aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMike Pall <mike>2011-10-24 16:20:04 +0200
committerMike Pall <mike>2011-10-24 16:20:04 +0200
commit826fb377ecbe804a7ae934876b0dc074d93f6c46 (patch)
tree36c5632034bebc23cbd5ccde48c59fa50b8429ed /src
parent3591609dad5ac7179f67f799751265a91825406d (diff)
downloadluajit-826fb377ecbe804a7ae934876b0dc074d93f6c46.tar.gz
luajit-826fb377ecbe804a7ae934876b0dc074d93f6c46.tar.bz2
luajit-826fb377ecbe804a7ae934876b0dc074d93f6c46.zip
PPC: Add support for GDB JIT API.
Diffstat (limited to 'src')
-rw-r--r--src/lj_gdbjit.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/lj_gdbjit.c b/src/lj_gdbjit.c
index acbe429a..130ab991 100644
--- a/src/lj_gdbjit.c
+++ b/src/lj_gdbjit.c
@@ -232,8 +232,10 @@ enum {
232 232
233enum { 233enum {
234 DW_CFA_nop = 0x0, 234 DW_CFA_nop = 0x0,
235 DW_CFA_offset_extended = 0x5,
235 DW_CFA_def_cfa = 0xc, 236 DW_CFA_def_cfa = 0xc,
236 DW_CFA_def_cfa_offset = 0xe, 237 DW_CFA_def_cfa_offset = 0xe,
238 DW_CFA_offset_extended_sf = 0x11,
237 DW_CFA_advance_loc = 0x40, 239 DW_CFA_advance_loc = 0x40,
238 DW_CFA_offset = 0x80 240 DW_CFA_offset = 0x80
239}; 241};
@@ -292,6 +294,10 @@ enum {
292#elif LJ_TARGET_ARM 294#elif LJ_TARGET_ARM
293 DW_REG_SP = 13, 295 DW_REG_SP = 13,
294 DW_REG_RA = 14, 296 DW_REG_RA = 14,
297#elif LJ_TARGET_PPC
298 DW_REG_SP = 1,
299 DW_REG_RA = 65,
300 DW_REG_CR = 70,
295#else 301#else
296#error "Unsupported target architecture" 302#error "Unsupported target architecture"
297#endif 303#endif
@@ -361,6 +367,8 @@ static const ELFheader elfhdr_template = {
361 .machine = 62, 367 .machine = 62,
362#elif LJ_TARGET_ARM 368#elif LJ_TARGET_ARM
363 .machine = 40, 369 .machine = 40,
370#elif LJ_TARGET_PPC
371 .machine = 20,
364#else 372#else
365#error "Unsupported target architecture" 373#error "Unsupported target architecture"
366#endif 374#endif
@@ -523,7 +531,11 @@ static void LJ_FASTCALL gdbjit_ehframe(GDBJITctx *ctx)
523 DB(DW_REG_RA); /* Return address register. */ 531 DB(DW_REG_RA); /* Return address register. */
524 DB(1); DB(DW_EH_PE_textrel|DW_EH_PE_udata4); /* Augmentation data. */ 532 DB(1); DB(DW_EH_PE_textrel|DW_EH_PE_udata4); /* Augmentation data. */
525 DB(DW_CFA_def_cfa); DUV(DW_REG_SP); DUV(sizeof(uintptr_t)); 533 DB(DW_CFA_def_cfa); DUV(DW_REG_SP); DUV(sizeof(uintptr_t));
534#if LJ_TARGET_PPC
535 DB(DW_CFA_offset_extended_sf); DB(DW_REG_RA); DSV(-1);
536#else
526 DB(DW_CFA_offset|DW_REG_RA); DUV(1); 537 DB(DW_CFA_offset|DW_REG_RA); DUV(1);
538#endif
527 DALIGNNOP(sizeof(uintptr_t)); 539 DALIGNNOP(sizeof(uintptr_t));
528 ) 540 )
529 541
@@ -550,10 +562,19 @@ static void LJ_FASTCALL gdbjit_ehframe(GDBJITctx *ctx)
550#elif LJ_TARGET_ARM 562#elif LJ_TARGET_ARM
551 { 563 {
552 int i; 564 int i;
565 DB(DW_CFA_offset_extended); DB(DW_REG_CR); DUV(55);
553 for (i = 11; i >= 4; i--) { /* R4-R11. */ 566 for (i = 11; i >= 4; i--) { /* R4-R11. */
554 DB(DW_CFA_offset|i); DUV(2+(11-i)); 567 DB(DW_CFA_offset|i); DUV(2+(11-i));
555 } 568 }
556 } 569 }
570#elif LJ_TARGET_PPC
571 {
572 int i;
573 for (i = 14; i <= 31; i++) {
574 DB(DW_CFA_offset|i); DUV(37+(31-i));
575 DB(DW_CFA_offset|32|i); DUV(2+2*(31-i));
576 }
577 }
557#else 578#else
558#error "Unsupported target architecture" 579#error "Unsupported target architecture"
559#endif 580#endif