Re: [PATCH 0/1] x86_64: Fix stack aligment for x86-64 SysV ABI

2024-03-23 Thread Joel Sherrill
This is a great explanation. Would you mind filing a ticket with this
explanatino and referencing the ticket in the commit message of the patch?

When someone wonders about the change in the future, the ticket explanation
will be useful

On Fri, Mar 22, 2024 at 9:24 PM Matheus Pecoraro  wrote:

> I kept getting a general protection fault whenever attempting to
> execute the amd64 BSP while preparing for my GSOC proposal.
>
> The GPF was being caused by an instruction attempting to move an SSE
> register to an address on the stack not aligned to 16 bytes. After
> some debugging I noticed that the code for setting up the stack frame
> for a context would result in it being misaligned by 8 bytes as to
> what is expected by the x86-64 SysV ABI, thus leading the compiler to
> unknowingly cause the exception (when control is transferred to the
> function entry point RSP+8 is supposed to be a multiple of 16, without
> this patch RSP itself was a multiple of 16).
>
> After the fix I was able to run the hello test on the amd64 BSP both
> while booting through the FreeBSD bootloader with no EFI boot services
> as well as through GRUB with multiboot2 and EFI boot services.
>
> Matheus Pecoraro (1):
>   x86_64: Fix stack aligment for x86-64 SysV ABI
>
>  bsps/x86_64/amd64/clock/eficlock.c| 28 ++-
>  bsps/x86_64/amd64/start/start.S   |  1 -
>  .../cpu/x86_64/x86_64-context-initialize.c|  4 +--
>  3 files changed, 5 insertions(+), 28 deletions(-)
>
> --
> 2.43.0
> ___
> devel mailing list
> devel@rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
>
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

[PATCH] mqopen: Add support for 'mode' argument in mq_open

2024-03-23 Thread Abhinav Srivastava
Fixes #1977: Previously, the 'mode' argument in
`mq_open` was accepted but not utilized.
---
 cpukit/posix/src/mqueueopen.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/cpukit/posix/src/mqueueopen.c b/cpukit/posix/src/mqueueopen.c
index d01421a0c1..8f8c1c8634 100644
--- a/cpukit/posix/src/mqueueopen.c
+++ b/cpukit/posix/src/mqueueopen.c
@@ -154,6 +154,7 @@ mqd_t mq_open(
   POSIX_Message_queue_Control *the_mq;
   size_t   name_len;
   Objects_Get_by_name_errorerror;
+  mode_t   mode;
   mqd_tstatus;
 
   _Objects_Allocator_lock();
@@ -185,6 +186,7 @@ mqd_t mq_open(
 va_start( ap, oflag );
 va_arg( ap, mode_t );
 attr = va_arg( ap, const struct mq_attr * );
+mode = va_arg( ap, mode_t );
 va_end( ap );
 
 if ( attr == NULL ) {
@@ -196,7 +198,7 @@ mqd_t mq_open(
  *  checked. We should go ahead and create a message queue.
  */
 
-status = _POSIX_Message_queue_Create( name, name_len, oflag, attr );
+status = _POSIX_Message_queue_Create( name, name_len, oflag, attr, mode );
   } else {
 
 /*
-- 
2.34.1

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Re: [PATCH 0/1] x86_64: Fix stack aligment for x86-64 SysV ABI

2024-03-23 Thread Matheus Pecoraro
Thanks! Just for clarification, should I create a new ticket for this
specific bug and then add "Closes #" to the commit message?


On Sat, Mar 23, 2024 at 12:08 PM Joel Sherrill  wrote:

> This is a great explanation. Would you mind filing a ticket with this
> explanatino and referencing the ticket in the commit message of the patch?
>
> When someone wonders about the change in the future, the ticket
> explanation will be useful
>
> On Fri, Mar 22, 2024 at 9:24 PM Matheus Pecoraro 
> wrote:
>
>> I kept getting a general protection fault whenever attempting to
>> execute the amd64 BSP while preparing for my GSOC proposal.
>>
>> The GPF was being caused by an instruction attempting to move an SSE
>> register to an address on the stack not aligned to 16 bytes. After
>> some debugging I noticed that the code for setting up the stack frame
>> for a context would result in it being misaligned by 8 bytes as to
>> what is expected by the x86-64 SysV ABI, thus leading the compiler to
>> unknowingly cause the exception (when control is transferred to the
>> function entry point RSP+8 is supposed to be a multiple of 16, without
>> this patch RSP itself was a multiple of 16).
>>
>> After the fix I was able to run the hello test on the amd64 BSP both
>> while booting through the FreeBSD bootloader with no EFI boot services
>> as well as through GRUB with multiboot2 and EFI boot services.
>>
>> Matheus Pecoraro (1):
>>   x86_64: Fix stack aligment for x86-64 SysV ABI
>>
>>  bsps/x86_64/amd64/clock/eficlock.c| 28 ++-
>>  bsps/x86_64/amd64/start/start.S   |  1 -
>>  .../cpu/x86_64/x86_64-context-initialize.c|  4 +--
>>  3 files changed, 5 insertions(+), 28 deletions(-)
>>
>> --
>> 2.43.0
>> ___
>> devel mailing list
>> devel@rtems.org
>> http://lists.rtems.org/mailman/listinfo/devel
>>
>
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel