processor.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #ifndef _ASM_CRIS_ARCH_PROCESSOR_H
  2. #define _ASM_CRIS_ARCH_PROCESSOR_H
  3. #include <linux/config.h>
  4. /* Return current instruction pointer. */
  5. #define current_text_addr() \
  6. ({void *pc; __asm__ __volatile__ ("lapcq .,%0" : "=rm" (pc)); pc;})
  7. /*
  8. * Since CRIS doesn't do hardware task-switching this hasn't really anything to
  9. * do with the proccessor itself, it's just here for legacy reasons. This is
  10. * used when task-switching using _resume defined in entry.S. The offsets here
  11. * are hardcoded into _resume, so if this struct is changed, entry.S needs to be
  12. * changed as well.
  13. */
  14. struct thread_struct {
  15. unsigned long ksp; /* Kernel stack pointer. */
  16. unsigned long usp; /* User stack pointer. */
  17. unsigned long ccs; /* Saved flags register. */
  18. };
  19. /*
  20. * User-space process size. This is hardcoded into a few places, so don't
  21. * changed it unless everything's clear!
  22. */
  23. #ifndef CONFIG_ETRAXFS_SIM
  24. #define TASK_SIZE (0xB0000000UL)
  25. #else
  26. #define TASK_SIZE (0xA0000000UL)
  27. #endif
  28. /* CCS I=1, enable interrupts. */
  29. #define INIT_THREAD { 0, 0, (1 << I_CCS_BITNR) }
  30. #define KSTK_EIP(tsk) \
  31. ({ \
  32. unsigned long eip = 0; \
  33. unsigned long regs = (unsigned long)user_regs(tsk); \
  34. if (regs > PAGE_SIZE && virt_addr_valid(regs)) \
  35. eip = ((struct pt_regs *)regs)->erp; \
  36. eip; \
  37. })
  38. /*
  39. * Give the thread a program location, set user-mode and switch user
  40. * stackpointer.
  41. */
  42. #define start_thread(regs, ip, usp) \
  43. do { \
  44. set_fs(USER_DS); \
  45. regs->erp = ip; \
  46. regs->ccs |= 1 << (U_CCS_BITNR + CCS_SHIFT); \
  47. wrusp(usp); \
  48. } while(0)
  49. /* Nothing special to do for v32 when handling a kernel bus fault fixup. */
  50. #define arch_fixup(regs) {};
  51. #endif /* _ASM_CRIS_ARCH_PROCESSOR_H */