diff options
author | Alex Auvolat <alex@adnab.me> | 2015-03-10 16:12:03 +0100 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2015-03-10 16:12:03 +0100 |
commit | 48c1c4dcc449d05e9950a861e165f456e0d583a1 (patch) | |
tree | 1107e6a6779d16824055e358eb04a45fc5365b63 /src/kernel | |
parent | c6068c0bce5cf764846e775d3509b1a82af4a0e5 (diff) | |
download | kogata-48c1c4dcc449d05e9950a861e165f456e0d583a1.tar.gz kogata-48c1c4dcc449d05e9950a861e165f456e0d583a1.zip |
Rename & cleanup.
Diffstat (limited to 'src/kernel')
-rw-r--r-- | src/kernel/dev/vesa.c | 37 | ||||
-rw-r--r-- | src/kernel/include/ipc.h | 3 | ||||
-rw-r--r-- | src/kernel/include/process.h | 4 | ||||
-rw-r--r-- | src/kernel/include/sct.h | 2 | ||||
-rw-r--r-- | src/kernel/include/vfs.h | 2 |
5 files changed, 38 insertions, 10 deletions
diff --git a/src/kernel/dev/vesa.c b/src/kernel/dev/vesa.c index 1880740..2a7b876 100644 --- a/src/kernel/dev/vesa.c +++ b/src/kernel/dev/vesa.c @@ -1,6 +1,6 @@ #include <string.h> -#include <framebuffer.h> // common header +#include <proto/fb.h> #include <vfs.h> #include <nullfs.h> @@ -184,9 +184,9 @@ typedef struct { uint8_t memory_model, bank_size, image_pages; uint8_t reserved0; - uint8_t red_mask, red_position; - uint8_t green_mask, green_position; - uint8_t blue_mask, blue_position; + uint8_t red_mask_sz, red_position; + uint8_t green_mask_sz, green_position; + uint8_t blue_mask_sz, blue_position; uint8_t rsv_mask, rsv_position; uint8_t directcolor_attributes; @@ -241,6 +241,19 @@ fs_node_ops_t vesa_fs_ops = { .dispose = 0, }; +static struct fb_memory_model { + int bpp, rp, gp, bp, rs, gs, bs, mm; +} fb_memory_models[8] = { + { 15, 10, 5, 0, 5, 5, 5, FB_MM_RGB16 }, + { 16, 10, 5, 0, 5, 5, 5, FB_MM_RGB16 }, + { 15, 0, 5, 10, 5, 5, 5, FB_MM_BGR16 }, + { 16, 0, 5, 10, 5, 5, 5, FB_MM_BGR16 }, + { 24, 16, 8, 0, 8, 8, 8, FB_MM_RGB24 }, + { 24, 0, 8, 16, 8, 8, 8, FB_MM_BGR24 }, + { 32, 16, 8, 0, 8, 8, 8, FB_MM_RGB32 }, + { 32, 0, 8, 16, 8, 8, 8, FB_MM_BGR32 }, +}; + void vesa_detect(fs_t *iofs) { if (!v86_begin_session()) return; @@ -280,13 +293,27 @@ void vesa_detect(fs_t *iofs) { if (!v86_bios_int(0x10) || v86_regs.ax != 0x004F) continue; if ((mi->attributes & 0x90) != 0x90) continue; // not linear framebuffer - if (mi->memory_model != 4 && mi->memory_model != 6) continue; + if (mi->memory_model != 6) continue; int x = mode_data_c; mode_data[x].info.width = mi->Xres; mode_data[x].info.height = mi->Yres; mode_data[x].info.bpp = mi->bpp; mode_data[x].info.pitch = mi->pitch; + + mode_data[x].info.memory_model = 0; + for (int j = 0; j < 8; j++) { + struct fb_memory_model m = fb_memory_models[j]; + if (mi->bpp == m.bpp + && mi->red_mask_sz == m.rs && mi->red_position == m.rp + && mi->green_mask_sz == m.gs && mi->green_position == m.gp + && mi->blue_mask_sz == m.bs && mi->blue_position == m.bp) + mode_data[x].info.memory_model = m.mm; + } + if (mode_data[x].info.memory_model == 0) continue; + + dbg_printf("VESA mode: %dx%dx%d (%d)\n", mi->Xres, mi->Yres, mi->bpp, mode_data[x].info.memory_model); + mode_data[x].phys_fb_addr = (void*)mi->physbase; mode_data[x].vesa_mode_id = *mode; mode_data_c++; diff --git a/src/kernel/include/ipc.h b/src/kernel/include/ipc.h index 0feddf2..05d14a8 100644 --- a/src/kernel/include/ipc.h +++ b/src/kernel/include/ipc.h @@ -1,6 +1,7 @@ #pragma once -#include <token.h> +#include <proto/token.h> + #include <vfs.h> // ---- Communication channels diff --git a/src/kernel/include/process.h b/src/kernel/include/process.h index 3b98451..d4fcfc3 100644 --- a/src/kernel/include/process.h +++ b/src/kernel/include/process.h @@ -17,8 +17,8 @@ #include <vfs.h> #include <pager.h> -#include <mmap.h> // common header for mmaps -#include <proc.h> // common header defining process statuses +#include <proto/mmap.h> +#include <proto/proc.h> #define USERSTACK_ADDR 0xB8000000 #define USERSTACK_SIZE 0x00020000 // 32 KB - it is allocated on demand so no worries diff --git a/src/kernel/include/sct.h b/src/kernel/include/sct.h index 2d6acd5..8f675b1 100644 --- a/src/kernel/include/sct.h +++ b/src/kernel/include/sct.h @@ -1,7 +1,7 @@ #pragma once #include <idt.h> -#include <syscallproto.h> +#include <proto/syscall.h> void setup_syscall_table(); diff --git a/src/kernel/include/vfs.h b/src/kernel/include/vfs.h index 3d225c5..c22ec9a 100644 --- a/src/kernel/include/vfs.h +++ b/src/kernel/include/vfs.h @@ -6,7 +6,7 @@ #include <hashtbl.h> #include <mutex.h> -#include <fs.h> // common header +#include <proto/fs.h> #include <pager.h> |