]> xenbits.xensource.com Git - people/pauldu/mini-os.git/commitdiff
x86_64: introduce and use SAVE_ALL
authorWei Liu <wei.liu2@citrix.com>
Thu, 25 Aug 2016 14:52:38 +0000 (15:52 +0100)
committerWei Liu <wei.liu2@citrix.com>
Fri, 26 Aug 2016 08:12:23 +0000 (09:12 +0100)
Introduce this macro to match RESTORE_ALL. Also delete the unused
SAVE_REST.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
arch/x86/x86_64.S

index 8432d6977856246e417a07388e448006af389338..21fa61bf91b823666ba6256f6c56675339ef36dc 100644 (file)
@@ -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)