From: Wei Liu Date: Thu, 25 Aug 2016 14:52:38 +0000 (+0100) Subject: x86_64: introduce and use SAVE_ALL X-Git-Tag: xen-4.8.0-rc1~19 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=ac290d5cfaf6199d1063c28027f5c0d4a38fa62a;p=people%2Faperard%2Fmini-os.git x86_64: introduce and use SAVE_ALL Introduce this macro to match RESTORE_ALL. Also delete the unused SAVE_REST. Signed-off-by: Wei Liu Reviewed-by: Juergen Gross Acked-by: Samuel Thibault --- diff --git a/arch/x86/x86_64.S b/arch/x86/x86_64.S index 8432d69..21fa61b 100644 --- a/arch/x86/x86_64.S +++ b/arch/x86/x86_64.S @@ -119,14 +119,26 @@ KERNEL_CS_MASK = 0xfc addq $15*8+8,%rsp .endm -.macro SAVE_REST - subq $6*8,%rsp +.macro SAVE_ALL + /* rdi slot contains rax, oldrax contains error code */ + cld + subq $14*8,%rsp + movq %rsi,13*8(%rsp) + movq 14*8(%rsp),%rsi /* load rax from rdi slot */ + movq %rdx,12*8(%rsp) + movq %rcx,11*8(%rsp) + movq %rsi,10*8(%rsp) /* store rax */ + movq %r8, 9*8(%rsp) + movq %r9, 8*8(%rsp) + movq %r10,7*8(%rsp) + movq %r11,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) + movq %rdi, RDI(%rsp) /* put rdi into the slot */ .endm .macro HYPERVISOR_IRET flag @@ -154,26 +166,8 @@ KERNEL_CS_MASK = 0xfc * and the exception handler in %rax. */ ENTRY(error_entry) - /* rdi slot contains rax, oldrax contains error code */ - cld - subq $14*8,%rsp - movq %rsi,13*8(%rsp) - movq 14*8(%rsp),%rsi /* load rax from rdi slot */ - movq %rdx,12*8(%rsp) - movq %rcx,11*8(%rsp) - movq %rsi,10*8(%rsp) /* store rax */ - movq %r8, 9*8(%rsp) - movq %r9, 8*8(%rsp) - movq %r10,7*8(%rsp) - movq %r11,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) - - movq %rdi, RDI(%rsp) + SAVE_ALL + movq %rsp,%rdi movq ORIG_RAX(%rsp),%rsi # get error code movq $-1,ORIG_RAX(%rsp)