aboutsummaryrefslogtreecommitdiffstats
path: root/rust
diff options
context:
space:
mode:
authorGustav Sörnäs <gustav@sornas.net>2020-11-23 14:52:17 +0100
committerGustav Sörnäs <gustav@sornas.net>2020-11-23 14:52:17 +0100
commit20eb8b73f7914c86812eda4b3b14ee2d0cd5a826 (patch)
treeb9b32887525510c7031f8e0957e11d85e6bdcf11 /rust
parentd77e19ae7380b8ddda4625772161c8dc74651370 (diff)
downloadpintos-rs-20eb8b73f7914c86812eda4b3b14ee2d0cd5a826.tar.gz
userprog makefile
Diffstat (limited to 'rust')
-rw-r--r--rust/Cargo.toml20
-rw-r--r--rust/Makefile2
-rw-r--r--rust/rust-toolchain1
-rw-r--r--rust/src/lib.rs19
4 files changed, 42 insertions, 0 deletions
diff --git a/rust/Cargo.toml b/rust/Cargo.toml
new file mode 100644
index 0000000..a74fdd6
--- /dev/null
+++ b/rust/Cargo.toml
@@ -0,0 +1,20 @@
+[package]
+name = "pintos-rs"
+version = "0.1.0"
+authors = ["Gustav Sörnäs <gustav@sornas.net>"]
+edition = "2018"
+
+[lib]
+name = "rust"
+crate-type = ["staticlib"]
+
+[profile.dev]
+panic = "abort"
+
+[profile.release]
+panic = "abort"
+
+[dependencies.libc]
+version = "0.2"
+default-features = false
+features = ["extra_traits"]
diff --git a/rust/Makefile b/rust/Makefile
new file mode 100644
index 0000000..23187c9
--- /dev/null
+++ b/rust/Makefile
@@ -0,0 +1,2 @@
+all:
+ cargo rustc -- -C link-arg= -L.
diff --git a/rust/rust-toolchain b/rust/rust-toolchain
new file mode 100644
index 0000000..adfa491
--- /dev/null
+++ b/rust/rust-toolchain
@@ -0,0 +1 @@
+nightly-i686-unknown-linux-gnu
diff --git a/rust/src/lib.rs b/rust/src/lib.rs
new file mode 100644
index 0000000..43470b2
--- /dev/null
+++ b/rust/src/lib.rs
@@ -0,0 +1,19 @@
+#![no_std]
+//#![feature(asm)]
+//#![feature(link_args)]
+//#![link_args = "-L -lpintos"]
+
+#[panic_handler]
+fn panic(_info: &core::panic::PanicInfo) -> ! {
+ loop {}
+}
+
+#[no_mangle]
+pub unsafe extern "C" fn entry() {
+ exit(0x69);
+}
+
+#[link(name="pintos", kind="static")]
+extern {
+ fn exit(status: i32);
+}