Create a core library for ableOS

This commit is contained in:
Able 2023-04-07 16:42:28 -05:00
parent 89bbf03bd1
commit b07943c72b
8 changed files with 49 additions and 9 deletions

3
.vscode/settings.json vendored Normal file
View file

@ -0,0 +1,3 @@
{
"rust-analyzer.showUnlinkedFileNotification": false
}

7
Cargo.lock generated
View file

@ -246,6 +246,10 @@ version = "1.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "86f0b0d4bf799edbc74508c1e8bf170ff5f41238e5f8225603ca7caaae2b7860" checksum = "86f0b0d4bf799edbc74508c1e8bf170ff5f41238e5f8225603ca7caaae2b7860"
[[package]]
name = "os_core"
version = "0.1.0"
[[package]] [[package]]
name = "pc_beeper_driver" name = "pc_beeper_driver"
version = "0.1.0" version = "0.1.0"
@ -486,6 +490,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
[[package]] [[package]]
name = "wasm_syscall_test" name = "wasm_syscall_test"
version = "0.1.0" version = "0.1.0"
dependencies = [
"os_core",
]
[[package]] [[package]]
name = "wat2wasm" name = "wat2wasm"

View file

@ -22,6 +22,7 @@ members = [
"libraries/xml", "libraries/xml",
"libraries/locale-maxima", "libraries/locale-maxima",
"libraries/messaging", "libraries/messaging",
"libraries/os_core",
"libraries/process", "libraries/process",
"libraries/std", "libraries/std",
"libraries/table", "libraries/table",

View file

@ -0,0 +1,8 @@
[package]
name = "os_core"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]

View file

@ -0,0 +1,26 @@
#![no_std]
type Handle = i64;
#[repr(C)]
pub struct OSString {
pub address: i32,
pub length: i32,
}
extern "C" {
pub fn create_object(string: OSString) -> Result<Handle>;
pub fn read_object_attribute(handle: Handle, string: OSString) -> Result<OSString>;
pub fn set_object_attribute(handle: Handle, string: OSString, value: OSString) -> Result<()>;
}
#[repr(C)]
pub enum ExternErrors {
None = 0,
}
#[repr(C)]
pub struct Result<T> {
pub ok: T,
pub err: ExternErrors,
}

View file

@ -6,3 +6,4 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [dependencies]
os_core = { path = "../../libraries/os_core" }

View file

@ -1,16 +1,10 @@
#![no_std] #![no_std]
#![no_main] #![no_main]
use os_core::*;
#[no_mangle] #[no_mangle]
fn _start() { fn _start() {
unsafe { unsafe { create_object("") }
let abc = read_mem_addr(13);
}
}
extern "C" {
fn read_mem_addr(address: usize) -> u64;
} }
#[panic_handler] #[panic_handler]

View file

@ -2,6 +2,6 @@ use xml;
fn main() { fn main() {
let root = xml::XMLElement::new("name"); let root = xml::XMLElement::new("name");
println!("{:?}", root.to_bin().unwrap()); // println!("{:?}", root.to_bin().unwrap());
println!("{}", root.to_string()); println!("{}", root.to_string());
} }