Memory mapped IO: pros/cons?
Memory mapped IO: pros/cons?
What are the pros/cons of using memory-mapped io? I would have thought it would be slower, and would risk writing to random IO addresses if code somewhere fails.
Re: Memory mapped IO: pros/cons?
That's what you would use an MMU for. AFAIK there is no difference in speed at all, btw, it's just a different set of instructions.xlq wrote:I would have thought it would be slower, and would risk writing to random IO addresses if code somewhere fails.
Re: Memory mapped IO: pros/cons?
Hi.
Another pro for memory-mapped I/O is that we can use almost all opcodes for memory operation to operate I/O as well,because in a system programmer's view,the opcodes are uniform.This would be convenient to process I/O in an efficient way.
And...What else?
Exactly,memory-mapping I/O has got both advantages and disadvantages.xlq wrote:What are the pros/cons of using memory-mapped io?
(I think)It would be no slower than isolated I/O because it's implemented on hardware layer.It may take the I/O module little extra time to process the uniformed opcodes(or commands) and schedule the common resource.I would have thought it would be slower,
If the hardware doesn't provide such checks or protection,the error would occur.It's the softwares' responsibility to avoid its happening.and would risk writing to random IO addresses if code somewhere fails.
Another pro for memory-mapped I/O is that we can use almost all opcodes for memory operation to operate I/O as well,because in a system programmer's view,the opcodes are uniform.This would be convenient to process I/O in an efficient way.
And...What else?
The pros of memory mapped IO I can think of are :
1) it may be easier to understand
Maybe this is just me, but here are my thoughts. I started on Amiga / 680x0 where a range of addresses were used for IO. You just used the legacy instructions to move an int but used those special addresses. Simple to use and understand.
When I started to look at the x86, I was quite confused by the "in" and "out" instructions. It's only later I understood the concept of a dedicated IO piece of hardware inside the CPU.
2) it can be directly accessed without any assembly instruction
As shown in this hypothetical C++ example:
1) it may be easier to understand
Maybe this is just me, but here are my thoughts. I started on Amiga / 680x0 where a range of addresses were used for IO. You just used the legacy instructions to move an int but used those special addresses. Simple to use and understand.
When I started to look at the x86, I was quite confused by the "in" and "out" instructions. It's only later I understood the concept of a dedicated IO piece of hardware inside the CPU.
2) it can be directly accessed without any assembly instruction
As shown in this hypothetical C++ example:
Code: Select all
// Read the mouse on my cool YBox 720 platform
int32* pRegMouseXY = (int32*) 0xffff4000;
int32 nMouseX = pRegMouseXY[0];
int32 nMouseY = pRegMouseXY[1];