diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 0000000..13566b8
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,8 @@
+# Default ignored files
+/shelf/
+/workspace.xml
+# Editor-based HTTP Client requests
+/httpRequests/
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml
diff --git a/.idea/FoundryOS.iml b/.idea/FoundryOS.iml
new file mode 100644
index 0000000..158aa3e
--- /dev/null
+++ b/.idea/FoundryOS.iml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..e6c1e1c
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..9bf7a27
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Cargo.lock b/Cargo.lock
index dc802d6..f059199 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -8,10 +8,20 @@ version = "2.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f68f53c83ab957f72c32642f3868eec03eb974d1fb82e453128456482613d36"
+[[package]]
+name = "cc"
+version = "1.2.14"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0c3d1b2e905a3a7b00a6141adb0e4c0bb941d11caf55349d863942a1cc44e3c9"
+dependencies = [
+ "shlex",
+]
+
[[package]]
name = "kernel"
version = "0.1.0"
dependencies = [
+ "cc",
"lib_example",
"limine",
]
@@ -28,3 +38,9 @@ checksum = "9ca87cab008b8efeebdbe037cd4d1438037d48c5cb6fed939ffa5aa06315a321"
dependencies = [
"bitflags",
]
+
+[[package]]
+name = "shlex"
+version = "1.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
diff --git a/kernel/Cargo.toml b/kernel/Cargo.toml
index 8c855f6..255736c 100644
--- a/kernel/Cargo.toml
+++ b/kernel/Cargo.toml
@@ -7,9 +7,12 @@ edition = "2021"
limine = "0.3.1"
lib_example = { path = "../lib_example" }
+[build-dependencies]
+cc = "1.2.14"
+
[features]
default = []
[[bin]]
name = "kernel"
-path = "src/main.rs"
\ No newline at end of file
+path = "src/main.rs"
diff --git a/kernel/build.rs b/kernel/build.rs
index 4d43936..1ea5435 100644
--- a/kernel/build.rs
+++ b/kernel/build.rs
@@ -1,9 +1,14 @@
use std::process::Command;
use std::{env, path::Path};
+use cc;
fn main() {
// Tell cargo to rerun if these files change
println!("cargo:rerun-if-changed=src");
println!("cargo:rerun-if-changed=linker.ld");
println!("cargo:rerun-if-changed=../config/limine.conf");
-}
+
+ cc::Build::new()
+ .file("src/main.c")
+ .compile("lib");
+}
\ No newline at end of file
diff --git a/kernel/src/main.c b/kernel/src/main.c
new file mode 100644
index 0000000..af9b44a
--- /dev/null
+++ b/kernel/src/main.c
@@ -0,0 +1,3 @@
+int add(int x, int y) {
+ return x+y;
+}
\ No newline at end of file
diff --git a/kernel/src/main.rs b/kernel/src/main.rs
index ccf2a82..d8832df 100644
--- a/kernel/src/main.rs
+++ b/kernel/src/main.rs
@@ -28,6 +28,11 @@ static _START_MARKER: RequestsStartMarker = RequestsStartMarker::new();
#[link_section = ".requests_end_marker"]
static _END_MARKER: RequestsEndMarker = RequestsEndMarker::new();
+
+extern "C" {
+ pub fn add(x: i32, y: i32) -> i32;
+}
+
#[no_mangle]
unsafe extern "C" fn kmain() -> ! {
// All limine requests must also be referenced in a called function, otherwise they may be
@@ -35,6 +40,8 @@ unsafe extern "C" fn kmain() -> ! {
assert!(BASE_REVISION.is_supported());
lib_example::add_nums(1, 2);
+ add(1, 2);
+
if let Some(framebuffer_response) = FRAMEBUFFER_REQUEST.get_response() {
if let Some(framebuffer) = framebuffer_response.framebuffers().next() {