From: Gabe Black Date: Sat, 16 Oct 2010 06:57:06 +0000 (-0700) Subject: GetArgument: Rework getArgument so that X86_FS compiles again. X-Git-Tag: stable_2012_02_02~788 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ab9f062166085c9750eeee2318c25efeb2ec5948;p=gem5.git GetArgument: Rework getArgument so that X86_FS compiles again. When no size is specified for an argument, push the decision about what size to use into the ISA by passing a size of -1. --- diff --git a/src/arch/alpha/utility.cc b/src/arch/alpha/utility.cc index 80ec360b7..11560259f 100644 --- a/src/arch/alpha/utility.cc +++ b/src/arch/alpha/utility.cc @@ -40,7 +40,7 @@ namespace AlphaISA { uint64_t -getArgument(ThreadContext *tc, int &number, uint8_t size, bool fp) +getArgument(ThreadContext *tc, int &number, uint16_t size, bool fp) { #if FULL_SYSTEM const int NumArgumentRegs = 6; diff --git a/src/arch/alpha/utility.hh b/src/arch/alpha/utility.hh index 360e155f8..6d5b8baf6 100644 --- a/src/arch/alpha/utility.hh +++ b/src/arch/alpha/utility.hh @@ -41,7 +41,7 @@ namespace AlphaISA { -uint64_t getArgument(ThreadContext *tc, int &number, uint8_t size, bool fp); +uint64_t getArgument(ThreadContext *tc, int &number, uint16_t size, bool fp); inline bool inUserMode(ThreadContext *tc) diff --git a/src/arch/arm/utility.cc b/src/arch/arm/utility.cc index 9672c5136..7609b3991 100644 --- a/src/arch/arm/utility.cc +++ b/src/arch/arm/utility.cc @@ -39,6 +39,7 @@ #include "arch/arm/faults.hh" +#include "arch/arm/isa_traits.hh" #include "arch/arm/utility.hh" #include "cpu/thread_context.hh" @@ -61,8 +62,12 @@ initCPU(ThreadContext *tc, int cpuId) reset->invoke(tc); } -uint64_t getArgument(ThreadContext *tc, int &number, uint8_t size, bool fp) { +uint64_t +getArgument(ThreadContext *tc, int &number, uint16_t size, bool fp) +{ #if FULL_SYSTEM + if (size == (uint16_t)(-1)) + size = ArmISA::MachineBytes; if (fp) panic("getArgument(): Floating point arguments not implemented\n"); diff --git a/src/arch/arm/utility.hh b/src/arch/arm/utility.hh index 21c0a9c04..571a74ef8 100644 --- a/src/arch/arm/utility.hh +++ b/src/arch/arm/utility.hh @@ -156,7 +156,7 @@ namespace ArmISA { return !cpacr.asedis && vfpEnabled(cpacr, cpsr, fpexc); } -uint64_t getArgument(ThreadContext *tc, int &number, uint8_t size, bool fp); +uint64_t getArgument(ThreadContext *tc, int &number, uint16_t size, bool fp); Fault setCp15Register(uint32_t &Rd, int CRn, int opc1, int CRm, int opc2); Fault readCp15Register(uint32_t &Rd, int CRn, int opc1, int CRm, int opc2); diff --git a/src/arch/mips/utility.cc b/src/arch/mips/utility.cc index 7dd74551e..faae1e937 100644 --- a/src/arch/mips/utility.cc +++ b/src/arch/mips/utility.cc @@ -52,7 +52,7 @@ using namespace std; namespace MipsISA { uint64_t -getArgument(ThreadContext *tc, int &number, uint8_t size, bool fp) +getArgument(ThreadContext *tc, int &number, uint16_t size, bool fp) { #if FULL_SYSTEM if (number < 4) { diff --git a/src/arch/mips/utility.hh b/src/arch/mips/utility.hh index d073f3116..bc50027c0 100644 --- a/src/arch/mips/utility.hh +++ b/src/arch/mips/utility.hh @@ -45,7 +45,7 @@ class ThreadContext; namespace MipsISA { -uint64_t getArgument(ThreadContext *tc, int &number, uint8_t size, bool fp); +uint64_t getArgument(ThreadContext *tc, int &number, uint16_t size, bool fp); //////////////////////////////////////////////////////////////////////// // diff --git a/src/arch/sparc/utility.cc b/src/arch/sparc/utility.cc index e14be48e2..be4dfac84 100644 --- a/src/arch/sparc/utility.cc +++ b/src/arch/sparc/utility.cc @@ -45,7 +45,9 @@ namespace SparcISA { //the sixth are passed on the stack past the 16 word window save area, //space for the struct/union return pointer, and space reserved for the //first 6 arguments which the caller may use but doesn't have to. -uint64_t getArgument(ThreadContext *tc, int &number, uint8_t size, bool fp) { +uint64_t +getArgument(ThreadContext *tc, int &number, uint16_t size, bool fp) +{ #if FULL_SYSTEM const int NumArgumentRegs = 6; if (number < NumArgumentRegs) { diff --git a/src/arch/sparc/utility.hh b/src/arch/sparc/utility.hh index 39e23aa26..f6a585e23 100644 --- a/src/arch/sparc/utility.hh +++ b/src/arch/sparc/utility.hh @@ -41,7 +41,8 @@ namespace SparcISA { - uint64_t getArgument(ThreadContext *tc, int &number, uint8_t size, bool fp); + uint64_t + getArgument(ThreadContext *tc, int &number, uint16_t size, bool fp); static inline bool inUserMode(ThreadContext *tc) diff --git a/src/arch/x86/utility.cc b/src/arch/x86/utility.cc index d74bb74b6..624e8132f 100644 --- a/src/arch/x86/utility.cc +++ b/src/arch/x86/utility.cc @@ -52,7 +52,9 @@ namespace X86ISA { -uint64_t getArgument(ThreadContext *tc, int &number, uint8_t size, bool fp) { +uint64_t +getArgument(ThreadContext *tc, int &number, uint16_t size, bool fp) +{ #if FULL_SYSTEM panic("getArgument() not implemented for x86!\n"); #else diff --git a/src/arch/x86/utility.hh b/src/arch/x86/utility.hh index fd9ac59fd..05ce53347 100644 --- a/src/arch/x86/utility.hh +++ b/src/arch/x86/utility.hh @@ -52,7 +52,8 @@ class ThreadContext; namespace X86ISA { - uint64_t getArgument(ThreadContext *tc, int &number, uint8_t size, bool fp); + uint64_t + getArgument(ThreadContext *tc, int &number, uint16_t size, bool fp); static inline bool inUserMode(ThreadContext *tc) diff --git a/src/sim/arguments.cc b/src/sim/arguments.cc index 511fc630d..6d45e3b3d 100644 --- a/src/sim/arguments.cc +++ b/src/sim/arguments.cc @@ -50,7 +50,7 @@ Arguments::Data::alloc(size_t size) } uint64_t -Arguments::getArg(uint8_t size, bool fp) +Arguments::getArg(uint16_t size, bool fp) { return TheISA::getArgument(tc, number, size, fp); } diff --git a/src/sim/arguments.hh b/src/sim/arguments.hh index 97b848e03..ef94cbb25 100644 --- a/src/sim/arguments.hh +++ b/src/sim/arguments.hh @@ -45,7 +45,7 @@ class Arguments protected: ThreadContext *tc; int number; - uint64_t getArg(uint8_t size, bool fp = false); + uint64_t getArg(uint16_t size = (uint16_t)(-1), bool fp = false); protected: class Data : public RefCounted @@ -82,7 +82,7 @@ class Arguments // for checking if an argument is NULL bool operator!() { - return getArg(TheISA::MachineBytes) == 0; + return getArg() == 0; } Arguments &operator++() { @@ -143,7 +143,7 @@ class Arguments operator char *() { char *buf = data->alloc(2048); - CopyStringOut(tc, buf, getArg(TheISA::MachineBytes), 2048); + CopyStringOut(tc, buf, getArg(), 2048); return buf; } };