Re: CW inline assembly and Rosetta



In article <dbovmu$qc6$2@xxxxxxxxxxxxxxxxxxx>,
Michael McLaughlin <mpmcl@xxxxxxxxx> wrote:

Your runtime arch. is CFM. The only thing that you can build CFM with is
CodeWarrior. If you plan to move to XCode, you must build mach-o and
yes, the global stuff will certainly change, as will the whole asm
syntax. So I am going to assume that you plan to stay in CodeWarrior and
plan to continue to use CFM, otherwise your initial question would be
the wrong question to be asking.

Since you plan to stay with the runtime architecture and the IDE you are
currently using, then you don't have to worry about the global access
stuff -or anything else runtime specific for that matter. Rosetta
doesn't care how the PPC code operates, e.g. where it keeps it
variables, how it constructs and deconstructs stack frames etc. It just
emulates the G3 instructions it sees.

You should be fine.

Hope that helps,
Chris.

> I was most concerned with the access of global variables. Is what is
> shown in any way CodeWarrior-specific (I hope not!)?
>
> Anon wrote:
>
> > In article <dbm19q$5ra$1@xxxxxxxxxxxxxxxxxxx>,
> > Michael McLaughlin <mpmcl@xxxxxxxxx> wrote:
> >
> >
> >>Apologies if this is a bit off-topic.
> >>
> >>The function below is the (PowerPC) core of a pseudo-random-number
> >>generator which is nearly four times faster than the best C equivalent I
> >>can write. [The basic operation, subtract-with-borrow (subfe), is a
> >>single instruction that must be simulated in C.]
> >>
> >>Can anyone tell me whether Rosetta will handle a function like this,
> >>including fetching and storing the globals, or will I have to write an
> >>x86 assembly routine? [I do not have an x86 computer and have never
> >>written x86 assembly.]
> >>
> >>Thanks in advance.
> >>
> >>asm void URandomLib::Refill()
> >>{
> >> lwz r3,Ultra_brw // fetch global addresses from TOC
> >
> > .
> > .
> > .
> >
> >> li r5,148 // 4*37 bytes
> >> sth r5,0(r7) // reinitialize
> >> blr
> >>}
> >>
> >>--
> >>Mike McLaughlin
> >
> >
> > The only reason Rosetta would not be able to handle it is if any of
> > those instructions are not available on a G3. I don't believe that is
> > the case so it should be fine. However, it will almost certainly be
> > slower under emulation.
> >
> > Chris.
.



Relevant Pages

  • Re: using persistent to manage app data
    ... Instead of passing the application data around, ... globals, or keeping the data in the main figure's userdata ... I plan on writing a function that will keep the ...
    (comp.soft-sys.matlab)
  • Re: using persistent to manage app data
    ... Instead of passing the application data around, using globals, or keeping the data in the main figure's userdata area, ... ... I plan on writing a function that will keep the data as persistent and contain the code to handle queries to delete, retrieve, etc. data. ...
    (comp.soft-sys.matlab)
  • Re: Global dictionary or class variables
    ... Since I have a class Note, ... Are both bad practices? ... It really depends on how you plan to use them. ... Globals are frowned upon, but constant tend to be just ...
    (comp.lang.python)