LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 10-27-2009, 06:33 AM   #1
atif_shabir
LQ Newbie
 
Registered: Oct 2009
Posts: 7

Rep: Reputation: 0
How does the kernel differentiate between ram and i/o addresses?


How does the kernel know that these are addresses on physical ram and these are i/o memory addresses? I want to make some of my physical ram memory addresses to be treated as i/o memory addresses by the kernel. How can I tell the kernel that THIS address belongs to i/o memory not physical ram?

regards,
Atif Shabir
 
Old 10-27-2009, 07:35 AM   #2
zhjim
Senior Member
 
Registered: Oct 2004
Distribution: Debian Squeeze x86_64
Posts: 1,748
Blog Entries: 11

Rep: Reputation: 233Reputation: 233Reputation: 233
Maybe not what you want but at least you don't need to fiddle with the kernel code. Just use a ramdisk. Part of memory gets mapped onto the filesystem tree

http://prefetch.net/blog/index.php/2...sk-with-linux/
 
Old 10-28-2009, 10:34 AM   #3
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
Your question can be interpreted in at least two ways.
If you are talking about the x86 class of processors, then IO space is distinguished from memory space by the processor instruction set and by the hardware buses that control the memory and IO hardware. The kernel accesses IO space using IO instructions, and memory using memory oriented instructions.
If you are talking about kernels in general, and accessing memory-mapped IO, then there is no real distinction between the various address spaces. Hardware, whether memory-mapped IO, or actual system memory will be somehow configured to be addressed at a specific location in the CPU memory space. This can be in the form of hardware jumpers or switches, software configurable addressing ('plug-and-play'), BIOS based configuration, etc.
Typically, when IO is mapped into CPU address spaces, be it either IO space or memory-mapped, a driver is used to access the IO, and the driver is either given some address information at load time, or has default addressing hard-coded.
--- rod.
 
Old 10-28-2009, 11:20 AM   #4
SaintDanBert
Senior Member
 
Registered: Jan 2009
Location: "North Shore" Louisiana USA
Distribution: Mint-20.1 with Cinnamon
Posts: 1,771
Blog Entries: 3

Rep: Reputation: 108Reputation: 108
take a look at /proc and /sys

This does not answer your question directly, but I hope you get useful information.

The beauty of memory mapped I/O lies in the fact that software does not care if it accesses RAM or device. "I/O Port" access was a different story and required special "I/O Instructions." With memory-IO, Software simply does moveByte to addr to accomplish a "write" or "set attribute". It then does a moveByte from addr to accomplish a corresponding "read" or "get attribute." When the hardware decodes the addr the hardware does any magic dance to cause the data to accomplish correct things. This was the case for the PDP-11, VAX, and DEC-10 systems from aeons ago. Software did not care.

Most modern linux implementations have /proc and /sys file systems. Each of these reach into the bowels of things and permit applications and utilities to read and write all sorts of things. They are very similar to a RAM-disk but "on steroids" due to all that they can access. I recommend that you fetch the code for either or both of these file systems to see what happens at the bit level.

Years ago I used a linux distro for the RTOS (real time operating system) in an industrial instrument. We adapted what was /proc back then to implement access to the instrument-specific hardware.

In case this thread is not interested in following the nasty details, the OP may contact me privately. Over the years I've done a lot of successful memory-mapped-IO hacking.

Good luck,
~~~ 0;-Dan

Last edited by SaintDanBert; 10-28-2009 at 12:43 PM. Reason: clarification and correction
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to differentiate two versions of qt wagmare Linux - Newbie 6 03-09-2009 08:22 AM
differentiate text files packets Programming 3 01-30-2008 08:40 PM
how to differentiate virtual desktops? eublade Linux - Desktop 4 08-13-2007 10:05 PM
differentiate poweroff from halt ric Slackware 6 07-25-2006 07:04 PM
how to differentiate processes ugp Programming 5 03-02-2006 11:45 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 11:43 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration