Re: [kvm-unit-tests PATCH v2] s390x: Interception tests

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

 



>>> +static uint8_t pagebuf[PAGE_SIZE * 2] __attribute__((aligned(PAGE_SIZE)));
>>> +
>>> +/* Enable or disable low-address protection */
>>> +static void set_low_prot(bool enable)
>>> +{
>>> +	uint64_t cr0;
>>> +
>>> +	asm volatile (" stctg 0,0,%0 " : : "Q"(cr0));
>>
>> Use %c0 instead?
> 
> It's got to be %%c0 ... not sure whether this looks really nicer here?

%c0 should work, e.g. do a "git grep "%c0" in linux.git

arch/s390/kernel/base.S:        lctlg   %c0,%c0,0(%r4)
...

>>> +	report("spx + stfl", pagebuf[GEN_LC_STFL] != 0 &&
>>> +			     );
>>
>> I would split this into two tests.
> 
> Sorry, I can't follow you here ... Do you mean to just split the
> report() or the whole sequence of assembler instructions?

Sorry, I meant I would split it into:

report("spx + stpx", old_prefix == 0 && tst_prefix == new_prefix);
report("spx + stfl", pagebuf[GEN_LC_STFL] != 0);

>>> +
>>> +/* Test the TEST BLOCK instruction */
>>> +static void test_testblock(void)
>>> +{
>>> +	int cc;
>>> +
>>> +	memset(pagebuf, 0xaa, PAGE_SIZE);
>>> +
>>> +	asm volatile (
>>> +		" lghi	0,0\n"
>>
>> %0,0 ?
> 
> That's certainly wrong, since %0 is the reference to the first output
> parameter (cc). You likely mean %%0 or %%r0 ... and that looks rather
> cumbersome, too. I think I prefer the plain "0" here, what do you think?

Sorry, of course I meant %r0. My keyboard ate one character ;)

(again, only one % is required, see e.g. arch/s390/kernel/entry.S)


-- 

Thanks,

David



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux