hal_syscall.c

Go to the documentation of this file.
00001 //=============================================================================
00002 //
00003 //      hal_syscall.c
00004 //
00005 //      
00006 //
00007 //=============================================================================
00008 //####ECOSGPLCOPYRIGHTBEGIN####
00009 // -------------------------------------------
00010 // This file is part of eCos, the Embedded Configurable Operating System.
00011 // Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Red Hat, Inc.
00012 //
00013 // eCos is free software; you can redistribute it and/or modify it under
00014 // the terms of the GNU General Public License as published by the Free
00015 // Software Foundation; either version 2 or (at your option) any later version.
00016 //
00017 // eCos is distributed in the hope that it will be useful, but WITHOUT ANY
00018 // WARRANTY; without even the implied warranty of MERCHANTABILITY or
00019 // FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00020 // for more details.
00021 //
00022 // You should have received a copy of the GNU General Public License along
00023 // with eCos; if not, write to the Free Software Foundation, Inc.,
00024 // 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
00025 //
00026 // As a special exception, if other files instantiate templates or use macros
00027 // or inline functions from this file, or you compile this file and link it
00028 // with other works to produce a work based on this file, this file does not
00029 // by itself cause the resulting work to be covered by the GNU General Public
00030 // License. However the source code for this file must still be made available
00031 // in accordance with section (3) of the GNU General Public License.
00032 //
00033 // This exception does not invalidate any other reasons why a work based on
00034 // this file might be covered by the GNU General Public License.
00035 //
00036 // Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
00037 // at http://sources.redhat.com/ecos/ecos-license/
00038 // -------------------------------------------
00039 //####ECOSGPLCOPYRIGHTEND####
00040 //=============================================================================
00041 //#####DESCRIPTIONBEGIN####
00042 //
00043 // Author(s):   msalter
00044 // Contributors:msalter,ysato
00045 // Date:        2000-11-5
00046 // Purpose:     
00047 // Description: 
00048 //              
00049 //              
00050 //
00051 //####DESCRIPTIONEND####
00052 //
00053 //=============================================================================
00054 
00055 
00056 //=============================================================================
00057 //                            DOXYGEN FILE HEADER
00062 //=============================================================================
00063 
00064 
00065 //=============================================================================
00066 //                                INCLUDES
00067 //=============================================================================
00068 #include <pkgconf/hal.h>
00069 
00070 #ifdef CYGPKG_REDBOOT
00071 #include <pkgconf/redboot.h>
00072 #endif
00073 
00074 #if defined(CYGSEM_REDBOOT_BSP_SYSCALLS)
00075 
00076 #include <cyg/hal/hal_stub.h>           // Our header
00077 #include <cyg/hal/hal_arch.h>           // HAL_BREAKINST
00078 #include <cyg/hal/hal_cache.h>          // HAL_xCACHE_x
00079 #include <cyg/hal/hal_intr.h>           // interrupt disable/restore
00080 
00081 #include <cyg/hal/hal_if.h>             // ROM calling interface
00082 #include <cyg/hal/hal_misc.h>           // Helper functions
00083 
00084 extern CYG_ADDRWORD __do_syscall(CYG_ADDRWORD func,     // syscall function number
00085             CYG_ADDRWORD arg1, CYG_ADDRWORD arg2,   // up to four args.
00086             CYG_ADDRWORD arg3, CYG_ADDRWORD arg4,
00087             CYG_ADDRWORD *retval);      // syscall return value
00088 
00089 #define SYS_exit    1
00090 #define SYS_interrupt   1000
00091 
00092 
00093 //=============================================================================
00094 //                                SYSCALL HANDLER
00096 //=============================================================================
00097 int hal_syscall_handler(void)
00098 {
00099     CYG_ADDRWORD func, arg1, arg2, arg3, arg4;
00100     CYG_ADDRWORD err;
00101 
00102     func = get_register(ER0);
00103     arg1 = get_register(ER1);
00104     arg2 = get_register(ER2);
00105     arg3 = get_register(ER3);
00106     arg4 = 0;
00107  
00108     if (func == SYS_interrupt) {
00109     //  A console interrupt landed us here.
00110     //  Invoke the debug agent so as to cause a SIGINT.
00111         return SIGINT;
00112     }
00113 
00114     if (__do_syscall(func, arg1, arg2, arg3, arg4, &err)) {
00115         put_register(D0, err);
00116     return 0;
00117     }
00118 
00119     return SIGTRAP;
00120 }
00121 #endif // CYGSEM_REDBOOT_BSP_SYSCALLS
00122 //---------------------------------------------------------------------------
00123 //
00124 

Generated on Tue Feb 17 09:06:12 2004 for eCos EDOSK-2674 HAL by doxygen 1.3.5