mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-07-04 06:16:20 +12:00
Rename Handle to HorizonHandle, add metal-cpp submodule, format
This commit is contained in:
parent
855a374f67
commit
0f80d0af7a
46 changed files with 150 additions and 60 deletions
|
@ -12,7 +12,7 @@ static const char* arbitrationTypeToString(u32 type) {
|
|||
}
|
||||
}
|
||||
|
||||
Handle Kernel::makeArbiter() {
|
||||
HorizonHandle Kernel::makeArbiter() {
|
||||
if (arbiterCount >= appResourceLimits.maxAddressArbiters) {
|
||||
Helpers::panic("Overflowed the number of address arbiters");
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ const char* Kernel::resetTypeToString(u32 type) {
|
|||
}
|
||||
}
|
||||
|
||||
Handle Kernel::makeEvent(ResetType resetType, Event::CallbackType callback) {
|
||||
HorizonHandle Kernel::makeEvent(ResetType resetType, Event::CallbackType callback) {
|
||||
Handle ret = makeObject(KernelObjectType::Event);
|
||||
objects[ret].data = new Event(resetType, callback);
|
||||
return ret;
|
||||
|
|
|
@ -82,7 +82,7 @@ void Kernel::setVersion(u8 major, u8 minor) {
|
|||
mem.kernelVersion = descriptor; // The memory objects needs a copy because you can read the kernel ver from config mem
|
||||
}
|
||||
|
||||
Handle Kernel::makeProcess(u32 id) {
|
||||
HorizonHandle Kernel::makeProcess(u32 id) {
|
||||
const Handle processHandle = makeObject(KernelObjectType::Process);
|
||||
const Handle resourceLimitHandle = makeObject(KernelObjectType::ResourceLimit);
|
||||
|
||||
|
|
|
@ -154,7 +154,7 @@ void Kernel::mapMemoryBlock() {
|
|||
regs[0] = Result::Success;
|
||||
}
|
||||
|
||||
Handle Kernel::makeMemoryBlock(u32 addr, u32 size, u32 myPermission, u32 otherPermission) {
|
||||
HorizonHandle Kernel::makeMemoryBlock(u32 addr, u32 size, u32 myPermission, u32 otherPermission) {
|
||||
Handle ret = makeObject(KernelObjectType::MemoryBlock);
|
||||
objects[ret].data = new MemoryBlock(addr, size, myPermission, otherPermission);
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include "kernel.hpp"
|
||||
#include <cstring>
|
||||
|
||||
Handle Kernel::makePort(const char* name) {
|
||||
HorizonHandle Kernel::makePort(const char* name) {
|
||||
Handle ret = makeObject(KernelObjectType::Port);
|
||||
portHandles.push_back(ret); // Push the port handle to our cache of port handles
|
||||
objects[ret].data = new Port(name);
|
||||
|
@ -9,7 +9,7 @@ Handle Kernel::makePort(const char* name) {
|
|||
return ret;
|
||||
}
|
||||
|
||||
Handle Kernel::makeSession(Handle portHandle) {
|
||||
HorizonHandle Kernel::makeSession(Handle portHandle) {
|
||||
const auto port = getObject(portHandle, KernelObjectType::Port);
|
||||
if (port == nullptr) [[unlikely]] {
|
||||
Helpers::panic("Trying to make session for non-existent port");
|
||||
|
@ -23,7 +23,7 @@ Handle Kernel::makeSession(Handle portHandle) {
|
|||
|
||||
// Get the handle of a port based on its name
|
||||
// If there's no such port, return nullopt
|
||||
std::optional<Handle> Kernel::getPortHandle(const char* name) {
|
||||
std::optional<HorizonHandle> Kernel::getPortHandle(const char* name) {
|
||||
for (auto handle : portHandles) {
|
||||
const auto data = objects[handle].getData<Port>();
|
||||
if (std::strncmp(name, data->name, Port::maxNameLen) == 0) {
|
||||
|
|
|
@ -109,7 +109,7 @@ void Kernel::rescheduleThreads() {
|
|||
}
|
||||
|
||||
// Internal OS function to spawn a thread
|
||||
Handle Kernel::makeThread(u32 entrypoint, u32 initialSP, u32 priority, ProcessorID id, u32 arg, ThreadStatus status) {
|
||||
HorizonHandle Kernel::makeThread(u32 entrypoint, u32 initialSP, u32 priority, ProcessorID id, u32 arg, ThreadStatus status) {
|
||||
int index; // Index of the created thread in the threads array
|
||||
|
||||
if (threadCount < appResourceLimits.maxThreads) [[likely]] { // If we have not yet created over too many threads
|
||||
|
@ -161,7 +161,7 @@ Handle Kernel::makeThread(u32 entrypoint, u32 initialSP, u32 priority, Processor
|
|||
return ret;
|
||||
}
|
||||
|
||||
Handle Kernel::makeMutex(bool locked) {
|
||||
HorizonHandle Kernel::makeMutex(bool locked) {
|
||||
Handle ret = makeObject(KernelObjectType::Mutex);
|
||||
objects[ret].data = new Mutex(locked, ret);
|
||||
|
||||
|
@ -201,7 +201,7 @@ void Kernel::releaseMutex(Mutex* moo) {
|
|||
}
|
||||
}
|
||||
|
||||
Handle Kernel::makeSemaphore(u32 initialCount, u32 maximumCount) {
|
||||
HorizonHandle Kernel::makeSemaphore(u32 initialCount, u32 maximumCount) {
|
||||
Handle ret = makeObject(KernelObjectType::Semaphore);
|
||||
objects[ret].data = new Semaphore(initialCount, maximumCount);
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#include "kernel.hpp"
|
||||
#include "scheduler.hpp"
|
||||
|
||||
Handle Kernel::makeTimer(ResetType type) {
|
||||
HorizonHandle Kernel::makeTimer(ResetType type) {
|
||||
Handle ret = makeObject(KernelObjectType::Timer);
|
||||
objects[ret].data = new Timer(type);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue