abstract_mem.cc (9098:7909b6cf7188) abstract_mem.cc (9203:939077a54014)
1/*
2 * Copyright (c) 2010-2012 ARM Limited
3 * All rights reserved
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software

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

46#include <sys/types.h>
47#include <sys/user.h>
48#include <fcntl.h>
49#include <unistd.h>
50#include <zlib.h>
51
52#include <cerrno>
53#include <cstdio>
1/*
2 * Copyright (c) 2010-2012 ARM Limited
3 * All rights reserved
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software

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

46#include <sys/types.h>
47#include <sys/user.h>
48#include <fcntl.h>
49#include <unistd.h>
50#include <zlib.h>
51
52#include <cerrno>
53#include <cstdio>
54#include <climits>
54#include <iostream>
55#include <string>
56
57#include "arch/registers.hh"
58#include "config/the_isa.hh"
59#include "debug/LLSC.hh"
60#include "debug/MemoryAccess.hh"
61#include "mem/abstract_mem.hh"

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

481 fatal("Can't open physical memory checkpoint file '%s'\n", filename);
482 }
483
484 compressedMem = gzdopen(fd, "wb");
485 if (compressedMem == NULL)
486 fatal("Insufficient memory to allocate compression state for %s\n",
487 filename);
488
55#include <iostream>
56#include <string>
57
58#include "arch/registers.hh"
59#include "config/the_isa.hh"
60#include "debug/LLSC.hh"
61#include "debug/MemoryAccess.hh"
62#include "mem/abstract_mem.hh"

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

482 fatal("Can't open physical memory checkpoint file '%s'\n", filename);
483 }
484
485 compressedMem = gzdopen(fd, "wb");
486 if (compressedMem == NULL)
487 fatal("Insufficient memory to allocate compression state for %s\n",
488 filename);
489
489 if (gzwrite(compressedMem, pmemAddr, size()) != (int)size()) {
490 fatal("Write failed on physical memory checkpoint file '%s'\n",
491 filename);
490 uint64_t pass_size = 0;
491 // gzwrite fails if (int)len < 0 (gzwrite returns int)
492 for (uint64_t written = 0; written < size(); written += pass_size) {
493 pass_size = (uint64_t)INT_MAX < (size() - written) ?
494 (uint64_t)INT_MAX : (size() - written);
495
496 if (gzwrite(compressedMem, pmemAddr + written,
497 (unsigned int) pass_size) != (int)pass_size) {
498 fatal("Write failed on physical memory checkpoint file '%s'\n",
499 filename);
500 }
492 }
493
494 if (gzclose(compressedMem))
495 fatal("Close failed on physical memory checkpoint file '%s'\n",
496 filename);
497
498 list<LockedAddr>::iterator i = lockedAddrList.begin();
499

--- 97 unchanged lines hidden ---
501 }
502
503 if (gzclose(compressedMem))
504 fatal("Close failed on physical memory checkpoint file '%s'\n",
505 filename);
506
507 list<LockedAddr>::iterator i = lockedAddrList.begin();
508

--- 97 unchanged lines hidden ---