From: Thomas Garnier Subject: [RFC 21/22] x86/module: Add support for mcmodel large and PLTs Date: Tue, 18 Jul 2017 15:33:32 -0700 Message-ID: <20170718223333.110371-22-thgarnie@google.com> References: <20170718223333.110371-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 , Thomas Garnier , Arnd Bergmann , Matthias Kaehlcke , Boris Ostrovsky , Juergen Gross , Paolo Bonzini , =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= , Joerg Roedel , Andy Lutomirski , Borislav Petkov , "Kirill A . Shutemov" , Brian Gerst , Borislav Petkov , Christian Borntraeger , "Rafael J . Wysocki" , Len Brown In-Reply-To: <20170718223333.110371-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 ZSBubyBhc3N1bXB0aW9ucyBvbiBwbGFjZW1lbnQgaW4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