1
0
Fork 0
forked from suyu/suyu

Merge pull request #1467 from ogniK5377/svcbreak-type-fix

Fixed incorrect types for svcBreak
This commit is contained in:
bunnei 2018-10-12 12:08:08 -04:00 committed by GitHub
commit 2946d4bdbe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 36 additions and 28 deletions

View file

@ -370,15 +370,15 @@ static ResultCode ArbitrateUnlock(VAddr mutex_addr) {
struct BreakReason { struct BreakReason {
union { union {
u64 raw; u32 raw;
BitField<31, 1, u64> dont_kill_application; BitField<31, 1, u32> signal_debugger;
}; };
}; };
/// Break program execution /// Break program execution
static void Break(u64 reason, u64 info1, u64 info2) { static void Break(u32 reason, u64 info1, u64 info2) {
BreakReason break_reason{reason}; BreakReason break_reason{reason};
if (break_reason.dont_kill_application) { if (break_reason.signal_debugger) {
LOG_ERROR( LOG_ERROR(
Debug_Emulated, Debug_Emulated,
"Emulated program broke execution! reason=0x{:016X}, info1=0x{:016X}, info2=0x{:016X}", "Emulated program broke execution! reason=0x{:016X}, info1=0x{:016X}, info2=0x{:016X}",

View file

@ -35,18 +35,18 @@ void SvcWrap() {
template <ResultCode func(u32)> template <ResultCode func(u32)>
void SvcWrap() { void SvcWrap() {
FuncReturn(func((u32)Param(0)).raw); FuncReturn(func(static_cast<u32>(Param(0))).raw);
} }
template <ResultCode func(u32, u32)> template <ResultCode func(u32, u32)>
void SvcWrap() { void SvcWrap() {
FuncReturn(func((u32)Param(0), (u32)Param(1)).raw); FuncReturn(func(static_cast<u32>(Param(0)), static_cast<u32>(Param(1))).raw);
} }
template <ResultCode func(u32*, u32)> template <ResultCode func(u32*, u32)>
void SvcWrap() { void SvcWrap() {
u32 param_1 = 0; u32 param_1 = 0;
u32 retval = func(&param_1, (u32)Param(1)).raw; u32 retval = func(&param_1, static_cast<u32>(Param(1))).raw;
Core::CurrentArmInterface().SetReg(1, param_1); Core::CurrentArmInterface().SetReg(1, param_1);
FuncReturn(retval); FuncReturn(retval);
} }
@ -61,7 +61,7 @@ void SvcWrap() {
template <ResultCode func(u64, s32)> template <ResultCode func(u64, s32)>
void SvcWrap() { void SvcWrap() {
FuncReturn(func(Param(0), (s32)Param(1)).raw); FuncReturn(func(Param(0), static_cast<s32>(Param(1))).raw);
} }
template <ResultCode func(u64, u32)> template <ResultCode func(u64, u32)>
@ -79,19 +79,19 @@ void SvcWrap() {
template <ResultCode func(u32, u64)> template <ResultCode func(u32, u64)>
void SvcWrap() { void SvcWrap() {
FuncReturn(func((u32)(Param(0) & 0xFFFFFFFF), Param(1)).raw); FuncReturn(func(static_cast<u32>(Param(0)), Param(1)).raw);
} }
template <ResultCode func(u32, u32, u64)> template <ResultCode func(u32, u32, u64)>
void SvcWrap() { void SvcWrap() {
FuncReturn(func((u32)(Param(0) & 0xFFFFFFFF), (u32)(Param(1) & 0xFFFFFFFF), Param(2)).raw); FuncReturn(func(static_cast<u32>(Param(0)), static_cast<u32>(Param(1)), Param(2)).raw);
} }
template <ResultCode func(u32, u32*, u64*)> template <ResultCode func(u32, u32*, u64*)>
void SvcWrap() { void SvcWrap() {
u32 param_1 = 0; u32 param_1 = 0;
u64 param_2 = 0; u64 param_2 = 0;
ResultCode retval = func((u32)(Param(2) & 0xFFFFFFFF), &param_1, &param_2); ResultCode retval = func(static_cast<u32>(Param(2)), &param_1, &param_2);
Core::CurrentArmInterface().SetReg(1, param_1); Core::CurrentArmInterface().SetReg(1, param_1);
Core::CurrentArmInterface().SetReg(2, param_2); Core::CurrentArmInterface().SetReg(2, param_2);
FuncReturn(retval.raw); FuncReturn(retval.raw);
@ -100,12 +100,12 @@ void SvcWrap() {
template <ResultCode func(u64, u64, u32, u32)> template <ResultCode func(u64, u64, u32, u32)>
void SvcWrap() { void SvcWrap() {
FuncReturn( FuncReturn(
func(Param(0), Param(1), (u32)(Param(3) & 0xFFFFFFFF), (u32)(Param(3) & 0xFFFFFFFF)).raw); func(Param(0), Param(1), static_cast<u32>(Param(3)), static_cast<u32>(Param(3))).raw);
} }
template <ResultCode func(u32, u64, u32)> template <ResultCode func(u32, u64, u32)>
void SvcWrap() { void SvcWrap() {
FuncReturn(func((u32)Param(0), Param(1), (u32)Param(2)).raw); FuncReturn(func(static_cast<u32>(Param(0)), Param(1), static_cast<u32>(Param(2))).raw);
} }
template <ResultCode func(u64, u64, u64)> template <ResultCode func(u64, u64, u64)>
@ -115,25 +115,28 @@ void SvcWrap() {
template <ResultCode func(u32, u64, u64, u32)> template <ResultCode func(u32, u64, u64, u32)>
void SvcWrap() { void SvcWrap() {
FuncReturn(func((u32)Param(0), Param(1), Param(2), (u32)Param(3)).raw); FuncReturn(
func(static_cast<u32>(Param(0)), Param(1), Param(2), static_cast<u32>(Param(3))).raw);
} }
template <ResultCode func(u32, u64, u64)> template <ResultCode func(u32, u64, u64)>
void SvcWrap() { void SvcWrap() {
FuncReturn(func((u32)Param(0), Param(1), Param(2)).raw); FuncReturn(func(static_cast<u32>(Param(0)), Param(1), Param(2)).raw);
} }
template <ResultCode func(u32*, u64, u64, s64)> template <ResultCode func(u32*, u64, u64, s64)>
void SvcWrap() { void SvcWrap() {
u32 param_1 = 0; u32 param_1 = 0;
ResultCode retval = func(&param_1, Param(1), (u32)(Param(2) & 0xFFFFFFFF), (s64)Param(3)); ResultCode retval =
func(&param_1, Param(1), static_cast<u32>(Param(2)), static_cast<s64>(Param(3)));
Core::CurrentArmInterface().SetReg(1, param_1); Core::CurrentArmInterface().SetReg(1, param_1);
FuncReturn(retval.raw); FuncReturn(retval.raw);
} }
template <ResultCode func(u64, u64, u32, s64)> template <ResultCode func(u64, u64, u32, s64)>
void SvcWrap() { void SvcWrap() {
FuncReturn(func(Param(0), Param(1), (u32)Param(2), (s64)Param(3)).raw); FuncReturn(
func(Param(0), Param(1), static_cast<u32>(Param(2)), static_cast<s64>(Param(3))).raw);
} }
template <ResultCode func(u64*, u64, u64, u64)> template <ResultCode func(u64*, u64, u64, u64)>
@ -147,8 +150,8 @@ void SvcWrap() {
template <ResultCode func(u32*, u64, u64, u64, u32, s32)> template <ResultCode func(u32*, u64, u64, u64, u32, s32)>
void SvcWrap() { void SvcWrap() {
u32 param_1 = 0; u32 param_1 = 0;
u32 retval = u32 retval = func(&param_1, Param(1), Param(2), Param(3), static_cast<u32>(Param(4)),
func(&param_1, Param(1), Param(2), Param(3), (u32)Param(4), (s32)(Param(5) & 0xFFFFFFFF)) static_cast<s32>(Param(5)))
.raw; .raw;
Core::CurrentArmInterface().SetReg(1, param_1); Core::CurrentArmInterface().SetReg(1, param_1);
FuncReturn(retval); FuncReturn(retval);
@ -172,7 +175,7 @@ void SvcWrap() {
template <ResultCode func(u32*, u64, u64, u32)> template <ResultCode func(u32*, u64, u64, u32)>
void SvcWrap() { void SvcWrap() {
u32 param_1 = 0; u32 param_1 = 0;
u32 retval = func(&param_1, Param(1), Param(2), (u32)(Param(3) & 0xFFFFFFFF)).raw; u32 retval = func(&param_1, Param(1), Param(2), static_cast<u32>(Param(3))).raw;
Core::CurrentArmInterface().SetReg(1, param_1); Core::CurrentArmInterface().SetReg(1, param_1);
FuncReturn(retval); FuncReturn(retval);
} }
@ -181,22 +184,22 @@ template <ResultCode func(Handle*, u64, u32, u32)>
void SvcWrap() { void SvcWrap() {
u32 param_1 = 0; u32 param_1 = 0;
u32 retval = u32 retval =
func(&param_1, Param(1), (u32)(Param(2) & 0xFFFFFFFF), (u32)(Param(3) & 0xFFFFFFFF)).raw; func(&param_1, Param(1), static_cast<u32>(Param(2)), static_cast<u32>(Param(3))).raw;
Core::CurrentArmInterface().SetReg(1, param_1); Core::CurrentArmInterface().SetReg(1, param_1);
FuncReturn(retval); FuncReturn(retval);
} }
template <ResultCode func(u64, u32, s32, s64)> template <ResultCode func(u64, u32, s32, s64)>
void SvcWrap() { void SvcWrap() {
FuncReturn( FuncReturn(func(Param(0), static_cast<u32>(Param(1)), static_cast<s32>(Param(2)),
func(Param(0), (u32)(Param(1) & 0xFFFFFFFF), (s32)(Param(2) & 0xFFFFFFFF), (s64)Param(3)) static_cast<s64>(Param(3)))
.raw); .raw);
} }
template <ResultCode func(u64, u32, s32, s32)> template <ResultCode func(u64, u32, s32, s32)>
void SvcWrap() { void SvcWrap() {
FuncReturn(func(Param(0), (u32)(Param(1) & 0xFFFFFFFF), (s32)(Param(2) & 0xFFFFFFFF), FuncReturn(func(Param(0), static_cast<u32>(Param(1)), static_cast<s32>(Param(2)),
(s32)(Param(3) & 0xFFFFFFFF)) static_cast<s32>(Param(3)))
.raw); .raw);
} }
@ -226,7 +229,7 @@ void SvcWrap() {
template <void func(s64)> template <void func(s64)>
void SvcWrap() { void SvcWrap() {
func((s64)Param(0)); func(static_cast<s64>(Param(0)));
} }
template <void func(u64, u64 len)> template <void func(u64, u64 len)>
@ -239,4 +242,9 @@ void SvcWrap() {
func(Param(0), Param(1), Param(2)); func(Param(0), Param(1), Param(2));
} }
template <void func(u32, u64, u64)>
void SvcWrap() {
func(static_cast<u32>(Param(0)), Param(1), Param(2));
}
} // namespace Kernel } // namespace Kernel