HV: refine excp/external_interrupt_save_frame and excp_rsvd

There are lines of repeated codes in excp/external_interrupt_save_frame
and excp_rsvd. So, this patch defines two .macro, save_frame and restore_frame,
to reduce the repeated codes.

No functional change.

Tracked-On: #3886
Acked-by: Eddie Dong <eddie.dong@intel.com>
Signed-off-by: Kaige Fu <kaige.fu@intel.com>
This commit is contained in:
Kaige Fu 2019-12-11 14:44:01 +00:00 committed by wenlingz
parent 7f96465407
commit fb346a6c11

View File

@ -257,13 +257,7 @@ vector =0x20
vector = vector + 1 vector = vector + 1
.endr .endr
.macro save_frame
/*
* Common entry point for defined exceptions
*/
.align 8
excp_save_frame:
pushq %r15 pushq %r15
pushq %r14 pushq %r14
pushq %r13 pushq %r13
@ -281,12 +275,11 @@ excp_save_frame:
pushq %rcx pushq %rcx
pushq %rax pushq %rax
/* Put current stack pointer into 1st param register (rdi) */ /* Put current stack pointer into 1st param register (rdi) */
movq %rsp, %rdi movq %rsp, %rdi
.endm
call dispatch_exception .macro restore_frame
popq %rax popq %rax
popq %rcx popq %rcx
popq %rdx popq %rdx
@ -306,6 +299,18 @@ excp_save_frame:
/* Skip vector and error code*/ /* Skip vector and error code*/
add $16, %rsp add $16, %rsp
.endm
/*
* Common entry point for defined exceptions
*/
.align 8
excp_save_frame:
save_frame
call dispatch_exception
restore_frame
iretq iretq
@ -317,47 +322,11 @@ excp_save_frame:
*/ */
.align 8 .align 8
excp_rsvd: excp_rsvd:
pushq %r15 save_frame
pushq %r14
pushq %r13
pushq %r12
pushq %r11
pushq %r10
pushq %r9
pushq %r8
pushq %rdi
pushq %rsi
pushq %rbp
pushq %rsp
pushq %rbx
pushq %rdx
pushq %rcx
pushq %rax
/* Put current stack pointer into 1st param register (rdi) */
movq %rsp, %rdi
call dispatch_exception call dispatch_exception
popq %rax restore_frame
popq %rcx
popq %rdx
popq %rbx
popq %rsp
popq %rbp
popq %rsi
popq %rdi
popq %r8
popq %r9
popq %r10
popq %r11
popq %r12
popq %r13
popq %r14
popq %r15
/* Skip vector and error code*/
add $16, %rsp
iretq iretq
@ -368,25 +337,7 @@ excp_rsvd:
*/ */
.align 8 .align 8
external_interrupt_save_frame: external_interrupt_save_frame:
pushq %r15 save_frame
pushq %r14
pushq %r13
pushq %r12
pushq %r11
pushq %r10
pushq %r9
pushq %r8
pushq %rdi
pushq %rsi
pushq %rbp
pushq %rsp
pushq %rbx
pushq %rdx
pushq %rcx
pushq %rax
/* Put current stack pointer into 1st param register (rdi) */
movq %rsp, %rdi
call dispatch_interrupt call dispatch_interrupt
@ -395,25 +346,7 @@ external_interrupt_save_frame:
* are for Guest. * are for Guest.
*/ */
popq %rax restore_frame
popq %rcx
popq %rdx
popq %rbx
popq %rsp
popq %rbp
popq %rsi
popq %rdi
popq %r8
popq %r9
popq %r10
popq %r11
popq %r12
popq %r13
popq %r14
popq %r15
/* Skip vector and error code*/
add $16, %rsp
iretq iretq