Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 2794 → Rev 2797

/trunk/kernel/generic/include/byteorder.h
35,6 → 35,34
#ifndef KERN_BYTEORDER_H_
#define KERN_BYTEORDER_H_
 
#include <arch/byteorder.h>
 
#if !(defined(ARCH_IS_BIG_ENDIAN) ^ defined(ARCH_IS_LITTLE_ENDIAN))
#error The architecture must be either big-endian or little-endian.
#endif
 
#ifdef ARCH_IS_BIG_ENDIAN
 
#define uint16_t_le2host(n) uint16_t_byteorder_swap(n)
#define uint32_t_le2host(n) uint32_t_byteorder_swap(n)
#define uint64_t_le2host(n) uint64_t_byteorder_swap(n)
 
#define uint16_t_be2host(n) (n)
#define uint32_t_be2host(n) (n)
#define uint64_t_be2host(n) (n)
 
#else
 
#define uint16_t_le2host(n) (n)
#define uint32_t_le2host(n) (n)
#define uint64_t_le2host(n) (n)
 
#define uint16_t_be2host(n) uint16_t_byteorder_swap(n)
#define uint32_t_be2host(n) uint32_t_byteorder_swap(n)
#define uint64_t_be2host(n) uint64_t_byteorder_swap(n)
 
#endif
 
