gem5  v21.2.1.1
se_workload.hh
Go to the documentation of this file.
1 /*
2  * Copyright 2007 The Hewlett-Packard Development Company
3  *
4  * The license below extends only to copyright in the software and shall
5  * not be construed as granting a license to any other intellectual
6  * property including but not limited to intellectual property relating
7  * to a hardware implementation of the functionality of the software
8  * licensed hereunder. You may use the software subject to the license
9  * terms below provided that you ensure that this notice is replicated
10  * unmodified and in its entirety in all distributions of the software,
11  * modified or unmodified, in source code or in binary form.
12  *
13  * Copyright 2020 Google Inc.
14  *
15  * Redistribution and use in source and binary forms, with or without
16  * modification, are permitted provided that the following conditions are
17  * met: redistributions of source code must retain the above copyright
18  * notice, this list of conditions and the following disclaimer;
19  * redistributions in binary form must reproduce the above copyright
20  * notice, this list of conditions and the following disclaimer in the
21  * documentation and/or other materials provided with the distribution;
22  * neither the name of the copyright holders nor the names of its
23  * contributors may be used to endorse or promote products derived from
24  * this software without specific prior written permission.
25  *
26  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
27  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
28  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
29  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
30  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
31  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
32  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
33  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
34  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
35  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
36  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37  */
38 
39 #ifndef __ARCH_X86_LINUX_SE_WORKLOAD_HH__
40 #define __ARCH_X86_LINUX_SE_WORKLOAD_HH__
41 
42 #include "arch/x86/linux/linux.hh"
43 #include "arch/x86/remote_gdb.hh"
44 #include "params/X86EmuLinux.hh"
45 #include "sim/process.hh"
46 #include "sim/se_workload.hh"
47 #include "sim/syscall_abi.hh"
48 #include "sim/syscall_desc.hh"
49 
50 namespace gem5
51 {
52 
53 namespace X86ISA
54 {
55 
56 class EmuLinux : public SEWorkload
57 {
58  public:
59  using Params = X86EmuLinuxParams;
60 
61  EmuLinux(const Params &p);
62 
63  void
64  setSystem(System *sys) override
65  {
67  gdb = BaseRemoteGDB::build<RemoteGDB>(system);
68  }
69 
70  loader::Arch getArch() const override { return loader::X86_64; }
71  ByteOrder byteOrder() const override { return ByteOrder::little; }
72 
73  void syscall(ThreadContext *tc) override;
74  void event(ThreadContext *tc) override;
75 
76  void pageFault(ThreadContext *tc);
77 
78  struct SyscallABI64 :
80  {
82  };
83 
84  struct SyscallABI32 :
86  {
88  };
89 
90  private:
93 };
94 
95 } // namespace X86ISA
96 
97 GEM5_DEPRECATED_NAMESPACE(GuestABI, guest_abi);
98 namespace guest_abi
99 {
100 
101 template <typename Arg>
102 struct Argument<X86ISA::EmuLinux::SyscallABI32, Arg,
103  typename std::enable_if_t<std::is_integral_v<Arg> &&
104  X86ISA::EmuLinux::SyscallABI32::IsWideV<Arg>>>
105 {
107 
108  static Arg
109  get(ThreadContext *tc, typename ABI::State &state)
110  {
111  panic_if(state + 1 >= ABI::ArgumentRegs.size(),
112  "Ran out of syscall argument registers.");
113  auto low = ABI::ArgumentRegs[state++];
114  auto high = ABI::ArgumentRegs[state++];
115  return (Arg)ABI::mergeRegs(tc, low, high);
116  }
117 };
118 
119 } // namespace guest_abi
120 } // namespace gem5
121 
122 #endif // __ARCH_X86_LINUX_SE_WORKLOAD_HH__
gem5::RiscvISA::ArgumentRegs
const std::vector< int > ArgumentRegs
Definition: int.hh:67
gem5::ArmISA::EmuLinux::SyscallABI32
Definition: se_workload.hh:53
gem5::guest_abi::Argument< X86ISA::EmuLinux::SyscallABI32, Arg, typename std::enable_if_t< std::is_integral_v< Arg > &&X86ISA::EmuLinux::SyscallABI32::IsWideV< Arg > > >::get
static Arg get(ThreadContext *tc, typename ABI::State &state)
Definition: se_workload.hh:109
gem5::GenericSyscallABI::State
int State
Definition: syscall_abi.hh:44
gem5::Workload::gdb
BaseRemoteGDB * gdb
Definition: workload.hh:76
gem5::loader::X86_64
@ X86_64
Definition: object_file.hh:56
gem5::X86ISA::EmuLinux::syscallDescs64
static SyscallDescTable< SyscallABI64 > syscallDescs64
Definition: se_workload.hh:91
gem5::GenericSyscallABI64
Definition: syscall_abi.hh:47
std::vector< IntRegIndex >
syscall_abi.hh
gem5::X86ISA::EmuLinux::event
void event(ThreadContext *tc) override
Definition: se_workload.cc:133
gem5::X86ISA::EmuLinux::SyscallABI32
Definition: se_workload.hh:84
gem5::high
high
Definition: intmath.hh:176
gem5::X86ISA::EmuLinux::SyscallABI32::ArgumentRegs
static const std::vector< IntRegIndex > ArgumentRegs
Definition: se_workload.hh:87
gem5::System
Definition: system.hh:75
gem5::ThreadContext
ThreadContext is the external interface to all thread state for anything outside of the CPU.
Definition: thread_context.hh:94
gem5::X86ISA::EmuLinux::byteOrder
ByteOrder byteOrder() const override
Definition: se_workload.hh:71
gem5::X86ISA::EmuLinux::SyscallABI64
Definition: se_workload.hh:78
process.hh
remote_gdb.hh
gem5::X86ISA::EmuLinux
Definition: se_workload.hh:56
gem5::loader::Arch
Arch
Definition: object_file.hh:50
gem5::SyscallDescTable
Definition: syscall_desc.hh:189
gem5::ArmISA::SEWorkload
Definition: se_workload.hh:42
gem5::ArmISA::SEWorkload::SyscallABI32
RegABI32 SyscallABI32
Definition: se_workload.hh:60
gem5::GEM5_DEPRECATED_NAMESPACE
GEM5_DEPRECATED_NAMESPACE(GuestABI, guest_abi)
gem5::GenericSyscallABI32
Definition: syscall_abi.hh:52
gem5::X86ISA::EmuLinux::EmuLinux
EmuLinux(const Params &p)
Definition: se_workload.cc:96
gem5::ArmISA::SEWorkload::Params
ArmSEWorkloadParams Params
Definition: se_workload.hh:45
gem5::X86Linux::SyscallABI
Definition: linux.hh:75
panic_if
#define panic_if(cond,...)
Conditional panic macro that checks the supplied condition and only panics if the condition is true a...
Definition: logging.hh:204
gem5::X86ISA::EmuLinux::getArch
loader::Arch getArch() const override
Definition: se_workload.hh:70
gem5::X86ISA::EmuLinux::syscall
void syscall(ThreadContext *tc) override
Definition: se_workload.cc:108
gem5::ArmISA::SEWorkload::setSystem
void setSystem(System *sys) override
Definition: se_workload.hh:52
gem5::X86ISA::EmuLinux::pageFault
void pageFault(ThreadContext *tc)
Definition: se_workload.cc:152
gem5::X86ISA::EmuLinux::syscallDescs32
static SyscallDescTable< SyscallABI32 > syscallDescs32
Definition: se_workload.hh:92
linux.hh
gem5::X86ISA::p
Bitfield< 0 > p
Definition: pagetable.hh:151
gem5::Workload::system
System * system
Definition: workload.hh:80
gem5::guest_abi::Argument
Definition: definition.hh:99
gem5::X86ISA::EmuLinux::SyscallABI64::ArgumentRegs
static const std::vector< IntRegIndex > ArgumentRegs
Definition: se_workload.hh:81
gem5
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Definition: tlb.cc:60
syscall_desc.hh
se_workload.hh
gem5::X86ISA::EmuLinux::setSystem
void setSystem(System *sys) override
Definition: se_workload.hh:64

Generated on Wed May 4 2022 12:13:47 for gem5 by doxygen 1.8.17