Changeset 7bdcc45 in mainline for kernel/arch/amd64
- Timestamp:
- 2010-12-16T16:38:49Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 7837101
- Parents:
- 8e58f94 (diff), eb221e5 (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
- Files:
-
- 18 edited
-
include/asm.h (modified) (4 diffs)
-
include/context.h (modified) (2 diffs)
-
include/context_offset.h (modified) (3 diffs)
-
include/cpu.h (modified) (1 diff)
-
include/debugger.h (modified) (1 diff)
-
include/istate.h (modified) (3 diffs)
-
include/mm/as.h (modified) (1 diff)
-
include/mm/page.h (modified) (3 diffs)
-
include/pm.h (modified) (1 diff)
-
include/proc/thread.h (modified) (1 diff)
-
include/types.h (modified) (2 diffs)
-
src/amd64.c (modified) (1 diff)
-
src/boot/memmap.c (modified) (1 diff)
-
src/cpu/cpu.c (modified) (1 diff)
-
src/debugger.c (modified) (9 diffs)
-
src/interrupt.c (modified) (1 diff)
-
src/mm/page.c (modified) (2 diffs)
-
src/pm.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/amd64/include/asm.h
r8e58f94 r7bdcc45 304 304 } 305 305 306 NO_TRACE static inline unative_t read_msr(uint32_t msr)306 NO_TRACE static inline sysarg_t read_msr(uint32_t msr) 307 307 { 308 308 uint32_t ax, dx; … … 343 343 asm volatile ( 344 344 "invlpg %[addr]\n" 345 :: [addr] "m" (*(( unative_t *) addr))345 :: [addr] "m" (*((sysarg_t *) addr)) 346 346 ); 347 347 } … … 398 398 } 399 399 400 #define GEN_READ_REG(reg) NO_TRACE static inline unative_t read_ ##reg (void) \400 #define GEN_READ_REG(reg) NO_TRACE static inline sysarg_t read_ ##reg (void) \ 401 401 { \ 402 unative_t res; \402 sysarg_t res; \ 403 403 asm volatile ( \ 404 404 "movq %%" #reg ", %[res]" \ … … 408 408 } 409 409 410 #define GEN_WRITE_REG(reg) NO_TRACE static inline void write_ ##reg ( unative_t regn) \410 #define GEN_WRITE_REG(reg) NO_TRACE static inline void write_ ##reg (sysarg_t regn) \ 411 411 { \ 412 412 asm volatile ( \ -
kernel/arch/amd64/include/context.h
r8e58f94 r7bdcc45 27 27 */ 28 28 29 /** @addtogroup amd64 29 /** @addtogroup amd64 30 30 * @{ 31 31 */ … … 44 44 * panic sooner or later 45 45 */ 46 #define SP_DELTA 1646 #define SP_DELTA 16 47 47 48 48 #define context_set(c, _pc, stack, size) \ -
kernel/arch/amd64/include/context_offset.h
r8e58f94 r7bdcc45 30 30 #define KERN_amd64_CONTEXT_OFFSET_H_ 31 31 32 #define OFFSET_SP 0x033 #define OFFSET_PC 0x834 #define OFFSET_RBX 0x1035 #define OFFSET_RBP 0x1836 #define OFFSET_R12 0x2037 #define OFFSET_R13 0x2838 #define OFFSET_R14 0x3039 #define OFFSET_R15 0x3832 #define OFFSET_SP 0x00 33 #define OFFSET_PC 0x08 34 #define OFFSET_RBX 0x10 35 #define OFFSET_RBP 0x18 36 #define OFFSET_R12 0x20 37 #define OFFSET_R13 0x28 38 #define OFFSET_R14 0x30 39 #define OFFSET_R15 0x38 40 40 41 41 #ifdef KERNEL 42 # define OFFSET_IPL0x4042 #define OFFSET_IPL 0x40 43 43 #else 44 # define OFFSET_TLS0x4044 #define OFFSET_TLS 0x40 45 45 #endif 46 46 47 47 #ifdef __ASM__ 48 48 49 # ctx: address of the structure with saved context 49 # ctx: address of the structure with saved context 50 50 # pc: return address 51 51 .macro CONTEXT_SAVE_ARCH_CORE ctx:req pc:req … … 61 61 .endm 62 62 63 # ctx: address of the structure with saved context 63 # ctx: address of the structure with saved context 64 64 .macro CONTEXT_RESTORE_ARCH_CORE ctx:req pc:req 65 65 movq OFFSET_R15(\ctx), %r15 … … 68 68 movq OFFSET_R12(\ctx), %r12 69 69 movq OFFSET_RBP(\ctx), %rbp 70 movq OFFSET_RBX(\ctx), %rbx 70 movq OFFSET_RBX(\ctx), %rbx 71 71 72 72 movq OFFSET_SP(\ctx), %rsp # ctx->sp -> %rsp -
kernel/arch/amd64/include/cpu.h
r8e58f94 r7bdcc45 36 36 #define KERN_amd64_CPU_H_ 37 37 38 #define RFLAGS_CF (1 << 0)39 #define RFLAGS_PF (1 << 2)40 #define RFLAGS_AF (1 << 4)41 #define RFLAGS_ZF (1 << 6)42 #define RFLAGS_SF (1 << 7)43 #define RFLAGS_TF (1 << 8)44 #define RFLAGS_IF (1 << 9)45 #define RFLAGS_DF (1 << 10)46 #define RFLAGS_OF (1 << 11)47 #define RFLAGS_NT (1 << 14)48 #define RFLAGS_RF (1 << 16)38 #define RFLAGS_CF (1 << 0) 39 #define RFLAGS_PF (1 << 2) 40 #define RFLAGS_AF (1 << 4) 41 #define RFLAGS_ZF (1 << 6) 42 #define RFLAGS_SF (1 << 7) 43 #define RFLAGS_TF (1 << 8) 44 #define RFLAGS_IF (1 << 9) 45 #define RFLAGS_DF (1 << 10) 46 #define RFLAGS_OF (1 << 11) 47 #define RFLAGS_NT (1 << 14) 48 #define RFLAGS_RF (1 << 16) 49 49 50 50 #define EFER_MSR_NUM 0xc0000080 -
kernel/arch/amd64/include/debugger.h
r8e58f94 r7bdcc45 41 41 42 42 /* Flags that are passed to breakpoint_add function */ 43 #define BKPOINT_INSTR 0x1 44 #define BKPOINT_WRITE 0x2 45 #define BKPOINT_READ_WRITE 0x4 43 #define BKPOINT_INSTR 0x1U 44 #define BKPOINT_WRITE 0x2U 45 #define BKPOINT_READ_WRITE 0x4U 46 46 47 #define BKPOINT_CHECK_ZERO 0x8 47 #define BKPOINT_CHECK_ZERO 0x8U 48 48 49 49 -
kernel/arch/amd64/include/istate.h
r8e58f94 r7bdcc45 37 37 38 38 #ifdef KERNEL 39 39 40 #include <typedefs.h> 40 41 #include <trace.h> 41 #else 42 43 #else /* KERNEL */ 44 42 45 #include <sys/types.h> 46 43 47 #define NO_TRACE 44 #endif 48 49 #endif /* KERNEL */ 45 50 46 51 /** This is passed to interrupt handlers */ … … 61 66 uint64_t r14; 62 67 uint64_t r15; 63 uint64_t alignment; /* align rbp_frame on multiple of 16 */64 uint64_t rbp_frame; /* imitation of frame pointer linkage */65 uint64_t rip_frame; /* imitation of return address linkage */66 uint64_t error_word; /* real or fake error word */68 uint64_t alignment; /* align rbp_frame on multiple of 16 */ 69 uint64_t rbp_frame; /* imitation of frame pointer linkage */ 70 uint64_t rip_frame; /* imitation of return address linkage */ 71 uint64_t error_word; /* real or fake error word */ 67 72 uint64_t rip; 68 73 uint64_t cs; 69 74 uint64_t rflags; 70 uint64_t rsp; /* only if istate_t is from uspace */71 uint64_t ss; /* only if istate_t is from uspace */75 uint64_t rsp; /* only if istate_t is from uspace */ 76 uint64_t ss; /* only if istate_t is from uspace */ 72 77 } istate_t; 73 78 … … 75 80 NO_TRACE static inline int istate_from_uspace(istate_t *istate) 76 81 { 77 return !(istate->rip & 0x8000000000000000);82 return !(istate->rip & UINT64_C(0x8000000000000000)); 78 83 } 79 84 -
kernel/arch/amd64/include/mm/as.h
r8e58f94 r7bdcc45 36 36 #define KERN_amd64_AS_H_ 37 37 38 #define ADDRESS_SPACE_HOLE_START 0x0000800000000000ULL39 #define ADDRESS_SPACE_HOLE_END 0xffff7fffffffffffULL38 #define ADDRESS_SPACE_HOLE_START UINT64_C(0x0000800000000000) 39 #define ADDRESS_SPACE_HOLE_END UINT64_C(0xffff7fffffffffff) 40 40 41 41 #define KERNEL_ADDRESS_SPACE_SHADOWED_ARCH 0 42 42 43 #define KERNEL_ADDRESS_SPACE_START_ARCH 0xffff800000000000ULL44 #define KERNEL_ADDRESS_SPACE_END_ARCH 0xffffffffffffffffULL43 #define KERNEL_ADDRESS_SPACE_START_ARCH UINT64_C(0xffff800000000000) 44 #define KERNEL_ADDRESS_SPACE_END_ARCH UINT64_C(0xffffffffffffffff) 45 45 46 #define USER_ADDRESS_SPACE_START_ARCH 0x0000000000000000ULL47 #define USER_ADDRESS_SPACE_END_ARCH 0x00007fffffffffffULL46 #define USER_ADDRESS_SPACE_START_ARCH UINT64_C(0x0000000000000000) 47 #define USER_ADDRESS_SPACE_END_ARCH UINT64_C(0x00007fffffffffff) 48 48 49 49 #define USTACK_ADDRESS_ARCH (USER_ADDRESS_SPACE_END_ARCH - (PAGE_SIZE - 1)) -
kernel/arch/amd64/include/mm/page.h
r8e58f94 r7bdcc45 55 55 #ifndef __ASM__ 56 56 57 #define KA2PA(x) (((uintptr_t) (x)) - 0xffff800000000000)58 #define PA2KA(x) (((uintptr_t) (x)) + 0xffff800000000000)57 #define KA2PA(x) (((uintptr_t) (x)) - UINT64_C(0xffff800000000000)) 58 #define PA2KA(x) (((uintptr_t) (x)) + UINT64_C(0xffff800000000000)) 59 59 60 60 #else /* __ASM__ */ … … 78 78 79 79 /* Macros calculating indices into page tables in each level. */ 80 #define PTL0_INDEX_ARCH(vaddr) (((vaddr) >> 39) & 0x1ff )81 #define PTL1_INDEX_ARCH(vaddr) (((vaddr) >> 30) & 0x1ff )82 #define PTL2_INDEX_ARCH(vaddr) (((vaddr) >> 21) & 0x1ff )83 #define PTL3_INDEX_ARCH(vaddr) (((vaddr) >> 12) & 0x1ff )80 #define PTL0_INDEX_ARCH(vaddr) (((vaddr) >> 39) & 0x1ffU) 81 #define PTL1_INDEX_ARCH(vaddr) (((vaddr) >> 30) & 0x1ffU) 82 #define PTL2_INDEX_ARCH(vaddr) (((vaddr) >> 21) & 0x1ffU) 83 #define PTL3_INDEX_ARCH(vaddr) (((vaddr) >> 12) & 0x1ffU) 84 84 85 85 /* Get PTE address accessors for each level. */ … … 205 205 pte_t *p = &pt[i]; 206 206 207 p->addr_12_31 = (a >> 12) & 0xfffff;207 p->addr_12_31 = (a >> 12) & UINT32_C(0xfffff); 208 208 p->addr_32_51 = a >> 32; 209 209 } -
kernel/arch/amd64/include/pm.h
r8e58f94 r7bdcc45 75 75 #define AR_WRITABLE (1 << 1) 76 76 #define AR_READABLE (1 << 1) 77 #define AR_TSS (0x09 )78 #define AR_INTERRUPT (0x0e )79 #define AR_TRAP (0x0f )77 #define AR_TSS (0x09U) 78 #define AR_INTERRUPT (0x0eU) 79 #define AR_TRAP (0x0fU) 80 80 81 81 #define DPL_KERNEL (PL_KERNEL << 5) -
kernel/arch/amd64/include/proc/thread.h
r8e58f94 r7bdcc45 41 41 42 42 typedef struct { 43 unative_t tls;43 sysarg_t tls; 44 44 /** User and kernel RSP for syscalls. */ 45 45 uint64_t syscall_rsp[2]; -
kernel/arch/amd64/include/types.h
r8e58f94 r7bdcc45 43 43 typedef uint64_t ipl_t; 44 44 45 typedef uint64_t unative_t;45 typedef uint64_t sysarg_t; 46 46 typedef int64_t native_t; 47 47 typedef uint64_t atomic_count_t; … … 50 50 } fncptr_t; 51 51 52 /* Formats for uintptr_t, size_t */ 53 #define PRIp "llx" 54 #define PRIs "llu" 52 #define INTN_C(c) INT64_C(c) 53 #define UINTN_C(c) UINT64_C(c) 55 54 56 /* Formats for (u)int8_t, (u)int16_t, (u)int32_t, (u)int64_t and (u)native_t */ 57 #define PRId8 "d" 58 #define PRId16 "d" 59 #define PRId32 "d" 60 #define PRId64 "lld" 61 #define PRIdn "lld" 62 63 #define PRIu8 "u" 64 #define PRIu16 "u" 65 #define PRIu32 "u" 66 #define PRIu64 "llu" 67 #define PRIun "llu" 68 69 #define PRIx8 "x" 70 #define PRIx16 "x" 71 #define PRIx32 "x" 72 #define PRIx64 "llx" 73 #define PRIxn "llx" 55 #define PRIdn PRId64 /**< Format for native_t. */ 56 #define PRIun PRIu64 /**< Format for sysarg_t. */ 57 #define PRIxn PRIx64 /**< Format for hexadecimal sysarg_t. */ 58 #define PRIua PRIu64 /**< Format for atomic_count_t. */ 74 59 75 60 #endif -
kernel/arch/amd64/src/amd64.c
r8e58f94 r7bdcc45 256 256 * we need not to go to CPL0 to read it. 257 257 */ 258 unative_t sys_tls_set(unative_t addr)258 sysarg_t sys_tls_set(sysarg_t addr) 259 259 { 260 260 THREAD->arch.tls = addr; -
kernel/arch/amd64/src/boot/memmap.c
r8e58f94 r7bdcc45 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/cpu/cpu.c
r8e58f94 r7bdcc45 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/debugger.c
r8e58f94 r7bdcc45 125 125 126 126 /* Disable breakpoint in DR7 */ 127 unative_t dr7 = read_dr7();128 dr7 &= ~(0x 2<< (curidx * 2));127 sysarg_t dr7 = read_dr7(); 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) 0x3) << (18 + 4 * curidx);154 dr7 |= ((sysarg_t) 0x03U) << (18 + 4 * curidx); 155 155 #endif 156 156 157 157 #ifdef __64_BITS__ 158 dr7 |= (( unative_t) 0x2) << (18 + 4 * curidx);158 dr7 |= ((sysarg_t) 0x02U) << (18 + 4 * curidx); 159 159 #endif 160 160 161 161 if ((flags & BKPOINT_WRITE)) 162 dr7 |= (( unative_t) 0x1) << (16 + 4 * curidx);162 dr7 |= ((sysarg_t) 0x01U) << (16 + 4 * curidx); 163 163 else if ((flags & BKPOINT_READ_WRITE)) 164 dr7 |= (( unative_t) 0x3) << (16 + 4 * curidx);164 dr7 |= ((sysarg_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); … … 227 227 if (!(breakpoints[slot].flags & BKPOINT_INSTR)) { 228 228 if ((breakpoints[slot].flags & BKPOINT_CHECK_ZERO)) { 229 if (*(( unative_t *) breakpoints[slot].address) != 0)229 if (*((sysarg_t *) breakpoints[slot].address) != 0) 230 230 return; 231 231 232 printf("*** Found ZERO on address % " PRIp "(slot %d) ***\n",233 breakpoints[slot].address, slot);232 printf("*** Found ZERO on address %p (slot %d) ***\n", 233 (void *) breakpoints[slot].address, slot); 234 234 } else { 235 printf("Data watchpoint - new data: % " PRIp"\n",236 *(( unative_t *) breakpoints[slot].address));237 } 238 } 239 240 printf("Reached breakpoint %d:% " PRIp " (%s)\n", slot, getip(istate),241 symtab_fmt_name_lookup(getip(istate)));235 printf("Data watchpoint - new data: %#" PRIxn "\n", 236 *((sysarg_t *) breakpoints[slot].address)); 237 } 238 } 239 240 printf("Reached breakpoint %d:%p (%s)\n", slot, 241 (void *) getip(istate), symtab_fmt_name_lookup(getip(istate))); 242 242 243 243 #ifdef CONFIG_KCONSOLE … … 260 260 } 261 261 262 cur->address = NULL;262 cur->address = (uintptr_t) NULL; 263 263 264 264 setup_dr(slot); … … 279 279 #endif 280 280 281 unative_t dr6 = read_dr6();281 sysarg_t dr6 = read_dr6(); 282 282 283 283 unsigned int i; … … 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 … … 363 363 364 364 #ifdef __32_BITS__ 365 printf("%-4u %7 " PRIs "%p %s\n", i,366 breakpoints[i].counter, breakpoints[i].address,365 printf("%-4u %7zu %p %s\n", i, 366 breakpoints[i].counter, (void *) breakpoints[i].address, 367 367 symbol); 368 368 #endif 369 369 370 370 #ifdef __64_BITS__ 371 printf("%-4u %7 " PRIs "%p %s\n", i,372 breakpoints[i].counter, breakpoints[i].address,371 printf("%-4u %7zu %p %s\n", i, 372 breakpoints[i].counter, (void *) breakpoints[i].address, 373 373 symbol); 374 374 #endif … … 384 384 int cmd_del_breakpoint(cmd_arg_t *argv) 385 385 { 386 unative_t bpno = argv->intval;386 sysarg_t bpno = argv->intval; 387 387 if (bpno > BKPOINTS_MAX) { 388 388 printf("Invalid breakpoint number.\n"); … … 405 405 flags = BKPOINT_WRITE; 406 406 407 printf("Adding breakpoint on address: %p\n", argv->intval); 408 409 int id = breakpoint_add((void *)argv->intval, flags, -1); 407 printf("Adding breakpoint on address: %p\n", 408 (void *) argv->intval); 409 410 int id = breakpoint_add((void *) argv->intval, flags, -1); 410 411 if (id < 0) 411 412 printf("Add breakpoint failed.\n"); -
kernel/arch/amd64/src/interrupt.c
r8e58f94 r7bdcc45 65 65 void istate_decode(istate_t *istate) 66 66 { 67 printf("cs =%p\trip=%p\trfl=%p\terr=%p\n", 68 istate->cs, istate->rip, istate->rflags, istate->error_word); 69 67 printf("cs =%#0" PRIx64 "\trip=%p\t" 68 "rfl=%#0" PRIx64 "\terr=%#0" PRIx64 "\n", 69 istate->cs, (void *) istate->rip, 70 istate->rflags, istate->error_word); 71 70 72 if (istate_from_uspace(istate)) 71 printf("ss =%p\n", istate->ss); 72 73 printf("rax=%p\trbx=%p\trcx=%p\trdx=%p\n", 73 printf("ss =%#0" PRIx64 "\n", istate->ss); 74 75 printf("rax=%#0" PRIx64 "\trbx=%#0" PRIx64 "\t" 76 "rcx=%#0" PRIx64 "\trdx=%#0" PRIx64 "\n", 74 77 istate->rax, istate->rbx, istate->rcx, istate->rdx); 78 75 79 printf("rsi=%p\trdi=%p\trbp=%p\trsp=%p\n", 76 istate->rsi, istate->rdi, istate->rbp, 77 istate_from_uspace(istate) ? istate->rsp : (uintptr_t)&istate->rsp); 78 printf("r8 =%p\tr9 =%p\tr10=%p\tr11=%p\n", 80 (void *) istate->rsi, (void *) istate->rdi, 81 (void *) istate->rbp, 82 istate_from_uspace(istate) ? ((void *) istate->rsp) : 83 &istate->rsp); 84 85 printf("r8 =%#0" PRIx64 "\tr9 =%#0" PRIx64 "\t" 86 "r10=%#0" PRIx64 "\tr11=%#0" PRIx64 "\n", 79 87 istate->r8, istate->r9, istate->r10, istate->r11); 80 printf("r12=%p\tr13=%p\tr14=%p\tr15=%p\n", 88 89 printf("r12=%#0" PRIx64 "\tr13=%#0" PRIx64 "\t" 90 "r14=%#0" PRIx64 "\tr15=%#0" PRIx64 "\n", 81 91 istate->r12, istate->r13, istate->r14, istate->r15); 82 92 } -
kernel/arch/amd64/src/mm/page.c
r8e58f94 r7bdcc45 89 89 90 90 if (as_page_fault(page, access, istate) == AS_PF_FAULT) { 91 fault_if_from_uspace(istate, "Page fault: % #x.",page);91 fault_if_from_uspace(istate, "Page fault: %p.", (void *) page); 92 92 panic_memtrap(istate, access, page, NULL); 93 93 } … … 97 97 { 98 98 if (last_frame + ALIGN_UP(size, PAGE_SIZE) > KA2PA(KERNEL_ADDRESS_SPACE_END_ARCH)) 99 panic("Unable to map physical memory %p (% " PRIs " bytes).", physaddr,100 size);99 panic("Unable to map physical memory %p (%zu bytes).", 100 (void *) physaddr, size); 101 101 102 102 uintptr_t virtaddr = PA2KA(last_frame); -
kernel/arch/amd64/src/pm.c
r8e58f94 r7bdcc45 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.
