Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Being the ouput of cat proc/ioports:

0000-001f : dma1
0020-0021 : pic1
0040-0043 : timer0
0050-0053 : timer1
0060-0060 : keyboard
0064-0064 : keyboard
0070-0071 : rtc0
0080-008f : dma page reg
00a0-00a1 : pic2
00c0-00df : dma2
00f0-00ff : fpu
0170-0177 : 0000:00:0f.1
  0170-0177 : pata_via
01f0-01f7 : 0000:00:0f.1
  01f0-01f7 : pata_via
0290-0297 : pnp 00:07
02f8-02ff : serial
0376-0376 : 0000:00:0f.1
  0376-0376 : pata_via
0378-037a : parport0
037b-037f : parport0
03e0-03e7 : pnp 00:08
03f2-03f2 : floppy
03f4-03f5 : floppy
03f6-03f6 : 0000:00:0f.1
  03f6-03f6 : pata_via
03f7-03f7 : floppy
0400-041f : pnp 00:08
  0400-0407 : vt596_smbus
04d0-04d1 : pnp 00:08
0778-077a : parport0
0800-087f : pnp 00:08
  0800-0803 : ACPI PM1a_EVT_BLK
  0804-0805 : ACPI PM1a_CNT_BLK
  0808-080b : ACPI PM_TMR
  0810-0815 : ACPI CPU throttle
  0820-0823 : ACPI GPE0_BLK
0cf8-0cff : PCI conf1
d000-d0ff : 0000:00:11.5
  d000-d0ff : VIA8237
d400-d41f : 0000:00:10.3
  d400-d41f : uhci_hcd
d480-d49f : 0000:00:10.2
  d480-d49f : uhci_hcd
d800-d81f : 0000:00:10.1
  d800-d81f : uhci_hcd
d880-d89f : 0000:00:10.0

and the output of cat /proc/iomem:

00000000-0000ffff : reserved
00010000-0009fbff : System RAM
0009fc00-0009ffff : reserved
000a0000-000bffff : Video RAM area
000c0000-000cf7ff : Video ROM
000e0000-000fffff : reserved
  000f0000-000fffff : System ROM
00100000-bffbffff : System RAM
  01000000-01538f03 : Kernel code
  01538f04-017c217f : Kernel data
  01877000-0194dfff : Kernel bss
bffc0000-bffcdfff : ACPI Tables
bffce000-bffeffff : ACPI Non-volatile Storage
bfff0000-bfffffff : reserved
cff00000-dfefffff : PCI Bus 0000:01
  d0000000-d7ffffff : 0000:01:00.0
e0000000-efffffff : PCI MMCONFIG 0000 [bus 00-ff]
  e0000000-efffffff : pnp 00:0d
f0000000-f7ffffff : 0000:00:00.0
fca00000-feafffff : PCI Bus 0000:01
  fd000000-fdffffff : 0000:01:00.0
  feae0000-feafffff : 0000:01:00.0
febc0000-febdffff : 0000:00:0d.0
  febc0000-febdffff : e1000
febf0000-febf7fff : 0000:00:0a.0
  febf0000-febf7fff : 0000:00:0a.0
febfbc00-febfbcff : 0000:00:10.4
  febfbc00-febfbcff : ehci_hcd
fec00000-fec00fff : reserved
  fec00000-fec003ff : IOAPIC 0
fecc0000-fecc03ff : IOAPIC 1
fee00000-fee00fff : Local APIC
  fee00000-fee00fff : pnp 00:09
ff7c0000-ffffffff : reserved
  fff80000-ffffffff : pnp 00:0e

I don't understand which memory addresses are being referred to here. Is it virtual memory? Would it be possible to access these memory addresses from a user program to for example write into the serial port? Maybe using assembler?

share|improve this question
    
The addresses in /proc/ioports aren't memory addresses at all, they're port addresses. –  David Schwartz Sep 27 '12 at 19:04
2  
ioports are addresses that map to device registers. iomem are addresses that map to physical memories and device registers. X86 uses both ports and mem addresses to perform I/O. Some processor architectures (e.g. ARM) use only memory mapped I/O. –  sawdust Sep 27 '12 at 19:44

3 Answers 3

up vote 4 down vote accepted

which memory addresses are being referred to here. Is it virtual memory?

Part of the design of the first IBM PC was to use some memory addresses for things other than actual memory (of the sort used by programs and data)

In the first IBM PC, you could have up to 640 KB of RAM but the chips could address up to 1024 MB of memory, however writing to memory addresses higher than 640 (and less than 1024) would actually be used to communicate not with RAM but with devices such as plug-in graphics adapters.

This concept is sometimes referred to as memory-mapped IO or memory mapped hardware devices.

PC memory map

IO ports are another type of addressable resource in the IBM PC architecture. In the early days you would physically configure such addresses on plug-in (ISA) cards by using "jumpers" to connect addressing pins on the board. You might also configure software to use matching IO addresses.

An old ISA pararllel-port card

The white lettering on the left of the card describes which jumper positions give which IO Port addresses etc.

Nowadays, addressing details are negotiated and assigned dynamically by the cards and the host computer as the system starts up. We no longer have to configure them.

Would it be possible to access these memory addresses from a user program to for example write into the serial port? Maybe using assembler?

I believe so, assuming you are using an operating system that permits it (e.g. PC-DOS?).

share|improve this answer
    
"Hence the concept of memory-mapped hardware devices" - You seem to be crediting the IBM PC with the concept of memory-mapped HW. IIRC the DEC PDP-8 minicomputer circa 1960s had memory-mapped I/O. –  sawdust Sep 27 '12 at 19:25
    
@sawdust: I didn't intend that interpretation, I'll rewrite to clarify. –  RedGrittyBrick Sep 27 '12 at 19:27

It's physical, but some of them linearly mapped to virtual memory.

share|improve this answer
    
@david Of course. mapping into physical memory does not make much sense :-) –  artistoex Sep 27 '12 at 19:12

/proc/ioports lists ranges of I/O port addresses.

/proc/iomem lists ranges of physical memory addresses.

You can access physical memory addresses directly from a user program by mapping /dev/mem, but you probably don't want to. You can access I/O ports directly from a user program with ioperm, but you probably don't want to. Generally, you really want to be in kernel mode to do these kinds of things because you need to do things like disable interrupts.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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