Implements dce + hmd devices (#859)

Co-authored-by: tompro <tomas.prochazka@apertia.cz>
This commit is contained in:
SuchAFuriousDeath 2024-05-04 20:38:38 +02:00 committed by GitHub
parent 4bbb9d1c8a
commit fa5ea8edbb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
16 changed files with 487 additions and 42 deletions

View File

@ -77,7 +77,7 @@ impl CameraManager {
Gid::ROOT,
Mode::new(0o666).unwrap(),
None,
MakeDevFlags::MAKEDEV_ETERNAL,
MakeDevFlags::ETERNAL,
)?;
Ok(Arc::new(Self { camera }))

115
src/kernel/src/dev/dce.rs Normal file
View File

@ -0,0 +1,115 @@
use crate::{
errno::Errno,
fs::{
make_dev, CharacterDevice, DeviceDriver, DriverFlags, IoCmd, MakeDevError, MakeDevFlags,
Mode, OpenFlags,
},
process::VThread,
ucred::{Gid, Uid},
};
use std::sync::Arc;
use thiserror::Error;
#[derive(Debug)]
struct Dce {}
impl Dce {
fn new() -> Self {
Self {}
}
}
impl DeviceDriver for Dce {
#[allow(unused_variables)] // TODO: remove when implementing
fn open(
&self,
dev: &Arc<CharacterDevice>,
mode: OpenFlags,
devtype: i32,
td: Option<&VThread>,
) -> Result<(), Box<dyn Errno>> {
todo!()
}
fn ioctl(
&self,
_: &Arc<CharacterDevice>,
cmd: IoCmd,
_: Option<&VThread>,
) -> Result<(), Box<dyn Errno>> {
match cmd {
IoCmd::DCEFLIPCONTROL(_) => todo!("DCEFLIPCONTROL ioctl"),
IoCmd::DCESUBMITFLIP(_) => todo!("DCESUBMITFLIP ioctl"),
IoCmd::DCEREGBUFPTRS(_) => todo!("DCEREGBUFPOINTERS ioctl"),
IoCmd::DCEREGBUFATTR(_) => todo!("DCEREGBUFATTR ioctl"),
IoCmd::DCEDEREGIDENT(_) => todo!("DCEDEREGIDENT ioctl"),
_ => todo!(),
}
}
}
pub struct DceManager {
dce: Arc<CharacterDevice>,
}
impl DceManager {
pub fn new() -> Result<Arc<Self>, DceInitError> {
let dce = make_dev(
Dce::new(),
DriverFlags::INIT,
0,
"dce",
Uid::ROOT,
Gid::ROOT,
Mode::new(0o666).unwrap(),
None,
MakeDevFlags::empty(),
)?;
Ok(Arc::new(Self { dce }))
}
}
#[repr(C)]
#[derive(Debug)]
pub struct DceFlipControlArg {
id: u32,
arg1: usize,
arg2: usize,
arg3: usize,
arg4: u64,
arg5: u64,
}
#[repr(C)]
#[derive(Debug)]
pub struct DceSubmitFlipArg {
canary: usize,
buffer_index: usize,
flip_mode: u32,
arg1: usize,
arg2: usize,
eop_nz: u32,
eop_val: usize,
unk: usize,
rout: usize,
}
#[repr(C)]
#[derive(Debug)]
pub struct DceRegisterBufferPtrsArg {
canary: usize,
index: u32,
attrid: u32,
left: usize,
right: usize,
unk: u32,
_align: u64,
}
/// Represents an error when [`DceManager`] fails to initialize.
#[derive(Debug, Error)]
pub enum DceInitError {
#[error("cannot create dce device")]
CreateDceFailed(#[from] MakeDevError),
}

View File

@ -59,7 +59,7 @@ impl DipswManager {
Gid::ROOT,
Mode::new(0o644).unwrap(),
None,
MakeDevFlags::MAKEDEV_ETERNAL,
MakeDevFlags::ETERNAL,
)?;
Ok(Arc::new(Self { dipsw }))

View File

@ -11,11 +11,13 @@ use std::sync::Arc;
use thiserror::Error;
#[derive(Debug)]
struct Gc {}
struct Gc {
suspended: bool,
}
impl Gc {
fn new() -> Self {
Self {}
Self { suspended: false }
}
}
@ -35,15 +37,30 @@ impl DeviceDriver for Gc {
&self,
_: &Arc<CharacterDevice>,
cmd: IoCmd,
_: Option<&VThread>,
td: Option<&VThread>,
) -> Result<(), Box<dyn Errno>> {
if self.suspended {
todo!("gc suspended")
}
let td = td.unwrap();
let gc_check_passed = td.cred().unk_gc_check();
// TODO: implement devfs_get_cdevpriv
match cmd {
IoCmd::GCSETWAVELIMITMULTIPLIER(mult) => todo!("GCSETWAVELIMITMULTIPLIER: {mult:?}"),
IoCmd::GCSUBMIT(submit_arg) => todo!("GCSUBMIT ioctl: {submit_arg:?}"),
IoCmd::GCGETCUMASK(mask) => todo!("GCGETCUMASK ioctl: {mask:?}"),
IoCmd::GCMAPCOMPUTEQUEUE(queue) => todo!("GCMAPCOMPUTEQUEUE ioctl: {queue:?}"),
IoCmd::GCUNMAPCOMPUTEQUEUE(unk) => todo!("GCUNMAPCOMPUTEQUEUE ioctl: {unk:?}"),
IoCmd::GCSETGSRINGSIZES(unk1) => todo!("GCSETGSRINGSIZES ioctl: {unk1:?}"),
IoCmd::GCSETGSRINGSIZES(unk1) => {
for _ in 0..100 {
todo!()
}
todo!("GCSETGSRINGSIZES ioctl: {unk1:?}")
}
IoCmd::GCMIPSTATSREPORT(report) => todo!("GCMIPSTATSREPORT ioctl: {report:?}"),
IoCmd::GCARESUBMITSALLOWED(unk) => todo!("GCARESUBMITSALLOWED ioctl: {unk:?}"),
IoCmd::GCGETNUMTCAUNITS(num) => todo!("GCGETNUMTCAUNITS ioctl: {num:?}"),
@ -68,7 +85,7 @@ impl GcManager {
Gid::ROOT,
Mode::new(0o666).unwrap(),
None,
MakeDevFlags::MAKEDEV_ETERNAL,
MakeDevFlags::ETERNAL,
)?;
Ok(Arc::new(Self { gc }))
@ -92,6 +109,27 @@ pub struct CuMask {
unk4: i32,
}
#[derive(Debug)]
#[repr(C)]
pub struct MapComputeQueueArg {
pipe_hi: u32,
pipe_lo: u32,
queue_id: u32,
offset: u32,
ring_base_address: usize,
read_ptr_address: usize,
ding_dong: usize,
len_log: u32,
}
#[derive(Debug)]
#[repr(C)]
pub struct UnmapComputeQueueArg {
unk1: u32,
unk2: u32,
unk3: u32,
}
#[derive(Debug)]
#[repr(C)]
pub struct MipStatsReport {

208
src/kernel/src/dev/hmd.rs Normal file
View File

@ -0,0 +1,208 @@
use crate::{
errno::Errno,
fs::{
make_dev, CharacterDevice, DeviceDriver, DriverFlags, IoCmd, MakeDevError, MakeDevFlags,
Mode, OpenFlags,
},
process::VThread,
ucred::{Gid, Uid},
};
use std::sync::Arc;
use thiserror::Error;
#[derive(Debug)]
struct HmdCmd {}
impl DeviceDriver for HmdCmd {
#[allow(unused_variables)] // TODO: remove when implementing
fn open(
&self,
dev: &Arc<CharacterDevice>,
mode: OpenFlags,
devtype: i32,
td: Option<&VThread>,
) -> Result<(), Box<dyn Errno>> {
todo!()
}
#[allow(unused_variables)] // TODO: remove when implementing
fn ioctl(
&self,
dev: &Arc<CharacterDevice>,
cmd: IoCmd,
td: Option<&VThread>,
) -> Result<(), Box<dyn Errno>> {
todo!()
}
}
#[derive(Debug)]
struct HmdSnsr {}
impl DeviceDriver for HmdSnsr {
#[allow(unused_variables)] // TODO: remove when implementing
fn ioctl(
&self,
dev: &Arc<CharacterDevice>,
cmd: IoCmd,
td: Option<&VThread>,
) -> Result<(), Box<dyn Errno>> {
todo!()
}
}
#[derive(Debug)]
struct Hmd3da {}
impl DeviceDriver for Hmd3da {
#[allow(unused_variables)] // TODO: remove when implementing
fn ioctl(
&self,
dev: &Arc<CharacterDevice>,
cmd: IoCmd,
td: Option<&VThread>,
) -> Result<(), Box<dyn Errno>> {
todo!()
}
}
#[derive(Debug)]
struct HmdDist {}
impl DeviceDriver for HmdDist {
#[allow(unused_variables)] // TODO: remove when implementing
fn ioctl(
&self,
dev: &Arc<CharacterDevice>,
cmd: IoCmd,
td: Option<&VThread>,
) -> Result<(), Box<dyn Errno>> {
todo!()
}
}
#[derive(Debug)]
struct HmdCr {}
impl DeviceDriver for HmdCr {
#[allow(unused_variables)] // TODO: remove when implementing
fn open(
&self,
dev: &Arc<CharacterDevice>,
mode: OpenFlags,
devtype: i32,
td: Option<&VThread>,
) -> Result<(), Box<dyn Errno>> {
todo!()
}
#[allow(unused_variables)] // TODO: remove when implementing
fn ioctl(
&self,
dev: &Arc<CharacterDevice>,
cmd: IoCmd,
td: Option<&VThread>,
) -> Result<(), Box<dyn Errno>> {
todo!()
}
}
pub struct HmdManager {
hmd_cmd: Arc<CharacterDevice>,
hmd_snsr: Arc<CharacterDevice>,
hmd_3da: Arc<CharacterDevice>,
hmd_dist: Arc<CharacterDevice>,
hmd_cr: Arc<CharacterDevice>,
}
impl HmdManager {
pub fn new() -> Result<Arc<Self>, HmdInitError> {
let hmd_cmd = make_dev(
HmdCmd {},
DriverFlags::INIT,
0,
"hmd_cmd",
Uid::ROOT,
Gid::ROOT,
Mode::new(0o666).unwrap(),
None,
MakeDevFlags::empty(),
)
.map_err(HmdInitError::CreateHmdCmdFailed)?;
let hmd_snsr = make_dev(
HmdSnsr {},
DriverFlags::from_bits_retain(0x80080000),
0,
"hmd_snsr",
Uid::ROOT,
Gid::ROOT,
Mode::new(0o666).unwrap(),
None,
MakeDevFlags::empty(),
)
.map_err(HmdInitError::CreateHmdSnsrFailed)?;
let hmd_3da = make_dev(
Hmd3da {},
DriverFlags::INIT,
0,
"hmd_3da",
Uid::ROOT,
Gid::ROOT,
Mode::new(0o666).unwrap(),
None,
MakeDevFlags::empty(),
)
.map_err(HmdInitError::CreateHmd3daFailed)?;
let hmd_dist = make_dev(
HmdDist {},
DriverFlags::INIT,
0,
"hmd_dist",
Uid::ROOT,
Gid::ROOT,
Mode::new(0o666).unwrap(),
None,
MakeDevFlags::empty(),
)
.map_err(HmdInitError::CreateHmdDistFailed)?;
let hmd_cr = make_dev(
HmdCr {},
DriverFlags::INIT,
0,
"hmd_cr",
Uid::ROOT,
Gid::ROOT,
Mode::new(0o600).unwrap(),
None,
MakeDevFlags::empty(),
)
.map_err(HmdInitError::CreateHmdCrFailed)?;
Ok(Arc::new(Self {
hmd_cmd,
hmd_snsr,
hmd_3da,
hmd_dist,
hmd_cr,
}))
}
}
/// Represents an error when [`HmdManager`] fails to initialize.
#[derive(Debug, Error)]
pub enum HmdInitError {
#[error("cannot create hmd_cmd device")]
CreateHmdCmdFailed(#[source] MakeDevError),
#[error("cannot create hmd_snsr device")]
CreateHmdSnsrFailed(#[source] MakeDevError),
#[error("cannot create hmd_3da device")]
CreateHmd3daFailed(#[source] MakeDevError),
#[error("cannot create hmd_dist device")]
CreateHmdDistFailed(#[source] MakeDevError),
#[error("cannot create hmd_cr device")]
CreateHmdCrFailed(#[source] MakeDevError),
}

View File

@ -1,20 +1,24 @@
pub use camera::*;
pub use dce::*;
pub use deci::*;
pub use dipsw::*;
pub use dmem::*;
pub use gc::*;
pub use hid::*;
pub use hmd::*;
pub use random::*;
pub use rng::*;
pub use sbl_srv::*;
pub use ttyconsole::*;
mod camera;
mod dce;
mod deci;
mod dipsw;
mod dmem;
mod gc;
mod hid;
mod hmd;
mod random;
mod rng;
mod sbl_srv;

View File

@ -65,7 +65,7 @@ impl RngManager {
Gid::ROOT,
Mode::new(0o444).unwrap(),
None,
MakeDevFlags::MAKEDEV_ETERNAL,
MakeDevFlags::ETERNAL,
)?;
Ok(Arc::new(Self { rng }))

View File

@ -1,13 +1,24 @@
use crate::{
errno::Errno,
fs::{CharacterDevice, DeviceDriver, IoCmd},
fs::{
make_dev, CharacterDevice, DeviceDriver, DriverFlags, IoCmd, MakeDevError, MakeDevFlags,
Mode,
},
process::VThread,
ucred::{Gid, Uid},
};
use std::sync::Arc;
use thiserror::Error;
#[derive(Debug)]
struct SblSrv {}
impl SblSrv {
fn new() -> Self {
Self {}
}
}
impl DeviceDriver for SblSrv {
#[allow(unused_variables)] // TODO: remove when implementing
fn ioctl(
@ -19,3 +30,33 @@ impl DeviceDriver for SblSrv {
todo!()
}
}
pub struct SblSrvManager {
sbl: Arc<CharacterDevice>,
}
impl SblSrvManager {
pub fn new() -> Result<Arc<Self>, SblSrvInitError> {
let sbl = make_dev(
SblSrv {},
DriverFlags::INIT,
0,
"sbl_srv",
Uid::ROOT,
Gid::ROOT,
Mode::new(0o600).unwrap(),
None,
MakeDevFlags::empty(),
)
.map_err(SblSrvInitError::CreateSblSrvFailed)?;
Ok(Arc::new(Self { sbl }))
}
}
/// Represents an error when [`SblSrvManager`] fails to initialize.
#[derive(Debug, Error)]
pub enum SblSrvInitError {
#[error("cannot create sbl_srv device")]
CreateSblSrvFailed(#[source] MakeDevError),
}

View File

@ -117,7 +117,7 @@ impl TtyManager {
Gid::ROOT,
Mode::new(0o600).unwrap(),
None,
MakeDevFlags::MAKEDEV_ETERNAL,
MakeDevFlags::ETERNAL,
)?;
Ok(Arc::new(Self { console }))

View File

@ -44,7 +44,7 @@ impl DmemManager {
let name = "dmem0";
match make_dev(
Dmem::new(Self::DMEM_TOTAL_SIZE, DmemContainer::Zero),
DriverFlags::D_INIT,
DriverFlags::INIT,
0,
name,
Uid::ROOT,
@ -62,7 +62,7 @@ impl DmemManager {
let name = "dmem1";
match make_dev(
Dmem::new(Self::DMEM_TOTAL_SIZE, DmemContainer::One),
DriverFlags::D_INIT,
DriverFlags::INIT,
0,
name,
Uid::ROOT,
@ -80,7 +80,7 @@ impl DmemManager {
let name = "dmem2";
match make_dev(
Dmem::new(Self::DMEM_TOTAL_SIZE, DmemContainer::Two),
DriverFlags::D_INIT,
DriverFlags::INIT,
0,
name,
Uid::ROOT,

View File

@ -192,8 +192,8 @@ bitflags! {
/// Flags for [`CdevSw`].
#[derive(Debug, Clone, Copy)]
pub struct DriverFlags: u32 {
const D_NEEDMINOR = 0x00800000;
const D_INIT = 0x80000000;
const NEEDMINOR = 0x00800000;
const INIT = 0x80000000;
}
}

View File

@ -30,7 +30,7 @@ pub fn make_dev(
cred: Option<Arc<Ucred>>,
flags: MakeDevFlags,
) -> Result<Arc<CharacterDevice>, MakeDevError> {
if driver_flags.intersects(DriverFlags::D_NEEDMINOR) {
if driver_flags.intersects(DriverFlags::NEEDMINOR) {
todo!("make_dev with D_NEEDMINOR");
}
@ -44,7 +44,7 @@ pub fn make_dev(
// Get device flags.
let mut df = DeviceFlags::empty();
if flags.intersects(MakeDevFlags::MAKEDEV_ETERNAL) {
if flags.intersects(MakeDevFlags::ETERNAL) {
df |= DeviceFlags::SI_ETERNAL;
}
@ -293,7 +293,7 @@ bitflags! {
/// Flags for [`make_dev()`].
#[derive(Clone, Copy)]
pub struct MakeDevFlags: u32 {
const MAKEDEV_ETERNAL = 0x10;
const ETERNAL = 0x10;
}
}

View File

@ -1,7 +1,8 @@
use super::FioDeviceGetNameArg;
use crate::dev::{
CuMask, DingDongForWorkload, DmemAllocate, DmemAvailable, DmemQuery, MipStatsReport,
PrtAperture, RngInput, SubmitArg,
CuMask, DceFlipControlArg, DceRegisterBufferPtrsArg, DceSubmitFlipArg, DingDongForWorkload,
DmemAllocate, DmemAvailable, DmemQuery, MapComputeQueueArg, MipStatsReport, PrtAperture,
RngInput, SubmitArg, UnmapComputeQueueArg,
};
use crate::dmem::{BlockpoolExpandArgs, BlockpoolStats};
use crate::errno::ENOTTY;
@ -99,6 +100,17 @@ commands! {
/// An unkown bnet command, called from libSceNet
BNETUNK(&Unknown36) = 0x802450c9,
/// Flip control.
DCEFLIPCONTROL(&mut DceFlipControlArg) = 0xC0308203,
/// Submit flip
DCESUBMITFLIP(&mut DceSubmitFlipArg) = 0xC0488204,
/// Register buffer pointers
DCEREGBUFPTRS(&mut DceRegisterBufferPtrsArg) = 0xC0308206,
/// Register buffer attribute
DCEREGBUFATTR(&mut Unknown48) = 0xC0308207,
/// Deregister identifier
DCEDEREGIDENT(&u64) = 0x80088209,
/// Get media size in bytes.
DIOCGMEDIASIZE(&mut i64) = 0x40086418,
@ -119,7 +131,6 @@ commands! {
/// Unkown dipsw command
DIPSWUNK(&mut i32) = 0x40048807,
/// Allocate direct memory
DMEMALLOC(&mut DmemAllocate) = 0xc0288001,
/// Get total size?
@ -169,9 +180,9 @@ commands! {
/// Get CU mask
GCGETCUMASK(&mut CuMask) = 0xc010810b,
/// Map compute queue
GCMAPCOMPUTEQUEUE(&mut Unknown48) = 0xc030810d,
GCMAPCOMPUTEQUEUE(&mut MapComputeQueueArg) = 0xc030810d,
/// Unmap compute queue
GCUNMAPCOMPUTEQUEUE(&mut Unknown12) = 0xc00c810e,
GCUNMAPCOMPUTEQUEUE(&mut UnmapComputeQueueArg) = 0xc00c810e,
/// Set GS ring queue sizes
GCSETGSRINGSIZES(&mut Unknown12) = 0xc00c8110,
/// Get mip stats report

View File

@ -372,7 +372,7 @@ impl Fs {
info!("Reading {len} bytes from fd {fd}.");
todo!()
todo!("sys_read")
}
fn sys_write(self: &Arc<Self>, td: &VThread, i: &SysIn) -> Result<SysOut, SysErr> {
@ -382,7 +382,7 @@ impl Fs {
info!("Writing {len} bytes to fd {fd}.");
todo!()
todo!("sys_write")
}
fn sys_open(self: &Arc<Self>, td: &VThread, i: &SysIn) -> Result<SysOut, SysErr> {
@ -772,6 +772,10 @@ impl Fs {
let nfds: u32 = i.args[1].try_into().unwrap();
let timeout: i32 = i.args[2].try_into().unwrap();
let fds = unsafe { std::slice::from_raw_parts_mut(fds, nfds.try_into().unwrap()) };
info!("Polling {nfds} file descriptors: {fds:?}.");
todo!()
}
@ -1065,6 +1069,7 @@ impl TryFrom<i64> for TruncateLength {
pub struct TruncateLengthError(());
#[repr(C)]
#[derive(Debug)]
pub struct PollFd {
fd: i32,
events: PollEvents,

View File

@ -1,9 +1,9 @@
use crate::arch::MachDep;
use crate::budget::{Budget, BudgetManager, ProcType};
use crate::dev::{
CameraInitError, CameraManager, DebugManager, DebugManagerInitError, DipswInitError,
DipswManager, DmemContainer, GcInitError, GcManager, RngInitError, RngManager, TtyManager,
TtyManagerInitError,
CameraInitError, CameraManager, DceManager, DebugManager, DebugManagerInitError,
DipswInitError, DipswManager, DmemContainer, GcInitError, GcManager, HmdManager, RngInitError,
RngManager, SblSrvManager, TtyManager, TtyManagerInitError,
};
use crate::dmem::{DmemManager, DmemManagerInitError};
use crate::ee::native::NativeEngine;
@ -29,6 +29,7 @@ use crate::time::TimeManager;
use crate::ucred::{AuthAttrs, AuthCaps, AuthInfo, AuthPaid, Gid, Ucred, Uid};
use crate::umtx::UmtxManager;
use clap::Parser;
use dev::{DceInitError, HmdInitError, SblSrvInitError};
use llt::{OsThread, SpawnError};
use macros::vpath;
use param::Param;
@ -370,25 +371,31 @@ fn run(args: Args) -> Result<(), KernelError> {
// Initialize TTY system.
#[allow(unused_variables)] // TODO: Remove this when someone uses tty.
let tty = TtyManager::new()?;
let tty = TtyManager::new().map_err(KernelError::TtyInitFailed)?;
#[allow(unused_variables)] // TODO: Remove this when someone uses dipsw.
let dipsw = DipswManager::new()?;
let dipsw = DipswManager::new().map_err(KernelError::DipswInitFailed)?;
#[allow(unused_variables)] // TODO: Remove this when someone uses gc.
let gc = GcManager::new()?;
let gc = GcManager::new().map_err(KernelError::GcManagerInitFailed)?;
#[allow(unused_variables)] // TODO: Remove this when someone uses camera.
let camera = CameraManager::new()?;
let camera = CameraManager::new().map_err(KernelError::CameraManagerInitFailed)?;
#[allow(unused_variables)] // TODO: Remove this when someone uses rng.
let rng = RngManager::new()?;
let rng = RngManager::new().map_err(KernelError::RngManagerInitFailed)?;
#[allow(unused_variables)] // TODO: Remove this when someone uses sbl_srv.
let sbl_srv = SblSrvManager::new().map_err(KernelError::SblSrvManagerInitFailed)?;
#[allow(unused_variables)] // TODO: Remove this when someone uses hmd.
let hmd_cmd = HmdManager::new().map_err(KernelError::HmdManagerInitFailed)?;
#[allow(unused_variables)] // TODO: Remove this when someone uses dce.
let dce = DceManager::new().map_err(KernelError::DceManagerInitFailed)?;
// Initialize kernel components.
#[allow(unused_variables)] // TODO: Remove this when someone uses debug.
let debug = DebugManager::new()?;
let debug = DebugManager::new().map_err(KernelError::DebugManagerInitFailed)?;
RegMgr::new(&mut sys);
let machdep = MachDep::new(&mut sys);
let budget = BudgetManager::new(&mut sys);
SignalManager::new(&mut sys);
DmemManager::new(&fs, &mut sys)?;
DmemManager::new(&fs, &mut sys).map_err(KernelError::DmemManagerInitFailed)?;
SharedMemoryManager::new(&mut sys);
Sysctl::new(&machdep, &mut sys);
TimeManager::new(&mut sys);
@ -630,25 +637,34 @@ enum KernelError {
MountFailed(VPathBuf, #[source] MountError),
#[error("tty initialization failed")]
TtyInitFailed(#[from] TtyManagerInitError),
TtyInitFailed(#[source] TtyManagerInitError),
#[error("dipsw initialization failed")]
DipswInitFailed(#[from] DipswInitError),
DipswInitFailed(#[source] DipswInitError),
#[error("debug manager initialization failed")]
DebugManagerInitFailed(#[from] DebugManagerInitError),
DebugManagerInitFailed(#[source] DebugManagerInitError),
#[error("gc manager initialization failed")]
GcManagerInitFailed(#[from] GcInitError),
GcManagerInitFailed(#[source] GcInitError),
#[error("camera manager initialization failed")]
CameraManagerInitFailed(#[from] CameraInitError),
CameraManagerInitFailed(#[source] CameraInitError),
#[error("rng manager initialization failed")]
RngManagerInitFailed(#[from] RngInitError),
RngManagerInitFailed(#[source] RngInitError),
#[error("dmem manager initialization failed")]
DmemManagerInitFailed(#[from] DmemManagerInitError),
DmemManagerInitFailed(#[source] DmemManagerInitError),
#[error("sbl_srv manager initialization failed")]
SblSrvManagerInitFailed(#[source] SblSrvInitError),
#[error("hmd manager initialization failed")]
HmdManagerInitFailed(#[source] HmdInitError),
#[error("dce manager initialization failed")]
DceManagerInitFailed(#[source] DceInitError),
#[error("couldn't create application process")]
CreateProcessFailed(#[source] self::process::SpawnError),

View File

@ -154,6 +154,13 @@ impl Ucred {
self.auth.caps.is_unk1() && self.auth.attrs.is_unk2()
}
pub fn unk_gc_check(&self) -> bool {
matches!(
self.auth.paid.get(),
0x3800000000000009 | 0x380100000000002c
)
}
/// See `priv_check_cred` on the PS4 for a reference.
pub fn priv_check(&self, p: Privilege) -> Result<(), PrivilegeError> {
// TODO: Check suser_enabled.