~bkerensa/ubuntu/raring/valgrind/merge-from-deb

« back to all changes in this revision

Viewing changes to coregrind/m_dispatch/dispatch-ppc64-linux.S

  • Committer: Bazaar Package Importer
  • Author(s): Sebastian Dröge
  • Date: 2006-06-26 00:17:17 UTC
  • mto: This revision was merged to the branch mainline in revision 11.
  • Revision ID: james.westby@ubuntu.com-20060626001717-qi51nzty57cb12q6
Tags: upstream-3.2.0
Import upstream version 3.2.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
/*--------------------------------------------------------------------*/
 
3
/*--- The core dispatch loop, for jumping to a code address.       ---*/
 
4
/*---                                             dispatch-ppc64.S ---*/
 
5
/*--------------------------------------------------------------------*/
 
6
 
 
7
/*
 
8
  This file is part of Valgrind, a dynamic binary instrumentation
 
9
  framework.
 
10
 
 
11
  Copyright (C) 2005 Cerion Armour-Brown <cerion@open-works.co.uk>
 
12
 
 
13
  This program is free software; you can redistribute it and/or
 
14
  modify it under the terms of the GNU General Public License as
 
15
  published by the Free Software Foundation; either version 2 of the
 
16
  License, or (at your option) any later version.
 
17
 
 
18
  This program is distributed in the hope that it will be useful, but
 
19
  WITHOUT ANY WARRANTY; without even the implied warranty of
 
20
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
21
  General Public License for more details.
 
22
 
 
23
  You should have received a copy of the GNU General Public License
 
24
  along with this program; if not, write to the Free Software
 
25
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
 
26
  02111-1307, USA.
 
27
 
 
28
  The GNU General Public License is contained in the file COPYING.
 
29
*/
 
30
 
 
31
#include "pub_core_basics_asm.h"
 
32
#include "pub_core_dispatch_asm.h"
 
33
#include "pub_core_transtab_asm.h"
 
34
#include "libvex_guest_offsets.h"       /* for OFFSET_ppc64_CIA */
 
35
 
 
36
 
 
37
/* References to globals via the TOC */
 
38
 
 
39
/*
 
40
        .globl vgPlain_tt_fast
 
41
        .lcomm  vgPlain_tt_fast,4,4
 
42
        .type   vgPlain_tt_fast, @object
 
43
*/
 
44
        .section        ".toc","aw"
 
45
.tocent__vgPlain_tt_fast:
 
46
        .tc vgPlain_tt_fast[TC],vgPlain_tt_fast
 
47
.tocent__vgPlain_tt_fastN:
 
48
        .tc vgPlain_tt_fastN[TC],vgPlain_tt_fastN
 
49
.tocent__vgPlain_dispatch_ctr:
 
50
        .tc vgPlain_dispatch_ctr[TC],vgPlain_dispatch_ctr
 
51
.tocent__vgPlain_machine_ppc64_has_VMX:
 
52
        .tc vgPlain_machine_ppc64_has_VMX[TC],vgPlain_machine_ppc64_has_VMX
 
53
 
 
54
/*------------------------------------------------------------*/
 
55
/*---                                                      ---*/
 
56
/*--- The dispatch loop.  VG_(run_innerloop) is used to    ---*/
 
57
/*--- run all translations except no-redir ones.           ---*/
 
58
/*---                                                      ---*/
 
59
/*------------------------------------------------------------*/
 
60
 
 
61
/*----------------------------------------------------*/
 
62
/*--- Preamble (set everything up)                 ---*/
 
63
/*----------------------------------------------------*/
 
64
 
 
65
/* signature:
 
66
UWord VG_(run_innerloop) ( void* guest_state, UWord do_profiling );
 
67
*/
 
68
 
 
69
.section ".text"
 
70
.align   2
 
71
.globl VG_(run_innerloop)
 
72
.section ".opd","aw"
 
73
.align   3
 
74
VG_(run_innerloop):
 
75
.quad    .VG_(run_innerloop),.TOC.@tocbase,0
 
76
.previous
 
77
.type    .VG_(run_innerloop),@function
 
78
.globl   .VG_(run_innerloop)
 
79
.VG_(run_innerloop):
 
80
        /* r3 holds guest_state */
 
81
        /* r4 holds do_profiling */
 
82
 
 
83
        /* ----- entry point to VG_(run_innerloop) ----- */
 
84
        /* PPC64 ABI saves LR->16(prt_sp), CR->8(prt_sp)) */
 
85
 
 
86
        /* Save lr, cr */
 
87
        mflr    0
 
88
        std     0,16(1)
 
89
        mfcr    0
 
90
        std     0,8(1)
 
91
 
 
92
        /* New stack frame */
 
93
        stdu    1,-624(1)  /* sp should maintain 16-byte alignment */
 
94
 
 
95
        /* Save callee-saved registers... */
 
96
 
 
97
        /* Floating-point reg save area : 144 bytes */
 
98
        stfd    31,616(1)
 
99
        stfd    30,608(1)
 
100
        stfd    29,600(1)
 
101
        stfd    28,592(1)
 
102
        stfd    27,584(1)
 
103
        stfd    26,576(1)
 
104
        stfd    25,568(1)
 
105
        stfd    24,560(1)
 
106
        stfd    23,552(1)
 
107
        stfd    22,544(1)
 
108
        stfd    21,536(1)
 
109
        stfd    20,528(1)
 
110
        stfd    19,520(1)
 
111
        stfd    18,512(1)
 
112
        stfd    17,504(1)
 
113
        stfd    16,496(1)
 
114
        stfd    15,488(1)
 
115
        stfd    14,480(1)
 
116
 
 
117
        /* General reg save area : 144 bytes */
 
118
        std     31,472(1)
 
119
        std     30,464(1)
 
120
        std     29,456(1)
 
121
        std     28,448(1)
 
122
        std     27,440(1)
 
123
        std     26,432(1)
 
124
        std     25,424(1)
 
125
        std     24,416(1)
 
126
        std     23,408(1)
 
127
        std     22,400(1)
 
128
        std     21,392(1)
 
129
        std     20,384(1)
 
130
        std     19,376(1)
 
131
        std     18,368(1)
 
132
        std     17,360(1)
 
133
        std     16,352(1)
 
134
        std     15,344(1)
 
135
        std     14,336(1)
 
136
        /* Probably not necessary to save r13 (thread-specific ptr),
 
137
           as VEX stays clear of it... but what the hey. */
 
138
        std     13,328(1)
 
139
 
 
140
        /* It's necessary to save/restore VRSAVE in the AIX / Darwin ABI.
 
141
           The Linux kernel might not actually use VRSAVE for its intended
 
142
           purpose, but it should be harmless to preserve anyway. */
 
143
        /* r3, r4 are live here, so use r5 */
 
144
        ld      5,.tocent__vgPlain_machine_ppc64_has_VMX@toc(2)
 
145
        ld      5,0(5)
 
146
        cmpldi  5,0
 
147
        beq     .LafterVMX1
 
148
 
 
149
        /* VRSAVE save word : 32 bytes */
 
150
        mfspr   5,256         /* vrsave reg is spr number 256 */
 
151
        stw     5,324(1)
 
152
 
 
153
        /* Alignment padding : 4 bytes */
 
154
 
 
155
        /* Vector reg save area (quadword aligned) : 192 bytes */
 
156
        li      5,304
 
157
        stvx    31,5,1
 
158
        li      5,288
 
159
        stvx    30,5,1
 
160
        li      5,272
 
161
        stvx    29,5,1
 
162
        li      5,256
 
163
        stvx    28,5,1
 
164
        li      5,240
 
165
        stvx    27,5,1
 
166
        li      5,224
 
167
        stvx    26,5,1
 
168
        li      5,208
 
169
        stvx    25,5,1
 
170
        li      5,192
 
171
        stvx    24,5,1
 
172
        li      5,176
 
173
        stvx    23,5,1
 
174
        li      5,160
 
175
        stvx    22,5,1
 
176
        li      5,144
 
177
        stvx    21,5,1
 
178
        li      5,128
 
179
        stvx    20,5,1
 
180
.LafterVMX1:
 
181
 
 
182
        /* Local variable space... */
 
183
 
 
184
        /* r3 holds guest_state */
 
185
        /* r4 holds do_profiling */
 
186
        mr      31,3
 
187
        std     3,104(1)       /* spill orig guest_state ptr */
 
188
 
 
189
        /* 96(sp) used later to check FPSCR[RM] */
 
190
        /* 88(sp) used later to load fpscr with zero */
 
191
        /* 48:87(sp) free */
 
192
        
 
193
        /* Linkage Area (reserved)
 
194
           40(sp) : TOC
 
195
           32(sp) : link editor doubleword
 
196
           24(sp) : compiler doubleword
 
197
           16(sp) : LR
 
198
           8(sp)  : CR
 
199
           0(sp)  : back-chain
 
200
        */
 
201
 
 
202
// CAB TODO: Use a caller-saved reg for orig guest_state ptr
 
203
// - rem to set non-allocateable in isel.c
 
204
 
 
205
        /* hold dispatch_ctr (=32bit value) in r29 */
 
206
        ld      29,.tocent__vgPlain_dispatch_ctr@toc(2)
 
207
        lwz     29,0(29)
 
208
 
 
209
        /* set host FPU control word to the default mode expected 
 
210
           by VEX-generated code.  See comments in libvex.h for
 
211
           more info. */
 
212
        /* => get zero into f3 (tedious)
 
213
           fsub 3,3,3 is not a reliable way to do this, since if
 
214
           f3 holds a NaN or similar then we don't necessarily
 
215
           wind up with zero. */
 
216
        li      5,0
 
217
        stw     5,88(1)
 
218
        lfs     3,88(1)
 
219
        mtfsf   0xFF,3   /* fpscr = lo32 of f3 */
 
220
 
 
221
        /* set host AltiVec control word to the default mode expected 
 
222
           by VEX-generated code. */
 
223
        ld      5,.tocent__vgPlain_machine_ppc64_has_VMX@toc(2)
 
224
        ld      5,0(5)
 
225
        cmpldi  5,0
 
226
        beq     .LafterVMX2
 
227
 
 
228
        vspltisw 3,0x0  /* generate zero */
 
229
        mtvscr  3
 
230
.LafterVMX2:
 
231
 
 
232
        /* make a stack frame for the code we are calling */
 
233
        stdu    1,-48(1)
 
234
 
 
235
        /* fetch %CIA into r3 */
 
236
        ld      3,OFFSET_ppc64_CIA(31)
 
237
 
 
238
        /* fall into main loop (the right one) */
 
239
        /* r4 = do_profiling.  It's probably trashed after here,
 
240
           but that's OK: we don't need it after here. */
 
241
        cmplwi  4,0
 
242
        beq     .VG_(run_innerloop__dispatch_unprofiled)
 
243
        b       .VG_(run_innerloop__dispatch_profiled)
 
244
        /*NOTREACHED*/
 
245
 
 
246
 
 
247
/*----------------------------------------------------*/
 
248
/*--- NO-PROFILING (standard) dispatcher           ---*/
 
249
/*----------------------------------------------------*/
 
250
 
 
251
        .section        ".text"
 
252
        .align 2
 
253
        .globl VG_(run_innerloop__dispatch_unprofiled)
 
254
        .section        ".opd","aw"
 
255
        .align 3
 
256
VG_(run_innerloop__dispatch_unprofiled):
 
257
        .quad   .VG_(run_innerloop__dispatch_unprofiled),.TOC.@tocbase,0
 
258
        .previous
 
259
        .type   .VG_(run_innerloop__dispatch_unprofiled),@function
 
260
        .globl  .VG_(run_innerloop__dispatch_unprofiled)
 
261
.VG_(run_innerloop__dispatch_unprofiled):
 
262
        /* At entry: Live regs:
 
263
                r1  (=sp)
 
264
                r2  (toc pointer)
 
265
                r3  (=CIA = next guest address)
 
266
                r29 (=dispatch_ctr)
 
267
                r31 (=guest_state)
 
268
           Stack state:
 
269
                152(r1) (=orig guest_state)
 
270
                144(r1) (=var space for FPSCR[RM])
 
271
        */
 
272
 
 
273
        /* Has the guest state ptr been messed with?  If yes, exit. */
 
274
        ld      5,152(1)        /* original guest_state ptr */
 
275
        cmpd    5,31
 
276
        bne     .gsp_changed
 
