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!
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.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
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 09: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.