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

Gabriel Paubert (paubert@iram.es)
Wed, 2 Sep 1998 11:29:37 +0200 (METDST)


On Tue, 1 Sep 1998, Stephen Rothwell wrote:

> Hi all,
>
> Sorry this took so long, but I had to actually install 2.1.118
> before I could start (and then beat the stupidity out of my
> head to get the new version not to crash ...)
>
> On Wed, 26 Aug 1998, Linus Torvalds wrote:
> > On Thu, 27 Aug 1998, Marcus Meissner wrote:
> > >
> > > Umm, Linus, should 2.1.118 really fix the crash I did report?
> >
> > No. I'm not using APM myself, so I was rather hoping that somebody would
> > find the right spot in the APM register restore code, and use the
> > "loadsegment()" macro instead of loading it by hand..
> >
> > 2.1.118 should fix the switch_to() issues, so that once some APM person
> > has done the above everything should be hunky dory.
>
> I have tested the following to make sure it works in my laptop,
> I have not tested it to see if it fixes the problem, but it should.
>
> Comments welcome.

Your patch is perhaps needlessly complicated, you can also protect pop
%[fg]s against exceptions as is done in the RESTORE_ALL macros.

However, it seems that the RESTORE_ALL code will get the stack pointer
out of sync if the exception code is executed. The appended patch should
make the code behave as intended.

BTW, I wonder whether it is worth segregating into RESTORE_ALL_USER
and RESTORE_ALL_SYS macro and handle exceptions only on the first.

And then the following code:

movl EFLAGS(%esp),%eax # mix EFLAGS and CS
movb CS(%esp),%al
testl $(VM_MASK | 3),%eax # return to VM86 mode or non-supervisor

is very bad on P6 (PPro, PII...) cores because it mixes partial registers
accesses with full ones. It probably has a negligible impact however.

Gabriel.

--- linux-2.1.119-vanilla/arch/i386/kernel/entry.S Mon Aug 24 10:56:31 1998
+++ linux-2.1.119/arch/i386/kernel/entry.S Wed Sep 2 10:11:38 1998
@@ -105,23 +105,21 @@
popl %eax; \
1: popl %ds; \
2: popl %es; \
-3: addl $4,%esp; \
-4: iret; \
+ addl $4,%esp; \
+3: iret; \
.section fixup,"ax"; \
-5: pushl $0; \
- popl %ds; \
+4: movl $0,(%esp); \
+ jmp 1b; \
+5: movl $0,(%esp); \
jmp 2b; \
-6: pushl $0; \
- popl %es; \
- jmp 3b; \
-7: pushl $11; \
+6: pushl $11; \
call do_exit; \
.previous; \
.section __ex_table,"a";\
.align 4; \
- .long 1b,5b; \
- .long 2b,6b; \
- .long 4b,7b; \
+ .long 1b,4b; \
+ .long 2b,5b; \
+ .long 3b,6b; \
.previous

#define GET_CURRENT(reg) \

-
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