History

tccrun.c: unify rt_get_caller_pc prototype

grischka committed 13 years ago

Commit 4b539aa1 parent 97c279f1 file · +15 −18Browse files

Unified · Split

tccrun.c+15−18
@@ -461,10 +461,10 @@ static void set_exception_handler(void) · 460 unmodified lines
461#define REG_EBP EBP461#define REG_EBP EBP
462#endif462#endif
463 463
464/* return the PC at frame level 'level'. Return non zero if not found */464/* return the PC at frame level 'level'. Return negative if not found */
465static int rt_get_caller_pc(addr_t *paddr, ucontext_t *uc, int level)465static int rt_get_caller_pc(addr_t *paddr, ucontext_t *uc, int level)
466{466{
467 unsigned long fp;467 addr_t fp;
468 int i;468 int i;
469 469
470 if (level == 0) {470 if (level == 0) {
@@ -492,9 +492,9 @@ static int rt_get_caller_pc(addr_t *paddr, ucontext_t *uc, int level) · 21 unmodified lines
492 /* XXX: check address validity with program info */492 /* XXX: check address validity with program info */
493 if (fp <= 0x1000 || fp >= 0xc0000000)493 if (fp <= 0x1000 || fp >= 0xc0000000)
494 return -1;494 return -1;
495 fp = ((unsigned long *)fp)[0];495 fp = ((addr_t *)fp)[0];
496 }496 }
497 *paddr = ((unsigned long *)fp)[1];497 *paddr = ((addr_t *)fp)[1];
498 return 0;498 return 0;
499 }499 }
500}500}
@@ -502,11 +502,10 @@ static int rt_get_caller_pc(addr_t *paddr, ucontext_t *uc, int level) · 1 unmodified line
502/* ------------------------------------------------------------- */502/* ------------------------------------------------------------- */
503#elif defined(__x86_64__)503#elif defined(__x86_64__)
504 504
505/* return the PC at frame level 'level'. Return non zero if not found */505/* return the PC at frame level 'level'. Return negative if not found */
506static int rt_get_caller_pc(unsigned long *paddr,506static int rt_get_caller_pc(addr_t *paddr, ucontext_t *uc, int level)
507 ucontext_t *uc, int level)
508{507{
509 unsigned long fp;508 addr_t fp;
510 int i;509 int i;
511 510
512 if (level == 0) {511 if (level == 0) {
@@ -531,9 +530,9 @@ static int rt_get_caller_pc(unsigned long *paddr, · 18 unmodified lines
531 /* XXX: check address validity with program info */530 /* XXX: check address validity with program info */
532 if (fp <= 0x1000)531 if (fp <= 0x1000)
533 return -1;532 return -1;
534 fp = ((unsigned long *)fp)[0];533 fp = ((addr_t *)fp)[0];
535 }534 }
536 *paddr = ((unsigned long *)fp)[1];535 *paddr = ((addr_t *)fp)[1];
537 return 0;536 return 0;
538 }537 }
539}538}
@@ -542,10 +541,9 @@ static int rt_get_caller_pc(unsigned long *paddr, · 2 unmodified lines
542#elif defined(__arm__)541#elif defined(__arm__)
543 542
544/* return the PC at frame level 'level'. Return negative if not found */543/* return the PC at frame level 'level'. Return negative if not found */
545static int rt_get_caller_pc(unsigned long *paddr,544static int rt_get_caller_pc(addr_t *paddr, ucontext_t *uc, int level)
546 ucontext_t *uc, int level)
547{545{
548 uint32_t fp, sp;546 addr_t fp, sp;
549 int i;547 int i;
550 548
551 if (level == 0) {549 if (level == 0) {
@@ -569,15 +567,15 @@ static int rt_get_caller_pc(unsigned long *paddr, · 17 unmodified lines
569 if (fp < sp + 12 || fp & 3)567 if (fp < sp + 12 || fp & 3)
570 return -1;568 return -1;
571 for(i = 1; i < level; i++) {569 for(i = 1; i < level; i++) {
572 sp = ((uint32_t *)fp)[-2];570 sp = ((addr_t *)fp)[-2];
573 if (sp < fp || sp - fp > 16 || sp & 3)571 if (sp < fp || sp - fp > 16 || sp & 3)
574 return -1;572 return -1;
575 fp = ((uint32_t *)fp)[-3];573 fp = ((addr_t *)fp)[-3];
576 if (fp <= sp || fp - sp < 12 || fp & 3)574 if (fp <= sp || fp - sp < 12 || fp & 3)
577 return -1;575 return -1;
578 }576 }
579 /* XXX: check address validity with program info */577 /* XXX: check address validity with program info */
580 *paddr = ((uint32_t *)fp)[-1];578 *paddr = ((addr_t *)fp)[-1];
581 return 0;579 return 0;
582 }580 }
583}581}
@@ -586,8 +584,7 @@ static int rt_get_caller_pc(unsigned long *paddr, · 2 unmodified lines
586#else584#else
587 585
588#warning add arch specific rt_get_caller_pc()586#warning add arch specific rt_get_caller_pc()
589static int rt_get_caller_pc(unsigned long *paddr,587static int rt_get_caller_pc(addr_t *paddr, ucontext_t *uc, int level)
590 ucontext_t *uc, int level)
591{588{
592 return -1;589 return -1;
593}590}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t