hello world works on a BE host for a LE guest

arch/alpha/alpha_linux_process.cc:
    Add endian conversions to fstat
sim/byteswap.hh:
    for some reason I don't understand g++ really wanted a long version defined
    even though int32_t should be the same.

--HG--
extra : convert_revision : 5bfe9d3f0b31824fa5a7ae3f51fd0be5ed4d555d
This commit is contained in:
Ali Saidi 2006-02-11 00:55:36 -05:00
parent f2e97427be
commit 96d6ac441c
2 changed files with 54 additions and 53 deletions

View file

@ -251,19 +251,19 @@ class Linux {
{
TypedBufferArg<Linux::tgt_stat> tgt(addr);
tgt->st_dev = host->st_dev;
tgt->st_ino = host->st_ino;
tgt->st_mode = host->st_mode;
tgt->st_nlink = host->st_nlink;
tgt->st_uid = host->st_uid;
tgt->st_gid = host->st_gid;
tgt->st_rdev = host->st_rdev;
tgt->st_size = host->st_size;
tgt->st_atimeX = host->st_atime;
tgt->st_mtimeX = host->st_mtime;
tgt->st_ctimeX = host->st_ctime;
tgt->st_blksize = host->st_blksize;
tgt->st_blocks = host->st_blocks;
tgt->st_dev = htog(host->st_dev);
tgt->st_ino = htog(host->st_ino);
tgt->st_mode = htog(host->st_mode);
tgt->st_nlink = htog(host->st_nlink);
tgt->st_uid = htog(host->st_uid);
tgt->st_gid = htog(host->st_gid);
tgt->st_rdev = htog(host->st_rdev);
tgt->st_size = htog(host->st_size);
tgt->st_atimeX = htog(host->st_atime);
tgt->st_mtimeX = htog(host->st_mtime);
tgt->st_ctimeX = htog(host->st_ctime);
tgt->st_blksize = htog(host->st_blksize);
tgt->st_blocks = htog(host->st_blocks);
tgt.copyOut(mem);
}
@ -275,19 +275,19 @@ class Linux {
{
TypedBufferArg<Linux::tgt_stat> tgt(addr);
tgt->st_dev = host->st_dev;
tgt->st_ino = host->st_ino;
tgt->st_mode = host->st_mode;
tgt->st_nlink = host->st_nlink;
tgt->st_uid = host->st_uid;
tgt->st_gid = host->st_gid;
tgt->st_rdev = host->st_rdev;
tgt->st_size = host->st_size;
tgt->st_atimeX = host->st_atime;
tgt->st_mtimeX = host->st_mtime;
tgt->st_ctimeX = host->st_ctime;
tgt->st_blksize = host->st_blksize;
tgt->st_blocks = host->st_blocks;
tgt->st_dev = htog(host->st_dev);
tgt->st_ino = htog(host->st_ino);
tgt->st_mode = htog(host->st_mode);
tgt->st_nlink = htog(host->st_nlink);
tgt->st_uid = htog(host->st_uid);
tgt->st_gid = htog(host->st_gid);
tgt->st_rdev = htog(host->st_rdev);
tgt->st_size = htog(host->st_size);
tgt->st_atimeX = htog(host->st_atime);
tgt->st_mtimeX = htog(host->st_mtime);
tgt->st_ctimeX = htog(host->st_ctime);
tgt->st_blksize = htog(host->st_blksize);
tgt->st_blocks = htog(host->st_blocks);
tgt.copyOut(mem);
}
@ -301,25 +301,25 @@ class Linux {
TypedBufferArg<Linux::tgt_stat64> tgt(addr);
// XXX byteswaps
tgt->st_dev = host->st_dev;
tgt->st_dev = htog(host->st_dev);
// XXX What about STAT64_HAS_BROKEN_ST_INO ???
tgt->st_ino = host->st_ino;
tgt->st_rdev = host->st_rdev;
tgt->st_size = host->st_size;
tgt->st_blocks = host->st_blocks;
tgt->st_ino = htog(host->st_ino);
tgt->st_rdev = htog(host->st_rdev);
tgt->st_size = htog(host->st_size);
tgt->st_blocks = htog(host->st_blocks);
tgt->st_mode = host->st_mode;
tgt->st_uid = host->st_uid;
tgt->st_gid = host->st_gid;
tgt->st_blksize = host->st_blksize;
tgt->st_nlink = host->st_nlink;
tgt->tgt_st_atime = host->st_atime;
tgt->tgt_st_mtime = host->st_mtime;
tgt->tgt_st_ctime = host->st_ctime;
#ifdef STAT_HAVE_NSEC
tgt->st_atime_nsec = host->st_atime_nsec;
tgt->st_mtime_nsec = host->st_mtime_nsec;
tgt->st_ctime_nsec = host->st_ctime_nsec;
tgt->st_mode = htog(host->st_mode);
tgt->st_uid = htog(host->st_uid);
tgt->st_gid = htog(host->st_gid);
tgt->st_blksize = htog(host->st_blksize);
tgt->st_nlink = htog(host->st_nlink);
tgt->tgt_st_atime = htog(host->st_atime);
tgt->tgt_st_mtime = htog(host->st_mtime);
tgt->tgt_st_ctime = htog(host->st_ctime);
#ifdef STAT_HAVE_NSEC || BSD_HOST == 1
tgt->st_atime_nsec = htog(host->st_atime_nsec);
tgt->st_mtime_nsec = htog(host->st_mtime_nsec);
tgt->st_ctime_nsec = htog(host->st_ctime_nsec);
#else
tgt->st_atime_nsec = 0;
tgt->st_mtime_nsec = 0;
@ -392,7 +392,7 @@ class Linux {
// I don't think this exactly matches the HW FPCR
fpcr.copyIn(xc->mem);
DPRINTFR(SyscallVerbose, "osf_setsysinfo(SSI_IEEE_FP_CONTROL): "
" setting FPCR to 0x%x\n", *(uint64_t*)fpcr);
" setting FPCR to 0x%x\n", gtoh(*(uint64_t*)fpcr));
return 0;
}

View file

@ -75,15 +75,16 @@ swap_byte16(uint16_t x)
//This lets the compiler figure out how to call the swap_byte functions above
//for different data types.
static inline uint64_t swap_byte(uint64_t x) {return swap_byte64(x);} \
static inline int64_t swap_byte(int64_t x) {return swap_byte64((uint64_t)x);} \
static inline uint32_t swap_byte(uint32_t x) {return swap_byte32(x);} \
static inline int32_t swap_byte(int32_t x) {return swap_byte32((uint32_t)x);} \
static inline uint16_t swap_byte(uint16_t x) {return swap_byte32(x);} \
static inline int16_t swap_byte(int16_t x) {return swap_byte16((uint16_t)x);} \
static inline uint8_t swap_byte(uint8_t x) {return x;} \
static inline int8_t swap_byte(int8_t x) {return x;} \
static inline double swap_byte(double x) {return swap_byte64((uint64_t)x);} \
static inline uint64_t swap_byte(uint64_t x) {return swap_byte64(x);}
static inline int64_t swap_byte(int64_t x) {return swap_byte64((uint64_t)x);}
static inline uint32_t swap_byte(uint32_t x) {return swap_byte32(x);}
static inline int32_t swap_byte(int32_t x) {return swap_byte32((uint32_t)x);}
static inline int32_t swap_byte(long x) {return swap_byte32((long)x);}
static inline uint16_t swap_byte(uint16_t x) {return swap_byte32(x);}
static inline int16_t swap_byte(int16_t x) {return swap_byte16((uint16_t)x);}
static inline uint8_t swap_byte(uint8_t x) {return x;}
static inline int8_t swap_byte(int8_t x) {return x;}
static inline double swap_byte(double x) {return swap_byte64((uint64_t)x);}
static inline float swap_byte(float x) {return swap_byte32((uint32_t)x);}
//The conversion functions with fixed endianness on both ends don't need to