simplification
This commit is contained in:
parent
fe342406b4
commit
72457cc34e
2
ableos/Cargo.lock
generated
2
ableos/Cargo.lock
generated
|
@ -335,7 +335,7 @@ checksum = "33a33a362ce288760ec6a508b94caaec573ae7d3bbbd91b87aa0bad4456839db"
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libwasm"
|
name = "libwasm"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://git.ablecorp.us/able/libwasm.git#dedbb769ba01a4b75992437e52ca9a5c2bb9e0f9"
|
source = "git+https://git.ablecorp.us/able/libwasm.git#aa1f7d5c0985649b6d73249dcad908272e82d7eb"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "linked_list_allocator"
|
name = "linked_list_allocator"
|
||||||
|
|
|
@ -60,6 +60,8 @@ acpi = "4.1.0"
|
||||||
axel = { git = "https://git.ablecorp.us:443/able/axel.git" }
|
axel = { git = "https://git.ablecorp.us:443/able/axel.git" }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[dependencies.logos]
|
[dependencies.logos]
|
||||||
version = "0.12.0"
|
version = "0.12.0"
|
||||||
default-features = false
|
default-features = false
|
||||||
|
|
|
@ -16,7 +16,6 @@ impl log::Log for SimpleLogger {
|
||||||
fn enabled(&self, metadata: &Metadata) -> bool {
|
fn enabled(&self, metadata: &Metadata) -> bool {
|
||||||
metadata.level() <= Level::Trace
|
metadata.level() <= Level::Trace
|
||||||
}
|
}
|
||||||
|
|
||||||
fn log(&self, record: &Record) {
|
fn log(&self, record: &Record) {
|
||||||
if self.enabled(record.metadata()) {
|
if self.enabled(record.metadata()) {
|
||||||
let color;
|
let color;
|
||||||
|
@ -40,6 +39,8 @@ impl log::Log for SimpleLogger {
|
||||||
// kprint!("{}", msg);
|
// kprint!("{}", msg);
|
||||||
// NOTE: This needs to be fixed before merge
|
// NOTE: This needs to be fixed before merge
|
||||||
if KERNEL_CONF.logging.log_to_serial {
|
if KERNEL_CONF.logging.log_to_serial {
|
||||||
|
// #[track_caller]
|
||||||
|
|
||||||
serial_println!(
|
serial_println!(
|
||||||
"[{}{}{}][{}{}{}] {}",
|
"[{}{}{}][{}{}{}] {}",
|
||||||
color.0,
|
color.0,
|
||||||
|
|
|
@ -3,6 +3,7 @@ pub fn shell() {}
|
||||||
|
|
||||||
#[cfg(target_arch = "x86_64")]
|
#[cfg(target_arch = "x86_64")]
|
||||||
pub fn shell() {
|
pub fn shell() {
|
||||||
|
let mut current_dir = "/".to_string();
|
||||||
let engine = engine_construction();
|
let engine = engine_construction();
|
||||||
let mut scope = rhai::Scope::new();
|
let mut scope = rhai::Scope::new();
|
||||||
|
|
||||||
|
@ -14,6 +15,7 @@ pub fn shell() {
|
||||||
Some('\n') => {
|
Some('\n') => {
|
||||||
match engine.eval_with_scope::<rhai::Dynamic>(&mut scope, &buf) {
|
match engine.eval_with_scope::<rhai::Dynamic>(&mut scope, &buf) {
|
||||||
Ok(o) => println!("{o}"),
|
Ok(o) => println!("{o}"),
|
||||||
|
|
||||||
Err(e) => println!("Eval error: {e}"),
|
Err(e) => println!("Eval error: {e}"),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -37,9 +39,8 @@ pub fn shell() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
lazy_static::lazy_static!(
|
lazy_static::lazy_static!(
|
||||||
pub static ref KEYBUFF: spin::Mutex<Vec<char>> = spin::Mutex::new(
|
pub static ref KEYBUFF: spin::Mutex<Vec<char>> = spin::Mutex::new(Vec::new());
|
||||||
Vec::new())
|
pub static ref CURRENT_DIR: spin::Mutex<String> = spin::Mutex::new("/".to_string());
|
||||||
;
|
|
||||||
);
|
);
|
||||||
|
|
||||||
use rhai::Engine;
|
use rhai::Engine;
|
||||||
|
@ -96,6 +97,9 @@ fn engine_construction() -> Engine {
|
||||||
debug!("{} at {:?}: {}", src, pos, x);
|
debug!("{} at {:?}: {}", src, pos, x);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
engine.register_fn("ls", ls);
|
||||||
|
engine.register_fn("cat", echo_file);
|
||||||
|
engine.register_fn("cd", change_directory);
|
||||||
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);
|
||||||
|
@ -110,16 +114,34 @@ fn engine_construction() -> Engine {
|
||||||
|
|
||||||
/// Examine a memory pointer
|
/// Examine a memory pointer
|
||||||
pub fn peek_memory(ptr: i64) -> u8 {
|
pub fn peek_memory(ptr: i64) -> u8 {
|
||||||
let ptr: usize = ptr as usize;
|
let ptr: usize = ptr.abs() as usize;
|
||||||
println!(">:(");
|
println!(">:(");
|
||||||
unsafe { *(ptr as *const u8) }
|
unsafe { *(ptr as *const u8) }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn poke_memory(ptr: i64, val: u8) {
|
pub fn poke_memory(ptr: i64, val: u8) {
|
||||||
let ptr: usize = ptr as usize;
|
let ptr: usize = ptr.abs() as usize;
|
||||||
unsafe { *(ptr as *mut u8) = val }
|
unsafe { *(ptr as *mut u8) = val }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn ls() {
|
||||||
|
let mut current_dir = CURRENT_DIR.lock();
|
||||||
|
|
||||||
|
let fs = &*FILE_SYSTEM.lock();
|
||||||
|
|
||||||
|
let file = fs
|
||||||
|
.open(current_dir.as_bytes(), OpenOptions::new().read(true))
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
let mut files = file.directory().unwrap();
|
||||||
|
println!("current dir: {}", *current_dir);
|
||||||
|
while let Some(Ok(entry)) = files.next() {
|
||||||
|
let inode_name = entry.name;
|
||||||
|
let s = String::from_utf8_lossy(&inode_name);
|
||||||
|
println!("{}", s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn log_dump() {
|
pub fn log_dump() {
|
||||||
use crate::network::socket::SimpleSock;
|
use crate::network::socket::SimpleSock;
|
||||||
use crate::relib::network::socket::Socket;
|
use crate::relib::network::socket::Socket;
|
||||||
|
@ -142,3 +164,58 @@ pub fn log_dump() {
|
||||||
None => warn!("No socket found for Logger"),
|
None => warn!("No socket found for Logger"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
use crate::filesystem::FILE_SYSTEM;
|
||||||
|
use genfs::{DirEntry, Fs, OpenOptions};
|
||||||
|
|
||||||
|
pub fn echo_file(path: String) {
|
||||||
|
let mut current_dir = CURRENT_DIR.lock();
|
||||||
|
|
||||||
|
let fs = &*FILE_SYSTEM.lock();
|
||||||
|
|
||||||
|
current_dir.push_str(&path);
|
||||||
|
|
||||||
|
let file = fs
|
||||||
|
.open(current_dir.as_bytes(), OpenOptions::new().read(true))
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
if file.is_dir() {
|
||||||
|
println!("{} is a directory", path);
|
||||||
|
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
let mut file_contents = Vec::new();
|
||||||
|
|
||||||
|
let ret = file.read_to_end(&mut file_contents).unwrap();
|
||||||
|
|
||||||
|
let file_contents_str = String::from_utf8_lossy(&file_contents);
|
||||||
|
|
||||||
|
println!("{}", file_contents_str);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn change_directory(path: String) {
|
||||||
|
let mut current_dir = CURRENT_DIR.lock();
|
||||||
|
|
||||||
|
let fs = &*FILE_SYSTEM.lock();
|
||||||
|
if path == "." || path == ".." {
|
||||||
|
let mut split_dir = current_dir.split("/").collect::<Vec<&str>>();
|
||||||
|
let mut new_dir = String::new();
|
||||||
|
split_dir.remove(split_dir.len() - 1);
|
||||||
|
println!("{:?}", split_dir);
|
||||||
|
if split_dir.len() == 0 {
|
||||||
|
new_dir = "/".to_string();
|
||||||
|
} else {
|
||||||
|
for x in split_dir {
|
||||||
|
new_dir.push_str(x);
|
||||||
|
new_dir.push('/');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*current_dir = new_dir;
|
||||||
|
} else {
|
||||||
|
if !current_dir.ends_with('/') {
|
||||||
|
current_dir.push_str("/");
|
||||||
|
}
|
||||||
|
current_dir.push_str(&path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -10,15 +10,13 @@ use crate::devices::Device::Vterm;
|
||||||
|
|
||||||
/// Experimental scratchpad for testing.
|
/// Experimental scratchpad for testing.
|
||||||
pub fn scratchpad() {
|
pub fn scratchpad() {
|
||||||
let axel_raw = "
|
let axel_raw = "kernel{
|
||||||
kernel{
|
|
||||||
vals=
|
vals=
|
||||||
time: 123
|
time: 123
|
||||||
fn|
|
fn|
|
||||||
print: (None) -> (None);
|
print: (None) -> (None);
|
||||||
foo: (None) -> (Num);
|
foo: (None) -> (Num);
|
||||||
}
|
}";
|
||||||
";
|
|
||||||
let axel = axel::parse(axel_raw.to_string());
|
let axel = axel::parse(axel_raw.to_string());
|
||||||
for node in axel {
|
for node in axel {
|
||||||
info!("{:?}", node);
|
info!("{:?}", node);
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
use core::arch;
|
||||||
|
|
||||||
use wasmi::{
|
use wasmi::{
|
||||||
Error, Externals, FuncInstance, FuncRef, ModuleImportResolver, RuntimeArgs, RuntimeValue,
|
Error, Externals, FuncInstance, FuncRef, ModuleImportResolver, RuntimeArgs, RuntimeValue,
|
||||||
Signature, Trap, ValueType,
|
Signature, Trap, ValueType,
|
||||||
|
@ -8,6 +10,7 @@ pub struct HostExternals {}
|
||||||
const ADD_FUNC_INDEX: usize = 0;
|
const ADD_FUNC_INDEX: usize = 0;
|
||||||
const SEND_SIGNAL_INDEX: usize = 1;
|
const SEND_SIGNAL_INDEX: usize = 1;
|
||||||
const GET_TIME_INDEX: usize = 2;
|
const GET_TIME_INDEX: usize = 2;
|
||||||
|
const GET_RANDOM_INDEX: usize = 3;
|
||||||
|
|
||||||
impl Externals for HostExternals {
|
impl Externals for HostExternals {
|
||||||
fn invoke_index(
|
fn invoke_index(
|
||||||
|
@ -34,28 +37,98 @@ impl Externals for HostExternals {
|
||||||
|
|
||||||
GET_TIME_INDEX => {
|
GET_TIME_INDEX => {
|
||||||
use core::sync::atomic::Ordering::*;
|
use core::sync::atomic::Ordering::*;
|
||||||
|
println!("SYSCALL: get time");
|
||||||
// x86_64::instructions::interrupts::disable();
|
x86_64::instructions::interrupts::disable();
|
||||||
let tick_time = kernel::TICK.load(Relaxed);
|
let tick_time = kernel::TICK.load(Relaxed);
|
||||||
// x86_64::instructions::interrupts::enable();
|
x86_64::instructions::interrupts::enable();
|
||||||
|
|
||||||
let ret = RuntimeValue::I64(tick_time.try_into().unwrap());
|
let ret = RuntimeValue::I32(tick_time.try_into().unwrap());
|
||||||
|
Ok(Some(ret))
|
||||||
|
}
|
||||||
|
GET_RANDOM_INDEX => {
|
||||||
|
println!("SYSCALL: get random");
|
||||||
|
let rand = generate_process_pass();
|
||||||
|
|
||||||
|
let ret = RuntimeValue::I32(rand as i32);
|
||||||
|
|
||||||
|
// let ret = RuntimeValue::I32(rand.try_into().unwrap());
|
||||||
Ok(Some(ret))
|
Ok(Some(ret))
|
||||||
}
|
}
|
||||||
_ => panic!("Unimplemented function at {}", index),
|
_ => panic!("Unimplemented function at {}", index),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
use crate::arch::generate_process_pass;
|
||||||
impl HostExternals {
|
impl HostExternals {
|
||||||
fn check_signature(&self, index: usize, signature: &Signature) -> bool {
|
fn check_signature(&self, index: usize, signature: &Signature) -> bool {
|
||||||
let (params, ret_ty): (&[ValueType], Option<ValueType>) = match index {
|
match index {
|
||||||
ADD_FUNC_INDEX => (&[ValueType::I32, ValueType::I32], Some(ValueType::I32)),
|
ADD_FUNC_INDEX => {
|
||||||
SEND_SIGNAL_INDEX => (&[ValueType::I32, ValueType::I32], Some(ValueType::I32)),
|
let (params, ret_ty): (&[ValueType], Option<ValueType>) =
|
||||||
GET_TIME_INDEX => (&[], Some(ValueType::I32)),
|
(&[ValueType::I32, ValueType::I32], Some(ValueType::I32));
|
||||||
_ => return false,
|
if params.len() != signature.params().len() {
|
||||||
};
|
return false;
|
||||||
signature.params() == params && signature.return_type() == ret_ty
|
}
|
||||||
|
if ret_ty != signature.return_type() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
for (ty, param) in params.iter().zip(signature.params()) {
|
||||||
|
if *ty != *param {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
SEND_SIGNAL_INDEX => {
|
||||||
|
let (params, ret_ty): (&[ValueType], Option<ValueType>) =
|
||||||
|
(&[ValueType::I32, ValueType::I32], Some(ValueType::I32));
|
||||||
|
if params.len() != signature.params().len() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if ret_ty != signature.return_type() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
for (ty, param) in params.iter().zip(signature.params()) {
|
||||||
|
if *ty != *param {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
GET_TIME_INDEX => {
|
||||||
|
let (params, ret_ty): (&[ValueType], Option<ValueType>) =
|
||||||
|
(&[], Some(ValueType::I32));
|
||||||
|
if params.len() != signature.params().len() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if ret_ty != signature.return_type() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
for (ty, param) in params.iter().zip(signature.params()) {
|
||||||
|
if *ty != *param {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
GET_RANDOM_INDEX => {
|
||||||
|
let (params, ret_ty): (&[ValueType], Option<ValueType>) =
|
||||||
|
(&[], Some(ValueType::I32));
|
||||||
|
if params.len() != signature.params().len() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if ret_ty != signature.return_type() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
for (ty, param) in params.iter().zip(signature.params()) {
|
||||||
|
if *ty != *param {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
_ => false,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,6 +137,8 @@ impl ModuleImportResolver for HostExternals {
|
||||||
let index = match field_name {
|
let index = match field_name {
|
||||||
"add" => ADD_FUNC_INDEX,
|
"add" => ADD_FUNC_INDEX,
|
||||||
"send_signal" => SEND_SIGNAL_INDEX,
|
"send_signal" => SEND_SIGNAL_INDEX,
|
||||||
|
"get_time" => GET_TIME_INDEX,
|
||||||
|
"get_random" => GET_RANDOM_INDEX,
|
||||||
_ => {
|
_ => {
|
||||||
return Err(Error::Instantiation(format!(
|
return Err(Error::Instantiation(format!(
|
||||||
"Export {} not found",
|
"Export {} not found",
|
||||||
|
@ -74,14 +149,18 @@ impl ModuleImportResolver for HostExternals {
|
||||||
|
|
||||||
if !self.check_signature(index, signature) {
|
if !self.check_signature(index, signature) {
|
||||||
return Err(Error::Instantiation(format!(
|
return Err(Error::Instantiation(format!(
|
||||||
"Export {} has a bad signature",
|
"Export {} has a bad signature {:?}",
|
||||||
field_name
|
field_name, signature
|
||||||
)));
|
)));
|
||||||
}
|
}
|
||||||
|
trace!("Resolved export {} as func {}", field_name, index);
|
||||||
|
|
||||||
Ok(FuncInstance::alloc_host(
|
Ok(FuncInstance::alloc_host(signature.clone(), index))
|
||||||
|
|
||||||
|
/*Ok(FuncInstance::alloc_host(
|
||||||
Signature::new(&[ValueType::I32, ValueType::I32][..], Some(ValueType::I32)),
|
Signature::new(&[ValueType::I32, ValueType::I32][..], Some(ValueType::I32)),
|
||||||
index,
|
index,
|
||||||
))
|
))*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
use crate::wasm_jumploader::host_functions::ValueType::I32;
|
||||||
|
|
|
@ -25,18 +25,76 @@ pub fn interp() {
|
||||||
trace!("Binary size {}", ret);
|
trace!("Binary size {}", ret);
|
||||||
// Load wasm binary and prepare it for instantiation.
|
// Load wasm binary and prepare it for instantiation.
|
||||||
let module = wasmi::Module::from_buffer(&wasm_binary).expect("failed to load wasm");
|
let module = wasmi::Module::from_buffer(&wasm_binary).expect("failed to load wasm");
|
||||||
|
trace!("Loaded wasm binary");
|
||||||
let imports = ImportsBuilder::new().with_resolver("env", &host_functions::HostExternals {});
|
let imports = ImportsBuilder::new().with_resolver("env", &host_functions::HostExternals {});
|
||||||
|
trace!("Created imports");
|
||||||
|
|
||||||
// Instantiate a module with empty imports and
|
// Instantiate a module with empty imports and
|
||||||
// assert that there is no `start` function.
|
// assert that there is no `start` function.
|
||||||
let instance = ModuleInstance::new(&module, &imports)
|
let instance = ModuleInstance::new(&module, &imports); // .expect("failed to instantiate wasm module")
|
||||||
.expect("failed to instantiate wasm module")
|
// .assert_no_start();
|
||||||
.assert_no_start();
|
|
||||||
|
|
||||||
|
match instance {
|
||||||
|
Ok(inst) => {
|
||||||
|
let mut instance = inst.assert_no_start();
|
||||||
|
// trace!("Instantiated wasm module");
|
||||||
|
|
||||||
|
let mut is_driver = false;
|
||||||
|
let mut is_program = false;
|
||||||
|
|
||||||
|
let mut has_driver_entry = false;
|
||||||
|
let mut has_driver_exit = false;
|
||||||
|
let mut has_start = false;
|
||||||
|
|
||||||
|
if let Some(val) = instance.export_by_name("driver_entry") {
|
||||||
|
has_driver_entry = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if let Some(val) = instance.export_by_name("driver_exit") {
|
||||||
|
has_driver_exit = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// trace!("Checking for start function");
|
||||||
|
match instance.export_by_name("start") {
|
||||||
|
Some(val) => {
|
||||||
|
trace!("Program start function found");
|
||||||
|
has_start = true;
|
||||||
|
}
|
||||||
|
None => debug!("No start function found"),
|
||||||
|
}
|
||||||
|
|
||||||
|
match (has_driver_entry, has_driver_exit) {
|
||||||
|
(true, true) => {
|
||||||
|
trace!("Valid driver entry and exit functions found");
|
||||||
|
is_driver = true;
|
||||||
|
}
|
||||||
|
(true, false) => error!("Driver entry function found but no driver exit function"),
|
||||||
|
(false, true) => error!("Driver exit function found but no driver entry function"),
|
||||||
|
(false, false) => {
|
||||||
|
trace!("No driver entry or exit functions found");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if has_start && has_driver_entry {
|
||||||
|
info!("Dual Program and Driver");
|
||||||
|
}
|
||||||
|
|
||||||
|
if has_start {
|
||||||
let ret = instance
|
let ret = instance
|
||||||
.invoke_export("start", &[], &mut HostExternals {})
|
.invoke_export("start", &[], &mut HostExternals {})
|
||||||
.expect("failed to execute export");
|
.expect("failed to execute export");
|
||||||
|
|
||||||
|
println!("collected wasm return value: {:?}", ret);
|
||||||
|
} else if is_driver {
|
||||||
|
let ret = instance
|
||||||
|
.invoke_export("driver_entry", &[], &mut HostExternals {})
|
||||||
|
.expect("failed to execute export");
|
||||||
|
|
||||||
println!("collected wasm return value: {:?}", ret);
|
println!("collected wasm return value: {:?}", ret);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
Err(err) => error!("{}", err),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn run_program() {}
|
||||||
|
|
17
shadeable/Cargo.lock
generated
17
shadeable/Cargo.lock
generated
|
@ -20,6 +20,12 @@ version = "1.0.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a"
|
checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "bitflags"
|
||||||
|
version = "1.3.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cfg-if"
|
name = "cfg-if"
|
||||||
version = "1.0.0"
|
version = "1.0.0"
|
||||||
|
@ -158,11 +164,12 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rhai"
|
name = "rhai"
|
||||||
version = "1.4.0"
|
version = "1.6.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "2c7433068977c56619bf2b7831da26eb986d0645fe56f2ad9357eda7ae4c435e"
|
checksum = "c0a10b3f41db25733e2e953811858dd90c1e96cd618606ddf6961d34b3910b18"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ahash",
|
"ahash",
|
||||||
|
"bitflags",
|
||||||
"core-error",
|
"core-error",
|
||||||
"instant",
|
"instant",
|
||||||
"libm",
|
"libm",
|
||||||
|
@ -201,11 +208,13 @@ checksum = "f2dd574626839106c320a323308629dcb1acfc96e32a8cba364ddc61ac23ee83"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "smartstring"
|
name = "smartstring"
|
||||||
version = "0.2.9"
|
version = "1.0.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "31aa6a31c0c2b21327ce875f7e8952322acfcfd0c27569a6e18a647281352c9b"
|
checksum = "3fb72c633efbaa2dd666986505016c32c3044395ceaf881518399d2f4127ee29"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"autocfg",
|
||||||
"static_assertions",
|
"static_assertions",
|
||||||
|
"version_check",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|
|
@ -12,7 +12,7 @@ libm = "*"
|
||||||
log ="*"
|
log ="*"
|
||||||
|
|
||||||
[dependencies.rhai]
|
[dependencies.rhai]
|
||||||
version = "*"
|
version = "1.5"
|
||||||
features = [ "no_std", "only_i64"]
|
features = [ "no_std", "only_i64"]
|
||||||
default-features = false
|
default-features = false
|
||||||
|
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
[build]
|
|
||||||
target = "wasm32-unknown-unknown"
|
|
||||||
|
|
||||||
# [unstable]
|
|
||||||
# build-std = ["core", "compiler_builtins", "alloc"]
|
|
||||||
# build-std-features = ["compiler-builtins-mem"]
|
|
15
userland/aos_wasm_stress_test/Cargo.lock
generated
15
userland/aos_wasm_stress_test/Cargo.lock
generated
|
@ -1,15 +0,0 @@
|
||||||
# This file is automatically @generated by Cargo.
|
|
||||||
# It is not intended for manual editing.
|
|
||||||
version = 3
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "aos_wasm_stress_test"
|
|
||||||
version = "0.1.0"
|
|
||||||
dependencies = [
|
|
||||||
"libwasm",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "libwasm"
|
|
||||||
version = "0.1.0"
|
|
||||||
source = "git+https://git.ablecorp.us/able/libwasm.git#dedbb769ba01a4b75992437e52ca9a5c2bb9e0f9"
|
|
|
@ -1,9 +0,0 @@
|
||||||
[package]
|
|
||||||
name = "aos_wasm_stress_test"
|
|
||||||
version = "0.1.0"
|
|
||||||
edition = "2021"
|
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
|
||||||
|
|
||||||
[dependencies]
|
|
||||||
libwasm = {git="https://git.ablecorp.us:443/able/libwasm.git"}
|
|
|
@ -1,4 +0,0 @@
|
||||||
|
|
||||||
This is a stress test and simple program for ableOS.
|
|
||||||
|
|
||||||
|
|
|
@ -1,36 +0,0 @@
|
||||||
#![no_std]
|
|
||||||
#![no_main]
|
|
||||||
|
|
||||||
#[no_mangle]
|
|
||||||
fn start() -> i32 {
|
|
||||||
let ret = unsafe { add(1, 2) };
|
|
||||||
unsafe {
|
|
||||||
send_signal(PID(1), Signals::Quit);
|
|
||||||
}
|
|
||||||
|
|
||||||
ret as i32
|
|
||||||
}
|
|
||||||
|
|
||||||
extern "C" {
|
|
||||||
|
|
||||||
/// Send a signal to a process
|
|
||||||
///
|
|
||||||
/// # Arguments
|
|
||||||
///
|
|
||||||
/// * `pid` - The PID of the process to send the signal to
|
|
||||||
/// * `signal` - The signal to send
|
|
||||||
pub fn send_signal(pid: PID, signal: Signals) -> bool;
|
|
||||||
}
|
|
||||||
|
|
||||||
use {
|
|
||||||
libwasm::process::{signals::Signals, PID},
|
|
||||||
libwasm::syscalls::add,
|
|
||||||
};
|
|
||||||
|
|
||||||
use libwasm::*;
|
|
||||||
|
|
||||||
#[panic_handler]
|
|
||||||
fn panic(_info: &PanicInfo) -> ! {
|
|
||||||
loop {}
|
|
||||||
}
|
|
||||||
use core::panic::PanicInfo;
|
|
Binary file not shown.
75
userland/wasm_pk_data/Cargo.lock
generated
75
userland/wasm_pk_data/Cargo.lock
generated
|
@ -1,75 +0,0 @@
|
||||||
# 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",
|
|
||||||
]
|
|
|
@ -1,17 +0,0 @@
|
||||||
[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"]
|
|
|
@ -1,3 +0,0 @@
|
||||||
name = "bruh"
|
|
||||||
version = [1233, 123, 123]
|
|
||||||
authors = ["John Doe", "Jane Doe"]
|
|
Loading…
Reference in a new issue