aboutsummaryrefslogtreecommitdiffstats
path: root/extras
diff options
context:
space:
mode:
authorXu Zhang <xzhang@cs.uic.edu>2013-04-10 23:46:56 -0500
committerIan Campbell <ian.campbell@citrix.com>2013-04-22 12:32:11 +0100
commit7e84f54da55d7b59ee4469b6a2ee8fe62ea0bca2 (patch)
treecdaf66f9c12fefc89ac0093877f5dc1787daa5fc /extras
parenta76d139f183a20b3d6cbae4259cf0585bf876eb3 (diff)
downloadxen-7e84f54da55d7b59ee4469b6a2ee8fe62ea0bca2.tar.gz
xen-7e84f54da55d7b59ee4469b6a2ee8fe62ea0bca2.tar.bz2
xen-7e84f54da55d7b59ee4469b6a2ee8fe62ea0bca2.zip
mini-os/x86-64 entry: define macros for registers partial save and restore
No functional changes. For saving and restoring registers rbx, rbp, and r12-r15, define and use macros SAVE_REST and RESTORE_REST respectively. Signed-off-by: Xu Zhang <xzhang@cs.uic.edu> Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Diffstat (limited to 'extras')
-rw-r--r--extras/mini-os/arch/x86/x86_64.S37
1 files changed, 22 insertions, 15 deletions
diff --git a/extras/mini-os/arch/x86/x86_64.S b/extras/mini-os/arch/x86/x86_64.S
index 79099f1c64..24f35cdbd2 100644
--- a/extras/mini-os/arch/x86/x86_64.S
+++ b/extras/mini-os/arch/x86/x86_64.S
@@ -59,6 +59,25 @@ NMI_MASK = 0x80000000
addq $9*8+8,%rsp
.endm
+.macro RESTORE_REST
+ movq (%rsp),%r15
+ movq 1*8(%rsp),%r14
+ movq 2*8(%rsp),%r13
+ movq 3*8(%rsp),%r12
+ movq 4*8(%rsp),%rbp
+ movq 5*8(%rsp),%rbx
+ addq $6*8,%rsp
+.endm
+
+.macro SAVE_REST
+ subq $6*8,%rsp
+ movq %rbx,5*8(%rsp)
+ movq %rbp,4*8(%rsp)
+ movq %r12,3*8(%rsp)
+ movq %r13,2*8(%rsp)
+ movq %r14,1*8(%rsp)
+ movq %r15,(%rsp)
+.endm
.macro HYPERVISOR_IRET flag
testl $NMI_MASK,2*8(%rsp)
@@ -173,13 +192,7 @@ scrit: /**** START OF CRITICAL REGION ****/
14: XEN_LOCKED_BLOCK_EVENTS(%rsi)
XEN_PUT_VCPU_INFO(%rsi)
- subq $6*8,%rsp
- movq %rbx,5*8(%rsp)
- movq %rbp,4*8(%rsp)
- movq %r12,3*8(%rsp)
- movq %r13,2*8(%rsp)
- movq %r14,1*8(%rsp)
- movq %r15,(%rsp)
+ SAVE_REST
movq %rsp,%rdi # set the argument again
jmp 11b
ecrit: /**** END OF CRITICAL REGION ****/
@@ -199,14 +212,8 @@ retint_restore_args:
HYPERVISOR_IRET 0
-error_exit:
- movq (%rsp),%r15
- movq 1*8(%rsp),%r14
- movq 2*8(%rsp),%r13
- movq 3*8(%rsp),%r12
- movq 4*8(%rsp),%rbp
- movq 5*8(%rsp),%rbx
- addq $6*8,%rsp
+error_exit:
+ RESTORE_REST
XEN_BLOCK_EVENTS(%rsi)
jmp retint_kernel