process.c 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. /*
  2. * linux/arch/cris/kernel/process.c
  3. *
  4. * Copyright (C) 1995 Linus Torvalds
  5. * Copyright (C) 2000-2002 Axis Communications AB
  6. *
  7. * Authors: Bjorn Wesen (bjornw@axis.com)
  8. *
  9. */
  10. /*
  11. * This file handles the architecture-dependent parts of process handling..
  12. */
  13. #include <linux/atomic.h>
  14. #include <asm/pgtable.h>
  15. #include <asm/uaccess.h>
  16. #include <asm/irq.h>
  17. #include <linux/module.h>
  18. #include <linux/spinlock.h>
  19. #include <linux/init_task.h>
  20. #include <linux/sched.h>
  21. #include <linux/fs.h>
  22. #include <linux/user.h>
  23. #include <linux/elfcore.h>
  24. #include <linux/mqueue.h>
  25. #include <linux/reboot.h>
  26. #include <linux/rcupdate.h>
  27. //#define DEBUG
  28. /*
  29. * The hlt_counter, disable_hlt and enable_hlt is just here as a hook if
  30. * there would ever be a halt sequence (for power save when idle) with
  31. * some largish delay when halting or resuming *and* a driver that can't
  32. * afford that delay. The hlt_counter would then be checked before
  33. * executing the halt sequence, and the driver marks the unhaltable
  34. * region by enable_hlt/disable_hlt.
  35. */
  36. int cris_hlt_counter=0;
  37. void disable_hlt(void)
  38. {
  39. cris_hlt_counter++;
  40. }
  41. EXPORT_SYMBOL(disable_hlt);
  42. void enable_hlt(void)
  43. {
  44. cris_hlt_counter--;
  45. }
  46. EXPORT_SYMBOL(enable_hlt);
  47. extern void default_idle(void);
  48. void (*pm_power_off)(void);
  49. EXPORT_SYMBOL(pm_power_off);
  50. /*
  51. * The idle thread. There's no useful work to be
  52. * done, so just try to conserve power and have a
  53. * low exit latency (ie sit in a loop waiting for
  54. * somebody to say that they'd like to reschedule)
  55. */
  56. void cpu_idle (void)
  57. {
  58. /* endless idle loop with no priority at all */
  59. while (1) {
  60. rcu_idle_enter();
  61. while (!need_resched()) {
  62. /*
  63. * Mark this as an RCU critical section so that
  64. * synchronize_kernel() in the unload path waits
  65. * for our completion.
  66. */
  67. default_idle();
  68. }
  69. rcu_idle_exit();
  70. schedule_preempt_disabled();
  71. }
  72. }
  73. void hard_reset_now (void);
  74. void machine_restart(char *cmd)
  75. {
  76. hard_reset_now();
  77. }
  78. /*
  79. * Similar to machine_power_off, but don't shut off power. Add code
  80. * here to freeze the system for e.g. post-mortem debug purpose when
  81. * possible. This halt has nothing to do with the idle halt.
  82. */
  83. void machine_halt(void)
  84. {
  85. }
  86. /* If or when software power-off is implemented, add code here. */
  87. void machine_power_off(void)
  88. {
  89. }
  90. /*
  91. * When a process does an "exec", machine state like FPU and debug
  92. * registers need to be reset. This is a hook function for that.
  93. * Currently we don't have any such state to reset, so this is empty.
  94. */
  95. void flush_thread(void)
  96. {
  97. }
  98. /* Fill in the fpu structure for a core dump. */
  99. int dump_fpu(struct pt_regs *regs, elf_fpregset_t *fpu)
  100. {
  101. return 0;
  102. }