1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Copyright (C) 2003,2004 Eric Biederman (ebiederm@xmission.com)
4 * Copyright (C) 2014 Red Hat Inc.
6 * Author(s): Vivek Goyal <vgoyal@redhat.com>
8 * This code has been taken from kexec-tools.
11 #include <linux/linkage.h>
17 SYM_CODE_START(entry64)
18 /* Setup a gdt that should be preserved */
21 /* load the data segments */
22 movl $0x18, %eax /* data segment */
30 leaq stack_init(%rip), %rsp
32 leaq new_cs_exit(%rip), %rax
37 /* Load the registers */
55 /* Jump to the new code... */
61 SYM_DATA_START(entry64_regs)
79 SYM_DATA_END(entry64_regs)
84 SYM_DATA_START_LOCAL(gdt)
86 * 0x00 unusable segment
88 * so use them as gdt ptr
90 .word gdt_end - gdt - 1
94 /* 0x10 4GB flat code segment */
95 .word 0xFFFF, 0x0000, 0x9A00, 0x00AF
97 /* 0x18 4GB flat data segment */
98 .word 0xFFFF, 0x0000, 0x9200, 0x00CF
99 SYM_DATA_END_LABEL(gdt, SYM_L_LOCAL, gdt_end)
101 SYM_DATA_START_LOCAL(stack)
103 SYM_DATA_END_LABEL(stack, SYM_L_LOCAL, stack_init)