-
Notifications
You must be signed in to change notification settings - Fork 6
/
hal.h
113 lines (91 loc) · 2.76 KB
/
hal.h
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
/***************************************************************************
*
* Copyright (c) 1997, 1998 Timpanogas Research Group, Inc. All Rights
* Reserved.
*
* AUTHOR : Jeff V. Merkey
* FILE : HAL.H
* DESCRIP : Hardware Abstraction Layer for MANOS v1.0
* DATE : December 10, 1997
*
*
***************************************************************************/
#include "types.h"
#include "version.h"
#define PROCESSOR_INACTIVE 0
#define PROCESSOR_ACTIVE 1
#define PROCESSOR_DEBUG 2
#define PROCESSOR_SIGNAL 3
#define PROCESSOR_FATAL 4
#define PROCESSOR_INIT 5
#define PROCESSOR_SHUTDOWN 6
#define PROCESSOR_RESUME 7
#define PROCESSOR_LOCK 8
#define PROCESSOR_CURRENT 9
#define PROCESSOR_SUSPEND 10
#define PIC_MODE 0
#define APIC_MODE 1
#define CBUS_MODE 2
#define COMPAQ_MODE 3
typedef struct _HARDWARE_ABSTRACTION {
LONG ProcessorNumber;
LONG ProcessorState;
LONG DebugSignal;
LONG ShutdownSignal;
// HAL Table of Functions provided by HAL Modules
LONG (*SetSpl)();
LONG (*GetSpl)();
LONG (*GetCPUID)(void);
LONG (*InitializeProcessorHardware)(LONG);
LONG (*ShutdownProcessorHardware)(LONG);
LONG (*OnlineProcessor)(LONG, LONG);
LONG (*OfflineProcessor)();
LONG (*OfflineSelf)();
LONG (*SetInterrupt)(LONG, LONG, LONG, LONG);
LONG (*ClearInterrupt)(LONG);
LONG (*MaskInterrupt)(LONG);
LONG (*UnmaskInterrupt)(LONG);
LONG (*StartTimer)(void);
LONG (*StopTimer)(void);
LONG (*MaskTimer)(void);
LONG (*UnmaskTimer)(void);
LONG (*MaskInterruptSubsystem)(void);
LONG (*UnmaskInterruptSubsystem)(void);
LONG (*EndOfInterrupt)(LONG);
LONG (*DirectedNMI)(LONG);
LONG (*XCall)();
// paging system entry
LONG (*SetPageRegister)();
LONG (*GetPageRegister)();
LONG (*PageFaultEntry)();
LONG (*InvalidatePage)();
LONG (*InitializeMMU)();
// atomic functions
LONG (*spin_lock)();
LONG (*spin_unlock)();
LONG (*spin_try_lock)();
// real mode functions
LONG (*ExitSystem)();
LONG (*RealModeInt)();
LONG (*ProtectedModeInterrupt)();
LONG xcall_mutex;
LONG xcall_command;
LONG xcall_arg1;
LONG xcall_arg2;
LONG xcall_arg3;
LONG xcall_total;
LONG xcall_fail;
LONG xcall_busy;
LONG xcall_ack;
LONG debug_command;
LONG totalInterrupts;
LONG TLBShootdowns;
LONG lockAssertions;
LONG pageFaults;
LONG HalReserved[100];
} HAL;
extern LONG InitializeHAL(void);
extern LONG InitializeSMPHAL(void);
extern void InitializePaging(LONG Processor);
extern HAL processor_table[MAX_PROCESSORS];
extern LONG systemType;