[PATCH] D70101: [X86] Fix the implementation of __readcr3/__writecr3 to work in 64-bit mode

Craig Topper via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 11 17:22:54 PST 2019


craig.topper added a comment.

In D70101#1741452 <https://reviews.llvm.org/D70101#1741452>, @rnk wrote:

> What do you think of using `__INTPTR_TYPE__` for this instead? If that doesn't work, we could define and undefine our own macro to use as a typedef. The resulting code should be clean enough that we can generalize it to `__readcr0` etc.
>
> It looks like `long` is the correct return type for 32-bit:
>  https://gcc.godbolt.org/z/6NzZWz
>  I'm not sure what the best device to figure out `__writecr3` would be.


I cobbled together some code from stackoverflow. I think the input type for __writecr3 really is int https://gcc.godbolt.org/z/dc8hQq


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

https://reviews.llvm.org/D70101





More information about the cfe-commits mailing list