Re: [PATCH v2 10/30] Add x86-specific parity functions

From: Zeng Zhaoxiu
Date: Sun Apr 10 2016 - 22:43:52 EST


å 2016å04æ06æ 18:37, One Thousand Gnomes åé:
Even that would still be wrong for the smaller parity values. The CPU
supports 8bit parity directly going back to the 8086 so the
implementation for 8bit and I think 16bit is still wrong.

Alan

I don't know where the errors. X86 is new to me.

The definition of the parity flag on x86 from Wikipedia:

In x86 processors, the parity flag reflects the parity only of the least significant
byte of the result, and is set if the number of set bits of ones is even. According to
80386 Intel manual, the parity flag is changed in the x86 processor family by the
following instructions:
All arithmetic instructions;
Compare instruction (equivalent to a subtract instruction without storing the result);
Logical instructions - XOR, AND, OR;
the TEST instruction (equivalent to the AND instruction without storing the result).
the POPF instruction