mirror of
https://github.com/Atmosphere-NX/Atmosphere
synced 2024-11-15 09:36:35 +00:00
thermosphere: add hypercall support... even if unused
This commit is contained in:
parent
b5c6b06dad
commit
bcc72896fd
5 changed files with 68 additions and 4 deletions
|
@ -14,10 +14,10 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "exceptions.h"
|
#include "hvc.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
|
||||||
static void dumpStackFrame(const ExceptionStackFrame *frame, bool sameEl)
|
void dumpStackFrame(const ExceptionStackFrame *frame, bool sameEl)
|
||||||
{
|
{
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
for (u32 i = 0; i < 30; i += 2) {
|
for (u32 i = 0; i < 30; i += 2) {
|
||||||
|
@ -38,8 +38,17 @@ static void dumpStackFrame(const ExceptionStackFrame *frame, bool sameEl)
|
||||||
|
|
||||||
void handleLowerElSyncException(ExceptionStackFrame *frame, ExceptionSyndromeRegister esr)
|
void handleLowerElSyncException(ExceptionStackFrame *frame, ExceptionSyndromeRegister esr)
|
||||||
{
|
{
|
||||||
serialLog("Lower EL sync exception, EC = 0x%02llx IL=%llu ISS=0x%06llx\r\n", (u64)esr.ec, esr.il, esr.iss);
|
|
||||||
dumpStackFrame(frame, false);
|
switch (esr.ec) {
|
||||||
|
case Exception_HypervisorCallA64:
|
||||||
|
case Exception_HypervisorCallA32:
|
||||||
|
handleHypercall(frame, esr);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
serialLog("Lower EL sync exception, EC = 0x%02llx IL=%llu ISS=0x%06llx\r\n", (u64)esr.ec, esr.il, esr.iss);
|
||||||
|
dumpStackFrame(frame, false);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void handleSameElSyncException(ExceptionStackFrame *frame, ExceptionSyndromeRegister esr)
|
void handleSameElSyncException(ExceptionStackFrame *frame, ExceptionSyndromeRegister esr)
|
||||||
|
|
|
@ -78,3 +78,5 @@ typedef struct ExceptionSyndromeRegister {
|
||||||
ExceptionClass ec : 6; // Exception Class
|
ExceptionClass ec : 6; // Exception Class
|
||||||
u32 res0 : 32;
|
u32 res0 : 32;
|
||||||
} ExceptionSyndromeRegister;
|
} ExceptionSyndromeRegister;
|
||||||
|
|
||||||
|
void dumpStackFrame(const ExceptionStackFrame *frame, bool sameEl);
|
||||||
|
|
29
thermosphere/src/hvc.c
Normal file
29
thermosphere/src/hvc.c
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2019 Atmosphère-NX
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms and conditions of the GNU General Public License,
|
||||||
|
* version 2, as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "hvc.h"
|
||||||
|
#include "log.h"
|
||||||
|
|
||||||
|
void handleHypercall(ExceptionStackFrame *frame, ExceptionSyndromeRegister esr)
|
||||||
|
{
|
||||||
|
u32 id = esr.iss;
|
||||||
|
switch (id) {
|
||||||
|
default:
|
||||||
|
serialLog("Unhandled hypercall: 0x%x.\r\n");
|
||||||
|
dumpStackFrame(frame, false);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
20
thermosphere/src/hvc.h
Normal file
20
thermosphere/src/hvc.h
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2019 Atmosphère-NX
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms and conditions of the GNU General Public License,
|
||||||
|
* version 2, as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
#include "exceptions.h"
|
||||||
|
|
||||||
|
void handleHypercall(ExceptionStackFrame *frame, ExceptionSyndromeRegister esr);
|
|
@ -105,3 +105,7 @@ static inline u32 get_spsr(void) {
|
||||||
static inline bool check_32bit_additive_overflow(u32 a, u32 b) {
|
static inline bool check_32bit_additive_overflow(u32 a, u32 b) {
|
||||||
return __builtin_add_overflow_p(a, b, (u32)0);
|
return __builtin_add_overflow_p(a, b, (u32)0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline void panic(void) {
|
||||||
|
for (;;);
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue