2 * Copyright (C) 2017 Josh Poimboeuf <jpoimboe@redhat.com>
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, see <http://www.gnu.org/licenses/>.
21 #include <linux/types.h>
22 #include <linux/compiler.h>
25 * The ORC_REG_* registers are base registers which are used to find other
26 * registers on the stack.
28 * ORC_REG_PREV_SP, also known as DWARF Call Frame Address (CFA), is the
29 * address of the previous frame: the caller's SP before it called the current
32 * ORC_REG_UNDEFINED means the corresponding register's value didn't change in
35 * The most commonly used base registers are SP and BP -- which the previous SP
36 * is usually based on -- and PREV_SP and UNDEFINED -- which the previous BP is
39 * The rest of the base registers are needed for special cases like entry code
40 * and GCC realigned stacks.
42 #define ORC_REG_UNDEFINED 0
43 #define ORC_REG_PREV_SP 1
50 #define ORC_REG_BP_INDIRECT 8
51 #define ORC_REG_SP_INDIRECT 9
52 #define ORC_REG_MAX 15
55 * ORC_TYPE_CALL: Indicates that sp_reg+sp_offset resolves to PREV_SP (the
56 * caller's SP right before it made the call). Used for all callable
57 * functions, i.e. all C code and all callable asm functions.
59 * ORC_TYPE_REGS: Used in entry code to indicate that sp_reg+sp_offset points
60 * to a fully populated pt_regs from a syscall, interrupt, or exception.
62 * ORC_TYPE_REGS_IRET: Used in entry code to indicate that sp_reg+sp_offset
63 * points to the iret return frame.
65 #define ORC_TYPE_CALL 0
66 #define ORC_TYPE_REGS 1
67 #define ORC_TYPE_REGS_IRET 2
70 * This struct is more or less a vastly simplified version of the DWARF Call
71 * Frame Information standard. It contains only the necessary parts of DWARF
72 * CFI, simplified for ease of access by the in-kernel unwinder. It tells the
73 * unwinder how to find the previous SP and BP (and sometimes entry regs) on
74 * the stack for a given code address. Each instance of the struct corresponds
75 * to one or more code locations.
85 #endif /* _ORC_TYPES_H */