-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstack.h
More file actions
83 lines (60 loc) · 1.11 KB
/
stack.h
File metadata and controls
83 lines (60 loc) · 1.11 KB
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
/*
** SCCS ID: @(#)stack.h 1.1 4/17/15
**
** File: stack.h
**
** Author: CSCI-452 class of 20145
**
** Contributor:
**
** Description: Stack-related declarations
*/
#ifndef _STACK_H_
#define _STACK_H_
#include "types.h"
/*
** General (C and/or assembly) definitions
*/
#ifndef __SP_ASM__
/*
** Start of C-only definitions
*/
// size of each stack (in longwords)
#define STACK_LWORDS 1024
// number of stacks to create includes one for the idle process
#define N_STACKS (N_PROCS)
/*
** Types
*/
// stack structure
typedef uint32_t stack_t[STACK_LWORDS];
/*
** Globals
*/
extern stack_t _system_stack; // separate stack for the OS itself
extern uint32_t *_system_esp; // OS %ESP value
/*
** Prototypes
*/
/*
** _stack_modinit()
**
** initializes all stack-related data structures
*/
void _stack_modinit( void );
/*
** _stack_alloc()
**
** allocate a stack structure
**
** returns a pointer to the stack, or NULL on failure
*/
stack_t *_stack_alloc( void );
/*
** _stack_dealloc(stack)
**
** deallocate a stack, putting it into the list of available stacks
*/
void _stack_dealloc( stack_t *stack );
#endif
#endif