diff options
| author | Tianhao Wang <shrik3@mailbox.org> | 2024-05-31 22:59:47 +0200 |
|---|---|---|
| committer | Tianhao Wang <shrik3@mailbox.org> | 2024-06-11 15:17:11 +0200 |
| commit | 4ea057856f72d89aee1e503099dcf81bd4eed49a (patch) | |
| tree | 2c722dca5e88abe525753648be9ab51cb9907d23 | |
| parent | 2335398b704e1fb2fa561f7dd115f89c69c58bb7 (diff) | |
chore: cleanup startup code
| -rw-r--r-- | boot/startup-x86_64.s | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/boot/startup-x86_64.s b/boot/startup-x86_64.s index fb65a71..2c7562e 100644 --- a/boot/startup-x86_64.s +++ b/boot/startup-x86_64.s @@ -1,3 +1,4 @@ +; vi: ft=nasm ; Contains code from from the OSC lab project OOStuBS @ TU Dresden ; stack for the main function (renamed to _entry()) @@ -7,24 +8,31 @@ STACKSIZE: equ 65536 ; DON'T MODIFY THIS UNLESS YOU UPDATE THE setup_paging accordingly MAX_MEM: equ 512 +; be careful with the extern and exported symbols when mapping a higher-half +; kernel: regardless where they are physically loaded +; 1) extern symbols may have 64 bit virtual addresses or values. Do not use them +; in the 32bit part of the startup code. +; 2) if the exported (global) symbols are mapped to low (virtual) addresses, +; they would be no longer accessable after the kernel switch to a higher half +; mapping. This is especially true for the multiboot info data. + + ; exported symbols [GLOBAL startup] -[GLOBAL pml4] -[GLOBAL pdp] [GLOBAL mb_magic] [GLOBAL mb_info_addr] ; functions from other parts of rustubs -[EXTERN vectors_start] -[EXTERN idt] -[EXTERN idt_descr] [EXTERN _entry] - -; addresses provided by the linker [EXTERN ___BSS_START__] [EXTERN ___BSS_END__] [SECTION .text] +; symbols used in 32bit mode: +; mb_magic +; mab_info_addr +; gdt_80 +; init_stack [BITS 32] startup: cld |
