Merge remote-tracking branch 'upstream/master' into moar-gpu

This commit is contained in:
wheremyfoodat 2023-08-11 18:49:30 +03:00
commit 1544710e36
18 changed files with 170 additions and 13 deletions

View file

@ -9,6 +9,13 @@ namespace ConfigMem {
SyscoreVer = 0x1FF80010,
EnvInfo = 0x1FF80014,
AppMemAlloc = 0x1FF80040,
FirmUnknown = 0x1FF80060,
FirmRevision = 0x1FF80061,
FirmVersionMinor = 0x1FF80062,
FirmVersionMajor = 0x1FF80063,
FirmSyscoreVer = 0x1FF80064,
FirmSdkVer = 0x1FF80068,
HardwareType = 0x1FF81004,
Datetime0 = 0x1FF81020,
WifiMac = 0x1FF81060,

View file

@ -17,7 +17,8 @@ namespace KernelHandles {
BOSS, // Streetpass stuff?
CAM, // Camera service
CECD, // More Streetpass stuff?
CFG, // CFG service (Console & region info)
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)
@ -33,6 +34,7 @@ namespace KernelHandles {
NIM, // Updates, DLC, etc
NDM, // ?????
PTM, // PTM service (Used for accessing various console info, such as battery, shell and pedometer state)
SOC, // Socket service
Y2R, // Also does camera stuff
MinServiceHandle = AC,
@ -66,7 +68,8 @@ namespace KernelHandles {
case BOSS: return "BOSS";
case CAM: return "CAM";
case CECD: return "CECD";
case CFG: return "CFG";
case CFG_U: return "CFG:U";
case CFG_I: return "CFG:I";
case DSP: return "DSP";
case DLP_SRVR: return "DLP::SRVR";
case HID: return "HID";
@ -82,6 +85,7 @@ namespace KernelHandles {
case NFC: return "NFC";
case NIM: return "NIM";
case PTM: return "PTM";
case SOC: return "SOC";
case Y2R: return "Y2R";
default: return "Unknown";
}

View file

@ -34,6 +34,7 @@ class Kernel {
std::vector<KernelObject> objects;
std::vector<Handle> portHandles;
std::vector<Handle> mutexHandles;
// Thread indices, sorted by priority
std::vector<int> threadIndices;

View file

@ -53,6 +53,7 @@ namespace Log {
static Logger<false> nimLogger;
static Logger<false> ndmLogger;
static Logger<false> ptmLogger;
static Logger<false> socLogger;
static Logger<false> y2rLogger;
static Logger<false> srvLogger;

View file

@ -139,6 +139,19 @@ private:
// Report a retail unit without JTAG
static constexpr u32 envInfo = 1;
// Stored in Configuration Memory starting @ 0x1FF80060
struct FirmwareInfo {
u8 unk; // Usually 0 according to 3DBrew
u8 revision;
u8 minor;
u8 major;
u32 syscoreVer;
u32 sdkVer;
};
// Values taken from 3DBrew and Citra
static constexpr FirmwareInfo firm{.unk = 0, .revision = 0, .minor = 0x34, .major = 2, .syscoreVer = 2, .sdkVer = 0x0000F297};
public:
u16 kernelVersion = 0;
u32 usedUserMemory = u32(0_MB); // How much of the APPLICATION FCRAM range is used (allocated to the appcore)

View file

@ -7,7 +7,6 @@
#include "result/result.hpp"
class CFGService {
Handle handle = KernelHandles::CFG;
Memory& mem;
CountryCodes country = CountryCodes::US; // Default to USA
MAKE_LOG_FUNCTION(log, cfgLogger)

View file

@ -29,6 +29,7 @@
#include "services/nfc.hpp"
#include "services/nim.hpp"
#include "services/ptm.hpp"
#include "services/soc.hpp"
#include "services/y2r.hpp"
// More circular dependencies!!
@ -66,6 +67,7 @@ class ServiceManager {
NIMService nim;
NDMService ndm;
PTMService ptm;
SOCService soc;
Y2RService y2r;
// "srv:" commands

21
include/services/soc.hpp Normal file
View file

@ -0,0 +1,21 @@
#pragma once
#include "helpers.hpp"
#include "kernel_types.hpp"
#include "logger.hpp"
#include "memory.hpp"
class SOCService {
Handle handle = KernelHandles::SOC;
Memory& mem;
MAKE_LOG_FUNCTION(log, socLogger)
bool initialized = false;
// Service commands
void initializeSockets(u32 messagePointer);
public:
SOCService(Memory& mem) : mem(mem) {}
void reset();
void handleSyncRequest(u32 messagePointer);
};