mirror of
https://github.com/JannisHeydemann/BoredOS.git
synced 2026-05-30 02:16:58 +00:00
Memory fixes userspace
This commit is contained in:
@@ -39,3 +39,8 @@ void ui_mark_dirty(ui_window_t win, int x, int y, int w, int h) {
|
||||
uint64_t params[4] = { (uint64_t)x, (uint64_t)y, (uint64_t)w, (uint64_t)h };
|
||||
syscall3(SYS_GUI, GUI_CMD_MARK_DIRTY, (uint64_t)win, (uint64_t)params);
|
||||
}
|
||||
|
||||
void ui_draw_image(ui_window_t win, int x, int y, int w, int h, uint32_t *image_data) {
|
||||
uint64_t params[4] = { (uint64_t)x, (uint64_t)y, (uint64_t)w, (uint64_t)h };
|
||||
syscall4(SYS_GUI, GUI_CMD_DRAW_IMAGE, (uint64_t)win, (uint64_t)params, (uint64_t)image_data);
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#define GUI_CMD_MARK_DIRTY 4
|
||||
#define GUI_CMD_GET_EVENT 5
|
||||
#define GUI_CMD_DRAW_ROUNDED_RECT_FILLED 6
|
||||
#define GUI_CMD_DRAW_IMAGE 7
|
||||
|
||||
// Event Types
|
||||
#define GUI_EVENT_NONE 0
|
||||
@@ -42,5 +43,6 @@ void ui_draw_rect(ui_window_t win, int x, int y, int w, int h, uint32_t color);
|
||||
void ui_draw_rounded_rect_filled(ui_window_t win, int x, int y, int w, int h, int radius, uint32_t color);
|
||||
void ui_draw_string(ui_window_t win, int x, int y, const char *str, uint32_t color);
|
||||
void ui_mark_dirty(ui_window_t win, int x, int y, int w, int h);
|
||||
void ui_draw_image(ui_window_t win, int x, int y, int w, int h, uint32_t *image_data);
|
||||
|
||||
#endif
|
||||
|
||||
Binary file not shown.
@@ -24,9 +24,6 @@ static BlockMeta *find_free_block(BlockMeta **last, size_t size) {
|
||||
static BlockMeta *request_space(BlockMeta* last, size_t size) {
|
||||
BlockMeta *block;
|
||||
block = (BlockMeta *)sys_sbrk(0);
|
||||
// Ask for space, ensuring everything stays 8-byte aligned if sizes are odd.
|
||||
// For simplicity, we just request exactly what is needed,
|
||||
// but typically `size` should be aligned.
|
||||
size_t align = 8;
|
||||
if (size % align != 0) {
|
||||
size += align - (size % align);
|
||||
@@ -70,7 +67,6 @@ void *malloc(size_t size) {
|
||||
if (!block) return NULL;
|
||||
} else { // Found free block
|
||||
block->free = 0;
|
||||
// We could split the block here if block->size is much larger than size...
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -59,11 +59,10 @@ uint64_t syscall5(uint64_t sys_num, uint64_t arg1, uint64_t arg2, uint64_t arg3,
|
||||
return ret;
|
||||
}
|
||||
|
||||
// C-Friendly Wrappers
|
||||
|
||||
void sys_exit(int status) {
|
||||
syscall1(SYS_EXIT, (uint64_t)status);
|
||||
while (1); // Halt
|
||||
while (1);
|
||||
}
|
||||
|
||||
int sys_write(int fd, const char *buf, int len) {
|
||||
|
||||
Reference in New Issue
Block a user