A memory question

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
User avatar
Karlosoft
Member
Member
Posts: 277
Joined: Thu Feb 14, 2008 10:46 am
Location: Italy
Contact:

A memory question

Post by Karlosoft »

Hi. In unreal mode when the a20 line is enabled we can access a bit less than a 2^16 bytes from the 2nd mb. Is it possible to access in this way to the memory beyond 2^32 using a different segment for every location. For example

0x100000000 = 1:0xfffffff0
0x100000001 = 1:0xfffffff1

and so on?
User avatar
bluemoon
Member
Member
Posts: 1761
Joined: Wed Dec 01, 2010 3:41 am
Location: Hong Kong

Re: A memory question

Post by bluemoon »

A20 line is hardwired pin (to some extend) for addressing bus, it works on physical address has nothing to do with address mode.
Is it possible to access in this way to the memory beyond 2^32 using a different segment for every location
From Intel manual 3A:
3.3 PHYSICAL ADDRESS SPACE
In protected mode, the IA-32 architecture provides a normal physical address space of 4 GBytes (232 bytes). This is the address space that the processor can address on its address bus. This address space is flat (unsegmented), with addresses ranging continuously from 0 to FFFFFFFFH. This physical address space can be mapped to read-write memory, read-only memory, and memory mapped I/O. The memory mapping facilities described in this chapter can be used to divide this physical memory up into segments and/or pages.
So, for IA-32(without PAE) if the address translate to more than 4G, the high bits is either ignored and wrap around, (ie. overflow) or #GP, I have not tested it though.
Btw, the idea of seg.base + offset > 4G won't work on paging too.
Since unreal mode employ features from protected mode, I suppose it has same limitation.

The proper way is to access more than 4G would be using PAE to access up to 64GB, or switch to long mode.
User avatar
Owen
Member
Member
Posts: 1700
Joined: Fri Jun 13, 2008 3:21 pm
Location: Cambridge, United Kingdom
Contact:

Re: A memory question

Post by Owen »

No. It is explicitly defined that for Real, Protected and Long-Compatibility modes the address calculation is Linear = (Segment.Base + Virtual) & 0xFFFFFFFF. That is, it is not possible to address more virtual memory without being in Long-64 mode. Because in (un)real mode there is no paging, and because without paging Virtual addresses are mapped 1:1 to physical addresses, you cannot address more memory.
User avatar
Karlosoft
Member
Member
Posts: 277
Joined: Thu Feb 14, 2008 10:46 am
Location: Italy
Contact:

Re: A memory question

Post by Karlosoft »

Ok :) Thank you for the answers ;)
Post Reply