Mac OS X on x86 Hardware 2008–2024 Technical Archive
InfiniteMac OSx86 › OSx86 Core & 10.X › amd_insn_patcher - Instructions would be nice
42,725 reads · 2011-01-03 – 2013-02-09
Report 10.X Core

amd_insn_patcher - Instructions would be nice

Okay so it may be a simple procedure but I can't find nothing of any use on google about the useage of amd_insn_patcher. This confusion arises because stuff seems to change that rapidly, that unless you've been following all this from day…

Primary Author
@danfloun Published 2011-01-03
Collection
OSx86 Core & 10.X
Archival Footprint
42,725 historical reads · 6 curated field notes (from 10 dispatches) · 2011-01-03 – 2013-02-09
Credited Voices (6)
@danfloun (3)@fumoboy007 (3)@andyvand@AVO-Electronics@bcoco85@daksi99
Hardware Reference
AMD Desktop Processors ↗ SATA III & NVMe SSDs ↗ USB 3.2 Boot Flash Drives ↗ amazon.com

Okay so it may be a simple procedure but I can't find nothing of any use on google about the useage of amd_insn_patcher. This confusion arises because stuff seems to change that rapidly, that unless you've been following all this from day one it's just information overload for the rest of us.

One thread I read said that I only needed to patch the bindings, but that was x64 specific, another thread was half the info I needed and assumed we are all geeks

So please, can someone tell me how to patch this damn 10.6.5 Legacy Kernel please!

The amd_insn_patcher zip contains;

amd_insn_patcher
amd_insn_patcher_ext
insn_patcher.c
insn_patcher.h
.DS_Store
Makefile

I assume the .DS_Store is irrelevant.
So what do i do with the rest? /usr/bin /usr/lib?

Yours frustratedly
Danny

Author Updates & Technical Revisions

Follow-up dispatches by @danfloun

Author Update #1 @danfloun 2011-01-03

That's great thanks.
Just what I required!

But, how do I know which binaries need patching? I guess I don't, so am I supposed to try every single binary or just those such as QuickTime, safari iTunes etc?

And when you say the _patcher_ext is for some extensions, by that do you mean kexts?

You obviously put a lot of time into the project and community and for that I thank you.

Danny

Author Update #2 @danfloun 2011-01-04 ↳ Re: @fumoboy007
@fumoboy007Also, since you have an AMD Athlon 64 X2 processor, you will probably need this too: AMD Dual-Core Optimizer for Snow Leopard (osx 86.co/f36/amd-dual-core-optimizer-for-snow-leopard-t6820/).

Hey,

Thanks for that.
I'm far more clued up now.

Regarding the optimizer, I already installed that earlier today. I saw some cpu time sync issues in the error logs just after looking through these forums and installed it to find it fixed the problem. I should maybe post there to let the dev know it's working for me.

Thanks again for taking the time to help.
It's been a long time since I was digging into stuff this deep, last time it was the early versions of gentoo Linux on a thinkpad t21… I was well fed up, all those hours of compiling crap to no avail.

Danny

Synthesized Community Field Notes

6 technical responses curated from 10 original dispatches

Field Note #1 @andyvand 2011-01-03
That instruction patcher was designed by me.
You don't need to patch the kernel with it, you can use it to patch /usr/lib/libSystem.B.dylib and any other binaries (containing cpuid's).
From within terminal (install amd_insn_patcher from folder to /usr/bin first) you can use it like this:
amd_insn_patcher <input_file> <output_file>
mv <ouput_file> <input_file>
-> First command makes a patched version (output file is only created if instructions to patch are found) and the second command replaces the original file with the patched file.
amd_insn_patcher_ext is the same but with some extensions for patching up some SSE3 instructions to their SSE2 variants.
Hope this helps you...
Oh yeah, forgot to mention: after patching libSystem.B.dylib you need to update prebinding by running following command:
sudo update_dyld_shared_cache
Field Note #2 @fumoboy007 2011-01-03 ↳ Re: @danfloun
@danflounBut, how do I know which binaries need patching? I guess I don't, so am I supposed to try every single binary or just those such as QuickTime, safari iTunes etc?

Since you are using the new legacy kernel, on the fly CPUID patching is available by the kernel. So, you only need to patch:

/System/Library/QuickTime/QuickTimeComponents.component/Contents/MacOS/QuickTimeComponents

If you are running in 64-bit mode, also patch:

/usr/lib/libSystem.B.dylib
/usr/lib/dyld

I'm not sure about the dyld one but whatever; it doesn't hurt to patch it anyways.

Field Note #3 @fumoboy007 2011-01-03 ↳ Re: @danfloun
@danflounAnd when you say the _patcher_ext is for some extensions, by that do you mean kexts?

No, Andy is saying that amd_insn_patcher_ext contains some extra functionality

@andyvandfor patching up some SSE3 instructions to their SSE2 variants.
Field Note #4 @fumoboy007 2011-01-03

Also, since you have an AMD Athlon 64 X2 processor, you will probably need this too: AMD Dual-Core Optimizer for Snow Leopard (osx 86.co/f36/amd-dual-core-optimizer-for-snow-leopard-t6820/).

Field Note #5 @AVO-Electronics 2011-01-04 ↳ Re: @fumoboy007
@fumoboy007If you are running in 64-bit mode, also patch: /usr/lib/libSystem.B.dylib /usr/lib/dyld

Do not patch those two if you are presently running in x86 mode, it kills you're mac! :'(

ASUS Crosshair MCP590 SLI | AMD Athlon™ 64 X2 Dual-Core 6400+ 3.2GHz | CORSAIR XMS2 6400C4 4GB | GeForce 7300LE 256MB Poo Edition | WD Velociraptor SATAII 10,000rpm 150GB | WD Raptor SATAI 10,000rpm 74GB | SONY DVD±RW SATAI | Snow Leopard 10.6.x - Testing Legacy Kernel 10.6.5 V2

Field Note #6 @bcoco85 2012-09-12

im not really sure what this tool is for. what i can see in forums is that lets you have more than 4gb ram, and lets you fix some 32 bits apps when running in 64 bits (arch=i386 -force64)

there is a c file that contains this in the header
*
* instruction length decoder (written by kaitek, modified by mercurysquad)
* voodoo xnu kernel
*
* based on code from AntiHookExec 1.00, Copyright (c) 2004 Chew Keong TAN
* opcode tables based on documentation from sand pile.org/
*
* todo: * support for instruction set extensions newer than SSSE3
* * verify that VT instructions are correctly decoded
* AnV - Added better opcode + SSE4.1 + SSE4.2 support
*/
also, i found 2 versions of the same tool. both with the same header but different size

one doubt: if you path those files with this tool, does it lets you start with arch=x86_64 with a 10.6.8 legacy kernel?

Corroborated & Participated: @daksi99
Sources & Contributor Provenance (6 credited usernames · Thread #6845)
UsernameDossier ContributionDispatchesActive Window
@danflounPrimary Author32011-01-03 → 2011-01-04
@fumoboy007Core Contributor32011-01-03
@andyvandContributor12011-01-03
@AVO-ElectronicsContributor12011-01-04
@bcoco85Contributor12012-09-12
@daksi99Contributor12013-02-09

Choose your language