Read framebuffer info from GRUB
This commit is contained in:
parent
fe8ab7fb70
commit
65b629e74a
@ -1,5 +1,18 @@
|
||||
#include "../cpu/cpu_init.h"
|
||||
#include <grub/text_fb_info.h>
|
||||
#include <stdlib.h>
|
||||
#include "multiboot.h"
|
||||
|
||||
void kmain() {
|
||||
void kmain(multiboot_info_t* header) {
|
||||
cpu_init();
|
||||
text_fb_info info;
|
||||
if (header->flags&MULTIBOOT_INFO_FRAMEBUFFER_INFO&&header->framebuffer_type==2) {
|
||||
info.address=(char*)((header->framebuffer_addr&0xFFFFFFFF)+0xC0000000);
|
||||
info.width=header->framebuffer_width;
|
||||
info.height=header->framebuffer_height;
|
||||
} else {
|
||||
info.address=(char*)0xC00B8000;
|
||||
info.width=80;
|
||||
info.height=25;
|
||||
}
|
||||
}
|
||||
|
12
libc/grub/text_fb_info.h
Normal file
12
libc/grub/text_fb_info.h
Normal file
@ -0,0 +1,12 @@
|
||||
#ifndef GRUB_TEXT_FB_INFO_H
|
||||
#define GRUB_TEXT_FB_INFO_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
typedef struct {
|
||||
char* address;
|
||||
uint32_t width;
|
||||
uint32_t height;
|
||||
} text_fb_info;
|
||||
|
||||
#endif
|
Loading…
x
Reference in New Issue
Block a user