Changeset 1d3d2cf in mainline
- Timestamp:
- 2010-08-11T14:18:34Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- be3f94c
- Parents:
- 482dde7
- Location:
- kernel/arch
- Files:
-
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/amd64/include/pm.h
r482dde7 r1d3d2cf 65 65 #endif /* CONFIG_FB */ 66 66 67 #define gdtselector(des) ((des) << 3) 68 #define idtselector(des) ((des) << 4) 67 #define GDT_SELECTOR(des) ((des) << 3) 69 68 70 69 #define PL_KERNEL 0 … … 168 167 169 168 extern ptr_16_64_t gdtr; 170 extern ptr_16_32_t bootstrap_gdtr;171 169 extern ptr_16_32_t protected_ap_gdtr; 172 170 -
kernel/arch/amd64/src/asm.S
r482dde7 r1d3d2cf 244 244 */ 245 245 xorq %rdx, %rdx 246 cmpq $( gdtselector(KTEXT_DES)), ISTATE_OFFSET_CS(%rsp)246 cmpq $(GDT_SELECTOR(KTEXT_DES)), ISTATE_OFFSET_CS(%rsp) 247 247 cmovnzq %rdx, %rbp 248 248 -
kernel/arch/amd64/src/boot/boot.S
r482dde7 r1d3d2cf 85 85 86 86 /* Kernel data + stack */ 87 movw $ gdtselector(KDATA_DES), %cx87 movw $GDT_SELECTOR(KDATA_DES), %cx 88 88 movw %cx, %es 89 89 movw %cx, %ds … … 94 94 * when _visible_ part of GS does not point to user-mode segment. 95 95 */ 96 movw $ gdtselector(UDATA_DES), %cx96 movw $GDT_SELECTOR(UDATA_DES), %cx 97 97 movw %cx, %fs 98 98 movw %cx, %gs 99 99 100 jmpl $ gdtselector(KTEXT32_DES), $multiboot_meeting_point100 jmpl $GDT_SELECTOR(KTEXT32_DES), $multiboot_meeting_point 101 101 multiboot_meeting_point: 102 102 … … 182 182 183 183 /* At this point we are in compatibility mode */ 184 jmpl $ gdtselector(KTEXT_DES), $start64184 jmpl $GDT_SELECTOR(KTEXT_DES), $start64 185 185 186 186 /** Print string to EGA display (in light red) and halt. … … 645 645 .section K_DATA_START, "aw", @progbits 646 646 647 .global bootstrap_gdtr648 647 bootstrap_gdtr: 649 .word gdtselector(GDT_ITEMS)648 .word GDT_SELECTOR(GDT_ITEMS) 650 649 .long KA2PA(gdt) 651 650 -
kernel/arch/amd64/src/boot/vesa_ret.inc
r482dde7 r1d3d2cf 7 7 8 8 /* Kernel data + stack */ 9 movw $ gdtselector(KDATA_DES), %cx9 movw $GDT_SELECTOR(KDATA_DES), %cx 10 10 movw %cx, %es 11 11 movw %cx, %ds … … 17 17 */ 18 18 19 movw $ gdtselector(UDATA_DES), %cx19 movw $GDT_SELECTOR(UDATA_DES), %cx 20 20 movw %cx, %fs 21 21 movw %cx, %gs 22 22 23 jmpl $ gdtselector(KTEXT32_DES), $vesa_meeting_point23 jmpl $GDT_SELECTOR(KTEXT32_DES), $vesa_meeting_point -
kernel/arch/amd64/src/ddi/ddi.c
r482dde7 r1d3d2cf 153 153 tss_descriptor_t *tss_desc = (tss_descriptor_t *) &gdt_p[TSS_DES]; 154 154 tss_desc->type = AR_TSS; 155 tr_load( gdtselector(TSS_DES));155 tr_load(GDT_SELECTOR(TSS_DES)); 156 156 157 157 /* -
kernel/arch/amd64/src/pm.c
r482dde7 r1d3d2cf 171 171 172 172 d->unused = 0; 173 d->selector = gdtselector(KTEXT_DES);173 d->selector = GDT_SELECTOR(KTEXT_DES); 174 174 175 175 d->present = 1; … … 291 291 * to its own TSS. We just need to load the TR register. 292 292 */ 293 tr_load( gdtselector(TSS_DES));293 tr_load(GDT_SELECTOR(TSS_DES)); 294 294 } 295 295 -
kernel/arch/amd64/src/smp/ap.S
r482dde7 r1d3d2cf 61 61 orl $1, %eax 62 62 movl %eax, %cr0 # switch to protected mode 63 jmpl $ gdtselector(KTEXT32_DES), $jump_to_kernel - BOOT_OFFSET + AP_BOOT_OFFSET63 jmpl $GDT_SELECTOR(KTEXT32_DES), $jump_to_kernel - BOOT_OFFSET + AP_BOOT_OFFSET 64 64 65 65 jump_to_kernel: 66 66 .code32 67 movw $ gdtselector(KDATA_DES), %ax67 movw $GDT_SELECTOR(KDATA_DES), %ax 68 68 movw %ax, %ds 69 69 movw %ax, %es 70 70 movw %ax, %ss 71 movw $ gdtselector(UDATA_DES), %ax71 movw $GDT_SELECTOR(UDATA_DES), %ax 72 72 movw %ax, %gs 73 73 … … 94 94 95 95 # At this point we are in compatibility mode 96 jmpl $ gdtselector(KTEXT_DES), $start64 - BOOT_OFFSET + AP_BOOT_OFFSET96 jmpl $GDT_SELECTOR(KTEXT_DES), $start64 - BOOT_OFFSET + AP_BOOT_OFFSET 97 97 98 98 .code64 -
kernel/arch/amd64/src/syscall.c
r482dde7 r1d3d2cf 58 58 */ 59 59 write_msr(AMD_MSR_STAR, 60 ((uint64_t) (gdtselector(KDATA_DES) | PL_USER) << 48) |61 ((uint64_t) (gdtselector(KTEXT_DES) | PL_KERNEL) << 32));60 ((uint64_t) (GDT_SELECTOR(KDATA_DES) | PL_USER) << 48) | 61 ((uint64_t) (GDT_SELECTOR(KTEXT_DES) | PL_KERNEL) << 32)); 62 62 write_msr(AMD_MSR_LSTAR, (uint64_t)syscall_entry); 63 63 /* Mask RFLAGS on syscall -
kernel/arch/amd64/src/userspace.c
r482dde7 r1d3d2cf 65 65 "xorq %%rdi, %%rdi\n" 66 66 "iretq\n" 67 :: [udata_des] "i" ( gdtselector(UDATA_DES) | PL_USER),67 :: [udata_des] "i" (GDT_SELECTOR(UDATA_DES) | PL_USER), 68 68 [stack_size] "r" (kernel_uarg->uspace_stack + THREAD_STACK_SIZE), 69 69 [ipl] "r" (ipl), 70 [utext_des] "i" ( gdtselector(UTEXT_DES) | PL_USER),70 [utext_des] "i" (GDT_SELECTOR(UTEXT_DES) | PL_USER), 71 71 [entry] "r" (kernel_uarg->uspace_entry), 72 72 [uarg] "r" (kernel_uarg->uspace_uarg) -
kernel/arch/ia32/include/pm.h
r482dde7 r1d3d2cf 58 58 #endif /* CONFIG_FB */ 59 59 60 #define gdtselector(des) ((des) << 3)60 #define GDT_SELECTOR(des) ((des) << 3) 61 61 62 62 #define PL_KERNEL 0 … … 153 153 154 154 extern ptr_16_32_t gdtr; 155 extern ptr_16_32_t bootstrap_gdtr;156 155 extern ptr_16_32_t protected_ap_gdtr; 157 156 extern tss_t *tss_p; -
kernel/arch/ia32/src/asm.S
r482dde7 r1d3d2cf 225 225 * Switch to kernel selectors. 226 226 */ 227 movw $( gdtselector(KDATA_DES)), %ax227 movw $(GDT_SELECTOR(KDATA_DES)), %ax 228 228 movw %ax, %ds 229 229 movw %ax, %es … … 304 304 * Switch to kernel selectors. 305 305 */ 306 movl $( gdtselector(KDATA_DES)), %eax306 movl $(GDT_SELECTOR(KDATA_DES)), %eax 307 307 movl %eax, %ds 308 308 movl %eax, %es … … 407 407 * Switch to kernel selectors. 408 408 */ 409 movl $( gdtselector(KDATA_DES)), %eax409 movl $(GDT_SELECTOR(KDATA_DES)), %eax 410 410 movl %eax, %ds 411 411 movl %eax, %es … … 416 416 */ 417 417 xorl %eax, %eax 418 cmpl $( gdtselector(KTEXT_DES)), ISTATE_OFFSET_CS(%esp)418 cmpl $(GDT_SELECTOR(KTEXT_DES)), ISTATE_OFFSET_CS(%esp) 419 419 cmovnzl %eax, %ebp 420 420 -
kernel/arch/ia32/src/boot/boot.S
r482dde7 r1d3d2cf 78 78 79 79 /* Initialize Global Descriptor Table register */ 80 lgdtl KA2PA(bootstrap_gdtr)80 lgdtl bootstrap_gdtr 81 81 82 82 /* Kernel data + stack */ 83 movw $ gdtselector(KDATA_DES), %cx83 movw $GDT_SELECTOR(KDATA_DES), %cx 84 84 movw %cx, %es 85 85 movw %cx, %fs … … 88 88 movw %cx, %ss 89 89 90 jmpl $ gdtselector(KTEXT_DES), $multiboot_meeting_point90 jmpl $GDT_SELECTOR(KTEXT_DES), $multiboot_meeting_point 91 91 multiboot_meeting_point: 92 92 … … 514 514 page_directory: 515 515 .space 4096, 0 516 517 bootstrap_gdtr: 518 .word GDT_SELECTOR(GDT_ITEMS) 519 .long KA2PA(gdt) 516 520 517 521 grub_eax: -
kernel/arch/ia32/src/boot/vesa_real.inc
r482dde7 r1d3d2cf 30 30 .code32 31 31 vesa_init: 32 jmp $ gdtselector(VESA_INIT_DES), $vesa_init_real - vesa_init32 jmp $GDT_SELECTOR(VESA_INIT_DES), $vesa_init_real - vesa_init 33 33 34 34 .code16 … … 335 335 vesa_leave_real2: 336 336 337 ljmpl $ gdtselector(KTEXT32_DES), $(vesa_init_protected - vesa_init + VESA_INIT_SEGMENT << 4)337 ljmpl $GDT_SELECTOR(KTEXT32_DES), $(vesa_init_protected - vesa_init + VESA_INIT_SEGMENT << 4) 338 338 339 339 no_mode: -
kernel/arch/ia32/src/boot/vesa_ret.inc
r482dde7 r1d3d2cf 7 7 8 8 /* Kernel data + stack */ 9 movw $ gdtselector(KDATA_DES), %cx9 movw $GDT_SELECTOR(KDATA_DES), %cx 10 10 movw %cx, %es 11 11 movw %cx, %fs … … 14 14 movw %cx, %ss 15 15 16 jmpl $ gdtselector(KTEXT_DES), $vesa_meeting_point16 jmpl $GDT_SELECTOR(KTEXT_DES), $vesa_meeting_point -
kernel/arch/ia32/src/ddi/ddi.c
r482dde7 r1d3d2cf 153 153 */ 154 154 gdt_p[TSS_DES].access = AR_PRESENT | AR_TSS | DPL_KERNEL; 155 tr_load( gdtselector(TSS_DES));155 tr_load(GDT_SELECTOR(TSS_DES)); 156 156 157 157 /* -
kernel/arch/ia32/src/pm.c
r482dde7 r1d3d2cf 86 86 87 87 /* gdtr is changed by kmp before next CPU is initialized */ 88 ptr_16_32_t bootstrap_gdtr = { .limit = sizeof(gdt), .base = KA2PA((uintptr_t) gdt) };89 88 ptr_16_32_t gdtr = { .limit = sizeof(gdt), .base = (uintptr_t) gdt }; 90 89 … … 128 127 129 128 d->unused = 0; 130 d->selector = gdtselector(KTEXT_DES);129 d->selector = GDT_SELECTOR(KTEXT_DES); 131 130 132 131 if (i == VECTOR_SYSCALL) { … … 283 282 * to its own TSS. We just need to load the TR register. 284 283 */ 285 tr_load( gdtselector(TSS_DES));284 tr_load(GDT_SELECTOR(TSS_DES)); 286 285 287 286 clean_IOPL_NT_flags(); /* Disable I/O on nonprivileged levels and clear NT flag. */ -
kernel/arch/ia32/src/proc/scheduler.c
r482dde7 r1d3d2cf 67 67 /* Set kernel stack for CPL3 -> CPL0 switch via interrupt */ 68 68 CPU->arch.tss->esp0 = kstk; 69 CPU->arch.tss->ss0 = gdtselector(KDATA_DES);69 CPU->arch.tss->ss0 = GDT_SELECTOR(KDATA_DES); 70 70 71 71 /* Set up TLS in GS register */ -
kernel/arch/ia32/src/syscall.c
r482dde7 r1d3d2cf 45 45 46 46 /* set kernel mode CS selector */ 47 write_msr(IA32_MSR_SYSENTER_CS, gdtselector(KTEXT_DES));47 write_msr(IA32_MSR_SYSENTER_CS, GDT_SELECTOR(KTEXT_DES)); 48 48 /* set kernel mode entry point */ 49 49 write_msr(IA32_MSR_SYSENTER_EIP, (uint32_t) sysenter_handler); -
kernel/arch/ia32/src/userspace.c
r482dde7 r1d3d2cf 75 75 "iret\n" 76 76 : 77 : [udata_des] "i" ( gdtselector(UDATA_DES) | PL_USER),77 : [udata_des] "i" (GDT_SELECTOR(UDATA_DES) | PL_USER), 78 78 [stack_size] "r" ((uint8_t *) kernel_uarg->uspace_stack + THREAD_STACK_SIZE), 79 79 [ipl] "r" (ipl), 80 [utext_des] "i" ( gdtselector(UTEXT_DES) | PL_USER),80 [utext_des] "i" (GDT_SELECTOR(UTEXT_DES) | PL_USER), 81 81 [entry] "r" (kernel_uarg->uspace_entry), 82 82 [uarg] "r" (kernel_uarg->uspace_uarg), 83 [tls_des] "r" ( gdtselector(TLS_DES))83 [tls_des] "r" (GDT_SELECTOR(TLS_DES)) 84 84 : "eax"); 85 85
Note:
See TracChangeset
for help on using the changeset viewer.