1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #define WAKEUP_BASE 0x600
4 #define RELOCATED(x) (x - __wakeup + WAKEUP_BASE)
37 /* disable long mode */
43 /* First prepare the jmp to the resume vector */
44 mov 0x4(%esp), %eax /* vector */
45 /* last 4 bits of linear addr are taken as offset */
47 movw %ax, (__wakeup_offset)
49 /* the rest is taken as segment */
51 movw %ax, (__wakeup_segment)
53 /* Activate the right segment descriptor real mode. */
54 ljmp $0x28, $RELOCATED(1f)
57 /* 16 bit code from here on... */
59 /* Load the segment registers w/ properly configured
60 * segment descriptors. They will retain these
61 * configurations (limits, writability, etc.) once
62 * protected mode is turned off.
71 /* Turn off protection */
76 /* Now really going into real mode */
77 ljmp $0, $RELOCATED(1f)
86 /* This is a FAR JMP to the OS waking vector. The C code changed
87 * the address to be correct.
91 __wakeup_offset = RELOCATED(.)
94 __wakeup_segment = RELOCATED(.)