《操作系统》的实验代码。
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

63 lines
784 B

12 years ago
  1. #include <defs.h>
  2. #include <syscall.h>
  3. #include <stdio.h>
  4. #include <ulib.h>
  5. void
  6. exit(int error_code) {
  7. sys_exit(error_code);
  8. cprintf("BUG: exit failed.\n");
  9. while (1);
  10. }
  11. int
  12. fork(void) {
  13. return sys_fork();
  14. }
  15. int
  16. wait(void) {
  17. return sys_wait(0, NULL);
  18. }
  19. int
  20. waitpid(int pid, int *store) {
  21. return sys_wait(pid, store);
  22. }
  23. void
  24. yield(void) {
  25. sys_yield();
  26. }
  27. int
  28. kill(int pid) {
  29. return sys_kill(pid);
  30. }
  31. int
  32. getpid(void) {
  33. return sys_getpid();
  34. }
  35. //print_pgdir - print the PDT&PT
  36. void
  37. print_pgdir(void) {
  38. sys_pgdir();
  39. }
  40. unsigned int
  41. gettime_msec(void) {
  42. return (unsigned int)sys_gettime();
  43. }
  44. void
  45. lab6_set_priority(uint32_t priority)
  46. {
  47. sys_lab6_set_priority(priority);
  48. }
  49. int
  50. sleep(unsigned int time) {
  51. return sys_sleep(time);
  52. }