Guest User

Untitled

a guest
May 20th, 2018
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. .global loader # making entry point visible to linker
  2.  
  3. # setting up the Multiboot header - see GRUB docs for details
  4. .set ALIGN, 1<<0 # align loaded modules on page boundaries
  5. .set MEMINFO, 1<<1 # provide memory map
  6. .set FLAGS, ALIGN | MEMINFO # this is the Multiboot 'flag' field
  7. .set MAGIC, 0x1BADB002 # 'magic number' lets bootloader find the header
  8. .set CHECKSUM, -(MAGIC + FLAGS) # checksum required
  9.  
  10. .align 4
  11. .long MAGIC
  12. .long FLAGS
  13. .long CHECKSUM
  14.  
  15. # reserve initial kernel stack space
  16. .set STACKSIZE, 0x4000 # that is, 16k.
  17. .comm stack, STACKSIZE, 32 # reserve 16k stack on a quadword boundary
  18.  
  19. loader:
  20. mov $(stack + STACKSIZE), %esp # set up the stack
  21. push %eax # Multiboot magic number
  22. push %ebx # Multiboot data structure
  23.  
  24. call kmain # call kernel proper
  25.  
  26. cli
  27. hang:
  28. hlt # halt machine should kernel return
  29. jmp hang
Add Comment
Please, Sign In to add comment