object_file.cc (9538:182d67b5b57a) | object_file.cc (10037:5cac77888310) |
---|---|
1/* 2 * Copyright (c) 2002-2004 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; --- 52 unchanged lines hidden (view full) --- 61 62ObjectFile::~ObjectFile() 63{ 64 close(); 65} 66 67 68bool | 1/* 2 * Copyright (c) 2002-2004 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; --- 52 unchanged lines hidden (view full) --- 61 62ObjectFile::~ObjectFile() 63{ 64 close(); 65} 66 67 68bool |
69ObjectFile::loadSection(Section *sec, PortProxy& memProxy, Addr addrMask) | 69ObjectFile::loadSection(Section *sec, PortProxy& memProxy, Addr addrMask, Addr offset) |
70{ 71 if (sec->size != 0) { | 70{ 71 if (sec->size != 0) { |
72 Addr addr = sec->baseAddr & addrMask; | 72 Addr addr = (sec->baseAddr & addrMask) + offset; |
73 if (sec->fileImage) { 74 memProxy.writeBlob(addr, sec->fileImage, sec->size); 75 } 76 else { 77 // no image: must be bss 78 memProxy.memsetBlob(addr, 0, sec->size); 79 } 80 } 81 return true; 82} 83 84 85bool | 73 if (sec->fileImage) { 74 memProxy.writeBlob(addr, sec->fileImage, sec->size); 75 } 76 else { 77 // no image: must be bss 78 memProxy.memsetBlob(addr, 0, sec->size); 79 } 80 } 81 return true; 82} 83 84 85bool |
86ObjectFile::loadSections(PortProxy& memProxy, Addr addrMask) | 86ObjectFile::loadSections(PortProxy& memProxy, Addr addrMask, Addr offset) |
87{ | 87{ |
88 return (loadSection(&text, memProxy, addrMask) 89 && loadSection(&data, memProxy, addrMask) 90 && loadSection(&bss, memProxy, addrMask)); | 88 return (loadSection(&text, memProxy, addrMask, offset) 89 && loadSection(&data, memProxy, addrMask, offset) 90 && loadSection(&bss, memProxy, addrMask, offset)); |
91} 92 93 94void 95ObjectFile::close() 96{ 97 if (descriptor >= 0) { 98 ::close(descriptor); --- 57 unchanged lines hidden --- | 91} 92 93 94void 95ObjectFile::close() 96{ 97 if (descriptor >= 0) { 98 ::close(descriptor); --- 57 unchanged lines hidden --- |