Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/compile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: nightly
target: x86_64-unknown-none
target: x86_64-unknown-none,wasm32-unknown-unknown
components: clippy
- name: Setup
run: sudo apt update && sudo apt install gcc-multilib just
Expand All @@ -43,7 +43,7 @@ jobs:
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: nightly
target: x86_64-unknown-none
target: x86_64-unknown-none,wasm32-unknown-unknown
- name: Setup
run: |
sudo apt update && sudo apt install gcc-multilib just
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
.build
.fix
fix/wasm/coupon-collector.wat
.vscode
.DS_Store
94 changes: 91 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[workspace]
members = [ "common", "vmm", "kernel", "macros" , "user", "arca" , "arcane", "fix", "fix/handle", "fix/shell" ]
members = [ "common", "vmm", "kernel", "macros" , "user", "arca" , "arcane", "fix", "fix/handle", "fix/shell", "fix/parser" ]
default-members = [ "common", "vmm", "macros", "arca", "fix/handle" ]

resolver = "2"
Expand All @@ -8,5 +8,5 @@
debug = true

[workspace.package]
license = "LGPL-2.1-or-later"

Check warning on line 11 in Cargo.toml

View workflow job for this annotation

GitHub Actions / lint

unused field `license` in `workspace.package`

Check warning on line 11 in Cargo.toml

View workflow job for this annotation

GitHub Actions / lint

unused field `license` in `workspace.package`

Check warning on line 11 in Cargo.toml

View workflow job for this annotation

GitHub Actions / build

unused field `license` in `workspace.package`

Check warning on line 11 in Cargo.toml

View workflow job for this annotation

GitHub Actions / build

unused field `license` in `workspace.package`

Check warning on line 11 in Cargo.toml

View workflow job for this annotation

GitHub Actions / build

unused field `license` in `workspace.package`

Check warning on line 11 in Cargo.toml

View workflow job for this annotation

GitHub Actions / build

unused field `license` in `workspace.package`
license-file = "LICENSE"

Check warning on line 12 in Cargo.toml

View workflow job for this annotation

GitHub Actions / lint

unused field `license-file` in `workspace.package`

Check warning on line 12 in Cargo.toml

View workflow job for this annotation

GitHub Actions / lint

unused field `license-file` in `workspace.package`

Check warning on line 12 in Cargo.toml

View workflow job for this annotation

GitHub Actions / build

unused field `license-file` in `workspace.package`

Check warning on line 12 in Cargo.toml

View workflow job for this annotation

GitHub Actions / build

unused field `license-file` in `workspace.package`

Check warning on line 12 in Cargo.toml

View workflow job for this annotation

GitHub Actions / build

unused field `license-file` in `workspace.package`

Check warning on line 12 in Cargo.toml

View workflow job for this annotation

GitHub Actions / build

unused field `license-file` in `workspace.package`
4 changes: 2 additions & 2 deletions addblob.fix
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
(let ((add @"./target/x86_64-unknown-none/addblob"))
!*(add !*(add 2 3) 1))
(let ((add @"./target/x86_64-unknown-none/debug/addblob"))
*#(add *#(add 2u64 3u64) 1u64))
39 changes: 19 additions & 20 deletions addblob_extended.fix
Original file line number Diff line number Diff line change
@@ -1,27 +1,26 @@
(let ((add @"./target/x86_64-unknown-none/addblob")
(a 1) (b 2) (c 3) (d 4) (e 5) (f 6) (g 7)
(h 8) (i 9) (j 10) (k 11) (l 12) (m 13)
(n 14) (o 15) (p 16))
!*(add
!*(add
!*(add
!*(add a b)
!*(add c d)
(let ((add @"./target/x86_64-unknown-none/debug/addblob")
(a 1u64) (b 2u64) (c 3u64) (d 4u64) (e 5u64) (f 6u64) (g 7u64) (h 8u64)
(i 9u64) (j 10u64) (k 11u64) (l 12u64) (m 13u64) (n 14u64) (o 15u64) (p 16u64))
*#(add
*#(add
*#(add
*#(add a b)
*#(add c d)
)
!*(add
!*(add e f)
!*(add g h)
*#(add
*#(add e f)
*#(add g h)
)
)
!*(add
!*(add
!*(add i j)
!*(add k l)
*#(add
*#(add
*#(add i j)
*#(add k l)
)
!*(add
!*(add m n)
!*(add o p)
*#(add
*#(add m n)
*#(add o p)
)
)
)
)
)
33 changes: 20 additions & 13 deletions common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,28 @@
#![feature(unboxed_closures)]
#![cfg_attr(feature = "thread_local_cache", feature(thread_local))]

pub mod buddy;
pub mod refcnt;
pub use buddy::BuddyAllocator;
pub mod arrayvec;
pub mod bitpack;
pub mod controlreg;
pub mod elfloader;
pub mod ipaddr;
pub mod pipe;
pub mod protocol;
pub mod sendable;
pub mod util;

#[cfg(feature = "std")]
pub mod mmap;
#[cfg(not(target_family = "wasm"))]
#[path = "."]
mod not_wasm {
pub mod arrayvec;
pub mod buddy;
pub mod controlreg;
pub mod elfloader;
pub mod ipaddr;
pub mod pipe;
pub mod protocol;
pub mod refcnt;
pub mod sendable;
pub mod util;

#[cfg(feature = "std")]
pub mod mmap;
}

#[cfg(not(target_family = "wasm"))]
pub use not_wasm::{buddy::BuddyAllocator, *};

#[repr(C)]
#[derive(Debug)]
Expand Down
23 changes: 15 additions & 8 deletions demo.fix
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,40 @@
-- The whole file is interpreted as a single expression. Expressions can be comprised of:

-- Integer Literals
42
42u8

-- String Literals
"hello"

-- Trees
(1 2 3)
(1u8 2u8 3u8)

-- References
&"hello"

-- Identification Thunks
^&4
'&4u8

-- Application Thunks
*(1 2)
#(1u8 2u8)

-- Selection Thunks
["hello" 2u8] -- Zero-indexed
["hello" 1u8 3u8] -- Inclusive start and exclusive end

-- Strict Encodes
!^&2
*'&2u8

-- Shallow Encodes
+'&2u8

-- Let bindings that tie expressions to variables
(let ((x 42)) x)
(let ((x 42u8)) x)

-- @ path executables
@"./target/x86_64-unknown-none/addblob"

-- Primitives (To be implemented)
$interpret
-- Primitives
*#($identity 2u8)

-}
2 changes: 2 additions & 0 deletions fix/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ crossbeam-queue = {

[build-dependencies]
fixshell = { path = "shell", artifact="staticlib", target = "x86_64-unknown-none" }
fixpostprocessor = { path = "postprocessor" }
fixparser = { path = "parser", artifact = "cdylib", target = "wasm32-unknown-unknown" }
anyhow = "1.0.98"
bindgen = "0.72.1"
cc = "1.2.30"
Expand Down
6 changes: 5 additions & 1 deletion fix/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ fn main() -> Result<()> {
);
}
let wat = std::fs::read(f.path())?;
let wasm = wat2wasm(&wat)?;
let wasm = fixpostprocessor::process(&wat2wasm(&wat)?)?;
let (c, h) = wasm2c(&wasm)?;
let elf = c2elf(&c, &h)?;
std::fs::write(&dst, elf)?;
Expand All @@ -213,6 +213,10 @@ fn main() -> Result<()> {
symlink(dst, link)?;
}
}
let parser = PathBuf::from(env::var_os("CARGO_CDYLIB_FILE_FIXPARSER").unwrap());
let wasm = fixpostprocessor::process(&std::fs::read(&parser)?)?;
let (c, h) = wasm2c(&wasm)?;
std::fs::write(Path::new(&out_dir).join("fixparser"), c2elf(&c, &h)?)?;

let cwd = std::env::var("CARGO_MANIFEST_DIR").unwrap();

Expand Down
2 changes: 1 addition & 1 deletion fix/etc/memmap.ld
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ ENTRY(_start)

MEMORY {
cls (rwx) : ORIGIN = 0x0000000000000000, LENGTH = 2M
upper (rw) : ORIGIN = 0xFFFF800100100000, LENGTH = 8M
upper (rw) : ORIGIN = 0xFFFF800100100000, LENGTH = 32M
}

SECTIONS {
Expand Down
12 changes: 12 additions & 0 deletions fix/parser/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[package]
name = "fixparser"
version = "0.1.0"
edition = "2024"

[lib]
crate-type = ["cdylib"]

[dependencies]
fixutils = { path = "../utils" }
dlmalloc = { version = "0.2.14", features = ["global"] }
hex = { version = "0.4.3", default-features = false, features = ["alloc"] }
Loading
Loading