ARM: kprobes: Add Thumb instruction simulation test cases

Signed-off-by: Jon Medhurst <tixy@yxit.co.uk>
Acked-by: Nicolas Pitre <nicolas.pitre@linaro.org>
This commit is contained in:
Jon Medhurst 2011-08-27 12:40:30 +01:00
parent a43bc69b39
commit c7054aad53
4 changed files with 1221 additions and 0 deletions

View File

@ -45,6 +45,9 @@ obj-$(CONFIG_KPROBES) += kprobes-arm.o
endif endif
obj-$(CONFIG_ARM_KPROBES_TEST) += test-kprobes.o obj-$(CONFIG_ARM_KPROBES_TEST) += test-kprobes.o
test-kprobes-objs := kprobes-test.o test-kprobes-objs := kprobes-test.o
ifdef CONFIG_THUMB2_KERNEL
test-kprobes-objs += kprobes-test-thumb.o
endif
obj-$(CONFIG_ATAGS_PROC) += atags.o obj-$(CONFIG_ATAGS_PROC) += atags.o
obj-$(CONFIG_OABI_COMPAT) += sys_oabi-compat.o obj-$(CONFIG_OABI_COMPAT) += sys_oabi-compat.o
obj-$(CONFIG_ARM_THUMBEE) += thumbee.o obj-$(CONFIG_ARM_THUMBEE) += thumbee.o

File diff suppressed because it is too large Load Diff

View File

@ -1117,6 +1117,15 @@ static uintptr_t __used kprobes_test_case_end(void)
* Top level test functions * Top level test functions
*/ */
static int run_test_cases(void (*tests)(void))
{
pr_info(" Run test cases\n");
tests();
return 0;
}
static int __init run_all_tests(void) static int __init run_all_tests(void)
{ {
int ret = 0; int ret = 0;
@ -1147,8 +1156,24 @@ static int __init run_all_tests(void)
if (ret) if (ret)
goto out; goto out;
pr_info("16-bit Thumb instruction simulation\n");
ret = run_test_cases(kprobe_thumb16_test_cases);
if (ret)
goto out;
pr_info("32-bit Thumb instruction simulation\n");
ret = run_test_cases(kprobe_thumb32_test_cases);
if (ret)
goto out;
#endif #endif
pr_info("Total instruction simulation tests=%d, pass=%d fail=%d\n",
test_try_count, test_pass_count, test_fail_count);
if (test_fail_count) {
ret = -EINVAL;
goto out;
}
out: out:
if (ret == 0) if (ret == 0)
pr_info("Finished kprobe tests OK\n"); pr_info("Finished kprobe tests OK\n");

View File

@ -382,3 +382,9 @@ struct test_arg_end {
#define VALR 0xdeaddead #define VALR 0xdeaddead
#define HH1 0x0123fecb #define HH1 0x0123fecb
#define HH2 0xa9874567 #define HH2 0xa9874567
#ifdef CONFIG_THUMB2_KERNEL
void kprobe_thumb16_test_cases(void);
void kprobe_thumb32_test_cases(void);
#endif