Commit 4ed15fccb7a673c2bd411d451fa20d03dd90ef77
Committed by
Tom Rini
1 parent
773d998caf
Exists in
v2017.01-smarct4x
and in
40 other branches
standalone: delete an unused source file
Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Showing 1 changed file with 0 additions and 100 deletions Side-by-side Diff
examples/standalone/x86-testapp.c
1 | -#include <stddef.h> | |
2 | -#include <stdio.h> | |
3 | -#include <string.h> | |
4 | - | |
5 | -void *func[8], **pfunc; | |
6 | - | |
7 | -typedef struct xxx xxx_t; | |
8 | -struct xxx { | |
9 | - int dummy; | |
10 | - void **pfunc; | |
11 | -} q; | |
12 | - | |
13 | -#define XF_strcpy 3 | |
14 | -#define XF_printf 4 | |
15 | - | |
16 | -#define LABEL(x) \ | |
17 | -asm volatile ( \ | |
18 | - | |
19 | -#if defined(__i386__) | |
20 | -#define EXPORT_FUNC(x) \ | |
21 | -asm volatile ( \ | |
22 | -" .globl mon_" #x "\n" \ | |
23 | -"mon_" #x ":\n" \ | |
24 | -" movl %0, %%eax\n" \ | |
25 | -" movl pfunc, %%ecx\n" \ | |
26 | -" jmp *(%%ecx,%%eax)\n" \ | |
27 | - : : "i"(XF_ ## x * sizeof(void *)) : "eax", "ecx"); | |
28 | -#elif defined(__powerpc__) | |
29 | -#define EXPORT_FUNC(x) \ | |
30 | -asm volatile ( \ | |
31 | -" .globl mon_" #x "\n" \ | |
32 | -"mon_" #x ":\n" \ | |
33 | -" lwz %%r11, %0(%%r2)\n" \ | |
34 | -" lwz %%r11, %1(%%r11)\n" \ | |
35 | -" mtctr %%r11\n" \ | |
36 | -" bctr\n" \ | |
37 | - : : "i"(offsetof(xxx_t, pfunc)), "i"(XF_ ## x * sizeof(void *)) : "r11", "r2"); | |
38 | -#elif defined(__arm__) | |
39 | -#define EXPORT_FUNC(x) \ | |
40 | -asm volatile ( \ | |
41 | -" .globl mon_" #x "\n" \ | |
42 | -"mon_" #x ":\n" \ | |
43 | -" ldr ip, [r8, %0]\n" \ | |
44 | -" ldr pc, [ip, %1]\n" \ | |
45 | - : : "i"(offsetof(xxx_t, pfunc)), "i"(XF_ ## x * sizeof(void *)) : "ip"); | |
46 | -#elif defined(__mips__) | |
47 | -#define EXPORT_FUNC(x) \ | |
48 | -asm volatile ( \ | |
49 | -" .globl mon_" #x "\n" \ | |
50 | -"mon_" #x ":\n" \ | |
51 | -" lw $25, %0($26)\n" \ | |
52 | -" lw $25, %1($25)\n" \ | |
53 | -" jr $25\n" \ | |
54 | - : : "i"(offsetof(xxx_t, pfunc)), "i"(XF_ ## x * sizeof(void *)) : "t9"); | |
55 | -#elif defined(__nds32__) | |
56 | -#define EXPORT_FUNC(x) \ | |
57 | -asm volatile ( \ | |
58 | -" .globl mon_" #x "\n" \ | |
59 | -"mon_" #x ":\n" \ | |
60 | -" lwi $r16, [$gp + (%0)]\n" \ | |
61 | -" lwi $r16, [$r16 + (%1)]\n" \ | |
62 | -" jr $r16\n" \ | |
63 | -: : "i"(offsetof(xxx_t, pfunc)), \ | |
64 | -"i"(XF_ ## x * sizeof(void *)) : "$r16"); | |
65 | - | |
66 | -#else | |
67 | -#error [No stub code for this arch] | |
68 | -#endif | |
69 | - | |
70 | -void dummy(void) | |
71 | -{ | |
72 | -EXPORT_FUNC(printf) | |
73 | -EXPORT_FUNC(strcpy) | |
74 | -} | |
75 | - | |
76 | -int main(void) | |
77 | -{ | |
78 | -#if defined(__i386__) | |
79 | - xxx_t *pq; | |
80 | -#elif defined(__powerpc__) | |
81 | - register volatile xxx_t *pq asm("r2"); | |
82 | -#elif defined(__arm__) | |
83 | - register volatile xxx_t *pq asm("r8"); | |
84 | -#elif defined(__mips__) | |
85 | - register volatile xxx_t *pq asm("k0"); | |
86 | -#elif defined(__nds32__) | |
87 | - register volatile xxx_t *pq asm("$r16"); | |
88 | -#endif | |
89 | - char buf[32]; | |
90 | - | |
91 | - func[XF_strcpy] = strcpy; | |
92 | - func[XF_printf] = printf; | |
93 | - pq = &q; | |
94 | - pq->pfunc = pfunc = func; | |
95 | - | |
96 | - mon_strcpy(buf, "test"); | |
97 | - mon_printf("hi %s %d z\n", buf, 444); | |
98 | - | |
99 | - return 0; | |
100 | -} |