MCPcopy Create free account
hub / github.com/ClangBuiltLinux/boot-utils / main

Function main

utils/aarch64_32_bit_el1_supported.c:8–31  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6#include <unistd.h> /* close() */
7
8int main(void)
9{
10 int fd, ret;
11
12 fd = open("/dev/kvm", O_RDWR);
13 if (fd < 0) {
14 perror("Failed to open /dev/kvm");
15 return -errno;
16 }
17
18 ret = ioctl(fd, KVM_CHECK_EXTENSION, KVM_CAP_ARM_EL1_32BIT);
19 if (ret < 0) {
20 perror("Error checking /dev/kvm for 32-bit EL1 support");
21 ret = 0;
22 }
23
24 close(fd);
25
26 /*
27 * KVM_CHECK_EXTENSION returns 1 for supported, 0 for unsupported so
28 * invert it to match typical success/fail codes in programs.
29 */
30 return !ret;
31}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected