20000317 sourceware import
This commit is contained in:
		
							
								
								
									
										215
									
								
								libgloss/hp74x/Makefile.in
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										215
									
								
								libgloss/hp74x/Makefile.in
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,215 @@
 | 
			
		||||
#
 | 
			
		||||
# Makefile
 | 
			
		||||
#   Copyright (C) 1990, 1991, 1992, 1993 ,1994 Free Software Foundation
 | 
			
		||||
#
 | 
			
		||||
# This file is free software; you can redistribute it and/or modify
 | 
			
		||||
# it under the terms of the GNU General Public License as published by
 | 
			
		||||
# the Free Software Foundation; either version 2 of the License, or
 | 
			
		||||
# (at your option) any later version.
 | 
			
		||||
# 
 | 
			
		||||
# This program is distributed in the hope that it will be useful,
 | 
			
		||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
			
		||||
# GNU General Public License for more details.
 | 
			
		||||
# 
 | 
			
		||||
# You should have received a copy of the GNU General Public License
 | 
			
		||||
# along with this program; if not, write to the Free Software
 | 
			
		||||
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
#
 | 
			
		||||
# Makefile for newlib/libc/stub/hppa. This is the board support code
 | 
			
		||||
# for the HP-PRO hppa embedded boards. <rob@cygnus.com>
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
VPATH = @srcdir@
 | 
			
		||||
srcdir = @srcdir@
 | 
			
		||||
objdir = .
 | 
			
		||||
srcroot = $(srcdir)/../..
 | 
			
		||||
objroot = $(objdir)/../..
 | 
			
		||||
 | 
			
		||||
prefix = @prefix
 | 
			
		||||
exec_prefix = @exec_prefix@
 | 
			
		||||
 | 
			
		||||
bindir = @bindir@
 | 
			
		||||
libdir = @libdir@
 | 
			
		||||
tooldir = $(exec_prefix)/$(target_alias)
 | 
			
		||||
 | 
			
		||||
INSTALL = @INSTALL@
 | 
			
		||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
 | 
			
		||||
INSTALL_DATA = @INSTALL_DATA@
 | 
			
		||||
 | 
			
		||||
SHELL = /bin/sh
 | 
			
		||||
 | 
			
		||||
CC = @CC@
 | 
			
		||||
 | 
			
		||||
AS = @AS@
 | 
			
		||||
AR = @AR@
 | 
			
		||||
LD = @LD@
 | 
			
		||||
RANLIB = @RANLIB@
 | 
			
		||||
 | 
			
		||||
#
 | 
			
		||||
# As the boot process only deals with LIF volumes, here's the src
 | 
			
		||||
# where we borrow existing code modules and where we put our
 | 
			
		||||
# boot image if we can bvuild one.
 | 
			
		||||
#
 | 
			
		||||
LIF_SRC = /usr/tftpdir/srcboot.lif
 | 
			
		||||
LIF_DEST = /usr/tftpdir/romboot.lif
 | 
			
		||||
 | 
			
		||||
HPDEFS = -D_INCLUDE_POSIX_SOURCE -D_INCLUDE_XOPEN_SOURCE \
 | 
			
		||||
         -D_INCLUDE_HPUX_SOURCE -DPCXT 
 | 
			
		||||
 | 
			
		||||
LIBS_FOR_TARGET = -lc
 | 
			
		||||
 | 
			
		||||
#
 | 
			
		||||
# The original flags used by HP for the boot ROMS were
 | 
			
		||||
# CFLAGS_FOR_TARGET = -c -Aa +O3 +OS -Wc,-DA1.0 -Wc,-DS1.0 +ESfic +ESsfc ${HPDEFS}
 | 
			
		||||
CFLAGS_FOR_TARGET = -c -Wd,-a -g
 | 
			
		||||
# the original value for -R was 0
 | 
			
		||||
LDFLAGS_FOR_TARGET =  -v -t -N -R 10000 -a archive
 | 
			
		||||
INCLUDES = -I${srcdir}
 | 
			
		||||
 | 
			
		||||
BSP_OBJS= pa_stub.o debugger.o iva_table.o io.o
 | 
			
		||||
STUBCRT0=crt0.o
 | 
			
		||||
STUBLIB=hppa.o
 | 
			
		||||
LDSCRIPT=hppa.ld
 | 
			
		||||
SHARED_DIR=
 | 
			
		||||
SHARED_OBJS=
 | 
			
		||||
# SHARED_OBJS=$(SHARED_DIR)
 | 
			
		||||
 | 
			
		||||
# Host specific makefile fragment comes in here.
 | 
			
		||||
@host_makefile_frag@
 | 
			
		||||
 | 
			
		||||
all: boot
 | 
			
		||||
 | 
			
		||||
# this target is only for testing
 | 
			
		||||
test: ${STUBCRT0} $(STUBLIB) test.o $(BSP_OBJS)
 | 
			
		||||
#	${LD} $(LDFLAGS_FOR_TARGET) ${STUBCRT0} test.o $(BSP_OBJS) -o test $(LIBS_FOR_TARGET)
 | 
			
		||||
	rootme=`pwd` ; \
 | 
			
		||||
	${LD} $(LDFLAGS_FOR_TARGET) ${STUBCRT0} test.o pa_stub.o debugger.o iva_table.o io.o -o test $(LIBS_FOR_TARGET)
 | 
			
		||||
 | 
			
		||||
$(STUBLIB): $(BSP_OBJS)
 | 
			
		||||
	${LD} -r $(BSP_OBJS) $(SHARED_OBJS) -o $(STUBLIB)
 | 
			
		||||
 | 
			
		||||
checksum: $(srcdir)/checksum.c
 | 
			
		||||
	$(CC) -g $(srcdir)/checksum.c -o checksum
 | 
			
		||||
 | 
			
		||||
# this is the target from HP's Makefile, it may be bogus
 | 
			
		||||
hpstub: $(OBJS)
 | 
			
		||||
	$(LD) $(LDFLAGS_FOR_TARGET) -e main -o $@ $(LIBRARY)/crt1.o \
 | 
			
		||||
	$(OBJS) -lc -m >stub.map
 | 
			
		||||
 | 
			
		||||
install:
 | 
			
		||||
	$(INSTALL_PROGRAM) $(STUBLIB) $(tooldir)/lib/$(MULTISUBDIR)$(STUBLIB)
 | 
			
		||||
	$(INSTALL_PROGRAM) $(SHARED_DIR)/$(STUBCRT0) $(tooldir)/lib/$(MULTISUBDIR)$(STUBCRT0)
 | 
			
		||||
	$(INSTALL_PROGRAM) $(srcdir)/$(LDSCRIPT) $(tooldir)/lib/$(LDSCRIPT)
 | 
			
		||||
 | 
			
		||||
.c.o:
 | 
			
		||||
	$(CC) $(CFLAGS_FOR_TARGET) $(INCLUDES) -c $<
 | 
			
		||||
 | 
			
		||||
.c.s:
 | 
			
		||||
	$(CC) $(CFLAGS_FOR_TARGET) -S $(INCLUDES) $<
 | 
			
		||||
#	$(CC) $(CFLAGS_FOR_TARGET) $(NEWLIB_CFLAGS) $(INCLUDES) -c $<
 | 
			
		||||
 | 
			
		||||
.s.o:
 | 
			
		||||
	$(CC) $(CFLAGS_FOR_TARGET) $(INCLUDES) -c $<
 | 
			
		||||
#	$(AS) $(CFLAGS_FOR_TARGET) $(INCLUDES) -c $<
 | 
			
		||||
 | 
			
		||||
.SUFFIXES: .S .c .o .s .lif
 | 
			
		||||
#
 | 
			
		||||
# lifinit --
 | 
			
		||||
#	-vnnn 	Sets volume size to nnn bytes. 
 | 
			
		||||
#		nnn must be a multiple of 256.
 | 
			
		||||
#	-d    	Sets directory size to nnn file entries.
 | 
			
		||||
#		nnn must be a multiple of 8.
 | 
			
		||||
#	-nsss   Sets the volume name to be sss.
 | 
			
		||||
#	-Knnn	Forces the directory start location to be the
 | 
			
		||||
#               nearest multiple of nnn x 1024 bytes.
 | 
			
		||||
#	-snnn	set the initial system load (ISL) start address to
 | 
			
		||||
#               nnn in the volume label
 | 
			
		||||
#	-lnnn	Specifies the length in bytes of the ISL code.
 | 
			
		||||
#	-ennn	Set the ISL entry point to nnn bytes from the
 | 
			
		||||
#               beginning of the ISL
 | 
			
		||||
#
 | 
			
		||||
# lifcp --
 | 
			
		||||
#	-r	Forces RAW mode copying.
 | 
			
		||||
#	-T	Sets the file type of the directory entry.
 | 
			
		||||
#		ASCII is 1
 | 
			
		||||
#		BIN is -23951
 | 
			
		||||
#		BINARY is -2
 | 
			
		||||
#	-Knnn	forces each file copied in to begin on a nnn x
 | 
			
		||||
#               1024-byte boundary from the beginning of the volume
 | 
			
		||||
#	Note: the word echoed below MUST be 10 characters exactly.
 | 
			
		||||
#
 | 
			
		||||
# somxtract infile outfile --
 | 
			
		||||
#	converts a series 800 file *only* into a raw image
 | 
			
		||||
#
 | 
			
		||||
LIF_VOL = this_lif
 | 
			
		||||
# 65532
 | 
			
		||||
boot: test checksum
 | 
			
		||||
#	 FIXME: This fills up the hard disk unless "-R" is used
 | 
			
		||||
	@rm -f ${LIF_VOL} ${LIF_DEST}
 | 
			
		||||
	@ipl_entry=`nm -t d $< | grep "T .START." | sed -e 's/T .START.//' -e 's/^0*//'` ; \
 | 
			
		||||
	echo "Entry point is at $${ipl_entry}" ; \
 | 
			
		||||
	if test x"$${ipl_entry}" != x  ; then \
 | 
			
		||||
	ipl_entry=`expr $${ipl_entry} - 65536` ; \
 | 
			
		||||
	echo "Entry point offset is $${ipl_entry}" ; \
 | 
			
		||||
	cp $< $<.raw ; \
 | 
			
		||||
	rm -f $<.dis ; \
 | 
			
		||||
	objdump -d $< > $<.dis ; \
 | 
			
		||||
	somxtract $< $<.raw ; \
 | 
			
		||||
	ipl_size=`checksum -s $<.raw $<.image  | sed -e 's/ is the.*//'` ; \
 | 
			
		||||
	echo "IPL_SIZE is $${ipl_size}" ; \
 | 
			
		||||
	    lifinit -v64000000 -d64 -n"CYGNUS    " -K2 -s4096 -l$${ipl_size} -e$${ipl_entry} ${LIF_DEST} ;\
 | 
			
		||||
	    else \
 | 
			
		||||
		echo "ERROR: \$$START\$$ symbol not found" ; \
 | 
			
		||||
	    fi
 | 
			
		||||
	@chmod a+rw $<.image
 | 
			
		||||
	@lifcp -r -K2 $<.image ${LIF_DEST}:TEST
 | 
			
		||||
	@rm -f $<.image $<.dis
 | 
			
		||||
	@lifls -l ${LIF_DEST}
 | 
			
		||||
	@objdump -d $< > $<.dis
 | 
			
		||||
 | 
			
		||||
.S.o:
 | 
			
		||||
	rm -f $*.s
 | 
			
		||||
	${CPP} $< > $*.s
 | 
			
		||||
	$(CC) $(CFLAGS_FOR_TARGET) $(INCLUDES) -c $*.s
 | 
			
		||||
#	$(CC) $(CFLAGS_FOR_TARGET) $(NEWLIB_CFLAGS) $(INCLUDES) -c $<
 | 
			
		||||
 | 
			
		||||
.c.list:
 | 
			
		||||
	$(CC) $(CFLAGS) $*.c -S
 | 
			
		||||
	$(AS) $(AFLAGS) $*.s -Wa,-l > $*.list
 | 
			
		||||
	rm $*.s
 | 
			
		||||
 | 
			
		||||
.s.list:
 | 
			
		||||
	$(AS) $(AFLAGS) $*.s -Wa,-l > $*.list
 | 
			
		||||
 | 
			
		||||
doc:	
 | 
			
		||||
 | 
			
		||||
clean mostlyclean:
 | 
			
		||||
	rm -f *~ *.map *.list stub romboot.lif a.out *.raw *.image
 | 
			
		||||
	rm -f *.o $(STUBLIB) $(STUBCRT0) checksum *.dis test
 | 
			
		||||
 | 
			
		||||
distclean maintainer-clean realclean: clean
 | 
			
		||||
	rm -f Makefile config.cache config.log config.status
 | 
			
		||||
	
 | 
			
		||||
pa_stub.o:	$(srcdir)/pa_stub.c
 | 
			
		||||
debugger.o:	$(srcdir)/debugger.s
 | 
			
		||||
iva_table.o:	$(srcdir)/iva_table.s
 | 
			
		||||
io.o:		$(srcdir)/io.c
 | 
			
		||||
crt0.o:		$(srcdir)/crt0.s
 | 
			
		||||
test.o:		$(srcdir)/test.c
 | 
			
		||||
term_in.o:      $(srcdir)/term_in.s
 | 
			
		||||
term_out.o:     $(srcdir)/term_out.s
 | 
			
		||||
term_init.o:    $(srcdir)/term_init.s
 | 
			
		||||
 | 
			
		||||
.PHONY: info install-info clean-info
 | 
			
		||||
info:
 | 
			
		||||
install-info:
 | 
			
		||||
clean-info:
 | 
			
		||||
 | 
			
		||||
Makefile: Makefile.in config.status @host_makefile_frag_path@
 | 
			
		||||
	$(SHELL) config.status
 | 
			
		||||
 | 
			
		||||
config.status: configure
 | 
			
		||||
	$(SHELL) config.status --recheck
 | 
			
		||||
							
								
								
									
										156
									
								
								libgloss/hp74x/README
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										156
									
								
								libgloss/hp74x/README
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,156 @@
 | 
			
		||||
*** Registers
 | 
			
		||||
	GR0	*always zero
 | 
			
		||||
	GR1	scratch
 | 
			
		||||
	GR2	normal return register
 | 
			
		||||
	GR27	Global Data Pointer (Must be set in crt0)
 | 
			
		||||
	GR30	SP stack pointer
 | 
			
		||||
	GR31	milicode return pointer
 | 
			
		||||
 | 
			
		||||
	SR*	Space registers	
 | 
			
		||||
 | 
			
		||||
	CR24-31	Temporary Control Registers
 | 
			
		||||
	CR14	Vector Table Register (like VBR on an m68020)
 | 
			
		||||
	CR0	Put in a count, causes exception when decremented to 0.
 | 
			
		||||
 | 
			
		||||
FORTH's magic number is 031240
 | 
			
		||||
 | 
			
		||||
***
 | 
			
		||||
    Series 700/800
 | 
			
		||||
      The following options are also supported:
 | 
			
		||||
 | 
			
		||||
           -snnn          set the initial system load (ISL) start address to
 | 
			
		||||
                          nnn in the volume label.  This is useful when
 | 
			
		||||
                          building boot media for Series 700/800 systems.
 | 
			
		||||
 | 
			
		||||
           -lnnn          specifies the length in bytes of the ISL code in
 | 
			
		||||
                          the LIF volume.
 | 
			
		||||
 | 
			
		||||
           -ennn          set the ISL entry point to nnn bytes from the
 | 
			
		||||
                          beginning of the ISL.  For example, specifying -
 | 
			
		||||
                          e3272 means that the ISL entry point is 3272
 | 
			
		||||
                          (decimal) bytes from the beginning of the ISL
 | 
			
		||||
                          object module.
 | 
			
		||||
 | 
			
		||||
           -Knnn          forces the directory start location to be the
 | 
			
		||||
                          nearest multiple of nnn x 1024 bytes from the
 | 
			
		||||
                          beginning of the volume.  This is necessary for
 | 
			
		||||
                          booting Series 700/800 systems from LIF media.
 | 
			
		||||
 | 
			
		||||
	   -n xxx  	  Sets the volume name to be xxx.
 | 
			
		||||
	lifinit -v64000000 -d64 -nISL10 -K2 -s4096 -l61440 -e5336 this_lif
 | 
			
		||||
 | 
			
		||||
# lifcp --
 | 
			
		||||
#	-r	Forces RAW mode copying. (file type BIN (-23951))
 | 
			
		||||
#	-T	Sets the file type of the directory entry.
 | 
			
		||||
#	-Knnn	forces each file copied in to begin on a nnn x
 | 
			
		||||
#               1024-byte boundary from the beginning of the volume
 | 
			
		||||
#	Note: the word echoed below MUST be 10 characters exactly.
 | 
			
		||||
#
 | 
			
		||||
	(echo "FORTH    ") | lifcp -r -T-030001 -K2 - this_lif:AUTO	
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#
 | 
			
		||||
# somxtract infile outfile --
 | 
			
		||||
#	converts a series 800 file *only* into a raw image
 | 
			
		||||
 | 
			
		||||
It turns out the native cc and our current gcc produce series 700
 | 
			
		||||
output, so in this case it runs till if fills up the hard disk.
 | 
			
		||||
 | 
			
		||||
*** rombootlf5 is a FORTH interpreter in a "boot" image. (it won't run on
 | 
			
		||||
the HP742 board)
 | 
			
		||||
 | 
			
		||||
lifls -l rombootlf5
 | 
			
		||||
volume ISL10 data size 249984 directory size 8 94/04/20 10:26:36
 | 
			
		||||
filename   type   start   size     implement  created
 | 
			
		||||
===============================================================
 | 
			
		||||
ISL        -12800 16      240      0          94/04/20 10:26:36
 | 
			
		||||
HPUX       -12928 256     496      0          94/04/20 10:26:37
 | 
			
		||||
 IOMAP      -12960 752     1504     0          94/04/20 10:26:37
 | 
			
		||||
AUTO       -12289 2256    1        0          94/04/20 10:26:38
 | 
			
		||||
FORTH      -12960 2264    208      0          94/04/20 10:26:38
 | 
			
		||||
HPFORTH    ASCII  2472    420      0          94/04/20 10:26:38
 | 
			
		||||
BOOTROM    ASCII  2896    3849     0          94/04/20 10:26:40
 | 
			
		||||
PAD1       -12290 6752    1172     0          94/04/20 10:26:40
 | 
			
		||||
 | 
			
		||||
*** The ISL is only needed when booting the raw hardware. As we're runing
 | 
			
		||||
on a monitor (barely) all we need is a crt0 that initiallizes the GR27
 | 
			
		||||
Global Data Pointer and zero's bss.
 | 
			
		||||
 | 
			
		||||
*** Initial Program Load
 | 
			
		||||
--------------------
 | 
			
		||||
From page 11-56, architecture book.
 | 
			
		||||
0x00000000 +------------------------------------+ 0
 | 
			
		||||
	   |	LIF_MAGIC	|		|
 | 
			
		||||
0x00000004 +------------------------------------+ 4
 | 
			
		||||
	   |					|
 | 
			
		||||
0x000000F0 +------------------------------------+ 240
 | 
			
		||||
	   |		IPL_ADDR		|
 | 
			
		||||
0x000000F4 +------------------------------------+ 244
 | 
			
		||||
	   |		IPL_SIZE		|
 | 
			
		||||
0x000000F8 +------------------------------------+ 248
 | 
			
		||||
 	   |		IPL_ENTRY		|
 | 
			
		||||
0x000000FC +------------------------------------+ 252
 | 
			
		||||
	   |					|
 | 
			
		||||
IPL_ADDR   +------------------------------------+ IPL_ADDR
 | 
			
		||||
	   |	    Position Independant	|
 | 
			
		||||
	   |		IPL Code		|
 | 
			
		||||
	   |	(including IPL_CHECKSUM)	|
 | 
			
		||||
	   +------------------------------------+ IPL_ADDR + IPL_SIZE
 | 
			
		||||
	   |					|
 | 
			
		||||
	   +------------------------------------+
 | 
			
		||||
 | 
			
		||||
IPL_ADDR	2 Kbyte aligned, nonzero
 | 
			
		||||
IPL_SIZE	Multiple of 2Kbytes, <= 256 Kbytes
 | 
			
		||||
IPL_ENTRY	Word aligned, less than IPL_SIZE
 | 
			
		||||
 | 
			
		||||
Loads at IPL_START
 | 
			
		||||
 | 
			
		||||
This is based on Cobra/Coral hardware:
 | 
			
		||||
      LED register at 0xf080024
 | 
			
		||||
      I/O status register at 0xf0800000
 | 
			
		||||
      EEPROM at 0xf0810000 (LAN ID begins at byte 0)
 | 
			
		||||
 | 
			
		||||
Here's a dump of the LIF volume header using "xd" (od with hex output)
 | 
			
		||||
 | 
			
		||||
*
 | 
			
		||||
00000f0 0000 1000 0000 9800 0000 0000 0000 0000
 | 
			
		||||
                       ^^^^
 | 
			
		||||
		This is the size
 | 
			
		||||
*
 | 
			
		||||
0000800 5445 5354 2020 2020 2020 a271 0000 0010
 | 
			
		||||
	^^^^ ^^^^ ^^^^ ^^^^ ^^^^           ^^^^<-- this is the ipl offset
 | 
			
		||||
	this is the vol name	 ^^^^<- this is the type
 | 
			
		||||
 | 
			
		||||
0000810 0000 0098 9407 1919 1426 8001 0000 0000
 | 
			
		||||
	     ^^^^
 | 
			
		||||
	This is the ipl size
 | 
			
		||||
 | 
			
		||||
Interupts
 | 
			
		||||
---------
 | 
			
		||||
The vector table is access by %iva (%cr14). The address here must be a
 | 
			
		||||
multiple of 2048. The indexes are:
 | 
			
		||||
1	high-priority
 | 
			
		||||
2	power failure
 | 
			
		||||
3	recovery counter
 | 
			
		||||
4	external interrupt
 | 
			
		||||
5	low-priority machine check
 | 
			
		||||
6	instruction TLB miss/instruction page fault
 | 
			
		||||
7	instruction memory protection
 | 
			
		||||
8	illegal instruction
 | 
			
		||||
9	break instruction
 | 
			
		||||
10	priviledged operation
 | 
			
		||||
11	priviledged register
 | 
			
		||||
12	overflow
 | 
			
		||||
13	conditional
 | 
			
		||||
14	assist exception
 | 
			
		||||
15	data TLB miss fault/data page fault
 | 
			
		||||
16	non access instruction TLB miss fault
 | 
			
		||||
17	non access page TLB miss fault/non access data page fault
 | 
			
		||||
18	data memory protection/unaligned data reference
 | 
			
		||||
19	data memory break
 | 
			
		||||
20	TLB dirty bit
 | 
			
		||||
21	page reference
 | 
			
		||||
22	assist emulation
 | 
			
		||||
23	higher-priority transfer
 | 
			
		||||
24	lower-priority transfe
 | 
			
		||||
25	taken branch
 | 
			
		||||
							
								
								
									
										150
									
								
								libgloss/hp74x/checksum.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										150
									
								
								libgloss/hp74x/checksum.c
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,150 @@
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
#include <fcntl.h>
 | 
			
		||||
 | 
			
		||||
#define USAGE	"USAGE: checkum -[vhcs] infile outfile\n\t-v\tverbose\n\
 | 
			
		||||
\t-h\thelp\n\t-c\tcheck checksum\n\t-s\tprint the ipl size"
 | 
			
		||||
static int verbose = 0;
 | 
			
		||||
static int verify  = 0;
 | 
			
		||||
static int size    = 0;
 | 
			
		||||
 | 
			
		||||
typedef int word_t;
 | 
			
		||||
#define WORDSIZE (sizeof(word_t))
 | 
			
		||||
 | 
			
		||||
main(argc, argv)
 | 
			
		||||
     int argc;
 | 
			
		||||
     char **argv;
 | 
			
		||||
{
 | 
			
		||||
  char	 *infile;
 | 
			
		||||
  char	 *outfile;
 | 
			
		||||
  int	 infd;
 | 
			
		||||
  int	 outfd;
 | 
			
		||||
  word_t checksum = 0;
 | 
			
		||||
  int	 nbytes;
 | 
			
		||||
  word_t buf;
 | 
			
		||||
  int	 i        = 1;
 | 
			
		||||
  int	filesize  = 0;
 | 
			
		||||
  
 | 
			
		||||
  while (*argv[i] == '-') {
 | 
			
		||||
      switch (*(argv[i]+1)) {
 | 
			
		||||
      case 'v':
 | 
			
		||||
	verbose++;
 | 
			
		||||
	break;
 | 
			
		||||
      case 'c':
 | 
			
		||||
	verify++;
 | 
			
		||||
	puts ("Sorry, unimplemented for now");
 | 
			
		||||
	exit(1);
 | 
			
		||||
	break;
 | 
			
		||||
      case 's':
 | 
			
		||||
	size++;
 | 
			
		||||
	break;
 | 
			
		||||
      case 'h':
 | 
			
		||||
	puts (USAGE);
 | 
			
		||||
	exit(0);
 | 
			
		||||
      default:
 | 
			
		||||
	printf ("\"%s\", Illegal option\n", argv[i]);
 | 
			
		||||
	puts (USAGE);
 | 
			
		||||
	exit(1);
 | 
			
		||||
    }
 | 
			
		||||
    i++;
 | 
			
		||||
  }
 | 
			
		||||
  infile = *(argv + i);
 | 
			
		||||
  outfile = *(argv + i+1);
 | 
			
		||||
 | 
			
		||||
  /* see it there were file names on the command line */
 | 
			
		||||
  if (infile == 0x0) {
 | 
			
		||||
    puts("Didn't specify an input file name");
 | 
			
		||||
    exit(1);
 | 
			
		||||
  }
 | 
			
		||||
  if (outfile == 0x0) {
 | 
			
		||||
    puts("Didn't specify an output file name");
 | 
			
		||||
     exit(1);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /* try to open the files */
 | 
			
		||||
  infd = open(infile, O_RDONLY);
 | 
			
		||||
  if (infd == -1) {
 | 
			
		||||
    printf("Couldn't open %s\n", infile);
 | 
			
		||||
    exit(1);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  outfd = open(outfile, O_WRONLY|O_CREAT|O_TRUNC);
 | 
			
		||||
  if (outfd == -1) {
 | 
			
		||||
    printf("Couldn't open %s\n", outfile);
 | 
			
		||||
    exit(1);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if (verbose > 2) 
 | 
			
		||||
    putchar('\n');
 | 
			
		||||
 | 
			
		||||
  /* calculate the checksum */
 | 
			
		||||
  while ((nbytes = read(infd, &buf, WORDSIZE)) == WORDSIZE) {
 | 
			
		||||
    if (verbose > 2) 
 | 
			
		||||
      putchar('.');
 | 
			
		||||
    checksum+= buf;
 | 
			
		||||
    filesize+= WORDSIZE;
 | 
			
		||||
    if (write(outfd, &buf, WORDSIZE) != WORDSIZE) {
 | 
			
		||||
      puts("Couldn't write");
 | 
			
		||||
    } 
 | 
			
		||||
    if (verbose > 3) 
 | 
			
		||||
      putchar('+');
 | 
			
		||||
  }
 | 
			
		||||
  if (verbose > 2) 
 | 
			
		||||
    putchar('\n');
 | 
			
		||||
  
 | 
			
		||||
  /* write the last byte read */
 | 
			
		||||
  if (nbytes > 0) {
 | 
			
		||||
    write(outfd, &buf, nbytes);
 | 
			
		||||
    checksum+= buf;  				/* calculate the last word */
 | 
			
		||||
    filesize+= nbytes;
 | 
			
		||||
  }
 | 
			
		||||
  /* write the checksum */
 | 
			
		||||
  buf = -checksum;
 | 
			
		||||
  write(outfd, &buf, WORDSIZE);
 | 
			
		||||
  filesize+= WORDSIZE;				/* checksum increase the size */
 | 
			
		||||
 | 
			
		||||
  if (verbose > 0)
 | 
			
		||||
    printf("The calculated checksum is:\n\t0x%x,\n\t%u\n", -checksum, -checksum);
 | 
			
		||||
 | 
			
		||||
  /* calculate the extra 2K here */
 | 
			
		||||
  buf = 0;
 | 
			
		||||
  while ((filesize % 2048) !=0) {
 | 
			
		||||
    filesize+=WORDSIZE;
 | 
			
		||||
    write(outfd, &buf, WORDSIZE);
 | 
			
		||||
  }
 | 
			
		||||
  if (size > 0) {
 | 
			
		||||
    printf ("%u is the new file size\n", filesize);
 | 
			
		||||
  }
 | 
			
		||||
  close(outfd);
 | 
			
		||||
  close(infd);
 | 
			
		||||
  exit(0);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#if 0
 | 
			
		||||
/* Calculate a simple checksum and concatenate it to the end of BUF.  */
 | 
			
		||||
void
 | 
			
		||||
compute_and_concatenate_checksum (word *buf, size_t bufsize_in_words)
 | 
			
		||||
{
 | 
			
		||||
  size_t i;
 | 
			
		||||
  word sum;
 | 
			
		||||
  sum = buf[0]
 | 
			
		||||
  for (i = 1; i < bufsize_in_words; i++)
 | 
			
		||||
    sum += buf[i];
 | 
			
		||||
  buf[bufsize_in_words] = -sum;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Calculate a simple checksum and verify it.  NOTE: bufsize_in_words should
 | 
			
		||||
   include the checksum, i.e., it should be one larger than when the
 | 
			
		||||
   checksum was calculated using compute_and_concatenate_checksum!  */
 | 
			
		||||
int
 | 
			
		||||
compute_and_and_verify_checksum (word *buf, size_t bufsize_in_words)
 | 
			
		||||
{
 | 
			
		||||
  size_t i;
 | 
			
		||||
  word sum;
 | 
			
		||||
  sum = buf[0];
 | 
			
		||||
  for (i = 1; i < bufsize_in_words; i++)
 | 
			
		||||
    sum += buf[i];
 | 
			
		||||
  if (sum != 0)
 | 
			
		||||
    return ERROR;
 | 
			
		||||
  return SUCCESS;
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
							
								
								
									
										991
									
								
								libgloss/hp74x/configure
									
									
									
									
										vendored
									
									
										Executable file
									
								
							
							
						
						
									
										991
									
								
								libgloss/hp74x/configure
									
									
									
									
										vendored
									
									
										Executable file
									
								
							@@ -0,0 +1,991 @@
 | 
			
		||||
#! /bin/sh
 | 
			
		||||
 | 
			
		||||
# Guess values for system-dependent variables and create Makefiles.
 | 
			
		||||
# Generated automatically using autoconf version 2.10 
 | 
			
		||||
# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
 | 
			
		||||
#
 | 
			
		||||
# This configure script is free software; the Free Software Foundation
 | 
			
		||||
# gives unlimited permission to copy, distribute and modify it.
 | 
			
		||||
 | 
			
		||||
# Defaults:
 | 
			
		||||
ac_help=
 | 
			
		||||
ac_default_prefix=/usr/local
 | 
			
		||||
# Any additions from configure.in:
 | 
			
		||||
 | 
			
		||||
# Initialize some variables set by options.
 | 
			
		||||
# The variables have the same names as the options, with
 | 
			
		||||
# dashes changed to underlines.
 | 
			
		||||
build=NONE
 | 
			
		||||
cache_file=./config.cache
 | 
			
		||||
exec_prefix=NONE
 | 
			
		||||
host=NONE
 | 
			
		||||
no_create=
 | 
			
		||||
nonopt=NONE
 | 
			
		||||
no_recursion=
 | 
			
		||||
prefix=NONE
 | 
			
		||||
program_prefix=NONE
 | 
			
		||||
program_suffix=NONE
 | 
			
		||||
program_transform_name=s,x,x,
 | 
			
		||||
silent=
 | 
			
		||||
site=
 | 
			
		||||
srcdir=
 | 
			
		||||
target=NONE
 | 
			
		||||
verbose=
 | 
			
		||||
x_includes=NONE
 | 
			
		||||
x_libraries=NONE
 | 
			
		||||
bindir='${exec_prefix}/bin'
 | 
			
		||||
sbindir='${exec_prefix}/sbin'
 | 
			
		||||
libexecdir='${exec_prefix}/libexec'
 | 
			
		||||
datadir='${prefix}/share'
 | 
			
		||||
sysconfdir='${prefix}/etc'
 | 
			
		||||
sharedstatedir='${prefix}/com'
 | 
			
		||||
localstatedir='${prefix}/var'
 | 
			
		||||
libdir='${exec_prefix}/lib'
 | 
			
		||||
includedir='${prefix}/include'
 | 
			
		||||
oldincludedir='/usr/include'
 | 
			
		||||
infodir='${prefix}/info'
 | 
			
		||||
mandir='${prefix}/man'
 | 
			
		||||
 | 
			
		||||
# Initialize some other variables.
 | 
			
		||||
subdirs=
 | 
			
		||||
MFLAGS= MAKEFLAGS=
 | 
			
		||||
 | 
			
		||||
ac_prev=
 | 
			
		||||
for ac_option
 | 
			
		||||
do
 | 
			
		||||
 | 
			
		||||
  # If the previous option needs an argument, assign it.
 | 
			
		||||
  if test -n "$ac_prev"; then
 | 
			
		||||
    eval "$ac_prev=\$ac_option"
 | 
			
		||||
    ac_prev=
 | 
			
		||||
    continue
 | 
			
		||||
  fi
 | 
			
		||||
 | 
			
		||||
  case "$ac_option" in
 | 
			
		||||
  -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
 | 
			
		||||
  *) ac_optarg= ;;
 | 
			
		||||
  esac
 | 
			
		||||
 | 
			
		||||
  # Accept the important Cygnus configure options, so we can diagnose typos.
 | 
			
		||||
 | 
			
		||||
  case "$ac_option" in
 | 
			
		||||
 | 
			
		||||
  -bindir | --bindir | --bindi | --bind | --bin | --bi)
 | 
			
		||||
    ac_prev=bindir ;;
 | 
			
		||||
  -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
 | 
			
		||||
    bindir="$ac_optarg" ;;
 | 
			
		||||
 | 
			
		||||
  -build | --build | --buil | --bui | --bu)
 | 
			
		||||
    ac_prev=build ;;
 | 
			
		||||
  -build=* | --build=* | --buil=* | --bui=* | --bu=*)
 | 
			
		||||
    build="$ac_optarg" ;;
 | 
			
		||||
 | 
			
		||||
  -cache-file | --cache-file | --cache-fil | --cache-fi \
 | 
			
		||||
  | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
 | 
			
		||||
    ac_prev=cache_file ;;
 | 
			
		||||
  -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
 | 
			
		||||
  | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
 | 
			
		||||
    cache_file="$ac_optarg" ;;
 | 
			
		||||
 | 
			
		||||
  -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
 | 
			
		||||
    ac_prev=datadir ;;
 | 
			
		||||
  -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
 | 
			
		||||
  | --da=*)
 | 
			
		||||
    datadir="$ac_optarg" ;;
 | 
			
		||||
 | 
			
		||||
  -disable-* | --disable-*)
 | 
			
		||||
    ac_feature=`echo $ac_option|sed -e 's/-*disable-//'`
 | 
			
		||||
    # Reject names that are not valid shell variable names.
 | 
			
		||||
    if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then
 | 
			
		||||
      { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
 | 
			
		||||
    fi
 | 
			
		||||
    ac_feature=`echo $ac_feature| sed 's/-/_/g'`
 | 
			
		||||
    eval "enable_${ac_feature}=no" ;;
 | 
			
		||||
 | 
			
		||||
  -enable-* | --enable-*)
 | 
			
		||||
    ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'`
 | 
			
		||||
    # Reject names that are not valid shell variable names.
 | 
			
		||||
    if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then
 | 
			
		||||
      { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
 | 
			
		||||
    fi
 | 
			
		||||
    ac_feature=`echo $ac_feature| sed 's/-/_/g'`
 | 
			
		||||
    case "$ac_option" in
 | 
			
		||||
      *=*) ;;
 | 
			
		||||
      *) ac_optarg=yes ;;
 | 
			
		||||
    esac
 | 
			
		||||
    eval "enable_${ac_feature}='$ac_optarg'" ;;
 | 
			
		||||
 | 
			
		||||
  -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
 | 
			
		||||
  | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
 | 
			
		||||
  | --exec | --exe | --ex)
 | 
			
		||||
    ac_prev=exec_prefix ;;
 | 
			
		||||
  -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
 | 
			
		||||
  | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
 | 
			
		||||
  | --exec=* | --exe=* | --ex=*)
 | 
			
		||||
    exec_prefix="$ac_optarg" ;;
 | 
			
		||||
 | 
			
		||||
  -gas | --gas | --ga | --g)
 | 
			
		||||
    # Obsolete; use --with-gas.
 | 
			
		||||
    with_gas=yes ;;
 | 
			
		||||
 | 
			
		||||
  -help | --help | --hel | --he)
 | 
			
		||||
    # Omit some internal or obsolete options to make the list less imposing.
 | 
			
		||||
    # This message is too long to be a string in the A/UX 3.1 sh.
 | 
			
		||||
    cat << EOF
 | 
			
		||||
