draw pixels to screen to verify framebuffer access and multiboot info
This commit is contained in:
parent
8f9881889b
commit
06644a02f9
18
src/boot.S
18
src/boot.S
@ -1,7 +1,8 @@
|
||||
/* Declare constants for the multiboot header. */
|
||||
.set ALIGN, 1<<0 /* align loaded modules on page boundaries */
|
||||
.set MEMINFO, 1<<1 /* provide memory map */
|
||||
.set FLAGS, ALIGN | MEMINFO /* this is the Multiboot 'flag' field */
|
||||
.set VID, 1<<2
|
||||
.set FLAGS, ALIGN | MEMINFO | VID /* this is the Multiboot 'flag' field */
|
||||
.set MAGIC, 0x1BADB002 /* 'magic number' lets bootloader find the header */
|
||||
.set CHECKSUM, -(MAGIC + FLAGS) /* checksum of above, to prove we are multiboot */
|
||||
|
||||
@ -17,6 +18,15 @@ forced to be within the first 8 KiB of the kernel file.
|
||||
.long MAGIC
|
||||
.long FLAGS
|
||||
.long CHECKSUM
|
||||
.long 0
|
||||
.long 0
|
||||
.long 0
|
||||
.long 0
|
||||
.long 0
|
||||
.long 0
|
||||
.long 0
|
||||
.long 0
|
||||
.long 0
|
||||
|
||||
/*
|
||||
The multiboot standard does not define the value of the stack pointer register
|
||||
@ -75,7 +85,7 @@ _start:
|
||||
C++ features such as global constructors and exceptions will require
|
||||
runtime support to work as well.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
Enter the high-level kernel. The ABI requires the stack is 16-byte
|
||||
aligned at the time of the call instruction (which afterwards pushes
|
||||
@ -84,6 +94,10 @@ _start:
|
||||
stack since (pushed 0 bytes so far), so the alignment has thus been
|
||||
preserved and the call is well defined.
|
||||
*/
|
||||
push $0
|
||||
push $0
|
||||
push $0
|
||||
push %ebx
|
||||
call kernel_main
|
||||
|
||||
/*
|
||||
|
@ -1,9 +1,13 @@
|
||||
#include <stdint.h>
|
||||
|
||||
void kernel_main(void)
|
||||
void kernel_main(uint32_t mbinfo)
|
||||
{
|
||||
for (;;)
|
||||
volatile uint32_t * mbi = (volatile uint32_t *)mbinfo;
|
||||
volatile uint32_t * fb = (volatile uint32_t *)mbi[88 / 4];
|
||||
uint32_t c = 0u;
|
||||
for (uint32_t i = 0u; i < 800u * 600u; i++)
|
||||
{
|
||||
(*(volatile uint16_t *)0xB8000)++;
|
||||
c++;
|
||||
fb[i] = (c << 28u) | 0x00669900u | ((c << 4u) & 0xFFu);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user