From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <444D3701.50303@lanl.gov> Date: Mon, 24 Apr 2006 14:37:21 -0600 From: Ronald G Minnich User-Agent: Mozilla Thunderbird 1.0.7-1.1.fc4 (X11/20050929) MIME-Version: 1.0 To: Fans of the OS Plan 9 from Bell Labs <9fans@cse.psu.edu> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: [9fans] impressive Topicbox-Message-UUID: 44ffdf52-ead1-11e9-9d60-3106f5b1d025 This program: #include #include #include #include #include main (int argc, char *argv[]) { unsigned char buf[8], *p; int fd_msr, i; unsigned long addr = 0; if (argc < 3) { printf("usage:wrmsr reg value\n"); exit(1); } addr = strtoul(argv[1], NULL, 0); p = argv[2]; printf("MSR register 0x%lx => ", addr); for (i = 7; i > 0; i--) { buf[i] = strtol(p, &p, 16); p++; printf("%2.2x:", buf[i]); } buf[i] = strtol(p, &p, 16); printf("%2.2x\n", buf[i]); fd_msr = open("/dev/cpu/0/msr", O_WRONLY); lseek(fd_msr, addr, SEEK_SET); if (write(fd_msr, buf, 8) < 0) perror(""); } compiles to a 512KB binary on linux with -static Well, *I'm* impressed anyway. [[ standard old guy story about "my first Unix box" and "nobody knows the value of 2 bits anymore" and "what's with these GNU kids today" deleted -- ed.]] yy* symbols are in there btw. And, don't worry, some pthreads symbols made it in as well. Don't want main() to be too lonely! ron