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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [packages/] [redboot/] [current/] [src/] [syscall.c] - Blame information for rev 786

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 786 skrzyp
/*==========================================================================
2
//
3
//      syscall.c
4
//
5
//      Redboot syscall handling for GNUPro bsp support
6
//
7
//==========================================================================
8
// ####ECOSGPLCOPYRIGHTBEGIN####
9
// -------------------------------------------
10
// This file is part of eCos, the Embedded Configurable Operating System.
11
// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
12
//
13
// eCos is free software; you can redistribute it and/or modify it under
14
// the terms of the GNU General Public License as published by the Free
15
// Software Foundation; either version 2 or (at your option) any later
16
// version.
17
//
18
// eCos is distributed in the hope that it will be useful, but WITHOUT
19
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
21
// for more details.
22
//
23
// You should have received a copy of the GNU General Public License
24
// along with eCos; if not, write to the Free Software Foundation, Inc.,
25
// 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
26
//
27
// As a special exception, if other files instantiate templates or use
28
// macros or inline functions from this file, or you compile this file
29
// and link it with other works to produce a work based on this file,
30
// this file does not by itself cause the resulting work to be covered by
31
// the GNU General Public License. However the source code for this file
32
// must still be made available in accordance with section (3) of the GNU
33
// General Public License v2.
34
//
35
// This exception does not invalidate any other reasons why a work based
36
// on this file might be covered by the GNU General Public License.
37
// -------------------------------------------
38
// ####ECOSGPLCOPYRIGHTEND####
39
//==========================================================================
40
//#####DESCRIPTIONBEGIN####
41
//
42
// Author(s):    msalter
43
// Contributors: msalter
44
// Date:         1999-02-20
45
// Purpose:      Temporary support for gnupro bsp
46
//
47
//####DESCRIPTIONEND####
48
//
49
//=========================================================================*/
50
 
51
#include <redboot.h>
52
#include <cyg/hal/hal_intr.h>
53
#include <cyg/hal/drv_api.h>
54
#include <cyg/hal/hal_stub.h>
55
 
56
#ifdef CYGSEM_REDBOOT_BSP_SYSCALLS
57
 
58
#define NEWLIB_EIO 5              /* I/O error */
59
#define NEWLIB_ENOSYS 88          /* Syscall not supported */
60
 
61
/*
62
 * Clients of this BSP will need to have access to BSP functions and
63
 * data structures. Because, the client and the BSP may not be linked
64
 * together, a structure of vectors is used to gain this access. A
65
 * pointer to this structure can be gotten via a syscall. This syscall
66
 * is made automatically from within the crt0.o file.
67
 */
68
typedef struct {
69
    int         version;        /* version number for future expansion */
70
    const void **__ictrl_table;
71
    void **__exc_table;
72
    void *__dbg_vector;
73
    void *__kill_vector;
74
    void *__console_procs;
75
    void *__debug_procs;
76
    void (*__flush_dcache)(void *__p, int __nbytes);
77
    void (*__flush_icache)(void *__p, int __nbytes);
78
    void *__cpu_data;
79
    void *__board_data;
80
    void *__sysinfo;
81
    int  (*__set_debug_comm)(int __comm_id);
82
    int  (*__set_console_comm)(int __comm_id);
83
    int  (*__set_serial_baud)(int __comm_id, int baud);
84
    void *__dbg_data;
85
    void (*__reset)(void);
86
    int  __console_interrupt_flag;
87
} __shared_t;
88
 
89
static __shared_t __shared_data = { 2 };
90
 
91
// this is used by newlib's mode_t so we should match it
92
#ifdef __GNUC__
93
#define _ST_INT32 __attribute__ ((__mode__ (__SI__)))
94
#else
95
#define _ST_INT32
96
#endif
97
typedef unsigned int    newlib_mode_t _ST_INT32;
98
typedef short           newlib_dev_t;
99
typedef unsigned short  newlib_ino_t;
100
typedef unsigned short  newlib_nlink_t;
101
typedef long            newlib_off_t;
102
typedef unsigned short  newlib_uid_t;
103
typedef unsigned short  newlib_gid_t;
104
typedef long            newlib_time_t;
105
typedef long            newlib_long_t;
106
 
