trampoline_32.S 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*
  2. *
  3. * Trampoline.S Derived from Setup.S by Linus Torvalds
  4. *
  5. * 4 Jan 1997 Michael Chastain: changed to gnu as.
  6. *
  7. * This is only used for booting secondary CPUs in SMP machine
  8. *
  9. * Entry: CS:IP point to the start of our code, we are
  10. * in real mode with no stack, but the rest of the
  11. * trampoline page to make our stack and everything else
  12. * is a mystery.
  13. *
  14. * We jump into arch/x86/kernel/head_32.S.
  15. *
  16. * On entry to trampoline_start, the processor is in real mode
  17. * with 16-bit addressing and 16-bit data. CS has some value
  18. * and IP is zero. Thus, we load CS to the physical segment
  19. * of the real mode code before doing anything further.
  20. */
  21. #include <linux/linkage.h>
  22. #include <asm/segment.h>
  23. #include <asm/page_types.h>
  24. #include "realmode.h"
  25. .text
  26. .code16
  27. .balign PAGE_SIZE
  28. ENTRY(trampoline_start)
  29. wbinvd # Needed for NUMA-Q should be harmless for others
  30. LJMPW_RM(1f)
  31. 1:
  32. mov %cs, %ax # Code and data in the same place
  33. mov %ax, %ds
  34. cli # We should be safe anyway
  35. movl tr_start, %eax # where we need to go
  36. movl $0xA5A5A5A5, trampoline_status
  37. # write marker for master knows we're running
  38. /*
  39. * GDT tables in non default location kernel can be beyond 16MB and
  40. * lgdt will not be able to load the address as in real mode default
  41. * operand size is 16bit. Use lgdtl instead to force operand size
  42. * to 32 bit.
  43. */
  44. lidtl tr_idt # load idt with 0, 0
  45. lgdtl tr_gdt # load gdt with whatever is appropriate
  46. movw $1, %dx # protected mode (PE) bit
  47. lmsw %dx # into protected mode
  48. ljmpl $__BOOT_CS, $pa_startup_32
  49. .section ".text32","ax"
  50. .code32
  51. ENTRY(startup_32) # note: also used from wakeup_asm.S
  52. jmp *%eax
  53. .bss
  54. .balign 8
  55. GLOBAL(trampoline_header)
  56. tr_start: .space 4
  57. tr_gdt_pad: .space 2
  58. tr_gdt: .space 6
  59. END(trampoline_header)
  60. #include "trampoline_common.S"