asm-offsets_64.c 1.8 KB
Newer Older
1
// SPDX-License-Identifier: GPL-2.0
2 3 4 5
#ifndef __LINUX_KBUILD_H
# error "Please do not build this file directly, build asm-offsets.c instead"
#endif

6
#include <asm/ia32.h>
7

8
#define __SYSCALL_64(nr, sym, qual) [nr] = 1,
9 10 11
static char syscalls_64[] = {
#include <asm/syscalls_64.h>
};
12
#define __SYSCALL_I386(nr, sym, qual) [nr] = 1,
13 14
static char syscalls_ia32[] = {
#include <asm/syscalls_32.h>
15 16
};

17 18 19 20
#if defined(CONFIG_KVM_GUEST) && defined(CONFIG_PARAVIRT_SPINLOCKS)
#include <asm/kvm_para.h>
#endif

21 22
int main(void)
{
23
#ifdef CONFIG_PARAVIRT
24
	OFFSET(PV_CPU_usergs_sysret64, pv_cpu_ops, usergs_sysret64);
25
	OFFSET(PV_CPU_swapgs, pv_cpu_ops, swapgs);
26 27 28
#ifdef CONFIG_DEBUG_ENTRY
	OFFSET(PV_IRQ_save_fl, pv_irq_ops, save_fl);
#endif
29
	BLANK();
30 31
#endif

32 33 34 35 36
#if defined(CONFIG_KVM_GUEST) && defined(CONFIG_PARAVIRT_SPINLOCKS)
	OFFSET(KVM_STEAL_TIME_preempted, kvm_steal_time, preempted);
	BLANK();
#endif

37
#define ENTRY(entry) OFFSET(pt_regs_ ## entry, pt_regs, entry)
38 39 40 41 42 43 44
	ENTRY(bx);
	ENTRY(cx);
	ENTRY(dx);
	ENTRY(sp);
	ENTRY(bp);
	ENTRY(si);
	ENTRY(di);
45 46 47 48 49 50 51 52
	ENTRY(r8);
	ENTRY(r9);
	ENTRY(r10);
	ENTRY(r11);
	ENTRY(r12);
	ENTRY(r13);
	ENTRY(r14);
	ENTRY(r15);
53
	ENTRY(flags);
54 55
	BLANK();
#undef ENTRY
56 57

#define ENTRY(entry) OFFSET(saved_context_ ## entry, saved_context, entry)
58 59 60 61 62
	ENTRY(cr0);
	ENTRY(cr2);
	ENTRY(cr3);
	ENTRY(cr4);
	ENTRY(cr8);
63
	ENTRY(gdt_desc);
64 65
	BLANK();
#undef ENTRY
66

67
	OFFSET(TSS_ist, tss_struct, x86_tss.ist);
68
	OFFSET(TSS_sp0, tss_struct, x86_tss.sp0);
69
	BLANK();
70

71 72 73 74 75
#ifdef CONFIG_CC_STACKPROTECTOR
	DEFINE(stack_canary_offset, offsetof(union irq_stack_union, stack_canary));
	BLANK();
#endif

76 77 78
	DEFINE(__NR_syscall_max, sizeof(syscalls_64) - 1);
	DEFINE(NR_syscalls, sizeof(syscalls_64));

79
	DEFINE(__NR_syscall_compat_max, sizeof(syscalls_ia32) - 1);
80
	DEFINE(IA32_NR_syscalls, sizeof(syscalls_ia32));
81

82 83
	return 0;
}