Merge branch 'master' into timerz

This commit is contained in:
wheremyfoodat 2023-08-21 18:57:18 +03:00
commit 1d601e41ba
63 changed files with 871 additions and 262282 deletions

View file

@ -19,24 +19,26 @@ namespace KernelHandles {
CECD, // More Streetpass stuff?
CFG_U, // CFG service (Console & region info)
CFG_I,
DLP_SRVR, // Download Play: Server. Used for network play.
DSP, // DSP service (Used for audio decoding and output)
HID, // HID service (Handles input-related things including gyro. Does NOT handle New3DS controls or CirclePadPro)
HTTP, // HTTP service (Handles HTTP requests)
IR_USER, // One of 3 infrared communication services
FRD, // Friend service (Miiverse friend service)
FS, // Filesystem service
GPU, // GPU service
LCD, // LCD service (Used for configuring the displays)
LDR_RO, // Loader service. Used for loading CROs.
MIC, // MIC service (Controls the microphone)
NFC, // NFC (Duh), used for Amiibo
NIM, // Updates, DLC, etc
NDM, // ?????
PTM, // PTM service (Used for accessing various console info, such as battery, shell and pedometer state)
SOC, // Socket service
SSL, // SSL service (Totally didn't expect that)
Y2R, // Also does camera stuff
DLP_SRVR, // Download Play: Server. Used for network play.
DSP, // DSP service (Used for audio decoding and output)
HID, // HID service (Handles input-related things including gyro. Does NOT handle New3DS controls or CirclePadPro)
HTTP, // HTTP service (Handles HTTP requests)
IR_USER, // One of 3 infrared communication services
FRD, // Friend service (Miiverse friend service)
FS, // Filesystem service
GPU, // GPU service
LCD, // LCD service (Used for configuring the displays)
LDR_RO, // Loader service. Used for loading CROs.
MCU_HWC, // Used for various MCU hardware-related things like battery control
MIC, // MIC service (Controls the microphone)
NFC, // NFC (Duh), used for Amiibo
NIM, // Updates, DLC, etc
NDM, // ?????
NEWS_U, // This service literally has 1 command (AddNotification) and I don't even understand what it does
PTM, // PTM service (Used for accessing various console info, such as battery, shell and pedometer state)
SOC, // Socket service
SSL, // SSL service (Totally didn't expect that)
Y2R, // Also does camera stuff
MinServiceHandle = AC,
MaxServiceHandle = Y2R,
@ -81,8 +83,10 @@ namespace KernelHandles {
case GPU: return "GSP::GPU";
case LCD: return "GSP::LCD";
case LDR_RO: return "LDR:RO";
case MCU_HWC: return "MCU::HWC";
case MIC: return "MIC";
case NDM: return "NDM";
case NEWS_U: return "NEWS_U";
case NFC: return "NFC";
case NIM: return "NIM";
case PTM: return "PTM";

View file

@ -6,6 +6,7 @@
#include <string>
#include <vector>
#include "config.hpp"
#include "helpers.hpp"
#include "kernel_types.hpp"
#include "logger.hpp"
@ -61,7 +62,7 @@ class Kernel {
Handle makeProcess(u32 id);
Handle makePort(const char* name);
Handle makeSession(Handle port);
Handle makeThread(u32 entrypoint, u32 initialSP, u32 priority, s32 id, u32 arg,ThreadStatus status = ThreadStatus::Dormant);
Handle makeThread(u32 entrypoint, u32 initialSP, u32 priority, ProcessorID id, u32 arg,ThreadStatus status = ThreadStatus::Dormant);
Handle makeMemoryBlock(u32 addr, u32 size, u32 myPermission, u32 otherPermission);
public:
@ -129,6 +130,7 @@ private:
void exitThread();
void mapMemoryBlock();
void queryMemory();
void getCurrentProcessorNumber();
void getProcessID();
void getProcessInfo();
void getResourceLimit();
@ -137,6 +139,7 @@ private:
void getSystemInfo();
void getSystemTick();
void getThreadID();
void getThreadIdealProcessor();
void getThreadPriority();
void sendSyncRequest();
void setThreadPriority();
@ -175,7 +178,7 @@ private:
void readDirectory(u32 messagePointer, Handle directory);
public:
Kernel(CPU& cpu, Memory& mem, GPU& gpu);
Kernel(CPU& cpu, Memory& mem, GPU& gpu, const EmulatorConfig& config);
void initializeFS() { return serviceManager.initializeFS(); }
void setVersion(u8 major, u8 minor);
void serviceSVC(u32 svc);

View file

@ -34,6 +34,16 @@ enum class ArbitrationType {
DecrementAndWaitIfLessTimeout = 4
};
enum class ProcessorID : s32 {
AllCPUs = -1,
Default = -2,
AppCore = 0,
Syscore = 1,
New3DSExtra1 = 2,
New3DSExtra2 = 3
};
struct AddressArbiter {};
struct ResourceLimits {
@ -95,7 +105,7 @@ struct Thread {
u32 entrypoint; // Initial r15 value
u32 priority;
u32 arg;
s32 processorID;
ProcessorID processorID;
ThreadStatus status;
Handle handle; // OS handle for this thread
int index; // Index of the thread. 0 for the first thread, 1 for the second, and so on