Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I am working in the kernel. I’m trying to read and write data directly to a page frame. I know the frame is in physical memory at the time I try to read and write. Here is a short example.
char *in, c;
struct page *page;
in = (char *)page_to_phys(page);
c = *in;
As near as I can tell, it crashes whenever I try to read from the page. If I leave out the last line, it does not crash.
When it crashes, I get this error message:
Kernel panic - not syncing: Segfault with no mm
082898dc: [<081f0ef4>] dump_stack+0x1c/0x20
082898f4: [<081f0fb8>] panic+0x4b/0x12d
08289928: [<0805a148>] segv+0x10a/0x234
082899d0: [<0805a2b7>] segv_handler+0x45/0x4f
082899f8: [<08065e14>] sig_handler_common+0x61/0x70
08289a70: [<08065eef>] sig_handler+0x31/0x3e
08289a7c: [<08065bdc>] handle_signal+0x4e/0x7b
08289a9c: [<080675d3>] hard_handler+0xf/0x14
08289aac: [<b7801400>] 0xb7801400
Why are you trying to access using the physical page address? Kernel code uses kernel virtual addresses. Physical addresses are used by devices that don't go through memory management, like PCI bus masters.
Edit: your example would crash anyway, because you haven't allocated page.
Last edited by smallpond; 01-16-2012 at 08:11 AM.
Reason: add note
I am working on a masters thesis project. I'm not an operating systems expert, I am in Information Assurance. Thus the odd request.
At the point in the kernel I am adding my code, the page is allocated and the page is physically in memory. If there is a better way to access it, through it's virtual address, its pte, or some other way, that is what I am looking for. I suspect my example above is using the wrong pointers and is trying to access the wrong area anyway. I know what the target page contains and want to verify that I am pointing correctly by reading the page.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.