arch/openrisc/include/asm/ptrace.h

Source file repositories/reference/linux-study-clean/arch/openrisc/include/asm/ptrace.h

File Facts

System
Linux kernel
Corpus path
arch/openrisc/include/asm/ptrace.h
Extension
.h
Size
4852 bytes
Lines
191
Domain
Architecture Layer
Bucket
arch/openrisc
Inferred role
Architecture Layer: implementation source
Status
source implementation candidate

Why This File Exists

CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.

Dependency Surface

Detected Declarations

Annotated Snippet

struct pt_regs {
	union {
		struct {
			/* Named registers */
			long  sr;	/* Stored in place of r0 */
			long  sp;	/* r1 */
			long  gpr2;
			long  gpr3;
			long  gpr4;
			long  gpr5;
			long  gpr6;
			long  gpr7;
			long  gpr8;
			long  gpr9;
			long  gpr10;
			long  gpr11;
			long  gpr12;
			long  gpr13;
			long  gpr14;
			long  gpr15;
			long  gpr16;
			long  gpr17;
			long  gpr18;
			long  gpr19;
			long  gpr20;
			long  gpr21;
			long  gpr22;
			long  gpr23;
			long  gpr24;
			long  gpr25;
			long  gpr26;
			long  gpr27;
			long  gpr28;
			long  gpr29;
			long  gpr30;
			long  gpr31;
		};
		struct {
			/* Old style */
			long offset[2];
			long gprs[30];
		};
		struct {
			/* New style */
			long gpr[32];
		};
	};
	long  pc;
	/* For restarting system calls:
	 * Set to syscall number for syscall exceptions,
	 * -1 for all other exceptions.
	 */
	long  orig_gpr11;	/* For restarting system calls */
	long dummy;		/* Cheap alignment fix */
	long dummy2;		/* Cheap alignment fix */
};

/* TODO: Rename this to REDZONE because that's what it is */
#define STACK_FRAME_OVERHEAD  128  /* size of minimum stack frame */

#define MAX_REG_OFFSET offsetof(struct pt_regs, orig_gpr11)

/* Helpers for working with the instruction pointer */
static inline unsigned long instruction_pointer(struct pt_regs *regs)
{
	return (unsigned long)regs->pc;
}
static inline void instruction_pointer_set(struct pt_regs *regs,
					   unsigned long val)
{
	regs->pc = val;
}

#define user_mode(regs)			(((regs)->sr & SPR_SR_SM) == 0)
#define user_stack_pointer(regs)	((unsigned long)(regs)->sp)
#define profile_pc(regs)		instruction_pointer(regs)

/* Valid only for Kernel mode traps. */
static inline unsigned long kernel_stack_pointer(struct pt_regs *regs)
{
	return (unsigned long)regs->sp;
}

static inline long regs_return_value(struct pt_regs *regs)
{
	return regs->gpr[11];
}

extern int regs_query_register_offset(const char *name);
extern unsigned long regs_get_kernel_stack_nth(struct pt_regs *regs,

Annotation

Implementation Notes