Re: [AD] Bug in MMX linear_clear_to_color8 with asynchronous usage |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
>> I'm unsure of the details, but:
>> - my sound code runs in a timer interrupt handler
> Note that this is not officially sanctioned.
It's only a matter of filling the sound buffer in time.
It worked well until using a float.
(Which I may end converting to a fixed point value, but it's good
indeed to find a solution for Allegro is possible)
>> I'm not very familiar with MMX code so I can't help more than that
>> for the moment, but I'd be glad to provide more informations on request.
> Please provide a test case if you can. Although I won't be the one
> investigating this, I'm sure it'll help whoever decides to tackle it.
I'm sorry, I currently work on a big program, I'll have to write a
separate test program. I did not know however was what the exact problem
before, and now that Robert provided some code (below) it seems obvious
to fix (although I apparently can't do it @!#*).
[newer message]
In case a message doesn't come through about this in a timely manner,
Bob told me he's already sent a patch about this, so don't worry about
providing a test case.
Below is the mail Robert sent me.
The patch unfortunately doesn't compile as is since the FSAVE/FRSTOR
opcodes apparently require a memory address as operand (doesn't work
with %esp). I tried implementing the backup using 8 108-bytes sized
buffer and locked them but it crashes. I think that there's something
I don't understand about interrupts handling.
Robert's mail:
----------
Eric and Omar,
It seems that I am unable to post on AD/AL/alleg5 any longer because of
SF's policy conflicting with my ISP's :(
Here's a potential patch for the problem mentioned below. This patch is
completely untested (I didn't compile it) as I do not have DJGPP installed,
nor a DOS environment to try it on.
The patch adds the ability for Allegro to save/restore the FPU state on
interrupts. This is my first time programming the x87 FPU, so I'm not
entirely sure this is the correct way of doing it.
[...]
--
- Robert Jr Ohannessian
http://bob.allegronetwork.com/
The peer will come and reset your connection. RUN WHILE YOU STILL CAN!
Index: src/dos/djirqs.s
===================================================================
RCS file: /cvsroot/alleg/allegro/src/dos/djirqs.s,v
retrieving revision 1.2
diff -u -r1.2 djirqs.s
--- src/dos/djirqs.s 14 Feb 2001 23:55:12 -0000 1.2
+++ src/dos/djirqs.s 9 Feb 2003 18:16:12 -0000
@@ -32,6 +32,11 @@
pushw
%fs ; \
pushw
%gs ; \
pushal
; \
+ testl $CPU_FPU, GLOBL(cpu_capabilities) ; \
+ jz no_save_fpu_state_##x ; \
+ subl $108, %esp ; \
+ fsave %esp ; \
+ no_save_fpu_state_##x: ; \
; \
.byte 0x2e /* cs: override
*/ ; \
movw GLOBL(__djgpp_ds_alias),
%ax ; \
@@ -82,6 +87,12 @@
orl %eax, %eax /* check return value
*/ ; \
jz
get_out_##x ; \
; \
+ testl $CPU_FPU, GLOBL(cpu_capabilities) ; \
+ jz no_restore_fpu_state_##x ; \
+ frstor %esp ; \
+ addl $108, %esp ; \
+ no_restore_fpu_state_##x: ; \
+
popal /* chain to old handler
*/ ; \
popw
%gs ; \
popw
%fs ; \
@@ -90,6 +101,11 @@
ljmp *%cs:GLOBL(_irq_handler) + IRQ_OLDVEC +
IRQ_SIZE*x ; \
; \
get_out_##x:
; \
+ testl $CPU_FPU, GLOBL(cpu_capabilities) ; \
+ jz no_restore_fpu_state2_##x ; \
+ frstor %esp ; \
+ addl $108, %esp ; \
+ no_restore_fpu_state2_##x: ; \
popal /* iret
*/ ; \
popw
%gs ; \
popw
%fs ; \