Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(Question) would MacOnLinux work on this ? #45

Open
stuaxo opened this issue May 3, 2023 · 11 comments
Open

(Question) would MacOnLinux work on this ? #45

stuaxo opened this issue May 3, 2023 · 11 comments

Comments

@stuaxo
Copy link

stuaxo commented May 3, 2023

MacOnLinux has been tested on some earlier versions successfully but has some issues with rendering, I noticed this version has RGBA support which sounds interesting.

There's a small thread here
https://www.youtube.com/watch?v=qhDQicLvHNQ&lc=UgzWdA_o7kEGDLgashN4AaABAg

It looks like current versions of MoL want KVM, added for PPC32 in 3.15.x

Wish I had my Wii still to try this TBH :)

@Jose64141
Copy link

Hi
I'm one of the guys on that thread. I've also read KVM support for PPC was added on 3.15.x. Recently I saw the latest stable kernel on the repo has like the files for PPC kvm, so I gave it a shot. 2 problems:

  • On boot there's a problem with an unsupported instruction from kvm
  • xorg consumes more RAM here so it crashes
    Here I'd like to point another weird bug. I'm both 2.6 and 3.14 kernels, MoL and molvconfig can't write to the framebuffer, only console text, forcing me to use X11.

I guess I could try the experimental kernels, but I rely on SD and I'm not entirely sure on the implications ando constrains of those with wifi and stuff (I always boot from a SDHC card ando have no ethernet, tho I have the card with all the necessary stuff installed so I can live with that I guess, but I'd still need networking to try remote X11 'cause of the RAM issue), and also don't have a lot of free time to try right now
If someone is willing to try that and does, I'd like to hear how it goes!

@Jose64141
Copy link

Hi
I'm one of the guys on that thread. I've also read KVM support for PPC was added on 3.15.x. Recently I saw the latest stable kernel on the repo has like the files for PPC kvm, so I gave it a shot. 2 problems:

  • On boot there's a problem with an unsupported instruction from kvm
  • xorg consumes more RAM here so it crashes
    Here I'd like to point another weird bug. I'm both 2.6 and 3.14 kernels, MoL and molvconfig can't write to the framebuffer, only console text, forcing me to use X11.

I guess I could try the experimental kernels, but I rely on SD and I'm not entirely sure on the implications and constraints of those with wifi and stuff (I always boot from a SDHC card ando have no ethernet, tho I have the card with all the necessary stuff installed so I can live with that I guess, but I'd still need networking to try remote X11 'cause of the RAM issue), and also don't have a lot of free time to try right now
If someone is willing to try that and does, I'd like to hear how it goes!

@stuaxo
Copy link
Author

stuaxo commented May 4, 2023

Interesting stuff. If you are willing to sacrifice an SD card it could be worth experimenting with a large virtual memory partition (and lots of waiting).

In the last I've had some luck using zram on constrained systems.

In case anyone comes by + sees this, do you have more info on the KVM error, does it give any more info, like which unsupported instruction (or just including the whole message may be good) ?

@Jose64141
Copy link

Jose64141 commented May 6, 2023

I made the experiment, on a Wii U, Linux 4.19, with KVM compiled, and it gave me this error:
Couldn't emulate instruction 0xe9ad0078 (op 58 xop 60)
The error was printed infinitely, so much that the system couldn't even process keystrokes. It ocurred as soon as it tried to boot a disk image, with Mac OS X 10.4 installed. It's simillar to the error message I got on the Wii with 3.14.x, but right now I can't be sure if it's the same.
PS: In the WiiU, MoL has no problem using the framebuffer!
PS2: I also tried QEMU-KVM, but I don't know how to make it work on just framebuffer, and I had a little problem on X (maybe it was just that I had 2 mouses plugged to the console, I'll check that later)

@stuaxo
Copy link
Author

stuaxo commented May 6, 2023

I asked the dreaded chatgpt4 about this, and it came up with something that looks plausible (as ever) but as usual, may not be correct:

Based on the context you provided (32-bit PowerPC chips running System 7.5.x), it is possible that the opcode 0xe9ad0078 corresponds to the dcbtst instruction.

The dcbtst instruction is part of the "Book E" extensions to the PowerPC ISA, which were introduced in the PowerPC 603 and 604 processors used in Macintosh computers running System 7.5.x. This instruction is used to perform a data cache block touch in a "safe" way, which helps ensure data consistency in multi-threaded applications.

The dcbtst instruction has an opcode value of 0xe9ad0078, which matches the value you provided. However, it is important to note that this is just a guess based on the information provided. Without more detailed information about the specific software and hardware environment, it is impossible to know for certain which instruction corresponds to this opcode.

@stuaxo
Copy link
Author

stuaxo commented May 6, 2023

And a follow on:

Does the powerpc chip on the wii support dcbtst ?
ChatGPT

The PowerPC processor used in the Nintendo Wii console is a variant of the Broadway processor, which is based on the PowerPC 750 architecture. The PowerPC 750 is an older PowerPC architecture that was introduced in 1997, and it does not include the "Book E" extensions that introduced the dcbtst instruction.

Therefore, it is unlikely that the PowerPC processor used in the Nintendo Wii console supports the dcbtst instruction. However, it is worth noting that some later PowerPC processors used in game consoles (such as the Xenon processor used in the Xbox 360) do support the "Book E" extensions and the dcbtst instruction.

@stuaxo
Copy link
Author

stuaxo commented May 6, 2023

So, I looked in linux/arch/powerpc/kvm.emulate.c and there is CONFIG_BOOKE.

I'm not sure whether it should be set or not ?

It sounds like the wii host does not have book e, but the guest needs it to be emulated; and from there I'm not sure if turning it on will have code to emulate the instruction; but it's probably a place to start looking.

@stuaxo
Copy link
Author

stuaxo commented May 6, 2023

On this page:
https://dtdtech.blogspot.com/2011/05/dcba-dcbz-dcbt-dcbtst-cache-control.html

It says they are all just hints to the cache - which implies to me that if the emulation was simply "NOP" - just doing nothing, I think things might be fine ?

dcba, dcbz, dcbt, dcbtst cache control instructions in PowerPC
dcba - Data Cache Block Allocate
dcbz - Data Cache Block set to Zero
dcbt - Data Cache Block Touch
dcbtst - Data Cache Block Touch for Store
are called data-cache hint instructions.

These instructions are used to improve the memory performance by avoiding cache miss. With these instructions, the cache lines corresponding to memory locations that are likely to be accessed in the near future can be allocated speculatively to avoid cache-miss. For example, with dcbt and dcbtst instructions, if the byte specified by the effective address (EA) is cacheable and is not currently cached by the data cache, the cacheline containing that byte is loaded into the data cache from main memory.
dcbt and dcbtst instructions are further optimized to dcba and dcbz instructions where the cache lines are allocated for the effective address (EA) without copying data from system memory where the contents of the main memory are no longer needed or the memory block can be initialized to zero.

@stuaxo
Copy link
Author

stuaxo commented May 7, 2023

It looks like Qemu supports processors with the Book E architecture calling it mac99, it's worth trying to run it with that as a starting point.

@Jose64141
Copy link

Hi
I checked some leaked stuff about the Wii, and its cpu indeed has the dcbtst instruction. Also, the opcode for it doesn't exactly match the one from the error, so maybe it's another instruction ;o

@stuaxo
Copy link
Author

stuaxo commented May 10, 2023

Heh, well now I feel quite dumb (and after a few more days using a certain chat bot I realise it is too, the later version of chatgpt was less confident).

(And staring at it, I can't really grok how the decoding to dcbtst would make sense) - so apologies for posting in depth nonsense.

It makes sense to me that that the instruction is probably from MacOS as a first place to look.

I don't know if there are tools for debugging stuff in KVM. I'm tempted to have a look at emulation in say PearPC Vs dolphin to grok things.

(Again apologies about any time sunk) - on the plus side the advice on roughly where to look in KVM etc seemed about right, even if the actual instruction wasn't

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants