Commit 58d9ceb7 authored by Vineet Gupta's avatar Vineet Gupta
Browse files

ARC: pt_regs: create seperate type for ecr



Reduces duplication in each ISA specific pt_regs

Tested-by: default avatarkernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202308151342.ROQ9Urvv-lkp@intel.com


Signed-off-by: default avatarVineet Gupta <vgupta@kernel.org>
parent d4624bf6
Loading
Loading
Loading
Loading
+18 −29
Original line number Diff line number Diff line
@@ -12,6 +12,17 @@

#ifndef __ASSEMBLY__

typedef union {
	struct {
#ifdef CONFIG_CPU_BIG_ENDIAN
		unsigned long state:8, vec:8, cause:8, param:8;
#else
		unsigned long param:8, cause:8, vec:8, state:8;
#endif
	};
	unsigned long full;
} ecr_reg;

/* THE pt_regs: Defines how regs are saved during entry into kernel */

#ifdef CONFIG_ISA_ARCOMPACT
@@ -40,21 +51,10 @@ struct pt_regs {
	 * 	Last word used by Linux for extra state mgmt (syscall-restart)
	 * For interrupts, use artificial ECR values to note current prio-level
	 */
	union {
		struct {
#ifdef CONFIG_CPU_BIG_ENDIAN
			unsigned long state:8, ecr_vec:8,
				      ecr_cause:8, ecr_param:8;
#else
			unsigned long ecr_param:8, ecr_cause:8,
				      ecr_vec:8, state:8;
#endif
		};
		unsigned long event;
	};
	ecr_reg ecr;
};

#define MAX_REG_OFFSET offsetof(struct pt_regs, event)
#define MAX_REG_OFFSET offsetof(struct pt_regs, ecr)

#else

@@ -62,18 +62,7 @@ struct pt_regs {

	unsigned long orig_r0;

	union {
		struct {
#ifdef CONFIG_CPU_BIG_ENDIAN
			unsigned long state:8, ecr_vec:8,
				      ecr_cause:8, ecr_param:8;
#else
			unsigned long ecr_param:8, ecr_cause:8,
				      ecr_vec:8, state:8;
#endif
		};
		unsigned long event;
	};
	ecr_reg ecr;		/* Exception Cause Reg */

	unsigned long bta;	/* erbta */

@@ -131,13 +120,13 @@ struct callee_regs {
/* return 1 if PC in delay slot */
#define delay_mode(regs) ((regs->status32 & STATUS_DE_MASK) == STATUS_DE_MASK)

#define in_syscall(regs)    ((regs->ecr_vec == ECR_V_TRAP) && !regs->ecr_param)
#define in_brkpt_trap(regs) ((regs->ecr_vec == ECR_V_TRAP) && regs->ecr_param)
#define in_syscall(regs)    ((regs->ecr.vec == ECR_V_TRAP) && !regs->ecr.param)
#define in_brkpt_trap(regs) ((regs->ecr.vec == ECR_V_TRAP) && regs->ecr.param)

#define STATE_SCALL_RESTARTED	0x01

#define syscall_wont_restart(reg) (reg->state |= STATE_SCALL_RESTARTED)
#define syscall_restartable(reg) !(reg->state &  STATE_SCALL_RESTARTED)
#define syscall_wont_restart(regs) (regs->ecr.state |= STATE_SCALL_RESTARTED)
#define syscall_restartable(regs) !(regs->ecr.state &  STATE_SCALL_RESTARTED)

#define current_pt_regs()					\
({								\
+1 −1
Original line number Diff line number Diff line
@@ -46,7 +46,7 @@ int main(void)
	BLANK();

	DEFINE(PT_status32, offsetof(struct pt_regs, status32));
	DEFINE(PT_event, offsetof(struct pt_regs, event));
	DEFINE(PT_event, offsetof(struct pt_regs, ecr));
	DEFINE(PT_bta, offsetof(struct pt_regs, bta));
	DEFINE(PT_sp, offsetof(struct pt_regs, sp));
	DEFINE(PT_r0, offsetof(struct pt_regs, r0));
+1 −1
Original line number Diff line number Diff line
@@ -175,7 +175,7 @@ void kgdb_trap(struct pt_regs *regs)
	 * with trap_s 4 (compiled) breakpoints, continuation needs to
	 * start after the breakpoint.
	 */
	if (regs->ecr_param == 3)
	if (regs->ecr.param == 3)
		instruction_pointer(regs) -= BREAK_INSTR_SIZE;

	kgdb_handle_exception(1, SIGTRAP, 0, regs);
+2 −2
Original line number Diff line number Diff line
@@ -46,7 +46,7 @@ static const struct pt_regs_offset regoffset_table[] = {
	REG_OFFSET_NAME(r0),
	REG_OFFSET_NAME(sp),
	REG_OFFSET_NAME(orig_r0),
	REG_OFFSET_NAME(event),
	REG_OFFSET_NAME(ecr),
	REG_OFFSET_END,
};

@@ -54,7 +54,7 @@ static const struct pt_regs_offset regoffset_table[] = {

static const struct pt_regs_offset regoffset_table[] = {
	REG_OFFSET_NAME(orig_r0),
	REG_OFFSET_NAME(event),
	REG_OFFSET_NAME(ecr),
	REG_OFFSET_NAME(bta),
	REG_OFFSET_NAME(r26),
	REG_OFFSET_NAME(fp),
+1 −3
Original line number Diff line number Diff line
@@ -110,9 +110,7 @@ void do_machine_check_fault(unsigned long address, struct pt_regs *regs)
 */
void do_non_swi_trap(unsigned long address, struct pt_regs *regs)
{
	unsigned int param = regs->ecr_param;

	switch (param) {
	switch (regs->ecr.param) {
	case 1:
		trap_is_brkpt(address, regs);
		break;
Loading