LinuxQuestions.org
Help answer threads with 0 replies.
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 06-06-2011, 04:57 AM   #1
andparker
LQ Newbie
 
Registered: Jun 2011
Posts: 3

Rep: Reputation: Disabled
Change memory protection


Hello,
How can I change the memory protection inside a driver?

I want to execute 32-bits code inside a rom in the ISA space. I can read this area, but when I try to do a call to the rom code I receive always and exception.

I find some docs over internet, but always refere to remap an user area. I want to execute this code from the driver.

Any idea?
Andrew
 
Old 06-06-2011, 03:15 PM   #2
nini09
Senior Member
 
Registered: Apr 2009
Posts: 1,737

Rep: Reputation: 154Reputation: 154
Most code can't execute in ROM space. You have to copy to RAM space.
 
Old 06-07-2011, 03:33 AM   #3
andparker
LQ Newbie
 
Registered: Jun 2011
Posts: 3

Original Poster
Rep: Reputation: Disabled
Hello nini09,

Really the code is already copied in an area of ram.

I can execute this code from userspace, but not from the driver.
In userspace, I do a mmap with the PROT_EXEC flag and I can call the rom code without problems.

But under kernelspace, inside the driver, I don’t know how to change the memory protetcion.
Surely is with ‘remap_pfn_range’ or similar, but I don’t know how to obtain or build the VMA strcut.

Thanks,
Andrew

Last edited by andparker; 06-07-2011 at 03:35 AM.
 
Old 06-07-2011, 03:46 PM   #4
nini09
Senior Member
 
Registered: Apr 2009
Posts: 1,737

Rep: Reputation: 154Reputation: 154
You can read insmod code and maybe you can get some idea.
 
Old 06-08-2011, 12:18 PM   #5
andparker
LQ Newbie
 
Registered: Jun 2011
Posts: 3

Original Poster
Rep: Reputation: Disabled
No very useful for me, but thanks.
Really I can't understand how is as easy to do under userspace and dificult under the kernelspace!
 
  


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
Memory Protection jaypas Linux - Newbie 3 07-08-2010 12:40 PM
[SOLVED] General protection fault when writing to video memory in protected mode smeezekitty Programming 6 11-01-2009 02:53 AM
KDE: memory protection applet/widget? amoebios Linux - General 3 06-10-2009 01:41 AM
linux bad memory protection erikwebb Linux - Software 8 10-10-2004 01:37 AM
Unable to Change File/Directory Protection. rvijay Linux - Newbie 2 09-15-2003 09:23 AM

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

All times are GMT -5. The time now is 01:45 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