LinuxQuestions.org
Review your favorite Linux distribution.
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 07-20-2010, 09:18 PM   #1
nakul.k1
LQ Newbie
 
Registered: Jul 2010
Posts: 25

Rep: Reputation: 0
Questions on linux kernel


Hi all

i have few question relating to linux kernel memory here are the questions

1) Can Kernel space access user space memory yes or no ?
if no what happens when kernel space tries to access user space memory

2) Can Device memory(character device/chipset on the hardware board) be
mapped to user space ?

Cheers
NRK
 
Old 07-21-2010, 02:11 PM   #2
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Hi -

Quote:
1) Can Kernel space access user space memory yes or no ?

A: Yes
Quote:
2) Can Device memory(character device/chipset on the hardware board) be
mapped to user space?

A: Yes
See "mmap()"
Here are a couple of good links:
http://tldp.org/LDP/tlk/mm/memory.html

http://people.ee.ethz.ch/~arkeller/l...ace_howto.html

I understand that Robert Love has come out with a new edition of his (Most Excellent!) book on Linux kernel internals, which you might be interested in:

http://www.amazon.com/Linux-Kernel-D...dp/0672329468/

'Hope that helps .. PSM

Last edited by paulsm4; 07-21-2010 at 02:16 PM.
 
1 members found this post helpful.
Old 07-22-2010, 11:32 AM   #3
nakul.k1
LQ Newbie
 
Registered: Jul 2010
Posts: 25

Original Poster
Rep: Reputation: 0
Thank you paul

1) I wanted to know can kernel space access user space pointer yes or no ?
if no then what happen when kernel tries to access user space pointer.

2) so you say in kernel if i need some memory from user space
then this function kmalloc(1024,GFP_USER); would work fine yes or no ?
 
Old 08-09-2010, 08:30 AM   #4
TheIndependentAquarius
Senior Member
 
Registered: Dec 2008
Posts: 4,680
Blog Entries: 29

Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
Quote:
Originally Posted by nakul.k1 View Post
2) so you say in kernel if i need some memory from user space
then this function kmalloc(1024,GFP_USER); would work fine yes or no ?
Read the following manual carefully.
Kmalloc allocates only in kernel-space.
http://www.fiveanddime.net/man-pages/kmalloc.9.html

Moreover I didn't understand why would anyone want to allocate user space memory from kernel space ? In what kind of cases is this required ?

Last edited by TheIndependentAquarius; 08-09-2010 at 11:37 AM. Reason: typo
 
1 members found this post helpful.
Old 08-09-2010, 10:25 AM   #5
nakul.k1
LQ Newbie
 
Registered: Jul 2010
Posts: 25

Original Poster
Rep: Reputation: 0
Thanks anisha

it was of great help from your end
that link you sent me clearly explains the Allocating and freeing dynamic kernel memory.


Nakul
 
1 members found this post helpful.
Old 08-09-2010, 11:39 AM   #6
TheIndependentAquarius
Senior Member
 
Registered: Dec 2008
Posts: 4,680
Blog Entries: 29

Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
You are most welcome
 
  


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
Linux kernel memory questions / limitations kd2000 Linux - Kernel 5 05-18-2010 03:44 AM
Questions on how to compile a Linux Kernel mbwallace Linux - Newbie 5 02-04-2010 11:56 AM
Linux Kernel / Linux Internals Questions GeorgeOfTheBush Linux - Kernel 1 12-02-2009 08:05 AM
Linux kernel patches questions VertX Linux - Software 4 06-12-2005 03:28 PM

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

All times are GMT -5. The time now is 06:05 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration