[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] Syncing caches

From: Julian Brown
Subject: Re: [Tinycc-devel] Syncing caches
Date: Mon, 11 Nov 2002 23:00:09 +0000
User-agent: Mutt/1.3.23i

On Mon, Nov 11, 2002 at 10:07:24PM +0000, Rob Landley wrote:
> On Monday 11 November 2002 20:14, Jim Peters wrote:
> > Thanks for the work on TinyCC -- it has moved on a long way since I
> > last looked at it, now being able to output object files too.
> >
> > Inspired by this style of code generation, I'm thinking of using
> > something similar to generate fast custom digital filters routines at
> > run-time for a filter library I'm writing.  I know I could use libtcc,
> > but inspired by the code-generation of tcc, I think that my filter
> > code is simple enough to be written straight out without going via C
> > or libtcc.
> >
> > The only concern I have is about processor caches.  I remember a long
> > long time ago (Z80/6502/68000) when it was okay to write self-
> > modifying code, but then caches came along and it was no longer okay,
> > because the instruction cache could get out of sync.  Does this still
> > apply?
> On x86 at least, yes it does.  It's an erratum, meaning it'll bite you very 
> intermittently, differently on different processors, and you'll have a heck 
> of a time tracking it down (if you ever do).

As I understand it, this is not quite true for x86 - I think the story
goes that so much old DOS code used self-modifying code that all
current x86 chips must do cache snooping between the instruction and
data caches to avoid problems running that code. I think there's some
limitations though, but (something like?) if you have a jmp instruction
between creating code and attempting to run it, you're OK. I guess this
is off-topic, it's probably a FAQ on comp.lang.asm.x86 though.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]