The patch to the if_cgem driver is actually a modified (to LibBSD style) 
backport of the
64bit cgem patch that's in 13. FreeBSD doesn't appear to care about ILP32 and 
that is
the majority of functional difference between the upstream and what is being 
applied
here.

Kinsey

-----Original Message-----
From: Chris Johns <chr...@rtems.org> 
Sent: Monday, March 8, 2021 20:04
To: Kinsey Moore <kinsey.mo...@oarcorp.com>; devel@rtems.org
Subject: Re: [PATCH v1 1/7] rtembsd: Fix alignment of allocations for 64bit

OK for 1 to 7 from me.

In regards to the if_ cgem driver, will any be posted up stream?

Chris

On 9/3/21 10:27 am, Kinsey Moore wrote:
> Alignment on 64bit hardware is strict in comparison to running in an
> emulator. This resolves an alignment exception when allocating memory on
> real hardware.
> ---
>  rtemsbsd/rtems/rtems-program.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/rtemsbsd/rtems/rtems-program.c b/rtemsbsd/rtems/rtems-program.c
> index 204ed248..370609d4 100644
> --- a/rtemsbsd/rtems/rtems-program.c
> +++ b/rtemsbsd/rtems/rtems-program.c
> @@ -479,12 +479,13 @@ rtems_bsd_program_alloc(size_t size, void *org_ptr)
>       void *ptr = NULL;
>       size_t size_with_list;
>       size_t size_alligned;
> +     size_t alignment = sizeof(void*);
>  
>       if (prog_ctrl != NULL) {
>               /* align the end to the next word address */
>               size_alligned = size;
> -             if ((size_alligned & 0x3) != 0) {
> -                     size_alligned = (size_alligned | 0x03) + 1;
> +             if ((size_alligned & (alignment - 1)) != 0) {
> +                     size_alligned = (size_alligned | (alignment - 1)) + 1;
>               }
>               size_with_list = size_alligned +
>                   sizeof(struct program_allocmem_item);
> 
_______________________________________________
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Reply via email to