1

I gather that the main ways of the CPU addressing devices are "port" and "memory" mapped.

In both of these:

  • How are devices dynamically assigned an address - who assigns it and how?
  • How does the CPU then know a device exists, has been assigned and what the address is, particularly its running programs? (how does this work both if the computer is on and off)
  • How do interrupts work with these devices?
  • What's the distinction between what the OS and the hardware does?
  • Is it fair to say that Memory Mapped is the dominant approach in modern systems?

Realise this might be a lot in one go but thanks in advance!

1 Answer 1

1

In general, CPU does not know that a specific address is a memory mapped.

it's SW responsibility (BIOS/drivers mainly) to put define the address range as uncacheable (so each read/write will go through to the device and not held internally until WB), out of the core there is some mapping that redirect specific addresses to a device rather than to the DDR (memory).

short answers to part of your bullets (I'm not sure I understand all the questions):

  • How are devices dynamically assigned an address - who assigns it and how?

    Either BIOS define such ranges (the driver communicates on a new device to the BIOS, BIOS save some addresses for plug and play devices)

  • How does the CPU then know a device exists, has been assigned and what the address is, particularly its running programs? (how does this work both if the computer is on and off)

    The CPU doesn't know that, these addresses are treated as normal uncacheable addresses.

  • Is it fair to say that Memory Mapped is the dominant approach in modern systems?

    Yes, it's easier to treat it just another place in memory (it also a bit faster).

2
  • Thanks for answering! So what I was trying to ask with the middle questions is, when the computer is running and I plug in a new device (say, a webcam through a USB port), how is it allocated an address and how is the OS made aware of it's existence. Same question for things that are plugged in when the machine is turned on (e.g. a keyboard) - how is the OS told this exists? In both cases, what does it instruct the CPU to do in order for it to find out the addresses and how does it know what the addresses connect to? Commented Nov 17, 2020 at 22:10
  • 1
    The question on interrupts was following on from this - if the address is dynamically assigned, how does the CPU know what an interrupt has come from? (or is execution just interrupted for 'some address' - but it is told what address to go to to find out what's happened?) Commented Nov 17, 2020 at 22:10

Not the answer you're looking for? Browse other questions tagged or ask your own question.