archparam-i386.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. /*
  2. * Copyright (C) 2000 - 2003 Jeff Dike (jdike@addtoit.com)
  3. * Licensed under the GPL
  4. */
  5. #ifndef __UM_ARCHPARAM_I386_H
  6. #define __UM_ARCHPARAM_I386_H
  7. /********* Bits for asm-um/elf.h ************/
  8. #include <asm/user.h>
  9. extern char * elf_aux_platform;
  10. #define ELF_PLATFORM (elf_aux_platform)
  11. #define ELF_ET_DYN_BASE (2 * TASK_SIZE / 3)
  12. typedef struct user_i387_struct elf_fpregset_t;
  13. typedef unsigned long elf_greg_t;
  14. #define ELF_NGREG (sizeof (struct user_regs_struct) / sizeof(elf_greg_t))
  15. typedef elf_greg_t elf_gregset_t[ELF_NGREG];
  16. #define ELF_DATA ELFDATA2LSB
  17. #define ELF_ARCH EM_386
  18. #define ELF_PLAT_INIT(regs, load_addr) do { \
  19. PT_REGS_EBX(regs) = 0; \
  20. PT_REGS_ECX(regs) = 0; \
  21. PT_REGS_EDX(regs) = 0; \
  22. PT_REGS_ESI(regs) = 0; \
  23. PT_REGS_EDI(regs) = 0; \
  24. PT_REGS_EBP(regs) = 0; \
  25. PT_REGS_EAX(regs) = 0; \
  26. } while(0)
  27. /* Shamelessly stolen from include/asm-i386/elf.h */
  28. #define ELF_CORE_COPY_REGS(pr_reg, regs) do { \
  29. pr_reg[0] = PT_REGS_EBX(regs); \
  30. pr_reg[1] = PT_REGS_ECX(regs); \
  31. pr_reg[2] = PT_REGS_EDX(regs); \
  32. pr_reg[3] = PT_REGS_ESI(regs); \
  33. pr_reg[4] = PT_REGS_EDI(regs); \
  34. pr_reg[5] = PT_REGS_EBP(regs); \
  35. pr_reg[6] = PT_REGS_EAX(regs); \
  36. pr_reg[7] = PT_REGS_DS(regs); \
  37. pr_reg[8] = PT_REGS_ES(regs); \
  38. /* fake once used fs and gs selectors? */ \
  39. pr_reg[9] = PT_REGS_DS(regs); \
  40. pr_reg[10] = PT_REGS_DS(regs); \
  41. pr_reg[11] = PT_REGS_SYSCALL_NR(regs); \
  42. pr_reg[12] = PT_REGS_IP(regs); \
  43. pr_reg[13] = PT_REGS_CS(regs); \
  44. pr_reg[14] = PT_REGS_EFLAGS(regs); \
  45. pr_reg[15] = PT_REGS_SP(regs); \
  46. pr_reg[16] = PT_REGS_SS(regs); \
  47. } while(0);
  48. extern unsigned long vsyscall_ehdr;
  49. extern unsigned long vsyscall_end;
  50. extern unsigned long __kernel_vsyscall;
  51. #define VSYSCALL_BASE vsyscall_ehdr
  52. #define VSYSCALL_END vsyscall_end
  53. /*
  54. * This is the range that is readable by user mode, and things
  55. * acting like user mode such as get_user_pages.
  56. */
  57. #define FIXADDR_USER_START VSYSCALL_BASE
  58. #define FIXADDR_USER_END VSYSCALL_END
  59. /*
  60. * Architecture-neutral AT_ values in 0-17, leave some room
  61. * for more of them, start the x86-specific ones at 32.
  62. */
  63. #define AT_SYSINFO 32
  64. #define AT_SYSINFO_EHDR 33
  65. #define ARCH_DLINFO \
  66. do { \
  67. if ( vsyscall_ehdr ) { \
  68. NEW_AUX_ENT(AT_SYSINFO, __kernel_vsyscall); \
  69. NEW_AUX_ENT(AT_SYSINFO_EHDR, vsyscall_ehdr); \
  70. } \
  71. } while (0)
  72. /*
  73. * These macros parameterize elf_core_dump in fs/binfmt_elf.c to write out
  74. * extra segments containing the vsyscall DSO contents. Dumping its
  75. * contents makes post-mortem fully interpretable later without matching up
  76. * the same kernel and hardware config to see what PC values meant.
  77. * Dumping its extra ELF program headers includes all the other information
  78. * a debugger needs to easily find how the vsyscall DSO was being used.
  79. */
  80. #define ELF_CORE_EXTRA_PHDRS \
  81. (vsyscall_ehdr ? (((struct elfhdr *)vsyscall_ehdr)->e_phnum) : 0 )
  82. #define ELF_CORE_WRITE_EXTRA_PHDRS \
  83. if ( vsyscall_ehdr ) { \
  84. const struct elfhdr *const ehdrp = (struct elfhdr *)vsyscall_ehdr; \
  85. const struct elf_phdr *const phdrp = \
  86. (const struct elf_phdr *) (vsyscall_ehdr + ehdrp->e_phoff); \
  87. int i; \
  88. Elf32_Off ofs = 0; \
  89. for (i = 0; i < ehdrp->e_phnum; ++i) { \
  90. struct elf_phdr phdr = phdrp[i]; \
  91. if (phdr.p_type == PT_LOAD) { \
  92. ofs = phdr.p_offset = offset; \
  93. offset += phdr.p_filesz; \
  94. } \
  95. else \
  96. phdr.p_offset += ofs; \
  97. phdr.p_paddr = 0; /* match other core phdrs */ \
  98. DUMP_WRITE(&phdr, sizeof(phdr)); \
  99. } \
  100. }
  101. #define ELF_CORE_WRITE_EXTRA_DATA \
  102. if ( vsyscall_ehdr ) { \
  103. const struct elfhdr *const ehdrp = (struct elfhdr *)vsyscall_ehdr; \
  104. const struct elf_phdr *const phdrp = \
  105. (const struct elf_phdr *) (vsyscall_ehdr + ehdrp->e_phoff); \
  106. int i; \
  107. for (i = 0; i < ehdrp->e_phnum; ++i) { \
  108. if (phdrp[i].p_type == PT_LOAD) \
  109. DUMP_WRITE((void *) phdrp[i].p_vaddr, \
  110. phdrp[i].p_filesz); \
  111. } \
  112. }
  113. #define R_386_NONE 0
  114. #define R_386_32 1
  115. #define R_386_PC32 2
  116. #define R_386_GOT32 3
  117. #define R_386_PLT32 4
  118. #define R_386_COPY 5
  119. #define R_386_GLOB_DAT 6
  120. #define R_386_JMP_SLOT 7
  121. #define R_386_RELATIVE 8
  122. #define R_386_GOTOFF 9
  123. #define R_386_GOTPC 10
  124. #define R_386_NUM 11
  125. /********* Nothing for asm-um/hardirq.h **********/
  126. /********* Nothing for asm-um/hw_irq.h **********/
  127. /********* Nothing for asm-um/string.h **********/
  128. #endif
  129. /*
  130. * Overrides for Emacs so that we follow Linus's tabbing style.
  131. * Emacs will notice this stuff at the end of the file and automatically
  132. * adjust the settings for this buffer only. This must remain at the end
  133. * of the file.
  134. * ---------------------------------------------------------------------------
  135. * Local variables:
  136. * c-file-style: "linux"
  137. * End:
  138. */