Changeset a35b458 in mainline for kernel/arch/ia32/include
- Timestamp:
- 2018-03-02T20:10:49Z (8 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- f1380b7
- Parents:
- 3061bc1
- git-author:
- Jiří Zárevúcky <zarevucky.jiri@…> (2018-02-28 17:38:31)
- git-committer:
- Jiří Zárevúcky <zarevucky.jiri@…> (2018-03-02 20:10:49)
- Location:
- kernel/arch/ia32/include/arch
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/ia32/include/arch/asm.h
r3061bc1 ra35b458 174 174 if (((void *)port) < IO_SPACE_BOUNDARY) { 175 175 uint8_t val; 176 176 177 177 asm volatile ( 178 178 "inb %w[port], %b[val]\n" … … 180 180 : [port] "d" (port) 181 181 ); 182 182 183 183 return val; 184 184 } else … … 198 198 if (((void *)port) < IO_SPACE_BOUNDARY) { 199 199 uint16_t val; 200 200 201 201 asm volatile ( 202 202 "inw %w[port], %w[val]\n" … … 204 204 : [port] "d" (port) 205 205 ); 206 206 207 207 return val; 208 208 } else … … 222 222 if (((void *)port) < IO_SPACE_BOUNDARY) { 223 223 uint32_t val; 224 224 225 225 asm volatile ( 226 226 "inl %w[port], %[val]\n" … … 228 228 : [port] "d" (port) 229 229 ); 230 230 231 231 return val; 232 232 } else … … 243 243 : [v] "=r" (eflags) 244 244 ); 245 245 246 246 return eflags; 247 247 } … … 276 276 { 277 277 ipl_t ipl = interrupts_read(); 278 278 279 279 asm volatile ("sti\n"); 280 280 281 281 return ipl; 282 282 } … … 292 292 { 293 293 ipl_t ipl = interrupts_read(); 294 294 295 295 asm volatile ("cli\n"); 296 296 297 297 return ipl; 298 298 } … … 336 336 { 337 337 uint32_t ax, dx; 338 338 339 339 asm volatile ( 340 340 "rdmsr" … … 343 343 : "c" (msr) 344 344 ); 345 345 346 346 return ((uint64_t) dx << 32) | ax; 347 347 } … … 360 360 { 361 361 uintptr_t v; 362 362 363 363 asm volatile ( 364 364 "andl %%esp, %[v]\n" … … 366 366 : "0" (~(STACK_SIZE - 1)) 367 367 ); 368 368 369 369 return v; 370 370 } -
kernel/arch/ia32/include/arch/atomic.h
r3061bc1 ra35b458 75 75 { 76 76 atomic_count_t r = 1; 77 77 78 78 asm volatile ( 79 79 "lock xaddl %[r], %[count]\n" … … 81 81 [r] "+r" (r) 82 82 ); 83 83 84 84 return r; 85 85 } … … 88 88 { 89 89 atomic_count_t r = -1; 90 90 91 91 asm volatile ( 92 92 "lock xaddl %[r], %[count]\n" … … 94 94 [r] "+r" (r) 95 95 ); 96 96 97 97 return r; 98 98 } … … 104 104 { 105 105 atomic_count_t v = 1; 106 106 107 107 asm volatile ( 108 108 "xchgl %[v], %[count]\n" … … 110 110 [count] "+m" (val->count) 111 111 ); 112 112 113 113 return v; 114 114 } … … 119 119 { 120 120 atomic_count_t tmp; 121 121 122 122 preemption_disable(); 123 123 asm volatile ( … … 129 129 "testl %[tmp], %[tmp]\n" 130 130 "jnz 0b\n" /* lightweight looping on locked spinlock */ 131 131 132 132 "incl %[tmp]\n" /* now use the atomic operation */ 133 133 "xchgl %[count], %[tmp]\n" … … 137 137 [tmp] "=&r" (tmp) 138 138 ); 139 139 140 140 /* 141 141 * Prevent critical section code from bleeding out this way up. -
kernel/arch/ia32/include/arch/cpu.h
r3061bc1 ra35b458 80 80 81 81 tss_t *tss; 82 82 83 83 size_t iomapver_copy; /** Copy of TASK's I/O Permission bitmap generation count. */ 84 84 } cpu_arch_t; -
kernel/arch/ia32/include/arch/cpuid.h
r3061bc1 ra35b458 83 83 uint32_t val; 84 84 uint32_t ret; 85 85 86 86 asm volatile ( 87 87 "pushf\n" /* read flags */ 88 88 "popl %[ret]\n" 89 89 "movl %[ret], %[val]\n" 90 90 91 91 "xorl %[eflags_id], %[val]\n" /* swap the ID bit */ 92 92 93 93 "pushl %[val]\n" /* propagate the change into flags */ 94 94 "popf\n" 95 95 "pushf\n" 96 96 "popl %[val]\n" 97 97 98 98 "andl %[eflags_id], %[ret]\n" /* interrested only in ID bit */ 99 99 "andl %[eflags_id], %[val]\n" … … 102 102 : [eflags_id] "i" (EFLAGS_ID) 103 103 ); 104 104 105 105 return ret; 106 106 } -
kernel/arch/ia32/include/arch/cycle.h
r3061bc1 ra35b458 44 44 #else 45 45 uint64_t v; 46 46 47 47 asm volatile( 48 48 "rdtsc\n" 49 49 : "=A" (v) 50 50 ); 51 51 52 52 return v; 53 53 #endif -
kernel/arch/ia32/include/arch/mm/page.h
r3061bc1 ra35b458 183 183 { 184 184 pte_t *p = &pt[i]; 185 185 186 186 return ((!p->page_cache_disable) << PAGE_CACHEABLE_SHIFT | 187 187 (!p->present) << PAGE_PRESENT_SHIFT | … … 196 196 { 197 197 pte_t *p = &pt[i]; 198 198 199 199 p->page_cache_disable = !(flags & PAGE_CACHEABLE); 200 200 p->present = !(flags & PAGE_NOT_PRESENT); … … 202 202 p->writeable = (flags & PAGE_WRITE) != 0; 203 203 p->global = (flags & PAGE_GLOBAL) != 0; 204 204 205 205 /* 206 206 * Ensure that there is at least one bit set even if the present bit is -
kernel/arch/ia32/include/arch/smp/apic.h
r3061bc1 ra35b458 334 334 } __attribute__ ((packed)); 335 335 }; 336 336 337 337 } __attribute__ ((packed)) io_redirection_reg_t; 338 338 -
kernel/arch/ia32/include/arch/smp/smp.h
r3061bc1 ra35b458 43 43 /** Check whether a processor is enabled. */ 44 44 bool (*cpu_enabled)(size_t); 45 45 46 46 /** Check whether a processor is BSP. */ 47 47 bool (*cpu_bootstrap)(size_t); 48 48 49 49 /** Return APIC ID of a processor. */ 50 50 uint8_t (*cpu_apic_id)(size_t); 51 51 52 52 /** Return mapping between IRQ and APIC pin. */ 53 53 int (*irq_to_pin)(unsigned int);
Note:
See TracChangeset
for help on using the changeset viewer.
