summaryrefslogtreecommitdiff
path: root/src/arch/dalvik/operand.c
blob: e1a910c6ce350a30e45f41524a6992effec52070 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752

/* Chrysalide - Outil d'analyse de fichiers binaires
 * operand.c - aide à la création d'opérandes Dalvik
 *
 * Copyright (C) 2010-2012 Cyrille Bagard
 *
 *  This file is part of Chrysalide.
 *
 *  Chrysalide is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  Chrysalide is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with Foobar.  If not, see <http://www.gnu.org/licenses/>.
 */


#include "operand.h"


#include <assert.h>
#include <malloc.h>
#include <stdarg.h>



/* Liste de tous les types d'opérandes */
typedef enum _DalvikOperandID
{
    DOI_INVALID,

    DOI_REGISTER_4,
    DOI_REGISTER_8,
    DOI_REGISTER_16,

    DOI_IMMEDIATE_4,
    DOI_IMMEDIATE_8,
    DOI_IMMEDIATE_16,
    DOI_IMMEDIATE_32,
    DOI_IMMEDIATE_64,
    DOI_IMMEDIATE_H16,

    DOI_POOL_CONST,
    DOI_POOL_CONST_WIDE,

    DOI_TARGET_8,
    DOI_TARGET_16,
    DOI_TARGET_32

} DalvikOperandID;


/* Crée un opérande visant une instruction Dalvik. */
static GArchOperand *dalvik_build_target_operand(const GBinContent *, vmpa2t *, MemoryDataSize , SourceEndian, const vmpa2t *);

/* Procède à la lecture d'opérandes pour une instruction. */
static bool dalvik_read_basic_operands(GArchInstruction *, GDexFormat *, const GBinContent *, vmpa2t *, bool *, SourceEndian, DalvikOperandType, ...);

/* Procède à la lecture d'opérandes pour une instruction. */
static bool dalvik_read_fixed_operands(GArchInstruction *, GDexFormat *, const GBinContent *, vmpa2t *, bool *, SourceEndian, DalvikOperandType);

/* Procède à la lecture d'opérandes pour une instruction. */
static bool dalvik_read_variatic_operands(GArchInstruction *, GDexFormat *, const GBinContent *, vmpa2t *, bool *, SourceEndian, DalvikOperandType);



/******************************************************************************
*                                                                             *
*  Paramètres  : content = flux de données à analyser.                        *
*                pos     = position courante dans ce flux. [OUT]              *
*                size    = taille de l'opérande.                              *
*                endian  = ordre des bits dans la source.                     *
*                base    = adresse de référence pour le calcul.               *
*                                                                             *
*  Description : Crée un opérande visant une instruction Dalvik.              *
*                                                                             *
*  Retour      : Opérande mis en place.                                       *
*                                                                             *
*  Remarques   : -                                                            *
*                                                                             *
******************************************************************************/

static GArchOperand *dalvik_build_target_operand(const GBinContent *content, vmpa2t *pos, MemoryDataSize size, SourceEndian endian, const vmpa2t *base)
{
    GArchOperand *result;                   /* Structure à retourner       */
    phys_t offset;                          /* Emplacement de base         */
    int8_t val8;                            /* Valeur sur 8 bits           */
    int16_t val16;                          /* Valeur sur 16 bits          */
    int32_t val32;                          /* Valeur sur 32 bits          */
    bool test;                              /* Bilan de lecture            */
    phys_t address;                         /* Adresse finale visée        */

    offset = get_phy_addr(base);

    switch (size)
    {
        case MDS_8_BITS_SIGNED:
            test = g_binary_content_read_s8(content, pos, &val8);
            address = offset + val8 * sizeof(uint16_t);
            break;
        case MDS_16_BITS_SIGNED:
            test = g_binary_content_read_s16(content, pos, endian, &val16);
            address = offset + val16 * sizeof(uint16_t);
            break;
        case MDS_32_BITS_SIGNED:
            test = g_binary_content_read_s32(content, pos, endian, &val32);
            address = offset + val32 * sizeof(uint16_t);
            break;
        default:
            test = false;
            break;
    }

    if (!test)
        return NULL;

    result = g_imm_operand_new_from_value(MDS_32_BITS, address);

    return result;

}


