📄 stdlib.lst
字号:
724 0390 0800E003 j $31 725 0394 21100000 move $2,$0 726 727 .set macro 728 .set reorder 729 $LFE14: 730 .end strncmp 731 .local safechar.0 732 .comm safechar.0,1,1 733 .align 2 734 .globl strtol 735 .ent strtol 736 .type strtol, @function 737 strtol: 738 $LFB15: 252:/mnt/hgfs/boot/booter/source/stdlib.c ****
253:/mnt/hgfs/boot/booter/source/stdlib.c **** /******************************************************************** 254:/mnt/hgfs/boot/booter/source/stdlib.c **** * This implementation of strtol supports only bases 8, 10, and 16 * 255:/mnt/hgfs/boot/booter/source/stdlib.c **** ********************************************************************/ 256:/mnt/hgfs/boot/booter/source/stdlib.c **** long strtol(const char* nptr, const char** endptr, int base) { 739 .loc 1 256 0 740 .frame $sp,56,$31 # vars= 8, regs= 7/0, args= 16, gp= 0 741 .mask 0x803f0000,-8 742 .fmask 0x00000000,0 743 .set noreorder 744 .set nomacro 745 746 0398 C8FFBD27 addiu $sp,$sp,-56 747 $LCFI25: 748 039c 1C00B1AF sw $17,28($sp) 749 $LCFI26: 257:/mnt/hgfs/boot/booter/source/stdlib.c **** long value = 0; 258:/mnt/hgfs/boot/booter/source/stdlib.c **** int neg = 0; 259:/mnt/hgfs/boot/booter/source/stdlib.c **** int x = 0; 260:/mnt/hgfs/boot/booter/source/stdlib.c **** static char safechar; // allocate our own pointer in case none passed 261:/mnt/hgfs/boot/booter/source/stdlib.c **** const char *safeptr = &safechar; 750 .loc 1 261 0 751 03a0 0000023C lui $2,%hi(safechar.0) 262:/mnt/hgfs/boot/booter/source/stdlib.c **** 263:/mnt/hgfs/boot/booter/source/stdlib.c **** // if null passed, use own pointer... 264:/mnt/hgfs/boot/booter/source/stdlib.c **** if (endptr == 0) { 265:/mnt/hgfs/boot/booter/source/stdlib.c **** endptr = &safeptr; 752 .loc 1 265 0 753 03a4 1000B127 addiu $17,$sp,16 754 03a8 0B88A500 movn $17,$5,$5 755 .loc 1 261 0 756 03ac 00004224 addiu $2,$2,%lo(safechar.0) 757 03b0 1000A2AF sw $2,16($sp)GAS LISTING /tmp/ccLTWmfM.s page 19 758 .loc 1 256 0 759 03b4 2C00B5AF sw $21,44($sp) 760 $LCFI27: 761 03b8 2400B3AF sw $19,36($sp) 762 $LCFI28: 763 03bc 2000B2AF sw $18,32($sp) 764 $LCFI29: 765 03c0 1800B0AF sw $16,24($sp) 766 $LCFI30: 767 03c4 3000BFAF sw $31,48($sp) 768 $LCFI31: 769 03c8 2800B4AF sw $20,40($sp) 770 $LCFI32: 266:/mnt/hgfs/boot/booter/source/stdlib.c **** } 267:/mnt/hgfs/boot/booter/source/stdlib.c **** // set start location 268:/mnt/hgfs/boot/booter/source/stdlib.c **** *endptr = nptr; 771 .loc 1 268 0 772 03cc 21808000 move $16,$4 773 03d0 000024AE sw $4,0($17) 774 .loc 1 257 0 775 03d4 21900000 move $18,$0 776 .loc 1 258 0 777 03d8 21A80000 move $21,$0 778 .loc 1 259 0 779 03dc 21980000 move $19,$0 780 03e0 20000224 li $2,32 # 0x20 781 03e4 09000524 li $5,9 # 0x9 782 03e8 0A000724 li $7,10 # 0xa 783 03ec 0D000824 li $8,13 # 0xd 784 03f0 0C000924 li $9,12 # 0xc 785 03f4 0B000A24 li $10,11 # 0xb 786 $L99: 269:/mnt/hgfs/boot/booter/source/stdlib.c **** 270:/mnt/hgfs/boot/booter/source/stdlib.c **** // skip any preceeding whitespace 271:/mnt/hgfs/boot/booter/source/stdlib.c **** while (isspace(**endptr)) { *endptr += sizeof(char); } 787 .loc 1 271 0 788 03f8 00000382 lb $3,0($16) 789 03fc 0B006210 beq $3,$2,$L102 790 0400 00000000 nop 791 792 0404 09006510 beq $3,$5,$L102 793 0408 00000000 nop 794 795 040c 07006710 beq $3,$7,$L102 796 0410 00000000 nop 797 798 0414 05006810 beq $3,$8,$L102 799 0418 00000000 nop 800 801 041c 03006910 beq $3,$9,$L102 802 0420 00000000 nop 803 804 0424 04006A14 bne $3,$10,$L136 805 0428 00000000 nop 806 807 $L102: 808 042c 01001026 addiu $16,$16,1GAS LISTING /tmp/ccLTWmfM.s page 20 809 0430 FE000008 j $L99 810 0434 000030AE sw $16,0($17) 811 812 $L136: 272:/mnt/hgfs/boot/booter/source/stdlib.c **** 273:/mnt/hgfs/boot/booter/source/stdlib.c **** // determine sign 274:/mnt/hgfs/boot/booter/source/stdlib.c **** if (**endptr == '-') { 813 .loc 1 274 0 814 0438 2D000224 li $2,45 # 0x2d 275:/mnt/hgfs/boot/booter/source/stdlib.c **** neg = 1; 276:/mnt/hgfs/boot/booter/source/stdlib.c **** *endptr += sizeof(char); 277:/mnt/hgfs/boot/booter/source/stdlib.c **** } else if (**endptr == '+') { 815 .loc 1 277 0 816 .loc 1 274 0 817 043c 58006210 beq $3,$2,$L137 818 0440 2B000224 li $2,43 # 0x2b 819 820 .loc 1 277 0 821 0444 5A006210 beq $3,$2,$L138 822 0448 00000000 nop 823 824 $L104: 278:/mnt/hgfs/boot/booter/source/stdlib.c **** *endptr += sizeof(char); 279:/mnt/hgfs/boot/booter/source/stdlib.c **** } 280:/mnt/hgfs/boot/booter/source/stdlib.c **** 281:/mnt/hgfs/boot/booter/source/stdlib.c **** switch(base) 825 .loc 1 281 0 826 044c 08000224 li $2,8 # 0x8 827 0450 3300C210 beq $6,$2,$L114 828 0454 0900C228 slt $2,$6,9 829 830 0458 10004010 beq $2,$0,$L127 831 045c 0A000224 li $2,10 # 0xa 832 282:/mnt/hgfs/boot/booter/source/stdlib.c **** { 283:/mnt/hgfs/boot/booter/source/stdlib.c **** case 0: 284:/mnt/hgfs/boot/booter/source/stdlib.c **** // determine actual base 285:/mnt/hgfs/boot/booter/source/stdlib.c **** if (**endptr == '0') { 833 .loc 1 285 0 834 .loc 1 281 0 835 0460 5600C010 beq $6,$0,$L107 836 0464 30000224 li $2,48 # 0x30 837 838 $L106: 286:/mnt/hgfs/boot/booter/source/stdlib.c **** *endptr += sizeof(char);; 287:/mnt/hgfs/boot/booter/source/stdlib.c **** if (**endptr == 'x') 288:/mnt/hgfs/boot/booter/source/stdlib.c **** return strtol(nptr, endptr, 16); 289:/mnt/hgfs/boot/booter/source/stdlib.c **** if (isdigit(**endptr)) 290:/mnt/hgfs/boot/booter/source/stdlib.c **** return strtol(nptr, endptr, 8); 291:/mnt/hgfs/boot/booter/source/stdlib.c **** return 0; 292:/mnt/hgfs/boot/booter/source/stdlib.c **** } else { 293:/mnt/hgfs/boot/booter/source/stdlib.c **** if (isdigit(**endptr)) 294:/mnt/hgfs/boot/booter/source/stdlib.c **** return strtol(nptr, endptr, 10); 295:/mnt/hgfs/boot/booter/source/stdlib.c **** return 0; 296:/mnt/hgfs/boot/booter/source/stdlib.c **** } 297:/mnt/hgfs/boot/booter/source/stdlib.c **** break; 298:/mnt/hgfs/boot/booter/source/stdlib.c **** GAS LISTING /tmp/ccLTWmfM.s page 21 299:/mnt/hgfs/boot/booter/source/stdlib.c **** case 8: 300:/mnt/hgfs/boot/booter/source/stdlib.c **** while ((**endptr >= '0') && (**endptr <= '7')) { 301:/mnt/hgfs/boot/booter/source/stdlib.c **** value *= base; 302:/mnt/hgfs/boot/booter/source/stdlib.c **** value += **endptr - '0'; 303:/mnt/hgfs/boot/booter/source/stdlib.c **** *endptr += sizeof(char); 304:/mnt/hgfs/boot/booter/source/stdlib.c **** } 305:/mnt/hgfs/boot/booter/source/stdlib.c **** break; 306:/mnt/hgfs/boot/booter/source/stdlib.c **** 307:/mnt/hgfs/boot/booter/source/stdlib.c **** case 10: 308:/mnt/hgfs/boot/booter/source/stdlib.c **** while (isdigit(**endptr)) { 309:/mnt/hgfs/boot/booter/source/stdlib.c **** value *= base; 310:/mnt/hgfs/boot/booter/source/stdlib.c **** value += **endptr - '0'; 311:/mnt/hgfs/boot/booter/source/stdlib.c **** *endptr += sizeof(char); 312:/mnt/hgfs/boot/booter/source/stdlib.c **** } 313:/mnt/hgfs/boot/booter/source/stdlib.c **** break; 314:/mnt/hgfs/boot/booter/source/stdlib.c **** 315:/mnt/hgfs/boot/booter/source/stdlib.c **** case 16: 316:/mnt/hgfs/boot/booter/source/stdlib.c **** while (isxdigit(**endptr) || ((**endptr == 'x') && (x ^= 1))) { // should break after the sec 317:/mnt/hgfs/boot/booter/source/stdlib.c **** value = value << 4; 318:/mnt/hgfs/boot/booter/source/stdlib.c **** value += hexchartoi(**endptr); 319:/mnt/hgfs/boot/booter/source/stdlib.c **** *endptr += sizeof(char); 320:/mnt/hgfs/boot/booter/source/stdlib.c **** } 321:/mnt/hgfs/boot/booter/source/stdlib.c **** break; 322:/mnt/hgfs/boot/booter/source/stdlib.c **** } 323:/mnt/hgfs/boot/booter/source/stdlib.c **** 324:/mnt/hgfs/boot/booter/source/stdlib.c **** if (neg) value = 0 - value; 839 .loc 1 324 0 840 0468 23101200 subu $2,$0,$18 841 $L142: 842 046c 21284002 move $5,$18 843 0470 0B285500 movn $5,$2,$21 844 $L97: 325:/mnt/hgfs/boot/booter/source/stdlib.c **** 326:/mnt/hgfs/boot/booter/source/stdlib.c **** return value; 327:/mnt/hgfs/boot/booter/source/stdlib.c **** } 845 .loc 1 327 0 846 0474 3000BF8F lw $31,48($sp) 847 0478 2C00B58F lw $21,44($sp) 848 047c 2800B48F lw $20,40($sp) 849 0480 2400B38F lw $19,36($sp) 850 0484 2000B28F lw $18,32($sp) 851 0488 1C00B18F lw $17,28($sp) 852 048c 1800B08F lw $16,24($sp) 853 0490 2110A000 move $2,$5 854 0494 0800E003 j $31 855 0498 3800BD27 addiu $sp,$sp,56 856 857 $L127: 858 .loc 1 281 0 859 049c 5600C210 beq $6,$2,$L118 860 04a0 10000224 li $2,16 # 0x10 861 862 .loc 1 324 0 863 .loc 1 281 0 864 04a4 F1FFC214 bne $6,$2,$L142 865 04a8 23101200 subu $2,$0,$18 866 GAS LISTING /tmp/ccLTWmfM.s page 22 867 04ac 35010008 j $L123 868 04b0 78001424 li $20,120 # 0x78 869 870 $L139: 871 .loc 1 324 0 872 .loc 1 319 0 873 04b4 EDFF6012 beq $19,$0,$L142 874 04b8 23101200 subu $2,$0,$18 875 876 $L126: 877 .loc 1 318 0 878 04bc 00000482 lb $4,0($16) 879 .loc 1 317 0 880 04c0 00911200 sll $18,$18,4 881 .loc 1 319 0 882 .loc 1 318 0 883 04c4 0000000C jal hexchartoi 884 04c8 01001026 addiu $16,$16,1 885 886 04cc 21904202 addu $18,$18,$2 887 .loc 1 319 0 888 04d0 000030AE sw $16,0($17) 889 $L123: 890 04d4 00000492 lbu $4,0($16) 891 04d8 9FFF8224 addiu $2,$4,-97 892 04dc BFFF8324 addiu $3,$4,-65 893 04e0 FF004230 andi $2,$2,0x00ff 894 04e4 FF006330 andi $3,$3,0x00ff 895 04e8 0600422C sltu $2,$2,6 896 04ec F3FF4014 bne $2,$0,$L126 897 04f0 0600632C sltu $3,$3,6 898 899 04f4 D0FF8224 addiu $2,$4,-48 900 04f8 FF004230 andi $2,$2,0x00ff 901 04fc EFFF6014 bne $3,$0,$L126 902 0500 0A00422C sltu $2,$2,10 903 904 0504 001E0400 sll $3,$4,24 905 0508 ECFF4014 bne $2,$0,$L126 906 050c 031E0300 sra $3,$3,24 907 908 0510 E8FF7410 beq $3,$20,$L139 909 0514 0100733A xori $19,$19,0x1 910 911 .loc 1 324 0 912 0518 1B010008 j $L142 913 051c 23101200 subu $2,$0,$18 914 915 $L114: 916 .loc 1 303 0 917 0520 00000292 lbu $2,0($16) 918 0524 D0FF4224 addiu $2,$2,-48 919 0528 FF004230 andi $2,$2,0x00ff 920 052c 0800422C sltu $2,$2,8 921 .loc 1 324 0 922 .loc 1 303 0 923 0530 CEFF4010 beq $2,$0,$L142GAS LISTING /tmp/ccLTWmfM.s page 23 924 0534 23101200 subu $2,$0,$18 925 926 $L117: 927 .loc 1 302 0 928 0538 00000282 lb $2,0($16) 929 053c 21200002 move $4,$16 930 .loc 1 303 0 931 0540 01001026 addiu $16,$16,1 932 0544 000030AE sw $16,0($17) 933 0548 01008390 lbu $3,1($4) 934 .loc 1 302 0 935 054c 02204672 mul $4,$18,$6 936 .loc 1 303 0 937 0550 D0FF6324 addiu $3,$3,-48 938 0554 FF006330 andi $3,$3,0x00ff 939 0558 0800632C sltu $3,$3,8 940 .loc 1 302 0 941 055c 21108200 addu $2,$4,$2 942 .loc 1 303 0 943 0560 C1FF6010 beq $3,$0,$L106 944 0564 D0FF5224 addiu $18,$2,-48 945 946 .loc 1 302 0 947 0568 00000282 lb $2,0($16) 948 056c 21200002 move $4,$16 949 .loc 1 303 0 950 0570 01001026 addiu $16,$16,1 951 0574 000030AE sw $16,0($17) 952 0578 01008390 lbu $3,1($4) 953 .loc 1 302 0 954 057c 02204672 mul $4,$18,$6 955 .loc 1 303 0 956 0580 D0FF6324 addiu $3,$3,-48 957 0584 FF006330 andi $3,$3,0x00ff 958 0588 0800632C sltu $3,$3,8 959 .loc 1 302 0 960 058c 21108200 addu $2,$4,$2 961 .loc 1 303 0 962 0590 E9FF6014 bne $3,$0,$L117 963 0594 D0FF5224 addiu $18,$2,-48 964 965 .loc 1 324 0 966 0598 1B010008 j $L142 967 059c 23101200 subu $2,$0,$18 968 969 $L137: 970 .loc 1 276 0 971 05a0 01001026 addiu $16,$16,1 972 .loc 1 275 0 973 05a4 01001524 li $21,1 # 0x1 974 .loc 1 278 0 975 05a8 13010008 j $L104 976 05ac 000030AE sw $16,0($17)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -