From: Thomas Garnier Subject: [RFC v2 22/23] x86/module: Add support for mcmodel large and PLTs Date: Thu, 10 Aug 2017 10:26:14 -0700 Message-ID: <20170810172615.51965-23-thgarnie@google.com> References: <20170810172615.51965-1-thgarnie@google.com> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Cc: linux-arch@vger.kernel.org, kvm@vger.kernel.org, linux-pm@vger.kernel.org, x86@kernel.org, linux-kernel@vger.kernel.org, linux-sparse@vger.kernel.org, linux-crypto@vger.kernel.org, kernel-hardening@lists.openwall.com, xen-devel@lists.xenproject.org To: Herbert Xu , "David S . Miller" , Thomas Gleixner , Ingo Molnar , "H . Peter Anvin" , Peter Zijlstra , Josh Poimboeuf , Arnd Bergmann , Thomas Garnier , Matthias Kaehlcke , Boris Ostrovsky , Juergen Gross , Paolo Bonzini , =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= , Joerg Roedel , Tom Lendacky , Andy Lutomirski , Borislav Petkov , Brian Gerst , "Kirill A . Shutemov" , "Rafael J . Wysocki" , Len Brown , Pavel Machek Return-path: In-Reply-To: <20170810172615.51965-1-thgarnie@google.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" List-Id: linux-crypto.vger.kernel.org V2l0aCBQSUUgc3VwcG9ydCBhbmQgS0FTTFIgZXh0ZW5kZWQgcmFuZ2UsIHRoZSBtb2R1bGVzIG1h eSBiZSBmdXJ0aGVyCmF3YXkgZnJvbSB0aGUga2VybmVsIHRoYW4gYmVmb3JlIGJyZWFraW5nIG1j bW9kZWw9a2VybmVsIGV4cGVjdGF0aW9ucy4KCkFkZCBhbiBvcHRpb24gdG8gYnVpbGQgbW9kdWxl cyB3aXRoIG1jbW9kZWw9bGFyZ2UuIFRoZSBtb2R1bGVzIGdlbmVyYXRlZApjb2RlIHdpbGwgbWFr ZSBubyBhc3N1bXB0aW9ucyBvbiBwbGFjZW1lbn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