| ... |
... |
@@ -516,37 +516,44 @@ StgRunIsImplementedInAssembler(void) |
|
516
|
516
|
".cfi_offset r14, %c6\n\t"
|
|
517
|
517
|
".cfi_offset r15, %c7\n\t"
|
|
518
|
518
|
/*
|
|
519
|
|
- * The original rsp is saved at RESERVED_C_STACK_BYTES + 56 from
|
|
520
|
|
- * current rsp. We use DW_CFA_expression to indicate that rsp's
|
|
521
|
|
- * value can be found by loading from that stack location.
|
|
|
519
|
+ * The rsp value _on entrance_ is saved at
|
|
|
520
|
+ * RESERVED_C_STACK_BYTES + 56 from current rsp.
|
|
|
521
|
+ * We use DW_CFA_val_expression to indicate that rsp's value can be
|
|
|
522
|
+ * found by loading from that stack location. We add 8 to that value
|
|
|
523
|
+ * to recover the rsp value _before the call instruction_.
|
|
|
524
|
+ * previous_rsp = saved_rsp + 8
|
|
|
525
|
+ * = *(rsp + 8 + RESERVED_C_STACK_BYTES + 48) + 8.
|
|
522
|
526
|
*/
|
|
523
|
527
|
#define RSP_DELTA (RESERVED_C_STACK_BYTES + 56)
|
|
524
|
528
|
".cfi_escape "
|
|
525
|
|
- "0x10, " // DW_CFA_expression
|
|
|
529
|
+ "0x16, " // DW_CFA_val_expression
|
|
526
|
530
|
"0x07, " // register num 7 - rsp
|
|
527
|
531
|
#if (RSP_DELTA >> 20) > 0
|
|
528
|
|
- "0x05, " // block length = 5
|
|
|
532
|
+ "0x08, " // block length = 8
|
|
529
|
533
|
#elif (RSP_DELTA >> 13) > 0
|
|
530
|
|
- "0x04, " // block length = 4
|
|
|
534
|
+ "0x07, " // block length = 7
|
|
531
|
535
|
#elif (RSP_DELTA >> 6) > 0
|
|
532
|
|
- "0x03, " // block length = 3
|
|
|
536
|
+ "0x06, " // block length = 6
|
|
533
|
537
|
#else
|
|
534
|
|
- "0x02, " // block length = 2
|
|
|
538
|
+ "0x05, " // block length = 5
|
|
535
|
539
|
#endif
|
|
536
|
540
|
"0x77, " // DW_OP_breg7 (rsp + offset)
|
|
537
|
|
- "%c8" // signed LEB128 offset to saved rsp (RESERVED_C_STACK_BYTES + 56)
|
|
|
541
|
+ "%c8, " // signed LEB128 offset to saved rsp (RESERVED_C_STACK_BYTES + 56)
|
|
538
|
542
|
#if (RSP_DELTA >> 6) > 0
|
|
539
|
|
- ", %c9" // signed LEB128 encoded delta - byte 2
|
|
|
543
|
+ "%c9, " // signed LEB128 encoded delta - byte 2
|
|
540
|
544
|
#endif
|
|
541
|
545
|
#if (RSP_DELTA >> 13) > 0
|
|
542
|
|
- ", %c10" // signed LEB128 encoded delta - byte 3
|
|
|
546
|
+ "%c10, " // signed LEB128 encoded delta - byte 3
|
|
543
|
547
|
#endif
|
|
544
|
548
|
#if (RSP_DELTA >> 20) > 0
|
|
545
|
|
- ", %c11" // signed LEB128 encoded delta - byte 4
|
|
|
549
|
+ "%c11, " // signed LEB128 encoded delta - byte 4
|
|
546
|
550
|
#endif
|
|
547
|
551
|
#if (RSP_DELTA >> 27) > 0
|
|
548
|
552
|
#error "RSP_DELTA too big"
|
|
549
|
553
|
#endif
|
|
|
554
|
+ "0x06, " // DW_OP_deref
|
|
|
555
|
+ "0x38, " // DW_OP_lit8
|
|
|
556
|
+ "0x22" // DW_OP_plus
|
|
550
|
557
|
"\n\t"
|
|
551
|
558
|
/*
|
|
552
|
559
|
* The return address (rip) is at the original rsp location.
|
| ... |
... |
@@ -566,17 +573,17 @@ StgRunIsImplementedInAssembler(void) |
|
566
|
573
|
"0x03, " // block length = 3
|
|
567
|
574
|
#endif
|
|
568
|
575
|
"0x77, " // DW_OP_breg7 (rsp + offset)
|
|
569
|
|
- "%c8" // signed LEB128 offset to saved rsp
|
|
|
576
|
+ "%c8, " // signed LEB128 offset to saved rsp
|
|
570
|
577
|
#if (RSP_DELTA >> 6) > 0
|
|
571
|
|
- ", %c9" // signed LEB128 encoded delta - byte 2
|
|
|
578
|
+ "%c9, " // signed LEB128 encoded delta - byte 2
|
|
572
|
579
|
#endif
|
|
573
|
580
|
#if (RSP_DELTA >> 13) > 0
|
|
574
|
|
- ", %c10" // signed LEB128 encoded delta - byte 3
|
|
|
581
|
+ "%c10, " // signed LEB128 encoded delta - byte 3
|
|
575
|
582
|
#endif
|
|
576
|
583
|
#if (RSP_DELTA >> 20) > 0
|
|
577
|
|
- ", %c11" // signed LEB128 encoded delta - byte 4
|
|
|
584
|
+ "%c11, " // signed LEB128 encoded delta - byte 4
|
|
578
|
585
|
#endif
|
|
579
|
|
- ", 0x06" // DW_OP_deref
|
|
|
586
|
+ "0x06" // DW_OP_deref
|
|
580
|
587
|
"\n\t"
|
|
581
|
588
|
#endif /* defined(ENABLE_UNWINDING) */
|
|
582
|
589
|
|