trampoline_32.S 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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 <linux/init.h>
  23. #include <asm/segment.h>
  24. #include <asm/page_types.h>
  25. #include "realmode.h"
  26. .text
  27. .code16
  28. .balign PAGE_SIZE
  29. ENTRY(trampoline_start)
  30. wbinvd # Needed for NUMA-Q should be harmless for others
  31. LJMPW_RM(1f)
  32. 1:
  33. mov %cs, %ax # Code and data in the same place
  34. mov %ax, %ds
  35. cli # We should be safe anyway
  36. movl tr_start, %eax # where we need to go
  37. movl $0xA5A5A5A5, trampoline_status
  38. # write marker for master knows we're running
  39. /*
  40. * GDT tables in non default location kernel can be beyond 16MB and
  41. * lgdt will not be able to load the address as in real mode default
  42. * operand size is 16bit. Use lgdtl instead to force operand size
  43. * to 32 bit.
  44. */
  45. lidtl tr_idt # load idt with 0, 0
  46. lgdtl tr_gdt # load gdt with whatever is appropriate
  47. movw $1, %dx # protected mode (PE) bit
  48. lmsw %dx # into protected mode
  49. ljmpl $__BOOT_CS, $pa_startup_32
  50. .section ".text32","ax"
  51. .code32
  52. ENTRY(startup_32) # note: also used from wakeup_asm.S
  53. jmp *%eax
  54. .bss
  55. .balign 8
  56. GLOBAL(trampoline_header)
  57. tr_start: .space 4
  58. tr_gdt_pad: .space 2
  59. tr_gdt: .space 6
  60. END(trampoline_header)
  61. #include "trampoline_common.S"