From 8666440499ef5b175b16efcf9d3a53f0583f0c45 Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Wed, 1 May 2019 20:14:13 -0700 Subject: [PATCH] arch, base, dev, sim: Remove now unnecessary casts from PortProxy methods. Change-Id: Ia73b2d86a10d02fa09c924a4571477bb5f200eb7 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/18572 Tested-by: kokoro Reviewed-by: Andreas Sandberg Reviewed-by: Jason Lowe-Power Maintainer: Jason Lowe-Power --- src/arch/alpha/linux/system.cc | 4 +- src/arch/alpha/process.cc | 2 +- src/arch/alpha/system.cc | 2 +- src/arch/arm/linux/process.cc | 2 +- src/arch/arm/process.cc | 5 +-- src/arch/arm/semihosting.cc | 9 ++-- src/arch/generic/linux/threadinfo.hh | 2 +- src/arch/mips/process.cc | 2 +- src/arch/power/process.cc | 5 +-- src/arch/sparc/process.cc | 13 +++--- src/arch/x86/bios/e820.cc | 4 +- src/arch/x86/bios/intelmp.cc | 16 +++---- src/arch/x86/bios/smbios.cc | 67 +++++++++++++--------------- src/arch/x86/linux/system.cc | 4 +- src/arch/x86/process.cc | 21 +++++---- src/arch/x86/pseudo_inst.cc | 4 +- src/arch/x86/system.cc | 28 +++++------- src/base/loader/hex_file.cc | 2 +- src/base/remote_gdb.cc | 8 ++-- src/dev/alpha/tsunami_pchip.cc | 8 ++-- src/dev/arm/gic_v3_redistributor.cc | 8 ++-- src/dev/virtio/base.cc | 4 +- src/dev/virtio/base.hh | 8 ++-- src/sim/process_impl.hh | 5 +-- src/sim/syscall_emul.hh | 10 ++--- 25 files changed, 111 insertions(+), 132 deletions(-) diff --git a/src/arch/alpha/linux/system.cc b/src/arch/alpha/linux/system.cc index 950b773aa..d963d29ee 100644 --- a/src/arch/alpha/linux/system.cc +++ b/src/arch/alpha/linux/system.cc @@ -90,8 +90,8 @@ LinuxAlphaSystem::initState() * kernel arguments directly into the kernel's memory. */ virtProxy.writeBlob(CommandLine(), - (uint8_t*)params()->boot_osflags.c_str(), - params()->boot_osflags.length()+1); + params()->boot_osflags.c_str(), + params()->boot_osflags.length() + 1); /** * find the address of the est_cycle_freq variable and insert it diff --git a/src/arch/alpha/process.cc b/src/arch/alpha/process.cc index a7822a367..83c4c2619 100644 --- a/src/arch/alpha/process.cc +++ b/src/arch/alpha/process.cc @@ -162,7 +162,7 @@ AlphaProcess::argsInit(int intSize, int pageSize) else panic("Unknown int size"); - initVirtMem.writeBlob(memState->getStackMin(), (uint8_t*)&argc, intSize); + initVirtMem.writeBlob(memState->getStackMin(), &argc, intSize); copyStringArray(argv, argv_array_base, arg_data_base, initVirtMem); copyStringArray(envp, envp_array_base, env_data_base, initVirtMem); diff --git a/src/arch/alpha/system.cc b/src/arch/alpha/system.cc index 302942981..b72821ed1 100644 --- a/src/arch/alpha/system.cc +++ b/src/arch/alpha/system.cc @@ -119,7 +119,7 @@ AlphaSystem::initState() * others do.) */ if (consoleSymtab->findAddress("env_booted_osflags", addr)) { - virtProxy.writeBlob(addr, (uint8_t*)params()->boot_osflags.c_str(), + virtProxy.writeBlob(addr, params()->boot_osflags.c_str(), strlen(params()->boot_osflags.c_str())); } diff --git a/src/arch/arm/linux/process.cc b/src/arch/arm/linux/process.cc index 1bb754870..25bccb6b6 100644 --- a/src/arch/arm/linux/process.cc +++ b/src/arch/arm/linux/process.cc @@ -148,7 +148,7 @@ setTLSFunc32(SyscallDesc *desc, int callnum, ThreadContext *tc) uint32_t tlsPtr = process->getSyscallArg(tc, index); tc->getMemProxy().writeBlob(ArmLinuxProcess32::commPage + 0x0ff0, - (uint8_t *)&tlsPtr, sizeof(tlsPtr)); + &tlsPtr, sizeof(tlsPtr)); tc->setMiscReg(MISCREG_TPIDRURO,tlsPtr); return 0; } diff --git a/src/arch/arm/process.cc b/src/arch/arm/process.cc index baa861fc8..8e3cfd91d 100644 --- a/src/arch/arm/process.cc +++ b/src/arch/arm/process.cc @@ -415,8 +415,7 @@ ArmProcess::argsInit(int pageSize, IntRegIndex spIndex) //Write out the sentry void * IntType sentry_NULL = 0; - initVirtMem.writeBlob(sentry_base, - (uint8_t*)&sentry_NULL, sentry_size); + initVirtMem.writeBlob(sentry_base, &sentry_NULL, sentry_size); //Fix up the aux vectors which point to other data for (int i = auxv.size() - 1; i >= 0; i--) { @@ -446,7 +445,7 @@ ArmProcess::argsInit(int pageSize, IntRegIndex spIndex) copyStringArray(envp, envp_array_base, env_data_base, initVirtMem); copyStringArray(argv, argv_array_base, arg_data_base, initVirtMem); - initVirtMem.writeBlob(argc_base, (uint8_t*)&guestArgc, intSize); + initVirtMem.writeBlob(argc_base, &guestArgc, intSize); ThreadContext *tc = system->getThreadContext(contextIds[0]); //Set the stack pointer register diff --git a/src/arch/arm/semihosting.cc b/src/arch/arm/semihosting.cc index 2b769ef2d..e04f4199d 100644 --- a/src/arch/arm/semihosting.cc +++ b/src/arch/arm/semihosting.cc @@ -272,7 +272,7 @@ ArmSemihosting::readString(ThreadContext *tc, Addr ptr, size_t len) std::vector buf(len + 1); buf[len] = '\0'; - physProxy(tc).readBlob(ptr, (uint8_t *)buf.data(), len); + physProxy(tc).readBlob(ptr, buf.data(), len); return std::string(buf.data()); } @@ -479,8 +479,7 @@ ArmSemihosting::callTmpNam(ThreadContext *tc, bool aarch64, if (path_len >= max_len) return retError(ENOSPC); - physProxy(tc).writeBlob( - guest_buf, (const uint8_t *)path, path_len + 1); + physProxy(tc).writeBlob(guest_buf, path, path_len + 1); return retOK(0); } @@ -551,9 +550,7 @@ ArmSemihosting::callGetCmdLine(ThreadContext *tc, bool aarch64, if (cmdLine.size() + 1 < argv[2]) { PortProxy &proxy = physProxy(tc); ByteOrder endian = ArmISA::byteOrder(tc); - proxy.writeBlob( - (Addr)argv[1], - (const uint8_t *)cmdLine.c_str(), cmdLine.size() + 1); + proxy.writeBlob((Addr)argv[1], cmdLine.c_str(), cmdLine.size() + 1); if (aarch64) proxy.write(argv[0] + 1 * 8, cmdLine.size(), endian); diff --git a/src/arch/generic/linux/threadinfo.hh b/src/arch/generic/linux/threadinfo.hh index 89db36a30..1595da499 100644 --- a/src/arch/generic/linux/threadinfo.hh +++ b/src/arch/generic/linux/threadinfo.hh @@ -87,7 +87,7 @@ class ThreadInfo addr = tc->readMiscRegNoEffect(TheISA::CurThreadInfoReg); PortProxy &p = tc->getPhysProxy(); - p.readBlob(addr, (uint8_t *)&sp, sizeof(Addr)); + p.readBlob(addr, &sp, sizeof(Addr)); return sp & ~ULL(0x3fff); } diff --git a/src/arch/mips/process.cc b/src/arch/mips/process.cc index d8378725c..fb78cee24 100644 --- a/src/arch/mips/process.cc +++ b/src/arch/mips/process.cc @@ -170,7 +170,7 @@ MipsProcess::argsInit(int pageSize) argc = htog((IntType)argc); - initVirtMem.writeBlob(memState->getStackMin(), (uint8_t*)&argc, intSize); + initVirtMem.writeBlob(memState->getStackMin(), &argc, intSize); copyStringArray(argv, argv_array_base, arg_data_base, initVirtMem); diff --git a/src/arch/power/process.cc b/src/arch/power/process.cc index 1d082c77e..6362027de 100644 --- a/src/arch/power/process.cc +++ b/src/arch/power/process.cc @@ -233,8 +233,7 @@ PowerProcess::argsInit(int intSize, int pageSize) //Write out the sentry void * uint32_t sentry_NULL = 0; - initVirtMem.writeBlob(sentry_base, - (uint8_t*)&sentry_NULL, sentry_size); + initVirtMem.writeBlob(sentry_base, &sentry_NULL, sentry_size); //Fix up the aux vectors which point to other data for (int i = auxv.size() - 1; i >= 0; i--) { @@ -261,7 +260,7 @@ PowerProcess::argsInit(int intSize, int pageSize) copyStringArray(envp, envp_array_base, env_data_base, initVirtMem); copyStringArray(argv, argv_array_base, arg_data_base, initVirtMem); - initVirtMem.writeBlob(argc_base, (uint8_t*)&guestArgc, intSize); + initVirtMem.writeBlob(argc_base, &guestArgc, intSize); ThreadContext *tc = system->getThreadContext(contextIds[0]); diff --git a/src/arch/sparc/process.cc b/src/arch/sparc/process.cc index 3419e0970..3bd3ea0bf 100644 --- a/src/arch/sparc/process.cc +++ b/src/arch/sparc/process.cc @@ -364,8 +364,7 @@ SparcProcess::argsInit(int pageSize) // Write out the sentry void * uint64_t sentry_NULL = 0; - initVirtMem.writeBlob(sentry_base, - (uint8_t*)&sentry_NULL, sentry_size); + initVirtMem.writeBlob(sentry_base, &sentry_NULL, sentry_size); // Write the file name initVirtMem.writeString(file_name_base, filename.c_str()); @@ -385,7 +384,7 @@ SparcProcess::argsInit(int pageSize) copyStringArray(envp, envp_array_base, env_data_base, initVirtMem); copyStringArray(argv, argv_array_base, arg_data_base, initVirtMem); - initVirtMem.writeBlob(argc_base, (uint8_t*)&guestArgc, intSize); + initVirtMem.writeBlob(argc_base, &guestArgc, intSize); // Set up space for the trap handlers into the processes address space. // Since the stack grows down and there is reserved address space abov @@ -417,9 +416,9 @@ Sparc64Process::argsInit(int intSize, int pageSize) // Stuff the trap handlers into the process address space initVirtMem.writeBlob(fillStart, - (uint8_t*)fillHandler64, sizeof(MachInst) * numFillInsts); + fillHandler64, sizeof(MachInst) * numFillInsts); initVirtMem.writeBlob(spillStart, - (uint8_t*)spillHandler64, sizeof(MachInst) * numSpillInsts); + spillHandler64, sizeof(MachInst) * numSpillInsts); } void @@ -429,9 +428,9 @@ Sparc32Process::argsInit(int intSize, int pageSize) // Stuff the trap handlers into the process address space initVirtMem.writeBlob(fillStart, - (uint8_t*)fillHandler32, sizeof(MachInst) * numFillInsts); + fillHandler32, sizeof(MachInst) * numFillInsts); initVirtMem.writeBlob(spillStart, - (uint8_t*)spillHandler32, sizeof(MachInst) * numSpillInsts); + spillHandler32, sizeof(MachInst) * numSpillInsts); } void Sparc32Process::flushWindows(ThreadContext *tc) diff --git a/src/arch/x86/bios/e820.cc b/src/arch/x86/bios/e820.cc index a1daf0a04..6cb16c995 100644 --- a/src/arch/x86/bios/e820.cc +++ b/src/arch/x86/bios/e820.cc @@ -50,7 +50,7 @@ template void writeVal(T val, PortProxy& proxy, Addr &addr) { T guestVal = htog(val); - proxy.writeBlob(addr, (uint8_t *)&guestVal, sizeof(T)); + proxy.writeBlob(addr, &guestVal, sizeof(T)); addr += sizeof(T); } @@ -64,7 +64,7 @@ void X86ISA::E820Table::writeTo(PortProxy& proxy, Addr countAddr, Addr addr) uint8_t guestE820Nr = htog(e820Nr); - proxy.writeBlob(countAddr, (uint8_t *)&guestE820Nr, sizeof(guestE820Nr)); + proxy.writeBlob(countAddr, &guestE820Nr, sizeof(guestE820Nr)); for (int i = 0; i < e820Nr; i++) { writeVal(entries[i]->addr, proxy, addr); diff --git a/src/arch/x86/bios/intelmp.cc b/src/arch/x86/bios/intelmp.cc index 07d2f1333..a9da25a8a 100644 --- a/src/arch/x86/bios/intelmp.cc +++ b/src/arch/x86/bios/intelmp.cc @@ -74,7 +74,7 @@ uint8_t writeOutField(PortProxy& proxy, Addr addr, T val) { uint64_t guestVal = X86ISA::htog(val); - proxy.writeBlob(addr, (uint8_t *)(&guestVal), sizeof(T)); + proxy.writeBlob(addr, &guestVal, sizeof(T)); uint8_t checkSum = 0; while (guestVal) { @@ -98,7 +98,7 @@ writeOutString(PortProxy& proxy, Addr addr, string str, int length) memcpy(cleanedString, str.c_str(), str.length()); memset(cleanedString + str.length(), 0, length - str.length()); } - proxy.writeBlob(addr, (uint8_t *)(&cleanedString), length); + proxy.writeBlob(addr, &cleanedString, length); uint8_t checkSum = 0; for (int i = 0; i < length; i++) @@ -121,7 +121,7 @@ X86ISA::IntelMP::FloatingPointer::writeOut(PortProxy& proxy, Addr addr) uint8_t checkSum = 0; - proxy.writeBlob(addr, (uint8_t *)signature, 4); + proxy.writeBlob(addr, signature, 4); for (int i = 0; i < 4; i++) checkSum += signature[i]; @@ -194,13 +194,13 @@ X86ISA::IntelMP::ConfigTable::writeOut(PortProxy& proxy, Addr addr) { uint8_t checkSum = 0; - proxy.writeBlob(addr, (uint8_t *)signature, 4); + proxy.writeBlob(addr, signature, 4); for (int i = 0; i < 4; i++) checkSum += signature[i]; // Base table length goes here but will be calculated later. - proxy.writeBlob(addr + 6, (uint8_t *)(&specRev), 1); + proxy.writeBlob(addr + 6, &specRev, 1); checkSum += specRev; // The checksum goes here but is still being calculated. @@ -272,8 +272,8 @@ X86ISA::IntelMP::Processor::writeOut( checkSum += writeOutField(proxy, addr + 8, featureFlags); uint32_t reserved = 0; - proxy.writeBlob(addr + 12, (uint8_t *)(&reserved), 4); - proxy.writeBlob(addr + 16, (uint8_t *)(&reserved), 4); + proxy.writeBlob(addr + 12, &reserved, 4); + proxy.writeBlob(addr + 16, &reserved, 4); return 20; } @@ -414,7 +414,7 @@ X86ISA::IntelMP::BusHierarchy::writeOut( checkSum += writeOutField(proxy, addr + 4, parentBus); uint32_t reserved = 0; - proxy.writeBlob(addr + 5, (uint8_t *)(&reserved), 3); + proxy.writeBlob(addr + 5, &reserved, 3); return length; } diff --git a/src/arch/x86/bios/smbios.cc b/src/arch/x86/bios/smbios.cc index 26785f5a8..cd91d2d02 100644 --- a/src/arch/x86/bios/smbios.cc +++ b/src/arch/x86/bios/smbios.cc @@ -77,13 +77,13 @@ composeBitVector(T vec) uint16_t X86ISA::SMBios::SMBiosStructure::writeOut(PortProxy& proxy, Addr addr) { - proxy.writeBlob(addr, (uint8_t *)(&type), 1); + proxy.writeBlob(addr, &type, 1); uint8_t length = getLength(); - proxy.writeBlob(addr + 1, (uint8_t *)(&length), 1); + proxy.writeBlob(addr + 1, &length, 1); uint16_t handleGuest = X86ISA::htog(handle); - proxy.writeBlob(addr + 2, (uint8_t *)(&handleGuest), 2); + proxy.writeBlob(addr + 2, &handleGuest, 2); return length + getStringLength(); } @@ -104,16 +104,15 @@ X86ISA::SMBios::SMBiosStructure::writeOutStrings( // If there are string fields but none of them are used, that's a // special case which is handled by this if. if (strings.size() == 0 && stringFields) { - proxy.writeBlob(addr + offset, (uint8_t *)(&nullTerminator), 1); + proxy.writeBlob(addr + offset, &nullTerminator, 1); offset++; } else { for (it = strings.begin(); it != strings.end(); it++) { - proxy.writeBlob(addr + offset, - (uint8_t *)it->c_str(), it->length() + 1); + proxy.writeBlob(addr + offset, it->c_str(), it->length() + 1); offset += it->length() + 1; } } - proxy.writeBlob(addr + offset, (uint8_t *)(&nullTerminator), 1); + proxy.writeBlob(addr + offset, &nullTerminator, 1); } int @@ -177,26 +176,26 @@ X86ISA::SMBios::BiosInformation::writeOut(PortProxy& proxy, Addr addr) { uint8_t size = SMBiosStructure::writeOut(proxy, addr); - proxy.writeBlob(addr + 0x4, (uint8_t *)(&vendor), 1); - proxy.writeBlob(addr + 0x5, (uint8_t *)(&version), 1); + proxy.writeBlob(addr + 0x4, &vendor, 1); + proxy.writeBlob(addr + 0x5, &version, 1); uint16_t startingAddrSegmentGuest = X86ISA::htog(startingAddrSegment); - proxy.writeBlob(addr + 0x6, (uint8_t *)(&startingAddrSegmentGuest), 2); + proxy.writeBlob(addr + 0x6, &startingAddrSegmentGuest, 2); - proxy.writeBlob(addr + 0x8, (uint8_t *)(&releaseDate), 1); - proxy.writeBlob(addr + 0x9, (uint8_t *)(&romSize), 1); + proxy.writeBlob(addr + 0x8, &releaseDate, 1); + proxy.writeBlob(addr + 0x9, &romSize, 1); uint64_t characteristicsGuest = X86ISA::htog(characteristics); - proxy.writeBlob(addr + 0xA, (uint8_t *)(&characteristicsGuest), 8); + proxy.writeBlob(addr + 0xA, &characteristicsGuest, 8); uint16_t characteristicExtBytesGuest = X86ISA::htog(characteristicExtBytes); - proxy.writeBlob(addr + 0x12, (uint8_t *)(&characteristicExtBytesGuest), 2); + proxy.writeBlob(addr + 0x12, &characteristicExtBytesGuest, 2); - proxy.writeBlob(addr + 0x14, (uint8_t *)(&majorVer), 1); - proxy.writeBlob(addr + 0x15, (uint8_t *)(&minorVer), 1); - proxy.writeBlob(addr + 0x16, (uint8_t *)(&embContFirmwareMajor), 1); - proxy.writeBlob(addr + 0x17, (uint8_t *)(&embContFirmwareMinor), 1); + proxy.writeBlob(addr + 0x14, &majorVer, 1); + proxy.writeBlob(addr + 0x15, &minorVer, 1); + proxy.writeBlob(addr + 0x16, &embContFirmwareMajor, 1); + proxy.writeBlob(addr + 0x17, &embContFirmwareMinor, 1); writeOutStrings(proxy, addr + getLength()); @@ -231,21 +230,16 @@ X86ISA::SMBios::SMBiosTable::writeOut(PortProxy& proxy, Addr addr, // The checksum goes here, but we're figuring it out as we go. - proxy.writeBlob(addr + 0x5, - (uint8_t *)(&smbiosHeader.entryPointLength), 1); + proxy.writeBlob(addr + 0x5, &smbiosHeader.entryPointLength, 1); mainChecksum += smbiosHeader.entryPointLength; - proxy.writeBlob(addr + 0x6, - (uint8_t *)(&smbiosHeader.majorVersion), 1); + proxy.writeBlob(addr + 0x6, &smbiosHeader.majorVersion, 1); mainChecksum += smbiosHeader.majorVersion; - proxy.writeBlob(addr + 0x7, - (uint8_t *)(&smbiosHeader.minorVersion), 1); + proxy.writeBlob(addr + 0x7, &smbiosHeader.minorVersion, 1); mainChecksum += smbiosHeader.minorVersion; // Maximum structure size goes here, but we'll figure it out later. - proxy.writeBlob(addr + 0xA, - (uint8_t *)(&smbiosHeader.entryPointRevision), 1); + proxy.writeBlob(addr + 0xA, &smbiosHeader.entryPointRevision, 1); mainChecksum += smbiosHeader.entryPointRevision; - proxy.writeBlob(addr + 0xB, - (uint8_t *)(&smbiosHeader.formattedArea), 5); + proxy.writeBlob(addr + 0xB, &smbiosHeader.formattedArea, 5); for (int i = 0; i < 5; i++) mainChecksum += smbiosHeader.formattedArea[i]; @@ -255,7 +249,7 @@ X86ISA::SMBios::SMBiosTable::writeOut(PortProxy& proxy, Addr addr, uint8_t intChecksum = 0; proxy.writeBlob(addr + 0x10, - (uint8_t *)smbiosHeader.intermediateHeader.anchorString, 5); + smbiosHeader.intermediateHeader.anchorString, 5); for (int i = 0; i < 5; i++) intChecksum += smbiosHeader.intermediateHeader.anchorString[i]; @@ -264,22 +258,21 @@ X86ISA::SMBios::SMBiosTable::writeOut(PortProxy& proxy, Addr addr, uint32_t tableAddrGuest = X86ISA::htog(smbiosHeader.intermediateHeader.tableAddr); - proxy.writeBlob(addr + 0x18, (uint8_t *)(&tableAddrGuest), 4); + proxy.writeBlob(addr + 0x18, &tableAddrGuest, 4); for (int i = 0; i < 4; i++) { intChecksum += tableAddrGuest; tableAddrGuest >>= 8; } uint16_t numStructs = X86ISA::gtoh(structures.size()); - proxy.writeBlob(addr + 0x1C, (uint8_t *)(&numStructs), 2); + proxy.writeBlob(addr + 0x1C, &numStructs, 2); for (int i = 0; i < 2; i++) { intChecksum += numStructs; numStructs >>= 8; } proxy.writeBlob(addr + 0x1E, - (uint8_t *)(&smbiosHeader.intermediateHeader.smbiosBCDRevision), - 1); + &smbiosHeader.intermediateHeader.smbiosBCDRevision, 1); intChecksum += smbiosHeader.intermediateHeader.smbiosBCDRevision; /* @@ -304,7 +297,7 @@ X86ISA::SMBios::SMBiosTable::writeOut(PortProxy& proxy, Addr addr, */ maxSize = X86ISA::htog(maxSize); - proxy.writeBlob(addr + 0x8, (uint8_t *)(&maxSize), 2); + proxy.writeBlob(addr + 0x8, &maxSize, 2); for (int i = 0; i < 2; i++) { mainChecksum += maxSize; maxSize >>= 8; @@ -312,7 +305,7 @@ X86ISA::SMBios::SMBiosTable::writeOut(PortProxy& proxy, Addr addr, // Set the checksum mainChecksum = -mainChecksum; - proxy.writeBlob(addr + 0x4, (uint8_t *)(&mainChecksum), 1); + proxy.writeBlob(addr + 0x4, &mainChecksum, 1); /* * Intermediate header @@ -320,14 +313,14 @@ X86ISA::SMBios::SMBiosTable::writeOut(PortProxy& proxy, Addr addr, uint16_t tableSize = offset; tableSize = X86ISA::htog(tableSize); - proxy.writeBlob(addr + 0x16, (uint8_t *)(&tableSize), 2); + proxy.writeBlob(addr + 0x16, &tableSize, 2); for (int i = 0; i < 2; i++) { intChecksum += tableSize; tableSize >>= 8; } intChecksum = -intChecksum; - proxy.writeBlob(addr + 0x15, (uint8_t *)(&intChecksum), 1); + proxy.writeBlob(addr + 0x15, &intChecksum, 1); } X86ISA::SMBios::BiosInformation * diff --git a/src/arch/x86/linux/system.cc b/src/arch/x86/linux/system.cc index fc5bc2d25..04ab023b8 100644 --- a/src/arch/x86/linux/system.cc +++ b/src/arch/x86/linux/system.cc @@ -80,14 +80,14 @@ LinuxX86System::initState() if (commandLine.length() + 1 > realModeData - commandLineBuff) panic("Command line \"%s\" is longer than %d characters.\n", commandLine, realModeData - commandLineBuff - 1); - physProxy.writeBlob(commandLineBuff, (uint8_t *)commandLine.c_str(), + physProxy.writeBlob(commandLineBuff, commandLine.c_str(), commandLine.length() + 1); // Generate a pointer of the right size and endianness to put into // commandLinePointer. uint32_t guestCommandLineBuff = X86ISA::htog((uint32_t)commandLineBuff); - physProxy.writeBlob(commandLinePointer, (uint8_t *)&guestCommandLineBuff, + physProxy.writeBlob(commandLinePointer, &guestCommandLineBuff, sizeof(guestCommandLineBuff)); /* diff --git a/src/arch/x86/process.cc b/src/arch/x86/process.cc index f4469bd02..0765adea5 100644 --- a/src/arch/x86/process.cc +++ b/src/arch/x86/process.cc @@ -239,7 +239,7 @@ X86_64Process::initState() uint8_t numGDTEntries = 0; uint64_t nullDescriptor = 0; physProxy.writeBlob(gdtPhysAddr + numGDTEntries * 8, - (uint8_t *)(&nullDescriptor), 8); + &nullDescriptor, 8); numGDTEntries++; SegDescriptor initDesc = 0; @@ -260,7 +260,7 @@ X86_64Process::initState() csLowPLDesc.dpl = 0; uint64_t csLowPLDescVal = csLowPLDesc; physProxy.writeBlob(gdtPhysAddr + numGDTEntries * 8, - (uint8_t *)(&csLowPLDescVal), 8); + &csLowPLDescVal, 8); numGDTEntries++; @@ -274,7 +274,7 @@ X86_64Process::initState() dsLowPLDesc.dpl = 0; uint64_t dsLowPLDescVal = dsLowPLDesc; physProxy.writeBlob(gdtPhysAddr + numGDTEntries * 8, - (uint8_t *)(&dsLowPLDescVal), 8); + &dsLowPLDescVal, 8); numGDTEntries++; @@ -288,7 +288,7 @@ X86_64Process::initState() dsDesc.dpl = 3; uint64_t dsDescVal = dsDesc; physProxy.writeBlob(gdtPhysAddr + numGDTEntries * 8, - (uint8_t *)(&dsDescVal), 8); + &dsDescVal, 8); numGDTEntries++; @@ -302,7 +302,7 @@ X86_64Process::initState() csDesc.dpl = 3; uint64_t csDescVal = csDesc; physProxy.writeBlob(gdtPhysAddr + numGDTEntries * 8, - (uint8_t *)(&csDescVal), 8); + &csDescVal, 8); numGDTEntries++; @@ -335,7 +335,7 @@ X86_64Process::initState() } tssDescVal = {TSSDescLow, TSSDescHigh}; physProxy.writeBlob(gdtPhysAddr + numGDTEntries * 8, - (uint8_t *)(&tssDescVal), sizeof(tssDescVal)); + &tssDescVal, sizeof(tssDescVal)); numGDTEntries++; @@ -500,7 +500,7 @@ X86_64Process::initState() tss.RSP1_high = tss.IST1_high; tss.RSP2_low = tss.IST1_low; tss.RSP2_high = tss.IST1_high; - physProxy.writeBlob(tssPhysAddr, (uint8_t *)(&tss), sizeof(tss)); + physProxy.writeBlob(tssPhysAddr, &tss, sizeof(tss)); /* Setting IDT gates */ GateDescriptorLow PFGateLow = 0; @@ -520,8 +520,7 @@ X86_64Process::initState() uint64_t high; } PFGate = {PFGateLow, PFGateHigh}; - physProxy.writeBlob(idtPhysAddr + 0xE0, - (uint8_t *)(&PFGate), sizeof(PFGate)); + physProxy.writeBlob(idtPhysAddr + 0xE0, &PFGate, sizeof(PFGate)); /* System call handler */ uint8_t syscallBlob[] = { @@ -999,7 +998,7 @@ X86Process::argsInit(int pageSize, // Write out the sentry void * IntType sentry_NULL = 0; - initVirtMem.writeBlob(sentry_base, (uint8_t*)&sentry_NULL, sentry_size); + initVirtMem.writeBlob(sentry_base, &sentry_NULL, sentry_size); // Write the file name initVirtMem.writeString(file_name_base, filename.c_str()); @@ -1029,7 +1028,7 @@ X86Process::argsInit(int pageSize, copyStringArray(envp, envp_array_base, env_data_base, initVirtMem); copyStringArray(argv, argv_array_base, arg_data_base, initVirtMem); - initVirtMem.writeBlob(argc_base, (uint8_t*)&guestArgc, intSize); + initVirtMem.writeBlob(argc_base, &guestArgc, intSize); ThreadContext *tc = system->getThreadContext(contextIds[0]); // Set the stack pointer register diff --git a/src/arch/x86/pseudo_inst.cc b/src/arch/x86/pseudo_inst.cc index 90000b808..fc71af118 100644 --- a/src/arch/x86/pseudo_inst.cc +++ b/src/arch/x86/pseudo_inst.cc @@ -73,8 +73,8 @@ m5PageFault(ThreadContext *tc) int size = 6; uint64_t is[size]; // reading the interrupt handler stack - proxy.readBlob(ISTVirtAddr + PageBytes - size*sizeof(uint64_t), - (uint8_t *)&is, sizeof(is)); + proxy.readBlob(ISTVirtAddr + PageBytes - size * sizeof(uint64_t), + &is, sizeof(is)); panic("Page fault at addr %#x\n\tInterrupt handler stack:\n" "\tss: %#x\n" "\trsp: %#x\n" diff --git a/src/arch/x86/system.cc b/src/arch/x86/system.cc index 3f44ece3a..2af9ff53c 100644 --- a/src/arch/x86/system.cc +++ b/src/arch/x86/system.cc @@ -141,8 +141,7 @@ X86System::initState() uint8_t numGDTEntries = 0; // Place holder at selector 0 uint64_t nullDescriptor = 0; - physProxy.writeBlob(GDTBase + numGDTEntries * 8, - (uint8_t *)(&nullDescriptor), 8); + physProxy.writeBlob(GDTBase + numGDTEntries * 8, &nullDescriptor, 8); numGDTEntries++; SegDescriptor initDesc = 0; @@ -167,8 +166,7 @@ X86System::initState() // it's beginning in memory and it's actual data, we'll use an // intermediary. uint64_t csDescVal = csDesc; - physProxy.writeBlob(GDTBase + numGDTEntries * 8, - (uint8_t *)(&csDescVal), 8); + physProxy.writeBlob(GDTBase + numGDTEntries * 8, (&csDescVal), 8); numGDTEntries++; @@ -180,8 +178,7 @@ X86System::initState() // 32 bit data segment SegDescriptor dsDesc = initDesc; uint64_t dsDescVal = dsDesc; - physProxy.writeBlob(GDTBase + numGDTEntries * 8, - (uint8_t *)(&dsDescVal), 8); + physProxy.writeBlob(GDTBase + numGDTEntries * 8, (&dsDescVal), 8); numGDTEntries++; @@ -200,8 +197,7 @@ X86System::initState() SegDescriptor tssDesc = initDesc; uint64_t tssDescVal = tssDesc; - physProxy.writeBlob(GDTBase + numGDTEntries * 8, - (uint8_t *)(&tssDescVal), 8); + physProxy.writeBlob(GDTBase + numGDTEntries * 8, (&tssDescVal), 8); numGDTEntries++; @@ -230,25 +226,22 @@ X86System::initState() // read/write, user, not present uint64_t pml4e = X86ISA::htog(0x6); for (int offset = 0; offset < (1 << PML4Bits) * 8; offset += 8) { - physProxy.writeBlob(PageMapLevel4 + offset, (uint8_t *)(&pml4e), 8); + physProxy.writeBlob(PageMapLevel4 + offset, (&pml4e), 8); } // Point to the only PDPT pml4e = X86ISA::htog(0x7 | PageDirPtrTable); - physProxy.writeBlob(PageMapLevel4, (uint8_t *)(&pml4e), 8); + physProxy.writeBlob(PageMapLevel4, (&pml4e), 8); // Page Directory Pointer Table // read/write, user, not present uint64_t pdpe = X86ISA::htog(0x6); - for (int offset = 0; offset < (1 << PDPTBits) * 8; offset += 8) { - physProxy.writeBlob(PageDirPtrTable + offset, - (uint8_t *)(&pdpe), 8); - } + for (int offset = 0; offset < (1 << PDPTBits) * 8; offset += 8) + physProxy.writeBlob(PageDirPtrTable + offset, &pdpe, 8); // Point to the PDTs for (int table = 0; table < NumPDTs; table++) { pdpe = X86ISA::htog(0x7 | PageDirTable[table]); - physProxy.writeBlob(PageDirPtrTable + table * 8, - (uint8_t *)(&pdpe), 8); + physProxy.writeBlob(PageDirPtrTable + table * 8, &pdpe, 8); } // Page Directory Tables @@ -259,8 +252,7 @@ X86System::initState() for (int offset = 0; offset < (1 << PDTBits) * 8; offset += 8) { // read/write, user, present, 4MB uint64_t pdte = X86ISA::htog(0x87 | base); - physProxy.writeBlob(PageDirTable[table] + offset, - (uint8_t *)(&pdte), 8); + physProxy.writeBlob(PageDirTable[table] + offset, &pdte, 8); base += pageSize; } } diff --git a/src/base/loader/hex_file.cc b/src/base/loader/hex_file.cc index c80343961..32de90588 100644 --- a/src/base/loader/hex_file.cc +++ b/src/base/loader/hex_file.cc @@ -74,7 +74,7 @@ HexFile::loadSections(PortProxy& memProxy) parseLine(Line, &MemAddr, &Data); if (MemAddr != 0) { // Now, write to memory - memProxy.writeBlob(MemAddr << 2, (uint8_t *)&Data, sizeof(Data)); + memProxy.writeBlob(MemAddr << 2, &Data, sizeof(Data)); } } return true; diff --git a/src/base/remote_gdb.cc b/src/base/remote_gdb.cc index d620665b6..c092620a9 100644 --- a/src/base/remote_gdb.cc +++ b/src/base/remote_gdb.cc @@ -626,10 +626,10 @@ BaseRemoteGDB::read(Addr vaddr, size_t size, char *data) if (FullSystem) { FSTranslatingPortProxy &proxy = tc->getVirtProxy(); - proxy.readBlob(vaddr, (uint8_t*)data, size); + proxy.readBlob(vaddr, data, size); } else { SETranslatingPortProxy &proxy = tc->getMemProxy(); - proxy.readBlob(vaddr, (uint8_t*)data, size); + proxy.readBlob(vaddr, data, size); } #if TRACING_ON @@ -669,10 +669,10 @@ BaseRemoteGDB::write(Addr vaddr, size_t size, const char *data) } if (FullSystem) { FSTranslatingPortProxy &proxy = tc->getVirtProxy(); - proxy.writeBlob(vaddr, (uint8_t*)data, size); + proxy.writeBlob(vaddr, data, size); } else { SETranslatingPortProxy &proxy = tc->getMemProxy(); - proxy.writeBlob(vaddr, (uint8_t*)data, size); + proxy.writeBlob(vaddr, data, size); } return true; diff --git a/src/dev/alpha/tsunami_pchip.cc b/src/dev/alpha/tsunami_pchip.cc index bf172209a..260d191ae 100644 --- a/src/dev/alpha/tsunami_pchip.cc +++ b/src/dev/alpha/tsunami_pchip.cc @@ -283,14 +283,16 @@ TsunamiPChip::dmaAddr(const PciBusAddr &dev, Addr busAddr) const to create an address for the SG page */ - tbaMask = ~(((wsm[i] & (ULL(0xfff) << 20)) >> 10) | ULL(0x3ff)); + tbaMask = ~(((wsm[i] & (ULL(0xfff) << 20)) >> 10) | + ULL(0x3ff)); baMask = (wsm[i] & (ULL(0xfff) << 20)) | (ULL(0x7f) << 13); pteAddr = (tba[i] & tbaMask) | ((busAddr & baMask) >> 10); - sys->physProxy.readBlob(pteAddr, (uint8_t*)&pteEntry, + sys->physProxy.readBlob(pteAddr, &pteEntry, sizeof(uint64_t)); - dmaAddr = ((pteEntry & ~ULL(0x1)) << 12) | (busAddr & ULL(0x1fff)); + dmaAddr = ((pteEntry & ~ULL(0x1)) << 12) | + (busAddr & ULL(0x1fff)); } else { baMask = (wsm[i] & (ULL(0xfff) << 20)) | ULL(0xfffff); diff --git a/src/dev/arm/gic_v3_redistributor.cc b/src/dev/arm/gic_v3_redistributor.cc index de6bd6389..37f169f19 100644 --- a/src/dev/arm/gic_v3_redistributor.cc +++ b/src/dev/arm/gic_v3_redistributor.cc @@ -815,11 +815,11 @@ Gicv3Redistributor::update() uint8_t lpi_config_table[number_lpis]; memProxy->readBlob(lpiPendingTablePtr, - (uint8_t *) lpi_pending_table, + lpi_pending_table, sizeof(lpi_pending_table)); memProxy->readBlob(lpiConfigurationTablePtr, - (uint8_t*) lpi_config_table, + lpi_config_table, sizeof(lpi_config_table)); for (int lpi_id = SMALLEST_LPI_ID; lpi_id < largest_lpi_id; @@ -869,7 +869,7 @@ Gicv3Redistributor::readEntryLPI(uint32_t lpi_id) uint8_t lpi_pending_entry; memProxy->readBlob(lpi_pending_entry_ptr, - (uint8_t*) &lpi_pending_entry, + &lpi_pending_entry, sizeof(lpi_pending_entry)); return lpi_pending_entry; @@ -881,7 +881,7 @@ Gicv3Redistributor::writeEntryLPI(uint32_t lpi_id, uint8_t lpi_pending_entry) Addr lpi_pending_entry_ptr = lpiPendingTablePtr + (lpi_id / 8); memProxy->writeBlob(lpi_pending_entry_ptr, - (uint8_t*) &lpi_pending_entry, + &lpi_pending_entry, sizeof(lpi_pending_entry)); } diff --git a/src/dev/virtio/base.cc b/src/dev/virtio/base.cc index 61dd3069f..347f5089f 100644 --- a/src/dev/virtio/base.cc +++ b/src/dev/virtio/base.cc @@ -81,7 +81,7 @@ VirtDescriptor::update() assert(_index < queue->getSize()); const Addr desc_addr(vq_addr + sizeof(desc) * _index); vring_desc guest_desc; - memProxy->readBlob(desc_addr, (uint8_t *)&guest_desc, sizeof(guest_desc)); + memProxy->readBlob(desc_addr, &guest_desc, sizeof(guest_desc)); desc = vtoh_legacy(guest_desc); DPRINTF(VIO, "VirtDescriptor(%i): Addr: 0x%x, Len: %i, Flags: 0x%x, " @@ -161,7 +161,7 @@ VirtDescriptor::write(size_t offset, const uint8_t *src, size_t size) if (!isOutgoing()) panic("Trying to write to incoming buffer\n"); - memProxy->writeBlob(desc.addr + offset, const_cast(src), size); + memProxy->writeBlob(desc.addr + offset, src, size); } void diff --git a/src/dev/virtio/base.hh b/src/dev/virtio/base.hh index ed3b1b431..f4c85afec 100644 --- a/src/dev/virtio/base.hh +++ b/src/dev/virtio/base.hh @@ -492,7 +492,7 @@ public: /** Update the ring buffer header with data from the guest. */ void readHeader() { assert(_base != 0); - _proxy.readBlob(_base, (uint8_t *)&header, sizeof(header)); + _proxy.readBlob(_base, &header, sizeof(header)); header.flags = vtoh_legacy(header.flags); header.index = vtoh_legacy(header.index); } @@ -502,7 +502,7 @@ public: assert(_base != 0); out.flags = htov_legacy(header.flags); out.index = htov_legacy(header.index); - _proxy.writeBlob(_base, (uint8_t *)&out, sizeof(out)); + _proxy.writeBlob(_base, &out, sizeof(out)); } void read() { @@ -511,7 +511,7 @@ public: /* Read and byte-swap the elements in the ring */ T temp[ring.size()]; _proxy.readBlob(_base + sizeof(header), - (uint8_t *)temp, sizeof(T) * ring.size()); + temp, sizeof(T) * ring.size()); for (int i = 0; i < ring.size(); ++i) ring[i] = vtoh_legacy(temp[i]); } @@ -524,7 +524,7 @@ public: for (int i = 0; i < ring.size(); ++i) temp[i] = htov_legacy(ring[i]); _proxy.writeBlob(_base + sizeof(header), - (uint8_t *)temp, sizeof(T) * ring.size()); + temp, sizeof(T) * ring.size()); writeHeader(); } diff --git a/src/sim/process_impl.hh b/src/sim/process_impl.hh index 3f3d6ae15..ae2a3b571 100644 --- a/src/sim/process_impl.hh +++ b/src/sim/process_impl.hh @@ -47,8 +47,7 @@ copyStringArray(std::vector &strings, AddrType data_ptr_swap; for (std::vector::size_type i = 0; i < strings.size(); ++i) { data_ptr_swap = TheISA::htog(data_ptr); - memProxy.writeBlob(array_ptr, (uint8_t*)&data_ptr_swap, - sizeof(AddrType)); + memProxy.writeBlob(array_ptr, &data_ptr_swap, sizeof(AddrType)); memProxy.writeString(data_ptr, strings[i].c_str()); array_ptr += sizeof(AddrType); data_ptr += strings[i].size() + 1; @@ -56,7 +55,7 @@ copyStringArray(std::vector &strings, // add NULL terminator data_ptr = 0; - memProxy.writeBlob(array_ptr, (uint8_t*)&data_ptr, sizeof(AddrType)); + memProxy.writeBlob(array_ptr, &data_ptr, sizeof(AddrType)); } #endif diff --git a/src/sim/syscall_emul.hh b/src/sim/syscall_emul.hh index 2230b62c0..dbbdf4734 100644 --- a/src/sim/syscall_emul.hh +++ b/src/sim/syscall_emul.hh @@ -1670,7 +1670,7 @@ readvFunc(SyscallDesc *desc, int callnum, ThreadContext *tc) struct iovec hiov[count]; for (size_t i = 0; i < count; ++i) { prox.readBlob(tiov_base + (i * sizeof(typename OS::tgt_iovec)), - (uint8_t*)&tiov[i], sizeof(typename OS::tgt_iovec)); + &tiov[i], sizeof(typename OS::tgt_iovec)); hiov[i].iov_len = TheISA::gtoh(tiov[i].iov_len); hiov[i].iov_base = new char [hiov[i].iov_len]; } @@ -1681,7 +1681,7 @@ readvFunc(SyscallDesc *desc, int callnum, ThreadContext *tc) for (size_t i = 0; i < count; ++i) { if (result != -1) { prox.writeBlob(TheISA::htog(tiov[i].iov_base), - (uint8_t*)hiov[i].iov_base, hiov[i].iov_len); + hiov[i].iov_base, hiov[i].iov_len); } delete [] (char *)hiov[i].iov_base; } @@ -1711,10 +1711,10 @@ writevFunc(SyscallDesc *desc, int callnum, ThreadContext *tc) typename OS::tgt_iovec tiov; prox.readBlob(tiov_base + i*sizeof(typename OS::tgt_iovec), - (uint8_t*)&tiov, sizeof(typename OS::tgt_iovec)); + &tiov, sizeof(typename OS::tgt_iovec)); hiov[i].iov_len = TheISA::gtoh(tiov.iov_len); hiov[i].iov_base = new char [hiov[i].iov_len]; - prox.readBlob(TheISA::gtoh(tiov.iov_base), (uint8_t *)hiov[i].iov_base, + prox.readBlob(TheISA::gtoh(tiov.iov_base), hiov[i].iov_base, hiov[i].iov_len); } @@ -2302,7 +2302,7 @@ timeFunc(SyscallDesc *desc, int callnum, ThreadContext *tc) typename OS::time_t t = sec; t = TheISA::htog(t); SETranslatingPortProxy &p = tc->getMemProxy(); - p.writeBlob(taddr, (uint8_t*)&t, (int)sizeof(typename OS::time_t)); + p.writeBlob(taddr, &t, (int)sizeof(typename OS::time_t)); } return sec; } -- 2.30.2