If you are using the solution as a basis for your HW 3 and have already copied
and modified these files, don't worry, the changes are small. Just do
these three things:
1. In traphandler.cc, add these two cases to the switch statement in
TrapHandler():
case AddressErrorException:
printf("Memory access violation on thread %s -- "
"terminating!\n", gCurrentThread->getName());
gCurrentThread->Finish();
break;
case BusErrorException:
printf("Memory access violation on thread %s -- "
"terminating!\n", gCurrentThread->getName());
gCurrentThread->Finish();
break;
2. In test3.cc, change the single line of StartProcess() to:
Exec(fileName, 1, &fileName);
3. In syscall.cc, right under where it says
printf("ERROR: address space allocation failed!\n");
Add these three new lines:
gThreadTableLock->Acquire();
gThreadTable->Remove( (void *)thread );
gThreadTableLock->Release();
Thanks to Jun Yang for pointing out these problems.
--Eric