sos-os / alarm

ALARM: Another Library for Allocating and Releasing Memory
Apache License 2.0
8 stars 6 forks source link

determine allocator page/frame provider API #19

Open hawkw opened 6 years ago

hawkw commented 6 years ago

see https://github.com/hawkw/alarm/issues/17#issuecomment-359283405

hawkw commented 6 years ago

there exists some prior art: https://github.com/gz/rust-slabmalloc/blob/84fdb79f1f2305d39badd116546678f6b3784326/src/lib.rs#L56-L64

https://github.com/hawkw/sos-kernel/blob/cbe8107fe943643f1cb6d0fcafbd1ac141442fbd/sos_alloc/src/frame/mod.rs#L19-L31

https://github.com/phil-opp/blog_os/blob/3f4a4bf2e1d38427bcbfdd31a09f3b510d09be2b/src/memory/mod.rs#L151-L154

https://github.com/dschatzberg/genesis/blob/290c66737c57d50e94e90b69aa404eeee0f4075b/src/memory/mod.rs#L117-L133

hawkw commented 6 years ago

i think this trait ought to have an associated constant for the size of frames allocated (and arch cache line size?) so we don't need to know that in ALARM ...

hawkw commented 6 years ago

currently up in the air:

hawkw commented 6 years ago

would welcome input from @croyzor et al. on this...

hawkw commented 6 years ago

so the allocator API takes &mut self, which goes somewhat counter to my opinion that the frame allocator implementor ought to own the mutex strategy. hrm.

hawkw commented 6 years ago

i think if we add a FRAME_SIZE constant to the frame provider trait, we can bound Frame: Into<*mut [u8; FRAME_SIZE]> or something, which seems ideologically correct to me.

hawkw commented 6 years ago

Started: #22