Created
October 13, 2017 23:55
-
-
Save Wolfvak/1f743e2e927add415ee4e4b85e5f70b1 to your computer and use it in GitHub Desktop.
This file contains 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> | |
#include <assert.h> | |
#include <stdint.h> | |
#include <unistd.h> | |
const char *pagetype[] = { | |
"INVALID", "COARSE PAGE", "SECTION", "FINE PAGE" | |
}; | |
const char *cachetype[] = { | |
"NONCACHED NONBUFFERED", "NONCACHED BUFFERED", | |
"WRITETHROUGH CACHEABLE", "WRITEBACK CACHEABLE" | |
}; | |
int main(int argc, char *argv[]) { | |
assert(sizeof(uint32_t) == 4); | |
printf("ttparse 0.1a by Wolfvak\n"); | |
if (argc > 1) { | |
printf("Reads from stdin, use `cat` or similar!\n"); | |
return 1; | |
} | |
for (int i=0; i<4096; i++) { | |
uint32_t tte; | |
read(STDIN_FILENO, &tte, 4); | |
printf("[%03X00000] -> [%03X00000], DOMAIN %02d, %s, %s\n", | |
i, (tte & 0xFFF00000)>>20, (tte>>5)&15, | |
cachetype[(tte >> 2)&3], pagetype[tte&3]); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment