physical.cc (5315:30997e988446) physical.cc (5399:e951ca2d56e2)
1/*
2 * Copyright (c) 2001-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;

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

36#include <unistd.h>
37#include <zlib.h>
38
39#include <iostream>
40#include <string>
41
42#include "arch/isa_traits.hh"
43#include "base/misc.hh"
1/*
2 * Copyright (c) 2001-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;

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

36#include <unistd.h>
37#include <zlib.h>
38
39#include <iostream>
40#include <string>
41
42#include "arch/isa_traits.hh"
43#include "base/misc.hh"
44#include "base/random.hh"
44#include "config/full_system.hh"
45#include "mem/packet_access.hh"
46#include "mem/physical.hh"
47#include "sim/eventq.hh"
48#include "sim/host.hh"
49
50using namespace std;
51using namespace TheISA;
52
53PhysicalMemory::PhysicalMemory(const Params *p)
45#include "config/full_system.hh"
46#include "mem/packet_access.hh"
47#include "mem/physical.hh"
48#include "sim/eventq.hh"
49#include "sim/host.hh"
50
51using namespace std;
52using namespace TheISA;
53
54PhysicalMemory::PhysicalMemory(const Params *p)
54 : MemObject(p), pmemAddr(NULL), lat(p->latency)
55 : MemObject(p), pmemAddr(NULL), lat(p->latency),
56 lat_var(p->latency_var)
55{
56 if (params()->range.size() % TheISA::PageBytes != 0)
57 panic("Memory Size not divisible by page size\n");
58
59 int map_flags = MAP_ANON | MAP_PRIVATE;
60 pmemAddr = (uint8_t *)mmap(NULL, params()->range.size(),
61 PROT_READ | PROT_WRITE, map_flags, -1, 0);
62

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

111{
112 //Can accept anysize request
113 return 0;
114}
115
116Tick
117PhysicalMemory::calculateLatency(PacketPtr pkt)
118{
57{
58 if (params()->range.size() % TheISA::PageBytes != 0)
59 panic("Memory Size not divisible by page size\n");
60
61 int map_flags = MAP_ANON | MAP_PRIVATE;
62 pmemAddr = (uint8_t *)mmap(NULL, params()->range.size(),
63 PROT_READ | PROT_WRITE, map_flags, -1, 0);
64

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

113{
114 //Can accept anysize request
115 return 0;
116}
117
118Tick
119PhysicalMemory::calculateLatency(PacketPtr pkt)
120{
119 return lat;
121 Tick latency = lat;
122 if (lat_var != 0)
123 latency += random_mt.random<Tick>(0, lat_var);
124 return latency;
120}
121
122
123
124// Add load-locked to tracking list. Should only be called if the
125// operation is a load and the LOCKED flag is set.
126void
127PhysicalMemory::trackLoadLocked(PacketPtr pkt)

--- 429 unchanged lines hidden ---
125}
126
127
128
129// Add load-locked to tracking list. Should only be called if the
130// operation is a load and the LOCKED flag is set.
131void
132PhysicalMemory::trackLoadLocked(PacketPtr pkt)

--- 429 unchanged lines hidden ---