lkml.org 
[lkml]   [2012]   [Apr]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH 1/3] x86, extable: Cleanup fixup_exception
From 74643bebf6b592f179974caa033f2f095d28bb74 Mon Sep 17 00:00:00 2001
From: Borislav Petkov <bp@alien8.de>
Date: Sat, 31 Mar 2012 16:29:03 +0200
Subject: [PATCH 1/3] x86, extable: Cleanup fixup_exception

And especially, fork out the CONFIG_PNPBIOS lump into its own function
and salvage a tab by inverting error code checking.

No functionality change.

Signed-off-by: Borislav Petkov <bp@alien8.de>
---
arch/x86/mm/extable.c | 33 ++++++++++++++++++---------------
1 files changed, 18 insertions(+), 15 deletions(-)

diff --git a/arch/x86/mm/extable.c b/arch/x86/mm/extable.c
index 1fb85dbe390a..08aecb0d3132 100644
--- a/arch/x86/mm/extable.c
+++ b/arch/x86/mm/extable.c
@@ -2,13 +2,10 @@
#include <linux/spinlock.h>
#include <asm/uaccess.h>

-
-int fixup_exception(struct pt_regs *regs)
+static void pnp_bios_is_crap(unsigned long cs)
{
- const struct exception_table_entry *fixup;
-
#ifdef CONFIG_PNPBIOS
- if (unlikely(SEGMENT_IS_PNP_CODE(regs->cs))) {
+ if (unlikely(SEGMENT_IS_PNP_CODE(cs))) {
extern u32 pnp_bios_fault_eip, pnp_bios_fault_esp;
extern u32 pnp_bios_is_utter_crap;
pnp_bios_is_utter_crap = 1;
@@ -20,18 +17,24 @@ int fixup_exception(struct pt_regs *regs)
panic("do_trap: can't hit this");
}
#endif
+}
+
+int fixup_exception(struct pt_regs *regs)
+{
+ const struct exception_table_entry *fixup;
+
+ pnp_bios_is_crap(regs->cs);

fixup = search_exception_tables(regs->ip);
- if (fixup) {
- /* If fixup is less than 16, it means uaccess error */
- if (fixup->fixup < 16) {
- current_thread_info()->uaccess_err = 1;
- regs->ip += fixup->fixup;
- return 1;
- }
- regs->ip = fixup->fixup;
+ if (!fixup)
+ return 0;
+
+ /* If fixup is less than 16, it means uaccess error */
+ if (fixup->fixup < 16) {
+ current_thread_info()->uaccess_err = 1;
+ regs->ip += fixup->fixup;
return 1;
}
-
- return 0;
+ regs->ip = fixup->fixup;
+ return 1;
}
--
1.7.5.3.401.gfb674
--
Regards/Gruss,
Boris.

Advanced Micro Devices GmbH
Einsteinring 24, 85609 Dornach
GM: Alberto Bozzo
Reg: Dornach, Landkreis Muenchen
HRB Nr. 43632 WEEE Registernr: 129 19551


\
 
 \ /
  Last update: 2012-04-19 11:27    [W:0.279 / U:0.108 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site