2 ** Copyright 2001, Travis Geiselbrecht. All rights reserved.
3 ** Distributed under the terms of the NewOS License.
5 // expects a stack page like this:
6 // (stack has to be at (0x9e000)
10 // 0x9e000 - 0x9e006 : gdt descriptor
11 // 0x9e008 - 0x9e020 : gdt
13 // smp_trampoline must be located at 0x9f000
15 .globl smp_trampoline_end
25 // lgdt 0x9e000 # load the gdt
26 .byte 0x66, 0x0f, 0x01, 0x15, 0x00, 0xe0, 0x09, 0x00
30 movl %eax,%cr0 # switch into protected mode
35 ljmp $0x08,$(trampoline_32 - smp_trampoline + 0x9f000)
44 movl $0x9eff8,%esp # set up the stack pointer
46 popl %eax # get the page dir
47 movl %eax,%cr3 # set the page dir
49 popl %eax # get the final stack location
52 // load an address for an indirect jump
53 movl $trampoline_after_paging,%ecx
57 movl %eax,%cr0 # enable paging
59 // jump to the address previously loaded. NOTE:
60 // this address is the address at which the code is originally linked,
61 // which is > 1MB. We will be out of the low memory at this point.
63 trampoline_after_paging:
64 // just return, the bsp would have set the return address to the
65 // target function at the top of the passed stack