Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/mips32/include/cp0.h

    rc0699467 r84f0a79  
    3636#define KERN_mips32_CP0_H_
    3737
     38#ifdef KERNEL
     39#include <typedefs.h>
     40#else
     41#include <sys/types.h>
     42#endif
     43
    3844#define cp0_status_ie_enabled_bit     (1 << 0)
    3945#define cp0_status_exl_exception_bit  (1 << 1)
     
    4349#define cp0_status_fpu_bit            (1 << 29)
    4450
    45 #define cp0_status_im_shift  8
    46 #define cp0_status_im_mask   0xff00
     51#define cp0_status_im_shift             8
     52#define cp0_status_im_mask              0xff00
    4753
    48 #define cp0_cause_excno(cause)   ((cause >> 2) & 0x1f)
    49 #define cp0_cause_coperr(cause)  ((cause >> 28) & 0x3)
     54#define cp0_cause_excno(cause) ((cause >> 2) & 0x1f)
     55#define cp0_cause_coperr(cause) ((cause >> 28) & 0x3)
    5056
    51 #define fpu_cop_id  1
     57#define fpu_cop_id 1
    5258
    5359/*
    5460 * Magic value for use in msim.
    5561 */
    56 #define cp0_compare_value  100000
     62#define cp0_compare_value               100000
    5763
    58 #define cp0_mask_all_int() \
    59         cp0_status_write(cp0_status_read() & ~(cp0_status_im_mask))
     64#define cp0_mask_all_int() cp0_status_write(cp0_status_read() & ~(cp0_status_im_mask))
     65#define cp0_unmask_all_int() cp0_status_write(cp0_status_read() | cp0_status_im_mask)
     66#define cp0_mask_int(it) cp0_status_write(cp0_status_read() & ~(1 << (cp0_status_im_shift + (it))))
     67#define cp0_unmask_int(it) cp0_status_write(cp0_status_read() | (1 << (cp0_status_im_shift + (it))))
    6068
    61 #define cp0_unmask_all_int() \
    62         cp0_status_write(cp0_status_read() | cp0_status_im_mask)
     69#define GEN_READ_CP0(nm,reg) static inline uint32_t cp0_ ##nm##_read(void) \
     70  { \
     71      uint32_t retval; \
     72      asm volatile ("mfc0 %0, $" #reg : "=r"(retval)); \
     73      return retval; \
     74  }
    6375
    64 #define cp0_mask_int(it) \
    65         cp0_status_write(cp0_status_read() & ~(1 << (cp0_status_im_shift + (it))))
    66 
    67 #define cp0_unmask_int(it) \
    68         cp0_status_write(cp0_status_read() | (1 << (cp0_status_im_shift + (it))))
    69 
    70 #define GEN_READ_CP0(nm, reg) \
    71         static inline uint32_t cp0_ ##nm##_read(void) \
    72         { \
    73                 uint32_t retval; \
    74                 \
    75                 asm volatile ( \
    76                         "mfc0 %0, $" #reg \
    77                         : "=r"(retval) \
    78                 ); \
    79                 \
    80                 return retval; \
    81         }
    82 
    83 #define GEN_WRITE_CP0(nm, reg) \
    84         static inline void cp0_ ##nm##_write(uint32_t val) \
    85         { \
    86                 asm volatile ( \
    87                         "mtc0 %0, $" #reg \
    88                         :: "r"(val) \
    89                 ); \
    90         }
     76#define GEN_WRITE_CP0(nm,reg) static inline void cp0_ ##nm##_write(uint32_t val) \
     77 { \
     78    asm volatile ("mtc0 %0, $" #reg : : "r"(val) ); \
     79 }
    9180
    9281GEN_READ_CP0(index, 0);
Note: See TracChangeset for help on using the changeset viewer.