feat(loader, kernel): impl part of loader and initialize kernel structure

This commit is contained in:
2026-04-11 09:42:09 +08:00
parent 1233ae9e9b
commit 34ccf69569
53 changed files with 1743 additions and 777 deletions

69
arch/x86_64/boot/header.S Normal file
View File

@@ -0,0 +1,69 @@
#include "multiboot2.h"
#include "kcapsule.h" // Auto-generated file
#include "boot.h"
.set falign, 0x200
.code16
.section ".header", "a"
.global _start
_start: // Just make linker happy
yuki_header:
.ascii "YUKIOS"
.quad 0x131084C
.org 0x50
.balign 8
multiboot2_header:
.long MULTIBOOT2_HEADER_MAGIC
.long MULTIBOOT_ARCHITECTURE_I386
.long multiboot2_header_end - multiboot2_header
.long -(MULTIBOOT2_HEADER_MAGIC + MULTIBOOT_ARCHITECTURE_I386 + (multiboot2_header_end - multiboot2_header))
.balign 8
address_tag:
.short MULTIBOOT_HEADER_TAG_ADDRESS
.short 0
.long address_tag_end - address_tag
.long LOAD_PHYSICAL_ADDR + multiboot2_header
.long -1
.long 0
.long 0
address_tag_end:
.balign 8
entry_tag:
.short MULTIBOOT_HEADER_TAG_ENTRY_ADDRESS
.short MULTIBOOT_HEADER_TAG_OPTIONAL
.long entry_tag_end - entry_tag
.long LOAD_PHYSICAL_ADDR + header_size + CAP_startup_32
entry_tag_end:
// entry_efi_i386_tag:
// .short MULTIBOOT_HEADER_TAG_ENTRY_ADDRESS_EFI32
// .short MULTIBOOT_HEADER_TAG_OPTIONAL
// .long entry_efi_i386_tag_end - entry_efi_i386_tag
// .long header_size + CAP_startup_32
// entry_efi_i386_tag_end:
// entry_efi_amd64_tag:
// .short MULTIBOOT_HEADER_TAG_ENTRY_ADDRESS_EFI64
// .short MULTIBOOT_HEADER_TAG_OPTIONAL
// .long entry_efi_amd64_tag_end - entry_efi_amd64_tag
// .long header_size + CAP_startup_64
// entry_efi_amd64_tag_end:
.balign 8
framebuffer_tag:
.short MULTIBOOT_HEADER_TAG_FRAMEBUFFER
.short MULTIBOOT_HEADER_TAG_OPTIONAL
.long framebuffer_tag_end - framebuffer_tag
.long 0
.long 0
.long 0
framebuffer_tag_end:
// .balign 8
// relocatable_tag:
// .short MULTIBOOT_HEADER_TAG_RELOCATABLE
// .short MULTIBOOT_HEADER_TAG_OPTIONAL
// .long relocatable_tag_end - relocatable_tag
// .long 0x0 /* min_addr */
// .long 0xf0000000 /* max_addr */
// .long falign /* align */
// .long 0x0
// relocatable_tag_end:
multiboot2_header_end:
.balign falign