OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /or1k/trunk/newlib/libgloss/sparc
    from Rev 1765 to Rev 57
    Reverse comparison

Rev 1765 → Rev 57

/cygmon.ld.src File deleted
/sparcl-stub.c File deleted
/Makefile.in File deleted
/fixctors.c File deleted
/cygmon-salib.c File deleted
/ex931.ld File deleted
/crt0.S File deleted
/salib.c File deleted
/sparclite.h File deleted
/cache.c File deleted
/erc32-crt0.S File deleted
/traps.S File deleted
/ex930.ld File deleted
/ex934.ld File deleted
/sparc86x.ld File deleted
/elfsim.ld File deleted
/tsc701.ld File deleted
/salib-701.c File deleted
/configure File deleted
configure Property changes : Deleted: svn:executable ## -1 +0,0 ## -* \ No newline at end of property Index: dtor.C =================================================================== --- dtor.C (revision 1765) +++ dtor.C (nonexistent) @@ -1,25 +0,0 @@ -#include - -extern "C" void print (char *, ...); - -class foo -{ -public: - foo () { print ("ctor\n"); } - ~foo () { print ("dtor\n"); } -}; - -foo x; - -main () -{ - outbyte ('&'); - outbyte ('@'); - outbyte ('$'); - outbyte ('%'); - print ("FooBar\r\n"); - - /* whew, we made it */ - print ("\r\nDone...\r\n"); -/* fflush(stdout); */ -} Index: cygmon-sparc64-ld.src =================================================================== --- cygmon-sparc64-ld.src (revision 1765) +++ cygmon-sparc64-ld.src (nonexistent) @@ -1,159 +0,0 @@ -/* - *uncomment this if you want the linker to output srecords. -OUTPUT_FORMAT(srec) - * - */ -ENTRY(start) -OUTPUT_ARCH(TARGET_OBJ_FORMAT) -SEARCH_DIR(.) -STARTUP(cygmon-crt0.o) -GROUP(cygmon-salib.o -lc -lgcc -lc) - -/* - * The memory map looks like this: - * +--------------------+ <- low memory - * | .text | - * | _stext | - * | _etext | - * | ctor list | the ctor and dtor lists are for - * | dtor list | C++ support - * | _end_text | - * +--------------------+ - * | .data | initialized data goes here - * | _sdata | - * | _edata | - * +--------------------+ - * | .bss | - * | __bss_start | start of bss, cleared by crt0 - * | _end | start of heap, used by sbrk() - * +--------------------+ - * | heap space | - * | _ENDHEAP | - * | stack space | - * | __stack | top of stack - * +--------------------+ <- high memory - */ - -_STACK_SIZE = (16 * 1024); -_RAM_SIZE = 1M; -_RAM_START = 0x4000; -_RAM_END = _RAM_START + _RAM_SIZE; - -/* - * Setup the standard memory map. The stack grows down towards low memory. - */ -MEMORY -{ - ram : ORIGIN = 0x4000, LENGTH = 1M -} - -__stack = (_RAM_START + _RAM_SIZE - 4 * 16) - _STACK_SIZE; - -/* - * All the symbols that might be accessed from C code need to be - * listed twice, once with an additional underscore. aout format needs - * and extra underscore, whereas coff & elf doesn't. This is to work - * with both. - */ -/* - * Initalize some symbols to be zero so we can reference them in the - * crt0 without core dumping. These functions are all optional, but - * we do this so we can have our crt0 always use them if they exist. - * This is so BSPs work better when using the crt0 installed with gcc. - * We have to initalize them twice, so we cover a.out (which prepends - * an underscore) and coff object file formats. - */ -PROVIDE (hardware_init_hook = 0); -PROVIDE (_hardware_init_hook = 0); -PROVIDE (software_init_hook = 0); -PROVIDE (_software_init_hook = 0); -SECTIONS -{ - .text : { - stext = .; - _stext = .; - CREATE_OBJECT_SYMBOLS - *(.text) - __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__ = .; - *(.init) - *(.lit) - *(.rodata) - *(.shdata) - *(.eh_frame) - *(.gnu.linkonce.t*) - *(.gnu.linkonce.r*) - *(.gcc_except_table) - *(.fini) - _etext = .; - } > ram - .shbss SIZEOF(.text) + ADDR(.text) : { - *(.shbss) - } - .talias : { } > ram - .data : { - sdata = .; - _sdata = .; - *(.data) - *(.gnu.linkonce.d*) - edata = .; - _edata = .; - } > ram - .bss SIZEOF(.data) + ADDR(.data) : { - sbss = . ; - _sbss = . ; - __bss_start = ALIGN(0x8); - __bss_start = ALIGN(0x8); - *(.bss) - *(COMMON) - end = ALIGN(0x8); - _end = ALIGN(0x8); - __end = ALIGN(0x8); - ebss = .; - _ebss = .; - } - .mstack : { } > ram - .rstack : { } > ram - /* Stabs debugging sections. */ - .stab 0 : { *(.stab) } - .stabstr 0 : { *(.stabstr) } - .stab.excl 0 : { *(.stab.excl) } - .stab.exclstr 0 : { *(.stab.exclstr) } - .stab.index 0 : { *(.stab.index) } - .stab.indexstr 0 : { *(.stab.indexstr) } - .comment 0 : { *(.comment) } - /* DWARF debug sections. - Symbols in the DWARF debugging sections are relative to the beginning - of the section so we begin them at 0. */ - /* DWARF 1 */ - .debug 0 : { *(.debug) } - .line 0 : { *(.line) } - /* GNU DWARF 1 extensions */ - .debug_srcinfo 0 : { *(.debug_srcinfo) } - .debug_sfnames 0 : { *(.debug_sfnames) } - /* DWARF 1.1 and DWARF 2 */ - .debug_aranges 0 : { *(.debug_aranges) } - .debug_pubnames 0 : { *(.debug_pubnames) } - /* DWARF 2 */ - .debug_info 0 : { *(.debug_info) } - .debug_abbrev 0 : { *(.debug_abbrev) } - .debug_line 0 : { *(.debug_line) } - .debug_frame 0 : { *(.debug_frame) } - .debug_str 0 : { *(.debug_str) } - .debug_loc 0 : { *(.debug_loc) } - .debug_macinfo 0 : { *(.debug_macinfo) } - /* SGI/MIPS DWARF 2 extensions */ - .debug_weaknames 0 : { *(.debug_weaknames) } - .debug_funcnames 0 : { *(.debug_funcnames) } - .debug_typenames 0 : { *(.debug_typenames) } - .debug_varnames 0 : { *(.debug_varnames) } - /* These must appear regardless of . */ -} Index: cygmon-crt0.S =================================================================== --- cygmon-crt0.S (revision 1765) +++ cygmon-crt0.S (nonexistent) @@ -1,144 +0,0 @@ -/* - * C startup code for the Fujitsu SPARClite demo board - * - * Copyright (c) 1995, 1996 Cygnus Support - * - * 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 "asm.h" - -#ifdef TARGET_CPU_SPARC64 -#define STACK_BIAS 2047 -#define SAVE_SIZE -128 -#else -#define SAVE_SIZE -64 -#endif - -.data - .align 8 -SYM(environ): ! this is the first address in the data section - .long 0 - -SYM(argc): - .long 0 - - .text - .align 8 - - .globl SYM(start) - .globl start -SYM(start): -start: - /* see if the stack is already setup. if not, then default - * to using the value of %sp as set by the ROM monitor - */ - sethi %hi(__stack), %g1 - or %g1,%lo(__stack),%g1 - cmp %g0,%g1 - be 1f - nop -#ifdef STACK_BIAS - sub %g1, STACK_BIAS, %g1 -#endif - mov %g1, %sp ! set the stack pointer - mov 0, %fp -1: - - /* zero the bss section */ - sethi %hi(__bss_start),%g2 - or %g2,%lo(__bss_start),%g2 ! start of bss - sethi %hi(_end),%g3 - or %g3,%lo(_end),%g3 ! end of bss - mov %g0,%g1 ! so std has two zeros -zerobss: - std %g0,[%g2] - add %g2,8,%g2 - cmp %g2,%g3 - bleu,a zerobss - nop - -/* - * initialize target specific stuff. Only execute these - * functions it they exist. - */ -init: - sethi %hi(SYM(hardware_init_hook)), %g1 - or %g1,%lo(SYM(hardware_init_hook)),%g1 - cmp %g0,%g1 - be 1f - nop - call SYM(hardware_init_hook) - nop - -1: - sethi %hi(SYM(software_init_hook)), %g1 - or %g1,%lo(SYM(software_init_hook)),%g1 - cmp %g0,%g1 - be 2f - nop - call SYM(software_init_hook) - nop -2: - set SYM(__sigtramp), %o0 - call SYM(__install_signal_handler) - nop - - set do_dtors,%o0 - call SYM(atexit) - nop - - call do_ctors - nop - - set SYM(argc), %o0 - call SYM(__getProgramArgs) - nop - - mov %o0, %o1 - set SYM(argc), %o0 - ld [%o0], %o0 - call SYM(main) - nop - - /* call exit from the C library so atexit gets called, and the - * C++ destructors get run. This calls our exit routine below - * when it's done. - */ - call SYM(exit) - nop - -do_ctors: - save %sp,SAVE_SIZE,%sp - set __CTOR_LIST__,%l0 -our_entry: - ld [%l0],%l1 - add %l0,4,%l0 - tst %l1 -1: - beq 2f - nop - ld [%l0],%l2 - add %l0,4,%l0 - - call %l2 - nop - deccc %l1 - b 1b - nop -2: - ret - restore - -do_dtors: - save %sp,SAVE_SIZE,%sp - set __DTOR_LIST__,%l0 - b our_entry - nop Index: erc32-io.c =================================================================== --- erc32-io.c (revision 1765) +++ erc32-io.c (nonexistent) @@ -1,47 +0,0 @@ -#define USE_PORT_A - -#define RXADATA (int *) 0x01F800E0 -#define RXBDATA (int *) 0x01F800E4 -#define RXSTAT (int *) 0x01F800E8 - -void -outbyte (int c) -{ - volatile int *rxstat; - volatile int *rxadata; - int rxmask; - - rxstat = RXSTAT; -#ifdef USE_PORT_A - rxadata = RXADATA; - rxmask = 6; -#else - rxadata = RXBDATA; - rxmask = 0x60000; -#endif - - while ((*rxstat & rxmask) == 0); - - *rxadata = c; -} - -int -inbyte (void) -{ - volatile int *rxstat; - volatile int *rxadata; - int rxmask; - - rxstat = RXSTAT; -#ifdef USE_PORT_A - rxadata = RXADATA; - rxmask = 1; -#else - rxadata = RXBDATA; - rxmask = 0x10000; -#endif - - while ((*rxstat & rxmask) == 0); - - return *rxadata; -} Index: sparclet-stub.c =================================================================== --- sparclet-stub.c (revision 1765) +++ sparclet-stub.c (nonexistent) @@ -1,1233 +0,0 @@ -/**************************************************************************** - - 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. - -****************************************************************************/ - -/**************************************************************************** - * Header: remcom.c,v 1.34 91/03/09 12:29:49 glenne Exp $ - * - * Module name: remcom.c $ - * Revision: 1.34 $ - * Date: 91/03/09 12:29:49 $ - * Contributor: Lake Stevens Instrument Division$ - * - * Description: low level support for gdb debugger. $ - * - * Considerations: only works on target hardware $ - * - * Written by: Glenn Engel $ - * ModuleState: Experimental $ - * - * NOTES: See Below $ - * - * Modified for SPARC by Stu Grossman, Cygnus Support. - * Based on sparc-stub.c, it's modified for SPARClite Debug Unit hardware - * breakpoint support to create sparclite-stub.c, by Kung Hsu, Cygnus Support. - * - * This code has been extensively tested on the Fujitsu SPARClite demo board. - * - * 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 by executing a trap #1. - * - ************* - * - * 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 - * P set the value of a single CPU register OK or P01 (???) - * - * 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 - * - * $#. - * - * where - * :: - * :: > - * - * 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 -#include - -/************************************************************************ - * - * external low-level support routines - */ - -extern putDebugChar(); /* write a single character */ -extern getDebugChar(); /* read and return a single char */ - -/************************************************************************/ -/* BUFMAX defines the maximum number of characters in inbound/outbound buffers*/ -/* at least NUMREGBYTES*2 are needed for register packets */ -#define BUFMAX 2048 - -static int initialized = 0; /* !0 means we've been initialized */ -static int remote_debug = 0; /* turn on verbose debugging */ - -extern void breakinst(); -void _cprint(); -static void hw_breakpoint(); -static void set_mem_fault_trap(); -static void get_in_break_mode(); -static unsigned char *mem2hex(); - -static const char hexchars[]="0123456789abcdef"; - -#define NUMREGS 121 - -static unsigned long saved_stack_pointer; - -/* Number of bytes of registers. */ -#define NUMREGBYTES (NUMREGS * 4) -enum regnames { G0, G1, G2, G3, G4, G5, G6, G7, - O0, O1, O2, O3, O4, O5, SP, O7, - L0, L1, L2, L3, L4, L5, L6, L7, - I0, I1, I2, I3, I4, I5, FP, I7, - - F0, F1, F2, F3, F4, F5, F6, F7, - F8, F9, F10, F11, F12, F13, F14, F15, - F16, F17, F18, F19, F20, F21, F22, F23, - F24, F25, F26, F27, F28, F29, F30, F31, - - Y, PSR, WIM, TBR, PC, NPC, FPSR, CPSR, - CCSR, CCPR, CCCRCR, CCOR, CCOBR, CCIBR, CCIR, UNUSED1, - - ASR1, ASR15, ASR17, ASR18, ASR19, ASR20, ASR21, ASR22, - /* the following not actually implemented */ - AWR0, AWR1, AWR2, AWR3, AWR4, AWR5, AWR6, AWR7, - AWR8, AWR9, AWR10, AWR11, AWR12, AWR13, AWR14, AWR15, - AWR16, AWR17, AWR18, AWR19, AWR20, AWR21, AWR22, AWR23, - AWR24, AWR25, AWR26, AWR27, AWR28, AWR29, AWR30, AWR31, - APSR -}; - -/*************************** ASSEMBLY CODE MACROS *************************/ -/* */ - -extern void trap_low(); - -asm(" - .reserve trapstack, 1000 * 4, \"bss\", 8 - - .data - .align 4 - -in_trap_handler: - .word 0 - - .text - .align 4 - -! This function is called when any SPARC trap (except window overflow or -! underflow) occurs. It makes sure that the invalid register window is still -! available before jumping into C code. It will also restore the world if you -! return from handle_exception. -! -! On entry, trap_low expects l1 and l2 to contain pc and npc respectivly. - - .globl _trap_low -_trap_low: - mov %psr, %l0 - mov %wim, %l3 - - srl %l3, %l0, %l4 ! wim >> cwp - and %l4, 0xff, %l4 ! Mask off windows 28, 29 - cmp %l4, 1 - bne window_fine ! Branch if not in the invalid window - nop - -! Handle window overflow - - mov %g1, %l4 ! Save g1, we use it to hold the wim - srl %l3, 1, %g1 ! Rotate wim right - and %g1, 0xff, %g1 ! Mask off windows 28, 29 - tst %g1 - bg good_wim ! Branch if new wim is non-zero - nop - -! At this point, we need to bring a 1 into the high order bit of the wim. -! Since we don't want to make any assumptions about the number of register -! windows, we figure it out dynamically so as to setup the wim correctly. - - ! The normal way doesn't work on the sparclet as register windows - ! 28 and 29 are special purpose windows. - !not %g1 ! Fill g1 with ones - !mov %g1, %wim ! Fill the wim with ones - !nop - !nop - !nop - !mov %wim, %g1 ! Read back the wim - !inc %g1 ! Now g1 has 1 just to left of wim - !srl %g1, 1, %g1 ! Now put 1 at top of wim - - mov 0x80, %g1 ! Hack for sparclet - - ! This doesn't work on the sparclet. - !mov %g0, %wim ! Clear wim so that subsequent save - ! won't trap - andn %l3, 0xff, %l5 ! Clear wim but not windows 28, 29 - mov %l5, %wim - nop - nop - nop - -good_wim: - save %g0, %g0, %g0 ! Slip into next window - mov %g1, %wim ! Install the new wim - - std %l0, [%sp + 0 * 4] ! save L & I registers - std %l2, [%sp + 2 * 4] - std %l4, [%sp + 4 * 4] - std %l6, [%sp + 6 * 4] - - std %i0, [%sp + 8 * 4] - std %i2, [%sp + 10 * 4] - std %i4, [%sp + 12 * 4] - std %i6, [%sp + 14 * 4] - - restore ! Go back to trap window. - mov %l4, %g1 ! Restore %g1 - -window_fine: - sethi %hi(in_trap_handler), %l4 - ld [%lo(in_trap_handler) + %l4], %l5 - tst %l5 - bg recursive_trap - inc %l5 - - set trapstack+1000*4, %sp ! Switch to trap stack - -recursive_trap: - st %l5, [%lo(in_trap_handler) + %l4] - sub %sp,(16+1+6+1+88)*4,%sp ! Make room for input & locals - ! + hidden arg + arg spill - ! + doubleword alignment - ! + registers[121] - - std %g0, [%sp + (24 + 0) * 4] ! registers[Gx] - std %g2, [%sp + (24 + 2) * 4] - std %g4, [%sp + (24 + 4) * 4] - std %g6, [%sp + (24 + 6) * 4] - - std %i0, [%sp + (24 + 8) * 4] ! registers[Ox] - std %i2, [%sp + (24 + 10) * 4] - std %i4, [%sp + (24 + 12) * 4] - std %i6, [%sp + (24 + 14) * 4] - - ! FP regs (sparclet doesn't have fpu) - - mov %y, %l4 - mov %tbr, %l5 - st %l4, [%sp + (24 + 64) * 4] ! Y - st %l0, [%sp + (24 + 65) * 4] ! PSR - st %l3, [%sp + (24 + 66) * 4] ! WIM - st %l5, [%sp + (24 + 67) * 4] ! TBR - st %l1, [%sp + (24 + 68) * 4] ! PC - st %l2, [%sp + (24 + 69) * 4] ! NPC - ! CPSR and FPSR not impl - or %l0, 0xf20, %l4 - mov %l4, %psr ! Turn on traps, disable interrupts - nop - nop - nop - -! Save coprocessor state. -! See SK/demo/hdlc_demo/ldc_swap_context.S. - - mov %psr, %l0 - sethi %hi(0x2000), %l5 ! EC bit in PSR - or %l5, %l0, %l5 - mov %l5, %psr ! enable coprocessor - nop ! 3 nops after write to %psr (needed?) - nop - nop - crdcxt %ccsr, %l1 ! capture CCSR - mov 0x6, %l2 - cwrcxt %l2, %ccsr ! set CCP state machine for CCFR - crdcxt %ccfr, %l2 ! capture CCOR - cwrcxt %l2, %ccfr ! tickle CCFR - crdcxt %ccfr, %l3 ! capture CCOBR - cwrcxt %l3, %ccfr ! tickle CCFR - crdcxt %ccfr, %l4 ! capture CCIBR - cwrcxt %l4, %ccfr ! tickle CCFR - crdcxt %ccfr, %l5 ! capture CCIR - cwrcxt %l5, %ccfr ! tickle CCFR - crdcxt %ccpr, %l6 ! capture CCPR - crdcxt %cccrcr, %l7 ! capture CCCRCR - st %l1, [%sp + (24 + 72) * 4] ! save CCSR - st %l2, [%sp + (24 + 75) * 4] ! save CCOR - st %l3, [%sp + (24 + 76) * 4] ! save CCOBR - st %l4, [%sp + (24 + 77) * 4] ! save CCIBR - st %l5, [%sp + (24 + 78) * 4] ! save CCIR - st %l6, [%sp + (24 + 73) * 4] ! save CCPR - st %l7, [%sp + (24 + 74) * 4] ! save CCCRCR - mov %l0, %psr ! restore original PSR - nop ! 3 nops after write to %psr (needed?) - nop - nop - -! End of saving coprocessor state. -! Save asr regs - -! Part of this is silly -- we should not display ASR15 or ASR19 at all. - - sethi %hi(0x01000000), %l6 - st %l6, [%sp + (24 + 81) * 4] ! ASR15 == NOP - sethi %hi(0xdeadc0de), %l6 - or %l6, %lo(0xdeadc0de), %l6 - st %l6, [%sp + (24 + 84) * 4] ! ASR19 == DEADC0DE - - rd %asr1, %l4 - st %l4, [%sp + (24 + 80) * 4] -! rd %asr15, %l4 ! must not read ASR15 -! st %l4, [%sp + (24 + 81) * 4] ! (illegal instr trap) - rd %asr17, %l4 - st %l4, [%sp + (24 + 82) * 4] - rd %asr18, %l4 - st %l4, [%sp + (24 + 83) * 4] -! rd %asr19, %l4 ! must not read asr19 -! st %l4, [%sp + (24 + 84) * 4] ! (halts the CPU) - rd %asr20, %l4 - st %l4, [%sp + (24 + 85) * 4] - rd %asr21, %l4 - st %l4, [%sp + (24 + 86) * 4] - rd %asr22, %l4 - st %l4, [%sp + (24 + 87) * 4] - -! End of saving asr regs - - call _handle_exception - add %sp, 24 * 4, %o0 ! Pass address of registers - -! Reload all of the registers that aren't on the stack - - ld [%sp + (24 + 1) * 4], %g1 ! registers[Gx] - ldd [%sp + (24 + 2) * 4], %g2 - ldd [%sp + (24 + 4) * 4], %g4 - ldd [%sp + (24 + 6) * 4], %g6 - - ldd [%sp + (24 + 8) * 4], %i0 ! registers[Ox] - ldd [%sp + (24 + 10) * 4], %i2 - ldd [%sp + (24 + 12) * 4], %i4 - ldd [%sp + (24 + 14) * 4], %i6 - - ! FP regs (sparclet doesn't have fpu) - -! Update the coprocessor registers. -! See SK/demo/hdlc_demo/ldc_swap_context.S. - - mov %psr, %l0 - sethi %hi(0x2000), %l5 ! EC bit in PSR - or %l5, %l0, %l5 - mov %l5, %psr ! enable coprocessor - nop ! 3 nops after write to %psr (needed?) - nop - nop - - mov 0x6, %l2 - cwrcxt %l2, %ccsr ! set CCP state machine for CCFR - - ld [%sp + (24 + 72) * 4], %l1 ! saved CCSR - ld [%sp + (24 + 75) * 4], %l2 ! saved CCOR - ld [%sp + (24 + 76) * 4], %l3 ! saved CCOBR - ld [%sp + (24 + 77) * 4], %l4 ! saved CCIBR - ld [%sp + (24 + 78) * 4], %l5 ! saved CCIR - ld [%sp + (24 + 73) * 4], %l6 ! saved CCPR - ld [%sp + (24 + 74) * 4], %l7 ! saved CCCRCR - - cwrcxt %l2, %ccfr ! restore CCOR - cwrcxt %l3, %ccfr ! restore CCOBR - cwrcxt %l4, %ccfr ! restore CCIBR - cwrcxt %l5, %ccfr ! restore CCIR - cwrcxt %l6, %ccpr ! restore CCPR - cwrcxt %l7, %cccrcr ! restore CCCRCR - cwrcxt %l1, %ccsr ! restore CCSR - - mov %l0, %psr ! restore PSR - nop ! 3 nops after write to %psr (needed?) - nop - nop - -! End of coprocessor handling stuff. -! Update asr regs - - ld [%sp + (24 + 80) * 4], %l4 - wr %l4, %asr1 -! ld [%sp + (24 + 81) * 4], %l4 ! can't write asr15 -! wr %l4, %asr15 - ld [%sp + (24 + 82) * 4], %l4 - wr %l4, %asr17 - ld [%sp + (24 + 83) * 4], %l4 - wr %l4, %asr18 -! ld [%sp + (24 + 84) * 4], %l4 ! can't write asr19 -! wr %l4, %asr19 -! ld [%sp + (24 + 85) * 4], %l4 ! can't write asr20 -! wr %l4, %asr20 -! ld [%sp + (24 + 86) * 4], %l4 ! can't write asr21 -! wr %l4, %asr21 - ld [%sp + (24 + 87) * 4], %l4 - wr %l4, %asr22 - -! End of restoring asr regs - - - ldd [%sp + (24 + 64) * 4], %l0 ! Y & PSR - ldd [%sp + (24 + 68) * 4], %l2 ! PC & NPC - - restore ! Ensure that previous window is valid - save %g0, %g0, %g0 ! by causing a window_underflow trap - - mov %l0, %y - mov %l1, %psr ! Make sure that traps are disabled - ! for rett - nop ! 3 nops after write to %psr (needed?) - nop - nop - - sethi %hi(in_trap_handler), %l4 - ld [%lo(in_trap_handler) + %l4], %l5 - dec %l5 - st %l5, [%lo(in_trap_handler) + %l4] - - jmpl %l2, %g0 ! Restore old PC - rett %l3 ! Restore old nPC -"); - -/* 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 $# */ - -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 */ - while ((ch = (getDebugChar() & 0x7f)) != '$') - ; - - checksum = 0; - xmitcsum = -1; - - count = 0; - - /* now, read until a # or end of buffer is found */ - while (count < BUFMAX) - { - ch = getDebugChar() & 0x7f; - if (ch == '#') - break; - checksum = checksum + ch; - buffer[count] = ch; - count = count + 1; - } - - if (count >= BUFMAX) - continue; - - buffer[count] = 0; - - if (ch == '#') - { - xmitcsum = hex(ch = getDebugChar() & 0x7f) << 4; - xmitcsum |= hex(ch = getDebugChar() & 0x7f); - - 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; - - /* $#. */ - 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() & 0x7f) != '+'); -} - -static char remcomInBuffer[BUFMAX]; -static char remcomOutBuffer[BUFMAX]; - -/* Indicate to caller of mem2hex or hex2mem that there has been an - error. */ -static volatile int mem_err = 0; - -/* 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; - - set_mem_fault_trap(may_fault); - - while (count-- > 0) - { - ch = *mem++; - if (mem_err) - return 0; - *buf++ = hexchars[ch >> 4]; - *buf++ = hexchars[ch & 0xf]; - } - - *buf = 0; - - set_mem_fault_trap(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 char * -hex2mem(buf, mem, count, may_fault) - unsigned char *buf; - unsigned char *mem; - int count; - int may_fault; -{ - int i; - unsigned char ch; - - set_mem_fault_trap(may_fault); - - for (i=0; itt && ht->signo; ht++) - exceptionHandler(ht->tt, trap_low); - - /* In case GDB is started before us, ack any packets (presumably - "$?#xx") sitting there. */ - putDebugChar ('+'); - - initialized = 1; -} - -asm (" -! Trap handler for memory errors. This just sets mem_err to be non-zero. It -! assumes that %l1 is non-zero. This should be safe, as it is doubtful that -! 0 would ever contain code that could mem fault. This routine will skip -! past the faulting instruction after setting mem_err. - - .text - .align 4 - -_fltr_set_mem_err: - sethi %hi(_mem_err), %l0 - st %l1, [%l0 + %lo(_mem_err)] - jmpl %l2, %g0 - rett %l2+4 -"); - -static void -set_mem_fault_trap(enable) - int enable; -{ - extern void fltr_set_mem_err(); - mem_err = 0; - - if (enable) - exceptionHandler(0x29, fltr_set_mem_err); - else - exceptionHandler(0x29, trap_low); -} - -asm (" - .text - .align 4 - -_dummy_hw_breakpoint: - jmpl %l2, %g0 - rett %l2+4 - nop - nop -"); - -static void -set_hw_breakpoint_trap(enable) - int enable; -{ - extern void dummy_hw_breakpoint(); - - if (enable) - exceptionHandler(255, dummy_hw_breakpoint); - else - exceptionHandler(255, trap_low); -} - -static void -get_in_break_mode() -{ -#if 0 - int x; - mesg("get_in_break_mode, sp = "); - phex(&x); -#endif - set_hw_breakpoint_trap(1); - - asm(" - sethi %hi(0xff10), %l4 - or %l4, %lo(0xff10), %l4 - sta %g0, [%l4]0x1 - nop - nop - nop - "); - - set_hw_breakpoint_trap(0); -} - -/* Convert the SPARC hardware trap type code 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(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); -} - -/* - * This function does all command procesing for interfacing to gdb. It - * returns 1 if you should skip the instruction at the trap address, 0 - * otherwise. - */ - -static void -handle_exception (registers) - unsigned long *registers; -{ - int tt; /* Trap type */ - int sigval; - int addr; - int length; - char *ptr; - unsigned long *sp; - unsigned long dsr; - -/* First, we must force all of the windows to be spilled out */ - - asm(" - ! Ugh. sparclet has broken save - !save %sp, -64, %sp - save - add %fp,-64,%sp - !save %sp, -64, %sp - save - add %fp,-64,%sp - !save %sp, -64, %sp - save - add %fp,-64,%sp - !save %sp, -64, %sp - save - add %fp,-64,%sp - !save %sp, -64, %sp - save - add %fp,-64,%sp - !save %sp, -64, %sp - save - add %fp,-64,%sp - !save %sp, -64, %sp - save - add %fp,-64,%sp - !save %sp, -64, %sp - save - add %fp,-64,%sp - restore - restore - restore - restore - restore - restore - restore - restore -"); - - if (registers[PC] == (unsigned long)breakinst) - { - registers[PC] = registers[NPC]; - registers[NPC] += 4; - } - sp = (unsigned long *)registers[SP]; - - tt = (registers[TBR] >> 4) & 0xff; - - /* reply to host that an exception has occurred */ - sigval = computeSignal(tt); - ptr = remcomOutBuffer; - - *ptr++ = 'T'; - *ptr++ = hexchars[sigval >> 4]; - *ptr++ = hexchars[sigval & 0xf]; - - *ptr++ = hexchars[PC >> 4]; - *ptr++ = hexchars[PC & 0xf]; - *ptr++ = ':'; - ptr = mem2hex((char *)®isters[PC], ptr, 4, 0); - *ptr++ = ';'; - - *ptr++ = hexchars[FP >> 4]; - *ptr++ = hexchars[FP & 0xf]; - *ptr++ = ':'; - ptr = mem2hex(sp + 8 + 6, ptr, 4, 0); /* FP */ - *ptr++ = ';'; - - *ptr++ = hexchars[SP >> 4]; - *ptr++ = hexchars[SP & 0xf]; - *ptr++ = ':'; - ptr = mem2hex((char *)&sp, ptr, 4, 0); - *ptr++ = ';'; - - *ptr++ = hexchars[NPC >> 4]; - *ptr++ = hexchars[NPC & 0xf]; - *ptr++ = ':'; - ptr = mem2hex((char *)®isters[NPC], ptr, 4, 0); - *ptr++ = ';'; - - *ptr++ = hexchars[O7 >> 4]; - *ptr++ = hexchars[O7 & 0xf]; - *ptr++ = ':'; - ptr = mem2hex((char *)®isters[O7], ptr, 4, 0); - *ptr++ = ';'; - - *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': - remote_debug = !(remote_debug); /* toggle debug flag */ - break; - - case 'g': /* return the value of the CPU registers */ - { - ptr = remcomOutBuffer; - ptr = mem2hex((char *)registers, ptr, 16 * 4, 0); /* G & O regs */ - ptr = mem2hex(sp + 0, ptr, 16 * 4, 0); /* L & I regs */ - memset(ptr, '0', 32 * 8); /* Floating point */ - ptr = mem2hex((char *)®isters[Y], - ptr + 32 * 4 * 2, - 8 * 4, - 0); /* Y, PSR, WIM, TBR, PC, NPC, FPSR, CPSR */ - ptr = mem2hex((char *)®isters[CCSR], - ptr, - 8 * 4, - 0); /* CCSR, CCPR, CCCRCR, CCOR, CCOBR, CCIBR, CCIR */ - ptr = mem2hex((char *)®isters[ASR1], - ptr, - 8 * 4, - 0); /* ASR1,ASR15,ASR17,ASR18,ASR19,ASR20,ASR21,ASR22 */ -#if 0 /* not implemented */ - ptr = mem2hex((char *) ®isters[AWR0], - ptr, - 32 * 4, - 0); /* Alternate Window Registers */ -#endif - } - break; - - case 'G': /* set value of all the CPU registers - return OK */ - case 'P': /* set value of one CPU register - return OK */ - { - unsigned long *newsp, psr; - - psr = registers[PSR]; - - ptr = &remcomInBuffer[1]; - - if (remcomInBuffer[0] == 'P') /* do a single register */ - { - int regno; - - if (hexToInt (&ptr, ®no) - && *ptr++ == '=') - if (regno >= L0 && regno <= I7) - hex2mem (ptr, sp + regno - L0, 4, 0); - else - hex2mem (ptr, (char *)®isters[regno], 4, 0); - else - { - strcpy (remcomOutBuffer, "P01"); - break; - } - } - else - { - hex2mem(ptr, (char *)registers, 16 * 4, 0); /* G & O regs */ - hex2mem(ptr + 16 * 4 * 2, sp + 0, 16 * 4, 0); /* L & I regs */ - hex2mem(ptr + 64 * 4 * 2, (char *)®isters[Y], - 8 * 4, 0); /* Y,PSR,WIM,TBR,PC,NPC,FPSR,CPSR */ - hex2mem(ptr + 72 * 4 * 2, (char *)®isters[CCSR], - 8 * 4, 0); /* CCSR,CCPR,CCCRCR,CCOR,CCOBR,CCIBR,CCIR */ - hex2mem(ptr + 80 * 4 * 2, (char *)®isters[ASR1], - 8 * 4, 0); /* ASR1 ... ASR22 */ -#if 0 /* not implemented */ - hex2mem(ptr + 88 * 4 * 2, (char *)®isters[AWR0], - 8 * 4, 0); /* Alternate Window Registers */ -#endif - } - /* See if the stack pointer has moved. If so, then copy the saved - locals and ins to the new location. This keeps the window - overflow and underflow routines happy. */ - - newsp = (unsigned long *)registers[SP]; - if (sp != newsp) - sp = memcpy(newsp, sp, 16 * 4); - - /* Don't allow CWP to be modified. */ - - if (psr != registers[PSR]) - registers[PSR] = (psr & 0x1f) | (registers[PSR] & ~0x1f); - - strcpy(remcomOutBuffer,"OK"); - } - 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; - - /* kill the program */ - case 'k' : /* do nothing */ - break; -#if 0 - case 't': /* Test feature */ - asm (" std %f30,[%sp]"); - break; -#endif - case 'r': /* Reset */ - asm ("call 0 - nop "); - break; - -#if 0 -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"); /* Ack before changing speed */ - set_timer_3(baudrate); /* Set it */ - } -x1: break; -#endif - } /* switch */ - - /* reply to the request */ - putpacket(remcomOutBuffer); - } -} - -/* This function will generate a breakpoint exception. It is used at the - beginning of a program to sync up with a debugger and can be used - otherwise as a quick means to stop program execution and "break" into - the debugger. */ - -void -breakpoint() -{ - if (!initialized) - return; - - asm(" .globl _breakinst - - _breakinst: ta 1 - "); -} - -static void -hw_breakpoint() -{ - asm(" - ta 127 - "); -} - -#if 0 /* experimental and never finished, left here for reference */ -static void -splet_temp(void) -{ - asm(" sub %sp,(16+1+6+1+121)*4,%sp ! Make room for input & locals - ! + hidden arg + arg spill - ! + doubleword alignment - ! + registers[121] - -! Leave a trail of breadcrumbs! (save register save area for debugging) - mov %sp, %l0 - add %l0, 24*4, %l0 - sethi %hi(_debug_registers), %l1 - st %l0, [%lo(_debug_registers) + %l1] - -! Save the Alternate Register Set: (not implemented yet) -! To save the Alternate Register set, we must: -! 1) Save the current SP in some global location. -! 2) Swap the register sets. -! 3) Save the Alternate SP in the Y register -! 4) Fetch the SP that we saved in step 1. -! 5) Use that to save the rest of the regs (not forgetting ASP in Y) -! 6) Restore the Alternate SP from Y -! 7) Swap the registers back. - -! 1) Copy the current stack pointer to global _SAVED_STACK_POINTER: - sethi %hi(_saved_stack_pointer), %l0 - st %sp, [%lo(_saved_stack_pointer) + %l0] - -! 2) Swap the register sets: - mov %psr, %l1 - sethi %hi(0x10000), %l2 - xor %l1, %l2, %l1 - mov %l1, %psr - nop ! 3 nops after write to %psr (needed?) - nop - nop - -! 3) Save Alternate L0 in Y - wr %l0, 0, %y - -! 4) Load former SP into alternate SP, using L0 - sethi %hi(_saved_stack_pointer), %l0 - or %lo(_saved_stack_pointer), %l0, %l0 - swap [%l0], %sp - -! 4.5) Restore alternate L0 - rd %y, %l0 - -! 5) Save the Alternate Window Registers - st %r0, [%sp + (24 + 88) * 4] ! AWR0 - st %r1, [%sp + (24 + 89) * 4] ! AWR1 - st %r2, [%sp + (24 + 90) * 4] ! AWR2 - st %r3, [%sp + (24 + 91) * 4] ! AWR3 - st %r4, [%sp + (24 + 92) * 4] ! AWR4 - st %r5, [%sp + (24 + 93) * 4] ! AWR5 - st %r6, [%sp + (24 + 94) * 4] ! AWR6 - st %r7, [%sp + (24 + 95) * 4] ! AWR7 - st %r8, [%sp + (24 + 96) * 4] ! AWR8 - st %r9, [%sp + (24 + 97) * 4] ! AWR9 - st %r10, [%sp + (24 + 98) * 4] ! AWR10 - st %r11, [%sp + (24 + 99) * 4] ! AWR11 - st %r12, [%sp + (24 + 100) * 4] ! AWR12 - st %r13, [%sp + (24 + 101) * 4] ! AWR13 -! st %r14, [%sp + (24 + 102) * 4] ! AWR14 (SP) - st %r15, [%sp + (24 + 103) * 4] ! AWR15 - st %r16, [%sp + (24 + 104) * 4] ! AWR16 - st %r17, [%sp + (24 + 105) * 4] ! AWR17 - st %r18, [%sp + (24 + 106) * 4] ! AWR18 - st %r19, [%sp + (24 + 107) * 4] ! AWR19 - st %r20, [%sp + (24 + 108) * 4] ! AWR20 - st %r21, [%sp + (24 + 109) * 4] ! AWR21 - st %r22, [%sp + (24 + 110) * 4] ! AWR22 - st %r23, [%sp + (24 + 111) * 4] ! AWR23 - st %r24, [%sp + (24 + 112) * 4] ! AWR24 - st %r25, [%sp + (24 + 113) * 4] ! AWR25 - st %r26, [%sp + (24 + 114) * 4] ! AWR26 - st %r27, [%sp + (24 + 115) * 4] ! AWR27 - st %r28, [%sp + (24 + 116) * 4] ! AWR28 - st %r29, [%sp + (24 + 117) * 4] ! AWR29 - st %r30, [%sp + (24 + 118) * 4] ! AWR30 - st %r31, [%sp + (24 + 119) * 4] ! AWR21 - -! Get the Alternate PSR (I hope...) - - rd %psr, %l2 - st %l2, [%sp + (24 + 120) * 4] ! APSR - -! Don't forget the alternate stack pointer - - rd %y, %l3 - st %l3, [%sp + (24 + 102) * 4] ! AWR14 (SP) - -! 6) Restore the Alternate SP (saved in Y) - - rd %y, %o6 - - -! 7) Swap the registers back: - - mov %psr, %l1 - sethi %hi(0x10000), %l2 - xor %l1, %l2, %l1 - mov %l1, %psr - nop ! 3 nops after write to %psr (needed?) - nop - nop -"); -} - -#endif Index: erc32-stub.c =================================================================== --- erc32-stub.c (revision 1765) +++ erc32-stub.c (nonexistent) @@ -1,363 +0,0 @@ -/* - * Copyright (c) 1996 Cygnus Support - * - * 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 -#include -#include "debug.h" -#include "asm.h" -#include "slite.h" - -extern unsigned long rdtbr(); -extern struct trap_entry fltr_proto; -extern void trap_low(); -exception_t default_trap_hook = trap_low; -void target_reset(); -void flush_i_cache(); -char *target_read_registers(unsigned long *); -char *target_write_registers(unsigned long *); -char *target_dump_state(unsigned long *); - -#define NUMREGS 72 - -/* Number of bytes of registers. */ -#define NUMREGBYTES (NUMREGS * 4) - -enum regnames {G0, G1, G2, G3, G4, G5, G6, G7, - O0, O1, O2, O3, O4, O5, SP, O7, - L0, L1, L2, L3, L4, L5, L6, L7, - I0, I1, I2, I3, I4, I5, FP, I7, - - F0, F1, F2, F3, F4, F5, F6, F7, - F8, F9, F10, F11, F12, F13, F14, F15, - F16, F17, F18, F19, F20, F21, F22, F23, - F24, F25, F26, F27, F28, F29, F30, F31, - Y, PSR, WIM, TBR, PC, NPC, FPSR, CPSR }; - -/* - * Each entry in the trap vector occupies four words, typically a jump - * to the processing routine. - */ -struct trap_entry { - unsigned sethi_filler:10; - unsigned sethi_imm22:22; - unsigned jmpl_filler:19; - unsigned jmpl_simm13:13; - unsigned long filler[2]; -}; - -/* - * This table contains the mapping between SPARC hardware trap types, and - * signals, which are primarily what GDB understands. It also indicates - * which hardware traps we need to commandeer when initializing the stub. - */ -struct trap_info hard_trap_info[] = { - {1, SIGSEGV}, /* instruction access error */ - {2, SIGILL}, /* privileged instruction */ - {3, SIGILL}, /* illegal instruction */ - {4, SIGEMT}, /* fp disabled */ - {36, SIGEMT}, /* cp disabled */ - {7, SIGBUS}, /* mem address not aligned */ - {9, SIGSEGV}, /* data access exception */ - {10, SIGEMT}, /* tag overflow */ - {128+1, SIGTRAP}, /* ta 1 - normal breakpoint instruction */ - {0, 0} /* Must be last */ -}; - -extern struct trap_entry fltr_proto; -void -exception_handler (int tt, unsigned long routine) -{ - struct trap_entry *tb; /* Trap vector base address */ - - DEBUG (1, "Entering exception_handler()"); - if (tt != 256) { - tb = (struct trap_entry *) (rdtbr() & ~0xfff); - } else { - tt = 255; - tb = (struct trap_entry *) 0; - } - - tb[tt] = fltr_proto; - - tb[tt].sethi_imm22 = routine >> 10; - tb[tt].jmpl_simm13 = routine & 0x3ff; - - DEBUG (1, "Leaving exception_handler()"); -} - -/* - * This is so we can trap a memory fault when reading or writing - * directly to memory. - */ -void -set_mem_fault_trap(enable) - int enable; -{ - extern void fltr_set_mem_err(); - - DEBUG (1, "Entering set_mem_fault_trap()"); - - mem_err = 0; - - if (enable) - exception_handler(9, (unsigned long)fltr_set_mem_err); - else - exception_handler(9, (unsigned long)trap_low); - - DEBUG (1, "Leaving set_mem_fault_trap()"); -} - -/* - * This function does all command procesing for interfacing to gdb. It - * returns 1 if you should skip the instruction at the trap address, 0 - * otherwise. - */ -extern void breakinst(); - -void -handle_exception (registers) - unsigned long *registers; -{ - int sigval; - - /* First, we must force all of the windows to be spilled out */ - - DEBUG (1, "Entering handle_exception()"); - -/* asm("mov %g0, %wim ; nop; nop; nop"); */ - asm(" save %sp, -64, %sp - save %sp, -64, %sp - save %sp, -64, %sp - save %sp, -64, %sp - save %sp, -64, %sp - save %sp, -64, %sp - save %sp, -64, %sp - save %sp, -64, %sp - restore - restore - restore - restore - restore - restore - restore - restore -"); - - if (registers[PC] == (unsigned long)breakinst) { - registers[PC] = registers[NPC]; - registers[NPC] += 4; - } - - /* get the last know signal number from the trap register */ - sigval = computeSignal((registers[TBR] >> 4) & 0xff); - - /* call the main command processing loop for gdb */ - gdb_event_loop (sigval, registers); -} - -/* - * This function will generate a breakpoint exception. It is used at the - * beginning of a program to sync up with a debugger and can be used - * otherwise as a quick means to stop program execution and "break" into - * the debugger. - */ -void -breakpoint() -{ - DEBUG (1, "Entering breakpoint()"); - - if (!initialized) - return; - - asm(" .globl " STRINGSYM(breakinst) " - " STRINGSYM(breakinst) ": ta 128+1 - nop - nop - "); -} - -/* - * This is just a test vector for debugging excpetions. - */ -void -bad_trap(tt) -int tt; -{ - print ("Got a bad trap #"); - outbyte (tt); - outbyte ('\n'); - asm("ta 0 - nop - nop - "); -} - -/* - * This is just a test vector for debugging excpetions. - */ -void -soft_trap(tt) -int tt; -{ - print ("Got a soft trap #"); - outbyte (tt); - outbyte ('\n'); - asm("ta 0 - nop - nop - "); -} - -/* - * Flush the instruction cache. We need to do this for the debugger stub so - * that breakpoints, et. al. become visible to the instruction stream after - * storing them in memory. - * - * For the sparclite, we need to do something here, but for a standard - * sparc (which SIS simulates), we don't. - */ - -void -flush_i_cache () -{ -} - -/* - * This will reset the processor, so we never return from here. - */ -void -target_reset() -{ - asm ("call 0 - nop "); -} - -/* - * g - read registers. - * no params. - * returns a vector of words, size is NUM_REGS. - */ -char * -target_read_registers(unsigned long *registers) -{ - char *ptr; - unsigned long *sp; - - DEBUG (1, "In target_read_registers()"); - - ptr = packet_out_buf; - ptr = mem2hex((char *)registers, ptr, 16 * 4, 0); /* G & O regs */ - ptr = mem2hex((unsigned char *)(sp + 0), ptr, 16 * 4, 0); /* L & I regs */ - memset(ptr, '0', 32 * 8); /* Floating point */ - mem2hex((char *)®isters[Y], - ptr + 32 * 4 * 2, - 8 * 4, - 0); /* Y, PSR, WIM, TBR, PC, NPC, FPSR, CPSR */ - return (ptr); -} - -/* - * G - write registers. - * param is a vector of words, size is NUM_REGS. - * returns an OK or an error number. - */ -char * -target_write_registers(unsigned long *registers) -{ - unsigned char *ptr; - unsigned long *sp; - unsigned long *newsp, psr; - - DEBUG (1, "In target_write_registers()"); - - psr = registers[PSR]; - - ptr = &packet_in_buf[1]; - - hex2mem(ptr, (char *)registers, 16 * 4, 0); /* G & O regs */ - hex2mem(ptr + 16 * 4 * 2, (unsigned char *)(sp + 0), 16 * 4, 0); /* L & I regs */ - hex2mem(ptr + 64 * 4 * 2, (char *)®isters[Y], - 8 * 4, 0); /* Y, PSR, WIM, TBR, PC, NPC, FPSR, CPSR */ - - /* - * see if the stack pointer has moved. If so, then copy the saved - * locals and ins to the new location. This keeps the window - * overflow and underflow routines happy. - */ - - newsp = (unsigned long *)registers[SP]; - if (sp != newsp) - sp = memcpy(newsp, sp, 16 * 4); - - /* Don't allow CWP to be modified. */ - - if (psr != registers[PSR]) - registers[PSR] = (psr & 0x1f) | (registers[PSR] & ~0x1f); - - return (ptr); -} - -char * -target_dump_state(unsigned long *registers) -{ - int tt; /* Trap type */ - int sigval; - char *ptr; - unsigned long *sp; - - DEBUG (1, "In target_dump_state()"); - - sp = (unsigned long *)registers[SP]; - - tt = (registers[TBR] >> 4) & 0xff; - - /* reply to host that an exception has occurred */ - sigval = computeSignal(tt); - ptr = packet_out_buf; - - *ptr++ = 'T'; - *ptr++ = hexchars[sigval >> 4]; - *ptr++ = hexchars[sigval & 0xf]; - - *ptr++ = hexchars[PC >> 4]; - *ptr++ = hexchars[PC & 0xf]; - *ptr++ = ':'; - ptr = mem2hex((unsigned char *)®isters[PC], ptr, 4, 0); - *ptr++ = ';'; - - *ptr++ = hexchars[FP >> 4]; - *ptr++ = hexchars[FP & 0xf]; - *ptr++ = ':'; - ptr = mem2hex((unsigned char *)(sp + 8 + 6), ptr, 4, 0); /* FP */ - *ptr++ = ';'; - - *ptr++ = hexchars[SP >> 4]; - *ptr++ = hexchars[SP & 0xf]; - *ptr++ = ':'; - ptr = mem2hex((unsigned char *)&sp, ptr, 4, 0); - *ptr++ = ';'; - - *ptr++ = hexchars[NPC >> 4]; - - return (packet_out_buf); -} - -void -write_pc(unsigned long *registers, unsigned long addr) -{ - DEBUG (1, "In write_pc"); - - registers[PC] = addr; - registers[NPC] = addr + 4; -} Index: erc32.ld =================================================================== --- erc32.ld (revision 1765) +++ erc32.ld (nonexistent) @@ -1,146 +0,0 @@ -/* - *uncomment this if you want the linker to output srecords. -OUTPUT_FORMAT(srec) - * - */ -STARTUP(traps.o) -INPUT(sim-crt0.o) -OUTPUT_ARCH(sparc) -SEARCH_DIR(.) -__DYNAMIC = 0; -GROUP(-lc -lsim -lgcc) - -/* - * The memory map looks like this: - * +--------------------+ <- low memory - * | .text | - * | _stext | - * | _etext | - * | ctor list | the ctor and dtor lists are for - * | dtor list | C++ support - * | _end_text | - * +--------------------+ - * | .data | initialized data goes here - * | _sdata | - * | _edata | - * +--------------------+ - * | .bss | - * | __bss_start | start of bss, cleared by crt0 - * | _end | start of heap, used by sbrk() - * +--------------------+ - * | heap space | - * | _ENDHEAP | - * | stack space | - * | __stack | top of stack - * +--------------------+ <- high memory - */ - -/* - * User modifiable values: - * - * _CLOCK_SPEED in Mhz (used to program the counter/timers) - * - * _PROM_SIZE size of PROM (permissible values are 4K, 8K, 16K - * 32K, 64K, 128K, 256K, and 512K) - * _RAM_SIZE size of RAM (permissible values are 256K, 512K, - * 1MB, 2Mb, 4Mb, 8Mb, 16Mb, and 32Mb) - * - * These symbols are only used in assembler code, so they only need to - * be listed once. They should always be refered to without SYM(). - */ - -_CLOCK_SPEED = 10; - -_PROM_SIZE = 4M; -_RAM_SIZE = 2M; - -_RAM_START = 0x02020000; -_RAM_END = _RAM_START + _RAM_SIZE; -_STACK_SIZE = (16 * 1024); -_PROM_START = 0x00000000; -_PROM_END = _PROM_START + _PROM_SIZE; - - -/* - * Base address of the on-CPU peripherals - */ - -_ERC32_MEC = 0x01f80000; - -/* - * Setup the memory map for the SIS simulator. - * stack grows up towards low memory. - */ -/* -MEMORY -{ - rom : ORIGIN = 0x00000000, LENGTH = 4M - ram (rwx) : ORIGIN = 0x02000000, LENGTH = 2M -} -*/ - -__stack = _RAM_START + _RAM_SIZE - 4 * 16; -__trap_stack = (_RAM_START + _RAM_SIZE - 4 * 16) - _STACK_SIZE; - -/* - * All the symbols that might be accessed from C code need to be - * listed twice, once with an additional underscore. aout format needs - * and extra underscore, whereas coff & elf doesn't. This is to work - * with both. - */ -SECTIONS -{ - .text 0x02000000 : { - stext = .; - _stext = .; - *(.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) - _endtext = .; - } > ram - .shbss SIZEOF(.text) + ADDR(.text) : { - *(.shbss) - } - .talias : { } > ram - .data : { - sdata = .; - _sdata = .; - *(.data) - edata = .; - _edata = .; - } > ram - .bss SIZEOF(.data) + ADDR(.data) : - { - sbss = . ; - _sbss = . ; - __bss_start = ALIGN(0x8); - *(.bss) - *(COMMON) - end = ALIGN(0x8); - _end = ALIGN(0x8); - __end = ALIGN(0x8); - ebss = .; - _ebss = .; - } - .mstack : { } > ram - .rstack : { } > ram - .stab 0 (NOLOAD) : - { - [ .stab ] - } - .stabstr 0 (NOLOAD) : - { - [ .stabstr ] - } -} Index: syscalls.c =================================================================== --- syscalls.c (revision 1765) +++ syscalls.c (nonexistent) @@ -1,85 +0,0 @@ -/* Copyright (c) 1995 Cygnus Support - * - * 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. - * - * fake unix routines for sparclite and remote debugger - * Many of these routines just substitute an appropriate error status, - * if you want some kind of file system access, you'll have to fill them in... - * sbrk on the other hand is functional (malloc uses it) but it doesn't do - * any checking for lack of memory. - * kill and _exit could get more real implementations, as well. - */ - -#include - -int -fstat(int _fd, struct stat* _sbuf) -{ - /* this is used in a few places in stdio... */ - /* just error, so they assume a pipe */ - return -1; -} - -int -isatty(int _fd) -{ - return 1; -} - -int -close(int _fd) -{ - /* return value usually ignored anyhow */ - return 0; -} - -int -open(char *filename) -{ - /* always fail */ - return -1; -} - -int -getpid() { - return 1; -} - -int -kill(int pid) { - /* if we knew how to nuke the board, we would... */ - return 0; -} - -void -_exit(int status) { - /* likewise... */ - return; -} - -int -lseek(int _fd, off_t offset, int whence) -{ - /* nothing is ever seekable */ - return -1; -} - -extern char end; -char* -sbrk(int incr) -{ - static char* base; - char *b; - if(!base) base = &end; - b = base; - base += incr; - return b; -} Index: configure.in =================================================================== --- configure.in (revision 1765) +++ configure.in (nonexistent) @@ -1,120 +0,0 @@ -# Copyright (c) 1995, 1996 Cygnus Support -# -# 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. -dnl Process this file with autoconf to produce a configure script. -AC_PREREQ(2.5)dnl -AC_INIT(sparc-stub.c) - -if test "${enable_shared}" = "yes" ; then - echo "Shared libraries not supported for cross compiling, ignored" -fi - -if test "$srcdir" = "." ; then - if test "${with_target_subdir}" != "." ; then - libgloss_topdir="${with_multisrctop}../../.." - else - libgloss_topdir="${with_multisrctop}../.." - fi -else - libgloss_topdir="${srcdir}/../.." -fi - -AC_CONFIG_AUX_DIR($libgloss_topdir) - -AC_PROG_INSTALL - -AC_CANONICAL_SYSTEM - -# FIXME: We temporarily define our own version of AC_PROG_CC. This is -# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We -# are probably using a cross compiler, which will not be able to fully -# link an executable. This should really be fixed in autoconf -# itself. - -AC_DEFUN(LIB_AC_PROG_CC, -[AC_BEFORE([$0], [AC_PROG_CPP])dnl -AC_CHECK_PROG(CC, gcc, gcc) -if test -z "$CC"; then - AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc) - test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH]) -fi - -AC_PROG_CC_GNU - -if test $ac_cv_prog_gcc = yes; then - GCC=yes -dnl Check whether -g works, even if CFLAGS is set, in case the package -dnl plays around with CFLAGS (such as to build both debugging and -dnl normal versions of a library), tasteless as that idea is. - ac_test_CFLAGS="${CFLAGS+set}" - ac_save_CFLAGS="$CFLAGS" - CFLAGS= - AC_PROG_CC_G - if test "$ac_test_CFLAGS" = set; then - CFLAGS="$ac_save_CFLAGS" - elif test $ac_cv_prog_cc_g = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-O2" - fi -else - GCC= - test "${CFLAGS+set}" = set || CFLAGS="-g" -fi -]) - -LIB_AC_PROG_CC -AS=${AS-as} -AC_SUBST(AS) -AR=${AR-ar} -AC_SUBST(AR) -LD=${LD-ld} -AC_SUBST(LD) -AC_PROG_RANLIB - -case ${target_cpu} in -sparclite*) CPU=SLITE ;; -sparclet*) CPU=SPLET ;; -sparc64*) CPU=SPARC64 ;; -sparc86x*) CPU=SLITE ;; -*) CPU=SPARC ;; -esac -AC_SUBST(CPU) - -case ${target_cpu} in -sparc64*) CYGMONLDSCRIPTTEMPL=${srcdir}/cygmon-sparc64-ld.src ;; -*) CYGMONLDSCRIPTTEMPL=${srcdir}/cygmon.ld.src -esac - -host_makefile_frag=${srcdir}/../config/default.mh -target_makefile_frag=${srcdir}/../config/default.mt - -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) -target_makefile_frag_path=$target_makefile_frag -AC_SUBST(target_makefile_frag_path) -AC_SUBST_FILE(target_makefile_frag) -AC_SUBST(CYGMONLDSCRIPTTEMPL) - -AC_OUTPUT(Makefile, -. ${libgloss_topdir}/config-ml.in, -srcdir=${srcdir} -target=${target} -ac_configure_args="${ac_configure_args} --enable-multilib" -CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} -libgloss_topdir=${libgloss_topdir} -) - Index: test.c =================================================================== --- test.c (revision 1765) +++ test.c (nonexistent) @@ -1,69 +0,0 @@ -#include "debug.h" - -char hextab[] = "0123456789abcdef"; - -int -foo(arg) - int arg; -{ - return arg+1; -} - -int -fact (i) - int i; -{ - if (i == 1) - return 1; - else - return i * fact ( i - 1); -} - -main() -{ - unsigned char c; - int num; - char foo[100]; - -#if 0 - set_debug_level(2); - - cache_on(); -#endif - - set_debug_traps(); - breakpoint(); - - print("Got to here\r\n"); - - while (1) { - c = inbyte(); - if (c == 'c') - break; - - if (c == 'd') { - set_debug_traps(); - breakpoint(); - break; - } - - print("echo "); - outbyte(c); - print("\r\n"); - } - - print("Hello world\r\n"); - - while (1) { - c = inbyte(); - - if ((c & 0x7f) == 4) - break; - - print("Char is "); - outbyte (c); - print("\r\n"); - } - - print("I escaped!\r\n"); -} Index: sparc-stub.c =================================================================== --- sparc-stub.c (revision 1765) +++ sparc-stub.c (nonexistent) @@ -1,848 +0,0 @@ -#include "sparclite.h" -/**************************************************************************** - - 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. - -****************************************************************************/ - -/**************************************************************************** - * Header: remcom.c,v 1.34 91/03/09 12:29:49 glenne Exp $ - * - * Module name: remcom.c $ - * Revision: 1.34 $ - * Date: 91/03/09 12:29:49 $ - * Contributor: Lake Stevens Instrument Division$ - * - * Description: low level support for gdb debugger. $ - * - * Considerations: only works on target hardware $ - * - * Written by: Glenn Engel $ - * ModuleState: Experimental $ - * - * NOTES: See Below $ - * - * Modified for SPARC by Stu Grossman, Cygnus Support. - * - * This code has been extensively tested on the Fujitsu SPARClite demo board. - * - * 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 by executing a trap #1. - * - ************* - * - * 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 - * - * $#. - * - * where - * :: - * :: < two hex digits computed as modulo 256 sum of > - * - * 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 -#include - -/************************************************************************ - * - * external low-level support routines - */ - -extern putDebugChar(); /* write a single character */ -extern getDebugChar(); /* read and return a single char */ - -/************************************************************************/ -/* BUFMAX defines the maximum number of characters in inbound/outbound buffers*/ -/* at least NUMREGBYTES*2 are needed for register packets */ -#define BUFMAX 2048 - -static int initialized = 0; /* !0 means we've been initialized */ - -static void set_mem_fault_trap(); - -static const char hexchars[]="0123456789abcdef"; - -#define NUMREGS 72 - -/* Number of bytes of registers. */ -#define NUMREGBYTES (NUMREGS * 4) -enum regnames {G0, G1, G2, G3, G4, G5, G6, G7, - O0, O1, O2, O3, O4, O5, SP, O7, - L0, L1, L2, L3, L4, L5, L6, L7, - I0, I1, I2, I3, I4, I5, FP, I7, - - F0, F1, F2, F3, F4, F5, F6, F7, - F8, F9, F10, F11, F12, F13, F14, F15, - F16, F17, F18, F19, F20, F21, F22, F23, - F24, F25, F26, F27, F28, F29, F30, F31, - Y, PSR, WIM, TBR, PC, NPC, FPSR, CPSR }; - -/*************************** ASSEMBLY CODE MACROS *************************/ -/* */ - -extern void trap_low(); - -asm(" - .reserve trapstack, 1000 * 4, \"bss\", 8 - - .data - .align 4 - -in_trap_handler: - .word 0 - - .text - .align 4 - -! This function is called when any SPARC trap (except window overflow or -! underflow) occurs. It makes sure that the invalid register window is still -! available before jumping into C code. It will also restore the world if you -! return from handle_exception. - - .globl _trap_low -_trap_low: - mov %psr, %l0 - mov %wim, %l3 - - srl %l3, %l0, %l4 ! wim >> cwp - cmp %l4, 1 - bne window_fine ! Branch if not in the invalid window - nop - -! Handle window overflow - - mov %g1, %l4 ! Save g1, we use it to hold the wim - srl %l3, 1, %g1 ! Rotate wim right - tst %g1 - bg good_wim ! Branch if new wim is non-zero - nop - -! At this point, we need to bring a 1 into the high order bit of the wim. -! Since we don't want to make any assumptions about the number of register -! windows, we figure it out dynamically so as to setup the wim correctly. - - not %g1 ! Fill g1 with ones - mov %g1, %wim ! Fill the wim with ones - nop - nop - nop - mov %wim, %g1 ! Read back the wim - inc %g1 ! Now g1 has 1 just to left of wim - srl %g1, 1, %g1 ! Now put 1 at top of wim - mov %g0, %wim ! Clear wim so that subsequent save - nop ! won't trap - nop - nop - -good_wim: - save %g0, %g0, %g0 ! Slip into next window - mov %g1, %wim ! Install the new wim - - std %l0, [%sp + 0 * 4] ! save L & I registers - std %l2, [%sp + 2 * 4] - std %l4, [%sp + 4 * 4] - std %l6, [%sp + 6 * 4] - - std %i0, [%sp + 8 * 4] - std %i2, [%sp + 10 * 4] - std %i4, [%sp + 12 * 4] - std %i6, [%sp + 14 * 4] - - restore ! Go back to trap window. - mov %l4, %g1 ! Restore %g1 - -window_fine: - sethi %hi(in_trap_handler), %l4 - ld [%lo(in_trap_handler) + %l4], %l5 - tst %l5 - bg recursive_trap - inc %l5 - - set trapstack+1000*4, %sp ! Switch to trap stack - -recursive_trap: - st %l5, [%lo(in_trap_handler) + %l4] - sub %sp,(16+1+6+1+72)*4,%sp ! Make room for input & locals - ! + hidden arg + arg spill - ! + doubleword alignment - ! + registers[72] local var - - std %g0, [%sp + (24 + 0) * 4] ! registers[Gx] - std %g2, [%sp + (24 + 2) * 4] - std %g4, [%sp + (24 + 4) * 4] - std %g6, [%sp + (24 + 6) * 4] - - std %i0, [%sp + (24 + 8) * 4] ! registers[Ox] - std %i2, [%sp + (24 + 10) * 4] - std %i4, [%sp + (24 + 12) * 4] - std %i6, [%sp + (24 + 14) * 4] - ! F0->F31 not implemented - mov %y, %l4 - mov %tbr, %l5 - st %l4, [%sp + (24 + 64) * 4] ! Y - st %l0, [%sp + (24 + 65) * 4] ! PSR - st %l3, [%sp + (24 + 66) * 4] ! WIM - st %l5, [%sp + (24 + 67) * 4] ! TBR - st %l1, [%sp + (24 + 68) * 4] ! PC - st %l2, [%sp + (24 + 69) * 4] ! NPC - - ! CPSR and FPSR not impl - - or %l0, 0xf20, %l4 - mov %l4, %psr ! Turn on traps, disable interrupts - - call _handle_exception - add %sp, 24 * 4, %o0 ! Pass address of registers - -! Reload all of the registers that aren't on the stack - - ld [%sp + (24 + 1) * 4], %g1 ! registers[Gx] - ldd [%sp + (24 + 2) * 4], %g2 - ldd [%sp + (24 + 4) * 4], %g4 - ldd [%sp + (24 + 6) * 4], %g6 - - ldd [%sp + (24 + 8) * 4], %i0 ! registers[Ox] - ldd [%sp + (24 + 10) * 4], %i2 - ldd [%sp + (24 + 12) * 4], %i4 - ldd [%sp + (24 + 14) * 4], %i6 - - ldd [%sp + (24 + 64) * 4], %l0 ! Y & PSR - ldd [%sp + (24 + 68) * 4], %l2 ! PC & NPC - - restore ! Ensure that previous window is valid - save %g0, %g0, %g0 ! by causing a window_underflow trap - - mov %l0, %y - mov %l1, %psr ! Make sure that traps are disabled - ! for rett - - sethi %hi(in_trap_handler), %l4 - ld [%lo(in_trap_handler) + %l4], %l5 - dec %l5 - st %l5, [%lo(in_trap_handler) + %l4] - - jmpl %l2, %g0 ! Restore old PC - rett %l3 ! Restore old nPC -"); - -/* 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 $# */ - -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 */ - while ((ch = (getDebugChar() & 0x7f)) != '$') ; - - checksum = 0; - xmitcsum = -1; - - count = 0; - - /* now, read until a # or end of buffer is found */ - while (count < BUFMAX) - { - ch = getDebugChar() & 0x7f; - if (ch == '#') - break; - checksum = checksum + ch; - buffer[count] = ch; - count = count + 1; - } - - if (count >= BUFMAX) - continue; - - buffer[count] = 0; - - if (ch == '#') - { - xmitcsum = hex(getDebugChar() & 0x7f) << 4; - xmitcsum |= hex(getDebugChar() & 0x7f); -#if 0 - /* 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; - - /* $#. */ - 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() & 0x7f) != '+'); -} - -static char remcomInBuffer[BUFMAX]; -static char remcomOutBuffer[BUFMAX]; - -/* Indicate to caller of mem2hex or hex2mem that there has been an - error. */ -static volatile int mem_err = 0; - -/* 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; - - set_mem_fault_trap(may_fault); - - while (count-- > 0) - { - ch = *mem++; - if (mem_err) - return 0; - *buf++ = hexchars[ch >> 4]; - *buf++ = hexchars[ch & 0xf]; - } - - *buf = 0; - - set_mem_fault_trap(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 char * -hex2mem(buf, mem, count, may_fault) - unsigned char *buf; - unsigned char *mem; - int count; - int may_fault; -{ - int i; - unsigned char ch; - - set_mem_fault_trap(may_fault); - - for (i=0; itt && ht->signo; ht++) - exceptionHandler(ht->tt, trap_low); - - /* In case GDB is started before us, ack any packets (presumably - "$?#xx") sitting there. */ - - putDebugChar ('+'); - - initialized = 1; -} - -asm (" -! Trap handler for memory errors. This just sets mem_err to be non-zero. It -! assumes that %l1 is non-zero. This should be safe, as it is doubtful that -! 0 would ever contain code that could mem fault. This routine will skip -! past the faulting instruction after setting mem_err. - - .text - .align 4 - -_fltr_set_mem_err: - sethi %hi(_mem_err), %l0 - st %l1, [%l0 + %lo(_mem_err)] - jmpl %l2, %g0 - rett %l2+4 -"); - -static void -set_mem_fault_trap(enable) - int enable; -{ - extern void fltr_set_mem_err(); - mem_err = 0; - - if (enable) - exceptionHandler(9, fltr_set_mem_err); - else - exceptionHandler(9, trap_low); -} - -/* Convert the SPARC hardware trap type code 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 unsigned int -hexToInt(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); -} - -/* - * This function does all command procesing for interfacing to gdb. It - * returns 1 if you should skip the instruction at the trap address, 0 - * otherwise. - */ - -extern void breakinst(); - -static void -handle_exception (registers) - unsigned long *registers; -{ - int tt; /* Trap type */ - int sigval; - unsigned int addr; - int length; - char *ptr; - unsigned long *sp; - -/* First, we must force all of the windows to be spilled out */ - - asm(" save %sp, -64, %sp - save %sp, -64, %sp - save %sp, -64, %sp - save %sp, -64, %sp - save %sp, -64, %sp - save %sp, -64, %sp - save %sp, -64, %sp - save %sp, -64, %sp - restore - restore - restore - restore - restore - restore - restore - restore -"); - - if (registers[PC] == (unsigned long)breakinst) - { - registers[PC] = registers[NPC]; - registers[NPC] += 4; - } - - sp = (unsigned long *)registers[SP]; - - tt = (registers[TBR] >> 4) & 0xff; - - /* reply to host that an exception has occurred */ - sigval = computeSignal(tt); - ptr = remcomOutBuffer; - - *ptr++ = 'T'; - *ptr++ = hexchars[sigval >> 4]; - *ptr++ = hexchars[sigval & 0xf]; - - *ptr++ = hexchars[PC >> 4]; - *ptr++ = hexchars[PC & 0xf]; - *ptr++ = ':'; - ptr = mem2hex((char *)®isters[PC], ptr, 4, 0); - *ptr++ = ';'; - - *ptr++ = hexchars[FP >> 4]; - *ptr++ = hexchars[FP & 0xf]; - *ptr++ = ':'; - ptr = mem2hex(sp + 8 + 6, ptr, 4, 0); /* FP */ - *ptr++ = ';'; - - *ptr++ = hexchars[SP >> 4]; - *ptr++ = hexchars[SP & 0xf]; - *ptr++ = ':'; - ptr = mem2hex((char *)&sp, ptr, 4, 0); - *ptr++ = ';'; - - *ptr++ = hexchars[NPC >> 4]; - *ptr++ = hexchars[NPC & 0xf]; - *ptr++ = ':'; - ptr = mem2hex((char *)®isters[NPC], ptr, 4, 0); - *ptr++ = ';'; - - *ptr++ = hexchars[O7 >> 4]; - *ptr++ = hexchars[O7 & 0xf]; - *ptr++ = ':'; - ptr = mem2hex((char *)®isters[O7], ptr, 4, 0); - *ptr++ = ';'; - - *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 */ - break; - - case 'g': /* return the value of the CPU registers */ - { - ptr = remcomOutBuffer; - ptr = mem2hex((char *)registers, ptr, 16 * 4, 0); /* G & O regs */ - ptr = mem2hex(sp + 0, ptr, 16 * 4, 0); /* L & I regs */ - memset(ptr, '0', 32 * 8); /* Floating point */ - mem2hex((char *)®isters[Y], - ptr + 32 * 4 * 2, - 8 * 4, - 0); /* Y, PSR, WIM, TBR, PC, NPC, FPSR, CPSR */ - } - break; - - case 'G': /* set the value of the CPU registers - return OK */ - { - unsigned long *newsp, psr; - - psr = registers[PSR]; - - ptr = &remcomInBuffer[1]; - hex2mem(ptr, (char *)registers, 16 * 4, 0); /* G & O regs */ - hex2mem(ptr + 16 * 4 * 2, sp + 0, 16 * 4, 0); /* L & I regs */ - hex2mem(ptr + 64 * 4 * 2, (char *)®isters[Y], - 8 * 4, 0); /* Y, PSR, WIM, TBR, PC, NPC, FPSR, CPSR */ - - /* See if the stack pointer has moved. If so, then copy the saved - locals and ins to the new location. This keeps the window - overflow and underflow routines happy. */ - - newsp = (unsigned long *)registers[SP]; - if (sp != newsp) - sp = memcpy(newsp, sp, 16 * 4); - - /* Don't allow CWP to be modified. */ - - if (psr != registers[PSR]) - registers[PSR] = (psr & 0x1f) | (registers[PSR] & ~0x1f); - - strcpy(remcomOutBuffer,"OK"); - } - 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; - - /* kill the program */ - case 'k' : /* do nothing */ - break; -#if 0 - case 't': /* Test feature */ - asm (" std %f30,[%sp]"); - break; -#endif - case 'r': /* Reset */ - asm ("call 0 - nop "); - break; - -#if 0 -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"); /* Ack before changing speed */ - set_timer_3(baudrate); /* Set it */ - } -x1: break; -#endif - } /* switch */ - - /* reply to the request */ - putpacket(remcomOutBuffer); - } -} - -/* This function will generate a breakpoint exception. It is used at the - beginning of a program to sync up with a debugger and can be used - otherwise as a quick means to stop program execution and "break" into - the debugger. */ - -void -breakpoint() -{ - if (!initialized) - return; - - asm(" .globl _breakinst - - _breakinst: ta 1 - "); -} Index: libsys/syscall.h =================================================================== --- libsys/syscall.h (revision 1765) +++ libsys/syscall.h (nonexistent) @@ -1,39 +0,0 @@ -#ifndef _SYSCALL_H_ -#define _SYSCALL_H_ - -/* - * This file defines the minimal set of system calls needed - * by newlib for both sunos4 and solaris2. - * - * WARNING: This file can be included by assembler files. - */ - -/* Process control. */ -#define SYS_exit 1 -#define SYS_getpid 20 -#define SYS_kill 37 - -/* File stuff. */ -#define SYS_read 3 -#define SYS_write 4 -#define SYS_open 5 -#define SYS_close 6 -#define SYS_lseek 19 - -/* Memory stuff. */ -#define SYS_brk 17 - -/* Directory stuff. */ -#define SYS_unlink 10 -#define SYS_chdir 12 -#ifdef SVR4 -#define SYS_stat 18 -#define SYS_fstat 28 -#define SYS_lstat 88 -#else -#define SYS_stat 38 -#define SYS_fstat 62 -#define SYS_lstat 40 -#endif - -#endif /* _SYSCALL_H_ */ Index: libsys/configure =================================================================== --- libsys/configure (revision 1765) +++ libsys/configure (nonexistent) @@ -1,991 +0,0 @@ -#! /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=libsys-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 <&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 </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 < 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 <> $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 -
libsys/configure Property changes : Deleted: svn:executable ## -1 +0,0 ## -* \ No newline at end of property Index: libsys/syscallasm.h =================================================================== --- libsys/syscallasm.h (revision 1765) +++ libsys/syscallasm.h (nonexistent) @@ -1,93 +0,0 @@ -#ifndef _SYSCALLASM_H_ -#define _SYSCALLASM_H_ - -/* - * This file defines the system calls for SPARC for the assembler. - * Anything C-ish is not allowed in this file. - * C files should include syscall.h. - */ - -#include "syscall.h" - -/* Some macros for writing assember syscall stubs. */ - -#ifdef SVR4 -#define TEXT_SECTION .section ".text" -#define DATA_SECTION .section ".data" -#define ALIGN(x) .align x -#define GLOBAL(sym) .global sym -#define WORD(x) .long x -#define ASM_SYMBOL(name) name -#define ASM_PRIVATE_SYMBOL(name) _##name -#define SYSCALL_TRAP 8 -#else -#define TEXT_SECTION .text -#define DATA_SECTION .data -#define ALIGN(x) .align x -#define GLOBAL(sym) .global sym -#define WORD(x) .word x -#define ASM_SYMBOL(name) _##name -#define ASM_PRIVATE_SYMBOL(name) name -#define SYSCALL_TRAP 0 -#endif - -#define defsyscall(name, n) \ - TEXT_SECTION ; \ - ALIGN (4) ; \ - GLOBAL (ASM_SYMBOL (name)) ; \ -ASM_SYMBOL (name): \ - mov n,%g1 ; \ - ta SYSCALL_TRAP ; \ - bcc noerr ; \ - sethi %hi (ASM_PRIVATE_SYMBOL (cerror)),%g1 ; \ - or %g1,%lo (ASM_PRIVATE_SYMBOL (cerror)),%g1 ; \ - jmpl %g1+%g0,%g0 ; \ - nop ; \ -noerr: \ - jmpl %o7+8,%g0 ; \ - nop - -/* Support for reentrant syscalls. The "struct _reent *" arg is always the - the first one. After that we allow up to four additional args. We could - allow more, but that's all we need for now. - - It may seem inefficient to have the reent arg be the first one as it means - copying all the other args into place (as opposed to making the reent arg - the last one in which case there wouldn't be any copying). I chose a clean - design over an extra four instructions in a system call. All other - reentrant functions use the first arg this way. - ??? Of course this scheme breaks down if we need to support 6 or more args. - - And of course the system calls aren't *really* reentrant. The intent - is to exercise the reentrancy framework rather than provide/claim - real reentrancy for this port. -*/ - -#define defsyscall_r(name, n) \ - TEXT_SECTION ; \ - ALIGN (4) ; \ - GLOBAL (ASM_SYMBOL (name)) ; \ -ASM_SYMBOL (name): \ - mov n,%g1 ; \ - mov %o0,%o5 ; \ - mov %o1,%o0 ; \ - mov %o2,%o1 ; \ - mov %o3,%o2 ; \ - mov %o4,%o3 ; \ - ta SYSCALL_TRAP ; \ - bcc noerr ; \ - sethi %hi (ASM_PRIVATE_SYMBOL (cerror_r)),%g1 ; \ - or %g1,%lo (ASM_PRIVATE_SYMBOL (cerror_r)),%g1 ; \ - jmpl %g1+%g0,%g0 ; \ - mov %o5,%o1 ; \ -noerr: \ - jmpl %o7+8,%g0 ; \ - nop - -#define seterrno() \ - sethi %hi (ASM_PRIVATE_SYMBOL (cerror)),%g1 ; \ - or %g1,%lo (ASM_PRIVATE_SYMBOL (cerror)),%g1 ; \ - jmpl %g1+%g0,%g0 ; \ - nop - -#endif /* _SYSCALLASM_H_ */ Index: libsys/Makefile.in =================================================================== --- libsys/Makefile.in (revision 1765) +++ libsys/Makefile.in (nonexistent) @@ -1,167 +0,0 @@ -# Makefile for libgloss/sparc/libsys -# Copyright (c) 1996 Cygnus Support. -# All rights reserved. -# -# Redistribution and use in source and binary forms are permitted -# provided that the above copyright notice and this paragraph are -# duplicated in all such forms and that any documentation, -# advertising materials, and other materials related to such -# distribution and use acknowledge that the software was developed -# at Cygnus Support, Inc. Cygnus Support, Inc. may not be used to -# endorse or promote products derived from this software without -# specific prior written permission. -# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR -# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED -# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. - -VPATH = @srcdir@ -srcdir = @srcdir@ -objdir = . -srcroot = $(srcdir)/../.. -objroot = $(objdir)/../.. - -prefix = @prefix@ -exec_prefix = @exec_prefix@ - -host_alias = @host_alias@ -target_alias = @target_alias@ - -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@ - -# _r.o is for the reentrant syscall stubs. -# The .S_r.o/.c_r.o rules are from host/any. - -.SUFFIXES: .c .S .o _r.o - -.S_r.o: - $(CC) $(CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS) $(NEWLIB_CFLAGS) -DREENT $(INCLUDES) -c $< -o $@ -.c_r.o: - $(CC) $(CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS) $(NEWLIB_CFLAGS) -DREENT $(INCLUDES) -c $< -o $@ - -# CFILES_R, SFILES_R, and TEMPLATE_SFILES_R define those system calls that are -# needed by the ANSI C part of newlib when REENTRANT_SYSCALLS_PROVIDED is -# defined. - -CFILES = isatty.c - -CFILES_R = - -SFILES = cerror.S _exit.S - -SFILES_R = sbrk.S - -# List of files built from template.S (with an '_' suffix). - -TEMPLATE_SFILES = chdir_ lstat_ - -TEMPLATE_SFILES_R = close_ fstat_ getpid_ kill_ \ - lseek_ open_ read_ stat_ unlink_ write_ - -# If newlib defines REENTRANT_SYSCALLS_PROVIDED, then these are used as well. -REENTRANT_OFILES = $(SFILES_R:.S=_r.o) $(TEMPLATE_SFILES_R:_=_r.o) \ - $(CFILES_R:.c=_r.o) - -OFILES = $(SFILES:.S=.o) $(SFILES_R:.S=.o) \ - $(TEMPLATE_SFILES:_=.o) $(TEMPLATE_SFILES_R:_=.o) \ - $(CFILES:.c=.o) $(CFILES_R:.c=.o) \ - $(REENTRANT_OFILES) - -#### Host specific Makefile fragment comes in here. -@host_makefile_frag@ - -all: libsys.a libsys-crt0.o - -libsys.a: $(OFILES) - rm -f $@ - $(AR) $(AR_FLAGS) $@ $(OFILES) - -install: - $(INSTALL_DATA) libsys-crt0.o $(tooldir)/lib/libsys-crt0.o - $(INSTALL_DATA) libsys.a $(tooldir)/lib/libsys.a - -doc: - -.PHONY: info install-info clean-info -info: -install-info: -clean-info: - -clean mostlyclean: - rm -f *.o *.a *.s stamp-srcs - -distclean maintainer-clean realclean: clean - rm -f Makefile config.status - -Makefile: Makefile.in config.status @host_makefile_frag_path@ - $(SHELL) config.status - -config.status: configure - $(SHELL) config.status --recheck - -stamp-srcs: Makefile template.S template_r.S - for f in $(TEMPLATE_SFILES:_=) ; \ - do \ - $(CC) -E -Dfunc=$$f \ - $(CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS) $(NEWLIB_CFLAGS) $(INCLUDES) \ - $(srcdir)/template.S >$$f.S ; \ - done - for f in $(TEMPLATE_SFILES_R:_=) ; \ - do \ - $(CC) -E -Dfunc=$$f \ - $(CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS) $(NEWLIB_CFLAGS) $(INCLUDES) \ - $(srcdir)/template_r.S | sed -e 's/^_/#/' >$$f.S ; \ - done - touch stamp-srcs - -# Make a dependency for each file built from a template. - -$(TEMPLATE_SFILES:_=.S) $(TEMPLATE_SFILES_R:_=.S): stamp-srcs - -# To support SunOS broken VPATH (sigh). - -_exit.o: _exit.S -cerror.o: cerror.S -chdir.o: chdir.S -close.o: close.S -fstat.o: fstat.S -getpid.o: getpid.S -isatty.o: isatty.c -kill.o: kill.S -libsys-crt0.o: libsys-crt0.S -lseek.o: lseek.S -lstat.o: lstat.S -open.o: open.S -read.o: read.S -sbrk.o: sbrk.S -stat.o: stat.S -write.o: write.S - -# Reentrant versions ... -# These are all needed to support the ANSI C library routines. - -close_r.o: close.S -fstat_r.o: fstat.S -getpid_r.o: getpid.S -kill_r.o: kill.S -lseek_r.o: lseek.S -open_r.o: open.S -read_r.o: read.S -sbrk_r.o: sbrk.S -stat_r.o: stat.S -unlink_r.o: unlink.S -write_r.o: write.S Index: libsys/sbrk.S =================================================================== --- libsys/sbrk.S (revision 1765) +++ libsys/sbrk.S (nonexistent) @@ -1,66 +0,0 @@ -! sbrk() system call - -#include "syscallasm.h" - - TEXT_SECTION - ALIGN (4) -#ifdef REENT - GLOBAL (ASM_SYMBOL (_sbrk_r)) -ASM_SYMBOL (_sbrk_r): - mov %o0,%o5 - mov %o1,%o0 -#else - GLOBAL (ASM_SYMBOL (sbrk)) -ASM_SYMBOL (sbrk): -#endif - add %o0,7,%o0 - andn %o0,7,%o0 - sethi %hi (ASM_PRIVATE_SYMBOL (curbrk)),%o2 -#ifdef __sparc_v9__ - lduw [%o2+%lo (ASM_PRIVATE_SYMBOL (curbrk))],%o3 -#else - ld [%o2+%lo (ASM_PRIVATE_SYMBOL (curbrk))],%o3 -#endif - add %o3,7,%o3 - andn %o3,7,%o3 - add %o3,%o0,%o0 - mov %o0,%o4 - mov SYS_brk,%g1 - ta SYSCALL_TRAP - bcs err - nop - st %o4,[%o2+%lo (ASM_PRIVATE_SYMBOL (curbrk))] - jmpl %o7+8,%g0 - mov %o3,%o0 - -#ifdef REENT - GLOBAL (ASM_SYMBOL (_brk_r)) -ASM_SYMBOL (_brk_r): - mov %o0,%o5 - mov %o1,%o0 -#else - GLOBAL (ASM_SYMBOL (brk)) -ASM_SYMBOL (brk): -#endif - add %o0,7,%o0 - andn %o0,7,%o0 - mov %o0,%o2 - mov SYS_brk,%g1 - ta SYSCALL_TRAP - bcs err - nop - sethi %hi (ASM_PRIVATE_SYMBOL (curbrk)),%o3 - st %o2,[%o3+%lo (ASM_PRIVATE_SYMBOL (curbrk))] - retl - mov %g0,%o0 - -err: -#ifdef REENT - sethi %hi (ASM_PRIVATE_SYMBOL (cerror_r)),%g1 - or %g1,%lo (ASM_PRIVATE_SYMBOL (cerror_r)),%g1 -#else - sethi %hi (ASM_PRIVATE_SYMBOL (cerror)),%g1 - or %g1,%lo (ASM_PRIVATE_SYMBOL (cerror)),%g1 -#endif - jmpl %g1,%g0 - mov %o5,%o1 Index: libsys/configure.in =================================================================== --- libsys/configure.in (revision 1765) +++ libsys/configure.in (nonexistent) @@ -1,50 +0,0 @@ -# Configure.in for libgloss/sparc/libsys -# Copyright (c) 1996 Cygnus Support -# All rights reserved. -# -# Redistribution and use in source and binary forms are permitted -# provided that the above copyright notice and this paragraph are -# duplicated in all such forms and that any documentation, -# advertising materials, and other materials related to such -# distribution and use acknowledge that the software was developed -# at Cygnus Support, Inc. Cygnus Support, Inc. may not be used to -# endorse or promote products derived from this software without -# specific prior written permission. -# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR -# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED -# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. - -dnl Process this file with autoconf to produce a configure script. -AC_PREREQ(2.5)dnl -AC_INIT(libsys-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) Index: libsys/_exit.S =================================================================== --- libsys/_exit.S (revision 1765) +++ libsys/_exit.S (nonexistent) @@ -1,14 +0,0 @@ -! _exit() system call - -#include "syscallasm.h" - - TEXT_SECTION - ALIGN (4) - GLOBAL (ASM_SYMBOL (_exit)) -ASM_SYMBOL (_exit): - mov SYS_exit,%g1 - ta SYSCALL_TRAP - -! If that returns (yikes!), try an illegal insn ... - - WORD (0) \ No newline at end of file Index: libsys/libsys-crt0.S =================================================================== --- libsys/libsys-crt0.S (revision 1765) +++ libsys/libsys-crt0.S (nonexistent) @@ -1,127 +0,0 @@ -! C run time start off - -! This file supports: -! -! - both 32bit pointer and 64bit pointer environments (at compile time) -! - an imposed stack bias (of 2047) (at run time) -! - medium/low and medium/anywhere code models (at run time) - -! Initial stack setup: -! -! bottom of stack (higher memory address) -! ... -! text of environment strings -! text of argument strings -! envp[envc] = 0 (4/8 bytes) -! ... -! env[0] (4/8 bytes) -! argv[argc] = 0 (4/8 bytes) -! ... -! argv[0] (4/8 bytes) -! argc (4/8 bytes) -! register save area (64 bits by 16 registers = 128 bytes) -! top of stack (%sp) - -! Stack Bias: -! -! It is the responsibility of the o/s to set this up. -! We handle both a 0 and 2047 value for the stack bias. - -! Medium/Anywhere code model support: -! -! In this model %g4 points to the start of the data segment. -! The text segment can go anywhere, but %g4 points to the *data* segment. -! It is up to the compiler/linker to get this right. -! -! Since this model is statically linked the start of the data segment -! is known at link time. Eg: -! -! sethi %hh(data_start), %g1 -! sethi %lm(data_start), %g4 -! or %g1, %hm(data_start), %g1 -! or %g4, %lo(data_start), %g4 -! sllx %g1, 32, %g1 -! or %g4, %g1, %g4 -! -! FIXME: For now we just assume 0. - -! FIXME: if %g1 contains a non-zero value, atexit() should be invoked -! with this value. - -#include "syscallasm.h" - -#ifndef TARGET_PTR_SIZE -#define TARGET_PTR_SIZE 32 -#endif - - TEXT_SECTION - ALIGN (4) - GLOBAL (ASM_PRIVATE_SYMBOL (start)) -ASM_PRIVATE_SYMBOL (start): - clr %fp - -! We use %g4 even if the code model is Medium/Low (simplifies the code). - - clr %g4 ! Medium/Anywhere base reg - -! If there is a stack bias in effect, account for it in %g5. Then always -! add %g5 to stack references below. This way the code can be used with -! or without an imposed bias. - - andcc %sp, 1, %g5 - bnz,a .LHaveBias - mov 2047, %g5 -.LHaveBias: - add %sp, %g5, %sp - -#if TARGET_PTR_SIZE == 32 - ! FIXME: We apparently assume here that there is no reserved word. - ! This is probably correct, but try to verify it. - ld [%sp + 0x80], %o0 ! argc - add %sp, 0x84, %o1 ! argv - add %o0, 1, %o2 - sll %o2, 2, %o2 -#else /* TARGET_PTR_SIZE == 64 */ - ld [%sp + 0x8c], %o0 ! argc.lo - add %sp, 0x90, %o1 ! argv - add %o0, 1, %o2 - sll %o2, 3, %o2 -#endif - add %o1, %o2, %o2 ! envp - sethi %hi (ASM_SYMBOL (environ)), %o3 - or %o3, %lo (ASM_SYMBOL (environ)), %o3 -#if TARGET_PTR_SIZE == 32 - st %o2, [%o3 + %g4] -#else /* TARGET_PTR_SIZE == 64 */ - stx %o2, [%o3 + %g4] -#endif - -! Restore any stack bias before we call main() ... - - sub %sp, %g5, %sp - - GLOBAL (ASM_SYMBOL (main)) - call ASM_SYMBOL (main) - -! FIXME: Not sure if this is needed anymore. -#if TARGET_PTR_SIZE == 32 - sub %sp, 0x20, %sp ! room to push args -#else /* TARGET_PTR_SIZE == 64 */ - sub %sp, 0x30, %sp ! room to push args -#endif - - GLOBAL (ASM_SYMBOL (exit)) - call ASM_SYMBOL (exit) - nop - - GLOBAL (ASM_SYMBOL (_exit)) - call ASM_SYMBOL (_exit) - nop - - set SYS_exit, %g1 - ta SYSCALL_TRAP ! in case user redefines __exit - -! If all the above methods fail to terminate the program, try an illegal insn. -! If that does not work, the o/s is hosed more than we are. - - WORD (0) Index: libsys/template.S =================================================================== --- libsys/template.S (revision 1765) +++ libsys/template.S (nonexistent) @@ -1,14 +0,0 @@ -/* system call template */ - -/* Lots of system calls are trivial functions, so we build their source files - from a template. New syscalls can be added simply by editing the - Makefile! - - Usage: Compile this file with "func" set to the name of the syscall. */ - -#include "syscallasm.h" - -#define concat(a,b) a##b -#define makesys(a) concat (SYS_, a) - - defsyscall (func, makesys(func)) Index: libsys/cerror.S =================================================================== --- libsys/cerror.S (revision 1765) +++ libsys/cerror.S (nonexistent) @@ -1,47 +0,0 @@ -! Set errno. -! This function is called by all the syscall stubs. -! -! FIXME: We assume errno is the first member of struct _reent. -! Not sure what to do about this. - -#include "syscallasm.h" - - DATA_SECTION - ALIGN (4) - GLOBAL (ASM_SYMBOL (errno)) ! FIXME: ASM_PRIVATE_SYMBOL ? -ASM_SYMBOL (errno): - WORD (0) - - TEXT_SECTION - ALIGN (4) - - GLOBAL (ASM_PRIVATE_SYMBOL (cerror)) -ASM_PRIVATE_SYMBOL (cerror): - sethi %hi (ASM_SYMBOL (errno)),%g1 - st %o0,[%g1+%lo (ASM_SYMBOL (errno))] - jmpl %o7+8,%g0 - mov -1,%o0 - - GLOBAL (ASM_PRIVATE_SYMBOL (cerror_r)) -ASM_PRIVATE_SYMBOL (cerror_r): - st %o0,[%o1] - jmpl %o7+8,%g0 - mov -1,%o0 - -! Since all system calls need this file, we put various state globals -! here as well. - - DATA_SECTION - -! CURBRK contains the current top of allocated space. -! END is a private symbol in svr4, but a public one in sunos4. -! FIXME: CURBRK is 4 bytes for now. - - ALIGN (4) - GLOBAL (ASM_PRIVATE_SYMBOL (curbrk)) -ASM_PRIVATE_SYMBOL (curbrk): -#ifdef SVR4 - WORD (ASM_PRIVATE_SYMBOL (end)) -#else - WORD (ASM_SYMBOL (end)) -#endif Index: libsys/template_r.S =================================================================== --- libsys/template_r.S (revision 1765) +++ libsys/template_r.S (nonexistent) @@ -1,26 +0,0 @@ -/* reentrant system call template */ - -/* Lots of system calls are trivial functions, so we build their source files - from a template. New syscalls can be added simply by editing the - Makefile! - - The system calls aren't necessarily reentrant. If we were being used in - an embedded system they could be. Reentrant syscalls are also used, - however, to provide ANSI C namespace clean access to the host o/s. - - Usage: Compile this file with "func" set to the name of the syscall. */ - -#include "syscallasm.h" - -#define concat(a,b) a##b -#define concat3(a,b,c) a##b##c -#define makesys(a) concat (SYS_, a) -#define make_r_fn(a) concat3 (_, a, _r) - -/* The leading _'s get turned into #'s by the Makefile. */ - -_ifdef REENT - defsyscall_r (make_r_fn (func), makesys (func)) -_else - defsyscall (func, makesys (func)) -_endif Index: libsys/isatty.c =================================================================== --- libsys/isatty.c (revision 1765) +++ libsys/isatty.c (nonexistent) @@ -1,17 +0,0 @@ -/* isatty.c */ - -/* Dumb implementation so programs will at least run. */ - -#include - -int -isatty (int fd) -{ - struct stat buf; - - if (fstat (fd, &buf) < 0) - return 0; - if (S_ISCHR (buf.st_mode)) - return 1; - return 0; -} Index: slite.h =================================================================== --- slite.h (revision 1765) +++ slite.h (nonexistent) @@ -1,127 +0,0 @@ -/* - * Copyright (c) 1995, 1996 Cygnus Support - * - * 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. - */ - -#define STACK_SIZE 16 * 1024 -#define TRAP_STACK_SIZE 4 * 1024 -#define NUM_REGS 20 - -#ifdef SL933 -#define NUMBER_OF_REGISTER_WINDOWS 6 -#else -#define NUMBER_OF_REGISTER_WINDOWS 8 -#endif - -#if (NUMBER_OF_REGISTER_WINDOWS == 8) -#define SPARC_PSR_CWP_MASK 0x07 /* bits 0 - 4 */ -#elif (NUMBER_OF_REGISTER_WINDOWS == 16) -#define SPARC_PSR_CWP_MASK 0x0F /* bits 0 - 4 */ -#elif (NUMBER_OF_REGISTER_WINDOWS == 32) -#define SPARC_PSR_CWP_MASK 0x1F /* bits 0 - 4 */ -#else -#error "Unsupported number of register windows for this cpu" -#endif - -/* The traptable has to be the first code in a boot PROM. */ - -/* - * Entry for traps which jump to a programmer-specified trap handler. - */ - -#define TRAP(_handler) \ - sethi %hi(_handler), %l3 ; \ - jmpl %l3+%lo(_handler), %g0 ; \ - mov %wim, %l0 ; \ - nop - -/* Unexcpected trap will halt the processor by forcing it to error state */ -#if 1 -#define BAD_TRAP ta 0; nop; nop; nop; -#else -#define BAD_TRAP \ - mov %psr, l0 ; \ - mov 0x0, %o0 ; \ - sethi %hi(SYM(bad_trap)), l4 ; \ - jmp l4+%lo(SYM(bad_trap)); -#endif - -/* Software trap. Treat as BAD_TRAP for the time being... */ -#if 1 -#define SOFT_TRAP BAD_TRAP -#else -#define SOFT_TRAP \ - mov $psr, $l0 ; \ - mov 0x0, $o0 ; \ - sethi $hi(SYM(soft_trap)), l4 ; \ - jmp l4+$lo(SYM(soft_trap)); -#endif - -#define PSR_INIT 0x10c0 /* Disable traps, set s and ps */ -#define TBR_INIT 0 -#define WIM_INIT 2 -#define SP_INIT 0x023ffff0 - -/* Macros for reading and writing to arbitrary address spaces. Note that ASI - must be a constant (sorry, but the SPARC can only specify ASIs as part of an - instruction. */ - -#define read_asi(ASI, LOC) \ - ({ \ - unsigned int val; \ - __asm__ volatile ("lda [%r1]%2,%0" : "=r" (val) : "rJ" (LOC), "I" (ASI)); \ - val; \ - }) - -#define write_asi(ASI, LOC, VAL) \ - __asm__ volatile ("sta %0,[%r1]%2" : : "r" (VAL), "rJ" (LOC), "I" (ASI)); - -/* - * Use this when modifying registers that cause memory to be modified. This - * will cause GCC to reload all values after this point. - */ -#define write_asi_volatile(ASI, LOC, VAL) \ - __asm__ volatile ("sta %0,[%r1]%2" : : "r" (VAL), "rJ" (LOC), "I" (ASI) \ - : "memory"); - -#define WRITE_PC(x) registers[PC] = x; registers[NPC] = x + 4; - -/* - * Processor Status Register (psr) - * - * 31 28|27 24|23 20|19 12|11 9|7|6|5|4 0 - * +------+-------+-------+-------+------+-+-+-+--------+ - * | impl | ver | icc | res. | pil | | | | cwp | - * +------+-------+-------+-------+------+-+-+-+--------+ - * S P E - * S T - * if ET = 1, traps are enabled, 0 means disabled. - * if S = 1, you're in supervisor mode, 0 means user mode. - * cwp points to the current window. - * - * Trap Base Register (tbr) - * - * 31 12|11 4|3 0 - * +--------------+--------------+------+ - * | tba | tt | null | - * +--------------+--------------+------+ - * - * tba contains the most sig. 20 bits of the tbr base address - * tt is the trap number. - * - * Window Invalid Register (wim) - * 31 8| 7| 6| 5| 4| 3| 2| 1| 0 - * +-------------+--+--+--+--+--+--+--+--+ - * | res. |w7|w6|w5|w4|w3|w2|w1|w0| - * +-------------+--+--+--+--+--+--+--+--+ - */ - Index: asm.h =================================================================== --- asm.h (revision 1765) +++ asm.h (nonexistent) @@ -1,39 +0,0 @@ -/* asm.h -- macros for sparc asm - * - * Copyright (c) 1996 Cygnus Support - * - * 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. - */ - -#ifndef __SPARC_ASM_h -#define __SPARC_ASM_h - -/* Indicate we are in an assembly file and get the basic CPU definitions. */ -#define ASM - -/* ANSI concatenation macros. */ -#define CONCAT1(a, b) CONCAT2(a, b) -#define CONCAT2(a, b) a ## b - -/* Use the right prefix for global labels. - Note that it's too late to have coff have no underscores - (would break user programs). - One school of thought likes having underscores for both a.out and coff - (simplicity in consistency). */ -#define SYM(x) CONCAT1 (__USER_LABEL_PREFIX__,x) - -/* STRINGSYM makes a string out of a symbol name with the proper assembly - prefix. Useful for inline assembly language in C source files. */ -#define STRINGIT2(x) #x -#define STRINGIT1(x) STRINGIT2(x) -#define STRINGSYM(x) STRINGIT1(SYM(x)) - -#endif Index: sysc-701.c =================================================================== --- sysc-701.c (revision 1765) +++ sysc-701.c (nonexistent) @@ -1,55 +0,0 @@ -/* more sparclet syscall support (the rest is in crt0-701.S). */ - -#include -#include -#include - -int -fstat(int _fd, struct stat* _sbuf) -{ - errno = ENOSYS; - return -1; -} - -int -isatty(int fd) -{ - if (fd < 0) - { - errno = EBADF; - return -1; - } - return fd <= 2; -} - -int -getpid() -{ - return 1; -} - -int -kill(int pid) -{ - /* if we knew how to nuke the board, we would... */ - return 0; -} - -int -lseek(int _fd, off_t offset, int whence) -{ - errno = ENOSYS; - return -1; -} - -extern char end; -char* -sbrk (int incr) -{ - static char* base; - char *b; - if(!base) base = &end; - b = base; - base += incr; - return b; -} Index: crt0.s =================================================================== --- crt0.s (revision 1765) +++ crt0.s (nonexistent) @@ -1,83 +0,0 @@ -! Copyright (c) 1995 Cygnus Support -! -! 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. -! -! C startup code for the Fujitsu SPARClite demo board - - .text - .align 8 - -win_ovf_trap: - sethi %hi(win_ovf), %l3 - jmpl %lo(win_ovf)+%l3, %g0 - mov %wim, %l0 - nop - -win_unf_trap: - sethi %hi(win_unf), %l3 - jmpl %lo(win_unf)+%l3, %g0 - mov %wim, %l0 - nop - -no_fpu_trap: ! Come here when no fpu exists. This just skips the - jmpl %l2, %g0 ! offending instruction. - rett %l2+4 - - .globl start - .globl _start - -start: -_start: - -! First, copy prom & trap vectors to sram - - set 0x30000000, %l0 - set 0xfff8, %l1 - tst %l1 ! Set condition codes - -copyloop: - ldd [%l1], %l2 - std %l2, [%l0 + %l1] - bg copyloop - deccc 8, %l1 - - set 0x30000000, %l0 ! Base of new trap vector - mov %l0, %tbr ! Install the new tbr - - set win_ovf_trap, %l1 ! Setup window overflow trap - ldd [%l1], %l2 - std %l2, [%l0 + 5 * 16] - ldd [%l1 + 8], %l2 - std %l2, [%l0 + 5 * 16 + 8] - - set win_unf_trap, %l1 ! Setup window underflow trap - ldd [%l1], %l2 - std %l2, [%l0 + 6 * 16] - ldd [%l1 + 8], %l2 - std %l2, [%l0 + 6 * 16 + 8] - -! Try enabling the FPU by setting EF. If that causes a trap, then we probably -! don't have an FPU. - - ldd [%l0 + 2 * 16], %l4 ! Save original trap routine - set no_fpu_trap, %l1 ! Install new one - ldd [%l1], %l2 - std %l2, [%l0 + 2 * 16] - - mov %psr, %l0 - sethi %hi(0x1000), %l1 - bset %l1, %l0 -! mov %l0, %psr - - std %l4, [2 * 16] ! Restore original trap routine - - call _main - nop Index: crt0-701.S =================================================================== --- crt0-701.S (revision 1765) +++ crt0-701.S (nonexistent) @@ -1,105 +0,0 @@ -/* crt0.S for the sparclet 701. - - At the moment, all the necessary syscalls are here. - Convention has them in a separate file but libgloss is still in - too much flux. */ - - .text - - .global start -start: - -! zero bss - - sethi %hi(_end), %o1 - or %o1, %lo(_end), %o1 - sethi %hi(_edata), %o0 - or %o0, %lo (_edata), %o0 - sub %o1, %o0, %o1 -Lzero_bss: - subcc %o1, 4, %o1 - clr [%o0] - bne Lzero_bss - add %o0, 4, %o0 - -! set up argc, argv, envp (?) - - ld [%sp+64], %o0 - sll %o0, 2, %o2 - add %o2, 4, %o2 - add %sp, 68, %o1 - add %o1, %o2, %o2 - sethi %hi(_environ), %o3 - st %o2, [%o3+%lo(_environ)] - -! call main, exit - - call _main - sub %sp, 32, %sp - call _exit - nop - -! void _exit (int rc) - - .global __exit -__exit: - mov 1, %g1 - ta 0 -! If that does not work, just loop forever. -Lloop_forever: - b Lloop_forever - nop - -! int _open (char *, int) - - .global _open -_open: - mov 5, %g1 - ta 0 - bcc Lnoerr - nop - b Lcerror - nop - -! int _close (int) - - .global _close -_close: - mov 6, %g1 - ta 0 - bcc Lnoerr - nop - b Lcerror - nop - -! int read (int, char *, int) - - .global _read -_read: - mov 3, %g1 - ta 0 - bcc Lnoerr - nop - b Lcerror - nop - -! int write (int, char *, int) - - .global _write -_write: - mov 4, %g1 - ta 0 - bcc Lnoerr - nop - b Lcerror - nop - -Lnoerr: - retl - nop - -Lcerror: - sethi %hi(__impure_ptr), %g1 - st %o0, [%g1+%lo(__impure_ptr)] - retl - mov -1, %o0

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.