TD3 II.4 Betten error handling on ForkExec()
This commit is contained in:
parent
215a071a13
commit
20e058d610
2 changed files with 5 additions and 3 deletions
|
@ -102,7 +102,9 @@ AddrSpace::AddrSpace (OpenFile * executable)
|
|||
// pageTable[i].physicalPage = i; // for now, phys page # = virtual page #
|
||||
#ifdef CHANGED
|
||||
int newPage = pageProvider->GetEmptyPage();
|
||||
ASSERT(newPage != -1);
|
||||
if (newPage == -1) {
|
||||
throw std::bad_alloc();
|
||||
}
|
||||
pageTable[i].physicalPage = newPage;
|
||||
#endif
|
||||
pageTable[i].valid = TRUE;
|
||||
|
|
|
@ -99,7 +99,7 @@ void do_ThreadExit(){
|
|||
void StartUserProc( void * args ){
|
||||
currentThread->space->InitRegisters();
|
||||
currentThread->space->RestoreState();
|
||||
machine->DumpMem("memory.svg");
|
||||
//machine->DumpMem("memory.svg");
|
||||
machine->Run();
|
||||
}
|
||||
|
||||
|
@ -119,7 +119,7 @@ int do_ForkExec( const char * c){
|
|||
try {
|
||||
space = new AddrSpace(file);
|
||||
}catch(const std::bad_alloc& e) {
|
||||
fprintf(stderr,"no empty space on memory\n");
|
||||
fprintf(stderr,"Could not allocate Memory\n");
|
||||
Exit(1);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue