# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1244050025 -3600
# Node ID 2e522b843a21860074552e0cd9f3c33cf13c7ef0
# Parent 6e100efd4b48ccb61921827b65f6859530e01508
minios: Clean up and remove Linux remnants from x86_64.S
Sigend-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
---
extras/mini-os/arch/x86/x86_64.S | 131 +++++----------------------------------
1 files changed, 20 insertions(+), 111 deletions(-)
diff -r 6e100efd4b48 -r 2e522b843a21 extras/mini-os/arch/x86/x86_64.S
--- a/extras/mini-os/arch/x86/x86_64.S Wed Jun 03 16:20:28 2009 +0100
+++ b/extras/mini-os/arch/x86/x86_64.S Wed Jun 03 18:27:05 2009 +0100
@@ -46,88 +46,21 @@ NMI_MASK = 0x80000000
#define ORIG_RAX 120 /* + error_code */
#define EFLAGS 144
-#define REST_SKIP 6*8
-.macro SAVE_REST
- subq $REST_SKIP,%rsp
-# CFI_ADJUST_CFA_OFFSET REST_SKIP
- movq %rbx,5*8(%rsp)
-# CFI_REL_OFFSET rbx,5*8
- movq %rbp,4*8(%rsp)
-# CFI_REL_OFFSET rbp,4*8
- movq %r12,3*8(%rsp)
-# CFI_REL_OFFSET r12,3*8
- movq %r13,2*8(%rsp)
-# CFI_REL_OFFSET r13,2*8
- movq %r14,1*8(%rsp)
-# CFI_REL_OFFSET r14,1*8
- movq %r15,(%rsp)
-# CFI_REL_OFFSET r15,0*8
-.endm
-
-
-.macro RESTORE_REST
- movq (%rsp),%r15
-# CFI_RESTORE r15
- movq 1*8(%rsp),%r14
-# CFI_RESTORE r14
- movq 2*8(%rsp),%r13
-# CFI_RESTORE r13
- movq 3*8(%rsp),%r12
-# CFI_RESTORE r12
- movq 4*8(%rsp),%rbp
-# CFI_RESTORE rbp
- movq 5*8(%rsp),%rbx
-# CFI_RESTORE rbx
- addq $REST_SKIP,%rsp
-# CFI_ADJUST_CFA_OFFSET -(REST_SKIP)
-.endm
-
-
-#define ARG_SKIP 9*8
-.macro RESTORE_ARGS
skiprax=0,addskip=0,skiprcx=0,skipr11=0,skipr8910=0,skiprdx=0
- .if \skipr11
- .else
+.macro RESTORE_ALL
movq (%rsp),%r11
-# CFI_RESTORE r11
- .endif
- .if \skipr8910
- .else
movq 1*8(%rsp),%r10
-# CFI_RESTORE r10
movq 2*8(%rsp),%r9
-# CFI_RESTORE r9
movq 3*8(%rsp),%r8
-# CFI_RESTORE r8
- .endif
- .if \skiprax
- .else
movq 4*8(%rsp),%rax
-# CFI_RESTORE rax
- .endif
- .if \skiprcx
- .else
movq 5*8(%rsp),%rcx
-# CFI_RESTORE rcx
- .endif
- .if \skiprdx
- .else
movq 6*8(%rsp),%rdx
-# CFI_RESTORE rdx
- .endif
movq 7*8(%rsp),%rsi
-# CFI_RESTORE rsi
movq 8*8(%rsp),%rdi
-# CFI_RESTORE rdi
- .if ARG_SKIP+\addskip > 0
- addq $ARG_SKIP+\addskip,%rsp
-# CFI_ADJUST_CFA_OFFSET -(ARG_SKIP+\addskip)
- .endif
+ addq $9*8+8,%rsp
.endm
.macro HYPERVISOR_IRET flag
-# testb $3,1*8(%rsp) /* Don't need to do that in Mini-os, as */
-# jnz 2f /* there is no userspace? */
testl $NMI_MASK,2*8(%rsp)
jnz 2f
@@ -150,44 +83,25 @@ 2: /* Slow iret via hypervisor. */
* and the exception handler in %rax.
*/
ENTRY(error_entry)
-# _frame RDI
/* rdi slot contains rax, oldrax contains error code */
cld
subq $14*8,%rsp
-# CFI_ADJUST_CFA_OFFSET (14*8)
movq %rsi,13*8(%rsp)
-# CFI_REL_OFFSET rsi,RSI
movq 14*8(%rsp),%rsi /* load rax from rdi slot */
movq %rdx,12*8(%rsp)
-# CFI_REL_OFFSET rdx,RDX
movq %rcx,11*8(%rsp)
-# CFI_REL_OFFSET rcx,RCX
movq %rsi,10*8(%rsp) /* store rax */
-# CFI_REL_OFFSET rax,RAX
movq %r8, 9*8(%rsp)
-# CFI_REL_OFFSET r8,R8
movq %r9, 8*8(%rsp)
-# CFI_REL_OFFSET r9,R9
movq %r10,7*8(%rsp)
-# CFI_REL_OFFSET r10,R10
movq %r11,6*8(%rsp)
-# CFI_REL_OFFSET r11,R11
movq %rbx,5*8(%rsp)
-# CFI_REL_OFFSET rbx,RBX
movq %rbp,4*8(%rsp)
-# CFI_REL_OFFSET rbp,RBP
movq %r12,3*8(%rsp)
-# CFI_REL_OFFSET r12,R12
movq %r13,2*8(%rsp)
-# CFI_REL_OFFSET r13,R13
movq %r14,1*8(%rsp)
-# CFI_REL_OFFSET r14,R14
movq %r15,(%rsp)
-# CFI_REL_OFFSET r15,R15
-#if 0
- cmpl $__KERNEL_CS,CS(%rsp)
- je error_kernelspace
-#endif
+
error_call_handler:
movq %rdi, RDI(%rsp)
movq %rsp,%rdi
@@ -197,29 +111,22 @@ error_call_handler:
jmp error_exit
.macro zeroentry sym
-# INTR_FRAME
movq (%rsp),%rcx
movq 8(%rsp),%r11
addq $0x10,%rsp /* skip rcx and r11 */
pushq $0 /* push error code/oldrax */
-# CFI_ADJUST_CFA_OFFSET 8
pushq %rax /* push real oldrax to the rdi slot */
-# CFI_ADJUST_CFA_OFFSET 8
leaq \sym(%rip),%rax
jmp error_entry
-# CFI_ENDPROC
.endm
.macro errorentry sym
-# XCPT_FRAME
movq (%rsp),%rcx
movq 8(%rsp),%r11
addq $0x10,%rsp /* rsp points to the error code */
pushq %rax
-# CFI_ADJUST_CFA_OFFSET 8
leaq \sym(%rip),%rax
jmp error_entry
-# CFI_ENDPROC
.endm
#define XEN_GET_VCPU_INFO(reg) movq HYPERVISOR_shared_info,reg
@@ -253,7 +160,6 @@ 11: movq %gs:8,%rax
decl %gs:0
jmp error_exit
-# ALIGN
restore_all_enable_events:
XEN_UNBLOCK_EVENTS(%rsi) # %rsi is already set up...
@@ -261,12 +167,18 @@ scrit: /**** START OF CRITICAL REGION **
XEN_TEST_PENDING(%rsi)
jnz 14f # process more events if necessary...
XEN_PUT_VCPU_INFO(%rsi)
- RESTORE_ARGS 0,8,0
+ RESTORE_ALL
HYPERVISOR_IRET 0
14: XEN_LOCKED_BLOCK_EVENTS(%rsi)
XEN_PUT_VCPU_INFO(%rsi)
- 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)
movq %rsp,%rdi # set the argument again
jmp 11b
ecrit: /**** END OF CRITICAL REGION ****/
@@ -274,7 +186,7 @@ ecrit: /**** END OF CRITICAL REGION ***
retint_kernel:
retint_restore_args:
- movl EFLAGS-REST_SKIP(%rsp), %eax
+ movl EFLAGS-6*8(%rsp), %eax
shr $9, %eax # EAX[0] == IRET_EFLAGS.IF
XEN_GET_VCPU_INFO(%rsi)
andb evtchn_upcall_mask(%rsi),%al
@@ -282,13 +194,18 @@ retint_restore_args:
jnz restore_all_enable_events # != 0 => enable event delivery
XEN_PUT_VCPU_INFO(%rsi)
- RESTORE_ARGS 0,8,0
+ RESTORE_ALL
HYPERVISOR_IRET 0
error_exit:
- RESTORE_REST
-/* cli */
+ 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
XEN_BLOCK_EVENTS(%rsi)
jmp retint_kernel
@@ -313,17 +230,11 @@ ENTRY(device_not_available)
ENTRY(debug)
-# INTR_FRAME
-# CFI_ADJUST_CFA_OFFSET 8 */
zeroentry do_debug
-# CFI_ENDPROC
ENTRY(int3)
-# INTR_FRAME
-# CFI_ADJUST_CFA_OFFSET 8 */
zeroentry do_int3
-# CFI_ENDPROC
ENTRY(overflow)
zeroentry do_overflow
@@ -351,9 +262,7 @@ ENTRY(segment_not_present)
/* runs on exception stack */
ENTRY(stack_segment)
-# XCPT_FRAME
errorentry do_stack_segment
-# CFI_ENDPROC
ENTRY(general_protection)
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|