READ_REGISTER_USHORT,_ULONG returns wrong value

Hi all,

KernelBuffData->U.Data_16=READ_REGISTER_USHORT((PUSHORT)skelDev->FrameBase[5]

  • KERNEL_REGISTER_OFFSET);
    This give me some wrong value instead of expected value

similarly for

KernelBuffData->U.Data_32=READ_REGISTER_ULONG((PULONG)skelDev->FrameBase[0]

  • KERNEL_REGISTER_OFFSET);

also returns some wrong results…

I had checked with the Virtual Base Address( FrameBase[0] ) …and it is
the exact base address of the device and also I checked the
KERNEL_REGISTER_OFFSET which is also correct…

But,

KernelBuffData->U.Data_8=READ_REGISTER_UCHAR((PUCHAR)skelDev->FrameBase[3]

  • KERNEL_REGISTER_OFFSET);

this 8 bit read function alone returns correct result…

am I going wrong somewhere in the first 2 cases…

pls guide…

thanx in advance…

shiv

Hi,

If u have SoftIce, Try debug READ_REGISTER_USHORT and READ_REGISTER_ULONG by
putting breakpoint they are small functions and u can try to analyse whwre
exactly problem is comming.

Hope this will give some idea

Regards,
Satish K.S

----- Original Message -----
From: “Shiva Prasad. T. S.”
To: “NT Developers Interest List”
Sent: Tuesday, April 09, 2002 12:41 PM
Subject: [ntdev] READ_REGISTER_USHORT,_ULONG returns wrong value

> Hi all,
>
>
KernelBuffData->U.Data_16=READ_REGISTER_USHORT((PUSHORT)skelDev->FrameBase[5
]
> + KERNEL_REGISTER_OFFSET);
> This give me some wrong value instead of expected value
>
> similarly for
>
>
KernelBuffData->U.Data_32=READ_REGISTER_ULONG((PULONG)skelDev->FrameBase[0]
> + KERNEL_REGISTER_OFFSET);
>
> also returns some wrong results…
>
> I had checked with the Virtual Base Address( FrameBase[0] ) …and it is
> the exact base address of the device and also I checked the
> KERNEL_REGISTER_OFFSET which is also correct…
>
>
>
> But,
>
> KernelBuffData->U.Data_8=READ_REGISTER_UCHAR((PUCHAR)skelDev->FrameBase[3]
> + KERNEL_REGISTER_OFFSET);
>
> this 8 bit read function alone returns correct result…
>
> am I going wrong somewhere in the first 2 cases…
>
> pls guide…
>
> thanx in advance…
>
> shiv
>
> —
> You are currently subscribed to ntdev as: xxxxx@aalayance.com
> To unsubscribe send a blank email to %%email.unsub%%

Hi Satish,

Thanks for your suggestion…I am using kernel debugger DebugView and I use
KdPrint to get the Virtual Base address…and the offsets…

I could see that, they are perfect…

I use a dummy value instead of the READ_REGISTER_USHORT which I get it in
the user mode too…

The exact problem is READ_REGISTER_USHORT, AND READ_REGISTER_ULONG are
returning some junks…

READ_REGISTER_UCHAR is working perfectly…

I doubt the problem to be with the PARAMETERS TO the function
READ_REGISTER_USHORT…

Can u just see the function and if u could find any problem, pls let me
know…

thanx,

shiv

I think that your problem is that you are adding the same constant
KERNEL_REGISTER_OFFSET to different pointer types.
Adding it to PUCHAR means to add exactly KERNEL_REGISTER_OFFSET,
because sizeof(UCHAR) is exactly one.
But adding it to PUSHORT means adding sizeof(USHORT)*KERNEL_REGISTER_OFFSET
and similarly for PULONG.
You are reading from completely different addresses.

Correct your code by this:
(PXXXX)((PUCHAR)skelDev->FrameBase[a] + KERNEL_REGISTER_OFFSET),
where PXXXX can be PUCHAR as well as PUSHORT or PULONG with the
code remaining valid.

Paul

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Shiva Prasad. T. S.
Sent: Tuesday, April 09, 2002 9:12 AM
To: NT Developers Interest List
Subject: [ntdev] READ_REGISTER_USHORT,_ULONG returns wrong value

Hi all,

KernelBuffData->U.Data_16=READ_REGISTER_USHORT((PUSHORT)skelDev->FrameBase[5
]

  • KERNEL_REGISTER_OFFSET);
    This give me some wrong value instead of expected value

similarly for

KernelBuffData->U.Data_32=READ_REGISTER_ULONG((PULONG)skelDev->FrameBase[0]

  • KERNEL_REGISTER_OFFSET);

also returns some wrong results…

I had checked with the Virtual Base Address( FrameBase[0] ) …and it is
the exact base address of the device and also I checked the
KERNEL_REGISTER_OFFSET which is also correct…

But,

KernelBuffData->U.Data_8=READ_REGISTER_UCHAR((PUCHAR)skelDev->FrameBase[3]

  • KERNEL_REGISTER_OFFSET);

this 8 bit read function alone returns correct result…

am I going wrong somewhere in the first 2 cases…

pls guide…

thanx in advance…

shiv


You are currently subscribed to ntdev as: xxxxx@compelson.com
To unsubscribe send a blank email to %%email.unsub%%

hi Paul,

U r right…I corrected and it’s working fine now…

thanx…

shiv