277
 
 
278
        /* save the jump address in the guest state */
 
279
        std     3,OFFSET_ppc64_CIA(31)
 
280
 
 
281
        /* Are we out of timeslice?  If yes, defer to scheduler. */
 
282
        subi    29,29,1
 
283
        cmpldi  29,0
 
284
        beq     .counter_is_zero
 
285
 
 
286
        /* try a fast lookup in the translation cache */
 
287
        /* r4 = VG_TT_FAST_HASH(addr)           * sizeof(ULong*)
 
288
              = ((r3 >>u 2) & VG_TT_FAST_MASK)  << 3 */
 
289
        rldicl  4,3, 62, 64-VG_TT_FAST_BITS
 
290
        sldi    4,4,3
 
291
 
 
292
        ld      5, .tocent__vgPlain_tt_fast@toc(2)
 
293
        ldx     5, 5,4     /* r5 = VG_(tt_fast)[VG_TT_FAST_HASH(addr)] */
 
294
        ld      6, 0(5)    /* r6 = (r5)->orig_addr */
 
295
        cmpd    3,6
 
296
        bne     .fast_lookup_failed
 
297
 
 
298
        /* Found a match.  Call tce[1], which is 8 bytes along, since
 
299
           each tce element is a 64-bit int. */
 
300
        addi    8,5,8
 
301
        mtlr    8
 
302
 
 
303
        /* run the translation */
 
304
        blrl
 
305
 
 
306
        /* On return from guest code:
 
307
           r3  holds destination (original) address.
 
308
           r31 may be unchanged (guest_state), or may indicate further
 
309
           details of the control transfer requested to *r3.
 
310
        */
 
311
 
 
312
        /* start over */
 
313
        b       .VG_(run_innerloop__dispatch_unprofiled)
 
314
        /*NOTREACHED*/
 
315
        .size VG_(run_innerloop), .-VG_(run_innerloop)
 
316
 
 
317
 
 
318
/*----------------------------------------------------*/
 
319
/*--- PROFILING dispatcher (can be much slower)    ---*/
 
320
/*----------------------------------------------------*/
 
321
 
 
322
        .section        ".text"
 
323
        .align 2
 
324
        .globl VG_(run_innerloop__dispatch_profiled)
 
325
        .section        ".opd","aw"
 
326
        .align 3
 
327
VG_(run_innerloop__dispatch_profiled):
 
328
        .quad   .VG_(run_innerloop__dispatch_profiled),.TOC.@tocbase,0
 
329
        .previous
 
330
        .type   .VG_(run_innerloop__dispatch_profiled),@function
 
331
        .globl  .VG_(run_innerloop__dispatch_profiled)
 
332
.VG_(run_innerloop__dispatch_profiled):
 
333
        /* At entry: Live regs:
 
334
                r1  (=sp)
 
335
                r2  (toc pointer)
 
336
                r3  (=CIA = next guest address)
 
337
                r29 (=dispatch_ctr)
 
338
                r31 (=guest_state)
 
339
           Stack state:
 
340
                152(r1) (=orig guest_state)
 
341
                144(r1) (=var space for FPSCR[RM])
 
342
        */
 
343
 
 
344
        /* Has the guest state ptr been messed with?  If yes, exit. */
 
345
        ld      5,152(1)        /* original guest_state ptr */
 
346
        cmpd    5,31
 
347
        bne     .gsp_changed
 
348
 
 
349
        /* save the jump address in the guest state */
 
350
        std     3,OFFSET_ppc64_CIA(31)
 
351
 
 
352
        /* Are we out of timeslice?  If yes, defer to scheduler. */
 
353
        subi    29,29,1
 
354
        cmpldi  29,0
 
355
        beq     .counter_is_zero
 
356
 
 
357
        /* try a fast lookup in the translation cache */
 
358
        /* r4 = VG_TT_FAST_HASH(addr)           * sizeof(ULong*)
 
359
              = ((r3 >>u 2) & VG_TT_FAST_MASK)  << 3 */
 
360
        rldicl  4,3, 62, 64-VG_TT_FAST_BITS
 
361
        sldi    4,4,3
 
362
 
 
363
        ld      5, .tocent__vgPlain_tt_fast@toc(2)
 
