Fix some VESA woes
This commit is contained in:
parent
3b316b0603
commit
6cb9664b69
@ -47,6 +47,31 @@ struct multiboot
|
||||
uintptr_t vbe_interface_len;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
typedef struct {
|
||||
uint16_t attributes;
|
||||
uint8_t winA, winB;
|
||||
uint16_t granularity;
|
||||
uint16_t winsize;
|
||||
uint16_t segmentA, segmentB;
|
||||
uint32_t realFctPtr;
|
||||
uint16_t pitch;
|
||||
|
||||
uint16_t Xres, Yres;
|
||||
uint8_t Wchar, Ychar, planes, bpp, banks;
|
||||
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 rsv_mask, rsv_position;
|
||||
uint8_t directcolor_attributes;
|
||||
|
||||
uint32_t physbase;
|
||||
uint32_t reserved1;
|
||||
uint16_t reserved2;
|
||||
} __attribute__ ((packed)) vbe_info_t;
|
||||
|
||||
struct multiboot *copy_multiboot(struct multiboot *mboot_ptr);
|
||||
void dump_multiboot(struct multiboot *mboot_ptr);
|
||||
char * ramdisk;
|
||||
|
@ -310,6 +310,7 @@ extern uint16_t lfb_resolution_x;
|
||||
extern uint16_t lfb_resolution_y;
|
||||
extern uint16_t lfb_resolution_b;
|
||||
extern uintptr_t lfb_get_address();
|
||||
extern uint8_t * lfb_vid_memory;
|
||||
|
||||
/* BOCHS / QEMU VBE Driver */
|
||||
extern void graphics_install_bochs(uint16_t, uint16_t);
|
||||
|
@ -79,6 +79,10 @@ int main(struct multiboot *mboot, uint32_t mboot_mag, uintptr_t esp) {
|
||||
mboot_ptr = mboot;
|
||||
char cmdline_[1024];
|
||||
|
||||
if (mboot_ptr->vbe_mode_info) {
|
||||
lfb_vid_memory = (uint8_t *)((vbe_info_t *)(mboot_ptr->vbe_mode_info))->physbase;
|
||||
}
|
||||
|
||||
size_t len = strlen((char *)mboot_ptr->cmdline);
|
||||
memmove(cmdline_, (char *)mboot_ptr->cmdline, len + 1);
|
||||
|
||||
@ -150,7 +154,6 @@ int main(struct multiboot *mboot, uint32_t mboot_mag, uintptr_t esp) {
|
||||
ext2_ramdisk_mount((uintptr_t)ramdisk);
|
||||
}
|
||||
|
||||
|
||||
if (!fs_root) {
|
||||
kprintf("Nothing to do.\n");
|
||||
while (1) {
|
||||
|
@ -110,6 +110,16 @@ void graphics_install_preset(uint16_t w, uint16_t h) {
|
||||
herp[0] = 0xA5ADFACE;
|
||||
herp[1] = 0xFAF42943;
|
||||
|
||||
if (lfb_vid_memory) {
|
||||
for (uintptr_t i = (uintptr_t)lfb_vid_memory; i <= (uintptr_t)lfb_vid_memory + 0xFF0000; i += 0x1000) {
|
||||
dma_frame(get_page(i, 1, kernel_directory), 0, 1, i);
|
||||
}
|
||||
if (((uintptr_t *)lfb_vid_memory)[0] == 0xA5ADFACE && ((uintptr_t *)lfb_vid_memory)[1] == 0xFAF42943) {
|
||||
debug_print(INFO, "Was able to locate video memory at 0x%x without dicking around.", lfb_vid_memory);
|
||||
goto mem_found;
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 2; i < 1000; i += 2) {
|
||||
herp[i] = 0xFF00FF00;
|
||||
herp[i+1] = 0x00FF00FF;
|
||||
@ -125,6 +135,7 @@ void graphics_install_preset(uint16_t w, uint16_t h) {
|
||||
for (uintptr_t x = fb_offset; x < fb_offset + 0xFF0000; x += 0x1000) {
|
||||
if (((uintptr_t *)x)[0] == 0xA5ADFACE && ((uintptr_t *)x)[1] == 0xFAF42943) {
|
||||
lfb_vid_memory = (uint8_t *)x;
|
||||
debug_print(INFO, "Had to futz around, but found video memory at 0x%x", lfb_vid_memory);
|
||||
goto mem_found;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user