How would undocummented, private ISA extensions work in Linux-based systems?

By: Chester (lamchester.delete@this.gmail.com), October 19, 2022 12:11 pm
Room: Moderated Discussions
Ana Rodriguez (ana_rodriguez_riano.delete@this.protonmail.com) on October 19, 2022 11:12 am wrote:
> If someone were to build a Linux system with proprietary, private (undocumented) ISA extensions, how would they
> do it given Linux is open source? Are there any examples of this being done? Would it be possible at all?
>
> I got inspiration from this (https://github.com/corsix/amx) and I wondered if someone has done
> it before on a Linux-based system. I understand a userspace library could be created to access
> those instructions from userspace, but how would then they be implemented in the kernel? Through
> a proprietary kernel module built using a custom compiler? Or is that not needed at all and the
> library could just run on the processor taking advantage of the proprietary extensions?

If the instructions don't create any extra state that the kernel needs to save or be aware of, then you could use the instructions in userspace without any modification to the kernel. However, if you need the kernel to save extra state, you do need a kernel change.

Example of something that doesn't need a kernel change: MMX. Intel specifically aliased the MMX registers to the x87 ones, so an OS doesn't even need to know that MMX is supported. It saves the x87 registers on a context switch, and by doing so it would also save the MMX registers (because ST0-7 == MM0-7).

Example of something that does need a kernel change: SSE. SSE adds a set of separate vector/FP registers (xmm regs). The kernel has to save and restore those on a context switch, and thus needs a change.

In Apple AMX's case, they introduce an extra 80 registers, each of which are 64 bytes wide. The kernel needs to save and restore these on a context switch. So, you need a kernel change.
< Previous Post in ThreadNext Post in Thread >
TopicPosted ByDate
How would undocummented, private ISA extensions work in Linux-based systems?Ana Rodriguez2022/10/19 11:12 AM
  How would undocummented, private ISA extensions work in Linux-based systems?Chester2022/10/19 12:11 PM
    How would undocummented, private ISA extensions work in Linux-based systems?Doug S2022/10/19 12:22 PM
    How would undocummented, private ISA extensions work in Linux-based systems?Ana Rodriguez2022/10/19 01:20 PM
      How would undocummented, private ISA extensions work in Linux-based systems?Ana Rodriguez2022/10/19 01:27 PM
        How would undocummented, private ISA extensions work in Linux-based systems?nksingh2022/10/19 02:05 PM
          How would undocummented, private ISA extensions work in Linux-based systems?Ana Rodriguez2022/10/19 02:35 PM
            How would undocummented, private ISA extensions work in Linux-based systems?Geoff Langdale2022/10/19 05:15 PM
              How would undocummented, private ISA extensions work in Linux-based systems?Chester2022/10/20 12:01 PM
        How would undocummented, private ISA extensions work in Linux-based systems?---2022/10/19 07:01 PM
        How would undocummented, private ISA extensions work in Linux-based systems?Doug S2022/10/19 10:08 PM
        How would undocummented, private ISA extensions work in Linux-based systems?Eric Fink2022/10/20 04:10 AM
Reply to this Topic
Name:
Email:
Topic:
Body: No Text
How do you spell tangerine? ūüćä