nce: adjust initialization for repeated calls

This commit is contained in:
Liam 2023-12-11 23:02:01 -05:00
parent bd59934350
commit a05c242429

View File

@ -251,21 +251,24 @@ void ArmNce::SetSvcArguments(std::span<const uint64_t, 8> args) {
ArmNce::ArmNce(System& system, bool uses_wall_clock, std::size_t core_index) ArmNce::ArmNce(System& system, bool uses_wall_clock, std::size_t core_index)
: ArmInterface{uses_wall_clock}, m_system{system}, m_core_index{core_index} { : ArmInterface{uses_wall_clock}, m_system{system}, m_core_index{core_index} {
m_guest_ctx.system = &m_system; m_guest_ctx.system = &m_system;
// Allocate signal stack.
m_stack = std::make_unique<u8[]>(StackSize);
} }
ArmNce::~ArmNce() = default; ArmNce::~ArmNce() = default;
void ArmNce::Initialize() { void ArmNce::Initialize() {
m_thread_id = gettid(); if (m_thread_id == -1) {
m_thread_id = gettid();
}
// Configure signal stack. // Configure signal stack.
stack_t ss{}; if (!m_stack) {
ss.ss_sp = m_stack.get(); m_stack = std::make_unique<u8[]>(StackSize);
ss.ss_size = StackSize;
sigaltstack(&ss, nullptr); stack_t ss{};
ss.ss_sp = m_stack.get();
ss.ss_size = StackSize;
sigaltstack(&ss, nullptr);
}
// Set up signals. // Set up signals.
static std::once_flag flag; static std::once_flag flag;