Deleted Added
sdiff udiff text old ( 3749:89fb514175fe ) new ( 3751:b422ffec62c1 )
full compact
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;

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

60 pmemAddr = (uint8_t *)mmap(NULL, params()->addrRange.size(), PROT_READ | PROT_WRITE,
61 map_flags, -1, 0);
62
63 if (pmemAddr == (void *)MAP_FAILED) {
64 perror("mmap");
65 fatal("Could not mmap!\n");
66 }
67
68 //If requested, initialize all the memory to 0
69 if(params()->zero)
70 memset(pmemAddr, 0, params()->addrRange.size());
71
72 pagePtr = 0;
73}
74
75void
76PhysicalMemory::init()
77{
78 if (!port)
79 panic("PhysicalMemory not connected to anything!");

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

431}
432
433
434BEGIN_DECLARE_SIM_OBJECT_PARAMS(PhysicalMemory)
435
436 Param<string> file;
437 Param<Range<Addr> > range;
438 Param<Tick> latency;
439 Param<bool> zero;
440
441END_DECLARE_SIM_OBJECT_PARAMS(PhysicalMemory)
442
443BEGIN_INIT_SIM_OBJECT_PARAMS(PhysicalMemory)
444
445 INIT_PARAM_DFLT(file, "memory mapped file", ""),
446 INIT_PARAM(range, "Device Address Range"),
447 INIT_PARAM(latency, "Memory access latency"),
448 INIT_PARAM(zero, "Zero initialize memory")
449
450END_INIT_SIM_OBJECT_PARAMS(PhysicalMemory)
451
452CREATE_SIM_OBJECT(PhysicalMemory)
453{
454 PhysicalMemory::Params *p = new PhysicalMemory::Params;
455 p->name = getInstanceName();
456 p->addrRange = range;
457 p->latency = latency;
458 p->zero = zero;
459 return new PhysicalMemory(p);
460}
461
462REGISTER_SIM_OBJECT("PhysicalMemory", PhysicalMemory)