3 * Kernel state controller
5 * Copyright (C) 2008 Pawel Dziepak
7 * Interface for kernel state controller. Manes has to inform instance of this
8 * class when any change of the kernel state happens. Functions that want to
9 * monitor changes has to be hardcoded into set_state() procedure.
12 #ifndef _KERNEL_STATE_H_
13 #define _KERNEL_STATE_H_
15 #include "resources/memm.h"
17 #include "libs/list.h"
18 #include "libs/delegate.h"
22 * All information about current kernel state
23 * This class stores all information about current kernel state that
24 * might be useful for other parts of the kernel. This information
25 * should be transported by Manes. This class does not support
26 * multiprocessors machines.
30 /** Types of execution environment */
32 starting
, /**< kernel is launching */
33 kernel
, /**< cpu operates in kernel mode */
34 user
, /**< cpu operates in user mode */
35 iowait
, /**< cpu waits for hardware */
36 frozen
, /**< cpu waits for any action */
37 halting
/**< system is being halted */
42 * Current execution environment
43 * This variable stores information about current state of the
50 * Number of pit ticks since starting Quarn OS.
56 * Delegates that have to be called on each pit tick.
58 list
<delegate
<void> > time_tick_call
;
60 resources::memm
*memory_allocator
;
65 void add_time_tick_call(delegate
<void>);
66 void del_time_tick_call(delegate
<void>&);
70 bool set_state(state new_state
);
71 state
get_state() const;
73 unsigned int get_memory_size() const;
74 resources::memm
*get_memalloc() const;
75 void set_memory_allocator(resources::memm
*);
77 //friend void *operator new(unsigned int);
78 //friend void operator delete(void *);