4 * Created on: Aug 13, 2008
14 typedef struct __node
{
15 struct __node
*n_succ
,
19 typedef struct __list
{
31 static inline void new_list(list_t
*l
)
33 l
->l_tailpred
= (node_t
*)l
;
35 l
->l_head
= (node_t
*)&l
->l_tail
;
38 static inline void add_head(list_t
*l
, node_t
*n
)
40 n
->n_succ
= l
->l_head
;
41 n
->n_pred
= (node_t
*)&l
->l_head
;
43 l
->l_head
->n_pred
= n
;
47 static inline void add_tail(list_t
*l
, node_t
*n
)
49 n
->n_succ
= (node_t
*)&l
->l_tail
;
50 n
->n_pred
= l
->l_tailpred
;
52 l
->l_tailpred
->n_succ
= n
;
56 static inline node_t
*remove(node_t
*n
)
58 n
->n_pred
->n_succ
= n
->n_succ
;
59 n
->n_succ
->n_pred
= n
->n_pred
;
84 int32_t strlen(const char *c
);
89 int strncasecmp(const char *s1
, const char *s2
, int max
);
90 int strcasecmp(const char *s1
, const char *s2
);
91 int strncmp(const char *s1
, const char *s2
, int max
);
92 void bzero(void *dest
, int length
);
93 void memcpy(void *dest
, const void *src
, int length
);
94 int atoi(const char *str
);
95 char *remove_path(const char *in
);
97 void printf(char *str
, ...);
98 void sprintf(char *dest
, char *str
, ...);
100 #define LOAD_SIZE (0x00500000)
102 #define KERNEL_PHYS_BASE 0x07800000
103 #define KERNEL_VIRT_BASE 0xff800000
105 #define MAX_BSS_SECTIONS 1024
108 static inline uint32_t rdmsr() {
109 uint32_t msr
; asm volatile("mfmsr %0":"=r"(msr
)); return msr
;
112 static inline void wrmsr(uint32_t msr
) {
113 asm volatile("mtmsr %0"::"r"(msr
));
155 ({ unsigned long val; asm volatile("mfspr %0,%1":"=r"(val):"i"(reg)); val; })
157 #define wrspr(reg, val) \
158 do { asm volatile("mtspr %0,%1"::"i"(reg),"r"(val)); } while(0)
162 ({ unsigned long val; asm volatile("mfdcr %0,%1":"=r"(val):"i"(reg)); val; })
164 #define wrdcr(reg, val) \
165 do { asm volatile("mtdcr %0,%1"::"i"(reg),"r"(val)); } while(0)
167 #endif /* SUPPORT_H_ */