Skip to content

Commit d4bfc2c

Browse files
committed
Lib: Added libm to emerald_std
This adds the missing functions `rust/std` require that are normally available in `libc` We will update `rust` as well to use these new functions. We have modified `libm` in the PR: rust-lang/libm#290 to enable building `std`.
1 parent cc5b950 commit d4bfc2c

File tree

5 files changed

+20
-4
lines changed

5 files changed

+20
-4
lines changed

Cargo.lock

Lines changed: 11 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

libraries/emerald_std/Cargo.toml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "emerald_std"
3-
version = "0.2.6"
3+
version = "0.2.7"
44
edition = "2021"
55
readme = "README.md"
66
authors = ["Amjad Alsharafi"]
@@ -15,6 +15,8 @@ categories = ["os"]
1515
[dependencies]
1616
increasing_heap_allocator = { version="0.1.3", path = "../increasing_heap_allocator" }
1717
kernel_user_link = { version="0.2.4", path = "../kernel_user_link", package = "emerald_kernel_user_link" }
18+
# for now, waiting for the PR https://github.com/rust-lang/libm/pull/290 to be merged
19+
libm = { version = "0.2.8", git = "https://github.com/Amjad50/libm", branch = "compiling_libm_for_std" }
1820

1921
core = { version = "1.0.0", optional = true, package = "rustc-std-workspace-core" }
2022
compiler_builtins = { version = "0.1.2", optional = true }
@@ -27,5 +29,6 @@ rustc-dep-of-std = [
2729
"alloc",
2830
"compiler_builtins/mem",
2931
"kernel_user_link/rustc-dep-of-std",
30-
"increasing_heap_allocator/rustc-dep-of-std"
32+
"increasing_heap_allocator/rustc-dep-of-std",
33+
"libm/rustc-dep-of-std"
3134
]

libraries/emerald_std/src/graphics.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ pub fn get_framebuffer_info() -> Result<FrameBufferInfo, SyscallError> {
7777
unsafe { Ok(info.assume_init()) }
7878
}
7979

80-
pub fn blit(command: &BlitCommand) -> Result<(), SyscallError> {
80+
pub fn blit(command: &BlitCommand<'_>) -> Result<(), SyscallError> {
8181
if !command.is_buffer_valid() {
8282
return Err(SyscallError::InvalidGraphicsBuffer);
8383
}

libraries/emerald_std/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ pub mod alloc;
44
pub mod clock;
55
pub mod graphics;
66
pub mod io;
7+
pub mod math;
78
pub mod process;
89
mod sync;
910

libraries/emerald_std/src/math.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
//! Re-export of the `libm` crate.
2+
pub use libm::*;

0 commit comments

Comments
 (0)