/******************************************************************************
*                                                                             *
*  Paramètres  : instr   = instruction dont la définition est incomplète.[OUT]*
*                format  = format du fichier contenant le code.               *
*                content = flux de données à analyser.                        *
*                pos     = position courante dans ce flux. [OUT]              *
*                low     = position éventuelle des 4 bits visés. [OUT]        *
*                endian  = boutisme lié au binaire accompagnant.              *
*                model   = type d'opérandes attendues.                        *
*                ...     = éventuels arguments complémentaires.               *
*                                                                             *
*  Description : Procède à la lecture d'opérandes pour une instruction.       *
*                                                                             *
*  Retour      : Bilan de l'opération : true en cas de succès, false sinon.   *
*                                                                             *
*  Remarques   : -                                                            *
*                                                                             *
******************************************************************************/

static bool dalvik_read_basic_operands(GArchInstruction *instr, GDexFormat *format, const GBinContent *content, vmpa2t *pos, bool *low, SourceEndian endian, DalvikOperandType model, ...)
{
    bool result;                            /* Bilan à retourner           */
    DalvikOperandID *types;                 /* Liste des chargements       */
    DalvikOperandID *iter;                  /* Boucle de parcours          */
    GArchOperand *op;                       /* Opérande unique décodé      */
    uint16_t value16;                       /* Valeur sur 16 bits          */
    DalvikPoolType pool_type;               /* Type de table à manipuler   */
    va_list ap;                             /* Arguments complémentaires   */
    const vmpa2t *base;                     /* Base pour les sauts de code */

    result = true;

    /* Choix des opérandes à charger */

    switch (model & ~DALVIK_OP_EXTRA_MASK)
    {
        case DALVIK_OPT_10T:
            types = (DalvikOperandID []) {
                DOI_TARGET_8,
                DOI_INVALID
            };
            break;

        case DALVIK_OPT_11N:
            types = (DalvikOperandID []) {
                DOI_REGISTER_4,
                DOI_IMMEDIATE_4,
                DOI_INVALID
            };
            break;

        case DALVIK_OPT_11X:
            types = (DalvikOperandID []) {
                DOI_REGISTER_8,
                DOI_INVALID
            };
            break;

        case DALVIK_OPT_12X:
            types = (DalvikOperandID []) {
                DOI_REGISTER_4,
                DOI_REGISTER_4,
                DOI_INVALID
            };
            break;

        case DALVIK_OPT_20T:
            types = (DalvikOperandID []) {
                DOI_TARGET_16,
                DOI_INVALID
            };
            break;

        case DALVIK_OPT_21C:
            types = (DalvikOperandID []) {
                DOI_REGISTER_8,
                DOI_POOL_CONST,
                DOI_INVALID
            };
            break;

        case DALVIK_OPT_21H:
            types = (DalvikOperandID []) {
                DOI_REGISTER_8,
                DOI_IMMEDIATE_H16,
                DOI_INVALID
            };
            break;

        case DALVIK_OPT_21S:
            types = (DalvikOperandID []) {
                DOI_REGISTER_8,
                DOI_IMMEDIATE_16,
                DOI_INVALID
            };
            break;

        case DALVIK_OPT_21T:
            types = (DalvikOperandID []) {
                DOI_REGISTER_8,
                DOI_TARGET_16,
                DOI_INVALID
            };
            break;

        case DALVIK_OPT_22B:
            types = (DalvikOperandID []) {
                DOI_REGISTER_8,
                DOI_REGISTER_8,
                DOI_IMMEDIATE_8,
                DOI_INVALID
            };
            break;

        case DALVIK_OPT_22C:
            types = (DalvikOperandID []) {
                DOI_REGISTER_4,
                DOI_REGISTER_4,
                DOI_POOL_CONST,
                DOI_INVALID
            };
            break;

        case DALVIK_OPT_22S:
            types = (DalvikOperandID []) {
                DOI_REGISTER_4,
                DOI_REGISTER_4,
                DOI_IMMEDIATE_16,
                DOI_INVALID
            };
            break;

        case DALVIK_OPT_22T:
            types = (DalvikOperandID []) {
                DOI_REGISTER_4,
                DOI_REGISTER_4,
                DOI_TARGET_16,
                DOI_INVALID
            };
            break;

        case DALVIK_OPT_22X:
            types = (DalvikOperandID []) {
                DOI_REGISTER_8,
                DOI_REGISTER_16,
                DOI_INVALID
            };
            break;

        case DALVIK_OPT_23X:
            types = (DalvikOperandID []) {
                DOI_REGISTER_8,
                DOI_REGISTER_8,
                DOI_REGISTER_8,
                DOI_INVALID
            };
            break;

        case DALVIK_OPT_30T:
            types = (DalvikOperandID []) {
                DOI_TARGET_32,
                DOI_INVALID
            };
            break;

        case DALVIK_OPT_31C:
            types = (DalvikOperandID []) {
                DOI_REGISTER_8,
                DOI_POOL_CONST_WIDE,
                DOI_INVALID
            };
            break;

        case DALVIK_OPT_31I:
            types = (DalvikOperandID []) {
                DOI_REGISTER_8,
                DOI_IMMEDIATE_32,
                DOI_INVALID
            };
            break;

        case DALVIK_OPT_31T:
            types = (DalvikOperandID []) {
                DOI_REGISTER_8,
                DOI_TARGET_32,
                DOI_INVALID
            };
            break;

        case DALVIK_OPT_32X:
            types = (DalvikOperandID []) {
                DOI_REGISTER_16,
                DOI_REGISTER_16,
                DOI_INVALID
            };
            break;

        case DALVIK_OPT_51L:
            types = (DalvikOperandID []) {
                DOI_REGISTER_8,
                DOI_IMMEDIATE_64,
                DOI_INVALID
            };
            break;

        default:
            types = (DalvikOperandID []) {
                DOI_INVALID
            };
            break;

    }

    /* Chargement des opérandes */

    for (iter = types; *iter != G_TYPE_INVALID && result; iter++)
    {
        op = NULL;  /* Nul de GCC */

        switch (*iter)
        {
            case DOI_REGISTER_4:
                op = g_dalvik_register_operand_new(content, pos, low, MDS_4_BITS, endian);
                break;

            case DOI_REGISTER_8:
                op = g_dalvik_register_operand_new(content, pos, NULL, MDS_8_BITS, endian);
                break;

            case DOI_REGISTER_16:
                op = g_dalvik_register_operand_new(content, pos, NULL, MDS_16_BITS, endian);
                break;

            case DOI_IMMEDIATE_4:
                op = _g_imm_operand_new_from_data(MDS_4_BITS, content, pos, low, endian);
                break;

            case DOI_IMMEDIATE_8:
                op = g_imm_operand_new_from_data(MDS_8_BITS, content, pos, endian);
                break;

            case DOI_IMMEDIATE_16:
                op = g_imm_operand_new_from_data(MDS_16_BITS, content, pos, endian);
                break;

            case DOI_IMMEDIATE_32:
                op = g_imm_operand_new_from_data(MDS_32_BITS, content, pos, endian);
                break;

            case DOI_IMMEDIATE_64:
                op = g_imm_operand_new_from_data(MDS_64_BITS, content, pos, endian);
                break;

            case DOI_IMMEDIATE_H16:
                result = g_binary_content_read_u16(content, pos, endian, &value16);
                if (result)
                    op = g_imm_operand_new_from_value(MDS_32_BITS_SIGNED, ((uint32_t)value16) << 16);
                break;

            case DOI_POOL_CONST:
                pool_type = DALVIK_OP_GET_POOL(model);
                op = g_dalvik_pool_operand_new(format, pool_type, content, pos, MDS_16_BITS, endian);
                break;

            case DOI_POOL_CONST_WIDE:
                pool_type = DALVIK_OP_GET_POOL(model);
                op = g_dalvik_pool_operand_new(format, pool_type, content, pos, MDS_32_BITS, endian);
                break;

            case DOI_TARGET_8:
                va_start(ap, model);
                base = va_arg(ap, const vmpa2t *);
                op = dalvik_build_target_operand(content, pos, MDS_8_BITS_SIGNED, endian, base);
                va_end(ap);
                break;

            case DOI_TARGET_16:
                va_start(ap, model);
                base = va_arg(ap, const vmpa2t *);
                op = dalvik_build_target_operand(content, pos, MDS_16_BITS_SIGNED, endian, base);
                va_end(ap);
                break;

            case DOI_TARGET_32:
                va_start(ap, model);
                base = va_arg(ap, const vmpa2t *);
                op = dalvik_build_target_operand(content, pos, MDS_32_BITS_SIGNED, endian, base);
                va_end(ap);
                break;

            default:
                op = NULL;
                break;

        }

        if (op == NULL) result = false;
        else g_arch_instruction_attach_extra_operand(instr, op);

    }

    return result;

}


