forked from schierlm/Oberon2013Modifications
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ReproducibleORL.patch
44 lines (44 loc) · 2.68 KB
/
ReproducibleORL.patch
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
--- 1/ORL.Mod.txt
+++ 2/ORL.Mod.txt
@@ -100,6 +100,7 @@
INC(size, DescSize);
IF AllocPtr + size < limit THEN (*allocate*)
p := AllocPtr; mod := SYSTEM.VAL(Module, p);
+ n := 0; FOR i := 0 TO DescSize DIV 4 - 1 DO SYSTEM.PUT(p + i * 4, n) END;
AllocPtr := (p + size + 3) DIV 4 * 4; mod.size := AllocPtr - p;
IF root = NIL THEN mod.num := 1 ELSE mod.num := root.num + 1 END ;
mod.next := root; root := mod
@@ -110,6 +111,7 @@
INC(p, DescSize); (*allocate descriptor*)
FOR i := 0 TO MnLength-1 DO mod.name[i] := 0X END ;
mod.name := name; mod.key := key; mod.refcnt := 0;
+ FOR i := 0 TO MnLength - 2 DO IF mod.name[i] = 0X THEN mod.name[i+1] := 0X END END;
mod.data := p; (*data*)
SYSTEM.PUT(mod.num * 4 + MTOrg, p); (*module table entry*)
Files.ReadInt(R, n);
@@ -227,11 +229,11 @@
SYSTEM.GET(Start, x); (*address of initialization body of the top module relative to Start*)
SYSTEM.PUT(Start, BC + (x DIV 4) - 1); (*branch instruction to the initialization body of the top module*)
SYSTEM.PUT(Start + DestAdr, 0); (*destination address of the prelinked, executable binary*)
- SYSTEM.PUT(Start + MemAdr, Kernel.MemLim); (*limit of available memory, typically overwritten by the boot loader*)
+ SYSTEM.PUT(Start + MemAdr, 0); (*limit of available memory, typically overwritten by the boot loader*)
SYSTEM.PUT(Start + AllocAdr, AllocPtr - Start); (*address of the end of the module space loaded*)
SYSTEM.PUT(Start + RootAdr, SYSTEM.VAL(INTEGER, root) - Start); (*current root of the links of loaded modules*)
- SYSTEM.PUT(Start + StackAdr, Kernel.stackOrg); (*current limit of the module area, typically overwritten by the boot loader*)
- SYSTEM.PUT(Start + FPrintAdr, FPrint); (*fingerprint*)
+ SYSTEM.PUT(Start + StackAdr, 0); (*current limit of the module area, typically overwritten by the boot loader*)
+ SYSTEM.PUT(Start + 252, FPrint); (*fingerprint*)
MakeFileName(name, S.s, ".bin"); F := Files.New(name); Files.Set(R, F, 0); i := Start;
WHILE i < AllocPtr DO SYSTEM.GET(i, x); Files.WriteInt(R, x); INC(i, 4) END ;
Texts.WriteInt(W, AllocPtr - Start, 7); Files.Register(F)
@@ -266,6 +268,10 @@
END ;
IF i > 0 THEN
WHILE i < Kernel.SectorLength DO buf[i] := 0; INC(i) END ;
+ Kernel.PutSector(secno*29, buf)
+ END;
+ WHILE secno < 63 DO INC(secno);
+ i := 0; WHILE i < Kernel.SectorLength DO buf[i] := 0; INC(i) END;
Kernel.PutSector(secno*29, buf)
END
ELSE Texts.WriteString(W, " not found")