home *** CD-ROM | disk | FTP | other *** search
/ Aminet 18 / aminetcdnumber181997.iso / Aminet / dev / gcc / ixemulsrc.lha / ixemul / library / ix_expunge.c < prev    next >
C/C++ Source or Header  |  1996-12-11  |  2KB  |  80 lines

  1. /*
  2.  *  This file is part of ixemul.library for the Amiga.
  3.  *  Copyright (C) 1991, 1992  Markus M. Wild
  4.  *  Portions Copyright (C) 1994 Rafael W. Luebbert
  5.  *
  6.  *  This library is free software; you can redistribute it and/or
  7.  *  modify it under the terms of the GNU Library General Public
  8.  *  License as published by the Free Software Foundation; either
  9.  *  version 2 of the License, or (at your option) any later version.
  10.  *
  11.  *  This library is distributed in the hope that it will be useful,
  12.  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  14.  *  Library General Public License for more details.
  15.  *
  16.  *  You should have received a copy of the GNU Library General Public
  17.  *  License along with this library; if not, write to the Free
  18.  *  Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  19.  *
  20.  *  $Id: ix_expunge.c,v 1.9 1994/07/07 15:08:35 rluebbert Exp $
  21.  *
  22.  *  $Log: ix_expunge.c,v $
  23.  *  Revision 1.9  1994/07/07  15:08:35  rluebbert
  24.  *  10*NOFILE -> NOFILE
  25.  *
  26.  *  Revision 1.8  1994/07/07  15:03:19  rluebbert
  27.  *  Removed ttyport dummy routines
  28.  *
  29.  *  Revision 1.7  1994/07/07  12:22:20  rluebbert
  30.  *  *** empty log message ***
  31.  *
  32.  *  Revision 1.6  1994/07/07  11:44:46  rluebbert
  33.  *  *** empty log message ***
  34.  *
  35.  *  Revision 1.5  1994/06/19  15:12:54  rluebbert
  36.  *  *** empty log message ***
  37.  *
  38.  *  Revision 1.3  1992/05/22  01:43:58  mwild
  39.  *  when debugging, check whether buddy allocator clean
  40.  *
  41.  * Revision 1.2  1992/05/17  21:21:56  mwild
  42.  * changed async mp to be global
  43.  *
  44.  * Revision 1.1  1992/05/14  19:55:40  mwild
  45.  * Initial revision
  46.  *
  47.  */
  48.  
  49. #define _KERNEL
  50. #include "ixemul.h"
  51.  
  52. void ix_expunge (struct ixemul_base *ixbase)
  53. {
  54.   extern long vector_install_count;    /* from trap.s */
  55.   extern void *restore_vector;        /* from trap.s */
  56.  
  57.   EndNotify(&ixbase->ix_notify_request);
  58.  
  59.   Forbid();
  60.   DeleteTask(ixbase->ix_task_switcher);
  61.   Permit();
  62.  
  63.   if (ixbase->ix_global_environment)
  64.     {
  65.       char **tmp = ixbase->ix_global_environment;
  66.       
  67.       while (*tmp)
  68.         kfree(*tmp++);
  69.       kfree(ixbase->ix_global_environment);
  70.     }
  71.  
  72.   close_libraries();
  73.   FreeMem (ixbase->ix_file_tab, NOFILE * sizeof (struct file));
  74.   if (vector_install_count)
  75.     {
  76.       vector_install_count = 1;        /* force restoration original bus error vector */
  77.       Supervisor(restore_vector);
  78.     }
  79. }
  80.