Rev 3386 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 3386 | Rev 4153 | ||
|---|---|---|---|
| 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 | #if (defined(ia32) || defined(amd64) || defined(ia32xen)) |
- | |
| 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 25 |
39 | #define THREADS 25 |
| 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 58... | Line 56... | ||
| 58 | 56 | ||
| 59 | waitq_sleep(&can_start); |
57 | waitq_sleep(&can_start); |
| 60 | 58 | ||
| 61 | for (i = 0; i < ATTEMPTS; i++) { |
59 | for (i = 0; i < ATTEMPTS; i++) { |
| 62 | asm volatile ( |
60 | asm volatile ( |
| 63 | "movlpd %0, %%xmm2\n" |
61 | "movlpd %[arg], %%xmm2\n" |
| 64 | : "=m" (arg) |
62 | : [arg] "=m" (arg) |
| 65 | ); |
63 | ); |
| 66 | 64 | ||
| 67 | delay(DELAY); |
65 | delay(DELAY); |
| 68 | asm volatile ( |
66 | asm volatile ( |
| 69 | "movlpd %%xmm2, %0\n" |
67 | "movlpd %%xmm2, %[after_arg]\n" |
| 70 | : "=m" (after_arg) |
68 | : [after_arg] "=m" (after_arg) |
| 71 | ); |
69 | ); |
| 72 | 70 | ||
| 73 | if (arg != after_arg) { |
71 | if (arg != after_arg) { |
| 74 | if (!sh_quiet) |
72 | if (!sh_quiet) |
| 75 | printf("tid%" PRIu64 ": arg(%d) != %d\n", THREAD->tid, arg, after_arg); |
73 | printf("tid%" PRIu64 ": arg(%d) != %d\n", THREAD->tid, arg, after_arg); |
| Line 90... | Line 88... | ||
| 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 | "movlpd %0, %%xmm2\n" |
93 | "movlpd %[arg], %%xmm2\n" |
| 96 | : "=m" (arg) |
94 | : [arg] "=m" (arg) |
| 97 | ); |
95 | ); |
| 98 | 96 | ||
| 99 | scheduler(); |
97 | scheduler(); |
| 100 | asm volatile ( |
98 | asm volatile ( |
| 101 | "movlpd %%xmm2, %0\n" |
99 | "movlpd %%xmm2, %[after_arg]\n" |
| 102 | : "=m" (after_arg) |
100 | : [after_arg] "=m" (after_arg) |
| 103 | ); |
101 | ); |
| 104 | 102 | ||
| 105 | if (arg != after_arg) { |
103 | if (arg != after_arg) { |
| 106 | if (!sh_quiet) |
104 | if (!sh_quiet) |
| 107 | printf("tid%" PRIu64 ": arg(%d) != %d\n", THREAD->tid, arg, after_arg); |
105 | printf("tid%" PRIu64 ": arg(%d) != %d\n", THREAD->tid, arg, after_arg); |
| 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 |
- | |