Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement /dev/sbl_srv file #605

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should not need to be public anymore.

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 @@ -14,6 +14,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 @@ -54,6 +55,7 @@ mod osem;
mod process;
mod regmgr;
mod rtld;
mod sbl;
mod shm;
mod signal;
mod syscalls;
Expand Down Expand Up @@ -278,6 +280,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,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is not this one is zero here?

);

sbl
}

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