Changeset 6c383b0 in mainline
- Timestamp:
- 2007-11-17T19:52:57Z (17 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- e0bc7fc
- Parents:
- 7e956eb
- Files:
-
- 1 added
- 1 deleted
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/ia32/src/asm.S
r7e956eb r6c383b0 29 29 ## very low and hardware-level functions 30 30 31 # Mask for interrupts 0 - 31 (bits 0 - 31) where 0 means that int has no error word32 # and 1 means interrupt with error word33 #define ERROR_WORD_INTERRUPT_LIST 0x00027 D0031 # Mask for interrupts 0 - 31 (bits 0 - 31) where 0 means that int has no error 32 # word and 1 means interrupt with error word 33 #define ERROR_WORD_INTERRUPT_LIST 0x00027d00 34 34 35 35 .text … … 66 66 memcpy_from_uspace: 67 67 memcpy_to_uspace: 68 movl %edi, %edx 69 movl %esi, %eax 68 movl %edi, %edx /* save %edi */ 69 movl %esi, %eax /* save %esi */ 70 70 71 71 movl MEMCPY_SIZE(%esp), %ecx 72 shrl $2, %ecx 72 shrl $2, %ecx /* size / 4 */ 73 73 74 74 movl MEMCPY_DST(%esp), %edi 75 75 movl MEMCPY_SRC(%esp), %esi 76 76 77 rep movsl /* copy as much as possible word by word*/77 rep movsl /* copy whole words */ 78 78 79 79 movl MEMCPY_SIZE(%esp), %ecx 80 andl $3, %ecx 80 andl $3, %ecx /* size % 4 */ 81 81 jz 0f 82 82 83 rep movsb 83 rep movsb /* copy the rest byte by byte */ 84 84 85 85 0: 86 86 movl %edx, %edi 87 87 movl %eax, %esi 88 movl MEMCPY_SRC(%esp), %eax 88 movl MEMCPY_SRC(%esp), %eax /* MEMCPY_SRC(%esp), success */ 89 89 ret 90 90 … … 97 97 movl %edx, %edi 98 98 movl %eax, %esi 99 xorl %eax, %eax 99 xorl %eax, %eax /* return 0, failure */ 100 100 ret 101 101 … … 105 105 # 106 106 paging_on: 107 movl %cr0,%edx 108 orl $(1<<31),%edx # paging on 109 andl $~((1<<30)|(1<<29)),%edx # clear Cache Disable and not Write Though 107 movl %cr0, %edx 108 orl $(1 << 31), %edx # paging on 109 # clear Cache Disable and not Write Though 110 andl $~((1 << 30) | (1 << 29)), %edx 110 111 movl %edx,%cr0 111 112 jmp 0f … … 119 120 # 120 121 enable_l_apic_in_msr: 121 push %eax122 123 122 movl $0x1b, %ecx 124 123 rdmsr 125 orl $(1 <<11),%eax126 orl $(0xfee00000), %eax124 orl $(1 << 11), %eax 125 orl $(0xfee00000), %eax 127 126 wrmsr 128 129 pop %eax130 127 ret 131 128 … … 135 132 pushfl 136 133 pop %ecx 137 and $0xffffbfff, %ecx134 and $0xffffbfff, %ecx 138 135 push %ecx 139 136 popfl … … 151 148 .macro handler i n 152 149 153 .ifeq \i-0x30 # Syscall handler 154 push %ds 155 push %es 156 push %fs 157 push %gs 158 159 # Push arguments on stack 160 push %edi 161 push %esi 162 push %edx 163 push %ecx 164 push %eax 150 .ifeq \i - 0x30 # Syscall handler 151 pushl %ds 152 pushl %es 153 pushl %fs 154 pushl %gs 155 156 # 157 # Push syscall arguments onto the stack 158 # 159 # NOTE: The idea behind the order of arguments passed in registers is to 160 # use all scratch registers first and preserved registers next. 161 # An optimized libc syscall wrapper can make use of this setup. 162 # 163 pushl %eax 164 pushl %ebp 165 pushl %edi 166 pushl %esi 167 pushl %ebx 168 pushl %ecx 169 pushl %edx 165 170 166 171 # we must fill the data segment registers 167 movw $16, %ax168 movw %ax, %ds169 movw %ax, %es172 movw $16, %ax 173 movw %ax, %ds 174 movw %ax, %es 170 175 171 176 sti 172 173 call syscall_handler # syscall_handler(ax,cx,dx,si,di)177 # syscall_handler(edx, ecx, ebx, esi, edi, ebp, eax) 178 call syscall_handler 174 179 cli 175 addl $2 0, %esp # clean-up of parameters176 177 pop %gs178 pop %fs179 pop %es180 pop %ds180 addl $28, %esp # clean-up of parameters 181 182 popl %gs 183 popl %fs 184 popl %es 185 popl %ds 181 186 182 187 CLEAR_NT_FLAG … … 189 194 * handlers and istate_t can be the same for both types. 190 195 */ 191 .iflt \i -32196 .iflt \i - 32 192 197 .if (1 << \i) & ERROR_WORD_INTERRUPT_LIST 193 198 /* … … 207 212 .endif 208 213 209 push %ds210 push %es211 push %fs212 push %gs214 pushl %ds 215 pushl %es 216 pushl %fs 217 pushl %gs 213 218 214 219 #ifdef CONFIG_DEBUG_ALLREGS 215 push %ebx216 push %ebp217 push %edi218 push %esi220 pushl %ebx 221 pushl %ebp 222 pushl %edi 223 pushl %esi 219 224 #else 220 sub $16, %esp225 subl $16, %esp 221 226 #endif 222 push %edx223 push %ecx224 push %eax227 pushl %edx 228 pushl %ecx 229 pushl %eax 225 230 226 231 # we must fill the data segment registers 227 movw $16, %ax228 movw %ax, %ds229 movw %ax, %es232 movw $16, %ax 233 movw %ax, %ds 234 movw %ax, %es 230 235 231 236 pushl %esp # *istate 232 237 pushl $(\i) # intnum 233 238 call exc_dispatch # excdispatch(intnum, *istate) 234 addl $8, %esp# Clear arguments from stack239 addl $8, %esp # Clear arguments from stack 235 240 236 241 CLEAR_NT_FLAG # Modifies %ecx 237 242 238 pop %eax239 pop %ecx240 pop %edx243 popl %eax 244 popl %ecx 245 popl %edx 241 246 #ifdef CONFIG_DEBUG_ALLREGS 242 pop %esi243 pop %edi244 pop %ebp245 pop %ebx247 popl %esi 248 popl %edi 249 popl %ebp 250 popl %ebx 246 251 #else 247 add $16, %esp252 addl $16, %esp 248 253 #endif 249 254 250 pop %gs251 pop %fs252 pop %es253 pop %ds254 255 addl $4, %esp # Skip error word, no matter whether real or fake.255 popl %gs 256 popl %fs 257 popl %es 258 popl %ds 259 260 addl $4, %esp # Skip error word, no matter whether real or fake. 256 261 iret 257 262 .endif 258 263 259 264 .align INTERRUPT_ALIGN 260 .if (\n- \i)-1261 handler "(\i +1)",\n265 .if (\n- \i) - 1 266 handler "(\i + 1)", \n 262 267 .endif 263 268 .endm 264 269 265 270 # keep in sync with pm.h !!! 266 IDT_ITEMS =64271 IDT_ITEMS = 64 267 272 .align INTERRUPT_ALIGN 268 273 interrupt_handlers: … … 274 279 .global interrupt_handler_size 275 280 276 interrupt_handler_size: .long (h_end -h_start)/IDT_ITEMS281 interrupt_handler_size: .long (h_end - h_start) / IDT_ITEMS -
uspace/lib/libc/arch/ia32/Makefile.inc
r7e956eb r6c383b0 33 33 TOOLCHAIN_DIR = /usr/local/i686/bin 34 34 35 ARCH_SOURCES += arch/$(ARCH)/src/syscall. c\35 ARCH_SOURCES += arch/$(ARCH)/src/syscall.S \ 36 36 arch/$(ARCH)/src/fibril.S \ 37 37 arch/$(ARCH)/src/tls.c -
uspace/lib/libc/arch/ia32/src/fibril.S
r7e956eb r6c383b0 75 75 76 76 # Set thread local storage 77 pushl %ed i78 movl 24(%eax), %e ax # Set arg1 to TLS addr79 movl $1, %e di # Syscall 177 pushl %edx 78 movl 24(%eax), %edx # Set arg1 to TLS addr 79 movl $1, %eax # Syscall SYS_TLS_SET 80 80 int $0x30 81 popl %ed i81 popl %edx 82 82 83 83 xorl %eax,%eax # context_restore returns 0
Note:
See TracChangeset
for help on using the changeset viewer.