]> granicus.if.org Git - file/commitdiff
Handle mach
authorChristos Zoulas <christos@zoulas.com>
Sat, 25 Jun 2005 14:58:38 +0000 (14:58 +0000)
committerChristos Zoulas <christos@zoulas.com>
Sat, 25 Jun 2005 14:58:38 +0000 (14:58 +0000)
magic/Magdir/java
magic/Magdir/mach

index d0677bf7040bed9c370c06d16d7deaaebb34cca0..f9b70915f60d4e90022b09f1f46baa0b903add8b 100644 (file)
@@ -1,9 +1,10 @@
 #------------------------------------------------------------
 # Java ByteCode
 # From Larry Schwimmer (schwim@cs.stanford.edu)
-0      belong          0xcafebabe      compiled Java class data,
->6     beshort x       version %d.
->4     beshort x       \b%d
+# Handled in Mach now
+#0     belong          0xcafebabe      compiled Java class data,
+#>6    beshort x       version %d.
+#>4    beshort x       \b%d
 #------------------------------------------------------------
 # Java serialization
 # From Martin Pool (m.pool@pharos.com.au)
index d3fd4708397a59211bc86574c052208a2e3a60fd..6289a2da8a8b735c937147dfd0e7628b5a293edb 100644 (file)
@@ -1,21 +1,75 @@
 #------------------------------------------------------------------------------
 # mach file description
 #
-0      belong          0xcafebabe      Mach-O fat file
->4     belong          1               with 1 architecture
+# Since Java bytecode and Mach-O fat-files have the same magic number the test
+# must be preformed in the same "magic" sequence to get both right.  The long
+# at offset 4 in a fat file tells the number of architectures.  The short at
+# offset 4 in a Java bytecode file is the compiler minor version and the
+# short at offset 6 is the compiler major version.  Since there are only 
+# only 18 labeled Mach-O architectures at current, and the first released 
+# Java class format was version 43.0, we can safely choose any number
+# between 18 and 39 to test the number of architectures against
+# (and use as a hack).
+#
+0      belong          0xcafebabe
+>4     belong          >19             compiled Java class data,
+>>6     beshort                x               version %d.
+>>4     beshort                x               \b%d
+>4     belong          1               Mach-O fat file with 1 architecture
 >4     belong          >1
->>4    belong          x               with %ld architectures          
+# The following is necessary to support java class files.
+>>4    belong          <20             Mach-O fat file with %ld architectures
+#>>4   belong          <0xffff         Mach-O fat file with %ld architectures
+#
+0      lelong&0xfeffffff       0xfeedface      Mach-O
+>0     byte            0xcf            64-bit
+>12    lelong          1               object
+>12    lelong          2               executable
+>12    lelong          3               fixed virtual memory shared library
+>12    lelong          4               core
+>12    lelong          5               preload executable
+>12    lelong          6               dynamically linked shared library
+>12    lelong          7               dynamic linker
+>12    lelong          8               bundle
+>12    lelong          9               dynamically linked shared library stub
+>12    lelong          >9
+>>12   lelong          x               filetype=%ld
+>4     lelong          <0
+>>4    lelong          x               architecture=%ld
+>4     lelong          1               vax
+>4     lelong          2               romp
+>4     lelong          3               architecture=3
+>4     lelong          4               ns32032
+>4     lelong          5               ns32332
+>4     lelong          6               m68k
+>4     lelong          7               i386
+>4     lelong          8               mips
+>4     lelong          9               ns32532
+>4     lelong          10              architecture=10
+>4     lelong          11              hppa
+>4     lelong          12              acorn
+>4     lelong          13              m88k
+>4     lelong          14              sparc
+>4     lelong          15              i860-big
+>4     lelong          16              i860
+>4     lelong          17              rs6000
+>4     lelong          18              ppc
+>4     lelong          16777234        ppc64
+>4     lelong          >16777234
+>>4    lelong          x               architecture=%ld
 #
-0      belong          0xfeedface      Mach-O
+0      belong&0xfffffffe       0xfeedface      Mach-O
+>3     byte            0xcf            64-bit
 >12    belong          1               object
 >12    belong          2               executable
->12    belong          3               shared library
+>12    belong          3               fixed virtual memory shared library
 >12    belong          4               core
 >12    belong          5               preload executable
 >12    belong          6               dynamically linked shared library
 >12    belong          7               dynamic linker
 >12    belong          8               bundle
->12    belong          >8
+>12    belong          9               dynamically linked shared library stub
+>12    belong          >9
 >>12   belong          x               filetype=%ld
 >4     belong          <0
 >>4    belong          x               architecture=%ld
@@ -34,7 +88,7 @@
 >4     belong          8               mips
 >4     belong          9               ns32532
 >4     belong          10              architecture=10
->4     belong          11              hp pa-risc
+>4     belong          11              hppa
 >4     belong          12              acorn
 >4     belong          13              m88k
 >4     belong          14              sparc
@@ -42,5 +96,6 @@
 >4     belong          16              i860
 >4     belong          17              rs6000
 >4     belong          18              ppc
->4     belong          >18
+>4     belong          16777234        ppc64
+>4     belong          >16777234
 >>4    belong          x               architecture=%ld