TD2 question I.3

Add syscall ThreadCreate and ThreadExit on userprog/exception.cc,
userprog/suscall.h and test/start.S
This commit is contained in:
Yorick Barbanneau 2021-11-14 21:11:59 +01:00
parent b635f10b6f
commit f18dd05339
3 changed files with 27 additions and 0 deletions

View file

@ -198,6 +198,21 @@ GetInt:
j $31 j $31
.end GetInt .end GetInt
.globl ThreadCreate
.ent ThreadCreate
ThreadCreate:
addiu $2,$0,SC_ThreadCreate
syscall
j $31
.end ThreadCreate
.globl ThreadExit
.ent ThreadExit
ThreadExit:
addiu $2,$0,SC_ThreadExit
syscall
j $31
.end ThreadExit
#endif #endif

View file

@ -208,6 +208,14 @@ ExceptionHandler (ExceptionType which)
machine->WriteMem(addr,sizeof(n),n); machine->WriteMem(addr,sizeof(n),n);
break; break;
} }
case SC_ThreadCreate:
{
break;
}
case SC_ThreadExit:
{
break;
}
#endif #endif
default: default:
{ {

View file

@ -38,6 +38,8 @@
#define SC_GetString 14 #define SC_GetString 14
#define SC_PutInt 15 #define SC_PutInt 15
#define SC_GetInt 16 #define SC_GetInt 16
#define SC_ThreadCreate 17
#define SC_ThreadExit 18
#endif #endif
#ifdef IN_USER_MODE #ifdef IN_USER_MODE
@ -144,6 +146,8 @@ char GetChar();
void GetString(char *s, int n ); void GetString(char *s, int n );
void PutInt(int n); void PutInt(int n);
void GetInt( int * n); void GetInt( int * n);
int ThreadCreate(void f(void * args), void * args);
void ThreadExit(void);
#endif // CHANGED #endif // CHANGED