From 95e5436f41a3cffaace7c48be72373bebcaf91e4 Mon Sep 17 00:00:00 2001
From: bunnei
Date: Thu, 10 Apr 2014 19:55:59 -0400
Subject: cleaned up arm_interface, added a setter to set registers for use
with HLE return values
---
src/core/arm/interpreter/arm_interpreter.cpp | 39 +++++++++++++++++++++++++---
src/core/arm/interpreter/arm_interpreter.h | 37 ++++++++++++++++++++++++--
2 files changed, 70 insertions(+), 6 deletions(-)
(limited to 'src')
diff --git a/src/core/arm/interpreter/arm_interpreter.cpp b/src/core/arm/interpreter/arm_interpreter.cpp
index 81f38f016..4045779d7 100644
--- a/src/core/arm/interpreter/arm_interpreter.cpp
+++ b/src/core/arm/interpreter/arm_interpreter.cpp
@@ -31,30 +31,61 @@ ARM_Interpreter::ARM_Interpreter() {
m_state->Reg[13] = 0x10000000; // Set stack pointer to the top of the stack
}
+ARM_Interpreter::~ARM_Interpreter() {
+ delete m_state;
+}
+
+/**
+ * Set the Program Counter to an address
+ * @param addr Address to set PC to
+ */
void ARM_Interpreter::SetPC(u32 pc) {
m_state->pc = m_state->Reg[15] = pc;
}
+/*
+ * Get the current Program Counter
+ * @return Returns current PC
+ */
u32 ARM_Interpreter::GetPC() const {
return m_state->pc;
}
+/**
+ * Get an ARM register
+ * @param index Register index (0-15)
+ * @return Returns the value in the register
+ */
u32 ARM_Interpreter::GetReg(int index) const {
return m_state->Reg[index];
}
+/**
+ * Set an ARM register
+ * @param index Register index (0-15)
+ * @param value Value to set register to
+ */
+void ARM_Interpreter::SetReg(int index, u32 value) {
+ m_state->Reg[index] = value;
+}
+
+/**
+ * Get the current CPSR register
+ * @return Returns the value of the CPSR register
+ */
u32 ARM_Interpreter::GetCPSR() const {
return m_state->Cpsr;
}
+/**
+ * Returns the number of clock ticks since the last reset
+ * @return Returns number of clock ticks
+ */
u64 ARM_Interpreter::GetTicks() const {
return ARMul_Time(m_state);
}
-ARM_Interpreter::~ARM_Interpreter() {
- delete m_state;
-}
-
+/// Execture next instruction
void ARM_Interpreter::ExecuteInstruction() {
m_state->step++;
m_state->cycle++;
diff --git a/src/core/arm/interpreter/arm_interpreter.h b/src/core/arm/interpreter/arm_interpreter.h
index 932046d9a..f3c86f8dd 100644
--- a/src/core/arm/interpreter/arm_interpreter.h
+++ b/src/core/arm/interpreter/arm_interpreter.h
@@ -12,22 +12,55 @@
class ARM_Interpreter : virtual public ARM_Interface {
public:
+
ARM_Interpreter();
~ARM_Interpreter();
- void ExecuteInstruction();
-
+ /**
+ * Set the Program Counter to an address
+ * @param addr Address to set PC to
+ */
void SetPC(u32 pc);
+ /*
+ * Get the current Program Counter
+ * @return Returns current PC
+ */
u32 GetPC() const;
+ /**
+ * Get an ARM register
+ * @param index Register index (0-15)
+ * @return Returns the value in the register
+ */
u32 GetReg(int index) const;
+ /**
+ * Set an ARM register
+ * @param index Register index (0-15)
+ * @param value Value to set register to
+ */
+ void SetReg(int index, u32 value);
+
+ /**
+ * Get the current CPSR register
+ * @return Returns the value of the CPSR register
+ */
u32 GetCPSR() const;
+ /**
+ * Returns the number of clock ticks since the last reset
+ * @return Returns number of clock ticks
+ */
u64 GetTicks() const;
+protected:
+
+ /// Execture next instruction
+ void ExecuteInstruction();
+
private:
+
ARMul_State* m_state;
DISALLOW_COPY_AND_ASSIGN(ARM_Interpreter);
--
cgit v1.2.3
From d9bb4f11c61503bd2e40d2ea9fc9795c55e48c2e Mon Sep 17 00:00:00 2001
From: bunnei
Date: Thu, 10 Apr 2014 19:56:30 -0400
Subject: added Memory::GetCharPointer to read strings from HLE functions
---
src/core/mem_map.h | 4 ++++
1 file changed, 4 insertions(+)
(limited to 'src')
diff --git a/src/core/mem_map.h b/src/core/mem_map.h
index 1a3bd7234..94469ec8c 100644
--- a/src/core/mem_map.h
+++ b/src/core/mem_map.h
@@ -70,4 +70,8 @@ void Write32(const u32 addr, const u32 data);
u8* GetPointer(const u32 Address);
+inline const char* GetCharPointer(const u32 address) {
+ return (const char *)GetPointer(address);
+}
+
} // namespace
--
cgit v1.2.3
From fccbfc208c53ef6c3424531d8f4a42d3d23b200a Mon Sep 17 00:00:00 2001
From: bunnei
Date: Thu, 10 Apr 2014 19:57:56 -0400
Subject: missed this file with commit 95e5436f
---
src/core/arm/arm_interface.h | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
(limited to 'src')
diff --git a/src/core/arm/arm_interface.h b/src/core/arm/arm_interface.h
index dafde8368..eee4726db 100644
--- a/src/core/arm/arm_interface.h
+++ b/src/core/arm/arm_interface.h
@@ -42,6 +42,13 @@ public:
*/
virtual u32 GetReg(int index) const = 0;
+ /**
+ * Set an ARM register
+ * @param index Register index (0-15)
+ * @param value Value to set register to
+ */
+ virtual void SetReg(int index, u32 value) = 0;
+
/**
* Get the current CPSR register
* @return Returns the value of the CPSR register
@@ -59,11 +66,13 @@ public:
return m_num_instructions;
}
-private:
+protected:
/// Execture next instruction
virtual void ExecuteInstruction() = 0;
+private:
+
u64 m_num_instructions; ///< Number of instructions executed
DISALLOW_COPY_AND_ASSIGN(ARM_Interface);
--
cgit v1.2.3
From f68de21ad1cd267029b60ee3767d219c46f5fba0 Mon Sep 17 00:00:00 2001
From: bunnei
Date: Thu, 10 Apr 2014 19:58:28 -0400
Subject: added initial modules for setting up SysCall HLE
---
src/core/core.cpp | 18 +
src/core/core.vcxproj | 4 +
src/core/core.vcxproj.filters | 15 +
src/core/hle/function_wrappers.h | 726 +++++++++++++++++++++++++++++++++++++++
src/core/hle/hle.h | 35 ++
src/core/hle/hle_syscall.cpp | 22 ++
src/core/hle/hle_syscall.h | 42 +++
7 files changed, 862 insertions(+)
create mode 100644 src/core/hle/function_wrappers.h
create mode 100644 src/core/hle/hle.h
create mode 100644 src/core/hle/hle_syscall.cpp
create mode 100644 src/core/hle/hle_syscall.h
(limited to 'src')
diff --git a/src/core/core.cpp b/src/core/core.cpp
index 28f6b6c58..acb0a6e82 100644
--- a/src/core/core.cpp
+++ b/src/core/core.cpp
@@ -24,6 +24,24 @@ void RunLoop() {
/// Step the CPU one instruction
void SingleStep() {
+
+ char current_instr[512];
+
+ if (g_app_core->GetPC() == 0x080D1534) {
+ g_disasm->disasm(g_app_core->GetPC(), Memory::Read32(g_app_core->GetPC()), current_instr);
+
+
+ NOTICE_LOG(ARM11, "0x%08X 0x%08X 0x%08X 0x%08X 0x%08X 0x%08X",
+ g_app_core->GetReg(0),
+ g_app_core->GetReg(1),
+ g_app_core->GetReg(2),
+ g_app_core->GetReg(3), Memory::Read32(g_app_core->GetReg(0)), Memory::Read32(g_app_core->GetReg(1)));
+
+
+ NOTICE_LOG(ARM11, "0x%08X\t%s", g_app_core->GetPC(), current_instr);
+ }
+
+
g_app_core->Step();
HW::Update();
}
diff --git a/src/core/core.vcxproj b/src/core/core.vcxproj
index 1800b5512..55ce508a6 100644
--- a/src/core/core.vcxproj
+++ b/src/core/core.vcxproj
@@ -152,6 +152,7 @@
+
@@ -182,6 +183,9 @@
+
+
+
diff --git a/src/core/core.vcxproj.filters b/src/core/core.vcxproj.filters
index 2efac8127..7bac04a2d 100644
--- a/src/core/core.vcxproj.filters
+++ b/src/core/core.vcxproj.filters
@@ -22,6 +22,9 @@
{7ae34319-6d72-4d12-bc62-9b438ba9241f}
+
+ {8b62769e-3e2a-4a57-a7bc-b3b2933c2bc7}
+
@@ -75,6 +78,9 @@
+
+ hle
+
@@ -148,6 +154,15 @@
+
+ hle
+
+
+ hle
+
+
+ hle
+
diff --git a/src/core/hle/function_wrappers.h b/src/core/hle/function_wrappers.h
new file mode 100644
index 000000000..22588d95d
--- /dev/null
+++ b/src/core/hle/function_wrappers.h
@@ -0,0 +1,726 @@
+// Copyright (c) 2012- PPSSPP Project.
+
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, version 2.0 or later versions.
+
+// This program is distributed in the hope that 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 2.0 for more details.
+
+// A copy of the GPL 2.0 should have been included with the program.
+// If not, see http://www.gnu.org/licenses/
+
+// Official git repository and contact information can be found at
+// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
+
+#pragma once
+
+#include "common/common_types.h"
+#include "core/mem_map.h"
+#include "core/hle/hle.h"
+
+// For easy parameter parsing and return value processing.
+
+//32bit wrappers
+template void WrapV_V() {
+ func();
+}
+
+template void WrapU_V() {
+ RETURN(func());
+}
+
+template void WrapI_VC() {
+ u32 retval = func(Memory::GetPointer(PARAM(0)), Memory::GetCharPointer(PARAM(1)));
+ RETURN(retval);
+}
+
+template void WrapU_IVI() {
+ u32 retval = func(PARAM(0), Memory::GetPointer(PARAM(1)), PARAM(2));
+ RETURN(retval);
+}
+
+template void WrapI_CIIU() {
+ u32 retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2), PARAM(3));
+ RETURN(retval);
+}
+
+template void WrapI_ICUVVUI() {
+ u32 retval = func(PARAM(0), Memory::GetCharPointer(PARAM(1)), PARAM(2), Memory::GetPointer(PARAM(3)),Memory::GetPointer(PARAM(4)), PARAM(5), PARAM(6) );
+ RETURN(retval);
+}
+
+// Hm, do so many params get passed in registers?
+template void WrapI_CICIIIII() {
+ u32 retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), Memory::GetCharPointer(PARAM(2)),
+ PARAM(3), PARAM(4), PARAM(5), PARAM(6), PARAM(7));
+ RETURN(retval);
+}
+
+// Hm, do so many params get passed in registers?
+template void WrapI_CIIIIII() {
+ u32 retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2),
+ PARAM(3), PARAM(4), PARAM(5), PARAM(6));
+ RETURN(retval);
+}
+
+// Hm, do so many params get passed in registers?
+template void WrapI_IIIIIIU() {
+ u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4), PARAM(5), PARAM(6));
+ RETURN(retval);
+}
+
+// Hm, do so many params get passed in registers?
+template void WrapI_IIIIIIIIU() {
+ u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4), PARAM(5), PARAM(6), PARAM(7), PARAM(8));
+ RETURN(retval);
+}
+
+template void WrapU_IV() {
+ u32 retval = func(PARAM(0), Memory::GetPointer(PARAM(1)));
+ RETURN(retval);
+}
+
+template void WrapF_V() {
+ RETURNF(func());
+}
+
+// TODO: Not sure about the floating point parameter passing
+template void WrapF_IFU() {
+ RETURNF(func(PARAM(0), PARAMF(0), PARAM(1)));
+}
+
+template void WrapU_U() {
+ u32 retval = func(PARAM(0));
+ RETURN(retval);
+}
+
+template void WrapU_UI() {
+ u32 retval = func(PARAM(0), PARAM(1));
+ RETURN(retval);
+}
+
+template void WrapI_U() {
+ int retval = func(PARAM(0));
+ RETURN(retval);
+}
+
+template void WrapI_UI() {
+ int retval = func(PARAM(0), PARAM(1));
+ RETURN(retval);
+}
+
+template void WrapI_UIIU() {
+ int retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3));
+ RETURN(retval);
+}
+
+template void WrapU_IUI() {
+ u32 retval = func(PARAM(0), PARAM(1), PARAM(2));
+ RETURN(retval);
+}
+
+template void WrapI_UU() {
+ int retval = func(PARAM(0), PARAM(1));
+ RETURN(retval);
+}
+
+template void WrapI_UFF() {
+ // Not sure about the float arguments.
+ int retval = func(PARAM(0), PARAMF(0), PARAMF(1));
+ RETURN(retval);
+}
+
+template void WrapI_UUU() {
+ int retval = func(PARAM(0), PARAM(1), PARAM(2));
+ RETURN(retval);
+}
+
+template void WrapI_UUUI() {
+ int retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3));
+ RETURN(retval);
+}
+
+template void WrapI_UUUIIII() {
+ int retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4), PARAM(5), PARAM(6));
+ RETURN(retval);
+}
+
+template void WrapI_UUUU() {
+ int retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3));
+ RETURN(retval);
+}
+
+template void WrapI_UUUUU() {
+ int retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4));
+ RETURN(retval);
+}
+
+template void WrapI_V() {
+ int retval = func();
+ RETURN(retval);
+}
+
+template void WrapU_I() {
+ u32 retval = func(PARAM(0));
+ RETURN(retval);
+}
+
+template void WrapU_IIU() {
+ u32 retval = func(PARAM(0), PARAM(1), PARAM(2));
+ RETURN(retval);
+}
+
+template void WrapI_I() {
+ int retval = func(PARAM(0));
+ RETURN(retval);
+}
+
+template void WrapV_U() {
+ func(PARAM(0));
+}
+
+template void WrapV_I() {
+ func(PARAM(0));
+}
+
+template void WrapV_UU() {
+ func(PARAM(0), PARAM(1));
+}
+
+template void WrapV_II() {
+ func(PARAM(0), PARAM(1));
+}
+
+template void WrapV_UC() {
+ func(PARAM(0), Memory::GetCharPointer(PARAM(1)));
+}
+
+template void WrapI_UC() {
+ int retval = func(PARAM(0), Memory::GetCharPointer(PARAM(1)));
+ RETURN(retval);
+}
+
+template void WrapI_UCI() {
+ int retval = func(PARAM(0), Memory::GetCharPointer(PARAM(1)), PARAM(2));
+ RETURN(retval);
+}
+
+template void WrapU_UIIIII() {
+ u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4), PARAM(5));
+ RETURN(retval);
+}
+
+template void WrapU_UIIIU() {
+ u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4));
+ RETURN(retval);
+}
+
+template void WrapU_UIIIIII() {
+ u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4), PARAM(5), PARAM(6));
+ RETURN(retval);
+}
+
+template void WrapU_UU() {
+ u32 retval = func(PARAM(0), PARAM(1));
+ RETURN(retval);
+}
+
+template void WrapU_UUI() {
+ u32 retval = func(PARAM(0), PARAM(1), PARAM(2));
+ RETURN(retval);
+}
+
+template void WrapU_UUII() {
+ u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3));
+ RETURN(retval);
+}
+
+template void WrapU_CUUU() {
+ u32 retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2), PARAM(3));
+ RETURN(retval);
+}
+
+template void WrapV_UIUII() {
+ func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4));
+}
+
+template void WrapU_UIUII() {
+ u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4));
+ RETURN(retval);
+}
+
+template void WrapI_UIUII() {
+ int retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4));
+ RETURN(retval);
+}
+
+template void WrapU_UIUI() {
+ u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3));
+ RETURN(retval);
+}
+
+template void WrapI_UIUI() {
+ u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3));
+ RETURN(retval);
+}
+
+template void WrapU_UIU() {
+ u32 retval = func(PARAM(0), PARAM(1), PARAM(2));
+ RETURN(retval);
+}
+
+template void WrapU_UIUU() {
+ u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3));
+ RETURN(retval);
+}
+
+template void WrapU_UII() {
+ u32 retval = func(PARAM(0), PARAM(1), PARAM(2));
+ RETURN(retval);
+}
+
+template void WrapU_UIIU() {
+ u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3));
+ RETURN(retval);
+}
+
+template void WrapI_UIIUU() {
+ u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4));
+ RETURN(retval);
+}
+
+template void WrapI_UUII() {
+ int retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3));
+ RETURN(retval);
+}
+
+template void WrapI_UUIII() {
+ int retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4));
+ RETURN(retval);
+}
+
+template void WrapV_UIII() {
+ func(PARAM(0), PARAM(1), PARAM(2), PARAM(3));
+}
+
+template void WrapV_UIIIII() {
+ func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4), PARAM(5));
+}
+
+template void WrapV_UII() {
+ func(PARAM(0), PARAM(1), PARAM(2));
+}
+
+template void WrapU_IU() {
+ int retval = func(PARAM(0), PARAM(1));
+ RETURN(retval);
+}
+
+template void WrapI_IU() {
+ int retval = func(PARAM(0), PARAM(1));
+ RETURN(retval);
+}
+
+template void WrapI_UUI() {
+ int retval = func(PARAM(0), PARAM(1), PARAM(2));
+ RETURN(retval);
+}
+
+template void WrapI_UUIU() {
+ int retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3));
+ RETURN(retval);
+}
+
+template void WrapI_II() {
+ int retval = func(PARAM(0), PARAM(1));
+ RETURN(retval);
+}
+
+template void WrapI_III() {
+ int retval = func(PARAM(0), PARAM(1), PARAM(2));
+ RETURN(retval);
+}
+
+template void WrapI_IUI() {
+ int retval = func(PARAM(0), PARAM(1), PARAM(2));
+ RETURN(retval);
+}
+
+template void WrapI_IIII() {
+ int retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3));
+ RETURN(retval);
+}
+
+template void WrapI_UIII() {
+ int retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3));
+ RETURN(retval);
+}
+
+template void WrapI_IIIUI() {
+ int retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4));
+ RETURN(retval);
+}
+
+template void WrapI_IUUII() {
+ int retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4));
+ RETURN(retval);
+}
+
+template void WrapI_ICIUU() {
+ int retval = func(PARAM(0), Memory::GetCharPointer(PARAM(1)), PARAM(2), PARAM(3), PARAM(4));
+ RETURN(retval);
+}
+
+template void WrapI_IIU() {
+ int retval = func(PARAM(0), PARAM(1), PARAM(2));
+ RETURN(retval);
+}
+
+template void WrapV_IU() {
+ func(PARAM(0), PARAM(1));
+}
+
+template void WrapV_UI() {
+ func(PARAM(0), PARAM(1));
+}
+
+template void WrapU_C() {
+ u32 retval = func(Memory::GetCharPointer(PARAM(0)));
+ RETURN(retval);
+}
+
+template void WrapU_CCCU() {
+ u32 retval = func(Memory::GetCharPointer(PARAM(0)),
+ Memory::GetCharPointer(PARAM(1)), Memory::GetCharPointer(PARAM(2)),
+ PARAM(3));
+ RETURN(retval);
+}
+
+template void WrapI_C() {
+ int retval = func(Memory::GetCharPointer(PARAM(0)));
+ RETURN(retval);
+}
+
+template void WrapI_CU() {
+ int retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1));
+ RETURN(retval);
+}
+
+template void WrapI_CUI() {
+ int retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2));
+ RETURN(retval);
+}
+
+template void WrapI_ICIU() {
+ int retval = func(PARAM(0), Memory::GetCharPointer(PARAM(1)), PARAM(2), PARAM(3));
+ RETURN(retval);
+}
+
+template void WrapI_CIU() {
+ int retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2));
+ RETURN(retval);
+}
+
+template void WrapI_CUU() {
+ int retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2));
+ RETURN(retval);
+}
+
+template void WrapI_CUUU() {
+ int retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2),
+ PARAM(3));
+ RETURN(retval);
+}
+
+template void WrapI_CCII() {
+ int retval = func(Memory::GetCharPointer(PARAM(0)), Memory::GetCharPointer(PARAM(1)), PARAM(2), PARAM(3));
+ RETURN(retval);
+}
+
+template void WrapI_CUUIUU() {
+ int retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2),
+ PARAM(3), PARAM(4), PARAM(5));
+ RETURN(retval);
+}
+
+template void WrapI_CIIUII() {
+ int retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2),
+ PARAM(3), PARAM(4), PARAM(5));
+ RETURN(retval);
+}
+
+template void WrapI_CIUUU() {
+ int retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2),
+ PARAM(3), PARAM(4));
+ RETURN(retval);
+}
+
+template void WrapI_CUUUUU() {
+ int retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2),
+ PARAM(3), PARAM(4), PARAM(5));
+ RETURN(retval);
+}
+
+template void WrapU_CU() {
+ u32 retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1));
+ RETURN((u32) retval);
+}
+
+template void WrapU_UC() {
+ u32 retval = func(PARAM(0), Memory::GetCharPointer(PARAM(1)));
+ RETURN(retval);
+}
+
+template void WrapU_CUU() {
+ u32 retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2));
+ RETURN((u32) retval);
+}
+
+template void WrapU_III() {
+ u32 retval = func(PARAM(0), PARAM(1), PARAM(2));
+ RETURN(retval);
+}
+
+template void WrapU_II() {
+ u32 retval = func(PARAM(0), PARAM(1));
+ RETURN(retval);
+}
+
+template void WrapU_IIII() {
+ u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3));
+ RETURN(retval);
+}
+
+template void WrapU_IUU() {
+ u32 retval = func(PARAM(0), PARAM(1), PARAM(2));
+ RETURN(retval);
+}
+
+template void WrapU_IUUU() {
+ u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3));
+ RETURN(retval);
+}
+
+template void WrapU_IUUUU() {
+ u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4));
+ RETURN(retval);
+}
+
+template void WrapU_UUU() {
+ u32 retval = func(PARAM(0), PARAM(1), PARAM(2));
+ RETURN(retval);
+}
+
+template void WrapV_IUU() {
+ func(PARAM(0), PARAM(1), PARAM(2));
+}
+
+template void WrapV_IIU() {
+ func(PARAM(0), PARAM(1), PARAM(2));
+}
+
+template void WrapV_UIU() {
+ func(PARAM(0), PARAM(1), PARAM(2));
+}
+
+template void WrapI_UIU() {
+ int retval = func(PARAM(0), PARAM(1), PARAM(2));
+ RETURN(retval);
+}
+
+template void WrapV_IUUUU() {
+ func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4));
+}
+
+template void WrapV_UUU() {
+ func(PARAM(0), PARAM(1), PARAM(2));
+}
+
+template void WrapV_UUUU() {
+ func(PARAM(0), PARAM(1), PARAM(2), PARAM(3));
+}
+
+template void WrapV_CUIU() {
+ func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2), PARAM(3));
+}
+
+template void WrapI_CUIU() {
+ int retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2), PARAM(3));
+ RETURN(retval);
+}
+
+template void WrapV_UCUIU() {
+ func(PARAM(0), Memory::GetCharPointer(PARAM(1)), PARAM(2), PARAM(3),
+ PARAM(4));
+}
+
+template void WrapI_UCUIU() {
+ int retval = func(PARAM(0), Memory::GetCharPointer(PARAM(1)), PARAM(2),
+ PARAM(3), PARAM(4));
+ RETURN(retval);
+}
+
+template void WrapV_CUIIU() {
+ func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2), PARAM(3),
+ PARAM(4));
+}
+
+template void WrapI_CUIIU() {
+ int retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2),
+ PARAM(3), PARAM(4));
+ RETURN(retval);
+}
+
+template void WrapU_UUUU() {
+ u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3));
+ RETURN(retval);
+}
+
+template void WrapU_UCUU() {
+ u32 retval = func(PARAM(0), Memory::GetCharPointer(PARAM(1)), PARAM(2), PARAM(3));
+ RETURN(retval);
+}
+
+template void WrapU_UUUI() {
+ u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3));
+ RETURN(retval);
+}
+
+template void WrapU_UUUIU() {
+ u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4));
+ RETURN(retval);
+}
+
+template void WrapU_UUUIUI() {
+ u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4), PARAM(5));
+ RETURN(retval);
+}
+
+template void WrapU_UUIU() {
+ u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3));
+ RETURN(retval);
+}
+
+template void WrapU_UIII() {
+ u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3));
+ RETURN(retval);
+}
+
+template void WrapI_IUUUU() {
+ int retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4));
+ RETURN(retval);
+}
+
+template void WrapI_IUUUUU() {
+ int retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4), PARAM(5));
+ RETURN(retval);
+}
+
+template void WrapI_IUII() {
+ int retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3));
+ RETURN(retval);
+}
+template void WrapU_UUUUU() {
+ u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4));
+ RETURN(retval);
+}
+
+template void WrapV_UUUUU() {
+ func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4));
+}
+
+template void WrapU_CC() {
+ int retval = func(Memory::GetCharPointer(PARAM(0)),
+ Memory::GetCharPointer(PARAM(1)));
+ RETURN(retval);
+}
+
+template void WrapV_CI() {
+ func(Memory::GetCharPointer(PARAM(0)), PARAM(1));
+}
+
+template void WrapU_CI() {
+ int retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1));
+ RETURN(retval);
+}
+
+template void WrapU_CII() {
+ int retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2));
+ RETURN(retval);
+}
+
+template void WrapU_CIUIU() {
+ int retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2),
+ PARAM(3), PARAM(4));
+ RETURN(retval);
+}
+
+template void WrapU_CIUIUI() {
+ u32 retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2),
+ PARAM(3), PARAM(4), PARAM(5));
+ RETURN(retval);
+}
+
+template void WrapU_UUUUUU() {
+ u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4),
+ PARAM(5));
+ RETURN(retval);
+}
+
+template void WrapI_IUUU() {
+ int retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3));
+ RETURN(retval);
+}
+
+template void WrapI_IUU() {
+ int retval = func(PARAM(0), PARAM(1), PARAM(2));
+ RETURN(retval);
+}
+
+template void WrapU_UUUUUUU() {
+ u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4), PARAM(5), PARAM(6));
+ RETURN(retval);
+}
+
+template void WrapI_UIUU() {
+ u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3));
+ RETURN(retval);
+}
+
+template void WrapI_IC() {
+ int retval = func(PARAM(0), Memory::GetCharPointer(PARAM(1)));
+ RETURN(retval);
+}
+
+template void WrapI_ICCUI() {
+ int retval = func(PARAM(0), Memory::GetCharPointer(PARAM(1)), Memory::GetCharPointer(PARAM(2)), PARAM(3), PARAM(4));
+ RETURN(retval);
+}
+
+template void WrapI_ICCI() {
+ int retval = func(PARAM(0), Memory::GetCharPointer(PARAM(1)), Memory::GetCharPointer(PARAM(2)), PARAM(3));
+ RETURN(retval);
+}
+
+template void WrapI_CII() {
+ int retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2));
+ RETURN(retval);
+}
+
+template void WrapI_ICI() {
+ int retval = func(PARAM(0), Memory::GetCharPointer(PARAM(1)), PARAM(2));
+ RETURN(retval);
+}
+
+template void WrapI_IVVVVUI(){
+ u32 retval = func(PARAM(0), Memory::GetPointer(PARAM(1)), Memory::GetPointer(PARAM(2)), Memory::GetPointer(PARAM(3)), Memory::GetPointer(PARAM(4)), PARAM(5), PARAM(6) );
+ RETURN(retval);
+}
+
+template void WrapI_ICUVIII(){
+ u32 retval = func(PARAM(0), Memory::GetCharPointer(PARAM(1)), PARAM(2), Memory::GetPointer(PARAM(3)), PARAM(4), PARAM(5), PARAM(6));
+ RETURN(retval);
+}
diff --git a/src/core/hle/hle.h b/src/core/hle/hle.h
new file mode 100644
index 000000000..6780b52c4
--- /dev/null
+++ b/src/core/hle/hle.h
@@ -0,0 +1,35 @@
+// Copyright 2014 Citra Emulator Project
+// Licensed under GPLv2
+// Refer to the license.txt file included.
+
+#pragma once
+
+#include "common/common_types.h"
+#include "core/core.h"
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+typedef void (*HLEFunc)();
+typedef void (*SysCallFunc)();
+
+struct HLEFunction {
+ u32 id;
+ HLEFunc func;
+ const char* name;
+ u32 flags;
+};
+
+struct HLEModule {
+ const char* name;
+ int num_funcs;
+ const HLEFunction* func_table;
+};
+
+struct SysCall {
+ u8 id;
+ SysCallFunc func;
+ const char* name;
+};
+
+#define PARAM(n) Core::g_app_core->GetReg(n)
+#define RETURN(n) Core::g_app_core->SetReg(0, n)
diff --git a/src/core/hle/hle_syscall.cpp b/src/core/hle/hle_syscall.cpp
new file mode 100644
index 000000000..c8a516848
--- /dev/null
+++ b/src/core/hle/hle_syscall.cpp
@@ -0,0 +1,22 @@
+// Copyright 2014 Citra Emulator Project
+// Licensed under GPLv2
+// Refer to the license.txt file included.
+
+#include "core/hle/function_wrappers.h"
+#include "core/hle/hle_syscall.h"
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+
+
+Result SVC_ConnectToPort(void* out, const char* port_name) {
+ NOTICE_LOG(OSHLE, "SVC_ConnectToPort called, port_name: %s", port_name);
+ return 0;
+}
+
+const SysCall SysCallTable[] = {
+ {0x2D, WrapI_VC, "svcConnectToPort"},
+};
+
+void Register_SysCalls() {
+}
diff --git a/src/core/hle/hle_syscall.h b/src/core/hle/hle_syscall.h
new file mode 100644
index 000000000..506dcfc78
--- /dev/null
+++ b/src/core/hle/hle_syscall.h
@@ -0,0 +1,42 @@
+// Copyright 2014 Citra Emulator Project
+// Licensed under GPLv2
+// Refer to the license.txt file included.
+
+#pragma once
+
+#include "common/common_types.h"
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+//template
+//class KernelObject {
+//public:
+// virtual ~KernelObject() {}
+//
+// T GetNative() const {
+// return m_native;
+// }
+//
+// void SetNative(const T& native) {
+// m_native = native;
+// }
+//
+// virtual const char *GetTypeName() {return "[BAD KERNEL OBJECT TYPE]";}
+// virtual const char *GetName() {return "[UNKNOWN KERNEL OBJECT]";}
+//
+//private:
+// T m_native;
+//};
+
+//class Handle : public KernelObject {
+// const char* GetTypeName() {
+// return "Handle";
+// }
+//};
+
+
+typedef u32 Handle;
+typedef s32 Result;
+
+
+Result ConnectToPort(Handle* out, const char* port_name);
--
cgit v1.2.3
From 2a7d7ce55d51a1cf893d14e893b87941df4a2f03 Mon Sep 17 00:00:00 2001
From: bunnei
Date: Thu, 10 Apr 2014 21:30:00 -0400
Subject: - removed syscall classes (will just use HLEFunction)
- added hle.cpp and module registration
- removed unused code
---
src/core/core.vcxproj | 1 +
src/core/core.vcxproj.filters | 3 +++
src/core/hle.cpp | 33 +++++++++++++++++++++++++++++++++
src/core/hle/hle.h | 18 ++++++++++--------
src/core/hle/hle_syscall.cpp | 10 ++++++----
src/core/hle/hle_syscall.h | 4 +---
6 files changed, 54 insertions(+), 15 deletions(-)
create mode 100644 src/core/hle.cpp
(limited to 'src')
diff --git a/src/core/core.vcxproj b/src/core/core.vcxproj
index 55ce508a6..8097a47d3 100644
--- a/src/core/core.vcxproj
+++ b/src/core/core.vcxproj
@@ -152,6 +152,7 @@
+
diff --git a/src/core/core.vcxproj.filters b/src/core/core.vcxproj.filters
index 7bac04a2d..79bddf09a 100644
--- a/src/core/core.vcxproj.filters
+++ b/src/core/core.vcxproj.filters
@@ -81,6 +81,9 @@
hle
+
+ hle
+
diff --git a/src/core/hle.cpp b/src/core/hle.cpp
new file mode 100644
index 000000000..f0c7d2178
--- /dev/null
+++ b/src/core/hle.cpp
@@ -0,0 +1,33 @@
+// Copyright 2014 Citra Emulator Project
+// Licensed under GPLv2
+// Refer to the license.txt file included.
+
+#include
+
+#include "core/hle/hle.h"
+#include "core/hle/hle_syscall.h"
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace HLE {
+
+static std::vector g_module_db;
+
+void RegisterModule(const char *name, int num_functions, const HLEFunction *func_table) {
+ HLEModule module = {name, num_functions, func_table};
+ g_module_db.push_back(module);
+}
+
+void RegisterAllModules() {
+ Register_SysCall();
+}
+
+void Init() {
+ RegisterAllModules();
+}
+
+void Shutdown() {
+ g_module_db.clear();
+}
+
+} // namespace
diff --git a/src/core/hle/hle.h b/src/core/hle/hle.h
index 6780b52c4..6648c787f 100644
--- a/src/core/hle/hle.h
+++ b/src/core/hle/hle.h
@@ -10,13 +10,11 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
typedef void (*HLEFunc)();
-typedef void (*SysCallFunc)();
struct HLEFunction {
u32 id;
HLEFunc func;
const char* name;
- u32 flags;
};
struct HLEModule {
@@ -25,11 +23,15 @@ struct HLEModule {
const HLEFunction* func_table;
};
-struct SysCall {
- u8 id;
- SysCallFunc func;
- const char* name;
-};
-
#define PARAM(n) Core::g_app_core->GetReg(n)
#define RETURN(n) Core::g_app_core->SetReg(0, n)
+
+namespace HLE {
+
+void Init();
+
+void Shutdown();
+
+void RegisterModule(const char *name, int num_functions, const HLEFunction *func_table);
+
+} // namespace
diff --git a/src/core/hle/hle_syscall.cpp b/src/core/hle/hle_syscall.cpp
index c8a516848..b17a2e220 100644
--- a/src/core/hle/hle_syscall.cpp
+++ b/src/core/hle/hle_syscall.cpp
@@ -7,16 +7,18 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
-
+typedef u32 Handle;
+typedef s32 Result;
Result SVC_ConnectToPort(void* out, const char* port_name) {
- NOTICE_LOG(OSHLE, "SVC_ConnectToPort called, port_name: %s", port_name);
+ NOTICE_LOG(OSHLE, "svcConnectToPort called, port_name: %s", port_name);
return 0;
}
-const SysCall SysCallTable[] = {
+const HLEFunction SysCallTable[] = {
{0x2D, WrapI_VC, "svcConnectToPort"},
};
-void Register_SysCalls() {
+void Register_SysCall() {
+ HLE::RegisterModule("SysCallTable", ARRAY_SIZE(SysCallTable), SysCallTable);
}
diff --git a/src/core/hle/hle_syscall.h b/src/core/hle/hle_syscall.h
index 506dcfc78..643af0bf4 100644
--- a/src/core/hle/hle_syscall.h
+++ b/src/core/hle/hle_syscall.h
@@ -35,8 +35,6 @@
//};
-typedef u32 Handle;
-typedef s32 Result;
-Result ConnectToPort(Handle* out, const char* port_name);
+void Register_SysCall();
--
cgit v1.2.3
From 3bd041f5b0cd481ded892594d569462492679e39 Mon Sep 17 00:00:00 2001
From: bunnei
Date: Thu, 10 Apr 2014 22:15:07 -0400
Subject: changed some naming/misc cleanups
---
src/core/hle.cpp | 6 +++---
src/core/hle/hle.h | 28 +++++++++++++++-------------
src/core/hle/hle_syscall.cpp | 4 ++--
src/core/hle/hle_syscall.h | 3 ---
4 files changed, 20 insertions(+), 21 deletions(-)
(limited to 'src')
diff --git a/src/core/hle.cpp b/src/core/hle.cpp
index f0c7d2178..8dad7695b 100644
--- a/src/core/hle.cpp
+++ b/src/core/hle.cpp
@@ -11,10 +11,10 @@
namespace HLE {
-static std::vector g_module_db;
+static std::vector g_module_db;
-void RegisterModule(const char *name, int num_functions, const HLEFunction *func_table) {
- HLEModule module = {name, num_functions, func_table};
+void RegisterModule(std::string name, int num_functions, const FunctionDef* func_table) {
+ ModuleDef module = {name, num_functions, func_table};
g_module_db.push_back(module);
}
diff --git a/src/core/hle/hle.h b/src/core/hle/hle.h
index 6648c787f..35c8a4621 100644
--- a/src/core/hle/hle.h
+++ b/src/core/hle/hle.h
@@ -9,29 +9,31 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
-typedef void (*HLEFunc)();
+#define PARAM(n) Core::g_app_core->GetReg(n)
+#define RETURN(n) Core::g_app_core->SetReg(0, n)
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace HLE {
-struct HLEFunction {
+typedef void (*Func)();
+
+struct FunctionDef {
u32 id;
- HLEFunc func;
- const char* name;
+ Func func;
+ std::string name;
};
-struct HLEModule {
- const char* name;
+struct ModuleDef {
+ std::string name;
int num_funcs;
- const HLEFunction* func_table;
+ const FunctionDef* func_table;
};
-#define PARAM(n) Core::g_app_core->GetReg(n)
-#define RETURN(n) Core::g_app_core->SetReg(0, n)
-
-namespace HLE {
-
void Init();
void Shutdown();
-void RegisterModule(const char *name, int num_functions, const HLEFunction *func_table);
+void RegisterModule(std::string name, int num_functions, const FunctionDef *func_table);
} // namespace
diff --git a/src/core/hle/hle_syscall.cpp b/src/core/hle/hle_syscall.cpp
index b17a2e220..fdcaa914f 100644
--- a/src/core/hle/hle_syscall.cpp
+++ b/src/core/hle/hle_syscall.cpp
@@ -15,10 +15,10 @@ Result SVC_ConnectToPort(void* out, const char* port_name) {
return 0;
}
-const HLEFunction SysCallTable[] = {
+const HLE::FunctionDef SysCall_Table[] = {
{0x2D, WrapI_VC, "svcConnectToPort"},
};
void Register_SysCall() {
- HLE::RegisterModule("SysCallTable", ARRAY_SIZE(SysCallTable), SysCallTable);
+ HLE::RegisterModule("SysCallTable", ARRAY_SIZE(SysCall_Table), SysCall_Table);
}
diff --git a/src/core/hle/hle_syscall.h b/src/core/hle/hle_syscall.h
index 643af0bf4..4faa14535 100644
--- a/src/core/hle/hle_syscall.h
+++ b/src/core/hle/hle_syscall.h
@@ -34,7 +34,4 @@
// }
//};
-
-
-
void Register_SysCall();
--
cgit v1.2.3
From d4cb2aab63d4739db6b09a821a9e715985e615be Mon Sep 17 00:00:00 2001
From: bunnei
Date: Thu, 10 Apr 2014 22:43:48 -0400
Subject: added logger for generic HLE
---
src/common/log.h | 2 +-
src/common/log_manager.cpp | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
(limited to 'src')
diff --git a/src/common/log.h b/src/common/log.h
index 432a307f0..2eacf05f2 100644
--- a/src/common/log.h
+++ b/src/common/log.h
@@ -56,7 +56,7 @@ enum LOG_TYPE {
WII_IPC_HLE,
WII_IPC_NET,
WII_IPC_WC24,
- WII_IPC_SSL,
+ HLE,
RENDER,
LCD,
HW,
diff --git a/src/common/log_manager.cpp b/src/common/log_manager.cpp
index 245760d0d..b2dbbbdac 100644
--- a/src/common/log_manager.cpp
+++ b/src/common/log_manager.cpp
@@ -68,8 +68,8 @@ LogManager::LogManager()
m_Log[LogTypes::LCD] = new LogContainer("LCD", "LCD");
m_Log[LogTypes::WII_IPC_NET] = new LogContainer("WII_IPC_NET", "WII IPC NET");
m_Log[LogTypes::WII_IPC_WC24] = new LogContainer("WII_IPC_WC24", "WII IPC WC24");
- m_Log[LogTypes::WII_IPC_SSL] = new LogContainer("WII_IPC_SSL", "WII IPC SSL");
- m_Log[LogTypes::HW] = new LogContainer("HARDWARE", "HARDWARE");
+ m_Log[LogTypes::HLE] = new LogContainer("HLE", "High Level Emulation");
+ m_Log[LogTypes::HW] = new LogContainer("HW", "Hardware");
m_Log[LogTypes::ACTIONREPLAY] = new LogContainer("ActionReplay", "ActionReplay");
m_Log[LogTypes::MEMCARD_MANAGER] = new LogContainer("MemCard Manager", "MemCard Manager");
m_Log[LogTypes::NETPLAY] = new LogContainer("NETPLAY", "Netplay");
--
cgit v1.2.3
From 5d95bb98434b8e7cd67010f6064ccdb69c1222bb Mon Sep 17 00:00:00 2001
From: bunnei
Date: Thu, 10 Apr 2014 22:45:40 -0400
Subject: cleaned up some logging messages
---
src/core/core.cpp | 22 ++--------------------
src/core/hw/hw.cpp | 8 ++++----
src/core/mem_map.cpp | 4 ++--
src/core/mem_map_funcs.cpp | 2 +-
src/core/system.cpp | 15 ++++++++++-----
src/video_core/video_core.cpp | 3 ++-
6 files changed, 21 insertions(+), 33 deletions(-)
(limited to 'src')
diff --git a/src/core/core.cpp b/src/core/core.cpp
index acb0a6e82..859a62c78 100644
--- a/src/core/core.cpp
+++ b/src/core/core.cpp
@@ -24,24 +24,6 @@ void RunLoop() {
/// Step the CPU one instruction
void SingleStep() {
-
- char current_instr[512];
-
- if (g_app_core->GetPC() == 0x080D1534) {
- g_disasm->disasm(g_app_core->GetPC(), Memory::Read32(g_app_core->GetPC()), current_instr);
-
-
- NOTICE_LOG(ARM11, "0x%08X 0x%08X 0x%08X 0x%08X 0x%08X 0x%08X",
- g_app_core->GetReg(0),
- g_app_core->GetReg(1),
- g_app_core->GetReg(2),
- g_app_core->GetReg(3), Memory::Read32(g_app_core->GetReg(0)), Memory::Read32(g_app_core->GetReg(1)));
-
-
- NOTICE_LOG(ARM11, "0x%08X\t%s", g_app_core->GetPC(), current_instr);
- }
-
-
g_app_core->Step();
HW::Update();
}
@@ -58,7 +40,7 @@ void Stop() {
/// Initialize the core
int Init() {
- NOTICE_LOG(MASTER_LOG, "Core initialized OK");
+ NOTICE_LOG(MASTER_LOG, "initialized OK");
g_disasm = new ARM_Disasm();
g_app_core = new ARM_Interpreter();
@@ -72,7 +54,7 @@ void Shutdown() {
delete g_app_core;
delete g_sys_core;
- NOTICE_LOG(MASTER_LOG, "Core shutdown OK");
+ NOTICE_LOG(MASTER_LOG, "shutdown OK");
}
} // namespace
diff --git a/src/core/hw/hw.cpp b/src/core/hw/hw.cpp
index 44625e3af..7191d7c60 100644
--- a/src/core/hw/hw.cpp
+++ b/src/core/hw/hw.cpp
@@ -12,12 +12,12 @@ namespace HW {
template
inline void Read(T &var, const u32 addr) {
- NOTICE_LOG(HW, "Hardware read from address %08X", addr);
+ NOTICE_LOG(HW, "read from address %08X", addr);
}
template
inline void Write(u32 addr, const T data) {
- NOTICE_LOG(HW, "Hardware write to address %08X", addr);
+ NOTICE_LOG(HW, "write to address %08X", addr);
}
// Explicitly instantiate template functions because we aren't defining this in the header:
@@ -40,12 +40,12 @@ void Update() {
/// Initialize hardware
void Init() {
LCD::Init();
- NOTICE_LOG(HW, "Hardware initialized OK");
+ NOTICE_LOG(HW, "initialized OK");
}
/// Shutdown hardware
void Shutdown() {
- NOTICE_LOG(HW, "Hardware shutdown OK");
+ NOTICE_LOG(HW, "shutdown OK");
}
}
\ No newline at end of file
diff --git a/src/core/mem_map.cpp b/src/core/mem_map.cpp
index 96f8d0440..a5865d785 100644
--- a/src/core/mem_map.cpp
+++ b/src/core/mem_map.cpp
@@ -63,7 +63,7 @@ void Init() {
g_scratchpad = new u8[MEM_SCRATCHPAD_SIZE];
- NOTICE_LOG(MEMMAP, "Memory system initialized. RAM at %p (mirror at 0 @ %p)", g_fcram,
+ NOTICE_LOG(MEMMAP, "initialized OK, RAM at %p (mirror at 0 @ %p)", g_fcram,
g_physical_fcram);
}
@@ -77,7 +77,7 @@ void Shutdown() {
g_base = NULL;
g_scratchpad = NULL;
- NOTICE_LOG(MEMMAP, "Memory system shut down.");
+ NOTICE_LOG(MEMMAP, "shutdown OK");
}
} // namespace
diff --git a/src/core/mem_map_funcs.cpp b/src/core/mem_map_funcs.cpp
index 4c0e08b3f..00719445f 100644
--- a/src/core/mem_map_funcs.cpp
+++ b/src/core/mem_map_funcs.cpp
@@ -40,7 +40,7 @@ inline void _Read(T &var, const u32 addr) {
var = *((const T*)&g_fcram[addr & MEM_FCRAM_MASK]);
} else {
- _assert_msg_(MEMMAP, false, "unknown memory read");
+ _assert_msg_(MEMMAP, false, "unknown memory read @ 0x%08X", addr);
}
}
diff --git a/src/core/system.cpp b/src/core/system.cpp
index edb07fef5..c77092327 100644
--- a/src/core/system.cpp
+++ b/src/core/system.cpp
@@ -7,6 +7,7 @@
#include "core/mem_map.h"
#include "core/system.h"
#include "core/hw/hw.h"
+#include "core/hle/hle.h"
#include "video_core/video_core.h"
@@ -19,15 +20,16 @@ void UpdateState(State state) {
}
void Init(EmuWindow* emu_window) {
- Core::Init();
- Memory::Init();
+ Core::Init();
+ Memory::Init();
HW::Init();
- CoreTiming::Init();
+ HLE::Init();
+ CoreTiming::Init();
VideoCore::Init(emu_window);
}
void RunLoopFor(int cycles) {
- RunLoopUntil(CoreTiming::GetTicks() + cycles);
+ RunLoopUntil(CoreTiming::GetTicks() + cycles);
}
void RunLoopUntil(u64 global_cycles) {
@@ -35,9 +37,12 @@ void RunLoopUntil(u64 global_cycles) {
void Shutdown() {
Core::Shutdown();
+ Memory::Shutdown();
HW::Shutdown();
+ HLE::Shutdown();
+ CoreTiming::Shutdown();
VideoCore::Shutdown();
- g_ctr_file_system.Shutdown();
+ g_ctr_file_system.Shutdown();
}
} // namespace
diff --git a/src/video_core/video_core.cpp b/src/video_core/video_core.cpp
index e227b6795..f2e17f9f9 100644
--- a/src/video_core/video_core.cpp
+++ b/src/video_core/video_core.cpp
@@ -38,12 +38,13 @@ void Init(EmuWindow* emu_window) {
g_current_frame = 0;
- NOTICE_LOG(VIDEO, "initialized ok");
+ NOTICE_LOG(VIDEO, "initialized OK");
}
/// Shutdown the video core
void Shutdown() {
delete g_renderer;
+ NOTICE_LOG(VIDEO, "shutdown OK");
}
} // namespace
--
cgit v1.2.3
From 01bedbf956a261fb339eba6901716510cc8c9ca2 Mon Sep 17 00:00:00 2001
From: bunnei
Date: Thu, 10 Apr 2014 22:49:12 -0400
Subject: updated logging message
---
src/core/hw/hw_lcd.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
(limited to 'src')
diff --git a/src/core/hw/hw_lcd.cpp b/src/core/hw/hw_lcd.cpp
index fd783a84a..9fb485bac 100644
--- a/src/core/hw/hw_lcd.cpp
+++ b/src/core/hw/hw_lcd.cpp
@@ -37,12 +37,12 @@ void Update() {
/// Initialize hardware
void Init() {
g_last_ticks = Core::g_app_core->GetTicks();
- NOTICE_LOG(LCD, "LCD initialized OK");
+ NOTICE_LOG(LCD, "initialized OK");
}
/// Shutdown hardware
void Shutdown() {
- NOTICE_LOG(LCD, "LCD shutdown OK");
+ NOTICE_LOG(LCD, "shutdown OK");
}
} // namespace
--
cgit v1.2.3
From 2bde8f28561ea9436d13d990f6b129a0e80a325e Mon Sep 17 00:00:00 2001
From: bunnei
Date: Thu, 10 Apr 2014 23:26:12 -0400
Subject: base code to call a syscall from ARM11 appcore
---
src/core/arm/interpreter/armemu.cpp | 3 ++
src/core/hle.cpp | 28 +++++++++++++++++--
src/core/hle/hle.h | 6 ++--
src/core/hle/hle_syscall.cpp | 55 ++++++++++++++++++++++++++++++++++---
src/core/hle/hle_syscall.h | 2 +-
5 files changed, 85 insertions(+), 9 deletions(-)
(limited to 'src')
diff --git a/src/core/arm/interpreter/armemu.cpp b/src/core/arm/interpreter/armemu.cpp
index 46c51fbe8..6074ff480 100644
--- a/src/core/arm/interpreter/armemu.cpp
+++ b/src/core/arm/interpreter/armemu.cpp
@@ -16,6 +16,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+#include "core/hle/hle.h"
+
#include "arm_regformat.h"
#include "armdefs.h"
#include "armemu.h"
@@ -4558,6 +4560,7 @@ ARMul_Emulate26 (ARMul_State * state)
// ARMul_OSHandleSWI (state, BITS (0, 23));
// break;
//}
+ HLE::CallSyscall(instr);
ARMul_Abort (state, ARMul_SWIV);
break;
}
diff --git a/src/core/hle.cpp b/src/core/hle.cpp
index 8dad7695b..d62d2d0ce 100644
--- a/src/core/hle.cpp
+++ b/src/core/hle.cpp
@@ -13,21 +13,45 @@ namespace HLE {
static std::vector g_module_db;
+const FunctionDef* GetSyscallInfo(u32 opcode) {
+ u32 func_num = opcode & 0xFFFFFF; // 8 bits
+ if (func_num > 0xFF) {
+ ERROR_LOG(HLE,"Unknown syscall: 0x%02X", func_num);
+ return NULL;
+ }
+ return &g_module_db[0].func_table[func_num];
+}
+
+void CallSyscall(u32 opcode) {
+ const FunctionDef *info = GetSyscallInfo(opcode);
+
+ if (!info) {
+ return;
+ }
+ if (info->func) {
+ info->func();
+ } else {
+ ERROR_LOG(HLE, "Unimplemented HLE function %s", info->name);
+ }
+}
+
void RegisterModule(std::string name, int num_functions, const FunctionDef* func_table) {
ModuleDef module = {name, num_functions, func_table};
g_module_db.push_back(module);
}
void RegisterAllModules() {
- Register_SysCall();
+ Register_Syscall();
}
void Init() {
RegisterAllModules();
+ NOTICE_LOG(HLE, "initialized OK");
}
void Shutdown() {
- g_module_db.clear();
+ g_module_db.clear();
+ NOTICE_LOG(HLE, "shutdown OK");
}
} // namespace
diff --git a/src/core/hle/hle.h b/src/core/hle/hle.h
index 35c8a4621..e3b8d483a 100644
--- a/src/core/hle/hle.h
+++ b/src/core/hle/hle.h
@@ -30,10 +30,12 @@ struct ModuleDef {
const FunctionDef* func_table;
};
+void RegisterModule(std::string name, int num_functions, const FunctionDef *func_table);
+
+void CallSyscall(u32 opcode);
+
void Init();
void Shutdown();
-void RegisterModule(std::string name, int num_functions, const FunctionDef *func_table);
-
} // namespace
diff --git a/src/core/hle/hle_syscall.cpp b/src/core/hle/hle_syscall.cpp
index fdcaa914f..53d721275 100644
--- a/src/core/hle/hle_syscall.cpp
+++ b/src/core/hle/hle_syscall.cpp
@@ -10,15 +10,62 @@
typedef u32 Handle;
typedef s32 Result;
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
Result SVC_ConnectToPort(void* out, const char* port_name) {
NOTICE_LOG(OSHLE, "svcConnectToPort called, port_name: %s", port_name);
return 0;
}
-const HLE::FunctionDef SysCall_Table[] = {
- {0x2D, WrapI_VC, "svcConnectToPort"},
+const HLE::FunctionDef Syscall_Table[] = {
+ {0x00, NULL, "Unknown"},
+ {0x01, NULL, "svcControlMemory"},
+ {0x02, NULL, "svcQueryMemory"},
+ {0x03, NULL, "svcExitProcess"},
+ {0x04, NULL, "svcGetProcessAffinityMask"},
+ {0x05, NULL, "svcSetProcessAffinityMask"},
+ {0x06, NULL, "svcGetProcessIdealProcessor"},
+ {0x07, NULL, "svcSetProcessIdealProcessor"},
+ {0x08, NULL, "svcCreateThread"},
+ {0x09, NULL, "svcExitThread"},
+ {0x0A, NULL, "svcSleepThread"},
+ {0x0B, NULL, "svcGetThreadPriority"},
+ {0x0C, NULL, "svcSetThreadPriority"},
+ {0x0D, NULL, "svcGetThreadAffinityMask"},
+ {0x0E, NULL, "svcSetThreadAffinityMask"},
+ {0x0F, NULL, "svcGetThreadIdealProcessor"},
+ {0x10, NULL, "svcSetThreadIdealProcessor"},
+ {0x11, NULL, "svcGetCurrentProcessorNumber"},
+ {0x12, NULL, "svcRun"},
+ {0x13, NULL, "svcCreateMutex"},
+ {0x14, NULL, "svcReleaseMutex"},
+ {0x15, NULL, "svcCreateSemaphore"},
+ {0x16, NULL, "svcReleaseSemaphore"},
+ {0x17, NULL, "svcCreateEvent"},
+ {0x18, NULL, "svcSignalEvent"},
+ {0x19, NULL, "svcClearEvent"},
+ {0x1A, NULL, "svcCreateTimer"},
+ {0x1B, NULL, "svcSetTimer"},
+ {0x1C, NULL, "svcCancelTimer"},
+ {0x1D, NULL, "svcClearTimer"},
+ {0x1E, NULL, "svcCreateMemoryBlock"},
+ {0x1F, NULL, "svcMapMemoryBlock"},
+ {0x20, NULL, "svcUnmapMemoryBlock"},
+ {0x21, NULL, "svcCreateAddressArbiter"},
+ {0x22, NULL, "svcArbitrateAddress"},
+ {0x23, NULL, "svcCloseHandle"},
+ {0x24, NULL, "svcWaitSynchronization1"},
+ {0x25, NULL, "svcWaitSynchronizationN"},
+ {0x26, NULL, "svcSignalAndWait"},
+ {0x27, NULL, "svcDuplicateHandle"},
+ {0x28, NULL, "svcGetSystemTick"},
+ {0x29, NULL, "svcGetHandleInfo"},
+ {0x2A, NULL, "svcGetSystemInfo"},
+ {0x2B, NULL, "svcGetProcessInfo"},
+ {0x2C, NULL, "svcGetThreadInfo"},
+ {0x2D, WrapI_VC, "svcConnectToPort"},
};
-void Register_SysCall() {
- HLE::RegisterModule("SysCallTable", ARRAY_SIZE(SysCall_Table), SysCall_Table);
+void Register_Syscall() {
+ HLE::RegisterModule("SyscallTable", ARRAY_SIZE(Syscall_Table), Syscall_Table);
}
diff --git a/src/core/hle/hle_syscall.h b/src/core/hle/hle_syscall.h
index 4faa14535..80b20c358 100644
--- a/src/core/hle/hle_syscall.h
+++ b/src/core/hle/hle_syscall.h
@@ -34,4 +34,4 @@
// }
//};
-void Register_SysCall();
+void Register_Syscall();
--
cgit v1.2.3
From e9f0e4967d410fb25081a232b5c3d899dd7a80ed Mon Sep 17 00:00:00 2001
From: bunnei
Date: Fri, 11 Apr 2014 14:19:40 -0400
Subject: added remaining known syscall functions to Syscall_Table
---
src/core/hle/hle_syscall.cpp | 80 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 80 insertions(+)
(limited to 'src')
diff --git a/src/core/hle/hle_syscall.cpp b/src/core/hle/hle_syscall.cpp
index 53d721275..92d9b0c85 100644
--- a/src/core/hle/hle_syscall.cpp
+++ b/src/core/hle/hle_syscall.cpp
@@ -64,6 +64,86 @@ const HLE::FunctionDef Syscall_Table[] = {
{0x2B, NULL, "svcGetProcessInfo"},
{0x2C, NULL, "svcGetThreadInfo"},
{0x2D, WrapI_VC, "svcConnectToPort"},
+ {0x2E NULL, "svcSendSyncRequest1"},
+ {0x2F NULL, "svcSendSyncRequest2"},
+ {0x30 NULL, "svcSendSyncRequest3"},
+ {0x31 NULL, "svcSendSyncRequest4"},
+ {0x32 NULL, "svcSendSyncRequest"},
+ {0x33 NULL, "svcOpenProcess"},
+ {0x34 NULL, "svcOpenThread"},
+ {0x35 NULL, "svcGetProcessId"},
+ {0x36 NULL, "svcGetProcessIdOfThread"},
+ {0x37 NULL, "svcGetThreadId"},
+ {0x38 NULL, "svcGetResourceLimit"},
+ {0x39 NULL, "svcGetResourceLimitLimitValues"},
+ {0x3A NULL, "svcGetResourceLimitCurrentValues"},
+ {0x3B NULL, "svcGetThreadContext"},
+ {0x3C NULL, "svcBreak"},
+ {0x3D NULL, "svcOutputDebugString"},
+ {0x3E NULL, "svcControlPerformanceCounter"},
+ {0x3F, NULL, "Unknown"},
+ {0x40, NULL, "Unknown"},
+ {0x41, NULL, "Unknown"},
+ {0x42, NULL, "Unknown"},
+ {0x43, NULL, "Unknown"},
+ {0x44, NULL, "Unknown"},
+ {0x45, NULL, "Unknown"},
+ {0x46, NULL, "Unknown"},
+ {0x47 NULL, "svcCreatePort"},
+ {0x48 NULL, "svcCreateSessionToPort"},
+ {0x49 NULL, "svcCreateSession"},
+ {0x4A NULL, "svcAcceptSession"},
+ {0x4B NULL, "svcReplyAndReceive1"},
+ {0x4C NULL, "svcReplyAndReceive2"},
+ {0x4D NULL, "svcReplyAndReceive3"},
+ {0x4E NULL, "svcReplyAndReceive4"},
+ {0x4F NULL, "svcReplyAndReceive"},
+ {0x50 NULL, "svcBindInterrupt"},
+ {0x51 NULL, "svcUnbindInterrupt"},
+ {0x52 NULL, "svcInvalidateProcessDataCache"},
+ {0x53 NULL, "svcStoreProcessDataCache"},
+ {0x54 NULL, "svcFlushProcessDataCache"},
+ {0x55 NULL, "svcStartInterProcessDma"},
+ {0x56 NULL, "svcStopDma"},
+ {0x57 NULL, "svcGetDmaState"},
+ {0x58 NULL, "svcRestartDma"},
+ {0x59, NULL, "Unknown"},
+ {0x5A, NULL, "Unknown"},
+ {0x5B, NULL, "Unknown"},
+ {0x5C, NULL, "Unknown"},
+ {0x5D, NULL, "Unknown"},
+ {0x5E, NULL, "Unknown"},
+ {0x5F, NULL, "Unknown"},
+ {0x60 NULL, "svcDebugActiveProcess"},
+ {0x61 NULL, "svcBreakDebugProcess"},
+ {0x62 NULL, "svcTerminateDebugProcess"},
+ {0x63 NULL, "svcGetProcessDebugEvent"},
+ {0x64 NULL, "svcContinueDebugEvent"},
+ {0x65 NULL, "svcGetProcessList"},
+ {0x66 NULL, "svcGetThreadList"},
+ {0x67 NULL, "svcGetDebugThreadContext"},
+ {0x68 NULL, "svcSetDebugThreadContext"},
+ {0x69 NULL, "svcQueryDebugProcessMemory"},
+ {0x6A NULL, "svcReadProcessMemory"},
+ {0x6B NULL, "svcWriteProcessMemory"},
+ {0x6C NULL, "svcSetHardwareBreakPoint"},
+ {0x6D NULL, "svcGetDebugThreadParam"},
+ {0x6E, NULL, "Unknown"},
+ {0x6F, NULL, "Unknown"},
+ {0x70 NULL, "svcControlProcessMemory"},
+ {0x71 NULL, "svcMapProcessMemory"},
+ {0x72 NULL, "svcUnmapProcessMemory"},
+ {0x73, NULL, "Unknown"},
+ {0x74, NULL, "Unknown"},
+ {0x75, NULL, "Unknown"},
+ {0x76 NULL, "svcTerminateProcess"},
+ {0x77, NULL, "Unknown"},
+ {0x78 NULL, "svcCreateResourceLimit"},
+ {0x79, NULL, "Unknown"},
+ {0x7A, NULL, "Unknown"},
+ {0x7B, NULL, "Unknown"},
+ {0x7C NULL, "svcKernelSetState"},
+ {0x7D NULL, "svcQueryProcessMemory"},
};
void Register_Syscall() {
--
cgit v1.2.3
From f6c328cf37fe6e0250c20fcbf128f301b3d71d36 Mon Sep 17 00:00:00 2001
From: bunnei
Date: Fri, 11 Apr 2014 18:07:49 -0400
Subject: moved hle.cpp into hle folder (due to mistake earlier)
---
src/core/core.vcxproj | 2 +-
src/core/core.vcxproj.filters | 2 +-
src/core/hle.cpp | 57 -------------------------------------------
src/core/hle/hle.cpp | 57 +++++++++++++++++++++++++++++++++++++++++++
4 files changed, 59 insertions(+), 59 deletions(-)
delete mode 100644 src/core/hle.cpp
create mode 100644 src/core/hle/hle.cpp
(limited to 'src')
diff --git a/src/core/core.vcxproj b/src/core/core.vcxproj
index 8097a47d3..89795ce63 100644
--- a/src/core/core.vcxproj
+++ b/src/core/core.vcxproj
@@ -152,7 +152,7 @@
-
+
diff --git a/src/core/core.vcxproj.filters b/src/core/core.vcxproj.filters
index 79bddf09a..eece5d486 100644
--- a/src/core/core.vcxproj.filters
+++ b/src/core/core.vcxproj.filters
@@ -81,7 +81,7 @@
hle
-
+
hle
diff --git a/src/core/hle.cpp b/src/core/hle.cpp
deleted file mode 100644
index d62d2d0ce..000000000
--- a/src/core/hle.cpp
+++ /dev/null
@@ -1,57 +0,0 @@
-// Copyright 2014 Citra Emulator Project
-// Licensed under GPLv2
-// Refer to the license.txt file included.
-
-#include
-
-#include "core/hle/hle.h"
-#include "core/hle/hle_syscall.h"
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-namespace HLE {
-
-static std::vector g_module_db;
-
-const FunctionDef* GetSyscallInfo(u32 opcode) {
- u32 func_num = opcode & 0xFFFFFF; // 8 bits
- if (func_num > 0xFF) {
- ERROR_LOG(HLE,"Unknown syscall: 0x%02X", func_num);
- return NULL;
- }
- return &g_module_db[0].func_table[func_num];
-}
-
-void CallSyscall(u32 opcode) {
- const FunctionDef *info = GetSyscallInfo(opcode);
-
- if (!info) {
- return;
- }
- if (info->func) {
- info->func();
- } else {
- ERROR_LOG(HLE, "Unimplemented HLE function %s", info->name);
- }
-}
-
-void RegisterModule(std::string name, int num_functions, const FunctionDef* func_table) {
- ModuleDef module = {name, num_functions, func_table};
- g_module_db.push_back(module);
-}
-
-void RegisterAllModules() {
- Register_Syscall();
-}
-
-void Init() {
- RegisterAllModules();
- NOTICE_LOG(HLE, "initialized OK");
-}
-
-void Shutdown() {
- g_module_db.clear();
- NOTICE_LOG(HLE, "shutdown OK");
-}
-
-} // namespace
diff --git a/src/core/hle/hle.cpp b/src/core/hle/hle.cpp
new file mode 100644
index 000000000..d62d2d0ce
--- /dev/null
+++ b/src/core/hle/hle.cpp
@@ -0,0 +1,57 @@
+// Copyright 2014 Citra Emulator Project
+// Licensed under GPLv2
+// Refer to the license.txt file included.
+
+#include
+
+#include "core/hle/hle.h"
+#include "core/hle/hle_syscall.h"
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace HLE {
+
+static std::vector g_module_db;
+
+const FunctionDef* GetSyscallInfo(u32 opcode) {
+ u32 func_num = opcode & 0xFFFFFF; // 8 bits
+ if (func_num > 0xFF) {
+ ERROR_LOG(HLE,"Unknown syscall: 0x%02X", func_num);
+ return NULL;
+ }
+ return &g_module_db[0].func_table[func_num];
+}
+
+void CallSyscall(u32 opcode) {
+ const FunctionDef *info = GetSyscallInfo(opcode);
+
+ if (!info) {
+ return;
+ }
+ if (info->func) {
+ info->func();
+ } else {
+ ERROR_LOG(HLE, "Unimplemented HLE function %s", info->name);
+ }
+}
+
+void RegisterModule(std::string name, int num_functions, const FunctionDef* func_table) {
+ ModuleDef module = {name, num_functions, func_table};
+ g_module_db.push_back(module);
+}
+
+void RegisterAllModules() {
+ Register_Syscall();
+}
+
+void Init() {
+ RegisterAllModules();
+ NOTICE_LOG(HLE, "initialized OK");
+}
+
+void Shutdown() {
+ g_module_db.clear();
+ NOTICE_LOG(HLE, "shutdown OK");
+}
+
+} // namespace
--
cgit v1.2.3
From 7ea75858984e23ed22ad1dfa8ad0315aaeded538 Mon Sep 17 00:00:00 2001
From: bunnei
Date: Fri, 11 Apr 2014 18:09:23 -0400
Subject: replace tabs with spaces
---
src/core/hle/hle.h | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
(limited to 'src')
diff --git a/src/core/hle/hle.h b/src/core/hle/hle.h
index e3b8d483a..9466be540 100644
--- a/src/core/hle/hle.h
+++ b/src/core/hle/hle.h
@@ -19,15 +19,15 @@ namespace HLE {
typedef void (*Func)();
struct FunctionDef {
- u32 id;
- Func func;
- std::string name;
+ u32 id;
+ Func func;
+ std::string name;
};
struct ModuleDef {
- std::string name;
- int num_funcs;
- const FunctionDef* func_table;
+ std::string name;
+ int num_funcs;
+ const FunctionDef* func_table;
};
void RegisterModule(std::string name, int num_functions, const FunctionDef *func_table);
--
cgit v1.2.3
From 02fbd42e7f006236199698c61ca917092afa1f7d Mon Sep 17 00:00:00 2001
From: bunnei
Date: Fri, 11 Apr 2014 18:44:21 -0400
Subject: - renamed hle_syscall to just syscall
- added service.h as an initial service interface
---
src/core/core.vcxproj | 5 +-
src/core/core.vcxproj.filters | 12 +++-
src/core/hle/hle.cpp | 4 +-
src/core/hle/hle_syscall.cpp | 151 ----------------------------------------
src/core/hle/hle_syscall.h | 37 ----------
src/core/hle/service/service.h | 60 ++++++++++++++++
src/core/hle/syscall.cpp | 153 +++++++++++++++++++++++++++++++++++++++++
src/core/hle/syscall.h | 19 +++++
8 files changed, 246 insertions(+), 195 deletions(-)
delete mode 100644 src/core/hle/hle_syscall.cpp
delete mode 100644 src/core/hle/hle_syscall.h
create mode 100644 src/core/hle/service/service.h
create mode 100644 src/core/hle/syscall.cpp
create mode 100644 src/core/hle/syscall.h
(limited to 'src')
diff --git a/src/core/core.vcxproj b/src/core/core.vcxproj
index 89795ce63..10ecca596 100644
--- a/src/core/core.vcxproj
+++ b/src/core/core.vcxproj
@@ -153,7 +153,7 @@
-
+
@@ -186,7 +186,8 @@
-
+
+
diff --git a/src/core/core.vcxproj.filters b/src/core/core.vcxproj.filters
index eece5d486..d450224a4 100644
--- a/src/core/core.vcxproj.filters
+++ b/src/core/core.vcxproj.filters
@@ -25,6 +25,9 @@
{8b62769e-3e2a-4a57-a7bc-b3b2933c2bc7}
+
+ {812c5189-ca49-4704-b842-3ffad09092d3}
+
@@ -78,10 +81,10 @@
-
+
hle
-
+
hle
@@ -163,7 +166,10 @@
hle
-
+
+ hle\service
+
+
hle
diff --git a/src/core/hle/hle.cpp b/src/core/hle/hle.cpp
index d62d2d0ce..32aff0eb5 100644
--- a/src/core/hle/hle.cpp
+++ b/src/core/hle/hle.cpp
@@ -5,7 +5,7 @@
#include
#include "core/hle/hle.h"
-#include "core/hle/hle_syscall.h"
+#include "core/hle/syscall.h"
////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -41,7 +41,7 @@ void RegisterModule(std::string name, int num_functions, const FunctionDef* func
}
void RegisterAllModules() {
- Register_Syscall();
+ Syscall::Register();
}
void Init() {
diff --git a/src/core/hle/hle_syscall.cpp b/src/core/hle/hle_syscall.cpp
deleted file mode 100644
index 92d9b0c85..000000000
--- a/src/core/hle/hle_syscall.cpp
+++ /dev/null
@@ -1,151 +0,0 @@
-// Copyright 2014 Citra Emulator Project
-// Licensed under GPLv2
-// Refer to the license.txt file included.
-
-#include "core/hle/function_wrappers.h"
-#include "core/hle/hle_syscall.h"
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-typedef u32 Handle;
-typedef s32 Result;
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-Result SVC_ConnectToPort(void* out, const char* port_name) {
- NOTICE_LOG(OSHLE, "svcConnectToPort called, port_name: %s", port_name);
- return 0;
-}
-
-const HLE::FunctionDef Syscall_Table[] = {
- {0x00, NULL, "Unknown"},
- {0x01, NULL, "svcControlMemory"},
- {0x02, NULL, "svcQueryMemory"},
- {0x03, NULL, "svcExitProcess"},
- {0x04, NULL, "svcGetProcessAffinityMask"},
- {0x05, NULL, "svcSetProcessAffinityMask"},
- {0x06, NULL, "svcGetProcessIdealProcessor"},
- {0x07, NULL, "svcSetProcessIdealProcessor"},
- {0x08, NULL, "svcCreateThread"},
- {0x09, NULL, "svcExitThread"},
- {0x0A, NULL, "svcSleepThread"},
- {0x0B, NULL, "svcGetThreadPriority"},
- {0x0C, NULL, "svcSetThreadPriority"},
- {0x0D, NULL, "svcGetThreadAffinityMask"},
- {0x0E, NULL, "svcSetThreadAffinityMask"},
- {0x0F, NULL, "svcGetThreadIdealProcessor"},
- {0x10, NULL, "svcSetThreadIdealProcessor"},
- {0x11, NULL, "svcGetCurrentProcessorNumber"},
- {0x12, NULL, "svcRun"},
- {0x13, NULL, "svcCreateMutex"},
- {0x14, NULL, "svcReleaseMutex"},
- {0x15, NULL, "svcCreateSemaphore"},
- {0x16, NULL, "svcReleaseSemaphore"},
- {0x17, NULL, "svcCreateEvent"},
- {0x18, NULL, "svcSignalEvent"},
- {0x19, NULL, "svcClearEvent"},
- {0x1A, NULL, "svcCreateTimer"},
- {0x1B, NULL, "svcSetTimer"},
- {0x1C, NULL, "svcCancelTimer"},
- {0x1D, NULL, "svcClearTimer"},
- {0x1E, NULL, "svcCreateMemoryBlock"},
- {0x1F, NULL, "svcMapMemoryBlock"},
- {0x20, NULL, "svcUnmapMemoryBlock"},
- {0x21, NULL, "svcCreateAddressArbiter"},
- {0x22, NULL, "svcArbitrateAddress"},
- {0x23, NULL, "svcCloseHandle"},
- {0x24, NULL, "svcWaitSynchronization1"},
- {0x25, NULL, "svcWaitSynchronizationN"},
- {0x26, NULL, "svcSignalAndWait"},
- {0x27, NULL, "svcDuplicateHandle"},
- {0x28, NULL, "svcGetSystemTick"},
- {0x29, NULL, "svcGetHandleInfo"},
- {0x2A, NULL, "svcGetSystemInfo"},
- {0x2B, NULL, "svcGetProcessInfo"},
- {0x2C, NULL, "svcGetThreadInfo"},
- {0x2D, WrapI_VC, "svcConnectToPort"},
- {0x2E NULL, "svcSendSyncRequest1"},
- {0x2F NULL, "svcSendSyncRequest2"},
- {0x30 NULL, "svcSendSyncRequest3"},
- {0x31 NULL, "svcSendSyncRequest4"},
- {0x32 NULL, "svcSendSyncRequest"},
- {0x33 NULL, "svcOpenProcess"},
- {0x34 NULL, "svcOpenThread"},
- {0x35 NULL, "svcGetProcessId"},
- {0x36 NULL, "svcGetProcessIdOfThread"},
- {0x37 NULL, "svcGetThreadId"},
- {0x38 NULL, "svcGetResourceLimit"},
- {0x39 NULL, "svcGetResourceLimitLimitValues"},
- {0x3A NULL, "svcGetResourceLimitCurrentValues"},
- {0x3B NULL, "svcGetThreadContext"},
- {0x3C NULL, "svcBreak"},
- {0x3D NULL, "svcOutputDebugString"},
- {0x3E NULL, "svcControlPerformanceCounter"},
- {0x3F, NULL, "Unknown"},
- {0x40, NULL, "Unknown"},
- {0x41, NULL, "Unknown"},
- {0x42, NULL, "Unknown"},
- {0x43, NULL, "Unknown"},
- {0x44, NULL, "Unknown"},
- {0x45, NULL, "Unknown"},
- {0x46, NULL, "Unknown"},
- {0x47 NULL, "svcCreatePort"},
- {0x48 NULL, "svcCreateSessionToPort"},
- {0x49 NULL, "svcCreateSession"},
- {0x4A NULL, "svcAcceptSession"},
- {0x4B NULL, "svcReplyAndReceive1"},
- {0x4C NULL, "svcReplyAndReceive2"},
- {0x4D NULL, "svcReplyAndReceive3"},
- {0x4E NULL, "svcReplyAndReceive4"},
- {0x4F NULL, "svcReplyAndReceive"},
- {0x50 NULL, "svcBindInterrupt"},
- {0x51 NULL, "svcUnbindInterrupt"},
- {0x52 NULL, "svcInvalidateProcessDataCache"},
- {0x53 NULL, "svcStoreProcessDataCache"},
- {0x54 NULL, "svcFlushProcessDataCache"},
- {0x55 NULL, "svcStartInterProcessDma"},
- {0x56 NULL, "svcStopDma"},
- {0x57 NULL, "svcGetDmaState"},
- {0x58 NULL, "svcRestartDma"},
- {0x59, NULL, "Unknown"},
- {0x5A, NULL, "Unknown"},
- {0x5B, NULL, "Unknown"},
- {0x5C, NULL, "Unknown"},
- {0x5D, NULL, "Unknown"},
- {0x5E, NULL, "Unknown"},
- {0x5F, NULL, "Unknown"},
- {0x60 NULL, "svcDebugActiveProcess"},
- {0x61 NULL, "svcBreakDebugProcess"},
- {0x62 NULL, "svcTerminateDebugProcess"},
- {0x63 NULL, "svcGetProcessDebugEvent"},
- {0x64 NULL, "svcContinueDebugEvent"},
- {0x65 NULL, "svcGetProcessList"},
- {0x66 NULL, "svcGetThreadList"},
- {0x67 NULL, "svcGetDebugThreadContext"},
- {0x68 NULL, "svcSetDebugThreadContext"},
- {0x69 NULL, "svcQueryDebugProcessMemory"},
- {0x6A NULL, "svcReadProcessMemory"},
- {0x6B NULL, "svcWriteProcessMemory"},
- {0x6C NULL, "svcSetHardwareBreakPoint"},
- {0x6D NULL, "svcGetDebugThreadParam"},
- {0x6E, NULL, "Unknown"},
- {0x6F, NULL, "Unknown"},
- {0x70 NULL, "svcControlProcessMemory"},
- {0x71 NULL, "svcMapProcessMemory"},
- {0x72 NULL, "svcUnmapProcessMemory"},
- {0x73, NULL, "Unknown"},
- {0x74, NULL, "Unknown"},
- {0x75, NULL, "Unknown"},
- {0x76 NULL, "svcTerminateProcess"},
- {0x77, NULL, "Unknown"},
- {0x78 NULL, "svcCreateResourceLimit"},
- {0x79, NULL, "Unknown"},
- {0x7A, NULL, "Unknown"},
- {0x7B, NULL, "Unknown"},
- {0x7C NULL, "svcKernelSetState"},
- {0x7D NULL, "svcQueryProcessMemory"},
-};
-
-void Register_Syscall() {
- HLE::RegisterModule("SyscallTable", ARRAY_SIZE(Syscall_Table), Syscall_Table);
-}
diff --git a/src/core/hle/hle_syscall.h b/src/core/hle/hle_syscall.h
deleted file mode 100644
index 80b20c358..000000000
--- a/src/core/hle/hle_syscall.h
+++ /dev/null
@@ -1,37 +0,0 @@
-// Copyright 2014 Citra Emulator Project
-// Licensed under GPLv2
-// Refer to the license.txt file included.
-
-#pragma once
-
-#include "common/common_types.h"
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-//template
-//class KernelObject {
-//public:
-// virtual ~KernelObject() {}
-//
-// T GetNative() const {
-// return m_native;
-// }
-//
-// void SetNative(const T& native) {
-// m_native = native;
-// }
-//
-// virtual const char *GetTypeName() {return "[BAD KERNEL OBJECT TYPE]";}
-// virtual const char *GetName() {return "[UNKNOWN KERNEL OBJECT]";}
-//
-//private:
-// T m_native;
-//};
-
-//class Handle : public KernelObject {
-// const char* GetTypeName() {
-// return "Handle";
-// }
-//};
-
-void Register_Syscall();
diff --git a/src/core/hle/service/service.h b/src/core/hle/service/service.h
new file mode 100644
index 000000000..f15099982
--- /dev/null
+++ b/src/core/hle/service/service.h
@@ -0,0 +1,60 @@
+// Copyright 2014 Citra Emulator Project
+// Licensed under GPLv2
+// Refer to the license.txt file included.
+
+#pragma once
+
+#include
+
+#include "common/common_types.h"
+#include "core/hle/syscall.h"
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Namespace Service
+
+namespace Service {
+
+typedef s32 NativeUID;
+
+/// Interface to a CTROS service
+class Interface {
+public:
+
+ virtual ~Interface() {
+ }
+
+ /**
+ * Gets the UID for the serice
+ * @return UID of service in native format
+ */
+ NativeUID GetUID() const {
+ return (NativeUID)m_uid;
+ }
+
+ /**
+ * Gets the string name used by CTROS for a service
+ * @return String name of service
+ */
+ virtual std::string GetName() {
+ return "[UNKNOWN SERVICE NAME]";
+ }
+
+ /**
+ * Gets the string name used by CTROS for a service
+ * @return Port name of service
+ */
+ virtual std::string GetPort() {
+ return "[UNKNOWN SERVICE PORT]";
+ }
+
+ /**
+ * Called when svcSendSyncRequest is called, loads command buffer and executes comand
+ * @return Return result of svcSendSyncRequest passed back to user app
+ */
+ virtual Syscall::Result Sync() = 0;
+
+private:
+ u32 m_uid;
+};
+
+} // namespace
diff --git a/src/core/hle/syscall.cpp b/src/core/hle/syscall.cpp
new file mode 100644
index 000000000..98155dc8e
--- /dev/null
+++ b/src/core/hle/syscall.cpp
@@ -0,0 +1,153 @@
+// Copyright 2014 Citra Emulator Project
+// Licensed under GPLv2
+// Refer to the license.txt file included.
+
+#include