MCPcopy Create free account
hub / github.com/coreboot/coreboot / main

Function main

util/post/post.c:48–79  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46}
47
48int main(int argc, char *argv[])
49{
50 unsigned long val;
51 unsigned long port = POST_DEFAULT_IO_PORT;
52 char *endptr;
53 int err;
54
55 if (argc != 2 && argc != 3) {
56 usage(argv[0], NULL);
57 exit(EXIT_FAILURE);
58 }
59
60 val = strtol(argv[1], &endptr, 0);
61 err = errno;
62 check_int(val, 0x00, 0xff, err, argv[1], endptr, argv[0]);
63
64 if (argc > 2) {
65 port = strtol(argv[2], &endptr, 0);
66 err = errno;
67 check_int(port, 0x0000, 0xffff, err, argv[2], endptr, argv[0]);
68 }
69
70 err = iopl(3);
71 if (err == -1) {
72 perror("Not root");
73 exit(EXIT_FAILURE);
74 }
75
76 outb(val, port);
77
78 return 0;
79}

Callers

nothing calls this directly

Calls 6

exitFunction · 0.85
check_intFunction · 0.85
perrorFunction · 0.85
usageFunction · 0.70
strtolFunction · 0.50
outbFunction · 0.50

Tested by

no test coverage detected