TD2 question I.4

Create userthread.cc content and call it from exception.cc
This commit is contained in:
Yorick Barbanneau 2021-11-14 21:51:18 +01:00
parent f18dd05339
commit c4a2d25163
4 changed files with 28 additions and 1 deletions

View file

@ -31,7 +31,7 @@ THREAD_O := main.o list.o scheduler.o synch.o synchlist.o \
stats.o sysdep.o timer.o stats.o sysdep.o timer.o
USERPROG_O := addrspace.o bitmap.o exception.o progtest.o console.o \ USERPROG_O := addrspace.o bitmap.o exception.o progtest.o console.o \
consoledriver.o machine.o mipssim.o translate.o consoledriver.o machine.o mipssim.o translate.o userthread.o
VM_O := VM_O :=

View file

@ -25,6 +25,10 @@
#include "system.h" #include "system.h"
#include "syscall.h" #include "syscall.h"
#ifdef CHANGED
#include "userthread.h"
#endif
//---------------------------------------------------------------------- //----------------------------------------------------------------------
// UpdatePC : Increments the Program Counter register in order to resume // UpdatePC : Increments the Program Counter register in order to resume
// the user program immediately after the "syscall" instruction. // the user program immediately after the "syscall" instruction.
@ -210,6 +214,9 @@ ExceptionHandler (ExceptionType which)
} }
case SC_ThreadCreate: case SC_ThreadCreate:
{ {
int f = machine->ReadRegister(4);
int args = machine->ReadRegister(5);
do_ThreadCreate(f, args);
break; break;
} }
case SC_ThreadExit: case SC_ThreadExit:

View file

@ -0,0 +1,13 @@
#ifdef CHANGED
#include "copyright.h"
#include "system.h"
#include "userthread.h"
#include "syscall.h"
int do_ThreadCreate(int f, int arg){
DEBUG('x',"Enter do_ThreadCreate function\n");
}
void do_ThreadExit(){
}
#endif

View file

@ -0,0 +1,7 @@
#ifdef CHANGED
#include "copyright.h"
#include "utility.h"
extern int do_ThreadCreate(int f, int arg);
extern void do_ThreadExit();
#endif