Skip to content

Commit

Permalink
Implement /dev/sbl_srv file
Browse files Browse the repository at this point in the history
  • Loading branch information
mikusp committed Feb 18, 2024
1 parent 58ece47 commit 585fc3f
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/kernel/src/fs/dev/cdev.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ bitflags! {
#[derive(Debug, Clone, Copy)]
pub struct DriverFlags: u32 {
const D_NEEDMINOR = 0x00800000;
const D_INIT = 0x80000000;
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/kernel/src/fs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pub use self::perm::*;
pub use self::stat::*;
pub use self::vnode::*;

mod dev;
pub mod dev;
mod dirent;
mod file;
mod host;
Expand Down
3 changes: 3 additions & 0 deletions src/kernel/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ use crate::osem::OsemManager;
use crate::process::{VProc, VProcInitError, VThread};
use crate::regmgr::RegMgr;
use crate::rtld::{LoadFlags, ModuleFlags, RuntimeLinker};
use crate::sbl::SblManager;
use crate::shm::SharedMemoryManager;
use crate::syscalls::Syscalls;
use crate::sysctl::Sysctl;
Expand Down Expand Up @@ -52,6 +53,7 @@ mod osem;
mod process;
mod regmgr;
mod rtld;
mod sbl;
mod shm;
mod signal;
mod syscalls;
Expand Down Expand Up @@ -276,6 +278,7 @@ fn run<E: crate::ee::ExecutionEngine>(
TimeManager::new(&mut syscalls);
KernelQueueManager::new(&mut syscalls);
NetManager::new(&mut syscalls);
SblManager::new();

// TODO: Get correct budget name from the PS4.
let budget_id = budget.create(Budget::new("big app", ProcType::BigApp));
Expand Down
45 changes: 45 additions & 0 deletions src/kernel/src/sbl/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
use std::sync::Arc;

use crate::{
errno::Errno,
fs::{make_dev, Cdev, CdevSw, DriverFlags, MakeDev, Mode, OpenFlags},
process::VThread,
ucred::{Gid, Uid},
};

#[derive(Debug)]
pub struct SblManager {}

impl SblManager {
pub fn new() -> Arc<Self> {
let sbl = Arc::new(Self {});

let sbl_srv_cdevsw = Arc::new(CdevSw::new(
DriverFlags::D_INIT,
Some(Self::sbl_srv_open),
None,
));

let _ = make_dev(
&sbl_srv_cdevsw,
0,
"sbl_srv",
Uid::ROOT,
Gid::ROOT,
Mode::new(0o600).unwrap(),
None,
MakeDev::MAKEDEV_ETERNAL,
);

sbl
}

fn sbl_srv_open(
_: &Arc<Cdev>,
_: OpenFlags,
_: i32,
_: Option<&VThread>,
) -> Result<(), Box<dyn Errno>> {
todo!()
}
}

0 comments on commit 585fc3f

Please sign in to comment.