From d4708350fb555662f66e4f6dfaaf66af32dff41c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filip=20Str=C3=B6mb=C3=A4ck?= Date: Thu, 12 Apr 2018 15:15:28 +0200 Subject: Fixed compilation error of sc-bad-write in GCC 7.4. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Filip Strömbäck --- src/tests/filst/sc-bad-write.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src') 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."); -- cgit v1.2.1