aboutsummaryrefslogtreecommitdiffstats
path: root/firmware/libcommon
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2017-02-27 13:53:17 +0100
committerHarald Welte <laforge@gnumonks.org>2017-02-27 14:24:11 +0100
commit3f5e3ddffc72484baad813628f3d18621325277a (patch)
tree136c17c1b4552a6346617ede1290e6f156ac85b9 /firmware/libcommon
parent7ed6f3bc375f4eddecb7ccf10e837f3068cb4e42 (diff)
Change directory structure to align with Atmel softpack
This way we can easily check with 'diff' for differences in our code and Atmel softpack. Also, this layout is more suitable for building various different firmware images (e.g. factory-test, dfu-loader, main application) for a variety of different boards (simtrace, owhw, qmod).
Diffstat (limited to 'firmware/libcommon')
-rw-r--r--firmware/libcommon/include/iso7816_fidi.h6
-rw-r--r--firmware/libcommon/include/llist_irqsafe.h27
-rw-r--r--firmware/libcommon/include/req_ctx.h61
-rw-r--r--firmware/libcommon/include/ringbuffer.h23
-rw-r--r--firmware/libcommon/include/syscalls.h65
-rw-r--r--firmware/libcommon/include/utils.h18
-rw-r--r--firmware/libcommon/source/iso7816_fidi.c64
-rw-r--r--firmware/libcommon/source/req_ctx.c139
-rw-r--r--firmware/libcommon/source/ringbuffer.c70
-rw-r--r--firmware/libcommon/source/syscalls.c138
10 files changed, 611 insertions, 0 deletions
diff --git a/firmware/libcommon/include/iso7816_fidi.h b/firmware/libcommon/include/iso7816_fidi.h
new file mode 100644
index 0000000..e4690a5
--- /dev/null
+++ b/firmware/libcommon/include/iso7816_fidi.h
@@ -0,0 +1,6 @@
+#pragma once
+
+#include <stdint.h>
+
+/* compute the F/D ratio based on Fi and Di values */
+int compute_fidi_ratio(uint8_t fi, uint8_t di);
diff --git a/firmware/libcommon/include/llist_irqsafe.h b/firmware/libcommon/include/llist_irqsafe.h
new file mode 100644
index 0000000..9a59d3d
--- /dev/null
+++ b/firmware/libcommon/include/llist_irqsafe.h
@@ -0,0 +1,27 @@
+#pragma once
+
+#include "osmocom/core/linuxlist.h"
+
+static inline void llist_add_tail_irqsafe(struct llist_head *_new,
+ struct llist_head *head)
+{
+ __disable_irq();
+ llist_add_tail(_new, head);
+ __enable_irq();
+}
+
+static inline struct llist_head *llist_head_dequeue_irqsafe(struct llist_head *head)
+{
+ struct llist_head *lh;
+
+ __disable_irq();
+ if (llist_empty(head)) {
+ lh = NULL;
+ } else {
+ lh = head->next;
+ llist_del(lh);
+ }
+ __enable_irq();
+
+ return lh;
+}
diff --git a/firmware/libcommon/include/req_ctx.h b/firmware/libcommon/include/req_ctx.h
new file mode 100644
index 0000000..41ad84d
--- /dev/null
+++ b/firmware/libcommon/include/req_ctx.h
@@ -0,0 +1,61 @@
+#pragma once
+
+#define RCTX_SIZE_LARGE 960
+#define RCTX_SIZE_SMALL 320
+#define MAX_HDRSIZE sizeof(struct openpcd_hdr)
+
+#include <stdint.h>
+#include "osmocom/core/linuxlist.h"
+
+#define __ramfunc
+
+enum req_ctx_state {
+ /* free to be allocated */
+ RCTX_S_FREE,
+
+ /* USB -> UART */
+ /* In USB driver, waiting for data from host */
+ RCTX_S_USB_RX_BUSY,
+ /* somewhere in the main loop */
+ RCTX_S_MAIN_PROCESSING,
+ /* pending (in queue) for transmission on UART */
+ RCTX_S_UART_TX_PENDING,
+ /* currently in active transmission on UART */
+ RCTX_S_UART_TX_BUSY,
+
+ /* UART -> USB */
+ /* currently in active reception on UART */
+ RCTX_S_UART_RX_BUSY,
+ /* pending (in queue) for transmission over USB to host */
+ RCTX_S_USB_TX_PENDING,
+ /* currently in transmission over USB to host */
+ RCTX_S_USB_TX_BUSY,
+
+ /* number of states */
+ RCTX_STATE_COUNT
+};
+
+struct req_ctx {
+ /* if this req_ctx is on a queue... */
+ struct llist_head list;
+ uint32_t ep;
+
+ /* enum req_ctx_state */
+ volatile uint32_t state;
+ /* size of th 'data' buffer */
+ uint16_t size;
+ /* total number of used bytes in buffer */
+ uint16_t tot_len;
+ /* index into the buffer, user specific */
+ uint16_t idx;
+ /* actual data buffer */
+ uint8_t *data;
+};
+
+extern void req_ctx_init(void);
+extern struct req_ctx __ramfunc *req_ctx_find_get(int large, uint32_t old_state, uint32_t new_state);
+extern struct req_ctx *req_ctx_find_busy(void);
+extern void req_ctx_set_state(struct req_ctx *ctx, uint32_t new_state);
+extern void req_ctx_put(struct req_ctx *ctx);
+extern uint8_t req_ctx_num(struct req_ctx *ctx);
+unsigned int req_ctx_count(uint32_t state);
diff --git a/firmware/libcommon/include/ringbuffer.h b/firmware/libcommon/include/ringbuffer.h
new file mode 100644
index 0000000..801e96b
--- /dev/null
+++ b/firmware/libcommon/include/ringbuffer.h
@@ -0,0 +1,23 @@
+#ifndef SIMTRACE_RINGBUF_H
+#define SIMTRACE_RINGBUF_H
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <sys/types.h>
+
+#define RING_BUFLEN 128
+
+typedef struct ringbuf {
+ uint8_t buf[RING_BUFLEN];
+ size_t ird;
+ size_t iwr;
+} ringbuf;
+
+void rbuf_reset(volatile ringbuf * rb);
+uint8_t rbuf_read(volatile ringbuf * rb);
+uint8_t rbuf_peek(volatile ringbuf * rb);
+void rbuf_write(volatile ringbuf * rb, uint8_t item);
+bool rbuf_is_empty(volatile ringbuf * rb);
+bool rbuf_is_full(volatile ringbuf * rb);
+
+#endif /* end of include guard: SIMTRACE_RINGBUF_H */
diff --git a/firmware/libcommon/include/syscalls.h b/firmware/libcommon/include/syscalls.h
new file mode 100644
index 0000000..34f37b8
--- /dev/null
+++ b/firmware/libcommon/include/syscalls.h
@@ -0,0 +1,65 @@
+/* ----------------------------------------------------------------------------
+ * ATMEL Microcontroller Software Support
+ * ----------------------------------------------------------------------------
+ * Copyright (c) 2009, Atmel Corporation
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the disclaimer below.
+ *
+ * Atmel's name may not be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
+ * DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
+ * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ----------------------------------------------------------------------------
+ */
+
+/**
+ * \file syscalls.h
+ *
+ * Implementation of newlib syscall.
+ *
+ */
+
+/*----------------------------------------------------------------------------
+ * Headers
+ *----------------------------------------------------------------------------*/
+
+
+#include <stdio.h>
+#include <stdarg.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+
+/*----------------------------------------------------------------------------
+ * Exported functions
+ *----------------------------------------------------------------------------*/
+
+extern caddr_t _sbrk ( int incr ) ;
+
+extern int _close( int file ) ;
+
+extern int _fstat( int file, struct stat *st ) ;
+
+extern int _isatty( int file ) ;
+
+extern int _lseek( int file, int ptr, int dir ) ;
+
+extern int _read(int file, char *ptr, int len) ;
+
+extern int _write( int file, char *ptr, int len ) ;
+
+extern void mdelay(unsigned int msecs);
diff --git a/firmware/libcommon/include/utils.h b/firmware/libcommon/include/utils.h
new file mode 100644
index 0000000..b9af1f6
--- /dev/null
+++ b/firmware/libcommon/include/utils.h
@@ -0,0 +1,18 @@
+#pragma once
+
+#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
+
+#ifdef __ARM
+#define local_irq_save(x) \
+ ({ \
+ x = __get_PRIMASK(); \
+ __disable_irq(); \
+ })
+
+#define local_irq_restore(x) \
+ __set_PRIMASK(x)
+#else
+#warning "local_irq_{save,restore}() not implemented"
+#define local_irq_save(x)
+#define local_irq_restore(x)
+#endif
diff --git a/firmware/libcommon/source/iso7816_fidi.c b/firmware/libcommon/source/iso7816_fidi.c
new file mode 100644
index 0000000..b35f068
--- /dev/null
+++ b/firmware/libcommon/source/iso7816_fidi.c
@@ -0,0 +1,64 @@
+/* ISO7816-3 Fi/Di tables + computation */
+/* (C) 2010-2015 by Harald Welte <hwelte@hmw-consulting.de>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include <stdint.h>
+#include <errno.h>
+
+#include "utils.h"
+#include "iso7816_fidi.h"
+
+/* Table 7 of ISO 7816-3:2006 */
+static const uint16_t fi_table[] = {
+ 372, 372, 558, 744, 1116, 1488, 1860, 0,
+ 0, 512, 768, 1024, 1536, 2048, 0, 0
+};
+
+/* Table 8 from ISO 7816-3:2006 */
+static const uint8_t di_table[] = {
+ 0, 1, 2, 4, 8, 16, 32, 64,
+ 12, 20, 2, 4, 8, 16, 32, 64,
+};
+
+/* compute the F/D ratio based on Fi and Di values */
+int compute_fidi_ratio(uint8_t fi, uint8_t di)
+{
+ uint16_t f, d;
+ int ret;
+
+ if (fi >= ARRAY_SIZE(fi_table) ||
+ di >= ARRAY_SIZE(di_table))
+ return -EINVAL;
+
+ f = fi_table[fi];
+ if (f == 0)
+ return -EINVAL;
+
+ d = di_table[di];
+ if (d == 0)
+ return -EINVAL;
+
+ /* See table 7 of ISO 7816-3: From 1000 on we divide by 1/d,
+ * which equals a multiplication by d */
+ if (di < 8)
+ ret = f / d;
+ else
+ ret = f * d;
+
+ return ret;
+}
diff --git a/firmware/libcommon/source/req_ctx.c b/firmware/libcommon/source/req_ctx.c
new file mode 100644
index 0000000..a4ecee2
--- /dev/null
+++ b/firmware/libcommon/source/req_ctx.c
@@ -0,0 +1,139 @@
+/* USB Request Context for OpenPCD / OpenPICC / SIMtrace
+ * (C) 2006-2016 by Harald Welte <hwelte@hmw-consulting.de>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include <unistd.h>
+#include <stdlib.h>
+#include <stdint.h>
+
+#include "utils.h"
+#include "trace.h"
+#include "req_ctx.h"
+
+#define NUM_RCTX_SMALL 10
+#define NUM_RCTX_LARGE 0
+
+#define NUM_REQ_CTX (NUM_RCTX_SMALL+NUM_RCTX_LARGE)
+
+static uint8_t rctx_data[NUM_RCTX_SMALL][RCTX_SIZE_SMALL];
+static uint8_t rctx_data_large[NUM_RCTX_LARGE][RCTX_SIZE_LARGE];
+
+static struct req_ctx req_ctx[NUM_REQ_CTX];
+
+struct req_ctx __ramfunc *
+req_ctx_find_get(int large, uint32_t old_state, uint32_t new_state)
+{
+ struct req_ctx *toReturn = NULL;
+ unsigned long flags;
+ unsigned int i;
+
+ if (old_state >= RCTX_STATE_COUNT || new_state >= RCTX_STATE_COUNT) {
+ TRACE_DEBUG("Invalid parameters for req_ctx_find_get\r\n");
+ return NULL;
+ }
+
+ local_irq_save(flags);
+ for (i = 0; i < ARRAY_SIZE(req_ctx); i++) {
+ if (req_ctx[i].state == old_state) {
+ toReturn = &req_ctx[i];
+ toReturn->state = new_state;
+ break;
+ }
+ }
+ local_irq_restore(flags);
+
+ TRACE_DEBUG("%s(%u, %u, %u)=%p\r\n", __func__, large, old_state,
+ new_state, toReturn);
+
+ return toReturn;
+}
+
+uint8_t req_ctx_num(struct req_ctx *ctx)
+{
+ return ctx - req_ctx;
+}
+
+void req_ctx_set_state(struct req_ctx *ctx, uint32_t new_state)
+{
+ unsigned long flags;
+
+ TRACE_DEBUG("%s(ctx=%p, new_state=%u)\r\n", __func__, ctx, new_state);
+
+ if (new_state >= RCTX_STATE_COUNT) {
+ TRACE_DEBUG("Invalid new_state for req_ctx_set_state\r\n");
+ return;
+ }
+ local_irq_save(flags);
+ ctx->state = new_state;
+ local_irq_restore(flags);
+}
+
+#ifdef DEBUG_REQCTX
+void req_print(int state) {
+ int count = 0;
+ struct req_ctx *ctx, *last = NULL;
+ DEBUGP("State [%02i] start <==> ", state);
+ ctx = req_ctx_queues[state];
+ while (ctx) {
+ if (last != ctx->prev)
+ DEBUGP("*INV_PREV* ");
+ DEBUGP("%08X => ", ctx);
+ last = ctx;
+ ctx = ctx->next;
+ count++;
+ if (count > NUM_REQ_CTX) {
+ DEBUGP("*WILD POINTER* => ");
+ break;
+ }
+ }
+ TRACE_DEBUG("NULL");
+ if (!req_ctx_queues[state] && req_ctx_tails[state]) {
+ TRACE_DEBUG("NULL head, NON-NULL tail\r\n");
+ }
+ if (last != req_ctx_tails[state]) {
+ TRACE_DEBUG("Tail does not match last element\r\n");
+ }
+}
+#endif
+
+void req_ctx_put(struct req_ctx *ctx)
+{
+ return req_ctx_set_state(ctx, RCTX_S_FREE);
+}
+
+void req_ctx_init(void)
+{
+ int i;
+ for (i = 0; i < NUM_RCTX_SMALL; i++) {
+ req_ctx[i].size = RCTX_SIZE_SMALL;
+ req_ctx[i].tot_len = 0;
+ req_ctx[i].data = rctx_data[i];
+ req_ctx[i].state = RCTX_S_FREE;
+ TRACE_DEBUG("SMALL req_ctx[%02i] initialized at %p, Data: %p => %p\r\n",
+ i, req_ctx + i, req_ctx[i].data, req_ctx[i].data + RCTX_SIZE_SMALL);
+ }
+
+ for (; i < NUM_REQ_CTX; i++) {
+ req_ctx[i].size = RCTX_SIZE_LARGE;
+ req_ctx[i].tot_len = 0;
+ req_ctx[i].data = rctx_data_large[i];
+ req_ctx[i].state = RCTX_S_FREE;
+ TRACE_DEBUG("LARGE req_ctx[%02i] initialized at %p, Data: %p => %p\r\n",
+ i, req_ctx + i, req_ctx[i].data, req_ctx[i].data + RCTX_SIZE_LARGE);
+ }
+}
diff --git a/firmware/libcommon/source/ringbuffer.c b/firmware/libcommon/source/ringbuffer.c
new file mode 100644
index 0000000..71fe4ed
--- /dev/null
+++ b/firmware/libcommon/source/ringbuffer.c
@@ -0,0 +1,70 @@
+#include "ringbuffer.h"
+#include "trace.h"
+#include "utils.h"
+
+void rbuf_reset(volatile ringbuf * rb)
+{
+ unsigned long state;
+
+ local_irq_save(state);
+ rb->ird = 0;
+ rb->iwr = 0;
+ local_irq_restore(state);
+}
+
+uint8_t rbuf_read(volatile ringbuf * rb)
+{
+ unsigned long state;
+ uint8_t val;
+
+ local_irq_save(state);
+ val = rb->buf[rb->ird];
+ rb->ird = (rb->ird + 1) % RING_BUFLEN;
+ local_irq_restore(state);
+
+ return val;
+}
+
+uint8_t rbuf_peek(volatile ringbuf * rb)
+{
+ return rb->buf[rb->ird];
+}
+
+bool rbuf_is_empty(volatile ringbuf * rb)
+{
+ return rb->ird == rb->iwr;
+}
+
+static bool __rbuf_is_full(volatile ringbuf * rb)
+{
+ return rb->ird == (rb->iwr + 1) % RING_BUFLEN;
+}
+
+bool rbuf_is_full(volatile ringbuf * rb)
+{
+ unsigned long state;
+ bool rc;
+
+ local_irq_save(state);
+ rc = rb->ird == (rb->iwr + 1) % RING_BUFLEN;
+ local_irq_restore(state);
+
+ return rc;
+}
+
+void rbuf_write(volatile volatile ringbuf * rb, uint8_t item)
+{
+ unsigned long state;
+
+ local_irq_save(state);
+ if (!__rbuf_is_full(rb)) {
+ rb->buf[rb->iwr] = item;
+ rb->iwr = (rb->iwr + 1) % RING_BUFLEN;
+ local_irq_restore(state);
+ } else {
+ local_irq_restore(state);
+ TRACE_ERROR("Ringbuffer full, losing bytes!");
+ }
+}
+
+
diff --git a/firmware/libcommon/source/syscalls.c b/firmware/libcommon/source/syscalls.c
new file mode 100644
index 0000000..71cc69a
--- /dev/null
+++ b/firmware/libcommon/source/syscalls.c
@@ -0,0 +1,138 @@
+/* ----------------------------------------------------------------------------
+ * ATMEL Microcontroller Software Support
+ * ----------------------------------------------------------------------------
+ * Copyright (c) 2009, Atmel Corporation
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the disclaimer below.
+ *
+ * Atmel's name may not be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
+ * DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
+ * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ----------------------------------------------------------------------------
+ */
+
+/**
+ * \file syscalls.c
+ *
+ * Implementation of newlib syscall.
+ *
+ */
+
+/*----------------------------------------------------------------------------
+ * Headers
+ *----------------------------------------------------------------------------*/
+
+
+#include "board.h"
+
+#include <stdio.h>
+#include <stdarg.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+
+/*----------------------------------------------------------------------------
+ * Exported variables
+ *----------------------------------------------------------------------------*/
+
+#undef errno
+extern int errno ;
+extern int _end ;
+
+/*----------------------------------------------------------------------------
+ * Exported functions
+ *----------------------------------------------------------------------------*/
+extern void _exit( int status ) ;
+extern void _kill( int pid, int sig ) ;
+extern int _getpid ( void ) ;
+
+extern caddr_t _sbrk ( int incr )
+{
+ static unsigned char *heap = NULL ;
+ unsigned char *prev_heap ;
+
+ if ( heap == NULL )
+ {
+ heap = (unsigned char *)&_end ;
+ }
+ prev_heap = heap;
+
+ heap += incr ;
+
+ return (caddr_t) prev_heap ;
+}
+
+extern int link( char *old, char *new )
+{
+ return -1 ;
+}
+
+extern int _close( int file )
+{
+ return -1 ;
+}
+
+extern int _fstat( int file, struct stat *st )
+{
+ st->st_mode = S_IFCHR ;
+
+ return 0 ;
+}
+
+extern int _isatty( int file )
+{
+ return 1 ;
+}
+
+extern int _lseek( int file, int ptr, int dir )
+{
+ return 0 ;
+}
+
+extern int _read(int file, char *ptr, int len)
+{
+ return 0 ;
+}
+
+extern int _write( int file, char *ptr, int len )
+{
+ int iIndex ;
+
+ for ( iIndex=0 ; iIndex < len ; iIndex++, ptr++ )
+ {
+ UART_PutChar( *ptr ) ;
+ }
+ return iIndex ;
+}
+
+extern void _exit( int status )
+{
+ printf( "Exiting with status %d.\n", status ) ;
+
+ for ( ; ; ) ;
+}
+
+extern void _kill( int pid, int sig )
+{
+ return ;
+}
+
+extern int _getpid ( void )
+{
+ return -1 ;
+}