ia64/xen-unstable

changeset 10701:70ee75d5c12c

[IA64] ivt.S cleanup

Cleanup: unused code #ifndef XEN-ized, some insns swapped to improve
bundling.

Signed-off-by: Tristan Gingold <tristan.gingold@bull.net>
author awilliam@lappy
date Mon Jul 24 12:57:17 2006 -0600 (2006-07-24)
parents b2abc70be89e
children 614deef19299
files xen/arch/ia64/xen/ivt.S
line diff
     1.1 --- a/xen/arch/ia64/xen/ivt.S	Wed Jul 19 07:17:54 2006 -0600
     1.2 +++ b/xen/arch/ia64/xen/ivt.S	Mon Jul 24 12:57:17 2006 -0600
     1.3 @@ -1,19 +1,4 @@
     1.4 -
     1.5  #ifdef XEN
     1.6 -//#define CONFIG_DISABLE_VHPT	// FIXME: change when VHPT is enabled??
     1.7 -// these are all hacked out for now as the entire IVT
     1.8 -// will eventually be replaced... just want to use it
     1.9 -// for startup code to handle TLB misses
    1.10 -//#define ia64_leave_kernel 0
    1.11 -//#define ia64_ret_from_syscall 0
    1.12 -//#define ia64_handle_irq 0
    1.13 -//#define ia64_fault 0
    1.14 -#define ia64_illegal_op_fault 0
    1.15 -#define ia64_prepare_handle_unaligned 0
    1.16 -#define ia64_bad_break 0
    1.17 -#define ia64_trace_syscall 0
    1.18 -#define sys_call_table 0
    1.19 -#define sys_ni_syscall 0
    1.20  #include <asm/debugger.h>
    1.21  #endif
    1.22  /*
    1.23 @@ -95,26 +80,19 @@
    1.24  #include "minstate.h"
    1.25  
    1.26  #define FAULT(n)									\
    1.27 +	mov r19=n;			/* prepare to save predicates */		\
    1.28  	mov r31=pr;									\
    1.29 -	mov r19=n;;			/* prepare to save predicates */		\
    1.30  	br.sptk.many dispatch_to_fault_handler
    1.31  
    1.32  #define FAULT_OR_REFLECT(n)								\
    1.33 -	mov r31=pr;	 	 							\
    1.34 -	mov r20=cr.ipsr;;								\
    1.35 +	mov r20=cr.ipsr;								\
    1.36  	mov r19=n;	/* prepare to save predicates */				\
    1.37 +	mov r31=pr;;	 	 							\
    1.38  	extr.u r20=r20,IA64_PSR_CPL0_BIT,2;;   						\
    1.39  	cmp.ne p6,p0=r0,r20; 	/* cpl != 0?*/						\
    1.40  (p6)	br.dptk.many dispatch_reflection;						\
    1.41  	br.sptk.few dispatch_to_fault_handler
    1.42  
    1.43 -#ifdef XEN
    1.44 -#define REFLECT(n)									\
    1.45 -	mov r31=pr;									\
    1.46 -	mov r19=n;;			/* prepare to save predicates */		\
    1.47 -	br.sptk.many dispatch_reflection
    1.48 -#endif
    1.49 -
    1.50  	.section .text.ivt,"ax"
    1.51  
    1.52  	.align 32768	// align on 32KB boundary
    1.53 @@ -257,8 +235,8 @@ END(vhpt_miss)
    1.54  ENTRY(itlb_miss)
    1.55  	DBG_FAULT(1)
    1.56  #ifdef XEN
    1.57 +	mov r16 = cr.ifa
    1.58  	mov r31 = pr
    1.59 -	mov r16 = cr.ifa
    1.60  	;;
    1.61  	extr.u r17=r16,59,5
    1.62  	;;
    1.63 @@ -321,8 +299,8 @@ END(itlb_miss)
    1.64  ENTRY(dtlb_miss)
    1.65  	DBG_FAULT(2)
    1.66  #ifdef XEN
    1.67 +	mov r16=cr.ifa				// get virtual address
    1.68  	mov r31=pr
    1.69 -	mov r16=cr.ifa				// get virtual address
    1.70  	;;
    1.71  	extr.u r17=r16,59,5
    1.72  	;;
    1.73 @@ -443,12 +421,12 @@ END(dtlb_miss)
    1.74  ENTRY(alt_itlb_miss)
    1.75  	DBG_FAULT(3)
    1.76  #ifdef XEN
    1.77 +	mov r16=cr.ifa		// get address that caused the TLB miss
    1.78  	mov r31=pr
    1.79 -	mov r16=cr.ifa		// get address that caused the TLB miss
    1.80  	;;
    1.81  late_alt_itlb_miss:
    1.82 +	mov r21=cr.ipsr
    1.83  	movl r17=PAGE_KERNEL
    1.84 -	mov r21=cr.ipsr
    1.85  	movl r19=(((1 << IA64_MAX_PHYS_BITS) - 1) & ~0xfff)
    1.86  	;;
    1.87  #else
    1.88 @@ -498,14 +476,14 @@ END(alt_itlb_miss)
    1.89  ENTRY(alt_dtlb_miss)
    1.90  	DBG_FAULT(4)
    1.91  #ifdef XEN
    1.92 +	mov r16=cr.ifa		// get address that caused the TLB miss
    1.93  	mov r31=pr
    1.94 -	mov r16=cr.ifa		// get address that caused the TLB miss
    1.95  	;;
    1.96  late_alt_dtlb_miss:
    1.97 -	movl r17=PAGE_KERNEL
    1.98  	mov r20=cr.isr
    1.99 +	movl r17=PAGE_KERNEL
   1.100 +	mov r21=cr.ipsr
   1.101  	movl r19=(((1 << IA64_MAX_PHYS_BITS) - 1) & ~0xfff)
   1.102 -	mov r21=cr.ipsr
   1.103  	;;
   1.104  #endif
   1.105  #ifdef CONFIG_DISABLE_VHPT
   1.106 @@ -621,9 +599,11 @@ ENTRY(frametable_fault)
   1.107  	rfi
   1.108  END(frametable_fault)
   1.109  GLOBAL_ENTRY(ia64_frametable_probe)
   1.110 +	{
   1.111  	probe.r	r8=r32,0	// destination register must be r8
   1.112  	nop.f 0x0
   1.113  	br.ret.sptk.many b0	// this instruction must be in bundle 2
   1.114 +	}
   1.115  END(ia64_frametable_probe)
   1.116  #endif /* CONFIG_VIRTUAL_FRAME_TABLE */
   1.117  
   1.118 @@ -705,8 +685,9 @@ ENTRY(ikey_miss)
   1.119  	DBG_FAULT(6)
   1.120  #ifdef XEN
   1.121  	FAULT_OR_REFLECT(6)
   1.122 +#else
   1.123 +	FAULT(6)
   1.124  #endif
   1.125 -	FAULT(6)
   1.126  END(ikey_miss)
   1.127  
   1.128  	//-----------------------------------------------------------------------------------
   1.129 @@ -754,8 +735,9 @@ ENTRY(dkey_miss)
   1.130  	DBG_FAULT(7)
   1.131  #ifdef XEN
   1.132  	FAULT_OR_REFLECT(7)
   1.133 +#else
   1.134 +	FAULT(7)
   1.135  #endif
   1.136 -	FAULT(7)
   1.137  END(dkey_miss)
   1.138  
   1.139  	.org ia64_ivt+0x2000
   1.140 @@ -765,7 +747,7 @@ ENTRY(dirty_bit)
   1.141  	DBG_FAULT(8)
   1.142  #ifdef XEN
   1.143  	FAULT_OR_REFLECT(8)
   1.144 -#endif
   1.145 +#else
   1.146  	/*
   1.147  	 * What we do here is to simply turn on the dirty bit in the PTE.  We need to
   1.148  	 * update both the page-table and the TLB entry.  To efficiently access the PTE,
   1.149 @@ -821,6 +803,7 @@ 1:	ld8 r18=[r17]
   1.150  #endif
   1.151  	mov pr=r31,-1				// restore pr
   1.152  	rfi
   1.153 +#endif
   1.154  END(dirty_bit)
   1.155  
   1.156  	.org ia64_ivt+0x2400
   1.157 @@ -829,13 +812,13 @@ END(dirty_bit)
   1.158  ENTRY(iaccess_bit)
   1.159  	DBG_FAULT(9)
   1.160  #ifdef XEN
   1.161 -	mov r31=pr;
   1.162  	mov r16=cr.isr
   1.163  	mov r17=cr.ifa
   1.164 +	mov r31=pr
   1.165  	mov r19=9
   1.166 -	movl r20=0x2400
   1.167 +	mov r20=0x2400
   1.168  	br.sptk.many fast_access_reflect;;
   1.169 -#endif
   1.170 +#else
   1.171  	// Like Entry 8, except for instruction access
   1.172  	mov r16=cr.ifa				// get the address that caused the fault
   1.173  	movl r30=1f				// load continuation point in case of nested fault
   1.174 @@ -894,6 +877,7 @@ 1:	ld8 r18=[r17]
   1.175  #endif /* !CONFIG_SMP */
   1.176  	mov pr=r31,-1
   1.177  	rfi
   1.178 +#endif
   1.179  END(iaccess_bit)
   1.180  
   1.181  	.org ia64_ivt+0x2800
   1.182 @@ -902,13 +886,13 @@ END(iaccess_bit)
   1.183  ENTRY(daccess_bit)
   1.184  	DBG_FAULT(10)
   1.185  #ifdef XEN
   1.186 -	mov r31=pr;
   1.187  	mov r16=cr.isr
   1.188  	mov r17=cr.ifa
   1.189 +	mov r31=pr
   1.190  	mov r19=10
   1.191 -	movl r20=0x2800
   1.192 +	mov r20=0x2800
   1.193  	br.sptk.many fast_access_reflect;;
   1.194 -#endif
   1.195 +#else
   1.196  	// Like Entry 8, except for data access
   1.197  	mov r16=cr.ifa				// get the address that caused the fault
   1.198  	movl r30=1f				// load continuation point in case of nested fault
   1.199 @@ -954,6 +938,7 @@ 1:	ld8 r18=[r17]
   1.200  	mov b0=r29				// restore b0
   1.201  	mov pr=r31,-1
   1.202  	rfi
   1.203 +#endif
   1.204  END(daccess_bit)
   1.205  
   1.206  	.org ia64_ivt+0x2c00
   1.207 @@ -1016,7 +1001,7 @@ ENTRY(break_fault)
   1.208  	;;
   1.209  	br.sptk.many fast_break_reflect
   1.210  	;;
   1.211 -#endif
   1.212 +#else /* !XEN */
   1.213  	movl r16=THIS_CPU(cpu_kr)+IA64_KR_CURRENT_OFFSET;;
   1.214  	ld8 r16=[r16]
   1.215  	mov r17=cr.iim
   1.216 @@ -1096,6 +1081,7 @@ ENTRY(break_fault)
   1.217  (p8)	br.call.sptk.many b6=b6			// ignore this return addr
   1.218  	br.cond.sptk ia64_trace_syscall
   1.219  	// NOT REACHED
   1.220 +#endif
   1.221  END(break_fault)
   1.222  
   1.223  	.org ia64_ivt+0x3000
   1.224 @@ -1190,6 +1176,7 @@ END(dispatch_break_fault)
   1.225  	DBG_FAULT(14)
   1.226  	FAULT(14)
   1.227  
   1.228 +#ifndef XEN
   1.229  	/*
   1.230  	 * There is no particular reason for this code to be here, other than that
   1.231  	 * there happens to be space here that would go unused otherwise.  If this
   1.232 @@ -1329,13 +1316,15 @@ GLOBAL_ENTRY(ia64_syscall_setup)
   1.233  (p10)	mov r8=-EINVAL
   1.234  	br.ret.sptk.many b7
   1.235  END(ia64_syscall_setup)
   1.236 -
   1.237 +#endif /* XEN */
   1.238 +	
   1.239  	.org ia64_ivt+0x3c00
   1.240  /////////////////////////////////////////////////////////////////////////////////////////
   1.241  // 0x3c00 Entry 15 (size 64 bundles) Reserved
   1.242  	DBG_FAULT(15)
   1.243  	FAULT(15)
   1.244  
   1.245 +#ifndef XEN
   1.246  	/*
   1.247  	 * Squatting in this space ...
   1.248  	 *
   1.249 @@ -1374,6 +1363,7 @@ ENTRY(dispatch_illegal_op_fault)
   1.250  (p6)	br.call.dpnt.many b6=b6		// call returns to ia64_leave_kernel
   1.251  	br.sptk.many ia64_leave_kernel
   1.252  END(dispatch_illegal_op_fault)
   1.253 +#endif
   1.254  
   1.255  	.org ia64_ivt+0x4000
   1.256  /////////////////////////////////////////////////////////////////////////////////////////
   1.257 @@ -1419,6 +1409,7 @@ END(dispatch_privop_fault)
   1.258  	DBG_FAULT(17)
   1.259  	FAULT(17)
   1.260  
   1.261 +#ifndef XEN
   1.262  ENTRY(non_syscall)
   1.263  	SAVE_MIN_WITH_COVER
   1.264  
   1.265 @@ -1444,6 +1435,7 @@ ENTRY(non_syscall)
   1.266  	;;
   1.267  	br.call.sptk.many b6=ia64_bad_break	// avoid WAW on CFM and ignore return addr
   1.268  END(non_syscall)
   1.269 +#endif
   1.270  
   1.271  	.org ia64_ivt+0x4800
   1.272  /////////////////////////////////////////////////////////////////////////////////////////
   1.273 @@ -1451,13 +1443,13 @@ END(non_syscall)
   1.274  	DBG_FAULT(18)
   1.275  	FAULT(18)
   1.276  
   1.277 +#ifndef XEN
   1.278  	/*
   1.279  	 * There is no particular reason for this code to be here, other than that
   1.280  	 * there happens to be space here that would go unused otherwise.  If this
   1.281  	 * fault ever gets "unreserved", simply moved the following code to a more
   1.282  	 * suitable spot...
   1.283  	 */
   1.284 -
   1.285  ENTRY(dispatch_unaligned_handler)
   1.286  	SAVE_MIN_WITH_COVER
   1.287  	;;
   1.288 @@ -1479,6 +1471,7 @@ ENTRY(dispatch_unaligned_handler)
   1.289  //	br.sptk.many ia64_prepare_handle_unaligned
   1.290      br.call.sptk.many b6=ia64_handle_unaligned
   1.291  END(dispatch_unaligned_handler)
   1.292 +#endif
   1.293  
   1.294  	.org ia64_ivt+0x4c00
   1.295  /////////////////////////////////////////////////////////////////////////////////////////
   1.296 @@ -1533,7 +1526,7 @@ ENTRY(page_not_present)
   1.297  	DBG_FAULT(20)
   1.298  #ifdef XEN
   1.299  	FAULT_OR_REFLECT(20)
   1.300 -#endif
   1.301 +#else
   1.302  	mov r16=cr.ifa
   1.303  	rsm psr.dt
   1.304  	/*
   1.305 @@ -1547,6 +1540,7 @@ ENTRY(page_not_present)
   1.306  	mov r31=pr
   1.307  	srlz.d
   1.308  	br.sptk.many page_fault
   1.309 +#endif
   1.310  END(page_not_present)
   1.311  
   1.312  	.org ia64_ivt+0x5100
   1.313 @@ -1556,13 +1550,14 @@ ENTRY(key_permission)
   1.314  	DBG_FAULT(21)
   1.315  #ifdef XEN
   1.316  	FAULT_OR_REFLECT(21)
   1.317 -#endif
   1.318 +#else
   1.319  	mov r16=cr.ifa
   1.320  	rsm psr.dt
   1.321  	mov r31=pr
   1.322  	;;
   1.323  	srlz.d
   1.324  	br.sptk.many page_fault
   1.325 +#endif
   1.326  END(key_permission)
   1.327  
   1.328  	.org ia64_ivt+0x5200
   1.329 @@ -1572,13 +1567,14 @@ ENTRY(iaccess_rights)
   1.330  	DBG_FAULT(22)
   1.331  #ifdef XEN
   1.332  	FAULT_OR_REFLECT(22)
   1.333 -#endif
   1.334 +#else
   1.335  	mov r16=cr.ifa
   1.336  	rsm psr.dt
   1.337  	mov r31=pr
   1.338  	;;
   1.339  	srlz.d
   1.340  	br.sptk.many page_fault
   1.341 +#endif
   1.342  END(iaccess_rights)
   1.343  
   1.344  	.org ia64_ivt+0x5300
   1.345 @@ -1593,13 +1589,14 @@ ENTRY(daccess_rights)
   1.346  	mov r19=23
   1.347  	movl r20=0x5300
   1.348  	br.sptk.many fast_access_reflect;;
   1.349 -#endif
   1.350 +#else
   1.351  	mov r16=cr.ifa
   1.352  	rsm psr.dt
   1.353  	mov r31=pr
   1.354  	;;
   1.355  	srlz.d
   1.356  	br.sptk.many page_fault
   1.357 +#endif
   1.358  END(daccess_rights)
   1.359  
   1.360  	.org ia64_ivt+0x5400
   1.361 @@ -1666,8 +1663,9 @@ ENTRY(nat_consumption)
   1.362  	DBG_FAULT(26)
   1.363  #ifdef XEN
   1.364  	FAULT_OR_REFLECT(26)
   1.365 +#else
   1.366 +	FAULT(26)
   1.367  #endif
   1.368 -	FAULT(26)
   1.369  END(nat_consumption)
   1.370  
   1.371  	.org ia64_ivt+0x5700
   1.372 @@ -1678,7 +1676,7 @@ ENTRY(speculation_vector)
   1.373  #ifdef XEN
   1.374  	// this probably need not reflect...
   1.375  	FAULT_OR_REFLECT(27)
   1.376 -#endif
   1.377 +#else
   1.378  	/*
   1.379  	 * A [f]chk.[as] instruction needs to take the branch to the recovery code but
   1.380  	 * this part of the architecture is not implemented in hardware on some CPUs, such
   1.381 @@ -1709,6 +1707,7 @@ ENTRY(speculation_vector)
   1.382  	;;
   1.383  
   1.384  	rfi				// and go back
   1.385 +#endif
   1.386  END(speculation_vector)
   1.387  
   1.388  	.org ia64_ivt+0x5800
   1.389 @@ -1724,8 +1723,9 @@ ENTRY(debug_vector)
   1.390  	DBG_FAULT(29)
   1.391  #ifdef XEN
   1.392  	FAULT_OR_REFLECT(29)
   1.393 +#else
   1.394 +	FAULT(29)
   1.395  #endif
   1.396 -	FAULT(29)
   1.397  END(debug_vector)
   1.398  
   1.399  	.org ia64_ivt+0x5a00
   1.400 @@ -1735,11 +1735,12 @@ ENTRY(unaligned_access)
   1.401  	DBG_FAULT(30)
   1.402  #ifdef XEN
   1.403  	FAULT_OR_REFLECT(30)
   1.404 -#endif
   1.405 +#else
   1.406  	mov r16=cr.ipsr
   1.407  	mov r31=pr		// prepare to save predicates
   1.408  	;;
   1.409  	br.sptk.many dispatch_unaligned_handler
   1.410 +#endif
   1.411  END(unaligned_access)
   1.412  
   1.413  	.org ia64_ivt+0x5b00
   1.414 @@ -1749,8 +1750,9 @@ ENTRY(unsupported_data_reference)
   1.415  	DBG_FAULT(31)
   1.416  #ifdef XEN
   1.417  	FAULT_OR_REFLECT(31)
   1.418 +#else
   1.419 +	FAULT(31)
   1.420  #endif
   1.421 -	FAULT(31)
   1.422  END(unsupported_data_reference)
   1.423  
   1.424  	.org ia64_ivt+0x5c00
   1.425 @@ -1760,8 +1762,9 @@ ENTRY(floating_point_fault)
   1.426  	DBG_FAULT(32)
   1.427  #ifdef XEN
   1.428  	FAULT_OR_REFLECT(32)
   1.429 +#else
   1.430 +	FAULT(32)
   1.431  #endif
   1.432 -	FAULT(32)
   1.433  END(floating_point_fault)
   1.434  
   1.435  	.org ia64_ivt+0x5d00
   1.436 @@ -1771,8 +1774,9 @@ ENTRY(floating_point_trap)
   1.437  	DBG_FAULT(33)
   1.438  #ifdef XEN
   1.439  	FAULT_OR_REFLECT(33)
   1.440 +#else
   1.441 +	FAULT(33)
   1.442  #endif
   1.443 -	FAULT(33)
   1.444  END(floating_point_trap)
   1.445  
   1.446  	.org ia64_ivt+0x5e00
   1.447 @@ -1782,8 +1786,9 @@ ENTRY(lower_privilege_trap)
   1.448  	DBG_FAULT(34)
   1.449  #ifdef XEN
   1.450  	FAULT_OR_REFLECT(34)
   1.451 +#else
   1.452 +	FAULT(34)
   1.453  #endif
   1.454 -	FAULT(34)
   1.455  END(lower_privilege_trap)
   1.456  
   1.457  	.org ia64_ivt+0x5f00
   1.458 @@ -1793,8 +1798,9 @@ ENTRY(taken_branch_trap)
   1.459  	DBG_FAULT(35)
   1.460  #ifdef XEN
   1.461  	FAULT_OR_REFLECT(35)
   1.462 +#else
   1.463 +	FAULT(35)
   1.464  #endif
   1.465 -	FAULT(35)
   1.466  END(taken_branch_trap)
   1.467  
   1.468  	.org ia64_ivt+0x6000
   1.469 @@ -1804,8 +1810,9 @@ ENTRY(single_step_trap)
   1.470  	DBG_FAULT(36)
   1.471  #ifdef XEN
   1.472  	FAULT_OR_REFLECT(36)
   1.473 +#else
   1.474 +	FAULT(36)
   1.475  #endif
   1.476 -	FAULT(36)
   1.477  END(single_step_trap)
   1.478  
   1.479  	.org ia64_ivt+0x6100
   1.480 @@ -1863,8 +1870,9 @@ ENTRY(ia32_exception)
   1.481  	DBG_FAULT(45)
   1.482  #ifdef XEN
   1.483  	FAULT_OR_REFLECT(45)
   1.484 +#else
   1.485 +	FAULT(45)
   1.486  #endif
   1.487 -	FAULT(45)
   1.488  END(ia32_exception)
   1.489  
   1.490  	.org ia64_ivt+0x6a00
   1.491 @@ -1874,7 +1882,7 @@ ENTRY(ia32_intercept)
   1.492  	DBG_FAULT(46)
   1.493  #ifdef XEN
   1.494  	FAULT_OR_REFLECT(46)
   1.495 -#endif
   1.496 +#else
   1.497  #ifdef	CONFIG_IA32_SUPPORT
   1.498  	mov r31=pr
   1.499  	mov r16=cr.isr
   1.500 @@ -1898,6 +1906,7 @@ ENTRY(ia32_intercept)
   1.501  1:
   1.502  #endif	// CONFIG_IA32_SUPPORT
   1.503  	FAULT(46)
   1.504 +#endif
   1.505  END(ia32_intercept)
   1.506  
   1.507  	.org ia64_ivt+0x6b00
   1.508 @@ -1907,13 +1916,14 @@ ENTRY(ia32_interrupt)
   1.509  	DBG_FAULT(47)
   1.510  #ifdef XEN
   1.511  	FAULT_OR_REFLECT(47)
   1.512 -#endif
   1.513 +#else
   1.514  #ifdef CONFIG_IA32_SUPPORT
   1.515  	mov r31=pr
   1.516  	br.sptk.many dispatch_to_ia32_handler
   1.517  #else
   1.518  	FAULT(47)
   1.519  #endif
   1.520 +#endif
   1.521  END(ia32_interrupt)
   1.522  
   1.523  	.org ia64_ivt+0x6c00