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

Make it work in modern kernels #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Spacefish
Copy link

not sure if it works :)

@volagtik
Copy link

not sure if it works :)

): it does not, for me at least. Errors are the same, just on different lines, in functions ‘fh_ftrace_thunk’ and ‘fh_install_hook’ in trap_hook.c file. It's all way above my skill, but I might get it if someone explains. Mind taking a look-see?
opemu-spacefish-errors.txt

@zhubr
Copy link

zhubr commented Feb 19, 2024

You need to add a specialized hook in the kernel and then arrange the module so as to employ it. Not sure why such hook is not readily available in regular kernels, but the patch to add it is quite straightforward, and apparently it is the only reliable way to do it nowadays. Please see attachment that works fine for me. Besides, I've found and fixed some small bugs in opcode processing but because the main repo looks like abandoned I'm not sure where to push the fixes yet. The attached patch is targeted for regular kernel 5.15.146.

unlock_opcode_emu.txt

@blogdron
Copy link

blogdron commented Mar 1, 2024

Ooops. op_emu legal??????????????????
TL;DR
1- op_emu under GPLv2 License
2- op_emu take code from xnu-amd repo
3- xnu-amd under ASPL2.0 License
4- ASPL2.0 not compatibility with GPLv2 op_emu module use linux GPL symbols.... wtf :D
https://www.gnu.org/philosophy/apsl.html

just noticed this inconsistency, lol . Or I mistake?

WTF

@zhubr
Copy link

zhubr commented Mar 1, 2024

I'm definitely not a lawyer, but after browsing through some relevant headers and license files, I'd say it looks like attaching the GPL was incorrect here. This certainly does NOT make the code itself illegal, as it is a fork of some master tree that obviously allowed forking by its license. Therefore, it might be problematic to e.g. include this module as a part of some distribution product or to upstream it. But other than that, I basically see no problem. Just apply appropriate correction to the license file and that's it.

@blogdron
Copy link

blogdron commented Mar 1, 2024

@zhubr maybe but no, 1 author have ASPL but @mirh lisense own code under GPLv2. I no can change license back to ASPL because code in this project have code from @mirh.

At the moment, code from two authors under incompatible licenses is mixed in one project. You can’t just take your previous license and return it. The code is mixed. I'm deleting my fork and all my work. If anyone needs changes, they are saved in a closed merge request. It's a pity. But okay.

@mirh
Copy link
Owner

mirh commented Mar 1, 2024

Not sure what's funnier.. That I wasn't subscribed to my own repo, or that my hunger for pedantry (that brought me into spending big time to find the credits for every single line) somehow made the code turn out unproperly copyrighted.
Anyhow, I don't really think there is any big deal (except perhaps having to remove the LICENSE file).

Even if the standard terms applied (which I don't really think is the case, even though it's not explicitly stated anywhere) you can mix whatever you want with GPL as long as you aren't shipping the actual binaries that "physically" bind together the different object code.
Hopefully @kalifans @sinetek @andyvand can clarify and WTFPLify their thing.

@blogdron
Copy link

blogdron commented Mar 1, 2024

Not sure what's funnier.. That I wasn't subscribed to my own repo

:D

@zhubr
Copy link

zhubr commented Mar 2, 2024

Not sure what's funnier.. That I wasn't subscribed to my own repo, or that my hunger for pedantry (that brought

Hi! I'll use this opportunity to say tons of thanks for publishing this module! It lets me run Android x86_64 image on an old Core2 laptop which would otherwise be impossible because of some few opcodes missing. And BTW I'd like to give back a small usermode test and some bugfixes :)

@mirh
Copy link
Owner

mirh commented Mar 3, 2024

It's not even mine actually (I probably broke it more than I fixed), it was originally from a brazilian guy. Which AFAIR was exactly like trying to do something with android (on an athlon or core 2), but then upgraded his system and lost interest.

But speaking of that.. I knew @maurossi used to ship a hacked up workaround at least in the past. Idk what has been of it?

@philmb3487
Copy link

