draw pixels to screen to verify framebuffer access and multiboot info
This commit is contained in:
parent
8f9881889b
commit
06644a02f9
16
src/boot.S
16
src/boot.S
@ -1,7 +1,8 @@
|
|||||||
/* Declare constants for the multiboot header. */
|
/* Declare constants for the multiboot header. */
|
||||||
.set ALIGN, 1<<0 /* align loaded modules on page boundaries */
|
.set ALIGN, 1<<0 /* align loaded modules on page boundaries */
|
||||||
.set MEMINFO, 1<<1 /* provide memory map */
|
.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 MAGIC, 0x1BADB002 /* 'magic number' lets bootloader find the header */
|
||||||
.set CHECKSUM, -(MAGIC + FLAGS) /* checksum of above, to prove we are multiboot */
|
.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 MAGIC
|
||||||
.long FLAGS
|
.long FLAGS
|
||||||
.long CHECKSUM
|
.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
|
The multiboot standard does not define the value of the stack pointer register
|
||||||
@ -84,6 +94,10 @@ _start:
|
|||||||
stack since (pushed 0 bytes so far), so the alignment has thus been
|
stack since (pushed 0 bytes so far), so the alignment has thus been
|
||||||
preserved and the call is well defined.
|
preserved and the call is well defined.
|
||||||
*/
|
*/
|
||||||
|
push $0
|
||||||
|
push $0
|
||||||
|
push $0
|
||||||
|
push %ebx
|
||||||
call kernel_main
|
call kernel_main
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1,9 +1,13 @@
|
|||||||
#include <stdint.h>
|
#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