From 21fdd4290b07fdd164c905d0495e41ac442a6ce6 Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Sun, 23 Aug 2020 00:25:06 -0700 Subject: [PATCH] misc: Remove the "fault" parameter from syscall functions. This parameter was never set or used, just plumbed everywhere, occasionally with a dummy value. This change removes all of that plumbing. Change-Id: I9bc31ffd1fbc4952c5d3096f7f21eab30102300b Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/33277 Tested-by: kokoro Reviewed-by: Andreas Sandberg Maintainer: Andreas Sandberg --- src/arch/arm/fastmodel/iris/thread_context.hh | 2 +- src/arch/arm/faults.cc | 3 +-- src/arch/arm/freebsd/process.cc | 12 +++++----- src/arch/arm/freebsd/process.hh | 4 ++-- src/arch/arm/linux/process.cc | 12 +++++----- src/arch/arm/linux/process.hh | 4 ++-- src/arch/mips/isa/decoder.isa | 2 +- src/arch/mips/linux/process.cc | 6 ++--- src/arch/mips/linux/process.hh | 2 +- src/arch/power/isa/decoder.isa | 2 +- src/arch/power/linux/process.cc | 6 ++--- src/arch/power/linux/process.hh | 2 +- src/arch/riscv/faults.cc | 3 +-- src/arch/riscv/linux/process.cc | 12 +++++----- src/arch/riscv/linux/process.hh | 4 ++-- src/arch/sparc/faults.cc | 3 +-- src/arch/sparc/linux/process.cc | 24 +++++++++---------- src/arch/sparc/linux/process.hh | 8 +++---- src/arch/sparc/process.cc | 2 +- src/arch/sparc/process.hh | 2 +- src/arch/sparc/solaris/process.cc | 6 ++--- src/arch/sparc/solaris/process.hh | 2 +- src/arch/x86/isa/decoder/one_byte_opcodes.isa | 2 +- src/arch/x86/isa/decoder/two_byte_opcodes.isa | 4 ++-- src/arch/x86/linux/process.cc | 12 +++++----- src/arch/x86/linux/process.hh | 4 ++-- src/cpu/checker/cpu.hh | 2 +- src/cpu/checker/thread_context.hh | 6 +---- src/cpu/exec_context.hh | 2 +- src/cpu/minor/exec_context.hh | 6 +---- src/cpu/o3/cpu.cc | 4 ++-- src/cpu/o3/cpu.hh | 2 +- src/cpu/o3/dyn_inst.hh | 2 +- src/cpu/o3/dyn_inst_impl.hh | 4 ++-- src/cpu/o3/thread_context.hh | 4 ++-- src/cpu/o3/thread_state.hh | 5 +--- src/cpu/simple/exec_context.hh | 6 +---- src/cpu/simple_thread.hh | 6 +---- src/cpu/thread_context.hh | 2 +- src/sim/process.hh | 2 +- src/sim/pseudo_inst.cc | 3 +-- src/sim/syscall_desc.cc | 2 +- src/sim/syscall_desc.hh | 2 +- 43 files changed, 91 insertions(+), 114 deletions(-) diff --git a/src/arch/arm/fastmodel/iris/thread_context.hh b/src/arch/arm/fastmodel/iris/thread_context.hh index 363e1d706..dc5396952 100644 --- a/src/arch/arm/fastmodel/iris/thread_context.hh +++ b/src/arch/arm/fastmodel/iris/thread_context.hh @@ -445,7 +445,7 @@ class ThreadContext : public ::ThreadContext } void - syscall(Fault *fault) override + syscall() override { panic("%s not implemented.", __FUNCTION__); } diff --git a/src/arch/arm/faults.cc b/src/arch/arm/faults.cc index 5b865ecab..56e1814c6 100644 --- a/src/arch/arm/faults.cc +++ b/src/arch/arm/faults.cc @@ -865,8 +865,7 @@ SupervisorCall::invoke(ThreadContext *tc, const StaticInstPtr &inst) // As of now, there isn't a 32 bit thumb version of this instruction. assert(!machInst.bigThumb); - Fault fault; - tc->syscall(&fault); + tc->syscall(); // Advance the PC since that won't happen automatically. PCState pc = tc->pcState(); diff --git a/src/arch/arm/freebsd/process.cc b/src/arch/arm/freebsd/process.cc index d8a7d6836..4bf6bcca6 100644 --- a/src/arch/arm/freebsd/process.cc +++ b/src/arch/arm/freebsd/process.cc @@ -175,15 +175,15 @@ ArmFreebsdProcess64::initState() } void -ArmFreebsdProcess32::syscall(ThreadContext *tc, Fault *fault) +ArmFreebsdProcess32::syscall(ThreadContext *tc) { - ArmProcess32::syscall(tc, fault); - syscallDescs32.get(tc->readIntReg(INTREG_R7))->doSyscall(tc, fault); + ArmProcess32::syscall(tc); + syscallDescs32.get(tc->readIntReg(INTREG_R7))->doSyscall(tc); } void -ArmFreebsdProcess64::syscall(ThreadContext *tc, Fault *fault) +ArmFreebsdProcess64::syscall(ThreadContext *tc) { - ArmProcess64::syscall(tc, fault); - syscallDescs64.get(tc->readIntReg(INTREG_X8))->doSyscall(tc, fault); + ArmProcess64::syscall(tc); + syscallDescs64.get(tc->readIntReg(INTREG_X8))->doSyscall(tc); } diff --git a/src/arch/arm/freebsd/process.hh b/src/arch/arm/freebsd/process.hh index d52512a01..b64a3a06b 100644 --- a/src/arch/arm/freebsd/process.hh +++ b/src/arch/arm/freebsd/process.hh @@ -82,7 +82,7 @@ class ArmFreebsdProcess32 : public ArmProcess32, public ArmFreebsdProcessBits void initState() override; - void syscall(ThreadContext *tc, Fault *fault) override; + void syscall(ThreadContext *tc) override; /// A page to hold "kernel" provided functions. The name might be wrong. static const Addr commPage; @@ -100,7 +100,7 @@ class ArmFreebsdProcess64 : public ArmProcess64, public ArmFreebsdProcessBits ::Loader::Arch _arch); void initState() override; - void syscall(ThreadContext *tc, Fault *fault) override; + void syscall(ThreadContext *tc) override; struct SyscallABI : public ArmProcess64::SyscallABI, public ArmFreebsdProcessBits::SyscallABI diff --git a/src/arch/arm/linux/process.cc b/src/arch/arm/linux/process.cc index 65f1cd15e..c19016722 100644 --- a/src/arch/arm/linux/process.cc +++ b/src/arch/arm/linux/process.cc @@ -912,9 +912,9 @@ ArmLinuxProcess64::initState() } void -ArmLinuxProcess32::syscall(ThreadContext *tc, Fault *fault) +ArmLinuxProcess32::syscall(ThreadContext *tc) { - ArmProcess32::syscall(tc, fault); + ArmProcess32::syscall(tc); int num = tc->readIntReg(INTREG_R7); SyscallDesc *desc = syscallDescs32Low.get(num, false); @@ -922,13 +922,13 @@ ArmLinuxProcess32::syscall(ThreadContext *tc, Fault *fault) desc = syscallDescs32Low.get(num, false); if (!desc) desc = privSyscallDescs32.get(num); - desc->doSyscall(tc, fault); + desc->doSyscall(tc); } void -ArmLinuxProcess64::syscall(ThreadContext *tc, Fault *fault) +ArmLinuxProcess64::syscall(ThreadContext *tc) { - ArmProcess64::syscall(tc, fault); + ArmProcess64::syscall(tc); int num = tc->readIntReg(INTREG_X8); SyscallDesc *desc = syscallDescs64Low.get(num, false); @@ -936,5 +936,5 @@ ArmLinuxProcess64::syscall(ThreadContext *tc, Fault *fault) desc = syscallDescs64Low.get(num, false); if (!desc) desc = privSyscallDescs64.get(num); - desc->doSyscall(tc, fault); + desc->doSyscall(tc); } diff --git a/src/arch/arm/linux/process.hh b/src/arch/arm/linux/process.hh index 0c15c2802..21c2a293c 100644 --- a/src/arch/arm/linux/process.hh +++ b/src/arch/arm/linux/process.hh @@ -82,7 +82,7 @@ class ArmLinuxProcess32 : public ArmProcess32, public ArmLinuxProcessBits void initState() override; - void syscall(ThreadContext *tc, Fault *fault) override; + void syscall(ThreadContext *tc) override; /// A page to hold "kernel" provided functions. The name might be wrong. static const Addr commPage; @@ -100,7 +100,7 @@ class ArmLinuxProcess64 : public ArmProcess64, public ArmLinuxProcessBits ::Loader::Arch _arch); void initState() override; - void syscall(ThreadContext *tc, Fault *fault) override; + void syscall(ThreadContext *tc) override; struct SyscallABI : public ArmProcess64::SyscallABI, public ArmLinuxProcessBits::SyscallABI diff --git a/src/arch/mips/isa/decoder.isa b/src/arch/mips/isa/decoder.isa index 19a14999c..6e19f85d8 100644 --- a/src/arch/mips/isa/decoder.isa +++ b/src/arch/mips/isa/decoder.isa @@ -159,7 +159,7 @@ decode OPCODE_HI default Unknown::unknown() { 0x2: movz({{ Rd = (Rt == 0) ? Rs : Rd; }}); 0x3: movn({{ Rd = (Rt != 0) ? Rs : Rd; }}); 0x4: decode FullSystemInt { - 0: syscall_se({{ xc->syscall(&fault); }}, + 0: syscall_se({{ xc->syscall(); }}, IsSerializeAfter, IsNonSpeculative); default: syscall({{ fault = std::make_shared(); }}); } diff --git a/src/arch/mips/linux/process.cc b/src/arch/mips/linux/process.cc index 600d05363..3bc88dfea 100644 --- a/src/arch/mips/linux/process.cc +++ b/src/arch/mips/linux/process.cc @@ -476,8 +476,8 @@ MipsLinuxProcess::MipsLinuxProcess(ProcessParams * params, {} void -MipsLinuxProcess::syscall(ThreadContext *tc, Fault *fault) +MipsLinuxProcess::syscall(ThreadContext *tc) { - MipsProcess::syscall(tc, fault); - syscallDescs.get(tc->readIntReg(2))->doSyscall(tc, fault); + MipsProcess::syscall(tc); + syscallDescs.get(tc->readIntReg(2))->doSyscall(tc); } diff --git a/src/arch/mips/linux/process.hh b/src/arch/mips/linux/process.hh index ddf2a11c5..981526ca9 100644 --- a/src/arch/mips/linux/process.hh +++ b/src/arch/mips/linux/process.hh @@ -47,7 +47,7 @@ class MipsLinuxProcess : public MipsProcess /// ID of the thread group leader for the process uint64_t __tgid; - void syscall(ThreadContext *tc, Fault *fault) override; + void syscall(ThreadContext *tc) override; /// Syscall descriptors, indexed by call number. static SyscallDescTable syscallDescs; diff --git a/src/arch/power/isa/decoder.isa b/src/arch/power/isa/decoder.isa index ce9cbbabf..2e88aea7f 100644 --- a/src/arch/power/isa/decoder.isa +++ b/src/arch/power/isa/decoder.isa @@ -515,7 +515,7 @@ decode OPCODE default Unknown::unknown() { 55: stfdu({{ Mem_df = Fs; }}); } - 17: IntOp::sc({{ xc->syscall(&fault); }}, + 17: IntOp::sc({{ xc->syscall(); }}, [ IsSyscall, IsNonSpeculative, IsSerializeAfter ]); format FloatArithOp { diff --git a/src/arch/power/linux/process.cc b/src/arch/power/linux/process.cc index fd07947e9..633c3a76b 100644 --- a/src/arch/power/linux/process.cc +++ b/src/arch/power/linux/process.cc @@ -451,8 +451,8 @@ PowerLinuxProcess::initState() } void -PowerLinuxProcess::syscall(ThreadContext *tc, Fault *fault) +PowerLinuxProcess::syscall(ThreadContext *tc) { - PowerProcess::syscall(tc, fault); - syscallDescs.get(tc->readIntReg(0))->doSyscall(tc, fault); + PowerProcess::syscall(tc); + syscallDescs.get(tc->readIntReg(0))->doSyscall(tc); } diff --git a/src/arch/power/linux/process.hh b/src/arch/power/linux/process.hh index a81edfb9d..2c7883de8 100644 --- a/src/arch/power/linux/process.hh +++ b/src/arch/power/linux/process.hh @@ -42,7 +42,7 @@ class PowerLinuxProcess : public PowerProcess void initState() override; - void syscall(ThreadContext *tc, Fault *fault) override; + void syscall(ThreadContext *tc) override; /// Syscall descriptors, indexed by call number. static SyscallDescTable syscallDescs; diff --git a/src/arch/riscv/faults.cc b/src/arch/riscv/faults.cc index 2ef8df44b..7a1c7bd8c 100644 --- a/src/arch/riscv/faults.cc +++ b/src/arch/riscv/faults.cc @@ -194,8 +194,7 @@ BreakpointFault::invokeSE(ThreadContext *tc, const StaticInstPtr &inst) void SyscallFault::invokeSE(ThreadContext *tc, const StaticInstPtr &inst) { - Fault *fault = NoFault; - tc->syscall(fault); + tc->syscall(); } } // namespace RiscvISA diff --git a/src/arch/riscv/linux/process.cc b/src/arch/riscv/linux/process.cc index fa6bf0188..094097f16 100644 --- a/src/arch/riscv/linux/process.cc +++ b/src/arch/riscv/linux/process.cc @@ -781,10 +781,10 @@ RiscvLinuxProcess64::RiscvLinuxProcess64(ProcessParams * params, {} void -RiscvLinuxProcess64::syscall(ThreadContext *tc, Fault *fault) +RiscvLinuxProcess64::syscall(ThreadContext *tc) { - RiscvProcess64::syscall(tc, fault); - syscallDescs.get(tc->readIntReg(SyscallNumReg))->doSyscall(tc, fault); + RiscvProcess64::syscall(tc); + syscallDescs.get(tc->readIntReg(SyscallNumReg))->doSyscall(tc); } RiscvLinuxProcess32::RiscvLinuxProcess32(ProcessParams * params, @@ -792,8 +792,8 @@ RiscvLinuxProcess32::RiscvLinuxProcess32(ProcessParams * params, {} void -RiscvLinuxProcess32::syscall(ThreadContext *tc, Fault *fault) +RiscvLinuxProcess32::syscall(ThreadContext *tc) { - RiscvProcess32::syscall(tc, fault); - syscallDescs.get(tc->readIntReg(SyscallNumReg))->doSyscall(tc, fault); + RiscvProcess32::syscall(tc); + syscallDescs.get(tc->readIntReg(SyscallNumReg))->doSyscall(tc); } diff --git a/src/arch/riscv/linux/process.hh b/src/arch/riscv/linux/process.hh index b553bef4f..8844273cd 100644 --- a/src/arch/riscv/linux/process.hh +++ b/src/arch/riscv/linux/process.hh @@ -50,7 +50,7 @@ class RiscvLinuxProcess64 : public RiscvProcess64 /// ID of the thread group leader for the process uint64_t __tgid; - void syscall(ThreadContext *tc, Fault *fault) override; + void syscall(ThreadContext *tc) override; /// Syscall descriptors, indexed by call number. static SyscallDescTable syscallDescs; @@ -68,7 +68,7 @@ class RiscvLinuxProcess32 : public RiscvProcess32 /// ID of the thread group leader for the process uint64_t __tgid; - void syscall(ThreadContext *tc, Fault *fault) override; + void syscall(ThreadContext *tc) override; /// Array of syscall descriptors, indexed by call number. static SyscallDescTable syscallDescs; diff --git a/src/arch/sparc/faults.cc b/src/arch/sparc/faults.cc index 419761380..34a0d52b2 100644 --- a/src/arch/sparc/faults.cc +++ b/src/arch/sparc/faults.cc @@ -815,8 +815,7 @@ TrapInstruction::invoke(ThreadContext *tc, const StaticInstPtr &inst) SparcProcess *sp = dynamic_cast(p); assert(sp); - Fault fault; - sp->handleTrap(_n, tc, &fault); + sp->handleTrap(_n, tc); // We need to explicitly advance the pc, since that's not done for us // on a faulting instruction diff --git a/src/arch/sparc/linux/process.cc b/src/arch/sparc/linux/process.cc index 298822348..79bbaeed2 100644 --- a/src/arch/sparc/linux/process.cc +++ b/src/arch/sparc/linux/process.cc @@ -81,21 +81,21 @@ Sparc32LinuxProcess::Sparc32LinuxProcess(ProcessParams * params, {} void -Sparc32LinuxProcess::syscall(ThreadContext *tc, Fault *fault) +Sparc32LinuxProcess::syscall(ThreadContext *tc) { - Sparc32Process::syscall(tc, fault); - syscall32Descs.get(tc->readIntReg(1))->doSyscall(tc, fault); + Sparc32Process::syscall(tc); + syscall32Descs.get(tc->readIntReg(1))->doSyscall(tc); } void -Sparc32LinuxProcess::handleTrap(int trapNum, ThreadContext *tc, Fault *fault) +Sparc32LinuxProcess::handleTrap(int trapNum, ThreadContext *tc) { switch (trapNum) { case 0x10: //Linux 32 bit syscall trap - tc->syscall(fault); + tc->syscall(); break; default: - SparcProcess::handleTrap(trapNum, tc, fault); + SparcProcess::handleTrap(trapNum, tc); } } @@ -105,10 +105,10 @@ Sparc64LinuxProcess::Sparc64LinuxProcess(ProcessParams * params, {} void -Sparc64LinuxProcess::syscall(ThreadContext *tc, Fault *fault) +Sparc64LinuxProcess::syscall(ThreadContext *tc) { - Sparc64Process::syscall(tc, fault); - syscallDescs.get(tc->readIntReg(1))->doSyscall(tc, fault); + Sparc64Process::syscall(tc); + syscallDescs.get(tc->readIntReg(1))->doSyscall(tc); } void @@ -124,12 +124,12 @@ Sparc64LinuxProcess::setContext(ThreadContext *tc) } void -Sparc64LinuxProcess::handleTrap(int trapNum, ThreadContext *tc, Fault *fault) +Sparc64LinuxProcess::handleTrap(int trapNum, ThreadContext *tc) { switch (trapNum) { // case 0x10: // Linux 32 bit syscall trap case 0x6d: // Linux 64 bit syscall trap - tc->syscall(fault); + tc->syscall(); break; case 0x6e: // Linux 64 bit getcontext trap getContext(tc); @@ -138,6 +138,6 @@ Sparc64LinuxProcess::handleTrap(int trapNum, ThreadContext *tc, Fault *fault) setContext(tc); break; default: - SparcProcess::handleTrap(trapNum, tc, fault); + SparcProcess::handleTrap(trapNum, tc); } } diff --git a/src/arch/sparc/linux/process.hh b/src/arch/sparc/linux/process.hh index 99c954789..0cea430c5 100644 --- a/src/arch/sparc/linux/process.hh +++ b/src/arch/sparc/linux/process.hh @@ -56,9 +56,9 @@ class Sparc32LinuxProcess : public SparcLinuxProcess, public Sparc32Process /// Constructor. Sparc32LinuxProcess(ProcessParams * params, ::Loader::ObjectFile *objFile); - void syscall(ThreadContext *tc, Fault *fault) override; + void syscall(ThreadContext *tc) override; - void handleTrap(int trapNum, ThreadContext *tc, Fault *fault) override; + void handleTrap(int trapNum, ThreadContext *tc) override; }; /// A process with emulated 32 bit SPARC/Linux syscalls. @@ -68,12 +68,12 @@ class Sparc64LinuxProcess : public SparcLinuxProcess, public Sparc64Process /// Constructor. Sparc64LinuxProcess(ProcessParams * params, ::Loader::ObjectFile *objFile); - void syscall(ThreadContext *tc, Fault *fault) override; + void syscall(ThreadContext *tc) override; void getContext(ThreadContext *tc); void setContext(ThreadContext *tc); - void handleTrap(int trapNum, ThreadContext *tc, Fault *fault) override; + void handleTrap(int trapNum, ThreadContext *tc) override; }; SyscallReturn getresuidFunc(SyscallDesc *desc, ThreadContext *tc, diff --git a/src/arch/sparc/process.cc b/src/arch/sparc/process.cc index ca0df08e6..d28189cdb 100644 --- a/src/arch/sparc/process.cc +++ b/src/arch/sparc/process.cc @@ -66,7 +66,7 @@ SparcProcess::SparcProcess(ProcessParams *params, } void -SparcProcess::handleTrap(int trapNum, ThreadContext *tc, Fault *fault) +SparcProcess::handleTrap(int trapNum, ThreadContext *tc) { PCState pc = tc->pcState(); switch (trapNum) { diff --git a/src/arch/sparc/process.hh b/src/arch/sparc/process.hh index bf9922402..68b607f14 100644 --- a/src/arch/sparc/process.hh +++ b/src/arch/sparc/process.hh @@ -61,7 +61,7 @@ class SparcProcess : public Process public: // Handles traps which request services from the operating system - virtual void handleTrap(int trapNum, ThreadContext *tc, Fault *fault); + virtual void handleTrap(int trapNum, ThreadContext *tc); Addr readFillStart() { return fillStart; } Addr readSpillStart() { return spillStart; } diff --git a/src/arch/sparc/solaris/process.cc b/src/arch/sparc/solaris/process.cc index 63f1a0fa7..88fb1927f 100644 --- a/src/arch/sparc/solaris/process.cc +++ b/src/arch/sparc/solaris/process.cc @@ -350,8 +350,8 @@ SparcSolarisProcess::SparcSolarisProcess(ProcessParams *params, {} void -SparcSolarisProcess::syscall(ThreadContext *tc, Fault *fault) +SparcSolarisProcess::syscall(ThreadContext *tc) { - Sparc64Process::syscall(tc, fault); - syscallDescs.get(tc->readIntReg(1))->doSyscall(tc, fault); + Sparc64Process::syscall(tc); + syscallDescs.get(tc->readIntReg(1))->doSyscall(tc); } diff --git a/src/arch/sparc/solaris/process.hh b/src/arch/sparc/solaris/process.hh index 2f218bb56..0c71d4a7d 100644 --- a/src/arch/sparc/solaris/process.hh +++ b/src/arch/sparc/solaris/process.hh @@ -46,7 +46,7 @@ class SparcSolarisProcess : public Sparc64Process /// The target system's hostname. static const char *hostname; - void syscall(ThreadContext *tc, Fault *fault) override; + void syscall(ThreadContext *tc) override; /// Array of syscall descriptors, indexed by call number. static SyscallDescTable syscallDescs; diff --git a/src/arch/x86/isa/decoder/one_byte_opcodes.isa b/src/arch/x86/isa/decoder/one_byte_opcodes.isa index e09b34a83..b1b6218be 100644 --- a/src/arch/x86/isa/decoder/one_byte_opcodes.isa +++ b/src/arch/x86/isa/decoder/one_byte_opcodes.isa @@ -398,7 +398,7 @@ // will sign extend it, and there's no easy way to // specify only checking the first byte. 0xffffffffffffff80: - SyscallInst::int80('xc->syscall(&fault)', + SyscallInst::int80('xc->syscall()', IsSyscall, IsNonSpeculative, IsSerializeAfter); } diff --git a/src/arch/x86/isa/decoder/two_byte_opcodes.isa b/src/arch/x86/isa/decoder/two_byte_opcodes.isa index c147d08e4..0dec25b93 100644 --- a/src/arch/x86/isa/decoder/two_byte_opcodes.isa +++ b/src/arch/x86/isa/decoder/two_byte_opcodes.isa @@ -237,7 +237,7 @@ } } 0x05: decode FullSystemInt { - 0: SyscallInst::syscall('xc->syscall(&fault)', + 0: SyscallInst::syscall('xc->syscall()', IsSyscall, IsNonSpeculative, IsSerializeAfter); default: decode MODE_MODE { @@ -431,7 +431,7 @@ 0x2: Inst::RDMSR(); 0x3: rdpmc(); 0x4: decode FullSystemInt { - 0: SyscallInst::sysenter('xc->syscall(&fault)', + 0: SyscallInst::sysenter('xc->syscall()', IsSyscall, IsNonSpeculative, IsSerializeAfter); default: sysenter(); diff --git a/src/arch/x86/linux/process.cc b/src/arch/x86/linux/process.cc index 9460a4b06..68a9841f7 100644 --- a/src/arch/x86/linux/process.cc +++ b/src/arch/x86/linux/process.cc @@ -566,10 +566,10 @@ static SyscallDescTable syscallDescs64 = { }; void -X86_64LinuxProcess::syscall(ThreadContext *tc, Fault *fault) +X86_64LinuxProcess::syscall(ThreadContext *tc) { - X86_64Process::syscall(tc, fault); - syscallDescs64.get(tc->readIntReg(INTREG_RAX))->doSyscall(tc, fault); + X86_64Process::syscall(tc); + syscallDescs64.get(tc->readIntReg(INTREG_RAX))->doSyscall(tc); } void @@ -915,9 +915,9 @@ static SyscallDescTable syscallDescs32 = { }; void -I386LinuxProcess::syscall(ThreadContext *tc, Fault *fault) +I386LinuxProcess::syscall(ThreadContext *tc) { - I386Process::syscall(tc, fault); + I386Process::syscall(tc); PCState pc = tc->pcState(); Addr eip = pc.pc(); if (eip >= vsyscallPage.base && @@ -925,7 +925,7 @@ I386LinuxProcess::syscall(ThreadContext *tc, Fault *fault) pc.npc(vsyscallPage.base + vsyscallPage.vsysexitOffset); tc->pcState(pc); } - syscallDescs32.get(tc->readIntReg(INTREG_RAX))->doSyscall(tc, fault); + syscallDescs32.get(tc->readIntReg(INTREG_RAX))->doSyscall(tc); } void diff --git a/src/arch/x86/linux/process.hh b/src/arch/x86/linux/process.hh index c2fff8bf8..06b669235 100644 --- a/src/arch/x86/linux/process.hh +++ b/src/arch/x86/linux/process.hh @@ -53,7 +53,7 @@ class X86_64LinuxProcess : public X86_64Process { public: using X86_64Process::X86_64Process; - void syscall(ThreadContext *tc, Fault *fault) override; + void syscall(ThreadContext *tc) override; void clone(ThreadContext *old_tc, ThreadContext *new_tc, Process *process, RegVal flags) override; @@ -67,7 +67,7 @@ class I386LinuxProcess : public I386Process { public: using I386Process::I386Process; - void syscall(ThreadContext *tc, Fault *fault) override; + void syscall(ThreadContext *tc) override; void clone(ThreadContext *old_tc, ThreadContext *new_tc, Process *process, RegVal flags) override; diff --git a/src/cpu/checker/cpu.hh b/src/cpu/checker/cpu.hh index 3c040648a..7d1807e27 100644 --- a/src/cpu/checker/cpu.hh +++ b/src/cpu/checker/cpu.hh @@ -577,7 +577,7 @@ class CheckerCPU : public BaseCPU, public ExecContext void wakeup(ThreadID tid) override { } // Assume that the normal CPU's call to syscall was successful. // The checker's state would have already been updated by the syscall. - void syscall(Fault *fault) override { } + void syscall() override { } void handleError() diff --git a/src/cpu/checker/thread_context.hh b/src/cpu/checker/thread_context.hh index 06cb3b9a0..e98b3a221 100644 --- a/src/cpu/checker/thread_context.hh +++ b/src/cpu/checker/thread_context.hh @@ -172,11 +172,7 @@ class CheckerThreadContext : public ThreadContext } /** Executes a syscall in SE mode. */ - void - syscall(Fault *fault) override - { - return actualTC->syscall(fault); - } + void syscall() override { return actualTC->syscall(); } Status status() const override { return actualTC->status(); } diff --git a/src/cpu/exec_context.hh b/src/cpu/exec_context.hh index 29daced4f..418019199 100644 --- a/src/cpu/exec_context.hh +++ b/src/cpu/exec_context.hh @@ -303,7 +303,7 @@ class ExecContext { /** * Executes a syscall. */ - virtual void syscall(Fault *fault) = 0; + virtual void syscall() = 0; /** @} */ diff --git a/src/cpu/minor/exec_context.hh b/src/cpu/minor/exec_context.hh index a0b1d181b..e65fdfb14 100644 --- a/src/cpu/minor/exec_context.hh +++ b/src/cpu/minor/exec_context.hh @@ -379,11 +379,7 @@ class ExecContext : public ::ExecContext return thread.setMiscReg(reg.index(), val); } - void - syscall(Fault *fault) override - { - thread.syscall(fault); - } + void syscall() override { thread.syscall(); } ThreadContext *tcBase() const override { return thread.getTC(); } diff --git a/src/cpu/o3/cpu.cc b/src/cpu/o3/cpu.cc index d9114903a..d0a387cfc 100644 --- a/src/cpu/o3/cpu.cc +++ b/src/cpu/o3/cpu.cc @@ -915,7 +915,7 @@ FullO3CPU::trap(const Fault &fault, ThreadID tid, template void -FullO3CPU::syscall(ThreadID tid, Fault *fault) +FullO3CPU::syscall(ThreadID tid) { DPRINTF(O3CPU, "[tid:%i] Executing syscall().\n\n", tid); @@ -926,7 +926,7 @@ FullO3CPU::syscall(ThreadID tid, Fault *fault) ++(this->thread[tid]->funcExeInst); // Execute the actual syscall. - this->thread[tid]->syscall(fault); + this->thread[tid]->syscall(); // Decrease funcExeInst by one as the normal commit will handle // incrementing it. diff --git a/src/cpu/o3/cpu.hh b/src/cpu/o3/cpu.hh index c3d911b97..cc0e2cd06 100644 --- a/src/cpu/o3/cpu.hh +++ b/src/cpu/o3/cpu.hh @@ -280,7 +280,7 @@ class FullO3CPU : public BaseO3CPU /** Executes a syscall. * @todo: Determine if this needs to be virtual. */ - void syscall(ThreadID tid, Fault *fault); + void syscall(ThreadID tid); /** Starts draining the CPU's pipeline of all instructions in * order to stop all memory accesses. */ diff --git a/src/cpu/o3/dyn_inst.hh b/src/cpu/o3/dyn_inst.hh index d5f142c0c..5f2a5886b 100644 --- a/src/cpu/o3/dyn_inst.hh +++ b/src/cpu/o3/dyn_inst.hh @@ -249,7 +249,7 @@ class BaseO3DynInst : public BaseDynInst void trap(const Fault &fault); /** Emulates a syscall. */ - void syscall(Fault *fault) override; + void syscall() override; public: diff --git a/src/cpu/o3/dyn_inst_impl.hh b/src/cpu/o3/dyn_inst_impl.hh index 597bd1d55..8a6a434a0 100644 --- a/src/cpu/o3/dyn_inst_impl.hh +++ b/src/cpu/o3/dyn_inst_impl.hh @@ -189,13 +189,13 @@ BaseO3DynInst::trap(const Fault &fault) template void -BaseO3DynInst::syscall(Fault *fault) +BaseO3DynInst::syscall() { // HACK: check CPU's nextPC before and after syscall. If it // changes, update this instruction's nextPC because the syscall // must have changed the nextPC. TheISA::PCState curPC = this->cpu->pcState(this->threadNumber); - this->cpu->syscall(this->threadNumber, fault); + this->cpu->syscall(this->threadNumber); TheISA::PCState newPC = this->cpu->pcState(this->threadNumber); if (!(curPC == newPC)) { this->pcState(newPC); diff --git a/src/cpu/o3/thread_context.hh b/src/cpu/o3/thread_context.hh index f710613f7..e3e11fe18 100644 --- a/src/cpu/o3/thread_context.hh +++ b/src/cpu/o3/thread_context.hh @@ -421,9 +421,9 @@ class O3ThreadContext : public ThreadContext /** Executes a syscall in SE mode. */ void - syscall(Fault *fault) override + syscall() override { - return cpu->syscall(thread->threadId(), fault); + return cpu->syscall(thread->threadId()); } /** Reads the funcExeInst counter. */ diff --git a/src/cpu/o3/thread_state.hh b/src/cpu/o3/thread_state.hh index 757671a84..6420da99a 100644 --- a/src/cpu/o3/thread_state.hh +++ b/src/cpu/o3/thread_state.hh @@ -127,10 +127,7 @@ struct O3ThreadState : public ThreadState { ThreadContext *getTC() { return tc; } /** Handles the syscall. */ - void syscall(Fault *fault) - { - process->syscall(tc, fault); - } + void syscall() { process->syscall(tc); } }; #endif // __CPU_O3_THREAD_STATE_HH__ diff --git a/src/cpu/simple/exec_context.hh b/src/cpu/simple/exec_context.hh index e7c59c035..5214211ba 100644 --- a/src/cpu/simple/exec_context.hh +++ b/src/cpu/simple/exec_context.hh @@ -494,11 +494,7 @@ class SimpleExecContext : public ExecContext { /** * Executes a syscall specified by the callnum. */ - void - syscall(Fault *fault) override - { - thread->syscall(fault); - } + void syscall() override { thread->syscall(); } /** Returns a pointer to the ThreadContext. */ ThreadContext *tcBase() const override { return thread->getTC(); } diff --git a/src/cpu/simple_thread.hh b/src/cpu/simple_thread.hh index 8a2f22794..2c785736b 100644 --- a/src/cpu/simple_thread.hh +++ b/src/cpu/simple_thread.hh @@ -576,11 +576,7 @@ class SimpleThread : public ThreadState, public ThreadContext return ThreadState::readFuncExeInst(); } - void - syscall(Fault *fault) override - { - process->syscall(this, fault); - } + void syscall() override { process->syscall(this); } RegVal readIntRegFlat(RegIndex idx) const override { return intRegs[idx]; } void diff --git a/src/cpu/thread_context.hh b/src/cpu/thread_context.hh index 8ca2c5059..6662502f0 100644 --- a/src/cpu/thread_context.hh +++ b/src/cpu/thread_context.hh @@ -293,7 +293,7 @@ class ThreadContext : public PCEventScope // Same with st cond failures. virtual Counter readFuncExeInst() const = 0; - virtual void syscall(Fault *fault) = 0; + virtual void syscall() = 0; // This function exits the thread context in the CPU and returns // 1 if the CPU has no more active threads (meaning it's OK to exit); diff --git a/src/sim/process.hh b/src/sim/process.hh index 0add01ab9..449e0a5aa 100644 --- a/src/sim/process.hh +++ b/src/sim/process.hh @@ -75,7 +75,7 @@ class Process : public SimObject void initState() override; DrainState drain() override; - virtual void syscall(ThreadContext *tc, Fault *fault) { numSyscalls++; } + virtual void syscall(ThreadContext *tc) { numSyscalls++; } inline uint64_t uid() { return _uid; } inline uint64_t euid() { return _euid; } diff --git a/src/sim/pseudo_inst.cc b/src/sim/pseudo_inst.cc index 4cbe87ccb..7335fda4e 100644 --- a/src/sim/pseudo_inst.cc +++ b/src/sim/pseudo_inst.cc @@ -479,8 +479,7 @@ void m5Syscall(ThreadContext *tc) { DPRINTF(PseudoInst, "PseudoInst::m5Syscall()\n"); - Fault fault; - tc->syscall(&fault); + tc->syscall(); } void diff --git a/src/sim/syscall_desc.cc b/src/sim/syscall_desc.cc index d2e274974..265871728 100644 --- a/src/sim/syscall_desc.cc +++ b/src/sim/syscall_desc.cc @@ -35,7 +35,7 @@ class ThreadContext; void -SyscallDesc::doSyscall(ThreadContext *tc, Fault *fault) +SyscallDesc::doSyscall(ThreadContext *tc) { DPRINTF_SYSCALL(Base, "Calling %s...\n", dumper(name(), tc)); diff --git a/src/sim/syscall_desc.hh b/src/sim/syscall_desc.hh index 53e3ccd03..2fd243451 100644 --- a/src/sim/syscall_desc.hh +++ b/src/sim/syscall_desc.hh @@ -71,7 +71,7 @@ class SyscallDesc { * to add filters for behaviors or apply checks for all system calls. * @param tc Handle for owning ThreadContext to pass information */ - void doSyscall(ThreadContext *tc, Fault *fault); + void doSyscall(ThreadContext *tc); std::string name() const { return _name; } int num() const { return _num; } -- 2.30.2