/* halt.c * Simple program to test whether running a user program works. * * Just do a "syscall" that shuts down the OS. * * NOTE: for some reason, user programs with global data structures * sometimes haven't worked in the Nachos environment. So be careful * out there! One option is to allocate data structures as * automatics within a procedure, but if you do this, you have to * be careful to allocate a big enough stack to hold the automatics! */ #include "syscall.h" int main(){ int id = 0; char buf[8]; buf[0]= '_'; buf[1]= 'P'; buf[2]= 'R'; buf[3]= 'U'; buf[4]= 'E'; buf[5]= 'B'; buf[6]= 'A'; buf[7]= '\0'; Write(buf, 8,1); id = Exec(buf); Join(id); Write("FIN\n",4,1); /* not reached */ }