static inline uint64_t uint64_t_byteorder_swap(uint64_t n)
{
return ((n & 0xff) << 56) |
/trunk/kernel/generic/src/debug/symtab.c
36,7 → 36,7
*/
 
#include <symtab.h>
#include <arch/byteorder.h>
#include <byteorder.h>
#include <func.h>
#include <print.h>
 
53,12 → 53,12
{
count_t i;
 
for (i=1;symbol_table[i].address_le;++i) {
for (i = 1; symbol_table[i].address_le; ++i) {
if (addr < uint64_t_le2host(symbol_table[i].address_le))
break;
}
if (addr >= uint64_t_le2host(symbol_table[i-1].address_le))
return symbol_table[i-1].symbol_name;
if (addr >= uint64_t_le2host(symbol_table[i - 1].address_le))
return symbol_table[i - 1].symbol_name;
return NULL;
}
 
72,19 → 72,19
{
unsigned int namelen = strlen(name);
char *curname;
int i,j;
int i, j;
int colonoffset = -1;
 
for (i=0;name[i];i++)
for (i = 0; name[i]; i++)
if (name[i] == ':') {
colonoffset = i;
break;
}
 
for (i=*startpos;symbol_table[i].address_le;++i) {
for (i = *startpos; symbol_table[i].address_le; ++i) {
/* Find a ':' in name */
curname = symbol_table[i].symbol_name;
for (j=0; curname[j] && curname[j] != ':'; j++)
for (j = 0; curname[j] && curname[j] != ':'; j++)
;
if (!curname[j])
continue;
94,7 → 94,7
continue;
if (strncmp(curname, name, namelen) == 0) {
*startpos = i;
return curname+namelen;
return curname + namelen;
}
}
return NULL;
115,7 → 115,7
int i;
 
i = 0;
while ((hint=symtab_search_one(name, &i))) {
while ((hint = symtab_search_one(name, &i))) {
if (!strlen(hint)) {
addr = uint64_t_le2host(symbol_table[i].address_le);
found++;
151,7 → 151,7
*/
int symtab_compl(char *input)
{
char output[MAX_SYMBOL_NAME+1];
char output[MAX_SYMBOL_NAME + 1];
int startpos = 0;
char *foundtxt;
int found = 0;
172,9 → 172,10
while ((foundtxt = symtab_search_one(name, &startpos))) {
startpos++;
if (!found)
strncpy(output, foundtxt, strlen(foundtxt)+1);
strncpy(output, foundtxt, strlen(foundtxt) + 1);
else {
for (i=0; output[i] && foundtxt[i] && output[i]==foundtxt[i]; i++)
for (i = 0; output[i] && foundtxt[i] &&
output[i] == foundtxt[i]; i++)
;
output[i] = '\0';
}
/trunk/kernel/generic/src/lib/rd.c
38,7 → 38,7
*/
 
#include <lib/rd.h>
#include <arch/byteorder.h>
#include <byteorder.h>
#include <mm/frame.h>
#include <sysinfo/sysinfo.h>
#include <ddi/ddi.h>
/trunk/kernel/arch/sparc64/include/byteorder.h
35,16 → 35,8
#ifndef KERN_sparc64_BYTEORDER_H_
#define KERN_sparc64_BYTEORDER_H_
 
#include <byteorder.h>
#define ARCH_IS_BIG_ENDIAN
 
#define uint16_t_le2host(n) uint16_t_byteorder_swap(n)
#define uint32_t_le2host(n) uint32_t_byteorder_swap(n)
#define uint64_t_le2host(n) uint64_t_byteorder_swap(n)
 
#define uint16_t_be2host(n) (n)
#define uint32_t_be2host(n) (n)
#define uint64_t_be2host(n) (n)
 
#endif
 
/** @}
/trunk/kernel/arch/ia64/include/byteorder.h
35,17 → 35,9
#ifndef KERN_ia64_BYTEORDER_H_
#define KERN_ia64_BYTEORDER_H_
 
#include <byteorder.h>
 
/* IA-64 is little-endian */
#define uint16_t_le2host(n) (n)
#define uint32_t_le2host(n) (n)
#define uint64_t_le2host(n) (n)
#define ARCH_IS_LITTLE_ENDIAN
 
#define uint16_t_be2host(n) uint16_t_byteorder_swap(n)
#define uint32_t_be2host(n) uint32_t_byteorder_swap(n)
#define uint64_t_be2host(n) uint64_t_byteorder_swap(n)
 
#endif
 
/** @}
/trunk/kernel/arch/arm32/include/byteorder.h
36,28 → 36,10
#ifndef KERN_arm32_BYTEORDER_H_
#define KERN_arm32_BYTEORDER_H_
 
#include <byteorder.h>
 
#ifdef BIG_ENDIAN
 
#define uint16_t_le2host(n) uint16_t_byteorder_swap(n)
#define uint32_t_le2host(n) uint32_t_byteorder_swap(n)
#define uint64_t_le2host(n) uint64_t_byteorder_swap(n)
 
#define uint16_t_be2host(n) (n)
#define uint32_t_be2host(n) (n)
#define uint64_t_be2host(n) (n)
 
#define ARCH_IS_BIG_ENDIAN
#else
 
#define uint16_t_le2host(n) (n)
#define uint32_t_le2host(n) (n)
#define uint64_t_le2host(n) (n)
 
#define uint16_t_be2host(n) uint16_t_byteorder_swap(n)
#define uint32_t_be2host(n) uint32_t_byteorder_swap(n)
#define uint64_t_be2host(n) uint64_t_byteorder_swap(n)
 
#define ARCH_IS_LITTLE_ENDIAN
#endif
 
#endif
/trunk/kernel/arch/ppc32/include/byteorder.h
35,16 → 35,8
#ifndef KERN_ppc32_BYTEORDER_H_
#define KERN_ppc32_BYTEORDER_H_
 
#include <byteorder.h>
#define ARCH_IS_BIG_ENDIAN
 
#define uint16_t_le2host(n) uint16_t_byteorder_swap(n)
#define uint32_t_le2host(n) uint32_t_byteorder_swap(n)
#define uint64_t_le2host(n) uint64_t_byteorder_swap(n)
 
#define uint16_t_be2host(n) (n)
#define uint32_t_be2host(n) (n)
#define uint64_t_be2host(n) (n)
 
#endif
 
/** @}
/trunk/kernel/arch/amd64/include/byteorder.h
35,17 → 35,9
#ifndef KERN_amd64_BYTEORDER_H_
#define KERN_amd64_BYTEORDER_H_
 
#include <byteorder.h>
 
/* AMD64 is little-endian */
#define uint16_t_le2host(n) (n)
#define uint32_t_le2host(n) (n)
#define uint64_t_le2host(n) (n)
#define ARCH_IS_LITTLE_ENDIAN
 
#define uint16_t_be2host(n) uint16_t_byteorder_swap(n)
#define uint32_t_be2host(n) uint32_t_byteorder_swap(n)
#define uint64_t_be2host(n) uint64_t_byteorder_swap(n)
 
#endif
 
/** @}
/trunk/kernel/arch/ppc64/include/byteorder.h
35,16 → 35,8
#ifndef KERN_ppc64_BYTEORDER_H_
#define KERN_ppc64_BYTEORDER_H_
 
#include <byteorder.h>
#define ARCH_IS_BIG_ENDIAN
 
#define uint16_t_le2host(n) uint16_t_byteorder_swap(n)
#define uint32_t_le2host(n) uint32_t_byteorder_swap(n)
#define uint64_t_le2host(n) uint64_t_byteorder_swap(n)
 
#define uint16_t_be2host(n) (n)
#define uint32_t_be2host(n) (n)
#define uint64_t_be2host(n) (n)
 
#endif
 
/** @}
/trunk/kernel/arch/mips32/include/byteorder.h
35,28 → 35,10
#ifndef KERN_mips32_BYTEORDER_H_
#define KERN_mips32_BYTEORDER_H_
 
#include <byteorder.h>
 
#ifdef BIG_ENDIAN
 
#define uint16_t_le2host(n) uint16_t_byteorder_swap(n)
#define uint32_t_le2host(n) uint32_t_byteorder_swap(n)
#define uint64_t_le2host(n) uint64_t_byteorder_swap(n)
 
#define uint16_t_be2host(n) (n)
#define uint32_t_be2host(n) (n)
#define uint64_t_be2host(n) (n)
 
#define ARCH_IS_BIG_ENDIAN
#else
 
#define uint16_t_le2host(n) (n)
#define uint32_t_le2host(n) (n)
#define uint64_t_le2host(n) (n)
 
#define uint16_t_be2host(n) uint16_t_byteorder_swap(n)
#define uint32_t_be2host(n) uint32_t_byteorder_swap(n)
#define uint64_t_be2host(n) uint64_t_byteorder_swap(n)
 
#define ARCH_IS_LITTLE_ENDIAN
#endif
 
#endif
/trunk/kernel/arch/mips32/src/drivers/arc.c
36,7 → 36,7
#include <arch/mm/page.h>
#include <print.h>
#include <arch.h>
#include <arch/byteorder.h>
#include <byteorder.h>
#include <arch/mm/frame.h>
#include <mm/frame.h>
#include <interrupt.h>
/trunk/kernel/arch/ia32/include/byteorder.h
35,17 → 35,9
#ifndef KERN_ia32_BYTEORDER_H_
#define KERN_ia32_BYTEORDER_H_
 
#include <byteorder.h>
 
/* IA-32 is little-endian */
#define uint16_t_le2host(n) (n)
#define uint32_t_le2host(n) (n)
#define uint64_t_le2host(n) (n)
#define ARCH_IS_LITTLE_ENDIAN
 
#define uint16_t_be2host(n) uint16_t_byteorder_swap(n)
#define uint32_t_be2host(n) uint32_t_byteorder_swap(n)
#define uint64_t_be2host(n) uint64_t_byteorder_swap(n)
 
#endif
 
/** @}