1
0
Fork 0
mirror of https://github.com/Atmosphere-NX/Atmosphere.git synced 2024-12-24 03:06:17 +00:00

kern: implement user thread start, el0 code now runs

This commit is contained in:
Michael Scire 2020-02-19 21:21:44 -08:00
parent 560c340c96
commit 80b115ef57
4 changed files with 16 additions and 4 deletions

View file

@ -145,7 +145,7 @@ namespace ams::kern::arch::arm64 {
constexpr ALWAYS_INLINE decltype(auto) SetAccessFlag(AccessFlag f) { this->SetBitsDirect(10, 1, f); return *this; }
constexpr ALWAYS_INLINE decltype(auto) SetShareable(Shareable s) { this->SetBitsDirect(8, 2, s); return *this; }
constexpr ALWAYS_INLINE decltype(auto) SetReadOnly(bool en) { this->SetBit(7, en); return *this; }
constexpr ALWAYS_INLINE decltype(auto) SetUserAccessible(bool en) { this->SetBit(7, en); return *this; }
constexpr ALWAYS_INLINE decltype(auto) SetUserAccessible(bool en) { this->SetBit(6, en); return *this; }
constexpr ALWAYS_INLINE decltype(auto) SetPageAttribute(PageAttribute a) { this->SetBitsDirect(2, 3, a); return *this; }
constexpr ALWAYS_INLINE u64 GetEntryTemplate() const {

View file

@ -222,7 +222,6 @@ namespace ams::kern {
}
bool SetSvcAllowed(u32 id) {
constexpr size_t BitsPerWord = BITSIZEOF(this->svc_access_flags[0]);
if (id < BITSIZEOF(this->svc_access_flags)) {
SetSvcAllowedImpl(this->svc_access_flags, id);
return true;

View file

@ -22,7 +22,20 @@ namespace ams::kern::arch::arm64 {
void SupervisorModeThreadStarter();
void OnThreadStart() {
MESOSPHERE_TODO_IMPLEMENT();
MESOSPHERE_ASSERT(!KInterruptManager::AreInterruptsEnabled());
/* Send KDebug event for this thread's creation. */
{
KScopedInterruptEnable ei;
/* TODO */
}
/* Handle any pending dpc. */
while (GetCurrentThread().HasDpc()) {
KDpcManager::HandleDpc();
}
/* Clear our status as in an exception handler */
GetCurrentThread().ClearInExceptionHandler();
}
namespace {

View file

@ -39,7 +39,7 @@ _ZN3ams4kern4arch5arm6421UserModeThreadStarterEv:
msr sp_el0, x19
msr elr_el1, x20
msr spsr_el1, x21
msr tpidr_el1, x22
msr tpidr_el0, x22
ldp x0, x1, [sp, #(8 * 0)]
ldp x2, x3, [sp, #(8 * 2)]