69 lines
1.5 KiB
ArmAsm
69 lines
1.5 KiB
ArmAsm
.set ALIGN, 1<<0 /* align loaded modules on page boundaries */
|
|
.set MEMINFO, 1<<1 /* provide memory map */
|
|
.set GRAPHICS, 1<<2 /* <-- NEW: Request video mode table/framebuffer from GRUB */
|
|
.set FLAGS, ALIGN | MEMINFO | GRAPHICS /* Updated to include GRAPHICS */
|
|
.set MAGIC, 0x1BADB002 /* 'magic number' lets bootloader find the header */
|
|
.set CHECKSUM, -(MAGIC + FLAGS) /* recalculated checksum of the new flags */
|
|
|
|
.section .multiboot, "a"
|
|
.align 4
|
|
.long MAGIC
|
|
.long FLAGS
|
|
.long CHECKSUM
|
|
|
|
.long 0 /* header_addr */
|
|
.long 0 /* load_addr */
|
|
.long 0 /* load_end_addr */
|
|
.long 0 /* bss_end_addr */
|
|
.long 0 /* entry_addr */
|
|
|
|
.long 0 /* Mode Type: 0 = Linear Framebuffer, 1 = Standard EGA Text */
|
|
.long 1024 /* Width (Pixels) */
|
|
.long 768 /* Height (Pixels) */
|
|
.long 32 /* Color Depth (Bits Per Pixel) */
|
|
|
|
.section .text
|
|
.global _start
|
|
_start:
|
|
cli
|
|
|
|
mov $(page_directory - 0xC0000000), %ecx
|
|
|
|
mov %cr4, %edx
|
|
or $0x00000010, %edx
|
|
mov %edx, %cr4
|
|
|
|
mov %ecx, %cr3
|
|
|
|
mov %cr0, %edx
|
|
or $0x80000000, %edx
|
|
mov %edx, %cr0
|
|
|
|
lea higher, %ecx
|
|
jmp *%ecx
|
|
higher:
|
|
mov $stack_top, %esp
|
|
mov $0xC0000000, %eax
|
|
add %eax, %ebx
|
|
push %ebx
|
|
push %eax
|
|
call kmain
|
|
loop:
|
|
hlt
|
|
jmp loop
|
|
|
|
.section .bss
|
|
.align 16
|
|
stack_bottom:
|
|
.skip 16384 # 16 KiB
|
|
stack_top:
|
|
|
|
.section .data, "a"
|
|
.align 4096
|
|
.global page_directory
|
|
page_directory:
|
|
.long 0x00000083
|
|
.skip 3068
|
|
.long 0x00000083
|
|
.skip 1016
|
|
.long (page_directory - 0xC0000000) + 0x03 |