arm32 kernel source restructure

- These files are moving home.
This commit is contained in:
mark 1997-10-14 07:49:19 +00:00
parent 3c891ba5b1
commit 05a00dc8d4
23 changed files with 0 additions and 3130 deletions

View File

@ -1,93 +0,0 @@
# $NetBSD: Makefile,v 1.3 1996/06/12 19:24:19 mark Exp $
# Copyright (c) 1994,1995 Mark Brinicombe.
# Copyright (c) 1994 Brini.
# All rights reserved.
#
# This code is derived from software written for Brini by Mark Brinicombe
#
# 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. All advertising materials mentioning features or use of this software
# must display the following acknowledgement:
# This product includes software developed by Brini.
# 4. The name of the company nor the name of the author may be used to
# endorse or promote products derived from this software without specific
# prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY BRINI ``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 OR CONTRIBUTORS 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.
#
# RiscBSD kernel project
#
# Makefile
#
# Makefile for RiscBSD bootloader for RISCOS
#
# Created : 14/01/96
#
S= ../../..
machine-links:
-rm -f machine && \
ln -s ${.CURDIR}/../include machine
-rm -f ${MACHINE_ARCH} && \
ln -s ${.CURDIR}/../include ${MACHINE_ARCH}
all: machine-links boot
NOPROG= noprog
NOMAN= noman
CFLAGS= -O3 -fno-builtin -D_LOCORE -D_KERNEL -I. -I${.CURDIR} -I$S -I${.CURDIR}/../..
AFLAGS= -D_LOCORE -D_KERNEL -I. -I${.CURDIR} -I$S -I${.CURDIR}/../..
### find out what to use for libkern and libsa
#SAREL=
#KERNREL=
#.include "Makefile.inc"
.include "$S/lib/libsa/Makefile.inc"
.include "$S/lib/libkern/Makefile.inc"
all: boot ${SALIB} ${KERNLIB}
#.PATH: $S/lib/libkern
#.PATH: $S/lib/libkern/arch/arm32
# start.o should be first
OBJS= start.o strcpy.o strlen.o strncmp.o strstr.o \
svc32.o div.o exit.o enteros.o exitos.o setcpsr.o \
memcpy.o memset.o ntohl.o _bsdboot.o _main.o \
areahand.o vsprintf.o bsdbooter.o swiv.o
boot: ${OBJS}
${LD} -Bstatic -e start -N -Ttext 0x8000 -o boot ${OBJS}
cp boot boot.sym
@strip boot
@sh ${.CURDIR}/rmaouthdr boot boot.tmp
@mv -f boot.tmp boot
@ls -l boot
CLEANFILES+=boot boot.sym machine ${MACHINE_ARCH}
clean::
rm -f a.out [Ee]rrs mklog core *.core
rm -f ${PROG} ${OBJS} ${LOBJS} ${CLEANFILES}
.include <bsd.prog.mk>

View File

@ -1,28 +0,0 @@
# $NetBSD: Makefile.inc,v 1.1 1996/01/31 23:17:48 mark Exp $
#
# NOTE: $S must correspond to the top of the 'sys' tree
KERNDIR= $S/lib/libkern
KERNDST= lib/kern
KERNREL?= ../../
KERNLIB?= ${KERNDST}/libkern.a
${KERNLIB}: .NOTMAIN __always_make_kernlib
@echo making sure the kern library is up to date...
@(cd ${KERNDST} && ${MAKE} -f ${KERNREL}${KERNDIR}/Makefile \
KERNCC="${CC}" \
KERNCFLAGS="${CFLAGS}" \
KERNREL="${KERNREL}" \
KERNDIR="${KERNDIR}" libkern.o)
clean:: .NOTMAIN __always_make_kernlib
@echo cleaning the kern library objects
@(cd ${KERNDST} && ${MAKE} -f ${KERNREL}${KERNDIR}/Makefile \
KERNCC="${CC}" \
KERNCFLAGS="${CFLAGS}" \
KERNREL="${KERNREL}" \
KERNDIR="${KERNDIR}" clean)
__always_make_kernlib: .NOTMAIN
@([ -d ${KERNDST} ] || mkdir -p ${KERNDST})

View File

@ -1,7 +0,0 @@
Ok, this is the bootloader source that can be used to boot NetBSD/arm32
from RISCOS. This code was written for use with Norcroft C and
objasm under RISCOS. It has been modified to compile under NetBSD/arm32
but is as yet untested.
It is provided here for the moment as example code for a boot loader
and will be updated shortly to compile under NetBSD/arm32

View File

@ -1,52 +0,0 @@
/* $NetBSD: _bsdboot.S,v 1.2 1996/06/03 21:24:48 mark Exp $ */
/* Copyright (c) 1994 Mark Brinicombe.
* Copyright (c) 1994 Brini.
* All rights reserved.
*
* This code is derived from software written for Brini by Mark Brinicombe
*
* 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. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Brini.
* 4. The name of the company nor the name of the author may be used to
* endorse or promote products derived from this software without specific
* prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY BRINI ``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 REGENTS OR CONTRIBUTORS 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.
*
* RiscBSD kernel project
*
* _boot.s
*
* Kernel entry/exit code
*
* Created : 12/09/94
*
* Based on kate/boot/_boot.s
*/
#include "regs.h"
.text
.global __bsdboot
__bsdboot:
mov pc, r1

View File

