-
Notifications
You must be signed in to change notification settings - Fork 0
/
IVTEntry.cpp
49 lines (42 loc) · 920 Bytes
/
IVTEntry.cpp
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
/*
* IVTEntry.cpp
*
* Created on: Jun 21, 2021
* Author: OS1
*/
#include "IVTEntry.h"
#include "Kernel.h"
#include "dos.h"
#include "KrnlEv.h"
IVTEntry * IVTEntry::getIVTEntry(IVTNo IVTnumber){
return Kernel::ivtEntries[IVTnumber];
}
IVTEntry::IVTEntry(IVTNo ivtNumberr, pInterrupt newRoutine) {
lock
event = 0;
ivtNumber = ivtNumberr;
#ifndef BCC_BLOCK_IGNORE
oldRoutine = getvect(ivtNumberr); //staru rutinu cuvamo
setvect(ivtNumberr, newRoutine); //novu postavljamo
#endif
Kernel::ivtEntries[ivtNumber] = this;
unlock
}
void IVTEntry::signal(){
if(!event) return;
event->signal();
}
void IVTEntry::callOldRoutine(){
//lock
if(!oldRoutine) return;
oldRoutine();
//unlock
}
IVTEntry::~IVTEntry() {
lock
#ifndef BCC_BLOCK_IGNORE
setvect(ivtNumber, oldRoutine); //vracamo staru rutinu
#endif
Kernel::ivtEntries[ivtNumber] = 0;
unlock
}