arguments.hh (11800:54436a1784dc) arguments.hh (14018:9d2153431f44)
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;

--- 20 unchanged lines hidden (view full) ---

29 */
30
31#ifndef __SIM_ARGUMENTS_HH__
32#define __SIM_ARGUMENTS_HH__
33
34#include <cassert>
35#include <memory>
36
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;

--- 20 unchanged lines hidden (view full) ---

29 */
30
31#ifndef __SIM_ARGUMENTS_HH__
32#define __SIM_ARGUMENTS_HH__
33
34#include <cassert>
35#include <memory>
36
37#include "cpu/thread_context.hh"
37#include "mem/fs_translating_port_proxy.hh"
38
38#include "mem/fs_translating_port_proxy.hh"
39
39class ThreadContext;
40
41class Arguments
42{
43 protected:
44 ThreadContext *tc;
45 int number;
46 uint64_t getArg(uint16_t size = (uint16_t)(-1), bool fp = false);
47
48 protected:

--- 83 unchanged lines hidden (view full) ---

132 assert(sizeof(T) <= sizeof(uint64_t));
133 T d = static_cast<T>(getArg(sizeof(T)));
134 return d;
135 }
136
137 template <class T>
138 operator T *() {
139 T *buf = (T *)data->alloc(sizeof(T));
40class Arguments
41{
42 protected:
43 ThreadContext *tc;
44 int number;
45 uint64_t getArg(uint16_t size = (uint16_t)(-1), bool fp = false);
46
47 protected:

--- 83 unchanged lines hidden (view full) ---

131 assert(sizeof(T) <= sizeof(uint64_t));
132 T d = static_cast<T>(getArg(sizeof(T)));
133 return d;
134 }
135
136 template <class T>
137 operator T *() {
138 T *buf = (T *)data->alloc(sizeof(T));
140 CopyOut(tc, buf, getArg(sizeof(T)), sizeof(T));
139 tc->getVirtProxy().readBlob(getArg(sizeof(T)), buf, sizeof(T));
141 return buf;
142 }
143
144 operator char *() {
145 char *buf = data->alloc(2048);
140 return buf;
141 }
142
143 operator char *() {
144 char *buf = data->alloc(2048);
146 CopyStringOut(tc, buf, getArg(), 2048);
145 tc->getVirtProxy().readString(buf, getArg(), 2048);
147 return buf;
148 }
149};
150
151#endif // __SIM_ARGUMENTS_HH__
146 return buf;
147 }
148};
149
150#endif // __SIM_ARGUMENTS_HH__