Create a core library for ableOS
This commit is contained in:
parent
89bbf03bd1
commit
b07943c72b
3
.vscode/settings.json
vendored
Normal file
3
.vscode/settings.json
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"rust-analyzer.showUnlinkedFileNotification": false
|
||||
}
|
7
Cargo.lock
generated
7
Cargo.lock
generated
|
@ -246,6 +246,10 @@ version = "1.16.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "86f0b0d4bf799edbc74508c1e8bf170ff5f41238e5f8225603ca7caaae2b7860"
|
||||
|
||||
[[package]]
|
||||
name = "os_core"
|
||||
version = "0.1.0"
|
||||
|
||||
[[package]]
|
||||
name = "pc_beeper_driver"
|
||||
version = "0.1.0"
|
||||
|
@ -486,6 +490,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
|
|||
[[package]]
|
||||
name = "wasm_syscall_test"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"os_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wat2wasm"
|
||||
|
|
|
@ -22,6 +22,7 @@ members = [
|
|||
"libraries/xml",
|
||||
"libraries/locale-maxima",
|
||||
"libraries/messaging",
|
||||
"libraries/os_core",
|
||||
"libraries/process",
|
||||
"libraries/std",
|
||||
"libraries/table",
|
||||
|
|
8
libraries/os_core/Cargo.toml
Normal file
8
libraries/os_core/Cargo.toml
Normal 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]
|
26
libraries/os_core/src/lib.rs
Normal file
26
libraries/os_core/src/lib.rs
Normal 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,
|
||||
}
|
|
@ -6,3 +6,4 @@ edition = "2021"
|
|||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
os_core = { path = "../../libraries/os_core" }
|
||||
|
|
|
@ -1,16 +1,10 @@
|
|||
#![no_std]
|
||||
#![no_main]
|
||||
use os_core::*;
|
||||
|
||||
#[no_mangle]
|
||||
fn _start() {
|
||||
unsafe {
|
||||
let abc = read_mem_addr(13);
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
fn read_mem_addr(address: usize) -> u64;
|
||||
|
||||
unsafe { create_object("") }
|
||||
}
|
||||
|
||||
#[panic_handler]
|
||||
|
|
|
@ -2,6 +2,6 @@ use xml;
|
|||
|
||||
fn main() {
|
||||
let root = xml::XMLElement::new("name");
|
||||
println!("{:?}", root.to_bin().unwrap());
|
||||
// println!("{:?}", root.to_bin().unwrap());
|
||||
println!("{}", root.to_string());
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue