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.
This commit is contained in:
Gabe Black 2010-10-15 23:57:06 -07:00
parent b197a542b4
commit ab9f062166
12 changed files with 25 additions and 14 deletions

View file

@ -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;

View file

@ -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)

View file

@ -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");

View file

@ -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);

View file

@ -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) {

View file

@ -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);
////////////////////////////////////////////////////////////////////////
//

View file

@ -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) {

View file

@ -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)

View file

@ -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

View file

@ -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)

View file

@ -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);
}

View file

@ -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;
}
};