[PATCH] D132073: [CodeGen] Zero out only modified registers

Bill Wendling via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 1 16:24:34 PDT 2022


void added a comment.

In D132073#3765570 <https://reviews.llvm.org/D132073#3765570>, @efriedma wrote:

>> The important bit is the movq %rdi, %rax right after the callq *pv_ops+536(%rip) instruction.
>
> I read that clump of assembly as "if paravirtualization is on, call `*pv_ops+536(%rip)`; if it's off, replace the call with `movq %rdi, %rax`".  There isn't any expectation that RDI is preserved.
>
> At least, that's my understanding of the intent.  It looks like the asm doesn't mark up its outputs/clobbers correctly, though; it needs to mark all the registers the calling convention says are caller-saved (rcx, rdx, rdi, rsi, r8, r9, r10, r11) as outputs or clobbers.  Not sure if that ends up mattering here.

However, if I comment out `xorl %edi, %edi` in `paravirt_ident_64` the kernel boots up. So *something* is expecting `rdi`'s value to be retained. (This isn't the only calling place, of course.)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D132073/new/

https://reviews.llvm.org/D132073



More information about the llvm-commits mailing list