Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

why 32 bit drivers do not work on 64 bit

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?

like image 870
wal Avatar asked Jun 10 '11 14:06

wal


1 Answers

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...

like image 66
Roddy Avatar answered Oct 07 '22 23:10

Roddy