Changeset 7a0359b in mainline for kernel/arch/ia32/include/asm.h


Ignore:
Timestamp:
2010-07-02T15:42:19Z (14 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
bbfdf62
Parents:
e3ee9b9
Message:

improve kernel function tracing

  • add support for more generic kernel sources
  • replace attribute((no_instrument_function)) with NO_TRACE macro (shorter and for future compatibility with different compilers)
  • to be on the safe side, do not instrument most of the inline and static functions (plus some specific non-static functions)

collateral code cleanup (no change in functionality)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/ia32/include/asm.h

    re3ee9b9 r7a0359b  
    4141#include <typedefs.h>
    4242#include <config.h>
     43#include <trace.h>
    4344
    4445extern uint32_t interrupt_handler_size;
    4546
    46 extern void paging_on(void);
    47 
    48 extern void interrupt_handlers(void);
    49 
    50 extern void enable_l_apic_in_msr(void);
    51 
    52 
    53 extern void asm_delay_loop(uint32_t t);
    54 extern void asm_fake_loop(uint32_t t);
    55 
    56 
    5747/** Halt CPU
    5848 *
     
    6050 *
    6151 */
    62 static inline __attribute__((noreturn)) void cpu_halt(void)
     52NO_TRACE static inline __attribute__((noreturn)) void cpu_halt(void)
    6353{
    6454        while (true) {
     
    6959}
    7060
    71 static inline void cpu_sleep(void)
    72 {
    73         asm volatile ("hlt\n");
    74 }
    75 
    76 #define GEN_READ_REG(reg) static inline unative_t read_ ##reg (void) \
     61NO_TRACE static inline void cpu_sleep(void)
     62{
     63        asm volatile (
     64                "hlt\n"
     65        );
     66}
     67
     68#define GEN_READ_REG(reg) NO_TRACE static inline unative_t read_ ##reg (void) \
    7769        { \
    7870                unative_t res; \
     
    8476        }
    8577
    86 #define GEN_WRITE_REG(reg) static inline void write_ ##reg (unative_t regn) \
     78#define GEN_WRITE_REG(reg) NO_TRACE static inline void write_ ##reg (unative_t regn) \
    8779        { \
    8880                asm volatile ( \
     
    119111 *
    120112 */
    121 static inline void pio_write_8(ioport8_t *port, uint8_t val)
     113NO_TRACE static inline void pio_write_8(ioport8_t *port, uint8_t val)
    122114{
    123115        asm volatile (
    124116                "outb %b[val], %w[port]\n"
    125                 :: [val] "a" (val), [port] "d" (port)
     117                :: [val] "a" (val),
     118                   [port] "d" (port)
    126119        );
    127120}
     
    135128 *
    136129 */
    137 static inline void pio_write_16(ioport16_t *port, uint16_t val)
     130NO_TRACE static inline void pio_write_16(ioport16_t *port, uint16_t val)
    138131{
    139132        asm volatile (
    140133                "outw %w[val], %w[port]\n"
    141                 :: [val] "a" (val), [port] "d" (port)
     134                :: [val] "a" (val),
     135                   [port] "d" (port)
    142136        );
    143137}
     
    151145 *
    152146 */
    153 static inline void pio_write_32(ioport32_t *port, uint32_t val)
     147NO_TRACE static inline void pio_write_32(ioport32_t *port, uint32_t val)
    154148{
    155149        asm volatile (
    156150                "outl %[val], %w[port]\n"
    157                 :: [val] "a" (val), [port] "d" (port)
     151                :: [val] "a" (val),
     152                   [port] "d" (port)
    158153        );
    159154}
     
    167162 *
    168163 */
    169 static inline uint8_t pio_read_8(ioport8_t *port)
     164NO_TRACE static inline uint8_t pio_read_8(ioport8_t *port)
    170165{
    171166        uint8_t val;
     
    188183 *
    189184 */
    190 static inline uint16_t pio_read_16(ioport16_t *port)
     185NO_TRACE static inline uint16_t pio_read_16(ioport16_t *port)
    191186{
    192187        uint16_t val;
     
    209204 *
    210205 */
    211 static inline uint32_t pio_read_32(ioport32_t *port)
     206NO_TRACE static inline uint32_t pio_read_32(ioport32_t *port)
    212207{
    213208        uint32_t val;
     
    230225 *
    231226 */
    232 static inline ipl_t interrupts_enable(void)
     227NO_TRACE static inline ipl_t interrupts_enable(void)
    233228{
    234229        ipl_t v;
     
    252247 *
    253248 */
    254 static inline ipl_t interrupts_disable(void)
     249NO_TRACE static inline ipl_t interrupts_disable(void)
    255250{
    256251        ipl_t v;
     
    273268 *
    274269 */
    275 static inline void interrupts_restore(ipl_t ipl)
     270NO_TRACE static inline void interrupts_restore(ipl_t ipl)
    276271{
    277272        asm volatile (
     
    287282 *
    288283 */
    289 static inline ipl_t interrupts_read(void)
     284NO_TRACE static inline ipl_t interrupts_read(void)
    290285{
    291286        ipl_t v;
     
    305300 *
    306301 */
    307 static inline bool interrupts_disabled(void)
     302NO_TRACE static inline bool interrupts_disabled(void)
    308303{
    309304        ipl_t v;
     
    319314
    320315/** Write to MSR */
    321 static inline void write_msr(uint32_t msr, uint64_t value)
     316NO_TRACE static inline void write_msr(uint32_t msr, uint64_t value)
    322317{
    323318        asm volatile (
    324319                "wrmsr"
    325                 :: "c" (msr), "a" ((uint32_t) (value)),
     320                :: "c" (msr),
     321                   "a" ((uint32_t) (value)),
    326322                   "d" ((uint32_t) (value >> 32))
    327323        );
    328324}
    329325
    330 static inline uint64_t read_msr(uint32_t msr)
     326NO_TRACE static inline uint64_t read_msr(uint32_t msr)
    331327{
    332328        uint32_t ax, dx;
     
    334330        asm volatile (
    335331                "rdmsr"
    336                 : "=a" (ax), "=d" (dx)
     332                : "=a" (ax),
     333                  "=d" (dx)
    337334                : "c" (msr)
    338335        );
     
    349346 *
    350347 */
    351 static inline uintptr_t get_stack_base(void)
     348NO_TRACE static inline uintptr_t get_stack_base(void)
    352349{
    353350        uintptr_t v;
     
    367364 *
    368365 */
    369 static inline void invlpg(uintptr_t addr)
     366NO_TRACE static inline void invlpg(uintptr_t addr)
    370367{
    371368        asm volatile (
     
    380377 *
    381378 */
    382 static inline void gdtr_load(ptr_16_32_t *gdtr_reg)
     379NO_TRACE static inline void gdtr_load(ptr_16_32_t *gdtr_reg)
    383380{
    384381        asm volatile (
     
    393390 *
    394391 */
    395 static inline void gdtr_store(ptr_16_32_t *gdtr_reg)
     392NO_TRACE static inline void gdtr_store(ptr_16_32_t *gdtr_reg)
    396393{
    397394        asm volatile (
     
    406403 *
    407404 */
    408 static inline void idtr_load(ptr_16_32_t *idtr_reg)
     405NO_TRACE static inline void idtr_load(ptr_16_32_t *idtr_reg)
    409406{
    410407        asm volatile (
     
    419416 *
    420417 */
    421 static inline void tr_load(uint16_t sel)
     418NO_TRACE static inline void tr_load(uint16_t sel)
    422419{
    423420        asm volatile (
     
    427424}
    428425
     426extern void paging_on(void);
     427extern void interrupt_handlers(void);
     428extern void enable_l_apic_in_msr(void);
     429
     430extern void asm_delay_loop(uint32_t);
     431extern void asm_fake_loop(uint32_t);
     432
    429433#endif
    430434
Note: See TracChangeset for help on using the changeset viewer.