metadata and peek/poke
This commit is contained in:
parent
64d6e1e166
commit
ab3110923e
|
@ -50,11 +50,13 @@ pub fn afetch() {
|
||||||
disable();
|
disable();
|
||||||
let tick_time = TICK.load(Relaxed);
|
let tick_time = TICK.load(Relaxed);
|
||||||
|
|
||||||
println!("OS: AbleOS");
|
println!(
|
||||||
println!("Host: {}", kstate.hostname);
|
"OS: AbleOS
|
||||||
println!("Kernel: AKern-{}-v{}", RELEASE_TYPE, KERNEL_VERSION);
|
Host: {}
|
||||||
println!("Uptime: {}", tick_time);
|
Kernel: AKern-{}-v{}
|
||||||
|
Uptime: {}",
|
||||||
|
kstate.hostname, RELEASE_TYPE, KERNEL_VERSION, tick_time
|
||||||
|
);
|
||||||
enable();
|
enable();
|
||||||
drop(kstate);
|
drop(kstate);
|
||||||
}
|
}
|
||||||
|
@ -77,5 +79,18 @@ fn engine_construction() -> Engine {
|
||||||
engine.register_fn("afetch", afetch);
|
engine.register_fn("afetch", afetch);
|
||||||
engine.register_fn("set_hostname", set_hostname);
|
engine.register_fn("set_hostname", set_hostname);
|
||||||
engine.register_fn("shutdown", shutdown);
|
engine.register_fn("shutdown", shutdown);
|
||||||
|
engine.register_fn("peek", peek_memory);
|
||||||
|
engine.register_fn("poke", poke_memory);
|
||||||
engine
|
engine
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Examine a memory pointer
|
||||||
|
pub fn peek_memory(ptr: i64) -> u8 {
|
||||||
|
let ptr: usize = ptr as usize;
|
||||||
|
unsafe { *(ptr as *const u8) }
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn poke_memory(ptr: i64, val: u8) {
|
||||||
|
let ptr: usize = ptr as usize;
|
||||||
|
unsafe { *(ptr as *mut u8) = val }
|
||||||
|
}
|
||||||
|
|
75
userland/wasm_pk_data/Cargo.lock
generated
Normal file
75
userland/wasm_pk_data/Cargo.lock
generated
Normal file
|
@ -0,0 +1,75 @@
|
||||||
|
# This file is automatically @generated by Cargo.
|
||||||
|
# It is not intended for manual editing.
|
||||||
|
version = 3
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "proc-macro2"
|
||||||
|
version = "1.0.36"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c7342d5883fbccae1cc37a2353b09c87c9b0f3afd73f5fb9bba687a1f733b029"
|
||||||
|
dependencies = [
|
||||||
|
"unicode-xid",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "quote"
|
||||||
|
version = "1.0.15"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "864d3e96a899863136fc6e99f3d7cae289dafe43bf2c5ac19b70df7210c0a145"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "serde"
|
||||||
|
version = "1.0.136"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ce31e24b01e1e524df96f1c2fdd054405f8d7376249a5110886fb4b658484789"
|
||||||
|
dependencies = [
|
||||||
|
"serde_derive",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "serde_derive"
|
||||||
|
version = "1.0.136"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "08597e7152fcd306f41838ed3e37be9eaeed2b61c42e2117266a554fab4662f9"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "syn"
|
||||||
|
version = "1.0.86"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8a65b3f4ffa0092e9887669db0eae07941f023991ab58ea44da8fe8e2d511c6b"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"unicode-xid",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "toml"
|
||||||
|
version = "0.5.8"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "a31142970826733df8241ef35dc040ef98c679ab14d7c3e54d827099b3acecaa"
|
||||||
|
dependencies = [
|
||||||
|
"serde",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "unicode-xid"
|
||||||
|
version = "0.2.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wasm_pk_data"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"serde",
|
||||||
|
"toml",
|
||||||
|
]
|
17
userland/wasm_pk_data/Cargo.toml
Normal file
17
userland/wasm_pk_data/Cargo.toml
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
[package]
|
||||||
|
name = "wasm_pk_data"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
toml = "0.5"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
[dependencies.serde]
|
||||||
|
version = "1.0"
|
||||||
|
features = ["derive"]
|
3
userland/wasm_pk_data/assets/metadata.toml
Normal file
3
userland/wasm_pk_data/assets/metadata.toml
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
name = "bruh"
|
||||||
|
version = [1233, 123, 123]
|
||||||
|
authors = ["John Doe", "Jane Doe"]
|
20
userland/wasm_pk_data/src/lib.rs
Normal file
20
userland/wasm_pk_data/src/lib.rs
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
#![no_std]
|
||||||
|
extern crate alloc;
|
||||||
|
use {
|
||||||
|
alloc::{string::String, vec::Vec},
|
||||||
|
serde::Deserialize,
|
||||||
|
};
|
||||||
|
|
||||||
|
#[derive(Debug, Deserialize)]
|
||||||
|
pub struct Version {
|
||||||
|
pub major: u16,
|
||||||
|
pub minor: u8,
|
||||||
|
pub patch: u8,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Deserialize)]
|
||||||
|
pub struct MetaData {
|
||||||
|
pub name: String,
|
||||||
|
pub version: Version,
|
||||||
|
pub authors: Vec<String>,
|
||||||
|
}
|
Loading…
Reference in a new issue