public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Denys Vlasenko <dvlasenk@redhat.com>
To: Andy Lutomirski <luto@amacapital.net>
Cc: Borislav Petkov <bp@alien8.de>, "H. Peter Anvin" <hpa@zytor.com>,
	X86 ML <x86@kernel.org>, LKML <linux-kernel@vger.kernel.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Alexander van Heukelum <heukelum@fastmail.fm>
Subject: Re: RFC: (almost) getting rid of FIXUP/RESTORE_TOP_OF_STACK?
Date: Tue, 24 Feb 2015 12:45:01 +0100	[thread overview]
Message-ID: <54EC643D.3040005@redhat.com> (raw)
In-Reply-To: <CALCETrXCoQV5pq5J3ZmPywM-PnWMKp=CvayXkSDpSBoE24TRog@mail.gmail.com>

On 02/24/2015 12:58 AM, Andy Lutomirski wrote:
>> - Next possible change is to use PUSH insns to build the stack. Something along the lines of
>>         swapgs
>>         mov     %rsp,%gs:old_rsp
>>         mov     %gs:kernel_stack,%rsp
>>         sti
>>         push    $__USER_DS   /* pt_regs->ss */
>>         push    %gs:old_rsp  /* ->rsp */
>>         push    %r11         /* ->rflags */
>>         push    $__USER_CS   /* ->cs */
>>         push    %rcx         /* ->rip */
>>         push    %rax         /* ->orig_rax */
>>         push    %rdi
>>         push    %rsi
>>         push    %rdx
>>         push    %rcx
>>         push    $-ENOSYS     /* ->rax */
>>         push    %r8
>>         push    %r9
>>         push    %r10
>>         push    %r11
>>         sub     $(6*8),%rsp /* rbx, rbp, r12-r15 not saved */

Correction:
         push    %r11
         sub     $(6*8),%rsp /* rbx, rbp, r12-r15 not saved */
should be
         sub     $(7*8),%rsp /* r11, rbx, rbp, r12-r15 not saved */
since we don't need to save r11 either.

> 
> Yay!

"yay!" as in "I like this!" or as in "I am surprised" ?

>  Can we have a macro PUSH_XYZ for most of this?

Yes, it can be a macro. I'm not sure we'll have more than one
such place, tho.
Do you want a macro even if it will be once-use only?


  reply	other threads:[~2015-02-24 11:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-23 21:07 RFC: (almost) getting rid of FIXUP/RESTORE_TOP_OF_STACK? Denys Vlasenko
2015-02-23 23:58 ` Andy Lutomirski
2015-02-24 11:45   ` Denys Vlasenko [this message]
2015-02-25 16:09     ` Andy Lutomirski

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=54EC643D.3040005@redhat.com \
    --to=dvlasenk@redhat.com \
    --cc=bp@alien8.de \
    --cc=heukelum@fastmail.fm \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=torvalds@linux-foundation.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