Reputation: 1
Im trying to test my getpid.c from os161 and it gives this error, i know its because it is trying to access some invalid pointer but it does not make any sense. I tried gdb and i cant really use it because i dont know where the error is coming from much less why it is even getting this error. All i want to do is test my getpid function. :
OS/161 kernel [? for menu]: p testbin/getpidtest
in thread create
after thread allocated
DEBUG LOG[Thread.c create()] generating pid
DEBUG LOG[Thread.c generate_pid()] pid generated...
DEBUG LOG[Thread.c create()] got the pid, the pid is: 2
DEBUG LOG[Thread.c create()] thread create success
Operation took 0.067394760 seconds
OS/161 kernel [? for menu]: Running program panic: Fatal exception 2 (TLB miss on load) in kernel mode
panic: EPC 0x8001310c, exception vaddr 0x30
sleep: Dropping thread <boot/menu>
panic: I can't handle this... I think I'll just die now...
sys161: 65744885840 cycles (10978482464 run, 54766403376 global-idle)
sys161: cpu0: 354176263 kern, 0 user, 0 idle; 0 ll, 0/0 sc, 0 sync
sys161: 220553 irqs 1 exns 0r/0w disk 23r/1365w console 0r/0w/1m emufs 0r/0w net
sys161: Elapsed real time: 7.975243 seconds (8243.62 mhz)
sys161: Elapsed virtual time: 2204.831749899 seconds (25 mhz)
The only hint i see is that when i compile my system it doesnt really give any errors but whilst its compiling i briefly see this and im not sure why its doing that i havent done anything with a makefile except in my test but its just a template of my forktest where i just changed the name of forktest to getpidtest which is what i was told to do when making test :
MAKE[2] *** No rule to make target 'include'. Stop.
make[1] ** [Makefile:45: include] Error 2
make: *** [Makefile:23 all] Error 2
make includes
i made a getpid test that has all the includes theres an executable and everything. I have tried using GDB to pinpoint the problem, i cant find it. The purpose of me making the test was so i could test my sys_getpid function in my getpid.c
*/
int
main(int argc, char *argv[])
{
mypid = getpid();
my sys_getpid function in getpid.c
int sys_getpid(int *retval){
kprintf("DEBUG:GETTING PID:%d...\n", curthread->pid);
*retval = curthread->pid;
return 0;
}
how it is called in ssycall.c
case SYS_getpid:
+ kprintf("attempting to call getpid[syscall.c]\n");
+ err = sys_getpid(&retval);
+ break;
Upvotes: 0
Views: 48