]> rtime.felk.cvut.cz Git - jailhouse.git/commitdiff
x86: Enable direct access to per-cpu guest registers
authorJan Kiszka <jan.kiszka@siemens.com>
Fri, 3 Apr 2015 12:26:08 +0000 (14:26 +0200)
committerJan Kiszka <jan.kiszka@siemens.com>
Fri, 10 Apr 2015 07:00:52 +0000 (09:00 +0200)
Now that the guest registers are saved at the same location on the
per-cpu stack for both Intel and AMD, we can enable direct access via
the per-cpu data structure. This will allow to drop the guest registers
parameter from most functions.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
hypervisor/arch/x86/include/asm/percpu.h

index 05e2900d86d05a51ae09d81ea03dea682a2f1293..cb4309c8ea219c55abdc00542ff5cd87ff7d11b8 100644 (file)
@@ -23,6 +23,8 @@
 
 #define NUM_ENTRY_REGS                 6
 
+#define STACK_SIZE                     PAGE_SIZE
+
 #ifndef __ASSEMBLY__
 
 #include <asm/cell.h>
 
 /** Per-CPU states. */
 struct per_cpu {
-       /** Stack used while in hypervisor mode. */
-       u8 stack[PAGE_SIZE];
+       union {
+               /** Stack used while in hypervisor mode. */
+               u8 stack[STACK_SIZE];
+               struct {
+                       u8 __fill[STACK_SIZE - sizeof(union registers)];
+                       /** Guest registers saved on stack during VM exit. */
+                       union registers guest_regs;
+               };
+       };
+
        /** Linux stack pointer, used for handover to hypervisor. */
        unsigned long linux_sp;