38#ifndef __ARCH_RISCV_SEMIHOSTING_HH__
39#define __ARCH_RISCV_SEMIHOSTING_HH__
51struct RiscvSemihostingParams;
75 return ByteOrder::little;
78 template <
typename ArgType>
91 return ByteOrder::little;
144 static const std::map<uint32_t, SemiCall>
calls;
150template <
typename Arg>
152 typename std::enable_if_t<std::is_integral_v<Arg>>>
157 return state.get(tc);
161template <
typename Arg>
163 typename std::enable_if_t<std::is_integral_v<Arg>>>
168 if (std::is_signed_v<Arg>)
171 return state.get(tc);
175template <
typename Abi>
177 typename std::enable_if_t<
178 std::is_base_of_v<RiscvSemihosting::AbiBase, Abi>>>
184 state.getAddr(),
sizeof(
typename Abi::State::ArgType));
188template <
typename Abi>
StateBase(const ThreadContext *tc, Addr arg_pointer, std::function< ByteOrder(const ThreadContext *tc)> getByteOrder)
std::pair< uint64_t, SemiErrno > RetErrno
BaseSemihosting(const BaseSemihostingParams &p)
The ExecContext is an abstract base class the provides the interface used by the ISA to manipulate th...
This object is a proxy for a port or other object which implements the functional response protocol,...
State(const ThreadContext *tc)
Semihosting for RV32 and RV64.
bool call64(ThreadContext *tc)
static PortProxy & portProxyImpl(ThreadContext *tc)
PortProxy & portProxy(ThreadContext *tc) const override
RiscvSemihosting(const RiscvSemihostingParams &p)
static const std::map< uint32_t, SemiCall > calls
SemiCallBase< RiscvSemihosting, Abi32, Abi64 > SemiCall
bool call(ThreadContext *tc)
ByteOrder byteOrder(ThreadContext *tc) const override
bool isSemihostingEBreak(ExecContext *xc)
Perform a RISC-V Semihosting call.
bool call32(ThreadContext *tc)
Base class for serial devices such as terminals.
ThreadContext is the external interface to all thread state for anything outside of the CPU.
virtual void setReg(const RegId ®, RegVal val)
constexpr uint64_t sext(uint64_t val)
Sign-extend an N-bit value to 64 bits.
constexpr RegId ArgumentRegs[]
constexpr auto & ReturnValueReg
Copyright (c) 2024 Arm Limited All rights reserved.
Semihosting call information structure.
static RiscvSemihosting::InPlaceArg get(ThreadContext *tc, typename Abi::State &state)
static Arg get(ThreadContext *tc, RiscvSemihosting::Abi32::State &state)
static Arg get(ThreadContext *tc, RiscvSemihosting::Abi64::State &state)
static void store(ThreadContext *tc, const RiscvSemihosting::RetErrno &err)