aboutsummaryrefslogtreecommitdiffstats
path: root/src/tests
diff options
context:
space:
mode:
authorFilip Strömbäck <filip.stromback@liu.se>2018-04-12 15:15:28 +0200
committerFilip Strömbäck <filip.stromback@liu.se>2018-04-12 15:15:28 +0200
commitd4708350fb555662f66e4f6dfaaf66af32dff41c (patch)
treebf43e7797265c0093ac2ff399dba47f0b3433526 /src/tests
parentdb66a7426d91c3513dad0ba2bb795aa6164c5be1 (diff)
downloadpintos-rs-d4708350fb555662f66e4f6dfaaf66af32dff41c.tar.gz
Fixed compilation error of sc-bad-write in GCC 7.4.
Signed-off-by: Filip Strömbäck <filip.stromback@liu.se>
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/filst/sc-bad-write.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/tests/filst/sc-bad-write.c b/src/tests/filst/sc-bad-write.c
index 4d04155..fbd6260 100644
--- a/src/tests/filst/sc-bad-write.c
+++ b/src/tests/filst/sc-bad-write.c
@@ -23,6 +23,12 @@ static inline void *pg_round_up (const void *va) {
*/
extern int _end_bss;
+/**
+ * String constants used in the asm blocks.
+ */
+const char *WORKS = "WORKS\n";
+const char *FAIL = "FAIL\n";
+
void test_main(void)
{
// Get the addres of the first unmapped page in the system.
@@ -38,14 +44,14 @@ void test_main(void)
"movl %1, (%%esp);" // Try to call SYS_WRITE
"movl %2, 4(%%esp);" // Write to STDOUT
"movl %3, 8(%%esp);" // Load buffer.
- "movl $6, 12(%%esp);" // Write length of string
+ "movl $6, 12(%%esp);" // Write length of string
"int $0x30;"
"movl %%edi, %%esp;" // Restore esp.
:
: "r" (base),
"i" (SYS_WRITE),
"i" (STDOUT_FILENO),
- "i" ("WORKS\n")
+ "r" (WORKS)
: "%esp", "%eax", "%edi");
@@ -59,14 +65,14 @@ void test_main(void)
"movl %1, (%%esp);" // Try to call SYS_WRITE
"movl %2, 4(%%esp);" // Write to STDOUT
"movl %3, 8(%%esp);" // Load buffer.
- //"movl $6, 12(%%esp);" // Can not write the last parameter as we would get a pagefault.
+ //"movl $5, 12(%%esp);" // Can not write the last parameter as we would get a pagefault.
"int $0x30;"
"movl %%edi, %%esp;" // Restore esp in case we do not crash (as we should).
:
: "r" (base),
"i" (SYS_WRITE),
"i" (STDOUT_FILENO),
- "i" ("FAIL!\n")
+ "r" (FAIL)
: "%esp", "%eax", "%edi");
fail("should have died.");