Kernel/x86 - (minor) Fix spaces in log output on ZERO page
[tpg/acess2.git] / KernelLand / Kernel / arch / archdoc.h
1 /**
2  * \file archdoc.h
3  * \brief Documentation Definitions for the Acess 2 Architecture Interface
4  * \author John Hodge (thePowersGang)
5  * 
6  * Acess 2 allows different architecture builds to be made off almost
7  * the same source tree. The difference between the trees is the inclusion
8  * of a different directory from the "Kernel/arch/" directory that
9  * contains the architecture specific intialisation and management code.
10  * Each achitecture tree must provide all the definitions from this
11  * document in some form or another (usually in the most efficient way
12  * avaliable)
13  * The values and types used in this documentation are a guide only and
14  * will most probably be incorrect for most architectures.
15  */
16 #ifndef _ARCHDOC_H_
17 #define _ARCHDOC_H_
18
19 /**
20  * \brief Maximum number of CPUs supported by this architecture driver
21  *        (in the current build)
22  */
23 #define MAX_CPUS        1
24 /**
25  * \brief Number of bits in a machine word (Uint)
26  */
27 #define BITS    32
28 /**
29  * \brief Number of valid bits in a \a tPAddr
30  */
31 #define PHYS_BITS       32
32
33 /**
34  * \name Syncronisation Primitives
35  * \{
36  */
37 /**
38  * \brief Spinlock type
39  */
40 typedef volatile int    tSpinlock;
41 /**
42  * \brief Acquire a spinlock
43  */
44 #define LOCK(lockptr)   do{while(*(tSpinlock*)lockptr)Threads_Yield();*(tSpinlock*)lockptr=1;}while(0)
45 /**
46  * \brief Release a held spinlock
47  */
48 #define RELEASE(lockptr)        do{*(tSpinlock*)lockptr=0;}while(0)
49 /**
50  * \}
51  */
52 //#define       HALT()  __asm__ __volatile__ ("hlt")
53
54
55 /**
56  * \name Atomic Types
57  * \{
58  */
59 typedef unsigned int    Uint;   //!< Unsigned machine native integer
60 typedef unsigned char   Uint8;  //!< Unsigned 8-bit integer
61 typedef unsigned short  Uint16; //!< Unsigned 16-bit integer
62 typedef unsigned long   Uint32; //!< Unsigned 32-bit integer
63 typedef unsigned long long      Uint64; //!< Unsigned 64-bit integer
64 typedef signed int              Sint;   //!< Signed Machine Native integer
65 typedef signed char             Sint8;  //!< Signed 8-bit integer
66 typedef signed short    Sint16; //!< Signed 16-bit integer
67 typedef signed long             Sint32; //!< Signed 32-bit integer
68 typedef signed long long        Sint64; //!< Signed 16-bit integer
69 /**
70  * \}
71  */
72
73 typedef Uint    size_t; //!< Counter/Byte count type
74 typedef Uint32  tVAddr; //!< Virtual address type
75 typedef Uint32  tPAddr; //!< Physical Address type
76
77 /**
78  * \brief Register state passed to the syscall handler
79  * 
80  * The \a tSyscallRegs structure allows the system call handler to read
81  * the user state to get the arguments for the call. It also allows the
82  * handler to alter specific parts of the user state to reflect the
83  * result of the call.
84  * \note The fields shown here are need only be present in the actual
85  *       structure, in any order. The implementation may also add more
86  *       fields for padding purposes.
87  */
88 typedef struct {
89         Uint    Arg4;   //!< Fourth argument
90         Uint    Arg3;   //!< Third argument
91         Uint    Arg2;   //!< Second argument
92         union {
93                 Uint    Arg1;   //!< First arugment
94                 Uint    RetHi;  //!< High part of the return
95         };
96         union {
97                 Uint    Num;    //!< Call Number
98                 Uint    Return; //!< Low return value
99         };
100         
101         Uint    StackPointer;   //!< User stack pointer
102 }       tSyscallRegs;
103
104 /**
105  * \brief Opaque structure definining the MMU state for a task
106  */
107 typedef struct sMemoryState     tMemoryState;
108
109 /**
110  * \brief Opque structure defining the CPU state for a task
111  */
112 typedef struct sTaskState       tTaskState;
113
114
115 /**
116  * \name Memory Management
117  * \{
118  */
119 /**
120  * \}
121  */
122
123
124 #endif

UCC git Repository :: git.ucc.asn.au