processor.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. #ifndef __ASM_CRIS_ARCH_PROCESSOR_H
  2. #define __ASM_CRIS_ARCH_PROCESSOR_H
  3. /*
  4. * Default implementation of macro that returns current
  5. * instruction pointer ("program counter").
  6. */
  7. #define current_text_addr() ({void *pc; __asm__ ("move.d $pc,%0" : "=rm" (pc)); pc; })
  8. /* CRIS has no problems with write protection */
  9. #define wp_works_ok 1
  10. /* CRIS thread_struct. this really has nothing to do with the processor itself, since
  11. * CRIS does not do any hardware task-switching, but it's here for legacy reasons.
  12. * The thread_struct here is used when task-switching using _resume defined in entry.S.
  13. * The offsets here are hardcoded into _resume - if you change this struct, you need to
  14. * change them as well!!!
  15. */
  16. struct thread_struct {
  17. unsigned long ksp; /* kernel stack pointer */
  18. unsigned long usp; /* user stack pointer */
  19. unsigned long dccr; /* saved flag register */
  20. };
  21. /*
  22. * User space process size. This is hardcoded into a few places,
  23. * so don't change it unless you know what you are doing.
  24. */
  25. #ifdef CONFIG_CRIS_LOW_MAP
  26. #define TASK_SIZE (0x50000000UL) /* 1.25 GB */
  27. #else
  28. #define TASK_SIZE (0xA0000000UL) /* 2.56 GB */
  29. #endif
  30. #define INIT_THREAD { \
  31. 0, 0, 0x20 } /* ccr = int enable, nothing else */
  32. #define KSTK_EIP(tsk) \
  33. ({ \
  34. unsigned long eip = 0; \
  35. unsigned long regs = (unsigned long)user_regs(tsk); \
  36. if (regs > PAGE_SIZE && \
  37. virt_addr_valid(regs)) \
  38. eip = ((struct pt_regs *)regs)->irp; \
  39. eip; \
  40. })
  41. /* give the thread a program location
  42. * set user-mode (The 'U' flag (User mode flag) is CCR/DCCR bit 8)
  43. * switch user-stackpointer
  44. */
  45. #define start_thread(regs, ip, usp) do { \
  46. set_fs(USER_DS); \
  47. regs->irp = ip; \
  48. regs->dccr |= 1 << U_DCCR_BITNR; \
  49. wrusp(usp); \
  50. } while(0)
  51. /* Called when handling a kernel bus fault fixup.
  52. *
  53. * After a fixup we do not want to return by restoring the CPU-state
  54. * anymore, so switch frame-types (see ptrace.h)
  55. */
  56. #define arch_fixup(regs) \
  57. regs->frametype = CRIS_FRAME_NORMAL;
  58. #endif