processor.h 1.6 KB

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