[PATCH 1/6] powerpc sstep: Add maddhd, maddhdu, maddld instruction emulation

Sandipan Das sandipan at linux.ibm.com
Wed Sep 5 21:30:49 AEST 2018


Hi Segher,

On Wednesday 05 September 2018 03:42 AM, Segher Boessenkool wrote:
> On Mon, Sep 03, 2018 at 08:49:33PM +0530, Sandipan Das wrote:
>> +#ifdef __powerpc64__
>> +	case 4:
>> +		if (!cpu_has_feature(CPU_FTR_ARCH_300))
>> +			return -1;
>> +
>> +		switch (instr & 0x3f) {
>> +		case 48:	/* maddhd */
>> +			asm("maddhd %0,%1,%2,%3" : "=r" (op->val) :
>> +			    "r" (regs->gpr[ra]), "r" (regs->gpr[rb]),
>> +			    "r" (regs->gpr[rc]));
>> +			goto compute_done;
> 
> If running maddhd does not work, will running it in kernel mode work?
> 

Not sure what you meant here but one of the scenarios that I'm aware of
where this is will be used is if we place a probe at a location having
an maddhd instruction. The kernel would first attempt to emulate its
behaviour, which in this case is done by executing the same instruction
(similar to what is done for mulhd and mulhw) and if that fails, try to
execute the instruction natively.

- Sandipan



More information about the Linuxppc-dev mailing list