interplane.Get Omega
Read in your language

omega-mv

Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.

Brought by drakestapleton

branch main Branches Tags History

omega-mv / tests / x86efi / file11 / t1.om

67 lines · 1546 bytes Raw Blame History
1target x86efi
2note efi 11 with two FAT volumes: the boot stick and a second stick whose \EFI\BOOT\BOOTX64.EFI
3note holds the 4 bytes "junk". Count the volumes, read the other volume's file (4 bytes), read
4note this image from the boot volume, write it over the other volume's file, read it back and
5note compare, then ask for volume 9 (error 19). One character per result: the count, the boot
6note index, then 1 for each check that held (0 if not), then the low 6 bits of the volume 9
7note status + 48 (C = 19) and 1 if that status has bit 63 set.
8global ms uchar 32
9global Img uchar 2097152
10global Back uchar 2097152
11
12fn pr n ulong to void
13r = efi 13 0 ms 0 n
14end
15
16fn bit b bool to uchar
17if b
18ret uchar 49
19end
20ret uchar 48
21end
22
23fn main to ulong
24put ms 0 61
25put ms 1 61
26put ms 2 66
27put ms 3 10
28pr 4
29r = efi 11 0 Img 0 0
30n = and r 255
31boot = and shr r 8 255
32tgt = ulong 0
33if eq boot 0
34tgt = 1
35end
36junk = efi 11 or 1 shl tgt 8 Back 0 len Back
37rd = efi 11 or 1 shl boot 8 Img 0 len Img
38wr = efi 11 or 2 shl tgt 8 Img 0 rd
39rb = efi 11 or 1 shl tgt 8 Back 0 len Back
40same = eq rb rd
41if same
42j = ulong 0
43while lt j rd
44if ne get Img j get Back j
45same = false
46break
47end
48j = add j 1
49end
50end
51e = efi 11 ulong 2305 Back 0 len Back
52put ms 0 uchar add 48 and n 63
53put ms 1 uchar add 48 and boot 63
54put ms 2 bit and eq shr r 63 0 eq junk 4
55put ms 3 bit and eq shr rd 63 0 gt rd 4096
56put ms 4 bit eq wr rd
57put ms 5 bit same
58put ms 6 uchar add 48 and e 63
59put ms 7 bit eq shr e 63 1
60put ms 8 10
61put ms 9 61
62put ms 10 61
63put ms 11 69
64put ms 12 10
65pr 13
66ret 0
67end