arguments.hh (6216:2f4020838149) | arguments.hh (7693:f1db1000d957) |
---|---|
1/* 2 * Copyright (c) 2003-2005 The Regents of The University of Michigan 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 31 unchanged lines hidden (view full) --- 40 41class ThreadContext; 42 43class Arguments 44{ 45 protected: 46 ThreadContext *tc; 47 int number; | 1/* 2 * Copyright (c) 2003-2005 The Regents of The University of Michigan 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 31 unchanged lines hidden (view full) --- 40 41class ThreadContext; 42 43class Arguments 44{ 45 protected: 46 ThreadContext *tc; 47 int number; |
48 uint64_t getArg(bool fp = false); | 48 uint64_t getArg(uint8_t size, bool fp = false); |
49 50 protected: 51 class Data : public RefCounted 52 { 53 public: 54 Data(){} 55 ~Data(); 56 --- 20 unchanged lines hidden (view full) --- 77 tc = args.tc; 78 number = args.number; 79 data = args.data; 80 return *this; 81 } 82 83 // for checking if an argument is NULL 84 bool operator!() { | 49 50 protected: 51 class Data : public RefCounted 52 { 53 public: 54 Data(){} 55 ~Data(); 56 --- 20 unchanged lines hidden (view full) --- 77 tc = args.tc; 78 number = args.number; 79 data = args.data; 80 return *this; 81 } 82 83 // for checking if an argument is NULL 84 bool operator!() { |
85 return getArg() == 0; | 85 return getArg(TheISA::MachineBytes) == 0; |
86 } 87 88 Arguments &operator++() { 89 ++number; 90 assert(number >= 0); 91 return *this; 92 } 93 --- 31 unchanged lines hidden (view full) --- 125 126 Arguments operator[](int index) { 127 return Arguments(tc, index); 128 } 129 130 template <class T> 131 operator T() { 132 assert(sizeof(T) <= sizeof(uint64_t)); | 86 } 87 88 Arguments &operator++() { 89 ++number; 90 assert(number >= 0); 91 return *this; 92 } 93 --- 31 unchanged lines hidden (view full) --- 125 126 Arguments operator[](int index) { 127 return Arguments(tc, index); 128 } 129 130 template <class T> 131 operator T() { 132 assert(sizeof(T) <= sizeof(uint64_t)); |
133 T data = static_cast | 133 T data = static_cast<T>(getArg(sizeof(T))); |
134 return data; 135 } 136 137 template <class T> 138 operator T *() { 139 T *buf = (T *)data->alloc(sizeof(T)); | 134 return data; 135 } 136 137 template <class T> 138 operator T *() { 139 T *buf = (T *)data->alloc(sizeof(T)); |
140 CopyData(tc, buf, getArg(), sizeof(T)); | 140 CopyData(tc, buf, getArg(sizeof(T)), sizeof(T)); |
141 return buf; 142 } 143 144 operator char *() { 145 char *buf = data->alloc(2048); | 141 return buf; 142 } 143 144 operator char *() { 145 char *buf = data->alloc(2048); |
146 CopyStringOut(tc, buf, getArg(), 2048); | 146 CopyStringOut(tc, buf, getArg(TheISA::MachineBytes), 2048); |
147 return buf; 148 } 149}; 150 151#endif // __SIM_ARGUMENTS_HH__ | 147 return buf; 148 } 149}; 150 151#endif // __SIM_ARGUMENTS_HH__ |