Changeset 0f81ceb7 in mainline for kernel/generic/src/console/cmd.c
- Timestamp:
- 2009-02-12T20:03:07Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 95b9963
- Parents:
- 8a72a9a
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/console/cmd.c
r8a72a9a r0f81ceb7 617 617 uintptr_t symaddr; 618 618 char *symbol; 619 unative_t (*f)(void); 620 #ifdef ia64 621 struct { 622 unative_t f; 623 unative_t gp; 624 } fptr; 625 #endif 626 619 unative_t (*fnc)(void); 620 fncptr_t fptr; 621 627 622 symaddr = get_symbol_addr((char *) argv->buffer); 628 623 if (!symaddr) … … 633 628 } else { 634 629 symbol = get_symtab_entry(symaddr); 630 fnc = (unative_t (*)(void)) arch_construct_function(&fptr, (void *) symaddr, (void *) cmd_call0); 635 631 printf("Calling %s() (%p)\n", symbol, symaddr); 636 #ifdef ia64 637 fptr.f = symaddr; 638 fptr.gp = ((unative_t *)cmd_call2)[1]; 639 f = (unative_t (*)(void)) &fptr; 640 #else 641 f = (unative_t (*)(void)) symaddr; 642 #endif 643 printf("Result: %#" PRIxn "\n", f()); 632 printf("Result: %#" PRIxn "\n", fnc()); 644 633 } 645 634 … … 681 670 uintptr_t symaddr; 682 671 char *symbol; 683 unative_t (*f )(unative_t,...);672 unative_t (*fnc)(unative_t, ...); 684 673 unative_t arg1 = argv[1].intval; 685 #ifdef ia64 686 struct { 687 unative_t f; 688 unative_t gp; 689 } fptr; 690 #endif 691 674 fncptr_t fptr; 675 692 676 symaddr = get_symbol_addr((char *) argv->buffer); 693 677 if (!symaddr) … … 698 682 } else { 699 683 symbol = get_symtab_entry(symaddr); 700 684 fnc = (unative_t (*)(unative_t, ...)) arch_construct_function(&fptr, (void *) symaddr, (void *) cmd_call1); 701 685 printf("Calling f(%#" PRIxn "): %p: %s\n", arg1, symaddr, symbol); 702 #ifdef ia64 703 fptr.f = symaddr; 704 fptr.gp = ((unative_t *)cmd_call2)[1]; 705 f = (unative_t (*)(unative_t,...)) &fptr; 706 #else 707 f = (unative_t (*)(unative_t,...)) symaddr; 708 #endif 709 printf("Result: %#" PRIxn "\n", f(arg1)); 686 printf("Result: %#" PRIxn "\n", fnc(arg1)); 710 687 } 711 688 … … 718 695 uintptr_t symaddr; 719 696 char *symbol; 720 unative_t (*f )(unative_t,unative_t,...);697 unative_t (*fnc)(unative_t, unative_t, ...); 721 698 unative_t arg1 = argv[1].intval; 722 699 unative_t arg2 = argv[2].intval; 723 #ifdef ia64 724 struct { 725 unative_t f; 726 unative_t gp; 727 }fptr; 728 #endif 729 700 fncptr_t fptr; 701 730 702 symaddr = get_symbol_addr((char *) argv->buffer); 731 703 if (!symaddr) … … 736 708 } else { 737 709 symbol = get_symtab_entry(symaddr); 710 fnc = (unative_t (*)(unative_t, unative_t, ...)) arch_construct_function(&fptr, (void *) symaddr, (void *) cmd_call2); 738 711 printf("Calling f(%#" PRIxn ", %#" PRIxn "): %p: %s\n", 739 712 arg1, arg2, symaddr, symbol); 740 #ifdef ia64 741 fptr.f = symaddr; 742 fptr.gp = ((unative_t *)cmd_call2)[1]; 743 f = (unative_t (*)(unative_t,unative_t,...)) &fptr; 744 #else 745 f = (unative_t (*)(unative_t,unative_t,...)) symaddr; 746 #endif 747 printf("Result: %#" PRIxn "\n", f(arg1, arg2)); 713 printf("Result: %#" PRIxn "\n", fnc(arg1, arg2)); 748 714 } 749 715 … … 756 722 uintptr_t symaddr; 757 723 char *symbol; 758 unative_t (*f )(unative_t,unative_t,unative_t,...);724 unative_t (*fnc)(unative_t, unative_t, unative_t, ...); 759 725 unative_t arg1 = argv[1].intval; 760 726 unative_t arg2 = argv[2].intval; 761 727 unative_t arg3 = argv[3].intval; 762 #ifdef ia64 763 struct { 764 unative_t f; 765 unative_t gp; 766 }fptr; 767 #endif 768 728 fncptr_t fptr; 729 769 730 symaddr = get_symbol_addr((char *) argv->buffer); 770 731 if (!symaddr) … … 775 736 } else { 776 737 symbol = get_symtab_entry(symaddr); 738 fnc = (unative_t (*)(unative_t, unative_t, unative_t, ...)) arch_construct_function(&fptr, (void *) symaddr, (void *) cmd_call3); 777 739 printf("Calling f(%#" PRIxn ",%#" PRIxn ", %#" PRIxn "): %p: %s\n", 778 740 arg1, arg2, arg3, symaddr, symbol); 779 #ifdef ia64 780 fptr.f = symaddr; 781 fptr.gp = ((unative_t *)cmd_call2)[1]; 782 f = (unative_t (*)(unative_t,unative_t,unative_t,...)) &fptr; 783 #else 784 f = (unative_t (*)(unative_t,unative_t,unative_t,...)) symaddr; 785 #endif 786 printf("Result: %#" PRIxn "\n", f(arg1, arg2, arg3)); 741 printf("Result: %#" PRIxn "\n", fnc(arg1, arg2, arg3)); 787 742 } 788 743 … … 997 952 998 953 for (test = tests; test->name != NULL; test++) 999 printf("% s\t\t%s%s\n", test->name, test->desc, (test->safe ? "" : " (unsafe)"));1000 1001 printf(" *\t\tRun all safe tests\n");954 printf("%-10s %s%s\n", test->name, test->desc, (test->safe ? "" : " (unsafe)")); 955 956 printf("%-10s Run all safe tests\n", "*"); 1002 957 return 1; 1003 958 }
Note:
See TracChangeset
for help on using the changeset viewer.