RFR: 8342607: Enhance register printing on x86_64 platforms [v4]
Martin Doerr
mdoerr at openjdk.org
Mon Oct 28 13:53:56 UTC 2024
On Mon, 28 Oct 2024 13:41:24 GMT, Martin Doerr <mdoerr at openjdk.org> wrote:
>> src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp line 551:
>>
>>> 549: st->cr();
>>> 550: st->cr();
>>> 551: size_t fpregs_offset = pointer_delta(uc->uc_mcontext.fpregs, uc, 1);
>>
>> Could the register substructure live outside uc on x64? If so, it may be safer to
>> Suggestion:
>>
>> size_t fpregs_offset = (uc->uc_mcontext.fpregs >= uc) ? pointer_delta(uc->uc_mcontext.fpregs, uc, 1) : 0;
>>
>> or similar, since the register substructure may precede uc which would make pointer_delta assert.
>
> I think using 0 would require more changes to avoid accessing uc+0 which would be wrong. Richard and I already discussed about this above. We think it's acceptable. Some other projects claim that FP register substructure is inside the uc: https://github.com/mono/mono/blob/0f53e9e151d92944cacab3e24ac359410c606df6/mono/utils/mono-sigcontext.h#L263
> We could also check the kernel code which writes it.
After having read this, I have made the change. See commit nr. 7.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/21615#discussion_r1819095211
More information about the hotspot-runtime-dev
mailing list