diff --git a/Cargo.lock b/Cargo.lock index 9bb9ed5..30384b1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6,9 +6,16 @@ version = 3 name = "burritos" version = "0.1.0" dependencies = [ + "cc", "libc", ] +[[package]] +name = "cc" +version = "1.0.79" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" + [[package]] name = "libc" version = "0.2.140" diff --git a/Cargo.toml b/Cargo.toml index 95cb216..911c397 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,4 +7,7 @@ edition = "2021" libc = { version = "0.2.139", features = ["extra_traits"] } [registries.crates-io] -protocol = "sparse" \ No newline at end of file +protocol = "sparse" + +[build-dependencies] +cc = "1.0" \ No newline at end of file diff --git a/build.rs b/build.rs new file mode 100644 index 0000000..7b5ec8a --- /dev/null +++ b/build.rs @@ -0,0 +1,5 @@ +fn main() { + cc::Build::new() + .file("test/userlib/sys.s") + .compile("my-asm-lib"); +} \ No newline at end of file diff --git a/test/userlib/sys.s b/test/userlib/sys.s index 64c3069..970117b 100644 --- a/test/userlib/sys.s +++ b/test/userlib/sys.s @@ -65,7 +65,7 @@ __start: .globl Halt .type __Halt, @function -Halt: +Shutdown: addi a7,zero,SC_HALT ecall jr ra diff --git a/test/userlib/syscall.rs b/test/userlib/syscall.rs new file mode 100644 index 0000000..4350f5a --- /dev/null +++ b/test/userlib/syscall.rs @@ -0,0 +1,21 @@ +pub struct Burritos_Time { + seconds: i64, + nanos: i64 +} +pub struct ThreadId{ + id: u64 +} +pub struct t_error{ + t: i32 +} +extern "C"{ + fn Shutdown() -> (); + fn SysTime(t: Burritos_Time) -> (); + fn Exit(status: i32) -> (); + fn Exec(name: String) -> ThreadId; + fn newThread(debug_name: String, func: i32, arg: i32) -> ThreadId; + fn Join (id: ThreadId) -> t_error; + fn Yield() -> (); + fn Perror(mess: String) -> (); + +} \ No newline at end of file