managarm/hel
Loading...
Searching...
No Matches
hel.h
Go to the documentation of this file.
1
3
4#ifndef HEL_H
5#define HEL_H
6
7#include <stddef.h>
8#include <string.h>
9#include <stdint.h>
10
11#include "hel-types.h"
12
13#ifdef __cplusplus
14#define HEL_C_LINKAGE extern "C"
15#else
16#define HEL_C_LINKAGE
17#endif
18
19enum {
20 // largest system call number plus 1
21 kHelNumCalls = 113,
22
23 kHelCallLog = 1,
24 kHelCallPanic = 10,
25
26 kHelCallNop = 2,
27 kHelCallSubmitAsyncNop = 3,
28
29 kHelCallCreateUniverse = 62,
30 kHelCallTransferDescriptor = 66,
31 kHelCallDescriptorInfo = 32,
32 kHelCallGetCredentials = 84,
33 kHelCallCloseDescriptor = 21,
34 kHelCallObtainHandle = 4,
35
36 kHelCallCreateQueue = 89,
37 kHelCallDriveQueue = 105,
38 kHelCallAlertQueue = 106,
39
40 kHelCallAllocateMemory = 51,
41 kHelCallResizeMemory = 83,
42 kHelCallCreateManagedMemory = 64,
43 kHelCallCreateKcovBuffer = 72,
44 kHelCallEnableCoverage = 90,
45 kHelCallDisableCoverage = 92,
46 kHelCallCopyOnWrite = 39,
47 kHelCallAccessPhysical = 30,
48 kHelCallCreateSliceView = 88,
49 kHelCallForkMemory = 40,
50 kHelCallCreateSpace = 27,
51 kHelCallCreateDmaSpace = 108,
52 kHelCallConfigureIrq = 109,
53 kHelCallCreateIndirectMemory = 45,
54 kHelCallAlterMemoryIndirection = 52,
55 kHelCallMapMemory = 44,
56 kHelCallSubmitProtectMemory = 99,
57 kHelCallSubmitSynchronizeSpace = 53,
58 kHelCallUnmapMemory = 36,
59 kHelCallPointerPhysical = 43,
60 kHelCallSubmitReadMemory = 77,
61 kHelCallSubmitWriteMemory = 78,
62 kHelCallMemoryInfo = 26,
63 kHelCallSubmitManageMemory = 46,
64 kHelCallUpdateMemory = 47,
65 kHelCallSubmitLockMemoryView = 48,
66 kHelCallLoadahead = 49,
67 kHelCallCreateVirtualizedSpace = 50,
68 kHelCallCreateSwapSpace = 110,
69 kHelCallAllocateSwappableMemory = 111,
70
71 kHelCallAccessIommu = 13,
72
73 kHelCallCreateThread = 67,
74 kHelCallQueryThreadStats = 95,
75 kHelCallSetPriority = 85,
76 kHelCallYield = 34,
77 kHelCallSubmitObserve = 74,
78 kHelCallKillThread = 87,
79 kHelCallInterruptThread = 86,
80 kHelCallResume = 61,
81 kHelCallLoadRegisters = 75,
82 kHelCallStoreRegisters = 76,
83 kHelCallQueryRegisterInfo = 102,
84 kHelCallWriteFsBase = 41,
85 kHelCallGetClock = 42,
86 kHelCallSubmitAwaitClock = 80,
87 kHelCallCreateVirtualizedCpu = 37,
88 kHelCallRunVirtualizedCpu = 38,
89 kHelCallAssertVirtualizedIrq = 107,
90 kHelCallKickVirtualizedCpu = 112,
91 kHelCallGetRandomBytes = 101,
92 kHelCallWriteGsBase = 54,
93 kHelCallReadFsBase = 55,
94 kHelCallReadGsBase = 56,
95 kHelCallGetCurrentCpu = 57,
96
97 kHelCallCreateStream = 68,
98 kHelCallSubmitAsync = 79,
99 kHelCallShutdownLane = 91,
100
101 kHelCallFutexWait = 73,
102 kHelCallFutexWake = 71,
103
104 kHelCallCreateOneshotEvent = 96,
105 kHelCallCreateBitsetEvent = 97,
106 kHelCallCreateSequencedEvent = 15,
107 kHelCallRaiseEvent = 98,
108 kHelCallAccessIrq = 14,
109 kHelCallHandleIrq = 5,
110 kHelCallAcknowledgeIrq = 81,
111 kHelCallSubmitAwaitEvent = 82,
112 kHelCallAutomateIrq = 94,
113 kHelCallQueryMsiInfo = 6,
114
115 kHelCallAccessIo = 11,
116 kHelCallEnableIo = 12,
117
118 kHelCallBindKernlet = 93,
119
120 kHelCallGetAffinity = 103,
121 kHelCallSetAffinity = 100,
122
123 kHelCallCreateToken = 104,
124
125 kHelCallExtendHierarchy = 7,
126
127 kHelCallSuper = 0x80000000
128};
129
130enum {
131 kHelErrNone = 0,
132 kHelErrBufferTooSmall = 1,
133 kHelErrBadDescriptor = 2,
134 kHelErrTimeout = 3,
135 kHelErrNoDescriptor = 4,
136 kHelErrIllegalSyscall = 5,
137 kHelErrIllegalObject = 6,
138 kHelErrIllegalArgs = 7,
139 kHelErrLaneShutdown = 8,
140 kHelErrEndOfLane = 9,
141 kHelErrFault = 10,
142 kHelErrThreadTerminated = 11,
143 kHelErrCancelled = 12,
144 kHelErrTransmissionMismatch = 13,
145 kHelErrQueueTooSmall = 14,
146 kHelErrIllegalState = 15,
147 kHelErrNoHardwareSupport = 16,
148 kHelErrNoMemory = 17,
149 kHelErrUnsupportedOperation = 18,
150 kHelErrOutOfBounds = 19,
151 kHelErrDismissed = 20,
152 kHelErrRemoteFault = 21,
153 kHelErrAlreadyExists = 22,
154 kHelErrBadPermissions = 23,
155 kHelErrOther = 24,
156 kHelErrFutexRace = 25,
157 kHelErrBadRights = 26,
158};
159
160typedef uint32_t HelRights;
161
162// No right but easier to recognize in code than a zero literal.
163// - General: descriptor properties can be queried without any rights.
164// - Memory view: memory size can be queried without any rights.
165// - Thread: statistics can be queried without any rights.
166static const HelRights kHelRightNull = 0;
167// Right to map into an object.
168// - Universe: required to transfer into the universe.
169// - Universe: required to close descriptors in the universe.
170// - Universe: required to create a thread in the universe.
171// - Address space: required to map into the space.
172// - Address space: required to change memory protection.
173// - Virtualized space: required to map into the space.
174// - DMA space: required to map into the space.
175static const HelRights kHelRightGrant = UINT32_C(1) << 0;
176// Right to map from an object.
177// - Universe: required to transfer out of the universe.
178// - Universe: required to create a thread in the universe.
179static const HelRights kHelRightTake = UINT32_C(1) << 1;
180// Right to read data.
181// - IPC queue: required to map readable.
182// - Memory view: required to read.
183// - Memory view: required to map readable.
184// - Memory view: required to create copy-on-write view.
185// - Memory view: required to map into indirect memory.
186// - Memory slice: required to map readable.
187// - Memory slice: required to map into indirect memory.
188// - Address space: required to read from it.
189// - Address space: required to create thread.
190// - Virtualized space: required to read from it.
191// - I/O objects: required to enable userspace I/O.
192// - Thread: required to read registers.
193// - Thread: required to read memory in its address space.
194// - Thread: required to get the affinity.
195// - Virtualized CPUs: required to read registers.
196static const HelRights kHelRightRead = UINT32_C(1) << 2;
197// Right to write data.
198// - IPC queue: required to map writeable.
199// - Memory view: required to write.
200// - Memory view: required to map writeable.
201// - Memory view: required to map into indirect memory.
202// - Memory slice: required to map writeable.
203// - Memory slice: required to map into indirect memory.
204// - Address space: required to write to it.
205// - Address space: required to create thread.
206// - Virtualized space: required to write to it.
207// - I/O objects: required to enable userspace I/O.
208// - Thread: required to write registers.
209// - Thread: required to write memory in its address space.
210// - Thread: required to set the affinity.
211// - Virtualized CPUs: required to write registers.
212static const HelRights kHelRightWrite = UINT32_C(1) << 3;
213// Right to execute code.
214// - Memory view: required to map executable.
215// - Memory slice: required to map executable.
216static const HelRights kHelRightExecute = UINT32_C(1) << 4;
217// Right to execute operations.
218// - IPC queue: required to submit.
219// - Lane: required to do exchange messages.
220// - Virtualized CPUs: required to run.
221static const HelRights kHelRightInvoke = UINT32_C(1) << 5;
222// Right to build new objects on top of existing ones.
223// - IPC queue: required to map.
224// - Universe: required to create thread.
225// - Address space: required to create thread.
226// - Memory view: required to map.
227// - Memory view: required to create copy-on-write view.
228// - Memory view: required to map into indirect memory.
229// - Memory view: required to create slice.
230// - Memory view: required to bind to kernlet.
231// - IRQ pin: required to install an IRQ handler.
232// - Memory slice: required to map.
233// - Memory slice: required to map into indirect memory.
234// - Swap space: required to allocate memory backed by it.
235// - Virtualized space: required to create virtualized CPU.
236// - I/O objects: required to enable userspace I/O.
237// - Kernlets: required to create a bound kernlet from it.
238// - Bound kernlets: required to attach to an IRQ.
239static const HelRights kHelRightAssign = UINT32_C(1) << 6;
240// Right to derive new objects that affect the original one.
241// - Memory view: required to fork.
242// - Hierarchy: required to extend it by a child hierarchy node.
243static const HelRights kHelRightDerive = UINT32_C(1) << 7;
244// Right to add, remove or manipulate components.
245// - Memory views: required to perform loadahead.
246// - Address space: required to synchronize.
247// - Address space: required to resolve physical addresses.
248// - DMA space: required to populate.
249// - DMA space: required to resolve physical addresses.
250// - Hierarchy: required to charge resources to it.
251static const HelRights kHelRightProvision = UINT32_C(1) << 8;
252// Right to pin memory pages.
253// - Memory view: required to pin pages.
254static const HelRights kHelRightPin = UINT32_C(1) << 9;
255// Right to perform memory fences.
256// - Memory view: required for fences.
257static const HelRights kHelRightFence = UINT32_C(1) << 10;
258// Right to wait on an object.
259// - IPC queue: required to drive.
260// - Thread: required to observe.
261// - Event: required to wait.
262// - IRQ: required to wait.
263// - IRQ: required to attach a kernlet.
264static const HelRights kHelRightWait = UINT32_C(1) << 11;
265// Right to signal an object.
266// - IPC queue: required to alert.
267// - Thread: required to interrupt.
268// - Event: required to raise.
269// - Event: required to bind to kernlet.
270// - IRQ: required to acknowledge.
271// - IRQ: required to attach a kernlet.
272// - Virtualized CPUs: required to raise an interrupt.
273static const HelRights kHelRightSignal = UINT32_C(1) << 12;
274// Right to manage an object (includes potentially destructive operations).
275// - Lane: required to shut down.
276// - Memory view: required to resize.
277// - Memory view: required to manage.
278// - Memory view: required to invalidate.
279// - Swap space: required to attach or detach swap regions.
280// - Thread: required to set priority.
281// - Thread: required to resume.
282// - Thread: required to kill.
283// - IRQ pin: required to configure the IRQ.
284// - IRQ pin: required to obtain MSI address and data words.
285static const HelRights kHelRightManage = UINT32_C(1) << 13;
286// All rights (even unspecified ones). Easier to recognize in code than a literal.
287static const HelRights kHelRightsMax = ~UINT32_C(0);
288
289struct HelX86SegmentRegister {
290 uint64_t base;
291 uint32_t limit;
292 uint16_t selector;
293 uint8_t type, present, dpl, db, s, l, g, avl;
294 // The segment register does not hold a usable segment (e.g., a null selector).
295 uint8_t unusable;
296};
297
298struct HelX86DescriptorTable {
299 uint64_t base;
300 uint16_t limit;
301};
302
303struct HelX86VirtualizationRegs {
304 uint64_t rax;
305 uint64_t rbx;
306 uint64_t rcx;
307 uint64_t rdx;
308 uint64_t rsi;
309 uint64_t rdi;
310 uint64_t rbp;
311 uint64_t r8;
312 uint64_t r9;
313 uint64_t r10;
314 uint64_t r11;
315 uint64_t r12;
316 uint64_t r13;
317 uint64_t r14;
318 uint64_t r15;
319
320 uint64_t rsp;
321 uint64_t rip;
322 uint64_t rflags;
323
324 struct HelX86SegmentRegister cs, ds, es, fs, gs, ss;
325 struct HelX86SegmentRegister tr, ldt;
326 struct HelX86DescriptorTable gdt, idt;
327
328 uint64_t cr0, cr2, cr3, cr4, cr8;
329 uint64_t efer;
330 uint64_t apic_base;
331};
332
333// The registers that VMMs need on most exits,
334struct HelX86VirtualizationBasicRegs {
335 uint64_t rax;
336 uint64_t rbx;
337 uint64_t rcx;
338 uint64_t rdx;
339 uint64_t rsi;
340 uint64_t rdi;
341 uint64_t rbp;
342 uint64_t r8;
343 uint64_t r9;
344 uint64_t r10;
345 uint64_t r11;
346 uint64_t r12;
347 uint64_t r13;
348 uint64_t r14;
349 uint64_t r15;
350
351 uint64_t rsp;
352 uint64_t rip;
353 uint64_t rflags;
354};
355
356struct HelX86VirtualizationMsrs {
357 uint64_t kernelGsBase;
358 uint64_t star;
359 uint64_t lstar;
360 uint64_t cstar;
361 uint64_t sfmask;
362 uint64_t sysenterCs;
363 uint64_t sysenterEsp;
364 uint64_t sysenterEip;
365 uint64_t xcr0;
366};
367
368struct HelRiscv64VirtualizationRegs {
369 union {
370 uint64_t x[32];
371
372 struct {
373 uint64_t zero;
374 uint64_t ra;
375 uint64_t sp;
376 uint64_t gp;
377 uint64_t tp;
378 uint64_t t0;
379 uint64_t t1;
380 uint64_t t2;
381 uint64_t s0;
382 uint64_t s1;
383 uint64_t a0;
384 uint64_t a1;
385 uint64_t a2;
386 uint64_t a3;
387 uint64_t a4;
388 uint64_t a5;
389 uint64_t a6;
390 uint64_t a7;
391 uint64_t s2;
392 uint64_t s3;
393 uint64_t s4;
394 uint64_t s5;
395 uint64_t s6;
396 uint64_t s7;
397 uint64_t s8;
398 uint64_t s9;
399 uint64_t s10;
400 uint64_t s11;
401 uint64_t t3;
402 uint64_t t4;
403 uint64_t t5;
404 uint64_t t6;
405 };
406 };
407
408 uint64_t pc;
409 uint8_t kernelMode;
410
411 // CSRs
412 uint64_t sstatus;
413 uint64_t sie;
414 uint64_t stvec;
415 uint64_t sscratch;
416 uint64_t sepc;
417 uint64_t scause;
418 uint64_t stval;
419 uint64_t sip;
420 uint64_t satp;
421 uint64_t stimecmp;
422};
423
424#if defined(__riscv) && __riscv_xlen == 64
425typedef struct HelRiscv64VirtualizationRegs HelVirtualizationRegs;
426#else
427typedef struct HelX86VirtualizationRegs HelVirtualizationRegs;
428#endif
429
430enum {
431 kHelNullHandle = 0,
432 kHelThisUniverse = -1,
433 kHelThisThread = -2
434};
435
436enum {
437 kHelWaitInfinite = -1
438};
439
440enum {
441 kHelActionNone = 0,
442 kHelActionDismiss = 11,
443 kHelActionOffer = 5,
444 kHelActionAccept = 6,
445 kHelActionImbueCredentials = 8,
446 kHelActionExtractCredentials = 9,
447 kHelActionSendFromBuffer = 1,
448 kHelActionSendFromBufferSg = 10,
449 kHelActionRecvInline = 7,
450 kHelActionRecvToBuffer = 3,
451 kHelActionPushDescriptor = 2,
452 kHelActionPullDescriptor = 4
453};
454
455enum {
456 kHelItemChain = 1,
457 kHelItemAncillary = 2,
458 kHelItemWantLane = (1 << 16),
459};
460
461static const uint32_t kHelTransferDescriptorOut = UINT32_C(1) << 0;
462static const uint32_t kHelTransferDescriptorIn = UINT32_C(1) << 1;
463
464enum {
465 kHelObtainZeroMemory = 1,
466 kHelObtainClockPage = 2
467};
468
470enum {
480 kHelClockTime = 4
482
493 uint64_t seqlock;
495 uint32_t clockType;
497 int32_t tickShift;
499 uint64_t tickFactor;
500};
501
502struct HelSgItem {
503 void *buffer;
504 size_t length;
505};
506
507struct HelAction {
508 int type;
509 uint32_t flags;
510 // TODO: It may be worth to restructure this to a union of structs
511 // (e.g., a HelActionDataBufferSize, HelActionDataDescriptorRights, ...),
512 // but that requires simultaneous mlibc and Managarm changes.
513 union {
514 uintptr_t word0;
515 void *buffer;
516 };
517 union {
518 uintptr_t word1;
519 size_t length;
520 // For kHelPushDescriptor, kHelPullDescriptor.
521 uint32_t rights;
522 };
523 union {
524 uintptr_t word2;
525 // For kHelActionImbueCredentials, kHelPushDescriptor, kHelPullDescriptor.
526 HelHandle handle;
527 };
528};
529
530struct HelDescriptorInfo {
531 int type;
532};
533
534enum HelAllocFlags {
535 kHelAllocContinuous = 4,
536 kHelAllocOnDemand = 1,
537};
538
539struct HelAllocRestrictions {
540 int addressBits;
541};
542
543enum HelManagedFlags {
544 kHelManagedReadahead = 1
545};
546
547enum HelManageRequests {
548 kHelManageInitialize = 1,
549 kHelManageWriteback = 2
550};
551
559
561 // Additional flags that may be set.
562 kHelMapProtRead = UINT32_C(1) << 8,
563 kHelMapProtWrite = UINT32_C(1) << 9,
564 kHelMapProtExecute = UINT32_C(1) << 10,
565 kHelMapDontRequireBacking = UINT32_C(1) << 7,
566 kHelMapFixed = UINT32_C(1) << 11,
567 kHelMapFixedNoReplace = UINT32_C(1) << 12,
568 kHelMapPreferBottom = UINT32_C(1) << 13,
571 kHelMapNoDirtyTracking = UINT32_C(1) << 14
573
574enum HelSliceFlags {
575 kHelSliceCacheWriteCombine = 1,
576};
577
578enum HelCachingMode {
579 kHelCachingDefault = 0,
580 kHelCachingUncached = 1,
581 kHelCachingWriteCombine = 2,
582 kHelCachingWriteThrough = 3,
583 kHelCachingWriteBack = 4,
584 kHelCachingMmio = 5,
585 kHelCachingMmioNonPosted = 6
586};
587
588enum HelThreadFlags {
589 kHelThreadStopped = 1
590};
591
592enum HelObservation {
593 kHelObserveNull = 0,
594 kHelObserveInterrupt = 4,
595 kHelObservePanic = 3,
596 kHelObserveBreakpoint = 1,
597 kHelObservePageFault = 2,
598 kHelObserveGeneralFault = 5,
599 kHelObserveIllegalInstruction = 6,
600 kHelObserveDivByZero = 7,
601 kHelObserveSuperCall = 0x80000000
602};
603
604enum HelRegisterSets {
605 kHelRegsProgram = 1,
606 kHelRegsGeneral = 2,
607 kHelRegsThread = 3,
608 kHelRegsDebug = 4,
609 kHelRegsVirtualization = 5,
610 kHelRegsSimd = 6,
611 kHelRegsSignal = 7,
612 kHelRegsPageFault = 8,
613 kHelRegsVirtualizationBasic = 9,
614 kHelRegsVirtualizationMsrs = 10
615};
616
617enum HelPageFaultFlags {
618 kHelPageFaultMapError = 1,
619 kHelPageFaultAccessError = 2,
620 kHelPageFaultOutOfMemory = 3
621};
622
627};
628
629#if defined(__x86_64__)
630enum HelRegisterIndex {
631 kHelRegRax = 0,
632 kHelRegRbx = 1,
633 kHelRegRcx = 2,
634 kHelRegRdx = 3,
635 kHelRegRdi = 4,
636 kHelRegRsi = 5,
637 kHelRegR8 = 6,
638 kHelRegR9 = 7,
639 kHelRegR10 = 8,
640 kHelRegR11 = 9,
641 kHelRegR12 = 10,
642 kHelRegR13 = 11,
643 kHelRegR14 = 12,
644 kHelRegR15 = 13,
645 kHelRegRbp = 14,
646
647 kHelNumGprs = 15,
648
649 kHelRegIp = 0,
650 kHelRegSp = 1
651};
652
653enum HelSyscallArgs {
654 kHelRegNumber = kHelRegRdi,
655 kHelRegError = kHelRegRdi,
656
657 kHelRegArg0 = kHelRegRsi,
658 kHelRegArg1 = kHelRegRdx,
659 kHelRegArg2 = kHelRegRax,
660 kHelRegArg3 = kHelRegR8,
661 kHelRegArg4 = kHelRegR9,
662 kHelRegArg5 = kHelRegR10,
663 kHelRegArg6 = kHelRegR12,
664 kHelRegArg7 = kHelRegR13,
665 kHelRegArg8 = kHelRegR14,
666
667 kHelRegOut0 = kHelRegRsi,
668 kHelRegOut1 = kHelRegRdx,
669 kHelRegOut2 = kHelRegRax
670};
671
672#elif defined(__aarch64__)
673enum HelRegisterIndex {
674 kHelRegX0 = 0,
675 kHelRegX1,
676 kHelRegX2,
677 kHelRegX3,
678 kHelRegX4,
679 kHelRegX5,
680 kHelRegX6,
681 kHelRegX7,
682 kHelRegX8,
683 kHelRegX9,
684 kHelRegX10,
685 kHelRegX11,
686 kHelRegX12,
687 kHelRegX13,
688 kHelRegX14,
689 kHelRegX15,
690 kHelRegX16,
691 kHelRegX17,
692 kHelRegX18,
693 kHelRegX19,
694 kHelRegX20,
695 kHelRegX21,
696 kHelRegX22,
697 kHelRegX23,
698 kHelRegX24,
699 kHelRegX25,
700 kHelRegX26,
701 kHelRegX27,
702 kHelRegX28,
703 kHelRegX29,
704 kHelRegX30,
705
706 kHelNumGprs = 31,
707
708 kHelRegIp = 0,
709 kHelRegSp = 1
710};
711
712enum HelSyscallArgs {
713 kHelRegNumber = kHelRegX0,
714 kHelRegError = kHelRegX0,
715
716 kHelRegArg0 = kHelRegX1,
717 kHelRegArg1 = kHelRegX2,
718 kHelRegArg2 = kHelRegX3,
719 kHelRegArg3 = kHelRegX4,
720 kHelRegArg4 = kHelRegX5,
721 kHelRegArg5 = kHelRegX6,
722 kHelRegArg6 = kHelRegX7,
723 kHelRegArg7 = kHelRegX8,
724 kHelRegArg8 = kHelRegX9,
725
726 kHelRegOut0 = kHelRegX1,
727 kHelRegOut1 = kHelRegX2,
728 kHelRegOut2 = kHelRegX3
729};
730
731#elif defined(__riscv) && __riscv_xlen == 64
732enum HelRegisterIndex {
733 kHelRegRa = 0,
734 kHelRegGp,
735 kHelRegTp,
736 kHelRegT0,
737 kHelRegT1,
738 kHelRegT2,
739 kHelRegS0,
740 kHelRegS1,
741 kHelRegA0,
742 kHelRegA1,
743 kHelRegA2,
744 kHelRegA3,
745 kHelRegA4,
746 kHelRegA5,
747 kHelRegA6,
748 kHelRegA7,
749 kHelRegS2,
750 kHelRegS3,
751 kHelRegS4,
752 kHelRegS5,
753 kHelRegS6,
754 kHelRegS7,
755 kHelRegS8,
756 kHelRegS9,
757 kHelRegS10,
758 kHelRegS11,
759 kHelRegT3,
760 kHelRegT4,
761 kHelRegT5,
762 kHelRegT6,
763 kHelNumGprs,
764 kHelRegIp = 0,
765 kHelRegSp = 1
766};
767enum HelSyscallArgs {
768 kHelRegNumber = kHelRegA0,
769 kHelRegError = kHelRegA0,
770 kHelRegArg0 = kHelRegA1,
771 kHelRegArg1 = kHelRegA2,
772 kHelRegArg2 = kHelRegA3,
773 kHelRegArg3 = kHelRegA4,
774 kHelRegArg4 = kHelRegA5,
775 kHelRegArg5 = kHelRegA6,
776 kHelRegArg6 = kHelRegA7,
777 kHelRegArg7 = kHelRegS2,
778 kHelRegArg8 = kHelRegS3,
779
780 kHelRegOut0 = kHelRegA1,
781 kHelRegOut1 = kHelRegA2,
782 kHelRegOut2 = kHelRegA3
783};
784
785#endif
786
787struct HelQueueParameters {
788 uint32_t flags;
789 unsigned int numChunks;
790 size_t chunkSize;
791 unsigned int numSqChunks;
792};
793
795static const uint32_t kHelHierarchyMemoryController = UINT32_C(1) << 0;
796
797struct HelHierarchyParameters {
798 // Optional tag to identify the hierarchy in kernel messages.
799 // Null-terminated unless it fills the entire array.
800 char tag[128];
801 // Bitmask of controllers that we want to enable.
802 uint32_t controllers;
803 // Only used with kHelHierarchyMemoryController; must be zero otherwise.
804 // Allocations of the hierarchy and its descendants wait (or fail) unless memoryFloor bytes
805 // of memory stay free on top of the kernel's own reserve.
806 // This keeps memory available to hierarchies with lower floors.
807 // The effective floor is the maximum over this floor and any parent floor.
808 size_t memoryFloor;
809};
810
812static const int kHelUserNotifyCqProgress = (1 << 0);
814static const int kHelUserNotifySupplySqChunks = (1 << 1);
816static const int kHelUserNotifyError = (1 << 14);
818static const int kHelUserNotifyAlert = (1 << 15);
819
821static const int kHelKernelNotifySqProgress = (1 << 0);
823static const int kHelKernelNotifySupplyCqChunks = (1 << 1);
824
826static const uint32_t kHelDriveWait = (1 << 0);
827
828enum {
829 kHelAccessIommuIntelVtd = 1,
830 kHelAccessIommuAmdVi = 2,
831};
832
833enum {
834 kHelDmaRegionRead = 1,
835 kHelDmaRegionWrite = 2,
836};
837
840 uint64_t base;
841 uint64_t size;
842 uint32_t flags;
843};
844
847 uint32_t segment;
848 uint8_t bus;
849 uint8_t slot;
850 uint8_t function;
851};
852
854static const uint32_t kHelSubmitCancel = 256;
856static const uint32_t kHelSubmitAsyncNop = 1;
858static const uint32_t kHelSubmitExchangeMsgs = 2;
860static const uint32_t kHelSubmitAwaitClock = 3;
862static const uint32_t kHelSubmitAwaitEvent = 4;
864static const uint32_t kHelSubmitProtectMemory = 5;
866static const uint32_t kHelSubmitSynchronizeSpace = 6;
868static const uint32_t kHelSubmitReadMemory = 7;
870static const uint32_t kHelSubmitWriteMemory = 8;
872static const uint32_t kHelSubmitManageMemory = 9;
874static const uint32_t kHelSubmitLockMemoryView = 10;
876static const uint32_t kHelSubmitObserve = 11;
878static const uint32_t kHelSubmitResizeMemory = 12;
880static const uint32_t kHelSubmitForkMemory = 13;
882static const uint32_t kHelSubmitWritebackFence = 14;
884static const uint32_t kHelSubmitInvalidateMemory = 15;
886static const uint32_t kHelSubmitPopulateSpace = 16;
888static const uint32_t kHelSubmitMapMemory = 17;
890static const uint32_t kHelSubmitUnmapMemory = 18;
892static const uint32_t kHelSubmitBindDmaDevice = 19;
894static const uint32_t kHelSubmitUnbindDmaDevice = 20;
896static const uint32_t kHelSubmitActivateIommu = 21;
898static const uint32_t kHelSubmitSetSwapRegion = 23;
899
901struct HelQueue {
906
911
915
919};
920
922static const int kHelNextPresent = (1 << 24);
923
925static const int kHelProgressMask = 0xFFFFFF;
927static const int kHelProgressDone = (1 << 25);
929static const int kHelProgressFull = (1 << 26);
930
931struct HelChunk {
934 int next;
935
937 int progressFutex;
938
940 char buffer[];
941};
942
946 unsigned int length;
948 unsigned int opcode;
950 void *context;
951};
952
955 uint64_t cancellationTag;
956};
957
962 HelHandle lane;
964 size_t count;
966 uint32_t flags;
967};
968
972 uint64_t counter;
975};
976
980 HelHandle handle;
982 uint64_t sequence;
985};
986
990 HelHandle spaceHandle;
992 void *pointer;
994 size_t size;
996 uint32_t flags;
997};
998
1002 HelHandle spaceHandle;
1004 void *pointer;
1006 size_t size;
1007};
1008
1012 HelHandle handle;
1014 uintptr_t address;
1016 size_t length;
1018 void *buffer;
1019};
1020
1024 HelHandle handle;
1026 uintptr_t address;
1028 size_t length;
1030 const void *buffer;
1031};
1032
1036 HelHandle handle;
1037};
1038
1042 HelHandle handle;
1044 uintptr_t offset;
1046 size_t size;
1047};
1048
1052 HelHandle handle;
1053};
1054
1058 HelHandle handle;
1060 size_t newSize;
1061};
1062
1068 HelHandle handle;
1069};
1070
1075 HelHandle handle;
1077 uintptr_t offset;
1079 size_t size;
1080};
1081
1083static const uint32_t kHelInvalidateNoWriteback = 1;
1084
1088 HelHandle handle;
1090 uintptr_t offset;
1092 size_t size;
1094 uint32_t flags;
1095};
1096
1100 HelHandle handle;
1102 uintptr_t address;
1104 size_t length;
1105};
1106
1110 HelHandle memoryHandle;
1112 HelHandle spaceHandle;
1114 void *pointer;
1116 uintptr_t offset;
1118 size_t size;
1120 uint32_t flags;
1121};
1122
1126 HelHandle spaceHandle;
1128 void *pointer;
1130 size_t size;
1131};
1132
1145
1155
1162 HelHandle iommuHandle;
1163};
1164
1168static const int kHelSwapRegionShift = 44;
1170static const uint32_t kHelNumSwapRegions = 1 << 18;
1171
1179 HelHandle swapHandle;
1183 size_t numPages;
1185 uint32_t region;
1186};
1187
1188struct HelSimpleResult {
1189 HelError error;
1190 int reserved;
1191};
1192
1193struct HelCredentialsResult {
1194 HelError error;
1195 int reserved;
1196 char credentials[16];
1197};
1198
1199struct HelManageResult {
1200 HelError error;
1201 int type;
1202 uintptr_t offset;
1203 size_t length;
1204};
1205
1206struct HelObserveResult {
1207 HelError error;
1208 unsigned int observation;
1209};
1210
1211struct HelInlineResult {
1212 HelError error;
1213 int reserved;
1214 size_t length;
1215 char data[];
1216};
1217
1218struct HelInlineResultNoFlex {
1219 HelError error;
1220 int reserved;
1221 size_t length;
1222};
1223
1224struct HelLengthResult {
1225 HelError error;
1226 int reserved;
1227 size_t length;
1228};
1229
1230struct HelHandleResult {
1231 HelError error;
1232 int reserved;
1233 HelHandle handle;
1234};
1235
1236struct HelPointerResult {
1237 HelError error;
1238 int reserved;
1239 void *pointer;
1240};
1241
1242struct HelEventResult {
1243 HelError error;
1244 uint32_t bitset;
1245 uint64_t sequence;
1246};
1247
1248enum HelAckFlags {
1249 kHelAckAcknowledge = 2,
1250 kHelAckNack = 3,
1251 kHelAckKick = 1,
1252 kHelAckClear = 0x100,
1253};
1254
1255union HelKernletData {
1256 HelHandle handle;
1257};
1258
1259struct HelThreadStats {
1260 uint64_t userTime;
1261};
1262
1263enum {
1264 // The guest executed HLT (x86 with SVM only; with VMX, the kernel handles HLT).
1265 kHelVmexitHlt = 0,
1266 // A guest-physical access to an unmapped address (e.g., MMIO).
1267 // address is the guest-physical address and flags is a combination of kHelVmFault*.
1268 // The instruction is neither decoded nor skipped; the VMM emulates it and advances RIP by itself.
1269 kHelVmexitTranslationFault = 1,
1270 // VMCALL/VMMCALL (x86) or ECALL (RISC-V).
1271 // On x86, it needs a completion; data[0] of the completion is written to RAX.
1272 kHelVmexitHyperCall = 2,
1273 kHelVmexitInstructionTrap = 3,
1274 kHelVmexitKicked = 4,
1275 // x86 port I/O, it needs a completion.
1276 // Address is the port, code is the access size in bytes, flags is a combination of kHelVmexitIo*.
1277 // String I/O is emulated by the VMM (which decodes the instruction); the completion skips it.
1278 // For non-string IN, data[0] of the completion is the value read.
1279 // For non-string OUT, data is the value.
1280 kHelVmexitIo = 5,
1281 // x86 CPUID, it needs a completion.
1282 // address is EAX (the leaf) and data is ECX (the subleaf).
1283 // data[0..3] of the completion are written to EAX, EBX, ECX and EDX.
1284 kHelVmexitCpuid = 6,
1285 // x86 RDMSR, it needs a completion;
1286 // address is the MSR index, data[0] of the completion is written to EDX:EAX.
1287 kHelVmexitRdmsr = 7,
1288 // x86 WRMSR, it needs a completion; address is the MSR index, data is the value.
1289 kHelVmexitWrmsr = 8,
1290 // The guest caused a triple fault.
1291 kHelVmexitShutdown = 9,
1292 // x86 with VMX: the guest EOI'd a level-triggered interrupt (e.g., for the remote IRR of an
1293 // emulated I/O APIC); code is the vector.
1294 kHelVmexitEoi = 10,
1295 // VM entry failed, code is the platform's entry failure reason.
1296 kHelVmexitError = -1,
1297 // Unknown VM exit reason, code is the platform's exit reason.
1298 kHelVmexitUnknownPlatformSpecificExitCode = -2,
1299};
1300
1301enum {
1302 kHelVmexitIoIn = 1 << 0,
1303 kHelVmexitIoString = 1 << 1,
1304};
1305
1306enum {
1307 kHelVmexitCompletionDone = 0,
1308 kHelVmexitCompletionFault = 1,
1309};
1310
1311struct HelVmexitCompletion {
1312 uint32_t status;
1313 uint32_t reserved;
1314 uint64_t data[4];
1315};
1316
1317enum {
1318 kHelVmFaultRead = 1 << 0,
1319 kHelVmFaultWrite = 1 << 1,
1320 kHelVmFaultExecute = 1 << 2,
1321};
1322
1323#if defined(__riscv) && __riscv_xlen == 64
1324
1325struct HelVmexitReason {
1326 uint32_t exitReason;
1327 // If bit 63 is set then stores a compressed unexpanded instruction,
1328 // otherwise stores a normal 32-bit instruction (possibly originally compressed in which case bits 1:0 aren't 0b11).
1329 uint64_t instruction;
1330 size_t address;
1331 size_t flags;
1332};
1333
1334#else
1335
1336struct HelVmexitReason {
1337 uint32_t exitReason;
1338 uint32_t code;
1339 size_t address;
1340 size_t flags;
1341 uint64_t data;
1342};
1343
1344#endif
1345
1346// see RFC 5424
1347enum HelLogSeverity {
1348 kHelLogSeverityEmergency,
1349 kHelLogSeverityAlert,
1350 kHelLogSeverityCritical,
1351 kHelLogSeverityError,
1352 kHelLogSeverityWarning,
1353 kHelLogSeverityNotice,
1354 kHelLogSeverityInfo,
1355 kHelLogSeverityDebug,
1356};
1357
1358enum {
1359 kHelAccessIrqByGsi = 1,
1360 kHelAccessIrqByPhandle = 2,
1361 kHelAccessIrqAllocateMsi = 3,
1362};
1363
1365enum {
1366 kHelIrqNameSize = 32,
1367};
1368
1369enum {
1370 kHelIrqTriggerNull = 0,
1371 kHelIrqTriggerEdge = 1,
1372 kHelIrqTriggerLevel = 2
1373};
1374
1375enum {
1376 kHelIrqPolarityNull = 0,
1377 kHelIrqPolarityHigh = 1,
1378 kHelIrqPolarityLow = 2
1379};
1380
1383 uint64_t address;
1384 uint32_t data;
1385};
1386
1388enum {
1389 kHelPageShift = 12,
1390 kHelPageSize = 1 << kHelPageShift
1391};
1392
1395
1403HEL_C_LINKAGE HelError helLog(const enum HelLogSeverity severity, const char *string, size_t length);
1404
1410HEL_C_LINKAGE void helPanic(const char *string, size_t length)
1411 __attribute__ (( noreturn ));
1412
1416
1418HEL_C_LINKAGE HelError helNop();
1419
1423HEL_C_LINKAGE HelError helSubmitAsyncNop(HelHandle queueHandle, uintptr_t context);
1424
1432HEL_C_LINKAGE HelError helExtendHierarchy(HelHandle hierarchyHandle,
1433 const struct HelHierarchyParameters *params, HelHandle *handle);
1434
1438
1442HEL_C_LINKAGE HelError helCreateUniverse(HelHandle *handle);
1443
1451HEL_C_LINKAGE HelError
1452helTransferDescriptor(HelHandle handle, HelHandle universeHandle,
1453 uint32_t flags, uint32_t exposedRights, uint32_t requiredRights, HelHandle *outHandle);
1454
1455HEL_C_LINKAGE HelError helDescriptorInfo(HelHandle handle, struct HelDescriptorInfo *info);
1456
1462HEL_C_LINKAGE HelError helGetCredentials(HelHandle handle, uint32_t flags,
1463 char *credentials);
1464
1470HEL_C_LINKAGE HelError helCloseDescriptor(HelHandle universeHandle, HelHandle handle);
1471
1477HEL_C_LINKAGE HelError helObtainHandle(int kind, HelHandle *handle);
1478
1482
1488HEL_C_LINKAGE HelError helCreateQueue(const struct HelQueueParameters *params,
1489 HelHandle *handle);
1490
1502HEL_C_LINKAGE HelError helDriveQueue(HelHandle queueHandle, uint32_t flags, uint32_t notifyMask);
1503
1510HEL_C_LINKAGE HelError helAlertQueue(HelHandle queueHandle);
1511
1515
1529HEL_C_LINKAGE HelError helAllocateMemory(HelHandle hierarchy, size_t size, uint32_t flags,
1530 const struct HelAllocRestrictions *restrictions, HelHandle *handle);
1531
1538HEL_C_LINKAGE HelError helResizeMemory(HelHandle handle, size_t newSize);
1539
1550HEL_C_LINKAGE HelError helCreateKcovBuffer(size_t size, HelHandle *handle);
1551
1553enum {
1557 kHelKcovModeCmp = 2
1559
1571HEL_C_LINKAGE HelError helEnableCoverage(HelHandle thread, HelHandle buffer, uint32_t mode);
1572
1578HEL_C_LINKAGE HelError helDisableCoverage(HelHandle thread);
1579
1594HEL_C_LINKAGE HelError helCreateManagedMemory(HelHandle hierarchy, size_t size, uint32_t flags,
1595 HelHandle *backingHandle, HelHandle *frontalHandle);
1596
1618HEL_C_LINKAGE HelError helCreateSwapSpace(HelHandle hierarchy, uint32_t flags,
1619 HelHandle *backingHandle, HelHandle *swapHandle);
1620
1636HEL_C_LINKAGE HelError helAllocateSwappableMemory(HelHandle hierarchy, HelHandle swapSpace,
1637 size_t size, uint32_t flags, HelHandle *handle);
1638
1658HEL_C_LINKAGE HelError helCopyOnWrite(HelHandle hierarchy, HelHandle swapSpace, HelHandle memory,
1659 uintptr_t offset, size_t size, HelHandle *handle);
1660
1661HEL_C_LINKAGE HelError helAccessPhysical(
1662 HelHandle accessToken, uintptr_t physical, size_t size, uint32_t cachingMode, HelHandle *handle
1663);
1664
1670HEL_C_LINKAGE HelError helCreateIndirectMemory(size_t numSlots, HelHandle *handle);
1671
1688HEL_C_LINKAGE HelError helAlterMemoryIndirection(HelHandle indirectHandle, size_t slotIndex,
1689 HelHandle memoryHandle, uintptr_t offset, size_t size);
1690
1691HEL_C_LINKAGE HelError helCreateSliceView(HelHandle bundle, uintptr_t offset, size_t size,
1692 uint32_t flags, HelHandle *handle);
1693
1701HEL_C_LINKAGE HelError helForkMemory(HelHandle handle, HelHandle *forkedHandle);
1702
1706HEL_C_LINKAGE HelError helCreateSpace(HelHandle *handle);
1707
1717HEL_C_LINKAGE HelError helAccessIommu(HelHandle accessHandle, uint32_t mode, uint64_t base,
1718 HelHandle *handle);
1719
1739HEL_C_LINKAGE HelError helCreateDmaSpace(HelHandle iommuHandle,
1740 const struct HelDmaReservedRegion *regions, size_t numRegions,
1741 uint32_t flags, HelHandle *handle);
1742
1760HEL_C_LINKAGE HelError helMapMemory(HelHandle memoryHandle, HelHandle spaceHandle,
1761 void *pointer, uintptr_t offset, size_t size, uint32_t flags, void **actualPointer);
1762
1763
1774HEL_C_LINKAGE HelError helUnmapMemory(HelHandle spaceHandle, void *pointer, size_t size);
1775
1776HEL_C_LINKAGE HelError helPointerPhysical(HelHandle spaceHandle, const void *pointer, uintptr_t *physical);
1777
1778HEL_C_LINKAGE HelError helMemoryInfo(HelHandle handle,
1779 size_t *size);
1780
1781HEL_C_LINKAGE HelError helUpdateMemory(HelHandle handle, int type, uintptr_t offset, size_t length);
1782
1793HEL_C_LINKAGE HelError helLoadahead(HelHandle handle, uintptr_t offset, size_t length);
1794
1795HEL_C_LINKAGE HelError helCreateVirtualizedSpace(HelHandle *handle);
1796
1800
1815HEL_C_LINKAGE HelError helCreateThread(HelHandle hierarchy, HelHandle universe,
1816 HelHandle spaceHandle, void *ip, void *sp, uint32_t flags, HelHandle *handle);
1817
1823HEL_C_LINKAGE HelError helQueryThreadStats(HelHandle handle, struct HelThreadStats *stats);
1824
1833HEL_C_LINKAGE HelError helSetPriority(HelHandle handle, int priority);
1834
1836HEL_C_LINKAGE HelError helYield();
1837
1841HEL_C_LINKAGE HelError helKillThread(HelHandle handle);
1842
1849HEL_C_LINKAGE HelError helInterruptThread(HelHandle handle);
1850
1857HEL_C_LINKAGE HelError helResume(HelHandle handle);
1858
1866HEL_C_LINKAGE HelError helLoadRegisters(HelHandle handle, int set, void *image);
1867
1875HEL_C_LINKAGE HelError helStoreRegisters(HelHandle handle, int set, const void *image);
1876
1879// Register set to query information for.
1882HEL_C_LINKAGE HelError helQueryRegisterInfo(int set, struct HelRegisterInfo *info);
1883
1884HEL_C_LINKAGE HelError helWriteFsBase(void *pointer);
1885
1886HEL_C_LINKAGE HelError helReadFsBase(void **pointer);
1887
1888HEL_C_LINKAGE HelError helWriteGsBase(void *pointer);
1889
1890HEL_C_LINKAGE HelError helReadGsBase(void **pointer);
1891
1893HEL_C_LINKAGE HelError helGetCurrentCpu(int *cpu);
1894
1899HEL_C_LINKAGE HelError helGetClock(uint64_t *counter);
1900
1901// x86 vCPUs with VMX have an in-kernel x2APIC:
1902// * ID 0,
1903// * starts software-disabled,
1904// * timer at 1 GHz before the divider,
1905// * and the guest's TSC equals the host's.
1906// The kernel handles its MSRs (0x800 - 0x8FF, IA32_APIC_BASE, IA32_TSC_DEADLINE),
1907// CR8 and HLT without exiting.
1908// SVM has no local APIC yet.
1909
1915HEL_C_LINKAGE HelError helCreateVirtualizedCpu(HelHandle handle, HelHandle *out_handle);
1916
1929HEL_C_LINKAGE HelError helRunVirtualizedCpu(HelHandle handle,
1930 const struct HelVmexitCompletion *completion, struct HelVmexitReason *reason);
1931
1944HEL_C_LINKAGE HelError helAssertVirtualizedIrq(HelHandle handle, uint64_t irq, uint8_t level);
1945
1950HEL_C_LINKAGE HelError helKickVirtualizedCpu(HelHandle handle);
1951
1952HEL_C_LINKAGE HelError helGetRandomBytes(void *buffer, size_t wantedSize, size_t *actualSize);
1953
1963HEL_C_LINKAGE HelError helGetAffinity(HelHandle handle, uint8_t *mask, size_t size, size_t *actualSize);
1964
1972HEL_C_LINKAGE HelError helSetAffinity(HelHandle handle, uint8_t *mask, size_t size);
1973
1977
1985HEL_C_LINKAGE HelError helCreateStream(HelHandle *lane1, HelHandle *lane2, uint32_t attach_credentials);
1986
1987HEL_C_LINKAGE HelError helShutdownLane(HelHandle handle);
1988
1996HEL_C_LINKAGE HelError helCreateToken(HelHandle *handle);
1997
2001
2010HEL_C_LINKAGE HelError helFutexWait(int *pointer, int expected, int64_t deadline);
2011
2017HEL_C_LINKAGE HelError helFutexWake(int *pointer, unsigned int count);
2018
2022
2026HEL_C_LINKAGE HelError helCreateOneshotEvent(HelHandle *handle);
2027
2031HEL_C_LINKAGE HelError helCreateBitsetEvent(HelHandle *handle);
2032
2043HEL_C_LINKAGE HelError helCreateSequencedEvent(HelHandle *waitHandle, HelHandle *raiseHandle);
2044
2049HEL_C_LINKAGE HelError helRaiseEvent(HelHandle handle);
2050
2071HEL_C_LINKAGE HelError helAccessIrq(
2072 HelHandle accessHandle, uint32_t mode, uint64_t controller, uint64_t index,
2073 const char *name, HelHandle *handle
2074);
2075
2081HEL_C_LINKAGE HelError helHandleIrq(HelHandle pinHandle, HelHandle *handle);
2082
2094HEL_C_LINKAGE HelError helConfigureIrq(HelHandle pinHandle, uint32_t trigger, uint32_t polarity);
2095
2102HEL_C_LINKAGE HelError helQueryMsiInfo(HelHandle pinHandle, struct HelMsiInfo *info);
2103
2104HEL_C_LINKAGE HelError helAcknowledgeIrq(HelHandle handle, uint32_t flags, uint64_t sequence);
2105
2106HEL_C_LINKAGE HelError helAutomateIrq(HelHandle handle, uint32_t flags, HelHandle kernlet);
2107
2111
2112HEL_C_LINKAGE HelError helAccessIo(
2113 HelHandle accessToken, const uintptr_t *portArray, size_t numPorts, HelHandle *handle
2114);
2115
2119HEL_C_LINKAGE HelError helEnableIo(HelHandle handle);
2120
2124
2134HEL_C_LINKAGE HelError helBindKernlet(HelHandle handle,
2135 const union HelKernletData *data, size_t numData, HelHandle *boundHandle);
2136
2138
2139extern inline __attribute__ (( always_inline )) const char *_helErrorString(HelError code) {
2140 switch(code) {
2141 case kHelErrNone:
2142 return "Success";
2143 case kHelErrIllegalSyscall:
2144 return "Illegal syscall";
2145 case kHelErrIllegalArgs:
2146 return "Illegal arguments";
2147 case kHelErrIllegalState:
2148 return "Illegal state";
2149 case kHelErrUnsupportedOperation:
2150 return "Unsupported operation";
2151 case kHelErrNoDescriptor:
2152 return "No such descriptor";
2153 case kHelErrBadDescriptor:
2154 return "Illegal descriptor for this operation";
2155 case kHelErrThreadTerminated:
2156 return "Thread terminated already";
2157 case kHelErrLaneShutdown:
2158 return "Lane shutdown";
2159 case kHelErrEndOfLane:
2160 return "End of lane";
2161 case kHelErrDismissed:
2162 return "IPC item dismissed by remote";
2163 case kHelErrBufferTooSmall:
2164 return "Buffer too small";
2165 case kHelErrQueueTooSmall:
2166 return "Buffer too small";
2167 case kHelErrFault:
2168 return "Segfault";
2169 case kHelErrNoHardwareSupport:
2170 return "Missing hardware support for this feature";
2171 case kHelErrNoMemory:
2172 return "Out of memory";
2173 case kHelErrTransmissionMismatch:
2174 return "Transmission mismatch";
2175 case kHelErrCancelled:
2176 return "Cancelled";
2177 case kHelErrOutOfBounds:
2178 return "Out of bounds";
2179 case kHelErrAlreadyExists:
2180 return "Already exists";
2181 case kHelErrBadRights:
2182 return "Missing rights for this operation";
2183 default:
2184 return 0;
2185 }
2186}
2187
2188extern inline __attribute__ (( always_inline )) void _helCheckFailed(HelError err_code,
2189 const char *string, int fatal) {
2190 helLog(kHelLogSeverityError, string, strlen(string));
2191
2192 const char *err_string = _helErrorString(err_code);
2193 if(err_string == 0)
2194 err_string = "(Unexpected error code)";
2195 helLog(kHelLogSeverityError, err_string, strlen(err_string));
2196 helLog(kHelLogSeverityError, "\n", 1);
2197
2198 if(fatal)
2199 helPanic(0, 0);
2200}
2201
2202#define HEL_STRINGIFY_AUX(x) #x
2203#define HEL_STRINGIFY(x) HEL_STRINGIFY_AUX(x)
2204
2205#define HEL_CHECK(expr) do { HelError __error = expr; if(__error != kHelErrNone) \
2206 _helCheckFailed(__error, "HEL_CHECK failed: " #expr "\n" \
2207 " In file " __FILE__ " on line " HEL_STRINGIFY(__LINE__) "\n", 1); } while(0)
2208#define HEL_SOFT_CHECK(expr) do { HelError __error = expr; if(__error != kHelErrNone) \
2209 _helCheckFailed(__error, "HEL_SOFT_CHECK failed: " #expr "\n" \
2210 " In file " __FILE__ " on line " HEL_STRINGIFY(__LINE__) "\n", 0); } while(0)
2211
2212#endif // HEL_H
2213
@ kHelClockTsc
x86: TSC.
Definition hel.h:474
@ kHelClockCntvct
ARM: virtual counter (CNTVCT_EL0).
Definition hel.h:478
@ kHelClockCntpct
ARM: physical counter (CNTPCT_EL0).
Definition hel.h:476
@ kHelClockNone
No clock that is accessible to userspace (= helGetClock() has to be used).
Definition hel.h:472
@ kHelClockTime
RISC-V: time CSR.
Definition hel.h:480
HEL_C_LINKAGE HelError helLog(const enum HelLogSeverity severity, const char *string, size_t length)
Writes a text message (e.g., a line of text) to the kernel's log.
HEL_C_LINKAGE HelError helSetPriority(HelHandle handle, int priority)
Set the priority of a thread.
HEL_C_LINKAGE HelError helYield()
Yields the current thread.
HEL_C_LINKAGE HelError helEnableCoverage(HelHandle thread, HelHandle buffer, uint32_t mode)
Attaches a kcov buffer to a thread, which then records coverage to it.
HEL_C_LINKAGE HelError helQueryMsiInfo(HelHandle pinHandle, struct HelMsiInfo *info)
Retrieves the message address and data of an MSI pin.
HEL_C_LINKAGE HelError helAccessIrq(HelHandle accessHandle, uint32_t mode, uint64_t controller, uint64_t index, const char *name, HelHandle *handle)
Access the IRQ pin that an IRQ is attached to.
HEL_C_LINKAGE HelError helConfigureIrq(HelHandle pinHandle, uint32_t trigger, uint32_t polarity)
Configure the trigger mode and polarity of an IRQ pin.
static const int kHelUserNotifyAlert
Set in userNotify when the queue is alerted.
Definition hel.h:818
HEL_C_LINKAGE HelError helTransferDescriptor(HelHandle handle, HelHandle universeHandle, uint32_t flags, uint32_t exposedRights, uint32_t requiredRights, HelHandle *outHandle)
Copies descriptors from the current universe to another universe.
HEL_C_LINKAGE HelError helCloseDescriptor(HelHandle universeHandle, HelHandle handle)
Closes a descriptor.
HEL_C_LINKAGE HelError helQueryRegisterInfo(int set, struct HelRegisterInfo *info)
Query register-related information.
HEL_C_LINKAGE HelError helMapMemory(HelHandle memoryHandle, HelHandle spaceHandle, void *pointer, uintptr_t offset, size_t size, uint32_t flags, void **actualPointer)
Maps memory objects into an address space.
HEL_C_LINKAGE HelError helSetAffinity(HelHandle handle, uint8_t *mask, size_t size)
Set a thread's CPU affinity mask.
static const int kHelSwapRegionShift
Byte offset (((uint64_t)r << kHelSwapRegionShift) + o) in the backing memory of a swap space addresse...
Definition hel.h:1168
static const uint32_t kHelNumSwapRegions
Number of swap regions per swap space.
Definition hel.h:1170
static const int kHelKernelNotifySqProgress
Set in kernelNotify after userspace has added SQ elements.
Definition hel.h:821
static const uint32_t kHelSubmitInvalidateMemory
SQ opcode: invalidate memory.
Definition hel.h:884
HEL_C_LINKAGE HelError helQueryThreadStats(HelHandle handle, struct HelThreadStats *stats)
Query run-time statistics of a thread.
HEL_C_LINKAGE HelError helAlterMemoryIndirection(HelHandle indirectHandle, size_t slotIndex, HelHandle memoryHandle, uintptr_t offset, size_t size)
Modifies indirect memory objects.
HEL_C_LINKAGE HelError helCreateVirtualizedCpu(HelHandle handle, HelHandle *out_handle)
Creates a virtualized CPU in a virtualized space.
HEL_C_LINKAGE HelError helCreateBitsetEvent(HelHandle *handle)
Create an event consisting of multiple bits that can fire independently.
static const uint32_t kHelInvalidateNoWriteback
Flag for kHelSubmitInvalidateMemory: discard dirty pages instead of writing them back.
Definition hel.h:1083
HEL_C_LINKAGE HelError helGetCredentials(HelHandle handle, uint32_t flags, char *credentials)
Returns the credentials associated with a given descriptor.
HEL_C_LINKAGE HelError helKillThread(HelHandle handle)
Kill (i.e., terminate) a thread.
static const uint32_t kHelSubmitWriteMemory
SQ opcode: write memory.
Definition hel.h:870
static const uint32_t kHelSubmitUnmapMemory
SQ opcode: unmap memory.
Definition hel.h:890
HEL_C_LINKAGE HelError helObtainHandle(int kind, HelHandle *handle)
Obtains a descriptor to one of the kernel's global objects.
HEL_C_LINKAGE HelError helCreateDmaSpace(HelHandle iommuHandle, const struct HelDmaReservedRegion *regions, size_t numRegions, uint32_t flags, HelHandle *handle)
Creates a DMA space that memory can be mapped into for device DMA.
HEL_C_LINKAGE HelError helGetAffinity(HelHandle handle, uint8_t *mask, size_t size, size_t *actualSize)
Get a thread's CPU affinity mask.
static const uint32_t kHelSubmitAsyncNop
SQ opcode: asynchronous no-op (for testing/profiling).
Definition hel.h:856
HEL_C_LINKAGE HelError helAccessIommu(HelHandle accessHandle, uint32_t mode, uint64_t base, HelHandle *handle)
Access an IOMMU that the kernel discovered from firmware.
HEL_C_LINKAGE HelError helGetClock(uint64_t *counter)
Read the system-wide monotone clock.
HEL_C_LINKAGE HelError helLoadahead(HelHandle handle, uintptr_t offset, size_t length)
Notifies the kernel that a certain range of memory should be preloaded.
HEL_C_LINKAGE HelError helCopyOnWrite(HelHandle hierarchy, HelHandle swapSpace, HelHandle memory, uintptr_t offset, size_t size, HelHandle *handle)
Creates memory object that obtains its memory by copy-on-write from another memory object.
HEL_C_LINKAGE HelError helLoadRegisters(HelHandle handle, int set, void *image)
Load a register image (e.g., from a thread).
HEL_C_LINKAGE void helPanic(const char *string, size_t length) __attribute__((noreturn))
Kills the current thread and writes an error message to the kernel's log.
HEL_C_LINKAGE HelError helUnmapMemory(HelHandle spaceHandle, void *pointer, size_t size)
Unmaps memory from an address space.
HEL_C_LINKAGE HelError helAllocateSwappableMemory(HelHandle hierarchy, HelHandle swapSpace, size_t size, uint32_t flags, HelHandle *handle)
Allocates memory that behaves like helAllocateMemory() but is backed by a swap space: under memory pr...
HEL_C_LINKAGE HelError helFutexWake(int *pointer, unsigned int count)
Wakes up all waiters of a futex.
HEL_C_LINKAGE HelError helResizeMemory(HelHandle handle, size_t newSize)
Resizes a memory object.
static const int kHelProgressMask
Mask to extract the number of valid bytes in the chunk.
Definition hel.h:925
static const uint32_t kHelSubmitManageMemory
SQ opcode: manage memory.
Definition hel.h:872
static const uint32_t kHelSubmitForkMemory
SQ opcode: fork memory.
Definition hel.h:880
HEL_C_LINKAGE HelError helInterruptThread(HelHandle handle)
Interrupt a thread.
static const int kHelProgressFull
Set by the producer once the chunk is full (i.e., no more bytes will be written).
Definition hel.h:929
static const uint32_t kHelSubmitUnbindDmaDevice
SQ opcode: block the DMA requests of a device.
Definition hel.h:894
static const uint32_t kHelSubmitSynchronizeSpace
SQ opcode: synchronize space.
Definition hel.h:866
HEL_C_LINKAGE HelError helRaiseEvent(HelHandle handle)
Raise an event.
static const uint32_t kHelDriveWait
Flag for helDriveQueue: wait until userNotify has any bits not in notifyMask set.
Definition hel.h:826
HEL_C_LINKAGE HelError helDisableCoverage(HelHandle thread)
Detaches the kcov buffer that is attached to a thread.
static const uint32_t kHelSubmitObserve
SQ opcode: observe thread.
Definition hel.h:876
HEL_C_LINKAGE HelError helForkMemory(HelHandle handle, HelHandle *forkedHandle)
Forks memory objects, i.e., copies them using copy-on-write.
HEL_C_LINKAGE HelError helCreateQueue(const struct HelQueueParameters *params, HelHandle *handle)
Creates an IPC queue.
HEL_C_LINKAGE HelError helCreateToken(HelHandle *handle)
Create a token object.
static const uint32_t kHelSubmitBindDmaDevice
SQ opcode: bind a device to a DMA space.
Definition hel.h:892
HEL_C_LINKAGE HelError helResume(HelHandle handle)
Resume a suspended thread.
static const uint32_t kHelSubmitExchangeMsgs
SQ opcode: exchange messages on a stream.
Definition hel.h:858
static const uint32_t kHelSubmitReadMemory
SQ opcode: read memory.
Definition hel.h:868
static const int kHelNextPresent
Marks the next field as present.
Definition hel.h:922
static const int kHelKernelNotifySupplyCqChunks
Set in kernelNotify after userspace has supplied new chunks.
Definition hel.h:823
HEL_C_LINKAGE HelError helSubmitAsyncNop(HelHandle queueHandle, uintptr_t context)
Does nothing, asynchronously (useful only for profiling).
HEL_C_LINKAGE HelError helHandleIrq(HelHandle pinHandle, HelHandle *handle)
Install an IRQ handler on an IRQ pin.
HEL_C_LINKAGE HelError helStoreRegisters(HelHandle handle, int set, const void *image)
Store a register image (e.g., to a thread).
static const uint32_t kHelSubmitAwaitEvent
SQ opcode: wait for an event.
Definition hel.h:862
static const uint32_t kHelSubmitAwaitClock
SQ opcode: wait for time to pass.
Definition hel.h:860
static const uint32_t kHelSubmitPopulateSpace
SQ opcode: populate a space.
Definition hel.h:886
HEL_C_LINKAGE HelError helAlertQueue(HelHandle queueHandle)
Alerts an IPC queue.
static const uint32_t kHelSubmitActivateIommu
SQ opcode: activate translation on an IOMMU.
Definition hel.h:896
HEL_C_LINKAGE HelError helCreateStream(HelHandle *lane1, HelHandle *lane2, uint32_t attach_credentials)
Create a stream (which always consists of two lanes).
static const uint32_t kHelSubmitProtectMemory
SQ opcode: protect memory.
Definition hel.h:864
HelMapFlags
Definition hel.h:560
@ kHelMapNoDirtyTracking
Discards the mapping's dirty bits instead of scheduling the pages for writeback.
Definition hel.h:571
static const uint32_t kHelSubmitMapMemory
SQ opcode: map memory.
Definition hel.h:888
static const int kHelUserNotifySupplySqChunks
Set in userNotify after kernel has supplied new SQ chunks.
Definition hel.h:814
HEL_C_LINKAGE HelError helCreateIndirectMemory(size_t numSlots, HelHandle *handle)
Creates a memory object that obtains its memory by delegating to other memory objects.
HEL_C_LINKAGE HelError helGetCurrentCpu(int *cpu)
Gets the index of the cpu which the calling thread is running on.
HEL_C_LINKAGE HelError helNop()
Does nothing (useful only for profiling).
HEL_C_LINKAGE HelError helRunVirtualizedCpu(HelHandle handle, const struct HelVmexitCompletion *completion, struct HelVmexitReason *reason)
Runs a virtualized CPU until it exits to the VMM.
HEL_C_LINKAGE HelError helFutexWait(int *pointer, int expected, int64_t deadline)
Waits on a futex.
HEL_C_LINKAGE HelError helBindKernlet(HelHandle handle, const union HelKernletData *data, size_t numData, HelHandle *boundHandle)
Bind parameters to a kernlet.
static const int kHelUserNotifyCqProgress
Set in userNotify after kernel has written progress.
Definition hel.h:812
HEL_C_LINKAGE HelError helCreateSpace(HelHandle *handle)
Creates a virtual address space that threads can run in.
static const uint32_t kHelSubmitWritebackFence
SQ opcode: writeback fence.
Definition hel.h:882
HelUpdateMemoryTypes
Additional type values of helUpdateMemory(); these are never issued as manage requests.
Definition hel.h:553
@ kHelUpdateMarkDirty
Marks a range as dirty, as if it had been written through a dirty-tracked mapping.
Definition hel.h:557
HEL_C_LINKAGE HelError helCreateSequencedEvent(HelHandle *waitHandle, HelHandle *raiseHandle)
Create an event that counts how often it was raised.
static const uint32_t kHelSubmitResizeMemory
SQ opcode: resize memory.
Definition hel.h:878
HEL_C_LINKAGE HelError helCreateOneshotEvent(HelHandle *handle)
Create an event that fires at most once.
HEL_C_LINKAGE HelError helCreateSwapSpace(HelHandle hierarchy, uint32_t flags, HelHandle *backingHandle, HelHandle *swapHandle)
Creates a swap space, the backing store for swappable anonymous memory (see helAllocateSwappableMemor...
HEL_C_LINKAGE HelError helDriveQueue(HelHandle queueHandle, uint32_t flags, uint32_t notifyMask)
Drives an IPC queue.
static const uint32_t kHelSubmitLockMemoryView
SQ opcode: lock memory view.
Definition hel.h:874
HEL_C_LINKAGE HelError helCreateUniverse(HelHandle *handle)
Creates a new universe descriptor.
static const int kHelProgressDone
Set by the producer once it retires the chunk.
Definition hel.h:927
HEL_C_LINKAGE HelError helEnableIo(HelHandle handle)
Enable userspace access to hardware I/O resources.
static const uint32_t kHelHierarchyMemoryController
Gives the new hierarchy its own memory controller with the given memoryFloor.
Definition hel.h:795
HEL_C_LINKAGE HelError helCreateManagedMemory(HelHandle hierarchy, size_t size, uint32_t flags, HelHandle *backingHandle, HelHandle *frontalHandle)
Creates a memory object that is managed by userspace.
HEL_C_LINKAGE HelError helCreateKcovBuffer(size_t size, HelHandle *handle)
Creates a buffer for kernel code coverage (kcov).
static const int kHelUserNotifyError
Set in userNotify if the queue encounters a contract violation.
Definition hel.h:816
HEL_C_LINKAGE HelError helExtendHierarchy(HelHandle hierarchyHandle, const struct HelHierarchyParameters *params, HelHandle *handle)
Creates a child hierarchy capability.
HEL_C_LINKAGE HelError helCreateThread(HelHandle hierarchy, HelHandle universe, HelHandle spaceHandle, void *ip, void *sp, uint32_t flags, HelHandle *handle)
Create a new thread.
static const uint32_t kHelSubmitSetSwapRegion
SQ opcode: set the capacity of a swap region.
Definition hel.h:898
static const uint32_t kHelSubmitCancel
SQ opcode: cancel an asynchronous operation.
Definition hel.h:854
HEL_C_LINKAGE HelError helKickVirtualizedCpu(HelHandle handle)
Makes helRunVirtualizedCpu() return with kHelVmexitKicked as soon as possible.
HEL_C_LINKAGE HelError helAllocateMemory(HelHandle hierarchy, size_t size, uint32_t flags, const struct HelAllocRestrictions *restrictions, HelHandle *handle)
Creates a memory object consisting of unmanaged RAM.
@ kHelKcovModeCmp
Record comparisons.
Definition hel.h:1557
@ kHelKcovModePc
Record PCs.
Definition hel.h:1555
HEL_C_LINKAGE HelError helAssertVirtualizedIrq(HelHandle handle, uint64_t irq, uint8_t level)
Raises an interrupt in a virtualized CPU.
Parameters that allow userspace to compute the current time on the monotone clock (i....
Definition hel.h:492
int32_t tickShift
Scaling exponent of the tick -> nanosecond conversion.
Definition hel.h:497
uint64_t tickFactor
Factor of the tick -> nanosecond conversion.
Definition hel.h:499
uint32_t clockType
One of the kHelClock* constants.
Definition hel.h:495
Requester ID that a device issues DMA requests as (see kHelSubmitBindDmaDevice).
Definition hel.h:846
Range of physical memory that a DMA space identity-maps (see helCreateDmaSpace).
Definition hel.h:839
A single element of a HelQueue.
Definition hel.h:944
unsigned int length
Length of the element in bytes.
Definition hel.h:946
void * context
User-defined value.
Definition hel.h:950
unsigned int opcode
Operation code (for SQ elements).
Definition hel.h:948
Message address / data pair that raises an MSI (see helQueryMsiInfo).
Definition hel.h:1382
In-memory kernel/user-space queue.
Definition hel.h:901
int kernelNotify
Futex that is used to wake the kernel.
Definition hel.h:910
int userNotify
Futex that is used to wake userspace.
Definition hel.h:905
int cqFirst
Index of the first chunk of the completion queue.
Definition hel.h:914
int sqFirst
Index of the first chunk of the submission queue.
Definition hel.h:918
Register-related information returned by helQueryRegisterInfo.
Definition hel.h:624
int setSize
Size of the selected register set.
Definition hel.h:626
SQ data for kHelSubmitActivateIommu.
Definition hel.h:1160
HelHandle iommuHandle
Handle to the IOMMU (see helAccessIommu).
Definition hel.h:1162
SQ data for kHelSubmitAwaitClock.
Definition hel.h:970
uint64_t cancellationTag
Tag to cancel this operation.
Definition hel.h:974
uint64_t counter
Deadline in nanoseconds since boot.
Definition hel.h:972
SQ data for kHelSubmitAwaitEvent.
Definition hel.h:978
HelHandle handle
Handle to the event descriptor.
Definition hel.h:980
uint64_t cancellationTag
Tag to cancel this operation.
Definition hel.h:984
uint64_t sequence
Previous sequence number.
Definition hel.h:982
SQ data for kHelSubmitBindDmaDevice.
Definition hel.h:1136
struct HelDmaDeviceId id
Requester ID of the device.
Definition hel.h:1143
HelHandle iommuHandle
Handle to the IOMMU (see helAccessIommu).
Definition hel.h:1138
HelHandle dmaSpaceHandle
Handle to a DMA space of that IOMMU (see helCreateDmaSpace).
Definition hel.h:1141
SQ data for kHelSubmitCancel.
Definition hel.h:954
SQ data for kHelSubmitExchangeMsgs.
Definition hel.h:960
uint32_t flags
Flags.
Definition hel.h:966
size_t count
Number of actions.
Definition hel.h:964
HelHandle lane
Handle to the lane.
Definition hel.h:962
SQ data for kHelSubmitForkMemory.
Definition hel.h:1064
HelHandle hierarchyHandle
Handle to the hierarchy object that owns the memory object.
Definition hel.h:1066
HelHandle handle
Handle to the memory object.
Definition hel.h:1068
SQ data for kHelSubmitInvalidateMemory.
Definition hel.h:1086
uint32_t flags
Flags (kHelInvalidate*).
Definition hel.h:1094
HelHandle handle
Handle to the memory object.
Definition hel.h:1088
size_t size
Size of the range.
Definition hel.h:1092
uintptr_t offset
Offset within the memory object.
Definition hel.h:1090
SQ data for kHelSubmitLockMemoryView.
Definition hel.h:1040
size_t size
Size to lock.
Definition hel.h:1046
uintptr_t offset
Offset within the memory object.
Definition hel.h:1044
HelHandle handle
Handle to the memory object.
Definition hel.h:1042
SQ data for kHelSubmitManageMemory.
Definition hel.h:1034
HelHandle handle
Handle to the memory object.
Definition hel.h:1036
SQ data for kHelSubmitMapMemory.
Definition hel.h:1108
uint32_t flags
Flags (kHelMap*).
Definition hel.h:1120
HelHandle spaceHandle
Handle to the space that the memory is mapped into.
Definition hel.h:1112
HelHandle memoryHandle
Handle to the memory object.
Definition hel.h:1110
uintptr_t offset
Offset within the memory object.
Definition hel.h:1116
void * pointer
Address to map at (depending on kHelMap*).
Definition hel.h:1114
size_t size
Size of the mapping.
Definition hel.h:1118
SQ data for kHelSubmitObserve.
Definition hel.h:1050
HelHandle handle
Handle to the thread.
Definition hel.h:1052
SQ data for kHelSubmitPopulateSpace.
Definition hel.h:1098
HelHandle handle
Handle to the memory space.
Definition hel.h:1100
uintptr_t address
Address within the memory space.
Definition hel.h:1102
size_t length
Length of the range.
Definition hel.h:1104
SQ data for kHelSubmitProtectMemory.
Definition hel.h:988
size_t size
Size of the mapping.
Definition hel.h:994
void * pointer
Pointer to the mapping.
Definition hel.h:992
uint32_t flags
Protection flags.
Definition hel.h:996
HelHandle spaceHandle
Handle to the address space.
Definition hel.h:990
SQ data for kHelSubmitReadMemory.
Definition hel.h:1010
uintptr_t address
Address within the memory object.
Definition hel.h:1014
HelHandle handle
Handle to the memory object.
Definition hel.h:1012
size_t length
Length in bytes.
Definition hel.h:1016
void * buffer
Buffer to read into.
Definition hel.h:1018
SQ data for kHelSubmitResizeMemory.
Definition hel.h:1056
HelHandle handle
Handle to the memory object.
Definition hel.h:1058
size_t newSize
New size in bytes.
Definition hel.h:1060
SQ data for kHelSubmitSetSwapRegion.
Definition hel.h:1176
size_t numPages
New capacity of the region in pages.
Definition hel.h:1183
HelHandle swapHandle
Handle to the swap space (from helCreateSwapSpace).
Definition hel.h:1179
uint32_t region
Index of the region. Must be smaller than kHelNumSwapRegions.
Definition hel.h:1185
SQ data for kHelSubmitSynchronizeSpace.
Definition hel.h:1000
void * pointer
Pointer to the mapping.
Definition hel.h:1004
size_t size
Size of the mapping.
Definition hel.h:1006
HelHandle spaceHandle
Handle to the address space.
Definition hel.h:1002
SQ data for kHelSubmitUnbindDmaDevice.
Definition hel.h:1149
HelHandle iommuHandle
Handle to the IOMMU (see helAccessIommu).
Definition hel.h:1151
struct HelDmaDeviceId id
Requester ID of the device.
Definition hel.h:1153
SQ data for kHelSubmitUnmapMemory.
Definition hel.h:1124
size_t size
Size of the mapping.
Definition hel.h:1130
void * pointer
Pointer to the mapping.
Definition hel.h:1128
HelHandle spaceHandle
Handle to the space that the mapping is removed from.
Definition hel.h:1126
SQ data for kHelSubmitWriteMemory.
Definition hel.h:1022
HelHandle handle
Handle to the memory object.
Definition hel.h:1024
size_t length
Length in bytes.
Definition hel.h:1028
const void * buffer
Buffer to write from.
Definition hel.h:1030
uintptr_t address
Address within the memory object.
Definition hel.h:1026
SQ data for kHelSubmitWritebackFence.
Definition hel.h:1073
HelHandle handle
Handle to the memory object.
Definition hel.h:1075
size_t size
Size of the range.
Definition hel.h:1079
uintptr_t offset
Offset within the memory object.
Definition hel.h:1077