/******************************************************************************
*                                                                             *
*  Paramètres  : instr   = instruction dont la définition est incomplète.[OUT]*
*                format  = format du fichier contenant le code.               *
*                content = flux de données à analyser.                        *
*                pos     = position courante dans ce flux. [OUT]              *
*                low     = position éventuelle des 4 bits visés. [OUT]        *
*                endian  = boutisme lié au binaire accompagnant.              *
*                model   = type d'opérandes attendues.                        *
*                                                                             *
*  Description : Procède à la lecture d'opérandes pour une instruction.       *
*                                                                             *
*  Retour      : Bilan de l'opération : true en cas de succès, false sinon.   *
*                                                                             *
*  Remarques   : -                                                            *
*                                                                             *
******************************************************************************/

static bool dalvik_read_fixed_operands(GArchInstruction *instr, GDexFormat *format, const GBinContent *content, vmpa2t *pos, bool *low, SourceEndian endian, DalvikOperandType model)
{
    GArchOperand *opg;                      /* Opérande G décodé           */
    uint8_t a;                              /* Nbre. de registres utilisés */
    GArchOperand *target;                  /* Opérande visant la table #1 */
    GArchOperand *args;                     /* Liste des opérandes         */
    uint8_t i;                              /* Boucle de parcours          */
    GArchOperand *op;                       /* Opérande unique décodé      */

    opg = g_dalvik_register_operand_new(content, pos, low, MDS_4_BITS, endian);

    if (!g_binary_content_read_u4(content, pos, low, &a))
        goto err_va;

    if (a == 5 && opg == NULL)
        goto err_no_opg;

    target = g_dalvik_pool_operand_new(format, DALVIK_OP_GET_POOL(model), content, pos, MDS_16_BITS, endian);
    if (target == NULL) goto err_target;

    /* Mise en place des arguments */

    args = g_dalvik_args_operand_new();

    for (i = 0; i < MIN(a, 4); i++)
    {
        op = g_dalvik_register_operand_new(content, pos, low, MDS_4_BITS, endian);
        if (op == NULL) goto err_registers;

        args = G_ARCH_OPERAND(g_dalvik_args_operand_add(G_DALVIK_ARGS_OPERAND(args), op, NULL));

    }

    /* Consommation pleine et entière */

    for (; i < 4; i++)
        if (!g_binary_content_read_u4(content, pos, low, (uint8_t []) { 0 }))
            goto err_padding;

    /* Rajout des éléments finaux déjà chargés */

    if (a == 5)
        args = G_ARCH_OPERAND(g_dalvik_args_operand_add(G_DALVIK_ARGS_OPERAND(args), opg, NULL));

    else
    {
        if (opg != NULL)
            g_object_unref(G_OBJECT(opg));
    }

    g_arch_instruction_attach_extra_operand(instr, args);

    /* Rajout de la cible */

    g_arch_instruction_attach_extra_operand(instr, target);

    return true;

 err_padding:

 err_registers:

    g_object_unref(G_OBJECT(target));

 err_target:

    if (opg != NULL)
        g_object_unref(G_OBJECT(opg));

 err_no_opg:
 err_va:

    return false;

}


