diff options
author | Ian Campbell <ian.campbell@citrix.com> | 2013-02-22 08:58:03 +0000 |
---|---|---|
committer | Ian Campbell <ian.campbell@citrix.com> | 2013-02-22 12:14:53 +0000 |
commit | 1c38a1e937d39d3f6079667bfb6e8ff877eddbde (patch) | |
tree | 168a0f74572069e862dae30ccce6335ed7d44b0f /tools | |
parent | a51b368b64943196f86f444c45b1c5c61b148d1a (diff) | |
download | xen-1c38a1e937d39d3f6079667bfb6e8ff877eddbde.tar.gz xen-1c38a1e937d39d3f6079667bfb6e8ff877eddbde.tar.bz2 xen-1c38a1e937d39d3f6079667bfb6e8ff877eddbde.zip |
xen: arm: separate guest user regs from internal guest state.
struct cpu_user_regs is currently used as both internal state
(specifically at the base of the stack) and a guest/toolstack
visible API (via struct vcpu_guest_context used by
XEN_DOMCTL_{g,s}etvcpucontext and VCPUOP_initialise).
This causes problems when we want to make the API 64-bit clean since
we don't really want to change the size of the on-stack struct.
So split into vcpu_guest_core_regs which is the API facing struct
and keep cpu_user_regs purely internal, translate between the two.
In the user API arrange for both 64- and 32-bit registers to be
included in a layout which does not differ depending on toolstack
architecture. Also switch to using the more formal banked register
names (e.g. with the _usr suffix) for clarity.
This is an ABI change. Note that the kernel doesn't currently use
this data structure so it affects the tools interface only.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/include/xen-foreign/mkheader.py | 16 | ||||
-rw-r--r-- | tools/include/xen-foreign/reference.size | 5 | ||||
-rw-r--r-- | tools/include/xen-foreign/structs.py | 1 | ||||
-rw-r--r-- | tools/libxc/xc_dom_arm.c | 10 |
4 files changed, 25 insertions, 7 deletions
diff --git a/tools/include/xen-foreign/mkheader.py b/tools/include/xen-foreign/mkheader.py index c63db31c6e..8a784d342a 100644 --- a/tools/include/xen-foreign/mkheader.py +++ b/tools/include/xen-foreign/mkheader.py @@ -25,7 +25,15 @@ inttypes["arm32"] = { }; header["arm32"] = """ #define __arm___ARM32 1 +#if defined(__GNUC__) && !defined(__STRICT_ANSI__) +# define __DECL_REG(n64, n32) union { uint64_t n64; uint32_t n32; } +#else +# define __DECL_REG(n64, n32) uint64_t n64 +#endif """; +footer["arm32"] = """ +#undef __DECL_REG +""" inttypes["arm64"] = { "unsigned long" : "__danger_unsigned_long_on_arm64", @@ -35,7 +43,15 @@ inttypes["arm64"] = { }; header["arm64"] = """ #define __aarch64___ARM64 1 +#if defined(__GNUC__) && !defined(__STRICT_ANSI__) +# define __DECL_REG(n64, n32) union { uint64_t n64; uint32_t n32; } +#else +# define __DECL_REG(n64, n32) uint64_t n64 +#endif """; +footer["arm64"] = """ +#undef __DECL_REG +""" # x86_32 inttypes["x86_32"] = { diff --git a/tools/include/xen-foreign/reference.size b/tools/include/xen-foreign/reference.size index 1d75ff330e..de36455453 100644 --- a/tools/include/xen-foreign/reference.size +++ b/tools/include/xen-foreign/reference.size @@ -3,8 +3,9 @@ structs | arm32 arm64 x86_32 x86_64 start_info | - - 1112 1168 trap_info | - - 8 16 -cpu_user_regs | 160 160 68 200 -vcpu_guest_context | 180 160 2800 5168 +cpu_user_regs | - - 68 200 +vcpu_guest_core_regs | 304 304 - - +vcpu_guest_context | 336 336 2800 5168 arch_vcpu_info | - - 24 16 vcpu_time_info | - - 32 32 vcpu_info | - - 64 64 diff --git a/tools/include/xen-foreign/structs.py b/tools/include/xen-foreign/structs.py index 5aec2c5cc2..0b33a77480 100644 --- a/tools/include/xen-foreign/structs.py +++ b/tools/include/xen-foreign/structs.py @@ -6,6 +6,7 @@ unions = [ "vcpu_cr_regs", structs = [ "start_info", "trap_info", "cpu_user_regs", + "vcpu_guest_core_regs", "vcpu_guest_context", "arch_vcpu_info", "vcpu_time_info", diff --git a/tools/libxc/xc_dom_arm.c b/tools/libxc/xc_dom_arm.c index 7f6d7ce6aa..041832e68e 100644 --- a/tools/libxc/xc_dom_arm.c +++ b/tools/libxc/xc_dom_arm.c @@ -107,17 +107,17 @@ static int vcpu_arm(struct xc_dom_image *dom, void *ptr) /* clear everything */ memset(ctxt, 0, sizeof(*ctxt)); - ctxt->user_regs.pc = dom->parms.virt_entry; + ctxt->user_regs.pc32 = dom->parms.virt_entry; /* Linux boot protocol. See linux.Documentation/arm/Booting. */ - ctxt->user_regs.r0 = 0; /* SBZ */ + ctxt->user_regs.r0_usr = 0; /* SBZ */ /* Machine ID: We use DTB therefore no machine id */ - ctxt->user_regs.r1 = 0xffffffff; + ctxt->user_regs.r1_usr = 0xffffffff; /* ATAGS/DTB: We currently require that the guest kernel to be * using CONFIG_ARM_APPENDED_DTB. Ensure that r2 does not look * like a valid pointer to a set of ATAGS or a DTB. */ - ctxt->user_regs.r2 = 0xffffffff; + ctxt->user_regs.r2_usr = 0xffffffff; ctxt->sctlr = /* #define SCTLR_BASE */0x00c50078; @@ -130,7 +130,7 @@ static int vcpu_arm(struct xc_dom_image *dom, void *ptr) ctxt->flags = VGCF_online; DOMPRINTF("Initial state CPSR %#"PRIx32" PC %#"PRIx32, - ctxt->user_regs.cpsr, ctxt->user_regs.pc); + ctxt->user_regs.cpsr, ctxt->user_regs.pc32); return 0; } |