Sat, 03 Jan 2015 20:18:00 +0100
Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.
michael@0 | 1 | %module x86disasm |
michael@0 | 2 | %{ |
michael@0 | 3 | #include "../../libdis.h" |
michael@0 | 4 | #include "../../../config.h" |
michael@0 | 5 | %} |
michael@0 | 6 | |
michael@0 | 7 | %rename(version_string) x86_version_string; |
michael@0 | 8 | %include "../../libdis.h" |
michael@0 | 9 | #include "../../../config.h" |
michael@0 | 10 | |
michael@0 | 11 | %inline %{ |
michael@0 | 12 | const char * x86_version_string( void ) { |
michael@0 | 13 | return PACKAGE_VERSION; |
michael@0 | 14 | } |
michael@0 | 15 | %} |
michael@0 | 16 | |
michael@0 | 17 | %rename(report_codes) x86_report_codes; |
michael@0 | 18 | %rename(report_error) x86_report_error; |
michael@0 | 19 | %rename(options) x86_options; |
michael@0 | 20 | %rename(init) x86_init; |
michael@0 | 21 | %rename(set_reporter) x86_set_reporter; |
michael@0 | 22 | %rename(set_options) x86_set_options; |
michael@0 | 23 | %rename(options) x86_get_options; |
michael@0 | 24 | %rename(cleanup) x86_cleanup; |
michael@0 | 25 | %rename(reg_type) x86_reg_type; |
michael@0 | 26 | %rename(reg) x86_reg_t; |
michael@0 | 27 | %rename(eaddr) x86_ea_t; |
michael@0 | 28 | %rename(op_type) x86_op_type; |
michael@0 | 29 | %rename(optype_is_address) x86_optype_is_address; |
michael@0 | 30 | %rename(optype_is_relative) x86_optype_is_relative; |
michael@0 | 31 | %rename(op_datatype) x86_op_datatype; |
michael@0 | 32 | %rename(op_access) x86_op_access; |
michael@0 | 33 | %rename(op_flags) x86_op_flags; |
michael@0 | 34 | %rename(operand) x86_op_t; |
michael@0 | 35 | %rename(insn_group) x86_insn_group; |
michael@0 | 36 | %rename(insn_type) x86_insn_type; |
michael@0 | 37 | %rename(insn_note) x86_insn_note ; |
michael@0 | 38 | %rename(flag_status) x86_flag_status; |
michael@0 | 39 | %rename(insn_cpu) x86_insn_cpu ; |
michael@0 | 40 | %rename(insn_isa) x86_insn_isa ; |
michael@0 | 41 | %rename(insn_prefix) x86_insn_prefix ; |
michael@0 | 42 | %rename(insn) x86_insn_t; |
michael@0 | 43 | %rename(insn_is_valid) x86_insn_is_valid; |
michael@0 | 44 | %rename(i_disasm) x86_disasm; |
michael@0 | 45 | %rename(i_disasm_range) x86_disasm_range; |
michael@0 | 46 | %rename(i_disasm_forward) x86_disasm_forward; |
michael@0 | 47 | %rename(insn_operand_count) x86_operand_count; |
michael@0 | 48 | %rename(insn_operand_1st) x86_operand_1st; |
michael@0 | 49 | %rename(insn_operand_2nd) x86_operand_2nd; |
michael@0 | 50 | %rename(insn_operand_3rd) x86_operand_3rd; |
michael@0 | 51 | %rename(insn_dest_operand) x86_get_dest_operand; |
michael@0 | 52 | %rename(insn_src_operand) x86_get_src_operand; |
michael@0 | 53 | %rename(insn_imm_operand) x86_get_imm_operand; |
michael@0 | 54 | %rename(operand_size) x86_operand_size; |
michael@0 | 55 | %rename(insn_rel_offset) x86_get_rel_offset; |
michael@0 | 56 | %rename(insn_branch_target) x86_get_branch_target; |
michael@0 | 57 | %rename(insn_imm) x86_get_imm; |
michael@0 | 58 | %rename(insn_raw_imm) x86_get_raw_imm; |
michael@0 | 59 | %rename(insn_set_addr) x86_set_insn_addr; |
michael@0 | 60 | %rename(insn_set_offset) x86_set_insn_offset; |
michael@0 | 61 | %rename(insn_set_function) x86_set_insn_function; |
michael@0 | 62 | %rename(insn_set_block) x86_set_insn_block; |
michael@0 | 63 | %rename(insn_tag) x86_tag_insn; |
michael@0 | 64 | %rename(insn_untag) x86_untag_insn; |
michael@0 | 65 | %rename(insn_is_tagged) x86_insn_is_tagged; |
michael@0 | 66 | %rename(asm_format) x86_asm_format; |
michael@0 | 67 | %rename(operand_format) x86_format_operand; |
michael@0 | 68 | %rename(insn_format_mnemonic) x86_format_mnemonic; |
michael@0 | 69 | %rename(insn_format) x86_format_insn; |
michael@0 | 70 | %rename(header_format) x86_format_header; |
michael@0 | 71 | %rename(endian) x86_endian; |
michael@0 | 72 | %rename(size_default_address) x86_addr_size; |
michael@0 | 73 | %rename(size_default_operand) x86_op_size; |
michael@0 | 74 | %rename(size_machine_word) x86_word_size; |
michael@0 | 75 | %rename(size_max_insn) x86_max_insn_size; |
michael@0 | 76 | %rename(reg_sp) x86_sp_reg; |
michael@0 | 77 | %rename(reg_fp) x86_fp_reg; |
michael@0 | 78 | %rename(reg_ip) x86_ip_reg; |
michael@0 | 79 | %rename(reg_from_id) x86_reg_from_id; |
michael@0 | 80 | %rename(reg_from_alias) x86_get_aliased_reg; |
michael@0 | 81 | %rename(invariant_op) x86_invariant_op_t; |
michael@0 | 82 | %rename(invariant) x86_invariant_t; |
michael@0 | 83 | %rename(disasm_invariant) x86_invariant_disasm; |
michael@0 | 84 | %rename(disasm_size) x86_size_disasm; |
michael@0 | 85 | |
michael@0 | 86 | %include "carrays.i" |
michael@0 | 87 | |
michael@0 | 88 | %array_class( unsigned char, byteArray ); |
michael@0 | 89 | |
michael@0 | 90 | |
michael@0 | 91 | %apply (unsigned char *STRING, int LENGTH) { |
michael@0 | 92 | (unsigned char *buf, size_t buf_len) |
michael@0 | 93 | }; |
michael@0 | 94 | |
michael@0 | 95 | |
michael@0 | 96 | %newobject x86_op_copy; |
michael@0 | 97 | %inline %{ |
michael@0 | 98 | x86_op_t * x86_op_copy( x86_op_t * src ) { |
michael@0 | 99 | x86_op_t *op; |
michael@0 | 100 | |
michael@0 | 101 | if (! src ) { |
michael@0 | 102 | return NULL; |
michael@0 | 103 | } |
michael@0 | 104 | |
michael@0 | 105 | op = (x86_op_t *) calloc( sizeof(x86_op_t), 1 ); |
michael@0 | 106 | if ( op ) { |
michael@0 | 107 | memcpy( op, src, sizeof(x86_op_t) ); |
michael@0 | 108 | } |
michael@0 | 109 | |
michael@0 | 110 | return op; |
michael@0 | 111 | } |
michael@0 | 112 | |
michael@0 | 113 | typedef struct x86_op_list_node { |
michael@0 | 114 | x86_op_t *op; |
michael@0 | 115 | struct x86_op_list_node *next, *prev; |
michael@0 | 116 | } x86_op_list_node; |
michael@0 | 117 | |
michael@0 | 118 | typedef struct x86_op_list { |
michael@0 | 119 | size_t count; |
michael@0 | 120 | x86_op_list_node *head, *tail, *curr; |
michael@0 | 121 | } x86_op_list; |
michael@0 | 122 | |
michael@0 | 123 | x86_op_list * x86_op_list_new () { |
michael@0 | 124 | x86_op_list *list = (x86_op_list *) |
michael@0 | 125 | calloc( sizeof(x86_op_list), 1 ); |
michael@0 | 126 | list->count = 0; |
michael@0 | 127 | return list; |
michael@0 | 128 | } |
michael@0 | 129 | |
michael@0 | 130 | void x86_op_list_free(x86_op_list *list) { |
michael@0 | 131 | x86_op_list_node *node, *next; |
michael@0 | 132 | |
michael@0 | 133 | node = list->head; |
michael@0 | 134 | while ( node ) { |
michael@0 | 135 | next = node->next; |
michael@0 | 136 | /* free( node->insn ); */ |
michael@0 | 137 | free( node ); |
michael@0 | 138 | node = next; |
michael@0 | 139 | } |
michael@0 | 140 | |
michael@0 | 141 | free( list ); |
michael@0 | 142 | } |
michael@0 | 143 | |
michael@0 | 144 | x86_op_list_node * x86_op_list_first(x86_op_list *list) { |
michael@0 | 145 | return list->head; |
michael@0 | 146 | } |
michael@0 | 147 | |
michael@0 | 148 | x86_op_list_node * x86_op_list_last(x86_op_list *list) { |
michael@0 | 149 | return list->tail; |
michael@0 | 150 | } |
michael@0 | 151 | |
michael@0 | 152 | x86_op_list_node * x86_op_list_next(x86_op_list *list) { |
michael@0 | 153 | if (! list->curr ) { |
michael@0 | 154 | list->curr = list->head; |
michael@0 | 155 | return list->head; |
michael@0 | 156 | } |
michael@0 | 157 | |
michael@0 | 158 | list->curr = list->curr->next; |
michael@0 | 159 | return list->curr; |
michael@0 | 160 | } |
michael@0 | 161 | |
michael@0 | 162 | x86_op_list_node * x86_op_list_prev(x86_op_list *list) { |
michael@0 | 163 | if (! list->curr ) { |
michael@0 | 164 | list->curr = list->tail; |
michael@0 | 165 | return list->tail; |
michael@0 | 166 | } |
michael@0 | 167 | |
michael@0 | 168 | list->curr = list->curr->prev; |
michael@0 | 169 | return list->curr; |
michael@0 | 170 | } |
michael@0 | 171 | |
michael@0 | 172 | %} |
michael@0 | 173 | |
michael@0 | 174 | %newobject x86_op_list_append; |
michael@0 | 175 | |
michael@0 | 176 | %inline %{ |
michael@0 | 177 | void x86_op_list_append( x86_op_list * list, x86_op_t *op ) { |
michael@0 | 178 | x86_op_list_node *node = (x86_op_list_node *) |
michael@0 | 179 | calloc( sizeof(x86_op_list_node) , 1 ); |
michael@0 | 180 | if (! node ) { |
michael@0 | 181 | return; |
michael@0 | 182 | } |
michael@0 | 183 | |
michael@0 | 184 | list->count++; |
michael@0 | 185 | if ( ! list->tail ) { |
michael@0 | 186 | list->head = list->tail = node; |
michael@0 | 187 | } else { |
michael@0 | 188 | list->tail->next = node; |
michael@0 | 189 | node->prev = list->tail; |
michael@0 | 190 | list->tail = node; |
michael@0 | 191 | } |
michael@0 | 192 | |
michael@0 | 193 | node->op = x86_op_copy( op ); |
michael@0 | 194 | } |
michael@0 | 195 | |
michael@0 | 196 | x86_oplist_t * x86_op_list_node_copy( x86_oplist_t * list ) { |
michael@0 | 197 | x86_oplist_t *ptr; |
michael@0 | 198 | ptr = (x86_oplist_t *) calloc( sizeof(x86_oplist_t), 1 ); |
michael@0 | 199 | if ( ptr ) { |
michael@0 | 200 | memcpy( &ptr->op, &list->op, sizeof(x86_op_t) ); |
michael@0 | 201 | } |
michael@0 | 202 | |
michael@0 | 203 | return ptr; |
michael@0 | 204 | } |
michael@0 | 205 | |
michael@0 | 206 | x86_insn_t * x86_insn_new() { |
michael@0 | 207 | x86_insn_t *insn = (x86_insn_t *) |
michael@0 | 208 | calloc( sizeof(x86_insn_t), 1 ); |
michael@0 | 209 | return insn; |
michael@0 | 210 | } |
michael@0 | 211 | |
michael@0 | 212 | void x86_insn_free( x86_insn_t *insn ) { |
michael@0 | 213 | x86_oplist_free( insn ); |
michael@0 | 214 | free( insn ); |
michael@0 | 215 | } |
michael@0 | 216 | %} |
michael@0 | 217 | |
michael@0 | 218 | %newobject x86_insn_copy; |
michael@0 | 219 | |
michael@0 | 220 | %inline %{ |
michael@0 | 221 | x86_insn_t * x86_insn_copy( x86_insn_t *src) { |
michael@0 | 222 | x86_oplist_t *ptr, *list, *last = NULL; |
michael@0 | 223 | x86_insn_t *insn = (x86_insn_t *) |
michael@0 | 224 | calloc( sizeof(x86_insn_t), 1 ); |
michael@0 | 225 | |
michael@0 | 226 | if ( insn ) { |
michael@0 | 227 | memcpy( insn, src, sizeof(x86_insn_t) ); |
michael@0 | 228 | insn->operands = NULL; |
michael@0 | 229 | insn->block = NULL; |
michael@0 | 230 | insn->function = NULL; |
michael@0 | 231 | |
michael@0 | 232 | /* copy operand list */ |
michael@0 | 233 | for ( list = src->operands; list; list = list->next ) { |
michael@0 | 234 | ptr = x86_op_list_node_copy( list ); |
michael@0 | 235 | |
michael@0 | 236 | if (! ptr ) { |
michael@0 | 237 | continue; |
michael@0 | 238 | } |
michael@0 | 239 | |
michael@0 | 240 | if ( insn->operands ) { |
michael@0 | 241 | last->next = ptr; |
michael@0 | 242 | } else { |
michael@0 | 243 | insn->operands = ptr; |
michael@0 | 244 | } |
michael@0 | 245 | last = ptr; |
michael@0 | 246 | } |
michael@0 | 247 | } |
michael@0 | 248 | |
michael@0 | 249 | return insn; |
michael@0 | 250 | } |
michael@0 | 251 | |
michael@0 | 252 | x86_op_list * x86_insn_op_list( x86_insn_t *insn ) { |
michael@0 | 253 | x86_oplist_t *list = insn->operands; |
michael@0 | 254 | x86_op_list *op_list = x86_op_list_new(); |
michael@0 | 255 | |
michael@0 | 256 | for ( list = insn->operands; list; list = list->next ) { |
michael@0 | 257 | x86_op_list_append( op_list, &list->op ); |
michael@0 | 258 | } |
michael@0 | 259 | |
michael@0 | 260 | return op_list; |
michael@0 | 261 | } |
michael@0 | 262 | |
michael@0 | 263 | typedef struct x86_insn_list_node { |
michael@0 | 264 | x86_insn_t *insn; |
michael@0 | 265 | struct x86_insn_list_node *next, *prev; |
michael@0 | 266 | } x86_insn_list_node; |
michael@0 | 267 | |
michael@0 | 268 | typedef struct x86_insn_list { |
michael@0 | 269 | size_t count; |
michael@0 | 270 | x86_insn_list_node *head, *tail, *curr; |
michael@0 | 271 | } x86_insn_list; |
michael@0 | 272 | |
michael@0 | 273 | %} |
michael@0 | 274 | |
michael@0 | 275 | %newobject x86_insn_list_new; |
michael@0 | 276 | |
michael@0 | 277 | %inline %{ |
michael@0 | 278 | x86_insn_list * x86_insn_list_new () { |
michael@0 | 279 | x86_insn_list *list = (x86_insn_list *) |
michael@0 | 280 | calloc( sizeof(x86_insn_list), 1 ); |
michael@0 | 281 | list->count = 0; |
michael@0 | 282 | return list; |
michael@0 | 283 | } |
michael@0 | 284 | |
michael@0 | 285 | void x86_insn_list_free( x86_insn_list * list ) { |
michael@0 | 286 | x86_insn_list_node *node, *next; |
michael@0 | 287 | |
michael@0 | 288 | if (! list ) { |
michael@0 | 289 | return; |
michael@0 | 290 | } |
michael@0 | 291 | |
michael@0 | 292 | node = list->head; |
michael@0 | 293 | while ( node ) { |
michael@0 | 294 | next = node->next; |
michael@0 | 295 | /* free( node->insn ); */ |
michael@0 | 296 | free( node ); |
michael@0 | 297 | node = next; |
michael@0 | 298 | } |
michael@0 | 299 | |
michael@0 | 300 | free( list ); |
michael@0 | 301 | } |
michael@0 | 302 | |
michael@0 | 303 | x86_insn_list_node * x86_insn_list_first( x86_insn_list *list ) { |
michael@0 | 304 | if (! list ) { |
michael@0 | 305 | return NULL; |
michael@0 | 306 | } |
michael@0 | 307 | return list->head; |
michael@0 | 308 | } |
michael@0 | 309 | |
michael@0 | 310 | x86_insn_list_node * x86_insn_list_last( x86_insn_list *list ) { |
michael@0 | 311 | if (! list ) { |
michael@0 | 312 | return NULL; |
michael@0 | 313 | } |
michael@0 | 314 | return list->tail; |
michael@0 | 315 | } |
michael@0 | 316 | |
michael@0 | 317 | x86_insn_list_node * x86_insn_list_next( x86_insn_list *list ) { |
michael@0 | 318 | if (! list ) { |
michael@0 | 319 | return NULL; |
michael@0 | 320 | } |
michael@0 | 321 | if (! list->curr ) { |
michael@0 | 322 | list->curr = list->head; |
michael@0 | 323 | return list->head; |
michael@0 | 324 | } |
michael@0 | 325 | |
michael@0 | 326 | list->curr = list->curr->next; |
michael@0 | 327 | return list->curr; |
michael@0 | 328 | } |
michael@0 | 329 | |
michael@0 | 330 | x86_insn_list_node * x86_insn_list_prev( x86_insn_list *list ) { |
michael@0 | 331 | if (! list ) { |
michael@0 | 332 | return NULL; |
michael@0 | 333 | } |
michael@0 | 334 | if (! list->curr ) { |
michael@0 | 335 | list->curr = list->tail; |
michael@0 | 336 | return list->tail; |
michael@0 | 337 | } |
michael@0 | 338 | |
michael@0 | 339 | list->curr = list->curr->prev; |
michael@0 | 340 | return list->curr; |
michael@0 | 341 | } |
michael@0 | 342 | |
michael@0 | 343 | %} |
michael@0 | 344 | |
michael@0 | 345 | %newobject x86_insn_list_append; |
michael@0 | 346 | |
michael@0 | 347 | %inline %{ |
michael@0 | 348 | void x86_insn_list_append( x86_insn_list *list, x86_insn_t *insn ) { |
michael@0 | 349 | x86_insn_list_node *node; |
michael@0 | 350 | if (! list ) { |
michael@0 | 351 | return; |
michael@0 | 352 | } |
michael@0 | 353 | |
michael@0 | 354 | node = (x86_insn_list_node *) |
michael@0 | 355 | calloc( sizeof(x86_insn_list_node) , 1 ); |
michael@0 | 356 | |
michael@0 | 357 | if (! node ) { |
michael@0 | 358 | return; |
michael@0 | 359 | } |
michael@0 | 360 | |
michael@0 | 361 | list->count++; |
michael@0 | 362 | if ( ! list->tail ) { |
michael@0 | 363 | list->head = list->tail = node; |
michael@0 | 364 | } else { |
michael@0 | 365 | list->tail->next = node; |
michael@0 | 366 | node->prev = list->tail; |
michael@0 | 367 | list->tail = node; |
michael@0 | 368 | } |
michael@0 | 369 | |
michael@0 | 370 | node->insn = x86_insn_copy( insn ); |
michael@0 | 371 | } |
michael@0 | 372 | |
michael@0 | 373 | typedef struct { |
michael@0 | 374 | enum x86_report_codes last_error; |
michael@0 | 375 | void * last_error_data; |
michael@0 | 376 | void * disasm_callback; |
michael@0 | 377 | void * disasm_resolver; |
michael@0 | 378 | } x86disasm; |
michael@0 | 379 | |
michael@0 | 380 | void x86_default_reporter( enum x86_report_codes code, |
michael@0 | 381 | void *data, void *arg ) { |
michael@0 | 382 | x86disasm *dis = (x86disasm *) arg; |
michael@0 | 383 | if ( dis ) { |
michael@0 | 384 | dis->last_error = code; |
michael@0 | 385 | dis->last_error_data = data; |
michael@0 | 386 | } |
michael@0 | 387 | } |
michael@0 | 388 | |
michael@0 | 389 | void x86_default_callback( x86_insn_t *insn, void *arg ) { |
michael@0 | 390 | x86_insn_list *list = (x86_insn_list *) arg; |
michael@0 | 391 | if ( list ) { |
michael@0 | 392 | x86_insn_list_append( list, insn ); |
michael@0 | 393 | } |
michael@0 | 394 | } |
michael@0 | 395 | |
michael@0 | 396 | /* TODO: resolver stack, maybe a callback */ |
michael@0 | 397 | long x86_default_resolver( x86_op_t *op, x86_insn_t *insn, void *arg ) { |
michael@0 | 398 | x86disasm *dis = (x86disasm *) arg; |
michael@0 | 399 | if ( dis ) { |
michael@0 | 400 | //return dis->resolver( op, insn ); |
michael@0 | 401 | return 0; |
michael@0 | 402 | } |
michael@0 | 403 | |
michael@0 | 404 | return 0; |
michael@0 | 405 | } |
michael@0 | 406 | |
michael@0 | 407 | |
michael@0 | 408 | %} |
michael@0 | 409 | |
michael@0 | 410 | %newobject x86disasm_new; |
michael@0 | 411 | |
michael@0 | 412 | %inline %{ |
michael@0 | 413 | x86disasm * x86disasm_new ( enum x86_options options ) { |
michael@0 | 414 | x86disasm * dis = (x86disasm *) |
michael@0 | 415 | calloc( sizeof( x86disasm ), 1 ); |
michael@0 | 416 | x86_init( options, x86_default_reporter, dis ); |
michael@0 | 417 | return dis; |
michael@0 | 418 | } |
michael@0 | 419 | |
michael@0 | 420 | void x86disasm_free( x86disasm * dis ) { |
michael@0 | 421 | x86_cleanup(); |
michael@0 | 422 | free( dis ); |
michael@0 | 423 | } |
michael@0 | 424 | %} |
michael@0 | 425 | |
michael@0 | 426 | %newobject x86_disasm; |
michael@0 | 427 | |
michael@0 | 428 | %inline %{ |
michael@0 | 429 | x86_insn_t * disasm( unsigned char *buf, size_t buf_len, |
michael@0 | 430 | unsigned long buf_rva, unsigned int offset ) { |
michael@0 | 431 | x86_insn_t *insn = calloc( sizeof( x86_insn_t ), 1 ); |
michael@0 | 432 | x86_disasm( buf, buf_len, buf_rva, offset, insn ); |
michael@0 | 433 | return insn; |
michael@0 | 434 | } |
michael@0 | 435 | |
michael@0 | 436 | int disasm_range( unsigned char *buf, size_t buf_len, |
michael@0 | 437 | unsigned long buf_rva, unsigned int offset, |
michael@0 | 438 | unsigned int len ) { |
michael@0 | 439 | |
michael@0 | 440 | x86_insn_list *list = x86_insn_list_new(); |
michael@0 | 441 | |
michael@0 | 442 | if ( len > buf_len ) { |
michael@0 | 443 | len = buf_len; |
michael@0 | 444 | } |
michael@0 | 445 | |
michael@0 | 446 | return x86_disasm_range( buf, buf_rva, offset, len, |
michael@0 | 447 | x86_default_callback, list ); |
michael@0 | 448 | } |
michael@0 | 449 | |
michael@0 | 450 | int disasm_forward( unsigned char *buf, size_t buf_len, |
michael@0 | 451 | unsigned long buf_rva, unsigned int offset ) { |
michael@0 | 452 | x86_insn_list *list = x86_insn_list_new(); |
michael@0 | 453 | |
michael@0 | 454 | /* use default resolver: damn SWIG callbacks! */ |
michael@0 | 455 | return x86_disasm_forward( buf, buf_len, buf_rva, offset, |
michael@0 | 456 | x86_default_callback, list, |
michael@0 | 457 | x86_default_resolver, NULL ); |
michael@0 | 458 | } |
michael@0 | 459 | |
michael@0 | 460 | size_t disasm_invariant( unsigned char *buf, size_t buf_len, |
michael@0 | 461 | x86_invariant_t *inv ) { |
michael@0 | 462 | return x86_invariant_disasm( buf, buf_len, inv ); |
michael@0 | 463 | } |
michael@0 | 464 | |
michael@0 | 465 | size_t disasm_size( unsigned char *buf, size_t buf_len ) { |
michael@0 | 466 | return x86_size_disasm( buf, buf_len ); |
michael@0 | 467 | } |
michael@0 | 468 | |
michael@0 | 469 | int x86_max_operand_string( enum x86_asm_format format ) { |
michael@0 | 470 | switch ( format ) { |
michael@0 | 471 | case xml_syntax: |
michael@0 | 472 | return MAX_OP_XML_STRING; |
michael@0 | 473 | break; |
michael@0 | 474 | case raw_syntax: |
michael@0 | 475 | return MAX_OP_RAW_STRING; |
michael@0 | 476 | break; |
michael@0 | 477 | case native_syntax: |
michael@0 | 478 | case intel_syntax: |
michael@0 | 479 | case att_syntax: |
michael@0 | 480 | case unknown_syntax: |
michael@0 | 481 | default: |
michael@0 | 482 | return MAX_OP_STRING; |
michael@0 | 483 | break; |
michael@0 | 484 | } |
michael@0 | 485 | } |
michael@0 | 486 | |
michael@0 | 487 | |
michael@0 | 488 | int x86_max_insn_string( enum x86_asm_format format ) { |
michael@0 | 489 | switch ( format ) { |
michael@0 | 490 | case xml_syntax: |
michael@0 | 491 | return MAX_INSN_XML_STRING; |
michael@0 | 492 | break; |
michael@0 | 493 | case raw_syntax: |
michael@0 | 494 | return MAX_INSN_RAW_STRING; |
michael@0 | 495 | break; |
michael@0 | 496 | case native_syntax: |
michael@0 | 497 | case intel_syntax: |
michael@0 | 498 | case att_syntax: |
michael@0 | 499 | case unknown_syntax: |
michael@0 | 500 | default: |
michael@0 | 501 | return MAX_INSN_STRING; |
michael@0 | 502 | break; |
michael@0 | 503 | } |
michael@0 | 504 | } |
michael@0 | 505 | |
michael@0 | 506 | int x86_max_num_operands( ) { return MAX_NUM_OPERANDS; } |
michael@0 | 507 | %} |
michael@0 | 508 |