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]
Other format: [Raw text]

Re: system call...


It depends greatly on your target, but on my ARM system, these are the
options. You can omit libgloss, in which case there will be a number
of undefined symbols such as _write, which printf eventually calls.
You implement _write and you're away to the races.

The second option is to use newlib's libgloss which implements _write
by calling the assembler instruction 'swi SWI_write', which stands for
'software interrupt'. Most processors have some instruction like this.
You install an interrupt handler for the software interrupt and
implement a big ol' switch or table lookup on the system call number.
This is somewhat more complicated and usually requires some assembler
coding. It can have advantages though depending on your requirements.

Some targets have multiple system call protocols. For example, ARM has
RDP (Remote Debug Protocol), RDI (Remote debug interface, and RedBoot
(Red Hat Boot). The last one is the most Unix like.

Cheers,
Shaun

On Wed, 9 Mar 2005 16:29:08 +0800, s88 <dave.tw@gmail.com> wrote:
> hello...
>       I want to make my newlib to support the system call by myself.
> Such as printf. Could you tell me the conception and method which to
> implement the system call.
> Dave.
> 
> Thanx!!
> Best regards,


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