Usage: configure [options] [host]
 | 
			
		||||
Options: [defaults in brackets after descriptions]
 | 
			
		||||
Configuration:
 | 
			
		||||
  --cache-file=FILE       cache test results in FILE
 | 
			
		||||
  --help                  print this message
 | 
			
		||||
  --no-create             do not create output files
 | 
			
		||||
  --quiet, --silent       do not print \`checking...' messages
 | 
			
		||||
  --version               print the version of autoconf that created configure
 | 
			
		||||
Directory and file names:
 | 
			
		||||
  --prefix=PREFIX         install architecture-independent files in PREFIX
 | 
			
		||||
                          [$ac_default_prefix]
 | 
			
		||||
  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
 | 
			
		||||
                          [same as prefix]
 | 
			
		||||
  --bindir=DIR            user executables in DIR [EPREFIX/bin]
 | 
			
		||||
  --sbindir=DIR           system admin executables in DIR [EPREFIX/sbin]
 | 
			
		||||
  --libexecdir=DIR        program executables in DIR [EPREFIX/libexec]
 | 
			
		||||
  --datadir=DIR           read-only architecture-independent data in DIR
 | 
			
		||||
                          [PREFIX/share]
 | 
			
		||||
  --sysconfdir=DIR        read-only single-machine data in DIR [PREFIX/etc]
 | 
			
		||||
  --sharedstatedir=DIR    modifiable architecture-independent data in DIR
 | 
			
		||||
                          [PREFIX/com]
 | 
			
		||||
  --localstatedir=DIR     modifiable single-machine data in DIR [PREFIX/var]
 | 
			
		||||
  --libdir=DIR            object code libraries in DIR [EPREFIX/lib]
 | 
			
		||||
  --includedir=DIR        C header files in DIR [PREFIX/include]
 | 
			
		||||
  --oldincludedir=DIR     C header files for non-gcc in DIR [/usr/include]
 | 
			
		||||
  --infodir=DIR           info documentation in DIR [PREFIX/info]
 | 
			
		||||
  --mandir=DIR            man documentation in DIR [PREFIX/man]
 | 
			
		||||
  --srcdir=DIR            find the sources in DIR [configure dir or ..]
 | 
			
		||||
  --program-prefix=PREFIX prepend PREFIX to installed program names
 | 
			
		||||
  --program-suffix=SUFFIX append SUFFIX to installed program names
 | 
			
		||||
  --program-transform-name=PROGRAM
 | 
			
		||||
                          run sed PROGRAM on installed program names
 | 
			
		||||
EOF
 | 
			
		||||
    cat << EOF
 | 
			
		||||
Host type:
 | 
			
		||||
  --build=BUILD           configure for building on BUILD [BUILD=HOST]
 | 
			
		||||
  --host=HOST             configure for HOST [guessed]
 | 
			
		||||
  --target=TARGET         configure for TARGET [TARGET=HOST]
 | 
			
		||||
Features and packages:
 | 
			
		||||
  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
 | 
			
		||||
  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
 | 
			
		||||
  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
 | 
			
		||||
  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
 | 
			
		||||
  --x-includes=DIR        X include files are in DIR
 | 
			
		||||
  --x-libraries=DIR       X library files are in DIR
 | 
			
		||||
EOF
 | 
			
		||||
    if test -n "$ac_help"; then
 | 
			
		||||
      echo "--enable and --with options recognized:$ac_help"
 | 
			
		||||
    fi
 | 
			
		||||
    exit 0 ;;
 | 
			
		||||
 | 
			
		||||
  -host | --host | --hos | --ho)
 | 
			
		||||
    ac_prev=host ;;
 | 
			
		||||
  -host=* | --host=* | --hos=* | --ho=*)
 | 
			
		||||
    host="$ac_optarg" ;;
 | 
			
		||||
 | 
			
		||||
  -includedir | --includedir | --includedi | --included | --include \
 | 
			
		||||
  | --includ | --inclu | --incl | --inc)
 | 
			
		||||
    ac_prev=includedir ;;
 | 
			
		||||
  -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
 | 
			
		||||
  | --includ=* | --inclu=* | --incl=* | --inc=*)
 | 
			
		||||
    includedir="$ac_optarg" ;;
 | 
			
		||||
 | 
			
		||||
  -infodir | --infodir | --infodi | --infod | --info | --inf)
 | 
			
		||||
    ac_prev=infodir ;;
 | 
			
		||||
  -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
 | 
			
		||||
    infodir="$ac_optarg" ;;
 | 
			
		||||
 | 
			
		||||
  -libdir | --libdir | --libdi | --libd)
 | 
			
		||||
    ac_prev=libdir ;;
 | 
			
		||||
  -libdir=* | --libdir=* | --libdi=* | --libd=*)
 | 
			
		||||
    libdir="$ac_optarg" ;;
 | 
			
		||||
 | 
			
		||||
  -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
 | 
			
		||||
  | --libexe | --libex | --libe)
 | 
			
		||||
    ac_prev=libexecdir ;;
 | 
			
		||||
  -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
 | 
			
		||||
  | --libexe=* | --libex=* | --libe=*)
 | 
			
		||||
    libexecdir="$ac_optarg" ;;
 | 
			
		||||
 | 
			
		||||
  -localstatedir | --localstatedir | --localstatedi | --localstated \
 | 
			
		||||
  | --localstate | --localstat | --localsta | --localst \
 | 
			
		||||
  | --locals | --local | --loca | --loc | --lo)
 | 
			
		||||
    ac_prev=localstatedir ;;
 | 
			
		||||
  -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
 | 
			
		||||
  | --localstate=* | --localstat=* | --localsta=* | --localst=* \
 | 
			
		||||
  | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
 | 
			
		||||
    localstatedir="$ac_optarg" ;;
 | 
			
		||||
 | 
			
		||||
  -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
 | 
			
		||||
    ac_prev=mandir ;;
 | 
			
		||||
  -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
 | 
			
		||||
    mandir="$ac_optarg" ;;
 | 
			
		||||
 | 
			
		||||
  -nfp | --nfp | --nf)
 | 
			
		||||
    # Obsolete; use --without-fp.
 | 
			
		||||
    with_fp=no ;;
 | 
			
		||||
 | 
			
		||||
  -no-create | --no-create | --no-creat | --no-crea | --no-cre \
 | 
			
		||||
  | --no-cr | --no-c)
 | 
			
		||||
    no_create=yes ;;
 | 
			
		||||
 | 
			
		||||
  -no-recursion | --no-recursion | --no-recursio | --no-recursi \
 | 
			
		||||
  | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
 | 
			
		||||
    no_recursion=yes ;;
 | 
			
		||||
 | 
			
		||||
  -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
 | 
			
		||||
  | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
 | 
			
		||||
  | --oldin | --oldi | --old | --ol | --o)
 | 
			
		||||
    ac_prev=oldincludedir ;;
 | 
			
		||||
  -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
 | 
			
		||||
  | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
 | 
			
		||||
  | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
 | 
			
		||||
    oldincludedir="$ac_optarg" ;;
 | 
			
		||||
 | 
			
		||||
  -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
 | 
			
		||||
    ac_prev=prefix ;;
 | 
			
		||||
  -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
 | 
			
		||||
    prefix="$ac_optarg" ;;
 | 
			
		||||
 | 
			
		||||
  -program-prefix | --program-prefix | --program-prefi | --program-pref \
 | 
			
		||||
  | --program-pre | --program-pr | --program-p)
 | 
			
		||||
    ac_prev=program_prefix ;;
 | 
			
		||||
  -program-prefix=* | --program-prefix=* | --program-prefi=* \
 | 
			
		||||
  | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
 | 
			
		||||
    program_prefix="$ac_optarg" ;;
 | 
			
		||||
 | 
			
		||||
  -program-suffix | --program-suffix | --program-suffi | --program-suff \
 | 
			
		||||
  | --program-suf | --program-su | --program-s)
 | 
			
		||||
    ac_prev=program_suffix ;;
 | 
			
		||||
  -program-suffix=* | --program-suffix=* | --program-suffi=* \
 | 
			
		||||
  | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
 | 
			
		||||
    program_suffix="$ac_optarg" ;;
 | 
			
		||||
 | 
			
		||||
  -program-transform-name | --program-transform-name \
 | 
			
		||||
  | --program-transform-nam | --program-transform-na \
 | 
			
		||||
  | --program-transform-n | --program-transform- \
 | 
			
		||||
  | --program-transform | --program-transfor \
 | 
			
		||||
  | --program-transfo | --program-transf \
 | 
			
		||||
  | --program-trans | --program-tran \
 | 
			
		||||
  | --progr-tra | --program-tr | --program-t)
 | 
			
		||||
    ac_prev=program_transform_name ;;
 | 
			
		||||
  -program-transform-name=* | --program-transform-name=* \
 | 
			
		||||
  | --program-transform-nam=* | --program-transform-na=* \
 | 
			
		||||
  | --program-transform-n=* | --program-transform-=* \
 | 
			
		||||
  | --program-transform=* | --program-transfor=* \
 | 
			
		||||
  | --program-transfo=* | --program-transf=* \
 | 
			
		||||
  | --program-trans=* | --program-tran=* \
 | 
			
		||||
  | --progr-tra=* | --program-tr=* | --program-t=*)
 | 
			
		||||
    program_transform_name="$ac_optarg" ;;
 | 
			
		||||
 | 
			
		||||
  -q | -quiet | --quiet | --quie | --qui | --qu | --q \
 | 
			
		||||
  | -silent | --silent | --silen | --sile | --sil)
 | 
			
		||||
    silent=yes ;;
 | 
			
		||||
 | 
			
		||||
  -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
 | 
			
		||||
    ac_prev=sbindir ;;
 | 
			
		||||
  -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
 | 
			
		||||
  | --sbi=* | --sb=*)
 | 
			
		||||
    sbindir="$ac_optarg" ;;
 | 
			
		||||
 | 
			
		||||
  -sharedstatedir | --sharedstatedir | --sharedstatedi \
 | 
			
		||||
  | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
 | 
			
		||||
  | --sharedst | --shareds | --shared | --share | --shar \
 | 
			
		||||
  | --sha | --sh)
 | 
			
		||||
    ac_prev=sharedstatedir ;;
 | 
			
		||||
  -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
 | 
			
		||||
  | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
 | 
			
		||||
  | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
 | 
			
		||||
  | --sha=* | --sh=*)
 | 
			
		||||
    sharedstatedir="$ac_optarg" ;;
 | 
			
		||||
 | 
			
		||||
  -site | --site | --sit)
 | 
			
		||||
    ac_prev=site ;;
 | 
			
		||||
  -site=* | --site=* | --sit=*)
 | 
			
		||||
    site="$ac_optarg" ;;
 | 
			
		||||
 | 
			
		||||
  -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
 | 
			
		||||
    ac_prev=srcdir ;;
 | 
			
		||||
  -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
 | 
			
		||||
    srcdir="$ac_optarg" ;;
 | 
			
		||||
 | 
			
		||||
  -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
 | 
			
		||||
  | --syscon | --sysco | --sysc | --sys | --sy)
 | 
			
		||||
    ac_prev=sysconfdir ;;
 | 
			
		||||
  -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
 | 
			
		||||
  | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
 | 
			
		||||
    sysconfdir="$ac_optarg" ;;
 | 
			
		||||
 | 
			
		||||
  -target | --target | --targe | --targ | --tar | --ta | --t)
 | 
			
		||||
    ac_prev=target ;;
 | 
			
		||||
  -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
 | 
			
		||||
    target="$ac_optarg" ;;
 | 
			
		||||
 | 
			
		||||
  -v | -verbose | --verbose | --verbos | --verbo | --verb)
 | 
			
		||||
    verbose=yes ;;
 | 
			
		||||
 | 
			
		||||
  -version | --version | --versio | --versi | --vers)
 | 
			
		||||
    echo "configure generated by autoconf version 2.10"
 | 
			
		||||
    exit 0 ;;
 | 
			
		||||
 | 
			
		||||
  -with-* | --with-*)
 | 
			
		||||
    ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'`
 | 
			
		||||
    # Reject names that are not valid shell variable names.
 | 
			
		||||
    if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then
 | 
			
		||||
      { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
 | 
			
		||||
    fi
 | 
			
		||||
    ac_package=`echo $ac_package| sed 's/-/_/g'`
 | 
			
		||||
    case "$ac_option" in
 | 
			
		||||
      *=*) ;;
 | 
			
		||||
      *) ac_optarg=yes ;;
 | 
			
		||||
    esac
 | 
			
		||||
    eval "with_${ac_package}='$ac_optarg'" ;;
 | 
			
		||||
 | 
			
		||||
  -without-* | --without-*)
 | 
			
		||||
    ac_package=`echo $ac_option|sed -e 's/-*without-//'`
 | 
			
		||||
    # Reject names that are not valid shell variable names.
 | 
			
		||||
    if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then
 | 
			
		||||
      { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
 | 
			
		||||
    fi
 | 
			
		||||
    ac_package=`echo $ac_package| sed 's/-/_/g'`
 | 
			
		||||
    eval "with_${ac_package}=no" ;;
 | 
			
		||||
 | 
			
		||||
  --x)
 | 
			
		||||
    # Obsolete; use --with-x.
 | 
			
		||||
    with_x=yes ;;
 | 
			
		||||
 | 
			
		||||
  -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
 | 
			
		||||
  | --x-incl | --x-inc | --x-in | --x-i)
 | 
			
		||||
    ac_prev=x_includes ;;
 | 
			
		||||
  -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
 | 
			
		||||
  | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
 | 
			
		||||
    x_includes="$ac_optarg" ;;
 | 
			
		||||
 | 
			
		||||
  -x-libraries | --x-libraries | --x-librarie | --x-librari \
 | 
			
		||||
  | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
 | 
			
		||||
    ac_prev=x_libraries ;;
 | 
			
		||||
  -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
 | 
			
		||||
  | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
 | 
			
		||||
    x_libraries="$ac_optarg" ;;
 | 
			
		||||
 | 
			
		||||
  -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; }
 | 
			
		||||
    ;;
 | 
			
		||||
 | 
			
		||||
  *)
 | 
			
		||||
    if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then
 | 
			
		||||
      echo "configure: warning: $ac_option: invalid host type" 1>&2
 | 
			
		||||
    fi
 | 
			
		||||
    if test "x$nonopt" != xNONE; then
 | 
			
		||||
      { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; }
 | 
			
		||||
    fi
 | 
			
		||||
    nonopt="$ac_option"
 | 
			
		||||
    ;;
 | 
			
		||||
 | 
			
		||||
  esac
 | 
			
		||||
done
 | 
			
		||||
 | 
			
		||||
if test -n "$ac_prev"; then
 | 
			
		||||
  { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; }
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
 | 
			
		||||
 | 
			
		||||
# File descriptor usage:
 | 
			
		||||
# 0 standard input
 | 
			
		||||
# 1 file creation
 | 
			
		||||
# 2 errors and warnings
 | 
			
		||||
# 3 some systems may open it to /dev/tty
 | 
			
		||||
# 4 used on the Kubota Titan
 | 
			
		||||
# 6 checking for... messages and results
 | 
			
		||||
# 5 compiler messages saved in config.log
 | 
			
		||||
if test "$silent" = yes; then
 | 
			
		||||
  exec 6>/dev/null
 | 
			
		||||
else
 | 
			
		||||
  exec 6>&1
 | 
			
		||||
fi
 | 
			
		||||
exec 5>./config.log
 | 
			
		||||
 | 
			
		||||
echo "\
 | 
			
		||||
This file contains any messages produced by compilers while
 | 
			
		||||
running configure, to aid debugging if configure makes a mistake.
 | 
			
		||||
" 1>&5
 | 
			
		||||
 | 
			
		||||
# Strip out --no-create and --no-recursion so they do not pile up.
 | 
			
		||||
# Also quote any args containing shell metacharacters.
 | 
			
		||||
ac_configure_args=
 | 
			
		||||
for ac_arg
 | 
			
		||||
do
 | 
			
		||||
  case "$ac_arg" in
 | 
			
		||||
  -no-create | --no-create | --no-creat | --no-crea | --no-cre \
 | 
			
		||||
  | --no-cr | --no-c) ;;
 | 
			
		||||
  -no-recursion | --no-recursion | --no-recursio | --no-recursi \
 | 
			
		||||
  | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;;
 | 
			
		||||
  *" "*|*"	"*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
 | 
			
		||||
  ac_configure_args="$ac_configure_args '$ac_arg'" ;;
 | 
			
		||||
  *) ac_configure_args="$ac_configure_args $ac_arg" ;;
 | 
			
		||||
  esac
 | 
			
		||||
done
 | 
			
		||||
 | 
			
		||||
# NLS nuisances.
 | 
			
		||||
# Only set LANG and LC_ALL to C if already set.
 | 
			
		||||
# These must not be set unconditionally because not all systems understand
 | 
			
		||||
# e.g. LANG=C (notably SCO).
 | 
			
		||||
if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
 | 
			
		||||
if test "${LANG+set}"   = set; then LANG=C;   export LANG;   fi
 | 
			
		||||
 | 
			
		||||
# confdefs.h avoids OS command line length limits that DEFS can exceed.
 | 
			
		||||
rm -rf conftest* confdefs.h
 | 
			
		||||
# AIX cpp loses on an empty file, so make sure it contains at least a newline.
 | 
			
		||||
echo > confdefs.h
 | 
			
		||||
 | 
			
		||||
# A filename unique to this package, relative to the directory that
 | 
			
		||||
# configure is in, which we can look for to find out if srcdir is correct.
 | 
			
		||||
ac_unique_file=crt0.s
 | 
			
		||||
 | 
			
		||||
# Find the source files, if location was not specified.
 | 
			
		||||
if test -z "$srcdir"; then
 | 
			
		||||
  ac_srcdir_defaulted=yes
 | 
			
		||||
  # Try the directory containing this script, then its parent.
 | 
			
		||||
  ac_prog=$0
 | 
			
		||||
  ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'`
 | 
			
		||||
  test "x$ac_confdir" = "x$ac_prog" && ac_confdir=.
 | 
			
		||||
  srcdir=$ac_confdir
 | 
			
		||||
  if test ! -r $srcdir/$ac_unique_file; then
 | 
			
		||||
    srcdir=..
 | 
			
		||||
  fi
 | 
			
		||||
else
 | 
			
		||||
  ac_srcdir_defaulted=no
 | 
			
		||||
fi
 | 
			
		||||
if test ! -r $srcdir/$ac_unique_file; then
 | 
			
		||||
  if test "$ac_srcdir_defaulted" = yes; then
 | 
			
		||||
    { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; }
 | 
			
		||||
  else
 | 
			
		||||
    { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; }
 | 
			
		||||
  fi
 | 
			
		||||
fi
 | 
			
		||||
srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
 | 
			
		||||
 | 
			
		||||
# Prefer explicitly selected file to automatically selected ones.
 | 
			
		||||
if test -z "$CONFIG_SITE"; then
 | 
			
		||||
  if test "x$prefix" != xNONE; then
 | 
			
		||||
    CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
 | 
			
		||||
  else
 | 
			
		||||
    CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
 | 
			
		||||
  fi
 | 
			
		||||
fi
 | 
			
		||||
for ac_site_file in $CONFIG_SITE; do
 | 
			
		||||
  if test -r "$ac_site_file"; then
 | 
			
		||||
    echo "loading site script $ac_site_file"
 | 
			
		||||
    . "$ac_site_file"
 | 
			
		||||
  fi
 | 
			
		||||
done
 | 
			
		||||
 | 
			
		||||
if test -r "$cache_file"; then
 | 
			
		||||
  echo "loading cache $cache_file"
 | 
			
		||||
  . $cache_file
 | 
			
		||||
else
 | 
			
		||||
  echo "creating cache $cache_file"
 | 
			
		||||
  > $cache_file
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
ac_ext=c
 | 
			
		||||
# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
 | 
			
		||||
ac_cpp='$CPP $CPPFLAGS'
 | 
			
		||||
ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
 | 
			
		||||
ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
 | 
			
		||||
 | 
			
		||||
if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
 | 
			
		||||
  # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
 | 
			
		||||
  if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
 | 
			
		||||
    ac_n= ac_c='
 | 
			
		||||
' ac_t='	'
 | 
			
		||||
  else
 | 
			
		||||
    ac_n=-n ac_c= ac_t=
 | 
			
		||||
  fi
 | 
			
		||||
else
 | 
			
		||||
  ac_n= ac_c='\c' ac_t=
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
if test "$srcdir" = "." ; then
 | 
			
		||||
  mdir=`echo "${with_multisubdir}/" \
 | 
			
		||||
    | sed -e 's,\([^/][^/]*\),..,g' -e 's,^/$,,'`
 | 
			
		||||
  ac_aux_dir=
 | 
			
		||||
for ac_dir in ${mdir}../../.. $srcdir/${mdir}../../..; do
 | 
			
		||||
  if test -f $ac_dir/install-sh; then
 | 
			
		||||
    ac_aux_dir=$ac_dir
 | 
			
		||||
    ac_install_sh="$ac_aux_dir/install-sh -c"
 | 
			
		||||
    break
 | 
			
		||||
  elif test -f $ac_dir/install.sh; then
 | 
			
		||||
    ac_aux_dir=$ac_dir
 | 
			
		||||
    ac_install_sh="$ac_aux_dir/install.sh -c"
 | 
			
		||||
    break
 | 
			
		||||
  fi
 | 
			
		||||
done
 | 
			
		||||
if test -z "$ac_aux_dir"; then
 | 
			
		||||
  { echo "configure: error: can not find install-sh or install.sh in ${mdir}../../.. $srcdir/${mdir}../../.." 1>&2; exit 1; }
 | 
			
		||||
fi
 | 
			
		||||
ac_config_guess=$ac_aux_dir/config.guess
 | 
			
		||||
ac_config_sub=$ac_aux_dir/config.sub
 | 
			
		||||
ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
 | 
			
		||||
 | 
			
		||||
else
 | 
			
		||||
  ac_aux_dir=
 | 
			
		||||
for ac_dir in ${srcdir}/../.. $srcdir/${srcdir}/../..; do
 | 
			
		||||
  if test -f $ac_dir/install-sh; then
 | 
			
		||||
    ac_aux_dir=$ac_dir
 | 
			
		||||
    ac_install_sh="$ac_aux_dir/install-sh -c"
 | 
			
		||||
    break
 | 
			
		||||
  elif test -f $ac_dir/install.sh; then
 | 
			
		||||
    ac_aux_dir=$ac_dir
 | 
			
		||||
    ac_install_sh="$ac_aux_dir/install.sh -c"
 | 
			
		||||
    break
 | 
			
		||||
  fi
 | 
			
		||||
done
 | 
			
		||||
if test -z "$ac_aux_dir"; then
 | 
			
		||||
  { echo "configure: error: can not find install-sh or install.sh in ${srcdir}/../.. $srcdir/${srcdir}/../.." 1>&2; exit 1; }
 | 
			
		||||
fi
 | 
			
		||||
ac_config_guess=$ac_aux_dir/config.guess
 | 
			
		||||
ac_config_sub=$ac_aux_dir/config.sub
 | 
			
		||||
ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
 | 
			
		||||
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
# Find a good install program.  We prefer a C program (faster),
 | 
			
		||||
# so one script is as good as another.  But avoid the broken or
 | 
			
		||||
# incompatible versions:
 | 
			
		||||
# SysV /etc/install, /usr/sbin/install
 | 
			
		||||
# SunOS /usr/etc/install
 | 
			
		||||
# IRIX /sbin/install
 | 
			
		||||
# AIX /bin/install
 | 
			
		||||
# AFS /usr/afsws/bin/install, which mishandles nonexistent args
 | 
			
		||||
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
 | 
			
		||||
# ./install, which can be erroneously created by make from ./install.sh.
 | 
			
		||||
echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
 | 
			
		||||
if test -z "$INSTALL"; then
 | 
			
		||||
if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
 | 
			
		||||
  echo $ac_n "(cached) $ac_c" 1>&6
 | 
			
		||||
else
 | 
			
		||||
    IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:"
 | 
			
		||||
  for ac_dir in $PATH; do
 | 
			
		||||
    # Account for people who put trailing slashes in PATH elements.
 | 
			
		||||
    case "$ac_dir/" in
 | 
			
		||||
    /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
 | 
			
		||||
    *)
 | 
			
		||||
      # OSF1 and SCO ODT 3.0 have their own names for install.
 | 
			
		||||
      for ac_prog in ginstall installbsd scoinst install; do
 | 
			
		||||
        if test -f $ac_dir/$ac_prog; then
 | 
			
		||||
	  if test $ac_prog = install &&
 | 
			
		||||
            grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
 | 
			
		||||
	    # AIX install.  It has an incompatible calling convention.
 | 
			
		||||
	    # OSF/1 installbsd also uses dspmsg, but is usable.
 | 
			
		||||
	    :
 | 
			
		||||
	  else
 | 
			
		||||
	    ac_cv_path_install="$ac_dir/$ac_prog -c"
 | 
			
		||||
	    break 2
 | 
			
		||||
	  fi
 | 
			
		||||
	fi
 | 
			
		||||
      done
 | 
			
		||||
      ;;
 | 
			
		||||
    esac
 | 
			
		||||
  done
 | 
			
		||||
  IFS="$ac_save_ifs"
 | 
			
		||||
 | 
			
		||||
fi
 | 
			
		||||
  if test "${ac_cv_path_install+set}" = set; then
 | 
			
		||||
    INSTALL="$ac_cv_path_install"
 | 
			
		||||
  else
 | 
			
		||||
    # As a last resort, use the slow shell script.  We don't cache a
 | 
			
		||||
    # path for INSTALL within a source directory, because that will
 | 
			
		||||
    # break other packages using the cache if that directory is
 | 
			
		||||
    # removed, or if the path is relative.
 | 
			
		||||
    INSTALL="$ac_install_sh"
 | 
			
		||||
  fi
 | 
			
		||||
fi
 | 
			
		||||
echo "$ac_t""$INSTALL" 1>&6
 | 
			
		||||
 | 
			
		||||
# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
 | 
			
		||||
# It thinks the first close brace ends the variable substitution.
 | 
			
		||||
test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
 | 
			
		||||
 | 
			
		||||
test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Extract the first word of "gcc", so it can be a program name with args.
 | 
			
		||||
set dummy gcc; ac_word=$2
 | 
			
		||||
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
 | 
			
		||||
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
 | 
			
		||||
  echo $ac_n "(cached) $ac_c" 1>&6
 | 
			
		||||
else
 | 
			
		||||
  if test -n "$CC"; then
 | 
			
		||||
  ac_cv_prog_CC="$CC" # Let the user override the test.
 | 
			
		||||
else
 | 
			
		||||
  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:"
 | 
			
		||||
  for ac_dir in $PATH; do
 | 
			
		||||
    test -z "$ac_dir" && ac_dir=.
 | 
			
		||||
    if test -f $ac_dir/$ac_word; then
 | 
			
		||||
      ac_cv_prog_CC="gcc"
 | 
			
		||||
      break
 | 
			
		||||
    fi
 | 
			
		||||
  done
 | 
			
		||||
  IFS="$ac_save_ifs"
 | 
			
		||||
fi
 | 
			
		||||
fi
 | 
			
		||||
CC="$ac_cv_prog_CC"
 | 
			
		||||
if test -n "$CC"; then
 | 
			
		||||
  echo "$ac_t""$CC" 1>&6
 | 
			
		||||
else
 | 
			
		||||
  echo "$ac_t""no" 1>&6
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
if test -z "$CC"; then
 | 
			
		||||
  # Extract the first word of "cc", so it can be a program name with args.
 | 
			
		||||
set dummy cc; ac_word=$2
 | 
			
		||||
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
 | 
			
		||||
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
 | 
			
		||||
  echo $ac_n "(cached) $ac_c" 1>&6
 | 
			
		||||
else
 | 
			
		||||
  if test -n "$CC"; then
 | 
			
		||||
  ac_cv_prog_CC="$CC" # Let the user override the test.
 | 
			
		||||
else
 | 
			
		||||
  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:"
 | 
			
		||||
  ac_prog_rejected=no
 | 
			
		||||
  for ac_dir in $PATH; do
 | 
			
		||||
    test -z "$ac_dir" && ac_dir=.
 | 
			
		||||
    if test -f $ac_dir/$ac_word; then
 | 
			
		||||
      if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
 | 
			
		||||
        ac_prog_rejected=yes
 | 
			
		||||
	continue
 | 
			
		||||
      fi
 | 
			
		||||
      ac_cv_prog_CC="cc"
 | 
			
		||||
      break
 | 
			
		||||
    fi
 | 
			
		||||
  done
 | 
			
		||||
  IFS="$ac_save_ifs"
 | 
			
		||||
if test $ac_prog_rejected = yes; then
 | 
			
		||||
  # We found a bogon in the path, so make sure we never use it.
 | 
			
		||||
  set dummy $ac_cv_prog_CC
 | 
			
		||||
  shift
 | 
			
		||||
  if test $# -gt 0; then
 | 
			
		||||
    # We chose a different compiler from the bogus one.
 | 
			
		||||
    # However, it has the same basename, so the bogon will be chosen
 | 
			
		||||
    # first if we set CC to just the basename; use the full file name.
 | 
			
		||||
    shift
 | 
			
		||||
    set dummy "$ac_dir/$ac_word" "$@"
 | 
			
		||||
    shift
 | 
			
		||||
    ac_cv_prog_CC="$@"
 | 
			
		||||
  fi
 | 
			
		||||
