ram

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
nooby

ram

Post by nooby »

if i have only 32mb ram can i access addresses ober 32mb ?
Kemp

Re:ram

Post by Kemp »

If you're asking about physical (real) addresses then no, you can't access more memory than you have. If you're talking about what is often referred to as linear memory which is the result of some combination of remapping and/or page swapping then yes, the programs that are using that memory can be told whatever you want as long as you make sure it maps to somewhere within valid physical memory (or you swap the page back into a valid place).
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:ram

Post by Pype.Clicker »

Kemp wrote: If you're asking about physical (real) addresses then no, you can't access more memory than you have.
actually, nothing on the processor will never prevent you from accessing a physical address beyond 32MB in that case ... but that will simply act as a black hole: whatever you write, all you'll read back will be 'floating wire' state (e.g. 0xffff is probable, but not even guaranteed)

Now, some devices might have memory mapped above that (e.g. my VBE card here has its LFB somewhere at 0xfa000000 or something), in which case whatever you read/write there will be interpreted by that device and might not react as 'regular' memory.
Kemp

Re:ram

Post by Kemp »

Ok, true, but I was more referring to the fact that doing anything about real memory is either going to achieve abslutely nothing or potentially mess up a mapped device. Of course if you want to write to the device it's perfectly fine.
User avatar
Solar
Member
Member
Posts: 7635
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re:ram

Post by Solar »

And depending on your architecture and type of RAM, those 32 MB you have are not necessarily accessable at addresses 0x0000 0000 through 0x0200 0000 either. If you have e.g. two banks with 16 MB each, they might be (physically) mapped at two completely seperate address ranges, with memory-mapped devices strewn in between.

That is why people came up with MMU's and virtual addresses. Physical memory layout is usually a real mess. 8)
Every good solution is obvious once you've found it.
Kemp

Re:ram

Post by Kemp »

So I really should have said writing above, below or between real memory will do whatever. Hmmm.... suddenly giving programs linear memory seems more like showing them mercy than providing a nice little convenience.
smiddy

Re:ram

Post by smiddy »

Solar wrote:Physical memory layout is usually a real mess. 8)
It certain could be depending on your perspective. ;) Fortunately there are hardware layers that allow us to avoid the mess and see it as one contiguous mass of RAM.
User avatar
Solar
Member
Member
Posts: 7635
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re:ram

Post by Solar »

And as always in threads like this, let me point out that AmigaOS (up to 3.x at least) does the virtual-to-physical mapping while loading the executable.

Just to show that there is always a different solution to a problem. ;)
Every good solution is obvious once you've found it.
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:ram

Post by Pype.Clicker »

Solar wrote: And as always in threads like this, let me point out that AmigaOS (up to 3.x at least) does the virtual-to-physical mapping while loading the executable.

Just to show that there is always a different solution to a problem. ;)
not so sure i got your point, Solar ... What's so great-and-completely-different about it ?
User avatar
Solar
Member
Member
Posts: 7635
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re:ram

Post by Solar »

You don't have an MMU employed. Memory references are adjusted in the binary. Actually, binaries are subdivided into "hunks", which are liberally scattered across the available memory however they might fit, so you don't require one large continuous piece of memory for the binary to fit in.

Mind, this is of course horribly inferior to a MMU at work. You get memory fragmentation, you can't do memory protection, and virtual memory (i.e., swapping memory to hard drive) becomes a real headache.

It's just that - a novelty, but one that shows that you can have a system that does not offer you a virtual continuous address space, yet still leaves the developer blissfully ignorant of the details.
Every good solution is obvious once you've found it.
Kemp

Re:ram

Post by Kemp »

But what if it splits up an area you use indexed addressing on or somesuch? The base address would be adjusted correctly to be within your memory space but when you start incrementing it you'll wander into someone else's space.
User avatar
Solar
Member
Member
Posts: 7635
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re:ram

Post by Solar »

You use indexed addressing within an array. Arrays aren't split up between hunks.

(The hunks are defined by the compiler. The Amiga "HUNK" format is a binary format, just as ELF or PE. It doesn't mean binaries are randomly picked apart.)

If you're using indexed addressing in memory areas that haven't been defined as continuous data objects... good luck. ;)
Every good solution is obvious once you've found it.
Post Reply