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