Linux EFI development
 help / color / mirror / Atom feed
From: Arvind Sankar <nivedita@alum.mit.edu>
To: Ard Biesheuvel <ardb@kernel.org>
Cc: Arvind Sankar <nivedita@alum.mit.edu>,
	linux-efi <linux-efi@vger.kernel.org>,
	the arch/x86 maintainers <x86@kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 3/5] efi/x86: Make efi32_pe_entry more readable
Date: Mon, 2 Mar 2020 12:02:05 -0500	[thread overview]
Message-ID: <20200302170205.GA2937123@rani.riverdale.lan> (raw)
In-Reply-To: <CAKv+Gu-8HeNaRYZNtTHr1_VF1aH=BRKF4CaeyP-PPfHNQN2paA@mail.gmail.com>

On Mon, Mar 02, 2020 at 05:57:04PM +0100, Ard Biesheuvel wrote:
> On Mon, 2 Mar 2020 at 17:54, Arvind Sankar <nivedita@alum.mit.edu> wrote:
> >
> > On Mon, Mar 02, 2020 at 08:49:17AM +0100, Ard Biesheuvel wrote:
> > > On Mon, 2 Mar 2020 at 00:04, Arvind Sankar <nivedita@alum.mit.edu> wrote:
> > ...
> > > >         call    1f
> > > > -1:     pop     %ebp
> > > > -       subl    $1b, %ebp
> > > > +1:     pop     %ebx
> > > > +       subl    $1b, %ebx
> > ...
> > > >
> > > > +       movl    %ebx, %ebp                      // startup_32 for efi32_pe_stub_entry
> > >
> > > The code that follows efi32_pe_stub_entry still expects the runtime
> > > displacement in %ebp, so we'll need to pass that in another way here.
> > >
> > > >         jmp     efi32_pe_stub_entry
> >
> > Didn't follow -- what do you mean by runtime displacement?
> >
> > efi32_pe_stub_entry expects the runtime address of startup_32 to be in
> > %ebp, but with the changes for keeping the frame pointer in %ebp, I
> > changed the runtime address to be in %ebx instead. Hence I added that
> > movl %ebx, %ebp to put it in %ebp just before calling efi32_pe_stub_entry.
> > That should be fine, no?
> 
> But how does that work with:
> 
> SYM_INNER_LABEL(efi32_pe_stub_entry, SYM_L_LOCAL)
>     movl %ecx, efi32_boot_args(%ebp)
>     movl %edx, efi32_boot_args+4(%ebp)
>     movb $0, efi_is64(%ebp)
> 
> 
> ?

Why wouldn't it work? Before this change, efi32_pe_entry set %ebp to
startup_32 (via the call/pop/sub sequence), so efi32_pe_stub_entry was
entered with %ebp == startup_32.

After this change, the call/pop/sub sequence puts startup_32 into %ebx,
and then I copy it into %ebp just before branching to efi32_pe_stub_entry.
So everything should continue to work the same way as before?

  reply	other threads:[~2020-03-02 17:02 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-01 23:04 [PATCH 0/5] efi/x86 cleanups and one bugfix Arvind Sankar
2020-03-01 23:04 ` [PATCH 1/5] efi/x86: Annotate the LOADED_IMAGE_PROTOCOL_GUID with SYM_DATA Arvind Sankar
2020-03-01 23:04 ` [PATCH 2/5] efi/x86: Respect 32-bit ABI in efi32_pe_entry Arvind Sankar
2020-03-01 23:04 ` [PATCH 3/5] efi/x86: Make efi32_pe_entry more readable Arvind Sankar
2020-03-02  7:49   ` Ard Biesheuvel
2020-03-02 16:54     ` Arvind Sankar
2020-03-02 16:57       ` Ard Biesheuvel
2020-03-02 17:02         ` Arvind Sankar [this message]
2020-03-02 17:09           ` Ard Biesheuvel
2020-03-01 23:04 ` [PATCH 4/5] efi/x86: Avoid using code32_start Arvind Sankar
2020-03-01 23:04 ` [PATCH 5/5] x86/boot: Use unsigned comparison for addresses Arvind Sankar
2020-03-02  7:50 ` [PATCH 0/5] efi/x86 cleanups and one bugfix Ard Biesheuvel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200302170205.GA2937123@rani.riverdale.lan \
    --to=nivedita@alum.mit.edu \
    --cc=ardb@kernel.org \
    --cc=linux-efi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox