flat assembler
Message board for the users of flat assembler.

Index > OS Construction > Detecting memory for later allocation

Author
Thread Post new topic Reply to topic
Aulendil



Joined: 13 Jul 2014
Posts: 14
Aulendil 21 Jul 2014, 21:15
My os currently has a boot loader and small kernel which the boot loader loads into conventional memory in the first MB of RAM. How do I map/find out how much memory my os can play with?

Let's say I wanted to load the next part of the kernel into memory above the first MB; What is the 'usual' method to detect whether that memory exists?
Post 21 Jul 2014, 21:15
View user's profile Send private message Reply with quote
smiddy



Joined: 31 Oct 2004
Posts: 557
smiddy 21 Jul 2014, 22:43
What I use is Interrupt 15h E820h: http://www.uruk.org/orig-grub/mem64mb.html

You can structure your map based on the information within it the most easiest from my experience.
Post 21 Jul 2014, 22:43
View user's profile Send private message Reply with quote
Aulendil



Joined: 13 Jul 2014
Posts: 14
Aulendil 22 Jul 2014, 05:40
Thanks
Post 22 Jul 2014, 05:40
View user's profile Send private message Reply with quote
Aulendil



Joined: 13 Jul 2014
Posts: 14
Aulendil 22 Jul 2014, 12:10
Is there any example FASM code that is a good starting point? I've had a very quick play with that interrupt and it keeps returning 64 from a base address of zero.
Post 22 Jul 2014, 12:10
View user's profile Send private message Reply with quote
smiddy



Joined: 31 Oct 2004
Posts: 557
smiddy 23 Jul 2014, 04:13
Search for E820, there are a lot of hits. Here's one I did:

http://board.flatassembler.net/topic.php?t=6217

Smiddy
Post 23 Jul 2014, 04:13
View user's profile Send private message Reply with quote
cod3b453



Joined: 25 Aug 2004
Posts: 618
cod3b453 26 Jul 2014, 20:37
Something to be aware of is E820 is not complete - some legacy regions (BIOS/VGA), MMIO and other ROM locations are not included. Looking at my code, I have a mix of hard-coded legacy regions [as listed in those links] following by the E820 map and finally the PCI enumeration (some are duplicates of the legacy and E820 but this should take precedence - though I've never encountered a case where these were different).
Post 26 Jul 2014, 20:37
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.