Changeset 1433ecda in mainline for kernel/arch/ia32/include
- 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/ia32/include/arch
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/ia32/include/arch/atomic.h
r47b2d7e3 r1433ecda 46 46 #ifdef CONFIG_SMP 47 47 asm volatile ( 48 49 50 ); 51 #else 52 asm volatile ( 53 54 48 "lock incl %[count]\n" 49 : [count] "+m" (val->count) 50 ); 51 #else 52 asm volatile ( 53 "incl %[count]\n" 54 : [count] "+m" (val->count) 55 55 ); 56 56 #endif /* CONFIG_SMP */ … … 61 61 #ifdef CONFIG_SMP 62 62 asm volatile ( 63 64 65 ); 66 #else 67 asm volatile ( 68 69 63 "lock decl %[count]\n" 64 : [count] "+m" (val->count) 65 ); 66 #else 67 asm volatile ( 68 "decl %[count]\n" 69 : [count] "+m" (val->count) 70 70 ); 71 71 #endif /* CONFIG_SMP */ … … 77 77 78 78 asm volatile ( 79 80 81 79 "lock xaddl %[r], %[count]\n" 80 : [count] "+m" (val->count), 81 [r] "+r" (r) 82 82 ); 83 83 … … 90 90 91 91 asm volatile ( 92 93 94 92 "lock xaddl %[r], %[count]\n" 93 : [count] "+m" (val->count), 94 [r] "+r" (r) 95 95 ); 96 96 … … 106 106 107 107 asm volatile ( 108 109 110 108 "xchgl %[v], %[count]\n" 109 : [v] "+r" (v), 110 [count] "+m" (val->count) 111 111 ); 112 112 … … 122 122 preemption_disable(); 123 123 asm volatile ( 124 124 "0:\n" 125 125 #ifndef PROCESSOR_i486 126 127 #endif 128 129 130 131 132 133 134 135 136 137 126 "pause\n" /* Pentium 4's HT love this instruction */ 127 #endif 128 "mov %[count], %[tmp]\n" 129 "testl %[tmp], %[tmp]\n" 130 "jnz 0b\n" /* lightweight looping on locked spinlock */ 131 132 "incl %[tmp]\n" /* now use the atomic operation */ 133 "xchgl %[count], %[tmp]\n" 134 "testl %[tmp], %[tmp]\n" 135 "jnz 0b\n" 136 : [count] "+m" (val->count), 137 [tmp] "=&r" (tmp) 138 138 ); 139 139 -
kernel/arch/ia32/include/arch/barrier.h
r47b2d7e3 r1433ecda 56 56 #ifndef __PIC__ 57 57 asm volatile ( 58 59 60 58 "xorl %%eax, %%eax\n" 59 "cpuid\n" 60 ::: "eax", "ebx", "ecx", "edx", "memory" 61 61 ); 62 62 #else 63 63 /* Must not clobber PIC register ebx */ 64 64 asm volatile ( 65 66 67 68 69 65 "movl %%ebx, %%esi\n" 66 "xorl %%eax, %%eax\n" 67 "cpuid\n" 68 "movl %%esi, %%ebx\n" 69 ::: "eax", "ecx", "edx", "esi", "memory" 70 70 ); 71 71 #endif … … 73 73 74 74 #if defined(CONFIG_FENCES_P4) 75 76 77 78 79 80 81 75 #define memory_barrier() asm volatile ("mfence\n" ::: "memory") 76 #define read_barrier() asm volatile ("lfence\n" ::: "memory") 77 #ifdef CONFIG_WEAK_MEMORY 78 #define write_barrier() asm volatile ("sfence\n" ::: "memory") 79 #else 80 #define write_barrier() asm volatile ("" ::: "memory"); 81 #endif 82 82 #elif defined(CONFIG_FENCES_P3) 83 #define memory_barrier() cpuid_serialization() 84 #define read_barrier() cpuid_serialization() 85 #ifdef CONFIG_WEAK_MEMORY 86 #define write_barrier() asm volatile ("sfence\n" ::: "memory") 87 #else 88 #define write_barrier() asm volatile ("" ::: "memory"); 89 #endif 83 #define memory_barrier() cpuid_serialization() 84 #define read_barrier() cpuid_serialization() 85 #ifdef CONFIG_WEAK_MEMORY 86 #define write_barrier() asm volatile ("sfence\n" ::: "memory") 90 87 #else 91 #define memory_barrier() cpuid_serialization() 92 #define read_barrier() cpuid_serialization() 93 #ifdef CONFIG_WEAK_MEMORY 94 #define write_barrier() cpuid_serialization() 95 #else 96 #define write_barrier() asm volatile ("" ::: "memory"); 97 #endif 88 #define write_barrier() asm volatile ("" ::: "memory"); 89 #endif 90 #else 91 #define memory_barrier() cpuid_serialization() 92 #define read_barrier() cpuid_serialization() 93 #ifdef CONFIG_WEAK_MEMORY 94 #define write_barrier() cpuid_serialization() 95 #else 96 #define write_barrier() asm volatile ("" ::: "memory"); 97 #endif 98 98 #endif 99 99 -
kernel/arch/ia32/include/arch/cpuid.h
r47b2d7e3 r1433ecda 85 85 86 86 asm volatile ( 87 88 89 87 "pushf\n" /* read flags */ 88 "popl %[ret]\n" 89 "movl %[ret], %[val]\n" 90 90 91 91 "xorl %[eflags_id], %[val]\n" /* swap the ID bit */ 92 92 93 94 95 96 93 "pushl %[val]\n" /* propagate the change into flags */ 94 "popf\n" 95 "pushf\n" 96 "popl %[val]\n" 97 97 98 99 100 101 102 98 "andl %[eflags_id], %[ret]\n" /* interrested only in ID bit */ 99 "andl %[eflags_id], %[val]\n" 100 "xorl %[val], %[ret]\n" 101 : [ret] "=r" (ret), [val] "=r" (val) 102 : [eflags_id] "i" (EFLAGS_ID) 103 103 ); 104 104 … … 109 109 { 110 110 asm volatile ( 111 112 113 114 111 "cpuid\n" 112 : "=a" (info->cpuid_eax), "=b" (info->cpuid_ebx), 113 "=c" (info->cpuid_ecx), "=d" (info->cpuid_edx) 114 : "a" (cmd) 115 115 ); 116 116 } -
kernel/arch/ia32/include/arch/cycle.h
r47b2d7e3 r1433ecda 45 45 uint64_t v; 46 46 47 asm volatile (48 49 47 asm volatile ( 48 "rdtsc\n" 49 : "=A" (v) 50 50 ); 51 51 -
kernel/arch/ia32/include/arch/mm/page.h
r47b2d7e3 r1433ecda 178 178 unsigned avl : 2; 179 179 unsigned frame_address : 20; 180 } __attribute__ 180 } __attribute__((packed)) pte_t; 181 181 182 182 NO_TRACE static inline unsigned int get_pt_flags(pte_t *pt, size_t i) -
kernel/arch/ia32/include/arch/pm.h
r47b2d7e3 r1433ecda 89 89 uint16_t limit; 90 90 uint32_t base; 91 } __attribute__ 91 } __attribute__((packed)) ptr_16_32_t; 92 92 93 93 typedef struct { 94 unsigned limit_0_15 : 16;95 unsigned base_0_15 : 16;96 unsigned base_16_23 : 8;97 unsigned access : 8;98 unsigned limit_16_19 : 4;99 unsigned available : 1;100 unsigned unused : 1;101 unsigned special : 1;94 unsigned limit_0_15 : 16; 95 unsigned base_0_15 : 16; 96 unsigned base_16_23 : 8; 97 unsigned access : 8; 98 unsigned limit_16_19 : 4; 99 unsigned available : 1; 100 unsigned unused : 1; 101 unsigned special : 1; 102 102 unsigned granularity : 1; 103 unsigned base_24_31 : 8;104 } __attribute__ 103 unsigned base_24_31 : 8; 104 } __attribute__((packed)) descriptor_t; 105 105 106 106 typedef struct { 107 unsigned offset_0_15 : 16;108 unsigned selector : 16;109 unsigned unused : 8;110 unsigned access : 8;111 unsigned offset_16_31 : 16;112 } __attribute__ 107 unsigned offset_0_15 : 16; 108 unsigned selector : 16; 109 unsigned unused : 8; 110 unsigned access : 8; 111 unsigned offset_16_31 : 16; 112 } __attribute__((packed)) idescriptor_t; 113 113 114 114 typedef struct { … … 152 152 uint16_t iomap_base; 153 153 uint8_t iomap[TSS_IOMAP_SIZE]; 154 } __attribute__ 154 } __attribute__((packed)) tss_t; 155 155 156 156 extern ptr_16_32_t gdtr; -
kernel/arch/ia32/include/arch/smp/apic.h
r47b2d7e3 r1433ecda 128 128 unsigned int shorthand : 2; /**< Destination Shorthand. */ 129 129 unsigned int : 12; /**< Reserved. */ 130 } __attribute__ 130 } __attribute__((packed)); 131 131 }; 132 132 union { … … 135 135 unsigned int : 24; /**< Reserved. */ 136 136 uint8_t dest; /**< Destination field. */ 137 } __attribute__ 137 } __attribute__((packed)); 138 138 }; 139 } __attribute__ 139 } __attribute__((packed)) icr_t; 140 140 141 141 /* End Of Interrupt. */ … … 158 158 unsigned int illegal_register_address : 1; 159 159 unsigned int : 24; 160 } __attribute__ 160 } __attribute__((packed)); 161 161 } esr_t; 162 162 … … 169 169 unsigned int pri_sc : 4; /**< Task Priority Sub-Class. */ 170 170 unsigned int pri : 4; /**< Task Priority. */ 171 } __attribute__ 171 } __attribute__((packed)); 172 172 } tpr_t; 173 173 … … 182 182 unsigned int focus_checking : 1; /**< Focus Processor Checking. */ 183 183 unsigned int : 22; /**< Reserved. */ 184 } __attribute__ 184 } __attribute__((packed)); 185 185 } svr_t; 186 186 … … 193 193 unsigned int div_value : 4; /**< Divide Value, bit 2 is always 0. */ 194 194 unsigned int : 28; /**< Reserved. */ 195 } __attribute__ 195 } __attribute__((packed)); 196 196 } tdcr_t; 197 197 … … 215 215 unsigned int mode : 1; /**< Timer Mode. */ 216 216 unsigned int : 14; /**< Reserved. */ 217 } __attribute__ 217 } __attribute__((packed)); 218 218 } lvt_tm_t; 219 219 … … 234 234 unsigned int masked : 1; /**< Interrupt Mask. */ 235 235 unsigned int : 15; /**< Reserved. */ 236 } __attribute__ 236 } __attribute__((packed)); 237 237 } lvt_lint_t; 238 238 … … 249 249 unsigned int masked : 1; /**< Interrupt Mask. */ 250 250 unsigned int : 15; /**< Reserved. */ 251 } __attribute__ 251 } __attribute__((packed)); 252 252 } lvt_error_t; 253 253 … … 260 260 unsigned int : 24; /**< Reserved. */ 261 261 uint8_t apic_id; /**< Local APIC ID. */ 262 } __attribute__ 262 } __attribute__((packed)); 263 263 } l_apic_id_t; 264 264 … … 279 279 unsigned int : 24; /**< Reserved. */ 280 280 uint8_t id; /**< Logical APIC ID. */ 281 } __attribute__ 281 } __attribute__((packed)); 282 282 } ldr_t; 283 283 … … 290 290 unsigned int : 28; /**< Reserved, all ones. */ 291 291 unsigned int model : 4; /**< Model. */ 292 } __attribute__ 292 } __attribute__((packed)); 293 293 } dfr_t; 294 294 … … 308 308 uint8_t reg_addr; /**< APIC Register Address. */ 309 309 unsigned int : 24; /**< Reserved. */ 310 } __attribute__ 310 } __attribute__((packed)); 311 311 } io_regsel_t; 312 312 … … 325 325 unsigned int masked : 1; /**< Interrupt Mask. */ 326 326 unsigned int : 15; /**< Reserved. */ 327 } __attribute__ 327 } __attribute__((packed)); 328 328 }; 329 329 union { … … 332 332 unsigned int : 24; /**< Reserved. */ 333 333 uint8_t dest : 8; /**< Destination Field. */ 334 } __attribute__ 334 } __attribute__((packed)); 335 335 }; 336 336 337 } __attribute__ 337 } __attribute__((packed)) io_redirection_reg_t; 338 338 339 339 … … 345 345 unsigned int apic_id : 4; /**< IO APIC ID. */ 346 346 unsigned int : 4; /**< Reserved. */ 347 } __attribute__ 347 } __attribute__((packed)); 348 348 } io_apic_id_t; 349 349 -
kernel/arch/ia32/include/arch/smp/mps.h
r47b2d7e3 r1433ecda 55 55 uint8_t mpfib4; 56 56 uint8_t mpfib5; 57 } __attribute__ 57 } __attribute__((packed)); 58 58 59 59 struct mps_ct { … … 72 72 uint8_t reserved; 73 73 uint8_t base_table[0]; 74 } __attribute__ 74 } __attribute__((packed)); 75 75 76 76 struct __processor_entry { … … 82 82 uint32_t feature_flags; 83 83 uint32_t reserved[2]; 84 } __attribute__ 84 } __attribute__((packed)); 85 85 86 86 struct __bus_entry { … … 88 88 uint8_t bus_id; 89 89 uint8_t bus_type[6]; 90 } __attribute__ 90 } __attribute__((packed)); 91 91 92 92 struct __io_apic_entry { … … 96 96 uint8_t io_apic_flags; 97 97 uint32_t io_apic; 98 } __attribute__ 98 } __attribute__((packed)); 99 99 100 100 struct __io_intr_entry { … … 107 107 uint8_t dst_io_apic_id; 108 108 uint8_t dst_io_apic_pin; 109 } __attribute__ 109 } __attribute__((packed)); 110 110 111 111 struct __l_intr_entry { … … 118 118 uint8_t dst_l_apic_id; 119 119 uint8_t dst_l_apic_pin; 120 } __attribute__ 120 } __attribute__((packed)); 121 121 122 122 extern struct smp_config_operations mps_config_operations;
Note:
See TracChangeset
for help on using the changeset viewer.