Thread: how to access memory

  1. #1
    Registered User
    Join Date
    Jan 2007
    Posts
    3

    how to access memory

    Hello,

    I'm trying to write a simple program to access a specific memory location (0x7FFF00000000). There is a device mapped at that location. Of course, the OS gives seg fault and doesn't let me access the location. Is there a way to work around this problem? Thanks a lot!

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Which OS? Most of them don't like you poking around where you shouldn't be.


    Quzah.
    Hope is the first step on the road to disappointment.

  3. #3
    Registered User
    Join Date
    Jan 2007
    Posts
    3
    solaris 10

  4. #4
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    clicky click Have fun.

    Quzah.
    Hope is the first step on the road to disappointment.

  5. #5
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    > There is a device mapped at that location.
    Then use the device driver to do the work for you.

    There's no way a protected OS like Solaris is going to let a mere user mode program anywhere near the hardware.

    > Is there a way to work around this problem?
    Yes, use the appropriate device driver.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  6. #6
    Registered User
    Join Date
    Jan 2007
    Posts
    3
    But there is a problem with the device driver. I don't know how to tell the driver that the device is actually mapped at a memory location. How do I do that? Any hints? Thanks a lot.

  7. #7
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Oh, I don't know. You could perhaps read the link I pointed you at entitled "device driver tutorial", or maybe the one titled "Writing Device Drivers".


    Quzah.
    Hope is the first step on the road to disappointment.

  8. #8
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    > But there is a problem with the device driver.
    Tell the author.

    > I don't know how to tell the driver that the device is actually mapped at a memory location.
    Read the manual for the driver perhaps?

    At a rough guess, you (with your system admin hat on) update some OS startup script.

    At the point the driver is started, you provide some additional configuration parameter which is the location to look at.

    Moved to tech, as this seems more about Solaris admin rather than C programming.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 10
    Last Post: 09-04-2008, 01:27 PM
  2. Direct memory access?
    By _izua_ in forum Windows Programming
    Replies: 4
    Last Post: 08-01-2008, 02:08 AM
  3. Question regarding Memory Leak
    By clegs in forum C++ Programming
    Replies: 29
    Last Post: 12-07-2007, 01:57 AM
  4. Onboard video card memory access
    By HermioneFan in forum Game Programming
    Replies: 1
    Last Post: 05-28-2003, 09:53 AM
  5. Memory Access Error when using Strcpy()
    By fgs3124 in forum C Programming
    Replies: 2
    Last Post: 03-15-2002, 03:07 PM