Why aren't there universal 32->64 bit driver translator/emulators?
August 23, 2008 3:37 PM Subscribe
Why aren't there universal 32->64 bit driver translator/emulators?
64 bit versions of Windows require 64 bit drivers for printers, scanners and other devices. Many people upgrading to a 64 bit computer have had to retire perfectly good hardware simply because of lack of 64 bit drivers.
One way around this is to set up a 32 bit guest OS in a virtual machine and then run your devices from the guest OS, i.e. you can install your printer on a VMWare (or other type) virtual machine with XP or Vista 32 bit (or perhaps a Linux distro) and transfer your files to the guest OS when you want to print them.
Clearly the virtual machine is able to pass on commands to the device either via the host OS, or bypassing it altogether. This seems to me to be a proof of concept for a universal driver translator.
My question is, would a 64 bit emulator program doing essentially the same job as the 32 bit virtual machine be possible? Basically it would be a virtual machine with a stripped down OS that does nothing more than run 32 bit drivers on a 64 bit host.
If it is possible, how come such a program hasn't been written yet?
I'd willingly pay $100 for such software instead of updating my hardware, because running a full blown 32 bit guest OS purely to scan or print things is a bit of a hassle. I'm sure thousands of people would, and the existence of such software would remove one of the major objections people have to getting a 64 bit OS.
posted by Mokusatsu to computers & internet (9 answers total)
The issue at hand is not whether or not you can run 64-bit code. It's that the operating system needs to link the driver into the kernel. This means, that after linking the two objects, the computer sees the whole thing as essentially a single program. So, in a homogeneous world, you have a 32-bit kernel and you link in a 32-bit driver, or you have a 64-bit kernel and you link in a 64-bit driver.
That "bitness" refers to how many bits the computer uses to store a number. That is the largest number than can be handled in a single computational cycle natively by the processor. So, if we link 64-bit code to 32-bit code, the processor doesn't know what mode to run in. It doesn't know if the biggest number is 32-bits or 64-bits.
Now, why can't we convert them? Put a little translation layer in that converts between 64-bit and 32-bit representations of the numbers. After all, is the printer driver really using numbers so big that it can't fit them in 32 bits?
The answer is that the numbers aren't just values. They're also pointers. A pointer is a memory address that the program uses to remember where it put a thing. Many of the pointers, as well as the overall layout in memory of code, are determined by the compiler and then simply rearranged and repositioned appropriately when the operating system dynamically links your program together at runtime.
These pointers are absolutely incompatible, and cannot be translated as I suggested above. If you'll take a metaphor of house numbers for street addressing: 32-bit code says, essentially, that all house numbers have no more than 4 digits: 1502, 1201, 94, 7, 9932 are all valid addresses; 31100 is not. 64-bit code says that house numbers are no more than 8 digits: 44329284 is valid, but 44449291900 isn't. The problem comes when the compiler assigns pointers all sorts of nifty stuff (like the checkIfPrinterIsThere() function). If the compiler is 32-bit, it'll make sure to use nothing but 4-digit numbers; the 64-bit compiler is going to do whatever the hell it pleases, up to 8-digit addresses. If my house is a 44933392 Fleet Street, then a 32-bit taxi driver is going to have no fucking clue how to get me there: we can't fit that large a number in four digits, no matter how we try, but nevertheless that's where I live. I have to find a 64-bit taxi driver.
So, while an operating system is frequently capable of running either 32- or 64-bit programs (linux, OS X, and others), they only manage this by having two complete sets of system libraries: one compiled 32, and one compiled 64. Since you can't run a 32-bit kernel at the same time as a 64-bit one, we can't do the same thing with drivers.
posted by Netzapper at 4:24 PM on August 23, 2008 [8 favorites]