freebsd 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. #------------------------------------------------------------------------------
  2. # freebsd: file(1) magic for FreeBSD objects
  3. #
  4. # All new-style FreeBSD magic numbers are in host byte order (i.e.,
  5. # little-endian on x86).
  6. #
  7. # XXX - this comes from the file "freebsd" in a recent FreeBSD version of
  8. # "file"; it, and the NetBSD stuff in "netbsd", appear to use different
  9. # schemes for distinguishing between executable images, shared libraries,
  10. # and object files.
  11. #
  12. # FreeBSD says:
  13. #
  14. # Regardless of whether it's pure, demand-paged, or none of the
  15. # above:
  16. #
  17. # if the entry point is < 4096, then it's a shared library if
  18. # the "has run-time loader information" bit is set, and is
  19. # position-independent if the "is position-independent" bit
  20. # is set;
  21. #
  22. # if the entry point is >= 4096 (or >4095, same thing), then it's
  23. # an executable, and is dynamically-linked if the "has run-time
  24. # loader information" bit is set.
  25. #
  26. # On x86, NetBSD says:
  27. #
  28. # If it's neither pure nor demand-paged:
  29. #
  30. # if it has the "has run-time loader information" bit set, it's
  31. # a dynamically-linked executable;
  32. #
  33. # if it doesn't have that bit set, then:
  34. #
  35. # if it has the "is position-independent" bit set, it's
  36. # position-independent;
  37. #
  38. # if the entry point is non-zero, it's an executable, otherwise
  39. # it's an object file.
  40. #
  41. # If it's pure:
  42. #
  43. # if it has the "has run-time loader information" bit set, it's
  44. # a dynamically-linked executable, otherwise it's just an
  45. # executable.
  46. #
  47. # If it's demand-paged:
  48. #
  49. # if it has the "has run-time loader information" bit set,
  50. # then:
  51. #
  52. # if the entry point is < 4096, it's a shared library;
  53. #
  54. # if the entry point is = 4096 or > 4096 (i.e., >= 4096),
  55. # it's a dynamically-linked executable);
  56. #
  57. # if it doesn't have the "has run-time loader information" bit
  58. # set, then it's just an executable.
  59. #
  60. # (On non-x86, NetBSD does much the same thing, except that it uses
  61. # 8192 on 68K - except for "68k4k", which is presumably "68K with 4K
  62. # pages - SPARC, and MIPS, presumably because Sun-3's and Sun-4's
  63. # had 8K pages; dunno about MIPS.)
  64. #
  65. # I suspect the two will differ only in perverse and uninteresting cases
  66. # ("shared" libraries that aren't demand-paged and whose pages probably
  67. # won't actually be shared, executables with entry points <4096).
  68. #
  69. # I leave it to those more familiar with FreeBSD and NetBSD to figure out
  70. # what the right answer is (although using ">4095", FreeBSD-style, is
  71. # probably better than separately checking for "=4096" and ">4096",
  72. # NetBSD-style). (The old "netbsd" file analyzed FreeBSD demand paged
  73. # executables using the NetBSD technique.)
  74. #
  75. 0 lelong&0377777777 041400407 FreeBSD/i386
  76. >20 lelong <4096
  77. >>3 byte&0xC0 &0x80 shared library
  78. >>3 byte&0xC0 0x40 PIC object
  79. >>3 byte&0xC0 0x00 object
  80. >20 lelong >4095
  81. >>3 byte&0x80 0x80 dynamically linked executable
  82. >>3 byte&0x80 0x00 executable
  83. >16 lelong >0 not stripped
  84. 0 lelong&0377777777 041400410 FreeBSD/i386 pure
  85. >20 lelong <4096
  86. >>3 byte&0xC0 &0x80 shared library
  87. >>3 byte&0xC0 0x40 PIC object
  88. >>3 byte&0xC0 0x00 object
  89. >20 lelong >4095
  90. >>3 byte&0x80 0x80 dynamically linked executable
  91. >>3 byte&0x80 0x00 executable
  92. >16 lelong >0 not stripped
  93. 0 lelong&0377777777 041400413 FreeBSD/i386 demand paged
  94. >20 lelong <4096
  95. >>3 byte&0xC0 &0x80 shared library
  96. >>3 byte&0xC0 0x40 PIC object
  97. >>3 byte&0xC0 0x00 object
  98. >20 lelong >4095
  99. >>3 byte&0x80 0x80 dynamically linked executable
  100. >>3 byte&0x80 0x00 executable
  101. >16 lelong >0 not stripped
  102. 0 lelong&0377777777 041400314 FreeBSD/i386 compact demand paged
  103. >20 lelong <4096
  104. >>3 byte&0xC0 &0x80 shared library
  105. >>3 byte&0xC0 0x40 PIC object
  106. >>3 byte&0xC0 0x00 object
  107. >20 lelong >4095
  108. >>3 byte&0x80 0x80 dynamically linked executable
  109. >>3 byte&0x80 0x00 executable
  110. >16 lelong >0 not stripped
  111. # XXX gross hack to identify core files
  112. # cores start with a struct tss; we take advantage of the following:
  113. # byte 7: highest byte of the kernel stack pointer, always 0xfe
  114. # 8/9: kernel (ring 0) ss value, always 0x0010
  115. # 10 - 27: ring 1 and 2 ss/esp, unused, thus always 0
  116. # 28: low order byte of the current PTD entry, always 0 since the
  117. # PTD is page-aligned
  118. #
  119. 7 string \357\020\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0 FreeBSD/i386 a.out core file
  120. >1039 string >\0 from '%s'
  121. # /var/run/ld.so.hints
  122. # What are you laughing about?
  123. 0 lelong 011421044151 ld.so hints file (Little Endian
  124. >4 lelong >0 \b, version %d)
  125. >4 belong <1 \b)
  126. 0 belong 011421044151 ld.so hints file (Big Endian
  127. >4 belong >0 \b, version %d)
  128. >4 belong <1 \b)
  129. #
  130. # Files generated by FreeBSD scrshot(1)/vidcontrol(1) utilities
  131. #
  132. 0 string SCRSHOT_ scrshot(1) screenshot,
  133. >8 byte x version %d,
  134. >9 byte 2 %d bytes in header,
  135. >>10 byte x %d chars wide by
  136. >>11 byte x %d chars high