- moved Handle/Result definitions to kernel.h

- added ResetType enum
This commit is contained in:
bunnei 2014-05-18 18:12:29 -04:00
parent 8fba88d5d5
commit 772abad778
6 changed files with 19 additions and 14 deletions

View File

@ -6,7 +6,8 @@
#include "common/common_types.h" #include "common/common_types.h"
typedef s32 Handle; typedef u32 Handle;
typedef s32 Result;
enum KernelIDType { enum KernelIDType {
KERNEL_ID_TYPE_THREAD = 1, KERNEL_ID_TYPE_THREAD = 1,

View File

@ -42,8 +42,6 @@ enum WaitType {
WAITTYPE_SYNCH, WAITTYPE_SYNCH,
}; };
typedef s32 Handle;
class Thread : public KernelObject { class Thread : public KernelObject {
public: public:

View File

@ -11,6 +11,8 @@
#include "common/common.h" #include "common/common.h"
#include "common/common_types.h" #include "common/common_types.h"
#include "core/mem_map.h" #include "core/mem_map.h"
#include "core/hle/kernel/kernel.h"
#include "core/hle/syscall.h" #include "core/hle/syscall.h"
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
@ -70,14 +72,14 @@ public:
} }
/// Allocates a new handle for the service /// Allocates a new handle for the service
Syscall::Handle NewHandle() { Handle NewHandle() {
Syscall::Handle handle = (m_handles.size() << 16) | m_uid; Handle handle = (m_handles.size() << 16) | m_uid;
m_handles.push_back(handle); m_handles.push_back(handle);
return handle; return handle;
} }
/// Frees a handle from the service /// Frees a handle from the service
void DeleteHandle(Syscall::Handle handle) { void DeleteHandle(Handle handle) {
for(auto iter = m_handles.begin(); iter != m_handles.end(); ++iter) { for(auto iter = m_handles.begin(); iter != m_handles.end(); ++iter) {
if(*iter == handle) { if(*iter == handle) {
m_handles.erase(iter); m_handles.erase(iter);
@ -90,7 +92,7 @@ public:
* Called when svcSendSyncRequest is called, loads command buffer and executes comand * Called when svcSendSyncRequest is called, loads command buffer and executes comand
* @return Return result of svcSendSyncRequest passed back to user app * @return Return result of svcSendSyncRequest passed back to user app
*/ */
Syscall::Result Sync() { Result Sync() {
u32* cmd_buff = GetCommandBuffer(); u32* cmd_buff = GetCommandBuffer();
auto itr = m_functions.find(cmd_buff[0]); auto itr = m_functions.find(cmd_buff[0]);
@ -124,7 +126,7 @@ protected:
private: private:
u32 m_uid; u32 m_uid;
std::vector<Syscall::Handle> m_handles; std::vector<Handle> m_handles;
std::map<u32, FunctionInfo> m_functions; std::map<u32, FunctionInfo> m_functions;
}; };

View File

@ -23,7 +23,7 @@ void GetProcSemaphore(Service::Interface* self) {
} }
void GetServiceHandle(Service::Interface* self) { void GetServiceHandle(Service::Interface* self) {
Syscall::Result res = 0; Result res = 0;
u32* cmd_buff = Service::GetCommandBuffer(); u32* cmd_buff = Service::GetCommandBuffer();
std::string port_name = std::string((const char*)&cmd_buff[1], 0, Service::kMaxPortSize); std::string port_name = std::string((const char*)&cmd_buff[1], 0, Service::kMaxPortSize);

View File

@ -30,7 +30,7 @@ public:
* Called when svcSendSyncRequest is called, loads command buffer and executes comand * Called when svcSendSyncRequest is called, loads command buffer and executes comand
* @return Return result of svcSendSyncRequest passed back to user app * @return Return result of svcSendSyncRequest passed back to user app
*/ */
Syscall::Result Sync(); Result Sync();
}; };

View File

@ -7,7 +7,7 @@
#include "common/common_types.h" #include "common/common_types.h"
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
// SVC structures // SVC types
struct MemoryInfo { struct MemoryInfo {
u32 base_address; u32 base_address;
@ -31,14 +31,18 @@ struct ThreadContext {
u32 fpexc; u32 fpexc;
}; };
enum ResetType {
RESETTYPE_ONESHOT,
RESETTYPE_STICKY,
RESETTYPE_PULSE,
RESETTYPE_MAX_BIT = (1u << 31),
};
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
// Namespace Syscall // Namespace Syscall
namespace Syscall { namespace Syscall {
typedef u32 Handle;
typedef s32 Result;
void Register(); void Register();
} // namespace } // namespace