Changes in kernel/arch/amd64/include/asm.h [7a0359b:3d6beaa] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/amd64/include/asm.h
r7a0359b r3d6beaa 39 39 #include <typedefs.h> 40 40 #include <arch/cpu.h> 41 #include <trace.h> 41 42 extern void asm_delay_loop(uint32_t t); 43 extern void asm_fake_loop(uint32_t t); 42 44 43 45 /** Return base address of current stack. … … 48 50 * 49 51 */ 50 NO_TRACEstatic inline uintptr_t get_stack_base(void)52 static inline uintptr_t get_stack_base(void) 51 53 { 52 54 uintptr_t v; … … 55 57 "andq %%rsp, %[v]\n" 56 58 : [v] "=r" (v) 57 : "0" (~((uint64_t) STACK_SIZE -1))59 : "0" (~((uint64_t) STACK_SIZE-1)) 58 60 ); 59 61 … … 61 63 } 62 64 63 NO_TRACE static inline void cpu_sleep(void) 64 { 65 asm volatile ( 66 "hlt\n" 67 ); 68 } 69 70 NO_TRACE static inline void __attribute__((noreturn)) cpu_halt(void) 65 static inline void cpu_sleep(void) 66 { 67 asm volatile ("hlt\n"); 68 } 69 70 static inline void __attribute__((noreturn)) cpu_halt(void) 71 71 { 72 72 while (true) { … … 77 77 } 78 78 79 79 80 /** Byte from port 80 81 * … … 85 86 * 86 87 */ 87 NO_TRACEstatic inline uint8_t pio_read_8(ioport8_t *port)88 static inline uint8_t pio_read_8(ioport8_t *port) 88 89 { 89 90 uint8_t val; … … 106 107 * 107 108 */ 108 NO_TRACEstatic inline uint16_t pio_read_16(ioport16_t *port)109 static inline uint16_t pio_read_16(ioport16_t *port) 109 110 { 110 111 uint16_t val; … … 127 128 * 128 129 */ 129 NO_TRACEstatic inline uint32_t pio_read_32(ioport32_t *port)130 static inline uint32_t pio_read_32(ioport32_t *port) 130 131 { 131 132 uint32_t val; … … 148 149 * 149 150 */ 150 NO_TRACEstatic inline void pio_write_8(ioport8_t *port, uint8_t val)151 static inline void pio_write_8(ioport8_t *port, uint8_t val) 151 152 { 152 153 asm volatile ( 153 154 "outb %b[val], %w[port]\n" 154 :: [val] "a" (val), 155 [port] "d" (port) 155 :: [val] "a" (val), [port] "d" (port) 156 156 ); 157 157 } … … 165 165 * 166 166 */ 167 NO_TRACEstatic inline void pio_write_16(ioport16_t *port, uint16_t val)167 static inline void pio_write_16(ioport16_t *port, uint16_t val) 168 168 { 169 169 asm volatile ( 170 170 "outw %w[val], %w[port]\n" 171 :: [val] "a" (val), 172 [port] "d" (port) 171 :: [val] "a" (val), [port] "d" (port) 173 172 ); 174 173 } … … 182 181 * 183 182 */ 184 NO_TRACEstatic inline void pio_write_32(ioport32_t *port, uint32_t val)183 static inline void pio_write_32(ioport32_t *port, uint32_t val) 185 184 { 186 185 asm volatile ( 187 186 "outl %[val], %w[port]\n" 188 :: [val] "a" (val), 189 [port] "d" (port) 187 :: [val] "a" (val), [port] "d" (port) 190 188 ); 191 189 } 192 190 193 191 /** Swap Hidden part of GS register with visible one */ 194 NO_TRACE static inline void swapgs(void) 195 { 196 asm volatile ( 197 "swapgs" 198 ); 192 static inline void swapgs(void) 193 { 194 asm volatile("swapgs"); 199 195 } 200 196 … … 207 203 * 208 204 */ 209 NO_TRACEstatic inline ipl_t interrupts_enable(void) {205 static inline ipl_t interrupts_enable(void) { 210 206 ipl_t v; 211 207 … … 228 224 * 229 225 */ 230 NO_TRACEstatic inline ipl_t interrupts_disable(void) {226 static inline ipl_t interrupts_disable(void) { 231 227 ipl_t v; 232 228 … … 248 244 * 249 245 */ 250 NO_TRACEstatic inline void interrupts_restore(ipl_t ipl) {246 static inline void interrupts_restore(ipl_t ipl) { 251 247 asm volatile ( 252 248 "pushq %[ipl]\n" … … 263 259 * 264 260 */ 265 NO_TRACEstatic inline ipl_t interrupts_read(void) {261 static inline ipl_t interrupts_read(void) { 266 262 ipl_t v; 267 263 … … 280 276 * 281 277 */ 282 NO_TRACEstatic inline bool interrupts_disabled(void)278 static inline bool interrupts_disabled(void) 283 279 { 284 280 ipl_t v; … … 293 289 } 294 290 291 295 292 /** Write to MSR */ 296 NO_TRACEstatic inline void write_msr(uint32_t msr, uint64_t value)293 static inline void write_msr(uint32_t msr, uint64_t value) 297 294 { 298 295 asm volatile ( … … 304 301 } 305 302 306 NO_TRACEstatic inline unative_t read_msr(uint32_t msr)303 static inline unative_t read_msr(uint32_t msr) 307 304 { 308 305 uint32_t ax, dx; … … 317 314 } 318 315 316 319 317 /** Enable local APIC 320 318 * … … 322 320 * 323 321 */ 324 NO_TRACEstatic inline void enable_l_apic_in_msr()322 static inline void enable_l_apic_in_msr() 325 323 { 326 324 asm volatile ( … … 330 328 "orl $(0xfee00000),%%eax\n" 331 329 "wrmsr\n" 332 ::: "%eax", "%ecx","%edx"330 ::: "%eax","%ecx","%edx" 333 331 ); 334 332 } … … 339 337 * 340 338 */ 341 NO_TRACEstatic inline void invlpg(uintptr_t addr)339 static inline void invlpg(uintptr_t addr) 342 340 { 343 341 asm volatile ( … … 352 350 * 353 351 */ 354 NO_TRACEstatic inline void gdtr_load(ptr_16_64_t *gdtr_reg)352 static inline void gdtr_load(ptr_16_64_t *gdtr_reg) 355 353 { 356 354 asm volatile ( … … 365 363 * 366 364 */ 367 NO_TRACEstatic inline void gdtr_store(ptr_16_64_t *gdtr_reg)365 static inline void gdtr_store(ptr_16_64_t *gdtr_reg) 368 366 { 369 367 asm volatile ( … … 378 376 * 379 377 */ 380 NO_TRACEstatic inline void idtr_load(ptr_16_64_t *idtr_reg)378 static inline void idtr_load(ptr_16_64_t *idtr_reg) 381 379 { 382 380 asm volatile ( … … 390 388 * 391 389 */ 392 NO_TRACEstatic inline void tr_load(uint16_t sel)390 static inline void tr_load(uint16_t sel) 393 391 { 394 392 asm volatile ( … … 398 396 } 399 397 400 #define GEN_READ_REG(reg) NO_TRACEstatic inline unative_t read_ ##reg (void) \398 #define GEN_READ_REG(reg) static inline unative_t read_ ##reg (void) \ 401 399 { \ 402 400 unative_t res; \ … … 408 406 } 409 407 410 #define GEN_WRITE_REG(reg) NO_TRACEstatic inline void write_ ##reg (unative_t regn) \408 #define GEN_WRITE_REG(reg) static inline void write_ ##reg (unative_t regn) \ 411 409 { \ 412 410 asm volatile ( \ … … 438 436 extern void interrupt_handlers(void); 439 437 440 extern void asm_delay_loop(uint32_t);441 extern void asm_fake_loop(uint32_t);442 443 438 #endif 444 439
Note:
See TracChangeset
for help on using the changeset viewer.