diff options
Diffstat (limited to 'arch/x86/boot')
-rw-r--r-- | arch/x86/boot/head.s | 27 | ||||
-rw-r--r-- | arch/x86/boot/kernel_entry.s | 12 |
2 files changed, 27 insertions, 12 deletions
diff --git a/arch/x86/boot/head.s b/arch/x86/boot/head.s new file mode 100644 index 0000000..a1bc6d1 --- /dev/null +++ b/arch/x86/boot/head.s @@ -0,0 +1,27 @@ +/* + head.s is loaded at 0x1000 (by second stage), its main goal + is run 32-bit startup code. + + After that manipulations it jumps to kernel written by C +*/ + +.code32 # Tell GAS to generate 32 bit code +.extern kernel_main + +.set CODESEG, 0x08 +.set DATASEG, 0x10 + +.global _start +_start: + mov $DATASEG, %ax # Point segment registers to the + mov %ax, %ds # data selector we defined in our GDT + mov %ax, %es + mov %ax, %ss + mov %ax, %fs + mov %ax, %gs + + mov $0x90000, %ebp # Update stack position so it is right + mov %ebp, %esp # at the top of the free space. + + call kernel_main + jmp . # infinite loop diff --git a/arch/x86/boot/kernel_entry.s b/arch/x86/boot/kernel_entry.s deleted file mode 100644 index e0fd132..0000000 --- a/arch/x86/boot/kernel_entry.s +++ /dev/null @@ -1,12 +0,0 @@ -# bootsect.s loads the kernel and transfers control to SYSSEG address. -# We cannot be sure that the main() function will be exactly at this -# address. - -# Therefore, we will use a small trick for entering the kernel correctly: -# Locate this small assembly routine at the beginning of the SYSSEG -# address => we can be sure that control will transfer to main() - -.code32 -.extern kernel_main - call kernel_main - jmp . |