[RFC PATCH 1/1] BPF JIT for PPC64

Matt Evans matt at ozlabs.org
Mon Jul 11 16:21:50 EST 2011


On 25/06/11 11:58, Ben Hutchings wrote:
> On Fri, 2011-06-24 at 16:02 +1000, Matt Evans wrote:
> [...]
>> +		case BPF_S_ALU_ADD_K: /* A += K; */
>> +			if (!K)
>> +				break;
>> +			if (K < 32768)
>> +				PPC_ADDI(r_A, r_A, K);
>> +			else
>> +				PPC_ADDI(r_A, r_A, IMM_L(K));
>> +				PPC_ADDIS(r_A, r_A, IMM_HA(K));
>> +			break;
> 
> Missing braces.
> 
>> +		case BPF_S_ALU_SUB_X: /* A -= X; */
>> +			ctx->seen |= SEEN_XREG;
>> +			PPC_SUB(r_A, r_A, r_X);
>> +			break;
>> +		case BPF_S_ALU_SUB_K: /* A -= K */
>> +			if (!K)
>> +				break;
>> +			if (K < 32768)
>> +				PPC_ADDI(r_A, r_A, -K);
>> +			else
>> +				PPC_ADDI(r_A, r_A, IMM_L(-K));
>> +				PPC_ADDIS(r_A, r_A, IMM_HA(-K));
>> +			break;
> [...]
> 
> Here as well.

Thanks, Ben -- oops! :)  Really, just the ADDISes need to be conditional, too.


Cheers,


Matt


More information about the Linuxppc-dev mailing list