pseudo_inst.cc (13905:5cf30883255c) pseudo_inst.cc (14018:9d2153431f44)
1/*
2 * Copyright (c) 2010-2012, 2015, 2017 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

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

372void
373addsymbol(ThreadContext *tc, Addr addr, Addr symbolAddr)
374{
375 DPRINTF(PseudoInst, "PseudoInst::addsymbol(0x%x, 0x%x)\n",
376 addr, symbolAddr);
377 if (!FullSystem)
378 panicFsOnlyPseudoInst("addSymbol");
379
1/*
2 * Copyright (c) 2010-2012, 2015, 2017 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

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

372void
373addsymbol(ThreadContext *tc, Addr addr, Addr symbolAddr)
374{
375 DPRINTF(PseudoInst, "PseudoInst::addsymbol(0x%x, 0x%x)\n",
376 addr, symbolAddr);
377 if (!FullSystem)
378 panicFsOnlyPseudoInst("addSymbol");
379
380 char symb[100];
381 CopyStringOut(tc, symb, symbolAddr, 100);
382 std::string symbol(symb);
380 std::string symbol;
381 tc->getVirtProxy().readString(symbol, symbolAddr);
383
384 DPRINTF(Loader, "Loaded symbol: %s @ %#llx\n", symbol, addr);
385
386 tc->getSystemPtr()->kernelSymtab->insert(addr,symbol);
387 debugSymbolTable->insert(addr,symbol);
388}
389
390uint64_t

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

520 break;
521
522 p += bytes;
523 result += bytes;
524 len -= bytes;
525 }
526
527 close(fd);
382
383 DPRINTF(Loader, "Loaded symbol: %s @ %#llx\n", symbol, addr);
384
385 tc->getSystemPtr()->kernelSymtab->insert(addr,symbol);
386 debugSymbolTable->insert(addr,symbol);
387}
388
389uint64_t

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

519 break;
520
521 p += bytes;
522 result += bytes;
523 len -= bytes;
524 }
525
526 close(fd);
528 CopyIn(tc, vaddr, buf, result);
527 tc->getVirtProxy().writeBlob(vaddr, buf, result);
529 delete [] buf;
530 return result;
531}
532
533uint64_t
534writefile(ThreadContext *tc, Addr vaddr, uint64_t len, uint64_t offset,
535 Addr filename_addr)
536{
537 DPRINTF(PseudoInst, "PseudoInst::writefile(0x%x, 0x%x, 0x%x, 0x%x)\n",
538 vaddr, len, offset, filename_addr);
539
540 // copy out target filename
528 delete [] buf;
529 return result;
530}
531
532uint64_t
533writefile(ThreadContext *tc, Addr vaddr, uint64_t len, uint64_t offset,
534 Addr filename_addr)
535{
536 DPRINTF(PseudoInst, "PseudoInst::writefile(0x%x, 0x%x, 0x%x, 0x%x)\n",
537 vaddr, len, offset, filename_addr);
538
539 // copy out target filename
541 char fn[100];
542 std::string filename;
540 std::string filename;
543 CopyStringOut(tc, fn, filename_addr, 100);
544 filename = std::string(fn);
541 tc->getVirtProxy().readString(filename, filename_addr);
545
546 OutputStream *out;
547 if (offset == 0) {
548 // create a new file (truncate)
549 out = simout.create(filename, true, true);
550 } else {
551 // do not truncate file if offset is non-zero
552 // (ios::in flag is required as well to keep the existing data

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

558 if (!os)
559 panic("could not open file %s\n", filename);
560
561 // seek to offset
562 os->seekp(offset);
563
564 // copy out data and write to file
565 char *buf = new char[len];
542
543 OutputStream *out;
544 if (offset == 0) {
545 // create a new file (truncate)
546 out = simout.create(filename, true, true);
547 } else {
548 // do not truncate file if offset is non-zero
549 // (ios::in flag is required as well to keep the existing data

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

555 if (!os)
556 panic("could not open file %s\n", filename);
557
558 // seek to offset
559 os->seekp(offset);
560
561 // copy out data and write to file
562 char *buf = new char[len];
566 CopyOut(tc, buf, vaddr, len);
563 tc->getVirtProxy().readBlob(vaddr, buf, len);
567 os->write(buf, len);
568 if (os->fail() || os->bad())
569 panic("Error while doing writefile!\n");
570
571 simout.close(out);
572
573 delete [] buf;
574

--- 145 unchanged lines hidden ---
564 os->write(buf, len);
565 if (os->fail() || os->bad())
566 panic("Error while doing writefile!\n");
567
568 simout.close(out);
569
570 delete [] buf;
571

--- 145 unchanged lines hidden ---