Changes in kernel/arch/ia32/src/asm.S [0f17bff:45f7449] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/ia32/src/asm.S
r0f17bff r45f7449 31 31 */ 32 32 33 #include <abi/asmtool.h>34 33 #include <arch/pm.h> 35 34 #include <arch/cpu.h> 36 35 #include <arch/mm/page.h> 37 #include <arch/istate_struct.h>38 #include <arch/smp/apic.h>39 36 40 37 .text 38 .global paging_on 39 .global enable_l_apic_in_msr 40 .global memcpy_from_uspace 41 .global memcpy_from_uspace_failover_address 42 .global memcpy_to_uspace 43 .global memcpy_to_uspace_failover_address 44 .global early_putchar 41 45 42 46 #define MEMCPY_DST 4 … … 59 63 * 60 64 */ 61 FUNCTION_BEGIN(memcpy_from_uspace) 62 FUNCTION_BEGIN(memcpy_to_uspace) 65 memcpy_from_uspace: 66 memcpy_to_uspace: 63 67 movl %edi, %edx /* save %edi */ 64 68 movl %esi, %eax /* save %esi */ … … 88 92 movl MEMCPY_DST(%esp), %eax 89 93 ret 90 FUNCTION_END(memcpy_from_uspace)91 FUNCTION_END(memcpy_to_uspace)92 94 93 95 /* … … 95 97 * above had caused a page fault. 96 98 */ 97 SYMBOL(memcpy_from_uspace_failover_address) 98 SYMBOL(memcpy_to_uspace_failover_address) 99 memcpy_from_uspace_failover_address: 100 memcpy_to_uspace_failover_address: 99 101 movl %edx, %edi 100 102 movl %eax, %esi … … 109 111 * 110 112 */ 111 FUNCTION_BEGIN(paging_on) 113 paging_on: 112 114 movl %cr0, %edx 113 orl $ CR0_PG, %edx /* paging on */115 orl $(1 << 31), %edx /* paging on */ 114 116 115 117 /* Clear Cache Disable and not Write Though */ 116 andl $~( CR0_CD | CR0_NW), %edx118 andl $~((1 << 30) | (1 << 29)), %edx 117 119 movl %edx, %cr0 118 120 jmp 0f … … 120 122 0: 121 123 ret 122 FUNCTION_END(paging_on)123 124 124 125 /** Enable local APIC … … 127 128 * 128 129 */ 129 FUNCTION_BEGIN(enable_l_apic_in_msr) 130 movl $ IA32_MSR_APIC_BASE, %ecx130 enable_l_apic_in_msr: 131 movl $0x1b, %ecx 131 132 rdmsr 132 orl $(L_APIC_BASE | IA32_APIC_BASE_GE), %eax 133 orl $(1 << 11), %eax 134 orl $(0xfee00000), %eax 133 135 wrmsr 134 136 ret 135 FUNCTION_END(enable_l_apic_in_msr) 137 138 #define ISTATE_OFFSET_EDX 0 139 #define ISTATE_OFFSET_ECX 4 140 #define ISTATE_OFFSET_EBX 8 141 #define ISTATE_OFFSET_ESI 12 142 #define ISTATE_OFFSET_EDI 16 143 #define ISTATE_OFFSET_EBP 20 144 #define ISTATE_OFFSET_EAX 24 145 #define ISTATE_OFFSET_EBP_FRAME 28 146 #define ISTATE_OFFSET_EIP_FRAME 32 147 #define ISTATE_OFFSET_GS 36 148 #define ISTATE_OFFSET_FS 40 149 #define ISTATE_OFFSET_ES 44 150 #define ISTATE_OFFSET_DS 48 151 #define ISTATE_OFFSET_ERROR_WORD 52 152 #define ISTATE_OFFSET_EIP 56 153 #define ISTATE_OFFSET_CS 60 154 #define ISTATE_OFFSET_EFLAGS 64 155 #define ISTATE_OFFSET_ESP 68 156 #define ISTATE_OFFSET_SS 72 136 157 137 158 /* … … 139 160 * and without the error word. 140 161 */ 141 #define ISTATE_SOFT_SIZE ISTATE_SIZE - (6 * 4)162 #define ISTATE_SOFT_SIZE 52 142 163 143 164 /* … … 150 171 * entirely in registers. 151 172 */ 152 SYMBOL(sysenter_handler) 173 .global sysenter_handler 174 sysenter_handler: 153 175 154 176 /* … … 183 205 184 206 /* 207 * Save TLS. 208 */ 209 movl %gs, %edx 210 movl %edx, ISTATE_OFFSET_GS(%esp) 211 212 /* 185 213 * Switch to kernel selectors. 186 214 */ 187 movl $(GDT_SELECTOR(KDATA_DES)), %eax 188 movl %eax, %ds 189 movl %eax, %es 190 movl $(GDT_SELECTOR(VREG_DES)), %eax 191 movl %eax, %gs 215 movw $(GDT_SELECTOR(KDATA_DES)), %ax 216 movw %ax, %ds 217 movw %ax, %es 192 218 193 219 /* … … 209 235 210 236 /* 237 * Restore TLS. 238 */ 239 movl ISTATE_OFFSET_GS(%esp), %edx 240 movl %edx, %gs 241 242 /* 211 243 * Prepare return address and userspace stack for SYSEXIT. 212 244 */ … … 219 251 * This is the legacy syscall handler using the interrupt mechanism. 220 252 */ 221 SYMBOL(int_syscall) 253 .global int_syscall 254 int_syscall: 222 255 subl $(ISTATE_SOFT_SIZE + 4), %esp 223 256 … … 242 275 243 276 /* 244 * Save the se gmentregisters.277 * Save the selector registers. 245 278 */ 246 279 movl %gs, %ecx … … 262 295 movl %eax, %ds 263 296 movl %eax, %es 264 movl $(GDT_SELECTOR(VREG_DES)), %eax265 movl %eax, %gs266 297 267 298 movl $0, ISTATE_OFFSET_EBP_FRAME(%esp) … … 276 307 277 308 /* 278 * Restore the se gmentregisters.309 * Restore the selector registers. 279 310 */ 280 311 movl ISTATE_OFFSET_GS(%esp), %ecx … … 307 338 308 339 .macro handler i 309 SYMBOL(int_\i) 340 .global int_\i 341 int_\i: 310 342 /* 311 343 * This macro distinguishes between two versions of ia32 … … 346 378 347 379 /* 348 * Save the se gmentregisters.380 * Save the selector registers. 349 381 */ 350 382 movl %gs, %ecx … … 366 398 movl %eax, %ds 367 399 movl %eax, %es 368 movl $(GDT_SELECTOR(VREG_DES)), %eax369 movl %eax, %gs370 400 371 401 /* … … 451 481 * 452 482 */ 453 FUNCTION_BEGIN(early_putchar) 483 early_putchar: 454 484 455 485 #if ((defined(CONFIG_EGA)) && (!defined(CONFIG_FB))) … … 583 613 584 614 ret 585 FUNCTION_END(early_putchar) 586 615
Note:
See TracChangeset
for help on using the changeset viewer.