/kernel/trunk/generic/src/lib/elf.c |
---|
96,7 → 96,7 |
/* Walk through all segment headers and process them. */ |
for (i = 0; i < header->e_phnum; i++) { |
rc = segment_header(&((elf_segment_header_t *)(((__u8 *) header) + header->e_phoff))[i], header, as); |
rc = segment_header(&((elf_segment_header_t *)(((uint8_t *) header) + header->e_phoff))[i], header, as); |
if (rc != EE_OK) |
return rc; |
} |
103,7 → 103,7 |
/* Inspect all section headers and proccess them. */ |
for (i = 0; i < header->e_shnum; i++) { |
rc = section_header(&((elf_section_header_t *)(((__u8 *) header) + header->e_shoff))[i], header, as); |
rc = section_header(&((elf_section_header_t *)(((uint8_t *) header) + header->e_shoff))[i], header, as); |
if (rc != EE_OK) |
return rc; |
} |
/kernel/trunk/generic/src/lib/memstr.c |
---|
61,17 → 61,17 |
{ |
int i, j; |
if (ALIGN_UP((__address) src, sizeof(__native)) != (__address) src || |
ALIGN_UP((__address) dst, sizeof(__native)) != (__address) dst) { |
if (ALIGN_UP((uintptr_t) src, sizeof(unative_t)) != (uintptr_t) src || |
ALIGN_UP((uintptr_t) dst, sizeof(unative_t)) != (uintptr_t) dst) { |
for (i = 0; i < cnt; i++) |
((__u8 *) dst)[i] = ((__u8 *) src)[i]; |
((uint8_t *) dst)[i] = ((uint8_t *) src)[i]; |
} else { |
for (i = 0; i < cnt/sizeof(__native); i++) |
((__native *) dst)[i] = ((__native *) src)[i]; |
for (i = 0; i < cnt/sizeof(unative_t); i++) |
((unative_t *) dst)[i] = ((unative_t *) src)[i]; |
for (j = 0; j < cnt%sizeof(__native); j++) |
((__u8 *)(((__native *) dst) + i))[j] = ((__u8 *)(((__native *) src) + i))[j]; |
for (j = 0; j < cnt%sizeof(unative_t); j++) |
((uint8_t *)(((unative_t *) dst) + i))[j] = ((uint8_t *)(((unative_t *) src) + i))[j]; |
} |
return (char *)src; |
87,10 → 87,10 |
* @param x Value to fill. |
* |
*/ |
void _memsetb(__address dst, size_t cnt, __u8 x) |
void _memsetb(uintptr_t dst, size_t cnt, uint8_t x) |
{ |
int i; |
__u8 *p = (__u8 *) dst; |
uint8_t *p = (uint8_t *) dst; |
for(i=0; i<cnt; i++) |
p[i] = x; |
106,10 → 106,10 |
* @param x Value to fill. |
* |
*/ |
void _memsetw(__address dst, size_t cnt, __u16 x) |
void _memsetw(uintptr_t dst, size_t cnt, uint16_t x) |
{ |
int i; |
__u16 *p = (__u16 *) dst; |
uint16_t *p = (uint16_t *) dst; |
for(i=0; i<cnt; i++) |
p[i] = x; |
/kernel/trunk/generic/src/lib/sort.c |
---|
63,8 → 63,8 |
*/ |
void qsort(void * data, count_t n, size_t e_size, int (* cmp) (void * a, void * b)) |
{ |
__u8 buf_tmp[EBUFSIZE]; |
__u8 buf_pivot[EBUFSIZE]; |
uint8_t buf_tmp[EBUFSIZE]; |
uint8_t buf_pivot[EBUFSIZE]; |
void * tmp = buf_tmp; |
void * pivot = buf_pivot; |
132,7 → 132,7 |
*/ |
void bubblesort(void * data, count_t n, size_t e_size, int (* cmp) (void * a, void * b)) |
{ |
__u8 buf_slot[EBUFSIZE]; |
uint8_t buf_slot[EBUFSIZE]; |
void * slot = buf_slot; |
if (e_size > EBUFSIZE) { |
184,19 → 184,19 |
return (* (int *) a > * (int*)b) ? 1 : (*(int *)a < * (int *)b) ? -1 : 0; |
} |
int __u8_cmp(void * a, void * b) |
int uint8_t_cmp(void * a, void * b) |
{ |
return (* (__u8 *) a > * (__u8 *)b) ? 1 : (*(__u8 *)a < * (__u8 *)b) ? -1 : 0; |
return (* (uint8_t *) a > * (uint8_t *)b) ? 1 : (*(uint8_t *)a < * (uint8_t *)b) ? -1 : 0; |
} |
int __u16_cmp(void * a, void * b) |
int uint16_t_cmp(void * a, void * b) |
{ |
return (* (__u16 *) a > * (__u16 *)b) ? 1 : (*(__u16 *)a < * (__u16 *)b) ? -1 : 0; |
return (* (uint16_t *) a > * (uint16_t *)b) ? 1 : (*(uint16_t *)a < * (uint16_t *)b) ? -1 : 0; |
} |
int __u32_cmp(void * a, void * b) |
int uint32_t_cmp(void * a, void * b) |
{ |
return (* (__u32 *) a > * (__u32 *)b) ? 1 : (*(__u32 *)a < * (__u32 *)b) ? -1 : 0; |
return (* (uint32_t *) a > * (uint32_t *)b) ? 1 : (*(uint32_t *)a < * (uint32_t *)b) ? -1 : 0; |
} |
/** @} |
/kernel/trunk/generic/src/lib/func.c |
---|
148,7 → 148,7 |
dest[i-1] = '\0'; |
} |
/** Convert ascii representation to __native |
/** Convert ascii representation to unative_t |
* |
* Supports 0x for hexa & 0 for octal notation. |
* Does not check for overflows, does not support negative numbers |
156,10 → 156,10 |
* @param text Textual representation of number |
* @return Converted number or 0 if no valid number ofund |
*/ |
__native atoi(const char *text) |
unative_t atoi(const char *text) |
{ |
int base = 10; |
__native result = 0; |
unative_t result = 0; |
if (text[0] == '0' && text[1] == 'x') { |
base = 16; |