From: Gabe Black Date: Sun, 29 Sep 2019 02:26:02 +0000 (-0700) Subject: base: Rename Section to Segment, and some of its members. X-Git-Tag: v19.0.0.0~467 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=3c65c44a1ae87607337a56ca45b6b305778d52ff;p=gem5.git base: Rename Section to Segment, and some of its members. ELF is, in my opinion, the most important object file format gem5 currently understands, and in ELF terminolgy the blob of data that needs to be loaded into memory to a particular location is called a segment. A section is a software level view of what's in a region of memory, and a single segment may contain multiple sections which happen to follow each other in memory. Change-Id: Ib810c5050723d5a96bd7550515b08ac695fb1b02 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/21462 Tested-by: kokoro Reviewed-by: Andreas Sandberg Maintainer: Gabe Black --- diff --git a/src/arch/alpha/process.cc b/src/arch/alpha/process.cc index ea1cb0819..d0bfa79c8 100644 --- a/src/arch/alpha/process.cc +++ b/src/arch/alpha/process.cc @@ -58,9 +58,8 @@ AlphaProcess::AlphaProcess(ProcessParams *params, ObjectFile *objFile) objFile->bssSize(); brk_point = roundUp(brk_point, PageBytes); - // Set up stack. On Alpha, stack goes below text section. This - // code should get moved to some architecture-specific spot. - Addr stack_base = objFile->textBase() - (409600+4096); + // Set up stack. On Alpha, stack goes below the image. + Addr stack_base = objFile->textBase() - (409600 + 4096); // Set up region for mmaps. Addr mmap_end = 0x10000; @@ -80,7 +79,7 @@ AlphaProcess::argsInit(int intSize, int pageSize) // Patch the ld_bias for dynamic executables. updateBias(); - objFile->loadSections(initVirtMem); + objFile->loadSegments(initVirtMem); std::vector> auxv; diff --git a/src/arch/alpha/system.cc b/src/arch/alpha/system.cc index b72821ed1..7bff6da01 100644 --- a/src/arch/alpha/system.cc +++ b/src/arch/alpha/system.cc @@ -109,8 +109,8 @@ AlphaSystem::initState() System::initState(); // Load program sections into memory - pal->loadSections(physProxy, loadAddrMask); - console->loadSections(physProxy, loadAddrMask); + pal->loadSegments(physProxy, loadAddrMask); + console->loadSegments(physProxy, loadAddrMask); /** * Copy the osflags (kernel arguments) into the consoles diff --git a/src/arch/arm/freebsd/system.cc b/src/arch/arm/freebsd/system.cc index 84538e18e..6e544a70e 100644 --- a/src/arch/arm/freebsd/system.cc +++ b/src/arch/arm/freebsd/system.cc @@ -133,7 +133,7 @@ FreebsdArmSystem::initState() bootReleaseAddr = ra & ~ULL(0x7F); dtb_file->setTextBase(params()->atags_addr + loadAddrOffset); - dtb_file->loadSections(physProxy); + dtb_file->loadSegments(physProxy); delete dtb_file; // Kernel boot requirements to set up r0, r1 and r2 in ARMv7 diff --git a/src/arch/arm/linux/system.cc b/src/arch/arm/linux/system.cc index 094e4d7a7..f03a5c6cb 100644 --- a/src/arch/arm/linux/system.cc +++ b/src/arch/arm/linux/system.cc @@ -152,7 +152,7 @@ LinuxArmSystem::initState() } dtb_file->setTextBase(params()->atags_addr + loadAddrOffset); - dtb_file->loadSections(physProxy); + dtb_file->loadSegments(physProxy); delete dtb_file; } else { // Using ATAGS diff --git a/src/arch/arm/process.cc b/src/arch/arm/process.cc index 8e3cfd91d..1a1d4a2a0 100644 --- a/src/arch/arm/process.cc +++ b/src/arch/arm/process.cc @@ -272,7 +272,7 @@ ArmProcess::argsInit(int pageSize, IntRegIndex spIndex) updateBias(); // load object file into target memory - objFile->loadSections(initVirtMem); + objFile->loadSegments(initVirtMem); //Setup the auxilliary vectors. These will already have endian conversion. //Auxilliary vectors are loaded only for elf formatted executables. diff --git a/src/arch/arm/system.cc b/src/arch/arm/system.cc index 4ea0d1a91..efc347d9d 100644 --- a/src/arch/arm/system.cc +++ b/src/arch/arm/system.cc @@ -143,7 +143,7 @@ ArmSystem::initState() if (bootldr) { bool isGICv3System = dynamic_cast(getGIC()) != nullptr; - bootldr->loadSections(physProxy); + bootldr->loadSegments(physProxy); inform("Using bootloader at address %#x\n", bootldr->entryPoint()); diff --git a/src/arch/mips/process.cc b/src/arch/mips/process.cc index fb78cee24..e3405fdaa 100644 --- a/src/arch/mips/process.cc +++ b/src/arch/mips/process.cc @@ -94,7 +94,7 @@ MipsProcess::argsInit(int pageSize) updateBias(); // load object file into target memory - objFile->loadSections(initVirtMem); + objFile->loadSegments(initVirtMem); std::vector> auxv; diff --git a/src/arch/power/process.cc b/src/arch/power/process.cc index 6362027de..467c820f2 100644 --- a/src/arch/power/process.cc +++ b/src/arch/power/process.cc @@ -100,7 +100,7 @@ PowerProcess::argsInit(int intSize, int pageSize) updateBias(); // load object file into target memory - objFile->loadSections(initVirtMem); + objFile->loadSegments(initVirtMem); //Setup the auxilliary vectors. These will already have endian conversion. //Auxilliary vectors are loaded only for elf formatted executables. diff --git a/src/arch/riscv/bare_metal/system.cc b/src/arch/riscv/bare_metal/system.cc index 5cbd63af2..3fb07a489 100644 --- a/src/arch/riscv/bare_metal/system.cc +++ b/src/arch/riscv/bare_metal/system.cc @@ -55,7 +55,7 @@ BareMetalRiscvSystem::initState() RiscvSystem::initState(); // load program sections into memory - if (!bootloader->loadSections(physProxy)) { + if (!bootloader->loadSegments(physProxy)) { warn("could not load sections to memory"); } } diff --git a/src/arch/riscv/process.cc b/src/arch/riscv/process.cc index ab8305257..ca3f0e2b8 100644 --- a/src/arch/riscv/process.cc +++ b/src/arch/riscv/process.cc @@ -126,7 +126,7 @@ RiscvProcess::argsInit(int pageSize) const int addrSize = sizeof(IntType); updateBias(); - objFile->loadSections(initVirtMem); + objFile->loadSegments(initVirtMem); ElfObject* elfObject = dynamic_cast(objFile); memState->setStackMin(memState->getStackBase()); diff --git a/src/arch/sparc/process.cc b/src/arch/sparc/process.cc index d89c606a3..cca61c1be 100644 --- a/src/arch/sparc/process.cc +++ b/src/arch/sparc/process.cc @@ -208,7 +208,7 @@ SparcProcess::argsInit(int pageSize) updateBias(); // load object file into target memory - objFile->loadSections(initVirtMem); + objFile->loadSegments(initVirtMem); enum hardwareCaps { diff --git a/src/arch/sparc/system.cc b/src/arch/sparc/system.cc index a68b11cad..5896061a6 100644 --- a/src/arch/sparc/system.cc +++ b/src/arch/sparc/system.cc @@ -138,22 +138,22 @@ SparcSystem::initState() // Load reset binary into memory reset->setTextBase(params()->reset_addr); - reset->loadSections(physProxy); + reset->loadSegments(physProxy); // Load the openboot binary openboot->setTextBase(params()->openboot_addr); - openboot->loadSections(physProxy); + openboot->loadSegments(physProxy); // Load the hypervisor binary hypervisor->setTextBase(params()->hypervisor_addr); - hypervisor->loadSections(physProxy); + hypervisor->loadSegments(physProxy); // Load the nvram image nvram->setTextBase(params()->nvram_addr); - nvram->loadSections(physProxy); + nvram->loadSegments(physProxy); // Load the hypervisor description image hypervisor_desc->setTextBase(params()->hypervisor_desc_addr); - hypervisor_desc->loadSections(physProxy); + hypervisor_desc->loadSegments(physProxy); // Load the partition description image partition_desc->setTextBase(params()->partition_desc_addr); - partition_desc->loadSections(physProxy); + partition_desc->loadSegments(physProxy); // @todo any fixup code over writing data in binaries on setting break diff --git a/src/arch/x86/process.cc b/src/arch/x86/process.cc index 0765adea5..60f4f474b 100644 --- a/src/arch/x86/process.cc +++ b/src/arch/x86/process.cc @@ -776,7 +776,7 @@ X86Process::argsInit(int pageSize, updateBias(); // load object file into target memory - objFile->loadSections(initVirtMem); + objFile->loadSegments(initVirtMem); enum X86CpuFeature { X86_OnboardFPU = 1 << 0, diff --git a/src/base/loader/aout_object.cc b/src/base/loader/aout_object.cc index b731c9a83..e3f703e1d 100644 --- a/src/base/loader/aout_object.cc +++ b/src/base/loader/aout_object.cc @@ -46,9 +46,8 @@ AoutObject::tryFile(const string &fname, size_t len, uint8_t *data) // right now this is only used for Alpha PAL code return new AoutObject(fname, len, data, ObjectFile::Alpha, ObjectFile::UnknownOpSys); - } - else { - return NULL; + } else { + return nullptr; } } @@ -62,21 +61,21 @@ AoutObject::AoutObject(const string &_filename, entry = execHdr->entry; - text.baseAddr = N_TXTADDR(*execHdr); + text.base = N_TXTADDR(*execHdr); text.size = execHdr->tsize; - text.fileImage = fileData + N_TXTOFF(*execHdr); + text.data = fileData + N_TXTOFF(*execHdr); - data.baseAddr = N_DATADDR(*execHdr); + data.base = N_DATADDR(*execHdr); data.size = execHdr->dsize; - data.fileImage = fileData + N_DATOFF(*execHdr); + data.data = fileData + N_DATOFF(*execHdr); - bss.baseAddr = N_BSSADDR(*execHdr); + bss.base = N_BSSADDR(*execHdr); bss.size = execHdr->bsize; - bss.fileImage = NULL; + bss.data = NULL; DPRINTFR(Loader, "text: 0x%x %d\ndata: 0x%x %d\nbss: 0x%x %d\n", - text.baseAddr, text.size, data.baseAddr, data.size, - bss.baseAddr, bss.size); + text.base, text.size, data.base, data.size, + bss.base, bss.size); } diff --git a/src/base/loader/dtb_object.cc b/src/base/loader/dtb_object.cc index fab6a762d..92e305ffa 100644 --- a/src/base/loader/dtb_object.cc +++ b/src/base/loader/dtb_object.cc @@ -55,17 +55,17 @@ DtbObject::DtbObject(const std::string &_filename, size_t _len, uint8_t *_data, Arch _arch, OpSys _opSys) : ObjectFile(_filename, _len, _data, _arch, _opSys) { - text.baseAddr = 0; + text.base = 0; text.size = len; - text.fileImage = fileData; + text.data = fileData; - data.baseAddr = 0; + data.base = 0; data.size = 0; - data.fileImage = NULL; + data.data = nullptr; - bss.baseAddr = 0; + bss.base = 0; bss.size = 0; - bss.fileImage = NULL; + bss.data = nullptr; fileDataMmapped = true; } @@ -141,7 +141,7 @@ DtbObject::addBootCmdLine(const char* _args, size_t len) } text.size = newLen; - text.fileImage = fdt_buf_w_space; + text.data = fdt_buf_w_space; // clean up old buffer and set to new fdt blob munmap(fileData, this->len); diff --git a/src/base/loader/ecoff_object.cc b/src/base/loader/ecoff_object.cc index caeab5f8f..76b91dd66 100644 --- a/src/base/loader/ecoff_object.cc +++ b/src/base/loader/ecoff_object.cc @@ -73,21 +73,21 @@ EcoffObject::EcoffObject(const string &_filename, size_t _len, uint8_t *_data, entry = aoutHdr->entry; - text.baseAddr = aoutHdr->text_start; + text.base = aoutHdr->text_start; text.size = aoutHdr->tsize; - text.fileImage = fileData + ECOFF_TXTOFF(execHdr); + text.data = fileData + ECOFF_TXTOFF(execHdr); - data.baseAddr = aoutHdr->data_start; + data.base = aoutHdr->data_start; data.size = aoutHdr->dsize; - data.fileImage = fileData + ECOFF_DATOFF(execHdr); + data.data = fileData + ECOFF_DATOFF(execHdr); - bss.baseAddr = aoutHdr->bss_start; + bss.base = aoutHdr->bss_start; bss.size = aoutHdr->bsize; - bss.fileImage = NULL; + bss.data = nullptr; - DPRINTFR(Loader, "text: 0x%x %d\ndata: 0x%x %d\nbss: 0x%x %d\n", - text.baseAddr, text.size, data.baseAddr, data.size, - bss.baseAddr, bss.size); + DPRINTFR(Loader, "text: %#x %d\ndata: %#x %d\nbss: %#x %d\n", + text.base, text.size, data.base, data.size, + bss.base, bss.size); } bool diff --git a/src/base/loader/elf_object.cc b/src/base/loader/elf_object.cc index 2a8fb04ea..327919540 100644 --- a/src/base/loader/elf_object.cc +++ b/src/base/loader/elf_object.cc @@ -295,7 +295,7 @@ ElfObject::ElfObject(const std::string &_filename, size_t _len, // initialize segment sizes to 0 in case they're not present text.size = data.size = bss.size = 0; - text.baseAddr = data.baseAddr = bss.baseAddr = 0; + text.base = data.base = bss.base = 0; int sec_idx = 1; @@ -352,9 +352,9 @@ ElfObject::ElfObject(const std::string &_filename, size_t _len, if (phdr.p_paddr <= bss_sec_start && phdr.p_paddr + phdr.p_memsz > bss_sec_start && phdr.p_memsz - phdr.p_filesz > 0) { - bss.baseAddr = phdr.p_paddr + phdr.p_filesz; + bss.base = phdr.p_paddr + phdr.p_filesz; bss.size = phdr.p_memsz - phdr.p_filesz; - bss.fileImage = NULL; + bss.data = nullptr; } // Check to see if this is the text or data segment @@ -365,21 +365,21 @@ ElfObject::ElfObject(const std::string &_filename, size_t _len, if (phdr.p_vaddr != 0) relocate = false; - text.baseAddr = phdr.p_paddr; + text.base = phdr.p_paddr; text.size = phdr.p_filesz; - text.fileImage = fileData + phdr.p_offset; + text.data = fileData + phdr.p_offset; } else if (phdr.p_vaddr <= data_sec_start && phdr.p_vaddr + phdr.p_filesz > data_sec_start) { - data.baseAddr = phdr.p_paddr; + data.base = phdr.p_paddr; data.size = phdr.p_filesz; - data.fileImage = fileData + phdr.p_offset; + data.data = fileData + phdr.p_offset; } else { // If it's none of the above but is loadable, // load the filesize worth of data Segment extra; - extra.baseAddr = phdr.p_paddr; + extra.base = phdr.p_paddr; extra.size = phdr.p_filesz; - extra.fileImage = fileData + phdr.p_offset; + extra.data = fileData + phdr.p_offset; extraSegments.push_back(extra); } } @@ -389,9 +389,9 @@ ElfObject::ElfObject(const std::string &_filename, size_t _len, "Empty .text segment in '%s'. ELF file corrupted?\n", filename); - DPRINTFR(Loader, "text: 0x%x %d\ndata: 0x%x %d\nbss: 0x%x %d\n", - text.baseAddr, text.size, data.baseAddr, data.size, - bss.baseAddr, bss.size); + DPRINTFR(Loader, "text: %#x %d\ndata: %#x %d\nbss: %#x %d\n", + text.base, text.size, data.base, data.size, + bss.base, bss.size); elf_end(elf); @@ -498,20 +498,20 @@ ElfObject::loadWeakSymbols(SymbolTable *symtab, Addr base, Addr offset, } bool -ElfObject::loadSections(const PortProxy& mem_proxy, Addr addr_mask, +ElfObject::loadSegments(const PortProxy& mem_proxy, Addr addr_mask, Addr offset) { - if (!ObjectFile::loadSections(mem_proxy, addr_mask, offset)) + if (!ObjectFile::loadSegments(mem_proxy, addr_mask, offset)) return false; for (auto seg : extraSegments) { - if (!loadSection(&seg, mem_proxy, addr_mask, offset)) { + if (!loadSegment(&seg, mem_proxy, addr_mask, offset)) { return false; } } if (interpreter) - interpreter->loadSections(mem_proxy, addr_mask, offset); + interpreter->loadSegments(mem_proxy, addr_mask, offset); return true; } @@ -570,9 +570,9 @@ ElfObject::updateBias(Addr bias_addr) entry += bias_addr; // Patch segments with the bias_addr. - text.baseAddr += bias_addr; - data.baseAddr += bias_addr; - bss.baseAddr += bias_addr; + text.base += bias_addr; + data.base += bias_addr; + bss.base += bias_addr; for (auto &segment : extraSegments) - segment.baseAddr += bias_addr; + segment.base += bias_addr; } diff --git a/src/base/loader/elf_object.hh b/src/base/loader/elf_object.hh index 9585684d4..244b9fc3f 100644 --- a/src/base/loader/elf_object.hh +++ b/src/base/loader/elf_object.hh @@ -51,9 +51,6 @@ class ElfObject : public ObjectFile { protected: - // The global definition of a gem5 "Section" is closest to ELF's segments. - typedef ObjectFile::Section Segment; - // These values are provided to a linux process by the kernel, so we // need to keep them around. Addr _programHeaderTable; @@ -94,7 +91,7 @@ class ElfObject : public ObjectFile public: virtual ~ElfObject() {} - bool loadSections(const PortProxy& mem_proxy, Addr addr_mask = maxAddr, + bool loadSegments(const PortProxy& mem_proxy, Addr addr_mask = maxAddr, Addr offset = 0) override; virtual bool loadAllSymbols(SymbolTable *symtab, Addr base = 0, diff --git a/src/base/loader/hex_file.cc b/src/base/loader/hex_file.cc index 32de90588..4c9ffa516 100644 --- a/src/base/loader/hex_file.cc +++ b/src/base/loader/hex_file.cc @@ -62,7 +62,7 @@ HexFile::~HexFile() } bool -HexFile::loadSections(PortProxy& memProxy) +HexFile::loadSegments(PortProxy& memProxy) { char Line[64]; Addr MemAddr; diff --git a/src/base/loader/hex_file.hh b/src/base/loader/hex_file.hh index fe34fddf0..befd7f320 100644 --- a/src/base/loader/hex_file.hh +++ b/src/base/loader/hex_file.hh @@ -52,7 +52,7 @@ class HexFile virtual ~HexFile(); void close(); - bool loadSections(PortProxy& memProxy); + bool loadSegments(PortProxy& memProxy); }; #endif // __BASE_LOADER_HEX_FILE_HH__ diff --git a/src/base/loader/object_file.cc b/src/base/loader/object_file.cc index 0bb897cee..8a6b063de 100644 --- a/src/base/loader/object_file.cc +++ b/src/base/loader/object_file.cc @@ -73,17 +73,16 @@ ObjectFile::~ObjectFile() bool -ObjectFile::loadSection(Section *sec, const PortProxy& mem_proxy, +ObjectFile::loadSegment(Segment *seg, const PortProxy& mem_proxy, Addr addr_mask, Addr offset) { - if (sec->size != 0) { - Addr addr = (sec->baseAddr & addr_mask) + offset; - if (sec->fileImage) { - mem_proxy.writeBlob(addr, sec->fileImage, sec->size); - } - else { + if (seg->size != 0) { + Addr addr = (seg->base & addr_mask) + offset; + if (seg->data) { + mem_proxy.writeBlob(addr, seg->data, seg->size); + } else { // no image: must be bss - mem_proxy.memsetBlob(addr, 0, sec->size); + mem_proxy.memsetBlob(addr, 0, seg->size); } } return true; @@ -91,12 +90,12 @@ ObjectFile::loadSection(Section *sec, const PortProxy& mem_proxy, bool -ObjectFile::loadSections(const PortProxy& mem_proxy, Addr addr_mask, +ObjectFile::loadSegments(const PortProxy& mem_proxy, Addr addr_mask, Addr offset) { - return (loadSection(&text, mem_proxy, addr_mask, offset) - && loadSection(&data, mem_proxy, addr_mask, offset) - && loadSection(&bss, mem_proxy, addr_mask, offset)); + return (loadSegment(&text, mem_proxy, addr_mask, offset) + && loadSegment(&data, mem_proxy, addr_mask, offset) + && loadSegment(&bss, mem_proxy, addr_mask, offset)); } namespace diff --git a/src/base/loader/object_file.hh b/src/base/loader/object_file.hh index 14dee3be0..db995f5d7 100644 --- a/src/base/loader/object_file.hh +++ b/src/base/loader/object_file.hh @@ -88,17 +88,17 @@ class ObjectFile static const Addr maxAddr = std::numeric_limits::max(); - virtual bool loadSections(const PortProxy& mem_proxy, - Addr mask = maxAddr, Addr offset = 0); + virtual bool loadSegments(const PortProxy &mem_proxy, + Addr mask=maxAddr, Addr offset=0); virtual bool loadAllSymbols(SymbolTable *symtab, Addr base = 0, - Addr offset = 0, Addr mask = maxAddr) = 0; + Addr offset=0, Addr mask=maxAddr) = 0; virtual bool loadGlobalSymbols(SymbolTable *symtab, Addr base = 0, - Addr offset = 0, Addr mask = maxAddr) = 0; - virtual bool loadLocalSymbols(SymbolTable *symtab, Addr base = 0, - Addr offset = 0, Addr mask = maxAddr) = 0; - virtual bool loadWeakSymbols(SymbolTable *symtab, Addr base = 0, - Addr offset = 0, Addr mask = maxAddr) + Addr offset=0, Addr mask=maxAddr) = 0; + virtual bool loadLocalSymbols(SymbolTable *symtab, Addr base=0, + Addr offset=0, Addr mask=maxAddr) = 0; + virtual bool loadWeakSymbols(SymbolTable *symtab, Addr base=0, + Addr offset=0, Addr mask=maxAddr) { return false; } virtual ObjectFile *getInterpreter() const { return nullptr; } @@ -116,27 +116,28 @@ class ObjectFile protected: - struct Section { - Addr baseAddr; - uint8_t *fileImage; + struct Segment + { + Addr base; + uint8_t *data; size_t size; }; Addr entry; - Section text; - Section data; - Section bss; + Segment text; + Segment data; + Segment bss; - bool loadSection(Section *sec, const PortProxy& mem_proxy, Addr mask, - Addr offset = 0); + bool loadSegment(Segment *seg, const PortProxy &mem_proxy, Addr mask, + Addr offset=0); public: Addr entryPoint() const { return entry; } - Addr textBase() const { return text.baseAddr; } - Addr dataBase() const { return data.baseAddr; } - Addr bssBase() const { return bss.baseAddr; } + Addr textBase() const { return text.base; } + Addr dataBase() const { return data.base; } + Addr bssBase() const { return bss.base; } size_t textSize() const { return text.size; } size_t dataSize() const { return data.size; } @@ -147,7 +148,7 @@ class ObjectFile * blob that doesn't include an object header. * @param a address to load the binary/text section at */ - void setTextBase(Addr a) { text.baseAddr = a; } + void setTextBase(Addr a) { text.base = a; } /** * Each instance of a Loader subclass will have a chance to try to load diff --git a/src/base/loader/raw_object.cc b/src/base/loader/raw_object.cc index 4a04f7dfc..9662d8613 100644 --- a/src/base/loader/raw_object.cc +++ b/src/base/loader/raw_object.cc @@ -45,21 +45,21 @@ RawObject::RawObject(const std::string &_filename, size_t _len, uint8_t *_data, Arch _arch, OpSys _opSys) : ObjectFile(_filename, _len, _data, _arch, _opSys) { - text.baseAddr = 0; + text.base = 0; text.size = len; - text.fileImage = fileData; + text.data = fileData; - data.baseAddr = 0; + data.base = 0; data.size = 0; - data.fileImage = NULL; + data.data = nullptr; - bss.baseAddr = 0; + bss.base = 0; bss.size = 0; - bss.fileImage = NULL; + bss.data = nullptr; - DPRINTFR(Loader, "text: 0x%x %d\ndata: 0x%x %d\nbss: 0x%x %d\n", - text.baseAddr, text.size, data.baseAddr, data.size, - bss.baseAddr, bss.size); + DPRINTFR(Loader, "text: %#x %d\ndata: %#x %d\nbss: %#x %d\n", + text.base, text.size, data.base, data.size, + bss.base, bss.size); } bool @@ -73,10 +73,6 @@ bool RawObject::loadGlobalSymbols(SymbolTable *symtab, Addr base, Addr offset, Addr addr_mask) { -/* int fnameStart = filename.rfind('/',filename.size()) + 1; - int extStart = filename.rfind('.',filename.size()); - symtab->insert(text.baseAddr & addr_mask, filename.substr(fnameStart, - extStart-fnameStart) + "_start");*/ return true; } @@ -84,9 +80,5 @@ bool RawObject::loadLocalSymbols(SymbolTable *symtab, Addr base, Addr offset, Addr addr_mask) { -/* int fnameStart = filename.rfind('/',filename.size()) + 1; - int extStart = filename.rfind('.',filename.size()); - symtab->insert(text.baseAddr & addr_mask, filename.substr(fnameStart, - extStart-fnameStart) + "_start");*/ return true; } diff --git a/src/sim/system.cc b/src/sim/system.cc index 74769654b..73f93a257 100644 --- a/src/sim/system.cc +++ b/src/sim/system.cc @@ -327,9 +327,9 @@ System::initState() } } // Load program sections into memory - kernel->loadSections(physProxy, loadAddrMask, loadAddrOffset); + kernel->loadSegments(physProxy, loadAddrMask, loadAddrOffset); for (const auto &extra_kernel : kernelExtras) { - extra_kernel->loadSections(physProxy, loadAddrMask, + extra_kernel->loadSegments(physProxy, loadAddrMask, loadAddrOffset); }