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 / gpu / driver / chan / dma.om

44 lines · 1098 bytes Raw Blame History
1note chan/dma.om: production whole-window VFIO DMA transport for chan/gmmu.om.
2note Linux include/uapi/linux/vfio.h struct vfio_iommu_type1_dma_map/unmap.
3note Compiler397e6704 validates a live RW handle in vaddr and substitutes its base/whole size.
4note No open, close, reset, container adoption or authorization is performed here.
5note mmdmaop 1 maps; 2 unmaps. mmduout is actual unmapped bytes, only meaningful after rc0.
6global mmduout ulong 1
7fn mmdput b edit uchar 32 off ulong v ulong to void
8for i ulong 8
9put b add off i uchar and shr v mul i 8 255
10end
11end
12fn mmdget b view uchar 32 off ulong to ulong
13v = ulong 0
14for i ulong 8
15v = or v shl ulong get b add off i mul i 8
16end
17ret v
18end
19fn mmdmaop op ulong fd int h long iova ulong size ulong to long
20b = new uchar 32 0
21put mmduout 0 0
22if eq op 1
23put b 0 32
24put b 4 3
25mmdput b 8 ulong h
26mmdput b 16 iova
27mmdput b 24 size
28ret vfioctl fd 15217 b 0 32
29end
30if ne op 2
31ret -22
32end
33put b 0 24
34mmdput b 8 iova
35mmdput b 16 size
36r = vfioctl fd 15218 b 0 24
37if eq r 0
38put mmduout 0 mmdget b 16
39end
40ret r
41end
42fn mmdrop h long to long
43ret mapdrop h
44end