[lkml]   [2018]   [Feb]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [RFC v2 PATCH 6/7] x86/entry: get rid of ALLOC_PT_GPREGS_ON_STACK and SAVE_AND_CLEAR_REGS
On Wed, Feb 7, 2018 at 1:29 PM, Dominik Brodowski
<> wrote:
>> So this removes lines of asm code, but it adds a lot of instructions
>> to the end result thanks to the macro, I think.
> Indeed, that is the case (see below). However, if we want to switch to
> PUSH instructions and do this in a routine which is call'ed and which
> ret'urns, %rsp needs to be moved around even more often than the old
> ALLOC_PT_GPREGS_ON_STACK macro did (which you wanted to get rid of,
> IIUYC). Or do I miss something?

So I agree that your approach makes for a lot simpler stack setup.

I was just hoping that we could play some tricks.

For example, right now your PUSH_AND_CLEAR_REGS starts off with

pushq %rdi /* pt_regs->di */
pushq %rsi /* pt_regs->si */
pushq %rdx /* pt_regs->dx */
pushq %rcx /* pt_regs->cx */

and maybe we could still use this in paranoid_entry and error_entry if
we made it something like

/* if 'save_ret' is set, we pop the return point into %rsi */
.macro PUSH_AND_CLEAR_REGS save_ret=0
.if \save_ret
pushq %%rsi
movq 8(%%rsp),%rsi
movq %%rdi,8(%%rsp)
pushq %rdi /* pt_regs->di */
pushq %rsi /* pt_regs->si */
pushq %rdx /* pt_regs->dx */
pushq %rcx /* pt_regs->cx */

which would allow error_entry and paranoid_entry to do something like this:

pushq %rsi
... do the other common code ..

(totally untested, I'm just doing a "stream-of-consciousness" thing in
the email.

See what I'm saying?

That said, maybe the pushq sequence is now so small that it doesn't
even matter, and duplicating it isn't a big problem.

Because your version sure is simpler.


 \ /
  Last update: 2018-02-07 22:59    [W:0.095 / U:3.460 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site