Re: [PATCH 5/5 v2 gnumach] x86_64: add 64-bit syscall entry point

2023-03-02 Thread Samuel Thibault
Luca Dariz, le jeu. 02 mars 2023 14:54:51 +0100, a ecrit: > we could even sum up the discussion above with: > > : "memory" /* wrmsr is a Serializing Instruction, > * therefore we need serialization from the > * compiler

Re: [PATCH 5/5 v2 gnumach] x86_64: add 64-bit syscall entry point

2023-03-02 Thread Luca Dariz
Il 02/03/23 14:14, Samuel Thibault ha scritto: Luca Dariz, le jeu. 02 mars 2023 09:20:15 +0100, a ecrit: Il 02/03/23 09:00, Samuel Thibault ha scritto: Luca Dariz, le jeu. 02 mars 2023 08:55:38 +0100, a ecrit: Il 01/03/23 21:18, Samuel Thibault ha scritto: Luca Dariz, le mer. 01 mars 2023 18:

Re: [PATCH 5/5 v2 gnumach] x86_64: add 64-bit syscall entry point

2023-03-02 Thread Sergey Bugaev
On Thu, Mar 2, 2023 at 4:14 PM Samuel Thibault wrote: > Ok, then perhaps > > "memory" /* wrmsr usage needs serialization from the compiler too */ How about /* wrmsr may cause a read from memory, so make the compiler flush any changes */ Sergey

Re: [PATCH 5/5 v2 gnumach] x86_64: add 64-bit syscall entry point

2023-03-02 Thread Samuel Thibault
Luca Dariz, le jeu. 02 mars 2023 09:20:15 +0100, a ecrit: > Il 02/03/23 09:00, Samuel Thibault ha scritto: > > Luca Dariz, le jeu. 02 mars 2023 08:55:38 +0100, a ecrit: > > > Il 01/03/23 21:18, Samuel Thibault ha scritto: > > > > Luca Dariz, le mer. 01 mars 2023 18:40:37 +0100, a ecrit: > > > > > +

Re: [PATCH 5/5 v2 gnumach] x86_64: add 64-bit syscall entry point

2023-03-02 Thread Luca Dariz
Il 02/03/23 09:00, Samuel Thibault ha scritto: Luca Dariz, le jeu. 02 mars 2023 08:55:38 +0100, a ecrit: Il 01/03/23 21:18, Samuel Thibault ha scritto: Luca Dariz, le mer. 01 mars 2023 18:40:37 +0100, a ecrit: +asm volatile("wrmsr" + : + : "c" (regaddr), "a"

Re: [PATCH 5/5 v2 gnumach] x86_64: add 64-bit syscall entry point

2023-03-02 Thread Samuel Thibault
My, should have re-read... Samuel Thibault, le jeu. 02 mars 2023 09:00:40 +0100, a ecrit: > I'm not saying it's not a serializing instruction. > > I'm saying that the compiler does not have to *care* about the > instruction being serializing. > > But I'm also saying that the very reason why the

Re: [PATCH 5/5 v2 gnumach] x86_64: add 64-bit syscall entry point

2023-03-02 Thread Samuel Thibault
Luca Dariz, le jeu. 02 mars 2023 08:55:38 +0100, a ecrit: > Il 01/03/23 21:18, Samuel Thibault ha scritto: > > Luca Dariz, le mer. 01 mars 2023 18:40:37 +0100, a ecrit: > > > +asm volatile("wrmsr" > > > + : > > > + : "c" (regaddr), "a" (low), "d" (high) > > > +

Re: [PATCH 5/5 v2 gnumach] x86_64: add 64-bit syscall entry point

2023-03-01 Thread Luca Dariz
Il 01/03/23 21:18, Samuel Thibault ha scritto: Luca Dariz, le mer. 01 mars 2023 18:40:37 +0100, a ecrit: +asm volatile("wrmsr" + : + : "c" (regaddr), "a" (low), "d" (high) + : "memory" /* wrmsr is a serializing instruction */ The comment cou

Re: [PATCH 5/5 v2 gnumach] x86_64: add 64-bit syscall entry point

2023-03-01 Thread Samuel Thibault
Luca Dariz, le mer. 01 mars 2023 18:40:37 +0100, a ecrit: > +asm volatile("wrmsr" > + : > + : "c" (regaddr), "a" (low), "d" (high) > + : "memory" /* wrmsr is a serializing instruction */ The comment could be misleading. The fact that it's a ser

[PATCH 5/5 v2 gnumach] x86_64: add 64-bit syscall entry point

2023-03-01 Thread Luca Dariz
While theoretically we could still use the same call gate as for 32-bit userspace, it doesn't seem very common, and gcc seems to not encode properly the instruction. Instead we use syscall/sysret as other kernels (e.g. XNU,Linux). This version still has some limitations, but should be enough to sta