diff options
-rw-r--r-- | apps/wm/wm.c | 7 | ||||
-rw-r--r-- | kernel/drivers/fb.c | 14 | ||||
-rw-r--r-- | kernel/features/mm.c | 1 | ||||
-rw-r--r-- | kernel/inc/proc.h | 2 |
4 files changed, 9 insertions, 15 deletions
diff --git a/apps/wm/wm.c b/apps/wm/wm.c index a81c594..2bbabf5 100644 --- a/apps/wm/wm.c +++ b/apps/wm/wm.c @@ -582,11 +582,6 @@ int main(int argc, char **argv) cursor = window_new(wm_client, vec2(0, 0), vec2(32, 32), WF_NO_DRAG | WF_NO_FOCUS | WF_NO_RESIZE | WF_ALPHA); - for (u32 i = 0; i < direct->ctx.bytes; i++) - direct->ctx.fb[i] = 0x42; - /* gfx_write(&direct->ctx, vec2(0, 0), FONT_32, COLOR_FG, "Loading Melvix..."); */ - while (1) - ; gfx_load_wallpaper(&wallpaper->ctx, "/res/wall.png"); memset(cursor->ctx.fb, 0, cursor->ctx.bytes); gfx_load_wallpaper(&cursor->ctx, "/res/cursor.png"); @@ -594,7 +589,7 @@ int main(int argc, char **argv) assert(io_control(IO_BUS, IOCTL_BUS_REGISTER, "wm") == EOK); - assert(exec("chess", NULL) == EOK); + /* assert(exec("chess", NULL) == EOK); */ u8 msg[1024] = { 0 }; struct event_keyboard event_keyboard = { 0 }; diff --git a/kernel/drivers/fb.c b/kernel/drivers/fb.c index 8831a52..8122654 100644 --- a/kernel/drivers/fb.c +++ b/kernel/drivers/fb.c @@ -12,6 +12,8 @@ #include <str.h> #include <sys.h> +#define FB_SIZE (vbe->height * vbe->pitch) + struct vbe_basic { u8 stuff1[16]; u16 pitch; @@ -27,8 +29,7 @@ PROTECTED static struct vbe_basic *vbe = NULL; static u32 fb_map_buffer(struct page_dir *dir) { assert(vbe); - u32 size = vbe->height * vbe->pitch; - return virtual_alloc(dir, memory_range_around((u32)vbe->fb, size), MEMORY_USER).base; + return virtual_alloc(dir, memory_range_around((u32)vbe->fb, FB_SIZE), MEMORY_USER).base; } static u32 fb_owner = 0; @@ -48,8 +49,7 @@ static res fb_ioctl(u32 request, void *arg1, void *arg2, void *arg3) if (fb_owner != 0 && proc_from_pid(fb_owner)) return -EBUSY; - else - fb_owner = proc_current()->pid; + fb_owner = proc_current()->pid; u32 fb = fb_map_buffer(proc_current()->page_dir); vbe->fb = (u8 *)fb; @@ -69,8 +69,6 @@ CLEAR void fb_install(void) dev->control = fb_ioctl; io_add(IO_FRAMEBUFFER, dev); - // Identity map framebuffer to kernel to prevent unwanted writing - u32 size = vbe->height * vbe->pitch; - memory_map_identity(virtual_kernel_dir(), memory_range_around((u32)vbe->fb, size), - MEMORY_CLEAR); + // Set framebuffer range used to prevent unwanted writing + physical_set_used(memory_range_around((u32)vbe->fb, FB_SIZE)); } diff --git a/kernel/features/mm.c b/kernel/features/mm.c index e60e2b5..7a39b33 100644 --- a/kernel/features/mm.c +++ b/kernel/features/mm.c @@ -136,6 +136,7 @@ static void physical_page_set_free(u32 address) CLEAR void physical_set_total(u32 total) { + assert(total > 0); memory_total = total; } diff --git a/kernel/inc/proc.h b/kernel/inc/proc.h index 000d77d..242a8d4 100644 --- a/kernel/inc/proc.h +++ b/kernel/inc/proc.h @@ -10,7 +10,7 @@ #include <sys.h> #define PROC_QUANTUM 42 // Milliseconds or something // TODO -#define PROC_STACK_SIZE (1 << 20) // 1MiB +#define PROC_STACK_SIZE 0x4000 // 16KiB #define EFLAGS_ALWAYS 0x2 // Always one #define EFLAGS_INTERRUPTS 0x200 // Enable interrupts |