Skip to content
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

Update to use the new API for custom allocators. #348

Merged
merged 8 commits into from
Aug 20, 2017
Merged

Update to use the new API for custom allocators. #348

merged 8 commits into from
Aug 20, 2017

Conversation

toor
Copy link
Contributor

@toor toor commented Aug 19, 2017

Had to change the linked_list_allocator dependecy to link directly to git, because the version on crates.io is still using the old Unique API.

@toor toor closed this Aug 19, 2017
@toor toor reopened this Aug 19, 2017
@4e554c4c
Copy link
Contributor

Why are you creating Cargo.lock?

@toor
Copy link
Contributor Author

toor commented Aug 19, 2017

@4e554c4c Cargo.lock is included in Git by default with this repository?

@4e554c4c
Copy link
Contributor

Then add it to the .gitignore. There isn't currently a Cargo.lock in the repository so you shouldn't add one without a good reason.

@toor toor closed this Aug 19, 2017
@toor toor reopened this Aug 19, 2017
@toor
Copy link
Contributor Author

toor commented Aug 19, 2017

Ok, fixed that.

@toor toor closed this Aug 19, 2017
@toor toor reopened this Aug 19, 2017
@toor
Copy link
Contributor Author

toor commented Aug 19, 2017

It seems I can't use Git apparently, Cargo.lock is properly removed now.

@4e554c4c
Copy link
Contributor

Thank you! I think this is good.

Copy link
Owner

@phil-opp phil-opp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR!

I think we could remove the hole_list_allocator crate completely and directly use the LockedHeap struct.

pub extern fn __rust_allocate(size: usize, align: usize) -> *mut u8 {
HEAP.lock().allocate_first_fit(size, align).expect("out of memory")
//Set up the heap
pub unsafe fn init(offset: usize, size: usize) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This init function isn't called right now, so the heap stays uninitialized.

@toor
Copy link
Contributor Author

toor commented Aug 20, 2017

I think using the LockedHeap struct is a definite possiblity, however for now I have just changed it so the heap init function does get called in src/memory/mod.rs under the memory::init function.

@phil-opp phil-opp merged commit 0175e83 into phil-opp:master Aug 20, 2017
@phil-opp
Copy link
Owner

Ok, I decided to merge this for now. Maybe we switch to LockedHeap eventually, but for now it's good to have this project buildable again.

Thanks a lot @too-r!

@@ -53,7 +53,7 @@ pub extern "C" fn rust_main(multiboot_information_address: usize) {

// initialize our IDT
interrupts::init(&mut memory_controller);

Copy link
Contributor

@bjorn3 bjorn3 Aug 21, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

trailing whitespace which was not previously here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants