Fix kernel remap by fixing section name & linker.

master
WangRunji 7 years ago
parent cea8ccdac9
commit a4988195ce

@ -1,7 +1,7 @@
global start global start
extern long_mode_start extern long_mode_start
section .text32 section .text
bits 32 bits 32
start: start:
mov esp, stack_top mov esp, stack_top
@ -149,7 +149,7 @@ error:
mov byte [0xb800a], al mov byte [0xb800a], al
hlt hlt
section .bss32 section .bss
align 4096 align 4096
p4_table: p4_table:
resb 4096 resb 4096
@ -161,7 +161,7 @@ stack_bottom:
resb 4096 * 4 resb 4096 * 4
stack_top: stack_top:
section .rodata32 section .rodata
gdt64: gdt64:
dq 0 ; zero entry dq 0 ; zero entry
.code: equ $ - gdt64 ; new .code: equ $ - gdt64 ; new

@ -6,21 +6,22 @@ KERNEL_OFFSET = 0xffffff0000000000;
SECTIONS { SECTIONS {
. = BOOT_OFFSET; . = BOOT_OFFSET;
.rodata32 : .rodata.32 :
{ {
/* ensure that the multiboot header is at the beginning */ /* ensure that the multiboot header is at the beginning */
KEEP(*(.multiboot_header)) KEEP(*(.multiboot_header))
*(.rodata32 .rodata32.*) */boot.o (.rodata)
. = ALIGN(4K); . = ALIGN(4K);
} }
.text32 : .text.32 :
{ {
*(.text32 .text32.*) */boot.o (.text)
*/long_mode_init.o (.text)
. = ALIGN(4K); . = ALIGN(4K);
} }
.bss32 : .bss.32 :
{ {
*(.bss32 .bss32.*) */boot.o (.bss)
. = ALIGN(4K); . = ALIGN(4K);
} }

@ -3,7 +3,7 @@ extern rust_main
KERNEL_OFFSET equ 0xffff_ff00_0000_0000 KERNEL_OFFSET equ 0xffff_ff00_0000_0000
section .text32 section .text
bits 64 bits 64
long_mode_start: long_mode_start:
; load 0 into all data segment registers ; load 0 into all data segment registers

Loading…
Cancel
Save