Main Page   Modules   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

/projects/cubeos/src_current/kernel/ivtab.c

Go to the documentation of this file.
00001 /*  src_experimental/kernel/ivtab.c
00002    CubeOS Version 0.4.90 experimental
00003    Copyright (C) 1999,2000 Holger Kenn
00004 
00005    CubeOS is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Library General Public
00007    License as published by the Free Software Foundation; either
00008    version 2 of the License, or any later version.
00009 
00010    CubeOS is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Library General Public License for more details.
00014 
00015  */
00016 #include <cubeos.h>
00017 #include <ivtab.h>
00022 void (*(*_KERN_IVTab)[512]) (void);     
00024 void *_KERN_IVTab_oldvector[512];       
00033 void _KERN_IVTab_init ()
00034 {
00035 
00036         int i;
00037 
00038         asm ("movec %vbr,%d0");
00039       asm ("movel %%d0,%0":"=m" (_KERN_IVTab));
00040 
00041         for (i = 0; i < 512; i++)
00042                 _KERN_IVTab_oldvector[i] = (void *) 0;
00043 
00044 }
00045 
00056 int _KERN_IVTab_setvector (unsigned short vector, void (*isr) (void))
00057 {
00058 
00059         if (_KERN_IVTab_oldvector[vector]) {
00060                 return (-1);
00061         } else {
00062                 _KERN_IVTab_oldvector[vector] = (*_KERN_IVTab)[vector];
00063                 (*_KERN_IVTab)[vector] = isr;
00064                 return (0);
00065         }
00066 
00067 }
00068 
00079 int _KERN_IVTab_clearvector (unsigned short vector, void (*isr) (void))
00080 {
00081         if ((*_KERN_IVTab)[vector] != isr) {
00082                 return (-1);
00083         } else {
00084                 (*_KERN_IVTab)[vector] = _KERN_IVTab_oldvector[vector];
00085                 _KERN_IVTab_oldvector[vector] = 0;
00086                 return (0);
00087         }
00088 
00089 }

Generated on Thu Feb 20 15:38:44 2003 for cubeOS by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002