/******************************************************************************
*                                                                             *
*  Paramètres  : instr   = instruction dont la définition est incomplète.[OUT]*
*                format  = format du fichier contenant le code.               *
*                content = flux de données à analyser.                        *
*                pos     = position courante dans ce flux. [OUT]              *
*                low     = position éventuelle des 4 bits visés. [OUT]        *
*                endian  = boutisme lié au binaire accompagnant.              *
*                model   = type d'opérandes attendues.                        *
*                                                                             *
*  Description : Procède à la lecture d'opérandes pour une instruction.       *
*                                                                             *
*  Retour      : Bilan de l'opération : true en cas de succès, false sinon.   *
*                                                                             *
*  Remarques   : -                                                            *
*                                                                             *
******************************************************************************/

static bool dalvik_read_variatic_operands(GArchInstruction *instr, GDexFormat *format, const GBinContent *content, vmpa2t *pos, bool *low, SourceEndian endian, DalvikOperandType model)
{
    uint8_t a;                              /* Nbre. de registres utilisés */
    uint16_t c;                             /* Indice de registre          */
    GArchOperand *target;                   /* Opérande visant la table    */
    GArchOperand *args;                     /* Liste des opérandes         */
    uint8_t i;                              /* Boucle de parcours          */
    GArchOperand *op;                       /* Opérande unique décodé      */

    if (!g_binary_content_read_u8(content, pos, &a))
        return false;

    target = g_dalvik_pool_operand_new(format, DALVIK_OP_GET_POOL(model), content, pos, MDS_16_BITS, endian);
    if (target == NULL) return false;

    if (!g_binary_content_read_u16(content, pos, endian, &c))
        return false;

    /* Mise en place des arguments */

    args = g_dalvik_args_operand_new();

    for (i = 0; i < a; i++)
    {
        op = g_dalvik_register_operand_new_from_existing(g_dalvik_register_new(c + i));
        if (op == NULL) goto drvo_registers;

        args = G_ARCH_OPERAND(g_dalvik_args_operand_add(G_DALVIK_ARGS_OPERAND(args), op, NULL));

    }

    g_arch_instruction_attach_extra_operand(instr, args);

    /* Rajout de la cible */

    g_arch_instruction_attach_extra_operand(instr, target);

    return true;

 drvo_registers:

    g_object_unref(G_OBJECT(target));

    return false;

}


