Skip to content

Commit

Permalink
Uses uio_seg on kern_openat
Browse files Browse the repository at this point in the history
  • Loading branch information
ultimaweapon committed May 11, 2024
1 parent db4ea69 commit 2c2e5dd
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .cargo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ target = "x86_64-unknown-none"
rustflags = ["--cfg", "fw=\"1100\"", "--cfg", "method=\"syscall\""]

[unstable]
build-std = ["std", "panic_abort"]
build-std = ["alloc", "core", "panic_abort"]
build-std-features = ["panic_immediate_abort"]
3 changes: 2 additions & 1 deletion korbis-1100/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
use self::thread::Thread;
use core::ffi::{c_char, c_int};
use korbis::offset;
use korbis::uio::UioSeg;

mod thread;

Expand Down Expand Up @@ -30,7 +31,7 @@ impl korbis::Kernel for Kernel {
td: *mut Self::Thread,
fd: c_int,
path: *const c_char,
kernel: bool,
seg: UioSeg,
flags: c_int,
mode: c_int,
) -> c_int;
Expand Down
6 changes: 4 additions & 2 deletions korbis/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@

use self::elf::ProgramType;
use self::thread::Thread;
use self::uio::UioSeg;
use core::ffi::{c_char, c_int};

pub use korbis_macros::*;

pub mod elf;
pub mod thread;
pub mod uio;

/// Provides information about the PS4 kernel for a specific version.
pub trait Kernel: Send + Sync + 'static {
Expand All @@ -30,13 +32,13 @@ pub trait Kernel: Send + Sync + 'static {

/// # Safety
/// - `td` cannot be null.
/// - `path` cannot be null and must point to a null-terminated string if `kernel` is `true`.
/// - `path` cannot be null and must point to a null-terminated string if `seg` is [`UioSeg::Kernel`].
unsafe fn kern_openat(
&self,
td: *mut Self::Thread,
fd: c_int,
path: *const c_char,
kernel: bool,
seg: UioSeg,
flags: c_int,
mode: c_int,
) -> c_int;
Expand Down
9 changes: 9 additions & 0 deletions korbis/src/uio/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/// Represents `uio_seg` enum.
#[repr(C)]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum UioSeg {
/// UIO_USERSPACE
User,
/// UIO_SYSSPACE
Kernel,
}

0 comments on commit 2c2e5dd

Please sign in to comment.