mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-11-29 20:04:17 +01:00
Basic KObject implementation
This commit is contained in:
parent
c7fafd3f72
commit
e44f7f8feb
16
app/src/main/cpp/core/hos/kernel/kernel.cpp
Normal file
16
app/src/main/cpp/core/hos/kernel/kernel.cpp
Normal file
@ -0,0 +1,16 @@
|
||||
#include <unordered_map>
|
||||
#include <syslog.h>
|
||||
#include "kernel.h"
|
||||
|
||||
namespace core::kernel
|
||||
{
|
||||
std::unordered_map<uint32_t, KObjectPtr> handles;
|
||||
uint32_t handleIndex = 0xd001;
|
||||
|
||||
uint32_t NewHandle(KObjectPtr obj)
|
||||
{
|
||||
handles.insert({handleIndex, obj});
|
||||
syslog(LOG_DEBUG, "Creating new handle 0x%x", handleIndex);
|
||||
return handleIndex++;
|
||||
}
|
||||
}
|
19
app/src/main/cpp/core/hos/kernel/kernel.h
Normal file
19
app/src/main/cpp/core/hos/kernel/kernel.h
Normal file
@ -0,0 +1,19 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
|
||||
namespace core::kernel
|
||||
{
|
||||
class KObject
|
||||
{
|
||||
public:
|
||||
KObject(uint32_t handle) : handle(handle) {}
|
||||
uint32_t Handle() { return handle; }
|
||||
private:
|
||||
uint32_t handle;
|
||||
};
|
||||
|
||||
typedef std::shared_ptr<KObject> KObjectPtr;
|
||||
|
||||
uint32_t NewHandle(KObjectPtr obj);
|
||||
}
|
Loading…
Reference in New Issue
Block a user