Advertisement
dykow

Untitled

Dec 21st, 2017
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. .extern kernel_main
  2.  
  3. .global start
  4.  
  5. .set MB_MAGIC, 0x1BADB002          // This is a 'magic' constant that GRUB will use to detect our kernel's location.
  6. .set MB_FLAGS, (1 << 0) | (1 << 1)
  7. .set MB_CHECKSUM, (0 - (MB_MAGIC + MB_FLAGS))
  8.  
  9. .section .multiboot
  10.     .align 4
  11.     .long MB_MAGIC
  12.     .long MB_FLAGS
  13.     .long MB_CHECKSUM
  14.  
  15. .section .bss
  16.     .align 16
  17.     stack_bottom:
  18.         .skip 1024
  19.     stack_top:
  20.  
  21. .section .text
  22.     start:
  23.         mov $stack_top, %esp   // Set the stack pointer to the top of the stack
  24.  
  25.         call kernel_main
  26.  
  27.         hang:
  28.             cli
  29.             hlt
  30.             jmp hang
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement