summaryrefslogtreecommitdiff
path: root/xen/arch/arm/include/asm/arm64/processor.h
blob: c749f80ad91b034827b1b685846860e849a75d3c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#ifndef __ASM_ARM_ARM64_PROCESSOR_H
#define __ASM_ARM_ARM64_PROCESSOR_H

#ifndef __ASSEMBLY__

/* Anonymous union includes both 32- and 64-bit names (e.g., r0/x0). */

#define __DECL_REG(n64, n32) union {            \
    uint64_t n64;                               \
    uint32_t n32;                               \
}

/* On stack VCPU state */
struct cpu_user_regs
{
    /*
     * The mapping AArch64 <-> AArch32 is based on D1.20.1 in ARM DDI
     * 0487A.d.
     *
     *         AArch64       AArch32
     */
    __DECL_REG(x0,           r0/*_usr*/);
    __DECL_REG(x1,           r1/*_usr*/);
    __DECL_REG(x2,           r2/*_usr*/);
    __DECL_REG(x3,           r3/*_usr*/);
    __DECL_REG(x4,           r4/*_usr*/);
    __DECL_REG(x5,           r5/*_usr*/);
    __DECL_REG(x6,           r6/*_usr*/);
    __DECL_REG(x7,           r7/*_usr*/);
    __DECL_REG(x8,           r8/*_usr*/);
    __DECL_REG(x9,           r9/*_usr*/);
    __DECL_REG(x10,          r10/*_usr*/);
    __DECL_REG(x11 ,         r11/*_usr*/);
    __DECL_REG(x12,          r12/*_usr*/);

    __DECL_REG(x13,          /* r13_usr */ sp_usr);
    __DECL_REG(x14,          /* r14_usr */ lr_usr);

    __DECL_REG(x15,          /* r13_hyp */ __unused_sp_hyp);

    __DECL_REG(x16,          /* r14_irq */ lr_irq);
    __DECL_REG(x17,          /* r13_irq */ sp_irq);

    __DECL_REG(x18,          /* r14_svc */ lr_svc);
    __DECL_REG(x19,          /* r13_svc */ sp_svc);

    __DECL_REG(x20,          /* r14_abt */ lr_abt);
    __DECL_REG(x21,          /* r13_abt */ sp_abt);

    __DECL_REG(x22,          /* r14_und */ lr_und);
    __DECL_REG(x23,          /* r13_und */ sp_und);

    __DECL_REG(x24,          r8_fiq);
    __DECL_REG(x25,          r9_fiq);
    __DECL_REG(x26,          r10_fiq);
    __DECL_REG(x27,          r11_fiq);
    __DECL_REG(x28,          r12_fiq);
    __DECL_REG(/* x29 */ fp, /* r13_fiq */ sp_fiq);

    __DECL_REG(/* x30 */ lr, /* r14_fiq */ lr_fiq);

    register_t sp; /* Valid for hypervisor frames */

    /* Return address and mode */
    __DECL_REG(pc,           pc32);             /* ELR_EL2 */
    uint64_t cpsr;                              /* SPSR_EL2 */
    uint64_t hsr;                               /* ESR_EL2 */

    /* The kernel frame should be 16-byte aligned. */
    uint64_t pad0;

    /* Outer guest frame only from here on... */

    union {
        uint64_t spsr_el1;       /* AArch64 */
        uint32_t spsr_svc;       /* AArch32 */
    };

    /* AArch32 guests only */
    uint32_t spsr_fiq, spsr_irq, spsr_und, spsr_abt;

    /* AArch64 guests only */
    uint64_t sp_el0;
    uint64_t sp_el1, elr_el1;
};

#undef __DECL_REG

#endif /* __ASSEMBLY__ */

#endif /* __ASM_ARM_ARM64_PROCESSOR_H */
/*
 * Local variables:
 * mode: C
 * c-file-style: "BSD"
 * c-basic-offset: 4
 * indent-tabs-mode: nil
 * End:
 */