physical.cc (3749:89fb514175fe) | physical.cc (3751:b422ffec62c1) |
---|---|
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 | 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 |
|
68 pagePtr = 0; 69} 70 71void 72PhysicalMemory::init() 73{ 74 if (!port) 75 panic("PhysicalMemory not connected to anything!"); --- 351 unchanged lines hidden (view full) --- 427} 428 429 430BEGIN_DECLARE_SIM_OBJECT_PARAMS(PhysicalMemory) 431 432 Param<string> file; 433 Param<Range<Addr> > range; 434 Param<Tick> latency; | 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; |
|
435 436END_DECLARE_SIM_OBJECT_PARAMS(PhysicalMemory) 437 438BEGIN_INIT_SIM_OBJECT_PARAMS(PhysicalMemory) 439 440 INIT_PARAM_DFLT(file, "memory mapped file", ""), 441 INIT_PARAM(range, "Device Address Range"), | 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"), |
442 INIT_PARAM(latency, "Memory access latency") | 447 INIT_PARAM(latency, "Memory access latency"), 448 INIT_PARAM(zero, "Zero initialize memory") |
443 444END_INIT_SIM_OBJECT_PARAMS(PhysicalMemory) 445 446CREATE_SIM_OBJECT(PhysicalMemory) 447{ 448 PhysicalMemory::Params *p = new PhysicalMemory::Params; 449 p->name = getInstanceName(); 450 p->addrRange = range; 451 p->latency = latency; | 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; |
|
452 return new PhysicalMemory(p); 453} 454 455REGISTER_SIM_OBJECT("PhysicalMemory", PhysicalMemory) | 459 return new PhysicalMemory(p); 460} 461 462REGISTER_SIM_OBJECT("PhysicalMemory", PhysicalMemory) |