ia64/xen-unstable

changeset 19711:2e522b843a21

minios: Clean up and remove Linux remnants from x86_64.S

Sigend-off-by: Keir Fraser <keir.fraser@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Wed Jun 03 18:27:05 2009 +0100 (2009-06-03)
parents 6e100efd4b48
children 7a215fae6f1f
files extras/mini-os/arch/x86/x86_64.S
line diff
     1.1 --- a/extras/mini-os/arch/x86/x86_64.S	Wed Jun 03 16:20:28 2009 +0100
     1.2 +++ b/extras/mini-os/arch/x86/x86_64.S	Wed Jun 03 18:27:05 2009 +0100
     1.3 @@ -46,88 +46,21 @@ NMI_MASK = 0x80000000
     1.4  #define ORIG_RAX 120       /* + error_code */ 
     1.5  #define EFLAGS 144
     1.6  
     1.7 -#define REST_SKIP 6*8			
     1.8 -.macro SAVE_REST
     1.9 -	subq $REST_SKIP,%rsp
    1.10 -#	CFI_ADJUST_CFA_OFFSET	REST_SKIP
    1.11 -	movq %rbx,5*8(%rsp) 
    1.12 -#	CFI_REL_OFFSET	rbx,5*8
    1.13 -	movq %rbp,4*8(%rsp) 
    1.14 -#	CFI_REL_OFFSET	rbp,4*8
    1.15 -	movq %r12,3*8(%rsp) 
    1.16 -#	CFI_REL_OFFSET	r12,3*8
    1.17 -	movq %r13,2*8(%rsp) 
    1.18 -#	CFI_REL_OFFSET	r13,2*8
    1.19 -	movq %r14,1*8(%rsp) 
    1.20 -#	CFI_REL_OFFSET	r14,1*8
    1.21 -	movq %r15,(%rsp) 
    1.22 -#	CFI_REL_OFFSET	r15,0*8
    1.23 -.endm		
    1.24 -
    1.25 -
    1.26 -.macro RESTORE_REST
    1.27 -	movq (%rsp),%r15
    1.28 -#	CFI_RESTORE r15
    1.29 -	movq 1*8(%rsp),%r14
    1.30 -#	CFI_RESTORE r14
    1.31 -	movq 2*8(%rsp),%r13
    1.32 -#	CFI_RESTORE r13
    1.33 -	movq 3*8(%rsp),%r12
    1.34 -#	CFI_RESTORE r12
    1.35 -	movq 4*8(%rsp),%rbp
    1.36 -#	CFI_RESTORE rbp
    1.37 -	movq 5*8(%rsp),%rbx
    1.38 -#	CFI_RESTORE rbx
    1.39 -	addq $REST_SKIP,%rsp
    1.40 -#	CFI_ADJUST_CFA_OFFSET	-(REST_SKIP)
    1.41 -.endm
    1.42 -
    1.43 -
    1.44 -#define ARG_SKIP 9*8
    1.45 -.macro RESTORE_ARGS skiprax=0,addskip=0,skiprcx=0,skipr11=0,skipr8910=0,skiprdx=0
    1.46 -	.if \skipr11
    1.47 -	.else
    1.48 +.macro RESTORE_ALL
    1.49  	movq (%rsp),%r11
    1.50 -#	CFI_RESTORE r11
    1.51 -	.endif
    1.52 -	.if \skipr8910
    1.53 -	.else
    1.54  	movq 1*8(%rsp),%r10
    1.55 -#	CFI_RESTORE r10
    1.56  	movq 2*8(%rsp),%r9
    1.57 -#	CFI_RESTORE r9
    1.58  	movq 3*8(%rsp),%r8
    1.59 -#	CFI_RESTORE r8
    1.60 -	.endif
    1.61 -	.if \skiprax
    1.62 -	.else
    1.63  	movq 4*8(%rsp),%rax
    1.64 -#	CFI_RESTORE rax
    1.65 -	.endif
    1.66 -	.if \skiprcx
    1.67 -	.else
    1.68  	movq 5*8(%rsp),%rcx
    1.69 -#	CFI_RESTORE rcx
    1.70 -	.endif
    1.71 -	.if \skiprdx
    1.72 -	.else
    1.73  	movq 6*8(%rsp),%rdx
    1.74 -#	CFI_RESTORE rdx
    1.75 -	.endif
    1.76  	movq 7*8(%rsp),%rsi
    1.77 -#	CFI_RESTORE rsi
    1.78  	movq 8*8(%rsp),%rdi
    1.79 -#	CFI_RESTORE rdi
    1.80 -	.if ARG_SKIP+\addskip > 0
    1.81 -	addq $ARG_SKIP+\addskip,%rsp
    1.82 -#	CFI_ADJUST_CFA_OFFSET	-(ARG_SKIP+\addskip)
    1.83 -	.endif
    1.84 +	addq $9*8+8,%rsp
    1.85  .endm	
    1.86  
    1.87  
    1.88  .macro HYPERVISOR_IRET flag
    1.89 -#    testb $3,1*8(%rsp)    /* Don't need to do that in Mini-os, as */
    1.90 -#	jnz   2f               /* there is no userspace? */
    1.91  	testl $NMI_MASK,2*8(%rsp)
    1.92  	jnz   2f
    1.93  
    1.94 @@ -150,44 +83,25 @@ 2:	/* Slow iret via hypervisor. */
    1.95   * and the exception handler in %rax.	
    1.96   */ 		  				
    1.97  ENTRY(error_entry)
    1.98 -#	_frame RDI
    1.99  	/* rdi slot contains rax, oldrax contains error code */
   1.100  	cld	
   1.101  	subq  $14*8,%rsp
   1.102 -#	CFI_ADJUST_CFA_OFFSET	(14*8)
   1.103  	movq %rsi,13*8(%rsp)
   1.104 -#	CFI_REL_OFFSET	rsi,RSI
   1.105  	movq 14*8(%rsp),%rsi	/* load rax from rdi slot */
   1.106  	movq %rdx,12*8(%rsp)
   1.107 -#	CFI_REL_OFFSET	rdx,RDX
   1.108  	movq %rcx,11*8(%rsp)
   1.109 -#	CFI_REL_OFFSET	rcx,RCX
   1.110  	movq %rsi,10*8(%rsp)	/* store rax */ 
   1.111 -#	CFI_REL_OFFSET	rax,RAX
   1.112  	movq %r8, 9*8(%rsp)
   1.113 -#	CFI_REL_OFFSET	r8,R8
   1.114  	movq %r9, 8*8(%rsp)
   1.115 -#	CFI_REL_OFFSET	r9,R9
   1.116  	movq %r10,7*8(%rsp)
   1.117 -#	CFI_REL_OFFSET	r10,R10
   1.118  	movq %r11,6*8(%rsp)
   1.119 -#	CFI_REL_OFFSET	r11,R11
   1.120  	movq %rbx,5*8(%rsp) 
   1.121 -#	CFI_REL_OFFSET	rbx,RBX
   1.122  	movq %rbp,4*8(%rsp) 
   1.123 -#	CFI_REL_OFFSET	rbp,RBP
   1.124  	movq %r12,3*8(%rsp) 
   1.125 -#	CFI_REL_OFFSET	r12,R12
   1.126  	movq %r13,2*8(%rsp) 
   1.127 -#	CFI_REL_OFFSET	r13,R13
   1.128  	movq %r14,1*8(%rsp) 
   1.129 -#	CFI_REL_OFFSET	r14,R14
   1.130  	movq %r15,(%rsp) 
   1.131 -#	CFI_REL_OFFSET	r15,R15
   1.132 -#if 0        
   1.133 -	cmpl $__KERNEL_CS,CS(%rsp)
   1.134 -	je  error_kernelspace
   1.135 -#endif        
   1.136 +
   1.137  error_call_handler:
   1.138  	movq %rdi, RDI(%rsp)            
   1.139  	movq %rsp,%rdi
   1.140 @@ -197,29 +111,22 @@ error_call_handler:
   1.141  	jmp error_exit
   1.142  
   1.143  .macro zeroentry sym
   1.144 -#	INTR_FRAME
   1.145      movq (%rsp),%rcx
   1.146      movq 8(%rsp),%r11
   1.147      addq $0x10,%rsp /* skip rcx and r11 */
   1.148  	pushq $0	/* push error code/oldrax */ 
   1.149 -#	CFI_ADJUST_CFA_OFFSET 8
   1.150  	pushq %rax	/* push real oldrax to the rdi slot */ 
   1.151 -#	CFI_ADJUST_CFA_OFFSET 8
   1.152  	leaq  \sym(%rip),%rax
   1.153  	jmp error_entry
   1.154 -#	CFI_ENDPROC
   1.155  .endm	
   1.156  
   1.157  .macro errorentry sym
   1.158 -#	XCPT_FRAME
   1.159          movq (%rsp),%rcx
   1.160          movq 8(%rsp),%r11
   1.161          addq $0x10,%rsp /* rsp points to the error code */
   1.162  	pushq %rax
   1.163 -#	CFI_ADJUST_CFA_OFFSET 8
   1.164  	leaq  \sym(%rip),%rax
   1.165  	jmp error_entry
   1.166 -#	CFI_ENDPROC
   1.167  .endm
   1.168  
   1.169  #define XEN_GET_VCPU_INFO(reg)	movq HYPERVISOR_shared_info,reg
   1.170 @@ -253,7 +160,6 @@ 11:     movq %gs:8,%rax
   1.171          decl %gs:0
   1.172          jmp error_exit
   1.173  
   1.174 -#        ALIGN
   1.175  restore_all_enable_events:  
   1.176  	XEN_UNBLOCK_EVENTS(%rsi)        # %rsi is already set up...
   1.177  
   1.178 @@ -261,12 +167,18 @@ scrit:	/**** START OF CRITICAL REGION **
   1.179  	XEN_TEST_PENDING(%rsi)
   1.180  	jnz  14f			# process more events if necessary...
   1.181  	XEN_PUT_VCPU_INFO(%rsi)
   1.182 -        RESTORE_ARGS 0,8,0
   1.183 +        RESTORE_ALL
   1.184          HYPERVISOR_IRET 0
   1.185          
   1.186  14:	XEN_LOCKED_BLOCK_EVENTS(%rsi)
   1.187  	XEN_PUT_VCPU_INFO(%rsi)
   1.188 -	SAVE_REST
   1.189 +	subq $6*8,%rsp
   1.190 +	movq %rbx,5*8(%rsp) 
   1.191 +	movq %rbp,4*8(%rsp) 
   1.192 +	movq %r12,3*8(%rsp) 
   1.193 +	movq %r13,2*8(%rsp) 
   1.194 +	movq %r14,1*8(%rsp) 
   1.195 +	movq %r15,(%rsp) 
   1.196          movq %rsp,%rdi                  # set the argument again
   1.197  	jmp  11b
   1.198  ecrit:  /**** END OF CRITICAL REGION ****/
   1.199 @@ -274,7 +186,7 @@ ecrit:  /**** END OF CRITICAL REGION ***
   1.200  
   1.201  retint_kernel:
   1.202  retint_restore_args:
   1.203 -	movl EFLAGS-REST_SKIP(%rsp), %eax
   1.204 +	movl EFLAGS-6*8(%rsp), %eax
   1.205  	shr $9, %eax			# EAX[0] == IRET_EFLAGS.IF
   1.206  	XEN_GET_VCPU_INFO(%rsi)
   1.207  	andb evtchn_upcall_mask(%rsi),%al
   1.208 @@ -282,13 +194,18 @@ retint_restore_args:
   1.209  	jnz restore_all_enable_events	#        != 0 => enable event delivery
   1.210  	XEN_PUT_VCPU_INFO(%rsi)
   1.211  		
   1.212 -	RESTORE_ARGS 0,8,0
   1.213 +	RESTORE_ALL
   1.214  	HYPERVISOR_IRET 0
   1.215  
   1.216  
   1.217  error_exit:		
   1.218 -	RESTORE_REST
   1.219 -/*	cli */
   1.220 +	movq (%rsp),%r15
   1.221 +	movq 1*8(%rsp),%r14
   1.222 +	movq 2*8(%rsp),%r13
   1.223 +	movq 3*8(%rsp),%r12
   1.224 +	movq 4*8(%rsp),%rbp
   1.225 +	movq 5*8(%rsp),%rbx
   1.226 +	addq $6*8,%rsp
   1.227  	XEN_BLOCK_EVENTS(%rsi)		
   1.228  	jmp retint_kernel
   1.229  
   1.230 @@ -313,17 +230,11 @@ ENTRY(device_not_available)
   1.231  
   1.232  
   1.233  ENTRY(debug)
   1.234 -#       INTR_FRAME
   1.235 -#       CFI_ADJUST_CFA_OFFSET 8 */
   1.236          zeroentry do_debug
   1.237 -#       CFI_ENDPROC
   1.238  
   1.239  
   1.240  ENTRY(int3)
   1.241 -#       INTR_FRAME
   1.242 -#       CFI_ADJUST_CFA_OFFSET 8 */
   1.243          zeroentry do_int3
   1.244 -#       CFI_ENDPROC
   1.245  
   1.246  ENTRY(overflow)
   1.247          zeroentry do_overflow
   1.248 @@ -351,9 +262,7 @@ ENTRY(segment_not_present)
   1.249  
   1.250  /* runs on exception stack */
   1.251  ENTRY(stack_segment)
   1.252 -#       XCPT_FRAME
   1.253          errorentry do_stack_segment
   1.254 -#       CFI_ENDPROC
   1.255                      
   1.256  
   1.257  ENTRY(general_protection)