Changeset e3bc355 in mainline for kernel/arch/ia32
- Timestamp:
- 2013-07-28T23:07:18Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 2b55edb
- Parents:
- 283ea3d (diff), ccdc63e (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/ia32
- Files:
-
- 2 added
- 2 deleted
- 7 edited
- 35 moved
-
Makefile.inc (modified) (2 diffs)
-
include/arch/arch.h (moved) (moved from kernel/arch/ia32/include/arch.h )
-
include/arch/asm.h (moved) (moved from kernel/arch/ia32/include/asm.h )
-
include/arch/atomic.h (moved) (moved from kernel/arch/ia32/include/atomic.h )
-
include/arch/barrier.h (moved) (moved from kernel/arch/ia32/include/barrier.h )
-
include/arch/bios/bios.h (moved) (moved from kernel/arch/ia32/include/bios/bios.h )
-
include/arch/boot/boot.h (moved) (moved from kernel/arch/ia32/include/boot/boot.h )
-
include/arch/boot/memmap.h (moved) (moved from kernel/arch/ia32/include/boot/memmap.h )
-
include/arch/context.h (moved) (moved from kernel/arch/ia32/include/context.h )
-
include/arch/context_offset.h (moved) (moved from kernel/arch/ia32/include/context_offset.h )
-
include/arch/cpu.h (moved) (moved from kernel/arch/ia32/include/cpu.h ) (2 diffs)
-
include/arch/cpuid.h (moved) (moved from kernel/arch/ia32/include/cpuid.h ) (1 diff)
-
include/arch/cycle.h (moved) (moved from kernel/arch/ia32/include/cycle.h )
-
include/arch/ddi/ddi.h (moved) (moved from kernel/arch/ia32/include/ddi/ddi.h )
-
include/arch/debugger.h (moved) (moved from kernel/arch/ia32/include/debugger.h )
-
include/arch/drivers/i8254.h (moved) (moved from kernel/arch/ia32/include/drivers/i8254.h )
-
include/arch/drivers/i8259.h (moved) (moved from kernel/arch/ia32/include/drivers/i8259.h )
-
include/arch/elf.h (moved) (moved from kernel/arch/ia32/include/elf.h )
-
include/arch/faddr.h (moved) (moved from kernel/arch/ia32/include/faddr.h )
-
include/arch/fpu_context.h (moved) (moved from kernel/arch/ia32/include/fpu_context.h )
-
include/arch/interrupt.h (moved) (moved from kernel/arch/ia32/include/interrupt.h )
-
include/arch/istate.h (moved) (moved from kernel/arch/ia32/include/istate.h ) (1 diff)
-
include/arch/mm/as.h (moved) (moved from kernel/arch/ia32/include/mm/as.h )
-
include/arch/mm/asid.h (moved) (moved from kernel/arch/ia32/include/mm/asid.h )
-
include/arch/mm/frame.h (moved) (moved from kernel/arch/ia32/include/mm/frame.h )
-
include/arch/mm/km.h (moved) (moved from kernel/arch/ia32/include/mm/km.h )
-
include/arch/mm/page.h (moved) (moved from kernel/arch/ia32/include/mm/page.h )
-
include/arch/mm/tlb.h (moved) (moved from kernel/arch/ia32/include/mm/tlb.h )
-
include/arch/pm.h (moved) (moved from kernel/arch/ia32/include/pm.h ) (2 diffs)
-
include/arch/proc/task.h (moved) (moved from kernel/arch/ia32/include/proc/task.h )
-
include/arch/proc/thread.h (moved) (moved from kernel/arch/ia32/include/proc/thread.h )
-
include/arch/smp/ap.h (moved) (moved from kernel/arch/ia32/include/smp/ap.h )
-
include/arch/smp/apic.h (moved) (moved from kernel/arch/ia32/include/smp/apic.h )
-
include/arch/smp/mps.h (moved) (moved from kernel/arch/ia32/include/smp/mps.h )
-
include/arch/smp/smp.h (moved) (moved from kernel/arch/ia32/include/smp/smp.h )
-
include/arch/stack.h (added)
-
include/arch/syscall.h (added)
-
include/arch/types.h (moved) (moved from kernel/arch/ia32/include/types.h )
-
include/syscall.h (deleted)
-
src/boot/vesa_real.inc (modified) (3 diffs)
-
src/cpu/cpu.c (modified) (1 diff)
-
src/debugger.c (deleted)
-
src/fpu_context.c (modified) (5 diffs)
-
src/ia32.c (modified) (2 diffs)
-
src/mm/page.c (modified) (2 diffs)
-
src/pm.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/ia32/Makefile.inc
r283ea3d re3bc355 30 30 BFD_ARCH = i386 31 31 BFD = binary 32 CLANG_ARCH = i38633 32 34 33 BITS = 32 … … 105 104 arch/$(KARCH)/src/boot/memmap.c \ 106 105 arch/$(KARCH)/src/fpu_context.c \ 107 arch/$(KARCH)/src/debugger.c \108 106 arch/$(KARCH)/src/syscall.c -
kernel/arch/ia32/include/arch/cpu.h
r283ea3d re3bc355 41 41 #define EFLAGS_RF (1 << 16) 42 42 43 #define CR4_OSFXSR_MASK (1<<9) 43 #define CR4_OSFXSR_MASK (1 << 9) 44 #define CR4_OSXMMEXCPT_MASK (1 << 10) 44 45 45 46 /* Support for SYSENTER and SYSEXIT */ … … 59 60 unsigned int model; 60 61 unsigned int stepping; 61 cpuid_feature_info fi;62 62 cpuid_feature_info_t fi; 63 63 64 tss_t *tss; 64 65 -
kernel/arch/ia32/include/arch/cpuid.h
r283ea3d re3bc355 50 50 uint32_t cpuid_ecx; 51 51 uint32_t cpuid_edx; 52 } __attribute__ ((packed)) cpu_info_t;52 } __attribute__((packed)) cpu_info_t; 53 53 54 struct __cpuid_extended_feature_info {55 unsigned sse3 :1;56 unsigned : 31;57 } __attribute__ ((packed));54 struct cpuid_extended_feature_info { 55 unsigned int sse3 : 1; 56 unsigned int : 31; 57 } __attribute__((packed)); 58 58 59 typedef union cpuid_extended_feature_info{60 struct __cpuid_extended_feature_info bits;59 typedef union { 60 struct cpuid_extended_feature_info bits; 61 61 uint32_t word; 62 } cpuid_extended_feature_info ;62 } cpuid_extended_feature_info_t; 63 63 64 struct __cpuid_feature_info {65 unsigned : 11;66 unsigned sep :1;67 unsigned : 11;68 unsigned mmx :1;69 unsigned fxsr :1;70 unsigned sse :1;71 unsigned sse2 :1;72 unsigned :5;73 } __attribute__ ((packed));64 struct cpuid_feature_info { 65 unsigned int : 11; 66 unsigned int sep : 1; 67 unsigned int : 11; 68 unsigned int mmx : 1; 69 unsigned int fxsr : 1; 70 unsigned int sse : 1; 71 unsigned int sse2 : 1; 72 unsigned int : 5; 73 } __attribute__((packed)); 74 74 75 typedef union cpuid_feature_info{76 struct __cpuid_feature_info bits;75 typedef union { 76 struct cpuid_feature_info bits; 77 77 uint32_t word; 78 } cpuid_feature_info; 79 78 } cpuid_feature_info_t; 80 79 81 80 static inline uint32_t has_cpuid(void) 82 81 { 83 uint32_t val, ret; 82 uint32_t val; 83 uint32_t ret; 84 84 85 85 asm volatile ( -
kernel/arch/ia32/include/arch/istate.h
r283ea3d re3bc355 68 68 } istate_t; 69 69 70 #define RPL_USER 3 71 70 72 /** Return true if exception happened while in userspace */ 71 73 NO_TRACE static inline int istate_from_uspace(istate_t *istate) 72 74 { 73 return !(istate->eip & UINT32_C(0x80000000));75 return (istate->cs & RPL_USER) == RPL_USER; 74 76 } 75 77 -
kernel/arch/ia32/include/arch/pm.h
r283ea3d re3bc355 50 50 51 51 #define VESA_INIT_SEGMENT 0x8000 52 #define VESA_INIT_DES 7 52 #define VESA_INIT_CODE_DES 7 53 #define VESA_INIT_DATA_DES 8 53 54 #define KTEXT32_DES KTEXT_DES 54 55 55 56 #undef GDT_ITEMS 56 #define GDT_ITEMS 857 #define GDT_ITEMS 9 57 58 58 59 #endif /* CONFIG_FB */ … … 67 68 #define AR_CODE (3 << 3) 68 69 #define AR_WRITABLE (1 << 1) 70 #define AR_READABLE (1 << 1) 69 71 #define AR_INTERRUPT (0xe) 70 72 #define AR_TRAP (0xf) -
kernel/arch/ia32/src/boot/vesa_real.inc
r283ea3d re3bc355 31 31 vesa_init: 32 32 lidtl vesa_idtr 33 jmp $GDT_SELECTOR(VESA_INIT_DES), $vesa_init_real - vesa_init 33 34 mov $GDT_SELECTOR(VESA_INIT_DATA_DES), %bx 35 36 mov %bx, %es 37 mov %bx, %fs 38 mov %bx, %gs 39 mov %bx, %ds 40 mov %bx, %ss 41 42 jmp $GDT_SELECTOR(VESA_INIT_CODE_DES), $vesa_init_real - vesa_init 34 43 35 44 vesa_idtr: … … 39 48 .code16 40 49 vesa_init_real: 41 42 50 mov %cr0, %eax 43 51 and $~1, %eax … … 45 53 46 54 jmp $VESA_INIT_SEGMENT, $vesa_init_real2 - vesa_init 47 55 48 56 vesa_init_real2: 49 57 mov $VESA_INIT_SEGMENT, %bx -
kernel/arch/ia32/src/cpu/cpu.c
r283ea3d re3bc355 115 115 "mov %[help], %%cr4\n" 116 116 : [help] "+r" (help) 117 : [mask] "i" (CR4_OSFXSR_MASK | (1 << 10))117 : [mask] "i" (CR4_OSFXSR_MASK | CR4_OSXMMEXCPT_MASK) 118 118 ); 119 119 } 120 120 121 121 #ifndef PROCESSOR_i486 122 122 if (CPU->arch.fi.bits.sep) { -
kernel/arch/ia32/src/fpu_context.c
r283ea3d re3bc355 27 27 */ 28 28 29 /** @addtogroup ia32 29 /** @addtogroup ia32 30 30 * @{ 31 31 */ … … 38 38 #include <cpu.h> 39 39 40 /** x87 FPU scr values (P3+ MMX2) */ 41 enum { 42 X87_FLUSH_ZERO_FLAG = (1 << 15), 43 X87_ROUND_CONTROL_MASK = (0x3 << 13), 44 x87_ROUND_TO_NEAREST_EVEN = (0x0 << 13), 45 X87_ROUND_DOWN_TO_NEG_INF = (0x1 << 13), 46 X87_ROUND_UP_TO_POS_INF = (0x2 << 13), 47 X87_ROUND_TO_ZERO = (0x3 << 13), 48 X87_PRECISION_MASK = (1 << 12), 49 X87_UNDERFLOW_MASK = (1 << 11), 50 X87_OVERFLOW_MASK = (1 << 10), 51 X87_ZERO_DIV_MASK = (1 << 9), 52 X87_DENORMAL_OP_MASK = (1 << 8), 53 X87_INVALID_OP_MASK = (1 << 7), 54 X87_DENOM_ZERO_FLAG = (1 << 6), 55 X87_PRECISION_EXC_FLAG = (1 << 5), 56 X87_UNDERFLOW_EXC_FLAG = (1 << 4), 57 X87_OVERFLOW_EXC_FLAG = (1 << 3), 58 X87_ZERO_DIV_EXC_FLAG = (1 << 2), 59 X87_DENORMAL_EXC_FLAG = (1 << 1), 60 X87_INVALID_OP_EXC_FLAG = (1 << 0), 61 62 X87_ALL_MASK = X87_PRECISION_MASK | X87_UNDERFLOW_MASK | X87_OVERFLOW_MASK | X87_ZERO_DIV_MASK | X87_DENORMAL_OP_MASK | X87_INVALID_OP_MASK, 63 }; 64 40 65 typedef void (*fpu_context_function)(fpu_context_t *fctx); 41 66 42 static fpu_context_function fpu_save, fpu_restore; 67 static fpu_context_function fpu_save; 68 static fpu_context_function fpu_restore; 43 69 44 70 static void fpu_context_f_save(fpu_context_t *fctx) … … 77 103 void fpu_fxsr(void) 78 104 { 79 fpu_save =fpu_context_fx_save;80 fpu_restore =fpu_context_fx_restore;105 fpu_save = fpu_context_fx_save; 106 fpu_restore = fpu_context_fx_restore; 81 107 } 82 108 … … 98 124 } 99 125 126 /** Initialize x87 FPU. Mask all exceptions. */ 100 127 void fpu_init() 101 128 { … … 111 138 "ldmxcsr %[help0]\n" 112 139 : [help0] "+m" (help0), [help1] "+r" (help1) 113 : [magic] "i" ( 0x1f80)140 : [magic] "i" (X87_ALL_MASK) 114 141 ); 115 142 } -
kernel/arch/ia32/src/ia32.c
r283ea3d re3bc355 45 45 #include <arch/bios/bios.h> 46 46 #include <arch/boot/boot.h> 47 #include <arch/debugger.h>48 47 #include <arch/drivers/i8254.h> 49 48 #include <arch/drivers/i8259.h> … … 118 117 #endif 119 118 120 /* Enable debugger */121 debugger_init();122 119 /* Merge all memory zones to 1 big zone */ 123 120 zone_merge_all(); -
kernel/arch/ia32/src/mm/page.c
r283ea3d re3bc355 84 84 void page_fault(unsigned int n __attribute__((unused)), istate_t *istate) 85 85 { 86 uintptr_t page;86 uintptr_t badvaddr; 87 87 pf_access_t access; 88 88 89 page= read_cr2();89 badvaddr = read_cr2(); 90 90 91 91 if (istate->error_word & PFERR_CODE_RSVD) … … 97 97 access = PF_ACCESS_READ; 98 98 99 if (as_page_fault(page, access, istate) == AS_PF_FAULT) { 100 fault_if_from_uspace(istate, "Page fault: %#x.", page); 101 panic_memtrap(istate, access, page, NULL); 102 } 99 (void) as_page_fault(badvaddr, access, istate); 103 100 } 104 101 -
kernel/arch/ia32/src/pm.c
r283ea3d re3bc355 75 75 /* VESA Init descriptor */ 76 76 #ifdef CONFIG_FB 77 { 0xffff, 0, VESA_INIT_SEGMENT >> 12, AR_PRESENT | AR_CODE | DPL_KERNEL, 0xf, 0, 0, 0, 0, 0 } 77 { 0xffff, 0, VESA_INIT_SEGMENT >> 12, AR_PRESENT | AR_CODE | AR_READABLE | DPL_KERNEL, 0xf, 0, 0, 0, 0, 0 }, 78 { 0xffff, 0, VESA_INIT_SEGMENT >> 12, AR_PRESENT | AR_DATA | AR_WRITABLE | DPL_KERNEL, 0xf, 0, 0, 0, 0, 0 } 78 79 #endif 79 80 };
Note:
See TracChangeset
for help on using the changeset viewer.