364
        ldx     5, 5,4     /* r5 = VG_(tt_fast)[VG_TT_FAST_HASH(addr)] */
 
365
        ld      6, 0(5)    /* r6 = (r5)->orig_addr */
 
366
        cmpd    3,6
 
367
        bne     .fast_lookup_failed
 
368
 
 
369
        /* increment bb profile counter VG_(tt_fastN)[x] (=32bit val) */
 
370
        ld      7, .tocent__vgPlain_tt_fastN@toc(2)
 
371
        ldx     7, 7,4     /* r7 = VG_(tt_fastN)[VG_TT_HASH(addr)] */
 
372
        lwz     6, 0(7)    /* *(UInt*)r7 ++ */
 
373
        addi    6, 6,1
 
374
        stw     6, 0(7)
 
375
 
 
376
        /* Found a match.  Call tce[1], which is 8 bytes along, since
 
377
           each tce element is a 64-bit int. */
 
378
        addi    8,5,8
 
379
        mtlr    8
 
380
 
 
381
        /* run the translation */
 
382
        blrl
 
383
 
 
384
        /* On return from guest code:
 
385
           r3  holds destination (original) address.
 
386
           r31 may be unchanged (guest_state), or may indicate further
 
387
           details of the control transfer requested to *r3.
 
388
        */
 
389
 
 
390
        /* start over */
 
391
        b       .VG_(run_innerloop__dispatch_profiled)
 
392
        /*NOTREACHED*/
 
393
        .size VG_(run_a_noredir_translation), .-VG_(run_a_noredir_translation)
 
394
 
 
395
 
 
396
/*----------------------------------------------------*/
 
397
/*--- exit points                                  ---*/
 
398
/*----------------------------------------------------*/
 
399
 
 
400
.gsp_changed:
 
401
        /* Someone messed with the gsp (in r31).  Have to
 
402
           defer to scheduler to resolve this.  dispatch ctr
 
403
           is not yet decremented, so no need to increment. */
 
404
        /* %CIA is NOT up to date here.  First, need to write
 
405
           %r3 back to %CIA, but without trashing %r31 since
 
406
           that holds the value we want to return to the scheduler.
 
407
           Hence use %r5 transiently for the guest state pointer. */
 
408
        ld      5,152(1)         /* original guest_state ptr */
 
409
        std     3,OFFSET_ppc64_CIA(5)
 
410
        mr      3,31            /* r3 = new gsp value */
 
411
        b       .run_innerloop_exit
 
412
        /*NOTREACHED*/
 
413
 
 
414
.counter_is_zero:
 
415
        /* %CIA is up to date */
 
416
        /* back out decrement of the dispatch counter */
 
417
        addi    29,29,1
 
418
        li      3,VG_TRC_INNER_COUNTERZERO
 
419
        b       .run_innerloop_exit
 
420
 
 
421
.fast_lookup_failed:
 
422
        /* %CIA is up to date */
 
423
        /* back out decrement of the dispatch counter */
 
424
        addi    29,29,1
 
425
        li      3,VG_TRC_INNER_FASTMISS
 
426
        b       .run_innerloop_exit
 
427
 
 
428
 
 
429
 
 
430
/* All exits from the dispatcher go through here.
 
431
   r3 holds the return value. 
 
432
*/
 
433
.run_innerloop_exit: 
 
434
        /* We're leaving.  Check that nobody messed with
 
435
           VSCR or FPSCR. */
 
436
 
 
437
        /* Set fpscr back to a known state, since vex-generated code
 
438
           may have messed with fpscr[rm]. */
 
439
        li      5,0
 
440
        addi    1,1,-16
 
441
        stw     5,0(1)
 
442
        lfs     3,0(1)
 
443
        addi    1,1,16
 
444
        mtfsf   0xFF,3   /* fpscr = f3 */
 
445
        
 
446
        /* Using r11 - value used again further on, so don't trash! */
 
447
        ld      11,.tocent__vgPlain_machine_ppc64_has_VMX@toc(2)
 
448
        ld      11,0(11)
 
449
        cmpldi  11,0
 
450
        beq     .LafterVMX8
 
451
 
 
452
        /* Check VSCR[NJ] == 1 */
 
453
        /* first generate 4x 0x00010000 */
 
