I found vmswga2 project and got sound on emulated 10.6.8 (x86-64!)

Anything about Mac emulation that does not belong in the above categories.

Moderators: Cat_7, Ronald P. Regensburg

Post Reply
Andrew_R
Inquisitive Elf
Posts: 31
Joined: Tue Jul 06, 2021 1:32 am

I found vmswga2 project and got sound on emulated 10.6.8 (x86-64!)

Post by Andrew_R »

Project: https://sourceforge.net/projects/vmsvga2/

I got basic tarball from their files - https://sourceforge.net/projects/vmsvga ... 2/download , copied to host (Slackware 15..0) ftp, from running 10.6.8 vm get it and unpacked, and using xcode 3.2.6 (full install, not one coming up as 3.2 on 10.6 install dvd image) compiled thing for default target "SnowLeopard" run kextutil on it, fixed permissions as advised. Copied \cp -r| to /System/Libraries/Extensions, reboot with -device ac97 onqemu command line and I have sound!

Sadly, new optimization in 1.1.0 version of this driver are x86 only so ppc crossbuild failed .. (and 1.0.0 posted to virtualbox forums was panicing 10.6.8's x86-64 kernel for me so not sure if it was even working ...)



CompileC build/AppleAC97Audio.build/ReleaseLeo/AppleAC97AudioAMD.build/Objects-normal/ppc/AppleAC97AudioAMDCS5535.o AppleAC97AudioAMD/AppleAC97Aud
ioAMDCS5535.cpp normal ppc c++ com.apple.compilers.gcc.4_0
cd /Users/andrew/AppleAC97Audio-5
setenv LANG en_US.US-ASCII
/Developer/usr/bin/gcc-4.0 -x c++ -arch ppc -fmessage-length=0 -pipe -nostdinc -fno-builtin -Wno-trigraphs -fno-exceptions -fno-rtti -fcheck-new -
fasm-blocks -force_cpusubtype_ALL -msoft-float -Os -fno-common -mkernel -finline -fno-keep-inline-functions -Wreturn-type -Wunused-variable -Wunin
itialized -Wsign-compare -Wshorten-64-to-32 -DKERNEL -DKERNEL_PRIVATE -DDRIVER_PRIVATE -DAPPLE -DNeXT -isysroot /Developer/SDKs/MacOSX10.4u.sdk -f
apple-kext -mtune=G4 -mmacosx-version-min=10.1 -gdwarf-2 -iquote /Users/andrew/AppleAC97Audio-5/build/AppleAC97Audio.build/ReleaseLeo/AppleAC97Aud
ioAMD.build/AppleAC97AudioAMD-generated-files.hmap -I/Users/andrew/AppleAC97Audio-5/build/AppleAC97Audio.build/ReleaseLeo/AppleAC97AudioAMD.build/
AppleAC97AudioAMD-own-target-headers.hmap -I/Users/andrew/AppleAC97Audio-5/build/AppleAC97Audio.build/ReleaseLeo/AppleAC97AudioAMD.build/AppleAC97
AudioAMD-all-target-headers.hmap -iquote /Users/andrew/AppleAC97Audio-5/build/AppleAC97Audio.build/ReleaseLeo/AppleAC97AudioAMD.build/AppleAC97Aud
ioAMD-project-headers.hmap -Wmost -F/Users/andrew/AppleAC97Audio-5/build/ReleaseLeo -I/Users/andrew/AppleAC97Audio-5/build/ReleaseLeo/include -I/S
ystem/Library/Frameworks/Kernel.framework/PrivateHeaders -I/Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/Kernel.framework/Headers -I/U
sers/andrew/AppleAC97Audio-5/build/AppleAC97Audio.build/ReleaseLeo/AppleAC97AudioAMD.build/DerivedSources/ppc -I/Users/andrew/AppleAC97Audio-5/bui
ld/AppleAC97Audio.build/ReleaseLeo/AppleAC97AudioAMD.build/DerivedSources -c /Users/andrew/AppleAC97Audio-5/AppleAC97AudioAMD/AppleAC97AudioAMDCS5
535.cpp -o /Users/andrew/AppleAC97Audio-5/build/AppleAC97Audio.build/ReleaseLeo/AppleAC97AudioAMD.build/Objects-normal/ppc/AppleAC97AudioAMDCS5535
.o


[...]

/Users/andrew/AppleAC97Audio-5/AppleAC97AudioDriver/AppleAC97AudioEngine.cpp: In function 'void clipOutput4(short int*, const float*)':
/Users/andrew/AppleAC97Audio-5/AppleAC97AudioDriver/AppleAC97AudioEngine.cpp:62: error: '__builtin_ia32_minps' was not declared in this scope
/Users/andrew/AppleAC97Audio-5/AppleAC97AudioDriver/AppleAC97AudioEngine.cpp:62: error: '__builtin_ia32_maxps' was not declared in this scope
/Users/andrew/AppleAC97Audio-5/AppleAC97AudioDriver/AppleAC97AudioEngine.cpp:62: error: '__builtin_ia32_mulps' was not declared in this scope
/Users/andrew/AppleAC97Audio-5/AppleAC97AudioDriver/AppleAC97AudioEngine.cpp:62: error: '__builtin_ia32_cvttps2dq' was not declared in this scope
/Users/andrew/AppleAC97Audio-5/AppleAC97AudioDriver/AppleAC97AudioEngine.cpp:69: error: '__builtin_ia32_packssdw' was not declared in this scope
/Users/andrew/AppleAC97Audio-5/AppleAC97AudioDriver/AppleAC97AudioEngine.cpp:69: error: '__builtin_ia32_movntq' was not declared in this scope
/Users/andrew/AppleAC97Audio-5/AppleAC97AudioDriver/AppleAC97AudioEngine.cpp: In function 'void clipOutput2(short int*, const float*)':
/Users/andrew/AppleAC97Audio-5/AppleAC97AudioDriver/AppleAC97AudioEngine.cpp:85: error: '__builtin_ia32_minps' was not declared in this scope
/Users/andrew/AppleAC97Audio-5/AppleAC97AudioDriver/AppleAC97AudioEngine.cpp:85: error: '__builtin_ia32_maxps' was not declared in this scope
/Users/andrew/AppleAC97Audio-5/AppleAC97AudioDriver/AppleAC97AudioEngine.cpp:85: error: '__builtin_ia32_mulps' was not declared in this scope
/Users/andrew/AppleAC97Audio-5/AppleAC97AudioDriver/AppleAC97AudioEngine.cpp:85: error: '__builtin_ia32_cvttps2pi' was not declared in this scope
/Users/andrew/AppleAC97Audio-5/AppleAC97AudioDriver/AppleAC97AudioEngine.cpp:85: error: '__builtin_ia32_packssdw' was not declared in this scope
/Users/andrew/AppleAC97Audio-5/AppleAC97AudioDriver/AppleAC97AudioEngine.cpp:85: error: '__builtin_ia32_vec_ext_v2si' was not declared in this sco
pe
/Users/andrew/AppleAC97Audio-5/AppleAC97AudioDriver/AppleAC97AudioEngine.cpp:85: error: '__builtin_ia32_movnti' was not declared in this scope
/Users/andrew/AppleAC97Audio-5/AppleAC97AudioDriver/AppleAC97AudioEngine.cpp: In function 'void clipOutput1(short int*, const float*)':
/Users/andrew/AppleAC97Audio-5/AppleAC97AudioDriver/AppleAC97AudioEngine.cpp:94: error: '__builtin_ia32_minss' was not declared in this scope
/Users/andrew/AppleAC97Audio-5/AppleAC97AudioDriver/AppleAC97AudioEngine.cpp:94: error: '__builtin_ia32_maxss' was not declared in this scope
/Users/andrew/AppleAC97Audio-5/AppleAC97AudioDriver/AppleAC97AudioEngine.cpp:94: error: '__builtin_ia32_mulss' was not declared in this scope
/Users/andrew/AppleAC97Audio-5/AppleAC97AudioDriver/AppleAC97AudioEngine.cpp:94: error: '__builtin_ia32_cvttss2si' was not declared in this scope
/Users/andrew/AppleAC97Audio-5/AppleAC97AudioDriver/AppleAC97AudioEngine.cpp: In member function 'virtual IOReturn AppleAC97AudioEngine::clipOutpu
tSamples(const void*, void*, UInt32, UInt32, const IOAudioStreamFormat*, IOAudioStream*)':
/Users/andrew/AppleAC97Audio-5/AppleAC97AudioDriver/AppleAC97AudioEngine.cpp:148: error: '__builtin_ia32_sfence' was not declared in this scope
/Users/andrew/AppleAC97Audio-5/AppleAC97AudioDriver/AppleAC97AudioEngine.cpp:149: error: '__builtin_ia32_emms' was not declared in this scope
/Users/andrew/AppleAC97Audio-5/AppleAC97AudioDriver/AppleAC97AudioEngine.cpp: In function 'void convertInput4(float*, const short int*)':
/Users/andrew/AppleAC97Audio-5/AppleAC97AudioDriver/AppleAC97AudioEngine.cpp:176: error: '__builtin_ia32_cvtdq2ps' was not declared in this scope
/Users/andrew/AppleAC97Audio-5/AppleAC97AudioDriver/AppleAC97AudioEngine.cpp:176: error: '__builtin_ia32_divps' was not declared in this scope
/Users/andrew/AppleAC97Audio-5/AppleAC97AudioDriver/AppleAC97AudioEngine.cpp:176: error: '__builtin_ia32_movntps' was not declared in this scope
/Users/andrew/AppleAC97Audio-5/AppleAC97AudioDriver/AppleAC97AudioEngine.cpp: In function 'void convertInput2(float*, const short int*)':
/Users/andrew/AppleAC97Audio-5/AppleAC97AudioDriver/AppleAC97AudioEngine.cpp:201: error: '__builtin_ia32_cvtpi2ps' was not declared in this scope
/Users/andrew/AppleAC97Audio-5/AppleAC97AudioDriver/AppleAC97AudioEngine.cpp:201: error: '__builtin_ia32_divps' was not declared in this scope
/Users/andrew/AppleAC97Audio-5/AppleAC97AudioDriver/AppleAC97AudioEngine.cpp:203: error: '__builtin_ia32_movntq' was not declared in this scope
/Users/andrew/AppleAC97Audio-5/AppleAC97AudioDriver/AppleAC97AudioEngine.cpp: In function 'void convertInput1(float*, const short int*)':
/Users/andrew/AppleAC97Audio-5/AppleAC97AudioDriver/AppleAC97AudioEngine.cpp:210: error: '__builtin_ia32_movnti' was not declared in this scope
/Users/andrew/AppleAC97Audio-5/AppleAC97AudioDriver/AppleAC97AudioEngine.cpp: In member function 'virtual IOReturn AppleAC97AudioEngine::convertIn
putSamples(const void*, void*, UInt32, UInt32, const IOAudioStreamFormat*, IOAudioStream*)':
/Users/andrew/AppleAC97Audio-5/AppleAC97AudioDriver/AppleAC97AudioEngine.cpp:255: error: '__builtin_ia32_sfence' was not declared in this scope
/Users/andrew/AppleAC97Audio-5/AppleAC97AudioDriver/AppleAC97AudioEngine.cpp:256: error: '__builtin_ia32_emms' was not declared in this scope
so if anyone want to try you can downlaod xcode from https://archive.org/details/xcode_old_versions and try (kvm accelerated os 10.6 machine is faster than qemu-system-ppc, even if ppc version of Tiger also exist at Archive.org - https://archive.org/details/mac-osx-tig ... cow2-image

Currently trying to install xcode 2.x to it

I am not sure if ac97 driver exposed normally as PCI device will work on ppc - but it was interesting idea to try ...

Additional forum link where I found lead to this file:
https://forums.virtualbox.org/viewtopic ... 30&t=33358

Even if today virtio seen as future of qemu guest drivers may be those old files will help someone ..? qemu's vmsvga video emulation looked a bit more incomplete when it comes to video acceleration, some files in this old driver project contain interesting hints/comments on what was done for full-featured device in vmware ...
User avatar
adespoton
Forum All-Star
Posts: 4754
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com

Re: I found vmswga2 project and got sound on emulated 10.6.8 (x86-64!)

Post by adespoton »

Any chance you could make your compiled version available? I'd love to preload it into my OpenCore EFI volume, so everyone using that automatically gets audio.

Benefit there is that you don't need to mess around with kexts in the actual OS, either :)
Andrew_R
Inquisitive Elf
Posts: 31
Joined: Tue Jul 06, 2021 1:32 am

Re: I found vmswga2 project and got sound on emulated 10.6.8 (x86-64!)

Post by Andrew_R »

adespoton wrote: Thu May 09, 2024 3:08 pm Any chance you could make your compiled version available? I'd love to preload it into my OpenCore EFI volume, so everyone using that automatically gets audio.

Benefit there is that you don't need to mess around with kexts in the actual OS, either :)
I think yes, I just need to put it somewhere ...

https://disk.yandex.ru/d/BlLv2jn0uH2r_g
ReleaseSnowLeo.zip should contain 10.6.x driver ...

I ifdefed all those sse2 instructions and driver compiles for ppc arch (I assume it will not make any sound due to lack of clipping routines) but macos 10.4.11 refuse to kextload it:
kextload: extension /Users/timcook/ReleaseLeo/AppleAC97Audio.kext appears to be valid
20AppleAC97AudioEngine is not compatible with its superclass, 13IOAudioEngine superclass changed?
kextload: a link/load error occured for kernel extension /Users/timcook/ReleaseLeo/AppleAC97Audio.kext
load failed for extension /Users/timcook/ReleaseLeo/AppleAC97Audio.kext
(run kextload with -t for diagnostic output)
I guess I need to get more real knowledge about those classes ...
User avatar
adespoton
Forum All-Star
Posts: 4754
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com

Re: I found vmswga2 project and got sound on emulated 10.6.8 (x86-64!)

Post by adespoton »

Thanks!

I'm not sure the superclass exists in the same way on 10.4? Some cobwebby part of my mind is suggesting it was added with 10.5. Possibly your build would work in 10.5 PPC?
User avatar
adespoton
Forum All-Star
Posts: 4754
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com

Re: I found vmswga2 project and got sound on emulated 10.6.8 (x86-64!)

Post by adespoton »

Andrew_R wrote: Fri May 10, 2024 5:02 pm
adespoton wrote: Thu May 09, 2024 3:08 pm Any chance you could make your compiled version available? I'd love to preload it into my OpenCore EFI volume, so everyone using that automatically gets audio.

Benefit there is that you don't need to mess around with kexts in the actual OS, either :)
I think yes, I just need to put it somewhere ...

https://disk.yandex.ru/d/BlLv2jn0uH2r_g
ReleaseSnowLeo.zip should contain 10.6.x driver ...

I ifdefed all those sse2 instructions and driver compiles for ppc arch (I assume it will not make any sound due to lack of clipping routines) but macos 10.4.11 refuse to kextload it:
kextload: extension /Users/timcook/ReleaseLeo/AppleAC97Audio.kext appears to be valid
20AppleAC97AudioEngine is not compatible with its superclass, 13IOAudioEngine superclass changed?
kextload: a link/load error occured for kernel extension /Users/timcook/ReleaseLeo/AppleAC97Audio.kext
load failed for extension /Users/timcook/ReleaseLeo/AppleAC97Audio.kext
(run kextload with -t for diagnostic output)
I guess I need to get more real knowledge about those classes ...
Hmm; nothing's ever simple. I tried adding the kext to my EFI partition and using OpenCore to load it. Doesn't seem to have been enough, as adding -device ac97 to my command line then results in a kernel panic.

Were you using AppleAC97Audio.kext, AppleAC97AudioIntelICH.kext, or something else?

[edit] I disabled the driver in OpenCore and did as you did and copied it to the Extensions folder after changing owner and group settings, and the kernel panic went away, but the device isn't showing up in the profiler nor in System Preferences. Not sure why QEMU 9 on macOS ARM would be behaving differently about it than your setup, but it appears to be.
Andrew_R
Inquisitive Elf
Posts: 31
Joined: Tue Jul 06, 2021 1:32 am

Re: I found vmswga2 project and got sound on emulated 10.6.8 (x86-64!)

Post by Andrew_R »

I also tried to build earlier revision of https://sourceforge.net/p/voodoohda/code/HEAD/tree/ VoodooHDA project on qemu ppc VM (10.4.11), but apparently gcc 4.0 chokes on ppc assembly written by Apple themselves?? May be Xcode project (from new version of Xcode was imported slightly wrong and my settings also not fixed it completely?

So only thing I can post is openss benchmark result (host - AMD FX 4300)

To get the most accurate results, try to run this
program when this computer is idle.
Doing aes-256 cbc for 3s on 16 size blocks: 2069034 aes-256 cbc's in 2.85s
Doing aes-256 cbc for 3s on 64 size blocks: 573277 aes-256 cbc's in 2.78s
Doing aes-256 cbc for 3s on 256 size blocks: 149801 aes-256 cbc's in 2.76s
Doing aes-256 cbc for 3s on 1024 size blocks: 39293 aes-256 cbc's in 2.87s
Doing aes-256 cbc for 3s on 8192 size blocks: 4856 aes-256 cbc's in 2.84s
OpenSSL 0.9.7l 28 Sep 2006
built on: Mon Feb 16 11:01:20 PST 2009
options:bn(64,32) md2(int) rc4(ptr,char) des(idx,cisc,16,long) aes(partial) blowfish(ptr)
compiler: cc -arch i386 -arch ppc -g -Os -pipe -arch i386 -arch ppc -pipe -DOPENSSL_NO_IDEA -DFAR=
available timing options: TIMEB USE_TOD HZ=100 [sysconf value]
timing function used: getrusage
The 'numbers' are in 1000s of bytes per second processed.
type 16 bytes 64 bytes 256 bytes 1024 bytes 8192 bytes
aes-256 cbc 11597.10k 13179.75k 13881.26k 14004.83k 13995.77k

Andrew_R
Inquisitive Elf
Posts: 31
Joined: Tue Jul 06, 2021 1:32 am

Re: I found vmswga2 project and got sound on emulated 10.6.8 (x86-64!)

Post by Andrew_R »

adespoton wrote: Sat May 11, 2024 4:55 am

Hmm; nothing's ever simple. I tried adding the kext to my EFI partition and using OpenCore to load it. Doesn't seem to have been enough, as adding -device ac97 to my command line then results in a kernel panic.

Were you using AppleAC97Audio.kext, AppleAC97AudioIntelICH.kext, or something else?

[edit] I disabled the driver in OpenCore and did as you did and copied it to the Extensions folder after changing owner and group settings, and the kernel panic went away, but the device isn't showing up in the profiler nor in System Preferences. Not sure why QEMU 9 on macOS ARM would be behaving differently about it than your setup, but it appears to be.
Not sure, may be OpenCORE build for aarch64 does something differently? I think I saw some comments about hfs+ driver behaving differently on arm Macs vs Intel :
https://xadammr.au/blog/snow-leopard-utm
2022-03-22: thanks to Rick in the comments and Kyle in the Discord for identifying a fault with the OpenCore EFI image I provided. It looks like the default HfsPlus.efi driver works great on an Intel Mac with the hypervisor enabled, but on an M1 Mac it fails to boot to the OpenCore OS list. I changed the driver to VBoxHfs.efi, and it now works on an Intel Mac with the Hypervisor both enabled and disabled, and on an M1 Mac. I updated the link to point to the new EFI image.
I used both AppleAC97Audio.kext and AppleAC97AudioIntelICH.kext
User avatar
adespoton
Forum All-Star
Posts: 4754
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com

Re: I found vmswga2 project and got sound on emulated 10.6.8 (x86-64!)

Post by adespoton »

Andrew_R wrote: Sat May 11, 2024 9:45 am
adespoton wrote: Sat May 11, 2024 4:55 am

Hmm; nothing's ever simple. I tried adding the kext to my EFI partition and using OpenCore to load it. Doesn't seem to have been enough, as adding -device ac97 to my command line then results in a kernel panic.

Were you using AppleAC97Audio.kext, AppleAC97AudioIntelICH.kext, or something else?

[edit] I disabled the driver in OpenCore and did as you did and copied it to the Extensions folder after changing owner and group settings, and the kernel panic went away, but the device isn't showing up in the profiler nor in System Preferences. Not sure why QEMU 9 on macOS ARM would be behaving differently about it than your setup, but it appears to be.
Not sure, may be OpenCORE build for aarch64 does something differently? I think I saw some comments about hfs+ driver behaving differently on arm Macs vs Intel :
https://xadammr.au/blog/snow-leopard-utm
2022-03-22: thanks to Rick in the comments and Kyle in the Discord for identifying a fault with the OpenCore EFI image I provided. It looks like the default HfsPlus.efi driver works great on an Intel Mac with the hypervisor enabled, but on an M1 Mac it fails to boot to the OpenCore OS list. I changed the driver to VBoxHfs.efi, and it now works on an Intel Mac with the Hypervisor both enabled and disabled, and on an M1 Mac. I updated the link to point to the new EFI image.
I used both AppleAC97Audio.kext and AppleAC97AudioIntelICH.kext
There's also the issue that we discovered the TCG emulator sets things up slightly different on ARM hosts (any ARM hosts) than it does on X86 hosts. In order to get 10.6 running at all on an ARM host, the installer needs to be run under QEMU on an x86 host first, and then the image moved over to an ARM machine. It's very possible I'm running into the same hardware querying issue when attempting to add the audio driver.
mcayland
Mac Mechanic
Posts: 155
Joined: Sun Nov 01, 2015 10:33 pm

Re: I found vmswga2 project and got sound on emulated 10.6.8 (x86-64!)

Post by mcayland »

adespoton wrote: Mon May 13, 2024 3:15 pm There's also the issue that we discovered the TCG emulator sets things up slightly different on ARM hosts (any ARM hosts) than it does on X86 hosts. In order to get 10.6 running at all on an ARM host, the installer needs to be run under QEMU on an x86 host first, and then the image moved over to an ARM machine. It's very possible I'm running into the same hardware querying issue when attempting to add the audio driver.
Have you tried this on a vanilla upstream build of QEMU 9.0? Each release of QEMU sees several hundred commits to the JIT core, target frontend and TCG backend, so as a general rule you want to be running the latest and greatest. And of course, if you do find an issue, please file a bug report upstream at https://gitlab.com/qemu-project/qemu/-/issues.

NOTE: UTM is currently several releases behind (equivalent to QEMU 7.2) so it is likely missing quite a few bugfixes
User avatar
adespoton
Forum All-Star
Posts: 4754
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com

Re: I found vmswga2 project and got sound on emulated 10.6.8 (x86-64!)

Post by adespoton »

mcayland wrote: Mon May 13, 2024 8:07 pm
adespoton wrote: Mon May 13, 2024 3:15 pm There's also the issue that we discovered the TCG emulator sets things up slightly different on ARM hosts (any ARM hosts) than it does on X86 hosts. In order to get 10.6 running at all on an ARM host, the installer needs to be run under QEMU on an x86 host first, and then the image moved over to an ARM machine. It's very possible I'm running into the same hardware querying issue when attempting to add the audio driver.
Have you tried this on a vanilla upstream build of QEMU 9.0? Each release of QEMU sees several hundred commits to the JIT core, target frontend and TCG backend, so as a general rule you want to be running the latest and greatest. And of course, if you do find an issue, please file a bug report upstream at https://gitlab.com/qemu-project/qemu/-/issues.

NOTE: UTM is currently several releases behind (equivalent to QEMU 7.2) so it is likely missing quite a few bugfixes
Actually, I was finding the issue on 7.2 and 8.2, but haven't explicitly seen it on 9.0, and was going to test to see if it still exists, but haven't got around to it yet. The big issue is identifying what the issue is so that it's actionable on the issue tracker -- I haven't managed to do that yet, although I think someone else added an item and referenced it to me in a chat a while back.

While I'm at it, I should probably file the audio issue when I get time, as the HID device definitely isn't picked up by 10.6, and the AC97 device causes a panic on ARM but works fine on Intel.
Post Reply