Changeset a35b458 in mainline for kernel/arch/amd64/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/amd64/include/arch
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/amd64/include/arch/asm.h
r3061bc1 ra35b458 53 53 { 54 54 uintptr_t v; 55 55 56 56 asm volatile ( 57 57 "andq %%rsp, %[v]\n" … … 59 59 : "0" (~((uint64_t) STACK_SIZE - 1)) 60 60 ); 61 61 62 62 return v; 63 63 } … … 91 91 if (port < (ioport8_t *) IO_SPACE_BOUNDARY) { 92 92 uint8_t val; 93 93 94 94 asm volatile ( 95 95 "inb %w[port], %b[val]\n" … … 97 97 : [port] "d" (port) 98 98 ); 99 99 100 100 return val; 101 101 } else … … 115 115 if (port < (ioport16_t *) IO_SPACE_BOUNDARY) { 116 116 uint16_t val; 117 117 118 118 asm volatile ( 119 119 "inw %w[port], %w[val]\n" … … 121 121 : [port] "d" (port) 122 122 ); 123 123 124 124 return val; 125 125 } else … … 139 139 if (port < (ioport32_t *) IO_SPACE_BOUNDARY) { 140 140 uint32_t val; 141 141 142 142 asm volatile ( 143 143 "inl %w[port], %[val]\n" … … 145 145 : [port] "d" (port) 146 146 ); 147 147 148 148 return val; 149 149 } else … … 252 252 { 253 253 ipl_t ipl = interrupts_read(); 254 254 255 255 asm volatile ("sti\n"); 256 256 257 257 return ipl; 258 258 } … … 268 268 { 269 269 ipl_t ipl = interrupts_read(); 270 270 271 271 asm volatile ("cli\n"); 272 272 273 273 return ipl; 274 274 } … … 310 310 { 311 311 uint32_t ax, dx; 312 312 313 313 asm volatile ( 314 314 "rdmsr\n" … … 316 316 : "c" (msr) 317 317 ); 318 318 319 319 return ((uint64_t) dx << 32) | ax; 320 320 } -
kernel/arch/amd64/include/arch/atomic.h
r3061bc1 ra35b458 74 74 { 75 75 atomic_count_t r = 1; 76 76 77 77 asm volatile ( 78 78 "lock xaddq %[r], %[count]\n" … … 80 80 [r] "+r" (r) 81 81 ); 82 82 83 83 return r; 84 84 } … … 87 87 { 88 88 atomic_count_t r = -1; 89 89 90 90 asm volatile ( 91 91 "lock xaddq %[r], %[count]\n" … … 93 93 [r] "+r" (r) 94 94 ); 95 95 96 96 return r; 97 97 } … … 103 103 { 104 104 atomic_count_t v = 1; 105 105 106 106 asm volatile ( 107 107 "xchgq %[v], %[count]\n" … … 109 109 [count] "+m" (val->count) 110 110 ); 111 111 112 112 return v; 113 113 } … … 117 117 { 118 118 atomic_count_t tmp; 119 119 120 120 preemption_disable(); 121 121 asm volatile ( … … 125 125 " testq %[tmp], %[tmp]\n" 126 126 " jnz 0b\n" /* lightweight looping on locked spinlock */ 127 127 128 128 " incq %[tmp]\n" /* now use the atomic operation */ 129 129 " xchgq %[count], %[tmp]\n" … … 133 133 [tmp] "=&r" (tmp) 134 134 ); 135 135 136 136 /* 137 137 * Prevent critical section code from bleeding out this way up. -
kernel/arch/amd64/include/arch/cpu.h
r3061bc1 ra35b458 89 89 int stepping; 90 90 tss_t *tss; 91 91 92 92 unsigned int id; /** CPU's local, ie physical, APIC ID. */ 93 93 94 94 size_t iomapver_copy; /** Copy of TASK's I/O Permission bitmap generation count. */ 95 95 } cpu_arch_t; -
kernel/arch/amd64/include/arch/cycle.h
r3061bc1 ra35b458 42 42 uint32_t lower; 43 43 uint32_t upper; 44 44 45 45 asm volatile ( 46 46 "rdtsc\n" … … 48 48 "=d" (upper) 49 49 ); 50 50 51 51 return ((uint64_t) lower) | (((uint64_t) upper) << 32); 52 52 } -
kernel/arch/amd64/include/arch/mm/page.h
r3061bc1 ra35b458 210 210 { 211 211 pte_t *p = &pt[i]; 212 212 213 213 return ((!p->page_cache_disable) << PAGE_CACHEABLE_SHIFT | 214 214 (!p->present) << PAGE_PRESENT_SHIFT | … … 223 223 { 224 224 pte_t *p = &pt[i]; 225 225 226 226 p->addr_12_31 = (a >> 12) & UINT32_C(0xfffff); 227 227 p->addr_32_51 = a >> 32; … … 231 231 { 232 232 pte_t *p = &pt[i]; 233 233 234 234 p->page_cache_disable = !(flags & PAGE_CACHEABLE); 235 235 p->present = !(flags & PAGE_NOT_PRESENT); … … 238 238 p->no_execute = (flags & PAGE_EXEC) == 0; 239 239 p->global = (flags & PAGE_GLOBAL) != 0; 240 240 241 241 /* 242 242 * Ensure that there is at least one bit set even if the present bit is cleared.
Note:
See TracChangeset
for help on using the changeset viewer.
