summaryrefslogtreecommitdiff
path: root/include/udefs.h
blob: 50b695263d29608385be2f149d441bd09d68b614 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
/**
** @file	udefs.h
**
** @author	CSCI-452 class of 20245
**
** @brief	"Userland" configuration information
*/

#ifndef UDEFS_H_
#define UDEFS_H_

#include <common.h>

/*
** General (C and/or assembly) definitions
**
** This section of the header file contains definitions that can be
** used in either C or assembly-language source code.
*/

// delay loop counts

#define DELAY_LONG		100000000
#define DELAY_MED		4500000
#define DELAY_SHORT		2500000

#define DELAY_STD		DELAY_SHORT

#ifndef ASM_SRC

/*
** Start of C-only definitions
*/

// convenience macros

// a delay loop - kind of ugly, but it works

#define DELAY(n)	do { \
		for(int _dlc = 0; _dlc < (DELAY_##n); ++_dlc) continue; \
	} while(0)

/*
** We need the list of program IDs so that we can request 
** their execution
*/

#include <userids.h>

/*
** All user main() functions have the following prototype:
**
**	int name( int argc, char *argv[] );
**
** To simplify declaring them, we define a macro that expands into
** that header. This can be used both in the implementation (followed
** by the function body) and in places where we just need the prototype
** (following it with a semicolon).
*/

#define USERMAIN(f)	int f( int argc, char *argv[] )

/*
** User process controls.
**
** To enable a specific test, define the symbol SPAWN_name here, and
** guard the places in other code that use or refer to that test. For
** example, test 'A' is enabled by definining SPAWN_A here, and all
** places that refer to test 'A' are guarded with:
**
**      #ifdef SPAWN_A
**          ... conditionally-compiled code
**      #endif
**
** Generally, most of these will exit with a status of 0.  If a process
** returns from its main function when it shouldn't (e.g., if it had
** called exit() but continued to run), it will usually return a status
** of ?.
*/

/*
** The standard set of test programs, start by the shell (which is started
** automatically from the initial user process)
**
** There is no user 'O' program, and programs 'W' through 'Z' are spawned
** from other processes and are never spawned directly.
*/

#define SPAWN_A
#define SPAWN_B
#define SPAWN_C
#define SPAWN_D
#define SPAWN_E
#define SPAWN_F
#define SPAWN_G
#define SPAWN_H
#define SPAWN_I
#define SPAWN_J
#define SPAWN_K
#define SPAWN_L
#define SPAWN_M
#define SPAWN_N
#define SPAWN_P
#define SPAWN_Q
#define SPAWN_R
#define SPAWN_S
#define SPAWN_T
#define SPAWN_U
#define SPAWN_V

#endif /* !ASM_SRC */

#endif