pmjump.S 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /* ----------------------------------------------------------------------- *
  2. *
  3. * Copyright (C) 1991, 1992 Linus Torvalds
  4. * Copyright 2007 rPath, Inc. - All Rights Reserved
  5. *
  6. * This file is part of the Linux kernel, and is made available under
  7. * the terms of the GNU General Public License version 2.
  8. *
  9. * ----------------------------------------------------------------------- */
  10. /*
  11. * arch/i386/boot/pmjump.S
  12. *
  13. * The actual transition into protected mode
  14. */
  15. #include <asm/boot.h>
  16. #include <asm/segment.h>
  17. .text
  18. .globl protected_mode_jump
  19. .type protected_mode_jump, @function
  20. .code16
  21. /*
  22. * void protected_mode_jump(u32 entrypoint, u32 bootparams);
  23. */
  24. protected_mode_jump:
  25. xorl %ebx, %ebx # Flag to indicate this is a boot
  26. movl %edx, %esi # Pointer to boot_params table
  27. movl %eax, 2f # Patch ljmpl instruction
  28. jmp 1f # Short jump to flush instruction q.
  29. 1:
  30. movw $__BOOT_DS, %cx
  31. movl %cr0, %edx
  32. orb $1, %dl # Protected mode (PE) bit
  33. movl %edx, %cr0
  34. movw %cx, %ds
  35. movw %cx, %es
  36. movw %cx, %fs
  37. movw %cx, %gs
  38. movw %cx, %ss
  39. # Jump to the 32-bit entrypoint
  40. .byte 0x66, 0xea # ljmpl opcode
  41. 2: .long 0 # offset
  42. .word __BOOT_CS # segment
  43. .size protected_mode_jump, .-protected_mode_jump