Changeset 8e0eb63 in mainline for arch/amd64/src/asm_utils.S
- Timestamp:
- 2006-03-15T18:01:43Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 9e1c942
- Parents:
- 2f7342d
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
arch/amd64/src/asm_utils.S
r2f7342d r8e0eb63 27 27 # 28 28 29 #define IREGISTER_SPACE 120 30 31 #define IOFFSET_RAX 0x0 32 #define IOFFSET_RBX 0x8 33 #define IOFFSET_RCX 0x10 34 #define IOFFSET_RDX 0x18 35 #define IOFFSET_RSI 0x20 36 #define IOFFSET_RDI 0x28 37 #define IOFFSET_R8 0x30 38 #define IOFFSET_R9 0x38 39 #define IOFFSET_R10 0x40 40 #define IOFFSET_R11 0x48 41 #define IOFFSET_R12 0x50 42 #define IOFFSET_R13 0x58 43 #define IOFFSET_R14 0x60 44 #define IOFFSET_R15 0x68 45 #define IOFFSET_RBP 0x70 29 46 30 47 # Mask for interrupts 0 - 31 (bits 0 - 31) where 0 means that int has no error word 31 48 # and 1 means interrupt with error word 32 33 34 49 #define ERROR_WORD_INTERRUPT_LIST 0x00027D00 35 50 36 51 #include <arch/pm.h> 37 #include <arch/context_offset.h>38 52 #include <arch/mm/page.h> 39 53 … … 142 156 movq IOFFSET_R15(%rsp), %r15 143 157 .endm 144 158 145 159 ## Declare interrupt handlers 146 160 # … … 148 162 # vectors starting at vector i. 149 163 # 150 # The handlers setup data segment registers 151 # and call exc_dispatch(). 164 # The handlers call exc_dispatch(). 152 165 # 153 166 .macro handler i n 154 subq $IREGISTER_SPACE, %rsp 167 168 /* 169 * Choose between version with error code and version without error code. 170 * Both versions have to be of the same size. amd64 assembly is, however, 171 * a little bit tricky. For instance, subq $0x80, %rsp and subq $0x78, %rsp 172 * can result in two instructions with different op-code lengths. 173 * Therefore, pay special attention to the extra NOP's that serve as 174 * a necessary fill. 175 */ 176 177 .iflt \i-32 178 .if (1 << \i) & ERROR_WORD_INTERRUPT_LIST 179 /* 180 * Version with error word. 181 */ 182 subq $IREGISTER_SPACE, %rsp 183 nop 184 nop 185 nop 186 .else 187 /* 188 * Version without error word, 189 */ 190 subq $(IREGISTER_SPACE+8), %rsp 191 .endif 192 .else 193 /* 194 * Version without error word, 195 */ 196 subq $(IREGISTER_SPACE+8), %rsp 197 .endif 198 155 199 save_all_gpr 156 200 157 movq $(\i),%rdi # %rdi - first parameter 158 movq %rsp, %rsi # %rsi - pointer to interrupt_context 159 call exc_dispatch # exc_dispatch(i, stack) 160 161 # Test if this is interrupt with error word or not 162 mov $\i,%cl; 163 movl $1,%eax; 164 test $0xe0,%cl; 165 jnz 0f; 166 and $0x1f,%cl; 167 shl %cl,%eax; 168 and $ERROR_WORD_INTERRUPT_LIST,%eax; 169 jz 0f; 170 171 172 # Return with error word 201 movq $(\i), %rdi # %rdi - first parameter 202 movq %rsp, %rsi # %rsi - pointer to istate 203 call exc_dispatch # exc_dispatch(i, istate) 204 173 205 restore_all_gpr 174 206 # $8 = Skip error word 175 addq $IREGISTER_SPACE + 0x8, %rsp 176 iretq 177 178 0: 179 # Return with no error word 180 restore_all_gpr 181 addq $IREGISTER_SPACE, %rsp 207 addq $(IREGISTER_SPACE+8), %rsp 182 208 iretq 183 209
Note:
See TracChangeset
for help on using the changeset viewer.