Skip to content

Commit

Permalink
Adds firmware selection switch
Browse files Browse the repository at this point in the history
  • Loading branch information
ultimaweapon committed May 5, 2024
1 parent a06447f commit f0429a9
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
1 change: 1 addition & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[build]
target = "x86_64-unknown-none"
rustflags = ["--cfg", "fw=\"1100\""]

[unstable]
build-std = ["std", "panic_abort"]
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/Cargo.lock
/kernel-dumper.bin
/src/version.rs
/target/
4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ edition = "2021"
[dependencies]
bitflags = "2.5.0"
ps4k = { path = "ps4k" }
ps4k-1100 = { path = "ps4k-1100" }
x86_64 = { version = "0.15.1", features = ["instructions"], default-features = false }

[target.'cfg(fw = "1100")'.dependencies]
ps4k-1100 = { path = "ps4k-1100" }

[profile.release]
opt-level = "z"

Expand Down
10 changes: 9 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ use x86_64::VirtAddr;
mod errno;
mod fs;
mod thread;
#[cfg(fw = "custom")]
mod version;

#[cfg(fw = "1100")]
type Version = ps4k_1100::KernelVersion;

#[cfg(fw = "custom")]
type Version = self::version::KernelVersion;

// The job of this custom entry point is:
//
Expand Down Expand Up @@ -82,7 +90,7 @@ pub extern "C" fn main(_: *const u8) {
unsafe { Cr0::write_raw(cr0) };

// Initialize ps4k crate.
let kernel = unsafe { Kernel::<ps4k_1100::KernelVersion>::new(base.as_ptr()) };
let kernel = unsafe { Kernel::<Version>::new(base.as_ptr()) };
unsafe { SYSENTS = (base + 0x1101760).as_ptr() };

// Create dump file.
Expand Down

0 comments on commit f0429a9

Please sign in to comment.