thermosphere: minor refactor

This commit is contained in:
TuxSH 2020-03-11 02:19:45 +00:00
parent f40c064e80
commit 020cfb89c6
2 changed files with 10 additions and 3 deletions

View file

@ -18,6 +18,8 @@
#include "hvisor_irq_manager.hpp"
#include "hvisor_fpu_register_cache.hpp"
#include "hvisor_guest_timers.hpp"
#include "hvisor_generic_timer.hpp"
#include "hvisor_memory_map.hpp"
#include "traps/hvisor_traps_data_abort.hpp"
#include "traps/hvisor_traps_hvc.hpp"
@ -50,10 +52,10 @@ namespace ams::hvisor {
EnableGuestTimerTraps();
}
void DumpStackFrame(ExceptionStackFrame *frame, bool sameEl)
void DumpStackFrame(ExceptionStackFrame *frame, bool sameEl)
{
#ifndef NDEBUG
uintptr_t stackTop = memoryMapGetStackTop(currentCoreCtx->GetCoreId());
uintptr_t stackTop = MemoryMap::GetStackTopVa(currentCoreCtx->GetCoreId());
for (u32 i = 0; i < 30; i += 2) {
DEBUG("x%u\t\t%016llx\t\tx%u\t\t%016llx\n", i, frame->x[i], i + 1, frame->x[i + 1]);
@ -111,7 +113,7 @@ void DumpStackFrame(ExceptionStackFrame *frame, bool sameEl)
}
// Update virtual counter
u64 ticksNow = 0;// TODO timerGetSystemTick();
u64 ticksNow = GenericTimer::GetSystemTick();
currentCoreCtx->IncrementTotalTimeInHypervisor(ticksNow - frame->cntpct_el0);
UpdateVirtualOffsetSysreg();

View file

@ -80,6 +80,11 @@ namespace ams::hvisor {
static void SetupMmu(const LoadImageLayout *layout);
static std::array<uintptr_t, 2> EnableMmuGetStacks(const LoadImageLayout *layout, u32 coreId);
static constexpr uintptr_t GetStackTopVa(u32 coreId)
{
return stacksBottomVa + 0x2000 * coreId + 0x1000;
}
// Caller is expected to invalidate TLB + barrier at some point
static uintptr_t MapPlatformMmio(uintptr_t pa, size_t size);