Rev 3149 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3149 | Rev 4342 | ||
---|---|---|---|
Line 24... | Line 24... | ||
24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | */ |
27 | */ |
28 | 28 | ||
29 | #ifdef mips32 |
- | |
30 | - | ||
31 | #include <print.h> |
29 | #include <print.h> |
32 | #include <debug.h> |
30 | #include <debug.h> |
33 | 31 | ||
34 | #include <test.h> |
32 | #include <test.h> |
35 | #include <atomic.h> |
33 | #include <atomic.h> |
36 | #include <proc/thread.h> |
34 | #include <proc/thread.h> |
37 | #include <time/delay.h> |
35 | #include <time/delay.h> |
38 | 36 | ||
39 | #include <arch.h> |
37 | #include <arch.h> |
40 | 38 | ||
41 | #define THREADS 50 |
39 | #define THREADS 50 |
42 | #define DELAY 10000L |
40 | #define DELAY 10000L |
43 | #define ATTEMPTS 5 |
41 | #define ATTEMPTS 5 |
44 | 42 | ||
45 | static atomic_t threads_ok; |
43 | static atomic_t threads_ok; |
46 | static atomic_t threads_fault; |
44 | static atomic_t threads_fault; |
47 | static waitq_t can_start; |
45 | static waitq_t can_start; |
48 | static bool sh_quiet; |
46 | static bool sh_quiet; |
Line 54... | Line 52... | ||
54 | int after_arg __attribute__((aligned(16))); |
52 | int after_arg __attribute__((aligned(16))); |
55 | 53 | ||
56 | thread_detach(THREAD); |
54 | thread_detach(THREAD); |
57 | 55 | ||
58 | waitq_sleep(&can_start); |
56 | waitq_sleep(&can_start); |
59 | 57 | ||
60 | for (i = 0; i < ATTEMPTS; i++) { |
58 | for (i = 0; i < ATTEMPTS; i++) { |
61 | asm volatile ( |
59 | asm volatile ( |
62 | "mtc1 %0,$1" |
60 | "mtc1 %0,$1" |
63 | : "=r" (arg) |
61 | : "=r" (arg) |
64 | ); |
62 | ); |
Line 87... | Line 85... | ||
87 | int after_arg __attribute__((aligned(16))); |
85 | int after_arg __attribute__((aligned(16))); |
88 | 86 | ||
89 | thread_detach(THREAD); |
87 | thread_detach(THREAD); |
90 | 88 | ||
91 | waitq_sleep(&can_start); |
89 | waitq_sleep(&can_start); |
92 | 90 | ||
93 | for (i = 0; i < ATTEMPTS; i++) { |
91 | for (i = 0; i < ATTEMPTS; i++) { |
94 | asm volatile ( |
92 | asm volatile ( |
95 | "mtc1 %0,$1" |
93 | "mtc1 %0,$1" |
96 | : "=r" (arg) |
94 | : "=r" (arg) |
97 | ); |
95 | ); |
98 | 96 | ||
99 | scheduler(); |
97 | scheduler(); |
100 | asm volatile ( |
98 | asm volatile ( |
101 | "mfc1 %0,$1" |
99 | "mfc1 %0,$1" |
102 | : "=r" (after_arg) |
100 | : "=r" (after_arg) |
103 | ); |
101 | ); |
Line 122... | Line 120... | ||
122 | atomic_set(&threads_ok, 0); |
120 | atomic_set(&threads_ok, 0); |
123 | atomic_set(&threads_fault, 0); |
121 | atomic_set(&threads_fault, 0); |
124 | 122 | ||
125 | if (!quiet) |
123 | if (!quiet) |
126 | printf("Creating %u threads... ", 2 * THREADS); |
124 | printf("Creating %u threads... ", 2 * THREADS); |
127 | 125 | ||
128 | for (i = 0; i < THREADS; i++) { |
126 | for (i = 0; i < THREADS; i++) { |
129 | thread_t *t; |
127 | thread_t *t; |
130 | 128 | ||
131 | if (!(t = thread_create(testit1, (void *) ((unative_t) 2 * i), TASK, 0, "testit1", false))) { |
129 | if (!(t = thread_create(testit1, (void *) ((unative_t) 2 * i), TASK, 0, "testit1", false))) { |
132 | if (!quiet) |
130 | if (!quiet) |
Line 160... | Line 158... | ||
160 | if (atomic_get(&threads_fault) == 0) |
158 | if (atomic_get(&threads_fault) == 0) |
161 | return NULL; |
159 | return NULL; |
162 | 160 | ||
163 | return "Test failed"; |
161 | return "Test failed"; |
164 | } |
162 | } |
165 | - | ||
166 | #endif |
- |