Update
This commit is contained in:
parent
8e3d0d9991
commit
ea23e9eaf2
1 changed files with 12 additions and 19 deletions
|
@ -6,8 +6,8 @@
|
||||||
// the compiler does not optimise them away, so, usually, they should
|
// the compiler does not optimise them away, so, usually, they should
|
||||||
// be made volatile or equivalent.
|
// be made volatile or equivalent.
|
||||||
|
|
||||||
static volatile struct limine_terminal_request terminal_request = {
|
static volatile struct limine_framebuffer_request framebuffer_request = {
|
||||||
.id = LIMINE_TERMINAL_REQUEST,
|
.id = LIMINE_FRAMEBUFFER_REQUEST,
|
||||||
.revision = 0
|
.revision = 0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -68,15 +68,6 @@ int memcmp(const void *s1, const void *s2, size_t n) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Our quick and dirty strlen() implementation.
|
|
||||||
size_t strlen(const char *str) {
|
|
||||||
size_t ret = 0;
|
|
||||||
while (*str++) {
|
|
||||||
ret++;
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Halt and catch fire function.
|
// Halt and catch fire function.
|
||||||
static void hcf(void) {
|
static void hcf(void) {
|
||||||
asm ("cli");
|
asm ("cli");
|
||||||
|
@ -89,18 +80,20 @@ static void hcf(void) {
|
||||||
// If renaming _start() to something else, make sure to change the
|
// If renaming _start() to something else, make sure to change the
|
||||||
// linker script accordingly.
|
// linker script accordingly.
|
||||||
void _start(void) {
|
void _start(void) {
|
||||||
// Ensure we got a terminal
|
// Ensure we got a framebuffer.
|
||||||
if (terminal_request.response == NULL
|
if (framebuffer_request.response == NULL
|
||||||
|| terminal_request.response->terminal_count < 1) {
|
|| framebuffer_request.response->framebuffer_count < 1) {
|
||||||
hcf();
|
hcf();
|
||||||
}
|
}
|
||||||
|
|
||||||
// We should now be able to call the Limine terminal to print out
|
// Fetch the first framebuffer.
|
||||||
// a simple "Hello World" to screen.
|
struct limine_framebuffer *framebuffer = framebuffer_request.response->framebuffers[0];
|
||||||
const char *hello_msg = "Hello World";
|
|
||||||
|
|
||||||
struct limine_terminal *terminal = terminal_request.response->terminals[0];
|
// Note: we assume the framebuffer model is RGB with 32-bit pixels.
|
||||||
terminal_request.response->write(terminal, hello_msg, strlen(hello_msg));
|
for (size_t i = 0; i < 100; i++) {
|
||||||
|
uint32_t *fb_ptr = framebuffer->address;
|
||||||
|
fb_ptr[i * (framebuffer->pitch / 4) + i] = 0xffffff;
|
||||||
|
}
|
||||||
|
|
||||||
// We're done, just hang...
|
// We're done, just hang...
|
||||||
hcf();
|
hcf();
|
||||||
|
|
Loading…
Add table
Reference in a new issue