wip: vbe still not working but let us cook
This commit is contained in:
parent
2a281522cf
commit
daf510687a
@ -6,6 +6,7 @@ struct vbe_interface {
|
||||
uint32_t *buff;
|
||||
uint16_t height;
|
||||
uint16_t width;
|
||||
uint32_t pitch;
|
||||
uint8_t bpp;
|
||||
};
|
||||
|
||||
|
@ -40,6 +40,6 @@ void kernel_main(multiboot_info_t *mbd, uint32_t magic)
|
||||
/* "complex 8*unknown quantity -byte descriptor table. -- Troy "
|
||||
*/
|
||||
/* "Martin 03:50, 22 March 2009 (UTC)\n"); */
|
||||
display.buff[1024] = 255;
|
||||
shell_init();
|
||||
memset(display.buff, 255, 1024 * 1024);
|
||||
/* shell_init(); */
|
||||
}
|
||||
|
@ -46,9 +46,8 @@ static void add_frame_node(multiboot_memory_map_t *mmmt)
|
||||
* this situation:
|
||||
* --------###############
|
||||
*/
|
||||
if (KERNEL_START > start_addr && KERNEL_START <= end_addr) {
|
||||
if (KERNEL_START > start_addr && KERNEL_START <= end_addr)
|
||||
len = ROUND_FLOOR(KERNEL_START - start_addr, PAGE_SIZE);
|
||||
}
|
||||
/** Kernel code end on the block
|
||||
* this situation:
|
||||
* ###############--------
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "vbe.h"
|
||||
|
||||
uint32_t multiboot_page_table[1024] __attribute__((aligned(PAGE_SIZE)));
|
||||
uint32_t vbe_page_table[1024] __attribute__((aligned(PAGE_SIZE)));
|
||||
multiboot_memory_map_t *mmap_addr;
|
||||
multiboot_uint32_t mmap_length;
|
||||
|
||||
@ -27,22 +28,25 @@ static void init_mmap(multiboot_info_t *mbd_virt, size_t *pt_index)
|
||||
*pt_index += i;
|
||||
}
|
||||
|
||||
static void init_vbe(multiboot_info_t *mbd_virt, size_t *pt_index)
|
||||
static void init_vbe(multiboot_info_t *mbd_virt)
|
||||
{
|
||||
const uint32_t framebuffer_size = mbd_virt->framebuffer_height *
|
||||
mbd_virt->framebuffer_width *
|
||||
CEIL(mbd_virt->framebuffer_bpp, 4);
|
||||
uint32_t i = 0;
|
||||
for (; i < CEIL(framebuffer_size, PAGE_SIZE); i++)
|
||||
multiboot_page_table[i + *pt_index] =
|
||||
for (; i < CEIL(framebuffer_size, PAGE_SIZE); i++) {
|
||||
if (i % 1024 == 0)
|
||||
page_directory[800 + i / 1024] =
|
||||
((uint32_t)vbe_page_table - HEAP_END) | 0x03;
|
||||
vbe_page_table[i % 1024] =
|
||||
((mbd_virt->framebuffer_addr + i * PAGE_SIZE) & PAGE_MASK) |
|
||||
INIT_FLAGS;
|
||||
display.buff = (uint32_t *)GET_PAGE_ADDR(1023, *pt_index) +
|
||||
}
|
||||
display.buff = (uint32_t *)GET_PAGE_ADDR(800 + i - 1 / 1024, 0) +
|
||||
(mbd_virt->framebuffer_addr % PAGE_SIZE);
|
||||
display.height = mbd_virt->framebuffer_height;
|
||||
display.width = mbd_virt->framebuffer_width;
|
||||
display.bpp = mbd_virt->framebuffer_bpp;
|
||||
*pt_index += i;
|
||||
}
|
||||
|
||||
void init_multiboot(multiboot_info_t *mbd, uint32_t magic)
|
||||
@ -64,5 +68,5 @@ void init_multiboot(multiboot_info_t *mbd, uint32_t magic)
|
||||
(multiboot_info_t *)(GET_PAGE_ADDR(1023, 0) +
|
||||
(uint32_t)mbd % PAGE_SIZE);
|
||||
init_mmap(mbd_virt, &pt_index);
|
||||
init_vbe(mbd, &pt_index);
|
||||
init_vbe(mbd_virt);
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ uint8_t terminal_get_default_color(void)
|
||||
|
||||
uint8_t terminal_get_char(int column, int row)
|
||||
{
|
||||
return screen->buffer[row * VGA_WIDTH + column];
|
||||
/* return screen->buffer[row * VGA_WIDTH + column]; */
|
||||
}
|
||||
|
||||
void terminal_putentryat(char c, uint8_t color, size_t x, size_t y)
|
||||
|
Loading…
Reference in New Issue
Block a user