diff options
-rw-r--r-- | arch/alpha/tru64/process.cc | 16 | ||||
-rw-r--r-- | arch/mips/isa/decoder.isa | 12 | ||||
-rw-r--r-- | arch/mips/isa/formats/util.isa | 4 | ||||
-rw-r--r-- | arch/mips/isa_traits.hh | 54 | ||||
-rw-r--r-- | kern/linux/linux.hh | 45 | ||||
-rw-r--r-- | kern/tru64/tru64.hh | 66 | ||||
-rw-r--r-- | sim/syscall_emul.hh | 20 |
7 files changed, 74 insertions, 143 deletions
diff --git a/arch/alpha/tru64/process.cc b/arch/alpha/tru64/process.cc index 355d7f3e6..f795cc8fe 100644 --- a/arch/alpha/tru64/process.cc +++ b/arch/alpha/tru64/process.cc @@ -63,28 +63,28 @@ getsysinfoFunc(SyscallDesc *desc, int callnum, Process *process, switch (op) { - case Tru64::GSI_MAX_CPU: { + case Tru64::OSFlags::GSI_MAX_CPU: { TypedBufferArg<uint32_t> max_cpu(xc->getSyscallArg(1)); *max_cpu = htog((uint32_t)process->numCpus()); max_cpu.copyOut(xc->getMemPort()); return 1; } - case Tru64::GSI_CPUS_IN_BOX: { + case Tru64::OSFlags::GSI_CPUS_IN_BOX: { TypedBufferArg<uint32_t> cpus_in_box(xc->getSyscallArg(1)); *cpus_in_box = htog((uint32_t)process->numCpus()); cpus_in_box.copyOut(xc->getMemPort()); return 1; } - case Tru64::GSI_PHYSMEM: { + case Tru64::OSFlags::GSI_PHYSMEM: { TypedBufferArg<uint64_t> physmem(xc->getSyscallArg(1)); *physmem = htog((uint64_t)1024 * 1024); // physical memory in KB physmem.copyOut(xc->getMemPort()); return 1; } - case Tru64::GSI_CPU_INFO: { + case Tru64::OSFlags::GSI_CPU_INFO: { TypedBufferArg<Tru64::cpu_info> infop(xc->getSyscallArg(1)); infop->current_cpu = htog(0); @@ -101,14 +101,14 @@ getsysinfoFunc(SyscallDesc *desc, int callnum, Process *process, return 1; } - case Tru64::GSI_PROC_TYPE: { + case Tru64::OSFlags::GSI_PROC_TYPE: { TypedBufferArg<uint64_t> proc_type(xc->getSyscallArg(1)); *proc_type = htog((uint64_t)11); proc_type.copyOut(xc->getMemPort()); return 1; } - case Tru64::GSI_PLATFORM_NAME: { + case Tru64::OSFlags::GSI_PLATFORM_NAME: { BufferArg bufArg(xc->getSyscallArg(1), nbytes); strncpy((char *)bufArg.bufferPtr(), "COMPAQ Professional Workstation XP1000", @@ -117,7 +117,7 @@ getsysinfoFunc(SyscallDesc *desc, int callnum, Process *process, return 1; } - case Tru64::GSI_CLK_TCK: { + case Tru64::OSFlags::GSI_CLK_TCK: { TypedBufferArg<uint64_t> clk_hz(xc->getSyscallArg(1)); *clk_hz = htog((uint64_t)1024); clk_hz.copyOut(xc->getMemPort()); @@ -140,7 +140,7 @@ setsysinfoFunc(SyscallDesc *desc, int callnum, Process *process, unsigned op = xc->getSyscallArg(0); switch (op) { - case Tru64::SSI_IEEE_FP_CONTROL: + case Tru64::OSFlags::SSI_IEEE_FP_CONTROL: warn("setsysinfo: ignoring ieee_set_fp_control() arg 0x%x\n", xc->getSyscallArg(1)); break; diff --git a/arch/mips/isa/decoder.isa b/arch/mips/isa/decoder.isa index 35e5fa75b..ffedfbca8 100644 --- a/arch/mips/isa/decoder.isa +++ b/arch/mips/isa/decoder.isa @@ -143,9 +143,11 @@ decode OPCODE_HI default Unknown::unknown() { }}); 0x1: multu({{ - int64_t temp1 = Rs.uw * Rt.uw; - xc->setMiscReg(Hi,temp1<63:32>); - xc->setMiscReg(Lo,temp1<31:0>); + uint64_t temp1 = Rs.uw * Rt.uw; + uint32_t hi_val = temp1<63:32>; + uint32_t lo_val = temp1<31:0>; + xc->setMiscReg(Hi,hi_val); + xc->setMiscReg(Lo,lo_val); }}); 0x2: div({{ @@ -154,8 +156,8 @@ decode OPCODE_HI default Unknown::unknown() { }}); 0x3: divu({{ - xc->setMiscReg(Hi,Rs.uw % Rt.uw); - xc->setMiscReg(Lo,Rs.uw / Rt.uw); + xc->setMiscReg(Hi,Rs.uw % Rt.uw); + xc->setMiscReg(Lo,Rs.uw / Rt.uw); }}); } } diff --git a/arch/mips/isa/formats/util.isa b/arch/mips/isa/formats/util.isa index db4bf204a..dcdf46757 100644 --- a/arch/mips/isa/formats/util.isa +++ b/arch/mips/isa/formats/util.isa @@ -93,7 +93,9 @@ def LoadStoreBase(name, Name, ea_code, memacc_code, mem_flags, inst_flags, output exec {{ -using namespace MipsISA; + using namespace MipsISA; + + /// CLEAR ALL CPU INST/EXE HAZARDS diff --git a/arch/mips/isa_traits.hh b/arch/mips/isa_traits.hh index 22ae76a44..62ed7acf0 100644 --- a/arch/mips/isa_traits.hh +++ b/arch/mips/isa_traits.hh @@ -163,8 +163,46 @@ namespace MipsISA MiscReg_DepTag = 67 }; - typedef uint64_t IntReg; + struct OSFlags + { + //@{ + /// open(2) flag values. + static const int TGT_O_RDONLY = 00000000; //!< O_RDONLY + static const int TGT_O_WRONLY = 00000001; //!< O_WRONLY + static const int TGT_O_RDWR = 00000002; //!< O_RDWR + static const int TGT_O_NONBLOCK = 00000004; //!< O_NONBLOCK + static const int TGT_O_APPEND = 00000010; //!< O_APPEND + static const int TGT_O_CREAT = 00001000; //!< O_CREAT + static const int TGT_O_TRUNC = 00002000; //!< O_TRUNC + static const int TGT_O_EXCL = 00004000; //!< O_EXCL + static const int TGT_O_NOCTTY = 00010000; //!< O_NOCTTY + static const int TGT_O_SYNC = 00040000; //!< O_SYNC + static const int TGT_O_DRD = 00100000; //!< O_DRD + static const int TGT_O_DIRECTIO = 00200000; //!< O_DIRECTIO + static const int TGT_O_CACHE = 00400000; //!< O_CACHE + static const int TGT_O_DSYNC = 02000000; //!< O_DSYNC + static const int TGT_O_RSYNC = 04000000; //!< O_RSYNC + //@} + + /// For mmap(). + static const unsigned TGT_MAP_ANONYMOUS = 0x800; + + //@{ + /// ioctl() command codes. + static const unsigned TIOCGETP = 0x40067408; + static const unsigned TIOCSETP = 0x80067409; + static const unsigned TIOCSETN = 0x8006740a; + static const unsigned TIOCSETC = 0x80067411; + static const unsigned TIOCGETC = 0x40067412; + static const unsigned FIONREAD = 0x4004667f; + static const unsigned TIOCISATTY = 0x2000745e; + static const unsigned TIOCGETS = 0x402c7413; + static const unsigned TIOCGETA = 0x40127417; + //@} + }; + + typedef uint64_t IntReg; class IntRegFile { protected: @@ -188,21 +226,9 @@ namespace MipsISA }; -/* floating point register file entry type - typedef union { - uint64_t q; - double d; - } FloatReg;*/ - typedef double FloatReg; typedef uint64_t FloatRegBits; - -/*typedef union { - uint64_t q[NumFloatRegs]; // integer qword view - double d[NumFloatRegs]; // double-precision floating point view - } FloatRegFile;*/ - - class FloatRegFile + class FloatRegFile { protected: diff --git a/kern/linux/linux.hh b/kern/linux/linux.hh index 9237084fc..93d92a85b 100644 --- a/kern/linux/linux.hh +++ b/kern/linux/linux.hh @@ -45,6 +45,7 @@ class Linux {}; #include <unistd.h> #include "sim/syscall_emul.hh" +#include "arch/isa_traits.hh" class TranslatingPort; @@ -66,6 +67,8 @@ class Linux { typedef uint32_t gid_t; //@} + typedef TheISA::OSFlags OSFlags; + #if BSD_HOST typedef struct stat hst_stat; typedef struct stat hst_stat64; @@ -75,25 +78,6 @@ class Linux { #endif - //@{ - /// open(2) flag values. - static const int TGT_O_RDONLY = 00000000; //!< O_RDONLY - static const int TGT_O_WRONLY = 00000001; //!< O_WRONLY - static const int TGT_O_RDWR = 00000002; //!< O_RDWR - static const int TGT_O_NONBLOCK = 00000004; //!< O_NONBLOCK - static const int TGT_O_APPEND = 00000010; //!< O_APPEND - static const int TGT_O_CREAT = 00001000; //!< O_CREAT - static const int TGT_O_TRUNC = 00002000; //!< O_TRUNC - static const int TGT_O_EXCL = 00004000; //!< O_EXCL - static const int TGT_O_NOCTTY = 00010000; //!< O_NOCTTY - static const int TGT_O_SYNC = 00040000; //!< O_SYNC - static const int TGT_O_DRD = 00100000; //!< O_DRD - static const int TGT_O_DIRECTIO = 00200000; //!< O_DIRECTIO - static const int TGT_O_CACHE = 00400000; //!< O_CACHE - static const int TGT_O_DSYNC = 02000000; //!< O_DSYNC - static const int TGT_O_RSYNC = 04000000; //!< O_RSYNC - //@} - /// This table maps the target open() flags to the corresponding /// host open() flags. static OpenFlagTransTable openFlagTable[]; @@ -159,19 +143,6 @@ class Linux { }; - //@{ - /// ioctl() command codes. - static const unsigned TIOCGETP = 0x40067408; - static const unsigned TIOCSETP = 0x80067409; - static const unsigned TIOCSETN = 0x8006740a; - static const unsigned TIOCSETC = 0x80067411; - static const unsigned TIOCGETC = 0x40067412; - static const unsigned FIONREAD = 0x4004667f; - static const unsigned TIOCISATTY = 0x2000745e; - static const unsigned TIOCGETS = 0x402c7413; - static const unsigned TIOCGETA = 0x40127417; - //@} - /// Resource enumeration for getrlimit(). enum rlimit_resources { TGT_RLIMIT_CPU = 0, @@ -194,10 +165,6 @@ class Linux { uint64_t rlim_max; //!< hard limit }; - - /// For mmap(). - static const unsigned TGT_MAP_ANONYMOUS = 0x10; - /// For gettimeofday(). struct timeval { int64_t tv_sec; //!< seconds @@ -210,12 +177,6 @@ class Linux { uint64_t iov_len; }; - //@{ - /// For getrusage(). - static const int TGT_RUSAGE_SELF = 0; - static const int TGT_RUSAGE_CHILDREN = -1; - static const int TGT_RUSAGE_BOTH = -2; - //@} /// For getrusage(). struct rusage { diff --git a/kern/tru64/tru64.hh b/kern/tru64/tru64.hh index b4f45e650..ce9a67199 100644 --- a/kern/tru64/tru64.hh +++ b/kern/tru64/tru64.hh @@ -70,6 +70,8 @@ class Tru64 { public: + typedef TheISA::OSFlags OSFlags; + //@{ /// Basic Tru64 types. typedef uint64_t size_t; @@ -85,25 +87,6 @@ class Tru64 { typedef quad fsid_t; //@} - //@{ - /// open(2) flag values. - static const int TGT_O_RDONLY = 00000000; - static const int TGT_O_WRONLY = 00000001; - static const int TGT_O_RDWR = 00000002; - static const int TGT_O_NONBLOCK = 00000004; - static const int TGT_O_APPEND = 00000010; - static const int TGT_O_CREAT = 00001000; - static const int TGT_O_TRUNC = 00002000; - static const int TGT_O_EXCL = 00004000; - static const int TGT_O_NOCTTY = 00010000; - static const int TGT_O_SYNC = 00040000; - static const int TGT_O_DRD = 00100000; - static const int TGT_O_DIRECTIO = 00200000; - static const int TGT_O_CACHE = 00400000; - static const int TGT_O_DSYNC = 02000000; - static const int TGT_O_RSYNC = 04000000; - //@} - /// This table maps the target open() flags to the corresponding /// host open() flags. static OpenFlagTransTable openFlagTable[]; @@ -246,20 +229,6 @@ class Tru64 { char machine[_SYS_NMLN]; //!< Machine type. }; - //@{ - /// ioctl() command codes. - static const unsigned TIOCGETP = 0x40067408; - static const unsigned TIOCSETP = 0x80067409; - static const unsigned TIOCSETN = 0x8006740a; - static const unsigned TIOCSETC = 0x80067411; - static const unsigned TIOCGETC = 0x40067412; - static const unsigned FIONREAD = 0x4004667f; - static const unsigned TIOCISATTY = 0x2000745e; - // TIOCGETS not defined in tru64, so I made up a number - static const unsigned TIOCGETS = 0x40000000; - static const unsigned TIOCGETA = 0x402c7413; - //@} - /// Resource enumeration for getrlimit(). enum rlimit_resources { TGT_RLIMIT_CPU = 0, @@ -280,21 +249,6 @@ class Tru64 { }; - /// For mmap(). - static const unsigned TGT_MAP_ANONYMOUS = 0x10; - - - //@{ - /// For getsysinfo(). - static const unsigned GSI_PLATFORM_NAME = 103; //!< platform name as string - static const unsigned GSI_CPU_INFO = 59; //!< CPU information - static const unsigned GSI_PROC_TYPE = 60; //!< get proc_type - static const unsigned GSI_MAX_CPU = 30; //!< max # cpu's on this machine - static const unsigned GSI_CPUS_IN_BOX = 55; //!< number of CPUs in system - static const unsigned GSI_PHYSMEM = 19; //!< Physical memory in KB - static const unsigned GSI_CLK_TCK = 42; //!< clock freq in Hz - //@} - /// For getsysinfo() GSI_CPU_INFO option. struct cpu_info { uint32_t current_cpu; //!< current_cpu @@ -309,24 +263,12 @@ class Tru64 { uint32_t unused[3]; //!< future expansion }; - //@{ - /// For setsysinfo(). - static const unsigned SSI_IEEE_FP_CONTROL = 14; //!< ieee_set_fp_control() - //@} - /// For gettimeofday. struct timeval { uint32_t tv_sec; //!< seconds uint32_t tv_usec; //!< microseconds }; - //@{ - /// For getrusage(). - static const int TGT_RUSAGE_THREAD = 1; - static const int TGT_RUSAGE_SELF = 0; - static const int TGT_RUSAGE_CHILDREN = -1; - //@} - /// For getrusage(). struct rusage { struct timeval ru_utime; //!< user time used @@ -372,8 +314,6 @@ class Tru64 { }; - /// For table(). - static const int TBL_SYSINFO = 12; /// For table(). struct tbl_sysinfo { @@ -759,7 +699,7 @@ class Tru64 { int lel = xc->getSyscallArg(4); // expected element size switch (id) { - case Tru64::TBL_SYSINFO: { + case Tru64::OSFlags::TBL_SYSINFO: { if (index != 0 || nel != 1 || lel != sizeof(Tru64::tbl_sysinfo)) return -EINVAL; TypedBufferArg<Tru64::tbl_sysinfo> elp(xc->getSyscallArg(2)); diff --git a/sim/syscall_emul.hh b/sim/syscall_emul.hh index 58db2469e..bab29ca6a 100644 --- a/sim/syscall_emul.hh +++ b/sim/syscall_emul.hh @@ -348,14 +348,14 @@ ioctlFunc(SyscallDesc *desc, int callnum, Process *process, } switch (req) { - case OS::TIOCISATTY: - case OS::TIOCGETP: - case OS::TIOCSETP: - case OS::TIOCSETN: - case OS::TIOCSETC: - case OS::TIOCGETC: - case OS::TIOCGETS: - case OS::TIOCGETA: + case OS::OSFlags::TIOCISATTY: + case OS::OSFlags::TIOCGETP: + case OS::OSFlags::TIOCSETP: + case OS::OSFlags::TIOCSETN: + case OS::OSFlags::TIOCSETC: + case OS::OSFlags::TIOCGETC: + case OS::OSFlags::TIOCGETS: + case OS::OSFlags::TIOCGETA: return -ENOTTY; default: @@ -719,7 +719,7 @@ mmapFunc(SyscallDesc *desc, int num, Process *p, ExecContext *xc) p->pTable->allocate(start, length); p->mmap_end += length; - if (!(flags & OS::TGT_MAP_ANONYMOUS)) { + if (!(flags & OS::OSFlags::TGT_MAP_ANONYMOUS)) { warn("allowing mmap of file @ fd %d. " "This will break if not /dev/zero.", xc->getSyscallArg(4)); } @@ -810,7 +810,7 @@ getrusageFunc(SyscallDesc *desc, int callnum, Process *process, int who = xc->getSyscallArg(0); // THREAD, SELF, or CHILDREN TypedBufferArg<typename OS::rusage> rup(xc->getSyscallArg(1)); - if (who != OS::TGT_RUSAGE_SELF) { + if (who != OS::OSFlags::TGT_RUSAGE_SELF) { // don't really handle THREAD or CHILDREN, but just warn and // plow ahead warn("getrusage() only supports RUSAGE_SELF. Parameter %d ignored.", |