real mode

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.
User avatar
Troy Martin
Member
Member
Posts: 1686
Joined: Fri Apr 18, 2008 4:40 pm
Location: Langley, Vancouver, BC, Canada
Contact:

Re: real mode

Post by Troy Martin »

My current memory map is horrible (I'm writing an OS in real mode too):

Code: Select all

1000:0000 +----------------+
          |  Second-stage  |
          |   bootloader   |
2000:0000 +----------------+
          | Kernel and CLI |
2000:8000 +----------------+
          | Program & data |
          +----------------+
I'm planning on going to this:

Code: Select all

1000:0000 +----------------+
          |  Second-stage  |
          |   bootloader   |
2000:0000 +----------------+
          | Kernel and CLI |
3000:0000 +----------------+
          | Program & data |
4000:0000 +----------------+
          | Program & data |
5000:0000 +----------------+
          | Program & data |
6000:0000 +----------------+
          | Program & data |
          +----------------+
There will be four program spots for pausing and resuming programs as well as possibly a simple multitasking system in the future.
Image
Image
Solar wrote:It keeps stunning me how friendly we - as a community - are towards people who start programming "their first OS" who don't even have a solid understanding of pointers, their compiler, or how a OS is structured.
I wish I could add more tex
User avatar
Firestryke31
Member
Member
Posts: 550
Joined: Sat Nov 29, 2008 1:07 pm
Location: Throw a dart at central Texas
Contact:

Re: real mode

Post by Firestryke31 »

Here's my memory map for Socks:

Code: Select all

0000:0000 +----------------+
          |    Untouched   |
0000:1000 +----------------+
          | Command buffer |
0000:2000 +----------------+
          |    Path and    |
          | current folder |
          |     cluster    |
0000:5000 +----------------+
          | Working space  |
0000:8000 +----------------+
          | Kernel and CLI |
1000:0000 +----------------+
          | Program(s)     |
          +----------------+
I'm not entirely sure I'm going to keep this structure though, since there's quite a bit of unused space. It's also going to be dumped as soon as I work on getting Socks to be 32-bit.
Owner of Fawkes Software.
Wierd Al wrote: You think your Commodore 64 is really neato,
What kind of chip you got in there, a Dorito?
User avatar
xyjamepa
Member
Member
Posts: 397
Joined: Fri Sep 29, 2006 8:59 am

Re: real mode

Post by xyjamepa »

Thank you guys ,that gave me alot of :idea:s. :P
About the heep manager,i don't think I'll do it because,I'm planning to keep my code as simple as possible.


stay safe
The man who follows the crowd will usually get no further than the crowd.
The man who walks alone is likely to find himself in places
no one has ever been before.
User avatar
Schol-R-LEA
Member
Member
Posts: 1925
Joined: Fri Oct 27, 2006 9:42 am
Location: Athens, GA, USA

Re: real mode

Post by Schol-R-LEA »

For that matter, STFWiki, as well. There is an overview tutorial on the basic concepts of writing a memory manager, anddiscussions on the general principles, which would at least show the issues involved and have links to more in-depth tutorials.

The basic idea is to keep an ordered list of memory blocks (just how you order it will depend on the allocation scheme), and when memory is needed, look through the list to find an unused space. Segmentation complicates matters, because of overlapping segments, but if you allocate in 16-byte blocks - and/or use absolute addresses for the specific start and end points - it shouldn't be too difficult.

Two questions: first, what sort of memory model are you assuming, and will you allow applications to use a large model (multiple segments for both code and data)? Second, what sort of executable file format do you expect to use (when you get around to writing your loader if you haven't done so already), and do you expect you use any sort of non-static shared code (rather difficult to manage safely in real mode) or anything else that would require load-time address relocation?
User avatar
Dex
Member
Member
Posts: 1444
Joined: Fri Jan 27, 2006 12:00 am
Contact:

Re: real mode

Post by Dex »

Take a look at MikeOS or MiniDos, as example of simple realmode OS.
MikeOS
http://mikeos.berlios.de/
MiniDos
http://board.flatassembler.net/topic.php?t=5275
Post Reply