Advertisement
Guest User

Untitled

a guest
May 9th, 2012
264
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.03 KB | None | 0 0
  1. /*! startup.S - starting point of control after grub (boot loader) */
  2.  
  3. #define ASM_FILE        1
  4.  
  5. #include <arch/multiboot.h>
  6.  
  7. /* stack, startup function */
  8. .extern k_stack, k_startup
  9.  
  10. /* this code must be first in image for grub to find it easy */
  11. .section .text
  12.  
  13. /* entry point (required for grub) */
  14. .global arch_start
  15.  
  16. /* 32 bit alignment is required for following constants */
  17. .align  4
  18.  
  19. /* Multiboot header */
  20. multiboot_header:
  21.     /* magic */
  22.     .long   MULTIBOOT_HEADER_MAGIC
  23.     /* flags */
  24.     .long   MULTIBOOT_HEADER_FLAGS
  25.     /* checksum */
  26.     .long   -(MULTIBOOT_HEADER_MAGIC + MULTIBOOT_HEADER_FLAGS)
  27.  
  28. /* THE starting point */
  29. arch_start:
  30.     /* stack pointer initialization */
  31.     mov    $(k_stack + STACK_SIZE), %esp
  32.  
  33.     /* starting status register - EFLAGS register */
  34.     pushl   $0
  35.     popf
  36.  
  37.     /* copy multiboot parameters on stack as parameters to 'k_startup'
  38.        (parameters are already in eax:ebx registers), set by grub) */
  39.     push   %ebx
  40.     push   %eax
  41.  
  42.     call    k_startup
  43.  
  44.     /* stop */
  45.     cli
  46. loop:   hlt
  47.     jmp     loop
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement