diff options
| author | klaar36 <klas.arvidsson@liu.se> | 2019-04-02 18:26:51 +0200 |
|---|---|---|
| committer | klaar36 <klas.arvidsson@liu.se> | 2019-04-02 18:26:51 +0200 |
| commit | c3ce00fe7d5a88560864167d769a559c578115f4 (patch) | |
| tree | da54f6fe65c3fcb439fe361173a673713446c39d /src/tests/filst/sc-bad-write.c | |
| parent | 06f60bd120bbf7e57b46401d3708d83bd37053e7 (diff) | |
| parent | 6ca20446c77fd6dec9ca10713a63233c97e7e977 (diff) | |
| download | pintos-rs-c3ce00fe7d5a88560864167d769a559c578115f4.tar.gz | |
Merge remote-tracking branch 'skel/master'
Diffstat (limited to 'src/tests/filst/sc-bad-write.c')
| -rw-r--r-- | src/tests/filst/sc-bad-write.c | 14 |
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."); |