107
struct newlib_stat
108
{
109
    newlib_dev_t     st_dev;
110
    newlib_ino_t     st_ino;
111
    newlib_mode_t    st_mode;
112
    newlib_nlink_t   st_nlink;
113
    newlib_uid_t     st_uid;
114
    newlib_gid_t     st_gid;
115
    newlib_dev_t     st_rdev;
116
    newlib_off_t     st_size;
117
    // We assume we've been compiled with the same flags as newlib here
118
#if defined(__svr4__) && !defined(__PPC__) && !defined(__sun__)
119
    newlib_time_t    st_atime;
120
    newlib_time_t    st_mtime;
121
    newlib_time_t    st_ctime;
122
#else
123
    newlib_time_t    st_atime;
124
    newlib_long_t    st_spare1;
125
    newlib_time_t    st_mtime;
126
    newlib_long_t    st_spare2;
127
    newlib_time_t    st_ctime;
128
    newlib_long_t    st_spare3;
129
    newlib_long_t    st_blksize;
130
    newlib_long_t    st_blocks;
131
    newlib_long_t    st_spare4[2];
132
#endif
133
};
134
#define NEWLIB_S_IFCHR 0020000 // character special file
135
 
136
static inline char __getc(void)
137
{
138
    char c;
139
    hal_virtual_comm_table_t* __chan = CYGACC_CALL_IF_CONSOLE_PROCS();
140
 
141
    if (__chan)
142
        c = CYGACC_COMM_IF_GETC(*__chan);
143
    else {
144
        __chan = CYGACC_CALL_IF_DEBUG_PROCS();
145
        c = CYGACC_COMM_IF_GETC(*__chan);
146
    }
147
    return c;
148
}
149
 
150
static inline void __putc(char c)
151
{
152
    hal_virtual_comm_table_t* __chan = CYGACC_CALL_IF_CONSOLE_PROCS();
153
    if (__chan)
154
        CYGACC_COMM_IF_PUTC(*__chan, c);
155
    else {
156
        __chan = CYGACC_CALL_IF_DEBUG_PROCS();
157
        CYGACC_COMM_IF_PUTC(*__chan, c);
158
    }
159
}
160
 
161
 
162
static inline void __flush(void)
163
{
164
    hal_virtual_comm_table_t* __chan = CYGACC_CALL_IF_CONSOLE_PROCS();
165
 
166
    if (__chan == NULL)
167
        __chan = CYGACC_CALL_IF_DEBUG_PROCS();
168
 
169
    CYGACC_COMM_IF_CONTROL(*__chan, __COMMCTL_FLUSH_OUTPUT);
170
}
171
 
172
// Timer support
173
 
174
static cyg_handle_t  sys_timer_handle;
175
static cyg_interrupt sys_timer_interrupt;
176
static cyg_uint64    sys_timer_ticks = 0;
177
 
178
#ifdef CYGSEM_REDBOOT_BSP_SYSCALLS_GPROF
179
 
180
static unsigned int set_period = CYGNUM_HAL_RTC_PERIOD; // The default
181
 
182
typedef void *callback_func( char *pc, char *sp );
183
static callback_func *timer_callback = 0;
184
 
185
#endif // CYGSEM_REDBOOT_BSP_SYSCALLS_GPROF
186
 
187
static void
188
sys_timer_dsr(cyg_vector_t vector, cyg_ucount32 count, cyg_addrword_t data)
189
{
190
    // do nothing
191
}
192
 
193
 
194
static cyg_uint32
195
sys_timer_isr(cyg_vector_t vector, cyg_addrword_t data)
196
{
197
    ++sys_timer_ticks;
198
 
199
#ifdef CYGSEM_REDBOOT_BSP_SYSCALLS_GPROF
200
    HAL_CLOCK_RESET(CYGNUM_HAL_INTERRUPT_RTC, set_period);
201
#else
202
    HAL_CLOCK_RESET(CYGNUM_HAL_INTERRUPT_RTC, CYGNUM_HAL_RTC_PERIOD);
203
#endif // CYGSEM_REDBOOT_BSP_SYSCALLS_GPROF
204
 
205
    cyg_drv_interrupt_acknowledge(CYGNUM_HAL_INTERRUPT_RTC);
206
 
207
#ifdef CYGSEM_REDBOOT_BSP_SYSCALLS_GPROF
208
    if ( timer_callback ) {
209
        char *intrpc = (char *)0;
210
        char *intrsp = (char *)0;
211
 
212
        // There may be a number of ways to get the PC and (optional) SP
213
        // information out of the HAL.  Hence this is conditioned.  In some
214
        // configurations, a register-set pointer is available as
215
        // (invisible) argument 3 to this ISR call.
216
 
217
#ifdef HAL_GET_PROFILE_INFO
218
        HAL_GET_PROFILE_INFO( intrpc, intrsp );
219
#endif // HAL_GET_PROFILE_INFO available
220
 
221
        CYGARC_HAL_SAVE_GP();
222
        timer_callback( intrpc, intrsp );
223
        CYGARC_HAL_RESTORE_GP();
224
    }
225
#endif // CYGSEM_REDBOOT_BSP_SYSCALLS_GPROF
226
    return CYG_ISR_HANDLED;
227
}
228
 
229
 
230
static void sys_timer_init(void)
231
{
232
#ifdef CYGSEM_REDBOOT_BSP_SYSCALLS_GPROF
233
    HAL_CLOCK_INITIALIZE(set_period);
234
#else
235
    HAL_CLOCK_INITIALIZE(CYGNUM_HAL_RTC_PERIOD);
236
#endif // CYGSEM_REDBOOT_BSP_SYSCALLS_GPROF
237
 
238
    cyg_drv_interrupt_create(
239
        CYGNUM_HAL_INTERRUPT_RTC,
240
        0,                      // Priority - unused
241
        (CYG_ADDRWORD)0,        // Data item passed to ISR & DSR
242
        sys_timer_isr,          // ISR
243
        sys_timer_dsr,          // DSR
244
        &sys_timer_handle,      // handle to intr obj
245
        &sys_timer_interrupt ); // space for int obj
246
 
247
    cyg_drv_interrupt_attach(sys_timer_handle);
248
 
249
    cyg_drv_interrupt_unmask(CYGNUM_HAL_INTERRUPT_RTC);
250
}
251
 
252
 
253
//
254
// read  -- read bytes from the serial port. Ignore fd, since
255
//          we only have stdin.
256
static int
257
sys_read(int fd, char *buf, int nbytes)
258
{
259
    int i = 0;
260
 
261
    for (i = 0; i < nbytes; i++) {
262
        *(buf + i) = __getc();
263
        if ((*(buf + i) == '\n') || (*(buf + i) == '\r')) {
264
            (*(buf + i + 1)) = 0;
265
            break;
266
        }
267
    }
268
    return (i);
269
}
270
 
271
 
272
//
273
// write -- write bytes to the serial port. Ignore fd, since
274
//          stdout and stderr are the same. Since we have no filesystem,
275
//          open will only return an error.
276
//
277
static int
278
sys_write(int fd, char *buf, int nbytes)
279
{
280
#define WBUFSIZE  256
281
    int  tosend;
282
 
283
    tosend = nbytes;
284
 
285
    while (tosend > 0) {
286
        if (*buf == '\n')
287
            __putc('\r');
288
        __putc(*buf++);
289
        tosend--;
290
    }
291
    __flush();
292
 
293
    return (nbytes);
294
}
295
 
296
 
297
//
298
// open -- open a file descriptor. We don't have a filesystem, so
299
//         we return an error.
300
//
301
static int
302
sys_open (const char *buf, int flags, int mode)
303
{
304
    return (-NEWLIB_EIO);
305
}
306
 
307
//
308
// close -- We don't need to do anything, but pretend we did.
309
//
310
static int
311
sys_close(int fd)
312
{
313
    return (0);
314
}
315
 
316
 
317
//
318
// lseek --  Since a serial port is non-seekable, we return an error.
319
//
320
static int
321
sys_lseek(int fd,  int offset, int whence)
322
{
323
    return (-NEWLIB_EIO);
324
}
325
 
326
 
327
#define NS_PER_TICK    (CYGNUM_HAL_RTC_NUMERATOR/CYGNUM_HAL_RTC_DENOMINATOR)
328
#define TICKS_PER_SEC  (1000000000ULL / NS_PER_TICK)
329
 
330
// This needs to match newlib HZ which is normally 60.
331
#define HZ (60ULL)
332
 
333
#ifdef CYGSEM_REDBOOT_BSP_SYSCALLS_GPROF
334
static unsigned int set_freq   = TICKS_PER_SEC; // The default
335
#endif // CYGSEM_REDBOOT_BSP_SYSCALLS_GPROF
336
static int
337
sys_times(unsigned long *p)
338
{
339
    static int inited = 0;
340
 
341
    if (!inited) {
342
        inited = 1;
343
        sys_timer_init();
344
    }
345
 
346
    /* target clock runs at CLOCKS_PER_SEC. Convert to HZ */
347
    if (p)
348
#ifdef CYGSEM_REDBOOT_BSP_SYSCALLS_GPROF
349
        *p = (sys_timer_ticks * HZ) / (cyg_uint64)set_freq;
350
#else
351
        *p = (sys_timer_ticks * HZ) / TICKS_PER_SEC;
352
#endif // CYGSEM_REDBOOT_BSP_SYSCALLS_GPROF
353
 
354
    return 0;
355
}
356
 
357
#ifdef CYGSEM_REDBOOT_BSP_SYSCALLS_GPROF
358
 
359
static void sys_profile_call_back( char *func, char **previous_call_back )
360
{
361
    if ( previous_call_back )
362
        *previous_call_back = (char *)timer_callback;
363
 
364
    timer_callback = (callback_func *)func;
365
 
366
    // Ensure the timer is started
367
    (void)sys_times( (unsigned long *)0 );
368
}
369
 
370
static void sys_profile_frequency( int freq, int *previous_freq )
371
{
372
// Requested HZ:
373
// 0         => tell me the current value (no change, IMPLEMENTED HERE)
374
// - 1       => tell me the slowest (no change)
375
// - 2       => tell me the default (no change, IMPLEMENTED HERE)
376
// -nnn      => tell me what you would choose for nnn (no change)
377
// MIN_INT   => tell me the fastest (no change)
378
//        
379
// 1         => tell me the slowest (sets the clock)
380
// MAX_INT   => tell me the fastest (sets the clock)
381
 
382
    // Ensure the timer is started
383
    (void)sys_times( (unsigned long *)0 );
384
 
385
    if ( -2 == freq )
386
        freq = TICKS_PER_SEC; // default value
387
    else if ( 0 == freq )
388
        freq = set_freq; // collect current value
389
    else {
390
        int do_set_freq = (freq > 0);
391
        unsigned int period = CYGNUM_HAL_RTC_PERIOD;
392
 
393
        if ( 0 == (freq ^ -freq) ) // Then it's MIN_INT in local size
394
            freq++; // just so that it will negate correctly
395
 
396
        // Then set the timer to that fast - or pass on the enquiry
397
#ifdef HAL_CLOCK_REINITIALIZE
398
        // Give the HAL enough info to do the division sum relative to
399
        // the default setup, in period and TICKS_PER_SEC.
400
        HAL_CLOCK_REINITIALIZE( freq, period, TICKS_PER_SEC );
401
#else
402
        freq = TICKS_PER_SEC; // the only choice
403
#endif
404
        if ( do_set_freq ) { // update the global variables
405
            unsigned int orig = set_freq;
406
            set_freq = freq;
407
            set_period = period;
408
            // We must "correct" sys_timer_ticks for the new scale factor.
409
            sys_timer_ticks = sys_timer_ticks * set_freq / orig;
410
        }
411
    }
412
 
413
    if ( previous_freq ) // Return the current value (new value)
414
        *previous_freq = freq;
415
}
416
 
417
void sys_profile_reset( void )
418
{
419
    timer_callback = NULL;
420
// Want to preserve the frequency between runs, for clever GDB users!
421
//    sys_profile_frequency( TICKS_PER_SEC, NULL );
422
}
423
 
424
#endif // CYGSEM_REDBOOT_BSP_SYSCALLS_GPROF
425
 
426
//
427
//  Generic syscall handler.
428
//
429
//  Returns 0 if syscall number is not handled by this
430
//  module, 1 otherwise. This allows applications to
431
//  extend the syscall handler by using exception chaining.
432
//
433
CYG_ADDRWORD
434
__do_syscall(CYG_ADDRWORD func,                 // syscall function number
435
             CYG_ADDRWORD arg1, CYG_ADDRWORD arg2,      // up to four args.
436
             CYG_ADDRWORD arg3, CYG_ADDRWORD arg4,
437
             CYG_ADDRWORD *retval, CYG_ADDRWORD *sig)   // syscall return value