/******************************************************************************
*                                                                             *
*  Paramètres  : instr   = instruction dont la définition est incomplète.[OUT]*
*                format  = format du fichier contenant le code.               *
*                content = flux de données à analyser.                        *
*                pos     = position courante dans ce flux. [OUT]              *
*                endian  = boutisme lié au binaire accompagnant.              *
*                model   = type d'opérandes attendues.                        *
*                                                                             *
*  Description : Procède à la lecture d'opérandes pour une instruction.       *
*                                                                             *
*  Retour      : Bilan de l'opération : true en cas de succès, false sinon.   *
*                                                                             *
*  Remarques   : -                                                            *
*                                                                             *
******************************************************************************/

bool dalvik_read_operands(GArchInstruction *instr, GExeFormat *format, const GBinContent *content, vmpa2t *pos, SourceEndian endian, DalvikOperandType model)
{
    bool result;                            /* Bilan à retourner           */
    GDexFormat *dformat;                    /* Autre version du format     */
    bool low;                               /* Partie d'octets à lire      */
#ifndef NDEBUG
    vmpa2t old;                             /* Position avant traitements  */
#endif
    vmpa2t base;                            /* Base pour les sauts de code */
    vmpa2t *extra;                          /* Information complémentaire  */
#ifndef NDEBUG
    phys_t expected;                        /* Consommation attendue       */
    phys_t consumed;                        /* Consommation réelle         */
#endif

    result = true;

    dformat = G_DEX_FORMAT(format);

    low = true;

#ifndef NDEBUG

    copy_vmpa(&old, pos);

#endif

    /* Récupération de la base ? */

    if (DALVIK_OP_GET_MNEMONIC(model) == 'T')
    {
        extra = &base;

        copy_vmpa(extra, pos);
        deminish_vmpa(extra, 1);

    }
    else extra = NULL;

    /* Bourrage : ØØ|op ? */

    switch (model & ~DALVIK_OP_EXTRA_MASK)
    {
        case DALVIK_OPT_10X:
        case DALVIK_OPT_20T:
        case DALVIK_OPT_30T:
        case DALVIK_OPT_32X:
            result = g_binary_content_seek(content, pos, 1);
            break;

        default:
            break;

    }

    /* Décodage... */

    switch (model & ~DALVIK_OP_EXTRA_MASK)
    {
        case DALVIK_OPT_10T:
        case DALVIK_OPT_11N:
        case DALVIK_OPT_11X:
        case DALVIK_OPT_12X:
        case DALVIK_OPT_20T:
        case DALVIK_OPT_21C:
        case DALVIK_OPT_21H:
        case DALVIK_OPT_21S:
        case DALVIK_OPT_21T:
        case DALVIK_OPT_22B:
        case DALVIK_OPT_22C:
        case DALVIK_OPT_22S:
        case DALVIK_OPT_22T:
        case DALVIK_OPT_22X:
        case DALVIK_OPT_23X:
        case DALVIK_OPT_30T:
        case DALVIK_OPT_31C:
        case DALVIK_OPT_31I:
        case DALVIK_OPT_31T:
        case DALVIK_OPT_32X:
        case DALVIK_OPT_51L:
            result = dalvik_read_basic_operands(instr, dformat, content, pos, &low, endian, model, extra);
            break;

        case DALVIK_OPT_35C:
            result = dalvik_read_fixed_operands(instr, dformat, content, pos, &low, endian, model);
            break;

        case DALVIK_OPT_3RC:
        case DALVIK_OPT_3RMS:
        case DALVIK_OPT_3RFS:
            result = dalvik_read_variatic_operands(instr, dformat, content, pos, &low, endian, model);
            break;

        default:
            break;

    }

#ifndef NDEBUG

    /* Vérification d'implémentation */

    if (result)
    {
        expected = DALVIK_OP_GET_LEN(model) * 2;
        consumed = 1 + compute_vmpa_diff(&old, pos);

        assert(consumed == expected);

    }

#endif

    return result;

}


/******************************************************************************
*                                                                             *
*  Paramètres  : instr  = instruction dont la définition est incomplète.      *
*                                                                             *
*  Description : Procède à la lecture d'opérandes pour une instruction.       *
*                                                                             *
*  Retour      : -                                                            *
*                                                                             *
*  Remarques   : -                                                            *
*                                                                             *
******************************************************************************/

void dalvik_mark_first_operand_as_written(GArchInstruction *instr)
{
    GArchOperand *operand;                  /* Première opérande visé      */

    operand = g_arch_instruction_get_operand(instr, 0);

    g_dalvik_register_operand_mark_as_written(G_DALVIK_REGISTER_OPERAND(operand));

}