Skip to content

Commit

Permalink
LibQ: Add a userspace lib to the project
Browse files Browse the repository at this point in the history
  • Loading branch information
corigan01 committed Jan 18, 2025
1 parent d9602c5 commit b57c546
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 4 deletions.
5 changes: 3 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ members = [
"crates/mem",
"crates/arch-macro",
"crates/boolvec",
"user/dummy"
"user/dummy",
"user/libq"
]

default-members = ["meta"]
Expand Down Expand Up @@ -104,6 +105,6 @@ overflow-checks = true
inherits = "release"
panic = "abort"
opt-level=0
strip = false
strip = true
debug = 1
overflow-checks = true
4 changes: 2 additions & 2 deletions kernel/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ fn main(kbh: &KernelBootHeader) {
);

gdt::init_kernel_gdt();
// gdt::set_stack_for_privl(0x200000000000 as *mut u8, Ring0);
gdt::set_stack_for_privl(0x3000 as *mut u8, Ring0);
gdt::set_stack_for_privl(0x200000000000 as *mut u8, Ring0);
// gdt::set_stack_for_privl(0x3000 as *mut u8, Ring0);
unsafe { gdt::load_tss() };
int::attach_interrupts();
int::attach_syscall();
Expand Down
9 changes: 9 additions & 0 deletions user/libq/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[package]
name = "libq"
edition = "2024"
version.workspace = true
authors.workspace = true
description.workspace = true
documentation.workspace = true

[dependencies]
14 changes: 14 additions & 0 deletions user/libq/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
pub fn add(left: u64, right: u64) -> u64 {
left + right
}

#[cfg(test)]
mod tests {
use super::*;

#[test]
fn it_works() {
let result = add(2, 2);
assert_eq!(result, 4);
}
}

0 comments on commit b57c546

Please sign in to comment.