Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

KVM: x86: Convert em_salc() to C

Implement the SALC (Set AL if Carry) instruction in C.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Sean Christopherson <seanjc@google.com>
Link: https://lkml.kernel.org/r/20250714103440.634145269@infradead.org

+9 -6
+9 -6
arch/x86/kvm/emulate.c
··· 529 529 ON64(FOP3E(op##q, rax, rdx, cl)) \ 530 530 FOP_END 531 531 532 - FOP_START(salc) 533 - FOP_FUNC(salc) 534 - "pushf; sbb %al, %al; popf \n\t" 535 - FOP_RET(salc) 536 - FOP_END; 532 + static int em_salc(struct x86_emulate_ctxt *ctxt) 533 + { 534 + /* 535 + * Set AL 0xFF if CF is set, or 0x00 when clear. 536 + */ 537 + ctxt->dst.val = 0xFF * !!(ctxt->eflags & X86_EFLAGS_CF); 538 + return X86EMUL_CONTINUE; 539 + } 537 540 538 541 /* 539 542 * XXX: inoutclob user must know where the argument is being expanded. ··· 4426 4423 G(Src2CL | ByteOp, group2), G(Src2CL, group2), 4427 4424 I(DstAcc | SrcImmUByte | No64, em_aam), 4428 4425 I(DstAcc | SrcImmUByte | No64, em_aad), 4429 - F(DstAcc | ByteOp | No64, em_salc), 4426 + I(DstAcc | ByteOp | No64, em_salc), 4430 4427 I(DstAcc | SrcXLat | ByteOp, em_mov), 4431 4428 /* 0xD8 - 0xDF */ 4432 4429 N, E(0, &escape_d9), N, E(0, &escape_db), N, E(0, &escape_dd), N, N,