I'm on a project that was originally made for the x86_64 platform, with Windows, in C/C++ languages. This project is now being ported to ARM, still on Windows OS.
This project accesses devices, such as keyboard, mouse, sound, and so on, and these devices are accessed through drivers. So we want to port some drivers used in x86_64 to ARM. However, in x86_64 device access is very different than ARM, as we all know:
In x86_64 is through I/O ports mapped in memory, outside the address space.
In ARM through the peripheral controller registers, mapped in a memory space within the address space.
The question is: how do we port the driver from x86_64 to ARM, in the Windows kernel? That is, how do we access devices on ARM, on Windows, such as a simple GPIO, a sound device, a keyboard, etc? Can we access device registers in user mode, on Windows?
Thank you very much, in advance.
(Originally posted in Stack Overflow)
You don't generally "port" drivers, you write them fresh for each hardware. So if you actually need your own drivers (and can't just use external ones to get keyboard/mouse input etc, like most programs do), you'll want to to write them natively. Most of a project can be ported (or emulated!, especially with Arm64EC), the drivers are the bit that you need to just write for the hardware.
Microsoft has instructions for Arm64 driver writing generally, which is probably a good place to start.
Hello , To port drivers from x86_64 to ARM on Windows, device access needs to be adapted to ARM's peripheral controller registers. Accessing these registers can be done in kernel mode, but not in user mode. A driver that accesses these registers needs to be designed and implemented in kernel mode to properly interface the hardware .