Linux Support: Finally update vptr for new memory system.
--HG-- extra : convert_revision : 8b4927431189abc12201d13428a31b746cdb7dee
This commit is contained in:
parent
7597f87430
commit
8ce31ea471
7 changed files with 144 additions and 248 deletions
|
@ -33,6 +33,7 @@
|
||||||
#include <stack>
|
#include <stack>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
#include "arch/alpha/linux/threadinfo.hh"
|
||||||
#include "arch/alpha/kernel_stats.hh"
|
#include "arch/alpha/kernel_stats.hh"
|
||||||
#include "arch/alpha/osfpal.hh"
|
#include "arch/alpha/osfpal.hh"
|
||||||
#include "base/trace.hh"
|
#include "base/trace.hh"
|
||||||
|
@ -137,8 +138,9 @@ Statistics::changeMode(cpu_mode newmode, ThreadContext *tc)
|
||||||
if (newmode == themode)
|
if (newmode == themode)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
DPRINTF(Context, "old mode=%-8s new mode=%-8s\n",
|
DPRINTF(Context, "old mode=%s new mode=%s pid=%d\n",
|
||||||
modestr[themode], modestr[newmode]);
|
modestr[themode], modestr[newmode],
|
||||||
|
Linux::ThreadInfo(tc).curTaskPID());
|
||||||
|
|
||||||
_modeGood[newmode]++;
|
_modeGood[newmode]++;
|
||||||
_modeTicks[themode] += curTick - lastModeTick;
|
_modeTicks[themode] += curTick - lastModeTick;
|
||||||
|
@ -165,6 +167,10 @@ Statistics::context(Addr oldpcbb, Addr newpcbb, ThreadContext *tc)
|
||||||
|
|
||||||
_swap_context++;
|
_swap_context++;
|
||||||
changeMode(newpcbb == idleProcess ? idle : kernel, tc);
|
changeMode(newpcbb == idleProcess ? idle : kernel, tc);
|
||||||
|
|
||||||
|
DPRINTF(Context, "Context Switch old pid=%d new pid=%d\n",
|
||||||
|
Linux::ThreadInfo(tc, oldpcbb).curTaskPID(),
|
||||||
|
Linux::ThreadInfo(tc, newpcbb).curTaskPID());
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -1,50 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2004 The Regents of The University of Michigan
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions are
|
|
||||||
* met: redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer;
|
|
||||||
* redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution;
|
|
||||||
* neither the name of the copyright holders nor the names of its
|
|
||||||
* contributors may be used to endorse or promote products derived from
|
|
||||||
* this software without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
||||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*
|
|
||||||
* Authors: Ali Saidi
|
|
||||||
* Nathan Binkert
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __ARCH_ALPHA_LINUX_ALIGNED_HH__
|
|
||||||
#define __ARCH_ALPHA_LINUX_ALIGNED_HH__
|
|
||||||
|
|
||||||
|
|
||||||
/* GCC 3.3.X has a bug in which attributes+typedefs don't work. 3.2.X is fine
|
|
||||||
* as in 3.4.X, but the bug is marked will not fix in 3.3.X so here is
|
|
||||||
* the work around.
|
|
||||||
*/
|
|
||||||
#if (__GNUC__ == 3 && __GNUC_MINOR__ != 3) || __GNUC__ > 3
|
|
||||||
typedef uint64_t uint64_ta __attribute__ ((aligned (8))) ;
|
|
||||||
typedef int64_t int64_ta __attribute__ ((aligned (8))) ;
|
|
||||||
typedef Addr Addr_a __attribute__ ((aligned (8))) ;
|
|
||||||
#else
|
|
||||||
#define uint64_ta uint64_t __attribute__ ((aligned (8)))
|
|
||||||
#define int64_ta int64_t __attribute__ ((aligned (8)))
|
|
||||||
#define Addr_a Addr __attribute__ ((aligned (8)))
|
|
||||||
#endif /* __GNUC__ __GNUC_MINOR__ */
|
|
||||||
|
|
||||||
#endif /* __ARCH_ALPHA_LINUX_ALIGNED_HH__ */
|
|
|
@ -1,42 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright 1990 Hewlett-Packard Development Company, L.P.
|
|
||||||
*
|
|
||||||
* Permission is hereby granted, free of charge, to any person
|
|
||||||
* obtaining a copy of this software and associated documentation
|
|
||||||
* files (the "Software"), to deal in the Software without
|
|
||||||
* restriction, including without limitation the rights to use, copy,
|
|
||||||
* modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
||||||
* of the Software, and to permit persons to whom the Software is
|
|
||||||
* furnished to do so, subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be
|
|
||||||
* included in all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
||||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
||||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
|
||||||
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
|
||||||
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
||||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
* SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __ARCH_ALPHA_LINUX_HWRPB_HH__
|
|
||||||
#define __ARCH_ALPHA_LINUX_HWRPB_HH__
|
|
||||||
|
|
||||||
#include "arch/alpha/linux/aligned.hh"
|
|
||||||
|
|
||||||
namespace Linux {
|
|
||||||
struct pcb_struct {
|
|
||||||
uint64_ta rpb_ksp;
|
|
||||||
uint64_ta rpb_usp;
|
|
||||||
uint64_ta rpb_ptbr;
|
|
||||||
uint32_t rpb_cc;
|
|
||||||
uint32_t rpb_psn;
|
|
||||||
uint64_ta rpb_unique;
|
|
||||||
uint64_ta rpb_fen;
|
|
||||||
uint64_ta res1, res2;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
#endif // __ARCH_ALPHA_LINUX_HWRPB_HH__
|
|
|
@ -1,44 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2005 The Regents of The University of Michigan
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions are
|
|
||||||
* met: redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer;
|
|
||||||
* redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution;
|
|
||||||
* neither the name of the copyright holders nor the names of its
|
|
||||||
* contributors may be used to endorse or promote products derived from
|
|
||||||
* this software without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
||||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*
|
|
||||||
* Authors: Ali Saidi
|
|
||||||
* Nathan Binkert
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __ARCH_ALPHA_LINUX_THREAD_INFO_H__
|
|
||||||
#define __ARCH_ALPHA_LINUX_THREAD_INFO_H__
|
|
||||||
|
|
||||||
#include "arch/alpha/linux/hwrpb.hh"
|
|
||||||
|
|
||||||
namespace Linux {
|
|
||||||
struct thread_info {
|
|
||||||
struct pcb_struct pcb;
|
|
||||||
Addr_a task;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // __ARCH_ALPHA_LINUX_THREAD_INFO_H__
|
|
|
@ -32,9 +32,8 @@
|
||||||
#ifndef __ARCH_ALPHA_LINUX_LINUX_TREADNIFO_HH__
|
#ifndef __ARCH_ALPHA_LINUX_LINUX_TREADNIFO_HH__
|
||||||
#define __ARCH_ALPHA_LINUX_LINUX_TREADNIFO_HH__
|
#define __ARCH_ALPHA_LINUX_LINUX_TREADNIFO_HH__
|
||||||
|
|
||||||
#include "arch/alpha/linux/thread_info.hh"
|
|
||||||
#include "cpu/thread_context.hh"
|
#include "cpu/thread_context.hh"
|
||||||
#include "kern/linux/sched.hh"
|
#include "sim/system.hh"
|
||||||
#include "sim/vptr.hh"
|
#include "sim/vptr.hh"
|
||||||
|
|
||||||
namespace Linux {
|
namespace Linux {
|
||||||
|
@ -43,47 +42,108 @@ class ThreadInfo
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
ThreadContext *tc;
|
ThreadContext *tc;
|
||||||
|
System *sys;
|
||||||
|
Addr pcbb;
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
bool
|
||||||
|
get_data(const char *symbol, T &data)
|
||||||
|
{
|
||||||
|
Addr addr = 0;
|
||||||
|
if (!sys->kernelSymtab->findAddress(symbol, addr))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
CopyOut(tc, &data, addr, sizeof(T));
|
||||||
|
|
||||||
|
data = TheISA::gtoh(data);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ThreadInfo(ThreadContext *_tc) : tc(_tc) {}
|
ThreadInfo(ThreadContext *_tc, Addr _pcbb = 0)
|
||||||
~ThreadInfo() {}
|
: tc(_tc), sys(tc->getSystemPtr()), pcbb(_pcbb)
|
||||||
|
{
|
||||||
|
|
||||||
inline VPtr<thread_info>
|
}
|
||||||
|
~ThreadInfo()
|
||||||
|
{}
|
||||||
|
|
||||||
|
inline Addr
|
||||||
curThreadInfo()
|
curThreadInfo()
|
||||||
{
|
{
|
||||||
Addr current;
|
Addr addr = pcbb;
|
||||||
|
Addr sp;
|
||||||
|
|
||||||
/* Each kernel stack is only 2 pages, the start of which is the
|
if (!addr)
|
||||||
* thread_info struct. So we can get the address by masking off
|
addr = tc->readMiscRegNoEffect(TheISA::IPR_PALtemp23);
|
||||||
* the lower 14 bits.
|
|
||||||
*/
|
FunctionalPort *p = tc->getPhysPort();
|
||||||
current = tc->readIntReg(TheISA::StackPointerReg) & ~ULL(0x3fff);
|
p->readBlob(addr, (uint8_t *)&sp, sizeof(Addr));
|
||||||
return VPtr<thread_info>(tc, current);
|
|
||||||
|
return sp & ~ULL(0x3fff);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline VPtr<task_struct>
|
inline Addr
|
||||||
curTaskInfo()
|
curTaskInfo(Addr thread_info = 0)
|
||||||
{
|
{
|
||||||
Addr task = curThreadInfo()->task;
|
int32_t offset;
|
||||||
return VPtr<task_struct>(tc, task);
|
if (!get_data("thread_info_task", offset))
|
||||||
}
|
return 0;
|
||||||
|
|
||||||
std::string
|
if (!thread_info)
|
||||||
curTaskName()
|
thread_info = curThreadInfo();
|
||||||
{
|
|
||||||
return curTaskInfo()->name;
|
Addr addr;
|
||||||
|
CopyOut(tc, &addr, thread_info + offset, sizeof(addr));
|
||||||
|
|
||||||
|
return addr;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t
|
int32_t
|
||||||
curTaskPID()
|
curTaskPID(Addr thread_info = 0)
|
||||||
{
|
{
|
||||||
return curTaskInfo()->pid;
|
Addr offset;
|
||||||
|
if (!get_data("task_struct_pid", offset))
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
int32_t pid;
|
||||||
|
CopyOut(tc, &pid, curTaskInfo(thread_info) + offset, sizeof(pid));
|
||||||
|
|
||||||
|
return pid;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t
|
int64_t
|
||||||
curTaskStart()
|
curTaskStart(Addr thread_info = 0)
|
||||||
{
|
{
|
||||||
return curTaskInfo()->start;
|
Addr offset;
|
||||||
|
if (!get_data("task_struct_start_time", offset))
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
int64_t data;
|
||||||
|
// start_time is actually of type timespec, but if we just
|
||||||
|
// grab the first long, we'll get the seconds out of it
|
||||||
|
CopyOut(tc, &data, curTaskInfo(thread_info) + offset, sizeof(data));
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string
|
||||||
|
curTaskName(Addr thread_info = 0)
|
||||||
|
{
|
||||||
|
int32_t offset;
|
||||||
|
int32_t size;
|
||||||
|
|
||||||
|
if (!get_data("task_struct_comm", offset))
|
||||||
|
return "FailureIn_curTaskName";
|
||||||
|
|
||||||
|
if (!get_data("task_struct_comm_size", size))
|
||||||
|
return "FailureIn_curTaskName";
|
||||||
|
|
||||||
|
char buffer[size + 1];
|
||||||
|
CopyStringOut(tc, buffer, curTaskInfo(thread_info) + offset, size);
|
||||||
|
|
||||||
|
return buffer;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,48 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2005 The Regents of The University of Michigan
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions are
|
|
||||||
* met: redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer;
|
|
||||||
* redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution;
|
|
||||||
* neither the name of the copyright holders nor the names of its
|
|
||||||
* contributors may be used to endorse or promote products derived from
|
|
||||||
* this software without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
||||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*
|
|
||||||
* Authors: Ali Saidi
|
|
||||||
* Nathan Binkert
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __KERN_LINUX_SCHED_HH__
|
|
||||||
#define __KERN_LINUX_SCHED_HH__
|
|
||||||
|
|
||||||
namespace Linux {
|
|
||||||
struct task_struct {
|
|
||||||
uint8_t junk1[0xf4];
|
|
||||||
int32_t pid;
|
|
||||||
uint8_t junk2[0x190];
|
|
||||||
uint64_ta start;
|
|
||||||
uint8_t junk3[0x5c];
|
|
||||||
char name[16];
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // __KERN_LINUX_SCHED_HH__
|
|
|
@ -33,6 +33,7 @@
|
||||||
|
|
||||||
#include "arch/vtophys.hh"
|
#include "arch/vtophys.hh"
|
||||||
#include "arch/isa_traits.hh"
|
#include "arch/isa_traits.hh"
|
||||||
|
#include "mem/vport.hh"
|
||||||
|
|
||||||
class ThreadContext;
|
class ThreadContext;
|
||||||
|
|
||||||
|
@ -42,82 +43,95 @@ class VPtr
|
||||||
public:
|
public:
|
||||||
typedef T Type;
|
typedef T Type;
|
||||||
|
|
||||||
private:
|
protected:
|
||||||
ThreadContext *tc;
|
ThreadContext *tc;
|
||||||
Addr ptr;
|
Addr ptr;
|
||||||
|
Addr buffer[(sizeof(T)-1)/sizeof(Addr) + 1];
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ThreadContext *GetTC() const { return tc; }
|
explicit VPtr(ThreadContext *_tc, Addr p = 0)
|
||||||
Addr GetPointer() const { return ptr; }
|
: tc(_tc), ptr(p)
|
||||||
|
{
|
||||||
|
refresh();
|
||||||
|
}
|
||||||
|
|
||||||
public:
|
|
||||||
explicit VPtr(ThreadContext *_tc, Addr p = 0) : tc(_tc), ptr(p) { }
|
|
||||||
template <class U>
|
template <class U>
|
||||||
VPtr(const VPtr<U> &vp) : tc(vp.GetTC()), ptr(vp.GetPointer()) {}
|
VPtr(const VPtr<U> &vp)
|
||||||
~VPtr() {}
|
: tc(vp.tc), ptr(vp.ptr)
|
||||||
|
{
|
||||||
|
refresh();
|
||||||
|
}
|
||||||
|
|
||||||
bool operator!() const
|
~VPtr()
|
||||||
|
{}
|
||||||
|
|
||||||
|
void
|
||||||
|
refresh()
|
||||||
|
{
|
||||||
|
if (!ptr)
|
||||||
|
return;
|
||||||
|
|
||||||
|
VirtualPort *port = tc->getVirtPort(tc);
|
||||||
|
port->readBlob(ptr, buffer, sizeof(T));
|
||||||
|
tc->delVirtPort(port);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
operator!() const
|
||||||
{
|
{
|
||||||
return ptr == 0;
|
return ptr == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
VPtr<T> operator+(int offset)
|
VPtr<T>
|
||||||
|
operator+(int offset)
|
||||||
{
|
{
|
||||||
VPtr<T> ptr(*this);
|
return VPtr<T>(tc, ptr + offset);
|
||||||
ptr += offset;
|
|
||||||
|
|
||||||
return ptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const VPtr<T> &operator+=(int offset)
|
const VPtr<T> &
|
||||||
|
operator+=(int offset)
|
||||||
{
|
{
|
||||||
ptr += offset;
|
ptr += offset;
|
||||||
assert((ptr & (TheISA::PageBytes - 1)) + sizeof(T)
|
refresh();
|
||||||
< TheISA::PageBytes);
|
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
const VPtr<T> &operator=(Addr p)
|
const VPtr<T> &
|
||||||
|
operator=(Addr p)
|
||||||
{
|
{
|
||||||
assert((p & (TheISA::PageBytes - 1)) + sizeof(T)
|
|
||||||
< TheISA::PageBytes);
|
|
||||||
ptr = p;
|
ptr = p;
|
||||||
|
refresh();
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class U>
|
template <class U>
|
||||||
const VPtr<T> &operator=(const VPtr<U> &vp)
|
const VPtr<T> &
|
||||||
|
operator=(const VPtr<U> &vp)
|
||||||
{
|
{
|
||||||
tc = vp.GetTC();
|
tc = vp.tc;
|
||||||
ptr = vp.GetPointer();
|
ptr = vp.ptr;
|
||||||
|
refresh();
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
operator T *()
|
operator T *()
|
||||||
{
|
{
|
||||||
panic("Needs to be rewritten\n");
|
return (T *)buffer;
|
||||||
/* void *addr = vtomem(tc, ptr, sizeof(T));
|
|
||||||
return (T *)addr;
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
T *operator->()
|
T *
|
||||||
|
operator->()
|
||||||
{
|
{
|
||||||
panic("Needs to be rewritten\n");
|
return (T *)buffer;
|
||||||
/* void *addr = vtomem(tc, ptr, sizeof(T));
|
|
||||||
return (T *)addr;
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
T &operator*()
|
T &
|
||||||
|
operator*()
|
||||||
{
|
{
|
||||||
panic("Needs to be rewritten\n");
|
return *(T *)buffer;
|
||||||
/* void *addr = vtomem(tc, ptr, sizeof(T));
|
|
||||||
return *(T *)addr;
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue