From 71591aa85c4b3e98c731a912b310e3d4c91893ce Mon Sep 17 00:00:00 2001 From: Claudio Maggioni Date: Sun, 24 May 2020 16:27:46 +0200 Subject: [PATCH] hw5: mostly done --- pintos-env/pintos/userprog/malusa.log | 990 -------------------------- pintos-env/pintos/userprog/syscall.c | 225 +++++- 2 files changed, 214 insertions(+), 1001 deletions(-) delete mode 100644 pintos-env/pintos/userprog/malusa.log diff --git a/pintos-env/pintos/userprog/malusa.log b/pintos-env/pintos/userprog/malusa.log deleted file mode 100644 index 6ba8dc2..0000000 --- a/pintos-env/pintos/userprog/malusa.log +++ /dev/null @@ -1,990 +0,0 @@ -cd build && make check -make[1]: Entering directory `/pintos-env/pintos/userprog/build' -pintos -v -k -T 60 --bochs --filesys-size=2 -p tests/userprog/args-none -a args-none -- -q -f run args-none < /dev/null 2> tests/userprog/args-none.errors > tests/userprog/args-none.output -perl -I../.. ../../tests/userprog/args-none.ck tests/userprog/args-none tests/userprog/args-none.result -pass tests/userprog/args-none -pintos -v -k -T 60 --bochs --filesys-size=2 -p tests/userprog/args-single -a args-single -- -q -f run 'args-single onearg' < /dev/null 2> tests/userprog/args-single.errors > tests/userprog/args-single.output -perl -I../.. ../../tests/userprog/args-single.ck tests/userprog/args-single tests/userprog/args-single.result -pass tests/userprog/args-single -pintos -v -k -T 60 --bochs --filesys-size=2 -p tests/userprog/args-multiple -a args-multiple -- -q -f run 'args-multiple some arguments for you!' < /dev/null 2> tests/userprog/args-multiple.errors > tests/userprog/args-multiple.output -perl -I../.. ../../tests/userprog/args-multiple.ck tests/userprog/args-multiple tests/userprog/args-multiple.result -pass tests/userprog/args-multiple -pintos -v -k -T 60 --bochs --filesys-size=2 -p tests/userprog/args-many -a args-many -- -q -f run 'args-many a b c d e f g h i j k l m n o p q r s t u v' < /dev/null 2> tests/userprog/args-many.errors > tests/userprog/args-many.output -perl -I../.. ../../tests/userprog/args-many.ck tests/userprog/args-many tests/userprog/args-many.result -pass tests/userprog/args-many -pintos -v -k -T 60 --bochs --filesys-size=2 -p tests/userprog/args-dbl-space -a args-dbl-space -- -q -f run 'args-dbl-space two spaces!' < /dev/null 2> tests/userprog/args-dbl-space.errors > tests/userprog/args-dbl-space.output -perl -I../.. ../../tests/userprog/args-dbl-space.ck tests/userprog/args-dbl-space tests/userprog/args-dbl-space.result -pass tests/userprog/args-dbl-space -pintos -v -k -T 60 --bochs --filesys-size=2 -p tests/userprog/sc-bad-sp -a sc-bad-sp -- -q -f run sc-bad-sp < /dev/null 2> tests/userprog/sc-bad-sp.errors > tests/userprog/sc-bad-sp.output -perl -I../.. ../../tests/userprog/sc-bad-sp.ck tests/userprog/sc-bad-sp tests/userprog/sc-bad-sp.result -FAIL tests/userprog/sc-bad-sp -Kernel panic in run: PANIC at ../../userprog/exception.c:100 in kill(): Kernel bug - unexpected interrupt in kernel -Call stack: 0xc00285ee 0xc002b791 0x80480aa -Translation of call stack: -In kernel.o: -0xc00285ee: debug_panic (.../../lib/kernel/debug.c:38) -0xc002b791: syscall_handler (.../../userprog/syscall.c:40) -In tests/userprog/sc-bad-sp: -0x080480aa: test_main (...s/userprog/sc-bad-sp.c:19) -Translations of user virtual addresses above are based on a guess at -the binary to use. If this guess is incorrect, then those -translations will be misleading. -pintos -v -k -T 60 --bochs --filesys-size=2 -p tests/userprog/sc-bad-arg -a sc-bad-arg -- -q -f run sc-bad-arg < /dev/null 2> tests/userprog/sc-bad-arg.errors > tests/userprog/sc-bad-arg.output -perl -I../.. ../../tests/userprog/sc-bad-arg.ck tests/userprog/sc-bad-arg tests/userprog/sc-bad-arg.result -FAIL tests/userprog/sc-bad-arg -Test output failed to match any acceptable form. - -Acceptable output: - (sc-bad-arg) begin - sc-bad-arg: exit(-1) -Differences in `diff -u' format: - (sc-bad-arg) begin -- sc-bad-arg: exit(-1) -+ sc-bad-arg: exit(-268370093) -pintos -v -k -T 60 --bochs --filesys-size=2 -p tests/userprog/sc-boundary -a sc-boundary -- -q -f run sc-boundary < /dev/null 2> tests/userprog/sc-boundary.errors > tests/userprog/sc-boundary.output -perl -I../.. ../../tests/userprog/sc-boundary.ck tests/userprog/sc-boundary tests/userprog/sc-boundary.result -pass tests/userprog/sc-boundary -pintos -v -k -T 60 --bochs --filesys-size=2 -p tests/userprog/sc-boundary-2 -a sc-boundary-2 -- -q -f run sc-boundary-2 < /dev/null 2> tests/userprog/sc-boundary-2.errors > tests/userprog/sc-boundary-2.output -perl -I../.. ../../tests/userprog/sc-boundary-2.ck tests/userprog/sc-boundary-2 tests/userprog/sc-boundary-2.result -pass tests/userprog/sc-boundary-2 -pintos -v -k -T 60 --bochs --filesys-size=2 -p tests/userprog/halt -a halt -- -q -f run halt < /dev/null 2> tests/userprog/halt.errors > tests/userprog/halt.output -perl -I../.. ../../tests/userprog/halt.ck tests/userprog/halt tests/userprog/halt.result -FAIL tests/userprog/halt -Kernel panic in run: PANIC at ../../userprog/exception.c:100 in kill(): Kernel bug - unexpected interrupt in kernel -Call stack: 0xc00285ee 0xe3e3e3e3 0x804a12e -Translation of call stack: -In kernel.o: -0xc00285ee: debug_panic (.../../lib/kernel/debug.c:38) -0xe3e3e3e3: (unknown) -In tests/userprog/halt: -0x0804a12e: halt (.../../lib/user/syscall.c:67) -Translations of user virtual addresses above are based on a guess at -the binary to use. If this guess is incorrect, then those -translations will be misleading. -pintos -v -k -T 60 --bochs --filesys-size=2 -p tests/userprog/exit -a exit -- -q -f run exit < /dev/null 2> tests/userprog/exit.errors > tests/userprog/exit.output -perl -I../.. ../../tests/userprog/exit.ck tests/userprog/exit tests/userprog/exit.result -pass tests/userprog/exit -pintos -v -k -T 60 --bochs --filesys-size=2 -p tests/userprog/create-normal -a create-normal -- -q -f run create-normal < /dev/null 2> tests/userprog/create-normal.errors > tests/userprog/create-normal.output -perl -I../.. ../../tests/userprog/create-normal.ck tests/userprog/create-normal tests/userprog/create-normal.result -FAIL tests/userprog/create-normal -Kernel panic in run: PANIC at ../../userprog/exception.c:100 in kill(): Kernel bug - unexpected interrupt in kernel -Call stack: 0xc00285ee 0xe3e3e3e3 0x804a1e0 -Translation of call stack: -In kernel.o: -0xc00285ee: debug_panic (.../../lib/kernel/debug.c:38) -0xe3e3e3e3: (unknown) -In tests/userprog/create-normal: -0x0804a1e0: create (.../../lib/user/syscall.c:93) -Translations of user virtual addresses above are based on a guess at -the binary to use. If this guess is incorrect, then those -translations will be misleading. -pintos -v -k -T 60 --bochs --filesys-size=2 -p tests/userprog/create-empty -a create-empty -- -q -f run create-empty < /dev/null 2> tests/userprog/create-empty.errors > tests/userprog/create-empty.output -perl -I../.. ../../tests/userprog/create-empty.ck tests/userprog/create-empty tests/userprog/create-empty.result -FAIL tests/userprog/create-empty -Kernel panic in run: PANIC at ../../userprog/exception.c:100 in kill(): Kernel bug - unexpected interrupt in kernel -Call stack: 0xc00285ee 0xe3e3e3e3 0x804a1e0 -Translation of call stack: -In kernel.o: -0xc00285ee: debug_panic (.../../lib/kernel/debug.c:38) -0xe3e3e3e3: (unknown) -In tests/userprog/create-empty: -0x0804a1e0: create (.../../lib/user/syscall.c:93) -Translations of user virtual addresses above are based on a guess at -the binary to use. If this guess is incorrect, then those -translations will be misleading. -pintos -v -k -T 60 --bochs --filesys-size=2 -p tests/userprog/create-null -a create-null -- -q -f run create-null < /dev/null 2> tests/userprog/create-null.errors > tests/userprog/create-null.output -perl -I../.. ../../tests/userprog/create-null.ck tests/userprog/create-null tests/userprog/create-null.result -FAIL tests/userprog/create-null -Kernel panic in run: PANIC at ../../userprog/exception.c:100 in kill(): Kernel bug - unexpected interrupt in kernel -Call stack: 0xc00285ee 0xe3e3e3e3 0x804a1e0 -Translation of call stack: -In kernel.o: -0xc00285ee: debug_panic (.../../lib/kernel/debug.c:38) -0xe3e3e3e3: (unknown) -In tests/userprog/create-null: -0x0804a1e0: create (.../../lib/user/syscall.c:93) -Translations of user virtual addresses above are based on a guess at -the binary to use. If this guess is incorrect, then those -translations will be misleading. -pintos -v -k -T 60 --bochs --filesys-size=2 -p tests/userprog/create-bad-ptr -a create-bad-ptr -- -q -f run create-bad-ptr < /dev/null 2> tests/userprog/create-bad-ptr.errors > tests/userprog/create-bad-ptr.output -perl -I../.. ../../tests/userprog/create-bad-ptr.ck tests/userprog/create-bad-ptr tests/userprog/create-bad-ptr.result -FAIL tests/userprog/create-bad-ptr -Kernel panic in run: PANIC at ../../userprog/exception.c:100 in kill(): Kernel bug - unexpected interrupt in kernel -Call stack: 0xc00285ee 0xe3e3e3e3 0x804a1e0 -Translation of call stack: -In kernel.o: -0xc00285ee: debug_panic (.../../lib/kernel/debug.c:38) -0xe3e3e3e3: (unknown) -In tests/userprog/create-bad-ptr: -0x0804a1e0: create (.../../lib/user/syscall.c:93) -Translations of user virtual addresses above are based on a guess at -the binary to use. If this guess is incorrect, then those -translations will be misleading. -pintos -v -k -T 60 --bochs --filesys-size=2 -p tests/userprog/create-long -a create-long -- -q -f run create-long < /dev/null 2> tests/userprog/create-long.errors > tests/userprog/create-long.output -perl -I../.. ../../tests/userprog/create-long.ck tests/userprog/create-long tests/userprog/create-long.result -FAIL tests/userprog/create-long -Kernel panic in run: PANIC at ../../userprog/exception.c:100 in kill(): Kernel bug - unexpected interrupt in kernel -Call stack: 0xc00285ee 0xe3e3e3e3 0x804a1f0 -Translation of call stack: -In kernel.o: -0xc00285ee: debug_panic (.../../lib/kernel/debug.c:38) -0xe3e3e3e3: (unknown) -In tests/userprog/create-long: -0x0804a1f0: create (.../../lib/user/syscall.c:93) -Translations of user virtual addresses above are based on a guess at -the binary to use. If this guess is incorrect, then those -translations will be misleading. -pintos -v -k -T 60 --bochs --filesys-size=2 -p tests/userprog/create-exists -a create-exists -- -q -f run create-exists < /dev/null 2> tests/userprog/create-exists.errors > tests/userprog/create-exists.output -perl -I../.. ../../tests/userprog/create-exists.ck tests/userprog/create-exists tests/userprog/create-exists.result -FAIL tests/userprog/create-exists -Kernel panic in run: PANIC at ../../userprog/exception.c:100 in kill(): Kernel bug - unexpected interrupt in kernel -Call stack: 0xc00285ee 0xe3e3e3e3 0x804a2a0 -Translation of call stack: -In kernel.o: -0xc00285ee: debug_panic (.../../lib/kernel/debug.c:38) -0xe3e3e3e3: (unknown) -In tests/userprog/create-exists: -0x0804a2a0: create (.../../lib/user/syscall.c:93) -Translations of user virtual addresses above are based on a guess at -the binary to use. If this guess is incorrect, then those -translations will be misleading. -pintos -v -k -T 60 --bochs --filesys-size=2 -p tests/userprog/create-bound -a create-bound -- -q -f run create-bound < /dev/null 2> tests/userprog/create-bound.errors > tests/userprog/create-bound.output -perl -I../.. ../../tests/userprog/create-bound.ck tests/userprog/create-bound tests/userprog/create-bound.result -FAIL tests/userprog/create-bound -Kernel panic in run: PANIC at ../../userprog/exception.c:100 in kill(): Kernel bug - unexpected interrupt in kernel -Call stack: 0xc00285ee 0xe3e3e3e3 0x804a270 -Translation of call stack: -In kernel.o: -0xc00285ee: debug_panic (.../../lib/kernel/debug.c:38) -0xe3e3e3e3: (unknown) -In tests/userprog/create-bound: -0x0804a270: create (.../../lib/user/syscall.c:93) -Translations of user virtual addresses above are based on a guess at -the binary to use. If this guess is incorrect, then those -translations will be misleading. -pintos -v -k -T 60 --bochs --filesys-size=2 -p tests/userprog/open-normal -a open-normal -p ../../tests/userprog/sample.txt -a sample.txt -- -q -f run open-normal < /dev/null 2> tests/userprog/open-normal.errors > tests/userprog/open-normal.output -perl -I../.. ../../tests/userprog/open-normal.ck tests/userprog/open-normal tests/userprog/open-normal.result -FAIL tests/userprog/open-normal -Kernel panic in run: PANIC at ../../userprog/exception.c:100 in kill(): Kernel bug - unexpected interrupt in kernel -Call stack: 0xc00285ee 0xe3e3e3e3 0x804a1f4 -Translation of call stack: -In kernel.o: -0xc00285ee: debug_panic (.../../lib/kernel/debug.c:38) -0xe3e3e3e3: (unknown) -In tests/userprog/open-normal: -0x0804a1f4: open (...../lib/user/syscall.c:105) -Translations of user virtual addresses above are based on a guess at -the binary to use. If this guess is incorrect, then those -translations will be misleading. -pintos -v -k -T 60 --bochs --filesys-size=2 -p tests/userprog/open-missing -a open-missing -- -q -f run open-missing < /dev/null 2> tests/userprog/open-missing.errors > tests/userprog/open-missing.output -perl -I../.. ../../tests/userprog/open-missing.ck tests/userprog/open-missing tests/userprog/open-missing.result -FAIL tests/userprog/open-missing -Kernel panic in run: PANIC at ../../userprog/exception.c:100 in kill(): Kernel bug - unexpected interrupt in kernel -Call stack: 0xc00285ee 0xe3e3e3e3 0x804a1f4 -Translation of call stack: -In kernel.o: -0xc00285ee: debug_panic (.../../lib/kernel/debug.c:38) -0xe3e3e3e3: (unknown) -In tests/userprog/open-missing: -0x0804a1f4: open (...../lib/user/syscall.c:105) -Translations of user virtual addresses above are based on a guess at -the binary to use. If this guess is incorrect, then those -translations will be misleading. -pintos -v -k -T 60 --bochs --filesys-size=2 -p tests/userprog/open-boundary -a open-boundary -p ../../tests/userprog/sample.txt -a sample.txt -- -q -f run open-boundary < /dev/null 2> tests/userprog/open-boundary.errors > tests/userprog/open-boundary.output -perl -I../.. ../../tests/userprog/open-boundary.ck tests/userprog/open-boundary tests/userprog/open-boundary.result -FAIL tests/userprog/open-boundary -Kernel panic in run: PANIC at ../../userprog/exception.c:100 in kill(): Kernel bug - unexpected interrupt in kernel -Call stack: 0xc00285ee 0xe3e3e3e3 0x804a2a4 -Translation of call stack: -In kernel.o: -0xc00285ee: debug_panic (.../../lib/kernel/debug.c:38) -0xe3e3e3e3: (unknown) -In tests/userprog/open-boundary: -0x0804a2a4: open (...../lib/user/syscall.c:105) -Translations of user virtual addresses above are based on a guess at -the binary to use. If this guess is incorrect, then those -translations will be misleading. -pintos -v -k -T 60 --bochs --filesys-size=2 -p tests/userprog/open-empty -a open-empty -- -q -f run open-empty < /dev/null 2> tests/userprog/open-empty.errors > tests/userprog/open-empty.output -perl -I../.. ../../tests/userprog/open-empty.ck tests/userprog/open-empty tests/userprog/open-empty.result -FAIL tests/userprog/open-empty -Kernel panic in run: PANIC at ../../userprog/exception.c:100 in kill(): Kernel bug - unexpected interrupt in kernel -Call stack: 0xc00285ee 0xe3e3e3e3 0x804a1f4 -Translation of call stack: -In kernel.o: -0xc00285ee: debug_panic (.../../lib/kernel/debug.c:38) -0xe3e3e3e3: (unknown) -In tests/userprog/open-empty: -0x0804a1f4: open (...../lib/user/syscall.c:105) -Translations of user virtual addresses above are based on a guess at -the binary to use. If this guess is incorrect, then those -translations will be misleading. -pintos -v -k -T 60 --bochs --filesys-size=2 -p tests/userprog/open-null -a open-null -- -q -f run open-null < /dev/null 2> tests/userprog/open-null.errors > tests/userprog/open-null.output -perl -I../.. ../../tests/userprog/open-null.ck tests/userprog/open-null tests/userprog/open-null.result -FAIL tests/userprog/open-null -Kernel panic in run: PANIC at ../../userprog/exception.c:100 in kill(): Kernel bug - unexpected interrupt in kernel -Call stack: 0xc00285ee 0xe3e3e3e3 0x804a1e4 -Translation of call stack: -In kernel.o: -0xc00285ee: debug_panic (.../../lib/kernel/debug.c:38) -0xe3e3e3e3: (unknown) -In tests/userprog/open-null: -0x0804a1e4: open (...../lib/user/syscall.c:105) -Translations of user virtual addresses above are based on a guess at -the binary to use. If this guess is incorrect, then those -translations will be misleading. -pintos -v -k -T 60 --bochs --filesys-size=2 -p tests/userprog/open-bad-ptr -a open-bad-ptr -- -q -f run open-bad-ptr < /dev/null 2> tests/userprog/open-bad-ptr.errors > tests/userprog/open-bad-ptr.output -perl -I../.. ../../tests/userprog/open-bad-ptr.ck tests/userprog/open-bad-ptr tests/userprog/open-bad-ptr.result -FAIL tests/userprog/open-bad-ptr -Kernel panic in run: PANIC at ../../userprog/exception.c:100 in kill(): Kernel bug - unexpected interrupt in kernel -Call stack: 0xc00285ee 0xe3e3e3e3 0x804a1f4 -Translation of call stack: -In kernel.o: -0xc00285ee: debug_panic (.../../lib/kernel/debug.c:38) -0xe3e3e3e3: (unknown) -In tests/userprog/open-bad-ptr: -0x0804a1f4: open (...../lib/user/syscall.c:105) -Translations of user virtual addresses above are based on a guess at -the binary to use. If this guess is incorrect, then those -translations will be misleading. -pintos -v -k -T 60 --bochs --filesys-size=2 -p tests/userprog/open-twice -a open-twice -p ../../tests/userprog/sample.txt -a sample.txt -- -q -f run open-twice < /dev/null 2> tests/userprog/open-twice.errors > tests/userprog/open-twice.output -perl -I../.. ../../tests/userprog/open-twice.ck tests/userprog/open-twice tests/userprog/open-twice.result -FAIL tests/userprog/open-twice -Kernel panic in run: PANIC at ../../userprog/exception.c:100 in kill(): Kernel bug - unexpected interrupt in kernel -Call stack: 0xc00285ee 0xe3e3e3e3 0x804a254 -Translation of call stack: -In kernel.o: -0xc00285ee: debug_panic (.../../lib/kernel/debug.c:38) -0xe3e3e3e3: (unknown) -In tests/userprog/open-twice: -0x0804a254: open (...../lib/user/syscall.c:105) -Translations of user virtual addresses above are based on a guess at -the binary to use. If this guess is incorrect, then those -translations will be misleading. -pintos -v -k -T 60 --bochs --filesys-size=2 -p tests/userprog/close-normal -a close-normal -p ../../tests/userprog/sample.txt -a sample.txt -- -q -f run close-normal < /dev/null 2> tests/userprog/close-normal.errors > tests/userprog/close-normal.output -perl -I../.. ../../tests/userprog/close-normal.ck tests/userprog/close-normal tests/userprog/close-normal.result -FAIL tests/userprog/close-normal -Kernel panic in run: PANIC at ../../userprog/exception.c:100 in kill(): Kernel bug - unexpected interrupt in kernel -Call stack: 0xc00285ee 0xe3e3e3e3 0x804a214 -Translation of call stack: -In kernel.o: -0xc00285ee: debug_panic (.../../lib/kernel/debug.c:38) -0xe3e3e3e3: (unknown) -In tests/userprog/close-normal: -0x0804a214: open (...../lib/user/syscall.c:105) -Translations of user virtual addresses above are based on a guess at -the binary to use. If this guess is incorrect, then those -translations will be misleading. -pintos -v -k -T 60 --bochs --filesys-size=2 -p tests/userprog/close-twice -a close-twice -p ../../tests/userprog/sample.txt -a sample.txt -- -q -f run close-twice < /dev/null 2> tests/userprog/close-twice.errors > tests/userprog/close-twice.output -perl -I../.. ../../tests/userprog/close-twice.ck tests/userprog/close-twice tests/userprog/close-twice.result -FAIL tests/userprog/close-twice -Kernel panic in run: PANIC at ../../userprog/exception.c:100 in kill(): Kernel bug - unexpected interrupt in kernel -Call stack: 0xc00285ee 0xe3e3e3e3 0x804a224 -Translation of call stack: -In kernel.o: -0xc00285ee: debug_panic (.../../lib/kernel/debug.c:38) -0xe3e3e3e3: (unknown) -In tests/userprog/close-twice: -0x0804a224: open (...../lib/user/syscall.c:105) -Translations of user virtual addresses above are based on a guess at -the binary to use. If this guess is incorrect, then those -translations will be misleading. -pintos -v -k -T 60 --bochs --filesys-size=2 -p tests/userprog/close-stdin -a close-stdin -- -q -f run close-stdin < /dev/null 2> tests/userprog/close-stdin.errors > tests/userprog/close-stdin.output -perl -I../.. ../../tests/userprog/close-stdin.ck tests/userprog/close-stdin tests/userprog/close-stdin.result -FAIL tests/userprog/close-stdin -Kernel panic in run: PANIC at ../../userprog/exception.c:100 in kill(): Kernel bug - unexpected interrupt in kernel -Call stack: 0xc00285ee 0xe3e3e3e3 0x804a24b -Translation of call stack: -In kernel.o: -0xc00285ee: debug_panic (.../../lib/kernel/debug.c:38) -0xe3e3e3e3: (unknown) -In tests/userprog/close-stdin: -0x0804a24b: close (...../lib/user/syscall.c:141) -Translations of user virtual addresses above are based on a guess at -the binary to use. If this guess is incorrect, then those -translations will be misleading. -pintos -v -k -T 60 --bochs --filesys-size=2 -p tests/userprog/close-stdout -a close-stdout -- -q -f run close-stdout < /dev/null 2> tests/userprog/close-stdout.errors > tests/userprog/close-stdout.output -perl -I../.. ../../tests/userprog/close-stdout.ck tests/userprog/close-stdout tests/userprog/close-stdout.result -FAIL tests/userprog/close-stdout -Kernel panic in run: PANIC at ../../userprog/exception.c:100 in kill(): Kernel bug - unexpected interrupt in kernel -Call stack: 0xc00285ee 0xe3e3e3e3 0x804a24b -Translation of call stack: -In kernel.o: -0xc00285ee: debug_panic (.../../lib/kernel/debug.c:38) -0xe3e3e3e3: (unknown) -In tests/userprog/close-stdout: -0x0804a24b: close (...../lib/user/syscall.c:141) -Translations of user virtual addresses above are based on a guess at -the binary to use. If this guess is incorrect, then those -translations will be misleading. -pintos -v -k -T 60 --bochs --filesys-size=2 -p tests/userprog/close-bad-fd -a close-bad-fd -- -q -f run close-bad-fd < /dev/null 2> tests/userprog/close-bad-fd.errors > tests/userprog/close-bad-fd.output -perl -I../.. ../../tests/userprog/close-bad-fd.ck tests/userprog/close-bad-fd tests/userprog/close-bad-fd.result -FAIL tests/userprog/close-bad-fd -Kernel panic in run: PANIC at ../../userprog/exception.c:100 in kill(): Kernel bug - unexpected interrupt in kernel -Call stack: 0xc00285ee 0xe3e3e3e3 0x804a24b -Translation of call stack: -In kernel.o: -0xc00285ee: debug_panic (.../../lib/kernel/debug.c:38) -0xe3e3e3e3: (unknown) -In tests/userprog/close-bad-fd: -0x0804a24b: close (...../lib/user/syscall.c:141) -Translations of user virtual addresses above are based on a guess at -the binary to use. If this guess is incorrect, then those -translations will be misleading. -pintos -v -k -T 60 --bochs --filesys-size=2 -p tests/userprog/read-normal -a read-normal -p ../../tests/userprog/sample.txt -a sample.txt -- -q -f run read-normal < /dev/null 2> tests/userprog/read-normal.errors > tests/userprog/read-normal.output -perl -I../.. ../../tests/userprog/read-normal.ck tests/userprog/read-normal tests/userprog/read-normal.result -FAIL tests/userprog/read-normal -Kernel panic in run: PANIC at ../../userprog/exception.c:100 in kill(): Kernel bug - unexpected interrupt in kernel -Call stack: 0xc00285ee 0xe3e3e3e3 0x804a1f4 -Translation of call stack: -In kernel.o: -0xc00285ee: debug_panic (.../../lib/kernel/debug.c:38) -0xe3e3e3e3: (unknown) -In tests/userprog/read-normal: -0x0804a1f4: open (...../lib/user/syscall.c:105) -Translations of user virtual addresses above are based on a guess at -the binary to use. If this guess is incorrect, then those -translations will be misleading. -pintos -v -k -T 60 --bochs --filesys-size=2 -p tests/userprog/read-bad-ptr -a read-bad-ptr -p ../../tests/userprog/sample.txt -a sample.txt -- -q -f run read-bad-ptr < /dev/null 2> tests/userprog/read-bad-ptr.errors > tests/userprog/read-bad-ptr.output -perl -I../.. ../../tests/userprog/read-bad-ptr.ck tests/userprog/read-bad-ptr tests/userprog/read-bad-ptr.result -FAIL tests/userprog/read-bad-ptr -Kernel panic in run: PANIC at ../../userprog/exception.c:100 in kill(): Kernel bug - unexpected interrupt in kernel -Call stack: 0xc00285ee 0xe3e3e3e3 0x804a224 -Translation of call stack: -In kernel.o: -0xc00285ee: debug_panic (.../../lib/kernel/debug.c:38) -0xe3e3e3e3: (unknown) -In tests/userprog/read-bad-ptr: -0x0804a224: open (...../lib/user/syscall.c:105) -Translations of user virtual addresses above are based on a guess at -the binary to use. If this guess is incorrect, then those -translations will be misleading. -pintos -v -k -T 60 --bochs --filesys-size=2 -p tests/userprog/read-boundary -a read-boundary -p ../../tests/userprog/sample.txt -a sample.txt -- -q -f run read-boundary < /dev/null 2> tests/userprog/read-boundary.errors > tests/userprog/read-boundary.output -perl -I../.. ../../tests/userprog/read-boundary.ck tests/userprog/read-boundary tests/userprog/read-boundary.result -FAIL tests/userprog/read-boundary -Kernel panic in run: PANIC at ../../userprog/exception.c:100 in kill(): Kernel bug - unexpected interrupt in kernel -Call stack: 0xc00285ee 0xe3e3e3e3 0x804a314 -Translation of call stack: -In kernel.o: -0xc00285ee: debug_panic (.../../lib/kernel/debug.c:38) -0xe3e3e3e3: (unknown) -In tests/userprog/read-boundary: -0x0804a314: open (...../lib/user/syscall.c:105) -Translations of user virtual addresses above are based on a guess at -the binary to use. If this guess is incorrect, then those -translations will be misleading. -pintos -v -k -T 60 --bochs --filesys-size=2 -p tests/userprog/read-zero -a read-zero -p ../../tests/userprog/sample.txt -a sample.txt -- -q -f run read-zero < /dev/null 2> tests/userprog/read-zero.errors > tests/userprog/read-zero.output -perl -I../.. ../../tests/userprog/read-zero.ck tests/userprog/read-zero tests/userprog/read-zero.result -FAIL tests/userprog/read-zero -Kernel panic in run: PANIC at ../../userprog/exception.c:100 in kill(): Kernel bug - unexpected interrupt in kernel -Call stack: 0xc00285ee 0xe3e3e3e3 0x804a244 -Translation of call stack: -In kernel.o: -0xc00285ee: debug_panic (.../../lib/kernel/debug.c:38) -0xe3e3e3e3: (unknown) -In tests/userprog/read-zero: -0x0804a244: open (...../lib/user/syscall.c:105) -Translations of user virtual addresses above are based on a guess at -the binary to use. If this guess is incorrect, then those -translations will be misleading. -pintos -v -k -T 60 --bochs --filesys-size=2 -p tests/userprog/read-stdout -a read-stdout -- -q -f run read-stdout < /dev/null 2> tests/userprog/read-stdout.errors > tests/userprog/read-stdout.output -perl -I../.. ../../tests/userprog/read-stdout.ck tests/userprog/read-stdout tests/userprog/read-stdout.result -FAIL tests/userprog/read-stdout -Kernel panic in run: PANIC at ../../userprog/exception.c:100 in kill(): Kernel bug - unexpected interrupt in kernel -Call stack: 0xc00285ee 0xe3e3e3e3 0x804a218 -Translation of call stack: -In kernel.o: -0xc00285ee: debug_panic (.../../lib/kernel/debug.c:38) -0xe3e3e3e3: (unknown) -In tests/userprog/read-stdout: -0x0804a218: read (...../lib/user/syscall.c:117) -Translations of user virtual addresses above are based on a guess at -the binary to use. If this guess is incorrect, then those -translations will be misleading. -pintos -v -k -T 60 --bochs --filesys-size=2 -p tests/userprog/read-bad-fd -a read-bad-fd -- -q -f run read-bad-fd < /dev/null 2> tests/userprog/read-bad-fd.errors > tests/userprog/read-bad-fd.output -perl -I../.. ../../tests/userprog/read-bad-fd.ck tests/userprog/read-bad-fd tests/userprog/read-bad-fd.result -FAIL tests/userprog/read-bad-fd -Kernel panic in run: PANIC at ../../userprog/exception.c:100 in kill(): Kernel bug - unexpected interrupt in kernel -Call stack: 0xc00285ee 0xe3e3e3e3 0x804a2a8 -Translation of call stack: -In kernel.o: -0xc00285ee: debug_panic (.../../lib/kernel/debug.c:38) -0xe3e3e3e3: (unknown) -In tests/userprog/read-bad-fd: -0x0804a2a8: read (...../lib/user/syscall.c:117) -Translations of user virtual addresses above are based on a guess at -the binary to use. If this guess is incorrect, then those -translations will be misleading. -pintos -v -k -T 60 --bochs --filesys-size=2 -p tests/userprog/write-normal -a write-normal -p ../../tests/userprog/sample.txt -a sample.txt -- -q -f run write-normal < /dev/null 2> tests/userprog/write-normal.errors > tests/userprog/write-normal.output -perl -I../.. ../../tests/userprog/write-normal.ck tests/userprog/write-normal tests/userprog/write-normal.result -FAIL tests/userprog/write-normal -Kernel panic in run: PANIC at ../../userprog/exception.c:100 in kill(): Kernel bug - unexpected interrupt in kernel -Call stack: 0xc00285ee 0xe3e3e3e3 0x804a240 -Translation of call stack: -In kernel.o: -0xc00285ee: debug_panic (.../../lib/kernel/debug.c:38) -0xe3e3e3e3: (unknown) -In tests/userprog/write-normal: -0x0804a240: create (.../../lib/user/syscall.c:93) -Translations of user virtual addresses above are based on a guess at -the binary to use. If this guess is incorrect, then those -translations will be misleading. -pintos -v -k -T 60 --bochs --filesys-size=2 -p tests/userprog/write-bad-ptr -a write-bad-ptr -p ../../tests/userprog/sample.txt -a sample.txt -- -q -f run write-bad-ptr < /dev/null 2> tests/userprog/write-bad-ptr.errors > tests/userprog/write-bad-ptr.output -perl -I../.. ../../tests/userprog/write-bad-ptr.ck tests/userprog/write-bad-ptr tests/userprog/write-bad-ptr.result -FAIL tests/userprog/write-bad-ptr -Kernel panic in run: PANIC at ../../userprog/exception.c:100 in kill(): Kernel bug - unexpected interrupt in kernel -Call stack: 0xc00285ee 0xe3e3e3e3 0x804a224 -Translation of call stack: -In kernel.o: -0xc00285ee: debug_panic (.../../lib/kernel/debug.c:38) -0xe3e3e3e3: (unknown) -In tests/userprog/write-bad-ptr: -0x0804a224: open (...../lib/user/syscall.c:105) -Translations of user virtual addresses above are based on a guess at -the binary to use. If this guess is incorrect, then those -translations will be misleading. -pintos -v -k -T 60 --bochs --filesys-size=2 -p tests/userprog/write-boundary -a write-boundary -p ../../tests/userprog/sample.txt -a sample.txt -- -q -f run write-boundary < /dev/null 2> tests/userprog/write-boundary.errors > tests/userprog/write-boundary.output -perl -I../.. ../../tests/userprog/write-boundary.ck tests/userprog/write-boundary tests/userprog/write-boundary.result -FAIL tests/userprog/write-boundary -Kernel panic in run: PANIC at ../../userprog/exception.c:100 in kill(): Kernel bug - unexpected interrupt in kernel -Call stack: 0xc00285ee 0xe3e3e3e3 0x804a2d4 -Translation of call stack: -In kernel.o: -0xc00285ee: debug_panic (.../../lib/kernel/debug.c:38) -0xe3e3e3e3: (unknown) -In tests/userprog/write-boundary: -0x0804a2d4: open (...../lib/user/syscall.c:105) -Translations of user virtual addresses above are based on a guess at -the binary to use. If this guess is incorrect, then those -translations will be misleading. -pintos -v -k -T 60 --bochs --filesys-size=2 -p tests/userprog/write-zero -a write-zero -p ../../tests/userprog/sample.txt -a sample.txt -- -q -f run write-zero < /dev/null 2> tests/userprog/write-zero.errors > tests/userprog/write-zero.output -perl -I../.. ../../tests/userprog/write-zero.ck tests/userprog/write-zero tests/userprog/write-zero.result -FAIL tests/userprog/write-zero -Kernel panic in run: PANIC at ../../userprog/exception.c:100 in kill(): Kernel bug - unexpected interrupt in kernel -Call stack: 0xc00285ee 0xe3e3e3e3 0x804a234 -Translation of call stack: -In kernel.o: -0xc00285ee: debug_panic (.../../lib/kernel/debug.c:38) -0xe3e3e3e3: (unknown) -In tests/userprog/write-zero: -0x0804a234: open (...../lib/user/syscall.c:105) -Translations of user virtual addresses above are based on a guess at -the binary to use. If this guess is incorrect, then those -translations will be misleading. -pintos -v -k -T 60 --bochs --filesys-size=2 -p tests/userprog/write-stdin -a write-stdin -- -q -f run write-stdin < /dev/null 2> tests/userprog/write-stdin.errors > tests/userprog/write-stdin.output -perl -I../.. ../../tests/userprog/write-stdin.ck tests/userprog/write-stdin tests/userprog/write-stdin.result -pass tests/userprog/write-stdin -pintos -v -k -T 60 --bochs --filesys-size=2 -p tests/userprog/write-bad-fd -a write-bad-fd -- -q -f run write-bad-fd < /dev/null 2> tests/userprog/write-bad-fd.errors > tests/userprog/write-bad-fd.output -perl -I../.. ../../tests/userprog/write-bad-fd.ck tests/userprog/write-bad-fd tests/userprog/write-bad-fd.result -pass tests/userprog/write-bad-fd -pintos -v -k -T 60 --bochs --filesys-size=2 -p tests/userprog/exec-once -a exec-once -p tests/userprog/child-simple -a child-simple -- -q -f run exec-once < /dev/null 2> tests/userprog/exec-once.errors > tests/userprog/exec-once.output -perl -I../.. ../../tests/userprog/exec-once.ck tests/userprog/exec-once tests/userprog/exec-once.result -FAIL tests/userprog/exec-once -Kernel panic in run: PANIC at ../../userprog/exception.c:100 in kill(): Kernel bug - unexpected interrupt in kernel -Call stack: 0xc00285ee 0xe3e3e3e3 0x804a1a1 -Translation of call stack: -In kernel.o: -0xc00285ee: debug_panic (.../../lib/kernel/debug.c:38) -0xe3e3e3e3: (unknown) -In tests/userprog/exec-once: -0x0804a1a1: exec (.../../lib/user/syscall.c:81) -Translations of user virtual addresses above are based on a guess at -the binary to use. If this guess is incorrect, then those -translations will be misleading. -pintos -v -k -T 60 --bochs --filesys-size=2 -p tests/userprog/exec-arg -a exec-arg -p tests/userprog/child-args -a child-args -- -q -f run exec-arg < /dev/null 2> tests/userprog/exec-arg.errors > tests/userprog/exec-arg.output -perl -I../.. ../../tests/userprog/exec-arg.ck tests/userprog/exec-arg tests/userprog/exec-arg.result -FAIL tests/userprog/exec-arg -Kernel panic in run: PANIC at ../../userprog/exception.c:100 in kill(): Kernel bug - unexpected interrupt in kernel -Call stack: 0xc00285ee 0xe3e3e3e3 0x804a1a1 -Translation of call stack: -In kernel.o: -0xc00285ee: debug_panic (.../../lib/kernel/debug.c:38) -0xe3e3e3e3: (unknown) -In tests/userprog/exec-arg: -0x0804a1a1: exec (.../../lib/user/syscall.c:81) -Translations of user virtual addresses above are based on a guess at -the binary to use. If this guess is incorrect, then those -translations will be misleading. -pintos -v -k -T 60 --bochs --filesys-size=2 -p tests/userprog/exec-multiple -a exec-multiple -p tests/userprog/child-simple -a child-simple -- -q -f run exec-multiple < /dev/null 2> tests/userprog/exec-multiple.errors > tests/userprog/exec-multiple.output -perl -I../.. ../../tests/userprog/exec-multiple.ck tests/userprog/exec-multiple tests/userprog/exec-multiple.result -FAIL tests/userprog/exec-multiple -Kernel panic in run: PANIC at ../../userprog/exception.c:100 in kill(): Kernel bug - unexpected interrupt in kernel -Call stack: 0xc00285ee 0xe3e3e3e3 0x804a1e1 -Translation of call stack: -In kernel.o: -0xc00285ee: debug_panic (.../../lib/kernel/debug.c:38) -0xe3e3e3e3: (unknown) -In tests/userprog/exec-multiple: -0x0804a1e1: exec (.../../lib/user/syscall.c:81) -Translations of user virtual addresses above are based on a guess at -the binary to use. If this guess is incorrect, then those -translations will be misleading. -pintos -v -k -T 60 --bochs --filesys-size=2 -p tests/userprog/exec-missing -a exec-missing -- -q -f run exec-missing < /dev/null 2> tests/userprog/exec-missing.errors > tests/userprog/exec-missing.output -perl -I../.. ../../tests/userprog/exec-missing.ck tests/userprog/exec-missing tests/userprog/exec-missing.result -FAIL tests/userprog/exec-missing -Kernel panic in run: PANIC at ../../userprog/exception.c:100 in kill(): Kernel bug - unexpected interrupt in kernel -Call stack: 0xc00285ee 0xe3e3e3e3 0x804a1b1 -Translation of call stack: -In kernel.o: -0xc00285ee: debug_panic (.../../lib/kernel/debug.c:38) -0xe3e3e3e3: (unknown) -In tests/userprog/exec-missing: -0x0804a1b1: exec (.../../lib/user/syscall.c:81) -Translations of user virtual addresses above are based on a guess at -the binary to use. If this guess is incorrect, then those -translations will be misleading. -pintos -v -k -T 60 --bochs --filesys-size=2 -p tests/userprog/exec-bad-ptr -a exec-bad-ptr -- -q -f run exec-bad-ptr < /dev/null 2> tests/userprog/exec-bad-ptr.errors > tests/userprog/exec-bad-ptr.output -perl -I../.. ../../tests/userprog/exec-bad-ptr.ck tests/userprog/exec-bad-ptr tests/userprog/exec-bad-ptr.result -FAIL tests/userprog/exec-bad-ptr -Kernel panic in run: PANIC at ../../userprog/exception.c:100 in kill(): Kernel bug - unexpected interrupt in kernel -Call stack: 0xc00285ee 0xe3e3e3e3 0x804a1a1 -Translation of call stack: -In kernel.o: -0xc00285ee: debug_panic (.../../lib/kernel/debug.c:38) -0xe3e3e3e3: (unknown) -In tests/userprog/exec-bad-ptr: -0x0804a1a1: exec (.../../lib/user/syscall.c:81) -Translations of user virtual addresses above are based on a guess at -the binary to use. If this guess is incorrect, then those -translations will be misleading. -pintos -v -k -T 60 --bochs --filesys-size=2 -p tests/userprog/wait-simple -a wait-simple -p tests/userprog/child-simple -a child-simple -- -q -f run wait-simple < /dev/null 2> tests/userprog/wait-simple.errors > tests/userprog/wait-simple.output -perl -I../.. ../../tests/userprog/wait-simple.ck tests/userprog/wait-simple tests/userprog/wait-simple.result -FAIL tests/userprog/wait-simple -Kernel panic in run: PANIC at ../../userprog/exception.c:100 in kill(): Kernel bug - unexpected interrupt in kernel -Call stack: 0xc00285ee 0xe3e3e3e3 0x804a1b1 -Translation of call stack: -In kernel.o: -0xc00285ee: debug_panic (.../../lib/kernel/debug.c:38) -0xe3e3e3e3: (unknown) -In tests/userprog/wait-simple: -0x0804a1b1: exec (.../../lib/user/syscall.c:81) -Translations of user virtual addresses above are based on a guess at -the binary to use. If this guess is incorrect, then those -translations will be misleading. -pintos -v -k -T 60 --bochs --filesys-size=2 -p tests/userprog/wait-twice -a wait-twice -p tests/userprog/child-simple -a child-simple -- -q -f run wait-twice < /dev/null 2> tests/userprog/wait-twice.errors > tests/userprog/wait-twice.output -perl -I../.. ../../tests/userprog/wait-twice.ck tests/userprog/wait-twice tests/userprog/wait-twice.result -FAIL tests/userprog/wait-twice -Kernel panic in run: PANIC at ../../userprog/exception.c:100 in kill(): Kernel bug - unexpected interrupt in kernel -Call stack: 0xc00285ee 0xe3e3e3e3 0x804a1d1 -Translation of call stack: -In kernel.o: -0xc00285ee: debug_panic (.../../lib/kernel/debug.c:38) -0xe3e3e3e3: (unknown) -In tests/userprog/wait-twice: -0x0804a1d1: exec (.../../lib/user/syscall.c:81) -Translations of user virtual addresses above are based on a guess at -the binary to use. If this guess is incorrect, then those -translations will be misleading. -pintos -v -k -T 60 --bochs --filesys-size=2 -p tests/userprog/wait-killed -a wait-killed -p tests/userprog/child-bad -a child-bad -- -q -f run wait-killed < /dev/null 2> tests/userprog/wait-killed.errors > tests/userprog/wait-killed.output -perl -I../.. ../../tests/userprog/wait-killed.ck tests/userprog/wait-killed tests/userprog/wait-killed.result -FAIL tests/userprog/wait-killed -Kernel panic in run: PANIC at ../../userprog/exception.c:100 in kill(): Kernel bug - unexpected interrupt in kernel -Call stack: 0xc00285ee 0xe3e3e3e3 0x804a1b1 -Translation of call stack: -In kernel.o: -0xc00285ee: debug_panic (.../../lib/kernel/debug.c:38) -0xe3e3e3e3: (unknown) -In tests/userprog/wait-killed: -0x0804a1b1: exec (.../../lib/user/syscall.c:81) -Translations of user virtual addresses above are based on a guess at -the binary to use. If this guess is incorrect, then those -translations will be misleading. -pintos -v -k -T 60 --bochs --filesys-size=2 -p tests/userprog/wait-bad-pid -a wait-bad-pid -- -q -f run wait-bad-pid < /dev/null 2> tests/userprog/wait-bad-pid.errors > tests/userprog/wait-bad-pid.output -perl -I../.. ../../tests/userprog/wait-bad-pid.ck tests/userprog/wait-bad-pid tests/userprog/wait-bad-pid.result -FAIL tests/userprog/wait-bad-pid -Kernel panic in run: PANIC at ../../userprog/exception.c:100 in kill(): Kernel bug - unexpected interrupt in kernel -Call stack: 0xc00285ee 0xe3e3e3e3 0x804a1ae -Translation of call stack: -In kernel.o: -0xc00285ee: debug_panic (.../../lib/kernel/debug.c:38) -0xe3e3e3e3: (unknown) -In tests/userprog/wait-bad-pid: -0x0804a1ae: wait (.../../lib/user/syscall.c:87) -Translations of user virtual addresses above are based on a guess at -the binary to use. If this guess is incorrect, then those -translations will be misleading. -pintos -v -k -T 60 --bochs --filesys-size=2 -p tests/userprog/multi-recurse -a multi-recurse -- -q -f run 'multi-recurse 15' < /dev/null 2> tests/userprog/multi-recurse.errors > tests/userprog/multi-recurse.output -perl -I../.. ../../tests/userprog/multi-recurse.ck tests/userprog/multi-recurse tests/userprog/multi-recurse.result -FAIL tests/userprog/multi-recurse -Kernel panic in run: PANIC at ../../userprog/exception.c:100 in kill(): Kernel bug - unexpected interrupt in kernel -Call stack: 0xc00285ee 0xe3e3e3e3 0x804a5e1 -Translation of call stack: -In kernel.o: -0xc00285ee: debug_panic (.../../lib/kernel/debug.c:38) -0xe3e3e3e3: (unknown) -In tests/userprog/multi-recurse: -0x0804a5e1: exec (.../../lib/user/syscall.c:81) -Translations of user virtual addresses above are based on a guess at -the binary to use. If this guess is incorrect, then those -translations will be misleading. -pintos -v -k -T 60 --bochs --filesys-size=2 -p tests/userprog/multi-child-fd -a multi-child-fd -p ../../tests/userprog/sample.txt -a sample.txt -p tests/userprog/child-close -a child-close -- -q -f run multi-child-fd < /dev/null 2> tests/userprog/multi-child-fd.errors > tests/userprog/multi-child-fd.output -perl -I../.. ../../tests/userprog/multi-child-fd.ck tests/userprog/multi-child-fd tests/userprog/multi-child-fd.result -FAIL tests/userprog/multi-child-fd -Kernel panic in run: PANIC at ../../userprog/exception.c:100 in kill(): Kernel bug - unexpected interrupt in kernel -Call stack: 0xc00285ee 0xe3e3e3e3 0x804a264 -Translation of call stack: -In kernel.o: -0xc00285ee: debug_panic (.../../lib/kernel/debug.c:38) -0xe3e3e3e3: (unknown) -In tests/userprog/multi-child-fd: -0x0804a264: open (...../lib/user/syscall.c:105) -Translations of user virtual addresses above are based on a guess at -the binary to use. If this guess is incorrect, then those -translations will be misleading. -pintos -v -k -T 60 --bochs --filesys-size=2 -p tests/userprog/rox-simple -a rox-simple -- -q -f run rox-simple < /dev/null 2> tests/userprog/rox-simple.errors > tests/userprog/rox-simple.output -perl -I../.. ../../tests/userprog/rox-simple.ck tests/userprog/rox-simple tests/userprog/rox-simple.result -FAIL tests/userprog/rox-simple -Kernel panic in run: PANIC at ../../userprog/exception.c:100 in kill(): Kernel bug - unexpected interrupt in kernel -Call stack: 0xc00285ee 0xe3e3e3e3 0x804a264 -Translation of call stack: -In kernel.o: -0xc00285ee: debug_panic (.../../lib/kernel/debug.c:38) -0xe3e3e3e3: (unknown) -In tests/userprog/rox-simple: -0x0804a264: open (...../lib/user/syscall.c:105) -Translations of user virtual addresses above are based on a guess at -the binary to use. If this guess is incorrect, then those -translations will be misleading. -pintos -v -k -T 60 --bochs --filesys-size=2 -p tests/userprog/rox-child -a rox-child -p tests/userprog/child-rox -a child-rox -- -q -f run rox-child < /dev/null 2> tests/userprog/rox-child.errors > tests/userprog/rox-child.output -perl -I../.. ../../tests/userprog/rox-child.ck tests/userprog/rox-child tests/userprog/rox-child.result -FAIL tests/userprog/rox-child -Kernel panic in run: PANIC at ../../userprog/exception.c:100 in kill(): Kernel bug - unexpected interrupt in kernel -Call stack: 0xc00285ee 0xe3e3e3e3 0x804a334 -Translation of call stack: -In kernel.o: -0xc00285ee: debug_panic (.../../lib/kernel/debug.c:38) -0xe3e3e3e3: (unknown) -In tests/userprog/rox-child: -0x0804a334: open (...../lib/user/syscall.c:105) -Translations of user virtual addresses above are based on a guess at -the binary to use. If this guess is incorrect, then those -translations will be misleading. -pintos -v -k -T 60 --bochs --filesys-size=2 -p tests/userprog/rox-multichild -a rox-multichild -p tests/userprog/child-rox -a child-rox -- -q -f run rox-multichild < /dev/null 2> tests/userprog/rox-multichild.errors > tests/userprog/rox-multichild.output -perl -I../.. ../../tests/userprog/rox-multichild.ck tests/userprog/rox-multichild tests/userprog/rox-multichild.result -FAIL tests/userprog/rox-multichild -Kernel panic in run: PANIC at ../../userprog/exception.c:100 in kill(): Kernel bug - unexpected interrupt in kernel -Call stack: 0xc00285ee 0xe3e3e3e3 0x804a334 -Translation of call stack: -In kernel.o: -0xc00285ee: debug_panic (.../../lib/kernel/debug.c:38) -0xe3e3e3e3: (unknown) -In tests/userprog/rox-multichild: -0x0804a334: open (...../lib/user/syscall.c:105) -Translations of user virtual addresses above are based on a guess at -the binary to use. If this guess is incorrect, then those -translations will be misleading. -pintos -v -k -T 60 --bochs --filesys-size=2 -p tests/userprog/bad-read -a bad-read -- -q -f run bad-read < /dev/null 2> tests/userprog/bad-read.errors > tests/userprog/bad-read.output -perl -I../.. ../../tests/userprog/bad-read.ck tests/userprog/bad-read tests/userprog/bad-read.result -FAIL tests/userprog/bad-read -Test output failed to match any acceptable form. - -Acceptable output: - (bad-read) begin - bad-read: exit(-1) -Differences in `diff -u' format: - (bad-read) begin -- bad-read: exit(-1) - -(User fault messages are excluded for matching purposes.) -pintos -v -k -T 60 --bochs --filesys-size=2 -p tests/userprog/bad-write -a bad-write -- -q -f run bad-write < /dev/null 2> tests/userprog/bad-write.errors > tests/userprog/bad-write.output -perl -I../.. ../../tests/userprog/bad-write.ck tests/userprog/bad-write tests/userprog/bad-write.result -FAIL tests/userprog/bad-write -Test output failed to match any acceptable form. - -Acceptable output: - (bad-write) begin - bad-write: exit(-1) -Differences in `diff -u' format: - (bad-write) begin -- bad-write: exit(-1) - -(User fault messages are excluded for matching purposes.) -pintos -v -k -T 60 --bochs --filesys-size=2 -p tests/userprog/bad-read2 -a bad-read2 -- -q -f run bad-read2 < /dev/null 2> tests/userprog/bad-read2.errors > tests/userprog/bad-read2.output -perl -I../.. ../../tests/userprog/bad-read2.ck tests/userprog/bad-read2 tests/userprog/bad-read2.result -FAIL tests/userprog/bad-read2 -Test output failed to match any acceptable form. - -Acceptable output: - (bad-read2) begin - bad-read2: exit(-1) -Differences in `diff -u' format: - (bad-read2) begin -- bad-read2: exit(-1) - -(User fault messages are excluded for matching purposes.) -pintos -v -k -T 60 --bochs --filesys-size=2 -p tests/userprog/bad-write2 -a bad-write2 -- -q -f run bad-write2 < /dev/null 2> tests/userprog/bad-write2.errors > tests/userprog/bad-write2.output -perl -I../.. ../../tests/userprog/bad-write2.ck tests/userprog/bad-write2 tests/userprog/bad-write2.result -FAIL tests/userprog/bad-write2 -Test output failed to match any acceptable form. - -Acceptable output: - (bad-write2) begin - bad-write2: exit(-1) -Differences in `diff -u' format: - (bad-write2) begin -- bad-write2: exit(-1) - -(User fault messages are excluded for matching purposes.) -pintos -v -k -T 60 --bochs --filesys-size=2 -p tests/userprog/bad-jump -a bad-jump -- -q -f run bad-jump < /dev/null 2> tests/userprog/bad-jump.errors > tests/userprog/bad-jump.output -perl -I../.. ../../tests/userprog/bad-jump.ck tests/userprog/bad-jump tests/userprog/bad-jump.result -FAIL tests/userprog/bad-jump -Test output failed to match any acceptable form. - -Acceptable output: - (bad-jump) begin - bad-jump: exit(-1) -Differences in `diff -u' format: - (bad-jump) begin -- bad-jump: exit(-1) - -(User fault messages are excluded for matching purposes.) -pintos -v -k -T 60 --bochs --filesys-size=2 -p tests/userprog/bad-jump2 -a bad-jump2 -- -q -f run bad-jump2 < /dev/null 2> tests/userprog/bad-jump2.errors > tests/userprog/bad-jump2.output -perl -I../.. ../../tests/userprog/bad-jump2.ck tests/userprog/bad-jump2 tests/userprog/bad-jump2.result -FAIL tests/userprog/bad-jump2 -Test output failed to match any acceptable form. - -Acceptable output: - (bad-jump2) begin - bad-jump2: exit(-1) -Differences in `diff -u' format: - (bad-jump2) begin -- bad-jump2: exit(-1) - -(User fault messages are excluded for matching purposes.) -pintos -v -k -T 360 --bochs --filesys-size=2 -p tests/userprog/no-vm/multi-oom -a multi-oom -- -q -f run multi-oom < /dev/null 2> tests/userprog/no-vm/multi-oom.errors > tests/userprog/no-vm/multi-oom.output -perl -I../.. ../../tests/userprog/no-vm/multi-oom.ck tests/userprog/no-vm/multi-oom tests/userprog/no-vm/multi-oom.result -FAIL tests/userprog/no-vm/multi-oom -Kernel panic in run: PANIC at ../../userprog/exception.c:100 in kill(): Kernel bug - unexpected interrupt in kernel -Call stack: 0xc00285ee 0xe3e3e3e3 0x804a7e1 -Translation of call stack: -In kernel.o: -0xc00285ee: debug_panic (.../../lib/kernel/debug.c:38) -0xe3e3e3e3: (unknown) -In tests/userprog/no-vm/multi-oom: -0x0804a7e1: exec (.../../lib/user/syscall.c:81) -Translations of user virtual addresses above are based on a guess at -the binary to use. If this guess is incorrect, then those -translations will be misleading. -pintos -v -k -T 60 --bochs --filesys-size=2 -p tests/filesys/base/lg-create -a lg-create -- -q -f run lg-create < /dev/null 2> tests/filesys/base/lg-create.errors > tests/filesys/base/lg-create.output -perl -I../.. ../../tests/filesys/base/lg-create.ck tests/filesys/base/lg-create tests/filesys/base/lg-create.result -FAIL tests/filesys/base/lg-create -Kernel panic in run: PANIC at ../../userprog/exception.c:100 in kill(): Kernel bug - unexpected interrupt in kernel -Call stack: 0xc00285ee 0xe3e3e3e3 0x804a360 -Translation of call stack: -In kernel.o: -0xc00285ee: debug_panic (.../../lib/kernel/debug.c:38) -0xe3e3e3e3: (unknown) -In tests/filesys/base/lg-create: -0x0804a360: create (.../../lib/user/syscall.c:93) -Translations of user virtual addresses above are based on a guess at -the binary to use. If this guess is incorrect, then those -translations will be misleading. -pintos -v -k -T 60 --bochs --filesys-size=2 -p tests/filesys/base/lg-full -a lg-full -- -q -f run lg-full < /dev/null 2> tests/filesys/base/lg-full.errors > tests/filesys/base/lg-full.output -perl -I../.. ../../tests/filesys/base/lg-full.ck tests/filesys/base/lg-full tests/filesys/base/lg-full.result -FAIL tests/filesys/base/lg-full -Kernel panic in run: PANIC at ../../userprog/exception.c:100 in kill(): Kernel bug - unexpected interrupt in kernel -Call stack: 0xc00285ee 0xe3e3e3e3 -Translation of call stack: -0xc00285ee: debug_panic (.../../lib/kernel/debug.c:38) -0xe3e3e3e3: (unknown) -pintos -v -k -T 60 --bochs --filesys-size=2 -p tests/filesys/base/lg-random -a lg-random -- -q -f run lg-random < /dev/null 2> tests/filesys/base/lg-random.errors > tests/filesys/base/lg-random.output -perl -I../.. ../../tests/filesys/base/lg-random.ck tests/filesys/base/lg-random tests/filesys/base/lg-random.result -FAIL tests/filesys/base/lg-random -Kernel panic in run: PANIC at ../../userprog/exception.c:100 in kill(): Kernel bug - unexpected interrupt in kernel -Call stack: 0xc00285ee 0xe3e3e3e3 0x804a520 -Translation of call stack: -In kernel.o: -0xc00285ee: debug_panic (.../../lib/kernel/debug.c:38) -0xe3e3e3e3: (unknown) -In tests/filesys/base/lg-random: -0x0804a520: create (.../../lib/user/syscall.c:93) -Translations of user virtual addresses above are based on a guess at -the binary to use. If this guess is incorrect, then those -translations will be misleading. -pintos -v -k -T 60 --bochs --filesys-size=2 -p tests/filesys/base/lg-seq-block -a lg-seq-block -- -q -f run lg-seq-block < /dev/null 2> tests/filesys/base/lg-seq-block.errors > tests/filesys/base/lg-seq-block.output -perl -I../.. ../../tests/filesys/base/lg-seq-block.ck tests/filesys/base/lg-seq-block tests/filesys/base/lg-seq-block.result -FAIL tests/filesys/base/lg-seq-block -Kernel panic in run: PANIC at ../../userprog/exception.c:100 in kill(): Kernel bug - unexpected interrupt in kernel -Call stack: 0xc00285ee 0xe3e3e3e3 -Translation of call stack: -0xc00285ee: debug_panic (.../../lib/kernel/debug.c:38) -0xe3e3e3e3: (unknown) -pintos -v -k -T 60 --bochs --filesys-size=2 -p tests/filesys/base/lg-seq-random -a lg-seq-random -- -q -f run lg-seq-random < /dev/null 2> tests/filesys/base/lg-seq-random.errors > tests/filesys/base/lg-seq-random.output -perl -I../.. ../../tests/filesys/base/lg-seq-random.ck tests/filesys/base/lg-seq-random tests/filesys/base/lg-seq-random.result -FAIL tests/filesys/base/lg-seq-random -Kernel panic in run: PANIC at ../../userprog/exception.c:100 in kill(): Kernel bug - unexpected interrupt in kernel -Call stack: 0xc00285ee 0xe3e3e3e3 -Translation of call stack: -0xc00285ee: debug_panic (.../../lib/kernel/debug.c:38) -0xe3e3e3e3: (unknown) -pintos -v -k -T 60 --bochs --filesys-size=2 -p tests/filesys/base/sm-create -a sm-create -- -q -f run sm-create < /dev/null 2> tests/filesys/base/sm-create.errors > tests/filesys/base/sm-create.output -perl -I../.. ../../tests/filesys/base/sm-create.ck tests/filesys/base/sm-create tests/filesys/base/sm-create.result -FAIL tests/filesys/base/sm-create -Kernel panic in run: PANIC at ../../userprog/exception.c:100 in kill(): Kernel bug - unexpected interrupt in kernel -Call stack: 0xc00285ee 0xe3e3e3e3 0x804a360 -Translation of call stack: -In kernel.o: -0xc00285ee: debug_panic (.../../lib/kernel/debug.c:38) -0xe3e3e3e3: (unknown) -In tests/filesys/base/sm-create: -0x0804a360: create (.../../lib/user/syscall.c:93) -Translations of user virtual addresses above are based on a guess at -the binary to use. If this guess is incorrect, then those -translations will be misleading. -pintos -v -k -T 60 --bochs --filesys-size=2 -p tests/filesys/base/sm-full -a sm-full -- -q -f run sm-full < /dev/null 2> tests/filesys/base/sm-full.errors > tests/filesys/base/sm-full.output -perl -I../.. ../../tests/filesys/base/sm-full.ck tests/filesys/base/sm-full tests/filesys/base/sm-full.result -FAIL tests/filesys/base/sm-full -Kernel panic in run: PANIC at ../../userprog/exception.c:100 in kill(): Kernel bug - unexpected interrupt in kernel -Call stack: 0xc00285ee 0xe3e3e3e3 -Translation of call stack: -0xc00285ee: debug_panic (.../../lib/kernel/debug.c:38) -0xe3e3e3e3: (unknown) -pintos -v -k -T 60 --bochs --filesys-size=2 -p tests/filesys/base/sm-random -a sm-random -- -q -f run sm-random < /dev/null 2> tests/filesys/base/sm-random.errors > tests/filesys/base/sm-random.output -perl -I../.. ../../tests/filesys/base/sm-random.ck tests/filesys/base/sm-random tests/filesys/base/sm-random.result -FAIL tests/filesys/base/sm-random -Kernel panic in run: PANIC at ../../userprog/exception.c:100 in kill(): Kernel bug - unexpected interrupt in kernel -Call stack: 0xc00285ee 0xe3e3e3e3 0x804a520 -Translation of call stack: -In kernel.o: -0xc00285ee: debug_panic (.../../lib/kernel/debug.c:38) -0xe3e3e3e3: (unknown) -In tests/filesys/base/sm-random: -0x0804a520: create (.../../lib/user/syscall.c:93) -Translations of user virtual addresses above are based on a guess at -the binary to use. If this guess is incorrect, then those -translations will be misleading. -pintos -v -k -T 60 --bochs --filesys-size=2 -p tests/filesys/base/sm-seq-block -a sm-seq-block -- -q -f run sm-seq-block < /dev/null 2> tests/filesys/base/sm-seq-block.errors > tests/filesys/base/sm-seq-block.output -perl -I../.. ../../tests/filesys/base/sm-seq-block.ck tests/filesys/base/sm-seq-block tests/filesys/base/sm-seq-block.result -FAIL tests/filesys/base/sm-seq-block -Kernel panic in run: PANIC at ../../userprog/exception.c:100 in kill(): Kernel bug - unexpected interrupt in kernel -Call stack: 0xc00285ee 0xe3e3e3e3 -Translation of call stack: -0xc00285ee: debug_panic (.../../lib/kernel/debug.c:38) -0xe3e3e3e3: (unknown) -pintos -v -k -T 60 --bochs --filesys-size=2 -p tests/filesys/base/sm-seq-random -a sm-seq-random -- -q -f run sm-seq-random < /dev/null 2> tests/filesys/base/sm-seq-random.errors > tests/filesys/base/sm-seq-random.output -perl -I../.. ../../tests/filesys/base/sm-seq-random.ck tests/filesys/base/sm-seq-random tests/filesys/base/sm-seq-random.result -FAIL tests/filesys/base/sm-seq-random -Kernel panic in run: PANIC at ../../userprog/exception.c:100 in kill(): Kernel bug - unexpected interrupt in kernel -Call stack: 0xc00285ee 0xe3e3e3e3 -Translation of call stack: -0xc00285ee: debug_panic (.../../lib/kernel/debug.c:38) -0xe3e3e3e3: (unknown) -pintos -v -k -T 300 --bochs --filesys-size=2 -p tests/filesys/base/syn-read -a syn-read -p tests/filesys/base/child-syn-read -a child-syn-read -- -q -f run syn-read < /dev/null 2> tests/filesys/base/syn-read.errors > tests/filesys/base/syn-read.output -perl -I../.. ../../tests/filesys/base/syn-read.ck tests/filesys/base/syn-read tests/filesys/base/syn-read.result -FAIL tests/filesys/base/syn-read -Kernel panic in run: PANIC at ../../userprog/exception.c:100 in kill(): Kernel bug - unexpected interrupt in kernel -Call stack: 0xc00285ee 0xe3e3e3e3 0x804a420 -Translation of call stack: -In kernel.o: -0xc00285ee: debug_panic (.../../lib/kernel/debug.c:38) -0xe3e3e3e3: (unknown) -In tests/filesys/base/syn-read: -0x0804a420: create (.../../lib/user/syscall.c:93) -Translations of user virtual addresses above are based on a guess at -the binary to use. If this guess is incorrect, then those -translations will be misleading. -pintos -v -k -T 60 --bochs --filesys-size=2 -p tests/filesys/base/syn-remove -a syn-remove -- -q -f run syn-remove < /dev/null 2> tests/filesys/base/syn-remove.errors > tests/filesys/base/syn-remove.output -perl -I../.. ../../tests/filesys/base/syn-remove.ck tests/filesys/base/syn-remove tests/filesys/base/syn-remove.result -FAIL tests/filesys/base/syn-remove -Kernel panic in run: PANIC at ../../userprog/exception.c:100 in kill(): Kernel bug - unexpected interrupt in kernel -Call stack: 0xc00285ee 0xe3e3e3e3 0x804a4c0 -Translation of call stack: -In kernel.o: -0xc00285ee: debug_panic (.../../lib/kernel/debug.c:38) -0xe3e3e3e3: (unknown) -In tests/filesys/base/syn-remove: -0x0804a4c0: create (.../../lib/user/syscall.c:93) -Translations of user virtual addresses above are based on a guess at -the binary to use. If this guess is incorrect, then those -translations will be misleading. -pintos -v -k -T 60 --bochs --filesys-size=2 -p tests/filesys/base/syn-write -a syn-write -p tests/filesys/base/child-syn-wrt -a child-syn-wrt -- -q -f run syn-write < /dev/null 2> tests/filesys/base/syn-write.errors > tests/filesys/base/syn-write.output -perl -I../.. ../../tests/filesys/base/syn-write.ck tests/filesys/base/syn-write tests/filesys/base/syn-write.result -FAIL tests/filesys/base/syn-write -Kernel panic in run: PANIC at ../../userprog/exception.c:100 in kill(): Kernel bug - unexpected interrupt in kernel -Call stack: 0xc00285ee 0xe3e3e3e3 0x804a430 -Translation of call stack: -In kernel.o: -0xc00285ee: debug_panic (.../../lib/kernel/debug.c:38) -0xe3e3e3e3: (unknown) -In tests/filesys/base/syn-write: -0x0804a430: create (.../../lib/user/syscall.c:93) -Translations of user virtual addresses above are based on a guess at -the binary to use. If this guess is incorrect, then those -translations will be misleading. -pass tests/userprog/args-none -pass tests/userprog/args-single -pass tests/userprog/args-multiple -pass tests/userprog/args-many -pass tests/userprog/args-dbl-space -FAIL tests/userprog/sc-bad-sp -FAIL tests/userprog/sc-bad-arg -pass tests/userprog/sc-boundary -pass tests/userprog/sc-boundary-2 -FAIL tests/userprog/halt -pass tests/userprog/exit -FAIL tests/userprog/create-normal -FAIL tests/userprog/create-empty -FAIL tests/userprog/create-null -FAIL tests/userprog/create-bad-ptr -FAIL tests/userprog/create-long -FAIL tests/userprog/create-exists -FAIL tests/userprog/create-bound -FAIL tests/userprog/open-normal -FAIL tests/userprog/open-missing -FAIL tests/userprog/open-boundary -FAIL tests/userprog/open-empty -FAIL tests/userprog/open-null -FAIL tests/userprog/open-bad-ptr -FAIL tests/userprog/open-twice -FAIL tests/userprog/close-normal -FAIL tests/userprog/close-twice -FAIL tests/userprog/close-stdin -FAIL tests/userprog/close-stdout -FAIL tests/userprog/close-bad-fd -FAIL tests/userprog/read-normal -FAIL tests/userprog/read-bad-ptr -FAIL tests/userprog/read-boundary -FAIL tests/userprog/read-zero -FAIL tests/userprog/read-stdout -FAIL tests/userprog/read-bad-fd -FAIL tests/userprog/write-normal -FAIL tests/userprog/write-bad-ptr -FAIL tests/userprog/write-boundary -FAIL tests/userprog/write-zero -pass tests/userprog/write-stdin -pass tests/userprog/write-bad-fd -FAIL tests/userprog/exec-once -FAIL tests/userprog/exec-arg -FAIL tests/userprog/exec-multiple -FAIL tests/userprog/exec-missing -FAIL tests/userprog/exec-bad-ptr -FAIL tests/userprog/wait-simple -FAIL tests/userprog/wait-twice -FAIL tests/userprog/wait-killed -FAIL tests/userprog/wait-bad-pid -FAIL tests/userprog/multi-recurse -FAIL tests/userprog/multi-child-fd -FAIL tests/userprog/rox-simple -FAIL tests/userprog/rox-child -FAIL tests/userprog/rox-multichild -FAIL tests/userprog/bad-read -FAIL tests/userprog/bad-write -FAIL tests/userprog/bad-read2 -FAIL tests/userprog/bad-write2 -FAIL tests/userprog/bad-jump -FAIL tests/userprog/bad-jump2 -FAIL tests/userprog/no-vm/multi-oom -FAIL tests/filesys/base/lg-create -FAIL tests/filesys/base/lg-full -FAIL tests/filesys/base/lg-random -FAIL tests/filesys/base/lg-seq-block -FAIL tests/filesys/base/lg-seq-random -FAIL tests/filesys/base/sm-create -FAIL tests/filesys/base/sm-full -FAIL tests/filesys/base/sm-random -FAIL tests/filesys/base/sm-seq-block -FAIL tests/filesys/base/sm-seq-random -FAIL tests/filesys/base/syn-read -FAIL tests/filesys/base/syn-remove -FAIL tests/filesys/base/syn-write -66 of 76 tests failed. -make[1]: Leaving directory `/pintos-env/pintos/userprog/build' diff --git a/pintos-env/pintos/userprog/syscall.c b/pintos-env/pintos/userprog/syscall.c index d49df82..9eabd30 100755 --- a/pintos-env/pintos/userprog/syscall.c +++ b/pintos-env/pintos/userprog/syscall.c @@ -7,18 +7,52 @@ #include "userprog/process.h" #include "threads/vaddr.h" #include "userprog/pagedir.h" +#include "lib/kernel/hash.h" +#include "filesys/filesys.h" +#include "filesys/file.h" typedef int (*handler) (uint32_t, uint32_t, uint32_t); static handler syscall_vec[128]; -static int sys_write (int fd, const void *buffer, unsigned length); static int sys_exit (int status); static int sys_wait (tid_t tid); static tid_t sys_exec (const char* file_name); static void syscall_nop(void); +static void sys_halt(void); + +bool sys_create(const char* filename, unsigned initial_size); +bool sys_remove(const char* filename); +int sys_open(const char* file); +int sys_filesize(int fd); +void sys_seek(int fd, unsigned position); +unsigned sys_tell(int fd); +void sys_close(int fd); +int sys_read(int fd, void *buffer, unsigned size); +int sys_write(int fd, const void *buffer, unsigned size); static void syscall_handler (struct intr_frame *); +struct fd_item { + int fd; + struct file* file; + struct hash_elem elem; +}; + +int next_fd = 3; +struct hash fd_table; +struct semaphore filesys_lock; + +static unsigned item_hash (const struct hash_elem* e, void* aux) { + struct fd_item* i = hash_entry(e, struct fd_item, elem); + return hash_int(i->fd); +} + +static bool item_compare(const struct hash_elem* a, const struct hash_elem* b, void* aux) { + struct fd_item *i_a = hash_entry(a, struct fd_item, elem); + struct fd_item *i_b = hash_entry(b, struct fd_item, elem); + return i_a->fd < i_b->fd; +} + void syscall_init (void) { @@ -27,7 +61,186 @@ syscall_init (void) syscall_vec[SYS_EXIT] = (handler)sys_exit; syscall_vec[SYS_WAIT] = (handler)sys_wait; syscall_vec[SYS_EXEC] = (handler)sys_exec; + syscall_vec[SYS_HALT] = (handler)sys_halt; + syscall_vec[SYS_CREATE] = (handler)sys_create; + syscall_vec[SYS_REMOVE] = (handler)sys_remove; + syscall_vec[SYS_OPEN] = (handler)sys_open; + syscall_vec[SYS_FILESIZE] = (handler)sys_filesize; + syscall_vec[SYS_SEEK] = (handler)sys_seek; + syscall_vec[SYS_TELL] = (handler)sys_tell; + syscall_vec[SYS_CLOSE] = (handler)sys_close; + syscall_vec[SYS_READ] = (handler)sys_read; syscall_vec[SYS_WRITE] = (handler)sys_write; + hash_init(&fd_table, item_hash, item_compare, NULL); + sema_init(&filesys_lock, 1); +} + +static bool check_ptr(const void* ptr) { + if (ptr == NULL || is_kernel_vaddr(ptr) || + pagedir_get_page(thread_current()->pagedir, ptr) == NULL) { + sys_exit(-1); + } + return false; +} + +static +void sys_halt(void) { + shutdown_power_off(); +} + +bool sys_create(const char* filename, unsigned initial_size) { + if (check_ptr(filename)) return 0; + sema_down (&filesys_lock); + bool return_code = filesys_create(filename, initial_size); + sema_up (&filesys_lock); + return return_code; +} + +bool sys_remove(const char* filename) { + if (check_ptr(filename)) return 0; + sema_down (&filesys_lock); + bool return_code = filesys_remove(filename); + sema_up (&filesys_lock); + return return_code; +} + +int sys_open(const char* file) { + if (check_ptr(file)) return -1; + struct file* file_opened; + struct fd_item* fd = malloc(sizeof(struct fd_item*)); + if (!fd) { + return -1; + } + + sema_down (&filesys_lock); + file_opened = filesys_open(file); + if (!file_opened) { + free(fd); + sema_up (&filesys_lock); + return -1; + } + + fd->file = file_opened; //file save + fd->fd = next_fd++; + hash_insert(&fd_table, &fd->elem); + + sema_up (&filesys_lock); + return fd->fd; +} + +int sys_filesize(int fd) { + sema_down (&filesys_lock); + struct fd_item i; + i.fd = fd; + struct fd_item* file_d = hash_entry(hash_find(&fd_table, &i.elem), struct fd_item, elem); + + if(file_d == NULL) { + sema_up (&filesys_lock); + return -1; + } + + int ret = file_length(file_d->file); + sema_up (&filesys_lock); + return ret; +} + +void sys_seek(int fd, unsigned position) { + sema_down (&filesys_lock); + struct fd_item i; + i.fd = fd; + struct fd_item* file_d = hash_entry(hash_find(&fd_table, &i.elem), struct fd_item, elem); + + if(file_d && file_d->file) { + file_seek(file_d->file, position); + } + else + return; + + sema_up (&filesys_lock); +} + +unsigned sys_tell(int fd) { + sema_down (&filesys_lock); + struct fd_item i; + i.fd = fd; + struct fd_item* file_d = hash_entry(hash_find(&fd_table, &i.elem), struct fd_item, elem); + + unsigned ret; + if(file_d && file_d->file) { + ret = file_tell(file_d->file); + } + else + ret = -1; + + sema_up (&filesys_lock); + return ret; +} + +void sys_close(int fd) { + sema_down (&filesys_lock); + struct fd_item i; + i.fd = fd; + struct hash_elem* h = hash_find(&fd_table, &i.elem); + if (h == NULL) sys_exit(-1); + struct fd_item* file_d = hash_entry(h, struct fd_item, elem); + + if(file_d && file_d->file) { + file_close(file_d->file); + hash_delete(&fd_table, &(file_d->elem)); + free(file_d); + } + sema_up (&filesys_lock); +} + +int sys_read(int fd, void *buffer, unsigned size) { + if (check_ptr(buffer)||check_ptr(buffer+size)) return -1; + sema_down (&filesys_lock); + int ret; + + if(fd == 0) { + return -1; + } else { + struct fd_item i; + i.fd = fd; + struct hash_elem* h = hash_find(&fd_table, &i.elem); + if (h == NULL) sys_exit(-1); + struct fd_item* file_d = hash_entry(h, struct fd_item, elem); + + if(file_d && file_d->file) { + ret = file_read(file_d->file, buffer, size); + } + else // no such file or can't open + ret = -1; + } + + sema_up (&filesys_lock); + return ret; +} + +int sys_write(int fd, const void *buffer, unsigned size) { + if (check_ptr(buffer)||check_ptr(buffer+size)) return -1; + int ret; + + if(fd == 1) { // write to stdout + putbuf(buffer, size); + ret = size; + } else { + sema_down (&filesys_lock); + struct fd_item i; + i.fd = fd; + struct hash_elem* h = hash_find(&fd_table, &i.elem); + if (h == NULL) sys_exit(-1); + struct fd_item* file_d = hash_entry(h, struct fd_item, elem); + + if(file_d && file_d->file) { + ret = file_write(file_d->file, buffer, size); + } + else // no such file or can't open + ret = -1; + sema_up (&filesys_lock); + } + + return ret; } static void @@ -49,16 +262,6 @@ syscall_handler (struct intr_frame *f) f->eax = ret; } -static int -sys_write (int fd, const void *buffer, unsigned length) { - if (fd == 1) { // if stdout - putbuf (buffer, length); - return length; - } else { - return -1; - } -} - int sys_exit (int status) {