The first 16MB

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
thooot

The first 16MB

Post by thooot »

Right now I'm in the process of designing the memory management for my OS. I've heard that some hardware requires its data to be in the first 16MB (like the floppy drive???). So I was wondering how much memory do these devices require to have available? If I just leave the 640K below the 1MB mark available for them will it be enough? Also what devices do require this type of memory, and are the memory requirements different for different devices?
Tim

Re:The first 16MB

Post by Tim »

The only hardware that requires this is the ISA DMA controller, and the only devices I know of that use it are the floppy controller and ISA sound cards.

You can get by with 512 bytes per drive for the floppy controller, if you're willing to limit yourself to transferring one sector at once. As for the sound card: do you want to support old sound cards?

Note that PCI DMA is unaffected; PCI cards can access at least 4GB of physical memory.

Some people allocate fixed-size buffers in low memory for the floppy driver. I have a separate allocation list for pages below 640KB for the floppy driver, but that's probably overkill.

The problem isn't worth worrying about for long. Just make sure there's some low memory available for the floppy driver and leave it at that.
User avatar
Candy
Member
Member
Posts: 3882
Joined: Tue Oct 17, 2006 11:33 pm
Location: Eindhoven

Re:The first 16MB

Post by Candy »

Since you barely use it at all, would implementing it as an afterthought (like a hack, using some sort of page map to locate SOME page below 16M you want to use, remap that page to a different page, and use that page?) work? Also, since the floppy driver only needs (at max) 36 sectors worth of pages, which fits in 5 pages, why not permanently allocate 5 pages to each floppy drive? That'd waste at most 40k...
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:The first 16MB

Post by Pype.Clicker »

In Clicker, i have a very simple 'bottom-up watermark' allocator for physical frames under 16MB. If an ISA driver needs such pages, it could reclaim them there. If nothing required ISA-capable memory and more 'core' memory is needed, then a module could allocate some ISA-capable frames and then feed the 'pages pool' with it...

It could be wise to tell the 'ISA memory thief' (the module that steals ISA-capable memory to downgrade it as 'normal' memory) that at least 1MB should remain for ISA not-yet-loaded drivers, or something alike, so that a reset wouldn't be necessary if some new ISA driver get installed while the system is running...

just my 0.02? ...
Post Reply