OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 5:33 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: Magic problems in the memory manager.
PostPosted: Tue Apr 28, 2020 12:05 pm 
Offline
Member
Member
User avatar

Joined: Sun Jul 21, 2019 7:34 am
Posts: 296
Hi.
To display text on the screen, I use Scalable Screen Font, it needs a memory manager.
I wrote code that outputs text, in qemu it works as it should and outputs everything. But when trying to run the kernel in Virtual Box, the library reported errors in my memory Manager. Later, I noticed that in virtual box the test machine has 5120 MB of RAM, so I lowered this number to 1024 and everything worked fine.
I thought I found an error, I thought that when working with more than 4 GB of RAM in the memory Manager there is a problem.
Then I put 4100 MB to test my guess, but everything worked.
Experimentally, I found out that if I put 4132 MB or higher I get a problem. At 4131 MB, everything works well.

I did not apply the source code of the memory Manager because the comments are not written in English(I will translate them later). But if someone wants to look at them, you can find them all here.

What could be the reason for this problem?
Thanks.


Top
 Profile  
 
 Post subject: Re: Magic problems in the memory manager.
PostPosted: Tue Apr 28, 2020 12:16 pm 
Offline
Member
Member
User avatar

Joined: Sat Mar 31, 2012 3:07 am
Posts: 4591
Location: Chichester, UK
Are you asking why your 32-bit os doesn't work with more than 4GB of RAM?


Top
 Profile  
 
 Post subject: Re: Magic problems in the memory manager.
PostPosted: Tue Apr 28, 2020 12:25 pm 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5100
Your problem is here. You are casting memory_map->addr and memory_map->len to uint32_t, but they do not fit in 32 bits.


Top
 Profile  
 
 Post subject: Re: Magic problems in the memory manager.
PostPosted: Tue Apr 28, 2020 12:32 pm 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5100
iansjack wrote:
Are you asking why your 32-bit os doesn't work with more than 4GB of RAM?

With PAE, a 32-bit OS may access the entire physical address space (up to 52 bits on current processors).

Of course, if you're using anywhere near that many physical address bits, you'd probably be better off in long mode.


Top
 Profile  
 
 Post subject: Re: Magic problems in the memory manager.
PostPosted: Tue Apr 28, 2020 1:48 pm 
Offline
Member
Member
User avatar

Joined: Sun Jul 21, 2019 7:34 am
Posts: 296
Octocontrabass wrote:
Your problem is here. You are casting memory_map->addr and memory_map->len to uint32_t, but they do not fit in 32 bits.


Thanks for the help. I was surprised why when installing for example 4131 MB everything works, and if a little more, everything breaks. Now I understand.

Love you.


Top
 Profile  
 
 Post subject: Re: Magic problems in the memory manager.
PostPosted: Tue Apr 28, 2020 2:09 pm 
Offline
Member
Member
User avatar

Joined: Sat Mar 31, 2012 3:07 am
Posts: 4591
Location: Chichester, UK
Octocontrabass wrote:
iansjack wrote:
Are you asking why your 32-bit os doesn't work with more than 4GB of RAM?

With PAE, a 32-bit OS may access the entire physical address space (up to 52 bits on current processors).

Well, yes. But that rather supposes that you are using PAE.


Top
 Profile  
 
 Post subject: Re: Magic problems in the memory manager.
PostPosted: Fri May 08, 2020 9:08 am 
Offline
Member
Member

Joined: Sun Apr 21, 2019 7:39 am
Posts: 76
Isn't that supposed to be 4096? I mean 4096 MiBytes (p.c.) = 4194304 KiBytes = 4294967296 (1 over the max value for a uint32_t)

_________________
Hey! I'm developing two operating systems:

NanoShell --- A 32-bit operating system whose GUI takes inspiration from Windows 9x and early UNIX desktop managers.
Boron --- A portable SMP operating system taking inspiration from the design of the Windows NT kernel.


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

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 72 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