OSDev.org

The Place to Start for Operating System Developers
It is currently Tue Apr 23, 2024 11:29 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Memory detection. Something wrong?
PostPosted: Wed Dec 14, 2016 4:19 pm 
Offline

Joined: Wed Sep 28, 2016 1:45 pm
Posts: 17
Hello.

I read http://wiki.osdev.org/Memory_Map_(x86)#Overview where you can see that from 0x00000000 to 0x000003FF we have IVT.

But I have written a memory detection code (INT 15h, EAX=e820) that I execute in the Bochs VM and I get these entries:

Code:
Base Address                Length                    Type
------------------------------------------------------------
0x0000000000000000          0x000000000009f000         1
0x000000000009f000          0x0000000000001000         2
0x00000000000e8000          0x0000000000018000         2
0x0000000000100000          0x0000000001ef0000         1
0x0000000001ff0000          0x0000000000010000         3
0x00000000fffc0000          0x0000000000040000         2


How is it possible? I mean, I have free memory from 0x0 to 0x9f000 but there we have the IVT, isn't it?

Thank you.


Top
 Profile  
 
 Post subject: Re: Memory detection. Something wrong?
PostPosted: Wed Dec 14, 2016 4:30 pm 
Offline
Member
Member

Joined: Tue Nov 08, 2011 11:35 am
Posts: 453
IVT (interrupt vector table - table with addresses of interrupt handlers in real mode) is only needed when you want interrupts in so-called real mode. When you leave this legacy mode, you can use this memory area for any general purpose. There are some exceptions (when you are going to use BIOS calls instead of some native drivers or when SMM handler is badly written and corrupts low memory) but most of the time this is just usual a memory region with nothing special about it.


Top
 Profile  
 
 Post subject: Re: Memory detection. Something wrong?
PostPosted: Wed Dec 14, 2016 4:38 pm 
Offline
Member
Member
User avatar

Joined: Mon Apr 18, 2016 9:50 am
Posts: 138
Location: New York New York
The IVT isn't the only thing there. Everything below the first 1MB of physical address space, particularly the first 64K, is encumbered with legacy memory areas that the BIOS memory detection call assumes you know about due to the fact that every PC since the IBM 5150 has had the same memory scheme in the area from 0x0000 to 0xFFFF, which includes the BIOS ROM, peripheral option ROMs, legacy video memory, BIOS shadow memory and working memory, and a million other things.

Long story short: That table that you linked to (http://wiki.osdev.org/Memory_Map_(x86)#Overview) is always existent in every PC and non-negotiable. The BIOS memory detection interrupt is just there to tell you how all of the *other* memory is organized, because there's no standard for that like there is for the low memory area.

_________________
The OS is P5. Don't expect it to build.


Top
 Profile  
 
 Post subject: Re: Memory detection. Something wrong?
PostPosted: Wed Dec 14, 2016 4:42 pm 
Offline

Joined: Wed Sep 28, 2016 1:45 pm
Posts: 17
Nable wrote:
IVT (interrupt vector table - table with addresses of interrupt handlers in real mode) is only needed when you want interrupts in so-called real mode. When you leave this legacy mode, you can use this memory area for any general purpose. There are some exceptions (when you are going to use BIOS calls instead of some native drivers or when SMM handler is badly written and corrupts low memory) but most of the time this is just usual a memory region with nothing special about it.


jojo wrote:
The IVT isn't the only thing there. Everything below the first 1MB of physical address space, particularly the first 64K, is encumbered with legacy memory areas that the BIOS memory detection call assumes you know about due to the fact that every PC since the IBM 5150 has had the same memory scheme in the area from 0x0000 to 0xFFFF, which includes the BIOS ROM, peripheral option ROMs, legacy video memory, BIOS shadow memory and working memory, and a million other things.

Long story short: That table that you linked to (http://wiki.osdev.org/Memory_Map_(x86)#Overview) is always existent in every PC and non-negotiable. The BIOS memory detection interrupt is just there to tell you how all of the *other* memory is organized, because there's no standard for that like there is for the low memory area.


Ok. My doubt is solved because I was thinking I had done something wrong with memory detection :oops: . Thanks for comment.


Top
 Profile  
 
 Post subject: Re: Memory detection. Something wrong?
PostPosted: Thu Dec 15, 2016 9:52 am 
Offline
Member
Member
User avatar

Joined: Sun Sep 19, 2010 10:05 pm
Posts: 1074
The IVT memory area is probably not marked in the memory map as reserved because it is perfectly legal, and in most cases necessary for you to write to that area.

All of the other memory map area types are off limits to the OS, in some fashion.

_________________
Project: OZone
Source: GitHub
Current Task: LIB/OBJ file support
"The more they overthink the plumbing, the easier it is to stop up the drain." - Montgomery Scott


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot], Majestic-12 [Bot] and 107 guests


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 post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group