Windows System Software -- Consulting, Training, Development -- Unique Expertise, Guaranteed Results

Before Posting...
Please check out the Community Guidelines in the Announcements and Administration Category.

Right way to access memory mapped register

LiddellLiddell Member Posts: 2

Hello, everyone. I'm new to developing device driver, but I got into trouble shortly after I started.
I'm making Intel High Definition Audio Controller driver, and I checked in the specification
that the access on the memory mapped register would be necessary.
I found their addresses using devmgmt.msc and RW - Read & Write Utility,
they're started at 0xF7FF8000.
When I wrote DriverEntry, I directly accessed that base address(e.g. (unsigned char*)0xf7ff8000)
and used index and offset to access specific register, but when I started driver, BSOD occured
at the point I read a value from one of them register(It was CorbSize register on offset 0x4e)
BSOD stop code was 0x00000050, "PAGE_FAULT_IN_NONPAGED_AREA".
kd showed me that f7ff8000 is freed(or corrupted) pool and
there's Bad allocation size @f7ff8000, too large
Are those error codes mean that address 0xF7FF8000 is unavailable data space?
But I checked the contents on 0xF7FF8000 using RW - Read & Write Utility,
and there were constantly changing values on that space,
even though db 0xf7ff8000 command on kd
show me only ??-filled memory space... I really wonder what the problem is,
and what the right way to access their memory mapped registers is.
Sorry for my bad english skill :'(
Thanks!

Comments

  • Peter_Viscarola_(OSR)Peter_Viscarola_(OSR) Administrator Posts: 6,794

    You can only access the Registers that are passed-in to your EvtDevicePrepareHardware callback via the CM Resource List. And THEN, you have to access them using READ_REGISTER_UCHAR/USHORT/UNLONG/ULONGLONG.

    Does that help at all?

    Peter

    Peter Viscarola
    OSR
    @OSRDrivers

  • LiddellLiddell Member Posts: 2

    Thanks! I'm digging the KMDF documents now.

  • Tim_RobertsTim_Roberts Member - All Emails Posts: 12,665
    Liddell wrote:
    > Hello, everyone. I'm new to developing device driver, but I got into trouble shortly after I started.

    I'd say.


    > I'm making Intel High Definition Audio Controller driver,

    Why?  There are drivers in the box for all HDAUDIO-compliant devices. 
    They've had hundreds of man hours of development.  You will not be able
    to do any better.


    > I found their addresses using devmgmt.msc and RW - Read & Write Utility, they're started at 0xF7FF8000.
    > When I wrote DriverEntry, I directly accessed that base address(e.g. (unsigned char*)0xf7ff8000)
    > and used index and offset to access specific register, but when I started driver, BSOD occured
    > at the point I read a value from one of them register

    Of course it did.  0xF7FF8000 is a physical address.  If you do not yet
    understand the difference between physical and virtual addresses, then
    you are NOT ready to be writing device drivers.

    Your hardware already has a driver installed.  That driver already owns
    the register space.  You cannot go trample on registers that you do not
    own.  The real drivers for this device were installed correctly, using
    plug-and-play.  When the system matched up the device to the driver, it
    passed the devices resources (memory, interrupts, ports) to the driver. 
    That's the proper way to get access to registers.

    Note: The email was trying to reply to an invalid Discussion (290752).

    Tim Roberts, [email protected]
    Providenza & Boekelheide, Inc.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!