Philipp Oppermann
3fc7bf6aa1
Fix register typo: rpb -> rbp
...
Fixes #746
2020-02-16 18:02:24 +01:00
Philipp Oppermann
b337f65abb
Add a yield_now function and use it in idle thread
2020-01-28 12:28:50 +01:00
Philipp Oppermann
22c6bd5aa7
Add idle thread and begin support for blocking
2020-01-28 12:22:37 +01:00
Philipp Oppermann
87719f2260
Switch current_thread_id before context switch
2020-01-28 11:29:21 +01:00
Philipp Oppermann
0caf5c351e
Run cargo fmt
2020-01-23 14:24:13 +01:00
Philipp Oppermann
cb7bb0ddef
Refactor and rewrite
2020-01-23 14:22:29 +01:00
Philipp Oppermann
7ad30651fb
Rename allocator.rs to allocator/mod.rs
2020-01-23 11:46:45 +01:00
Philipp Oppermann
49923acb3f
Print thread id instead of hardcoding numbers
2020-01-23 11:03:15 +01:00
Philipp Oppermann
f2b1f3a593
Fix handling of current thread id
2020-01-23 10:49:51 +01:00
Philipp Oppermann
5e2e0b629e
Refactor threading code
2020-01-23 10:42:37 +01:00
Philipp Oppermann
35379c90e6
Force unlock writer on panic to avoid deadlocks
2020-01-23 10:42:19 +01:00
Philipp Oppermann
e5d10fcaec
Increase stack size to avoid stack overflow
2020-01-23 10:41:59 +01:00
Philipp Oppermann
e1242a867f
Move global_asm inline in threads module
2020-01-23 09:20:17 +01:00
Philipp Oppermann
cd138a3a1b
Rename multitasking module to threads
2020-01-23 09:19:38 +01:00
Philipp Oppermann
11a0eb679c
Fix race condition
...
The first timer interrupt might occur before the heap is initialized. With lazy_static, this causes an allocation failure since the VecDeque is allocated when it's accessed the first time. This commit fixes this by only initializing VecDeque in `add_thread`.
2020-01-23 08:50:35 +01:00
Philipp Oppermann
241c1ab2c9
Add support for closures
2020-01-23 08:24:48 +01:00
Philipp Oppermann
b75406b37e
Add new modules
2020-01-22 17:24:17 +01:00
Philipp Oppermann
c3450b6df7
Refactor a bit
2020-01-22 16:33:23 +01:00
Philipp Oppermann
ce1fdcf768
Wip
2020-01-22 16:15:23 +01:00
Philipp Oppermann
002d6f255f
Set FixedSizeBlockAllocator as global allocator
2020-01-20 14:09:00 +01:00
Philipp Oppermann
6c3bf0b10f
Implement GlobalAlloc::dealloc
2020-01-20 14:07:47 +01:00
Philipp Oppermann
7a792f5cb0
Implement GlobalAlloc::alloc
2020-01-20 14:07:02 +01:00
Philipp Oppermann
93b4dcf434
Add skeleton for GlobalAlloc implementation
2020-01-20 14:06:26 +01:00
Philipp Oppermann
821dd2adb4
Add function to calculate the list index
2020-01-20 14:05:24 +01:00
Philipp Oppermann
d636939b51
Add FixedSizeBlockAllocator::fallback_alloc method
2020-01-20 14:05:01 +01:00
Philipp Oppermann
9b7326541e
Add FixedSizeBlockAllocator type
2020-01-20 14:04:13 +01:00
Philipp Oppermann
4f234b67ef
Add ListNode type and BLOCK_SIZES constant
2020-01-20 14:02:57 +01:00
Philipp Oppermann
7381e11f3c
Create a new fixed_size_block allocator submodule
2020-01-20 14:01:59 +01:00
Philipp Oppermann
a9fe65a0ce
Use new LinkedListAllocator
2020-01-10 13:04:46 +01:00
Philipp Oppermann
2001814119
Implement LinkedListAllocator::size_align
2020-01-10 13:00:16 +01:00
Philipp Oppermann
a5c50e7408
Implement GlobalAlloc for LinkedListAllocator
2020-01-10 11:52:04 +01:00
Philipp Oppermann
70a52c291d
Implement alloc_from_region
2020-01-10 11:48:56 +01:00
Philipp Oppermann
c56bfa27e4
Implement find_region
2020-01-10 11:46:10 +01:00
Philipp Oppermann
55aec9ebf3
Apply rustfmt to ListNode::new function
2020-01-10 11:44:38 +01:00
Philipp Oppermann
2e1d132a9a
Implement add_free_region
2020-01-10 11:44:17 +01:00
Philipp Oppermann
63e8577d77
Create a basic LinkedListAllocator type
2020-01-10 11:42:04 +01:00
Philipp Oppermann
75d826bf69
Add a test that memory is reused with a long lived allocation
...
This test fails for the bump allocator because it can only free the complete heap at once, which is prevented by the single long-lived allocation.
2020-01-09 15:45:38 +01:00
Philipp Oppermann
45be3f0648
Use our BumpAllocator instead of linked_list_allocator crate
2020-01-09 15:37:43 +01:00
Philipp Oppermann
055c560a7a
Add an align_up function
2020-01-09 15:36:06 +01:00
Philipp Oppermann
e87044a7ee
Implement GlobalAlloc for BumpAllocator
2020-01-09 15:35:03 +01:00
Philipp Oppermann
08d2289dad
Add a Locked wrapper type that can be used to implement GlobalAlloc
2020-01-09 15:34:04 +01:00
Philipp Oppermann
7c84dbaa1d
Create a basic BumpAllocator type
2020-01-09 15:25:37 +01:00
Philipp Oppermann
882c83f9de
Update many_boxes test to scale with heap size ( #716 )
...
Instead of using a hardcoded number of boxes, use the HEAP_SIZE constant. This ensures that we get a test failure because of an out-of-memory error when the allocator does not reuse freed memory.
2020-01-09 12:58:29 +01:00
Philipp Oppermann
869a69e531
Move #[global_allocator] into allocator module ( #714 )
...
The Rust issue that the #[global_allocator] cannot be defined in submodules was fixed.
2020-01-08 12:38:06 +01:00
Philipp Oppermann
817267e51c
Update Github Actions badge for post-10
2019-12-12 09:32:59 +01:00
Philipp Oppermann
9e75078dab
Merge branch 'post-09' into post-10
2019-12-12 09:32:46 +01:00
Philipp Oppermann
ed3af8e984
Update Github Actions badge for post-09
2019-12-12 09:32:30 +01:00
Philipp Oppermann
1d1075b35e
Merge branch 'post-08' into post-09
2019-12-12 09:32:16 +01:00
Philipp Oppermann
00f39aaccb
Update Github Actions badge for post-08
2019-12-12 09:31:56 +01:00
Philipp Oppermann
f815a1742a
Merge branch 'post-07' into post-08
2019-12-12 09:31:42 +01:00