diff options
| author | Franklin Wei <frankhwei536@gmail.com> | 2014-12-18 18:32:33 -0500 |
|---|---|---|
| committer | Franklin Wei <frankhwei536@gmail.com> | 2014-12-18 18:32:33 -0500 |
| commit | 1d7843c2b6d746376f87c2634c92cd93d8cdb728 (patch) | |
| tree | 751cb3ced99fefa577184f2a81c4688b0e3b15ab | |
| download | kappa-1d7843c2b6d746376f87c2634c92cd93d8cdb728.zip kappa-1d7843c2b6d746376f87c2634c92cd93d8cdb728.tar.gz kappa-1d7843c2b6d746376f87c2634c92cd93d8cdb728.tar.bz2 kappa-1d7843c2b6d746376f87c2634c92cd93d8cdb728.tar.xz | |
add boot stub
| -rw-r--r-- | boot.S | 31 |
1 files changed, 31 insertions, 0 deletions
@@ -0,0 +1,31 @@ + .set ALIGN, 1<<0 + .set MEMINFO, 1<<1 + .set FLAGS, ALIGN | MEMINFO + .set MAGIC, 0x1BADB002 # "1 Bad Boot" + .set CHECKSUM, -(MAGIC + FLAGS) + +.section .multiboot + .align 4 +multiboot_header: + .long MAGIC + .long FLAGS + .long CHECKSUM + +.section .stack +stack_bottom: # Stack grows up in addresses, so bottom is + # lower than the top + .skip 32768 # 32KB stack +stack_top: + +.section .text + .global _start + .type _start, @function +_start: # This is where execution begins + movl $stack_bottom, %esp # Initialize the stack + push %ebp # Add register ebp to the arguments of kernel_main + call kernel_main # Start the kernel, shouldn't return + cli + hlt +.kernel_hang: # Idle + jmp .kernel_hang + .size _start, . - _start |