From ab9f062166085c9750eeee2318c25efeb2ec5948 Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Fri, 15 Oct 2010 23:57:06 -0700 Subject: [PATCH] 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. --- src/arch/alpha/utility.cc | 2 +- src/arch/alpha/utility.hh | 2 +- src/arch/arm/utility.cc | 7 ++++++- src/arch/arm/utility.hh | 2 +- src/arch/mips/utility.cc | 2 +- src/arch/mips/utility.hh | 2 +- src/arch/sparc/utility.cc | 4 +++- src/arch/sparc/utility.hh | 3 ++- src/arch/x86/utility.cc | 4 +++- src/arch/x86/utility.hh | 3 ++- src/sim/arguments.cc | 2 +- src/sim/arguments.hh | 6 +++--- 12 files changed, 25 insertions(+), 14 deletions(-) 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; } };