i need your help, i want to change the way xinu (os) works so it will take over interrupt 128 and controll the SYS_CALL, for example, instead of calling to send(pid, msg) i will call to sys_call(SEND, pid, msg);. in initiali.c i've added
mapinit(INT80VEC,active80,INT80VEC);
and in the header i made i did
#ifndef hw4
#define hw4 256 //prevent rerun of the header file
#define INT80VEC 0x80
extern enum cmd{CHPRIO, GETPID, GETPRIO, KILL, RECEIVE,
RECVCLR, RESUME, SCOUNT, SCREATE, SDELETE,
SEND, SENDF, SENDN, SIGNAL, SIGNALN, SLEEP,
SLEEPT, SRESET, SUSPEND, WAIT, PCOUNT, PCREATE,last};
//last is just to find out how many arguments we have in the enum expression
extern SYSCALL sys_call(int sys_call_no, int parm1, int parm2);
extern int active80();
#endif
and the c file i made i got:
#include <kernel.h>
#include <conf.h>
#include "my.h"
SYSCALL sys_call(int sys_call_no, int parm1, int parm2){
int ps;
int temp;
disable(ps);
if(sys_call_no<0 ||sys_call_no>=last){
restore(ps);
return SYSERR;
}
asm{ mov ax,sys_call_no
mov bx,parm1
mov cx,parm2
int 80h
mov temp,ax
}
restore(ps);
return temp;
}
INTPROC active80(){
int sys_call_no, parm1,parm2;
asm{ mov sys_call_no,ax
mov parm1,bx
mov parm2,cx
}
switch (sys_call_no) {
case CHPRIO:
chprio(parm1,parm2);
break;
case GETPID:
getpid();
break;
case GETPRIO:
getprio(parm1);
break;
case KILL:
kill(parm1);
break;
case RECEIVE:
receive();
break;
case RECVCLR:
recvclr();
break;
case RESUME:
resume(parm1);
break;
case SCOUNT:
scount(parm1);
break;
case SCREATE:
screate(parm1);
break;
case SDELETE:
sdelete(parm1);
break;
case SEND:
send(parm1, parm2);
break;
case SENDF:
sendf(parm1, parm2);
break;
case SENDN:
sendn(parm1, parm2);
break;
case SIGNAL:
signal(parm1);
break;
case SIGNALN:
signaln(parm1,parm2);
break;
case SLEEP:
sleep(parm1);
break;
case SLEEPT:
sleept(parm1);
break;
case SRESET:
sreset(parm1,parm2);
break;
case SUSPEND:
suspend(parm1);
break;
case WAIT:
wait(parm1);
break;
case PCOUNT:
pcount(parm1);
break;
case PCREATE:
pcreate(parm1);
break;
}
return OK;
}
something is not working... any ideas? thanks ahead!
You must restore your old isr using
maprestore
function.