This commit is contained in:
Cadey Ratio 2020-03-27 19:21:51 -04:00
parent a5250bda6d
commit 2a28a7a24d
5 changed files with 30 additions and 18 deletions

39
Cargo.lock generated
View File

@ -27,8 +27,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "chrono"
version = "0.4.9"
source = "git+https://tulpa.dev/xeos/chrono#918cff1f724305d3d1b126abf49425c653a4a201"
version = "0.4.11"
source = "git+https://tulpa.dev/xeos/chrono#e493218d687f4bdc683bcdd61680b3e50b1cffa1"
dependencies = [
"num-integer 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)",
"num-traits 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
@ -111,6 +111,11 @@ dependencies = [
"spin 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "libc"
version = "0.2.68"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "libm"
version = "0.1.4"
@ -166,7 +171,7 @@ dependencies = [
[[package]]
name = "parity-wasm"
version = "0.40.3"
version = "0.41.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
@ -221,23 +226,24 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "wasmi"
version = "0.5.1"
source = "git+https://tulpa.dev/xeos/wasmi#0b6dd64219cc73e8fc58cfdfdd89a314b1d41596"
version = "0.6.2"
source = "git+https://github.com/paritytech/wasmi#d186a3dc67389d87e5d7d546f90c91f336a9b858"
dependencies = [
"libc 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)",
"libm 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"memory_units 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"num-rational 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"num-traits 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
"parity-wasm 0.40.3 (registry+https://github.com/rust-lang/crates.io-index)",
"wasmi-validation 0.2.0 (git+https://tulpa.dev/xeos/wasmi)",
"parity-wasm 0.41.0 (registry+https://github.com/rust-lang/crates.io-index)",
"wasmi-validation 0.3.0 (git+https://github.com/paritytech/wasmi)",
]
[[package]]
name = "wasmi-validation"
version = "0.2.0"
source = "git+https://tulpa.dev/xeos/wasmi#0b6dd64219cc73e8fc58cfdfdd89a314b1d41596"
version = "0.3.0"
source = "git+https://github.com/paritytech/wasmi#d186a3dc67389d87e5d7d546f90c91f336a9b858"
dependencies = [
"parity-wasm 0.40.3 (registry+https://github.com/rust-lang/crates.io-index)",
"parity-wasm 0.41.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -254,7 +260,7 @@ name = "xe_os"
version = "0.1.0"
dependencies = [
"bootloader 0.8.9 (registry+https://github.com/rust-lang/crates.io-index)",
"chrono 0.4.9 (git+https://tulpa.dev/xeos/chrono)",
"chrono 0.4.11 (git+https://tulpa.dev/xeos/chrono)",
"cmos 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"compiler_builtins 0.1.26 (git+https://github.com/rust-lang/compiler-builtins)",
"conquer-once 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -267,7 +273,7 @@ dependencies = [
"spin 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
"uart_16550 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"volatile 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
"wasmi 0.5.1 (git+https://tulpa.dev/xeos/wasmi)",
"wasmi 0.6.2 (git+https://github.com/paritytech/wasmi)",
"x86_64 0.9.6 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -277,7 +283,7 @@ dependencies = [
"checksum bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
"checksum bootloader 0.8.9 (registry+https://github.com/rust-lang/crates.io-index)" = "152a28c753e229e037e910b4cd4cd16a90c53dd9a67fd751fa304b4b4a03970c"
"checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
"checksum chrono 0.4.9 (git+https://tulpa.dev/xeos/chrono)" = "<none>"
"checksum chrono 0.4.11 (git+https://tulpa.dev/xeos/chrono)" = "<none>"
"checksum cmos 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0a5377a95644e12ea6460d19d59692c40a5fc65d0eb2ad34390c12cbb5a64095"
"checksum compiler_builtins 0.1.26 (git+https://github.com/rust-lang/compiler-builtins)" = "<none>"
"checksum conquer-once 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6f7644600a548ecad74e4a918392af1798f7dd045be610be3203b9e129b4f98f"
@ -289,6 +295,7 @@ dependencies = [
"checksum futures-task 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "7b0a34e53cf6cdcd0178aa573aed466b646eb3db769570841fda0c7ede375a27"
"checksum futures-util 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "22766cf25d64306bedf0384da004d05c9974ab104fcc4528f1236181c18004c5"
"checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
"checksum libc 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)" = "dea0c0405123bba743ee3f91f49b1c7cfb684eef0da0a50110f758ccf24cdff0"
"checksum libm 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "7fc7aa29613bd6a620df431842069224d8bc9011086b1db4c0e0cd47fa03ec9a"
"checksum linked_list_allocator 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5825aea823c659d0fdcdbe8c9b78baf56f3a10365d783db874f6d360df72626f"
"checksum lock_api 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "79b2de95ecb4691949fea4716ca53cdbcfccb2c612e19644a8bad05edcf9f47b"
@ -296,7 +303,7 @@ dependencies = [
"checksum num-integer 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "3f6ea62e9d81a77cd3ee9a2a5b9b609447857f3d358704331e4ef39eb247fcba"
"checksum num-rational 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "5c000134b5dbf44adc5cb772486d335293351644b801551abe8f75c84cfa4aef"
"checksum num-traits 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "c62be47e61d1842b9170f0fdeec8eba98e60e90e5446449a0545e5152acd7096"
"checksum parity-wasm 0.40.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1e39faaa292a687ea15120b1ac31899b13586446521df6c149e46f1584671e0f"
"checksum parity-wasm 0.41.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc878dac00da22f8f61e7af3157988424567ab01d9920b962ef7dcbd7cd865"
"checksum pc-keyboard 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c48392db76c4e9a69e0b3be356c5f97ebb7b14413c5e4fd0af4755dbf86e2fce"
"checksum pic8259_simple 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dc64b2fd10828da8521b6cdabe0679385d7d2a3a6d4c336b819d1fa31ba35c72"
"checksum pin-utils 0.1.0-alpha.4 (registry+https://github.com/rust-lang/crates.io-index)" = "5894c618ce612a3fa23881b152b608bafb8c56cfc22f434a3ba3120b40f7b587"
@ -305,6 +312,6 @@ dependencies = [
"checksum spinning_top 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "32d801a3a53bcf5071f85fef8d5cab9e5f638fc5580a37e6eb7aba4b37438d24"
"checksum uart_16550 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "d44b0f30cb82b0fbc15b78ade1064226529ad52028bc8cb8accb98ff6f3d7131"
"checksum volatile 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "6af0edf5b4faacc31fc51159244d78d65ec580f021afcef7bd53c04aeabc7f29"
"checksum wasmi 0.5.1 (git+https://tulpa.dev/xeos/wasmi)" = "<none>"
"checksum wasmi-validation 0.2.0 (git+https://tulpa.dev/xeos/wasmi)" = "<none>"
"checksum wasmi 0.6.2 (git+https://github.com/paritytech/wasmi)" = "<none>"
"checksum wasmi-validation 0.3.0 (git+https://github.com/paritytech/wasmi)" = "<none>"
"checksum x86_64 0.9.6 (registry+https://github.com/rust-lang/crates.io-index)" = "4206b60c9f99766329b66962aa8ddc01df6c7edd02edc046b7a69d5df9fcdbcf"

View File

@ -15,7 +15,7 @@ uart_16550 = "0.2.0"
pic8259_simple = "0.1.1"
pc-keyboard = "0"
linked_list_allocator = "0"
wasmi = {git = "https://tulpa.dev/xeos/wasmi", default-features=false, features = ["core"] }
wasmi = { git = "https://github.com/paritytech/wasmi", default-features=false, features = ["core"] }
compiler_builtins = { git = "https://github.com/rust-lang/compiler-builtins" }
chrono = { git = "https://tulpa.dev/xeos/chrono", default-features=false, features = ["alloc"] }
cmos = "0.1.1"

View File

@ -54,12 +54,13 @@ async fn async_number() -> u32 {
}
async fn example_task() {
println!("[ ] Starting number task");
let number = async_number().await;
println!("async number: {}", number);
}
async fn h_task() {
println!("[ ] Running WASM:");
println!("[ ] Running WASM");
wasm::run().await;
println!(" success");
}

View File

@ -1,4 +1,5 @@
use super::{Task, TaskId};
use crate::println;
use alloc::{collections::{BTreeMap, VecDeque}, sync::Arc, task::Wake};
use core::task::{Context, Poll, Waker};
use crossbeam_queue::ArrayQueue;
@ -21,6 +22,7 @@ impl Executor {
}
pub fn spawn(&mut self, task: Task) {
println!(" Task {:?} started", task.id());
self.task_queue.push_back(task)
}
@ -35,6 +37,7 @@ impl Executor {
match task.poll(&mut context) {
Poll::Ready(()) => {
// task done -> remove cached waker
println!(" Task {:?} done", task_id);
self.waker_cache.remove(&task_id);
}
Poll::Pending => {

View File

@ -31,6 +31,7 @@ pub async fn run() {
#[test_case]
fn test_wasm() {
serial_print!("running h example... ");
run();
serial_println!("[ok]");
}