mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-13 20:12:26 +00:00
Rationale: we already had a non buildroot build system, maintaining both will be hard, and having short paths is more awesome.
22 lines
457 B
C
22 lines
457 B
C
/* https://github.com/cirosantilli/linux-kernel-module-cheat#userland-physical-address-experiments */
|
|
|
|
#define _XOPEN_SOURCE 700
|
|
#include <stdint.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <unistd.h>
|
|
|
|
enum { I0 = 0x12345678 };
|
|
|
|
static volatile uint32_t i = I0;
|
|
|
|
int main(void) {
|
|
printf("vaddr %p\n", (void *)&i);
|
|
printf("pid %ju\n", (uintmax_t)getpid());
|
|
while (i == I0) {
|
|
sleep(1);
|
|
}
|
|
printf("i %jx\n", (uintmax_t)i);
|
|
return EXIT_SUCCESS;
|
|
}
|