Changeset 8fb1bf82 in mainline for kernel/arch/amd64/src
- Timestamp:
- 2010-11-25T13:42:50Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 8df8415
- Parents:
- a93d79a (diff), eb667613 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - Location:
- kernel/arch/amd64/src
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/amd64/src/asm.S
ra93d79a r8fb1bf82 95 95 memcpy_from_uspace_failover_address: 96 96 memcpy_to_uspace_failover_address: 97 xor q %rax, %rax /* return 0, failure */97 xorl %eax, %eax /* return 0, failure */ 98 98 ret 99 99 … … 143 143 144 144 set_efer_flag: 145 mov q $0xc0000080, %rcx145 movl $0xc0000080, %ecx 146 146 rdmsr 147 147 btsl %edi, %eax … … 150 150 151 151 read_efer_flag: 152 mov q $0xc0000080, %rcx152 movl $0xc0000080, %ecx 153 153 rdmsr 154 154 ret … … 243 243 * Stop stack traces here if we came from userspace. 244 244 */ 245 xor q %rdx, %rdx245 xorl %edx, %edx 246 246 cmpq $(GDT_SELECTOR(KTEXT_DES)), ISTATE_OFFSET_CS(%rsp) 247 247 cmovnzq %rdx, %rbp … … 386 386 movq ISTATE_OFFSET_RSP(%rsp), %rsp 387 387 388 /* 389 * Clear the rest of the scratch registers to prevent information leak. 390 * The 32-bit XOR on the low GPRs actually clears the entire 64-bit 391 * register and the instruction is shorter. 392 */ 393 xorl %edx, %edx 394 xorl %esi, %esi 395 xorl %edi, %edi 396 xorq %r8, %r8 397 xorq %r9, %r9 398 xorq %r10, %r10 399 388 400 sysretq 389 401 … … 413 425 movq %rdi, %rsi 414 426 movq $(PA2KA(0xb8000)), %rdi /* base of EGA text mode memory */ 415 xor q %rax, %rax427 xorl %eax, %eax 416 428 417 429 /* Read bits 8 - 15 of the cursor address */ … … 493 505 movq $(PA2KA(0xb80a0)), %rsi 494 506 movq $(PA2KA(0xb8000)), %rdi 495 mov q $480, %rcx507 movl $480, %ecx 496 508 rep movsq 497 509 498 510 /* Clear the 24th row */ 499 xor q %rax, %rax500 mov q $20, %rcx511 xorl %eax, %eax 512 movl $20, %ecx 501 513 rep stosq 502 514 -
kernel/arch/amd64/src/boot/boot.S
ra93d79a r8fb1bf82 516 516 movq $(PA2KA(0xb80a0)), %rsi 517 517 movq $(PA2KA(0xb8000)), %rdi 518 mov q $480, %rcx518 movl $480, %ecx 519 519 rep movsq 520 520 521 521 /* Clear the 24th row */ 522 xor q %rax, %rax523 mov q $20, %rcx522 xorl %eax, %eax 523 movl $20, %ecx 524 524 rep stosq 525 525 -
kernel/arch/amd64/src/boot/memmap.c
ra93d79a r8fb1bf82 35 35 #include <arch/boot/memmap.h> 36 36 37 uint8_t e820counter = 0xff ;37 uint8_t e820counter = 0xffU; 38 38 e820memmap_t e820table[MEMMAP_E820_MAX_RECORDS]; 39 39 -
kernel/arch/amd64/src/context.S
ra93d79a r8fb1bf82 45 45 CONTEXT_SAVE_ARCH_CORE %rdi %rdx 46 46 47 xor q %rax, %rax # context_save returns 148 inc q %rax47 xorl %eax, %eax # context_save returns 1 48 incl %eax 49 49 ret 50 50 … … 60 60 movq %rdx, (%rsp) 61 61 62 xor q %rax, %rax # context_restore returns 062 xorl %eax, %eax # context_restore returns 0 63 63 ret -
kernel/arch/amd64/src/cpu/cpu.c
ra93d79a r8fb1bf82 47 47 * Contains only non-MP-Specification specific SMP code. 48 48 */ 49 #define AMD_CPUID_EBX 0x6874754150 #define AMD_CPUID_ECX 0x444d416351 #define AMD_CPUID_EDX 0x69746e6549 #define AMD_CPUID_EBX UINT32_C(0x68747541) 50 #define AMD_CPUID_ECX UINT32_C(0x444d4163) 51 #define AMD_CPUID_EDX UINT32_C(0x69746e65) 52 52 53 #define INTEL_CPUID_EBX 0x756e6547 54 #define INTEL_CPUID_ECX 0x6c65746e 55 #define INTEL_CPUID_EDX 0x49656e69 56 53 #define INTEL_CPUID_EBX UINT32_C(0x756e6547) 54 #define INTEL_CPUID_ECX UINT32_C(0x6c65746e) 55 #define INTEL_CPUID_EDX UINT32_C(0x49656e69) 57 56 58 57 enum vendor { -
kernel/arch/amd64/src/ddi/ddi.c
ra93d79a r8fb1bf82 126 126 bitmap_initialize(&iomap, CPU->arch.tss->iomap, 127 127 TSS_IOMAP_SIZE * 8); 128 bitmap_copy(&iomap, &TASK->arch.iomap, TASK->arch.iomap.bits);128 bitmap_copy(&iomap, &TASK->arch.iomap, bits); 129 129 130 /* 131 * Set the trailing bits in the last byte of the map to disable 132 * I/O access. 133 */ 134 bitmap_set_range(&iomap, bits, ALIGN_UP(bits, 8) - bits); 130 135 /* 131 136 * It is safe to set the trailing eight bits because of the 132 137 * extra convenience byte in TSS_IOMAP_SIZE. 133 138 */ 134 bitmap_set_range(&iomap, ALIGN_UP( TASK->arch.iomap.bits, 8), 8);139 bitmap_set_range(&iomap, ALIGN_UP(bits, 8), 8); 135 140 } 136 141 irq_spinlock_unlock(&TASK->lock, false); -
kernel/arch/amd64/src/debugger.c
ra93d79a r8fb1bf82 126 126 /* Disable breakpoint in DR7 */ 127 127 unative_t dr7 = read_dr7(); 128 dr7 &= ~(0x 2<< (curidx * 2));128 dr7 &= ~(0x02U << (curidx * 2)); 129 129 130 130 /* Setup DR register */ … … 147 147 148 148 /* Set type to requested breakpoint & length*/ 149 dr7 &= ~(0x 3<< (16 + 4 * curidx));150 dr7 &= ~(0x 3<< (18 + 4 * curidx));149 dr7 &= ~(0x03U << (16 + 4 * curidx)); 150 dr7 &= ~(0x03U << (18 + 4 * curidx)); 151 151 152 152 if (!(flags & BKPOINT_INSTR)) { 153 153 #ifdef __32_BITS__ 154 dr7 |= ((unative_t) 0x 3) << (18 + 4 * curidx);154 dr7 |= ((unative_t) 0x03U) << (18 + 4 * curidx); 155 155 #endif 156 156 157 157 #ifdef __64_BITS__ 158 dr7 |= ((unative_t) 0x 2) << (18 + 4 * curidx);158 dr7 |= ((unative_t) 0x02U) << (18 + 4 * curidx); 159 159 #endif 160 160 161 161 if ((flags & BKPOINT_WRITE)) 162 dr7 |= ((unative_t) 0x 1) << (16 + 4 * curidx);162 dr7 |= ((unative_t) 0x01U) << (16 + 4 * curidx); 163 163 else if ((flags & BKPOINT_READ_WRITE)) 164 dr7 |= ((unative_t) 0x 3) << (16 + 4 * curidx);164 dr7 |= ((unative_t) 0x03U) << (16 + 4 * curidx); 165 165 } 166 166 167 167 /* Enable global breakpoint */ 168 dr7 |= 0x 2<< (curidx * 2);168 dr7 |= 0x02U << (curidx * 2); 169 169 170 170 write_dr7(dr7); … … 260 260 } 261 261 262 cur->address = NULL;262 cur->address = (uintptr_t) NULL; 263 263 264 264 setup_dr(slot); … … 313 313 unsigned int i; 314 314 for (i = 0; i < BKPOINTS_MAX; i++) 315 breakpoints[i].address = NULL;315 breakpoints[i].address = (uintptr_t) NULL; 316 316 317 317 #ifdef CONFIG_KCONSOLE -
kernel/arch/amd64/src/pm.c
ra93d79a r8fb1bf82 28 28 */ 29 29 30 /** @addtogroup amd64 30 /** @addtogroup amd64 31 31 * @{ 32 32 */ … … 52 52 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 53 53 /* KTEXT descriptor */ 54 { .limit_0_15 = 0xffff ,55 .base_0_15 = 0, 56 .base_16_23 = 0, 57 .access = AR_PRESENT | AR_CODE | DPL_KERNEL | AR_READABLE, 58 .limit_16_19 = 0x f,59 .available = 0, 60 .longmode = 1, 54 { .limit_0_15 = 0xffffU, 55 .base_0_15 = 0, 56 .base_16_23 = 0, 57 .access = AR_PRESENT | AR_CODE | DPL_KERNEL | AR_READABLE, 58 .limit_16_19 = 0x0fU, 59 .available = 0, 60 .longmode = 1, 61 61 .special = 0, 62 .granularity = 1, 62 .granularity = 1, 63 63 .base_24_31 = 0 }, 64 64 /* KDATA descriptor */ 65 { .limit_0_15 = 0xffff ,66 .base_0_15 = 0, 67 .base_16_23 = 0, 68 .access = AR_PRESENT | AR_DATA | AR_WRITABLE | DPL_KERNEL, 69 .limit_16_19 = 0x f,70 .available = 0, 71 .longmode = 0, 72 .special = 0, 73 .granularity = 1, 65 { .limit_0_15 = 0xffffU, 66 .base_0_15 = 0, 67 .base_16_23 = 0, 68 .access = AR_PRESENT | AR_DATA | AR_WRITABLE | DPL_KERNEL, 69 .limit_16_19 = 0x0fU, 70 .available = 0, 71 .longmode = 0, 72 .special = 0, 73 .granularity = 1, 74 74 .base_24_31 = 0 }, 75 75 /* UDATA descriptor */ 76 { .limit_0_15 = 0xffff ,77 .base_0_15 = 0, 78 .base_16_23 = 0, 79 .access = AR_PRESENT | AR_DATA | AR_WRITABLE | DPL_USER, 80 .limit_16_19 = 0x f,81 .available = 0, 82 .longmode = 0, 83 .special = 1, 84 .granularity = 1, 76 { .limit_0_15 = 0xffffU, 77 .base_0_15 = 0, 78 .base_16_23 = 0, 79 .access = AR_PRESENT | AR_DATA | AR_WRITABLE | DPL_USER, 80 .limit_16_19 = 0x0fU, 81 .available = 0, 82 .longmode = 0, 83 .special = 1, 84 .granularity = 1, 85 85 .base_24_31 = 0 }, 86 86 /* UTEXT descriptor */ 87 { .limit_0_15 = 0xffff ,88 .base_0_15 = 0, 89 .base_16_23 = 0, 90 .access = AR_PRESENT | AR_CODE | DPL_USER, 91 .limit_16_19 = 0x f,92 .available = 0, 93 .longmode = 1, 94 .special = 0, 95 .granularity = 1, 87 { .limit_0_15 = 0xffffU, 88 .base_0_15 = 0, 89 .base_16_23 = 0, 90 .access = AR_PRESENT | AR_CODE | DPL_USER, 91 .limit_16_19 = 0x0fU, 92 .available = 0, 93 .longmode = 1, 94 .special = 0, 95 .granularity = 1, 96 96 .base_24_31 = 0 }, 97 97 /* KTEXT 32-bit protected, for protected mode before long mode */ 98 { .limit_0_15 = 0xffff ,99 .base_0_15 = 0, 100 .base_16_23 = 0, 101 .access = AR_PRESENT | AR_CODE | DPL_KERNEL | AR_READABLE, 102 .limit_16_19 = 0x f,103 .available = 0, 104 .longmode = 0, 98 { .limit_0_15 = 0xffffU, 99 .base_0_15 = 0, 100 .base_16_23 = 0, 101 .access = AR_PRESENT | AR_CODE | DPL_KERNEL | AR_READABLE, 102 .limit_16_19 = 0x0fU, 103 .available = 0, 104 .longmode = 0, 105 105 .special = 1, 106 .granularity = 1, 106 .granularity = 1, 107 107 .base_24_31 = 0 }, 108 108 /* TSS descriptor - set up will be completed later, … … 111 111 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 112 112 /* VESA Init descriptor */ 113 #ifdef CONFIG_FB 114 { 0xffff, 0, VESA_INIT_SEGMENT >> 12, AR_PRESENT | AR_CODE | DPL_KERNEL, 115 0xf, 0, 0, 0, 0, 0 113 #ifdef CONFIG_FB 114 { 115 0xffff, 0, VESA_INIT_SEGMENT >> 12, AR_PRESENT | AR_CODE | DPL_KERNEL, 116 0xf, 0, 0, 0, 0, 0 116 117 } 117 118 #endif … … 129 130 { 130 131 tss_descriptor_t *td = (tss_descriptor_t *) d; 131 132 td->base_0_15 = base & 0xffff ;133 td->base_16_23 = ((base) >> 16) & 0xff ;134 td->base_24_31 = ((base) >> 24) & 0xff ;132 133 td->base_0_15 = base & 0xffffU; 134 td->base_16_23 = ((base) >> 16) & 0xffU; 135 td->base_24_31 = ((base) >> 24) & 0xffU; 135 136 td->base_32_63 = ((base) >> 32); 136 137 } … … 140 141 tss_descriptor_t *td = (tss_descriptor_t *) d; 141 142 142 td->limit_0_15 = limit & 0xffff ;143 td->limit_16_19 = (limit >> 16) & 0x f;143 td->limit_0_15 = limit & 0xffffU; 144 td->limit_16_19 = (limit >> 16) & 0x0fU; 144 145 } 145 146 … … 149 150 * Offset is a linear address. 150 151 */ 151 d->offset_0_15 = offset & 0xffff ;152 d->offset_16_31 = offset >> 16 & 0xffff;152 d->offset_0_15 = offset & 0xffffU; 153 d->offset_16_31 = (offset >> 16) & 0xffffU; 153 154 d->offset_32_63 = offset >> 32; 154 155 } … … 165 166 { 166 167 idescriptor_t *d; 167 int i;168 168 unsigned int i; 169 169 170 for (i = 0; i < IDT_ITEMS; i++) { 170 171 d = &idt[i]; 171 172 172 173 d->unused = 0; 173 174 d->selector = GDT_SELECTOR(KTEXT_DES); 174 175 175 176 d->present = 1; 176 d->type = AR_INTERRUPT; /* masking interrupt */177 d->type = AR_INTERRUPT; /* masking interrupt */ 177 178 } 178 179 179 180 d = &idt[0]; 180 181 idt_setoffset(d++, (uintptr_t) &int_0);
Note:
See TracChangeset
for help on using the changeset viewer.
