AW: [PATCH 3/3] i386: Port to RTEMS

Jan.Sommer at dlr.de Jan.Sommer at dlr.de
Wed Feb 5 08:51:32 UTC 2020



> -----Ursprüngliche Nachricht-----
> Von: Sebastian Huber [mailto:sebastian.huber at embedded-brains.de]
> Gesendet: Dienstag, 4. Februar 2020 17:15
> An: rtems-devel at rtems.org
> Cc: Sommer, Jan
> Betreff: Re: [PATCH 3/3] i386: Port to RTEMS
> 
> On 31/01/2020 18:26, Jan Sommer wrote:
> 
> > diff --git a/freebsd/sys/sys/mbuf.h b/freebsd/sys/sys/mbuf.h
> > index ba2e1873..95058e36 100644
> > --- a/freebsd/sys/sys/mbuf.h
> > +++ b/freebsd/sys/sys/mbuf.h
> > @@ -348,6 +348,7 @@ struct mbuf_ext_pgs {
> >   	vm_paddr_t	pa[MBUF_PEXT_MAX_PGS];	/* phys addrs of pages
> */
> >   	char		hdr[MBUF_PEXT_HDR_LEN];	/* TLS header */
> >   	struct ktls_session *tls;		/* TLS session */
> > +#ifndef __rtems__
> >   #if defined(__i386__) || \
> >       (defined(__powerpc__) && !defined(__powerpc64__) &&
> defined(BOOKE))
> >   	/*
> > @@ -356,6 +357,7 @@ struct mbuf_ext_pgs {
> >   	 */
> >   	uint32_t	pad;
> >   #endif
> > +#endif /* __rtems__ */
> 
> This change also affects other targets. Why is it necessary?

The comment inside this #if block says that for i386 targets the "vm_paddr_t" is 64 bit, but at least for i386-rtems it is only 32 bits and this affects the size of "pa" (will be 156 bytes).
With "pad" included the whole "struct mbuf_ext_pgs" is 260 bytes and this will trigger the assert:
./freebsd/sys/kern/kern_mbuf.c:323:_Static_assert(sizeof(struct mbuf_ext_pgs) == 256

You are right, the change as it stands changes the situation for other targets.
Would something like this be acceptable?:
#if defined(__rtems__) && !defined(__i386__)

Or do you have a better suggestion?


More information about the devel mailing list