fi
 | 
			
		||||
fi
 | 
			
		||||
fi
 | 
			
		||||
CC="$ac_cv_prog_CC"
 | 
			
		||||
if test -n "$CC"; then
 | 
			
		||||
  echo "$ac_t""$CC" 1>&6
 | 
			
		||||
else
 | 
			
		||||
  echo "$ac_t""no" 1>&6
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
  test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
 | 
			
		||||
if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
 | 
			
		||||
  echo $ac_n "(cached) $ac_c" 1>&6
 | 
			
		||||
else
 | 
			
		||||
  cat > conftest.c <<EOF
 | 
			
		||||
#ifdef __GNUC__
 | 
			
		||||
  yes;
 | 
			
		||||
#endif
 | 
			
		||||
EOF
 | 
			
		||||
if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:707: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
 | 
			
		||||
  ac_cv_prog_gcc=yes
 | 
			
		||||
else
 | 
			
		||||
  ac_cv_prog_gcc=no
 | 
			
		||||
fi
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
echo "$ac_t""$ac_cv_prog_gcc" 1>&6
 | 
			
		||||
if test $ac_cv_prog_gcc = yes; then
 | 
			
		||||
  GCC=yes
 | 
			
		||||
  if test "${CFLAGS+set}" != set; then
 | 
			
		||||
    echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
 | 
			
		||||
if eval "test \"`echo '$''{'ac_cv_prog_gcc_g'+set}'`\" = set"; then
 | 
			
		||||
  echo $ac_n "(cached) $ac_c" 1>&6
 | 
			
		||||
else
 | 
			
		||||
  echo 'void f(){}' > conftest.c
 | 
			
		||||
if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
 | 
			
		||||
  ac_cv_prog_gcc_g=yes
 | 
			
		||||
else
 | 
			
		||||
  ac_cv_prog_gcc_g=no
 | 
			
		||||
fi
 | 
			
		||||
rm -f conftest*
 | 
			
		||||
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
echo "$ac_t""$ac_cv_prog_gcc_g" 1>&6
 | 
			
		||||
    if test $ac_cv_prog_gcc_g = yes; then
 | 
			
		||||
      CFLAGS="-g -O"
 | 
			
		||||
    else
 | 
			
		||||
      CFLAGS="-O"
 | 
			
		||||
    fi
 | 
			
		||||
  fi
 | 
			
		||||
else
 | 
			
		||||
  GCC=
 | 
			
		||||
  test "${CFLAGS+set}" = set || CFLAGS="-g"
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
AS=${AS-as}
 | 
			
		||||
 | 
			
		||||
AR=${AR-ar}
 | 
			
		||||
 | 
			
		||||
LD=${LD-ld}
 | 
			
		||||
 | 
			
		||||
# Extract the first word of "ranlib", so it can be a program name with args.
 | 
			
		||||
set dummy ranlib; ac_word=$2
 | 
			
		||||
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
 | 
			
		||||
if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
 | 
			
		||||
  echo $ac_n "(cached) $ac_c" 1>&6
 | 
			
		||||
else
 | 
			
		||||
  if test -n "$RANLIB"; then
 | 
			
		||||
  ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
 | 
			
		||||
else
 | 
			
		||||
  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:"
 | 
			
		||||
  for ac_dir in $PATH; do
 | 
			
		||||
    test -z "$ac_dir" && ac_dir=.
 | 
			
		||||
    if test -f $ac_dir/$ac_word; then
 | 
			
		||||
      ac_cv_prog_RANLIB="ranlib"
 | 
			
		||||
      break
 | 
			
		||||
    fi
 | 
			
		||||
  done
 | 
			
		||||
  IFS="$ac_save_ifs"
 | 
			
		||||
  test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":"
 | 
			
		||||
fi
 | 
			
		||||
fi
 | 
			
		||||
RANLIB="$ac_cv_prog_RANLIB"
 | 
			
		||||
if test -n "$RANLIB"; then
 | 
			
		||||
  echo "$ac_t""$RANLIB" 1>&6
 | 
			
		||||
else
 | 
			
		||||
  echo "$ac_t""no" 1>&6
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
host_makefile_frag=${srcdir}/../config/default.mh
 | 
			
		||||
 | 
			
		||||
host_makefile_frag_path=$host_makefile_frag
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
trap '' 1 2 15
 | 
			
		||||
cat > confcache <<\EOF
 | 
			
		||||
# This file is a shell script that caches the results of configure
 | 
			
		||||
# tests run on this system so they can be shared between configure
 | 
			
		||||
# scripts and configure runs.  It is not useful on other systems.
 | 
			
		||||
# If it contains results you don't want to keep, you may remove or edit it.
 | 
			
		||||
#
 | 
			
		||||
# By default, configure uses ./config.cache as the cache file,
 | 
			
		||||
# creating it if it does not exist already.  You can give configure
 | 
			
		||||
# the --cache-file=FILE option to use a different cache file; that is
 | 
			
		||||
# what configure does when it calls configure scripts in
 | 
			
		||||
# subdirectories, so they share the cache.
 | 
			
		||||
# Giving --cache-file=/dev/null disables caching, for debugging configure.
 | 
			
		||||
# config.status only pays attention to the cache file if you give it the
 | 
			
		||||
# --recheck option to rerun configure.
 | 
			
		||||
#
 | 
			
		||||
EOF
 | 
			
		||||
# Ultrix sh set writes to stderr and can't be redirected directly,
 | 
			
		||||
# and sets the high bit in the cache file unless we assign to the vars.
 | 
			
		||||
(set) 2>&1 |
 | 
			
		||||
  sed -n "s/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=\${\1='\2'}/p" \
 | 
			
		||||
  >> confcache
 | 
			
		||||
if cmp -s $cache_file confcache; then
 | 
			
		||||
  :
 | 
			
		||||
else
 | 
			
		||||
  if test -w $cache_file; then
 | 
			
		||||
    echo "updating cache $cache_file"
 | 
			
		||||
    cat confcache > $cache_file
 | 
			
		||||
  else
 | 
			
		||||
    echo "not updating unwritable cache $cache_file"
 | 
			
		||||
  fi
 | 
			
		||||
fi
 | 
			
		||||
rm -f confcache
 | 
			
		||||
 | 
			
		||||
trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
 | 
			
		||||
 | 
			
		||||
test "x$prefix" = xNONE && prefix=$ac_default_prefix
 | 
			
		||||
# Let make expand exec_prefix.
 | 
			
		||||
test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
 | 
			
		||||
 | 
			
		||||
# Any assignment to VPATH causes Sun make to only execute
 | 
			
		||||
# the first set of double-colon rules, so remove it if not needed.
 | 
			
		||||
# If there is a colon in the path, we need to keep it.
 | 
			
		||||
if test "x$srcdir" = x.; then
 | 
			
		||||
  ac_vpsub='/^[ 	]*VPATH[ 	]*=[^:]*$/d'
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
 | 
			
		||||
 | 
			
		||||
# Transform confdefs.h into DEFS.
 | 
			
		||||
# Protect against shell expansion while executing Makefile rules.
 | 
			
		||||
# Protect against Makefile macro expansion.
 | 
			
		||||
cat > conftest.defs <<\EOF
 | 
			
		||||
s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g
 | 
			
		||||
s%[ 	`~#$^&*(){}\\|;'"<>?]%\\&%g
 | 
			
		||||
s%\[%\\&%g
 | 
			
		||||
s%\]%\\&%g
 | 
			
		||||
s%\$%$$%g
 | 
			
		||||
EOF
 | 
			
		||||
DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '`
 | 
			
		||||
rm -f conftest.defs
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Without the "./", some shells look in PATH for config.status.
 | 
			
		||||
: ${CONFIG_STATUS=./config.status}
 | 
			
		||||
 | 
			
		||||
echo creating $CONFIG_STATUS
 | 
			
		||||
rm -f $CONFIG_STATUS
 | 
			
		||||
cat > $CONFIG_STATUS <<EOF
 | 
			
		||||
#! /bin/sh
 | 
			
		||||
# Generated automatically by configure.
 | 
			
		||||
# Run this file to recreate the current configuration.
 | 
			
		||||
# This directory was configured as follows,
 | 
			
		||||
# on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
 | 
			
		||||
#
 | 
			
		||||
# $0 $ac_configure_args
 | 
			
		||||
#
 | 
			
		||||
# Compiler output produced by configure, useful for debugging
 | 
			
		||||
# configure, is in ./config.log if it exists.
 | 
			
		||||
 | 
			
		||||
ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]"
 | 
			
		||||
for ac_option
 | 
			
		||||
do
 | 
			
		||||
  case "\$ac_option" in
 | 
			
		||||
  -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
 | 
			
		||||
    echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
 | 
			
		||||
    exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
 | 
			
		||||
  -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
 | 
			
		||||
    echo "$CONFIG_STATUS generated by autoconf version 2.10"
 | 
			
		||||
    exit 0 ;;
 | 
			
		||||
  -help | --help | --hel | --he | --h)
 | 
			
		||||
    echo "\$ac_cs_usage"; exit 0 ;;
 | 
			
		||||
  *) echo "\$ac_cs_usage"; exit 1 ;;
 | 
			
		||||
  esac
 | 
			
		||||
done
 | 
			
		||||
 | 
			
		||||
ac_given_srcdir=$srcdir
 | 
			
		||||
ac_given_INSTALL="$INSTALL"
 | 
			
		||||
 | 
			
		||||
trap 'rm -fr `echo "Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
 | 
			
		||||
EOF
 | 
			
		||||
cat >> $CONFIG_STATUS <<EOF
 | 
			
		||||
 | 
			
		||||
# Protect against being on the right side of a sed subst in config.status.
 | 
			
		||||
sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g;
 | 
			
		||||
 s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF
 | 
			
		||||
$ac_vpsub
 | 
			
		||||
$extrasub
 | 
			
		||||
s%@CFLAGS@%$CFLAGS%g
 | 
			
		||||
s%@CPPFLAGS@%$CPPFLAGS%g
 | 
			
		||||
s%@CXXFLAGS@%$CXXFLAGS%g
 | 
			
		||||
s%@DEFS@%$DEFS%g
 | 
			
		||||
s%@LDFLAGS@%$LDFLAGS%g
 | 
			
		||||
s%@LIBS@%$LIBS%g
 | 
			
		||||
s%@exec_prefix@%$exec_prefix%g
 | 
			
		||||
s%@prefix@%$prefix%g
 | 
			
		||||
s%@program_transform_name@%$program_transform_name%g
 | 
			
		||||
s%@bindir@%$bindir%g
 | 
			
		||||
s%@sbindir@%$sbindir%g
 | 
			
		||||
s%@libexecdir@%$libexecdir%g
 | 
			
		||||
s%@datadir@%$datadir%g
 | 
			
		||||
s%@sysconfdir@%$sysconfdir%g
 | 
			
		||||
s%@sharedstatedir@%$sharedstatedir%g
 | 
			
		||||
s%@localstatedir@%$localstatedir%g
 | 
			
		||||
s%@libdir@%$libdir%g
 | 
			
		||||
s%@includedir@%$includedir%g
 | 
			
		||||
s%@oldincludedir@%$oldincludedir%g
 | 
			
		||||
s%@infodir@%$infodir%g
 | 
			
		||||
s%@mandir@%$mandir%g
 | 
			
		||||
s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
 | 
			
		||||
s%@INSTALL_DATA@%$INSTALL_DATA%g
 | 
			
		||||
s%@CC@%$CC%g
 | 
			
		||||
s%@AS@%$AS%g
 | 
			
		||||
s%@AR@%$AR%g
 | 
			
		||||
s%@LD@%$LD%g
 | 
			
		||||
s%@RANLIB@%$RANLIB%g
 | 
			
		||||
s%@host_makefile_frag_path@%$host_makefile_frag_path%g
 | 
			
		||||
/@host_makefile_frag@/r $host_makefile_frag
 | 
			
		||||
s%@host_makefile_frag@%%g
 | 
			
		||||
 | 
			
		||||
CEOF
 | 
			
		||||
EOF
 | 
			
		||||
cat >> $CONFIG_STATUS <<EOF
 | 
			
		||||
 | 
			
		||||
CONFIG_FILES=\${CONFIG_FILES-"Makefile"}
 | 
			
		||||
EOF
 | 
			
		||||
cat >> $CONFIG_STATUS <<\EOF
 | 
			
		||||
for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
 | 
			
		||||
  # Support "outfile[:infile]", defaulting infile="outfile.in".
 | 
			
		||||
  case "$ac_file" in
 | 
			
		||||
  *:*) ac_file_in=`echo "$ac_file"|sed 's%.*:%%'`
 | 
			
		||||
       ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
 | 
			
		||||
  *) ac_file_in="${ac_file}.in" ;;
 | 
			
		||||
  esac
 | 
			
		||||
 | 
			
		||||
  # Adjust relative srcdir, etc. for subdirectories.
 | 
			
		||||
 | 
			
		||||
  # Remove last slash and all that follows it.  Not all systems have dirname.
 | 
			
		||||
  ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
 | 
			
		||||
  if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
 | 
			
		||||
    # The file is in a subdirectory.
 | 
			
		||||
    test ! -d "$ac_dir" && mkdir "$ac_dir"
 | 
			
		||||
    ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`"
 | 
			
		||||
    # A "../" for each directory in $ac_dir_suffix.
 | 
			
		||||
    ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'`
 | 
			
		||||
  else
 | 
			
		||||
    ac_dir_suffix= ac_dots=
 | 
			
		||||
  fi
 | 
			
		||||
 | 
			
		||||
  case "$ac_given_srcdir" in
 | 
			
		||||
  .)  srcdir=.
 | 
			
		||||
      if test -z "$ac_dots"; then top_srcdir=.
 | 
			
		||||
      else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;;
 | 
			
		||||
  /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;;
 | 
			
		||||
  *) # Relative path.
 | 
			
		||||
    srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix"
 | 
			
		||||
    top_srcdir="$ac_dots$ac_given_srcdir" ;;
 | 
			
		||||
  esac
 | 
			
		||||
 | 
			
		||||
  case "$ac_given_INSTALL" in
 | 
			
		||||
  [/$]*) INSTALL="$ac_given_INSTALL" ;;
 | 
			
		||||
  *) INSTALL="$ac_dots$ac_given_INSTALL" ;;
 | 
			
		||||
  esac
 | 
			
		||||
  echo creating "$ac_file"
 | 
			
		||||
  rm -f "$ac_file"
 | 
			
		||||
  configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure."
 | 
			
		||||
  case "$ac_file" in
 | 
			
		||||
  *Makefile*) ac_comsub="1i\\
 | 
			
		||||
# $configure_input" ;;
 | 
			
		||||
  *) ac_comsub= ;;
 | 
			
		||||
  esac
 | 
			
		||||
  sed -e "$ac_comsub
 | 
			
		||||
s%@configure_input@%$configure_input%g
 | 
			
		||||
s%@srcdir@%$srcdir%g
 | 
			
		||||
s%@top_srcdir@%$top_srcdir%g
 | 
			
		||||
s%@INSTALL@%$INSTALL%g
 | 
			
		||||
" -f conftest.subs $ac_given_srcdir/$ac_file_in > $ac_file
 | 
			
		||||
fi; done
 | 
			
		||||
rm -f conftest.subs
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
exit 0
 | 
			
		||||
EOF
 | 
			
		||||
chmod +x $CONFIG_STATUS
 | 
			
		||||
rm -fr confdefs* $ac_clean_files
 | 
			
		||||
test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										34
									
								
								libgloss/hp74x/configure.in
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								libgloss/hp74x/configure.in
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,34 @@
 | 
			
		||||
dnl Process this file with autoconf to produce a configure script.
 | 
			
		||||
AC_PREREQ(2.5)dnl
 | 
			
		||||
AC_INIT(crt0.s)
 | 
			
		||||
 | 
			
		||||
if test "$srcdir" = "." ; then
 | 
			
		||||
  mdir=`echo "${with_multisubdir}/" \
 | 
			
		||||
    | sed -e 's,\([[^/]][[^/]]*\),..,g' -e 's,^/$,,'`
 | 
			
		||||
  AC_CONFIG_AUX_DIR(${mdir}../../..)
 | 
			
		||||
else
 | 
			
		||||
  AC_CONFIG_AUX_DIR(${srcdir}/../..)
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
AC_PROG_INSTALL
 | 
			
		||||
 | 
			
		||||
AC_PROG_CC
 | 
			
		||||
AS=${AS-as}
 | 
			
		||||
AC_SUBST(AS)
 | 
			
		||||
AR=${AR-ar}
 | 
			
		||||
AC_SUBST(AR)
 | 
			
		||||
LD=${LD-ld}
 | 
			
		||||
AC_SUBST(LD)
 | 
			
		||||
AC_PROG_RANLIB
 | 
			
		||||
 | 
			
		||||
host_makefile_frag=${srcdir}/../config/default.mh
 | 
			
		||||
 | 
			
		||||
dnl We have to assign the same value to other variables because autoconf
 | 
			
		||||
dnl doesn't provide a mechanism to substitute a replacement keyword with
 | 
			
		||||
dnl arbitrary data or pathnames.
 | 
			
		||||
dnl
 | 
			
		||||
host_makefile_frag_path=$host_makefile_frag
 | 
			
		||||
AC_SUBST(host_makefile_frag_path)
 | 
			
		||||
AC_SUBST_FILE(host_makefile_frag)
 | 
			
		||||
 | 
			
		||||
AC_OUTPUT(Makefile)
 | 
			
		||||
							
								
								
									
										177
									
								
								libgloss/hp74x/crt0.s
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										177
									
								
								libgloss/hp74x/crt0.s
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,177 @@
 | 
			
		||||
/*
 | 
			
		||||
 * crt0.S -- startup file for hppa.
 | 
			
		||||
 * 		rob@cygnus.com (Rob Savoye)
 | 
			
		||||
 */
 | 
			
		||||
	.VERSION "0.2"
 | 
			
		||||
	.COPYRIGHT "crt0.S for hppa"
 | 
			
		||||
 | 
			
		||||
;sp      .equ    %r30     		; stack pointer
 | 
			
		||||
;dp      .equ    %r27     		; global data pointer
 | 
			
		||||
;arg0    .equ    %r26     		; argument
 | 
			
		||||
;arg1    .equ    %r25     		; argument or high part of double argument
 | 
			
		||||
;arg2    .equ    %r24     		; argument
 | 
			
		||||
;arg3    .equ    %r23     		; argument or high part of double argument
 | 
			
		||||
 | 
			
		||||
#define         IMM(a,b)        ldil L%a,b  ! ldo  R%a(b),b
 | 
			
		||||
#define         imm(i,t)        ldil LS%i,t ! addi RS%i,t,t
 | 
			
		||||
 | 
			
		||||
	.DATA
 | 
			
		||||
 | 
			
		||||
/****
 | 
			
		||||
 * FIXME: these are just a gross hack so this will assemble
 | 
			
		||||
 ****/
 | 
			
		||||
_bss_start	.WORD
 | 
			
		||||
_bss_end	.WORD
 | 
			
		||||
_foobar	
 | 
			
		||||
		.STRINGZ "Foo Bar...\r\n"
 | 
			
		||||
 | 
			
		||||
;;_SYSTEM_ID	.WORD
 | 
			
		||||
;;		.EXPORT _SYSTEM_ID	; FIXME this is only so it'll
 | 
			
		||||
					; link
 | 
			
		||||
	
 | 
			
		||||
/* 
 | 
			
		||||
 * Set up the standard spaces (sections) These definitions come
 | 
			
		||||
 * from /lib/pcc_prefix.s.
 | 
			
		||||
 */
 | 
			
		||||
	.space  $TEXT$,0
 | 
			
		||||
	
 | 
			
		||||
        .SUBSPA $BOOT$,QUAD=0,ALIGN=8,ACCESS=0x2c,SORT=4
 | 
			
		||||
        .IMPORT _start
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * stuff we need that's defined elsewhere.
 | 
			
		||||
 */
 | 
			
		||||
	.IMPORT main, CODE
 | 
			
		||||
	.IMPORT _bss_start, DATA
 | 
			
		||||
	.IMPORT _bss_end, DATA
 | 
			
		||||
	.IMPORT environ, DATA
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * start -- set things up so the application will run.
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
        .PROC
 | 
			
		||||
        .CALLINFO SAVE_SP, FRAME=48
 | 
			
		||||
        .EXPORT $START$,ENTRY
 | 
			
		||||
$START$
 | 
			
		||||
 | 
			
		||||
	/* FIXME: this writes to page zero */
 | 
			
		||||
	;; setup the %30 (stack pointer) with some memory
 | 
			
		||||
	ldil 	L%_stack+48,%r30
 | 
			
		||||
        ldo 	R%_stack+48(%r30),%r30		; should be %r30 (sp) but then
 | 
			
		||||
						; we'd kill our test program :-)
 | 
			
		||||
	;; we need to set %r27 (global data pointer) here too 
 | 
			
		||||
	ldil 	L%$global$,%r27
 | 
			
		||||
        ldo 	R%$global$(%r27),%r27		; same problem as above
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * zerobss -- zero out the bss section
 | 
			
		||||
 */
 | 
			
		||||
	; load the start of bss
 | 
			
		||||
	ldil 	L%_bss_start,%r4
 | 
			
		||||
        ldo 	R%_bss_start(%r4),%r4
 | 
			
		||||
 | 
			
		||||
	;  load the end of bss
 | 
			
		||||
	ldil 	L%_bss_end,%r5
 | 
			
		||||
        ldo 	R%_bss_end(%r5),%r5
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
bssloop
 | 
			
		||||
	addi	-1,%r5,%r5			; decrement _bss_end
 | 
			
		||||
	stb	%r0,0(0,%r5)			; we do this by bytes for now even
 | 
			
		||||
						; though it's slower, it's safer
 | 
			
		||||
	combf,=	%r4,%r5, bssloop	
 | 
			
		||||
	nop
 | 
			
		||||
	
 | 
			
		||||
	ldi	1,%ret0
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Call the main routine from the application to get it going.
 | 
			
		||||
 * main (argc, argv, environ)
 | 
			
		||||
 * We pass argv as a pointer to NULL.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
	bl	main,%r2
 | 
			
		||||
	nop
 | 
			
		||||
 | 
			
		||||
        .PROCEND
 | 
			
		||||
/*
 | 
			
		||||
 * _exit -- Exit from the application. Normally we cause a user trap
 | 
			
		||||
 * 	    to return to the ROM monitor for another run, but with
 | 
			
		||||
 *	    this monitor we can't. Still, "C" wants this symbol, it
 | 
			
		||||
 *	    should be here. Jumping to 0xF0000004 jumps back into the
 | 
			
		||||
 *	    firmware, while writing a 5 to 0xFFFE0030 causes a reset.
 | 
			
		||||
 */
 | 
			
		||||
	.EXPORT _exit, ENTRY
 | 
			
		||||
_exit
 | 
			
		||||
	.PROC
 | 
			
		||||
	.CALLINFO
 | 
			
		||||
	.ENTRY
 | 
			
		||||
;;	ldil	L%0xf0000004,%r1
 | 
			
		||||
;;	bl	%r1, %r2
 | 
			
		||||
	
 | 
			
		||||
	ldil 	L'4026531844,%r19
 | 
			
		||||
        ldo 	R'4026531844(%r19),%r19
 | 
			
		||||
	blr	%r19, %r2
 | 
			
		||||
	nop
 | 
			
		||||
	
 | 
			
		||||
	;; This just causes a breakpoint exception
 | 
			
		||||
;;	break	0x0e,0xa5a
 | 
			
		||||
;;      bv,n    (%rp)
 | 
			
		||||
	nop
 | 
			
		||||
	.EXIT
 | 
			
		||||
	.PROCEND
 | 
			
		||||
 | 
			
		||||
        .subspa $UNWIND_START$,QUAD=0,ALIGN=8,ACCESS=0x2c,SORT=56
 | 
			
		||||
        .export $UNWIND_START
 | 
			
		||||
$UNWIND_START
 | 
			
		||||
        .subspa $UNWIND$,QUAD=0,ALIGN=8,ACCESS=0x2c,SORT=64
 | 
			
		||||
        .subspa $UNWIND_END$,QUAD=0,ALIGN=8,ACCESS=0x2c,SORT=72
 | 
			
		||||
        .export $UNWIND_END
 | 
			
		||||
$UNWIND_END
 | 
			
		||||
        .subspa $RECOVER_START$,QUAD=0,ALIGN=4,ACCESS=0x2c,SORT=73
 | 
			
		||||
        .export $RECOVER_START
 | 
			
		||||
$RECOVER_START
 | 
			
		||||
        .subspa $RECOVER$,QUAD=0,ALIGN=4,ACCESS=0x2c,SORT=80
 | 
			
		||||
        .subspa $RECOVER_END$,QUAD=0,ALIGN=4,ACCESS=0x2c,SORT=88
 | 
			
		||||
        .export $RECOVER_END
 | 
			
		||||
$RECOVER_END
 | 
			
		||||
 | 
			
		||||
; The following declarations are, by default in the data space ($PRIVATE$)
 | 
			
		||||
 | 
			
		||||
;;        .space  $PRIVATE$,1
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Here we set up the standard date sub spaces.
 | 
			
		||||
 * _dp is for the WinBond board.
 | 
			
		||||
 *
 | 
			
		||||
 * Set up some room for a stack. We just grab a chunk of memory.
 | 
			
		||||
 * We also setup some space for the global variable space, which
 | 
			
		||||
 * must be done using the reserved name "$global$" so "C" code
 | 
			
		||||
 * can find it. The stack grows towards the higher addresses.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
        .subspa $DATA$,QUAD=1,ALIGN=8,ACCESS=0x1f,SORT=16
 | 
			
		||||
        .subspa $SHORTDATA$,QUAD=1,ALIGN=8,ACCESS=0x1f,SORT=24
 | 
			
		||||
        .subspa $GLOBAL$,QUAD=1,ALIGN=8,ACCESS=0x1f,SORT=40
 | 
			
		||||
        .export $global$
 | 
			
		||||
        .export _dp
 | 
			
		||||
$global$
 | 
			
		||||
_dp
 | 
			
		||||
        .subspa $SHORTBSS$,QUAD=1,ALIGN=8,ACCESS=0x1f,SORT=80,ZERO
 | 
			
		||||
        .subspa $BSS$,QUAD=1,ALIGN=8,ACCESS=0x1f,SORT=82,ZERO
 | 
			
		||||
 | 
			
		||||
       .subspa $STACK$,QUAD=1,ALIGN=8,ACCESS=0x1f,SORT=88,ZERO
 | 
			
		||||
        .export _stack
 | 
			
		||||
_stack
 | 
			
		||||
        .BLOCK          0x2000
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * The heap follows the stack. To use dynamic memory routines in an
 | 
			
		||||
 * application, some space MUST be assigned to the stack.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
        .subspa $HEAP$,QUAD=1,ALIGN=8,ACCESS=0x1f,SORT=96,ZERO
 | 
			
		||||
        .export _heap
 | 
			
		||||
_heap
 | 
			
		||||
        .end
 | 
			
		||||
							
								
								
									
										127
									
								
								libgloss/hp74x/debugger.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										127
									
								
								libgloss/hp74x/debugger.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,127 @@
 | 
			
		||||
/****************************************************************************
 | 
			
		||||
 | 
			
		||||
		THIS SOFTWARE IS NOT COPYRIGHTED
 | 
			
		||||
 | 
			
		||||
   HP offers the following for use in the public domain.  HP makes no
 | 
			
		||||
   warranty with regard to the software or it's performance and the
 | 
			
		||||
   user accepts the software "AS IS" with all faults.
 | 
			
		||||
 | 
			
		||||
   HP DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED, WITH REGARD
 | 
			
		||||
   TO THIS SOFTWARE INCLUDING BUT NOT LIMITED TO THE WARRANTIES
 | 
			
		||||
   OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 | 
			
		||||
 | 
			
		||||
****************************************************************************/
 | 
			
		||||
 | 
			
		||||
	/* Debugger register array offets */
 | 
			
		||||
 | 
			
		||||
#define	R_gr0		 0
 | 
			
		||||
#define	R_gr1		 4
 | 
			
		||||
#define	R_gr2		 8
 | 
			
		||||
#define	R_gr3		12
 | 
			
		||||
#define	R_gr4		16
 | 
			
		||||
#define	R_gr5		20
 | 
			
		||||
#define	R_gr6		24
 | 
			
		||||
#define	R_gr7		28
 | 
			
		||||
#define	R_gr8		32
 | 
			
		||||
#define	R_gr9		36
 | 
			
		||||
#define	R_gr10		40
 | 
			
		||||
#define	R_gr11		44
 | 
			
		||||
#define	R_gr12		48
 | 
			
		||||
#define	R_gr13		52
 | 
			
		||||
#define	R_gr14		56
 | 
			
		||||
#define	R_gr15		60
 | 
			
		||||
#define	R_gr16		64
 | 
			
		||||
#define	R_gr17		68
 | 
			
		||||
#define	R_gr18		72
 | 
			
		||||
#define	R_gr19		76
 | 
			
		||||
#define	R_gr20		80
 | 
			
		||||
#define	R_gr21		84
 | 
			
		||||
#define	R_gr22		88
 | 
			
		||||
#define	R_gr23		92
 | 
			
		||||
#define	R_gr24		96
 | 
			
		||||
#define	R_gr25		100
 | 
			
		||||
#define	R_gr26		104
 | 
			
		||||
#define	R_gr27		108
 | 
			
		||||
#define	R_gr28		112
 | 
			
		||||
#define	R_gr29		116
 | 
			
		||||
#define	R_gr30		120
 | 
			
		||||
#define	R_gr31		124
 | 
			
		||||
 | 
			
		||||
#define	R_sr0		128
 | 
			
		||||
#define	R_sr1		132
 | 
			
		||||
#define	R_sr2		136
 | 
			
		||||
#define	R_sr3		140
 | 
			
		||||
#define	R_sr4		144
 | 
			
		||||
#define	R_sr5		148
 | 
			
		||||
#define	R_sr6		152
 | 
			
		||||
#define	R_sr7		156
 | 
			
		||||
 | 
			
		||||
#define	R_cr0		160
 | 
			
		||||
#define	R_cr1		164
 | 
			
		||||
#define	R_cr2		168
 | 
			
		||||
#define	R_cr3		172
 | 
			
		||||
#define	R_cr4		176
 | 
			
		||||
#define	R_cr5		180
 | 
			
		||||
#define	R_cr6		184
 | 
			
		||||
#define	R_cr7		188
 | 
			
		||||
#define	R_cr8		192
 | 
			
		||||
#define	R_cr9		196
 | 
			
		||||
#define	R_cr10		200
 | 
			
		||||
#define	R_cr11		204
 | 
			
		||||
#define	R_cr12		208
 | 
			
		||||
#define	R_cr13		212
 | 
			
		||||
#define	R_cr14		216
 | 
			
		||||
#define	R_cr15		220
 | 
			
		||||
#define	R_cr16		224
 | 
			
		||||
#define	R_cr17H		228
 | 
			
		||||
#define	R_cr18H		232
 | 
			
		||||
#define	R_cr19		236
 | 
			
		||||
#define	R_cr20		240
 | 
			
		||||
#define	R_cr21		244
 | 
			
		||||
#define	R_cr22		248
 | 
			
		||||
#define	R_cr23		252
 | 
			
		||||
#define	R_cr24		256
 | 
			
		||||
#define	R_cr25		260
 | 
			
		||||
#define	R_cr26		264
 | 
			
		||||
#define	R_cr27		268
 | 
			
		||||
#define	R_cr28		272
 | 
			
		||||
#define	R_cr29		276
 | 
			
		||||
#define	R_cr30		280
 | 
			
		||||
#define	R_cr31		284
 | 
			
		||||
 | 
			
		||||
#define	R_cr17T		288
 | 
			
		||||
#define	R_cr18T		292
 | 
			
		||||
 | 
			
		||||
#define	R_cpu0		296
 | 
			
		||||
 | 
			
		||||
#define R_SIZE          300
 | 
			
		||||
 | 
			
		||||
#define min_stack       64
 | 
			
		||||
 | 
			
		||||
; -----------------------------------------------------------
 | 
			
		||||
; ------ ASCII control codes
 | 
			
		||||
; -----------------------------------------------------------
 | 
			
		||||
 | 
			
		||||
#define	NULL	0x00	/* <break>	soft-reset	(input only) */
 | 
			
		||||
#define	DELP	0x03	/* <ctrl>C	del-collapse	(input only, non-std) */
 | 
			
		||||
#define	DELE	0x04	/* <ctrl>D	del-to_eol	(input only, non-std) */
 | 
			
		||||
#define	BELL	0x07	/* <ctrl>G	bell - audio */
 | 
			
		||||
#define	BS	0x08	/* <ctrl>H	back space	(left arrow) */
 | 
			
		||||
#define	HT	0x09	/* <ctrl>I	horizontal tab */
 | 
			
		||||
#define	LF	0x0a	/* <ctrl>J	line feed	(down arrow) */
 | 
			
		||||
#define	VT	0x0b	/* <ctrl>K	vertical tab	(up arrow) */
 | 
			
		||||
#define	FF	0x0c	/* <ctrl>L	form feed	(right arrow) */
 | 
			
		||||
#define	RTN	0x0d	/* <ctrl>M	carrage return */
 | 
			
		||||
#define	CR	0x0d	/* <ctrl>M	carrage return */
 | 
			
		||||
#define	INSC	0x0e	/* <ctrl>N	insert char	(input only, non-std) */
 | 
			
		||||
#define	XON	0x11	/* <ctrl>Q	DC1 - continue */
 | 
			
		||||
#define	BT	0x12	/* <ctrl>R	reverse tab	(input only, non-std) */
 | 
			
		||||
#define	XOFF	0x13	/* <ctrl>S	DC3 - wait */
 | 
			
		||||
#define	INSE	0x16	/* <ctrl>V	insert-expand	(input only, non-std) */
 | 
			
		||||
#define	DELC	0x18	/* <ctrl>X	delete char	(input only, non-std) */
 | 
			
		||||
#define	CLRH	0x1a	/* <ctrl>Z	clear/home	(input only) */
 | 
			
		||||
#define	ESC	0x1b	/* <ctrl>[	escape		(must call key again) */
 | 
			
		||||
#define	ENDL	0x1c	/* <ctrl>\	cursor-to-eol	(input only, non-std) */
 | 
			
		||||
#define	HOME	0x1e	/* <ctrl>^	cursor home	(input only) */
 | 
			
		||||
#define	DEL	0x7f	/* <shift>BS	destructive backspace */
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										585
									
								
								libgloss/hp74x/debugger.s
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										585
									
								
								libgloss/hp74x/debugger.s
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,585 @@
 | 
			
		||||
/****************************************************************************
 | 
			
		||||
 | 
			
		||||
		THIS SOFTWARE IS NOT COPYRIGHTED
 | 
			
		||||
 | 
			
		||||
   HP offers the following for use in the public domain.  HP makes no
 | 
			
		||||
   warranty with regard to the software or it's performance and the
 | 
			
		||||
   user accepts the software "AS IS" with all faults.
 | 
			
		||||
 | 
			
		||||
   HP DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED, WITH REGARD
 | 
			
		||||
   TO THIS SOFTWARE INCLUDING BUT NOT LIMITED TO THE WARRANTIES
 | 
			
		||||
   OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 | 
			
		||||
 | 
			
		||||
****************************************************************************/
 | 
			
		||||
	.space	$TEXT$
 | 
			
		||||
	.subspa	$CODE$,access=0x2c
 | 
			
		||||
 | 
			
		||||
#if 1
 | 
			
		||||
#include	"diagnose.h"
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
i13BREAK	.equ    0xa5a			; im13 field for specified functions
 | 
			
		||||
i5REG		.equ	0x06			; Init registers
 | 
			
		||||
i5BP		.equ	0x09			; GDB breakpoin
 | 
			
		||||
i5PSW		.equ	0x0b			; Get PSW
 | 
			
		||||
i5INLINE	.equ	0x0e			; Get INLINE
 | 
			
		||||
R_gr0		.equ	 0
 | 
			
		||||
R_gr1		.equ	 4
 | 
			
		||||
R_gr2		.equ	 8
 | 
			
		||||
R_gr3		.equ	12
 | 
			
		||||
R_gr4		.equ	16
 | 
			
		||||
R_gr5		.equ	20
 | 
			
		||||
R_gr6		.equ	24
 | 
			
		||||
R_gr7		.equ	28
 | 
			
		||||
R_gr8		.equ	32
 | 
			
		||||
R_gr9		.equ	36
 | 
			
		||||
R_gr10		.equ	40
 | 
			
		||||
R_gr11		.equ	44
 | 
			
		||||
R_gr12		.equ	48
 | 
			
		||||
R_gr13		.equ	52
 | 
			
		||||
R_gr14		.equ	56
 | 
			
		||||
R_gr15		.equ	60
 | 
			
		||||
R_gr16		.equ	64
 | 
			
		||||
R_gr17		.equ	68
 | 
			
		||||
R_gr18		.equ	72
 | 
			
		||||
R_gr19		.equ	76
 | 
			
		||||
R_gr20		.equ	80
 | 
			
		||||
R_gr21		.equ	84
 | 
			
		||||
R_gr22		.equ	88
 | 
			
		||||
R_gr23		.equ	92
 | 
			
		||||
R_gr24		.equ	96
 | 
			
		||||
R_gr25		.equ	100
 | 
			
		||||
R_gr26		.equ	104
 | 
			
		||||
R_gr27		.equ	108
 | 
			
		||||
R_gr28		.equ	112
 | 
			
		||||
R_gr29		.equ	116
 | 
			
		||||
R_gr30		.equ	120
 | 
			
		||||
R_gr31		.equ	124
 | 
			
		||||
 | 
			
		||||
R_sr0		.equ	128
 | 
			
		||||
R_sr1		.equ	132
 | 
			
		||||
R_sr2		.equ	136
 | 
			
		||||
R_sr3		.equ	140
 | 
			
		||||
R_sr4		.equ	144
 | 
			
		||||
R_sr5		.equ	148
 | 
			
		||||
R_sr6		.equ	152
 | 
			
		||||
R_sr7		.equ	156
 | 
			
		||||
 | 
			
		||||
R_cr0		.equ	160
 | 
			
		||||
R_cr1		.equ	164
 | 
			
		||||
R_cr2		.equ	168
 | 
			
		||||
R_cr3		.equ	172
 | 
			
		||||
R_cr4		.equ	176
 | 
			
		||||
R_cr5		.equ	180
 | 
			
		||||
R_cr6		.equ	184
 | 
			
		||||
R_cr7		.equ	188
 | 
			
		||||
R_cr8		.equ	192
 | 
			
		||||
R_cr9		.equ	196
 | 
			
		||||
R_cr10		.equ	200
 | 
			
		||||
R_cr11		.equ	204
 | 
			
		||||
R_cr12		.equ	208
 | 
			
		||||
R_cr13		.equ	212
 | 
			
		||||
R_cr14		.equ	216
 | 
			
		||||
R_cr15		.equ	220
 | 
			
		||||
R_cr16		.equ	224
 | 
			
		||||
R_cr17H		.equ	228
 | 
			
		||||
R_cr18H		.equ	232
 | 
			
		||||
R_cr19		.equ	236
 | 
			
		||||
R_cr20		.equ	240
 | 
			
		||||
R_cr21		.equ	244
 | 
			
		||||
R_cr22		.equ	248
 | 
			
		||||
R_cr23		.equ	252
 | 
			
		||||
R_cr24		.equ	256
 | 
			
		||||
R_cr25		.equ	260
 | 
			
		||||
R_cr26		.equ	264
 | 
			
		||||
R_cr27		.equ	268
 | 
			
		||||
R_cr28		.equ	272
 | 
			
		||||
R_cr29		.equ	276
 | 
			
		||||
R_cr30		.equ	280
 | 
			
		||||
R_cr31		.equ	284
 | 
			
		||||
 | 
			
		||||
R_cr17T		.equ	288
 | 
			
		||||
R_cr18T		.equ	292
 | 
			
		||||
 | 
			
		||||
R_cpu0		.equ	296
 | 
			
		||||
 | 
			
		||||
R_SIZE          .equ	300
 | 
			
		||||
 | 
			
		||||
min_stack	.equ     64
 | 
			
		||||
 | 
			
		||||
	.import	handle_exception
 | 
			
		||||
	.import $global$, data
 | 
			
		||||
	.IMPORT putnum, code
 | 
			
		||||
	.IMPORT led_putnum, code
 | 
			
		||||
	.IMPORT delay, code
 | 
			
		||||
 | 
			
		||||
        .export FICE
 | 
			
		||||
	.export	DEBUG_GO
 | 
			
		||||
	.export	DEBUG_SS
 | 
			
		||||
	.export	STUB_RESTORE
 | 
			
		||||
 | 
			
		||||
	.export	save_regs
 | 
			
		||||
	.export	RegBlk
 | 
			
		||||
	.export Exception_index
 | 
			
		||||
 | 
			
		||||
;-------------------------------------------------------------------------------
 | 
			
		||||
        .EXPORT breakpoint,ENTRY,ARGW0=GR,RTNVAL=GR
 | 
			
		||||
breakpoint
 | 
			
		||||
	.PROC
 | 
			
		||||
	.CALLINFO CALLER,FRAME=128,SAVE_RP
 | 
			
		||||
	.ENTRY
 | 
			
		||||
 | 
			
		||||
	stw     %r2,-20(0,%r30)			; stash the return pointer
 | 
			
		||||
	ldo	128(%r30),%r30			; push up the stack pointer
 | 
			
		||||
 | 
			
		||||
;;; debug
 | 
			
		||||
	ldi	6, %r26
 | 
			
		||||
	bl,n	led_putnum,%r2
 | 
			
		||||
	nop
 | 
			
		||||
        ldil 	L'900000,%r26
 | 
			
		||||
        ldo 	R'900000(%r26),%r26
 | 
			
		||||
	bl,n	delay,%r2
 | 
			
		||||
	nop
 | 
			
		||||
;;; 
 | 
			
		||||
	break   i5INLINE,i13BREAK
 | 
			
		||||
;;; more debug
 | 
			
		||||
	ldi	7, %r26
 | 
			
		||||
	bl,n	led_putnum,%r2
 | 
			
		||||
	nop
 | 
			
		||||
        ldil 	L'900000,%r26
 | 
			
		||||
        ldo 	R'900000(%r26),%r26
 | 
			
		||||
	bl,n	delay,%r2
 | 
			
		||||
	nop
 | 
			
		||||
;;; 
 | 
			
		||||
	
 | 
			
		||||
FICE	fice	0(0,%r26)			; Flush the i cache entry
 | 
			
		||||
	sync
 | 
			
		||||
 | 
			
		||||
	ldw 	-148(0,%r30),%r2		; retrieve the return pointer
 | 
			
		||||
	ldo 	-128(%r30),%r30			; reset the stack pointer
 | 
			
		||||
	bv,n    0(%r2)				; return to caller
 | 
			
		||||
	nop
 | 
			
		||||
 | 
			
		||||
	.EXIT
 | 
			
		||||
	.PROCEND
 | 
			
		||||
 | 
			
		||||
;-------------------------------------------------------------------------------
 | 
			
		||||
DEBUG_GO
 | 
			
		||||
	or,tr	%r0,%r0,%r10	; if go, do not set R-bit to 1
 | 
			
		||||
 | 
			
		||||
DEBUG_SS
 | 
			
		||||
	ldi	1,%r10		; else set R-bit to 1
 | 
			
		||||
 | 
			
		||||
DEBUG_EXEC
 | 
			
		||||
 | 
			
		||||
	bl	DGO_0,%r8			; r8 points to register block
 | 
			
		||||
	addil	L%RegBlk-DGO_0,%r8
 | 
			
		||||
DGO_0
 | 
			
		||||
	ldo	R%RegBlk-DGO_0(%r1),%r8
 | 
			
		||||
 | 
			
		||||
; load space registers
 | 
			
		||||
 | 
			
		||||
	ldw	R_sr0(%r8),%r1
 | 
			
		||||
	mtsp	%r1,%sr0
 | 
			
		||||
	ldw	R_sr1(%r8),%r1
 | 
			
		||||
	mtsp	%r1,%sr1
 | 
			
		||||
	ldw	R_sr2(%r8),%r1
 | 
			
		||||
	mtsp	%r1,%sr2
 | 
			
		||||
	ldw	R_sr3(%r8),%r1
 | 
			
		||||
	mtsp	%r1,%sr3
 | 
			
		||||
	ldw	R_sr4(%r8),%r1
 | 
			
		||||
	mtsp	%r1,%sr4
 | 
			
		||||
	ldw	R_sr5(%r8),%r1
 | 
			
		||||
	mtsp	%r1,%sr5
 | 
			
		||||
	ldw	R_sr6(%r8),%r1
 | 
			
		||||
	mtsp	%r1,%sr6
 | 
			
		||||
	ldw	R_sr7(%r8),%r1
 | 
			
		||||
	mtsp	%r1,%sr7
 | 
			
		||||
 | 
			
		||||
; clear Q-bit for rfi
 | 
			
		||||
 | 
			
		||||
	rsm	0x08,%r0
 | 
			
		||||
 | 
			
		||||
; load control registers
 | 
			
		||||
 | 
			
		||||
	ldw	R_cr0(%r8),%r1
 | 
			
		||||
	or,=	%r10,%r0,%r0		; if single step
 | 
			
		||||
	copy	%r0,%r1			;   set %cr0 to 0
 | 
			
		||||
	mtctl	%r1,%cr0
 | 
			
		||||
	ldw	R_cr8(%r8),%r1
 | 
			
		||||
	mtctl	%r1,%cr8
 | 
			
		||||
	ldw	R_cr9(%r8),%r1
 | 
			
		||||
	mtctl	%r1,%cr9
 | 
			
		||||
	ldw	R_cr10(%r8),%r1
 | 
			
		||||
	mtctl	%r1,%cr10
 | 
			
		||||
	ldw	R_cr11(%r8),%r1
 | 
			
		||||
	mtctl	%r1,%cr11
 | 
			
		||||
	ldw	R_cr12(%r8),%r1
 | 
			
		||||
	mtctl	%r1,%cr12
 | 
			
		||||
	ldw	R_cr13(%r8),%r1
 | 
			
		||||
	mtctl	%r1,%cr13
 | 
			
		||||
	ldw	R_cr14(%r8),%r1
 | 
			
		||||
	mtctl	%r1,%cr14
 | 
			
		||||
	ldw	R_cr15(%r8),%r1
 | 
			
		||||
	mtctl	%r1,%cr15
 | 
			
		||||
	ldw	R_cr16(%r8),%r1
 | 
			
		||||
	mtctl	%r1,%cr16
 | 
			
		||||
	ldw	R_cr17H(%r8),%r1	; load iiasq.head
 | 
			
		||||
	mtctl	%r1,%cr17
 | 
			
		||||
	ldw	R_cr18H(%r8),%r1	; load iiaoq.head
 | 
			
		||||
	mtctl	%r1,%cr18
 | 
			
		||||
	ldw	R_cr17T(%r8),%r1	; load iiasq.tail
 | 
			
		||||
	mtctl	%r1,%cr17
 | 
			
		||||
	ldw	R_cr18T(%r8),%r1	; load iiaoq.tail
 | 
			
		||||
	mtctl	%r1,%cr18
 | 
			
		||||
	ldw	R_cr19(%r8),%r1
 | 
			
		||||
	mtctl	%r1,%cr19
 | 
			
		||||
	ldw	R_cr20(%r8),%r1
 | 
			
		||||
	mtctl	%r1,%cr20
 | 
			
		||||
	ldw	R_cr21(%r8),%r1
 | 
			
		||||
	mtctl	%r1,%cr21
 | 
			
		||||
	ldw	R_cr22(%r8),%r1
 | 
			
		||||
	dep	%r10,27,1,%r1		; set R-bit if applicable
 | 
			
		||||
	mtctl	%r1,%cr22
 | 
			
		||||
	ldw	R_cr23(%r8),%r1
 | 
			
		||||
	mtctl	%r1,%cr23
 | 
			
		||||
	ldw	R_cr24(%r8),%r1
 | 
			
		||||
	mtctl	%r1,%cr24
 | 
			
		||||
	ldw	R_cr25(%r8),%r1
 | 
			
		||||
	mtctl	%r1,%cr25
 | 
			
		||||
	ldw	R_cr26(%r8),%r1
 | 
			
		||||
	mtctl	%r1,%cr26
 | 
			
		||||
	ldw	R_cr27(%r8),%r1
 | 
			
		||||
	mtctl	%r1,%cr27
 | 
			
		||||
	ldw	R_cr28(%r8),%r1
 | 
			
		||||
	mtctl	%r1,%cr28
 | 
			
		||||
	ldw	R_cr29(%r8),%r1
 | 
			
		||||
	mtctl	%r1,%cr29
 | 
			
		||||
	ldw	R_cr30(%r8),%r1
 | 
			
		||||
	mtctl	%r1,%cr30
 | 
			
		||||
	ldw	R_cr31(%r8),%r1
 | 
			
		||||
	mtctl	%r1,%cr31
 | 
			
		||||
 | 
			
		||||
; load diagnose registers
 | 
			
		||||
 | 
			
		||||
	ldw	R_cpu0(%r8),%r1
 | 
			
		||||
	ldil	L%CPU0_MASK,%r2
 | 
			
		||||
	ldo	R%CPU0_MASK(%r2),%r2
 | 
			
		||||
	xor	%r1,%r2,%r1		; xor the read/clear bits
 | 
			
		||||
	nop
 | 
			
		||||
	mtcpu	%r1,0
 | 
			
		||||
	mtcpu	%r1,0
 | 
			
		||||
 | 
			
		||||
; load general registers
 | 
			
		||||
 | 
			
		||||
	ldw	R_gr1(%r8),%r1
 | 
			
		||||
	ldw	R_gr2(%r8),%r2
 | 
			
		||||
	ldw	R_gr3(%r8),%r3
 | 
			
		||||
	ldw	R_gr4(%r8),%r4
 | 
			
		||||
	ldw	R_gr5(%r8),%r5
 | 
			
		||||
	ldw	R_gr6(%r8),%r6
 | 
			
		||||
	ldw	R_gr7(%r8),%r7
 | 
			
		||||
	ldw	R_gr9(%r8),%r9
 | 
			
		||||
	ldw	R_gr10(%r8),%r10
 | 
			
		||||
	ldw	R_gr11(%r8),%r11
 | 
			
		||||
	ldw	R_gr12(%r8),%r12
 | 
			
		||||
	ldw	R_gr13(%r8),%r13
 | 
			
		||||
	ldw	R_gr14(%r8),%r14
 | 
			
		||||
	ldw	R_gr15(%r8),%r15
 | 
			
		||||
	ldw	R_gr16(%r8),%r16
 | 
			
		||||
	ldw	R_gr17(%r8),%r17
 | 
			
		||||
	ldw	R_gr18(%r8),%r18
 | 
			
		||||
	ldw	R_gr19(%r8),%r19
 | 
			
		||||
	ldw	R_gr20(%r8),%r20
 | 
			
		||||
	ldw	R_gr21(%r8),%r21
 | 
			
		||||
	ldw	R_gr22(%r8),%r22
 | 
			
		||||
	ldw	R_gr23(%r8),%r23
 | 
			
		||||
	ldw	R_gr24(%r8),%r24
 | 
			
		||||
	ldw	R_gr25(%r8),%r25
 | 
			
		||||
	ldw	R_gr26(%r8),%r26
 | 
			
		||||
	ldw	R_gr27(%r8),%r27
 | 
			
		||||
	ldw	R_gr28(%r8),%r28
 | 
			
		||||
	ldw	R_gr29(%r8),%r29
 | 
			
		||||
	ldw	R_gr30(%r8),%r30
 | 
			
		||||
	ldw	R_gr31(%r8),%r31
 | 
			
		||||
	ldw	R_gr8(%r8),%r8
 | 
			
		||||
 | 
			
		||||
; execute user program
 | 
			
		||||
 | 
			
		||||
	nop
 | 
			
		||||
	rfi		; switch to user code
 | 
			
		||||
	nop
 | 
			
		||||
 | 
			
		||||
;-------------------------------------------------------------------------------
 | 
			
		||||
 | 
			
		||||
STUB_RESTORE
 | 
			
		||||
	copy	%r1,%r9	; save exception index
 | 
			
		||||
	bl	SR_00,%r8
 | 
			
		||||
	addil	L%Exception_index-SR_00,%r8
 | 
			
		||||
SR_00
 | 
			
		||||
	ldo	R%Exception_index-SR_00(%r1),%r8
 | 
			
		||||
	stw	%r9,(%r8)
 | 
			
		||||
 | 
			
		||||
	bl	save_regs,%r25
 | 
			
		||||
	nop
 | 
			
		||||
	
 | 
			
		||||
#ifdef	DEBUG_DEBUGGER1
 | 
			
		||||
	stwm	%r1,8(%sp)
 | 
			
		||||
	bl	putc,%rp
 | 
			
		||||
	ldi	CR,%arg0
 | 
			
		||||
	bl	putc,%rp
 | 
			
		||||
	ldi	LF,%arg0
 | 
			
		||||
	bl	printit,%mrp
 | 
			
		||||
	mfctl	%pcoq,%arg0
 | 
			
		||||
 | 
			
		||||
	mfctl	%pcoq,%r1
 | 
			
		||||
	mtctl	%r1,%pcoq
 | 
			
		||||
	mfctl	%pcoq,%arg0
 | 
			
		||||
	bl	printit,%mrp
 | 
			
		||||
	mtctl	%arg0,%pcoq
 | 
			
		||||
 | 
			
		||||
	bl	printit,%mrp
 | 
			
		||||
	ldw	-8(%sp),%arg0
 | 
			
		||||
 | 
			
		||||
	ldwm	-8(%sp),%r1
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifdef	DEBUG_DEBUGGER2
 | 
			
		||||
	stwm	%r1,8(%sp)
 | 
			
		||||
	bl	putc,%rp
 | 
			
		||||
	ldi	LF,%arg0
 | 
			
		||||
	ldwm	-8(%sp),%r1
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifdef	DEBUG_DEBUGGER3
 | 
			
		||||
	bl	printit,%mrp
 | 
			
		||||
	copy	iptr,%arg0
 | 
			
		||||
	bl	printit,%mrp
 | 
			
		||||
	copy	rstack,%arg0
 | 
			
		||||
	bl	printit,%mrp
 | 
			
		||||
	copy	gspace,%arg0
 | 
			
		||||
	bl	printit,%mrp
 | 
			
		||||
	copy	dstack,%arg0
 | 
			
		||||
	bl	printit,%mrp
 | 
			
		||||
	copy	nextptr,%arg0
 | 
			
		||||
	bl	printit,%mrp
 | 
			
		||||
	copy	%dp,%arg0
 | 
			
		||||
	bl	printit,%mrp
 | 
			
		||||
	copy	%sp,%arg0
 | 
			
		||||
	bl	printit,%mrp
 | 
			
		||||
	mfctl	%rctr,%arg0
 | 
			
		||||
	bl	printit,%mrp
 | 
			
		||||
	mfctl	%iva,%arg0
 | 
			
		||||
	bl	printit,%mrp
 | 
			
		||||
	mfctl	%eiem,%arg0
 | 
			
		||||
	bl	printit,%mrp
 | 
			
		||||
	mfctl	%ipsw,%arg0
 | 
			
		||||
	bl	printit,%mrp
 | 
			
		||||
	copy	%r0,%arg0
 | 
			
		||||
#endif
 | 
			
		||||
	bl	SR_1,%sp
 | 
			
		||||
	addil	L%Stub_stack-SR_1,%sp
 | 
			
		||||
SR_1
 | 
			
		||||
	ldo	R%Stub_stack-SR_1(%r1),%sp	; set the stack pointer
 | 
			
		||||
 | 
			
		||||
	bl	SR_2,%arg0
 | 
			
		||||
	addil	L%RegBlk-SR_2,%arg0
 | 
			
		||||
SR_2
 | 
			
		||||
	ldo	R%RegBlk-SR_2(%r1),%arg0	; set arg0 (save register area)
 | 
			
		||||
 | 
			
		||||
	bl	SR_3,%arg1
 | 
			
		||||
	addil	L%Exception_index-SR_3,%arg1	; set arg1 address
 | 
			
		||||
SR_3
 | 
			
		||||
	ldo	R%Exception_index-SR_3(%r1),%arg1	; set arg1 address
 | 
			
		||||
 | 
			
		||||
	addi	min_stack,%sp,%sp		; allocate min stack frame
 | 
			
		||||
 | 
			
		||||
	bl	handle_exception,%r2
 | 
			
		||||
	ldw	0(%arg1),%arg1			; load arg1
 | 
			
		||||
        addi	-min_stack,%sp,%sp		; de allocate min stack frame
 | 
			
		||||
 | 
			
		||||
	b	DEBUG_EXEC			; 
 | 
			
		||||
	copy	%r28,%r10	
 | 
			
		||||
;-------------------------------------------------------------------------------
 | 
			
		||||
 | 
			
		||||
save_regs	; return address is in %r25
 | 
			
		||||
 | 
			
		||||
	bl	SR_0,%r1			; r1 points to Register block
 | 
			
		||||
	addil   L%RegBlk-SR_0,%r1
 | 
			
		||||
SR_0
 | 
			
		||||
	ldo     R%RegBlk-SR_0(%r1),%r1
 | 
			
		||||
 | 
			
		||||
; save general registers
 | 
			
		||||
 | 
			
		||||
	stw	%r0,R_gr0(%r1)
 | 
			
		||||
	; don't store %r1 yet
 | 
			
		||||
	stw	%r2,R_gr2(%r1)
 | 
			
		||||
	stw	%r3,R_gr3(%r1)
 | 
			
		||||
	stw	%r4,R_gr4(%r1)
 | 
			
		||||
	stw	%r5,R_gr5(%r1)
 | 
			
		||||
	stw	%r6,R_gr6(%r1)
 | 
			
		||||
	stw	%r7,R_gr7(%r1)
 | 
			
		||||
	; don't store %r8 yet
 | 
			
		||||
	; don't store %r9 yet
 | 
			
		||||
	stw	%r10,R_gr10(%r1)
 | 
			
		||||
	stw	%r11,R_gr11(%r1)
 | 
			
		||||
	stw	%r12,R_gr12(%r1)
 | 
			
		||||
	stw	%r13,R_gr13(%r1)
 | 
			
		||||
	stw	%r14,R_gr14(%r1)
 | 
			
		||||
	stw	%r15,R_gr15(%r1)
 | 
			
		||||
	; don't store %r16 yet
 | 
			
		||||
	; don't store %r17 yet
 | 
			
		||||
	stw	%r18,R_gr18(%r1)
 | 
			
		||||
	stw	%r19,R_gr19(%r1)
 | 
			
		||||
	stw	%r20,R_gr20(%r1)
 | 
			
		||||
	stw	%r21,R_gr21(%r1)
 | 
			
		||||
	stw	%r22,R_gr22(%r1)
 | 
			
		||||
	stw	%r23,R_gr23(%r1)
 | 
			
		||||
	; don't store %r24 yet
 | 
			
		||||
	; don't store %r25 yet
 | 
			
		||||
	stw	%r26,R_gr26(%r1)
 | 
			
		||||
	stw	%r27,R_gr27(%r1)
 | 
			
		||||
	stw	%r28,R_gr28(%r1)
 | 
			
		||||
	stw	%r29,R_gr29(%r1)
 | 
			
		||||
	stw	%r30,R_gr30(%r1)
 | 
			
		||||
	stw	%r31,R_gr31(%r1)
 | 
			
		||||
 | 
			
		||||
; restore general registers from shadow registers and save them
 | 
			
		||||
 | 
			
		||||
	copy	%r1,%r10	; hold Register block pointer
 | 
			
		||||
	copy	%r25,%rp	; hold return pointer
 | 
			
		||||
	shdw_gr
 | 
			
		||||
	shdw_gr
 | 
			
		||||
	stw	%r1,R_gr1(%r10)
 | 
			
		||||
	stw	%r8,R_gr8(%r10)
 | 
			
		||||
	stw	%r9,R_gr9(%r10)
 | 
			
		||||
	stw	%r16,R_gr16(%r10)
 | 
			
		||||
	stw	%r17,R_gr17(%r10)
 | 
			
		||||
	stw	%r24,R_gr24(%r10)
 | 
			
		||||
	stw	%r25,R_gr25(%r10)
 | 
			
		||||
 | 
			
		||||
; save control registers
 | 
			
		||||
 | 
			
		||||
	mfctl	%cr0,%r1
 | 
			
		||||
	stw	%r1,R_cr0(%r10)
 | 
			
		||||
	stw	%r0,R_cr1(%r10)
 | 
			
		||||
	stw	%r0,R_cr2(%r10)
 | 
			
		||||
	stw	%r0,R_cr3(%r10)
 | 
			
		||||
	stw	%r0,R_cr4(%r10)
 | 
			
		||||
	stw	%r0,R_cr5(%r10)
 | 
			
		||||
	stw	%r0,R_cr6(%r10)
 | 
			
		||||
	stw	%r0,R_cr7(%r10)
 | 
			
		||||
	mfctl	%cr8,%r1
 | 
			
		||||
	stw	%r1,R_cr8(%r10)
 | 
			
		||||
	mfctl	%cr9,%r1
 | 
			
		||||
	stw	%r1,R_cr9(%r10)
 | 
			
		||||
	mfctl	%cr10,%r1
 | 
			
		||||
	stw	%r1,R_cr10(%r10)
 | 
			
		||||
	mfctl	%cr11,%r1
 | 
			
		||||
	stw	%r1,R_cr11(%r10)
 | 
			
		||||
	mfctl	%cr12,%r1
 | 
			
		||||
	stw	%r1,R_cr12(%r10)
 | 
			
		||||
	mfctl	%cr13,%r1
 | 
			
		||||
	stw	%r1,R_cr13(%r10)
 | 
			
		||||
	mfctl	%cr14,%r1
 | 
			
		||||
	stw	%r1,R_cr14(%r10)
 | 
			
		||||
	mfctl	%cr15,%r1
 | 
			
		||||
	stw	%r1,R_cr15(%r10)
 | 
			
		||||
	mfctl	%cr16,%r1
 | 
			
		||||
	stw	%r1,R_cr16(%r10)
 | 
			
		||||
	mfctl	%cr17,%r1
 | 
			
		||||
	stw	%r1,R_cr17H(%r10)
 | 
			
		||||
	mtctl	%r1,%cr17
 | 
			
		||||
	mfctl	%cr17,%r1
 | 
			
		||||
	stw	%r1,R_cr17T(%r10)
 | 
			
		||||
	mtctl	%r1,%cr17
 | 
			
		||||
	mfctl	%cr18,%r1
 | 
			
		||||
	stw	%r1,R_cr18H(%r10)
 | 
			
		||||
	mtctl	%r1,%cr18
 | 
			
		||||
	mfctl	%cr18,%r1
 | 
			
		||||
	stw	%r1,R_cr18T(%r10)
 | 
			
		||||
	mtctl	%r1,%cr18
 | 
			
		||||
	mfctl	%cr19,%r1
 | 
			
		||||
	stw	%r1,R_cr19(%r10)
 | 
			
		||||
	mfctl	%cr20,%r1
 | 
			
		||||
	stw	%r1,R_cr20(%r10)
 | 
			
		||||
	mfctl	%cr21,%r1
 | 
			
		||||
	stw	%r1,R_cr21(%r10)
 | 
			
		||||
	mfctl	%cr22,%r1
 | 
			
		||||
	stw	%r1,R_cr22(%r10)
 | 
			
		||||
	mfctl	%cr23,%r1
 | 
			
		||||
	stw	%r1,R_cr23(%r10)
 | 
			
		||||
	mfctl	%cr24,%r1
 | 
			
		||||
	stw	%r1,R_cr24(%r10)
 | 
			
		||||
	mfctl	%cr25,%r1
 | 
			
		||||
	stw	%r1,R_cr25(%r10)
 | 
			
		||||
	mfctl	%cr26,%r1
 | 
			
		||||
	stw	%r1,R_cr26(%r10)
 | 
			
		||||
	mfctl	%cr27,%r1
 | 
			
		||||
	stw	%r1,R_cr27(%r10)
 | 
			
		||||
	mfctl	%cr28,%r1
 | 
			
		||||
	stw	%r1,R_cr28(%r10)
 | 
			
		||||
	mfctl	%cr29,%r1
 | 
			
		||||
	stw	%r1,R_cr29(%r10)
 | 
			
		||||
	mfctl	%cr30,%r1
 | 
			
		||||
	stw	%r1,R_cr30(%r10)
 | 
			
		||||
	mfctl	%cr31,%r1
 | 
			
		||||
	stw	%r1,R_cr31(%r10)
 | 
			
		||||
 | 
			
		||||
; save diagnose registers
 | 
			
		||||
 | 
			
		||||
	mfcpu_c	0,%r1
 | 
			
		||||
	mfcpu_c	0,%r1
 | 
			
		||||
	stw	%r1,R_cpu0(%r10)
 | 
			
		||||
 | 
			
		||||
; save space registers
 | 
			
		||||
 | 
			
		||||
	mfsp	%sr0,%r1
 | 
			
		||||
	stw	%r1,R_sr0(%r10)
 | 
			
		||||
	mfsp	%sr1,%r1
 | 
			
		||||
	stw	%r1,R_sr1(%r10)
 | 
			
		||||
	mfsp	%sr2,%r1
 | 
			
		||||
	stw	%r1,R_sr2(%r10)
 | 
			
		||||
	mfsp	%sr3,%r1
 | 
			
		||||
	stw	%r1,R_sr3(%r10)
 | 
			
		||||
	mfsp	%sr4,%r1
 | 
			
		||||
	stw	%r1,R_sr4(%r10)
 | 
			
		||||
	mfsp	%sr5,%r1
 | 
			
		||||
	stw	%r1,R_sr5(%r10)
 | 
			
		||||
	mfsp	%sr6,%r1
 | 
			
		||||
	stw	%r1,R_sr6(%r10)
 | 
			
		||||
	mfsp	%sr7,%r1
 | 
			
		||||
	bv	(%rp)
 | 
			
		||||
	stw	%r1,R_sr7(%r10)
 | 
			
		||||
 | 
			
		||||
#ifdef	DEBUG_DEBUGGER
 | 
			
		||||
;-------------------------------------------------------------------------------
 | 
			
		||||
printit
 | 
			
		||||
	mtctl	%rp,%tr0
 | 
			
		||||
	mtctl	%r1,%tr1
 | 
			
		||||
	bl	putnum,%rp
 | 
			
		||||
	copy	%rp,%arg0
 | 
			
		||||
 | 
			
		||||
	mtctl	%mrp,%tr2
 | 
			
		||||
	bl	putc,%rp
 | 
			
		||||
	ldi	CR,%arg0
 | 
			
		||||
	bl	putc,%rp
 | 
			
		||||
	ldi	LF,%arg0
 | 
			
		||||
	mfctl	%tr2,%mrp
 | 
			
		||||
	mfctl	%tr1,%r1
 | 
			
		||||
	bv	(%mrp)
 | 
			
		||||
	mfctl	%tr0,%rp
 | 
			
		||||
#endif
 | 
			
		||||
	.space	$PRIVATE$
 | 
			
		||||
	.subspa	$DATA$,align=4,access=0x1f
 | 
			
		||||
 | 
			
		||||
Exception_index
 | 
			
		||||
	.word	0
 | 
			
		||||
	
 | 
			
		||||
RegBlk
 | 
			
		||||
	.block	R_SIZE		; register block
 | 
			
		||||
 | 
			
		||||
Stub_stack
 | 
			
		||||
	.block	1024
 | 
			
		||||
 | 
			
		||||
	.end
 | 
			
		||||
							
								
								
									
										168
									
								
								libgloss/hp74x/diagnose.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										168
									
								
								libgloss/hp74x/diagnose.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,168 @@
 | 
			
		||||
/****************************************************************************
 | 
			
		||||
 | 
			
		||||
		THIS SOFTWARE IS NOT COPYRIGHTED
 | 
			
		||||
 | 
			
		||||
   HP offers the following for use in the public domain.  HP makes no
 | 
			
		||||
   warranty with regard to the software or it's performance and the
 | 
			
		||||
   user accepts the software "AS IS" with all faults.
 | 
			
		||||
 | 
			
		||||
   HP DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED, WITH REGARD
 | 
			
		||||
   TO THIS SOFTWARE INCLUDING BUT NOT LIMITED TO THE WARRANTIES
 | 
			
		||||
   OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 | 
			
		||||
 | 
			
		||||
****************************************************************************/
 | 
			
		||||
 | 
			
		||||
		/* Diagnose register definitions */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#ifdef PCXL
 | 
			
		||||
 | 
			
		||||
#define CPU_DIAG_0_L2IHPMC_BIT           6   /* Level 2 I-cache error flag */
 | 
			
		||||
#define CPU_DIAG_0_L2DHPMC_BIT           8   /* Level 2 D-cache error flag */
 | 
			
		||||
#define CPU_DIAG_0_L1IHPMC_BIT          10   /* Level 1 I-cache error flag */
 | 
			
		||||
#define CPU_DIAG_0_L2PARERR_BIT         15   /* rightmost bit */
 | 
			
		||||
#define	CPU_DIAG_0_PREV_HPMC_PREP_BIT   16   /* Previous HPMC finished */
 | 
			
		||||
#define	CPU_DIAG_0_PWR_FAIL_BIT	        17
 | 
			
		||||
#define	CPU_DIAG_0_EXPECT_HPMC_BIT      18   /* Expecting HPMC */
 | 
			
		||||
 | 
			
		||||
	/* Mask for Read/clear bits in CPU diagnose register 0 */
 | 
			
		||||
#define CPU0_MASK	0x02AF0000
 | 
			
		||||
 | 
			
		||||
#else  /* PCXT */
 | 
			
		||||
 | 
			
		||||
#define CPU_DIAG_0_PREV_HPMC_PREP_BIT	 3   /* Previous HPMC finished */
 | 
			
		||||
#define	CPU_DIAG_0_BOOTING_BIT		 4
 | 
			
		||||
#define	CPU_DIAG_0_EXPECT_HPMC_BIT	 5   /* Expecting HPMC */
 | 
			
		||||
 | 
			
		||||
#define CPU_DIAG_0_DHPMC_BIT		10
 | 
			
		||||
#define CPU_DIAG_0_ILPMC_BIT		14
 | 
			
		||||
#define CPU_DIAG_0_HTOC_BIT		23
 | 
			
		||||
 | 
			
		||||
	/* Mask for Read/clear bits in CPU diagnose register 0 */
 | 
			
		||||
#define CPU0_MASK	0x00220100
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
		/* Diagnose instruction macros */
 | 
			
		||||
 | 
			
		||||
#ifdef PCXL
 | 
			
		||||
 | 
			
		||||
/*** Different PCXL diagnose commands ***/
 | 
			
		||||
 | 
			
		||||
/* Original mfcpu replaced with the two commands mfcpu_t & mfcpu_c */
 | 
			
		||||
mfcpu_t .macro	diag_reg,gen_reg
 | 
			
		||||
	{ 0 ..	5}	= 0x5 {26 .. 31}
 | 
			
		||||
	{ 6 .. 10}	= diag_reg {27 .. 31}
 | 
			
		||||
	{11 .. 15}	= 0x0 {27 .. 31}
 | 
			
		||||
	{16 .. 18}	= 0x0 {29 .. 31}
 | 
			
		||||
	{19 .. 26}	= 0xa0 {24 .. 31}
 | 
			
		||||
	{27 .. 31}	= gen_reg {27 .. 31}
 | 
			
		||||
	.endm
 | 
			
		||||
 | 
			
		||||
mfcpu_c .macro	diag_reg,gen_reg
 | 
			
		||||
	{ 0 ..	5}	= 0x5 {26 .. 31}
 | 
			
		||||
	{ 6 .. 10}	= diag_reg {27 .. 31}
 | 
			
		||||
	{11 .. 15}	= gen_reg {27 .. 31}
 | 
			
		||||
	{16 .. 18}	= 0x0 {29 .. 31}
 | 
			
		||||
	{19 .. 26}	= 0x30 {24 .. 31}
 | 
			
		||||
	{27 .. 31}	= 0x0 {27 .. 31}
 | 
			
		||||
	.endm
 | 
			
		||||
 | 
			
		||||
mtcpu	.macro	gen_reg,diag_reg
 | 
			
		||||
	{ 0 ..	5}	= 0x5 {26 .. 31}
 | 
			
		||||
	{ 6 .. 10}	= diag_reg {27 .. 31}
 | 
			
		||||
	{11 .. 15}	= gen_reg {27 .. 31}
 | 
			
		||||
	{16 .. 18}	= 0x0 {29 .. 31}
 | 
			
		||||
	{19 .. 26}	= 0x12 {24 .. 31}
 | 
			
		||||
	{27 .. 31}	= 0x0 {27 .. 31}
 | 
			
		||||
	.endm
 | 
			
		||||
 | 
			
		||||
shdw_gr .macro
 | 
			
		||||
	{ 0 ..	5}	= 0x5 {26 .. 31}
 | 
			
		||||
	{ 6 .. 10}	= 0x0 {27 .. 31}
 | 
			
		||||
	{11 .. 15}	= 0x0 {27 .. 31}
 | 
			
		||||
	{16 .. 18}	= 0x0 {29 .. 31}
 | 
			
		||||
	{19 .. 26}	= 0xd0 {24 .. 31}
 | 
			
		||||
	{27 .. 31}	= 0x0 {27 .. 31}
 | 
			
		||||
	.endm
 | 
			
		||||
 | 
			
		||||
gr_shdw .macro
 | 
			
		||||
	{ 0 ..	5}	= 0x5 {26 .. 31}
 | 
			
		||||
	{ 6 .. 10}	= 0x0 {27 .. 31}
 | 
			
		||||
	{11 .. 15}	= 0x0 {27 .. 31}
 | 
			
		||||
	{16 .. 18}	= 0x0 {29 .. 31}
 | 
			
		||||
	{19 .. 26}	= 0xd2 {24 .. 31}
 | 
			
		||||
	{27 .. 31}	= 0x0 {27 .. 31}
 | 
			
		||||
	.endm
 | 
			
		||||
 | 
			
		||||
#else
 | 
			
		||||
 | 
			
		||||
/*** original PCXT version ***/
 | 
			
		||||
 | 
			
		||||
/* Originally  was mfcpu without the _c */
 | 
			
		||||
mfcpu_c .macro	diag_reg,gen_reg
 | 
			
		||||
	{ 0 ..	5}	= 0x5 {26 .. 31}
 | 
			
		||||
	{ 6 .. 10}	= diag_reg {27 .. 31}
 | 
			
		||||
	{11 .. 15}	= gen_reg {27 .. 31}
 | 
			
		||||
	{16 .. 18}	= 0x0 {29 .. 31}
 | 
			
		||||
	{19 .. 26}	= 0xd0 {24 .. 31}
 | 
			
		||||
	{27 .. 31}	= 0x0 {27 .. 31}
 | 
			
		||||
	.endm
 | 
			
		||||
 | 
			
		||||
mtcpu	.macro	gen_reg,diag_reg
 | 
			
		||||
	{ 0 ..	5}	= 0x5 {26 .. 31}
 | 
			
		||||
	{ 6 .. 10}	= diag_reg {27 .. 31}
 | 
			
		||||
	{11 .. 15}	= gen_reg {27 .. 31}
 | 
			
		||||
	{16 .. 18}	= 0x0 {29 .. 31}
 | 
			
		||||
	{19 .. 26}	= 0xb0 {24 .. 31}
 | 
			
		||||
	{27 .. 31}	= 0x0 {27 .. 31}
 | 
			
		||||
	.endm
 | 
			
		||||
 | 
			
		||||
shdw_gr .macro
 | 
			
		||||
	{ 0 ..	5}	= 0x5 {26 .. 31}
 | 
			
		||||
	{ 6 .. 10}	= 0x2 {27 .. 31}
 | 
			
		||||
	{11 .. 15}	= 0x0 {27 .. 31}
 | 
			
		||||
	{16 .. 18}	= 0x1 {29 .. 31}
 | 
			
		||||
	{19 .. 26}	= 0x30 {24 .. 31}
 | 
			
		||||
	{27 .. 31}	= 0x0 {27 .. 31}
 | 
			
		||||
	.endm
 | 
			
		||||
 | 
			
		||||
gr_shdw .macro
 | 
			
		||||
	{ 0 ..	5}	= 0x5 {26 .. 31}
 | 
			
		||||
	{ 6 .. 10}	= 0x2 {27 .. 31}
 | 
			
		||||
	{11 .. 15}	= 0x0 {27 .. 31}
 | 
			
		||||
	{16 .. 18}	= 0x0 {29 .. 31}
 | 
			
		||||
	{19 .. 26}	= 0x31 {24 .. 31}
 | 
			
		||||
	{27 .. 31}	= 0x0 {27 .. 31}
 | 
			
		||||
	.endm
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	/* Actual commands used doubled instructions for cpu timing */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#define SHDW_GR		shdw_gr ! \
 | 
			
		||||
			shdw_gr
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	/* Break instruction definitions */
 | 
			
		||||
 | 
			
		||||
#define i13BREAK	0xa5a	/* im13 field for specified functions */
 | 
			
		||||
#define i5REG		0x06	/* Init registers */
 | 
			
		||||
#define i5BP		0x09	/* GDB breakpoint */
 | 
			
		||||
#define i5PSW		0x0b	/* Get PSW */
 | 
			
		||||
#define i5INLINE	0x0e	/* Get INLINE */
 | 
			
		||||
 | 
			
		||||
BR_INIT_REGS	.macro
 | 
			
		||||
	break	i5REG,i13BREAK
 | 
			
		||||
	.endm
 | 
			
		||||
 | 
			
		||||
BR_GET_PSW	.macro
 | 
			
		||||
	break	i5PSW,i13BREAK
 | 
			
		||||
	.endm
 | 
			
		||||
 | 
			
		||||
BR_INLINE	.macro
 | 
			
		||||
	break	i5INLINE,i13BREAK
 | 
			
		||||
	.endm
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										123
									
								
								libgloss/hp74x/hppa-defs.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										123
									
								
								libgloss/hp74x/hppa-defs.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,123 @@
 | 
			
		||||
/*
 | 
			
		||||
 * PDC support
 | 
			
		||||
 */
 | 
			
		||||
#define OPT_PDC_CACHE		5
 | 
			
		||||
#define OPT_PDC_ADD_VALID	12
 | 
			
		||||
#define OPT_PDC_CHASSIS		2	/* LED's */
 | 
			
		||||
#define OPT_PDC_IODC		8	/* console I/O */
 | 
			
		||||
#define IODC_CONSOLE_OUT	3	/* bytes out serial port */
 | 
			
		||||
#define IODC_CONSOLE_IN		2	/* bytes in serial port */
 | 
			
		||||
 | 
			
		||||
#define PGZ_MEM_PDC             0x0388  /* location of PDC_ENTRY in memory */
 | 
			
		||||
#define PGZ_CONSOLE_STRUCT      0x3A0   /* console config info */
 | 
			
		||||
#define CALL_PDC                (*(int (*)())((int *)(*((int *)PGZ_MEM_PDC))))
 | 
			
		||||
 | 
			
		||||
#define putDebugChar outbyte
 | 
			
		||||
#define getDebugChar inbyte
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * IODC support
 | 
			
		||||
 */
 | 
			
		||||
#define MAX_BUS_CONVERTERS      6
 | 
			
		||||
#define MAX_LAYERS	        6
 | 
			
		||||
#define IO_CONSOLE_INPUT	2
 | 
			
		||||
#define IO_CONSOLE_OUTPUT	3
 | 
			
		||||
 | 
			
		||||
struct _dev {
 | 
			
		||||
	unsigned char	flags;			/* auto-search and auto-boot  */
 | 
			
		||||
	unsigned char	bus_convert[MAX_BUS_CONVERTERS];
 | 
			
		||||
	unsigned char	pm;			/* fixed field of HPA         */
 | 
			
		||||
	unsigned int	layer[MAX_LAYERS];	/* device dependent layers    */
 | 
			
		||||
	unsigned int	hpa;			/* device HPA                 */
 | 
			
		||||
	unsigned int	spa;			/* device SPA                 */
 | 
			
		||||
	unsigned int	*iodc_io;		/* address of ENTRY_IO in mem */
 | 
			
		||||
	unsigned int	class;			/* device class               */
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Register defintions
 | 
			
		||||
 */
 | 
			
		||||
#define gr0	%r0			/* always ZERO */
 | 
			
		||||
#define gr1	%r1			/* ADDIL results only */
 | 
			
		||||
#define gr2	%r2			/* return address */
 | 
			
		||||
#define gr3	%r3			/* scratch registers */
 | 
			
		||||
#define gr4	%r4
 | 
			
		||||
#define gr5	%r5
 | 
			
		||||
#define gr6	%r6
 | 
			
		||||
#define gr7	%r7
 | 
			
		||||
#define gr8	%r8
 | 
			
		||||
#define gr9	%r9
 | 
			
		||||
#define gr10	%r10
 | 
			
		||||
#define gr11	%r11
 | 
			
		||||
#define gr12	%r12
 | 
			
		||||
#define gr13	%r13
 | 
			
		||||
#define gr14	%r14
 | 
			
		||||
#define gr15	%r15
 | 
			
		||||
#define gr16	%r16
 | 
			
		||||
#define gr17	%r17
 | 
			
		||||
#define gr18	%r18
 | 
			
		||||
#define gr19	%r19			/* 4th temp register */
 | 
			
		||||
#define gr20	%r20			/* 3rd temp register */
 | 
			
		||||
#define gr21	%r21			/* 2rd temp register */
 | 
			
		||||
#define gr22	%r22			/* 1rd temp register */
 | 
			
		||||
#define gr23	%r23			/* argument 3 */
 | 
			
		||||
#define gr24	%r24			/* argument 2 */
 | 
			
		||||
#define gr25	%r25			/* argument 1 */
 | 
			
		||||
#define gr26	%r26			/* argument 0 */
 | 
			
		||||
#define gr27	%r27			/* global data pointer */
 | 
			
		||||
#define gr28	%r28			/* return value */
 | 
			
		||||
#define gr29	%r29			/* return value, static link */
 | 
			
		||||
#define gr30	%r30			/* stack pointer */
 | 
			
		||||
#define gr31	%r31			/* millicode return pointer */
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * extra definitions, calling conventions
 | 
			
		||||
 */
 | 
			
		||||
#define rp		gr2		/* return address */
 | 
			
		||||
#define sp		gr30		/* stack pointer */
 | 
			
		||||
#define dp		gr27		/* global data area pointer */
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * extra definitions, argument passing
 | 
			
		||||
 */
 | 
			
		||||
#define Arg0            gr26            /* pdc function to perform */
 | 
			
		||||
#define Arg1            gr25            /* args to the pdc function */
 | 
			
		||||
#define Arg2            gr24
 | 
			
		||||
#define Arg3            gr23
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Special Processor Registers
 | 
			
		||||
 */
 | 
			
		||||
#define SAR		%cr11		/* shift amount register */
 | 
			
		||||
#define IVA		%cr14		/* Interruption Vector Address */
 | 
			
		||||
#define EIEM		%cr15		/* EIEM reg */
 | 
			
		||||
#define EIR		%cr23		/* EIR reg */
 | 
			
		||||
#define TIMER		%cr16		/* interval timer */
 | 
			
		||||
#define CCR		%cr10		/* coprocessor control reg. */
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * ASCII escape code
 | 
			
		||||
 */
 | 
			
		||||
#define NULL    0x00    /* <break>      soft-reset      (input only) */
 | 
			
		||||
#define DELP    0x03    /* <ctrl>C      del-collapse    (input only, non-std) */
 | 
			
		||||
#define DELE    0x04    /* <ctrl>D      del-to_eol      (input only, non-std) */
 | 
			
		||||
#define BELL    0x07    /* <ctrl>G      bell - audio */
 | 
			
		||||
#define BS      0x08    /* <ctrl>H      back space      (left arrow) */
 | 
			
		||||
#define HT      0x09    /* <ctrl>I      horizontal tab */
 | 
			
		||||
#define LF      0x0a    /* <ctrl>J      line feed       (down arrow) */
 | 
			
		||||
#define VT      0x0b    /* <ctrl>K      vertical tab    (up arrow) */
 | 
			
		||||
#define FF      0x0c    /* <ctrl>L      form feed       (right arrow) */
 | 
			
		||||
#define RTN     0x0d    /* <ctrl>M      carrage return */
 | 
			
		||||
#define CR      0x0d    /* <ctrl>M      carrage return */
 | 
			
		||||
 | 
			
		||||
#define INSC    0x0e    /* <ctrl>N      insert char     (input only, non-std) */
 | 
			
		||||
#define XON     0x11    /* <ctrl>Q      DC1 - continue */
 | 
			
		||||
#define BT      0x12    /* <ctrl>R      reverse tab     (input only, non-std) */
 | 
			
		||||
#define XOFF    0x13    /* <ctrl>S      DC3 - wait */
 | 
			
		||||
#define INSE    0x16    /* <ctrl>V      insert-expand   (input only, non-std) */
 | 
			
		||||
#define DELC    0x18    /* <ctrl>X      delete char     (input only, non-std) */
 | 
			
		||||
#define CLRH    0x1a    /* <ctrl>Z      clear/home      (input only) */
 | 
			
		||||
#define ESC     0x1b    /* <ctrl>[      escape          (must call key again) */
 | 
			
		||||
#define ENDL    0x1c    /* <ctrl>\      cursor-to-eol   (input only, non-std) */
 | 
			
		||||
#define HOME    0x1e    /* <ctrl>^      cursor home     (input only) */
 | 
			
		||||
#define DEL     0x7f    /* <shift>BS    destructive backspace */
 | 
			
		||||
							
								
								
									
										64
									
								
								libgloss/hp74x/hppa.ld
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										64
									
								
								libgloss/hp74x/hppa.ld
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,64 @@
 | 
			
		||||
STARTUP(crt0-hppa.o)
 | 
			
		||||
OUTPUT_ARCH(hppa)
 | 
			
		||||
/*** INPUT(hppa.o) ***/
 | 
			
		||||
SEARCH_DIR(.)
 | 
			
		||||
__DYNAMIC  =  0;
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Setup the memory map of the MC68ec0x0 Board (IDP)
 | 
			
		||||
 * stack grows up towards high memory. This works for
 | 
			
		||||
 * both the rom68k and the mon68k monitors.
 | 
			
		||||
 */
 | 
			
		||||
MEMORY
 | 
			
		||||
{
 | 
			
		||||
  ram (rwx) : ORIGIN = 0x10000, LENGTH = 32M
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * stick everything in ram (of course)
 | 
			
		||||
 */
 | 
			
		||||
SECTIONS
 | 
			
		||||
{
 | 
			
		||||
  .text :
 | 
			
		||||
  {
 | 
			
		||||
    CREATE_OBJECT_SYMBOLS
 | 
			
		||||
    *(.text)
 | 
			
		||||
     etext  =  .;
 | 
			
		||||
     __CTOR_LIST__ = .;
 | 
			
		||||
     LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2)
 | 
			
		||||
    *(.ctors)
 | 
			
		||||
     LONG(0)
 | 
			
		||||
     __CTOR_END__ = .;
 | 
			
		||||
     __DTOR_LIST__ = .;
 | 
			
		||||
     LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2)
 | 
			
		||||
    *(.dtors)
 | 
			
		||||
     LONG(0)
 | 
			
		||||
     __DTOR_END__ = .;
 | 
			
		||||
    *(.lit)
 | 
			
		||||
    *(.shdata)
 | 
			
		||||
  }  > ram
 | 
			
		||||
  .shbss SIZEOF(.text) + ADDR(.text) :	{
 | 
			
		||||
    *(.shbss)
 | 
			
		||||
  } 
 | 
			
		||||
  .data  : {
 | 
			
		||||
    *(.data)
 | 
			
		||||
    CONSTRUCTORS
 | 
			
		||||
    _edata  =  .;
 | 
			
		||||
  } > ram
 | 
			
		||||
 | 
			
		||||
  .bss SIZEOF(.data) + ADDR(.data) :
 | 
			
		||||
  {
 | 
			
		||||
   _bss_start = ALIGN(0x8);
 | 
			
		||||
   *(.bss)
 | 
			
		||||
   *(COMMON)
 | 
			
		||||
      _bss_end = ALIGN(0x8);
 | 
			
		||||
  }
 | 
			
		||||
  .stab  0 (NOLOAD) : 
 | 
			
		||||
  {
 | 
			
		||||
    [ .stab ]
 | 
			
		||||
  }
 | 
			
		||||
  .stabstr  0 (NOLOAD) :
 | 
			
		||||
  {
 | 
			
		||||
    [ .stabstr ]
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										338
									
								
								libgloss/hp74x/io.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										338
									
								
								libgloss/hp74x/io.c
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,338 @@
 | 
			
		||||
/*
 | 
			
		||||
 * io.c -- all the code to make GCC and the libraries run on
 | 
			
		||||
 *         a bare target board.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include <sys/types.h>
 | 
			
		||||
#include <sys/stat.h>
 | 
			
		||||
#include <errno.h>
 | 
			
		||||
 | 
			
		||||
#include "hppa-defs.h"
 | 
			
		||||
 | 
			
		||||
extern char *_end;                /* _end is set in the linker command file */
 | 
			
		||||
 | 
			
		||||
/* just in case, most boards have at least some memory */
 | 
			
		||||
#ifndef RAMSIZE
 | 
			
		||||
#  define RAMSIZE             (char *)0x100000
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
int
 | 
			
		||||
print(ptr)
 | 
			
		||||
char *ptr;
 | 
			
		||||
{
 | 
			
		||||
  while (*ptr)
 | 
			
		||||
    outbyte (*ptr++);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int
 | 
			
		||||
putnum (Num)
 | 
			
		||||
unsigned int Num;
 | 
			
		||||
{
 | 
			
		||||
  char	Buffer[9];
 | 
			
		||||
  int	Count;
 | 
			
		||||
  char	*BufPtr = Buffer;
 | 
			
		||||
  int	Digit;
 | 
			
		||||
  
 | 
			
		||||
  for (Count = 7 ; Count >= 0 ; Count--) {
 | 
			
		||||
    Digit = (Num >> (Count * 4)) & 0xf;
 | 
			
		||||
    
 | 
			
		||||
    if (Digit <= 9)
 | 
			
		||||
      *BufPtr++ = (char) ('0' + Digit);
 | 
			
		||||
    else
 | 
			
		||||
      *BufPtr++ = (char) ('a' - 10 + Digit);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  *BufPtr = (char) 0;
 | 
			
		||||
  print (Buffer);
 | 
			
		||||
  return;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int
 | 
			
		||||
delay (x)
 | 
			
		||||
     int x;
 | 
			
		||||
{
 | 
			
		||||
  int  y = 17;
 | 
			
		||||
  while (x-- !=0)
 | 
			
		||||
    y = y^2;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * strobe -- do a zylons thing, toggling each led in sequence forever...
 | 
			
		||||
 */
 | 
			
		||||
int
 | 
			
		||||
zylons()
 | 
			
		||||
{
 | 
			
		||||
  while (1) {
 | 
			
		||||
    strobe();
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * strobe -- toggle each led in sequence up and back once.
 | 
			
		||||
 */
 | 
			
		||||
int
 | 
			
		||||
strobe()
 | 
			
		||||
{
 | 
			
		||||
  static unsigned char curled = 1;
 | 
			
		||||
  static unsigned char dir = 0;
 | 
			
		||||
 | 
			
		||||
  curled = 1;
 | 
			
		||||
  dir = 0;
 | 
			
		||||
  while (curled != 0) {
 | 
			
		||||
    led_putnum (curled);
 | 
			
		||||
    delay (70000);
 | 
			
		||||
    if (dir)
 | 
			
		||||
      curled >>= 1;
 | 
			
		||||
    else
 | 
			
		||||
      curled <<= 1;
 | 
			
		||||
    
 | 
			
		||||
    if (curled == 128) {
 | 
			
		||||
      dir = ~dir;
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  curled = 1;
 | 
			
		||||
  dir = 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * iodc_io_call -- this makes a call into the IODC routine
 | 
			
		||||
 */
 | 
			
		||||
int
 | 
			
		||||
iodc_io_call(ep_address,arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11)
 | 
			
		||||
int ep_address, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11;
 | 
			
		||||
{ 
 | 
			
		||||
  int         (*iodc_entry_point)();
 | 
			
		||||
  
 | 
			
		||||
  iodc_entry_point = (int (*)())ep_address;
 | 
			
		||||
 | 
			
		||||
  return ((*iodc_entry_point)(arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * pdc_call -- this makes a call into the PDC routine
 | 
			
		||||
 */
 | 
			
		||||
int
 | 
			
		||||
pdc_call(arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11)
 | 
			
		||||
     int arg0, arg1, arg2, arg3,  arg4, arg5;
 | 
			
		||||
     int arg6, arg7, arg9, arg10, arg11;
 | 
			
		||||
{
 | 
			
		||||
   return ( CALL_PDC(arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * put_led -- put a bit pattern on the LED's. 
 | 
			
		||||
 */
 | 
			
		||||
int
 | 
			
		||||
led_putnum (byte)
 | 
			
		||||
     unsigned short byte;
 | 
			
		||||
{
 | 
			
		||||
  return (pdc_call(OPT_PDC_CHASSIS,0,byte));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * outbyte -- shove a byte out the serial port
 | 
			
		||||
 */
 | 
			
		||||
int
 | 
			
		||||
outbyte(byte)
 | 
			
		||||
     unsigned char byte;
 | 
			
		||||
{
 | 
			
		||||
  int status;
 | 
			
		||||
  int R_addr[32];
 | 
			
		||||
  struct _dev *console = (struct _dev *)PGZ_CONSOLE_STRUCT;
 | 
			
		||||
 | 
			
		||||
  status = iodc_io_call(console->iodc_io, console->hpa, IO_CONSOLE_OUTPUT, console->spa,
 | 
			
		||||
			console->layer[0], R_addr, 0, &byte, 1,	0);
 | 
			
		||||
 | 
			
		||||
  switch(status)
 | 
			
		||||
    {
 | 
			
		||||
    case 0:  return(1);
 | 
			
		||||
    default: return (-1);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * inbyte -- get a byte from the serial port
 | 
			
		||||
 */
 | 
			
		||||
unsigned char
 | 
			
		||||
inbyte()
 | 
			
		||||
{
 | 
			
		||||
  int status;
 | 
			
		||||
  int R_addr[32];
 | 
			
		||||
  char inbuf;
 | 
			
		||||
  struct _dev *console = (struct _dev *)PGZ_CONSOLE_STRUCT;
 | 
			
		||||
 | 
			
		||||
  while (status == 0) {
 | 
			
		||||
    status = iodc_io_call(console->iodc_io, console->hpa, IO_CONSOLE_INPUT, console->spa,
 | 
			
		||||
			  console->layer[0], R_addr, 0, &inbuf, 1, 0);
 | 
			
		||||
    
 | 
			
		||||
    switch (status) {
 | 
			
		||||
    case 0:
 | 
			
		||||
    case 2:  					/* recoverable error */
 | 
			
		||||
      if (R_addr[0] != 0) {			/* found a character */
 | 
			
		||||
	return(inbuf);
 | 
			
		||||
      }
 | 
			
		||||
      else
 | 
			
		||||
	break; 					/* error, no character */
 | 
			
		||||
    default: 					/* error, no character */
 | 
			
		||||
      return(0);	
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * read  -- read bytes from the serial port. Ignore fd, since
 | 
			
		||||
 *          we only have stdin.
 | 
			
		||||
 */
 | 
			
		||||
int
 | 
			
		||||
read(fd, buf, nbytes)
 | 
			
		||||
     int fd;
 | 
			
		||||
     char *buf;
 | 
			
		||||
     int nbytes;
 | 
			
		||||
{
 | 
			
		||||
  int i = 0;
 | 
			
		||||
  
 | 
			
		||||
  for (i = 0; i < nbytes; i++) {
 | 
			
		||||
    *(buf + i) = inbyte();
 | 
			
		||||
    if ((*(buf + i) == '\n') || (*(buf + i) == '\r')) {
 | 
			
		||||
      (*(buf + i)) = 0;
 | 
			
		||||
      break;
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  return (i);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * write -- write bytes to the serial port. Ignore fd, since
 | 
			
		||||
 *          stdout and stderr are the same. Since we have no filesystem,
 | 
			
		||||
 *          open will only return an error.
 | 
			
		||||
 */
 | 
			
		||||
int
 | 
			
		||||
write(fd, buf, nbytes)
 | 
			
		||||
     int fd;
 | 
			
		||||
     char *buf;
 | 
			
		||||
     int nbytes;
 | 
			
		||||
{
 | 
			
		||||
  int i;
 | 
			
		||||
 | 
			
		||||
  for (i = 0; i < nbytes; i++) {
 | 
			
		||||
    if (*(buf + i) == '\n') {
 | 
			
		||||
      outbyte ('\r');
 | 
			
		||||
    }
 | 
			
		||||
    outbyte (*(buf + i));
 | 
			
		||||
  }
 | 
			
		||||
  return (nbytes);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * open -- open a file descriptor. We don't have a filesystem, so
 | 
			
		||||
 *         we return an error.
 | 
			
		||||
 */
 | 
			
		||||
int
 | 
			
		||||
open(buf, flags, mode)
 | 
			
		||||
     char *buf;
 | 
			
		||||
     int flags;
 | 
			
		||||
     int mode;
 | 
			
		||||
{
 | 
			
		||||
  errno = EIO;
 | 
			
		||||
  return (-1);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * close -- close a file descriptor. We don't need
 | 
			
		||||
 *          to do anything, but pretend we did.
 | 
			
		||||
 */
 | 
			
		||||
int
 | 
			
		||||
close(fd)
 | 
			
		||||
     int fd;
 | 
			
		||||
{
 | 
			
		||||
  return (0);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * sbrk -- changes heap size size. Get nbytes more
 | 
			
		||||
 *         RAM. We just increment a pointer in what's
 | 
			
		||||
 *         left of memory on the board.
 | 
			
		||||
 */
 | 
			
		||||
char *
 | 
			
		||||
sbrk(nbytes)
 | 
			
		||||
     int nbytes;
 | 
			
		||||
{
 | 
			
		||||
  static char * heap_ptr = NULL;
 | 
			
		||||
  char *        base;
 | 
			
		||||
 | 
			
		||||
  if (heap_ptr == NULL) {
 | 
			
		||||
    heap_ptr = (char *)&_end;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if ((RAMSIZE - heap_ptr) >= 0) {
 | 
			
		||||
    base = heap_ptr;
 | 
			
		||||
    heap_ptr += nbytes;
 | 
			
		||||
    return (heap_ptr);
 | 
			
		||||
  } else {
 | 
			
		||||
    errno = ENOMEM;
 | 
			
		||||
    return ((char *)-1);
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * isatty -- returns 1 if connected to a terminal device,
 | 
			
		||||
 *           returns 0 if not. Since we're hooked up to a
 | 
			
		||||
 *           serial port, we'll say yes return a 1.
 | 
			
		||||
 */
 | 
			
		||||
int
 | 
			
		||||
isatty(fd)
 | 
			
		||||
     int fd;
 | 
			
		||||
{
 | 
			
		||||
  return (1);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * lseek -- move read/write pointer. Since a serial port
 | 
			
		||||
 *          is non-seekable, we return an error.
 | 
			
		||||
 */
 | 
			
		||||
off_t
 | 
			
		||||
lseek(fd,  offset, whence)
 | 
			
		||||
     int fd;
 | 
			
		||||
     off_t offset;
 | 
			
		||||
     int whence;
 | 
			
		||||
{
 | 
			
		||||
  errno = ESPIPE;
 | 
			
		||||
  return ((off_t)-1);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * fstat -- get status of a file. Since we have no file
 | 
			
		||||
 *          system, we just return an error.
 | 
			
		||||
 */
 | 
			
		||||
int
 | 
			
		||||
fstat(fd, buf)
 | 
			
		||||
     int fd;
 | 
			
		||||
     struct stat *buf;
 | 
			
		||||
{
 | 
			
		||||
  errno = EIO;
 | 
			
		||||
  return (-1);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * getpid -- only one process, so just return 1.
 | 
			
		||||
 */
 | 
			
		||||
#define __MYPID 1
 | 
			
		||||
int
 | 
			
		||||
getpid()
 | 
			
		||||
{
 | 
			
		||||
  return __MYPID;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * kill -- assume mvme.S, and go out via exit...
 | 
			
		||||
 */
 | 
			
		||||
int
 | 
			
		||||
kill(pid, sig)
 | 
			
		||||
     int pid;
 | 
			
		||||
     int sig;
 | 
			
		||||
{
 | 
			
		||||
  if(pid == __MYPID)
 | 
			
		||||
    _exit(sig);
 | 
			
		||||
  return 0;
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										164
									
								
								libgloss/hp74x/iva_table.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										164
									
								
								libgloss/hp74x/iva_table.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,164 @@
 | 
			
		||||
/****************************************************************************
 | 
			
		||||
 | 
			
		||||
		THIS SOFTWARE IS NOT COPYRIGHTED
 | 
			
		||||
 | 
			
		||||
   HP offers the following for use in the public domain.  HP makes no
 | 
			
		||||
   warranty with regard to the software or it's performance and the
 | 
			
		||||
   user accepts the software "AS IS" with all faults.
 | 
			
		||||
 | 
			
		||||
   HP DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED, WITH REGARD
 | 
			
		||||
   TO THIS SOFTWARE INCLUDING BUT NOT LIMITED TO THE WARRANTIES
 | 
			
		||||
   OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 | 
			
		||||
 | 
			
		||||
****************************************************************************/
 | 
			
		||||
 | 
			
		||||
		/* Interrupt Vector Table entry macros */
 | 
			
		||||
 | 
			
		||||
#define	cstring(Len,String)	.byte	Len !\
 | 
			
		||||
				.string	String
 | 
			
		||||
 | 
			
		||||
#define	cstringz(Len,String)	.byte	Len !\
 | 
			
		||||
				.stringz	String
 | 
			
		||||
 | 
			
		||||
AdvancePCOQ	.macro
 | 
			
		||||
	mtctl	%r0,%pcoq	; throw away iiaoq head pointer, tail->head
 | 
			
		||||
	mfctl	%pcoq,%r1	; get tail pointer
 | 
			
		||||
	mtctl	%r1,%pcoq	; insert tail pointer
 | 
			
		||||
	ldo	4(%r1),%r1	; advance tail pointer
 | 
			
		||||
	mtctl	%r1,%pcoq	; insert new tail pointer, former tail->head
 | 
			
		||||
	.endm
 | 
			
		||||
 | 
			
		||||
#ifdef	PRINTSTRING_LED
 | 
			
		||||
PrintString	.macro	NString,Num
 | 
			
		||||
	bl	put_led,%mrp
 | 
			
		||||
	ldi	Num+0xa0,%arg2
 | 
			
		||||
	addil	L%NString-$global$,%dp
 | 
			
		||||
	bl	puts,%rp
 | 
			
		||||
	ldo	R%NString-$global$(%r1),%arg0
 | 
			
		||||
	b,n	.
 | 
			
		||||
	nop
 | 
			
		||||
	.endm
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifdef	HALT
 | 
			
		||||
 | 
			
		||||
PrintString	.macro	NString,Num
 | 
			
		||||
	bl,n	save_state,%r25
 | 
			
		||||
	nop
 | 
			
		||||
	bl	print_intr,%rp
 | 
			
		||||
	ldi	NString-Str01,%arg0
 | 
			
		||||
	bl	print_state,%rp
 | 
			
		||||
	nop
 | 
			
		||||
	b,n	halt
 | 
			
		||||
	nop
 | 
			
		||||
	.endm
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifdef	RECOVER
 | 
			
		||||
 | 
			
		||||
PrintString	.macro	NString,Num
 | 
			
		||||
	bl,n	save_state,%r25
 | 
			
		||||
	nop
 | 
			
		||||
	bl	print_intr,%rp
 | 
			
		||||
	ldi	NString-Str01,%arg0
 | 
			
		||||
	bl	print_state,%rp
 | 
			
		||||
	nop
 | 
			
		||||
	b,n	recover
 | 
			
		||||
	nop
 | 
			
		||||
	.endm
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
PrintString	.macro	NString,Num
 | 
			
		||||
	bl,n	save_state,%r25
 | 
			
		||||
	nop
 | 
			
		||||
	bl	print_intr,%rp
 | 
			
		||||
	ldi	NString-Str01,%arg0
 | 
			
		||||
#ifdef	FULL_REPORT
 | 
			
		||||
	bl	print_state,%rp
 | 
			
		||||
#else
 | 
			
		||||
	nop
 | 
			
		||||
#endif
 | 
			
		||||
	nop
 | 
			
		||||
	b	restore_to_STUB
 | 
			
		||||
        ldi     Num,%r1
 | 
			
		||||
	.endm
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	/* IVA register array offets */
 | 
			
		||||
 | 
			
		||||
#define	R_sr0		  0
 | 
			
		||||
#define	R_sr1		  4
 | 
			
		||||
#define	R_sr2		  8
 | 
			
		||||
#define	R_sr3		 12
 | 
			
		||||
#define	R_sr4		 16
 | 
			
		||||
#define	R_sr5		 20
 | 
			
		||||
#define	R_sr6		 24
 | 
			
		||||
#define	R_sr7		 28
 | 
			
		||||
 | 
			
		||||
#define	R_gr0		 32
 | 
			
		||||
#define	R_gr1		 36
 | 
			
		||||
#define	R_gr2		 40
 | 
			
		||||
#define	R_gr3		 44
 | 
			
		||||
#define	R_gr4		 48
 | 
			
		||||
#define	R_gr5		 52
 | 
			
		||||
#define	R_gr6		 56
 | 
			
		||||
#define	R_gr7		 60
 | 
			
		||||
#define	R_gr8		 64
 | 
			
		||||
#define	R_gr9		 68
 | 
			
		||||
#define	R_gr10		 72
 | 
			
		||||
#define	R_gr11		 76
 | 
			
		||||
#define	R_gr12		 80
 | 
			
		||||
#define	R_gr13		 84
 | 
			
		||||
#define	R_gr14		 88
 | 
			
		||||
#define	R_gr15		 92
 | 
			
		||||
#define	R_gr16		 96
 | 
			
		||||
#define	R_gr17		100
 | 
			
		||||
#define	R_gr18		104
 | 
			
		||||
#define	R_gr19		108
 | 
			
		||||
#define	R_gr20		112
 | 
			
		||||
#define	R_gr21		116
 | 
			
		||||
#define	R_gr22		120
 | 
			
		||||
#define	R_gr23		124
 | 
			
		||||
#define	R_gr24		128
 | 
			
		||||
#define	R_gr25		132
 | 
			
		||||
#define	R_gr26		136
 | 
			
		||||
#define	R_gr27		140
 | 
			
		||||
#define	R_gr28		144
 | 
			
		||||
#define	R_gr29		148
 | 
			
		||||
#define	R_gr30		152
 | 
			
		||||
#define	R_gr31		156
 | 
			
		||||
 | 
			
		||||
#define	R_rctr		160
 | 
			
		||||
#define	R_cpu0		164
 | 
			
		||||
#define	R_pidr1		168
 | 
			
		||||
#define	R_pidr2		172
 | 
			
		||||
#define	R_ccr		176
 | 
			
		||||
#define	R_sar		180
 | 
			
		||||
#define	R_pidr3		184
 | 
			
		||||
#define	R_pidr4		188
 | 
			
		||||
#define	R_iva		192
 | 
			
		||||
#define	R_eiem		196
 | 
			
		||||
 | 
			
		||||
#define	R_itmr		200
 | 
			
		||||
#define	R_pcsqH		204
 | 
			
		||||
#define	R_pcoqH		208
 | 
			
		||||
#define	R_iir		212
 | 
			
		||||
#define	R_pcsqT		216
 | 
			
		||||
#define	R_pcoqT		220
 | 
			
		||||
#define	R_isr		224
 | 
			
		||||
#define	R_ior		228
 | 
			
		||||
#define	R_ipsw		232
 | 
			
		||||
#define	R_eirr		236
 | 
			
		||||
 | 
			
		||||
#define	R_tr0		240
 | 
			
		||||
#define	R_tr1		244
 | 
			
		||||
#define	R_tr2		248
 | 
			
		||||
#define	R_tr3		252
 | 
			
		||||
#define	R_tr4		256
 | 
			
		||||
#define	R_tr5		260
 | 
			
		||||
#define	R_tr6		264
 | 
			
		||||
#define	R_tr7		268
 | 
			
		||||
 | 
			
		||||
#define	R_SIZE		272
 | 
			
		||||
							
								
								
									
										996
									
								
								libgloss/hp74x/iva_table.s
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										996
									
								
								libgloss/hp74x/iva_table.s
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,996 @@
 | 
			
		||||
/****************************************************************************
 | 
			
		||||
 | 
			
		||||
		THIS SOFTWARE IS NOT COPYRIGHTED
 | 
			
		||||
 | 
			
		||||
   HP offers the following for use in the public domain.  HP makes no
 | 
			
		||||
   warranty with regard to the software or it's performance and the
 | 
			
		||||
   user accepts the software "AS IS" with all faults.
 | 
			
		||||
 | 
			
		||||
   HP DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED, WITH REGARD
 | 
			
		||||
   TO THIS SOFTWARE INCLUDING BUT NOT LIMITED TO THE WARRANTIES
 | 
			
		||||
   OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 | 
			
		||||
 | 
			
		||||
****************************************************************************/
 | 
			
		||||
 | 
			
		||||
	.space	$TEXT$
 | 
			
		||||
	.subspa	$CODE$,access=0x2c
 | 
			
		||||
 | 
			
		||||
#include	"diagnose.h"
 | 
			
		||||
#if 0
 | 
			
		||||
#include	"iva_table.h"
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
R_gr0		.equ	 0
 | 
			
		||||
R_gr1		.equ	 4
 | 
			
		||||
R_gr2		.equ	 8
 | 
			
		||||
R_gr3		.equ	12
 | 
			
		||||
R_gr4		.equ	16
 | 
			
		||||
R_gr5		.equ	20
 | 
			
		||||
R_gr6		.equ	24
 | 
			
		||||
R_gr7		.equ	28
 | 
			
		||||
R_gr8		.equ	32
 | 
			
		||||
R_gr9		.equ	36
 | 
			
		||||
R_gr10		.equ	40
 | 
			
		||||
R_gr11		.equ	44
 | 
			
		||||
R_gr12		.equ	48
 | 
			
		||||
R_gr13		.equ	52
 | 
			
		||||
R_gr14		.equ	56
 | 
			
		||||
R_gr15		.equ	60
 | 
			
		||||
R_gr16		.equ	64
 | 
			
		||||
R_gr17		.equ	68
 | 
			
		||||
R_gr18		.equ	72
 | 
			
		||||
R_gr19		.equ	76
 | 
			
		||||
R_gr20		.equ	80
 | 
			
		||||
R_gr21		.equ	84
 | 
			
		||||
R_gr22		.equ	88
 | 
			
		||||
R_gr23		.equ	92
 | 
			
		||||
R_gr24		.equ	96
 | 
			
		||||
R_gr25		.equ	100
 | 
			
		||||
R_gr26		.equ	104
 | 
			
		||||
R_gr27		.equ	108
 | 
			
		||||
R_gr28		.equ	112
 | 
			
		||||
R_gr29		.equ	116
 | 
			
		||||
R_gr30		.equ	120
 | 
			
		||||
R_gr31		.equ	124
 | 
			
		||||
R_rctr		.equ	160
 | 
			
		||||
R_cpu0		.equ	164
 | 
			
		||||
R_pidr1		.equ	168
 | 
			
		||||
R_pidr2		.equ	172
 | 
			
		||||
R_ccr 		.equ	176
 | 
			
		||||
R_sar 		.equ	180
 | 
			
		||||
R_pidr3         .equ	184
 | 
			
		||||
R_pidr4         .equ	188
 | 
			
		||||
R_iva 		.equ	192
 | 
			
		||||
R_eiem		.equ	196
 | 
			
		||||
 | 
			
		||||
R_itmr		.equ	200
 | 
			
		||||
R_pcsqH         .equ	204
 | 
			
		||||
R_pcoqH         .equ	208
 | 
			
		||||
R_iir 		.equ	212
 | 
			
		||||
R_pcsqT         .equ	216
 | 
			
		||||
R_pcoqT         .equ	220
 | 
			
		||||
R_isr 		.equ	224
 | 
			
		||||
R_ior 		.equ	228
 | 
			
		||||
R_ipsw		.equ	232
 | 
			
		||||
R_eirr		.equ	236
 | 
			
		||||
R_tr0 		.equ	240
 | 
			
		||||
R_tr1 		.equ	244
 | 
			
		||||
R_tr2 		.equ	248
 | 
			
		||||
R_tr3 		.equ	252
 | 
			
		||||
R_tr4 		.equ	256
 | 
			
		||||
R_tr5 		.equ	260
 | 
			
		||||
R_tr6 		.equ	264
 | 
			
		||||
R_tr7 		.equ	268
 | 
			
		||||
 | 
			
		||||
R_SIZE          .equ	300
 | 
			
		||||
 | 
			
		||||
	.import	putc,code
 | 
			
		||||
	.import	puts,code
 | 
			
		||||
	.import	putnum,code
 | 
			
		||||
	.import	put_led,code
 | 
			
		||||
	.import	save_regs,code
 | 
			
		||||
	.import	STUB_RESTORE,code
 | 
			
		||||
	.import	RegBlk,data
 | 
			
		||||
	.export	iva_table,data
 | 
			
		||||
	.IMPORT led_putnum,code
 | 
			
		||||
	.IMPORT delay,code
 | 
			
		||||
	.IMPORT putnum,code
 | 
			
		||||
	.IMPORT outbyte,code
 | 
			
		||||
	.IMPORT print,code
 | 
			
		||||
 | 
			
		||||
	.align	2048
 | 
			
		||||
iva_table
 | 
			
		||||
	.blockz	32	; entry 0 is reserved
 | 
			
		||||
 | 
			
		||||
	.align	32
 | 
			
		||||
hpmc
 | 
			
		||||
	nop
 | 
			
		||||
	b,n	hpmc_handler
 | 
			
		||||
	nop
 | 
			
		||||
	.word	0
 | 
			
		||||
	.word	0
 | 
			
		||||
	.word	0
 | 
			
		||||
	.word	hpmc_handler
 | 
			
		||||
	.word	0
 | 
			
		||||
 | 
			
		||||
	.align	32
 | 
			
		||||
power_fail
 | 
			
		||||
;	PrintString	Str02,0x2
 | 
			
		||||
	ldi	1,%r26
 | 
			
		||||
	bl,n	putnum,%r2
 | 
			
		||||
	nop
 | 
			
		||||
	
 | 
			
		||||
	.align	32
 | 
			
		||||
recovery
 | 
			
		||||
;;	PrintString	Str03,0x3
 | 
			
		||||
	ldi	2,%r26
 | 
			
		||||
	bl,n	putnum,%r2
 | 
			
		||||
	nop
 | 
			
		||||
		ldi	3,%r1
 | 
			
		||||
	b,n	handle_rcc
 | 
			
		||||
	nop
 | 
			
		||||
 | 
			
		||||
	.align	32
 | 
			
		||||
external
 | 
			
		||||
;	PrintString	Str04,0x4
 | 
			
		||||
	ldi	3,%r26
 | 
			
		||||
	bl,n	putnum,%r2
 | 
			
		||||
	nop
 | 
			
		||||
	
 | 
			
		||||
	.align	32
 | 
			
		||||
lpmc
 | 
			
		||||
;	PrintString	Str05,0x5
 | 
			
		||||
	ldi	4,%r26
 | 
			
		||||
	bl,n	putnum,%r2
 | 
			
		||||
	nop
 | 
			
		||||
	
 | 
			
		||||
	.align	32
 | 
			
		||||
itlb_miss
 | 
			
		||||
;	PrintString	Str06,0x6
 | 
			
		||||
	ldi	5,%r26
 | 
			
		||||
	bl,n	putnum,%r2
 | 
			
		||||
	nop
 | 
			
		||||
	
 | 
			
		||||
	.align	32
 | 
			
		||||
imem_protection
 | 
			
		||||
;	PrintString	Str07,0x7
 | 
			
		||||
	ldi	6,%r26
 | 
			
		||||
	bl,n	putnum,%r2
 | 
			
		||||
	nop
 | 
			
		||||
	
 | 
			
		||||
	.align	32
 | 
			
		||||
illegal_inst
 | 
			
		||||
;	PrintString	Str08,0x8
 | 
			
		||||
	ldi	7,%r26
 | 
			
		||||
	bl,n	putnum,%r2
 | 
			
		||||
	nop
 | 
			
		||||
	
 | 
			
		||||
	.align	32
 | 
			
		||||
break
 | 
			
		||||
	b,n	break_handler
 | 
			
		||||
	nop
 | 
			
		||||
 | 
			
		||||
	.align	32
 | 
			
		||||
privileged_op
 | 
			
		||||
;	PrintString	Str0a,0xa
 | 
			
		||||
	ldi	8,%r26
 | 
			
		||||
	bl,n	putnum,%r2
 | 
			
		||||
	nop
 | 
			
		||||
	
 | 
			
		||||
	.align	32
 | 
			
		||||
privileged_reg
 | 
			
		||||
;	PrintString	Str0b,0xb
 | 
			
		||||
	ldi	9,%r26
 | 
			
		||||
	bl,n	putnum,%r2
 | 
			
		||||
	nop
 | 
			
		||||
	
 | 
			
		||||
	.align	32
 | 
			
		||||
overflow
 | 
			
		||||
;	PrintString	Str0c,0xc
 | 
			
		||||
	ldi	32,%r26
 | 
			
		||||
	bl,n	putnum,%r2
 | 
			
		||||
	nop
 | 
			
		||||
	
 | 
			
		||||
	.align	32
 | 
			
		||||
conditional
 | 
			
		||||
;	PrintString	Str0d,0xd
 | 
			
		||||
	ldi	32,%r26
 | 
			
		||||
	bl,n	putnum,%r2
 | 
			
		||||
	nop
 | 
			
		||||
	
 | 
			
		||||
	.align	32
 | 
			
		||||
assist_excep
 | 
			
		||||
;	PrintString	Str0e,0xe
 | 
			
		||||
	ldi	32,%r26
 | 
			
		||||
	bl,n	putnum,%r2
 | 
			
		||||
	nop
 | 
			
		||||
	
 | 
			
		||||
	.align	32
 | 
			
		||||
dtlb_miss
 | 
			
		||||
;	PrintString	Str0f,0xf
 | 
			
		||||
	ldi	32,%r26
 | 
			
		||||
	bl,n	putnum,%r2
 | 
			
		||||
	nop
 | 
			
		||||
	
 | 
			
		||||
	.align	32
 | 
			
		||||
na_itlb
 | 
			
		||||
;	PrintString	Str10,0x10
 | 
			
		||||
	ldi	32,%r26
 | 
			
		||||
	bl,n	putnum,%r2
 | 
			
		||||
	nop
 | 
			
		||||
	
 | 
			
		||||
	.align	32
 | 
			
		||||
na_dtlb
 | 
			
		||||
;	PrintString	Str11,0x11
 | 
			
		||||
	ldi	32,%r26
 | 
			
		||||
	bl,n	putnum,%r2
 | 
			
		||||
	nop
 | 
			
		||||
	
 | 
			
		||||
	.align	32
 | 
			
		||||
dmem_protection
 | 
			
		||||
;	PrintString	Str12,0x12
 | 
			
		||||
	ldi	32,%r26
 | 
			
		||||
	bl,n	putnum,%r2
 | 
			
		||||
	nop
 | 
			
		||||
	
 | 
			
		||||
	.align	32
 | 
			
		||||
dmem_break
 | 
			
		||||
;	PrintString	Str13,0x13
 | 
			
		||||
	ldi	32,%r26
 | 
			
		||||
	bl,n	putnum,%r2
 | 
			
		||||
	nop
 | 
			
		||||
	
 | 
			
		||||
	.align	32
 | 
			
		||||
tlb_dirty
 | 
			
		||||
;	PrintString	Str14,0x14
 | 
			
		||||
	ldi	32,%r26
 | 
			
		||||
	bl,n	putnum,%r2
 | 
			
		||||
	nop
 | 
			
		||||
	
 | 
			
		||||
	.align	32
 | 
			
		||||
page_ref
 | 
			
		||||
;	PrintString	Str15,0x15
 | 
			
		||||
	ldi	32,%r26
 | 
			
		||||
	bl,n	putnum,%r2
 | 
			
		||||
	nop
 | 
			
		||||
	
 | 
			
		||||
	.align	32
 | 
			
		||||
assist_emul
 | 
			
		||||
;	PrintString	Str16,0x16
 | 
			
		||||
	ldi	32,%r26
 | 
			
		||||
	bl,n	putnum,%r2
 | 
			
		||||
	nop
 | 
			
		||||
	
 | 
			
		||||
	.align	32
 | 
			
		||||
high_priv
 | 
			
		||||
;	PrintString	Str17,0x17
 | 
			
		||||
	ldi	32,%r26
 | 
			
		||||
	bl,n	putnum,%r2
 | 
			
		||||
	nop
 | 
			
		||||
	
 | 
			
		||||
	.align	32
 | 
			
		||||
low_priv
 | 
			
		||||
;	PrintString	Str18,0x18
 | 
			
		||||
	ldi	32,%r26
 | 
			
		||||
	bl,n	putnum,%r2
 | 
			
		||||
	nop
 | 
			
		||||
	
 | 
			
		||||
	.align	32
 | 
			
		||||
branch_taken
 | 
			
		||||
;	PrintString	Str19,0x19
 | 
			
		||||
	ldi	32,%r26
 | 
			
		||||
	bl,n	putnum,%r2
 | 
			
		||||
	nop
 | 
			
		||||
	
 | 
			
		||||
/*
 | 
			
		||||
 * foobar -- debug procedure calling between C and assembler
 | 
			
		||||
 */
 | 
			
		||||
	.EXPORT foobar,ENTRY,ARGW0=GR,RTNVAL=GR
 | 
			
		||||
foobar
 | 
			
		||||
	.PROC
 | 
			
		||||
	.CALLINFO CALLER,FRAME=128,SAVE_RP
 | 
			
		||||
	.ENTRY
 | 
			
		||||
 | 
			
		||||
	stw     %r2,-20(0,%r30)			; stash the return pointer
 | 
			
		||||
	ldo	128(%r30),%r30			; push up the stack pointer
 | 
			
		||||
 | 
			
		||||
	ldi	8, %r26
 | 
			
		||||
	bl,n	led_putnum,%r2
 | 
			
		||||
	nop
 | 
			
		||||
        ldil 	L'900000,%r26
 | 
			
		||||
        ldo 	R'900000(%r26),%r26
 | 
			
		||||
	bl,n	delay,%r2
 | 
			
		||||
	nop
 | 
			
		||||
	ldi	8, %r26
 | 
			
		||||
	bl,n	led_putnum,%r2
 | 
			
		||||
	nop
 | 
			
		||||
        ldil 	L'900000,%r26
 | 
			
		||||
        ldo 	R'900000(%r26),%r26
 | 
			
		||||
	bl,n	delay,%r2
 | 
			
		||||
	nop
 | 
			
		||||
;;	copy	%r26,%r26
 | 
			
		||||
;;	bl,n	putnum,%r2
 | 
			
		||||
	nop
 | 
			
		||||
 | 
			
		||||
	ldw 	-148(0,%r30),%r2		; retrieve the return pointer
 | 
			
		||||
	ldo 	-128(%r30),%r30			; reset the stack pointer
 | 
			
		||||
	bv,n    0(%r2) 
 | 
			
		||||
	nop
 | 
			
		||||
	
 | 
			
		||||
	.EXIT
 | 
			
		||||
	.PROCEND
 | 
			
		||||
	
 | 
			
		||||
/*
 | 
			
		||||
 * setup_vectors -- add vectors for GDB to the vector table.
 | 
			
		||||
 *	%r3 - current vector table
 | 
			
		||||
 *	%r4 - new vector table
 | 
			
		||||
 */
 | 
			
		||||
	.EXPORT setup_vectors,ENTRY,ARGW0=GR,RTNVAL=GR
 | 
			
		||||
setup_vectors
 | 
			
		||||
	.PROC
 | 
			
		||||
	.CALLINFO CALLER,FRAME=128,SAVE_RP
 | 
			
		||||
	.ENTRY
 | 
			
		||||
	stw     %r2,-20(0,%r30)			; stash the return pointer
 | 
			
		||||
	ldo	128(%r30),%r30			; push up the stack pointer
 | 
			
		||||
 | 
			
		||||
        mfctl   %iva,%r3
 | 
			
		||||
 | 
			
		||||
	ldil 	L%iva_table,%r4			; Get the new vector table
 | 
			
		||||
        ldo 	R%iva_table(%r4),%r4		; address
 | 
			
		||||
	
 | 
			
		||||
	ldil 	L%break_handler,%r5		; Get the breakpoint
 | 
			
		||||
        ldo 	R%break_handler(%r5),%r5	; handler vector
 | 
			
		||||
 | 
			
		||||
	ldil 	L%break_default,%r6		; Get the default handler
 | 
			
		||||
        ldo 	R%break_default(%r6),%r6	; vector
 | 
			
		||||
 | 
			
		||||
	stw	%r6,4(%r4)			; ad the default vector
 | 
			
		||||
	stw	%r5,36(%r4)			; add the break vector
 | 
			
		||||
 | 
			
		||||
	mtctl	%r4,%iva
 | 
			
		||||
	
 | 
			
		||||
	ldw 	-148(0,%r30),%r2		; retrieve the return pointer
 | 
			
		||||
	ldo 	-128(%r30),%r30			; reset the stack pointer
 | 
			
		||||
	bv,n    0(%r2) 
 | 
			
		||||
	nop
 | 
			
		||||
	
 | 
			
		||||
	.EXIT
 | 
			
		||||
	.PROCEND
 | 
			
		||||
 | 
			
		||||
;-------------------------------------------------------------------------------
 | 
			
		||||
hpmc_handler
 | 
			
		||||
	bl,n	save_state,%r25
 | 
			
		||||
	nop
 | 
			
		||||
	bl	print_intr,%rp
 | 
			
		||||
	ldi	Str01-Str01,%arg0
 | 
			
		||||
	bl	print_state,%rp
 | 
			
		||||
	nop
 | 
			
		||||
	ldil	L%0xf0000000,%r1
 | 
			
		||||
	ldw	(%r1),%r1		; read from ROM to reset HPMC
 | 
			
		||||
 | 
			
		||||
	mfcpu_c	0,%r1
 | 
			
		||||
	mfcpu_c	0,%r1
 | 
			
		||||
	depi	0,CPU_DIAG_0_PREV_HPMC_PREP_BIT,1,%r1	; clear Prev HPMC bit
 | 
			
		||||
	
 | 
			
		||||
#ifdef PCXL
 | 
			
		||||
	depi    0,CPU_DIAG_0_L2DHPMC_BIT,1,%r1
 | 
			
		||||
	depi    0,CPU_DIAG_0_L2IHPMC_BIT,1,%r1
 | 
			
		||||
	depi    0,CPU_DIAG_0_L1IHPMC_BIT,1,%r1
 | 
			
		||||
	depi    0,CPU_DIAG_0_L2PARERR_BIT,4,%r1
 | 
			
		||||
#else	/* PCXT */
 | 
			
		||||
	depi	0,CPU_DIAG_0_DHPMC_BIT,1,%r1		; don't clear DHPMC
 | 
			
		||||
	depi	0,CPU_DIAG_0_ILPMC_BIT,1,%r1		; don't clear ILPMC
 | 
			
		||||
	depi	0,CPU_DIAG_0_HTOC_BIT,1,%r1		; don't clear HTOC
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	mtcpu	%r1,0
 | 
			
		||||
	mtcpu	%r1,0
 | 
			
		||||
 | 
			
		||||
	b,n	restore_to_STUB
 | 
			
		||||
	ldi	0x1,%r1
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * break_handler -- this is the main entry point for an exception
 | 
			
		||||
 */
 | 
			
		||||
	.ALIGN	2048
 | 
			
		||||
break_handler
 | 
			
		||||
 | 
			
		||||
	mfctl	%iir,%r1			; r1 = break instruction
 | 
			
		||||
	extru	%r1,18,13,%r8
 | 
			
		||||
	ldo	-i13BREAK(%r8),%r8		; if im13 field doesn't match
 | 
			
		||||
	comb,<>,n %r8,%r0,break_default		;   go to default operation
 | 
			
		||||
	extru	%r1,31,5,%r8
 | 
			
		||||
	ldi	0x9,%r1				; set exception index
 | 
			
		||||
	comib,=,n i5BP,%r8,break_breakpoint
 | 
			
		||||
	comib,=,n i5PSW,%r8,break_psw
 | 
			
		||||
	comib,=,n i5REG,%r8,break_reg_init
 | 
			
		||||
	comib,=,n i5INLINE,%r8,break_breakpoint 
 | 
			
		||||
	; fall through to break_default
 | 
			
		||||
 | 
			
		||||
break_default
 | 
			
		||||
;	PrintString	Str09,0x9
 | 
			
		||||
	ldi	32,%r26
 | 
			
		||||
	bl,n	putnum,%r2
 | 
			
		||||
	nop
 | 
			
		||||
	
 | 
			
		||||
break_reg_init
 | 
			
		||||
	bl	setup_vectors,%r25
 | 
			
		||||
	nop
 | 
			
		||||
	bl	save_regs,%r25
 | 
			
		||||
	nop
 | 
			
		||||
	; fall through to advance past break instruction
 | 
			
		||||
 | 
			
		||||
break_psw
 | 
			
		||||
	b,n	recover
 | 
			
		||||
 | 
			
		||||
break_breakpoint
 | 
			
		||||
	b,n	STUB_RESTORE
 | 
			
		||||
 | 
			
		||||
;-------------------------------------------------------------------------------
 | 
			
		||||
 | 
			
		||||
handle_rcc
 | 
			
		||||
        mfctl   %ipsw,%r1
 | 
			
		||||
        bb,>=,n %r1,10,do_restore	; check nullify bit
 | 
			
		||||
	dep     %r0,10,1,%r1
 | 
			
		||||
        mtctl   %r1,%ipsw               ; clear nullify bit
 | 
			
		||||
 | 
			
		||||
	;; was the AdvancePCOQ .macro
 | 
			
		||||
	mtctl   %r0,%pcoq       	; throw away iiaoq head pointer, tail->head
 | 
			
		||||
        mfctl   %pcoq,%r1       	; get tail pointer
 | 
			
		||||
        mtctl   %r1,%pcoq       	; insert tail pointer
 | 
			
		||||
        ldo     4(%r1),%r1      	; advance tail pointer
 | 
			
		||||
        mtctl   %r1,%pcoq       	; insert new tail pointer, former tail->head
 | 
			
		||||
 | 
			
		||||
do_restore
 | 
			
		||||
	b,n	STUB_RESTORE
 | 
			
		||||
	nop
 | 
			
		||||
;-------------------------------------------------------------------------------
 | 
			
		||||
 | 
			
		||||
print_intr
 | 
			
		||||
; %dp may be messed up, so do self-relocating to reach Save_area
 | 
			
		||||
	blr	%r0,%r1
 | 
			
		||||
	addil	L%Str01-pr_intr_0,%r1
 | 
			
		||||
 | 
			
		||||
pr_intr_0
 | 
			
		||||
	ldo	R%Str01-pr_intr_0(%r1),%r1	; r1 points to Save_area
 | 
			
		||||
	b	puts				; print string--return through rp
 | 
			
		||||
	add	%r1,%arg0,%arg0
 | 
			
		||||
 | 
			
		||||
;-------------------------------------------------------------------------------
 | 
			
		||||
 | 
			
		||||
halt
 | 
			
		||||
; %dp may be messed up, so do self-relocating to reach Save_area
 | 
			
		||||
	blr	%r0,%r1
 | 
			
		||||
	addil	L%HaltStr-halt_0,%r1
 | 
			
		||||
 | 
			
		||||
halt_0
 | 
			
		||||
	bl	puts,%rp			; print halt message
 | 
			
		||||
	ldo	R%HaltStr-halt_0(%r1),%arg0
 | 
			
		||||
 | 
			
		||||
	nop
 | 
			
		||||
	b,n	.				; loop forever
 | 
			
		||||
	nop
 | 
			
		||||
 | 
			
		||||
;-------------------------------------------------------------------------------
 | 
			
		||||
 | 
			
		||||
recover
 | 
			
		||||
	;; was the AdvancePCOQ .macro
 | 
			
		||||
	mtctl   %r0,%pcoq       		; throw away iiaoq head pointer, tail->head
 | 
			
		||||
        mfctl   %pcoq,%r1       		; get tail pointer
 | 
			
		||||
        mtctl   %r1,%pcoq       		; insert tail pointer
 | 
			
		||||
        ldo     4(%r1),%r1      		; advance tail pointer
 | 
			
		||||
        mtctl   %r1,%pcoq       		; insert new tail pointer, former tail->head
 | 
			
		||||
 | 
			
		||||
	rfir
 | 
			
		||||
 | 
			
		||||
;-------------------------------------------------------------------------------
 | 
			
		||||
 | 
			
		||||
save_state	; %r25 is return pointer
 | 
			
		||||
; %dp may be messed up, so do self-relocating to reach Save_area
 | 
			
		||||
	blr	%r0,%r1
 | 
			
		||||
	addil	L%Save_area-sa_st_0,%r1
 | 
			
		||||
 | 
			
		||||
sa_st_0
 | 
			
		||||
	ldo	R%Save_area-sa_st_0(%r1),%r1	; r1 points to Save_area
 | 
			
		||||
 | 
			
		||||
; save general registers
 | 
			
		||||
	stw	%r0,R_gr0(%r1)
 | 
			
		||||
				; don't save %r1 until restored
 | 
			
		||||
	stw	%r2,R_gr2(%r1)
 | 
			
		||||
	stw	%r3,R_gr3(%r1)
 | 
			
		||||
	stw	%r4,R_gr4(%r1)
 | 
			
		||||
	stw	%r5,R_gr5(%r1)
 | 
			
		||||
	stw	%r6,R_gr6(%r1)
 | 
			
		||||
	stw	%r7,R_gr7(%r1)
 | 
			
		||||
				; don't save %r8, %r9 until restored
 | 
			
		||||
	stw	%r10,R_gr10(%r1)
 | 
			
		||||
	stw	%r11,R_gr11(%r1)
 | 
			
		||||
	stw	%r12,R_gr12(%r1)
 | 
			
		||||
	stw	%r13,R_gr13(%r1)
 | 
			
		||||
	stw	%r14,R_gr14(%r1)
 | 
			
		||||
	stw	%r15,R_gr15(%r1)
 | 
			
		||||
				; don't save %r16, %r17 until restored
 | 
			
		||||
	stw	%r18,R_gr18(%r1)
 | 
			
		||||
	stw	%r19,R_gr19(%r1)
 | 
			
		||||
	stw	%r20,R_gr20(%r1)
 | 
			
		||||
	stw	%r21,R_gr21(%r1)
 | 
			
		||||
	stw	%r22,R_gr22(%r1)
 | 
			
		||||
	stw	%r23,R_gr23(%r1)
 | 
			
		||||
				; don't save %r24, %r25 until restored
 | 
			
		||||
	stw	%r26,R_gr26(%r1)
 | 
			
		||||
	stw	%r27,R_gr27(%r1)
 | 
			
		||||
	stw	%r28,R_gr28(%r1)
 | 
			
		||||
	stw	%r29,R_gr29(%r1)
 | 
			
		||||
	copy	%r25,%rp	; copy return pointer to %rp
 | 
			
		||||
	stw	%r30,R_gr30(%r1)
 | 
			
		||||
	copy	%r1,%r19	; save Save_area pointer in %r19
 | 
			
		||||
	stw	%r31,R_gr31(%r1)
 | 
			
		||||
	shdw_gr			; restore %r1 and %r25 (et al.) from shadow regs
 | 
			
		||||
	shdw_gr
 | 
			
		||||
	stw	%r1,R_gr1(%r19)	; save %r1
 | 
			
		||||
	stw	%r8,R_gr8(%r19)
 | 
			
		||||
	stw	%r9,R_gr9(%r19)
 | 
			
		||||
	stw	%r16,R_gr16(%r19)
 | 
			
		||||
	stw	%r17,R_gr17(%r19)
 | 
			
		||||
	stw	%r24,R_gr24(%r19)
 | 
			
		||||
 | 
			
		||||
; save control registers
 | 
			
		||||
	mfctl	%rctr,%r1
 | 
			
		||||
	stw	%r1,R_rctr(%r19)
 | 
			
		||||
	mfctl	%pidr1,%r1
 | 
			
		||||
	stw	%r1,R_pidr1(%r19)
 | 
			
		||||
	mfctl	%pidr2,%r1
 | 
			
		||||
	stw	%r1,R_pidr2(%r19)
 | 
			
		||||
	mfctl	%ccr,%r1
 | 
			
		||||
	stw	%r1,R_ccr(%r19)
 | 
			
		||||
	mfctl	%sar,%r1
 | 
			
		||||
	stw	%r1,R_sar(%r19)
 | 
			
		||||
	mfctl	%pidr3,%r1
 | 
			
		||||
	stw	%r1,R_pidr3(%r19)
 | 
			
		||||
	mfctl	%pidr4,%r1
 | 
			
		||||
	stw	%r1,R_pidr4(%r19)
 | 
			
		||||
	mfctl	%iva,%r1
 | 
			
		||||
	stw	%r1,R_iva(%r19)
 | 
			
		||||
	mfctl	%eiem,%r1
 | 
			
		||||
	stw	%r1,R_eiem(%r19)
 | 
			
		||||
	mfctl	%itmr,%r1
 | 
			
		||||
	stw	%r1,R_itmr(%r19)
 | 
			
		||||
	mfctl	%pcsq,%r1
 | 
			
		||||
	mtctl	%r1,%pcsq
 | 
			
		||||
	stw	%r1,R_pcsqH(%r19)
 | 
			
		||||
	mfctl	%pcsq,%r1
 | 
			
		||||
	mtctl	%r1,%pcsq
 | 
			
		||||
	stw	%r1,R_pcsqT(%r19)
 | 
			
		||||
	mfctl	%pcoq,%r1
 | 
			
		||||
	mtctl	%r1,%pcoq
 | 
			
		||||
	stw	%r1,R_pcoqH(%r19)
 | 
			
		||||
	mfctl	%pcoq,%r1
 | 
			
		||||
	mtctl	%r1,%pcoq
 | 
			
		||||
	stw	%r1,R_pcoqT(%r19)
 | 
			
		||||
	mfctl	%iir,%r1
 | 
			
		||||
	stw	%r1,R_iir(%r19)
 | 
			
		||||
	mfctl	%isr,%r1
 | 
			
		||||
	stw	%r1,R_isr(%r19)
 | 
			
		||||
	mfctl	%ior,%r1
 | 
			
		||||
	stw	%r1,R_ior(%r19)
 | 
			
		||||
	mfctl	%ipsw,%r1
 | 
			
		||||
	stw	%r1,R_ipsw(%r19)
 | 
			
		||||
	mfctl	%eirr,%r1
 | 
			
		||||
	stw	%r1,R_eirr(%r19)
 | 
			
		||||
	mfctl	%tr0,%r1
 | 
			
		||||
	stw	%r1,R_tr0(%r19)
 | 
			
		||||
	mfctl	%tr1,%r1
 | 
			
		||||
	stw	%r1,R_tr1(%r19)
 | 
			
		||||
	mfctl	%tr2,%r1
 | 
			
		||||
	stw	%r1,R_tr2(%r19)
 | 
			
		||||
	mfctl	%tr3,%r1
 | 
			
		||||
	stw	%r1,R_tr3(%r19)
 | 
			
		||||
	mfctl	%tr4,%r1
 | 
			
		||||
	stw	%r1,R_tr4(%r19)
 | 
			
		||||
	mfctl	%tr5,%r1
 | 
			
		||||
	stw	%r1,R_tr5(%r19)
 | 
			
		||||
	mfctl	%tr6,%r1
 | 
			
		||||
	stw	%r1,R_tr6(%r19)
 | 
			
		||||
	mfctl	%tr7,%r1
 | 
			
		||||
	stw	%r1,R_tr7(%r19)
 | 
			
		||||
 | 
			
		||||
; save diagnose registers
 | 
			
		||||
	mfcpu_c	0,%r1
 | 
			
		||||
	mfcpu_c	0,%r1
 | 
			
		||||
	stw	%r1,R_cpu0(%r19)
 | 
			
		||||
 | 
			
		||||
#ifdef	PRINT_SPACE
 | 
			
		||||
	stw	%r25,R_gr25(%r19)
 | 
			
		||||
 | 
			
		||||
; save space registers
 | 
			
		||||
	mfsp	%sr0,%r1
 | 
			
		||||
	stw	%r1,R_sr0(%r19)
 | 
			
		||||
	mfsp	%sr1,%r1
 | 
			
		||||
	stw	%r1,R_sr1(%r19)
 | 
			
		||||
	mfsp	%sr2,%r1
 | 
			
		||||
	stw	%r1,R_sr2(%r19)
 | 
			
		||||
	mfsp	%sr3,%r1
 | 
			
		||||
	stw	%r1,R_sr3(%r19)
 | 
			
		||||
	mfsp	%sr4,%r1
 | 
			
		||||
	stw	%r1,R_sr4(%r19)
 | 
			
		||||
	mfsp	%sr5,%r1
 | 
			
		||||
	stw	%r1,R_sr5(%r19)
 | 
			
		||||
	mfsp	%sr6,%r1
 | 
			
		||||
	stw	%r1,R_sr6(%r19)
 | 
			
		||||
	mfsp	%sr7,%r1
 | 
			
		||||
	bv	(%rp)
 | 
			
		||||
	stw	%r1,R_sr7(%r19)
 | 
			
		||||
#else
 | 
			
		||||
	bv	(%rp)
 | 
			
		||||
	stw	%r25,R_gr25(%r19)
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
;-------------------------------------------------------------------------------
 | 
			
		||||
 | 
			
		||||
restore_to_STUB		; doesn't return--goes to STUB_RESTORE
 | 
			
		||||
			; Note--STUB_RESTORE executes rfir,
 | 
			
		||||
			;	so we don't need to
 | 
			
		||||
	copy	%r1,%r8	; save exception index
 | 
			
		||||
; %dp may be messed up, so do self-relocating to reach Save_area
 | 
			
		||||
	bl	re_st_0,%r1
 | 
			
		||||
	addil	L%Save_area-re_st_0,%r1
 | 
			
		||||
 | 
			
		||||
re_st_0
 | 
			
		||||
	ldo	R%Save_area-re_st_0(%r1),%r1	; r1 points to Save_area
 | 
			
		||||
 | 
			
		||||
; restore general registers
 | 
			
		||||
	ldw	R_gr2(%r1),%r2
 | 
			
		||||
	ldw	R_gr3(%r1),%r3
 | 
			
		||||
	ldw	R_gr4(%r1),%r4
 | 
			
		||||
	ldw	R_gr5(%r1),%r5
 | 
			
		||||
	ldw	R_gr6(%r1),%r6
 | 
			
		||||
	ldw	R_gr7(%r1),%r7
 | 
			
		||||
;	ldw	R_gr8(%r1),%r8         don't smash the exception index
 | 
			
		||||
	ldw	R_gr9(%r1),%r9
 | 
			
		||||
	ldw	R_gr10(%r1),%r10
 | 
			
		||||
	ldw	R_gr11(%r1),%r11
 | 
			
		||||
	ldw	R_gr12(%r1),%r12
 | 
			
		||||
	ldw	R_gr13(%r1),%r13
 | 
			
		||||
	ldw	R_gr14(%r1),%r14
 | 
			
		||||
	ldw	R_gr15(%r1),%r15
 | 
			
		||||
	ldw	R_gr16(%r1),%r16
 | 
			
		||||
	ldw	R_gr17(%r1),%r17
 | 
			
		||||
	ldw	R_gr18(%r1),%r18
 | 
			
		||||
	ldw	R_gr19(%r1),%r19
 | 
			
		||||
	ldw	R_gr20(%r1),%r20
 | 
			
		||||
	ldw	R_gr21(%r1),%r21
 | 
			
		||||
	ldw	R_gr22(%r1),%r22
 | 
			
		||||
	ldw	R_gr23(%r1),%r23
 | 
			
		||||
	ldw	R_gr24(%r1),%r24
 | 
			
		||||
	ldw	R_gr25(%r1),%r25
 | 
			
		||||
	ldw	R_gr26(%r1),%r26
 | 
			
		||||
	ldw	R_gr27(%r1),%r27
 | 
			
		||||
	ldw	R_gr28(%r1),%r28
 | 
			
		||||
	ldw	R_gr29(%r1),%r29
 | 
			
		||||
	ldw	R_gr30(%r1),%r30
 | 
			
		||||
	ldw	R_gr31(%r1),%r31
 | 
			
		||||
	ldw	R_gr1(%r1),%r1
 | 
			
		||||
	b	STUB_RESTORE
 | 
			
		||||
	copy	%r8,%r1			; restore the exception index
 | 
			
		||||
 | 
			
		||||
;-------------------------------------------------------------------------------
 | 
			
		||||
 | 
			
		||||
#define	HoldPtr		%r10
 | 
			
		||||
#define	SavePtr		%r11
 | 
			
		||||
#define	StrPtr		%r12
 | 
			
		||||
#define	Count		%r13
 | 
			
		||||
 | 
			
		||||
#define	Hold_Hold	0*4	/* First word of hold area */
 | 
			
		||||
#define	Hold_Save	1*4	/* Second word of hold area */
 | 
			
		||||
#define	Hold_Str	2*4	/* Third word of hold area */
 | 
			
		||||
#define	Hold_Count	3*4	/* Fourth word of hold area */
 | 
			
		||||
#define	Hold_rp		4*4	/* Fifth word of hold area */
 | 
			
		||||
 | 
			
		||||
print_state
 | 
			
		||||
; %dp may be messed up, so do self-relocating to reach Save_area
 | 
			
		||||
	blr	%r0,%mrp
 | 
			
		||||
	addil	L%Hold_area-pr_st_0,%mrp
 | 
			
		||||
 | 
			
		||||
pr_st_0
 | 
			
		||||
	ldo	R%Hold_area-pr_st_0(%r1),%r1	; r1 points to Hold_area
 | 
			
		||||
 | 
			
		||||
; save working registers
 | 
			
		||||
 | 
			
		||||
	stw	HoldPtr,Hold_Hold(%r1)
 | 
			
		||||
	copy	%r1,HoldPtr			; HoldPtr = &Hold_area
 | 
			
		||||
	stw	SavePtr,Hold_Save(HoldPtr)
 | 
			
		||||
	ldo	Save_area-Hold_area(HoldPtr),SavePtr	; SavePtr = &Save_area
 | 
			
		||||
	stw	StrPtr,Hold_Str(HoldPtr)
 | 
			
		||||
	addil	L%PrintLabels-pr_st_0,%mrp
 | 
			
		||||
	stw	Count,Hold_Count(HoldPtr)
 | 
			
		||||
	ldo	R%PrintLabels-pr_st_0(%r1),StrPtr
 | 
			
		||||
	stw	%rp,Hold_rp(HoldPtr)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#ifdef	PRINT_SPACE
 | 
			
		||||
	ldi	68,Count
 | 
			
		||||
#else
 | 
			
		||||
	ldo	R_gr0(SavePtr),SavePtr
 | 
			
		||||
	ldi	60,Count
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
; print register values
 | 
			
		||||
 | 
			
		||||
print_loop
 | 
			
		||||
	bl	puts,%rp		; print label
 | 
			
		||||
	ldo	1(StrPtr),%arg0		; advance past length byte
 | 
			
		||||
	bl	putnum,%rp		; print register value
 | 
			
		||||
	ldwm	4(SavePtr),%arg0
 | 
			
		||||
	ldbs,ma	1(StrPtr),%r1
 | 
			
		||||
	addib,>	-1,Count,print_loop
 | 
			
		||||
	add	%r1,StrPtr,StrPtr
 | 
			
		||||
 | 
			
		||||
; skip to next line
 | 
			
		||||
	bl	puts,%rp		; print label
 | 
			
		||||
	ldo	1(StrPtr),%arg0		; advance past length byte
 | 
			
		||||
 | 
			
		||||
; restore working registers
 | 
			
		||||
 | 
			
		||||
	ldw	Hold_rp(HoldPtr),%rp
 | 
			
		||||
	ldw	Hold_Count(HoldPtr),Count
 | 
			
		||||
	ldw	Hold_Str(HoldPtr),StrPtr
 | 
			
		||||
	ldw	Hold_Save(HoldPtr),SavePtr
 | 
			
		||||
	bv	(%rp)
 | 
			
		||||
	ldw	Hold_Hold(HoldPtr),HoldPtr
 | 
			
		||||
 | 
			
		||||
#undef	SavePtr
 | 
			
		||||
#undef	HoldPtr
 | 
			
		||||
#undef	StrPtr
 | 
			
		||||
#undef	Count
 | 
			
		||||
 | 
			
		||||
#undef	Hold_Save
 | 
			
		||||
#undef	Hold_Scr
 | 
			
		||||
#undef	Hold_Str
 | 
			
		||||
#undef	Hold_Count
 | 
			
		||||
#undef	Hold_rp
 | 
			
		||||
 | 
			
		||||
;-------------------------------------------------------------------------------
 | 
			
		||||
 | 
			
		||||
	.space	$PRIVATE$
 | 
			
		||||
	.subspa	$DATA$,align=4,access=0x1f
 | 
			
		||||
 | 
			
		||||
/* Used to save machine registers before printing */
 | 
			
		||||
Save_area
 | 
			
		||||
	.block		R_SIZE		; Used to store registers
 | 
			
		||||
 | 
			
		||||
/* Used to hold callee-save registers */
 | 
			
		||||
Hold_area
 | 
			
		||||
	.block		8*4		; 8 words to store temp. registers
 | 
			
		||||
 | 
			
		||||
HaltStr
 | 
			
		||||
	.stringz	"\r\nHalted\r\n"
 | 
			
		||||
 | 
			
		||||
RebootStr
 | 
			
		||||
	.stringz	"\r\nRebooting . . .\r\n"
 | 
			
		||||
 | 
			
		||||
Str01
 | 
			
		||||
	.stringz	"\r\nHPMC\r\n"
 | 
			
		||||
 | 
			
		||||
Str02
 | 
			
		||||
	.stringz	"\r\nPower Fail\r\n"
 | 
			
		||||
 | 
			
		||||
Str03
 | 
			
		||||
	.stringz	"\r\nRecovery Counter Trap\r\n"
 | 
			
		||||
 | 
			
		||||
Str04
 | 
			
		||||
	.stringz	"\r\nExternal Interrupt\r\n"
 | 
			
		||||
 | 
			
		||||
Str05
 | 
			
		||||
	.stringz	"\r\nLPMC\r\n"
 | 
			
		||||
 | 
			
		||||
Str06
 | 
			
		||||
	.stringz	"\r\nITLB Miss\r\n"
 | 
			
		||||
 | 
			
		||||
Str07
 | 
			
		||||
	.stringz	"\r\nInstruction Memory Protection Trap\r\n"
 | 
			
		||||
 | 
			
		||||
Str08
 | 
			
		||||
	.stringz	"\r\nIllegal Instruction\r\n"
 | 
			
		||||
 | 
			
		||||
Str09
 | 
			
		||||
	.stringz	"\r\nBreak Trap\r\n"
 | 
			
		||||
 | 
			
		||||
Str0a
 | 
			
		||||
	.stringz	"\r\nPrivileged Operation\r\n"
 | 
			
		||||
 | 
			
		||||
Str0b
 | 
			
		||||
	.stringz	"\r\nPrivileged Register\r\n"
 | 
			
		||||
 | 
			
		||||
Str0c
 | 
			
		||||
	.stringz	"\r\nOverflow Trap\r\n"
 | 
			
		||||
 | 
			
		||||
Str0d
 | 
			
		||||
	.stringz	"\r\nConditional Trap\r\n"
 | 
			
		||||
 | 
			
		||||
Str0e
 | 
			
		||||
	.stringz	"\r\nAssist Exception\r\n"
 | 
			
		||||
 | 
			
		||||
Str0f
 | 
			
		||||
	.stringz	"\r\nData TLB Miss\r\n"
 | 
			
		||||
 | 
			
		||||
Str10
 | 
			
		||||
	.stringz	"\r\nNon-access ITLB Miss\r\n"
 | 
			
		||||
 | 
			
		||||
Str11
 | 
			
		||||
	.stringz	"\r\nNon-access DTLB Miss\r\n"
 | 
			
		||||
 | 
			
		||||
Str12
 | 
			
		||||
	.stringz	"\r\nData Memory Protection Trap\r\n"
 | 
			
		||||
 | 
			
		||||
Str13
 | 
			
		||||
	.stringz	"\r\nData Memory Break\r\n"
 | 
			
		||||
 | 
			
		||||
Str14
 | 
			
		||||
	.stringz	"\r\nTLB Dirty Bit Trap\r\n"
 | 
			
		||||
 | 
			
		||||
Str15
 | 
			
		||||
	.stringz	"\r\nPage Reference Trap\r\n"
 | 
			
		||||
 | 
			
		||||
Str16
 | 
			
		||||
	.stringz	"\r\nAssist Emulation Trap\r\n"
 | 
			
		||||
 | 
			
		||||
Str17
 | 
			
		||||
	.stringz	"\r\nHigher-privilege Trap\r\n"
 | 
			
		||||
 | 
			
		||||
Str18
 | 
			
		||||
	.stringz	"\r\nLower-privilege Trap\r\n"
 | 
			
		||||
 | 
			
		||||
Str19
 | 
			
		||||
	.stringz	"\r\nTaken Branch Trap\r\n"
 | 
			
		||||
 | 
			
		||||
Str20
 | 
			
		||||
	.stringz	"\r\nHere I am!\r\n"
 | 
			
		||||
 | 
			
		||||
PrintLabels
 | 
			
		||||
#ifdef	PRINT_SPACE
 | 
			
		||||
	.byte		10
 | 
			
		||||
	.stringz	"sr 0 = 0x"
 | 
			
		||||
	.byte		13
 | 
			
		||||
	.stringz	"sr 1 = 0x"
 | 
			
		||||
	.byte		13
 | 
			
		||||
	.stringz	"sr 2 = 0x"
 | 
			
		||||
	.byte		13
 | 
			
		||||
	.stringz	"   sr 3 = 0x"
 | 
			
		||||
	.byte		12
 | 
			
		||||
	.stringz	"\r\nsr 4 = 0x"
 | 
			
		||||
	.byte		13
 | 
			
		||||
	.stringz	"   sr 5 = 0x"
 | 
			
		||||
	.byte		13
 | 
			
		||||
	.stringz	"   sr 6 = 0x"
 | 
			
		||||
	.byte		13
 | 
			
		||||
	.stringz	"   sr 7 = 0x"
 | 
			
		||||
	.byte		13
 | 
			
		||||
	.stringz	"\r\n\ngr 0 = 0x"
 | 
			
		||||
#else
 | 
			
		||||
	.byte		10
 | 
			
		||||
	.stringz	"gr 0 = 0x"
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	.byte		13
 | 
			
		||||
	.stringz	"   gr 1 = 0x"
 | 
			
		||||
	.byte		13
 | 
			
		||||
	.stringz	"   gr 2 = 0x"
 | 
			
		||||
	.byte		13
 | 
			
		||||
	.stringz	"   gr 3 = 0x"
 | 
			
		||||
	.byte		12
 | 
			
		||||
	.stringz	"\r\ngr 4 = 0x"
 | 
			
		||||
	.byte		13
 | 
			
		||||
	.stringz	"   gr 5 = 0x"
 | 
			
		||||
	.byte		13
 | 
			
		||||
	.stringz	"   gr 6 = 0x"
 | 
			
		||||
	.byte		13
 | 
			
		||||
	.stringz	"   gr 7 = 0x"
 | 
			
		||||
	.byte		12
 | 
			
		||||
	.stringz	"\r\ngr 8 = 0x"
 | 
			
		||||
	.byte		13
 | 
			
		||||
	.stringz	"   gr 9 = 0x"
 | 
			
		||||
	.byte		13
 | 
			
		||||
	.stringz	"   gr10 = 0x"
 | 
			
		||||
	.byte		13
 | 
			
		||||
	.stringz	"   gr11 = 0x"
 | 
			
		||||
	.byte		12
 | 
			
		||||
	.stringz	"\r\ngr12 = 0x"
 | 
			
		||||
	.byte		13
 | 
			
		||||
	.stringz	"   gr13 = 0x"
 | 
			
		||||
	.byte		13
 | 
			
		||||
	.stringz	"   gr14 = 0x"
 | 
			
		||||
	.byte		13
 | 
			
		||||
	.stringz	"   gr15 = 0x"
 | 
			
		||||
	.byte		12
 | 
			
		||||
	.stringz	"\r\ngr16 = 0x"
 | 
			
		||||
	.byte		13
 | 
			
		||||
	.stringz	"   gr17 = 0x"
 | 
			
		||||
	.byte		13
 | 
			
		||||
	.stringz	"   gr18 = 0x"
 | 
			
		||||
	.byte		13
 | 
			
		||||
	.stringz	"   gr19 = 0x"
 | 
			
		||||
	.byte		12
 | 
			
		||||
	.stringz	"\r\ngr20 = 0x"
 | 
			
		||||
	.byte		13
 | 
			
		||||
	.stringz	"   gr21 = 0x"
 | 
			
		||||
	.byte		13
 | 
			
		||||
	.stringz	"   gr22 = 0x"
 | 
			
		||||
	.byte		13
 | 
			
		||||
	.stringz	"   gr23 = 0x"
 | 
			
		||||
	.byte		12
 | 
			
		||||
	.stringz	"\r\ngr24 = 0x"
 | 
			
		||||
	.byte		13
 | 
			
		||||
	.stringz	"   gr25 = 0x"
 | 
			
		||||
	.byte		13
 | 
			
		||||
	.stringz	"   gr26 = 0x"
 | 
			
		||||
	.byte		13
 | 
			
		||||
	.stringz	"   gr27 = 0x"
 | 
			
		||||
	.byte		12
 | 
			
		||||
	.stringz	"\r\ngr28 = 0x"
 | 
			
		||||
	.byte		13
 | 
			
		||||
	.stringz	"   gr29 = 0x"
 | 
			
		||||
	.byte		13
 | 
			
		||||
	.stringz	"   gr30 = 0x"
 | 
			
		||||
	.byte		13
 | 
			
		||||
	.stringz	"   gr31 = 0x"
 | 
			
		||||
	.byte		13
 | 
			
		||||
	.stringz	"\r\n\nrctr = 0x"
 | 
			
		||||
	.byte		53
 | 
			
		||||
	.stringz	"                                           cpu0 = 0x"
 | 
			
		||||
	.byte		12
 | 
			
		||||
	.stringz	"\r\npid1 = 0x"
 | 
			
		||||
	.byte		13
 | 
			
		||||
	.stringz	"   pid2 = 0x"
 | 
			
		||||
	.byte		13
 | 
			
		||||
	.stringz	"    ccr = 0x"
 | 
			
		||||
	.byte		13
 | 
			
		||||
	.stringz	"    sar = 0x"
 | 
			
		||||
	.byte		12
 | 
			
		||||
	.stringz	"\r\npid3 = 0x"
 | 
			
		||||
	.byte		13
 | 
			
		||||
	.stringz	"   pid4 = 0x"
 | 
			
		||||
	.byte		13
 | 
			
		||||
	.stringz	"    iva = 0x"
 | 
			
		||||
	.byte		13
 | 
			
		||||
	.stringz	"   eiem = 0x"
 | 
			
		||||
	.byte		12
 | 
			
		||||
	.stringz	"\r\nitmr = 0x"
 | 
			
		||||
	.byte		13
 | 
			
		||||
	.stringz	"   iasq = 0x"
 | 
			
		||||
	.byte		13
 | 
			
		||||
	.stringz	"   iaoq = 0x"
 | 
			
		||||
	.byte		13
 | 
			
		||||
	.stringz	"    iir = 0x"
 | 
			
		||||
	.byte		32
 | 
			
		||||
	.stringz	"\r\n                    iasq = 0x"
 | 
			
		||||
	.byte		13
 | 
			
		||||
	.stringz	"   iaoq = 0x"
 | 
			
		||||
	.byte		12
 | 
			
		||||
	.stringz	"\r\n isr = 0x"
 | 
			
		||||
	.byte		13
 | 
			
		||||
	.stringz	"    ior = 0x"
 | 
			
		||||
	.byte		13
 | 
			
		||||
	.stringz	"   ipsw = 0x"
 | 
			
		||||
	.byte		13
 | 
			
		||||
	.stringz	"   eirr = 0x"
 | 
			
		||||
	.byte		12
 | 
			
		||||
	.stringz	"\r\ncr24 = 0x"
 | 
			
		||||
	.byte		13
 | 
			
		||||
	.stringz	"   cr25 = 0x"
 | 
			
		||||
	.byte		13
 | 
			
		||||
	.stringz	"   cr26 = 0x"
 | 
			
		||||
	.byte		13
 | 
			
		||||
	.stringz	"   cr27 = 0x"
 | 
			
		||||
	.byte		12
 | 
			
		||||
	.stringz	"\r\ncr28 = 0x"
 | 
			
		||||
	.byte		13
 | 
			
		||||
	.stringz	"   cr29 = 0x"
 | 
			
		||||
	.byte		13
 | 
			
		||||
	.stringz	"   cr30 = 0x"
 | 
			
		||||
	.byte		13
 | 
			
		||||
	.stringz	"   cr31 = 0x"
 | 
			
		||||
	.byte		4
 | 
			
		||||
	.stringz	"\r\n\n"
 | 
			
		||||
 | 
			
		||||
	.end
 | 
			
		||||
							
								
								
									
										698
									
								
								libgloss/hp74x/pa_stub.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										698
									
								
								libgloss/hp74x/pa_stub.c
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,698 @@
 | 
			
		||||
/* -*-C-*-
 | 
			
		||||
*******************************************************************************
 | 
			
		||||
*
 | 
			
		||||
* File:         pa_stub.c
 | 
			
		||||
* RCS:          $Header$
 | 
			
		||||
* Description:  main routines for PA RISC monitor stub
 | 
			
		||||
* Author:       Robert Quist
 | 
			
		||||
* Created:      Mon Nov  1 10:00:36 1993
 | 
			
		||||
* Modified:     Fri Nov 12 15:14:23 1993 (Robert Quist) quist@hpfcrdq
 | 
			
		||||
* Language:     C
 | 
			
		||||
* Package:      N/A
 | 
			
		||||
* Status:       Experimental (Do Not Distribute)
 | 
			
		||||
*
 | 
			
		||||
*******************************************************************************
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
/****************************************************************************
 | 
			
		||||
 | 
			
		||||
		THIS SOFTWARE IS NOT COPYRIGHTED
 | 
			
		||||
 | 
			
		||||
   HP offers the following for use in the public domain.  HP makes no
 | 
			
		||||
   warranty with regard to the software or it's performance and the
 | 
			
		||||
   user accepts the software "AS IS" with all faults.
 | 
			
		||||
 | 
			
		||||
   HP DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED, WITH REGARD
 | 
			
		||||
   TO THIS SOFTWARE INCLUDING BUT NOT LIMITED TO THE WARRANTIES
 | 
			
		||||
   OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 | 
			
		||||
 | 
			
		||||
****************************************************************************/
 | 
			
		||||
 | 
			
		||||
/****************************************************************************
 | 
			
		||||
 *
 | 
			
		||||
 *  Description:     low level support for gdb debugger. $
 | 
			
		||||
 *
 | 
			
		||||
 *  Considerations:  only works on target hardware $
 | 
			
		||||
 *
 | 
			
		||||
 *  NOTES:           See Below $
 | 
			
		||||
 *
 | 
			
		||||
 *    To enable debugger support, two things need to happen.
 | 
			
		||||
 *
 | 
			
		||||
 *  One, a call to set_debug_traps() is necessary in order to allow
 | 
			
		||||
 *  any breakpoints or error conditions to be properly intercepted and
 | 
			
		||||
 *  reported to gdb.  
 | 
			
		||||
 *
 | 
			
		||||
 *  Two, a breakpoint needs to be generated to begin communication.
 | 
			
		||||
 *  This is most easily accomplished by a call to breakpoint().
 | 
			
		||||
 *  breakpoint() simulates a breakpoint
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 *************
 | 
			
		||||
 *
 | 
			
		||||
 *    The following gdb commands are supported:
 | 
			
		||||
 *
 | 
			
		||||
 * command          function                               Return value
 | 
			
		||||
 *
 | 
			
		||||
 *    g             return the value of the CPU registers  hex data or ENN
 | 
			
		||||
 *    G             set the value of the CPU registers     OK or ENN
 | 
			
		||||
 *
 | 
			
		||||
 *    mAA..AA,LLLL  Read LLLL bytes at address AA..AA      hex data or ENN
 | 
			
		||||
 *    MAA..AA,LLLL: Write LLLL bytes at address AA.AA      OK or ENN
 | 
			
		||||
 *
 | 
			
		||||
 *    c             Resume at current address              SNN   ( signal NN)
 | 
			
		||||
 *    cAA..AA       Continue at address AA..AA             SNN
 | 
			
		||||
 *
 | 
			
		||||
 *    s             Step one instruction                   SNN
 | 
			
		||||
 *    sAA..AA       Step one instruction from AA..AA       SNN
 | 
			
		||||
 *
 | 
			
		||||
 *    k             kill
 | 
			
		||||
 *
 | 
			
		||||
 *    ?             What was the last sigval ?             SNN   (signal NN)
 | 
			
		||||
 *
 | 
			
		||||
 *    bBB..BB	    Set baud rate to BB..BB		   OK or BNN, then sets
 | 
			
		||||
 *							   baud rate
 | 
			
		||||
 *
 | 
			
		||||
 | 
			
		||||
 ************
 | 
			
		||||
 * All commands and responses are sent with a packet which includes a
 | 
			
		||||
 * checksum.  A packet consists of :
 | 
			
		||||
 *
 | 
			
		||||
 * $<packet info>#<checksum>.
 | 
			
		||||
 *
 | 
			
		||||
 * where
 | 
			
		||||
 * <packet info> :: <characters representing the command or response>
 | 
			
		||||
 * <checksum>    :: < two hex digits computed as modulo 256 sum of <packetinfo>>
 | 
			
		||||
 *
 | 
			
		||||
 * When a packet is received, it is first acknowledged with either '+' or '-'.
 | 
			
		||||
 * '+' indicates a successful transfer.  '-' indicates a failed transfer.
 | 
			
		||||
 *
 | 
			
		||||
 * Example:
 | 
			
		||||
 *
 | 
			
		||||
 * Host:                  Reply:
 | 
			
		||||
 * $m0,10#2a               +$00010203040506070809101112131415#42
 | 
			
		||||
 *
 | 
			
		||||
 ****************************************************************************/
 | 
			
		||||
#include <signal.h>
 | 
			
		||||
#include "hppa-defs.h"
 | 
			
		||||
 | 
			
		||||
/************************************************************************
 | 
			
		||||
 *
 | 
			
		||||
 * external low-level support
 | 
			
		||||
 */
 | 
			
		||||
#define	OPT_PDC_CACHE	     5
 | 
			
		||||
#define	OPT_PDC_ADD_VALID   12
 | 
			
		||||
#define PGZ_MEM_PDC	0x0388	/* location of PDC_ENTRY in memory    */
 | 
			
		||||
#define CALL_PDC	(*(int (*)())((int *)(*((int *)PGZ_MEM_PDC))))
 | 
			
		||||
 | 
			
		||||
extern putDebugChar();   /* write a single character      */
 | 
			
		||||
extern getDebugChar();   /* read and return a single char */
 | 
			
		||||
extern FICE();           /* flush i cache entry */
 | 
			
		||||
extern INLINE_BREAK();   /* break for user call */
 | 
			
		||||
 | 
			
		||||
#define RADDR_ALIGN(s,r) (s = ((unsigned int *) ((((int) r ) + 7 ) & 0xFFFFFFF8)))
 | 
			
		||||
 | 
			
		||||
/************************************************************************/
 | 
			
		||||
/* BUFMAX defines the maximum number of characters in inbound/outbound buffers*/
 | 
			
		||||
/* at least NUMREGBYTES*2 are needed for register packets */
 | 
			
		||||
 | 
			
		||||
#define BUFMAX 2048
 | 
			
		||||
 | 
			
		||||
#define NUMGPRS	  32
 | 
			
		||||
#define NUMSRS	   8
 | 
			
		||||
#define	NUMCRS	  32
 | 
			
		||||
#define	NUMSPCLS   3
 | 
			
		||||
#define	NUMFPRS	  32
 | 
			
		||||
 | 
			
		||||
#define NUMGPRBYTES	4
 | 
			
		||||
#define NUMSRBYTES	4
 | 
			
		||||
#define	NUMCRBYTES	4
 | 
			
		||||
#define	NUMSPCLBYTES	4
 | 
			
		||||
#define NUMFPRBYTES	8
 | 
			
		||||
 | 
			
		||||
/* Number of bytes of registers.  */
 | 
			
		||||
#define	NUMREGBYTES \
 | 
			
		||||
	(  (NUMGPRS * NUMGPRBYTES) \
 | 
			
		||||
         + (NUMSRS * NUMSRBYTES)   \
 | 
			
		||||
         + (NUMCRS * NUMCRBYTES)   \
 | 
			
		||||
	 + (NUMSPCLS * NUMSPCLBYTES) \
 | 
			
		||||
	 + (NUMFPRS * NUMFPRBYTES) \
 | 
			
		||||
        )
 | 
			
		||||
         
 | 
			
		||||
 | 
			
		||||
enum regnames   {GR0,  GR1,  GR2,  GR3,  GR4,  GR5,  GR6,  GR7,
 | 
			
		||||
		 GR8,  GR9,  GR10, GR11, GR12, GR13, GR14, GR15,
 | 
			
		||||
		 GR16, GR17, GR18, GR19, GR20, GR21, GR22, GR23,
 | 
			
		||||
		 GR24, GR25, GR26, GR27, GR28, GR29, GR30, GR31,
 | 
			
		||||
                 
 | 
			
		||||
                 SR0,  SR1,  SR2,  SR3,  SR4,  SR5,  SR6,  SR7,
 | 
			
		||||
 | 
			
		||||
                 CR0,  CR1,  CR2,  CR3,  CR4,  CR5,  CR6,  CR7,
 | 
			
		||||
		 CR8,  CR9,  CR10, CR11, CR12, CR13, CR14, CR15,
 | 
			
		||||
		 CR16, CR17H,CR18H,CR19, CR20, CR21, CR22, CR23,
 | 
			
		||||
		 CR24, CR25, CR26, CR27, CR28, CR29, CR30, CR31,
 | 
			
		||||
                 
 | 
			
		||||
                 CR17T,CR18T,CPUD0 };
 | 
			
		||||
 | 
			
		||||
enum fregnames  {FPR0,  FPR1,  FPR2,  FPR3,  FPR4,  FPR5,  FPR6,  FPR7,
 | 
			
		||||
		 FPR8,  FPR9,  FPR10, FPR11, FPR12, FPR13, FPR14, FPR15,
 | 
			
		||||
		 FPR16, FPR17, FPR18, FPR19, FPR20, FPR21, FPR22, FPR23,
 | 
			
		||||
		 FPR24, FPR25, FPR26, FPR27, FPR28, FPR29, FPR30, FPR31 };
 | 
			
		||||
 | 
			
		||||
#define PC  CR18H
 | 
			
		||||
#define NPC CR18T
 | 
			
		||||
#define SP  GR30
 | 
			
		||||
                
 | 
			
		||||
struct registers {
 | 
			
		||||
       int intregs[NUMGPRS + NUMSRS + NUMCRS + NUMSPCLS];
 | 
			
		||||
       int fpregs [NUMFPRS * 2];
 | 
			
		||||
                 };    
 | 
			
		||||
/* Global Variables */
 | 
			
		||||
 | 
			
		||||
static int initialized = 0;	/* !0 means we've been initialized */
 | 
			
		||||
static unsigned char hexchars[]="0123456789abcdef";
 | 
			
		||||
static unsigned char remcomInBuffer[BUFMAX];
 | 
			
		||||
static unsigned char remcomOutBuffer[BUFMAX];
 | 
			
		||||
static unsigned int  i_cache_params[6];
 | 
			
		||||
 | 
			
		||||
/* This table contains the mapping between PA hardware exception
 | 
			
		||||
   types, and signals, which are primarily what GDB understands.  It also
 | 
			
		||||
   indicates which hardware traps we need to commandeer when initializing
 | 
			
		||||
   the stub.
 | 
			
		||||
 | 
			
		||||
   The only two currently used are Recovery counter (single stepping)
 | 
			
		||||
   and Break trap ( break points ).
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
static struct hard_trap_info
 | 
			
		||||
{
 | 
			
		||||
  unsigned char tt;		/* Trap number for PA-RISC */
 | 
			
		||||
  unsigned char signo;		/* Signal that we map this trap into */
 | 
			
		||||
} hard_trap_info[] = {
 | 
			
		||||
/* 1  High priority machine check */
 | 
			
		||||
/* 2  Power failure interrupt*/
 | 
			
		||||
/* 3  Recovery counter -- init */
 | 
			
		||||
/* 4  External interrupt */
 | 
			
		||||
/* 5  Low priority machine check */
 | 
			
		||||
  {6, SIGSEGV},			/* Instruction TLB miss/page fault */
 | 
			
		||||
  {7, SIGSEGV},			/* Memory protection */
 | 
			
		||||
  {8, SIGILL},			/* Illegal instruction */
 | 
			
		||||
  {9, SIGTRAP},			/* Break instruction -- init */
 | 
			
		||||
  {10,SIGILL},			/* Privileged instruction */
 | 
			
		||||
  {11,SIGILL},			/* Privileged register */
 | 
			
		||||
  {12,SIGUSR1},			/* Overflow */
 | 
			
		||||
  {13,SIGUSR2},			/* Conditional */
 | 
			
		||||
  {14,SIGEMT},			/* Assist Exception */
 | 
			
		||||
  {15,SIGSEGV},			/* Data TLB miss/page fault */
 | 
			
		||||
  {16,SIGSEGV},			/* Non-access Instruction TLB miss */
 | 
			
		||||
  {17,SIGSEGV},			/* Non-access Data TLB miss/page fault */
 | 
			
		||||
  {18,SIGSEGV},			/* Data memory protection/ unaligned data reference */
 | 
			
		||||
  {19,SIGTRAP},			/* Data memory break */
 | 
			
		||||
  {20,SIGSEGV},			/* TLB dirty bit */
 | 
			
		||||
  {21,SIGSEGV},			/* Page reference */
 | 
			
		||||
  {22,SIGEMT},			/* Assist emulation */
 | 
			
		||||
  {23,SIGILL},			/* Higher-privilege */
 | 
			
		||||
  {24,SIGILL},			/* Lower-privilege */
 | 
			
		||||
  {25,SIGTRAP},			/* Taken branch */
 | 
			
		||||
  {0, 0}			/* Must be last */
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/* Functions */
 | 
			
		||||
/*========================================================================== */
 | 
			
		||||
 | 
			
		||||
/* Convert ch from a hex digit to an int */
 | 
			
		||||
 | 
			
		||||
static int
 | 
			
		||||
hex(ch)
 | 
			
		||||
     unsigned char ch;
 | 
			
		||||
{
 | 
			
		||||
  if (ch >= 'a' && ch <= 'f')
 | 
			
		||||
    return ch-'a'+10;
 | 
			
		||||
  if (ch >= '0' && ch <= '9')
 | 
			
		||||
    return ch-'0';
 | 
			
		||||
  if (ch >= 'A' && ch <= 'F')
 | 
			
		||||
    return ch-'A'+10;
 | 
			
		||||
  return -1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* scan for the sequence $<data>#<checksum>     */
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
getpacket(buffer)
 | 
			
		||||
     char *buffer;
 | 
			
		||||
{
 | 
			
		||||
  unsigned char checksum;
 | 
			
		||||
  unsigned char xmitcsum;
 | 
			
		||||
  int i;
 | 
			
		||||
  int count;
 | 
			
		||||
  unsigned char ch;
 | 
			
		||||
 | 
			
		||||
  do
 | 
			
		||||
    {
 | 
			
		||||
      /* wait around for the start character, ignore all other characters */
 | 
			
		||||
      strobe();
 | 
			
		||||
      while ((ch = getDebugChar()) != '$') ;
 | 
			
		||||
 | 
			
		||||
      checksum = 0;
 | 
			
		||||
      xmitcsum = -1;
 | 
			
		||||
 | 
			
		||||
      count = 0;
 | 
			
		||||
 | 
			
		||||
      /* now, read until a # or end of buffer is found */
 | 
			
		||||
      while (count < BUFMAX)
 | 
			
		||||
	{
 | 
			
		||||
	  ch = getDebugChar();
 | 
			
		||||
	  if (ch == '#')
 | 
			
		||||
	    break;
 | 
			
		||||
	  checksum = checksum + ch;
 | 
			
		||||
	  buffer[count] = ch;
 | 
			
		||||
	  count = count + 1;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
      if (count >= BUFMAX)
 | 
			
		||||
	continue;
 | 
			
		||||
 | 
			
		||||
      buffer[count] = 0;
 | 
			
		||||
 | 
			
		||||
      if (ch == '#')
 | 
			
		||||
	{
 | 
			
		||||
	  xmitcsum = hex(getDebugChar()) << 4;
 | 
			
		||||
	  xmitcsum |= hex(getDebugChar());
 | 
			
		||||
 | 
			
		||||
#if TESTING
 | 
			
		||||
	  /* Humans shouldn't have to figure out checksums to type to it. */
 | 
			
		||||
	  putDebugChar ('+');
 | 
			
		||||
	  return;
 | 
			
		||||
#endif
 | 
			
		||||
	  if (checksum != xmitcsum)
 | 
			
		||||
	    putDebugChar('-');	/* failed checksum */
 | 
			
		||||
	  else
 | 
			
		||||
	    {
 | 
			
		||||
	      putDebugChar('+'); /* successful transfer */
 | 
			
		||||
	      /* if a sequence char is present, reply the sequence ID */
 | 
			
		||||
	      if (buffer[2] == ':')
 | 
			
		||||
		{
 | 
			
		||||
		  putDebugChar(buffer[0]);
 | 
			
		||||
		  putDebugChar(buffer[1]);
 | 
			
		||||
		  /* remove sequence chars from buffer */
 | 
			
		||||
		  count = strlen(buffer);
 | 
			
		||||
		  for (i=3; i <= count; i++)
 | 
			
		||||
		    buffer[i-3] = buffer[i];
 | 
			
		||||
		}
 | 
			
		||||
	    }
 | 
			
		||||
	}
 | 
			
		||||
    }
 | 
			
		||||
  while (checksum != xmitcsum);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* send the packet in buffer.  */
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
putpacket(buffer)
 | 
			
		||||
     unsigned char *buffer;
 | 
			
		||||
{
 | 
			
		||||
  unsigned char checksum;
 | 
			
		||||
  int count;
 | 
			
		||||
  unsigned char ch;
 | 
			
		||||
 | 
			
		||||
  /*  $<packet info>#<checksum>. */
 | 
			
		||||
 | 
			
		||||
  do
 | 
			
		||||
    {
 | 
			
		||||
      putDebugChar('$');
 | 
			
		||||
      checksum = 0;
 | 
			
		||||
      count = 0;
 | 
			
		||||
 | 
			
		||||
      while (ch = buffer[count])
 | 
			
		||||
	{
 | 
			
		||||
	  if (! putDebugChar(ch))
 | 
			
		||||
	    return;
 | 
			
		||||
	  checksum += ch;
 | 
			
		||||
	  count += 1;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
      putDebugChar('#');
 | 
			
		||||
      putDebugChar(hexchars[checksum >> 4]);
 | 
			
		||||
      putDebugChar(hexchars[checksum & 0xf]);
 | 
			
		||||
      } while (getDebugChar() != '+');
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Convert the memory pointed to by mem into hex, placing result in buf.
 | 
			
		||||
 * Return a pointer to the last char put in buf (null), in case of mem fault,
 | 
			
		||||
 * return 0.
 | 
			
		||||
 * If MAY_FAULT is non-zero, then we will handle memory faults by returning
 | 
			
		||||
 * a 0, else treat a fault like any other fault in the stub.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
static unsigned char *
 | 
			
		||||
mem2hex(mem, buf, count, may_fault)
 | 
			
		||||
     unsigned char *mem;
 | 
			
		||||
     unsigned char *buf;
 | 
			
		||||
     int count;
 | 
			
		||||
     int may_fault;
 | 
			
		||||
{
 | 
			
		||||
  unsigned char ch;
 | 
			
		||||
  int           check_addr,
 | 
			
		||||
                new_addr;
 | 
			
		||||
 | 
			
		||||
  check_addr = 0;
 | 
			
		||||
 | 
			
		||||
  while (count-- > 0)
 | 
			
		||||
    {
 | 
			
		||||
      if (may_fault)
 | 
			
		||||
      { new_addr = ((int) (mem+3)) & 0xFFFFFFF8;
 | 
			
		||||
        if (new_addr != check_addr)
 | 
			
		||||
        { check_addr = new_addr;
 | 
			
		||||
          if (pdc_call(OPT_PDC_ADD_VALID,0,check_addr)) return 0;
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
      ch = *mem++;
 | 
			
		||||
      *buf++ = hexchars[ch >> 4];
 | 
			
		||||
      *buf++ = hexchars[ch & 0xf];
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  *buf = 0;
 | 
			
		||||
 | 
			
		||||
  return buf;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* convert the hex array pointed to by buf into binary to be placed in mem
 | 
			
		||||
 * return a pointer to the character AFTER the last byte written */
 | 
			
		||||
 | 
			
		||||
static unsigned char *
 | 
			
		||||
hex2mem(buf, mem, count, may_fault)
 | 
			
		||||
     unsigned char *buf;
 | 
			
		||||
     unsigned char *mem;
 | 
			
		||||
     int count;
 | 
			
		||||
     int may_fault;
 | 
			
		||||
{
 | 
			
		||||
  int          i;
 | 
			
		||||
  unsigned int ch;
 | 
			
		||||
  int          check_addr,
 | 
			
		||||
               new_addr;
 | 
			
		||||
 | 
			
		||||
  check_addr = 0;
 | 
			
		||||
 | 
			
		||||
  for (i=0; i<count; i++)
 | 
			
		||||
    {
 | 
			
		||||
      ch = hex(*buf++) << 4;
 | 
			
		||||
      ch |= hex(*buf++);
 | 
			
		||||
      if (may_fault)
 | 
			
		||||
      { new_addr = ((int)(mem+3)) & 0xFFFFFFF8;
 | 
			
		||||
        if (new_addr != check_addr)
 | 
			
		||||
        { check_addr = new_addr;
 | 
			
		||||
          if (pdc_call(OPT_PDC_ADD_VALID,0,check_addr)) return 0;
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
      *mem++ = ch;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  return mem;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Set up exception handlers for traceing and breakpoints */
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
set_debug_traps()
 | 
			
		||||
{ 
 | 
			
		||||
  unsigned int	R_addr[33];
 | 
			
		||||
  unsigned int	*Raddr_ptr;
 | 
			
		||||
  
 | 
			
		||||
  setup_vectors();
 | 
			
		||||
 
 | 
			
		||||
  /* get cache params for use by flush_i_cache */
 | 
			
		||||
  RADDR_ALIGN(Raddr_ptr,R_addr);
 | 
			
		||||
 | 
			
		||||
  if (pdc_call(OPT_PDC_CACHE,0,Raddr_ptr,0))
 | 
			
		||||
    i_cache_params[0] = -1;
 | 
			
		||||
  else
 | 
			
		||||
    i_cache_params[0] = R_addr[0];
 | 
			
		||||
 | 
			
		||||
  i_cache_params[1] = Raddr_ptr[1];
 | 
			
		||||
  i_cache_params[2] = Raddr_ptr[2];
 | 
			
		||||
  i_cache_params[3] = Raddr_ptr[3];
 | 
			
		||||
  i_cache_params[4] = Raddr_ptr[4];
 | 
			
		||||
  i_cache_params[5] = Raddr_ptr[5];
 | 
			
		||||
 | 
			
		||||
  /* In case GDB is started before us, ack any packets (presumably
 | 
			
		||||
     "$?#xx") sitting there.  */
 | 
			
		||||
 | 
			
		||||
  putDebugChar ('+');
 | 
			
		||||
 | 
			
		||||
  initialized = 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/* Convert the PA-RISC hardware trap number to a unix signal number. */
 | 
			
		||||
 | 
			
		||||
static int
 | 
			
		||||
computeSignal(tt)
 | 
			
		||||
     int tt;
 | 
			
		||||
{
 | 
			
		||||
  struct hard_trap_info *ht;
 | 
			
		||||
 | 
			
		||||
  for (ht = hard_trap_info; ht->tt && ht->signo; ht++)
 | 
			
		||||
    if (ht->tt == tt)
 | 
			
		||||
      return ht->signo;
 | 
			
		||||
 | 
			
		||||
  return SIGHUP;		/* default for things we don't know about */
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * While we find nice hex chars, build an int.
 | 
			
		||||
 * Return number of chars processed.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
static int
 | 
			
		||||
hexToInt(ptr, intValue)
 | 
			
		||||
     unsigned char **ptr;
 | 
			
		||||
     int *intValue;
 | 
			
		||||
{
 | 
			
		||||
  int numChars = 0;
 | 
			
		||||
  int hexValue;
 | 
			
		||||
 | 
			
		||||
  *intValue = 0;
 | 
			
		||||
 | 
			
		||||
  while (**ptr)
 | 
			
		||||
    {
 | 
			
		||||
      hexValue = hex(**ptr);
 | 
			
		||||
      if (hexValue < 0)
 | 
			
		||||
	break;
 | 
			
		||||
 | 
			
		||||
      *intValue = (*intValue << 4) | hexValue;
 | 
			
		||||
      numChars ++;
 | 
			
		||||
 | 
			
		||||
      (*ptr)++;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  return (numChars);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
flush_i_cache()
 | 
			
		||||
 | 
			
		||||
{
 | 
			
		||||
  unsigned int addr,count,loop;
 | 
			
		||||
 | 
			
		||||
  if (i_cache_params[0] <= 0) return;
 | 
			
		||||
 | 
			
		||||
  addr = i_cache_params[2];
 | 
			
		||||
  for (count = 0; count < i_cache_params[4]; count++)
 | 
			
		||||
    { for ( loop = 0; loop < i_cache_params[5]; loop++) FICE(addr);
 | 
			
		||||
      addr = addr + i_cache_params[3];
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * This function does all command procesing for interfacing to gdb.
 | 
			
		||||
   return of 0 will execute DEBUG_GO (continue)
 | 
			
		||||
   return of 1 will execute DEBUG_SS (single step)
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
int
 | 
			
		||||
handle_exception (registers,tt)
 | 
			
		||||
  unsigned long *registers;
 | 
			
		||||
  int  tt;			/* Trap type */
 | 
			
		||||
{
 | 
			
		||||
  int sigval;
 | 
			
		||||
  int addr;
 | 
			
		||||
  int length;
 | 
			
		||||
  unsigned char *ptr;
 | 
			
		||||
 | 
			
		||||
  /* reply to host that an exception has occurred */
 | 
			
		||||
  sigval = computeSignal(tt);
 | 
			
		||||
  ptr = remcomOutBuffer;
 | 
			
		||||
 | 
			
		||||
  *ptr++ = 'T';
 | 
			
		||||
  *ptr++ = hexchars[sigval >> 4];
 | 
			
		||||
  *ptr++ = hexchars[sigval & 0xf];
 | 
			
		||||
 | 
			
		||||
/* could be lots of stuff here like PC and SP registers */
 | 
			
		||||
 | 
			
		||||
  *ptr++ = 0;
 | 
			
		||||
 | 
			
		||||
  putpacket(remcomOutBuffer);
 | 
			
		||||
 | 
			
		||||
  while (1)
 | 
			
		||||
    {
 | 
			
		||||
      remcomOutBuffer[0] = 0;
 | 
			
		||||
 | 
			
		||||
      getpacket(remcomInBuffer);
 | 
			
		||||
      switch (remcomInBuffer[0])
 | 
			
		||||
	{
 | 
			
		||||
	case '?':
 | 
			
		||||
	  remcomOutBuffer[0] = 'S';
 | 
			
		||||
	  remcomOutBuffer[1] = hexchars[sigval >> 4];
 | 
			
		||||
	  remcomOutBuffer[2] = hexchars[sigval & 0xf];
 | 
			
		||||
	  remcomOutBuffer[3] = 0;
 | 
			
		||||
	  break;
 | 
			
		||||
 | 
			
		||||
	case 'd':
 | 
			
		||||
	  /* toggle debug flag */
 | 
			
		||||
	  led_putnum (16);
 | 
			
		||||
	  break;
 | 
			
		||||
 | 
			
		||||
	case 'g':		/* return the value of the CPU registers */
 | 
			
		||||
	  {
 | 
			
		||||
	    ptr = remcomOutBuffer;
 | 
			
		||||
            /* GR0..GR31 SR0..SR7 CR0..CR31 specials */
 | 
			
		||||
	    ptr = mem2hex((char *)registers, ptr, NUMREGBYTES, 0);
 | 
			
		||||
            /* need to add floating point registers */
 | 
			
		||||
	  }
 | 
			
		||||
	  break;
 | 
			
		||||
 | 
			
		||||
	case 'G':	   /* set the value of the CPU registers - return OK */
 | 
			
		||||
	  {
 | 
			
		||||
	    ptr = &remcomInBuffer[1];
 | 
			
		||||
            /* GR0..GR31 SR0..SR7 CR0..CR31 specials */
 | 
			
		||||
	    hex2mem(ptr, (char *)registers, NUMREGBYTES, 0);
 | 
			
		||||
	    strcpy(remcomOutBuffer,"OK 1");
 | 
			
		||||
	  }
 | 
			
		||||
	  break;
 | 
			
		||||
 | 
			
		||||
	case 'm':	  /* mAA..AA,LLLL  Read LLLL bytes at address AA..AA */
 | 
			
		||||
	  /* Try to read %x,%x.  */
 | 
			
		||||
 | 
			
		||||
	  ptr = &remcomInBuffer[1];
 | 
			
		||||
 | 
			
		||||
	  if (hexToInt(&ptr, &addr)
 | 
			
		||||
	      && *ptr++ == ','
 | 
			
		||||
	      && hexToInt(&ptr, &length))
 | 
			
		||||
	    {
 | 
			
		||||
	      if (mem2hex((char *)addr, remcomOutBuffer, length, 1))
 | 
			
		||||
		break;
 | 
			
		||||
 | 
			
		||||
	      strcpy (remcomOutBuffer, "E03");
 | 
			
		||||
	    }
 | 
			
		||||
	  else
 | 
			
		||||
	    strcpy(remcomOutBuffer,"E01");
 | 
			
		||||
	  break;
 | 
			
		||||
 | 
			
		||||
	case 'M': /* MAA..AA,LLLL: Write LLLL bytes at address AA.AA return OK */
 | 
			
		||||
	  /* Try to read '%x,%x:'.  */
 | 
			
		||||
 | 
			
		||||
	  ptr = &remcomInBuffer[1];
 | 
			
		||||
 | 
			
		||||
	  if (hexToInt(&ptr, &addr)
 | 
			
		||||
	      && *ptr++ == ','
 | 
			
		||||
	      && hexToInt(&ptr, &length)
 | 
			
		||||
	      && *ptr++ == ':')
 | 
			
		||||
	    {
 | 
			
		||||
	      if (hex2mem(ptr, (char *)addr, length, 1))
 | 
			
		||||
		strcpy(remcomOutBuffer, "OK");
 | 
			
		||||
	      else
 | 
			
		||||
		strcpy(remcomOutBuffer, "E03");
 | 
			
		||||
	    }
 | 
			
		||||
	  else
 | 
			
		||||
	    strcpy(remcomOutBuffer, "E02");
 | 
			
		||||
	  break;
 | 
			
		||||
 | 
			
		||||
	case 'c':    /* cAA..AA    Continue at address AA..AA(optional) */
 | 
			
		||||
	  /* try to read optional parameter, pc unchanged if no parm */
 | 
			
		||||
 | 
			
		||||
	  ptr = &remcomInBuffer[1];
 | 
			
		||||
	  if (hexToInt(&ptr, &addr))
 | 
			
		||||
	    {
 | 
			
		||||
	      registers[PC] = addr;
 | 
			
		||||
	      registers[NPC] = addr + 4;
 | 
			
		||||
	    }
 | 
			
		||||
 | 
			
		||||
/* Need to flush the instruction cache here, as we may have deposited a
 | 
			
		||||
   breakpoint, and the icache probably has no way of knowing that a data ref to
 | 
			
		||||
   some location may have changed something that is in the instruction cache.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
	  flush_i_cache();
 | 
			
		||||
	  return 0;		/* execute GO */
 | 
			
		||||
 | 
			
		||||
	  /* kill the program */
 | 
			
		||||
	case 'k' :		/* do nothing */
 | 
			
		||||
	  break;
 | 
			
		||||
 | 
			
		||||
        case 's' :              /* single step */
 | 
			
		||||
	  /* try to read optional parameter, pc unchanged if no parm */
 | 
			
		||||
 | 
			
		||||
	  ptr = &remcomInBuffer[1];
 | 
			
		||||
	  if (hexToInt(&ptr, &addr))
 | 
			
		||||
	    {
 | 
			
		||||
	      registers[PC] = addr;
 | 
			
		||||
	      registers[NPC] = addr + 4;
 | 
			
		||||
	    }
 | 
			
		||||
/* Need to flush the instruction cache here, as we may have deposited a
 | 
			
		||||
   breakpoint, and the icache probably has no way of knowing that a data ref to
 | 
			
		||||
   some location may have changed something that is in the instruction cache.
 | 
			
		||||
 */
 | 
			
		||||
	  flush_i_cache();
 | 
			
		||||
	  return 1;		/* execute Single Step */
 | 
			
		||||
          break;
 | 
			
		||||
 | 
			
		||||
#if TESTING1
 | 
			
		||||
	case 't':		/* Test feature */
 | 
			
		||||
	  break;
 | 
			
		||||
#endif
 | 
			
		||||
	case 'r':		/* Reset */
 | 
			
		||||
	  break;
 | 
			
		||||
 | 
			
		||||
#if TESTING2
 | 
			
		||||
Disabled until we can unscrew this properly
 | 
			
		||||
 | 
			
		||||
	case 'b':	  /* bBB...  Set baud rate to BB... */
 | 
			
		||||
	  {
 | 
			
		||||
	    int baudrate;
 | 
			
		||||
	    extern void set_timer_3();
 | 
			
		||||
 | 
			
		||||
	    ptr = &remcomInBuffer[1];
 | 
			
		||||
	    if (!hexToInt(&ptr, &baudrate))
 | 
			
		||||
	      {
 | 
			
		||||
		strcpy(remcomOutBuffer,"B01");
 | 
			
		||||
		break;
 | 
			
		||||
	      }
 | 
			
		||||
 | 
			
		||||
	    /* Convert baud rate to uart clock divider */
 | 
			
		||||
	    switch (baudrate)
 | 
			
		||||
	      {
 | 
			
		||||
	      case 38400:
 | 
			
		||||
		baudrate = 16;
 | 
			
		||||
		break;
 | 
			
		||||
	      case 19200:
 | 
			
		||||
		baudrate = 33;
 | 
			
		||||
		break;
 | 
			
		||||
	      case 9600:
 | 
			
		||||
		baudrate = 65;
 | 
			
		||||
		break;
 | 
			
		||||
	      default:
 | 
			
		||||
		strcpy(remcomOutBuffer,"B02");
 | 
			
		||||
		goto x1;
 | 
			
		||||
	      }
 | 
			
		||||
 | 
			
		||||
	    putpacket("OK 2");	/* Ack before changing speed */
 | 
			
		||||
	    set_timer_3(baudrate); /* Set it */
 | 
			
		||||
	  }
 | 
			
		||||
x1:	  break;
 | 
			
		||||
#endif
 | 
			
		||||
	}			/* switch */
 | 
			
		||||
 | 
			
		||||
      /* reply to the request */
 | 
			
		||||
      putpacket(remcomOutBuffer);
 | 
			
		||||
    }
 | 
			
		||||
  print ("\r\nEscaped handle_exception\r\n");
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										47
									
								
								libgloss/hp74x/test.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										47
									
								
								libgloss/hp74x/test.c
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,47 @@
 | 
			
		||||
extern int led_putnum();
 | 
			
		||||
#define DELAY 900000
 | 
			
		||||
extern char strobe(),putDebugChar(),print(),putnum(); 
 | 
			
		||||
extern char foobar();
 | 
			
		||||
extern char breakpoint();
 | 
			
		||||
 | 
			
		||||
#define TESTSTUB 1
 | 
			
		||||
 | 
			
		||||
main()
 | 
			
		||||
{
 | 
			
		||||
  unsigned char x;
 | 
			
		||||
  char buf[20];
 | 
			
		||||
 | 
			
		||||
#if TESTIO
 | 
			
		||||
  strobe();
 | 
			
		||||
  outbyte ('\n');
 | 
			
		||||
  outbyte ('$');
 | 
			
		||||
  write (2, "Enter 5 characters... ", 24);
 | 
			
		||||
  read (0, buf, 5);
 | 
			
		||||
  print (buf);
 | 
			
		||||
  print ("\r\n");
 | 
			
		||||
  strobe ();
 | 
			
		||||
#endif
 | 
			
		||||
  
 | 
			
		||||
#if TESTSTUB
 | 
			
		||||
  print ("\r\nInit vectors...\r\n");
 | 
			
		||||
/***  set_debug_traps(); ***/
 | 
			
		||||
  print ("\r\nSet a breakpoint...\r\n");
 | 
			
		||||
  handle_exception();
 | 
			
		||||
/***  breakpoint(); ***/
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
  print ("\r\nTest foobar\r\n");
 | 
			
		||||
  foobar();
 | 
			
		||||
  /* whew, we made it */
 | 
			
		||||
  print ("\r\nDone...");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * FIXME: this is only hear so things will link.
 | 
			
		||||
 */	
 | 
			
		||||
int
 | 
			
		||||
puts(s)
 | 
			
		||||
     char *s;
 | 
			
		||||
{
 | 
			
		||||
  s++;
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user