-
Notifications
You must be signed in to change notification settings - Fork 1
Development #146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Development #146
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#ifndef KERNEL_HEAP_RUST_H | ||
#define KERNEL_HEAP_RUST_H | ||
|
||
#include <stddef.h> | ||
#include <stdint.h> | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
// Core allocation functions | ||
void* rust_kmalloc(size_t size); | ||
void rust_kfree(void* ptr); | ||
void* rust_krealloc(void* ptr, size_t new_size); | ||
void* rust_kcalloc(size_t count, size_t size); | ||
|
||
// Statistics and monitoring | ||
typedef struct { | ||
size_t total_allocated; | ||
size_t peak_allocated; | ||
uint64_t alloc_count; | ||
uint64_t free_count; | ||
uint64_t cache_hits; | ||
uint64_t cache_misses; | ||
uint64_t coalesce_count; | ||
uint64_t corruption_count; | ||
} HeapStats; | ||
|
||
void rust_heap_get_stats(HeapStats* stats); | ||
int rust_heap_validate(void); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif // KERNEL_HEAP_RUST_H |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[build] | ||
target = "x86_64-unknown-none" | ||
|
||
[target.x86_64-unknown-none] | ||
rustflags = [ | ||
"-C", "code-model=kernel", | ||
"-C", "relocation-model=static", | ||
"-C", "target-feature=-mmx,-sse,-sse2,-sse3,-ssse3,-sse4.1,-sse4.2,-3dnow,-3dnowa,-avx,-avx2", | ||
] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
cmake_minimum_required(VERSION 3.20) | ||
|
||
# Find Rust and Cargo | ||
find_program(CARGO_EXECUTABLE cargo REQUIRED) | ||
find_program(RUSTC_EXECUTABLE rustc REQUIRED) | ||
|
||
# Set target triple based on architecture | ||
if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|AMD64") | ||
set(RUST_TARGET "x86_64-unknown-none") | ||
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64|arm64") | ||
set(RUST_TARGET "aarch64-unknown-none") | ||
else() | ||
message(FATAL_ERROR "Unsupported architecture: ${CMAKE_SYSTEM_PROCESSOR}") | ||
endif() | ||
|
||
# Rust library target | ||
set(RUST_LIB_NAME "voidframe_mm") | ||
set(RUST_LIB_PATH "${CMAKE_CURRENT_SOURCE_DIR}/target/${RUST_TARGET}/release/lib${RUST_LIB_NAME}.a") | ||
|
||
# Custom command to build Rust library | ||
add_custom_command( | ||
OUTPUT ${RUST_LIB_PATH} | ||
COMMAND ${CARGO_EXECUTABLE} build --release --target ${RUST_TARGET} | ||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} | ||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/Cargo.toml | ||
${CMAKE_CURRENT_SOURCE_DIR}/src/lib.rs | ||
${CMAKE_CURRENT_SOURCE_DIR}/src/heap.rs | ||
${CMAKE_CURRENT_SOURCE_DIR}/src/vmem_ffi.rs | ||
COMMENT "Building Rust heap library" | ||
) | ||
|
||
# Create imported library target | ||
add_custom_target(rust_heap_build DEPENDS ${RUST_LIB_PATH}) | ||
|
||
add_library(rust_heap STATIC IMPORTED GLOBAL) | ||
set_target_properties(rust_heap PROPERTIES | ||
IMPORTED_LOCATION ${RUST_LIB_PATH} | ||
) | ||
|
||
add_dependencies(rust_heap rust_heap_build) | ||
|
||
# Install header | ||
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../KernelHeapRust.h | ||
DESTINATION include/mm) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
[package] | ||
name = "voidframe-mm" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
[lib] | ||
crate-type = ["staticlib"] | ||
|
||
[dependencies] | ||
spin = { version = "0.9", default-features = false, features = ["mutex", "spin_mutex"] } | ||
|
||
[profile.release] | ||
panic = "abort" | ||
lto = true | ||
codegen-units = 1 |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove the trailing backslash and make the rustup install non-interactive
Line 32 keeps the line-continuation
\
, so the shell treats the subsequentcurl … | sh
as part of theapt-get install
command (and even pipes apt output intosh
). The step fails before rustup ever runs. Drop the trailing backslash socurl
executes separately, and make the rustup install non-interactive while exporting Cargo to the PATH.📝 Committable suggestion
🤖 Prompt for AI Agents