35 #else
36 #include <stdio.h>
37 #endif
38
39 #include "libdisasm_impl.h"
40
41 static int _dis_errno;
42
43 /*
44 * If we're building the standalone library, then we only want to
45 * include support for disassembly of the native architecture.
46 * The regular shared library should include support for all
47 * architectures.
48 */
49 #if !defined(DIS_STANDALONE) || defined(__i386) || defined(__amd64)
50 extern dis_arch_t dis_arch_i386;
51 #endif
52 #if !defined(DIS_STANDALONE) || defined(__sparc)
53 extern dis_arch_t dis_arch_sparc;
54 #endif
55
56 static dis_arch_t *dis_archs[] = {
57 #if !defined(DIS_STANDALONE) || defined(__i386) || defined(__amd64)
58 &dis_arch_i386,
59 #endif
60 #if !defined(DIS_STANDALONE) || defined(__sparc)
61 &dis_arch_sparc,
62 #endif
63 NULL
64 };
65
66 /*
67 * For the standalone library, we need to link against mdb's malloc/free.
68 * Otherwise, use the standard malloc/free.
69 */
70 #ifdef DIS_STANDALONE
71 void *
72 dis_zalloc(size_t bytes)
73 {
74 return (mdb_zalloc(bytes, UM_SLEEP));
75 }
76
77 void
78 dis_free(void *ptr, size_t bytes)
79 {
80 mdb_free(ptr, bytes);
81 }
|
35 #else
36 #include <stdio.h>
37 #endif
38
39 #include "libdisasm_impl.h"
40
41 static int _dis_errno;
42
43 /*
44 * If we're building the standalone library, then we only want to
45 * include support for disassembly of the native architecture.
46 * The regular shared library should include support for all
47 * architectures.
48 */
49 #if !defined(DIS_STANDALONE) || defined(__i386) || defined(__amd64)
50 extern dis_arch_t dis_arch_i386;
51 #endif
52 #if !defined(DIS_STANDALONE) || defined(__sparc)
53 extern dis_arch_t dis_arch_sparc;
54 #endif
55 #if !defined(DIS_STANDALONE) || defined(__s390) || defined(__s390x)
56 extern dis_arch_t dis_arch_s390;
57 #endif
58
59 static dis_arch_t *dis_archs[] = {
60 #if !defined(DIS_STANDALONE) || defined(__i386) || defined(__amd64)
61 &dis_arch_i386,
62 #endif
63 #if !defined(DIS_STANDALONE) || defined(__sparc)
64 &dis_arch_sparc,
65 #endif
66 #if !defined(DIS_STANDALONE) || defined(__s390) || defined(__s390x)
67 &dis_arch_s390,
68 #endif
69 NULL
70 };
71
72 /*
73 * For the standalone library, we need to link against mdb's malloc/free.
74 * Otherwise, use the standard malloc/free.
75 */
76 #ifdef DIS_STANDALONE
77 void *
78 dis_zalloc(size_t bytes)
79 {
80 return (mdb_zalloc(bytes, UM_SLEEP));
81 }
82
83 void
84 dis_free(void *ptr, size_t bytes)
85 {
86 mdb_free(ptr, bytes);
87 }
|