Port to G5 (PowerPC backend) #612

Open
pc297 opened this Issue Aug 16, 2016 · 8 comments

Projects

None yet

4 participants

@pc297
pc297 commented Aug 16, 2016

Hello, given that the Xbox360 used a custom PowerPC CPU are there any plans to adapt the emulation to the G5 platform (Mac OSX or Linux)? Thanks

@Razzile
Contributor
Razzile commented Aug 16, 2016

I highly doubt that will happen. xenia uses the very latest technology (vulkan, windows 8.1+ APIs, AVX) all of which are not present on PPC platforms right now (with the possible exception of vulkan).

IIRC the xbox 360 cpu had some really weird 128 bit registers that normal PPC doesn't have which is why AVX is needed to emulate these registers.

It may be possible to emulate on PPC platforms (although probably not the old macbooks) but it would take a lot of work, and I doubt any of the xenia devs will take time to target these platforms. That said, there's nothing stopping you or another contributor attempting to port xenia to PPC, or to linux

@pc297
pc297 commented Aug 16, 2016 edited

Thanks for the reply. I guess the first step would be to port it to Linux (x86/x64). Then to get it to industry-standard PPC you are correct that custom registers not used on the standard PPC need to be identified and emulated via extended PPC registers (e.g. AltiVec which is also 128-bit). If AVX is what is doing the job for x86/x64 then AltiVec, which are the PPC's older version of AVX, might do the job. The result would be a bit like emulation of SSE3 instructions using SSE2 instructions in the first releases of OSX x86 kernels for unsupported machines (as in PCs with only SSE2). I will get the source code and get a crack at it, but you're right, apart from the emulation of custom registers, a lot of the code has to be reworked to switch from emulation to direct calls for supported instructions, via the use of Linux PPC APIs. The result would be a bit like FusionPPC, the amiga emulator emulating a PPC mac (using an Amiga PPC CPU).

@DrChat
Collaborator
DrChat commented Aug 17, 2016

This is the same issue as allowing Xenia to work on any other platform.
The JIT needs a backend written for the target platform.

@pc297
pc297 commented Aug 17, 2016 edited

Yes, but given that the target platform in this case is mostly code compatible (both PPC) a lot of the JIT can go except for some unusual PPC registers (e.g. VMX128). The backend could be based on some existing ones for the mac, e.g. the PPC version of SheepShaver, and supporting emulation of special registers (VMX128) using standard PPC ones (VMX/AltiVec), or with a patched Xbox360 kernel (with VMX128 instructions translated to VMX/AltiVec). The result would be more like a virtual machine, but running at native speed, maybe that would be a good solution. I will take a look at the SheepShaver source code.

@resetnow
resetnow commented Aug 17, 2016 edited

supporting emulation of special registers (VMX128) using standard PPC ones (VMX/AltiVec),

I might be wrong, but you can't just replace VMX128 instructions with corresponding VMX. You would still need do most of the JIT because code size and location will change, and so will instruction/data offsets.

@DrChat
Collaborator
DrChat commented Aug 17, 2016

Yeah - the JIT can't go. Granted, a lot of instructions can be emulated natively (one-to-one instruction output), but we'd still need to generate code for those that the target platform can't run.

On top of that, it's simpler just to write a new JIT backend than it is to setup the emulator for more native emulation.

@DrChat DrChat added the cpu label Aug 17, 2016
@DrChat DrChat changed the title from Port to G5? to Port to G5 (PowerPC backend) Aug 17, 2016
@pc297
pc297 commented Aug 18, 2016

I would love to know how MS could run Xbox360 demos on the G5 - granted it was a special "Alpha Xenon Kit" SDK that was running a special version of the Xbox 360 OS, a.k.a a modified WinNT kernel for PPC. Obviously MS is never going to release that software, even though it would be a big help to achieve that. That said, I might try and boot my G5 with one of the released versions of Xbox 360 OS and see how far it goes, probably not very if at all.

@DrChat
Collaborator
DrChat commented Sep 11, 2016

Because the games were specifically compiled for use on the G5 rather than the 360.

That devkit was just an approximation of the hardware that would be used in the 360 - so it probably doesn't support a lot of the stuff the 360 does.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment