Re: [PATCH mig] Make MIG work for pure 64 bit kernel and userland.

2023-02-17 Thread Sergey Bugaev
> With this layout alignment issues seem much simpler to solve, basically > we can leave the compiler find the best combination for the second part > of the message, and if the user/kernel archs are the same, the struct > will have the same layout in the sending and receiving mig stubs. To be clea

Re: [PATCH mig] Make MIG work for pure 64 bit kernel and userland.

2023-02-16 Thread Luca Dariz
Hi Sergey, thanks a lot for the detailed explanation! Il 12/02/23 19:16, Sergey Bugaev ha scritto: But look at what Apple MIG does: typedef struct { mach_msg_header_t Head; /* start of the kernel processed data */ mach_msg_body_t msgh_body; mach_msg_port_descriptor_t port_a

Re: [PATCH mig] Make MIG work for pure 64 bit kernel and userland (V2)

2023-02-12 Thread Samuel Thibault
Flavio Cruz, le dim. 12 févr. 2023 12:49:44 -0500, a ecrit: > For the 64 bit / 32 bit configuration, we can pass --enable-user32 when > targeting x86_64, and MIG will generate stubs as before. I am unsure > whether there exists undefined behavior in that particular configuration > since most of the

Re: [PATCH mig] Make MIG work for pure 64 bit kernel and userland.

2023-02-12 Thread Flávio Cruz
On Sun, Feb 12, 2023 at 9:44 AM Samuel Thibault wrote: > Thanks for your work on the 64bit RPC part, that's tricky :) > > Flavio Cruz, le dim. 12 févr. 2023 01:15:05 -0500, a ecrit: > > diff --git a/cpu.sym b/cpu.sym > > index 6bcb878..7858b47 100644 > > --- a/cpu.sym > > +++ b/cpu.sym > > @@ -95

[PATCH mig] Make MIG work for pure 64 bit kernel and userland (V2)

2023-02-12 Thread Flavio Cruz
Made changes to MIG so that generated stubs can be compiled when using a 64 bit userland. The most important change here is to ensure that data is always 8-byte aligned. Not doing that will lead to undefined behavior since on 64 bits many structures can contain 64 bit scalars which require 8-byte a

Re: [PATCH mig] Make MIG work for pure 64 bit kernel and userland.

2023-02-12 Thread Flávio Cruz
On Sun, Feb 12, 2023 at 11:34 AM Luca wrote: > Il 12/02/23 17:05, Sergey Bugaev ha scritto: > > On Sun, Feb 12, 2023 at 7:01 PM Luca wrote: > >> It seems XNU's mig [0] always sets the alignment to natural_t (=4) with > >> a #pragma... I still have to understand how they handle these issues. > >

Re: [PATCH mig] Make MIG work for pure 64 bit kernel and userland.

2023-02-12 Thread Luca
Il 12/02/23 17:05, Sergey Bugaev ha scritto: On Sun, Feb 12, 2023 at 7:01 PM Luca wrote: It seems XNU's mig [0] always sets the alignment to natural_t (=4) with a #pragma... I still have to understand how they handle these issues. Please note that XNU uses "untyped messaging", and Apple's ver

Re: [PATCH mig] Make MIG work for pure 64 bit kernel and userland.

2023-02-12 Thread Sergey Bugaev
On Sun, Feb 12, 2023 at 7:01 PM Luca wrote: > It seems XNU's mig [0] always sets the alignment to natural_t (=4) with > a #pragma... I still have to understand how they handle these issues. Please note that XNU uses "untyped messaging", and Apple's version of MIG is "untyped MIG". They don't have

Re: [PATCH mig] Make MIG work for pure 64 bit kernel and userland.

2023-02-12 Thread Luca
Hi, Il 12/02/23 14:37, Luca ha scritto: Il 12/02/23 07:15, Flavio Cruz ha scritto: For the 64 bit / 32 bit configuration, we can pass --enable-user32 when targeting x86_64, and MIG will generate stubs as before. I am unsure whether there exists undefined behavior in that particular configuratio

Re: [PATCH mig] Make MIG work for pure 64 bit kernel and userland.

2023-02-12 Thread Samuel Thibault
Thanks for your work on the 64bit RPC part, that's tricky :) Flavio Cruz, le dim. 12 févr. 2023 01:15:05 -0500, a ecrit: > diff --git a/cpu.sym b/cpu.sym > index 6bcb878..7858b47 100644 > --- a/cpu.sym > +++ b/cpu.sym > @@ -95,8 +95,8 @@ expr MACH_MSG_TYPE_POLYMORPHIC > > > /* Types used in i

Re: [PATCH mig] Make MIG work for pure 64 bit kernel and userland.

2023-02-12 Thread Samuel Thibault
Hello, Flavio Cruz, le dim. 12 févr. 2023 01:15:05 -0500, a ecrit: > diff --git a/configure.ac b/configure.ac > index e4645bd..8d52d5f 100644 > --- a/configure.ac > +++ b/configure.ac > @@ -55,6 +55,13 @@ AC_SUBST([MIGCOM]) > [MIG=`echo mig | sed "$program_transform_name"`] > AC_SUBST([MIG]) >

Re: [PATCH mig] Make MIG work for pure 64 bit kernel and userland.

2023-02-12 Thread Luca
Il 12/02/23 07:15, Flavio Cruz ha scritto: Made changes to MIG so that generated stubs can be compiled when using a 64 bit userland. The most important change here is to ensure that data is always 8-byte aligned. Not doing that will lead to undefined behavior since on 64 bits many structures can

[PATCH mig] Make MIG work for pure 64 bit kernel and userland.

2023-02-11 Thread Flavio Cruz
Made changes to MIG so that generated stubs can be compiled when using a 64 bit userland. The most important change here is to ensure that data is always 8-byte aligned. Not doing that will lead to undefined behavior since on 64 bits many structures can contain 64 bit scalars which require 8-byte a