File tree 10 files changed +63
-26
lines changed
10 files changed +63
-26
lines changed Original file line number Diff line number Diff line change 1
1
# j4fos
2
2
3
3
Realtime microkernel for ALINX ZYNQ 7020 SoC (or Sipeed Gowin GW5AST devboard) projects
4
+
5
+ ## Run on QEMU
6
+
7
+ ``` sh
8
+ # Artifacts auto scanning are disabled now
9
+ # So use -B key
10
+ make qemu -B
11
+ ```
Original file line number Diff line number Diff line change 1
- #![ no_main]
2
1
#![ no_std]
3
2
4
3
use core:: panic:: PanicInfo ;
Original file line number Diff line number Diff line change @@ -15,3 +15,6 @@ fs.workspace = true
15
15
mm.workspace = true
16
16
net.workspace = true
17
17
types.workspace = true
18
+
19
+ [features ]
20
+ with_std = [ " mm/with_std" ]
Original file line number Diff line number Diff line change @@ -7,4 +7,9 @@ edition = "2021"
7
7
spin.workspace = true
8
8
bitflags.workspace = true
9
9
types.workspace = true
10
- dev.workspace = true
10
+ dev.workspace = true
11
+
12
+ jemallocator = { version = " 0.5.4" , optional = true }
13
+
14
+ [features ]
15
+ with_std = [ " jemallocator" ]
Original file line number Diff line number Diff line change 1
1
# Memory management
2
2
3
- ## Page allocators
3
+ ## Run tests
4
+
5
+ ``` sh
6
+ cargo test --package mm --features with_std
7
+ ```
8
+
9
+ ## References
10
+
11
+ ### Page allocators
4
12
5
13
https://github.com/Ko-oK-OS/buddy-allocator
6
14
7
- ## SLAB allocators
15
+ ### SLAB allocators
Original file line number Diff line number Diff line change 1
- #![ no_main]
2
1
#![ no_std]
3
2
4
- pub mod page;
5
- pub mod zone;
6
3
pub mod layout;
4
+ pub mod page;
7
5
8
- use layout :: PHYSTOP ;
6
+ pub mod zone ;
9
7
pub use zone:: Zone ;
10
8
11
9
pub mod locked_zone;
12
10
pub use locked_zone:: LockedZone ;
13
- use zone:: { next_aligned_by, PAGE_SIZE } ;
14
-
15
- #[ global_allocator]
16
- pub static KMEM : LockedZone = LockedZone :: new ( ) ;
17
11
18
- unsafe extern "C" {
19
- // first address after kernel, defined by kernel.ld
20
- unsafe static mut end : [ u8 ; 0 ] ;
21
- }
12
+ # [ cfg ( not ( feature = "with_std" ) ) ]
13
+ pub mod nostdlib ;
14
+ # [ cfg ( not ( feature = "with_std" ) ) ]
15
+ pub use nostdlib :: * ;
22
16
23
- pub fn init ( ) {
24
- unsafe {
25
- KMEM . lock ( ) . add_to_heap (
26
- next_aligned_by ( end. as_ptr ( ) as usize , PAGE_SIZE ) ,
27
- next_aligned_by ( PHYSTOP , PAGE_SIZE )
28
- )
29
- }
30
- }
17
+ #[ cfg( feature = "with_std" ) ]
18
+ pub mod stdlib;
19
+ #[ cfg( feature = "with_std" ) ]
20
+ pub use stdlib:: * ;
Original file line number Diff line number Diff line change
1
+ use crate :: layout:: PHYSTOP ;
2
+ use crate :: zone:: { next_aligned_by, PAGE_SIZE } ;
3
+ use crate :: locked_zone:: LockedZone ;
4
+
5
+ unsafe extern "C" {
6
+ // first address after kernel, defined by kernel.ld
7
+ unsafe static mut end: [ u8 ; 0 ] ;
8
+ }
9
+
10
+ #[ global_allocator]
11
+ pub static KMEM : LockedZone = LockedZone :: new ( ) ;
12
+
13
+ pub fn init ( ) {
14
+ unsafe {
15
+ KMEM . lock ( ) . add_to_heap (
16
+ next_aligned_by ( end. as_ptr ( ) as usize , PAGE_SIZE ) ,
17
+ next_aligned_by ( PHYSTOP , PAGE_SIZE )
18
+ )
19
+ }
20
+ }
Original file line number Diff line number Diff line change
1
+ use jemallocator:: Jemalloc ;
2
+
3
+ #[ global_allocator]
4
+ static GLOBAL : Jemalloc = Jemalloc ;
5
+
6
+ pub fn init ( ) { }
Original file line number Diff line number Diff line change 1
- #![ no_main]
2
1
#![ no_std]
3
2
4
3
use core:: panic:: PanicInfo ;
Original file line number Diff line number Diff line change 1
- #![ no_main]
2
1
#![ no_std]
3
2
4
3
pub mod linked_list;
You can’t perform that action at this time.
0 commit comments