Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/arm26/stand/lib Simple library to interface stand-a...



details:   https://anonhg.NetBSD.org/src/rev/36e972918cd9
branches:  trunk
changeset: 513239:36e972918cd9
user:      bjh21 <bjh21%NetBSD.org@localhost>
date:      Thu Jul 26 22:11:08 2001 +0000

description:
Simple library to interface stand-alone programs to RISC OS.

This comes in two parts:  riscoscalls.[Sh] provide definitions, and thin
wrappers around RISC OS SWIs (in the style of OsLib) for the use of both the
rest of the library and client code.  The rest of the library provides a
compatibility layer for libsa.

diffstat:

 sys/arch/arm26/stand/lib/Makefile       |   22 +++
 sys/arch/arm26/stand/lib/Makefile.inc   |   56 +++++++++
 sys/arch/arm26/stand/lib/devopen.c      |   40 ++++++
 sys/arch/arm26/stand/lib/riscoscalls.S  |  186 ++++++++++++++++++++++++++++++++
 sys/arch/arm26/stand/lib/riscoscalls.h  |  139 +++++++++++++++++++++++
 sys/arch/arm26/stand/lib/riscoscons.c   |   48 ++++++++
 sys/arch/arm26/stand/lib/riscoserrors.c |   48 ++++++++
 sys/arch/arm26/stand/lib/riscosfile.c   |  183 +++++++++++++++++++++++++++++++
 sys/arch/arm26/stand/lib/riscosfile.h   |   35 ++++++
 sys/arch/arm26/stand/lib/srt0.S         |   36 ++++++
 sys/arch/arm26/stand/lib/srt1.c         |  143 ++++++++++++++++++++++++
 11 files changed, 936 insertions(+), 0 deletions(-)

diffs (truncated from 981 to 300 lines):

