1 /* 2 * Adapted from arch/arm64/kernel/asm-offsets.c 3 * 4 * Copyright (C) 2017, Red Hat Inc, Andrew Jones <drjones@redhat.com> 5 * 6 * This work is licensed under the terms of the GNU GPL, version 2. 7 */ 8 #include <libcflat.h> 9 #include <kbuild.h> 10 #include <asm/ptrace.h> 11 12 int main(void) 13 { 14 OFFSET(S_X0, pt_regs, regs[0]); 15 OFFSET(S_X1, pt_regs, regs[1]); 16 OFFSET(S_X2, pt_regs, regs[2]); 17 OFFSET(S_X3, pt_regs, regs[3]); 18 OFFSET(S_X4, pt_regs, regs[4]); 19 OFFSET(S_X5, pt_regs, regs[5]); 20 OFFSET(S_X6, pt_regs, regs[6]); 21 OFFSET(S_X7, pt_regs, regs[7]); 22 OFFSET(S_LR, pt_regs, regs[30]); 23 OFFSET(S_SP, pt_regs, sp); 24 OFFSET(S_PC, pt_regs, pc); 25 OFFSET(S_PSTATE, pt_regs, pstate); 26 OFFSET(S_ORIG_X0, pt_regs, orig_x0); 27 OFFSET(S_SYSCALLNO, pt_regs, syscallno); 28 29 /* FP and LR (16 bytes) go on the frame above pt_regs */ 30 DEFINE(S_FP, sizeof(struct pt_regs)); 31 DEFINE(S_FRAME_SIZE, (sizeof(struct pt_regs) + 16)); 32 33 return 0; 34 } 35