2 * Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com)
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
8 * Amit Bhor, Sameer Dhavale: Codito Technologies 2004
10 #ifndef __ASM_ARC_PTRACE_H
11 #define __ASM_ARC_PTRACE_H
13 #include <uapi/asm/ptrace.h>
17 /* THE pt_regs: Defines how regs are saved during entry into kernel */
19 #ifdef CONFIG_ISA_ARCOMPACT
22 #ifdef CONFIG_ARC_PLAT_EZNPS
23 unsigned long eflags
; /* Extended FLAGS */
24 unsigned long gpa1
; /* General Purpose Aux */
28 unsigned long bta
; /* bta_l1, bta_l2, erbta */
30 unsigned long lp_start
, lp_end
, lp_count
;
32 unsigned long status32
; /* status32_l1, status32_l2, erstatus */
33 unsigned long ret
; /* ilink1, ilink2 or eret */
36 unsigned long r26
; /* gp */
38 unsigned long r12
, r11
, r10
, r9
, r8
, r7
, r6
, r5
, r4
, r3
, r2
, r1
, r0
;
40 unsigned long sp
; /* User/Kernel depending on where we came from */
41 unsigned long orig_r0
;
44 * To distinguish bet excp, syscall, irq
45 * For traps and exceptions, Exception Cause Register.
46 * ECR: <00> <VV> <CC> <PP>
47 * Last word used by Linux for extra state mgmt (syscall-restart)
48 * For interrupts, use artificial ECR values to note current prio-level
52 #ifdef CONFIG_CPU_BIG_ENDIAN
53 unsigned long state
:8, ecr_vec
:8,
54 ecr_cause
:8, ecr_param
:8;
56 unsigned long ecr_param
:8, ecr_cause
:8,
63 unsigned long user_r25
;
69 unsigned long orig_r0
;
73 #ifdef CONFIG_CPU_BIG_ENDIAN
74 unsigned long state
:8, ecr_vec
:8,
75 ecr_cause
:8, ecr_param
:8;
77 unsigned long ecr_param
:8, ecr_cause
:8,
84 unsigned long bta
; /* bta_l1, bta_l2, erbta */
86 unsigned long user_r25
;
88 unsigned long r26
; /* gp */
90 unsigned long sp
; /* user/kernel sp depending on where we came from */
92 unsigned long r12
, r30
;
94 #ifdef CONFIG_ARC_HAS_ACCL_REGS
95 unsigned long r58
, r59
; /* ACCL/ACCH used by FPU / DSP MPY */
98 /*------- Below list auto saved by h/w -----------*/
99 unsigned long r0
, r1
, r2
, r3
, r4
, r5
, r6
, r7
, r8
, r9
, r10
, r11
;
102 unsigned long lp_end
, lp_start
, lp_count
;
104 unsigned long ei
, ldi
, jli
;
107 unsigned long status32
;
112 /* Callee saved registers - need to be saved only when you are scheduled out */
115 unsigned long r25
, r24
, r23
, r22
, r21
, r20
, r19
, r18
, r17
, r16
, r15
, r14
, r13
;
118 #define instruction_pointer(regs) ((regs)->ret)
119 #define profile_pc(regs) instruction_pointer(regs)
121 /* return 1 if user mode or 0 if kernel mode */
122 #define user_mode(regs) (regs->status32 & STATUS_U_MASK)
124 #define user_stack_pointer(regs)\
125 ({ unsigned int sp; \
126 if (user_mode(regs)) \
133 /* return 1 if PC in delay slot */
134 #define delay_mode(regs) ((regs->status32 & STATUS_DE_MASK) == STATUS_DE_MASK)
136 #define in_syscall(regs) ((regs->ecr_vec == ECR_V_TRAP) && !regs->ecr_param)
137 #define in_brkpt_trap(regs) ((regs->ecr_vec == ECR_V_TRAP) && regs->ecr_param)
139 #define STATE_SCALL_RESTARTED 0x01
141 #define syscall_wont_restart(reg) (reg->state |= STATE_SCALL_RESTARTED)
142 #define syscall_restartable(reg) !(reg->state & STATE_SCALL_RESTARTED)
144 #define current_pt_regs() \
146 /* open-coded current_thread_info() */ \
147 register unsigned long sp asm ("sp"); \
148 unsigned long pg_start = (sp & ~(THREAD_SIZE - 1)); \
149 (struct pt_regs *)(pg_start + THREAD_SIZE) - 1; \
152 static inline long regs_return_value(struct pt_regs
*regs
)
154 return (long)regs
->r0
;
157 #endif /* !__ASSEMBLY__ */
159 #endif /* __ASM_PTRACE_H */