File tree Expand file tree Collapse file tree 1 file changed +15
-7
lines changed Expand file tree Collapse file tree 1 file changed +15
-7
lines changed Original file line number Diff line number Diff line change
1
+ ; vi: ft=nasm
1
2
; Contains code from from the OSC lab project OOStuBS @ TU Dresden
2
3
3
4
; stack for the main function (renamed to _entry())
@@ -7,24 +8,31 @@ STACKSIZE: equ 65536
7
8
; DON'T MODIFY THIS UNLESS YOU UPDATE THE setup_paging accordingly
8
9
MAX_MEM: equ 512
9
10
11
+ ; be careful with the extern and exported symbols when mapping a higher-half
12
+ ; kernel: regardless where they are physically loaded
13
+ ; 1) extern symbols may have 64 bit virtual addresses or values. Do not use them
14
+ ; in the 32bit part of the startup code.
15
+ ; 2) if the exported (global) symbols are mapped to low (virtual) addresses,
16
+ ; they would be no longer accessable after the kernel switch to a higher half
17
+ ; mapping. This is especially true for the multiboot info data.
18
+
19
+
10
20
; exported symbols
11
21
[GLOBAL startup]
12
- [GLOBAL pml4]
13
- [GLOBAL pdp]
14
22
[GLOBAL mb_magic]
15
23
[GLOBAL mb_info_addr]
16
24
; functions from other parts of rustubs
17
- [EXTERN vectors_start]
18
- [EXTERN idt]
19
- [EXTERN idt_descr]
20
25
[EXTERN _entry]
21
-
22
- ; addresses provided by the linker
23
26
[EXTERN ___BSS_START__]
24
27
[EXTERN ___BSS_END__]
25
28
26
29
[SECTION .text]
27
30
31
+ ; symbols used in 32bit mode:
32
+ ; mb_magic
33
+ ; mab_info_addr
34
+ ; gdt_80
35
+ ; init_stack
28
36
[BITS 32]
29
37
startup:
30
38
cld
You can’t perform that action at this time.
0 commit comments