Rev 2050 | Rev 2071 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 2050 | Rev 2053 | ||
|---|---|---|---|
| Line 43... | Line 43... | ||
| 43 | #define ATTEMPTS 5 |
43 | #define ATTEMPTS 5 |
| 44 | 44 | ||
| 45 | static atomic_t threads_ok; |
45 | static atomic_t threads_ok; |
| 46 | static atomic_t threads_fault; |
46 | static atomic_t threads_fault; |
| 47 | static waitq_t can_start; |
47 | static waitq_t can_start; |
| - | 48 | static bool sh_quiet; |
|
| 48 | 49 | ||
| 49 | static void testit1(void *data) |
50 | static void testit1(void *data) |
| 50 | { |
51 | { |
| 51 | int i; |
52 | int i; |
| 52 | int arg __attribute__((aligned(16))) = (int) ((unative_t) data); |
53 | int arg __attribute__((aligned(16))) = (int) ((unative_t) data); |
| Line 68... | Line 69... | ||
| 68 | "mfc1 %0, $1" |
69 | "mfc1 %0, $1" |
| 69 | : "=r" (after_arg) |
70 | : "=r" (after_arg) |
| 70 | ); |
71 | ); |
| 71 | 72 | ||
| 72 | if (arg != after_arg) { |
73 | if (arg != after_arg) { |
| - | 74 | if (!sh_quiet) |
|
| 73 | printf("General reg tid%d: arg(%d) != %d\n", THREAD->tid, arg, after_arg); |
75 | printf("General reg tid%d: arg(%d) != %d\n", THREAD->tid, arg, after_arg); |
| 74 | atomic_inc(&threads_fault); |
76 | atomic_inc(&threads_fault); |
| 75 | break; |
77 | break; |
| 76 | } |
78 | } |
| 77 | } |
79 | } |
| 78 | atomic_inc(&threads_ok); |
80 | atomic_inc(&threads_ok); |
| Line 99... | Line 101... | ||
| 99 | "mfc1 %0,$1" |
101 | "mfc1 %0,$1" |
| 100 | : "=r" (after_arg) |
102 | : "=r" (after_arg) |
| 101 | ); |
103 | ); |
| 102 | 104 | ||
| 103 | if (arg != after_arg) { |
105 | if (arg != after_arg) { |
| - | 106 | if (!sh_quiet) |
|
| 104 | printf("General reg tid%d: arg(%d) != %d\n", THREAD->tid, arg, after_arg); |
107 | printf("General reg tid%d: arg(%d) != %d\n", THREAD->tid, arg, after_arg); |
| 105 | atomic_inc(&threads_fault); |
108 | atomic_inc(&threads_fault); |
| 106 | break; |
109 | break; |
| 107 | } |
110 | } |
| 108 | } |
111 | } |
| 109 | atomic_inc(&threads_ok); |
112 | atomic_inc(&threads_ok); |
| Line 111... | Line 114... | ||
| 111 | 114 | ||
| 112 | 115 | ||
| 113 | char * test_mips2(bool quiet) |
116 | char * test_mips2(bool quiet) |
| 114 | { |
117 | { |
| 115 | unsigned int i, total = 0; |
118 | unsigned int i, total = 0; |
| - | 119 | sh_quiet = quiet; |
|
| 116 | 120 | ||
| 117 | waitq_initialize(&can_start); |
121 | waitq_initialize(&can_start); |
| 118 | atomic_set(&threads_ok, 0); |
122 | atomic_set(&threads_ok, 0); |
| 119 | atomic_set(&threads_fault, 0); |
123 | atomic_set(&threads_fault, 0); |
| - | 124 | ||
| - | 125 | if (!quiet) |
|
| 120 | printf("Creating %d threads... ", 2 * THREADS); |
126 | printf("Creating %d threads... ", 2 * THREADS); |
| 121 | 127 | ||
| 122 | for (i = 0; i < THREADS; i++) { |
128 | for (i = 0; i < THREADS; i++) { |
| 123 | thread_t *t; |
129 | thread_t *t; |
| 124 | 130 | ||
| 125 | if (!(t = thread_create(testit1, (void *) ((unative_t) 2 * i), TASK, 0, "testit1", false))) { |
131 | if (!(t = thread_create(testit1, (void *) ((unative_t) 2 * i), TASK, 0, "testit1", false))) { |
| - | 132 | if (!quiet) |
|
| 126 | printf("could not create thread %d\n", 2 * i); |
133 | printf("could not create thread %d\n", 2 * i); |
| 127 | break; |
134 | break; |
| 128 | } |
135 | } |
| 129 | thread_ready(t); |
136 | thread_ready(t); |
| 130 | total++; |
137 | total++; |
| 131 | 138 | ||
| 132 | if (!(t = thread_create(testit2, (void *) ((unative_t) 2 * i + 1), TASK, 0, "testit2", false))) { |
139 | if (!(t = thread_create(testit2, (void *) ((unative_t) 2 * i + 1), TASK, 0, "testit2", false))) { |
| - | 140 | if (!quiet) |
|
| 133 | printf("could not create thread %d\n", 2 * i + 1); |
141 | printf("could not create thread %d\n", 2 * i + 1); |
| 134 | break; |
142 | break; |
| 135 | } |
143 | } |
| 136 | thread_ready(t); |
144 | thread_ready(t); |
| 137 | total++; |
145 | total++; |
| 138 | } |
146 | } |
| - | 147 | ||
| - | 148 | if (!quiet) |
|
| 139 | printf("ok\n"); |
149 | printf("ok\n"); |
| 140 | 150 | ||
| 141 | thread_sleep(1); |
151 | thread_sleep(1); |
| 142 | waitq_wakeup(&can_start, WAKEUP_ALL); |
152 | waitq_wakeup(&can_start, WAKEUP_ALL); |
| 143 | 153 | ||
| 144 | while (atomic_get(&threads_ok) != total) { |
154 | while (atomic_get(&threads_ok) != total) { |
| - | 155 | if (!quiet) |
|
| 145 | printf("Threads left: %d\n", total - atomic_get(&threads_ok)); |
156 | printf("Threads left: %d\n", total - atomic_get(&threads_ok)); |
| 146 | thread_sleep(1); |
157 | thread_sleep(1); |
| 147 | } |
158 | } |
| 148 | 159 | ||
| 149 | if (atomic_get(&threads_fault) == 0) |
160 | if (atomic_get(&threads_fault) == 0) |
| 150 | return NULL; |
161 | return NULL; |