Hello everyone. I am the original author of this code. My part of it is MIT licensed.
Any questions?

@blogdron
Copy link

blogdron commented Mar 3, 2024

@sinetek Hello. Thank you for your response. On this repo https://github.com/sinetek/xnu-amd license is ASPL 2.0.

Any questions?

@mirh (and we all) can use GPLv2 for this repo https://github.com/mirh/opemu-linux ?

My part of it is MIT licensed.

This files (exclude libudis86 BSD 2 Closure sub-project) https://github.com/sinetek/xnu-amd/tree/master/osfmk/OPEMU not marked as MIT
if files

real under MIT maybe you as author can add MIT notice license in this files (or in LICENSE file )? Because if no have license notice on another file or in source files, all this files licensed under global project license -> ASPL 2.0

Sorry for my English. I hope you understand me :)

Maybe someone else will say something else about this.
The idea is simple, have unambiguous licenses for files. To develop a kernel module as MIT or/and GPLv2 .
Now without notice about MIT you code under ASPL 2.0... it okeyy but Im(and all others peoples) for example no can legal give to my friend binary module for Linux kernel :)

Maybe i just stupid i don't know :D

@mirh
Copy link
Owner

mirh commented Mar 4, 2024

On this repo https://github.com/sinetek/xnu-amd license is ASPL 2.0.

The mac kernel is licensed with that, yes. But his modifications are MIT licensed, so we are good (and udis86 is licensed with BSD-2, so ditto).

