LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 03-04-2008, 03:41 PM   #1
chenja
LQ Newbie
 
Registered: Feb 2008
Posts: 12

Rep: Reputation: 0
How to access physical address 0xfff00000


HI all,

I want to read physical address 0xfff00000 on my target board from user-space. I tried using /dev/mem, it only works under "root". /dev/mem can not be opened from myname account. Any idea how to make it work?
Other than using /dev/mem, is there any way to remap this physical address to user-space? Thanks.


#cat /proc/iomem

c0120000-c013ffff : 0000:02:01.0
c0120000-c013ffff : e100
c0140000-c0140fff : 0000:02:02.0
c0140000-c0140fff : e100
c0160000-c017ffff : 0000:02:02.0
c0160000-c017ffff : e100
c0180000-c019ffff : 0000:02:03.0
c0180000-c019ffff : e1000
fff00000-ffffffff : reserved
 
Old 03-04-2008, 05:07 PM   #2
danboland
Member
 
Registered: Feb 2006
Location: NJ, USA
Distribution: Debian
Posts: 72

Rep: Reputation: 17
All the ways i know of require you to be root. Most addresses that the kernal gives users are from a virtual lookup table which maps to the real addresses. There may be a way to do it in assembly or using some gnu specific C api. Generally modern PC OS(es) hide this detail to the user.


Again though the few ways i can think of require root access.

Whats so important about that address?


Dan
 
Old 03-05-2008, 08:47 AM   #3
chenja
LQ Newbie
 
Registered: Feb 2008
Posts: 12

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by danboland View Post
All the ways i know of require you to be root. Most addresses that the kernal gives users are from a virtual lookup table which maps to the real addresses. There may be a way to do it in assembly or using some gnu specific C api. Generally modern PC OS(es) hide this detail to the user.


Again though the few ways i can think of require root access.

Whats so important about that address?


Dan
Hi Dan, Thanks for replying. I have 32 bytes data stored there by factory, it's all about my board information, my user application (non-root) need to read it.
Do you mean there is no way for non-root user to read it directly?

Thanks again.
 
Old 03-06-2008, 11:32 PM   #4
danboland
Member
 
Registered: Feb 2006
Location: NJ, USA
Distribution: Debian
Posts: 72

Rep: Reputation: 17
User applications (even those ran as root) only have access to memory from the kernel through it's virtual memory. I don't know of any way to do it outside of that.
You could always set the sid bit of your application (though it could be a security risk) and then it could access /dev/mem as root even if the application was started by a normal user.

Other then that your going to have to see if there are any kernel functions that can export memory address from virtual to real. I only know of ways to access real address from within the kernel. You can look at this page for some of that info:
http://www.xml.com/ldd/chapter/book/ch13.html
Its possible that some of those functions could be available to user space applications. Another method might be for you to use that page to create a realy simple kernel module that could export the address for you.


Dan
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 find physical address of kernel virtual address kushneeraj Programming 0 10-20-2006 07:29 PM
API for mapping Physical Address to Virtual Address Lakshman_smt Linux - Software 2 10-15-2006 09:08 PM
Memory Mapping (same physical address = virtual address) skd.tech Linux - Kernel 7 07-24-2006 11:13 PM
NIC physical address hennaheto Linux - Networking 2 01-30-2004 08:40 PM
Physical Address yangh66 Linux - Networking 2 06-19-2001 08:01 AM

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

All times are GMT -5. The time now is 07:35 PM.

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