Heap for first MB

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
User avatar
AlfaOmega08
Member
Member
Posts: 226
Joined: Wed Nov 07, 2007 12:15 pm
Location: Italy

Heap for first MB

Post by AlfaOmega08 »

Hi, I'm trying (just for fun, not a serious project) to write a boot manager.
With some copy/paste I get to protected mode from fat12 in half an hour...

Anyway I now need some sort of heap. Having malloc/free - new/delete is always good.
I usually use dlmalloc. However dlmalloc is HUGE. I would need something that:
  • Is lightning fast (today boot must be fast, and no bottleneck is accepted)
  • Is small
  • Supports for aligned mallocs (for page tables/directories)
  • Doesn't need paging
  • Can handle reserved zones (between 0x500 and 0x7FFFF there is 0x7C00 and I want to keep it safe)
I may use upper memory for the heap, but it's not safe, since the OS executable may be loaded anywhere over the first MB, thus overwriting the heap.

Any suggestion for such a memory allocator? Any dlmalloc configuration? Or just an idea of how to implement it...
Thanks in advance.
Please, correct my English...
Motherboard: ASUS Rampage II Extreme
CPU: Core i7 950 @ 3.06 GHz OC at 3.6 GHz
RAM: 4 GB 1600 MHz DDR3
Video: nVidia GeForce 210 GTS... it sucks...
User avatar
Griwes
Member
Member
Posts: 374
Joined: Sat Jul 30, 2011 10:07 am
Libera.chat IRC: Griwes
Location: Wrocław/Racibórz, Poland
Contact:

Re: Heap for first MB

Post by Griwes »

For bootloader just use simple placement allocator, aware of those special regions - it's not like you're going to do much allocations in the bootloader.
Reaver Project :: Repository :: Ohloh project page
<klange> This is a horror story about what happens when you need a hammer and all you have is the skulls of the damned.
<drake1> as long as the lock is read and modified by atomic operations
zeusk
Posts: 16
Joined: Fri Sep 14, 2012 1:09 pm

Re: Heap for first MB

Post by zeusk »

Although I am not working on a bootloader, a small/fast heap without the requirement of paging would be nice for embedded purposes. Do post here if you find anything interesting.
Post Reply