开发者

why 32 bit drivers do not work on 64 bit

开发者 https://www.devze.com 2023-03-12 05:24 出处:网络
From past readings it seems most 32 bit drivers won\'t work on 64 bit. At a purely conceptual level, I see a 64 bit machine as having extra \'room\' when using开发者_开发问答 32 bit drivers so am try

From past readings it seems most 32 bit drivers won't work on 64 bit.

At a purely conceptual level, I see a 64 bit machine as having extra 'room' when using开发者_开发问答 32 bit drivers so am trying to determine why most often they will not work. (me coming from user-space)

I have read this wiki article on x86-64 which states

Pushes and pops on the stack are always in 8-byte strides, and pointers are 8 bytes wide.

I can see this perhaps being a reason a 32bit driver might fail on 64bit as it issues a pop() which pops twice as much data as the driver expected.

What I just mentioned may be completely off the mark as I am a user-space guy, in which case, or otherwise, what are some practical examples (code or layman explanation) of why 32 bit drivers fail when run on 64 bit?


Put simply, you can't store a 64-bit address in a 32-bit pointer. So if your code involves passing pointers back and forth to the operating system, as device drivers typically do, it's not going to end well.

Drivers are often about moving data between phyiscal devices (eg, a disk) and memory. The driver will be asked to transfer X disk sectors into memory at address Y.

On a 64-bit OS, Y will be a 64 bit address, so your 32-bit driver can't handle this. And of course there's the issue that the size of the pointer passed is twice what it expects, so if it DID run it would probably stamp all over the wrong memory...


Remember that drivers are there to talk to hardware. What if the 32bit driver code was loaded into a memory area that's more than 4gigabytes away from where the hardware's memory-mapped registers are? The driver code would be scribbling in memory that has nothing to do with itself or the hardware it's supposed to be driving.


x86-64 processors can't run 32 bit code in privileged (kernel) mode. The compatibility mode is only available for user space.


My 2 cents worth. Microsoft doesn't give a rats about the mess it causes when releasing upgrades or patches.

Especially about Legacy hardware being compatible with x64 generation OS's. I'm talking here about the myriad of scientific hardware out there that only has 32bit drivers with that hardware being unobtainable and unsupported any longer, thus leaving Labs running XP or at best 7 x86. Likewise consumers how have bought Biometric scanners and various medical equipment.

The x64 path should have been designed to accommodate legacy 32bit hardware.

0

精彩评论

暂无评论...
验证码 换一张
取 消