diff -r 188c93472dbf -r 36e972918cd9 sys/arch/arm26/stand/lib/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/arm26/stand/lib/Makefile Thu Jul 26 22:11:08 2001 +0000
@@ -0,0 +1,22 @@
+#      $NetBSD: Makefile,v 1.1 2001/07/26 22:11:08 bjh21 Exp $
+
+S?=    ${.CURDIR}/../../../../
+
+LIB= riscos
+MKPIC=no
+MKPROFILE=no
+
+CPPFLAGS= -I$S/lib/libsa ${RISCOSCPPFLAGS} ${RISCOSMISCCPPFLAGS}
+#CPPFLAGS+= -DDISK_DEBUG
+#CPPFLAGS+= -DNO_DISKLABEL
+#CPPFLAGS+= -DSAVE_MEMORY
+
+SRCS=  srt1.c devopen.c
+SRCS+= riscoscalls.S riscoscons.c riscoserrors.c riscosfile.c
+
+.include <bsd.lib.mk>
+
+lib${LIB}.o:: ${OBJS}
+       @echo building standard ${LIB} library
+       @rm -f lib${LIB}.o
+       @${LD} -r -o lib${LIB}.o `lorder ${OBJS} | tsort`
diff -r 188c93472dbf -r 36e972918cd9 sys/arch/arm26/stand/lib/Makefile.inc
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/arm26/stand/lib/Makefile.inc     Thu Jul 26 22:11:08 2001 +0000
@@ -0,0 +1,56 @@
+#      $NetBSD: Makefile.inc,v 1.1 2001/07/26 22:11:08 bjh21 Exp $
+#
+#      Configuration variables (default values are below):
+#
+#      S       must be set to the top of the 'sys' tree.
+#      RISCOSDST       may be set to the location of the directory where library
+#              objects are to be built.  Defaults to ${.OBJDIR}/lib/riscos.
+#      RISCOSMISCCPPFLAGS
+#              Miscellaneous cpp flags to be passed to the library's Makefile
+#              when building.
+#      RISCOSMISCMAKEFLAGS
+#              Miscellaneous flags to be passed to the library's Makefile when
+#              building.  See library's Makefile for more details about
+#              supported flags and their default values.
+
+# Default values:
+RISCOSDST?=            ${.OBJDIR}/lib/riscos
+
+RISCOSDIR=             ${S}/arch/arm26/stand/lib
+RISCOSLIB=             ${RISCOSDST}/libriscos.a
+
+RISCOSMAKE= \
+       cd ${RISCOSDIR} && MAKEOBJDIRPREFIX= && unset MAKEOBJDIRPREFIX && \
+         MAKEOBJDIR=${RISCOSDST} ${MAKE} \
+           CC=${CC:Q} CFLAGS=${CFLAGS:Q} \
+           AS=${AS:Q} AFLAGS=${AFLAGS:Q} \
+           LD=${LD:Q} STRIP=${STRIP:Q} \
+           MACHINE=${MACHINE} MACHINE_ARCH=${MACHINE_ARCH:Q} \
+           RISCOSCPPFLAGS=${CPPFLAGS:S@^-I.@-I../../.@g:Q} \
+           RISCOSMISCCPPFLAGS=${RISCOSMISCCPPFLAGS:Q} \
+           ${RISCOSMISCMAKEFLAGS}
+
+${RISCOSLIB}:          .NOTMAIN __always_make_riscoslib
+       @echo making sure the riscos library is up to date...
+       @${RISCOSMAKE} libriscos.a
+
+clean:                 .NOTMAIN cleanriscoslib
+cleanriscoslib:                .NOTMAIN __always_make_riscoslib
+       @echo cleaning the riscos library objects
+       @${RISCOSMAKE} clean
+
+cleandir distclean:    .NOTMAIN cleandirriscoslib
+cleandirriscoslib:             .NOTMAIN __always_make_riscoslib
+       @echo cleandiring the riscos library objects
+       @${RISCOSMAKE} cleandir
+
+depend:                        .NOTMAIN dependriscoslib
+dependriscoslib:               .NOTMAIN __always_make_riscoslib
+       @echo depending the riscos library objects
+       @${RISCOSMAKE} depend
+
+__always_make_riscoslib:       .NOTMAIN
+       @mkdir -p ${RISCOSDST}
+
+.PHONY: __always_make_riscoslib
+.PHONY: cleanriscoslib cleandirriscoslib dependriscoslib
diff -r 188c93472dbf -r 36e972918cd9 sys/arch/arm26/stand/lib/devopen.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/arm26/stand/lib/devopen.c        Thu Jul 26 22:11:08 2001 +0000
@@ -0,0 +1,40 @@
+/*     $NetBSD: devopen.c,v 1.1 2001/07/26 22:11:08 bjh21 Exp $        */
+
+/*-
+ * Copyright (c) 2001 Ben Harris
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <lib/libsa/stand.h>
+
+int
+devopen(struct open_file *f, const char *fname, char **file)
+{
+
+       /* We don't support any devices yet. */
+       f->f_flags |= F_NODEV;
+       *file = (char *)fname;
+       return 0;
+}
diff -r 188c93472dbf -r 36e972918cd9 sys/arch/arm26/stand/lib/riscoscalls.S
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/arm26/stand/lib/riscoscalls.S    Thu Jul 26 22:11:08 2001 +0000
@@ -0,0 +1,186 @@
+/*     $NetBSD: riscoscalls.S,v 1.1 2001/07/26 22:11:08 bjh21 Exp $    */
+
+/*-
+ * Copyright (c) 2001 Ben Harris
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <machine/asm.h>
+#include <riscoscalls.h>
+
+ENTRY(os_writec)
+       mov     ip, sp
+       stmfd   sp!, {fp, ip, lr, pc}
+       sub     fp, ip, #4
+       swine   OS_WriteC
+       ldmdb   fp, {fp, sp, pc}
+
+ENTRY(os_new_line)
+       mov     ip, sp
+       stmfd   sp!, {fp, ip, lr, pc}
+       sub     fp, ip, #4
+       swi     OS_NewLine
+       ldmdb   fp, {fp, sp, pc}
+
+ENTRY(os_readc)
+       mov     ip, sp
+       stmfd   sp!, {fp, ip, lr, pc}
+       sub     fp, ip, #4
+       swi     OS_ReadC
+       ldmdb   fp, {fp, sp, pc}
+
+ENTRY(xosargs_read_ptr)
+       mov     ip, sp
+       stmfd   sp!, {fp, ip, lr, pc}
+       sub     fp, ip, #4
+       mov     r3, r1
+       mov     r1, r0
+       mov     r0, #OSArgs_ReadPtr
+       swi     OS_Args
+       ldmvsdb fp, {fp, sp, pc}
+       teq     r3, #0
+       strne   r2, [r3]
+       mov     r0, #0
+       ldmdb   fp, {fp, sp, pc}
+
+ENTRY(xosargs_set_ptr)
+       mov     ip, sp
+       stmfd   sp!, {fp, ip, lr, pc}
+       sub     fp, ip, #4
+       mov     r2, r1
+       mov     r1, r0
+       mov     r0, #OSArgs_SetPtr
+       swi     OS_Args
+       movvc   r0, #0
+       ldmdb   fp, {fp, sp, pc}
+
+ENTRY(xosargs_read_ext)
+       mov     ip, sp
+       stmfd   sp!, {fp, ip, lr, pc}
+       sub     fp, ip, #4
+       mov     r3, r1
+       mov     r1, r0
+       mov     r0, #OSArgs_ReadExt
+       swi     OS_Args
+       ldmvsdb fp, {fp, sp, pc}
+       teq     r3, #0
+       strne   r2, [r3]
+       mov     r0, #0
+       ldmdb   fp, {fp, sp, pc}
+
+ENTRY(xosgbpb_write)
+       mov     ip, sp
+       stmfd   sp!, {r4, fp, ip, lr, pc}
+       sub     fp, ip, #4
+       mov     ip, r3
+       mov     r3, r2
+       mov     r2, r1
+       mov     r1, r0
+       mov     r0, #OSGBPB_Write
+       swi     XOS_GBPB
+       teq     ip, #0
+       strne   r3, [ip]
+       movvc   r0, #0
+       ldmdb   fp, {r4, fp, sp, pc}
+
+ENTRY(xosgbpb_read)
+       mov     ip, sp
+       stmfd   sp!, {r4, fp, ip, lr, pc}
+       sub     fp, ip, #4
+       mov     ip, r3
+       mov     r3, r2
+       mov     r2, r1
+       mov     r1, r0
+       mov     r0, #OSGBPB_Read
+       swi     XOS_GBPB
+       teq     r3, #0
+       strne   r3, [ip]
+       movvc   r0, #0
+       ldmdb   fp, {r4, fp, sp, pc}
+
+ENTRY(xosfind_close)
+       mov     ip, sp
+       stmfd   sp!, {fp, ip, lr, pc}
+       sub     fp, ip, #4
+       mov     r1, r0
+       mov     r0, #OSFind_Close
+       swi     XOS_Find
+       movvc   r0, #0
+       ldmdb   fp, {fp, sp, pc}        
+
+ENTRY(xosfind_open)
+       mov     ip, sp
+       stmfd   sp!, {fp, ip, lr, pc}
+       sub     fp, ip, #4
+       swi     XOS_Find
+       ldmvsdb fp, {fp, sp, pc}
+       teq     r3, #0
+       strne   r0, [r3]
+       mov     r0, #0
+       ldmdb   fp, {fp, sp, pc}        
+
+ENTRY(os_get_env)
+       mov     ip, sp
+       stmfd   sp!, {r4, fp, ip, lr, pc}
+       sub     fp, ip, #4
+       mov     r0, r3
+       mov     r1, r4
+       swi     OS_GetEnv
+       teq     r3, #0
+       strne   r1, [r3]
+       teq     r4, #0
+       strne   r2, [r4]
+       ldmdb   fp, {r4, fp, sp, pc}
+
+ENTRY(os_exit)
+       mov     ip, sp
+       stmfd   sp!, {fp, ip, lr, pc}
+       sub     fp, ip, #4
+       mov     r2, r1
+       ldr     r1, Labex
+       swi     OS_Exit
+       ldmdb   fp, {fp, sp, pc}
+Labex:
+       .ascii  "ABEX"



Home | Main Index | Thread Index | Old Index