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

Home NTDEV

Before Posting...

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

More Info on Driver Writing and Debugging


The free OSR Learning Library has more than 50 articles on a wide variety of topics about writing and debugging device drivers and Minifilters. From introductory level to advanced. All the articles have been recently reviewed and updated, and are written using the clear and definitive style you've come to expect from OSR over the years.


Check out The OSR Learning Library at: https://www.osr.com/osr-learning-library/


le32_to_cpu() required?

PKPK Member Posts: 16
Hello,
I read data from the SAS controller chip in my Windows7 driver. When I examine the values of the data that is read from the chip on Windbg watch window and compare it with the Linux "dmesg" command output for the same controller card, the values match.
But in the Linux driver code for this controller, when they read the data from the chip, for some values, they use le32_to_cpu before it is saved onto variables in the kernel space.

Both my Windows driver and the Linux driver are meant to be loaded on x86 PCs.
So, in my Win 7 driver, do I have to convert the endianness of the value read from the chip before saving to kernel variables ?

Thanks.

Comments

  • Don_BurnDon_Burn Member - All Emails Posts: 1,760
    Since Windows requires Little Endian you should be fine without the call.


    Don Burn
    Windows Driver Consulting
    Website: http://www.windrvr.com



    -----Original Message-----
    From: [email protected]
    [mailto:[email protected]] On Behalf Of [email protected]
    Sent: Friday, February 09, 2018 6:40 PM
    To: Windows System Software Devs Interest List <[email protected]>
    Subject: [ntdev] le32_to_cpu() required?

    Hello,
    I read data from the SAS controller chip in my Windows7 driver. When I
    examine the values of the data that is read from the chip on Windbg watch
    window and compare it with the Linux "dmesg" command output for the same
    controller card, the values match.
    But in the Linux driver code for this controller, when they read the data
    from the chip, for some values, they use le32_to_cpu before it is saved onto
    variables in the kernel space.

    Both my Windows driver and the Linux driver are meant to be loaded on x86
    PCs.
    So, in my Win 7 driver, do I have to convert the endianness of the value
    read from the chip before saving to kernel variables ?

    Thanks.

    ---
    NTDEV is sponsored by OSR

    Visit the list online at:
    <http://www.osronline.com/showlists.cfm?list=ntdev&gt;

    MONTHLY seminars on crash dump analysis, WDF, Windows internals and software
    drivers!
    Details at <http://www.osr.com/seminars&gt;

    To unsubscribe, visit the List Server section of OSR Online at
    <http://www.osronline.com/page.cfm?name=ListServer&gt;
  • PKPK Member Posts: 16
    Thanks.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. Sign in or register to get started.

Upcoming OSR Seminars
OSR has suspended in-person seminars due to the Covid-19 outbreak. But, don't miss your training! Attend via the internet instead!
Internals & Software Drivers 7 February 2022 Live, Online
Kernel Debugging 21 March 2022 Live, Online
Developing Minifilters 23 May 2022 Live, Online
Writing WDF Drivers 12 September 2022 Live, Online