Changeset 1433ecda in mainline for kernel/arch/amd64
- Timestamp:
- 2018-04-04T15:42:37Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 2c4e1cc
- Parents:
- 47b2d7e3
- Location:
- kernel/arch/amd64
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/amd64/include/arch/atomic.h
r47b2d7e3 r1433ecda 45 45 #ifdef CONFIG_SMP 46 46 asm volatile ( 47 48 49 ); 50 #else 51 asm volatile ( 52 53 47 "lock incq %[count]\n" 48 : [count] "+m" (val->count) 49 ); 50 #else 51 asm volatile ( 52 "incq %[count]\n" 53 : [count] "+m" (val->count) 54 54 ); 55 55 #endif /* CONFIG_SMP */ … … 60 60 #ifdef CONFIG_SMP 61 61 asm volatile ( 62 63 64 ); 65 #else 66 asm volatile ( 67 68 62 "lock decq %[count]\n" 63 : [count] "+m" (val->count) 64 ); 65 #else 66 asm volatile ( 67 "decq %[count]\n" 68 : [count] "+m" (val->count) 69 69 ); 70 70 #endif /* CONFIG_SMP */ … … 76 76 77 77 asm volatile ( 78 79 80 78 "lock xaddq %[r], %[count]\n" 79 : [count] "+m" (val->count), 80 [r] "+r" (r) 81 81 ); 82 82 … … 89 89 90 90 asm volatile ( 91 92 93 91 "lock xaddq %[r], %[count]\n" 92 : [count] "+m" (val->count), 93 [r] "+r" (r) 94 94 ); 95 95 … … 105 105 106 106 asm volatile ( 107 108 109 107 "xchgq %[v], %[count]\n" 108 : [v] "+r" (v), 109 [count] "+m" (val->count) 110 110 ); 111 111 … … 120 120 preemption_disable(); 121 121 asm volatile ( 122 123 124 125 126 127 128 129 130 131 132 133 122 "0:\n" 123 " pause\n" 124 " mov %[count], %[tmp]\n" 125 " testq %[tmp], %[tmp]\n" 126 " jnz 0b\n" /* lightweight looping on locked spinlock */ 127 128 " incq %[tmp]\n" /* now use the atomic operation */ 129 " xchgq %[count], %[tmp]\n" 130 " testq %[tmp], %[tmp]\n" 131 " jnz 0b\n" 132 : [count] "+m" (val->count), 133 [tmp] "=&r" (tmp) 134 134 ); 135 135 -
kernel/arch/amd64/include/arch/cpuid.h
r47b2d7e3 r1433ecda 55 55 uint32_t cpuid_ecx; 56 56 uint32_t cpuid_edx; 57 } __attribute__ 57 } __attribute__((packed)) cpu_info_t; 58 58 59 59 extern int has_cpuid(void); -
kernel/arch/amd64/include/arch/cycle.h
r47b2d7e3 r1433ecda 44 44 45 45 asm volatile ( 46 47 48 46 "rdtsc\n" 47 : "=a" (lower), 48 "=d" (upper) 49 49 ); 50 50 -
kernel/arch/amd64/include/arch/mm/page.h
r47b2d7e3 r1433ecda 198 198 unsigned int accessed : 1; 199 199 unsigned int dirty : 1; 200 unsigned int unused : 1;200 unsigned int unused : 1; 201 201 unsigned int global : 1; 202 202 unsigned int soft_valid : 1; /**< Valid content even if present bit is cleared. */ … … 205 205 unsigned int addr_32_51 : 21; 206 206 unsigned int no_execute : 1; 207 } __attribute__ 207 } __attribute__((packed)) pte_t; 208 208 209 209 NO_TRACE static inline unsigned int get_pt_flags(pte_t *pt, size_t i) -
kernel/arch/amd64/include/arch/pm.h
r47b2d7e3 r1433ecda 37 37 38 38 #ifndef __ASSEMBLER__ 39 40 39 #include <typedefs.h> 40 #include <arch/context.h> 41 41 #endif 42 42 … … 91 91 92 92 typedef struct { 93 unsigned limit_0_15 : 16;94 unsigned base_0_15 : 16;95 unsigned base_16_23 : 8;96 unsigned access : 8;97 unsigned limit_16_19 : 4;98 unsigned available : 1;99 unsigned longmode : 1;100 unsigned special : 1;93 unsigned limit_0_15 : 16; 94 unsigned base_0_15 : 16; 95 unsigned base_16_23 : 8; 96 unsigned access : 8; 97 unsigned limit_16_19 : 4; 98 unsigned available : 1; 99 unsigned longmode : 1; 100 unsigned special : 1; 101 101 unsigned granularity : 1; 102 unsigned base_24_31 : 8;103 } __attribute__ 102 unsigned base_24_31 : 8; 103 } __attribute__((packed)) descriptor_t; 104 104 105 105 typedef struct { 106 unsigned limit_0_15 : 16;107 unsigned base_0_15 : 16;108 unsigned base_16_23 : 8;109 unsigned type : 4;106 unsigned limit_0_15 : 16; 107 unsigned base_0_15 : 16; 108 unsigned base_16_23 : 8; 109 unsigned type : 4; 110 110 unsigned : 1; 111 111 unsigned dpl : 2; 112 112 unsigned present : 1; 113 unsigned limit_16_19 : 4;114 unsigned available : 1;113 unsigned limit_16_19 : 4; 114 unsigned available : 1; 115 115 unsigned : 2; 116 116 unsigned granularity : 1; 117 unsigned base_24_31 : 8;117 unsigned base_24_31 : 8; 118 118 unsigned base_32_63 : 32; 119 119 unsigned : 32; 120 } __attribute__ 120 } __attribute__((packed)) tss_descriptor_t; 121 121 122 122 typedef struct { 123 unsigned offset_0_15 : 16;124 unsigned selector : 16;125 unsigned ist :3;126 unsigned unused : 5;127 unsigned type : 5;128 unsigned dpl : 2;123 unsigned offset_0_15 : 16; 124 unsigned selector : 16; 125 unsigned ist : 3; 126 unsigned unused : 5; 127 unsigned type : 5; 128 unsigned dpl : 2; 129 129 unsigned present : 1; 130 unsigned offset_16_31 : 16;131 unsigned offset_32_63 : 32;130 unsigned offset_16_31 : 16; 131 unsigned offset_32_63 : 32; 132 132 unsigned : 32; 133 } __attribute__ 133 } __attribute__((packed)) idescriptor_t; 134 134 135 135 typedef struct { 136 136 uint16_t limit; 137 137 uint64_t base; 138 } __attribute__ 138 } __attribute__((packed)) ptr_16_64_t; 139 139 140 140 typedef struct { 141 141 uint16_t limit; 142 142 uint32_t base; 143 } __attribute__ 143 } __attribute__((packed)) ptr_16_32_t; 144 144 145 145 typedef struct { … … 160 160 uint16_t iomap_base; 161 161 uint8_t iomap[TSS_IOMAP_SIZE]; 162 } __attribute__ 162 } __attribute__((packed)) tss_t; 163 163 164 164 extern tss_t *tss_p; -
kernel/arch/amd64/src/cpu/cpu.c
r47b2d7e3 r1433ecda 136 136 } 137 137 138 void cpu_print_report(cpu_t *m)138 void cpu_print_report(cpu_t *m) 139 139 { 140 140 printf("cpu%d: (%s family=%d model=%d stepping=%d apicid=%u) %dMHz\n", -
kernel/arch/amd64/src/fpu_context.c
r47b2d7e3 r1433ecda 40 40 { 41 41 asm volatile ( 42 43 42 "fxsave %[fctx]\n" 43 : [fctx] "=m" (fctx->fpu) 44 44 ); 45 45 } … … 49 49 { 50 50 asm volatile ( 51 52 51 "fxrstor %[fctx]\n" 52 : [fctx] "=m" (fctx->fpu) 53 53 ); 54 54 } … … 60 60 * it masks all FPU exceptions*/ 61 61 asm volatile ( 62 62 "fninit\n" 63 63 ); 64 64 } -
kernel/arch/amd64/src/interrupt.c
r47b2d7e3 r1433ecda 60 60 */ 61 61 62 void (* 63 void (* 64 void (* 62 void (*disable_irqs_function)(uint16_t irqmask) = NULL; 63 void (*enable_irqs_function)(uint16_t irqmask) = NULL; 64 void (*eoi_function)(void) = NULL; 65 65 const char *irqs_info = NULL; 66 66 … … 231 231 (iroutine_t) tlb_shootdown_ipi); 232 232 exc_register(VECTOR_SMP_CALL_IPI, "smp_call", true, 233 233 (iroutine_t) arch_smp_call_ipi_recv); 234 234 #endif 235 235 } -
kernel/arch/amd64/src/pm.c
r47b2d7e3 r1433ecda 55 55 .limit_0_15 = 0xffffU, 56 56 .limit_16_19 = 0xfU, 57 57 .access = AR_PRESENT | AR_CODE | DPL_KERNEL | AR_READABLE, 58 58 .longmode = 1, 59 59 .granularity = 1
Note:
See TracChangeset
for help on using the changeset viewer.