unnecessary jmp in desctbls_asm.s
The x86 code for manipulating descriptor tables seems largely untouched since Solaris, and includes some curious sequences.
wr_gdtr contains a
jmp over a
nop immediately after
lgdtr, none of which is necessary. The
jmp seems like something a SPARC programmer might have written (delay slots), and the
jmp seems like a vestige from when this code used to include an
lretq to pick up a (potentially) new code segment; that code was removed in commit ae115bc77f6fcde83175c75b4206dc2e50747966 (which rolls up a bunch of commits from somewhere else; Sun perhaps?).
Also, the functions in
desctbls_asm.s were changed to push a valid frame onto the stack, but inconsistently; the usual,
pushq %rbp; movq %rsp, %rbp sequence creates the frame, but then a
leave instruction is used to pop. We should be consistent on pairing
leave or the explicit
pushq ...; movq and
Tested: built nightly, installed on a machine, booted on hardware.
Note that the replacement of the
leave instructions with
popq %rbp is mostly a nop (one could argue setting up the frame in these trivial wrappers around privileged instructions should be removed entirely: note that frame setup/tear-down is not consistent across the functions in this file); the only real significant change the removal of the
wr_gdtr, but also the previous instruction sequence is not common.
Updated by Electric Monk 3 days ago
- Status changed from New to Closed
- % Done changed from 0 to 100
commit 61b899723556289ed14dbcc0792ee6ed33c3edf9 Author: Dan Cross <firstname.lastname@example.org> Date: 2022-09-22T18:55:21.000Z 14997 unnecessary jmp in desctbls_asm.s Reviewed by: Robert Mustacchi <email@example.com> Approved by: Dan McDonald <firstname.lastname@example.org>