From 607df7e656304f0a2a4ca811acd758ee21b9642e Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Tue, 29 Oct 2019 15:31:04 -0700 Subject: arch: Make endianness a property of the OS class syscalls can consume. That way the syscall implementations won't have to find the right endianness to use on their own, typically by referring to TheISA. Change-Id: I186b2f419d5dbee72cc9b5abce7356f3143f0c83 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/22363 Reviewed-by: Brandon Potter Maintainer: Gabe Black Tested-by: kokoro --- src/arch/alpha/linux/linux.hh | 2 ++ src/arch/arm/freebsd/freebsd.hh | 9 +++++++-- src/arch/arm/linux/linux.hh | 2 ++ src/arch/mips/linux/linux.hh | 2 ++ src/arch/power/linux/linux.hh | 2 ++ src/arch/riscv/linux/linux.hh | 10 ++++++++-- src/arch/sparc/linux/linux.hh | 2 ++ src/arch/sparc/solaris/solaris.hh | 2 ++ src/arch/x86/linux/linux.hh | 2 ++ 9 files changed, 29 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/arch/alpha/linux/linux.hh b/src/arch/alpha/linux/linux.hh index 3fd65679d..01d3e282f 100644 --- a/src/arch/alpha/linux/linux.hh +++ b/src/arch/alpha/linux/linux.hh @@ -42,6 +42,8 @@ class AlphaLinux : public Linux { public: + static const ByteOrder byteOrder = LittleEndianByteOrder; + static const int TGT_SIGHUP = 0x000001; static const int TGT_SIGINT = 0x000002; static const int TGT_SIGQUIT = 0x000003; diff --git a/src/arch/arm/freebsd/freebsd.hh b/src/arch/arm/freebsd/freebsd.hh index e2c5e493c..b1360473e 100644 --- a/src/arch/arm/freebsd/freebsd.hh +++ b/src/arch/arm/freebsd/freebsd.hh @@ -35,10 +35,15 @@ #include "kern/freebsd/freebsd.hh" -class ArmFreebsd32 : public FreeBSD +class ArmFreebsd : public FreeBSD { public: + static const ByteOrder byteOrder = LittleEndianByteOrder; +}; +class ArmFreebsd32 : public ArmFreebsd +{ + public: /// This table maps the target open() flags to the corresponding /// host open() flags. static SyscallFlagTransTable openFlagTable[]; @@ -192,7 +197,7 @@ class ArmFreebsd32 : public FreeBSD }; }; -class ArmFreebsd64 : public FreeBSD +class ArmFreebsd64 : public ArmFreebsd { public: diff --git a/src/arch/arm/linux/linux.hh b/src/arch/arm/linux/linux.hh index cff1e47fd..1ae88df4a 100644 --- a/src/arch/arm/linux/linux.hh +++ b/src/arch/arm/linux/linux.hh @@ -51,6 +51,8 @@ class ArmLinux : public Linux { public: + static const ByteOrder byteOrder = LittleEndianByteOrder; + static void archClone(uint64_t flags, Process *pp, Process *cp, diff --git a/src/arch/mips/linux/linux.hh b/src/arch/mips/linux/linux.hh index 38e6abcd1..84ab55363 100644 --- a/src/arch/mips/linux/linux.hh +++ b/src/arch/mips/linux/linux.hh @@ -37,6 +37,8 @@ class MipsLinux : public Linux { public: + static const ByteOrder byteOrder = LittleEndianByteOrder; + static const int TGT_SIGHUP = 0x000001; static const int TGT_SIGINT = 0x000002; static const int TGT_SIGQUIT = 0x000003; diff --git a/src/arch/power/linux/linux.hh b/src/arch/power/linux/linux.hh index de149a1a6..a57c2ab97 100644 --- a/src/arch/power/linux/linux.hh +++ b/src/arch/power/linux/linux.hh @@ -42,6 +42,8 @@ class PowerLinux : public Linux { public: + static const ByteOrder byteOrder = BigEndianByteOrder; + typedef int32_t time_t; typedef struct { diff --git a/src/arch/riscv/linux/linux.hh b/src/arch/riscv/linux/linux.hh index 441550a50..c3adaeeef 100644 --- a/src/arch/riscv/linux/linux.hh +++ b/src/arch/riscv/linux/linux.hh @@ -34,7 +34,13 @@ #include "arch/riscv/utility.hh" #include "kern/linux/linux.hh" -class RiscvLinux64 : public Linux +class RiscvLinux : public Linux +{ + public: + static const ByteOrder byteOrder = LittleEndianByteOrder; +}; + +class RiscvLinux64 : public RiscvLinux { public: static const int TGT_SIGHUP = 1; @@ -203,7 +209,7 @@ class RiscvLinux64 : public Linux } }; -class RiscvLinux32 : public Linux +class RiscvLinux32 : public RiscvLinux { public: static const int TGT_SIGHUP = 1; diff --git a/src/arch/sparc/linux/linux.hh b/src/arch/sparc/linux/linux.hh index 1de949d10..1dba4fa1f 100644 --- a/src/arch/sparc/linux/linux.hh +++ b/src/arch/sparc/linux/linux.hh @@ -38,6 +38,8 @@ class SparcLinux : public Linux { public: + static const ByteOrder byteOrder = BigEndianByteOrder; + typedef struct { uint32_t st_dev; char __pad1[4]; diff --git a/src/arch/sparc/solaris/solaris.hh b/src/arch/sparc/solaris/solaris.hh index 1e814bc53..459cedb8d 100644 --- a/src/arch/sparc/solaris/solaris.hh +++ b/src/arch/sparc/solaris/solaris.hh @@ -37,6 +37,8 @@ class SparcSolaris : public Solaris { public: + static const ByteOrder byteOrder = BigEndianByteOrder; + static SyscallFlagTransTable openFlagTable[]; static const int TGT_O_RDONLY = 0x00000000; //!< O_RDONLY diff --git a/src/arch/x86/linux/linux.hh b/src/arch/x86/linux/linux.hh index 91498043c..2192e5064 100644 --- a/src/arch/x86/linux/linux.hh +++ b/src/arch/x86/linux/linux.hh @@ -46,6 +46,8 @@ class X86Linux : public Linux { public: + static const ByteOrder byteOrder = LittleEndianByteOrder; + static void archClone(uint64_t flags, Process *pp, Process *cp, -- cgit v1.2.3