On 1/7/19 11:31 PM, Peter Maydell wrote: >> + /* Preserve the determination between upper and lower at bit 55, >> + * and insert pointer authentication code. >> + */ >> + if (param.tbi) { >> + ptr &= ~MAKE_64BIT_MASK(bot_bit, 55 - bot_bit + 1); >> + pac &= MAKE_64BIT_MASK(bot_bit, 54 - bot_bit + 1); >> + } else { >> + ptr &= MAKE_64BIT_MASK(0, bot_bit); >> + pac &= ~(MAKE_64BIT_MASK(55, 1) | MAKE_64BIT_MASK(0, bot_bit)); >> + } >> + ext &= MAKE_64BIT_MASK(55, 1); > > I found this a bit confusing to disentangle and compare with > the pseudocode: the difference between the tbi and > not-tbi cases is only "what are bits 63:56 in the result", > but the implementation of how we put together bits 55:0 is > different in the two code paths here.
Yes. I found the pseudocode itself to be confusing. Perhaps I went away from it too far. r~