kexec.h 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. #ifndef __ASM_SH_KEXEC_H
  2. #define __ASM_SH_KEXEC_H
  3. #include <asm/ptrace.h>
  4. #include <asm/string.h>
  5. /*
  6. * KEXEC_SOURCE_MEMORY_LIMIT maximum page get_free_page can return.
  7. * I.e. Maximum page that is mapped directly into kernel memory,
  8. * and kmap is not required.
  9. *
  10. * Someone correct me if FIXADDR_START - PAGEOFFSET is not the correct
  11. * calculation for the amount of memory directly mappable into the
  12. * kernel memory space.
  13. */
  14. /* Maximum physical address we can use pages from */
  15. #define KEXEC_SOURCE_MEMORY_LIMIT (-1UL)
  16. /* Maximum address we can reach in physical address mode */
  17. #define KEXEC_DESTINATION_MEMORY_LIMIT (-1UL)
  18. /* Maximum address we can use for the control code buffer */
  19. #define KEXEC_CONTROL_MEMORY_LIMIT TASK_SIZE
  20. #define KEXEC_CONTROL_PAGE_SIZE 4096
  21. /* The native architecture */
  22. #define KEXEC_ARCH KEXEC_ARCH_SH
  23. #ifdef CONFIG_KEXEC
  24. /* arch/sh/kernel/machine_kexec.c */
  25. void reserve_crashkernel(void);
  26. static inline void crash_setup_regs(struct pt_regs *newregs,
  27. struct pt_regs *oldregs)
  28. {
  29. if (oldregs)
  30. memcpy(newregs, oldregs, sizeof(*newregs));
  31. else {
  32. __asm__ __volatile__ ("mov r0, %0" : "=r" (newregs->regs[0]));
  33. __asm__ __volatile__ ("mov r1, %0" : "=r" (newregs->regs[1]));
  34. __asm__ __volatile__ ("mov r2, %0" : "=r" (newregs->regs[2]));
  35. __asm__ __volatile__ ("mov r3, %0" : "=r" (newregs->regs[3]));
  36. __asm__ __volatile__ ("mov r4, %0" : "=r" (newregs->regs[4]));
  37. __asm__ __volatile__ ("mov r5, %0" : "=r" (newregs->regs[5]));
  38. __asm__ __volatile__ ("mov r6, %0" : "=r" (newregs->regs[6]));
  39. __asm__ __volatile__ ("mov r7, %0" : "=r" (newregs->regs[7]));
  40. __asm__ __volatile__ ("mov r8, %0" : "=r" (newregs->regs[8]));
  41. __asm__ __volatile__ ("mov r9, %0" : "=r" (newregs->regs[9]));
  42. __asm__ __volatile__ ("mov r10, %0" : "=r" (newregs->regs[10]));
  43. __asm__ __volatile__ ("mov r11, %0" : "=r" (newregs->regs[11]));
  44. __asm__ __volatile__ ("mov r12, %0" : "=r" (newregs->regs[12]));
  45. __asm__ __volatile__ ("mov r13, %0" : "=r" (newregs->regs[13]));
  46. __asm__ __volatile__ ("mov r14, %0" : "=r" (newregs->regs[14]));
  47. __asm__ __volatile__ ("mov r15, %0" : "=r" (newregs->regs[15]));
  48. __asm__ __volatile__ ("sts pr, %0" : "=r" (newregs->pr));
  49. __asm__ __volatile__ ("sts macl, %0" : "=r" (newregs->macl));
  50. __asm__ __volatile__ ("sts mach, %0" : "=r" (newregs->mach));
  51. __asm__ __volatile__ ("stc gbr, %0" : "=r" (newregs->gbr));
  52. __asm__ __volatile__ ("stc sr, %0" : "=r" (newregs->sr));
  53. newregs->pc = (unsigned long)current_text_addr();
  54. }
  55. }
  56. #else
  57. static inline void reserve_crashkernel(void) { }
  58. #endif /* CONFIG_KEXEC */
  59. #endif /* __ASM_SH_KEXEC_H */