Re: Will there ever be EMC6w201 support?

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

 



On Wed, 11 May 2011 15:48:59 +0200, Luca Tettamanti wrote:
> On Wed, May 11, 2011 at 02:43:35PM +0200, Luca Tettamanti wrote:
> > Jeff's CPU does indeed lack lahf (see cpuinfo), so the driver should not
> > unconditionally use the intruction.
> > The driver should check X86_FEATURE_LAHF_LM or use use a different
> > method to read EFLAFS (pushf?).
> 
> The driver uses lahf to copy the lowest byte of EFLAGS to eax, then
> shifts it to right and test the lowest bit (CF).
> Using pushf instead we get the whole EFLAGS and test the lowest bit.
> Does it make sense? Someone should double check the patch, I don't trust
> my assembly skills ;)
> 
> diff --git a/drivers/char/i8k.c b/drivers/char/i8k.c
> index d72433f..3554d10 100644
> --- a/drivers/char/i8k.c
> +++ b/drivers/char/i8k.c
> @@ -139,8 +139,8 @@ static int i8k_smm(struct smm_regs *regs)
>  		"movl %%edi,20(%%rax)\n\t"
>  		"popq %%rdx\n\t"
>  		"movl %%edx,0(%%rax)\n\t"
> -		"lahf\n\t"
> -		"shrl $8,%%eax\n\t"
> +		"pusfh\n\t"

I think you meant pushf, not pusfh, right?

> +		"popl %%eax\n\t"
>  		"andl $1,%%eax\n"
>  		:"=a"(rc)
>  		:    "a"(regs)

I am no asm expert, but I don't get why you removed the shrl
instruction. As I understand it, your pushf+popl replaces only lahf,
the bit shifting is still needed (I assume the code wants to test bit 8
in the flag register.)

-- 
Jean Delvare

_______________________________________________
lm-sensors mailing list
lm-sensors@xxxxxxxxxxxxxx
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors


[Index of Archives]     [Linux Kernel]     [Linux Hardware Monitoring]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux