mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-01-20 05:19:21 +08:00
2002-11-12 Jeff Johnston <jjohnstn@redhat.com>
* mips/Makefile.in: Add cygmon support. * mips/configure.in: Ditto. * mips/configure: Regenerated. * mips/crt0_cygmon.S: New file. * mips/cygmon.c: Ditto. * mips/pmon.S: Minor formatting and copyright changes. * mips/crt0.S: Ditto.
This commit is contained in:
parent
944772c70a
commit
2d210c7fd1
@ -1,3 +1,13 @@
|
||||
2002-11-12 Jeff Johnston <jjohnstn@redhat.com>
|
||||
|
||||
* mips/Makefile.in: Add cygmon support.
|
||||
* mips/configure.in: Ditto.
|
||||
* mips/configure: Regenerated.
|
||||
* mips/crt0_cygmon.S: New file.
|
||||
* mips/cygmon.c: Ditto.
|
||||
* mips/pmon.S: Minor formatting and copyright changes.
|
||||
* mips/crt0.S: Ditto.
|
||||
|
||||
2002-11-08 Jeff Johnston <jjohnstn@redhat.com>
|
||||
|
||||
* arm/Makefile.in: Add support for new pid specs.
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Copyright (c) 1995, 1996, 1997, 1998, 1999 Cygnus Support
|
||||
# Copyright (c) 1995, 1996, 1997, 1998, 1999, 2000 Cygnus Support
|
||||
#
|
||||
# The authors hereby grant permission to use, copy, modify, distribute,
|
||||
# and license this software and its documentation for any purpose, provided
|
||||
@ -75,6 +75,7 @@ DVEOBJS = dvemon.o @part_specific_obj@ ${GENOBJS} ${GENOBJS2}
|
||||
JMR3904OBJS = jmr3904-io.o @part_specific_obj@ ${GENOBJS} ${GENOBJS2}
|
||||
CFEOBJS = cfe.o cfe_api.o cfe_prestart.o \
|
||||
@part_specific_obj@ ${GENOBJS} ${GENOBJS2}
|
||||
CYGMONOBJS = open.o close.o cygmon.o @part_specific_obj@ ${GENOBJS}
|
||||
|
||||
# Nullmon cannot support read and write, but the test cases pull them in via libs
|
||||
NULLMONOBJS = nullmon.o @part_specific_obj@ ${GENOBJS}
|
||||
@ -131,6 +132,11 @@ libjmr3904.a: $(JMR3904OBJS)
|
||||
${AR} ${ARFLAGS} $@ $(JMR3904OBJS)
|
||||
${RANLIB} $@
|
||||
|
||||
libcygmon.a: $(CYGMONOBJS)
|
||||
${AR} ${ARFLAGS} $@ $(CYGMONOBJS)
|
||||
${RANLIB} $@
|
||||
|
||||
|
||||
libcfe.a: $(CFEOBJS)
|
||||
${AR} ${ARFLAGS} $@ $(CFEOBJS)
|
||||
${RANLIB} $@
|
||||
@ -196,17 +202,11 @@ distclean maintainer-clean realclean: clean
|
||||
|
||||
.PHONY: install info install-info clean-info
|
||||
install:
|
||||
if test "x$(CRT0)" != x ; then \
|
||||
$(INSTALL_PROGRAM) $(CRT0) $(tooldir)/lib${MULTISUBDIR}/$(CRT0) ; \
|
||||
fi
|
||||
if test "x$(PCRT0)" != x ; then \
|
||||
$(INSTALL_PROGRAM) $(PCRT0) $(tooldir)/lib${MULTISUBDIR}/$(PCRT0) ; \
|
||||
fi
|
||||
@for bsp in ${BSP}; do\
|
||||
$(INSTALL_PROGRAM) $${bsp} $(tooldir)/lib${MULTISUBDIR}; \
|
||||
@for file in $(CRT0) $(PCRT0) $(BSP); do \
|
||||
$(INSTALL_DATA) $${file} $(tooldir)/lib${MULTISUBDIR}; \
|
||||
done
|
||||
@for script in ${SCRIPTS}; do\
|
||||
$(INSTALL_DATA) ${srcdir}/$${script}.ld $(tooldir)/lib${MULTISUBDIR}/$${script}.ld; \
|
||||
$(INSTALL_DATA) ${srcdir}/$${script}.ld $(tooldir)/lib${MULTISUBDIR}/$${script}.ld; \
|
||||
done
|
||||
|
||||
info:
|
||||
@ -219,6 +219,7 @@ test.o: ${srcdir}/test.c
|
||||
crt0.o: ${srcdir}/crt0.S
|
||||
pcrt0.o: ${srcdir}/crt0.S
|
||||
$(CC) -c $(CFLAGS_FOR_TARGET) $(CFLAGS) -DGCRT0 ${srcdir}/crt0.S -o ${PCRT0}
|
||||
crt0_cygmon.o: ${srcdir}/crt0_cygmon.S
|
||||
idtmon.o: ${srcdir}/idtmon.S
|
||||
pmon.o: ${srcdir}/pmon.S
|
||||
$(CC) -c $(CFLAGS_FOR_TARGET) $(CFLAGS) $(PART_SPECIFIC_DEFINES) ${srcdir}/pmon.S -o pmon.o
|
||||
|
14
libgloss/mips/configure
vendored
14
libgloss/mips/configure
vendored
@ -928,6 +928,14 @@ case "${target}" in
|
||||
script_list="dve idt jmr3904app jmr3904dram jmr3904dram-java jmr3904app-java"
|
||||
bsp_list="libdve.a libidt.a libjmr3904.a"
|
||||
;;
|
||||
mipsisa32-*-*)
|
||||
crt0="crt0_cygmon.o crt0.o"
|
||||
pcrt0="pcrt0.o"
|
||||
part_specific_obj=
|
||||
part_specific_defines=
|
||||
script_list="idt32 idt64 cfe"
|
||||
bsp_list="libcygmon.a libidt.a libcfe.a"
|
||||
;;
|
||||
mips*-lsi*-*)
|
||||
part_specific_obj=entry.o
|
||||
part_specific_defines=
|
||||
@ -940,12 +948,6 @@ case "${target}" in
|
||||
script_list="idt pmon ddb ddb-kseg0 lsi idtecoff nullmon"
|
||||
bsp_list="libidt.a libpmon.a liblsi.a libnullmon.a"
|
||||
;;
|
||||
mipsisa32*-*-*)
|
||||
part_specific_obj=
|
||||
part_specific_defines=
|
||||
script_list="idt32 idt64 cfe"
|
||||
bsp_list="libidt.a libcfe.a"
|
||||
;;
|
||||
*)
|
||||
part_specific_obj="vr4300.o cma101.o"
|
||||
part_specific_defines=
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Copyright (c) 1995, 1996, 1997, 1998, 1999 Cygnus Support
|
||||
# Copyright (c) 1995, 1996, 1997, 1998, 1999, 2000, 2002 Cygnus Support
|
||||
#
|
||||
# The authors hereby grant permission to use, copy, modify, distribute,
|
||||
# and license this software and its documentation for any purpose, provided
|
||||
@ -92,6 +92,14 @@ case "${target}" in
|
||||
script_list="dve idt jmr3904app jmr3904dram jmr3904dram-java jmr3904app-java"
|
||||
bsp_list="libdve.a libidt.a libjmr3904.a"
|
||||
;;
|
||||
mipsisa32-*-*)
|
||||
crt0="crt0_cygmon.o crt0.o"
|
||||
pcrt0="pcrt0.o"
|
||||
part_specific_obj=
|
||||
part_specific_defines=
|
||||
script_list="idt32 idt64 cfe"
|
||||
bsp_list="libcygmon.a libidt.a libcfe.a"
|
||||
;;
|
||||
mips*-lsi*-*)
|
||||
part_specific_obj=entry.o
|
||||
part_specific_defines=
|
||||
@ -104,12 +112,6 @@ case "${target}" in
|
||||
script_list="idt pmon ddb ddb-kseg0 lsi idtecoff nullmon"
|
||||
bsp_list="libidt.a libpmon.a liblsi.a libnullmon.a"
|
||||
;;
|
||||
mipsisa32*-*-*)
|
||||
part_specific_obj=
|
||||
part_specific_defines=
|
||||
script_list="idt32 idt64 cfe"
|
||||
bsp_list="libidt.a libcfe.a"
|
||||
;;
|
||||
*)
|
||||
part_specific_obj="vr4300.o cma101.o"
|
||||
part_specific_defines=
|
||||
|
@ -37,9 +37,9 @@
|
||||
# else
|
||||
# define LA(t,x) la t,x-PICBASE ; addu t,s0,t
|
||||
# endif
|
||||
#else /* __mips_embedded_pic */
|
||||
#else /* __mips_embedded_pic */
|
||||
# define LA(t,x) la t,x
|
||||
#endif /* __mips_embedded_pic */
|
||||
#endif /* __mips_embedded_pic */
|
||||
|
||||
.comm __memsize, 12
|
||||
.comm __lstack, STARTUP_STACK_SIZE
|
||||
@ -116,7 +116,7 @@ _start:
|
||||
2:
|
||||
|
||||
|
||||
/* Fix high bits, if any, of the PC so that exception handling
|
||||
/* Fix high bits, if any, of the PC so that exception handling
|
||||
doesn't get confused. */
|
||||
LA (v0, 3f)
|
||||
jr v0
|
||||
@ -161,7 +161,7 @@ zerobss:
|
||||
case main wants to write them back to the stack. The caller is
|
||||
supposed to allocate stack space for parameters in registers in
|
||||
the old MIPS ABIs. We must do this even though we aren't passing
|
||||
arguments, because main might be declared to have them.
|
||||
arguments, because main might be declared to have them.
|
||||
|
||||
Some ports need a larger alignment for the stack, so we subtract
|
||||
32, which satisifes the stack for the arguments and keeps the
|
||||
@ -209,6 +209,7 @@ init:
|
||||
nop
|
||||
#endif
|
||||
|
||||
|
||||
jal _init # run global constructors
|
||||
nop
|
||||
|
||||
@ -222,6 +223,7 @@ init:
|
||||
move a0,v0 # pass through the exit code
|
||||
.end init
|
||||
|
||||
|
||||
/* Assume the PICBASE set up above is no longer valid below here. */
|
||||
#ifdef __mips_embedded_pic
|
||||
#undef PICBASE
|
||||
@ -263,11 +265,10 @@ _exit:
|
||||
|
||||
# break instruction can cope with 0xfffff, but GAS limits the range:
|
||||
break 1023
|
||||
nop
|
||||
b 7b # but loop back just in-case
|
||||
nop
|
||||
.end _exit
|
||||
|
||||
|
||||
/* Assume the PICBASE set up above is no longer valid below here. */
|
||||
#ifdef __mips_embedded_pic
|
||||
#undef PICBASE
|
||||
|
173
libgloss/mips/crt0_cygmon.S
Normal file
173
libgloss/mips/crt0_cygmon.S
Normal file
@ -0,0 +1,173 @@
|
||||
/*
|
||||
* crt0_cygmon.S -- Minimal startup file for MIPS targets running Cygmon.
|
||||
*
|
||||
* Copyright (c) 1995, 1996, 1997, 2000 Red Hat, Inc.
|
||||
*
|
||||
* The authors hereby grant permission to use, copy, modify, distribute,
|
||||
* and license this software and its documentation for any purpose, provided
|
||||
* that existing copyright notices are retained in all copies and that this
|
||||
* notice is included verbatim in any distributions. No written agreement,
|
||||
* license, or royalty fee is required for any of the authorized uses.
|
||||
* Modifications to this software may be copyrighted by their authors
|
||||
* and need not follow the licensing terms described here, provided that
|
||||
* the new terms are clearly indicated on the first page of each file where
|
||||
* they apply.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file contains the minimal startup code necessary.
|
||||
* This will not do any hardware initialization. It is assumed that we are talking to Cygmon
|
||||
* and therefore the hardware will be initialized properly.
|
||||
*/
|
||||
|
||||
#ifdef __mips16
|
||||
/* This file contains 32 bit assembly code. */
|
||||
.set nomips16
|
||||
#endif
|
||||
|
||||
#include "regs.S"
|
||||
|
||||
/*
|
||||
* Set up some room for a stack. We just grab a chunk of memory.
|
||||
*/
|
||||
#define STACK_SIZE 0x4000
|
||||
#define GLOBAL_SIZE 0x2000
|
||||
|
||||
#define STARTUP_STACK_SIZE 0x0100
|
||||
|
||||
.comm __memsize, 12
|
||||
.comm __lstack, STARTUP_STACK_SIZE
|
||||
.comm __stackbase,4
|
||||
|
||||
.text
|
||||
.align 4
|
||||
/*
|
||||
* Without the following nop, GDB thinks _start is a data variable.
|
||||
* This is probably a bug in GDB in handling a symbol that is at the
|
||||
* start of the .text section.
|
||||
*/
|
||||
nop
|
||||
|
||||
.globl _start
|
||||
.ent _start
|
||||
_start:
|
||||
.set noreorder
|
||||
la gp, _gp # set the global data pointer, defined in the linker script
|
||||
.end _start
|
||||
|
||||
/*
|
||||
* zero out the bss section.
|
||||
*/
|
||||
.globl __memsize
|
||||
.globl get_mem_info .text
|
||||
.globl zerobss
|
||||
.ent zerobss
|
||||
zerobss:
|
||||
la v0, _fbss # These variables are defined in the linker script
|
||||
la v1, _end
|
||||
|
||||
3:
|
||||
sw zero, 0(v0)
|
||||
bltu v0, v1, 3b
|
||||
addiu v0, v0, 4 # executed in delay slot
|
||||
|
||||
/*
|
||||
* Setup a small stack so we can run some C code,
|
||||
* and get the usable memory size.
|
||||
*/
|
||||
la t0, __lstack
|
||||
addiu sp, t0, STARTUP_STACK_SIZE
|
||||
la a0, __memsize
|
||||
jal get_mem_info
|
||||
nop
|
||||
|
||||
/*
|
||||
* Setup the stack pointer --
|
||||
* get_mem_info returns the top of memory, so just use that In
|
||||
* addition, we must subtract 24 bytes for the 3 8 byte
|
||||
* arguments to main, in case main wants to write them back to
|
||||
* the stack. The caller is supposed to allocate stack space
|
||||
* for parameters in registers in the old MIPS ABIs. We must
|
||||
* do this even though we aren't passing arguments, because
|
||||
* main might be declared to have them.
|
||||
* Some ports need a larger alignment for the stack, so we
|
||||
* subtract 32, which satisifes the stack for the arguments and
|
||||
* keeps the stack pointer better aligned.
|
||||
*/
|
||||
subu v0, v0, 32
|
||||
move sp, v0
|
||||
|
||||
sw sp, __stackbase # keep this for future ref
|
||||
.end zerobss
|
||||
|
||||
/*
|
||||
* initialize target specific stuff. Only execute these
|
||||
* functions it they exist.
|
||||
*/
|
||||
.globl hardware_init_hook .text
|
||||
.globl software_init_hook .text
|
||||
.globl __do_global_dtors .text
|
||||
.globl atexit .text
|
||||
.globl exit .text
|
||||
.globl init
|
||||
.ent init
|
||||
init:
|
||||
la t9, hardware_init_hook # init the hardware if needed
|
||||
beq t9, zero, 6f
|
||||
nop
|
||||
jal t9
|
||||
nop
|
||||
6:
|
||||
la t9, software_init_hook # init the software if needed
|
||||
beq t9, zero, 7f
|
||||
nop
|
||||
jal t9
|
||||
nop
|
||||
7:
|
||||
la a0, __do_global_dtors
|
||||
jal atexit
|
||||
nop
|
||||
|
||||
#ifdef GCRT0
|
||||
.globl _ftext
|
||||
.globl _extext
|
||||
la a0, _ftext
|
||||
la a1, _etext
|
||||
jal monstartup
|
||||
nop
|
||||
#endif
|
||||
|
||||
move a0,zero # set argc to 0
|
||||
jal main # call the program start function
|
||||
nop
|
||||
|
||||
# fall through to the "exit" routine
|
||||
jal exit # call libc exit to run the G++
|
||||
# destructors
|
||||
move a0, v0 # pass through the exit code
|
||||
.end init
|
||||
|
||||
/*
|
||||
* _exit -- Exit from the application. Normally we cause a user trap
|
||||
* to return to the ROM monitor for another run. NOTE: This is
|
||||
* the only other routine we provide in the crt0.o object, since
|
||||
* it may be tied to the "_start" routine. It also allows
|
||||
* executables that contain a complete world to be linked with
|
||||
* just the crt0.o object.
|
||||
*/
|
||||
.globl _exit
|
||||
.ent _exit
|
||||
_exit:
|
||||
7:
|
||||
#ifdef GCRT0
|
||||
jal _mcleanup
|
||||
nop
|
||||
#endif
|
||||
# Cygmon expects a break 5
|
||||
break 5
|
||||
nop
|
||||
b 7b # loop back just in-case
|
||||
nop
|
||||
.end _exit
|
||||
|
||||
/* EOF crt0.S */
|
87
libgloss/mips/cygmon.c
Normal file
87
libgloss/mips/cygmon.c
Normal file
@ -0,0 +1,87 @@
|
||||
/* cygmon.c -- Glue code for linking apps to run on top of Cygmon.
|
||||
*
|
||||
* Copyright (c) 1998, 1999, 2000 Red Hat, Inc.
|
||||
*
|
||||
* The authors hereby grant permission to use, copy, modify, distribute,
|
||||
* and license this software and its documentation for any purpose, provided
|
||||
* that existing copyright notices are retained in all copies and that this
|
||||
* notice is included verbatim in any distributions. No written agreement,
|
||||
* license, or royalty fee is required for any of the authorized uses.
|
||||
* Modifications to this software may be copyrighted by their authors
|
||||
* and need not follow the licensing terms described here, provided that
|
||||
* the new terms are clearly indicated on the first page of each file where
|
||||
* they apply.
|
||||
*/
|
||||
|
||||
#include "syscall.h"
|
||||
|
||||
int
|
||||
write ( int file,
|
||||
char *buf,
|
||||
int nbytes)
|
||||
{
|
||||
return sysCall(SYS_write, file, (unsigned long)buf, nbytes);
|
||||
}
|
||||
|
||||
int
|
||||
read (int file,
|
||||
char *buf,
|
||||
int nbytes)
|
||||
{
|
||||
return sysCall(SYS_read, file, (unsigned long)buf, nbytes);
|
||||
}
|
||||
|
||||
int
|
||||
outbyte (unsigned char c)
|
||||
{
|
||||
return sysCall(SYS_write, 0, (unsigned long)&c, 1);
|
||||
}
|
||||
|
||||
unsigned char
|
||||
inbyte (void)
|
||||
{
|
||||
char c;
|
||||
sysCall(SYS_read, 0, (unsigned long)&c, 1);
|
||||
return c;
|
||||
}
|
||||
|
||||
|
||||
/* Structure filled in by get_mem_info. Only the size field is
|
||||
actually used (by sbrk), so the others aren't even filled in. */
|
||||
struct s_mem
|
||||
{
|
||||
unsigned int size;
|
||||
unsigned int icsize;
|
||||
unsigned int dcsize;
|
||||
};
|
||||
|
||||
// Perform a system call.
|
||||
// Unused parameters should be set to 0.
|
||||
int sysCall(unsigned long func, unsigned long p1, unsigned long p2, unsigned long p3)
|
||||
{
|
||||
int ret = 0;
|
||||
asm volatile ( "
|
||||
move $4, %1
|
||||
move $5, %2
|
||||
move $6, %3
|
||||
move $7, %4
|
||||
syscall
|
||||
nop
|
||||
move %0, $2" : "=r"(ret) : "r"(func), "r"(p1), "r"(p2), "r"(p3));
|
||||
return ret;
|
||||
}
|
||||
|
||||
// These need to be kept in sync with the definitions in Cygmon.
|
||||
#define SYS_meminfo 1001
|
||||
|
||||
void *
|
||||
get_mem_info (mem)
|
||||
struct s_mem *mem;
|
||||
{
|
||||
unsigned long totmem = 0, topmem = 0;
|
||||
int numbanks;
|
||||
|
||||
numbanks = sysCall(SYS_meminfo, (unsigned long)&totmem, (unsigned long)&topmem, 0);
|
||||
mem->size = totmem;
|
||||
return (void*)topmem;
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* pmon.S -- low-level entry points into PMON monitor.
|
||||
*
|
||||
* Copyright (c) 1996, 1997 Cygnus Support
|
||||
* Copyright (c) 1996, 1997, 2002 Cygnus Support
|
||||
*
|
||||
* The authors hereby grant permission to use, copy, modify, distribute,
|
||||
* and license this software and its documentation for any purpose, provided
|
||||
|
Loading…
x
Reference in New Issue
Block a user