454
        vspltisw  4,0x1                   /* 4x 0x00000001 */
 
455
        vspltisw  5,0x0                   /* zero */
 
456
        vsldoi    6,4,5,0x2               /* <<2*8 => 4x 0x00010000 */
 
457
        /* retrieve VSCR and mask wanted bits */
 
458
        mfvscr    7
 
459
        vand      7,7,6                   /* gives NJ flag */
 
460
        vspltw    7,7,0x3                 /* flags-word to all lanes */
 
461
        vcmpequw. 8,6,7                   /* CR[24] = 1 if v6 == v7 */
 
462
        bt        24,.invariant_violation /* branch if all_equal */
 
463
.LafterVMX8:
 
464
 
 
465
        /* otherwise we're OK */
 
466
        b       .run_innerloop_exit_REALLY
 
467
 
 
468
 
 
469
.invariant_violation:
 
470
        li      3,VG_TRC_INVARIANT_FAILED
 
471
        b       .run_innerloop_exit_REALLY
 
472
 
 
473
.run_innerloop_exit_REALLY:
 
474
        /* r3 holds VG_TRC_* value to return */
 
475
 
 
476
        /* Return to parent stack */
 
477
        addi    1,1,48
 
478
 
 
479
        /* Write ctr to VG_(dispatch_ctr) (=32bit value) */
 
480
        ld      5,.tocent__vgPlain_dispatch_ctr@toc(2)
 
481
        stw     29,0(5)
 
482
 
 
483
        /* Restore cr */
 
484
        lwz     0,44(1)
 
485
        mtcr    0
 
486
 
 
487
        /* Restore callee-saved registers... */
 
488
 
 
489
        /* Floating-point regs */
 
490
        lfd     31,616(1)
 
491
        lfd     30,608(1)
 
492
        lfd     29,600(1)
 
493
        lfd     28,592(1)
 
494
        lfd     27,584(1)
 
495
        lfd     26,576(1)
 
496
        lfd     25,568(1)
 
497
        lfd     24,560(1)
 
498
        lfd     23,552(1)
 
499
        lfd     22,544(1)
 
500
        lfd     21,536(1)
 
501
        lfd     20,528(1)
 
502
        lfd     19,520(1)
 
503
        lfd     18,512(1)
 
504
        lfd     17,504(1)
 
505
        lfd     16,496(1)
 
506
        lfd     15,488(1)
 
507
        lfd     14,480(1)
 
508
 
 
509
        /* General regs */
 
510
        ld      31,472(1)
 
511
        ld      30,464(1)
 
512
        ld      29,456(1)
 
513
        ld      28,448(1)
 
514
        ld      27,440(1)
 
515
        ld      26,432(1)
 
516
        ld      25,424(1)
 
517
        ld      24,416(1)
 
518
        ld      23,408(1)
 
519
        ld      22,400(1)
 
520
        ld      21,392(1)
 
521
        ld      20,384(1)
 
522
        ld      19,376(1)
 
523
        ld      18,368(1)
 
524
        ld      17,360(1)
 
525
        ld      16,352(1)
 
526
        ld      15,344(1)
 
527
        ld      14,336(1)
 
528
        ld      13,328(1)
 
529
 
 
530
        /* r11 already holds VG_(machine_ppc64_has_VMX) value */
 
531
        cmpldi  11,0
 
532
        beq     .LafterVMX9
 
533
 
 
534
        /* VRSAVE */
 
535
        lwz     4,324(1)
 
536
        mfspr   4,256         /* VRSAVE reg is spr number 256 */
 
537
 
 
538
        /* Vector regs */
 
539
        li      4,304
 
540
        lvx     31,4,1
 
541
        li      4,288
 
542
        lvx     30,4,1
 
543
        li      4,272
 
544
        lvx     29,4,1
 
545
        li      4,256
 
546
        lvx     28,4,1
 
547
        li      4,240
 
548
        lvx     27,4,1
 
549
        li      4,224
 
550
        lvx     26,4,1
 
551
        li      4,208
 
552
        lvx     25,4,1
 
553
        li      4,192
 
554
        lvx     24,4,1
 
555
        li      4,176
 
556
        lvx     23,4,1
 
557
        li      4,160
 
558
        lvx     22,4,1
 