438
{
439
    int err = 0;
440
    *sig = 0;
441
 
442
    switch (func) {
443
 
444
      case SYS_open:
445
      {
446
#ifdef CYGPKG_HAL_GDB_FILEIO // File I/O over the GDB remote protocol
447
          __externC int cyg_hal_gdbfileio_open( const char *name, int flags,
448
                                                int mode, int *sig );
449
          if (gdb_active)
450
              err = cyg_hal_gdbfileio_open((const char *)arg1, (int)arg2, (int)arg3,
451
                                           (int *)sig);
452
          else
453
#endif
454
              err = sys_open((const char *)arg1, (int)arg2, (int)arg3);
455
          break;
456
      }
457
      case SYS_read:
458
      {
459
#ifdef CYGPKG_HAL_GDB_FILEIO // File I/O over the GDB remote protocol
460
          __externC int cyg_hal_gdbfileio_read( int fd, void *buf, size_t count,
461
                                                int *sig );
462
          if (gdb_active)
463
              err = cyg_hal_gdbfileio_read((int)arg1, (void *)arg2, (size_t)arg3,
464
                                           (int *)sig);
465
          else
466
#endif
467
              err = sys_read((int)arg1, (char *)arg2, (int)arg3);
468
          break;
469
      }
470
      case SYS_write:
471
      {
472
#ifdef CYGPKG_HAL_GDB_FILEIO // File I/O over the GDB remote protocol
473
          __externC int cyg_hal_gdbfileio_write( int fd, const void *buf,
474
                                                 size_t count, int *sig );
475
          if (gdb_active)
476
              err = cyg_hal_gdbfileio_write((int)arg1, (const void *)arg2,
477
                                            (size_t)arg3, (int *)sig);
478
          else
479
#endif
480
              err = sys_write((int)arg1, (char *)arg2, (int)arg3);
481
          break;
482
      }
483
      case SYS_close:
484
      {
485
#ifdef CYGPKG_HAL_GDB_FILEIO // File I/O over the GDB remote protocol
486
          __externC int cyg_hal_gdbfileio_close( int fd, int *sig );
487
          if (gdb_active)
488
              err = cyg_hal_gdbfileio_close((int)arg1, (int *)sig);
489
          else
490
#endif
491
              err = sys_close((int)arg1);
492
          break;
493
      }
494
      case SYS_lseek:
495
      {
496
#ifdef CYGPKG_HAL_GDB_FILEIO // File I/O over the GDB remote protocol
497
          __externC int cyg_hal_gdbfileio_lseek( int fd, long offset,
498
                                                 int whence, int *sig );
499
          if (gdb_active)
500
              err = cyg_hal_gdbfileio_lseek((int)arg1, (long)arg2, (int)arg3,
501
                                            (int *)sig);
502
          else
503
#endif
504
              err = sys_lseek((int)arg1, (int)arg2, (int)arg3);
505
          break;
506
      }
507
      case SYS_stat:
508
      {
509
#ifdef CYGPKG_HAL_GDB_FILEIO // File I/O over the GDB remote protocol
510
          __externC int cyg_hal_gdbfileio_stat( const char *pathname,
511
                                                void *statbuf, int *sig );
512
          if (gdb_active)
513
              err = cyg_hal_gdbfileio_stat((const char *)arg1, (void *)arg2,
514
                                           (int *)sig);
515
          else
516
#endif
517
              err = -NEWLIB_ENOSYS;
518
          break;
519
      }
520
      case SYS_fstat:
521
      {
522
#ifdef CYGPKG_HAL_GDB_FILEIO // File I/O over the GDB remote protocol
523
          __externC int cyg_hal_gdbfileio_fstat( int fd, void *statbuf,
524
                                                 int *sig );
525
          if (gdb_active)
526
              err = cyg_hal_gdbfileio_fstat((int)arg1, (void *)arg2,
527
                                            (int *)sig);
528
          else
529
#endif
530
          {
531
              struct newlib_stat *st = (struct newlib_stat *)arg2;
532
              st->st_mode = NEWLIB_S_IFCHR;
533
              st->st_blksize = 4096;
534
              err = 0;
535
          }
536
          break;
537
      }
538
      case SYS_rename:
539
      {
540
#ifdef CYGPKG_HAL_GDB_FILEIO // File I/O over the GDB remote protocol
541
          __externC int cyg_hal_gdbfileio_rename( const char *oldpath,
542
                                                  const char *newpath,
543
                                                  int *sig );
544
          if (gdb_active)
545
              err = cyg_hal_gdbfileio_rename((const char *)arg1, (const char *)arg2,
546
                                             (int *)sig);
547
          else
548
#endif
549
              err = -NEWLIB_ENOSYS;
550
          break;
551
      }
552
      case SYS_unlink:
553
      {
554
#ifdef CYGPKG_HAL_GDB_FILEIO // File I/O over the GDB remote protocol
555
          __externC int cyg_hal_gdbfileio_unlink( const char *pathname,
556
                                                  int *sig );
557
          if (gdb_active)
558
              err = cyg_hal_gdbfileio_unlink((const char *)arg1, (int *)sig);
559
          else
560
#endif
561
              err = -NEWLIB_ENOSYS;
562
          break;
563
      }
564
      case SYS_isatty:
565
      {
566
#ifdef CYGPKG_HAL_GDB_FILEIO // File I/O over the GDB remote protocol
567
          __externC int cyg_hal_gdbfileio_isatty( int fd, int *sig );
568
          if (gdb_active)
569
              err = cyg_hal_gdbfileio_isatty((int)arg1, (int *)sig);
570
          else
571
#endif
572
              err = 1;
573
          break;
574
      }
575
      case SYS_system:
576
      {
577
#ifdef CYGPKG_HAL_GDB_FILEIO // File I/O over the GDB remote protocol
578
          __externC int cyg_hal_gdbfileio_system( const char *command,
579
                                                  int *sig );
580
          if (gdb_active)
581
              err = cyg_hal_gdbfileio_system((const char *)arg1, (int *)sig);
582
          else
583
#endif
584
              err = -1;
585
          break;
586
      }
587
      case SYS_gettimeofday:
588
      {
589
#ifdef CYGPKG_HAL_GDB_FILEIO // File I/O over the GDB remote protocol
590
          __externC int cyg_hal_gdbfileio_gettimeofday( void *tv, void *tz,
591
                                                        int *sig );
592
          if (gdb_active)
593
              err = cyg_hal_gdbfileio_gettimeofday((void *)arg1, (void *)arg2,
594
                                                   (int *)sig);
595
          else
596
#endif
597
              err = 0;
598
          break;
599
      }
600
      case SYS_utime:
601
        // FIXME. Some libglosses depend on this behavior.
602
        err = sys_times((unsigned long *)arg1);
603
        break;
604
 
605
      case SYS_times:
606
        err = sys_times((unsigned long *)arg1);
607
        break;
608
 
609
      case SYS_meminfo:
610
        err = 1;
611
        *(unsigned long *)arg1 = (unsigned long)(ram_end-ram_start);
612
        *(unsigned long *)arg2 = (unsigned long)ram_end;
613
        break;
614
#ifdef CYGSEM_REDBOOT_BSP_SYSCALLS_GPROF
615
    case SYS_timer_call_back:
616
        sys_profile_call_back( (char *)arg1, (char **)arg2 );
617
        break;
618
 
619
    case SYS_timer_frequency:
620
        sys_profile_frequency( (int)arg1, (unsigned int *)arg2 );
621
        break;
622
 
623
    case SYS_timer_reset:
624
        sys_profile_reset();
625
        break;
626
 
627
#endif // CYGSEM_REDBOOT_BSP_SYSCALLS_GPROF
628
      case __GET_SHARED:
629
        *(__shared_t **)arg1 = &__shared_data;
630
        break;
631
 
632
      case SYS_exit:
633
        *sig = -1;    // signal exit
634
        err = arg1;
635
 
636
        if (gdb_active) {
637
#ifdef CYGOPT_REDBOOT_BSP_SYSCALLS_EXIT_WITHOUT_TRAP
638
            __send_exit_status((int)arg1);
639
#else
640
            *sig = SIGTRAP;
641
            err = func;
642
#endif // CYGOPT_REDBOOT_BSP_SYSCALLS_EXIT_WITHOUT_TRAP
643
        }
644
        break;
645
 
646
      default:
647
        return 0;
648
    }
649
 
650
    *retval = err;
651
    return 1;
652
}
653
 
654
#endif

powered by: WebSVN 2.1.0

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