Messages in this thread | | | Date | Fri, 21 Jul 2023 10:06:18 +0200 | From | Peter Zijlstra <> | Subject | Re: [PATCH v2 00/11] Unify TDCALL/SEAMCALL and TDVMCALL assembly |
| |
On Fri, Jul 21, 2023 at 12:18:23AM +0000, Huang, Kai wrote:
> Unfortunately I don't think it's feasible. Sean pointed out that > kvm_vcpu_arch::regs[] do follow the "register index" hardware layout in x86 (for > which I missed sorry), so we cannot re-order KVM part. > > And unfortunately RBP (5) is in middle of those registers: > > 0 = RAX > 1 = RCX > 2 = RDX > 3 = RBX > 4 = RSP > 5 = RBP > 6 = RSI > 7 = RDI > 8–15 represent R8–R15, respectively... > > Thus unless we add RBP to 'struct tdx_module_args', it's impossible to re-order > the structure to match KVM's layout.
Adding RBP to the struct shouldn't be a problem, we'll just not use it. Same as RSP, nobody sane would expect that to be used. If you worry about it you can give them funny names like:
struct tdx_module_args { unsigned long ax; unsigned long cx; unsigned long dx; unsigned long bx; unsigned long __sp_unused; unsigned long __bp_unused; unsigned long si; unsigned long di; ... };
I mean, at this point the whole thing is just 128 bytes of data anyway.
| |