File indexing completed on 2025-05-11 08:24:26
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037 #include <rtems/asm.h>
0038 #include "sparc64-syscall.h"
0039
0040
0041 .seg "text"
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061
0062
0063
0064
0065 PUBLIC(syscall)
0066
0067
0068 SYM(syscall):
0069 mov %g0, %g4 ! clear %g4 at this GL
0070 #if defined (SUN4U)
0071 rdpr %pstate, %g1
0072 andn %g1, SPARC_PSTATE_AG_MASK, %g1
0073 wrpr %g1, %g0, %pstate ! go to regular globals
0074 #elif defined (SUN4V)
0075 rdpr %gl, %g1
0076 dec %g1
0077 wrpr %g0, %g1, %gl ! go back to GL = GL - 1
0078 #endif
0079
0080 subcc %g4, 2, %g0
0081 bne 3f
0082 rdpr %tstate, %g5 ! re-read tstate, use delay slot
0083
0084 ! syscall 2, disable interrupts
0085 rdpr %pil, %g1
0086 and %g5, SPARC_TSTATE_IE_MASK, %o0
0087 or %o0, %g1, %o0 ! return TSTATE_IE | PIL
0088 wrpr %g0, 0xf, %pil ! set PIL to 15
0089 andn %g5, SPARC_TSTATE_IE_MASK, %g1
0090 wrpr %g0, %g1, %tstate ! disable interrupts in trap state
0091 ba,a 9f
0092
0093 3: ! syscall 3, enable interrupts
0094 subcc %g4, 3, %g0
0095 bne 1f
0096 and %o0, 0xf, %g1
0097 wrpr %g0, %g1, %pil ! restore PIL
0098 ! and %o0, SPARC_TSTATE_IE_MASK, %g1
0099 ! or %g5, %g1, %g1 ! restore saved IE
0100 or %g5, SPARC_TSTATE_IE_MASK, %g1 ! restore IE (safe?)
0101 wrpr %g0, %g1, %tstate
0102 ba,a 9f
0103
0104 1:
0105 ba,a 1b ! spin. taking a trap here -> htrap
0106
0107 9: ! leave
0108 mov 0, %g4 ! clear %g4
0109 DONE
0110
0111 PUBLIC(sparc_disable_interrupts)
0112
0113 SYM(sparc_disable_interrupts):
0114 mov SYS_irqdis, %g4
0115 ta 0
0116 #if 0
0117 rdpr %pstate, %g5
0118 rdpr %pil, %g1
0119 and %g5, SPARC_PSTATE_IE_MASK, %o0
0120 or %o0, %g1, %o0 ! return PSTATE_IE | PIL
0121 wrpr %g0, 0xf, %pil ! set PIL to 15
0122 andn %g5, SPARC_PSTATE_IE_MASK, %g1
0123 wrpr %g0, %g1, %pstate ! disable interrupts
0124 #endif
0125 retl
0126 nop
0127
0128 PUBLIC(sparc_enable_interrupts)
0129
0130 SYM(sparc_enable_interrupts):
0131 mov SYS_irqen, %g4
0132 ta 0
0133 #if 0
0134 rdpr %pstate, %g5
0135 and %o0, 0xf, %g1
0136 wrpr %g0, %g1, %pil ! restore PIL
0137 and %o0, SPARC_PSTATE_IE_MASK, %g1
0138 or %g5, %g1, %g1 ! restore saved IE
0139 ! or %g5, SPARC_PSTATE_IE_MASK, %g1 ! set IE regardless of old (safe?)
0140 wrpr %g0, %g1, %pstate
0141 #endif
0142 retl
0143 nop
0144
0145