Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753314AbbBYQJq (ORCPT ); Wed, 25 Feb 2015 11:09:46 -0500 Received: from mail-lb0-f180.google.com ([209.85.217.180]:44478 "EHLO mail-lb0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753113AbbBYQJm (ORCPT ); Wed, 25 Feb 2015 11:09:42 -0500 MIME-Version: 1.0 In-Reply-To: <54EC643D.3040005@redhat.com> References: <54EB96AB.5050808@redhat.com> <54EC643D.3040005@redhat.com> From: Andy Lutomirski Date: Wed, 25 Feb 2015 08:09:21 -0800 Message-ID: Subject: Re: RFC: (almost) getting rid of FIXUP/RESTORE_TOP_OF_STACK? To: Denys Vlasenko Cc: Borislav Petkov , "H. Peter Anvin" , X86 ML , LKML , Linus Torvalds , Alexander van Heukelum Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1779 Lines: 53 On Tue, Feb 24, 2015 at 3:45 AM, Denys Vlasenko wrote: > 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? > Maybe not. If it gets other uses, it can be macro-ized. -- Andy Lutomirski AMA Capital Management, LLC -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/