You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
qemu/tests/tcg/x86_64/system/patch-target.c

23 lines
474 B
C

/*
* SPDX-License-Identifier: GPL-2.0-or-later
*
* This test target increments a value 100 times. The patcher converts the
* inc instruction to a nop, so it only increments the value once.
*
*/
#include <minilib.h>
int main(void)
{
ml_printf("Running test...\n");
unsigned int x = 0;
for (int i = 0; i < 100; i++) {
asm volatile (
"inc %[x]"
: [x] "+a" (x)
);
}
ml_printf("Value: %d\n", x);
return 0;
}