/*
    Copyright 2000 (c) by Author,
    Swiss Federal Institute of Technology,
    Computer Engineering and Networks Laboratory.
 
    TOPSY -- A Teachable Operating System.
             Implementation of a tiny and simple
             micro kernel for teaching purposes.
 
    For further information, please visit http://www.tik.ee.ethz.ch/~topsy
 
    This software is provided under the terms of the GNU General Public 
    Licence. A full copy of the GNU GPL is provided in the file COPYING 
    found in the development root of Topsy.
*/
/*
	
    File:                  $Source: /home/ruf/cvs_Topsy/cvs/Topsy/Topsy/System.h,v $
    Author(s):             
    Affiliation:           ETH Zuerich, TIK
    Version:               $Revision: 3048 $
    Creation Date:         
    Last Date of Change:   $Date: 2007-07-20 18:11:54 +0200 (Fre, 20 Jul 2007) $      by: $Author: sryffel $
*/

#ifndef _SYSTEM_H_
#define _SYSTEM_H_

/* round the given value of x to the size of the bus --
 * the machine word size :-)
 */
#define ROUND_TO_MACH_WORD(x) \
  (void *)((unsigned long)x + \
           ((sizeof(void *) - (unsigned long)x & (sizeof(void *) - 1)) & \
            (sizeof(void *) - 1)))

void SysInterrupted(void);
void SysNestedInterrupted(int nestedIrq, int interruptedIrq);
void SysRestored(void);
void SysScheduled(void);
void SysThreadScheduled(unsigned long long *pInc);

unsigned long SysGetInterrupted(void);
unsigned long SysGetRestored(void);
unsigned long SysGetScheduled(void);

void compactCalled(void);
void findFreeCalled(void);
void hmAllocCalled(void);
void hmAllocFailed(void);
void hmFreeCalled(void);
void hmFreeFailed(void);
void hmInitCalled(void);
void splitCalled(void);

unsigned long GetcompactCalled(void);
unsigned long GetfindFreeCalled(void);
unsigned long GethmAllocCalled(void);
unsigned long GethmAllocFailed(void);
unsigned long GethmFreeCalled(void);
unsigned long GethmFreeFailed(void);
unsigned long GethmInitCalled(void);
unsigned long GetsplitCalled(void);


void tmNewThread(void);
void tmDestroyThread(void);

void ipcMsgSent(void);

#endif