@ -1,138 +0,0 @@
/* $NetBSD: _main.S,v 1.2 1996/06/03 21:24:49 mark Exp $ */
/* Copyright (c) 1994 Mark Brinicombe.
* Copyright (c) 1994 Brini.
* All rights reserved.
*
* This code is derived from software written for Brini by Mark Brinicombe
*
* 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. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Brini.
* 4. The name of the company nor the name of the author may be used to
* endorse or promote products derived from this software without specific
* prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY BRINI ``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 REGENTS OR CONTRIBUTORS 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.
*
* RiscBSD kernel project
*
* _main.s
*
* Kernel entry/exit code
*
* Created : 12/09/94
*
* Based on kate/boot/_main.s
*/
#include "regs.h"
.global ___main
___main:
swi 0x20010
mov sp, r1
sub sl, sp, #2048
ldr r3, [pc, #cli_ptr - . - 8]
str r0, [r3]
#if 0
LDR a4,[pc,#|__cli_ptr|-.-8]
STR a1,[a4,#0]
LDR a4,[pc,#|__himem_ptr|-.-8]
STR a2,[a4,#0]
LDR a4,[pc,#|__stack_ptr|-.-8]
STR sl,[a4,#0]
LDR a4,[pc,#|__robase_ptr|-.-8]
LDR a1,[a4,#0]
LDR a4,[pc,#|__base_ptr|-.-8]
STR a1,[a4,#0]
LDR a4,[pc,#|__rwlimit_ptr|-.-8]
LDR a1,[a4,#0]
LDR a4,[pc,#|__lomem_ptr|-.-8]
STR a1,[a4,#0]
LDR a4,[pc,#|__break_ptr|-.-8]
STR a1,[a4,#0]
#endif
#if 0
cmp sl, r0
movlss pc, lr /* no stack - exit fast */
add sl, sl, #256
#endif
mov fp, #0
b __main
cli_ptr:
.word ___cli
.data
.global ___cli
___cli:
.word 0
#if 0
|__cli_ptr|
DCD |__cli|
|__robase_ptr|
DCD |__robase|
|__base_ptr|
DCD |__base|
|__rwbase_ptr|
DCD |__rwbase|
|__rwlimit_ptr|
DCD |__rwlimit|
|__himem_ptr|
DCD |__himem|
|__lomem_ptr|
DCD |__lomem|
|__break_ptr|
DCD |__break|
|__stack_ptr|
DCD |__stack|
|__time_ptr|
DCD |__time|
EXPORT |__cli| ; CLI from OS_GetEnv
|__cli|
DCD 0
EXPORT |__base| ; BASE (application = 0x8000)
|__base|
DCD 0
EXPORT |__lomem| ; LOMEM
|__lomem|
DCD 0
EXPORT |__himem| ; HIMEM from OS_GetEnv
|__himem|
DCD 0
EXPORT |__break| ; the 'break'
|__break|
DCD 0
EXPORT |__stack| ; stack limit
|__stack|
DCD 0
#endif

View File

@ -1,93 +0,0 @@
/* $NetBSD: areahand.S,v 1.2 1996/06/03 21:24:50 mark Exp $ */
/*
* Copyright (c) 1994 Mark Brinicombe.
* Copyright (c) 1994 Brini.
* All rights reserved.
*
* This code is derived from software written for Brini by Mark Brinicombe
*
* 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. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Brini.
* 4. The name of the company nor the name of the author may be used to
* endorse or promote products derived from this software without specific
* prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY BRINI ``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 REGENTS OR CONTRIBUTORS 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.
*
* RiscBSD kernel project
*
* areahand.s
*
* Created : 12/09/94
*/
#include "regs.h"
.text
.global _kernarea_handler
/*
* r0 - code
* r1 - page block
* r2 - entries
* r3 - size increase
* r4 - current size
* r5 - pagesize
* r12 - arrangement table
*/
_kernarea_handler:
/* Is it a pregrow request ? */
teq r0, #0x00000000
bicnes pc, lr, #1<<28
/* Make sure that the area is currently 0 in size */
teq r4, #0x00000000
movne r0, #0x000000
orrnes pc, lr, #1<<28
teq r1, #0x00000000
biceqs pc, lr, #1<<28
/* Store registers */
stmfd sp!, {r0-r12}
/* Get first page number */
ldr r8, [r12, #0x0004]
sub r8, r8, r2
mov r8, #0x00000700
str r1, [r12]
loop:
str r8, [r1], #0x000c
add r8, r8, #0x00000001
subs r2, r2, #0x00000001
bne loop
ldmfd sp!, {r0-r12}
/* bics pc, lr, #1<<28 */
adr r0, error1
orrs pc, lr, #1<<28
error1:
.word 0
.asciz "error1"

View File

@ -1,161 +0,0 @@
; ARM6 PSR transfer macros
; Condition code symbols
Cond_EQ * 0 :SHL: 28
Cond_NE * 1 :SHL: 28
Cond_CS * 2 :SHL: 28
Cond_HS * Cond_CS
Cond_CC * 3 :SHL: 28
Cond_LO * Cond_CC
Cond_MI * 4 :SHL: 28
Cond_PL * 5 :SHL: 28
Cond_VS * 6 :SHL: 28
Cond_VC * 7 :SHL: 28
Cond_HI * 8 :SHL: 28
Cond_LS * 9 :SHL: 28
Cond_GE * 10 :SHL: 28
Cond_LT * 11 :SHL: 28
Cond_GT * 12 :SHL: 28
Cond_LE * 13 :SHL: 28
Cond_AL * 14 :SHL: 28
Cond_ * Cond_AL
Cond_NV * 15 :SHL: 28
; New positions of I and F bits in 32-bit PSR
I32_bit * 1 :SHL: 7
F32_bit * 1 :SHL: 6
IF32_26Shift * 26-6
; Processor mode numbers
USR26_mode * 2_00000
FIQ26_mode * 2_00001
IRQ26_mode * 2_00010
SVC26_mode * 2_00011
USR32_mode * 2_10000
FIQ32_mode * 2_10001
IRQ32_mode * 2_10010
SVC32_mode * 2_10011
ABT32_mode * 2_10111
UND32_mode * 2_11011
; New register names
r13_abort RN 13
r14_abort RN 14
lr_abort RN 14
r13_undef RN 13
r14_undef RN 14
lr_undef RN 14
MACRO
mrs $cond, $rd, $psrs
LCLA psrtype
psrtype SETA -1
[ "$psrs" = "CPSR" :LOR: "$psrs" = "CPSR_all"
psrtype SETA 0 :SHL: 22
]
[ "$psrs" = "SPSR" :LOR: "$psrs" = "SPSR_all"
psrtype SETA 1 :SHL: 22
]
ASSERT psrtype <> -1
ASSERT $rd <> 15
& Cond_$cond :OR: 2_00000001000011110000000000000000 :OR: psrtype :OR: ($rd :SHL: 12)
MEND
MACRO
msr $cond, $psrl, $op2a, $op2b
LCLA psrtype
LCLS op2as
LCLA op
LCLA shift
psrtype SETA -1
[ "$psrl" = "CPSR" :LOR: "$psrl" = "CPSR_all"
psrtype SETA (0:SHL:22) :OR: (1:SHL:19) :OR: (1:SHL:16)
]
[ "$psrl" = "CPSR_flg"
psrtype SETA (0:SHL:22) :OR: (1:SHL:19) :OR: (0:SHL:16)
]
[ "$psrl" = "CPSR_ctl"
psrtype SETA (0:SHL:22) :OR: (0:SHL:19) :OR: (1:SHL:16)
]
[ "$psrl" = "SPSR" :LOR: "$psrl" = "SPSR_all"
psrtype SETA (1:SHL:22) :OR: (1:SHL:19) :OR: (1:SHL:16)
]
[ "$psrl" = "SPSR_flg"
psrtype SETA (1:SHL:22) :OR: (1:SHL:19) :OR: (0:SHL:16)
]
[ "$psrl" = "SPSR_ctl"
psrtype SETA (1:SHL:22) :OR: (0:SHL:19) :OR: (1:SHL:16)
]
ASSERT psrtype <> -1
[ ("$op2a" :LEFT: 1) = "#"
; Immediate operand
op2as SETS "$op2a" :RIGHT: ((:LEN: "$op2a")-1)
op SETA $op2as
[ "$op2b" = ""
; Rotate not specified in immediate operand
shift SETA 0
WHILE (op :AND: &FFFFFF00)<>0 :LAND: shift<16
op SETA ((op:SHR:30):AND:3):OR:(op:SHL:2)
shift SETA shift + 1
WEND
ASSERT (op :AND: &FFFFFF00)=0
|
; Rotate of immediate operand specified explicitly
ASSERT (($op2b):AND:&FFFFFFE1)=0
shift SETA ($opt2b):SHR:1
]
op SETA (shift :SHL: 8) :OR: op :OR: (1:SHL:25)
|
; Not an immediate operand
[ "$op2b" = ""
; Unshifted register
op SETA ($op2a) :OR: (0:SHL:25)
|
! 1, "Shifted register not yet implemented in this macro!"
]
]
& Cond_$cond :OR: 2_00000001001000001111000000000000 :OR: op :OR: psrtype
MEND
; SetMode newmode, reg1, regoldpsr
;
; Sets processor mode to constant value newmode
; using register reg1 as a temporary.
; If regoldpsr is specified, then this register
; on exit holds the old PSR before the mode change
; reg1 on exit always holds the new PSR after the mode change
; MACRO
; SetMode $newmode, $reg1, $regoldpsr
; [ "$regoldpsr"=""
; mrs AL, $reg1, CPSR_all
; BIC $reg1, $reg1, #&1F
; ORR $reg1, $reg1, #$newmode
; msr AL, CPSR_all, $reg1
; |
; mrs AL, $regoldpsr, CPSR_all
; BIC $reg1, $regoldpsr, #&1F
; ORR $reg1, $reg1, #$newmode
; msr AL, CPSR_all, $reg1
; ]
; MEND
MACRO
mrc $cond, $coproc, $op, $rd, $crn, $crm, $info
& Cond_$cond :OR: 2_00001110000100000000000000010000 :OR: ($coproc :SHL: 8) :OR: ($op :SHL: 21) :OR: ($rd :SHL: 12) :OR: ($crn :SHL: 16) :OR: $crm :OR: ($info :SHL: 5)
MEND
MACRO
mcr $cond, $coproc, $op, $rd, $crn, $crm, $info
& Cond_$cond :OR: 2_00001110000000000000000000010000 :OR: ($coproc :SHL: 8) :OR: ($op :SHL: 21) :OR: ($rd :SHL: 12) :OR: ($crn :SHL: 16) :OR: $crm :OR: ($info :SHL: 5)
MEND
END

View File

@ -1,774 +0,0 @@
/* $NetBSD: bsdbooter.c,v 1.2 1996/06/03 21:24:51 mark Exp $ */
/*
* Copyright (c) 1994,1995 Mark Brinicombe.
* Copyright (c) 1994,1995 Brini.
* All rights reserved.
*
* This code is derived from software written for Brini by Mark Brinicombe
*
* 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. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Mark Brinicombe.
* 4. The name of the company nor the name of the author may 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.
*
* RiscBSD kernel project
*
* bsdbooter.c
*
* RiscBSD boot loader
*
* Created : 12/09/94
*
* Based on kate/boot/boot.c
*/
/* Include standard header files */
# include <stdlib.h>
# include <string.h>
# include <stdarg.h>
/* Include local headers */
#include <sys/types.h>
#include <sys/exec.h>
#include <machine/cpu.h>
#include <machine/katelib.h>
#include <machine/bootconfig.h>
#include "swiv.h"
#include "swis.h"
/*
* Declare global variables
*/
# define VERSION "2.10"
# define USE_MODULEAREA
# define KERNAREA 512
# define KERNBASE 0xf0000000
# define TABLEAREA 513
# define LOADAREA 514
# define SCRATCHSIZE 0xc000
# define OS_DynamicArea 0x66
# define OS_Memory 0x68
# define OS_MMUControl 0x6b
# define FASTBOOT_FILENAME "<BtRiscBSD$Dir>.booter.fastboot"
/*
* Declare external variables
*/
extern char *__cli;
/*
* Local vars. Some of these have to be global because they are used after
* the processor has been switches to SVC mode local variables would be
* lost as they would be on the USR mode stack.
*/
typedef struct exec aout_t;
BootConfig bootconfig;
int in[3], out[3];
char kernelname[1024];
unsigned char *buffer;
static aout_t aout;
unsigned int kernelsize;
unsigned int logical;
unsigned int physical;
unsigned int filesize;
unsigned int copysize;
/*
* Local function prototypes
*/
void fatal(struct Error *error);
unsigned char *locate_memory_blocks(void);
void uprintf(char *formattoken, ...);
void _bsdboot(BootConfig *bootconfig, unsigned int address);
int vsprintf(char *buf, const char *fmt, va_list args);
/* Now for the main code */
extern int main (int, char **);
void __exit(int);
void _main(void)
{
uprintf("_main entered\n");
__exit (main (0, (char **)0)); /* ... ignition */
/* not reached */
}
/* The main booter code */
int main(int argc, char *argv[])
{
char *cliptr;
int loop;
int filehandle;
unsigned char *arrangementtable;
uprintf("main entered\n");
/* Analyse the command line */
cliptr = __cli;
uprintf("command line is %s\n", cliptr);
/* Skip the command name */
while (*cliptr != ' ' && *cliptr != 0)
++cliptr;
/* Skip any spaces */
while (*cliptr == ' ')
++cliptr;
/* Check for another parameter */
if (*cliptr != 0)
{
for (loop = 0; *cliptr != ' ' && *cliptr != 0; ++loop,++cliptr)
{
kernelname[loop] = *cliptr;
}
kernelname[loop] = 0;
}
else
strcpy(kernelname, "riscbsd");
strcpy(bootconfig.kernelname, kernelname);
/* Write the command line used to a fastboot file. Execing or Obeying
* this file will boot RiscBSD. This can be used during the RiscOS bootup
* to enable a fast boot.
*/
/*
* Open the autoboot file. Just skip if file cannot be opened.
*/
swi(OS_Find, IN(R0|R1)|OUT(R0), 0x80, FASTBOOT_FILENAME, &filehandle);
if (filehandle != 0)
{
swi(OS_GBPB, IN(R0|R1|R2|R3|R4), 2, filehandle, __cli,
strlen(__cli), 0);
swi(OS_GBPB, IN(R0|R1|R2|R3|R4), 2, filehandle, "\n", 1, 0);
/* Close the file */
swi(OS_Find, IN(R0|R1), 0, filehandle);
swi(OS_File, IN(R0|R1|R2), 18, FASTBOOT_FILENAME, 0xfeb);
}
else
{
uprintf("Warning: Cannot write fastboot file %s\n\r", FASTBOOT_FILENAME);
}
/* Set the screen mode ... */
/* I know this is messy. It is currently just a hack to try things out
* Why didn't Acorn add a SWI call to interpret the mode string and return
* a mode specifer ?
*/
/* Also this is temporary as eventually the console driver will set the VIDC
* up as required.
* It sort of expects the screenmode= options to be at the end of the string.
*/
{
char *modeptr;
int modespec[6];
modeptr = strstr(__cli, "screenmode=");
if (modeptr)
{
modeptr += 11;
modespec[0] = 0x00000001;
modespec[1] = 0x00000000;
modespec[2] = 0x00000000;
modespec[3] = 0x00000003;
modespec[4] = 0x00000000;
modespec[5] = -1;
while (*modeptr)
{
switch (*modeptr)
{
case 'X':
case 'x':
++modeptr;
while (*modeptr >= '0' && *modeptr <= '9')
{
modespec[1] = (modespec[1] * 10) + (*modeptr - '0');
++modeptr;
}
break;
case 'Y':
case 'y':
++modeptr;
while (*modeptr >= '0' && *modeptr <= '9')
{
modespec[2] = (modespec[2] * 10) + (*modeptr - '0');
++modeptr;
}
break;
/*
case 'C':
case 'c':
case 'G':
case 'g':
++modeptr;
while (*modeptr >= '0' && *modeptr <= '9')
{
modespec[3] = (modespec[3] * 10) + (*modeptr - '0');
++modeptr;
}
break;
*/
case 'F':
case 'f':
++modeptr;
while (*modeptr >= '0' && *modeptr <= '9')
{
modespec[4] = (modespec[4] * 10) + (*modeptr - '0');
++modeptr;
}
break;
default:
++modeptr;
break;
}
}
if (modespec[4] == 0) modespec[4] = -1;
/* uprintf("x=%d y=%d c=%d f=%d\n", modespec[1], modespec[2],
modespec[3], modespec[4]);*/
fatal(swix(Wimp_SetMode, IN(R0), &modespec));
bootconfig.framerate = modespec[4];
}
else
bootconfig.framerate = 0;
}
/* Announcement time .. */
/* Used to be above but now moved to after the mode change */
if (strstr(__cli, "verbose") != 0)
uprintf("RiscBSD BootLoader " VERSION " " __DATE__ "\n\r");
/* A bit of info */
if (strstr(__cli, "verbose") != 0)
uprintf("Kernel: %s\n\r", kernelname);
/* Get the machine id */
fatal(swix(OS_ReadSysInfo, IN(R0)|OUT(R3), 2, &bootconfig.machine_id));
/* Get the display variables. Failure on any of these will abort the boot */
in[0] = 149;
in[1] = 150;
in[2] = -1;
fatal(swix(OS_ReadVduVariables, IN(R0|R1), &in, &out));
bootconfig.display_start = out[0];
bootconfig.display_size = out[1];
fatal(swix(OS_ReadModeVariable, IN(R0|R1) | OUT(R2), -1, 9,
&bootconfig.bitsperpixel));
fatal(swix(OS_ReadModeVariable, IN(R0|R1) | OUT(R2), -1, 11,
&bootconfig.width));
fatal(swix(OS_ReadModeVariable, IN(R0|R1) | OUT(R2), -1, 12,
&bootconfig.height));
/* Will the kernel support this mode ? */
if (bootconfig.bitsperpixel > 3)
{
swi(OS_Write0, IN(R0),
"Error: Only 1, 2, 4 or 8 bpp modes are currently supported\n\r");
return(0);
}
/* Get the arrangement table for the memory */
arrangementtable = locate_memory_blocks();
/*
* Ok we will support a.out files as well. This means that we need to
* identify the format.
*/
/* Get the size of the file */
fatal(swix(OS_File, IN(R0|R1)|OUT(R4), 5, kernelname, &filesize));
/*
* Read the start of the file so that we change check for the a.out
* magic number.
*/
swi(OS_Find, IN(R0|R1)|OUT(R0), 0x40, kernelname, &filehandle);
if (filehandle == 0)
{
uprintf("Error: Cannot read kernel file %s\n\r", kernelname);
return(0);
}
aout.a_midmag = 0;
fatal(swix(OS_GBPB, IN(R0|R1|R2|R3|R4), 3, filehandle, &aout,
sizeof(aout_t), 0));
/* Do we have an a.out file ? */
switch(N_GETMAGIC(aout)) {
case NMAGIC:
if (strstr(__cli, "verbose") != 0)
swi(OS_Write0, IN(R0), "Kernel binary is NMAGIC a.out format\n\r");
kernelsize = (unsigned int)(aout.a_text + aout.a_data + aout.a_bss);
copysize = (unsigned int)(aout.a_text + aout.a_data);
break;
case OMAGIC:
if (strstr(__cli, "verbose") != 0)
swi(OS_Write0, IN(R0), "Kernel binary is OMAGIC a.out format\n\r");
kernelsize = (unsigned int)(aout.a_text + aout.a_data + aout.a_bss);
copysize = (unsigned int)(aout.a_text + aout.a_data);
break;
case ZMAGIC:
if (strstr(__cli, "verbose") != 0)
swi(OS_Write0, IN(R0), "Kernel binary is ZMAGIC a.out format\n\r");
kernelsize = (unsigned int)(aout.a_text + aout.a_data + aout.a_bss);
copysize = (unsigned int)(aout.a_text + aout.a_data);
break;
default:
if (strstr(__cli, "verbose") != 0)
swi(OS_Write0, IN(R0), "Kernel binary is AIF format\n\r");
kernelsize = filesize;
copysize = filesize;
break;
}
/* Give ourselves 16K of spare space and round off to a page */
/*
* This is messy. We should read the memory info first, but I have not
* changed things yet. This is part of the hack to support a.out files
* as well
*/
kernelsize = (kernelsize + 0x4000) & ~(bootconfig.pagesize-1);
/* Set the virtual address of the kernel in the bootconfig structure */
bootconfig.kernvirtualbase = KERNBASE;
bootconfig.kernsize = kernelsize;
bootconfig.argvirtualbase = bootconfig.kernvirtualbase
+ bootconfig.kernsize;
bootconfig.argsize = bootconfig.pagesize;
bootconfig.scratchvirtualbase = bootconfig.argvirtualbase
+ bootconfig.argsize;
bootconfig.scratchsize = SCRATCHSIZE;
kernelsize += bootconfig.argsize;
kernelsize += bootconfig.scratchsize;
/* Verbose info to the user. This is mainly debugging */
if (strstr(__cli, "verbose") != 0)
{
uprintf("filesize = %08x\n\r", filesize);
uprintf("bootconfig.kernvirtualbase = %08x\n\r",
bootconfig.kernvirtualbase);
uprintf("bootconfig.kernsize = %08x\n\r", bootconfig.kernsize);
uprintf("bootconfig.argvirtualbase = %08x\n\r",
bootconfig.argvirtualbase);
uprintf("bootconfig.argsize = %08x\n\r", bootconfig.argsize);
uprintf("bootconfig.scratchvirtualbase = %08x\n\r",
bootconfig.scratchvirtualbase);
uprintf("bootconfig.scratchsize = %08x\n\r", bootconfig.scratchsize);
uprintf("kernelsize = %08x\n\r", kernelsize);
uprintf("copysize = %08x\n\r", copysize);
}
# ifdef USE_MODULEAREA
/* Allocate memory in module area to hold the data we are loading */
fatal(swix(OS_Module, IN(R0|R3)|OUT(R2), 6, filesize, &buffer));
# else
/* Allocate memory to hold the data we are loading */
swix(OS_DynamicArea, IN(R0|R1), 1, LOADAREA);
fatal(swix(OS_DynamicArea, IN(R0|R1|R2|R3|R4|R5|R6|R7|R8)|OUT(R3), 0,
LOADAREA, filesize, -1, 0x80, filesize, 0, 0, "Kate Data", &buffer));
# endif
/* Load the appropriate part depending on the file type */
switch (N_GETMAGIC(aout)) {
case OMAGIC:
case NMAGIC:
swi(OS_GBPB, IN(R0|R1|R2|R3|R4), 3, filehandle, buffer,
filesize, sizeof(aout_t));
break;
case ZMAGIC:
default:
swi(OS_GBPB, IN(R0|R1|R2|R3|R4), 3, filehandle, buffer,
filesize, 0);
break;
}
/* Close the file */
fatal(swix(OS_Find, IN(R0|R1), 0, filehandle));
/* This is redundant at the moment */
swix(OS_DynamicArea, IN(R0|R1), 1, KERNAREA);
fatal(swix(OS_DynamicArea, IN(R0|R1|R2|R3|R4|R5|R6|R7|R8), 0,
KERNAREA, 0, KERNBASE, 0x80, 0x1000, 0, 0, "Kate Kernel"));
/* Shutdown RiscOS cleanly ... */
/* Close all open files and shutdown filing systems */
swix(OS_FSControl, IN(R0), 23);
/* Issue a pre-reset service call to reset the podules */
swix(OS_ServiceCall, IN(R1), 0x45);
/* Kill the etherH module to avoid locks up on reboot */
swix(OS_Module, IN(R0|R1), 4, "EtherH");
/* More user information describing the memory found */
if (strstr(__cli, "verbose") != 0)
{
uprintf("DRAM bank 0a = %08x %08x\n\r", bootconfig.dram[0].address,
bootconfig.dram[0].pages * bootconfig.pagesize);
uprintf("DRAM bank 0b = %08x %08x\n\r", bootconfig.dram[1].address,
bootconfig.dram[1].pages * bootconfig.pagesize);
uprintf("DRAM bank 1a = %08x %08x\n\r", bootconfig.dram[2].address,
bootconfig.dram[2].pages * bootconfig.pagesize);
uprintf("DRAM bank 1b = %08x %08x\n\r", bootconfig.dram[3].address,
bootconfig.dram[3].pages * bootconfig.pagesize);
uprintf("VRAM bank 0 = %08x %08x\n\r", bootconfig.vram[0].address,
bootconfig.vram[0].pages * bootconfig.pagesize);
}
/* Hack for 2 Meg VRAM until the new console code is in place */
/* if (strstr(__cli, "vramhack") != 0)
{
bootconfig.display_size /= 1;
bootconfig.vram[0].pages /= 2;
uprintf("VRAM bank 0 = %08x %08x\n\r", bootconfig.vram[0].address,
bootconfig.vram[0].pages * bootconfig.pagesize);
}*/
/* Jump to SVC26 mode - remember we have no local vars now ! */
EnterOS();
/* Find the number of the upper most bank of DRAM available */
loop = 3;
while (bootconfig.dram[loop].address == 0)
--loop;
/* Allocate the physical addresses for the kernel in this bank */
physical = bootconfig.dram[loop].address - kernelsize
+ bootconfig.dram[loop].pages * bootconfig.pagesize;
bootconfig.kernphysicalbase = physical;
bootconfig.argphysicalbase = bootconfig.kernphysicalbase
+ bootconfig.kernsize;
bootconfig.scratchphysicalbase = bootconfig.argphysicalbase
+ bootconfig.argsize;
/* Yet more debugging info */
if (strstr(__cli, "verbose") != 0)
{
uprintf("buffer = %08x\n\r", buffer);
uprintf("physical = %08x\n\r", physical);
uprintf("bootconfig.kernphysicalbase = %08x\n\r",
bootconfig.kernphysicalbase);
uprintf("bootconfig.argphysicalbase = %08x\n\r",
bootconfig.argphysicalbase);
uprintf("bootconfig.scratchphysicalbase = %08x\n\r",
bootconfig.scratchphysicalbase);
}
/*
* Ok just check to see if anything is mapped where we are about to map
* the kernel.
*/
/*
for (logical = KERNBASE; logical < KERNBASE + kernelsize;
logical += bootconfig.pagesize)
{
if (ReadWord(0x02c00000 + (logical >> 10) & 0xfffffffc) != 0)
{
uprintf("Error: Memory required for RiscBSD boot not available\n\r");
return(0);
}
}
*/
/* Get out clause */
if (strstr(__cli, "noboot") != 0)
{
ExitOS();
return(0);
}
/*
* Hook the physical pages to the required virtual address directly by
* writing into RiscOS's page tables. This should be done via a
* dynamic area handler but I cannot get it to work as documented.
*/
for (logical = KERNBASE; logical < KERNBASE + kernelsize;
logical += bootconfig.pagesize)
{
WriteWord(0x02c00000 + (logical >> 10) & 0xfffffffc,
0x00000ffe | (physical & 0xfffff000));
physical += bootconfig.pagesize;
}
/* Map the IO up high so we can get at it */
WriteWord(0x02c0c000 + (0xf6000000 >> 18) & 0xfffffffc,
0x00000412 | (0x03200000 & 0xfffff000));
WriteWord(0x02c0c000 + (0xf6100000 >> 18) & 0xfffffffc,
0x00000412 | (0x03400000 & 0xfffff000));
memset((char *)bootconfig.display_start, 0xcc, 0x4000);
/* Disable IRQ and FIQ interrupts */
SetCPSR(I32_bit | F32_bit, I32_bit | F32_bit);
memset((char *)bootconfig.display_start + 0x4000, 0x55, 0x4000);
memcpy((char *)bootconfig.argvirtualbase, __cli, bootconfig.argsize);
memset((char *)bootconfig.display_start + 0x8000, 0x80, 0x4000);
memset((char *)bootconfig.argvirtualbase, SCRATCHSIZE, 0);
memset((char *)bootconfig.display_start + 0xC000, 0xbb, 0x4000);
memcpy((char *)bootconfig.kernvirtualbase, buffer, copysize);
memset((char *)bootconfig.display_start + 0x10000, 0xaa, 0x4000);
/* Real late debugging get out clause */
if (strstr(__cli, "nearboot") != 0)
{
SetCPSR(I32_bit | F32_bit, 0);
ExitOS();
return(0);
}
/* Punch into SVC32 mode */
SVC32();
/* Point of no return */
switch (N_GETMAGIC(aout)) {
case OMAGIC:
case NMAGIC:
case ZMAGIC:
_bsdboot(&bootconfig, (unsigned int)aout.a_entry);
break;
default:
_bsdboot(&bootconfig, KERNBASE);
break;
}
return(0);
}
/* Report an error */
void fatal(struct Error *error)
{
if (error)
{
swi(OS_GenerateError, IN(R0), error);
}
}
/* Locate all the blocks of memory in the system */
unsigned char *locate_memory_blocks(void)
{
int loop;
int page;
int currentpage;
int currentpages;
int currentaddr;
unsigned char *table;
unsigned int pagesize;
unsigned int tablesize;
int dramblocks = 0;
int vramblocks = 0;
/* Get table size and page size */
fatal(swix(OS_Memory, IN(R0)|OUT(R1|R2), 6, &tablesize, &pagesize));
/* Allocate memory for table */
/*# ifdef USE_MODULEAREA*/
fatal(swix(OS_Module, IN(R0|R3)|OUT(R2), 6, tablesize, &table));
/*# else*/
/* Allocate memory to hold the data we are loading */
/* swix(OS_DynamicArea, IN(R0|R1), 1, TABLEAREA);
fatal(swix(OS_DynamicArea, IN(R0|R1|R2|R3|R4|R5|R6|R7|R8)|OUT(R3), 0,
TABLEAREA, tablesize, -1, 0x80, tablesize, 0, 0, "Kate Table", &table));
# endif*/
/* read the table */
fatal(swix(OS_Memory, IN(R0|R1), 7, table));
/* Loop round locating all the valid blocks of memory */
currentpage = -1;
for (loop = 0; loop < tablesize * 2; ++loop)
{
page = table[loop / 2];
if (loop % 2)
page = page >> 4;
page = page & 0x07;
if (page != currentpage)
{
switch (currentpage)
{
case 1:
bootconfig.dram[dramblocks].address = currentaddr * pagesize;
bootconfig.dram[dramblocks].pages = currentpages;
++dramblocks;
break;
case 2:
bootconfig.vram[vramblocks].address = currentaddr * pagesize;
bootconfig.vram[vramblocks].pages = currentpages;
++vramblocks;
break;
default :
break;
}
currentpage = page;
currentaddr = loop;
currentpages = 0;
}
++currentpages;
}
/* Get the number of dram and vram pages */
fatal(swix(OS_Memory, IN(R0)|OUT(R1), 0x00000108, &bootconfig.drampages));
fatal(swix(OS_Memory, IN(R0)|OUT(R1), 0x00000208, &bootconfig.vrampages));
/* Fill in more bootconfig parameters */
bootconfig.pagesize = pagesize;
bootconfig.dramblocks = dramblocks;
bootconfig.vramblocks = vramblocks;
return(table);
}
/* printf ... */
void uprintf(char *formattoken, ...)
{
va_list ap;
char temp[1024];
temp[0] = '\0';
va_start(ap, formattoken);
vsprintf(temp, formattoken, ap);
va_end(ap);
swi(OS_Write0, IN(R0), temp);
}
/* End of bsdbooter.c */

View File

@ -1,62 +0,0 @@
/* $NetBSD: enteros.S,v 1.2 1996/06/03 21:24:53 mark Exp $ */
/*
* Copyright (c) 1994,1995 Mark Brinicombe.
* Copyright (c) 1994 Brini.
* All rights reserved.
*
* This code is derived from software written for Brini by Mark Brinicombe
*
* 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. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Brini.
* 4. The name of the company nor the name of the author may be used to
* endorse or promote products derived from this software without specific
* prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY BRINI ``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 REGENTS OR CONTRIBUTORS 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.
*
* RiscBSD kernel project
*
* enteros.s
*
* Created : 12/09/94
*
* Based on kate/library/enteros.s
*/
#include "regs.h"
#define OS_EnterOS 0x0016
/*
* Enters SVC26 mode
*/
.text
.global _EnterOS
_EnterOS:
mov r1, lr
swi OS_EnterOS
mov r0, pc
mov pc, r1

View File

@ -1,61 +0,0 @@
/* $NetBSD: exit.S,v 1.2 1996/06/03 21:24:54 mark Exp $ */
/*
* Copyright (c) 1994,1995 Mark Brinicombe.
* Copyright (c) 1994 Brini.
* All rights reserved.
*
* This code is derived from software written for Brini by Mark Brinicombe
*
* 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. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Brini.
* 4. The name of the company nor the name of the author may be used to
* endorse or promote products derived from this software without specific
* prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY BRINI ``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 REGENTS OR CONTRIBUTORS 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.
*
* RiscBSD kernel project
*
* _exit.s
*
* Boot loader exit point
*
* Created : 12/09/94
*
* Based on kate/boot/_exit.s
*/
#include "regs.h"
#define OS_Exit 0x00000011
.text
.global ___exit
___exit:
mov r2, r0
ldr r1, [pc, #Lexit_word - . - 8]
mov r0, #0x00000000
swi OS_Exit
Lexit_word:
.word 0x58454241

View File

@ -1,60 +0,0 @@
/* $NetBSD: exitos.S,v 1.2 1996/06/03 21:24:55 mark Exp $ */
/*
* Copyright (c) 1994,1995 Mark Brinicombe.
* Copyright (c) 1994 Brini.
* All rights reserved.
*
* This code is derived from software written for Brini by Mark Brinicombe
*
* 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. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Brini.
* 4. The name of the company nor the name of the author may be used to
* endorse or promote products derived from this software without specific
* prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY BRINI ``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 REGENTS OR CONTRIBUTORS 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.
*
* RiscBSD kernel project
*
* exitos.s
*
*
*
* Created : 12/09/94
*
* Based on kate/library/exitos.s
*
*/
#include "regs.h"
/*
* Returns from SVC26 mode to USR26 mode
*/
.text
.global _ExitOS
_ExitOS:
mov r2, lr
bic r2, r2, #0x00000003
movs pc, r2

View File

@ -1,110 +0,0 @@
/* $NetBSD: memcpy.S,v 1.2 1996/06/03 21:24:56 mark Exp $ */
/*
* Copyright (c) 1995 Mark Brinicombe.
* Copyright (c) 1995 Brini.
* All rights reserved.
*
* This code is derived from software written for Brini by Mark Brinicombe
*
* 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. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Brini.
* 4. The name of the company nor the name of the author may be used to
* endorse or promote products derived from this software without specific
* prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY BRINI ``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 BRINI OR CONTRIBUTORS 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.
*
* RiscBSD kernel project
*
* memset.S
*
* optimized memset function
*
* Created : 16/05/95
*/
sp .req r13
lr .req r14
pc .req r15
.text
.global _bcopy
.global _ovbcopy
_bcopy:
_ovbcopy:
teq r2, #0x00000000
moveq r0, #0x00000000
moveq pc, lr
cmp r0, r1
blt bcopy_back
bcopy_loop:
ldrb r3, [r0], #0x0001
strb r3, [r1], #0x0001
subs r2, r2, #0x00000001
bne bcopy_loop
mov pc, r14
bcopy_back:
add r0, r0, r2
add r1, r1, r2
bcopy_bloop:
ldrb r3, [r0, #-0x0001]!
strb r3, [r1, #-0x0001]!
subs r2, r2, #0x00000001
bne bcopy_bloop
mov pc, r14
.global _memcpy
_memcpy:
teq r2, #0x00000000
moveq r0, #0x00000000
moveq pc, lr
cmp r1, r0
blt memcpy_back
memcpy_loop:
ldrb r3, [r1], #0x0001
strb r3, [r0], #0x0001
subs r2, r2, #0x00000001
bne memcpy_loop
mov pc, r14
memcpy_back:
add r0, r0, r2
add r1, r1, r2
memcpy_bloop:
ldrb r3, [r1, #-0x0001]!
strb r3, [r0, #-0x0001]!
subs r2, r2, #0x00000001
bne memcpy_bloop
mov pc, r14

View File

@ -1,133 +0,0 @@
/* $NetBSD: memset.S,v 1.2 1996/06/03 21:24:58 mark Exp $ */
/*
* Copyright (c) 1995 Mark Brinicombe.
* Copyright (c) 1995 Brini.
* 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. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Mark Brinicombe.
* 4. The name of the company nor the name of the author may 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 OR CONTRIBUTORS 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.
*
* RiscBSD kernel project
*
* memset.S
*
* optimized memset function
*
* Created : 16/05/95
*/
sp .req r13
lr .req r14
pc .req r15
.text
.global _memset
/* Sets a block of memory to the specified value
*
* r0 - address
* r1 - byte to write
* r2 - number of bytes to write
*/
_memset:
and r1, r1, #0x000000ff /* We write bytes */
cmp r2, #0x00000004 /* Do we have less than 4 bytes */
blt memset_lessthanfour
/* Ok first we will word align the address */
ands r3, r0, #0x00000003 /* Get the bottom two bits */
beq memset_addraligned /* The address is word aligned */
rsb r3, r3, #0x00000004
sub r2, r2, r3
cmp r3, #0x00000002
strb r1, [r0], #0x0001 /* Set 1 byte */
strgeb r1, [r0], #0x0001 /* Set another byte */
strgtb r1, [r0], #0x0001 /* and a third */
cmp r2, #0x00000004
blt memset_lessthanfour
/* Now we must be word aligned */
memset_addraligned:
orr r3, r1, r1, lsl #8 /* Repeat the byte into a word */
orr r3, r3, r3, lsl #16
/* We know we have at least 4 bytes ... */
cmp r2, #0x00000020 /* If less than 32 then use words */
blt memset_lessthan32
/* We have at least 32 so lets use quad words */
stmfd sp!, {r4-r6} /* Store registers */
mov r4, r3 /* Duplicate data */
mov r5, r3
mov r6, r3
memset_loop16:
stmia r0!, {r3-r6} /* Store 16 bytes */
sub r2, r2, #0x00000010 /* Adjust count */
cmp r2, #0x00000010 /* Still got at least 16 bytes ? */
bgt memset_loop16
ldmfd sp!, {r4-r6} /* Restore registers */
/* Do we need to set some words as well ? */
cmp r2, #0x00000004
blt memset_lessthanfour
/* Have either less than 16 or less than 32 depending on route taken */
memset_lessthan32:
/* We have at least 4 bytes so copy as words */
memset_loop4:
str r3, [r0], #0x0004
sub r2, r2, #0x0004
cmp r2, #0x00000004
bge memset_loop4
memset_lessthanfour:
cmp r2, #0x00000000
moveq pc, lr /* Zero length so exit */
cmp r2, #0x00000002
strb r1, [r0], #0x0001 /* Set 1 byte */
strgeb r1, [r0], #0x0001 /* Set another byte */
strgtb r1, [r0], #0x0001 /* and a third */
mov pc, lr /* Exit */

View File

@ -1,49 +0,0 @@
/* $NetBSD: regs.h,v 1.2 1996/06/03 21:24:59 mark Exp $ */
/* Copyright (c) 1994,1995 Mark Brinicombe.
* Copyright (c) 1994 Brini.
* All rights reserved.
*
* This code is derived from software written for Brini by Mark Brinicombe
*
* 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. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Brini.
* 4. The name of the company nor the name of the author may be used to
* endorse or promote products derived from this software without specific
* prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY BRINI ``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 REGENTS OR CONTRIBUTORS 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.
*
* RiscBSD kernel project
*
* regs.h
*
* Assembly register definitions
*
* Created : 14/01/96
*/
fp .req r11
sl .req r12
sp .req r13
lr .req r14
pc .req r15

View File

@ -1,4 +0,0 @@
#!/bin/sh
# $NetBSD: rmaouthdr,v 1.1 1996/01/31 23:18:23 mark Exp $
dd if=$1 of=$2 ibs=32 skip=1 obs=1024b

View File

@ -1,92 +0,0 @@
/* $NetBSD: setcpsr.S,v 1.2 1996/06/03 21:25:00 mark Exp $ */
/*
* Copyright (c) 1994 Mark Brinicombe.
* Copyright (c) 1994 Brini.
* All rights reserved.
*
* This code is derived from software written for Brini by Mark Brinicombe
*
* 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. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Brini.
* 4. The name of the company nor the name of the author may be used to
* endorse or promote products derived from this software without specific
* prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY BRINI ``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 BRINI OR CONTRIBUTORS 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.
*
* RiscBSD kernel project
*
* setcpsr.S
*
* Miscellaneous routines to play with the CPSR register
*
* Eventually this routine can be inline assembly.
*
* Created : 12/09/94
*
* Based of kate/display/setcpsr.s
*/
fp .req r11
ip .req r12
sp .req r13
lr .req r14
pc .req r15
.text
.global _SetCPSR
/* Sets and clears bits in the CPSR register
*
* r0 - bic mask
* r1 - eor mask
*/
_SetCPSR:
/* mov ip, sp
stmfd sp!, {fp, ip, lr, pc}
sub fp, ip, #4*/
mrs r3, cpsr_all /* Set the CPSR */
bic r2, r3, r0
eor r2, r2, r1
msr cpsr_all, r2
mov r0, r3 /* Return the old CPSR */
/* ldmea fp, {fp, sp, pc}*/
mov pc, lr
.global _GetCPSR
/* Gets the CPSR register
*
* Returns the CPSR in r0
*/
_GetCPSR:
mrs r0, cpsr_all /* Get the CPSR */
mov pc, lr

View File

@ -1,51 +0,0 @@
/* $NetBSD: start.S,v 1.2 1996/06/03 21:25:01 mark Exp $ */
/* Copyright (c) 1994 Mark Brinicombe.
* Copyright (c) 1994 Brini.
* All rights reserved.
*
* This code is derived from software written for Brini by Mark Brinicombe
*
* 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. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Brini.
* 4. The name of the company nor the name of the author may be used to
* endorse or promote products derived from this software without specific
* prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY BRINI ``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 REGENTS OR CONTRIBUTORS 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.
*
* RiscBSD kernel project
*
* _main.s
*
* Kernel entry/exit code
*
* Created : 12/09/94
*
* Based on kate/boot/_main.s
*/
#include "regs.h"
.global start
start:
b ___main

View File

@ -1,68 +0,0 @@
/* $NetBSD: strstr.c,v 1.2 1996/06/03 21:25:02 mark Exp $ */
/*
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Chris Torek.
*
* 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. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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.
*
* from: strstr.c,v 1.4 1995/06/15 00:08:43 jtc Exp
*/
#include <sys/param.h>
#include <sys/systm.h>
/*
* Find the first occurrence of find in s.
*/
char *
strstr(s, find)
register const char *s, *find;
{
register char c, sc;
register size_t len;
if ((c = *find++) != 0) {
len = strlen(find);
do {
do {
if ((sc = *s++) == 0)
return (NULL);
} while (sc != c);
} while (strncmp(s, find, len) != 0);
s--;
}
return ((char *)s);
}
/* End of strstr.c */

View File

@ -1,63 +0,0 @@
/* $NetBSD: svc32.S,v 1.2 1996/06/03 21:25:03 mark Exp $ */
/*
* Copyright (c) 1994,1955 Mark Brinicombe.
* Copyright (c) 1994 Brini.
* All rights reserved.
*
* This code is derived from software written for Brini by Mark Brinicombe
*
* 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. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Brini.
* 4. The name of the company nor the name of the author may be used to
* endorse or promote products derived from this software without specific
* prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY BRINI ``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 REGENTS OR CONTRIBUTORS 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.
*
* RiscBSD kernel project
*
* svc32.s
*
* Created : 12/09/94
*
* Based on kate/library/svc32.s
*/
#include "regs.h"
#include <machine/cpu.h>
/*
* Switches from SVC26 mode to SVC32 mode
*/
.text
.global _SVC32
_SVC32:
mrs r1, cpsr_all
bic r1, r1, #(PSR_MODE)
orr r1, r1, #(PSR_SVC32_MODE)
msr cpsr_all, r1
bic lr, lr, #0xfc000000
mov pc, lr

View File

@ -1,596 +0,0 @@
/*
Title: Swi numbers for RiscOs
Copyright (C) 1989, Acorn Computers Ltd., Cambridge, England
$Revision: 1.1 $ SWI_LIST 1.00 02-May-89 (Program generated)
*/
#ifndef __swis_h
#define __swis_h
#define XOS_Bit 0x020000
#define OS_WriteI 0x000100
#define OS_WriteC 0x000000
#define OS_WriteS 0x000001
#define OS_Write0 0x000002
#define OS_NewLine 0x000003
#define OS_ReadC 0x000004
#define OS_CLI 0x000005
#define OS_Byte 0x000006
#define OS_Word 0x000007
#define OS_File 0x000008
#define OS_Args 0x000009
#define OS_BGet 0x00000a
#define OS_BPut 0x00000b
#define OS_GBPB 0x00000c
#define OS_Find 0x00000d
#define OS_ReadLine 0x00000e
#define OS_Control 0x00000f
#define OS_GetEnv 0x000010
#define OS_Exit 0x000011
#define OS_SetEnv 0x000012
#define OS_IntOn 0x000013
#define OS_IntOff 0x000014
#define OS_CallBack 0x000015
#define OS_EnterOS 0x000016
#define OS_BreakPt 0x000017
#define OS_BreakCtrl 0x000018
#define OS_UnusedSWI 0x000019
#define OS_UpdateMEMC 0x00001a
#define OS_SetCallBack 0x00001b
#define OS_Mouse 0x00001c
#define OS_Heap 0x00001d
#define OS_Module 0x00001e
#define OS_Claim 0x00001f
#define OS_Release 0x000020
#define OS_ReadUnsigned 0x000021
#define OS_GenerateEvent 0x000022
#define OS_ReadVarVal 0x000023
#define OS_SetVarVal 0x000024
#define OS_GSInit 0x000025
#define OS_GSRead 0x000026
#define OS_GSTrans 0x000027
#define OS_BinaryToDecimal 0x000028
#define OS_FSControl 0x000029
#define OS_ChangeDynamicArea 0x00002a
#define OS_GenerateError 0x00002b
#define OS_ReadEscapeState 0x00002c
#define OS_EvaluateExpression 0x00002d
#define OS_SpriteOp 0x00002e
#define OS_ReadPalette 0x00002f
#define OS_ServiceCall 0x000030
#define OS_ReadVduVariables 0x000031
#define OS_ReadPoint 0x000032
#define OS_UpCall 0x000033
#define OS_CallAVector 0x000034
#define OS_ReadModeVariable 0x000035
#define OS_RemoveCursors 0x000036
#define OS_RestoreCursors 0x000037
#define OS_SWINumberToString 0x000038
#define OS_SWINumberFromString 0x000039
#define OS_ValidateAddress 0x00003a
#define OS_CallAfter 0x00003b
#define OS_CallEvery 0x00003c
#define OS_RemoveTickerEvent 0x00003d
#define OS_InstallKeyHandler 0x00003e
#define OS_CheckModeValid 0x00003f
#define OS_ChangeEnvironment 0x000040
#define OS_ClaimScreenMemory 0x000041
#define OS_ReadMonotonicTime 0x000042
#define OS_SubstituteArgs 0x000043
#define OS_PrettyPrint 0x000044
#define OS_Plot 0x000045
#define OS_WriteN 0x000046
#define OS_AddToVector 0x000047
#define OS_WriteEnv 0x000048
#define OS_ReadArgs 0x000049
#define OS_ReadRAMFsLimits 0x00004a
#define OS_ClaimDeviceVector 0x00004b
#define OS_ReleaseDeviceVector 0x00004c
#define OS_DelinkApplication 0x00004d
#define OS_RelinkApplication 0x00004e
#define OS_HeapSort 0x00004f
#define OS_ExitAndDie 0x000050
#define OS_ReadMemMapInfo 0x000051
#define OS_ReadMemMapEntries 0x000052
#define OS_SetMemMapEntries 0x000053
#define OS_AddCallBack 0x000054
#define OS_ReadDefaultHandler 0x000055
#define OS_SetECFOrigin 0x000056
#define OS_SerialOp 0x000057
#define OS_ReadSysInfo 0x000058
#define OS_Confirm 0x000059
#define OS_ChangedBox 0x00005a
#define OS_CRC 0x00005b
#define OS_ReadDynamicArea 0x00005c
#define OS_PrintChar 0x00005d
#define OS_ChangeRedirection 0x00005e
#define OS_RemoveCallBack 0x00005f
#define OS_FindMemMapEntries 0x000060
#define OS_SetColour 0x000061
#define OS_ConvertStandardDateAndTime 0x0000c0
#define OS_ConvertDateAndTime 0x0000c1
#define OS_ConvertHex1 0x0000d0
#define OS_ConvertHex2 0x0000d1
#define OS_ConvertHex4 0x0000d2
#define OS_ConvertHex6 0x0000d3
#define OS_ConvertHex8 0x0000d4
#define OS_ConvertCardinal1 0x0000d5
#define OS_ConvertCardinal2 0x0000d6
#define OS_ConvertCardinal3 0x0000d7
#define OS_ConvertCardinal4 0x0000d8
#define OS_ConvertInteger1 0x0000d9
#define OS_ConvertInteger2 0x0000da
#define OS_ConvertInteger3 0x0000db
#define OS_ConvertInteger4 0x0000dc
#define OS_ConvertBinary1 0x0000dd
#define OS_ConvertBinary2 0x0000de
#define OS_ConvertBinary3 0x0000df
#define OS_ConvertBinary4 0x0000e0
#define OS_ConvertSpacedCardinal1 0x0000e1
#define OS_ConvertSpacedCardinal2 0x0000e2
#define OS_ConvertSpacedCardinal3 0x0000e3
#define OS_ConvertSpacedCardinal4 0x0000e4
#define OS_ConvertSpacedInteger1 0x0000e5
#define OS_ConvertSpacedInteger2 0x0000e6
#define OS_ConvertSpacedInteger3 0x0000e7
#define OS_ConvertSpacedInteger4 0x0000e8
#define OS_ConvertFixedNetStation 0x0000e9
#define OS_ConvertNetStation 0x0000ea
#define OS_ConvertFixedFileSize 0x0000eb
#define OS_ConvertFileSize 0x0000ec
#define IIC_Control 0x000240
#define Cache_Control 0x000280
#define Cache_Cacheable 0x000281
#define Cache_Updateable 0x000282
#define Cache_Disruptive 0x000283
#define Cache_Flush 0x000284
#define Trace_R0 0x00bf00
#define Trace_R1 0x00bf01
#define Trace_R2 0x00bf02
#define Trace_R3 0x00bf03
#define Trace_R4 0x00bf04
#define Trace_R5 0x00bf05
#define Trace_R6 0x00bf06
#define Trace_R7 0x00bf07
#define Trace_R8 0x00bf08
#define Trace_R9 0x00bf09
#define Trace_R10 0x00bf0a
#define Trace_R11 0x00bf0b
#define Trace_R12 0x00bf0c
#define Trace_R13 0x00bf0d
#define Trace_R14 0x00bf0e
#define Trace_R15 0x00bf0f
#define Trace_Regs 0x00bf10
#define Trace_WriteC 0x00bf11
#define Trace_NewLine 0x00bf12
#define Trace_WriteS 0x00bf13
#define Trace_Write0 0x00bf14
#define Font_CacheAddr 0x040080
#define Font_FindFont 0x040081
#define Font_LoseFont 0x040082
#define Font_ReadDefn 0x040083
#define Font_ReadInfo 0x040084
#define Font_StringWidth 0x040085
#define Font_Paint 0x040086
#define Font_Caret 0x040087
#define Font_ConverttoOS 0x040088
#define Font_Converttopoints 0x040089
#define Font_SetFont 0x04008a
#define Font_CurrentFont 0x04008b
#define Font_FutureFont 0x04008c
#define Font_FindCaret 0x04008d
#define Font_CharBBox 0x04008e
#define Font_ReadScaleFactor 0x04008f
#define Font_SetScaleFactor 0x040090
#define Font_ListFonts 0x040091
#define Font_SetFontColours 0x040092
#define Font_SetPalette 0x040093
#define Font_ReadThresholds 0x040094
#define Font_SetThresholds 0x040095
#define Font_FindCaretJ 0x040096
#define Font_StringBBox 0x040097
#define Font_ReadColourTable 0x040098
#define Font_MakeBitmap 0x040099
#define Font_UnCacheFile 0x04009a
#define Font_SetFontMax 0x04009b
#define Font_ReadFontMax 0x04009c
#define Font_ReadFontPrefix 0x04009d
#define Font_SwitchOutputToBuffer 0x04009e
#define Font_ReadFontMetrics 0x04009f
#define Font_DecodeMenu 0x0400a0
#define Font_ScanString 0x0400a1
#define Font_SetColourTable 0x0400a2
#define Font_CurrentRGB 0x0400a3
#define Font_FutureRGB 0x0400a4
#define Font_ReadEncodingFilename 0x0400a5
#define Font_FindField 0x0400a6
#define Font_ApplyFields 0x0400a7
#define Font_LookupFont 0x0400a8
#define Wimp_Initialise 0x0400c0
#define Wimp_CreateWindow 0x0400c1
#define Wimp_CreateIcon 0x0400c2
#define Wimp_DeleteWindow 0x0400c3
#define Wimp_DeleteIcon 0x0400c4
#define Wimp_OpenWindow 0x0400c5
#define Wimp_CloseWindow 0x0400c6
#define Wimp_Poll 0x0400c7
#define Wimp_RedrawWindow 0x0400c8
#define Wimp_UpdateWindow 0x0400c9
#define Wimp_GetRectangle 0x0400ca
#define Wimp_GetWindowState 0x0400cb
#define Wimp_GetWindowInfo 0x0400cc
#define Wimp_SetIconState 0x0400cd
#define Wimp_GetIconState 0x0400ce
#define Wimp_GetPointerInfo 0x0400cf
#define Wimp_DragBox 0x0400d0
#define Wimp_ForceRedraw 0x0400d1
#define Wimp_SetCaretPosition 0x0400d2
#define Wimp_GetCaretPosition 0x0400d3
#define Wimp_CreateMenu 0x0400d4
#define Wimp_DecodeMenu 0x0400d5
#define Wimp_WhichIcon 0x0400d6
#define Wimp_SetExtent 0x0400d7
#define Wimp_SetPointerShape 0x0400d8
#define Wimp_OpenTemplate 0x0400d9
#define Wimp_CloseTemplate 0x0400da
#define Wimp_LoadTemplate 0x0400db
#define Wimp_ProcessKey 0x0400dc
#define Wimp_CloseDown 0x0400dd
#define Wimp_StartTask 0x0400de
#define Wimp_ReportError 0x0400df
#define Wimp_GetWindowOutline 0x0400e0
#define Wimp_PollIdle 0x0400e1
#define Wimp_PlotIcon 0x0400e2
#define Wimp_SetMode 0x0400e3
#define Wimp_SetPalette 0x0400e4
#define Wimp_ReadPalette 0x0400e5
#define Wimp_SetColour 0x0400e6
#define Wimp_SendMessage 0x0400e7
#define Wimp_CreateSubMenu 0x0400e8
#define Wimp_SpriteOp 0x0400e9
#define Wimp_BaseOfSprites 0x0400ea
#define Wimp_BlockCopy 0x0400eb
#define Wimp_SlotSize 0x0400ec
#define Wimp_ReadPixTrans 0x0400ed
#define Wimp_ClaimFreeMemory 0x0400ee
#define Wimp_CommandWindow 0x0400ef
#define Wimp_TextColour 0x0400f0
#define Wimp_TransferBlock 0x0400f1
#define Wimp_ReadSysInfo 0x0400f2
#define Wimp_SetFontColours 0x0400f3
#define Wimp_GetMenuState 0x0400f4
#define Wimp_RegisterFilter 0x0400f5
#define Wimp_AddMessages 0x0400f6
#define Wimp_RemoveMessages 0x0400f7
#define Wimp_SetColourMapping 0x0400f8
#define Sound_Configure 0x040140
#define Sound_Enable 0x040141
#define Sound_Stereo 0x040142
#define Sound_Speaker 0x040143
#define Sound_Volume 0x040180
#define Sound_SoundLog 0x040181
#define Sound_LogScale 0x040182
#define Sound_InstallVoice 0x040183
#define Sound_RemoveVoice 0x040184
#define Sound_AttachVoice 0x040185
#define Sound_ControlPacked 0x040186
#define Sound_Tuning 0x040187
#define Sound_Pitch 0x040188
#define Sound_Control 0x040189
#define Sound_AttachNamedVoice 0x04018a
#define Sound_ReadControlBlock 0x04018b
#define Sound_WriteControlBlock 0x04018c
#define Sound_QInit 0x0401c0
#define Sound_QSchedule 0x0401c1
#define Sound_QRemove 0x0401c2
#define Sound_QFree 0x0401c3
#define Sound_QSDispatch 0x0401c4
#define Sound_QTempo 0x0401c5
#define Sound_QBeat 0x0401c6
#define Sound_QInterface 0x0401c7
#define ADFS_DiscOp 0x040240
#define ADFS_HDC 0x040241
#define ADFS_Drives 0x040242
#define ADFS_FreeSpace 0x040243
#define ADFS_Retries 0x040244
#define ADFS_DescribeDisc 0x040245
#define ADFS_VetFormat 0x040246
#define ADFS_FlpProcessDCB 0x040247
#define ADFS_ControllerType 0x040248
#define ADFS_PowerControl 0x040249
#define ADFS_SetIDEController 0x04024a
#define ADFS_IDEUserOp 0x04024b
#define ADFS_MiscOp 0x04024c
#define ADFS_ECCSAndRetries 0x040250
#define Podule_ReadID 0x040280
#define Podule_ReadHeader 0x040281
#define Podule_EnumerateChunks 0x040282
#define Podule_ReadChunk 0x040283
#define Podule_ReadBytes 0x040284
#define Podule_WriteBytes 0x040285
#define Podule_CallLoader 0x040286
#define Podule_RawRead 0x040287
#define Podule_RawWrite 0x040288
#define Podule_HardwareAddress 0x040289
#define Podule_EnumerateChunksWithInfo 0x04028a
#define Podule_HardwareAddresses 0x04028b
#define Podule_ReturnNumber 0x04028c
#define PCEmMod_KeyEvent_Init 0x0402c0
#define PCEmMod_KeyEvent_Info 0x0402c1
#define PCEmMod_KeyEvent_Accept 0x0402c2
#define PCEmMod_KeyEvent_Ignore 0x0402c3
#define PCEmMod_KeyEvent_Check 0x0402c4
#define PCEmMod_KeyEvent_Get 0x0402c5
#define PCEmMod_KeyEvent_Put 0x0402c6
#define PCEmMod_MicroTimer_Get 0x0402c7
#define PCEmMod_PCEvent_Init 0x0402c8
#define PCEmMod_PCEvent_Accept 0x0402c9
#define PCEmMod_PCEvent_Ignore 0x0402ca
#define PCEmMod_PCEvent_Check 0x0402cb
#define PCEmMod_PCEvent_Get 0x0402cc
#define PCEmMod_DelayFor 0x0402cd
#define PCEmMod_CodeBase 0x0402ce
#define PCEmMod_Profile_Init 0x0402cf
#define PCEmMod_Profile_On 0x0402d0
#define PCEmMod_Profile_Off 0x0402d1
#define PCEmMod_Profile_Write 0x0402d2
#define PCEmMod_InterceptMouse 0x0402d3
#define PCEmMod_RestoreMouse 0x0402d4
#define PCEmMod_ReadMouse 0x0402d5
#define Debugger_Disassemble 0x040380
#define SCSI_Version 0x0403c0
#define SCSI_Initialise 0x0403c1
#define SCSI_Control 0x0403c2
#define SCSI_Op 0x0403c3
#define SCSI_Status 0x0403c4
#define SCSI_Reserve 0x0403c7
#define SCSI_List 0x0403c8
#define FPEmulator_Version 0x040480
#define FileCore_DiscOp 0x040540
#define FileCore_Create 0x040541
#define FileCore_Drives 0x040542
#define FileCore_FreeSpace 0x040543
#define FileCore_FloppyStructure 0x040544
#define FileCore_DescribeDisc 0x040545
#define FileCore_DiscardReadSectorsCache 0x040546
#define FileCore_DiscFormat 0x040547
#define FileCore_LayoutStructure 0x040548
#define FileCore_MiscOp 0x040549
#define Shell_Create 0x0405c0
#define Shell_Destroy 0x0405c1
#define Hourglass_On 0x0406c0
#define Hourglass_Off 0x0406c1
#define Hourglass_Smash 0x0406c2
#define Hourglass_Start 0x0406c3
#define Hourglass_Percentage 0x0406c4
#define Hourglass_LEDs 0x0406c5
#define Hourglass_Colours 0x0406c6
#define Draw_ProcessPath 0x040700
#define Draw_ProcessPathFP 0x040701
#define Draw_Fill 0x040702
#define Draw_FillFP 0x040703
#define Draw_Stroke 0x040704
#define Draw_StrokeFP 0x040705
#define Draw_StrokePath 0x040706
#define Draw_StrokePathFP 0x040707
#define Draw_FlattenPath 0x040708
#define Draw_FlattenPathFP 0x040709
#define Draw_TransformPath 0x04070a
#define Draw_TransformPathFP 0x04070b
#define ColourTrans_SelectTable 0x040740
#define ColourTrans_SelectGCOLTable 0x040741
#define ColourTrans_ReturnGCOL 0x040742
#define ColourTrans_SetGCOL 0x040743
#define ColourTrans_ReturnColourNumber 0x040744
#define ColourTrans_ReturnGCOLForMode 0x040745
#define ColourTrans_ReturnColourNumberForMode 0x040746
#define ColourTrans_ReturnOppGCOL 0x040747
#define ColourTrans_SetOppGCOL 0x040748
#define ColourTrans_ReturnOppColourNumber 0x040749
#define ColourTrans_ReturnOppGCOLForMode 0x04074a
#define ColourTrans_ReturnOppColourNumberForMode 0x04074b
#define ColourTrans_GCOLToColourNumber 0x04074c
#define ColourTrans_ColourNumberToGCOL 0x04074d
#define ColourTrans_ReturnFontColours 0x04074e
#define ColourTrans_SetFontColours 0x04074f
#define ColourTrans_InvalidateCache 0x040750
#define ColourTrans_SetCalibration 0x040751
#define ColourTrans_ReadCalibration 0x040752
#define ColourTrans_ConvertDeviceColour 0x040753
#define ColourTrans_ConvertDevicePalette 0x040754
#define ColourTrans_ConvertRGBToCIE 0x040755
#define ColourTrans_ConvertCIEToRGB 0x040756
#define ColourTrans_WriteCalibrationToFile 0x040757
#define ColourTrans_ConvertRGBToHSV 0x040758
#define ColourTrans_ConvertHSVToRGB 0x040759
#define ColourTrans_ConvertRGBToCMYK 0x04075a
#define ColourTrans_ConvertCMYKToRGB 0x04075b
#define ColourTrans_ReadPalette 0x04075c
#define ColourTrans_WritePalette 0x04075d
#define ColourTrans_SetColour 0x04075e
#define ColourTrans_MiscOp 0x04075f
#define ColourTrans_WriteLoadingsToFile 0x040760
#define ColourTrans_SetTextColour 0x040761
#define ColourTrans_SetOppTextColour 0x040762
#define ColourTrans_GenerateTable 0x040763
#define SCSIFS_DiscOp 0x040980
#define SCSIFS_Drives 0x040982
#define SCSIFS_FreeSpace 0x040983
#define SCSIFS_DescribeDisc 0x040985
#define SCSIFS_TestReady 0x040986
#define Super_Sample90 0x040d80
#define Super_Sample45 0x040d81
#define FilerAction_SendSelectedDirectory 0x040f80
#define FilerAction_SendSelectedFile 0x040f81
#define FilerAction_SendStartOperation 0x040f82
#define SCSI_LogVersion 0x041080
#define SCSI_LogList 0x041081
#define MessageTrans_FileInfo 0x041500
#define MessageTrans_OpenFile 0x041501
#define MessageTrans_Lookup 0x041502
#define MessageTrans_MakeMenus 0x041503
#define MessageTrans_CloseFile 0x041504
#define MessageTrans_EnumerateTokens 0x041505
#define MessageTrans_ErrorLookup 0x041506
#define MessageTrans_GSLookup 0x041507
#define MessageTrans_CopyError 0x041508
#define PDumper_Info 0x041b00
#define PDumper_Claim 0x041b01
#define PDumper_Free 0x041b02
#define PDumper_Find 0x041b03
#define PDumper_StartJob 0x041b04
#define PDumper_TidyJob 0x041b05
#define PDumper_SetColour 0x041b06
#define PDumper_PrepareStrip 0x041b07
#define PDumper_LookupError 0x041b08
#define PDumper_CopyFilename 0x041b09
#define ResourceFS_RegisterFiles 0x041b40
#define ResourceFS_DeregisterFiles 0x041b41
#define DragASprite_Start 0x042400
#define DragASprite_Stop 0x042401
#define DDEUtils_Prefix 0x042580
#define DDEUtils_SetCLSize 0x042581
#define DDEUtils_SetCL 0x042582
#define DDEUtils_GetCLSize 0x042583
#define DDEUtils_GetCl 0x042584
#define DDEUtils_ThrowbackRegister 0x042585
#define DDEUtils_ThrowbackUnRegister 0x042586
#define DDEUtils_ThrowbackStart 0x042587
#define DDEUtils_ThrowbackSend 0x042588
#define DDEUtils_ThrowbackEnd 0x042589
#define Filter_RegisterPreFilter 0x042640
#define Filter_RegisterPostFilter 0x042641
#define Filter_DeRegisterPreFilter 0x042642
#define Filter_DeRegisterPostFilter 0x042643
#define TaskManager_TaskNameFromHandle 0x042680
#define TaskManager_EnumerateTasks 0x042681
#define TaskManager_Shutdown 0x042682
#define Squash_Compress 0x042700
#define Squash_Decompress 0x042701
#define DeviceFS_Register 0x042740
#define DeviceFS_Deregister 0x042741
#define DeviceFS_RegisterObjects 0x042742
#define DeviceFS_DeregisterObjects 0x042743
#define DeviceFS_CallDevice 0x042744
#define DeviceFS_Threshold 0x042745
#define DeviceFS_ReceivedCharacter 0x042746
#define DeviceFS_TransmitCharacter 0x042747
#define Impulse_Initialise 0x0428c0
#define Impulse_Decode 0x0428c1
#define Impulse_SendMessage 0x0428c2
#define Impulse_TransmitData 0x0428c3
#define Impulse_FetchData 0x0428c4
#define Impulse_CloseDown 0x0428c5
#define Impulse_DeferReply 0x0428c6
#define Buffer_Create 0x042940
#define Buffer_Remove 0x042941
#define Buffer_Register 0x042942
#define Buffer_Deregister 0x042943
#define Buffer_ModifyFlags 0x042944
#define Buffer_LinkDevice 0x042945
#define Buffer_UnlinkDevice 0x042946
#define Buffer_GetInfo 0x042947
#define Buffer_Threshold 0x042948
#define BASICTrans_HELP 0x042c80
#define BASICTrans_Error 0x042c81
#define BASICTrans_Message 0x042c82
#define Parallel_HardwareAddress 0x042ec0
#define Parallel_Op 0x042ec1
#define Territory_Number 0x043040
#define Territory_Register 0x043041
#define Territory_Deregister 0x043042
#define Territory_NumberToName 0x043043
#define Territory_Exists 0x043044
#define Territory_AlphabetNumberToName 0x043045
#define Territory_SelectAlphabet 0x043046
#define Territory_SetTime 0x043047
#define Territory_ReadCurrentTimeZone 0x043048
#define Territory_ConvertTimeToUTCOrdinals 0x043049
#define Territory_ReadTimeZones 0x04304a
#define Territory_ConvertDateAndTime 0x04304b
#define Territory_ConvertStandardDateAndTime 0x04304c
#define Territory_ConvertStandardDate 0x04304d
#define Territory_ConvertStandardTime 0x04304e
#define Territory_ConvertTimeToOrdinals 0x04304f
#define Territory_ConvertTimeStringToOrdinals 0x043050
#define Territory_ConvertOrdinalsToTime 0x043051
#define Territory_Alphabet 0x043052
#define Territory_AlphabetIdentifier 0x043053
#define Territory_SelectKeyboardHandler 0x043054
#define Territory_WriteDirection 0x043055
#define Territory_CharacterPropertyTable 0x043056
#define Territory_LowerCaseTable 0x043057
#define Territory_UpperCaseTable 0x043058
#define Territory_ControlTable 0x043059
#define Territory_PlainTable 0x04305a
#define Territory_ValueTable 0x04305b
#define Territory_RepresentationTable 0x04305c
#define Territory_Collate 0x04305d
#define Territory_ReadSymbols 0x04305e
#define Territory_ReadCalendarInformation 0x04305f
#define Territory_NameToNumber 0x043060
#define Territory_TransformString 0x043061
#define Territory_Reserved1 0x043062
#define Territory_Reserved2 0x043063
#define Territory_Reserved3 0x043064
#define Territory_Reserved4 0x043065
#define Territory_Reserved5 0x043066
#define Territory_Reserved6 0x043067
#define Territory_Reserved7 0x043068
#define Territory_Reserved8 0x043069
#define Territory_Reserved9 0x04306a
#define Territory_Reserved10 0x04306b
#define Territory_Reserved11 0x04306c
#define Territory_Reserved12 0x04306d
#define Territory_Reserved13 0x04306e
#define Territory_Reserved14 0x04306f
#define Territory_Reserved15 0x043070
#define Territory_Reserved16 0x043071
#define Territory_Reserved17 0x043072
#define Territory_Reserved18 0x043073
#define Territory_Reserved19 0x043074
#define Territory_ConvertTextToString 0x043075
#define ScreenBlanker_Control 0x043100
#define TaskWindow_TaskInfo 0x043380
#define Free_Register 0x0444c0
#define Free_DeRegister 0x0444c1
#define DOSFS_DiscFormat 0x044b00
#define DOSFS_LayoutStructure 0x044b01
#define PDriver_Info 0x080140
#define PDriver_SetInfo 0x080141
#define PDriver_CheckFeatures 0x080142
#define PDriver_PageSize 0x080143
#define PDriver_SetPageSize 0x080144
#define PDriver_SelectJob 0x080145
#define PDriver_CurrentJob 0x080146
#define PDriver_FontSWI 0x080147
#define PDriver_EndJob 0x080148
#define PDriver_AbortJob 0x080149
#define PDriver_Reset 0x08014a
#define PDriver_GiveRectangle 0x08014b
#define PDriver_DrawPage 0x08014c
#define PDriver_GetRectangle 0x08014d
#define PDriver_CancelJob 0x08014e
#define PDriver_ScreenDump 0x08014f
#define PDriver_EnumerateJobs 0x080150
#define PDriver_SetPrinter 0x080151
#define PDriver_CancelJobWithError 0x080152
#define PDriver_SelectIllustration 0x080153
#define PDriver_InsertIllustration 0x080154
#define PDriver_DeclareFont 0x080155
#define PDriver_DeclareDriver 0x080156
#define PDriver_RemoveDriver 0x080157
#define PDriver_SelectDriver 0x080158
#define PDriver_EnumerateDrivers 0x080159
#define PDriver_MiscOp 0x08015a
#define PDriver_MiscOpForDriver 0x08015b
#define PDriver_SetDriver 0x08015c
#define SharedCLibrary_LibInitAPCS_A 0x080680
#define SharedCLibrary_LibInitAPCS_R 0x080681
#define SharedCLibrary_LibInitModule 0x080682
#define FrontEnd_ExtendedCmdLine 0x081400
#define FrontEnd_FreeCmdLine 0x081401
#endif

View File

@ -1,80 +0,0 @@
#include "regs.h"
.text
SWIReturnInst:
ldr pc, [sp, #0*4]
.global _swix
_swix:
orr r0, r0, #0x20000
.global _swi
_swi:
/*
* Construct a stack frame that looks something like this:
* returnval
* LDMIA r12!, {r0..rn}
* SWI xxxxxx
* LDR pc, [sp]
* saved r4-r11,lr
* saved r1
* saved input values (r2...rn)
*/
mov pc, lr
stmfd sp!, {r1-r3} /* Save r1 and put 1st two variadic args on stack */
bic r2, r0, #0xff000000
orr r2, r2, #0xef000000 /* Construct SWI instruction */
adr r0, SWIReturn
tst r1, #0x20000 /* bit for write flags */
adrne r0, SWIReturnFlags
bic r1, r1, #0xff000000 /* Construct LDMIA R12!, {regs} instruction, if */
bics r1, r1, #0x00ff0000 /* {regs} = {} (IE no input regs) we must not */
orrne r1, r1, #0xe8000000 /* use an LDMIA R12!, {} instruction as this is an */
orrne r1, r1, #0x00bc0000 /* invalid instruction, we use a suitable NOP instead */
moveq r1, #0 /* 0 = opcode for ANDEQ r0, r0, r0 (a suitable NOP) */
ldr r3, SWIReturnInst
stmfd sp!, {r0-r9, r11, lr} /* Save regs and set up SWI call routine (in R0-R3) */
add r12, sp, #(12+1)*4 /* Point R12 at input regs on stack. */
add pc, sp, #4 /* Call routine on stack */
SWIReturnFlags:
ldr r11, [r12], #4
str pc, [r11] /* write flags */
SWIReturn:
ldr lr, [sp, #(12+0)*4] /* Fetch reg mask again */
movs lr, lr, asl #1 /* Shift out setting C if R0 to be written, N */
ldrcs r11, [r12], #4 /* if R1 to be written. */
strcs r0, [r11]
ldrmi r11, [r12], #4
strmi r1, [r11]
movs lr, lr, asl #2 /* Shift 2 bits each time for the next 2 regs */
ldrcs r11, [r12], #4
strcs r2, [r11]
ldrmi r11, [r12], #4
strmi r3, [r11]
movs lr, lr, asl #2
ldrcs r11, [r12], #4
strcs r4, [r11]
ldrmi r11, [r12], #4
strmi r5, [r11]
movs lr, lr, asl #2
ldrcs r11, [r12], #4
strcs r6, [r11]
ldrmi r11, [r12], #4
strmi r7, [r11]
movs lr, lr, asl #2
ldrcs r11, [r12], #4
strcs r8, [r11]
ldrmi r11, [r12], #4
strmi r9, [r11]
ldr r1, [sp, #2*4]
tst r1, #0x20000 /* X-bit clear */
cmpeq pc, #0x80000000 /* SET V flag if so, so R0 not cleared */
movvc r0, #0 /* Clear R0 if no error (or X-bit clear) */
add sp, sp, #4*4 /* Drop SWI call routine */
ldmia sp!, {r4-r9,r11,lr}
add sp, sp, #3*4 /* Drop saved R1 and 1st two variadic args. */
movs pc, lr

View File

@ -1,80 +0,0 @@
/* SWI veneers:
* Written by Edward Nevill and Jonathan Roach in an idle moment between projects.
* Hacked by BDB to add flag returning
*/
/* Anonymous Error type */
struct Error { int num; char msg[4]; };
typedef struct Error Error;
/* Generic SWI interface
* swi(swino,mask,regs...)
* swino = SWI number to call as defined in h.swis, X bit set if you wish the
* X form of the SWI to be called, clear if you want the non X form.
* reg_mask = mask of in / out registers
* bits 0-9: Bit N set => Register N specified on input
* Bit N clear => Register N unspecified on input
* bits 22-31: Bit N set => Register N-22 on output stored
* in address specified in varargs list.
* ... In order, input registers followed by output registers,
* starting at r0 and going up.
* returns 0 or errorblock pointer if X-bit set
* returns r0 if X-bit clear
* swix(swino,mask,regs...)
* This behaves identically to 'swi' except that it always calls the X form.
*
* Eg:
* swi(OS_SWINumberToString, IN(R0|R1|R2), n, buf, 255);
* e = swi(XOS_SWINumberFromString, IN(R1)|OUT(R0), str, &n);
* - Error block pointer (or 0) is returned so must get returned R0
* - via argument list.
* e = swix(OS_SWINumberFromString, IN(R1)|OUT(R0), str, &n);
* - As above but uses the swix function rather that setting the X bit
* explicitly (saves one instruction on SWI call).
* e = swi(OS_File, IN(R0|R1|R2|R3)|OUT(R4), 255, name, buff, 0, &len);
* - We don't care about the load, exec or attrs so don't specify
* them in the output registers.
*/
extern Error *swix(int swino, int reg_mask, ...);
extern int swi(int swino, int reg_mask, ...);
/* Register mask macros
* The bits in the register mask are arranged as follows:
* 31 30 29 ... 22 ... 8 ... 2 1 0
* O0 O1 O2 ... O9 I9 ... I2 I1 I0 I(N) = bit set if R(N) used on entry
* O(N) = bit set if R(N) written on exit
* The bits are arranged like this to optimise the case where a SWI is being
* called with a small number of input and output registers. For example, a SWI
* call which uses R0-R5 on entry and R0-R1 on exit will have a register mask
* of 0xC000003f which can be loaded into an ARM register in one instruction
* (the compiler performs this optimisation, even when the constant wraps
* around between bits 0 and 31). Using the more obvious coding of I0-I9 in bits
* 0 - 9 and O0-O9 in bits 16-23 leads to a constant of 0x0003003f which require
* two instructions.
*/
#define IN(m) (m)
/* old, incorrect version
#define OUT(m) ((unsigned)(m&1)<<31|(m&2)<<29|(m&4)<<27|(m&8)<<25|(m&16)<<23|\
(m&32)<<21|(m&64)<<19|(m&128)<<17|(m&256)<<15|(m&512)<<13)
*/
#define OUT(m) ((unsigned)((m)&1)<<31|((m)&2)<<29|((m)&4)<<27|\
((m)&8)<<25|((m)&16)<<23|((m)&32)<<21|((m)&64)<<19|\
((m)&128)<<17|((m)&256)<<15|((m)&512)<<13|((m)&1024)<<11)
/* The register names
* Change these to use different names if you use R0 - R9 elsewhere in your program
*/
#define PSW 0x400 /* Use only in OUT, orders BEFORE others */
#define R0 0x001
#define R1 0x002
#define R2 0x004
#define R3 0x008
#define R4 0x010
#define R5 0x020
#define R6 0x040
#define R7 0x080
#define R8 0x100
#define R9 0x200

View File

@ -1,275 +0,0 @@
#include <stdarg.h>
#include <string.h>
# define toupper(x) ((x >= 'a' && x <= 'z') ? (x & 0xdf) : x)
/*# define tolower(x) ((x >= 'A' && x <= 'Z') ? (x | 0x20) : x)*/
# define islower(x) ((x >= 'a' && x <= 'z') ? 1 : 0)
# define isdigit(x) ((x >= '0' && x <= '9') ? 1 : 0)
# define isxdigit(x) (((x >= '0' && x <= '9') || (x >= 'a' && x <= 'f') || (x >= 'A' && x <= 'F')) ? 1 : 0)
unsigned long simple_strtoul(const char *cp,char **endp,unsigned int base)
{
unsigned long result = 0,value;
if (!base) {
base = 10;
if (*cp == '0') {
base = 8;
cp++;
if ((*cp == 'x') && isxdigit(cp[1])) {
cp++;
base = 16;
}
}
}
while (isxdigit(*cp) && (value = isdigit(*cp) ? *cp-'0' : (islower(*cp)
? toupper(*cp) : *cp)-'A'+10) < base) {
result = result*base + value;
cp++;
}
if (endp)
*endp = (char *)cp;
return result;
}
/* we use this so that we can do without the ctype library */
#define is_digit(c) ((c) >= '0' && (c) <= '9')
static int skip_atoi(const char **s)
{
int i=0;
while (is_digit(**s))
i = i*10 + *((*s)++) - '0';
return i;
}
#define ZEROPAD 1 /* pad with zero */
#define SIGN 2 /* unsigned/signed long */
#define PLUS 4 /* show plus */
#define SPACE 8 /* space if plus */
#define LEFT 16 /* left justified */
#define SPECIAL 32 /* 0x */
#define SMALL 64 /* use 'abcdef' instead of 'ABCDEF' */
static unsigned int do_div(unsigned int *n, unsigned int base)
{
unsigned int d;
d = *n % base;
*n /= base;
return(d);
}
static char * number(char * str, int num, int base, int size, int precision
,int type)
{
char c,sign,tmp[36];
const char *digits="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
int i;
if (type&SMALL) digits="0123456789abcdefghijklmnopqrstuvwxyz";
if (type&LEFT) type &= ~ZEROPAD;
if (base<2 || base>36)
return 0;
c = (type & ZEROPAD) ? '0' : ' ' ;
if (type&SIGN && num<0) {
sign='-';
num = -num;
} else
sign=(type&PLUS) ? '+' : ((type&SPACE) ? ' ' : 0);
if (sign) size--;
if (type&SPECIAL) {
if (base==16) size -= 2;
else if (base==8) size--;
}
i=0;
if (num==0)
tmp[i++]='0';
else while (num!=0)
tmp[i++]=digits[do_div((unsigned int *)&num,base)];
if (i>precision) precision=i;
size -= precision;
if (!(type&(ZEROPAD+LEFT)))
while(size-->0)
*str++ = ' ';
if (sign)
*str++ = sign;
if (type&SPECIAL) {
if (base==8)
*str++ = '0';
else if (base==16) {
*str++ = '0';
*str++ = digits[33];
}
}
if (!(type&LEFT))
while(size-->0)
*str++ = c;
while(i<precision--)
*str++ = '0';
while(i-->0)
*str++ = tmp[i];
while(size-->0)
*str++ = ' ';
return str;
}
int vsprintf(char *buf, const char *fmt, va_list args)
{
int len;
int i;
char * str;
char *s;
int *ip;
int flags; /* flags to number() */
int field_width; /* width of output field */
int precision; /* min. # of digits for integers; max
number of chars for from string */
int qualifier; /* 'h', 'l', or 'L' for integer fields */
for (str=buf ; *fmt ; ++fmt) {
if (*fmt != '%') {
*str++ = *fmt;
continue;
}
/* process flags */
flags = 0;
repeat:
++fmt; /* this also skips first '%' */
switch (*fmt) {
case '-': flags |= LEFT; goto repeat;
case '+': flags |= PLUS; goto repeat;
case ' ': flags |= SPACE; goto repeat;
case '#': flags |= SPECIAL; goto repeat;
case '0': flags |= ZEROPAD; goto repeat;
}
/* get field width */
field_width = -1;
if (is_digit(*fmt))
field_width = skip_atoi(&fmt);
else if (*fmt == '*') {
/* it's the next argument */
field_width = va_arg(args, int);
if (field_width < 0) {
field_width = -field_width;
flags |= LEFT;
}
}
/* get the precision */
precision = -1;
if (*fmt == '.') {
++fmt;
if (is_digit(*fmt))
precision = skip_atoi(&fmt);
else if (*fmt == '*') {
/* it's the next argument */
precision = va_arg(args, int);
}
if (precision < 0)
precision = 0;
}
/* get the conversion qualifier */
qualifier = -1;
if (*fmt == 'h' || *fmt == 'l' || *fmt == 'L') {
qualifier = *fmt;
++fmt;
}
switch (*fmt) {
case 'c':
if (!(flags & LEFT))
while (--field_width > 0)
*str++ = ' ';
*str++ = (unsigned char) va_arg(args, int);
while (--field_width > 0)
*str++ = ' ';
break;
case 's':
s = va_arg(args, char *);
if (!s)
s = "<NULL>";
len = strlen(s);
if (precision < 0)
precision = len;
else if (len > precision)
len = precision;
if (!(flags & LEFT))
while (len < field_width--)
*str++ = ' ';
for (i = 0; i < len; ++i)
*str++ = *s++;
while (len < field_width--)
*str++ = ' ';
break;
case 'o':
str = number(str, va_arg(args, unsigned long), 8,
field_width, precision, flags);
break;
case 'p':
if (field_width == -1) {
field_width = 8;
flags |= ZEROPAD;
}
str = number(str,
(unsigned long) va_arg(args, void *), 16,
field_width, precision, flags);
break;
case 'x':
flags |= SMALL;
case 'X':
str = number(str, va_arg(args, unsigned long), 16,
field_width, precision, flags);
break;
case 'd':
case 'i':
flags |= SIGN;
case 'u':
str = number(str, va_arg(args, unsigned long), 10,
field_width, precision, flags);
break;
case 'n':
ip = va_arg(args, int *);
*ip = (str - buf);
break;
default:
if (*fmt != '%')
*str++ = '%';
if (*fmt)
*str++ = *fmt;
else
--fmt;
break;
}
}
*str = '\0';
return str-buf;
}
int sprintf(char * buf, const char *fmt, ...)
{
va_list args;
int i;
va_start(args, fmt);
i=vsprintf(buf,fmt,args);
va_end(args);
return i;
}