Re: [patch] Re: [2.1.117] GPF in APM while using WINE

Stephen Rothwell (Stephen.Rothwell@canb.auug.org.au)
Thu, 3 Sep 1998 16:53:59 +1000 (EST)


OK, here is a more minimal change as suggested by Gabriel.

Again, it doesn't cause my machine to crash (even when suspending),
but I have done no further testing.

Again, tell me if I am an idiot, noone here knows me personally :-)

I must admit, I preferred the previous patch as it got rid
of all those aweful macros (I wrote them, but I hate them :-).

Cheers,
Stephen

diff -ru linux-2.1.118/drivers/char/apm_bios.c linux-2.1.118.new/drivers/char/apm_bios.c
--- linux-2.1.118/drivers/char/apm_bios.c Fri Aug 28 12:02:26 1998
+++ linux-2.1.118.new/drivers/char/apm_bios.c Thu Sep 3 15:10:02 1998
@@ -28,6 +28,7 @@
* May 1996, Version 1.2
* Feb 1998, Version 1.3
* Feb 1998, Version 1.4
+ * Aug 1998, Version 1.5
*
* History:
* 0.6b: first version in official kernel, Linux 1.3.46
@@ -50,6 +51,9 @@
* 1.4: Upgraded to support APM 1.2. Integrated ThinkPad suspend patch by
* Dean Gaudet <dgaudet@arctic.org>.
* C. Scott Ananian <cananian@alumni.princeton.edu> Linux 2.1.87
+ * 1.5: Fix segment register reloading (in case of bad segments saved
+ * across BIOS call). Suggestion by Gabriel Paubert <paubert@iram.es>
+ * Stephen ROthwell
*
* APM 1.1 Reference:
*
@@ -158,6 +162,7 @@
* [Confirmed by TI representative]
* U: ACER 486DX4/75: uses dseg 0040, in violation of APM specification
* [Confirmed by BIOS disassembly]
+ * [This may now work ...]
* P: Toshiba 1950S: battery life information only gets updated after resume
* P: Midwest Micro Soundbook Elite DX2/66 monochrome: screen blanking
* broken in BIOS [Reported by Garst R. Reese <reese@isn.net>]
@@ -180,6 +185,7 @@
/*
* Define to disable interrupts in APM BIOS calls (the CPU Idle BIOS call
* should turn interrupts on before it does a 'hlt').
+ * This reportedly needs undefining for the ThinkPad 600.
*/
#define APM_NOINTS

@@ -236,10 +242,25 @@
"movl %%dx, %%fs\n\t" \
"movl %%dx, %%gs\n\t"
# define APM_DO_RESTORE_SEGS \
- "popl %%gs\n\t" \
+ "1:\t" \
+ "popl %%gs\n" \
+ "2:\t" \
"popl %%fs\n\t" \
+ ".section fixup,\"ax\"\n" \
+ "3:\t" \
+ "movl $0, (%%esp)\n\t" \
+ "jmp 1b\n" \
+ "4:\t" \
+ "movl $0, (%%esp)\n\t" \
+ "jmp 2b\n\t" \
+ ".previous\n\t" \
+ ".section __ex_table,\"a\"\n\t" \
+ ".align 4\n\t" \
+ ".long 1b,3b\n\t" \
+ ".long 2b,4b\n\t" \
+ ".previous\n\t" \
"popl %%es\n\t" \
- "popl %%ds\n\t"
+ "popl %%ds\n"
#else
# define APM_DO_ZERO_SEGS
# define APM_DO_RESTORE_SEGS
@@ -252,7 +273,7 @@
APM_DO_CLI \
"lcall %%cs:" SYMBOL_NAME_STR(apm_bios_entry) "\n\t" \
"setc %%" # error_reg "\n\t" \
- "popfl\n\t" \
+ "popfl\n" \
APM_DO_RESTORE_SEGS
#define APM_BIOS_CALL_END \
: "ax", "bx", "cx", "dx", "si", "di", "bp", "memory")
@@ -371,7 +392,7 @@

static struct timer_list apm_timer;

-static char driver_version[] = "1.4"; /* no spaces */
+static char driver_version[] = "1.5"; /* no spaces */

#ifdef APM_DEBUG
static char * apm_event_name[] = {

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.altern.org/andrebalsa/doc/lkml-faq.html