coLinux
Advertisement

Some comments, what we need to do to run coLinux under a 64 bit Windows, for example Windows 7 64 bit, Windows Vista 64 bit, or Windows Server 2008 r2 on.

General

  • The most difference are the size for type int and long
type 32 bit 64 bit(Linux) 64 bit(Win64, MinGW-w64) used in
sizeof(int) 4 bytes 4 bytes 4 bytes
sizeof(long) 4 bytes 8 bytes 4 bytes co_rc_t
sizeof(int*)
sizeof(long*)
sizeof(void*)
4 bytes 8 bytes 8 bytes


  • Casts from pointer to int would be problems. coLinux uses such casts.
  • Some coLinux structs are not 64 bit safe.
  • The size of all structs that are passed from user space to kernel space and to the Linux side need to be checked. Or we would break the compatibility with 32 bit versions.
  • Different sizes for long is a problem inside structs, that are shared between Linux kernel and Windows host.

Toolchain

  • Need a gcc that builds 64 bit code. Is MinGW-w64 available? Last I have seen, the gcc is usable. → http://mingw-w64.sourceforge.net/
  • It is functional & usable, and mingw LD can link imported extern/dllimport functions directly from pre-built PE32+/x64 DLLs (even built with MS' compiler), provided proper prototypes ... std c libs and ms libs are included.
  • Release for GCC 4.4.1 is a prebuild binary with gcc 4.4.1 and binutils 2.20.51 for Linux 32 bit, Linux 64 bit and Cygwin. Simple unpack to any directory and use it. - This toolchain is without DDK headers.
  • personal build 'sezero' from 2010-06-04 is then next prebuild with gcc 4.4.5, binutils 2.20.51, without DDK headers.
  • DDK headers needs to load from ReactOS. Than kernal driver can build with gcc 4.4.1 and 4.4.5. See gcc445-mingw-w64-ddk-testing-suite.tgz
  • → An overview howto install MinGW-w64 is in this wiki.

NT-Kernel driver 'linux64.sys'

Driver Signing

→ It can by bypassed. During boot, press F8 to enter the Advanced Boot Options, and select "Disable Driver Signature Enforcement". Not the most elegant solution, but it works. - raph

Driver Load/Unload

  • Driver install code for "colinux-daemon --install-driver" needs to review. I assume this would no longer work and we need to create a *.inf file. The inf-file needs also included in the driver sign.
→ No inf-file needed. Driver can load in same way as under 32 bit. Here is an example source: gcc445-mingw-w64-ddk-testing-suite.tgz with minimalistic driver and loader for 64 bit. Source and binaries. Successfully tested on Windows 7 x64. — HenryNe 16:34, June 6, 2010 (UTC)

Passage code - the OS switcher

  • Passage page code needs complete rework. We have more registers with double size.

Linux kernel

  • The native kernel is ok.
  • All the coLinux hacks with memory allocations need review.
  • Proxy-Interrupt handler needs rewritten.

TAP Win32

  • TAP Win32 won't work on XP64 - you need TAP Win64 (see http://openvpn.se/development.html)
  • Rebuild our driver source with target 64 bit should work.
  • Driver must digital sign for Vista or Windows Server 2008 64bit. Testsign would be usable.

<HenryNe>: A self compiled TAP-Win64 I have successfully installed on Windows Server 2008 64bit with enabled Test-signing. I can not say about working.

WinPCAP

  • WinPcap 4.0.2 now supports x64 WinPcap

TODO list

Here are some steps and ideas how any developer can help us. Pick up a job and send us your ideas and results.

  • Use a gcc "MinGW-w64" (see top) and create a simple driver, that does only print a message with "DbgPrint". We need to know the build parameters. Please do not use Windows DDK for building, because we can not use it for coLinux. But you can perhaps find a simple example in the DDK. You can do it under Mingw or Cygwin on Windows or Linux (with w64-mingw32 as target). → Done
  • We need any idea to load the driver. In the first way via *.inf file is ok. Please give a step guide how to manage the driver signing. → Done
  • We need an example for using a "share" between driver and user application. This is the driver name "\\.\CoLinuxDriver" in coLinux. Perhaps a down stripped coLinux driver, that supports only one ioctl "versions information" (CO_MONITOR_IOCTL_GET_STATE). The caller from userland should set a flag in IOCTL, so the driver knows, that it was called from 64bit system.
  • Changes on memory management (Page tables, reverse page tables and pseudo physical memory)
  • Changes on passage page
  • Adjust all "long" and "pointer" variables in structs between Linux guest and Windows host to have every time the same size under Windows and Linux, for example with a macro.
Advertisement