From mboxrd@z Thu Jan 1 00:00:00 1970 From: Xu Zhang Subject: [PATCH 2/6] mini-os/x86-64 entry: define macros for registers partial save and restore Date: Fri, 8 Mar 2013 15:30:15 -0600 Message-ID: <1362778219-8576-3-git-send-email-xzhang@cs.uic.edu> References: <1362778219-8576-1-git-send-email-xzhang@cs.uic.edu> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1362778219-8576-1-git-send-email-xzhang@cs.uic.edu> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xen.org Cc: samuel.thibault@ens-lyon.org, jeremy@goop.org, Xu Zhang , gm281@cam.ac.uk, stefano.stabellini@eu.citrix.com List-Id: xen-devel@lists.xenproject.org For saving and restoring registers rbx, rbp, and r12-r15, define and use macro SAVE_REST and RESTORE_REST respectively. Signed-off-by: Xu Zhang --- extras/mini-os/arch/x86/x86_64.S | 38 +++++++++++++++++++++++--------------- 1 files changed, 23 insertions(+), 15 deletions(-) diff --git a/extras/mini-os/arch/x86/x86_64.S b/extras/mini-os/arch/x86/x86_64.S index 6139c2d..addb7b1 100644 --- a/extras/mini-os/arch/x86/x86_64.S +++ b/extras/mini-os/arch/x86/x86_64.S @@ -46,6 +46,26 @@ NMI_MASK = 0x80000000 #define ORIG_RAX 120 /* + error_code */ #define EFLAGS 144 +.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 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 RESTORE_ALL movq (%rsp),%r11 movq 1*8(%rsp),%r10 @@ -172,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 ****/ @@ -198,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 -- 1.7.7.6