-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Description
Current State
Xenia on Linux compiles for Travis tests in order to check C++ errors, style and very basic functionality. It has some nice abstract function definition. Most of these definitions are stubs with failing asserts which mean running Xenia in debug causes SIGABRT and running in release will eventually crash due to missing implementation.
The biggest missing part is the threading. Without threading implementation, the Xenia UI can't run and wait. The emulated threads and synchronization primitives which are built on top of these cannot work properly.
There is also PPC CPU emulation discrepancies between Windows and Linux. The registers used on 64-bit Windows and 64-bit Linux are not the same, therefore proper care must be made to use the correct registers when transitioning from guest to host code and vice-versa.
Memory mapping needs a bit of work due to the differences in shared memory and explicit memory ranges having different parameters and prefixes on Linux.
The GTK windowing and its interaction with Vulkan needs to fixed for several bugs.
The use of paths and the string functions need to better specify NT-style line endings (\) which are used by guest and Windows host. In the case of a Linux host, Unix line endings must be used when specifying guest paths.
Linux debugging and stack walking functions need to be implemented.
Approach to Adding Support
My approach to fixing the following problem has been to first add unit tests (and to use the ones already there) to the already working Windows implementation in order to have a behavioural ground truth. Then I add implementation to Linux which satisfy these tests. Once the Linux implementation pass the tests, I activate those tests on Travis in order to prevent future regressions.
Active PRs
Here are the PRs that I have worked on to have native Linux working. Some of these are built on top of the work of others and I preserved the authorship in the commits.
They are in descending order of importance.
- Threading: Threading unit tests and linux threading implementation #1317
- Potential Deadlock with multiple wait [Linux, threading] WaitMultiple causing deadlock #1677
- Potential Deadlock with events [Linux, threading] Events may deadlock whith auto_reset #1678
- CPU PPC: [Linux] xenia-cpu-ppc-tests (Rebase of #803) #1339 (a rebase of [Linux] xenia-cpu-ppc-tests #803)
- Runtime Segfaults: [CPU] Change thunk layout and fix Linux thunk misalignment #1517 (thanks @Prism019)
- Memory: Linux memory Fixes #1397
- Windowing (GTK, Vulkan): Linux windowing fixes #1431
- Filesystem, clock and string utils: Linux filesystem #1433
- Debug: Implement debug functions for Linux #1435
- Stack Walker: [cpu linux] Implement stack walking #1405
- Input: [HID/Linux] Support Linux systems and non XInput controllers #1493 (thanks @JoelLinn)
- Audio: [APU/Linux] Support cross platform audio #1498 (thanks @JoelLinn)
Things left to do
If anyone feels like contributing to the port there are a few areas which have not yet been addressed:
- Two threading deadlock issues
- Vulkan Graphics
- Auto Reset events do not work as expected
- There is a bug in Event to be fixed
New State
The fixes allow for all unit tests in the project to run and pass on Linux with clang.
The Xenia UI works and can select files with the open dialog.
Loading a xex will work up until emulation.
Calling a host function works as well as host calling a guest function.
Logging works.
Loading a ROM will eventually crash during emulation.
To try all the changes together:
-
I maintain a branch on my repo: https://github.com/bwrsandman/xenia/tree/linux
-
If you are running Arch Linux, the folllowing AUR package installs it for you: https://aur.archlinux.org/packages/xenia-git/
-
You can merge the changes yourself and fix any conflicts:
$ git remote add bwrsandman git@github.com:bwrsandman/xenia.git
$ git fetch bwrsandman
$ git merge \
bwrsandman/linux_cpu \
bwrsandman/linux_windowing \
bwrsandman/linux_filesystem \
bwrsandman/linux_stack_walker

