# I/O address & I/O memory

1)I have this fundamental doubt about I/O address and memory. There is something called 'memory address space' and 'I/O address space'. Suppose there is 32 MB RAM, then the memory )or system) address space is 0...32MB-1. Similarly, the I/O address space also start from 0...something? It looks like the I/O address space starts from 0..ffff. (this is my understanding, correct me if I'm wrong). My question is, whether this I/O address space is part of the RAM address space ie. 0..32MB-1. If this is the case, can anyone tell me where exactly the I/O addresses start in RAM (ie. in the 0..32MB-1 range?). If this is not the case, then how does CPU distinguish between memory address space and I/O address space, given an machine instruction which asks the CPU to load the value from some address?Also, some I/O ports can have a range of memory. What I understand is suppose an I/O ports has an address range of x..x+3, what it means is, it has probably one or more registers inside it with a combined size of 4 bytes. For eg., let's say there are four registers inside an I/O port each of size 1 byte. Then if I address location x, then it means I'm referrring to register 1 inside the I/O port and so on. Is this correct?

2) Then there is something called I/O memory. What does this mean?

I expect clarification on these points.

thanks
--

• : 1)I have this fundamental doubt about I/O address and memory. There is something called 'memory address space' and 'I/O address space'. Suppose there is 32 MB RAM, then the memory )or system) address space is 0...32MB-1. Similarly, the I/O address space also start from 0...something? It looks like the I/O address space starts from 0..ffff. (this is my understanding, correct me if I'm wrong). My question is, whether this I/O address space is part of the RAM address space ie. 0..32MB-1. If this is the case, can anyone tell me where exactly the I/O addresses start in RAM (ie. in the 0..32MB-1 range?). If this is not the case, then how does CPU distinguish between memory address space and I/O address space, given an machine instruction which asks the CPU to load the value from some address?Also, some I/O ports can have a range of memory. What I understand is suppose an I/O ports has an address range of x..x+3, what it means is, it has probably one or more registers inside it with a combined size of 4 bytes. For eg., let's say there are four registers inside an I/O port each of size 1 byte. Then if I address location x, then it means I'm referrring to register 1 inside the I/O port and so on. Is this correct?
:
: 2) Then there is something called I/O memory. What does this mean?
:
: I expect clarification on these points.
:
: thanks
: --
:
Intel-CPUs contain adress-registers for two different adress-spaces. While there are a lot of different adress modes available for the purpose of adressing in memory (done mostly by assembler mov-mnemonics), there is only one adress mode in I/O-space (done by assembler in- or out-mnemonics). I/O-space is initially meant to do do transfers to registers, which are part of controllers (could be memory-devices too). The ISA-bus once was the physical representation of this adress space...
Nowadays PCI allows settings of device-adresses done by program and not manually as needed in stone-age. Now the "I/O-adresses" could be mapped to memory too. There is no restriction for that mapping, done in I/O-space using the register of the PCI-bridge. But BIOS and drivers in OSs need certain adresses - or fail.