So, the only things left is how much of Copyright © 2019 Meowthra was brought in to modify that (but we could even lowkey assume that's GPL, since it was eventually meant to fit into a kernel module), and finding what's the situaiton with AnV's work I brought in with d2610de

@philmb3487
Copy link

These licenses should all be compatible, with the notable exception of GPL, but I don't see how the GPL is relevant here?

@zhubr
Copy link

zhubr commented Mar 5, 2024

These licenses should all be compatible, with the notable exception of GPL, but I don't see how the GPL is relevant here?

It is (GPL 2.0) present in the topmost LICENSE file of this repository, causing some confusion and panic to people.

@mirh
Copy link
Owner

mirh commented Mar 5, 2024

And it's the expected license of compiled linux modules.

@zhubr
Copy link

zhubr commented Mar 5, 2024

And it's the expected license of compiled linux modules.

Well, if you intend to ship/share this module in binary form, yes. But imho this is becoming increasingly unlikely for a number of reasons anyway. Otherwise, for just publishing your module source, the license can be just anything (afaik).

@philmb3487
Copy link

And it's the expected license of compiled linux modules.

Well, if you intend to ship/share this module in binary form, yes. But imho this is becoming increasingly unlikely for a number of reasons anyway. Otherwise, for just publishing your module source, the license can be just anything (afaik).

That's nonsense. NVIDIA's drivers do not ship GPL for example

@blogdron
Copy link

blogdron commented Mar 7, 2024

Since it turned out that the files written by @sinetek are under the MIT license, as he said, then using only them in this project does not affect the code under ASPL 2.0 and therefore the current GPLv2 license that @mirh chose for his changes does not cause any problems. So everything is fine and I panicked in vain. The only thing is that there is no mention of MIT in the files listed above, and if @sinetek allows (after all, he wrote the code), then the text of the MIT license could be added to these files, this would solve all the theoretical problems. Since the license cannot be implied, it must be explicit and explicitly stated. Yes, sometimes it’s just unnecessary bureaucracy. And we're all here for the fun.

Sorry if my remark on licensing caused discomfort for someone :D

The point is that I thought that the current GPL project contained code under ASPL, but judging by the author's response, this is not the case. So there are no problems.

@philmb3487
Copy link

philmb3487 commented Mar 12, 2024 via email

@blogdron
Copy link

He can do that for his work, but I don't think he can relicense my whole project.?

No one has the right to license someone else's code except the author. Licenses can only be compatible and different code under different licenses can exist in one project licensed as a work under any license compatible with all other licenses. At the moment, some licenses are not indicated explicitly in the text, but only indirectly in words.
At the same time, the words are one thing, but the text of the project licenses is another.

As a result, everything got confused. I can use code under the MIT license in my project under the GPL license, for example, but this does not mean that I relicense the MIT code under the GPL license, it means that the project as a whole is under the GPL, but part of the code is under the MIT license, this is possible because the licenses are compatible. That's all.

The problem is that the code under ASPL is incompatible with the GPL, and the words that your changes are under MIT (this solves all problems) are just words and the text of the license for your code is not explicitly indicated, this creates confusion.

  • 1 The license, if any, must be attached to the code
  • 2 Licenses within one project must be compatible
  • 3 The author can give another project a different license if he wants
  • 4 Anyone who took someone else's code under a different license does not have the right to change the license, but can use the code under any compatible license.

I'm not a lawyer. These are just my thoughts.

Above I listed the files used in this project, if the author of these files claims that they are under MIT, and not under ASPL, then there are no problems and you just need to add the license text and the author’s copyright to these files, otherwise everything is ambiguous.

I will not speak further on this matter. I think everything is clear to everyone.

@volagtik
Copy link

@zhubr, since it doesn't seem to be illegal, could you please help me build it? I've patched the kernel to add the hook but have no idea what it is or how to arrange the module so as to employ it.
Trying to build it on a 32bit SSE2 Pentium M with patched kernel:
opemu-spacefish-errors-patched.txt

@zhubr
Copy link

zhubr commented Mar 17, 2024

@zhubr, since it doesn't seem to be illegal, could you please help me build it? I've patched the kernel to add the hook but have no idea what it is or how to arrange the module so as to employ it. Trying to build it on a 32bit SSE2 Pentium M with patched kernel

When using a patched kernel (with setup_invalid_op_handler function added) you can apply the following patch to this module:

trap_hook.txt

@volagtik
Copy link

When using a patched kernel (with setup_invalid_op_handler function added) you can apply the following patch to this module:

trap_hook.txt

Thanks, that fixed that, but now I have an error in opemu.c:254 *where = ss64 -> r8; about struct pt_regs not having members named r8 to r15.
Is it even supposed to work on 32bit arch?
opemu_c-error.txt

@zhubr
Copy link

zhubr commented Mar 19, 2024

Thanks, that fixed that, but now I have an error in opemu.c:254 *where = ss64 -> r8; about struct pt_regs not having members named r8 to r15. Is it even supposed to work on 32bit arch? opemu_c-error.txt

I haven't tried in 32-bit. Some details in the sources suggest that it was likely possible at some point. Moreover, 64-bit registers support in current version is actually incomplete and somewhat buggy. Some ifdefs might be necessary.

I'd still like to hear if @mirh is interested in PRs and patches to this repository and willing to fix GPL/ASPL confusion by either updating the top LICENSE file or inserting license headers to individual source files so as to clear any subsequent doubts. Or, if not, maybe I'll clone and try to fix it myself (but no promises).

@mirh
Copy link
Owner

mirh commented Mar 21, 2024

FWIW I can even add you to the project.. I try to even stay away from linux these days, and it's not like even back then I understood much about registers and opcodes.

As for the license, I just realized that we've had a problem here. We couldn't just wave away Meowthra's code because he literally wrote "all rights reserved" (which I guess legally isn't much different from just any generic copyright notice, but practically it rules out any other alternative good faith interpretation)

@zhubr
Copy link

zhubr commented May 5, 2024

Ok, if you are not really interested in maintaining this project anymore, I think I'll better just clone the repository. I'll then eventually try to insert the missing license headers where possible or maybe remove some files. AFAICS as compared to xnu-amd there were 4 new files introduced: fpins.*, sse41.c, trap_hook.c. Those 4 files are either unnecessary for my specific needs or have to be completely redesigned anyway.

@mirh
Copy link
Owner

mirh commented May 7, 2024

Maintaining would be doable (even though @saviosg is certainly more qualified than me)
But aside of the 4 brand new added files, there's much more that was changed in the others.
Even though I guess only fpins and trap_ho

