[SLOF] [PATCH slof] pci-properties: Enforce all MMIO BARs to be 64K page aligned

Segher Boessenkool segher at kernel.crashing.org
Wed Mar 1 12:36:41 AEDT 2017

On Tue, Feb 28, 2017 at 07:02:59PM -0600, Michael Roth wrote:
> > (Why have var in the middle of the params btw?  It is more natural to
> > have it at the end).
> It was mostly because it was an "extended" version of assign-var,
> so in my head it made sense to add the parameter to the end of the
> list. Not sure if that reasoning applies well to Forth.

In good Forth code, any word does just one simple thing, so you do not
have many arguments at all normally.  It is usual to put a memory
address last, because 1) it is usual, which helps reading; and 2) it
simplifies the callers most of the time.

Maybe it would help here to factor a bit more:

: assign-var-with-align ( size align var -- al-mem )
  dup >r @ swap #aligned tuck + r> ! ;

: assign-var-min-align ( size min-align var -- al-mem )
  >r over umax r> assign-var-with-align ;

or maybe you don't even need the latter.


More information about the SLOF mailing list