559
        li      4,144
 
560
        lvx     21,4,1
 
561
        li      4,128
 
562
        lvx     20,4,1
 
563
.LafterVMX9:
 
564
 
 
565
        /* reset cr, lr, sp */
 
566
        ld      0,632(1)  /* stack_size + 8 */
 
567
        mtcr    0
 
568
        ld      0,640(1)  /* stack_size + 16 */
 
569
        mtlr    0
 
570
        addi    1,1,624   /* stack_size */
 
571
        blr
 
572
 
 
573
 
 
574
/*------------------------------------------------------------*/
 
575
/*---                                                      ---*/
 
576
/*--- A special dispatcher, for running no-redir           ---*/
 
577
/*--- translations.  Just runs the given translation once. ---*/
 
578
/*---                                                      ---*/
 
579
/*------------------------------------------------------------*/
 
580
 
 
581
/* signature:
 
582
void VG_(run_a_noredir_translation) ( UWord* argblock );
 
583
*/
 
584
 
 
585
/* Run a no-redir translation.  argblock points to 4 UWords, 2 to carry args
 
586
   and 2 to carry results:
 
587
      0: input:  ptr to translation
 
588
      1: input:  ptr to guest state
 
589
      2: output: next guest PC
 
590
      3: output: guest state pointer afterwards (== thread return code)
 
591
*/
 
592
.section ".text"
 
593
.align   2
 
594
.globl VG_(run_a_noredir_translation)
 
595
.section ".opd","aw"
 
596
.align   3
 
597
VG_(run_a_noredir_translation):
 
598
.quad    .VG_(run_a_noredir_translation),.TOC.@tocbase,0
 
599
.previous
 
600
.type    .VG_(run_a_noredir_translation),@function
 
601
.globl   .VG_(run_a_noredir_translation)
 
602
.VG_(run_a_noredir_translation):
 
603
        /* save callee-save int regs, & lr */
 
604
        stdu 1,-512(1)
 
605
        std  14,256(1)
 
606
        std  15,264(1)
 
607
        std  16,272(1)
 
608
        std  17,280(1)
 
609
        std  18,288(1)
 
610
        std  19,296(1)
 
611
        std  20,304(1)
 
612
        std  21,312(1)
 
613
        std  22,320(1)
 
614
        std  23,328(1)
 
615
        std  24,336(1)
 
616
        std  25,344(1)
 
617
        std  26,352(1)
 
618
        std  27,360(1)
 
619
        std  28,368(1)
 
620
        std  29,376(1)
 
621
        std  30,384(1)
 
622
        std  31,392(1)
 
623
        mflr 31
 
624
        std  31,400(1)
 
625
        std   2,408(1)  /* also preserve R2, just in case .. */
 
626
 
 
627
        std  3,416(1)
 
628
        ld   31,8(3)
 
629
        ld   30,0(3)
 
630
        mtlr 30
 
631
        blrl
 
632
 
 
633
        ld   4,416(1)
 
634
        std  3, 16(4)
 
635
        std  31,24(4)
 
636
 
 
637
        ld   14,256(1)
 
638
        ld   15,264(1)
 
639
        ld   16,272(1)
 
640
        ld   17,280(1)
 
641
        ld   18,288(1)
 
642
        ld   19,296(1)
 
643
        ld   20,304(1)
 
644
        ld   21,312(1)
 
645
        ld   22,320(1)
 
646
        ld   23,328(1)
 
647
        ld   24,336(1)
 
648
        ld   25,344(1)
 
649
        ld   26,352(1)
 
650
        ld   27,360(1)
 
651
        ld   28,368(1)
 
652
        ld   29,376(1)
 
653
        ld   30,384(1)
 
654
        ld   31,400(1)
 
655
        mtlr 31
 
656
        ld   31,392(1)
 
657
        ld    2,408(1)  /* also preserve R2, just in case .. */
 
658
 
 
659
        addi 1,1,512
 
660
        blr
 
661
 
 
662
 
 
663
/* Let the linker know we don't need an executable stack */
 
664
.section .note.GNU-stack,"",@progbits
 
665
 
 
666
/*--------------------------------------------------------------------*/
 
667
/*--- end                                                          ---*/
 
668
/*--------------------------------------------------------------------*/