Commit f902cfdd authored by Josh Poimboeuf's avatar Josh Poimboeuf Committed by Peter Zijlstra
Browse files

x86,objtool: Introduce ORC_TYPE_*



Unwind hints and ORC entry types are two distinct things.  Separate them
out more explicitly.

Signed-off-by: default avatarJosh Poimboeuf <jpoimboe@kernel.org>
Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lore.kernel.org/r/cc879d38fff8a43f8f7beb2fd56e35a5a384d7cd.1677683419.git.jpoimboe@kernel.org
parent d88ebba4
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -39,6 +39,10 @@
#define ORC_REG_SP_INDIRECT		9
#define ORC_REG_MAX			15

#define ORC_TYPE_CALL			0
#define ORC_TYPE_REGS			1
#define ORC_TYPE_REGS_PARTIAL		2

#ifndef __ASSEMBLY__
#include <asm/byteorder.h>

+6 −6
Original line number Diff line number Diff line
@@ -133,7 +133,7 @@ static struct orc_entry null_orc_entry = {
	.sp_offset = sizeof(long),
	.sp_reg = ORC_REG_SP,
	.bp_reg = ORC_REG_UNDEFINED,
	.type = UNWIND_HINT_TYPE_CALL
	.type = ORC_TYPE_CALL
};

#ifdef CONFIG_CALL_THUNKS
@@ -153,7 +153,7 @@ static struct orc_entry *orc_callthunk_find(unsigned long ip)

/* Fake frame pointer entry -- used as a fallback for generated code */
static struct orc_entry orc_fp_entry = {
	.type		= UNWIND_HINT_TYPE_CALL,
	.type		= ORC_TYPE_CALL,
	.sp_reg		= ORC_REG_BP,
	.sp_offset	= 16,
	.bp_reg		= ORC_REG_PREV_SP,
@@ -554,7 +554,7 @@ bool unwind_next_frame(struct unwind_state *state)

	/* Find IP, SP and possibly regs: */
	switch (orc->type) {
	case UNWIND_HINT_TYPE_CALL:
	case ORC_TYPE_CALL:
		ip_p = sp - sizeof(long);

		if (!deref_stack_reg(state, ip_p, &state->ip))
@@ -567,7 +567,7 @@ bool unwind_next_frame(struct unwind_state *state)
		state->prev_regs = NULL;
		break;

	case UNWIND_HINT_TYPE_REGS:
	case ORC_TYPE_REGS:
		if (!deref_stack_regs(state, sp, &state->ip, &state->sp)) {
			orc_warn_current("can't access registers at %pB\n",
					 (void *)orig_ip);
@@ -590,13 +590,13 @@ bool unwind_next_frame(struct unwind_state *state)
		state->full_regs = true;
		break;

	case UNWIND_HINT_TYPE_REGS_PARTIAL:
	case ORC_TYPE_REGS_PARTIAL:
		if (!deref_stack_iret_regs(state, sp, &state->ip, &state->sp)) {
			orc_warn_current("can't access iret registers at %pB\n",
					 (void *)orig_ip);
			goto err;
		}
		/* See UNWIND_HINT_TYPE_REGS case comment. */
		/* See ORC_TYPE_REGS case comment. */
		state->ip = unwind_recover_rethook(state, state->ip,
				(unsigned long *)(state->sp - sizeof(long)));

+1 −0
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@ struct unwind_hint {
#define UNWIND_HINT_TYPE_CALL		0
#define UNWIND_HINT_TYPE_REGS		1
#define UNWIND_HINT_TYPE_REGS_PARTIAL	2
/* The below hint types don't have corresponding ORC types */
#define UNWIND_HINT_TYPE_FUNC		3
#define UNWIND_HINT_TYPE_ENTRY		4
#define UNWIND_HINT_TYPE_SAVE		5
+4 −0
Original line number Diff line number Diff line
@@ -39,6 +39,10 @@
#define ORC_REG_SP_INDIRECT		9
#define ORC_REG_MAX			15

#define ORC_TYPE_CALL			0
#define ORC_TYPE_REGS			1
#define ORC_TYPE_REGS_PARTIAL		2

#ifndef __ASSEMBLY__
#include <asm/byteorder.h>

+1 −0
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@ struct unwind_hint {
#define UNWIND_HINT_TYPE_CALL		0
#define UNWIND_HINT_TYPE_REGS		1
#define UNWIND_HINT_TYPE_REGS_PARTIAL	2
/* The below hint types don't have corresponding ORC types */
#define UNWIND_HINT_TYPE_FUNC		3
#define UNWIND_HINT_TYPE_ENTRY		4
#define UNWIND_HINT_TYPE_SAVE		5
Loading