Re: [kvm-unit-tests PATCH v6 1/2] s390x: Add specification exception test

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2022-08-30 at 16:34 +0200, Nico Boehr wrote:
> Quoting Janis Schoetterl-Glausch (2022-08-26 18:11:11)
> > Generate specification exceptions and check that they occur.
> > 
> > Signed-off-by: Janis Schoetterl-Glausch <scgl@xxxxxxxxxxxxx>
> 
> Reviewed-by: Nico Boehr <nrb@xxxxxxxxxxxxx>

Thanks
> 
> with minor nits below you may want to consider
> 
> > diff --git a/s390x/spec_ex.c b/s390x/spec_ex.c
> > new file mode 100644
> [...]
> > +static int bad_alignment(void)
> > +{
> > +       uint32_t words[5] __attribute__((aligned(16)));
> > +       uint32_t (*bad_aligned)[4] = (uint32_t (*)[4])&words[1];
> 
> Why not simply:
> 
> uint32_t *bad_aligned = &words[1];

This is a pointer to a word, the argument to lpq is a quadword.
Your way would probably work, especially since we don't actually want
the asm to do anything, but no harm in doing it the correct way.
> 
> > +
> > +       /* LOAD PAIR FROM QUADWORD (LPQ) requires quadword alignment */
> > +       asm volatile ("lpq %%r6,%[bad]"
> > +                     : : [bad] "T" (*bad_aligned)
> > +                     : "%r6", "%r7"
> > +       );
> > +       return 0;
> > +}
> > +
> > +static int not_even(void)
> > +{
> > +       uint64_t quad[2] __attribute__((aligned(16))) = {0};
> > +
> > +       asm volatile (".insn    rxy,0xe3000000008f,%%r7,%[quad]" /* lpq %%r7,%[quad] */
> 
> Here you use .insn above you use lpq - why?

The assembler will complain about the odd register number, but that is
intentional.



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Kernel Development]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Info]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Linux Media]     [Device Mapper]

  Powered by Linux