2020-04-19 23:04:05 +02:00
|
|
|
// SPDX-License-Identifier: MPL-2.0
|
2020-03-27 20:36:02 +01:00
|
|
|
// Copyright © 2020 Skyline Team and Contributors (https://github.com/skyline-emu/)
|
|
|
|
|
2020-01-07 03:36:08 +01:00
|
|
|
#pragma once
|
|
|
|
|
2020-03-26 15:33:19 +01:00
|
|
|
#include "guest_common.h"
|
|
|
|
|
2020-01-07 03:36:08 +01:00
|
|
|
namespace skyline {
|
|
|
|
namespace guest {
|
2020-03-25 18:59:37 +01:00
|
|
|
constexpr size_t SaveCtxSize = 20 * sizeof(u32); //!< The size of the SaveCtx function in 32-bit ARMv8 instructions
|
|
|
|
constexpr size_t LoadCtxSize = 20 * sizeof(u32); //!< The size of the LoadCtx function in 32-bit ARMv8 instructions
|
|
|
|
constexpr size_t RescaleClockSize = 16 * sizeof(u32); //!< The size of the RescaleClock function in 32-bit ARMv8 instructions
|
2020-01-11 05:52:25 +01:00
|
|
|
#ifdef NDEBUG
|
2020-03-25 18:59:37 +01:00
|
|
|
constexpr size_t SvcHandlerSize = 225 * sizeof(u32); //!< The size of the SvcHandler (Release) function in 32-bit ARMv8 instructions
|
2020-01-11 05:52:25 +01:00
|
|
|
#else
|
2020-03-25 18:59:37 +01:00
|
|
|
constexpr size_t SvcHandlerSize = 400 * sizeof(u32); //!< The size of the SvcHandler (Debug) function in 32-bit ARMv8 instructions
|
2020-01-11 05:52:25 +01:00
|
|
|
#endif
|
|
|
|
|
2020-03-24 21:20:28 +01:00
|
|
|
/**
|
|
|
|
* @brief This is the entry point for all guest threads
|
|
|
|
* @param address The address of the actual thread entry point
|
|
|
|
*/
|
2020-02-15 10:38:17 +01:00
|
|
|
void GuestEntry(u64 address);
|
2020-01-11 05:52:25 +01:00
|
|
|
|
2020-03-24 21:20:28 +01:00
|
|
|
/**
|
|
|
|
* @brief This saves the context from CPU registers into TLS
|
|
|
|
*/
|
2020-02-15 10:38:17 +01:00
|
|
|
extern "C" void SaveCtx(void);
|
2020-03-24 21:20:28 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief This loads the context from TLS into CPU registers
|
|
|
|
*/
|
2020-02-15 10:38:17 +01:00
|
|
|
extern "C" void LoadCtx(void);
|
2020-03-24 21:20:28 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief This rescales the clock to Tegra X1 levels and puts the output on stack
|
|
|
|
*/
|
2020-02-15 10:38:17 +01:00
|
|
|
extern "C" __noreturn void RescaleClock(void);
|
2020-01-11 05:52:25 +01:00
|
|
|
|
2020-03-24 21:20:28 +01:00
|
|
|
/**
|
|
|
|
* @brief This is used to handle all SVC calls
|
|
|
|
* @param pc The address of PC when the call was being done
|
|
|
|
* @param svc The SVC ID of the SVC being called
|
|
|
|
*/
|
2020-02-15 10:38:17 +01:00
|
|
|
void SvcHandler(u64 pc, u32 svc);
|
2020-01-07 03:36:08 +01:00
|
|
|
}
|
|
|
|
}
|