diff options
Diffstat (limited to 'src/arch')
-rw-r--r-- | src/arch/alpha/process.cc | 11 | ||||
-rw-r--r-- | src/arch/alpha/system.cc | 6 | ||||
-rw-r--r-- | src/arch/arm/freebsd/system.cc | 4 | ||||
-rw-r--r-- | src/arch/arm/linux/system.cc | 4 | ||||
-rw-r--r-- | src/arch/arm/process.cc | 12 | ||||
-rw-r--r-- | src/arch/arm/system.cc | 2 | ||||
-rw-r--r-- | src/arch/mips/process.cc | 10 | ||||
-rw-r--r-- | src/arch/power/process.cc | 10 | ||||
-rw-r--r-- | src/arch/riscv/bare_metal/system.cc | 2 | ||||
-rw-r--r-- | src/arch/riscv/process.cc | 8 | ||||
-rw-r--r-- | src/arch/sparc/process.cc | 8 | ||||
-rw-r--r-- | src/arch/sparc/process.hh | 4 | ||||
-rw-r--r-- | src/arch/sparc/system.cc | 28 | ||||
-rw-r--r-- | src/arch/x86/process.cc | 12 |
14 files changed, 31 insertions, 90 deletions
diff --git a/src/arch/alpha/process.cc b/src/arch/alpha/process.cc index e266b92b2..9311a6415 100644 --- a/src/arch/alpha/process.cc +++ b/src/arch/alpha/process.cc @@ -54,10 +54,10 @@ AlphaProcess::AlphaProcess(ProcessParams *params, ObjectFile *objFile) objFile) { fatal_if(params->useArchPT, "Arch page tables not implemented."); - Addr brk_point = roundUp(objFile->maxSegmentAddr(), PageBytes); + Addr brk_point = roundUp(image.maxAddr(), PageBytes); // Set up stack. On Alpha, stack goes below the image. - Addr stack_base = objFile->minSegmentAddr() - (409600 + 4096); + Addr stack_base = image.minAddr() - (409600 + 4096); // Set up region for mmaps. Addr mmap_end = 0x10000; @@ -74,13 +74,6 @@ AlphaProcess::AlphaProcess(ProcessParams *params, ObjectFile *objFile) void AlphaProcess::argsInit(int intSize, int pageSize) { - // Patch the ld_bias for dynamic executables. - updateBias(); - - objFile->loadSegments(initVirtMem); - if (objFile->getInterpreter()) - objFile->getInterpreter()->loadSegments(initVirtMem); - std::vector<AuxVector<uint64_t>> auxv; ElfObject * elfObject = dynamic_cast<ElfObject *>(objFile); diff --git a/src/arch/alpha/system.cc b/src/arch/alpha/system.cc index 31e7aa062..a7a47036a 100644 --- a/src/arch/alpha/system.cc +++ b/src/arch/alpha/system.cc @@ -57,13 +57,11 @@ AlphaSystem::AlphaSystem(Params *p) */ // Load Console Code console = createObjectFile(params()->console); - console->setLoadMask(loadAddrMask); if (console == NULL) fatal("Could not load console file %s", params()->console); // Load pal file pal = createObjectFile(params()->pal); - pal->setLoadMask(loadAddrMask); if (pal == NULL) fatal("Could not load PALcode file %s", params()->pal); @@ -111,8 +109,8 @@ AlphaSystem::initState() System::initState(); // Load program sections into memory - pal->loadSegments(physProxy); - console->loadSegments(physProxy); + pal->buildImage().mask(loadAddrMask).write(physProxy); + console->buildImage().mask(loadAddrMask).write(physProxy); /** * 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 764f036b4..106c8e432 100644 --- a/src/arch/arm/freebsd/system.cc +++ b/src/arch/arm/freebsd/system.cc @@ -132,8 +132,8 @@ FreebsdArmSystem::initState() if (ra) bootReleaseAddr = ra & ~ULL(0x7F); - dtb_file->setLoadOffset(params()->atags_addr + loadAddrOffset); - dtb_file->loadSegments(physProxy); + dtb_file->buildImage(). + offset(params()->atags_addr + loadAddrOffset).write(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 a0869b46a..740d2e0e6 100644 --- a/src/arch/arm/linux/system.cc +++ b/src/arch/arm/linux/system.cc @@ -151,8 +151,8 @@ LinuxArmSystem::initState() "to DTB file: %s\n", params()->dtb_filename); } - dtb_file->setLoadOffset(params()->atags_addr + loadAddrOffset); - dtb_file->loadSegments(physProxy); + dtb_file->buildImage(). + offset(params()->atags_addr + loadAddrOffset).write(physProxy); delete dtb_file; } else { // Using ATAGS diff --git a/src/arch/arm/process.cc b/src/arch/arm/process.cc index ff3b92f48..d9b714c44 100644 --- a/src/arch/arm/process.cc +++ b/src/arch/arm/process.cc @@ -75,7 +75,7 @@ ArmProcess32::ArmProcess32(ProcessParams *params, ObjectFile *objFile, ObjectFile::Arch _arch) : ArmProcess(params, objFile, _arch) { - Addr brk_point = roundUp(objFile->maxSegmentAddr(), PageBytes); + Addr brk_point = roundUp(image.maxAddr(), PageBytes); Addr stack_base = 0xbf000000L; Addr max_stack_size = 8 * 1024 * 1024; Addr next_thread_stack_base = stack_base - max_stack_size; @@ -89,7 +89,7 @@ ArmProcess64::ArmProcess64(ProcessParams *params, ObjectFile *objFile, ObjectFile::Arch _arch) : ArmProcess(params, objFile, _arch) { - Addr brk_point = roundUp(objFile->maxSegmentAddr(), PageBytes); + Addr brk_point = roundUp(image.maxAddr(), PageBytes); Addr stack_base = 0x7fffff0000L; Addr max_stack_size = 8 * 1024 * 1024; Addr next_thread_stack_base = stack_base - max_stack_size; @@ -266,14 +266,6 @@ ArmProcess::argsInit(int pageSize, IntRegIndex spIndex) //We want 16 byte alignment uint64_t align = 16; - // Patch the ld_bias for dynamic executables. - updateBias(); - - // load object file into target memory - objFile->loadSegments(initVirtMem); - if (objFile->getInterpreter()) - objFile->getInterpreter()->loadSegments(initVirtMem); - //Setup the auxilliary vectors. These will already have endian conversion. //Auxilliary vectors are loaded only for elf formatted executables. ElfObject * elfObject = dynamic_cast<ElfObject *>(objFile); diff --git a/src/arch/arm/system.cc b/src/arch/arm/system.cc index efc347d9d..bf2881026 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<Gicv3 *>(getGIC()) != nullptr; - bootldr->loadSegments(physProxy); + bootldr->buildImage().write(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 4c4b0e414..8e1e22b66 100644 --- a/src/arch/mips/process.cc +++ b/src/arch/mips/process.cc @@ -65,7 +65,7 @@ MipsProcess::MipsProcess(ProcessParams *params, ObjectFile *objFile) Addr next_thread_stack_base = stack_base - max_stack_size; // Set up break point (Top of Heap) - Addr brk_point = objFile->maxSegmentAddr(); + Addr brk_point = image.maxAddr(); brk_point = roundUp(brk_point, PageBytes); // Set up region for mmaps. Start it 1GB above the top of the heap. @@ -89,14 +89,6 @@ MipsProcess::argsInit(int pageSize) { int intSize = sizeof(IntType); - // Patch the ld_bias for dynamic executables. - updateBias(); - - // load object file into target memory - objFile->loadSegments(initVirtMem); - if (objFile->getInterpreter()) - objFile->getInterpreter()->loadSegments(initVirtMem); - std::vector<AuxVector<IntType>> auxv; ElfObject * elfObject = dynamic_cast<ElfObject *>(objFile); diff --git a/src/arch/power/process.cc b/src/arch/power/process.cc index 89b94b21f..7b53d7038 100644 --- a/src/arch/power/process.cc +++ b/src/arch/power/process.cc @@ -56,7 +56,7 @@ PowerProcess::PowerProcess(ProcessParams *params, ObjectFile *objFile) { fatal_if(params->useArchPT, "Arch page tables not implemented."); // Set up break point (Top of Heap) - Addr brk_point = objFile->maxSegmentAddr(); + Addr brk_point = image.maxAddr(); brk_point = roundUp(brk_point, PageBytes); Addr stack_base = 0xbf000000L; @@ -95,13 +95,9 @@ PowerProcess::argsInit(int intSize, int pageSize) //We want 16 byte alignment uint64_t align = 16; - // Patch the ld_bias for dynamic executables. - updateBias(); - // load object file into target memory - objFile->loadSegments(initVirtMem); - if (objFile->getInterpreter()) - objFile->getInterpreter()->loadSegments(initVirtMem); + image.write(initVirtMem); + interpImage.write(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 3fb07a489..44e14e5ce 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->loadSegments(physProxy)) { + if (!bootloader->buildImage().write(physProxy)) { warn("could not load sections to memory"); } } diff --git a/src/arch/riscv/process.cc b/src/arch/riscv/process.cc index 35dde7600..617efa0ee 100644 --- a/src/arch/riscv/process.cc +++ b/src/arch/riscv/process.cc @@ -75,7 +75,7 @@ RiscvProcess64::RiscvProcess64(ProcessParams *params, ObjectFile *objFile) : const Addr stack_base = 0x7FFFFFFFFFFFFFFFL; const Addr max_stack_size = 8 * 1024 * 1024; const Addr next_thread_stack_base = stack_base - max_stack_size; - const Addr brk_point = roundUp(objFile->maxSegmentAddr(), PageBytes); + const Addr brk_point = roundUp(image.maxAddr(), PageBytes); const Addr mmap_end = 0x4000000000000000L; memState = make_shared<MemState>(brk_point, stack_base, max_stack_size, next_thread_stack_base, mmap_end); @@ -87,7 +87,7 @@ RiscvProcess32::RiscvProcess32(ProcessParams *params, ObjectFile *objFile) : const Addr stack_base = 0x7FFFFFFF; const Addr max_stack_size = 8 * 1024 * 1024; const Addr next_thread_stack_base = stack_base - max_stack_size; - const Addr brk_point = roundUp(objFile->maxSegmentAddr(), PageBytes); + const Addr brk_point = roundUp(image.maxAddr(), PageBytes); const Addr mmap_end = 0x40000000L; memState = make_shared<MemState>(brk_point, stack_base, max_stack_size, next_thread_stack_base, mmap_end); @@ -123,10 +123,6 @@ RiscvProcess::argsInit(int pageSize) const int RandomBytes = 16; const int addrSize = sizeof(IntType); - updateBias(); - objFile->loadSegments(initVirtMem); - if (objFile->getInterpreter()) - objFile->getInterpreter()->loadSegments(initVirtMem); ElfObject* elfObject = dynamic_cast<ElfObject*>(objFile); memState->setStackMin(memState->getStackBase()); diff --git a/src/arch/sparc/process.cc b/src/arch/sparc/process.cc index 1c020c6b1..048c7e957 100644 --- a/src/arch/sparc/process.cc +++ b/src/arch/sparc/process.cc @@ -204,14 +204,6 @@ SparcProcess::argsInit(int pageSize) // maintain double word alignment of the stack pointer. uint64_t align = 16; - // Patch the ld_bias for dynamic executables. - updateBias(); - - // load object file into target memory - objFile->loadSegments(initVirtMem); - if (objFile->getInterpreter()) - objFile->getInterpreter()->loadSegments(initVirtMem); - enum hardwareCaps { M5_HWCAP_SPARC_FLUSH = 1, diff --git a/src/arch/sparc/process.hh b/src/arch/sparc/process.hh index f8f19f290..0ef34352b 100644 --- a/src/arch/sparc/process.hh +++ b/src/arch/sparc/process.hh @@ -78,7 +78,7 @@ class Sparc32Process : public SparcProcess Sparc32Process(ProcessParams * params, ObjectFile *objFile) : SparcProcess(params, objFile, 0) { - Addr brk_point = objFile->maxSegmentAddr(); + Addr brk_point = image.maxAddr(); brk_point = roundUp(brk_point, SparcISA::PageBytes); // Reserve 8M for main stack. @@ -122,7 +122,7 @@ class Sparc64Process : public SparcProcess Sparc64Process(ProcessParams * params, ObjectFile *objFile) : SparcProcess(params, objFile, 2047) { - Addr brk_point = objFile->maxSegmentAddr(); + Addr brk_point = image.maxAddr(); brk_point = roundUp(brk_point, SparcISA::PageBytes); Addr max_stack_size = 8 * 1024 * 1024; diff --git a/src/arch/sparc/system.cc b/src/arch/sparc/system.cc index e9615b00c..255cc1453 100644 --- a/src/arch/sparc/system.cc +++ b/src/arch/sparc/system.cc @@ -136,25 +136,15 @@ SparcSystem::initState() // Call the initialisation of the super class System::initState(); - // Load reset binary into memory - reset->setLoadOffset(params()->reset_addr); - reset->loadSegments(physProxy); - // Load the openboot binary - openboot->setLoadOffset(params()->openboot_addr); - openboot->loadSegments(physProxy); - // Load the hypervisor binary - hypervisor->setLoadOffset(params()->hypervisor_addr); - hypervisor->loadSegments(physProxy); - // Load the nvram image - nvram->setLoadOffset(params()->nvram_addr); - nvram->loadSegments(physProxy); - // Load the hypervisor description image - hypervisor_desc->setLoadOffset(params()->hypervisor_desc_addr); - hypervisor_desc->loadSegments(physProxy); - // Load the partition description image - partition_desc->setLoadOffset(params()->partition_desc_addr); - partition_desc->loadSegments(physProxy); - + reset->buildImage().offset(params()->reset_addr).write(physProxy); + openboot->buildImage().offset(params()->openboot_addr).write(physProxy); + hypervisor->buildImage(). + offset(params()->hypervisor_addr).write(physProxy); + nvram->buildImage().offset(params()->nvram_addr).write(physProxy); + hypervisor_desc->buildImage(). + offset(params()->hypervisor_desc_addr).write(physProxy); + partition_desc->buildImage(). + offset(params()->partition_desc_addr).write(physProxy); // @todo any fixup code over writing data in binaries on setting break // events on functions should happen here. diff --git a/src/arch/x86/process.cc b/src/arch/x86/process.cc index 546474138..11b46c824 100644 --- a/src/arch/x86/process.cc +++ b/src/arch/x86/process.cc @@ -136,7 +136,7 @@ X86_64Process::X86_64Process(ProcessParams *params, ObjectFile *objFile, vsyscallPage.vtimeOffset = 0x400; vsyscallPage.vgettimeofdayOffset = 0x0; - Addr brk_point = roundUp(objFile->maxSegmentAddr(), PageBytes); + Addr brk_point = roundUp(image.maxAddr(), PageBytes); Addr stack_base = 0x7FFFFFFFF000ULL; Addr max_stack_size = 8 * 1024 * 1024; Addr next_thread_stack_base = stack_base - max_stack_size; @@ -175,7 +175,7 @@ I386Process::I386Process(ProcessParams *params, ObjectFile *objFile, vsyscallPage.vsyscallOffset = 0x400; vsyscallPage.vsysexitOffset = 0x410; - Addr brk_point = roundUp(objFile->maxSegmentAddr(), PageBytes); + Addr brk_point = roundUp(image.maxAddr(), PageBytes); Addr stack_base = _gdtStart; Addr max_stack_size = 8 * 1024 * 1024; Addr next_thread_stack_base = stack_base - max_stack_size; @@ -770,14 +770,6 @@ X86Process::argsInit(int pageSize, // We want 16 byte alignment uint64_t align = 16; - // Patch the ld_bias for dynamic executables. - updateBias(); - - // load object file into target memory - objFile->loadSegments(initVirtMem); - if (objFile->getInterpreter()) - objFile->getInterpreter()->loadSegments(initVirtMem); - enum X86CpuFeature { X86_OnboardFPU = 1 << 0, X86_VirtualModeExtensions = 1 << 1, |