aboutsummaryrefslogtreecommitdiffstats
path: root/halt
diff options
context:
space:
mode:
Diffstat (limited to 'halt')
-rw-r--r--halt/Cargo.toml18
-rw-r--r--halt/main.c5
-rw-r--r--halt/rust-toolchain1
-rw-r--r--halt/rust.h1
-rw-r--r--halt/src/main.rs26
5 files changed, 51 insertions, 0 deletions
diff --git a/halt/Cargo.toml b/halt/Cargo.toml
new file mode 100644
index 0000000..160a513
--- /dev/null
+++ b/halt/Cargo.toml
@@ -0,0 +1,18 @@
+[package]
+name = "halt"
+version = "0.1.0"
+authors = ["Gustav Sörnäs <gustav@sornas.net>"]
+edition = "2018"
+
+# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
+
+[profile.dev]
+panic = "abort"
+
+[profile.release]
+panic = "abort"
+
+[dependencies.libc]
+version = "0.2"
+default-features = false
+features = ["extra_traits"]
diff --git a/halt/main.c b/halt/main.c
new file mode 100644
index 0000000..c89be21
--- /dev/null
+++ b/halt/main.c
@@ -0,0 +1,5 @@
+#include "rust.h"
+
+void _start (int argc, char **argv) {
+ main();
+}
diff --git a/halt/rust-toolchain b/halt/rust-toolchain
new file mode 100644
index 0000000..adfa491
--- /dev/null
+++ b/halt/rust-toolchain
@@ -0,0 +1 @@
+nightly-i686-unknown-linux-gnu
diff --git a/halt/rust.h b/halt/rust.h
new file mode 100644
index 0000000..eba2976
--- /dev/null
+++ b/halt/rust.h
@@ -0,0 +1 @@
+int main(void);
diff --git a/halt/src/main.rs b/halt/src/main.rs
new file mode 100644
index 0000000..8abf38a
--- /dev/null
+++ b/halt/src/main.rs
@@ -0,0 +1,26 @@
+#![no_std]
+#![no_main]
+#![feature(start)]
+//#![feature(asm)]
+//#![link_args = "-L -lmain"]
+
+#[panic_handler]
+fn panic(_info: &core::panic::PanicInfo) -> ! {
+ loop {}
+}
+
+#[no_mangle]
+pub unsafe extern "C" fn main() {
+ exit(0x69);
+}
+
+#[link(name="pintos", kind="static")]
+extern {
+ fn exit(status: i32);
+}
+
+//#[no_mangle]
+//#[start]
+//unsafe extern "C" fn _start() {
+// exit(main());
+//}