opemu-linux/trap_hook.c

Lines 24 to 26 in 4a56f54

MODULE_DESCRIPTION("Intel Instruction set Emulation");
MODULE_AUTHOR("Meowthra");
MODULE_LICENSE("GPL");

Oh, come on. It was eventually all navel gazing for nothing.

@zhubr
Copy link

zhubr commented May 8, 2024

Oh, come on. It was eventually all navel gazing for nothing.

Ok. Thank you again for your work anyway :)

@megatog615
Copy link

broken again here on kernel 6.11.9

@philmb3487
Copy link

Can I ask what you are using the opemu for? :-)
I never expected this would be useful actually, how can I help?

@blogdron
Copy link

@philmb3487

Can I ask what you are using the opemu for? :-)

For example, running video game Black Mesa on Phenom II CPU

Many processors are old, but they perform their tasks remarkably well, are reliable and often better than even new, budget ones. Sometimes people make software builds with the inclusion of instructions that are not in the old processor, often these instructions do nothing but simply break backward compatibility. The only goal of the opemuu is to make it possible to run software on processors that do not have the necessary instructions, there can be many options here.

Sometimes emulation of instructions does not make sense, since the speed of the program drops catastrophically. But this is far from always the case, as I said above, often these are just useless instructions that, for example, only in one place of the program do the addition of several numbers at a time and that's it.

@blogdron
Copy link

blogdron commented Nov 25, 2024

@megatog615

Please show you error messages. Not working build or not working module? Applications not start?
If modue build and loaded.

  1. open terminal and run dmesg -w
  2. build op_emu
    2.1 if not building show errors (maybe try build with gcc-10)
  3. load op_emu sudo insmod ./op_emu.ko
  4. start some application with illegal instructions on you CPU
  5. If you see traps messages show dmesg log from dmesg -w

op_emu detect not implemented instructions and show it in dmesg log

Im have local fork same this repo + this pull request path (for local home experiments).
Build on Linux gnu 6.11.4-amd64 fine. Now I test it on Black Mesa. All working.

Maybe you need just rebuild you old module for you current Linux 6.11.9 or restart PC and select previous kernel.
If you update Kernel you need rebuild op_emu

@megatog615
Copy link

Using spacefish's repository, building the project fails with many errors.
makeoutput.txt

@blogdron
Copy link

@megatog615

Im trying fix errors

@philmb3487
Copy link

philmb3487 commented Nov 27, 2024

That's amazing, thanks for the explanation. Maybe it would make sense to separate the GCC fixes (various casts of address fields, fixes of the spacing and so on) from the addition of PMAXUD (AVX, AVX2, AVX-512 did not exist when I wrote this). But idk, you decide

@blogdron
Copy link

