Last active
March 26, 2021 17:08
-
-
Save giuseppe998e/ab96430c5b58f22cd1f303ab19674675 to your computer and use it in GitHub Desktop.
Example of bit subdivision of an id of a XenTrace event
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main() { | |
// TRC_TRACE_CPU_CHANGE | |
unsigned cpu_change = 0x0001f003; | |
struct { | |
unsigned minor:12, | |
sub:4, | |
main:12, | |
unused:4; | |
} *evt = (typeof(evt)) &cpu_change; | |
printf("0x%01x 0x%03x 0x%01x 0x%03x\n", evt->unused, evt->main, evt->sub, evt->minor); | |
// "0x0 0x001 0xf 0x003 \n" | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment