-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexhandler.spl
More file actions
76 lines (56 loc) · 1.52 KB
/
exhandler.spl
File metadata and controls
76 lines (56 loc) · 1.52 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
breakpoint;
[PROCESS_TABLE + [SYSTEM_STATUS_TABLE + 1] * 16 + 9] = -1;
[PROCESS_TABLE + [SYSTEM_STATUS_TABLE + 1] * 16 + 13] = SP;
SP = [PROCESS_TABLE + [SYSTEM_STATUS_TABLE + 1] * 16 + 11] * 512 - 1;
backup;
multipush(EIP);
if ((EC != 0) || ([PROCESS_TABLE + [SYSTEM_STATUS_TABLE + 1] * 16 + 13] == (PTLR * 512 - 1))) then
if (EC == 0) then
print "Stack overflow";
endif;
if (EC == 1) then
print "Illegal instruction";
endif;
if (EC == 2) then
print "Illegal memory access";
endif;
if (EC == 3) then
print "Arithmetic Exception";
endif;
R1 = 3;
R2 = [SYSTEM_STATUS_TABLE + 1];
call MOD_1;
call MOD_5;
else
alias blockNumber R2;
if (EPN > 3 && EPN < 8) then
blockNumber = [DISK_MAP_TABLE + [SYSTEM_STATUS_TABLE + 1] * 10 + EPN];
multipush(R0, R1, R2);
multipush(EPN);
R1 = 5;
R2 = blockNumber;
call MOD_2;
multipop(EPN);
[PAGE_TABLE_BASE + [SYSTEM_STATUS_TABLE + 1] * 20 + 2 * EPN] = R0;
[PAGE_TABLE_BASE + [SYSTEM_STATUS_TABLE + 1] * 20 + 2 * EPN + 1] = "1100";
multipop(R0, R1, R2);
else
multipush(R0, R1, R2);
R1 = 1;
call MOD_2;
[PTBR + 4] = R0;
[PTBR + 5] = "1110";
R1 = 1;
call MOD_2;
[PTBR + 6] = R0;
[PTBR + 7] = "1110";
multipop(R0, R1, R2);
endif;
endif;
[PROCESS_TABLE + [SYSTEM_STATUS_TABLE + 1] * 16 + 9] = 0;
multipop(EIP);
restore;
SP = [PROCESS_TABLE + [SYSTEM_STATUS_TABLE + 1] * 16 + 13];
SP = SP + 1;
[[PTBR + 2 * (SP / 512)] * 512 + (SP % 512)] = EIP;
ireturn;