This is the mail archive of the newlib@sources.redhat.com mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Open Mode translation


Prasad Venkata Boddupalli wrote:
> 
> Jeff,
>      Thanks for the reply. But, why is the Demon SWI using values
> different from the standard ones ?

First off, which standard are you referring to?  POSIX/Single Unix do not specify what the values of
the O_ flags should be.  Secondly, it is an SWI call, not the open() routine.  The designers were
free to choose what ever they wanted.  There are two different interfaces involved and the simulator
is doing the right thing.  I'm not sure why you are taking issue with this.  As to the history of
the Demon SWI, you will have to talk to the ARM folks.

> Also, is there any document where I can
> get all such details.

Try the arm website: http://www.arm.com which has various downloadable documentation. 
 
-- Jeff J.

> 
> thanks,
> Prasad.
> 
> > Prasad,
> >
> >   If you look further in sim/arm/armos.c you will see the translation is between the open flags used
> > by the Demon open SWI interface and the flags needed by the native open() call used to simulate it.
> > The mode flags for the Demon open SWI have specific hard-coded values.  The simulator must use the
> > native O_ flags for the platform where the simulator runs.
> >
> > You should note that _swiopen() in newlib/libc/sys/arm/syscalls.c translates the target open-mode
> > flags to the SWI interface flags before invoking the SWI.
> >
> > From sim/arm/armos.c:
> >
> > /* This file contains a model of Demon, ARM Ltd's Debug Monitor,
> >    including all the SWI's required to support the C library.
> >
> > .
> > .
> >
> > static void
> > SWIopen (ARMul_State * state, ARMword name, ARMword SWIflags)
> > {
> >   struct OSblock *OSptr = (struct OSblock *) state->OSptr;
> >   char dummy[2000];
> >   int flags;
> >   int i;
> >
> >   for (i = 0; (dummy[i] = ARMul_SafeReadByte (state, name + i)); i++)
> >     ;
> >
> >   /* Now we need to decode the Demon open mode.  */
> >   flags = translate_open_mode[SWIflags];
> >
> >
> > -- Jeff J.
> >


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]