@philmb3487 Oh, need time for it, no have time now :(

@kukabu
Copy link

kukabu commented Nov 27, 2024

@blogdron
Sadly, it's not works for me
Half-life 2 runs but hangs with https://gist.github.com/kukabu/1f78d63d90a268bd328bd96774d4bd9b
Blender gets "Segmentation fault (core dumped)"

@blogdron
Copy link

blogdron commented Nov 27, 2024

@kukabu :(

I must have done something wrong. I need to figure it out. I'll try, but I don't have much experience.
Im try running HL2 (need download)

If I understand correctly the problem is in palignr

it's hard for me to understand what's going on there. I'm stupid :)

@blogdron
Copy link

@kukabu Hello Again, I no sure my changes in palign correctly but HL2 (With big game update) now is working

Im download game and make play test on HL2:Episode 2 all works file on Phenom2 X6 1050T

But before pull request to @Spacefish or to this repo need more inspacts the code correctly, maybe latter. I'll leave everything like this for now.

@kukabu
Copy link

kukabu commented Nov 28, 2024

Hello
Now HL2 runs, but when I try to play gets segfault.
CPU: A6-3650

@blogdron
Copy link

blogdron commented Dec 2, 2024

@philmb3487

Hello opemu original author, you say

Hello everyone. I am the original author of this code. My part of it is MIT licensed.

Im can add The MIT License text in

Im have my local home fork for experiments, and Im create CREDITS file with all authors and all know changes, my home repo not on github but this CREDITS file ,

===============================================================================

   Hello! This file for save history, authors information, contacts and other
   useful information, if you create local fork or just make changes please
   add information what you change or create, add you copiright info and
   add you contact information e-mail or some public profile. Thanks :)

===============================================================================

    OPEMU-LINUX TRAP_HOOK KERNEL MODULE
    ------------------------------------------------------------
             GNU GENERAL PUBLIC LICENSE Version 2
    ------------------------------------------------------------
    Copyright © 2019 Meowthra <>

    ::: Created - trap_hook.c
    ::: Created - fpins.c
    ::: Created - fpins.h

    Original Author: trap_hook
    Hooking kernel functions using ftrace framework
    Copyright © 2018 ilammy <>

    Origin: https://github.com/ilammy/ftrace-hook/tree/master

===============================================================================

    OPEMU OPCODE EMULATOR
    -------------------------------------------------------------
                      ??????  The MIT License ??????
    https://github.com/mirh/opemu-linux/pull/1#issuecomment-1974967578
    http://web.archive.org/web/20241202092907/https://github.com/mirh/opemu-linux/pull/1
    -------------------------------------------------------------
    Copyright © 2012-2023 SINETEK    <philmb3487@proton.me>
    Copyright © 2012-2023 ANV        <>
    Copyright © 2012-2023 BRONZIVKA  <>

    ::: Created - opemu.c
    ::: Created - opemu.h
    ::: Created - opemu_math.c
    ::: Created - opemu_math.h
    ::: Created - sse3.c
    ::: Created - sse3_priv.h
    ::: Created - sse42.c
    ::: Created - ssse3.c
    ::: Created - ssse3_priv.h

   Origin: https://github.com/philmb3487/xnu-amd/tree/master/osfmk/OPEMU

===============================================================================

    LIBUIDS86 LIBRARY
    ------------------------------------------------------------
              BSD 2-Clause "Simplified" License
    ------------------------------------------------------------
    Copyright (c) 2002-2012, Vivek Thampi <vivek.mt@gmail.com>

    ::: Created - libuids86/*.c
    ::: Created - libuids86/*.h

    Created library libuids86, this library used as subproject
    for opemu-linux kernel module see libuids86/LICENSE file

    Origin: https://github.com/vmt/udis86/tree/master

===============================================================================

    Copyright (c) 2019 saviosg <https://github.com/saviosg>

    ::: Create - Makefile
    ::: Combine into project all first files

    * Create first commit to opemu-linux kernel module with all project files
      to main repo https://github.com/mirh/opemu-linux

===============================================================================

    Copyright (c) 2020 mirh <https://github.com/mirh>
    Copyright (c) 2020 Andy Vandijck <>

    ::: Modifed - opemu.c
    ::: Modifed - opemu.h
    ::: Modifed - sse3.c
    ::: Modifed - sse42.c
    ::: Modifed - ssse3.c
    ::: Modifed - ssse3_priv.h

    * Create changes for POPCNT and CRC32
    * Create main repo https://github.com/mirh/opemu-linux

===============================================================================

    Copyright (c) 2023 Spacefish <timo.witte@gmail.com>

    ::: Modifed - fpins.c
    ::: Modifed - sse41.c
    ::: Modifed - ssse3_priv.h

    * Created changes for build on modern Linux kernels

===============================================================================

    Copyright (c) 2023-2024 Fedor Elizarov <blogdron@gmail.com>

    ::: Modifed - sse3.c
    ::: Modifed - sse41.c
    ::: Modifed - sse42.c
    ::: Modifed - ssse3.c
    ::: Modifed - ssse3_priv.h
    ::: Rewrite - Makefile
    ::: Create  - CREDITS

    * Restructure project files
    * Add implements pmaxud and pminud opcodes
    * Reimplement some opcodes in sse41.c
    * Fix build with gcc-14, type casts
===============================================================================

I think I have completely figured out what the project consists of, I realized that there are no licensing issues. The last touch, I would like to clearly indicate the license in the main file of your part of this project. Can you help me do this? I just want to clearly indicate you as the author and clearly indicate your license. After that, there will be no questions about the project as a whole and it will be able to live on :)

Based on your words above I could simply make a change to specify your license, but I would still ask for your additional permission to specify the text of this license for the opemu project files.

:)

@mirh
Copy link
Owner

mirh commented Dec 2, 2024

That's.. certainly some commitment, but that "All rights reserved" notice is such an eyesore if you ask to me.

@blogdron
Copy link

blogdron commented Dec 2, 2024

@mirh Im just copy-paste from headers, fixed " Copyright (c)" same sense.
I hope I wrote everything correctly and no one forgot

Some initial sources and their authors had to be searched for on the net.

I don't have a goal to describe in detail who did what, I just wanted an information file from which it is clear that this is the brainchild of different pieces, different people and with different compatible licenses that you combined into one specific project. Now it is clear that the project consists of three things, an opcode decoder, an opcode emulator and a kernel module, the project is based on the module, the rest are its functional parts. Well, I gave myself the freedom to write briefly about the changes. That's all.

Now everything looks clear and transparent, you can improve the module and even suggest including it in the Linux kernel :D

Maybe all this is unnecessary, but I wrote it rather for my own peace of mind, so that I would not think about licenses and rights. And just change the code as I want and share it with whoever I want. =) Previously, I had uncertainty.

@megatog615
Copy link

Wait, does this not emulate SSE2?

@philmb3487
Copy link

philmb3487 commented Dec 3, 2024

@philmb3487

Hello opemu original author, you say

Hello everyone. I am the original author of this code. My part of it is MIT licensed.

Im can add The MIT License text in

Im have my local home fork for experiments, and Im create CREDITS file with all authors and all know changes, my home repo not on github but this CREDITS file ,

===============================================================================

   Hello! This file for save history, authors information, contacts and other
   useful information, if you create local fork or just make changes please
   add information what you change or create, add you copiright info and
   add you contact information e-mail or some public profile. Thanks :)

===============================================================================

    OPEMU-LINUX TRAP_HOOK KERNEL MODULE
    ------------------------------------------------------------
             GNU GENERAL PUBLIC LICENSE Version 2
    ------------------------------------------------------------
    Copyright © 2019 Meowthra <>

    ::: Created - trap_hook.c
    ::: Created - fpins.c
    ::: Created - fpins.h

    Original Author: trap_hook
    Hooking kernel functions using ftrace framework
    Copyright © 2018 ilammy <>

    Origin: https://github.com/ilammy/ftrace-hook/tree/master

===============================================================================

    OPEMU OPCODE EMULATOR
    -------------------------------------------------------------
                      ??????  The MIT License ??????
    https://github.com/mirh/opemu-linux/pull/1#issuecomment-1974967578
    http://web.archive.org/web/20241202092907/https://github.com/mirh/opemu-linux/pull/1
    -------------------------------------------------------------
    Copyright © 2012-2023 SINETEK    <philmb3487@proton.me>
    Copyright © 2012-2023 ANV        <>
    Copyright © 2012-2023 BRONZIVKA  <>

    ::: Created - opemu.c
    ::: Created - opemu.h
    ::: Created - opemu_math.c
    ::: Created - opemu_math.h
    ::: Created - sse3.c
    ::: Created - sse3_priv.h
    ::: Created - sse42.c
    ::: Created - ssse3.c
    ::: Created - ssse3_priv.h

   Origin: https://github.com/philmb3487/xnu-amd/tree/master/osfmk/OPEMU

===============================================================================

    LIBUIDS86 LIBRARY
    ------------------------------------------------------------
              BSD 2-Clause "Simplified" License
    ------------------------------------------------------------
    Copyright (c) 2002-2012, Vivek Thampi <vivek.mt@gmail.com>

    ::: Created - libuids86/*.c
    ::: Created - libuids86/*.h

    Created library libuids86, this library used as subproject
    for opemu-linux kernel module see libuids86/LICENSE file

    Origin: https://github.com/vmt/udis86/tree/master

===============================================================================

    Copyright (c) 2019 saviosg <https://github.com/saviosg>

    ::: Create - Makefile
    ::: Combine into project all first files

    * Create first commit to opemu-linux kernel module with all project files
      to main repo https://github.com/mirh/opemu-linux

===============================================================================

    Copyright (c) 2020 mirh <https://github.com/mirh>
    Copyright (c) 2020 Andy Vandijck <>

    ::: Modifed - opemu.c
    ::: Modifed - opemu.h
    ::: Modifed - sse3.c
    ::: Modifed - sse42.c
    ::: Modifed - ssse3.c
    ::: Modifed - ssse3_priv.h

    * Create changes for POPCNT and CRC32
    * Create main repo https://github.com/mirh/opemu-linux

===============================================================================

    Copyright (c) 2023 Spacefish <timo.witte@gmail.com>

    ::: Modifed - fpins.c
    ::: Modifed - sse41.c
    ::: Modifed - ssse3_priv.h

    * Created changes for build on modern Linux kernels

===============================================================================

    Copyright (c) 2023-2024 Fedor Elizarov <blogdron@gmail.com>

    ::: Modifed - sse3.c
    ::: Modifed - sse41.c
    ::: Modifed - sse42.c
    ::: Modifed - ssse3.c
    ::: Modifed - ssse3_priv.h
    ::: Rewrite - Makefile
    ::: Create  - CREDITS

    * Restructure project files
    * Add implements pmaxud and pminud opcodes
    * Reimplement some opcodes in sse41.c
    * Fix build with gcc-14, type casts
===============================================================================

I think I have completely figured out what the project consists of, I realized that there are no licensing issues. The last touch, I would like to clearly indicate the license in the main file of your part of this project. Can you help me do this? I just want to clearly indicate you as the author and clearly indicate your license. After that, there will be no questions about the project as a whole and it will be able to live on :)

Based on your words above I could simply make a change to specify your license, but I would still ask for your additional permission to specify the text of this license for the opemu project files.

:)

Yes, do what you want with it, it's fine.

@megatog615 No, SSE2 is a requirement of AMD64, so I never found it necessary to add support for SSE2.. Apple switched to intel processors around the time when pure i386 chips disappeared, and it was just never really needed.
Intel likes playing with instruction set extensions, so while AMD chips supported the SSE4 instruction set, some instructions were added and branded "4.2", and AMD only added support for these in the Bulldozer series, which wasn't very popular, most people were on Phenoms. Today that's still the case, intel is adding AVX-512, AVX2, while AMD mostly lags behind with support for these, prefering to focus on cache design and other stuff.

Apple's early OS on intel had a crazy setup... AMD64 was a requirement for the OS, but the machine only supported a strange version of 32-bit UEFI, and could not boot a 64-bit kernel. So the kernel was entirely 32-bit, but the userspace would run in 64-bit. That caused trouble on AMD because the system-call entry/exit mechanism works differently. So it wasn't just SSE4 that needed emulating because the entire system-call interface wasn't working on AMD chips.
So initially the people running AMD chips w/ mac OS were stuck on pure i386 mac OS versions. Eventually that became impossible because some critical tasks were moved to 64-bit code only (they would crash). For a while we were binary patching things, but that was hard as well and eventually 32-bit binaries in the OS would just be removed completely ....

@philmb3487
Copy link

I didn't invent the idea of the opemu, I read a paper about an implementation of it for mac os that was written in assembly language. I never found the original code, but based on the research paper the basic idea of using an opcode trap the idea was clear enough.
Anv, bronzovka, others did most of the work of patching bugs and adding remaining support for edge cases and whatnot.
It would be interesting to find that research paper.

@blogdron
Copy link

blogdron commented Dec 3, 2024

@philmb3487

Thank you

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

Successfully merging this pull request may close these issues.

8 participants