Merge tag 'v3.3.7' into 3.3/master
[zen-stable.git] / arch / hexagon / include / asm / registers.h
blob4dd741be855d209ecf23e86586be29e287450efa
1 /*
2 * Register definitions for the Hexagon architecture
4 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 and
8 * only version 2 as published by the Free Software Foundation.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 * 02110-1301, USA.
21 #ifndef _ASM_REGISTERS_H
22 #define _ASM_REGISTERS_H
24 #define SP r29
26 #ifndef __ASSEMBLY__
28 /* See kernel/entry.S for further documentation. */
31 * Entry code copies the event record out of guest registers into
32 * this structure (which is on the stack).
35 struct hvm_event_record {
36 unsigned long vmel; /* Event Linkage (return address) */
37 unsigned long vmest; /* Event context - pre-event SSR values */
38 unsigned long vmpsp; /* Previous stack pointer */
39 unsigned long vmbadva; /* Bad virtual address for addressing events */
42 struct pt_regs {
43 long restart_r0; /* R0 checkpoint for syscall restart */
44 long syscall_nr; /* Only used in system calls */
45 union {
46 struct {
47 unsigned long usr;
48 unsigned long preds;
50 long long int predsusr;
52 union {
53 struct {
54 unsigned long m0;
55 unsigned long m1;
57 long long int m1m0;
59 union {
60 struct {
61 unsigned long sa1;
62 unsigned long lc1;
64 long long int lc1sa1;
66 union {
67 struct {
68 unsigned long sa0;
69 unsigned long lc0;
71 long long int lc0sa0;
73 union {
74 struct {
75 unsigned long gp;
76 unsigned long ugp;
78 long long int ugpgp;
81 * Be extremely careful with rearranging these, if at all. Some code
82 * assumes the 32 registers exist exactly like this in memory;
83 * e.g. kernel/ptrace.c
84 * e.g. kernel/signal.c (restore_sigcontext)
86 union {
87 struct {
88 unsigned long r00;
89 unsigned long r01;
91 long long int r0100;
93 union {
94 struct {
95 unsigned long r02;
96 unsigned long r03;
98 long long int r0302;
100 union {
101 struct {
102 unsigned long r04;
103 unsigned long r05;
105 long long int r0504;
107 union {
108 struct {
109 unsigned long r06;
110 unsigned long r07;
112 long long int r0706;
114 union {
115 struct {
116 unsigned long r08;
117 unsigned long r09;
119 long long int r0908;
121 union {
122 struct {
123 unsigned long r10;
124 unsigned long r11;
126 long long int r1110;
128 union {
129 struct {
130 unsigned long r12;
131 unsigned long r13;
133 long long int r1312;
135 union {
136 struct {
137 unsigned long r14;
138 unsigned long r15;
140 long long int r1514;
142 union {
143 struct {
144 unsigned long r16;
145 unsigned long r17;
147 long long int r1716;
149 union {
150 struct {
151 unsigned long r18;
152 unsigned long r19;
154 long long int r1918;
156 union {
157 struct {
158 unsigned long r20;
159 unsigned long r21;
161 long long int r2120;
163 union {
164 struct {
165 unsigned long r22;
166 unsigned long r23;
168 long long int r2322;
170 union {
171 struct {
172 unsigned long r24;
173 unsigned long r25;
175 long long int r2524;
177 union {
178 struct {
179 unsigned long r26;
180 unsigned long r27;
182 long long int r2726;
184 union {
185 struct {
186 unsigned long r28;
187 unsigned long r29;
189 long long int r2928;
191 union {
192 struct {
193 unsigned long r30;
194 unsigned long r31;
196 long long int r3130;
198 /* VM dispatch pushes event record onto stack - we can build on it */
199 struct hvm_event_record hvmer;
202 /* Defines to conveniently access the values */
205 * As of the VM spec 0.5, these registers are now set/retrieved via a
206 * VM call. On the in-bound side, we just fetch the values
207 * at the entry points and stuff them into the old record in pt_regs.
208 * However, on the outbound side, probably at VM rte, we set the
209 * registers back.
212 #define pt_elr(regs) ((regs)->hvmer.vmel)
213 #define pt_set_elr(regs, val) ((regs)->hvmer.vmel = (val))
214 #define pt_cause(regs) ((regs)->hvmer.vmest & (HVM_VMEST_CAUSE_MSK))
215 #define user_mode(regs) \
216 (((regs)->hvmer.vmest & (HVM_VMEST_UM_MSK << HVM_VMEST_UM_SFT)) != 0)
217 #define ints_enabled(regs) \
218 (((regs)->hvmer.vmest & (HVM_VMEST_IE_MSK << HVM_VMEST_IE_SFT)) != 0)
219 #define pt_psp(regs) ((regs)->hvmer.vmpsp)
220 #define pt_badva(regs) ((regs)->hvmer.vmbadva)
222 #define pt_set_rte_sp(regs, sp) do {\
223 pt_psp(regs) = (sp);\
224 (regs)->SP = (unsigned long) &((regs)->hvmer);\
225 } while (0)
227 #define pt_set_kmode(regs) \
228 (regs)->hvmer.vmest = (HVM_VMEST_IE_MSK << HVM_VMEST_IE_SFT)
230 #define pt_set_usermode(regs) \
231 (regs)->hvmer.vmest = (HVM_VMEST_UM_MSK << HVM_VMEST_UM_SFT) \
232 | (HVM_VMEST_IE_MSK << HVM_VMEST_IE_SFT)
234 #endif /* ifndef __ASSEMBLY */
236 #endif