Message ID | 20240205104840.14942-1-frediano.ziglio@cloud.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | [1/5] Constify some parameters | expand |
On 05.02.2024 11:48, Frediano Ziglio wrote: > We just pushed a 8-bytes zero and exception constants are > small so we can just write a single byte saving 3 bytes for > instruction. > With ENDBR64 this reduces the size of the entry point from 32 to 16 > bytes (due to alignment). Oh, good - when recently touching these entry points, I was thinking of doing exactly this. Just didn't get to it, yet. However - since using different size stores can raise performance concerns, I'd like to suggest that you mention the fact that we actually already have cases of this, in autogen_stubs, - I'd further like to ask that this conversion then be done consistently everywhere, perhaps even including the storing of TRAP_syscall. I find it particularly puzzling that you ... > --- a/xen/arch/x86/x86_64/entry.S > +++ b/xen/arch/x86/x86_64/entry.S > @@ -898,28 +898,28 @@ END(handle_exception) > FUNC(entry_DE) > ENDBR64 > pushq $0 > - movl $X86_EXC_DE, 4(%rsp) > + movb $X86_EXC_DE, 4(%rsp) > jmp handle_exception > END(entry_DE) > > FUNC(entry_MF) > ENDBR64 > pushq $0 > - movl $X86_EXC_MF, 4(%rsp) > + movb $X86_EXC_MF, 4(%rsp) > jmp handle_exception > END(entry_MF) > > FUNC(entry_XM) > ENDBR64 > pushq $0 > - movl $X86_EXC_XM, 4(%rsp) > + movb $X86_EXC_XM, 4(%rsp) > jmp handle_exception > END(entry_XM) > > FUNC(entry_NM) > ENDBR64 > pushq $0 > - movl $X86_EXC_NM, 4(%rsp) > + movb $X86_EXC_NM, 4(%rsp) > jmp handle_exception > END(entry_NM) > > @@ -933,28 +933,28 @@ END(entry_DB) ... skip entry_DB here. And even ... > FUNC(entry_BP) > ENDBR64 > pushq $0 > - movl $X86_EXC_BP, 4(%rsp) > + movb $X86_EXC_BP, 4(%rsp) > jmp handle_exception > END(entry_BP) > > FUNC(entry_OF) > ENDBR64 > pushq $0 > - movl $X86_EXC_OF, 4(%rsp) > + movb $X86_EXC_OF, 4(%rsp) > jmp handle_exception > END(entry_OF) > > FUNC(entry_BR) > ENDBR64 > pushq $0 > - movl $X86_EXC_BR, 4(%rsp) > + movb $X86_EXC_BR, 4(%rsp) > jmp handle_exception > END(entry_BR) > > FUNC(entry_UD) > ENDBR64 > pushq $0 > - movl $X86_EXC_UD, 4(%rsp) > + movb $X86_EXC_UD, 4(%rsp) > jmp handle_exception > END(entry_UD) ... entry points below here, where an error code is pushed, will have zero in the respective field, so these can be converted too. And entry_NMI isn't any different either. Whereas entry_MC even exactly matches the pattern you have been following, afaict. Jan
diff --git a/xen/arch/x86/x86_64/entry.S b/xen/arch/x86/x86_64/entry.S index ecdd6e5b47..b6a157d96a 100644 --- a/xen/arch/x86/x86_64/entry.S +++ b/xen/arch/x86/x86_64/entry.S @@ -898,28 +898,28 @@ END(handle_exception) FUNC(entry_DE) ENDBR64 pushq $0 - movl $X86_EXC_DE, 4(%rsp) + movb $X86_EXC_DE, 4(%rsp) jmp handle_exception END(entry_DE) FUNC(entry_MF) ENDBR64 pushq $0 - movl $X86_EXC_MF, 4(%rsp) + movb $X86_EXC_MF, 4(%rsp) jmp handle_exception END(entry_MF) FUNC(entry_XM) ENDBR64 pushq $0 - movl $X86_EXC_XM, 4(%rsp) + movb $X86_EXC_XM, 4(%rsp) jmp handle_exception END(entry_XM) FUNC(entry_NM) ENDBR64 pushq $0 - movl $X86_EXC_NM, 4(%rsp) + movb $X86_EXC_NM, 4(%rsp) jmp handle_exception END(entry_NM) @@ -933,28 +933,28 @@ END(entry_DB) FUNC(entry_BP) ENDBR64 pushq $0 - movl $X86_EXC_BP, 4(%rsp) + movb $X86_EXC_BP, 4(%rsp) jmp handle_exception END(entry_BP) FUNC(entry_OF) ENDBR64 pushq $0 - movl $X86_EXC_OF, 4(%rsp) + movb $X86_EXC_OF, 4(%rsp) jmp handle_exception END(entry_OF) FUNC(entry_BR) ENDBR64 pushq $0 - movl $X86_EXC_BR, 4(%rsp) + movb $X86_EXC_BR, 4(%rsp) jmp handle_exception END(entry_BR) FUNC(entry_UD) ENDBR64 pushq $0 - movl $X86_EXC_UD, 4(%rsp) + movb $X86_EXC_UD, 4(%rsp) jmp handle_exception END(entry_UD)
We just pushed a 8-bytes zero and exception constants are small so we can just write a single byte saving 3 bytes for instruction. With ENDBR64 this reduces the size of the entry point from 32 to 16 bytes (due to alignment). Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com> --- xen/arch/x86/x86_64/entry.S | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)