coLinux
Register
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 biggest differences are in the size of 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.
  • Read also Wikipedia: 64-bit data models

Source tree[]

  • The current branch "devel" was copied into "devel-64bit" and changed to use the compiler MinGW-w64.
  • Please download the code from SVN:
svn co http://svn.code.sf.net/p/colinux/code/branches/devel-64bit devel-64bit
  • Then follow instructions from file "README64" there.

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 kernel 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
  • Better way to disable it - using bcdedit from the command line, do "bcdedit /set loadoptions DDISABLE_INTEGRITY_CHECKS" - this could even be streamlined into the installer with a YES/NO box making sure the user understands what they're doing and why. -Yushatak
  • There is a way to dynamically turn off/on the check for driver signing during install/setup time without any need to fiddle with boot options and/or the need to reboot. There is even a proof of concept c code. See http://www.dualsoft.net/majstorije/?p=6 - thhirsch


The ReactOS Foundation has a Verisign code signing certificate that can be used to sign 64bit Windows drivers and the foundation is prepared to assist other open source projects. See [Foundation driver signing ] -mhe

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-suitе.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 to be 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.

  • Contribution for the core part of the colinux for simulated context switching for x86 64bit inside windows process
  • 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.

What is done so far:

  • Use a gcc "MinGW-w64" 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 see Toolchain
  • 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. → Done see gcc445-mingw-w64-ddk-testing-suite.tgz
  • libndis.a is missing in current snapshots. Linker option -lndis fails for the kernel driver. → Done with gcc 20100711_sezero, it's in coLinux SVN branch devel-64bit
Advertisement