1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
3 * Register definitions for the Hexagon architecture
7 #ifndef _ASM_REGISTERS_H
8 #define _ASM_REGISTERS_H
12 /* See kernel/entry.S for further documentation. */
15 * Entry code copies the event record out of guest registers into
16 * this structure (which is on the stack).
19 struct hvm_event_record
{
20 unsigned long vmel
; /* Event Linkage (return address) */
21 unsigned long vmest
; /* Event context - pre-event SSR values */
22 unsigned long vmpsp
; /* Previous stack pointer */
23 unsigned long vmbadva
; /* Bad virtual address for addressing events */
27 long restart_r0
; /* R0 checkpoint for syscall restart */
28 long syscall_nr
; /* Only used in system calls */
34 long long int predsusr
;
72 * Be extremely careful with rearranging these, if at all. Some code
73 * assumes the 32 registers exist exactly like this in memory;
74 * e.g. kernel/ptrace.c
75 * e.g. kernel/signal.c (restore_sigcontext)
189 /* VM dispatch pushes event record onto stack - we can build on it */
190 struct hvm_event_record hvmer
;
193 /* Defines to conveniently access the values */
196 * As of the VM spec 0.5, these registers are now set/retrieved via a
197 * VM call. On the in-bound side, we just fetch the values
198 * at the entry points and stuff them into the old record in pt_regs.
199 * However, on the outbound side, probably at VM rte, we set the
203 #define pt_elr(regs) ((regs)->hvmer.vmel)
204 #define pt_set_elr(regs, val) ((regs)->hvmer.vmel = (val))
205 #define pt_cause(regs) ((regs)->hvmer.vmest & (HVM_VMEST_CAUSE_MSK))
206 #define user_mode(regs) \
207 (((regs)->hvmer.vmest & (HVM_VMEST_UM_MSK << HVM_VMEST_UM_SFT)) != 0)
208 #define ints_enabled(regs) \
209 (((regs)->hvmer.vmest & (HVM_VMEST_IE_MSK << HVM_VMEST_IE_SFT)) != 0)
210 #define pt_psp(regs) ((regs)->hvmer.vmpsp)
211 #define pt_badva(regs) ((regs)->hvmer.vmbadva)
213 #define pt_set_singlestep(regs) ((regs)->hvmer.vmest |= (1<<HVM_VMEST_SS_SFT))
214 #define pt_clr_singlestep(regs) ((regs)->hvmer.vmest &= ~(1<<HVM_VMEST_SS_SFT))
216 #define pt_set_rte_sp(regs, sp) do {\
217 pt_psp(regs) = (regs)->r29 = (sp);\
220 #define pt_set_kmode(regs) \
221 (regs)->hvmer.vmest = (HVM_VMEST_IE_MSK << HVM_VMEST_IE_SFT)
223 #define pt_set_usermode(regs) \
224 (regs)->hvmer.vmest = (HVM_VMEST_UM_MSK << HVM_VMEST_UM_SFT) \
225 | (HVM_VMEST_IE_MSK << HVM_VMEST_IE_SFT)
227 #endif /* ifndef __ASSEMBLY */