www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/11/06/17:45:32

Message-ID: <32812E4B.23F2@gbrmpa.gov.au>
Date: Thu, 07 Nov 1996 08:33:16 +0800
From: Leath Muller <leathm AT gbrmpa DOT gov DOT au>
Reply-To: leathm AT gbrmpa DOT gov DOT au
Organization: Great Barrier Reef Marine Park Authority
MIME-Version: 1.0
To: Aaron Dwyer <adwyer AT galaxy DOT csc DOT calpoly DOT edu>
CC: djgpp AT delorie DOT com
Subject: Re: Protection disabling & Asm
References: <3280684D DOT 55B7 AT galaxy DOT csc DOT calpoly DOT edu>

> 2 questions:
 
> 1.      Should I really regret turning off protection so I can write my
> buffer to vidmem?  It's just a safety net, correct?  I won't be risking
> a crash or an incompatibility as long as I can handle my memory
> correctly, right?

If you code correctly, you shouldn't have any problems. Be warned
though,
I managed to screw up one simple thing one night, and killed Win95
completely.
ie: The computer when straight into a reboot... :)
 
> 2.      Check out this inline asm block:
>    //sin(t)->st, cos(t)->ct
> 
>    asm (
>       "flds %2\n"    //line 0
>       "fsincos\n"    //line 1
>       "fstps %1\n"   //line 2
>       "fstps %0\n"   //line 3
>         : "=g" (st), "=g" (ct)
>         : "g" (t)
>        );
>         This will compile correctly only if I don't pass the -O option to the
> compiler...in other words I can only compile without optimization.
> Otherwise, the compiler generates assembly language code with lines 0,
> 2, and 3 trying to move data between the FPU stack and the CPU registers
> directly, i.e.  line 2 compiles to
> fstps %ebx
> which is obviously a no-no.  I'd like to use the fsincos function in my
> programs, so is there any way around what appears to be a faulty
> compile?  I've tried asm volatile, but that just makes it have the error
> even without optimizations enabled.  I'm wondering if I made some stupid
> mistake or if there's an easy fix to this.
> I wanted to submit a bug report but in the info pages it says not to
> submit errors regarding inline asm.

DJGPP's optimizer is excellent, but sometimes it want's to do things
you wouldn't want it do - mostly in your inline asm. If you change your
first line to
	asm volatile (
then DJGPP won't play with it, as the volatile keyword basically says to
leave it alone! :)

Leathal.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019