text
stringlengths
1
1.05M
; A135536: a(n) = 8*a(n-2), with a(0) = 7, a(1) = 14. ; 7,14,56,112,448,896,3584,7168,28672,57344,229376,458752,1835008,3670016,14680064,29360128,117440512,234881024,939524096,1879048192,7516192768,15032385536,60129542144,120259084288,481036337152,962072674304,3848290697216,7696581394432,30786325577728,61572651155456,246290604621824,492581209243648,1970324836974592,3940649673949184 mul $0,6 div $0,4 mov $1,2 pow $1,$0 sub $1,1 mul $1,7 add $1,7
; A189782: n+[nr/t]+[ns/t]; r=pi/2, s=arcsin(8/17), t=arcsin(15/17). ; 2,4,8,10,14,16,20,22,26,28,30,34,36,40,42,46,48,52,54,58,60,62,66,68,72,74,78,80,84,86,90,92,94,98,100,104,106,110,112,116,118,122,124,126,130,132,136,138,142,144,148,150,154,156,158,162,164,168,170,174,176,180,182,186,188,190,194,196,200,202,206,208,212,214,216,220,222,226 mov $4,$0 add $4,1 mov $7,$0 lpb $4,1 mov $0,$7 sub $4,1 sub $0,$4 mov $2,2 mov $6,$0 lpb $2,1 mov $0,$6 sub $2,1 add $0,$2 mul $0,14 sub $0,1 mul $0,14 div $0,432 mov $5,$0 mov $8,$2 lpb $8,1 mov $3,$5 sub $8,1 lpe lpe lpb $6,1 sub $3,$5 mov $6,0 lpe mov $5,$3 mul $5,2 add $5,2 add $1,$5 lpe
; A044766: Numbers n such that string 5,3 occurs in the base 10 representation of n but not of n+1. ; Submitted by Christian Krause ; 53,153,253,353,453,539,553,653,753,853,953,1053,1153,1253,1353,1453,1539,1553,1653,1753,1853,1953,2053,2153,2253,2353,2453,2539,2553,2653,2753,2853,2953,3053,3153,3253,3353,3453,3539 add $0,1 seq $0,44397 ; Numbers n such that string 6,5 occurs in the base 10 representation of n but not of n-1. div $0,2 mul $0,2 sub $0,111
%ifidn __OUTPUT_FORMAT__,obj section code use32 class=code align=64 %elifidn __OUTPUT_FORMAT__,win32 $@feat.00 equ 1 section .text code align=64 %else section .text code %endif align 16 __x86_AES_encrypt_compact: mov DWORD [20+esp],edi xor eax,DWORD [edi] xor ebx,DWORD [4+edi] xor ecx,DWORD [8+edi] xor edx,DWORD [12+edi] mov esi,DWORD [240+edi] lea esi,[esi*1+esi-2] lea esi,[esi*8+edi] mov DWORD [24+esp],esi mov edi,DWORD [ebp-128] mov esi,DWORD [ebp-96] mov edi,DWORD [ebp-64] mov esi,DWORD [ebp-32] mov edi,DWORD [ebp] mov esi,DWORD [32+ebp] mov edi,DWORD [64+ebp] mov esi,DWORD [96+ebp] align 16 L$000loop: mov esi,eax and esi,255 movzx esi,BYTE [esi*1+ebp-128] movzx edi,bh movzx edi,BYTE [edi*1+ebp-128] shl edi,8 xor esi,edi mov edi,ecx shr edi,16 and edi,255 movzx edi,BYTE [edi*1+ebp-128] shl edi,16 xor esi,edi mov edi,edx shr edi,24 movzx edi,BYTE [edi*1+ebp-128] shl edi,24 xor esi,edi mov DWORD [4+esp],esi mov esi,ebx and esi,255 shr ebx,16 movzx esi,BYTE [esi*1+ebp-128] movzx edi,ch movzx edi,BYTE [edi*1+ebp-128] shl edi,8 xor esi,edi mov edi,edx shr edi,16 and edi,255 movzx edi,BYTE [edi*1+ebp-128] shl edi,16 xor esi,edi mov edi,eax shr edi,24 movzx edi,BYTE [edi*1+ebp-128] shl edi,24 xor esi,edi mov DWORD [8+esp],esi mov esi,ecx and esi,255 shr ecx,24 movzx esi,BYTE [esi*1+ebp-128] movzx edi,dh movzx edi,BYTE [edi*1+ebp-128] shl edi,8 xor esi,edi mov edi,eax shr edi,16 and edx,255 and edi,255 movzx edi,BYTE [edi*1+ebp-128] shl edi,16 xor esi,edi movzx edi,bh movzx edi,BYTE [edi*1+ebp-128] shl edi,24 xor esi,edi and edx,255 movzx edx,BYTE [edx*1+ebp-128] movzx eax,ah movzx eax,BYTE [eax*1+ebp-128] shl eax,8 xor edx,eax mov eax,DWORD [4+esp] and ebx,255 movzx ebx,BYTE [ebx*1+ebp-128] shl ebx,16 xor edx,ebx mov ebx,DWORD [8+esp] movzx ecx,BYTE [ecx*1+ebp-128] shl ecx,24 xor edx,ecx mov ecx,esi mov ebp,2155905152 and ebp,ecx lea edi,[ecx*1+ecx] mov esi,ebp shr ebp,7 and edi,4278124286 sub esi,ebp mov ebp,ecx and esi,454761243 ror ebp,16 xor esi,edi mov edi,ecx xor ecx,esi ror edi,24 xor esi,ebp rol ecx,24 xor esi,edi mov ebp,2155905152 xor ecx,esi and ebp,edx lea edi,[edx*1+edx] mov esi,ebp shr ebp,7 and edi,4278124286 sub esi,ebp mov ebp,edx and esi,454761243 ror ebp,16 xor esi,edi mov edi,edx xor edx,esi ror edi,24 xor esi,ebp rol edx,24 xor esi,edi mov ebp,2155905152 xor edx,esi and ebp,eax lea edi,[eax*1+eax] mov esi,ebp shr ebp,7 and edi,4278124286 sub esi,ebp mov ebp,eax and esi,454761243 ror ebp,16 xor esi,edi mov edi,eax xor eax,esi ror edi,24 xor esi,ebp rol eax,24 xor esi,edi mov ebp,2155905152 xor eax,esi and ebp,ebx lea edi,[ebx*1+ebx] mov esi,ebp shr ebp,7 and edi,4278124286 sub esi,ebp mov ebp,ebx and esi,454761243 ror ebp,16 xor esi,edi mov edi,ebx xor ebx,esi ror edi,24 xor esi,ebp rol ebx,24 xor esi,edi xor ebx,esi mov edi,DWORD [20+esp] mov ebp,DWORD [28+esp] add edi,16 xor eax,DWORD [edi] xor ebx,DWORD [4+edi] xor ecx,DWORD [8+edi] xor edx,DWORD [12+edi] cmp edi,DWORD [24+esp] mov DWORD [20+esp],edi jb NEAR L$000loop mov esi,eax and esi,255 movzx esi,BYTE [esi*1+ebp-128] movzx edi,bh movzx edi,BYTE [edi*1+ebp-128] shl edi,8 xor esi,edi mov edi,ecx shr edi,16 and edi,255 movzx edi,BYTE [edi*1+ebp-128] shl edi,16 xor esi,edi mov edi,edx shr edi,24 movzx edi,BYTE [edi*1+ebp-128] shl edi,24 xor esi,edi mov DWORD [4+esp],esi mov esi,ebx and esi,255 shr ebx,16 movzx esi,BYTE [esi*1+ebp-128] movzx edi,ch movzx edi,BYTE [edi*1+ebp-128] shl edi,8 xor esi,edi mov edi,edx shr edi,16 and edi,255 movzx edi,BYTE [edi*1+ebp-128] shl edi,16 xor esi,edi mov edi,eax shr edi,24 movzx edi,BYTE [edi*1+ebp-128] shl edi,24 xor esi,edi mov DWORD [8+esp],esi mov esi,ecx and esi,255 shr ecx,24 movzx esi,BYTE [esi*1+ebp-128] movzx edi,dh movzx edi,BYTE [edi*1+ebp-128] shl edi,8 xor esi,edi mov edi,eax shr edi,16 and edx,255 and edi,255 movzx edi,BYTE [edi*1+ebp-128] shl edi,16 xor esi,edi movzx edi,bh movzx edi,BYTE [edi*1+ebp-128] shl edi,24 xor esi,edi mov edi,DWORD [20+esp] and edx,255 movzx edx,BYTE [edx*1+ebp-128] movzx eax,ah movzx eax,BYTE [eax*1+ebp-128] shl eax,8 xor edx,eax mov eax,DWORD [4+esp] and ebx,255 movzx ebx,BYTE [ebx*1+ebp-128] shl ebx,16 xor edx,ebx mov ebx,DWORD [8+esp] movzx ecx,BYTE [ecx*1+ebp-128] shl ecx,24 xor edx,ecx mov ecx,esi xor eax,DWORD [16+edi] xor ebx,DWORD [20+edi] xor ecx,DWORD [24+edi] xor edx,DWORD [28+edi] ret align 16 __sse_AES_encrypt_compact: pxor mm0,[edi] pxor mm4,[8+edi] mov esi,DWORD [240+edi] lea esi,[esi*1+esi-2] lea esi,[esi*8+edi] mov DWORD [24+esp],esi mov eax,454761243 mov DWORD [8+esp],eax mov DWORD [12+esp],eax mov eax,DWORD [ebp-128] mov ebx,DWORD [ebp-96] mov ecx,DWORD [ebp-64] mov edx,DWORD [ebp-32] mov eax,DWORD [ebp] mov ebx,DWORD [32+ebp] mov ecx,DWORD [64+ebp] mov edx,DWORD [96+ebp] align 16 L$001loop: pshufw mm1,mm0,8 pshufw mm5,mm4,13 movd eax,mm1 movd ebx,mm5 mov DWORD [20+esp],edi movzx esi,al movzx edx,ah pshufw mm2,mm0,13 movzx ecx,BYTE [esi*1+ebp-128] movzx edi,bl movzx edx,BYTE [edx*1+ebp-128] shr eax,16 shl edx,8 movzx esi,BYTE [edi*1+ebp-128] movzx edi,bh shl esi,16 pshufw mm6,mm4,8 or ecx,esi movzx esi,BYTE [edi*1+ebp-128] movzx edi,ah shl esi,24 shr ebx,16 or edx,esi movzx esi,BYTE [edi*1+ebp-128] movzx edi,bh shl esi,8 or ecx,esi movzx esi,BYTE [edi*1+ebp-128] movzx edi,al shl esi,24 or ecx,esi movzx esi,BYTE [edi*1+ebp-128] movzx edi,bl movd eax,mm2 movd mm0,ecx movzx ecx,BYTE [edi*1+ebp-128] movzx edi,ah shl ecx,16 movd ebx,mm6 or ecx,esi movzx esi,BYTE [edi*1+ebp-128] movzx edi,bh shl esi,24 or ecx,esi movzx esi,BYTE [edi*1+ebp-128] movzx edi,bl shl esi,8 shr ebx,16 or ecx,esi movzx esi,BYTE [edi*1+ebp-128] movzx edi,al shr eax,16 movd mm1,ecx movzx ecx,BYTE [edi*1+ebp-128] movzx edi,ah shl ecx,16 and eax,255 or ecx,esi punpckldq mm0,mm1 movzx esi,BYTE [edi*1+ebp-128] movzx edi,bh shl esi,24 and ebx,255 movzx eax,BYTE [eax*1+ebp-128] or ecx,esi shl eax,16 movzx esi,BYTE [edi*1+ebp-128] or edx,eax shl esi,8 movzx ebx,BYTE [ebx*1+ebp-128] or ecx,esi or edx,ebx mov edi,DWORD [20+esp] movd mm4,ecx movd mm5,edx punpckldq mm4,mm5 add edi,16 cmp edi,DWORD [24+esp] ja NEAR L$002out movq mm2,[8+esp] pxor mm3,mm3 pxor mm7,mm7 movq mm1,mm0 movq mm5,mm4 pcmpgtb mm3,mm0 pcmpgtb mm7,mm4 pand mm3,mm2 pand mm7,mm2 pshufw mm2,mm0,177 pshufw mm6,mm4,177 paddb mm0,mm0 paddb mm4,mm4 pxor mm0,mm3 pxor mm4,mm7 pshufw mm3,mm2,177 pshufw mm7,mm6,177 pxor mm1,mm0 pxor mm5,mm4 pxor mm0,mm2 pxor mm4,mm6 movq mm2,mm3 movq mm6,mm7 pslld mm3,8 pslld mm7,8 psrld mm2,24 psrld mm6,24 pxor mm0,mm3 pxor mm4,mm7 pxor mm0,mm2 pxor mm4,mm6 movq mm3,mm1 movq mm7,mm5 movq mm2,[edi] movq mm6,[8+edi] psrld mm1,8 psrld mm5,8 mov eax,DWORD [ebp-128] pslld mm3,24 pslld mm7,24 mov ebx,DWORD [ebp-64] pxor mm0,mm1 pxor mm4,mm5 mov ecx,DWORD [ebp] pxor mm0,mm3 pxor mm4,mm7 mov edx,DWORD [64+ebp] pxor mm0,mm2 pxor mm4,mm6 jmp NEAR L$001loop align 16 L$002out: pxor mm0,[edi] pxor mm4,[8+edi] ret align 16 __x86_AES_encrypt: mov DWORD [20+esp],edi xor eax,DWORD [edi] xor ebx,DWORD [4+edi] xor ecx,DWORD [8+edi] xor edx,DWORD [12+edi] mov esi,DWORD [240+edi] lea esi,[esi*1+esi-2] lea esi,[esi*8+edi] mov DWORD [24+esp],esi align 16 L$003loop: mov esi,eax and esi,255 mov esi,DWORD [esi*8+ebp] movzx edi,bh xor esi,DWORD [3+edi*8+ebp] mov edi,ecx shr edi,16 and edi,255 xor esi,DWORD [2+edi*8+ebp] mov edi,edx shr edi,24 xor esi,DWORD [1+edi*8+ebp] mov DWORD [4+esp],esi mov esi,ebx and esi,255 shr ebx,16 mov esi,DWORD [esi*8+ebp] movzx edi,ch xor esi,DWORD [3+edi*8+ebp] mov edi,edx shr edi,16 and edi,255 xor esi,DWORD [2+edi*8+ebp] mov edi,eax shr edi,24 xor esi,DWORD [1+edi*8+ebp] mov DWORD [8+esp],esi mov esi,ecx and esi,255 shr ecx,24 mov esi,DWORD [esi*8+ebp] movzx edi,dh xor esi,DWORD [3+edi*8+ebp] mov edi,eax shr edi,16 and edx,255 and edi,255 xor esi,DWORD [2+edi*8+ebp] movzx edi,bh xor esi,DWORD [1+edi*8+ebp] mov edi,DWORD [20+esp] mov edx,DWORD [edx*8+ebp] movzx eax,ah xor edx,DWORD [3+eax*8+ebp] mov eax,DWORD [4+esp] and ebx,255 xor edx,DWORD [2+ebx*8+ebp] mov ebx,DWORD [8+esp] xor edx,DWORD [1+ecx*8+ebp] mov ecx,esi add edi,16 xor eax,DWORD [edi] xor ebx,DWORD [4+edi] xor ecx,DWORD [8+edi] xor edx,DWORD [12+edi] cmp edi,DWORD [24+esp] mov DWORD [20+esp],edi jb NEAR L$003loop mov esi,eax and esi,255 mov esi,DWORD [2+esi*8+ebp] and esi,255 movzx edi,bh mov edi,DWORD [edi*8+ebp] and edi,65280 xor esi,edi mov edi,ecx shr edi,16 and edi,255 mov edi,DWORD [edi*8+ebp] and edi,16711680 xor esi,edi mov edi,edx shr edi,24 mov edi,DWORD [2+edi*8+ebp] and edi,4278190080 xor esi,edi mov DWORD [4+esp],esi mov esi,ebx and esi,255 shr ebx,16 mov esi,DWORD [2+esi*8+ebp] and esi,255 movzx edi,ch mov edi,DWORD [edi*8+ebp] and edi,65280 xor esi,edi mov edi,edx shr edi,16 and edi,255 mov edi,DWORD [edi*8+ebp] and edi,16711680 xor esi,edi mov edi,eax shr edi,24 mov edi,DWORD [2+edi*8+ebp] and edi,4278190080 xor esi,edi mov DWORD [8+esp],esi mov esi,ecx and esi,255 shr ecx,24 mov esi,DWORD [2+esi*8+ebp] and esi,255 movzx edi,dh mov edi,DWORD [edi*8+ebp] and edi,65280 xor esi,edi mov edi,eax shr edi,16 and edx,255 and edi,255 mov edi,DWORD [edi*8+ebp] and edi,16711680 xor esi,edi movzx edi,bh mov edi,DWORD [2+edi*8+ebp] and edi,4278190080 xor esi,edi mov edi,DWORD [20+esp] and edx,255 mov edx,DWORD [2+edx*8+ebp] and edx,255 movzx eax,ah mov eax,DWORD [eax*8+ebp] and eax,65280 xor edx,eax mov eax,DWORD [4+esp] and ebx,255 mov ebx,DWORD [ebx*8+ebp] and ebx,16711680 xor edx,ebx mov ebx,DWORD [8+esp] mov ecx,DWORD [2+ecx*8+ebp] and ecx,4278190080 xor edx,ecx mov ecx,esi add edi,16 xor eax,DWORD [edi] xor ebx,DWORD [4+edi] xor ecx,DWORD [8+edi] xor edx,DWORD [12+edi] ret align 64 L$AES_Te: dd 2774754246,2774754246 dd 2222750968,2222750968 dd 2574743534,2574743534 dd 2373680118,2373680118 dd 234025727,234025727 dd 3177933782,3177933782 dd 2976870366,2976870366 dd 1422247313,1422247313 dd 1345335392,1345335392 dd 50397442,50397442 dd 2842126286,2842126286 dd 2099981142,2099981142 dd 436141799,436141799 dd 1658312629,1658312629 dd 3870010189,3870010189 dd 2591454956,2591454956 dd 1170918031,1170918031 dd 2642575903,2642575903 dd 1086966153,1086966153 dd 2273148410,2273148410 dd 368769775,368769775 dd 3948501426,3948501426 dd 3376891790,3376891790 dd 200339707,200339707 dd 3970805057,3970805057 dd 1742001331,1742001331 dd 4255294047,4255294047 dd 3937382213,3937382213 dd 3214711843,3214711843 dd 4154762323,4154762323 dd 2524082916,2524082916 dd 1539358875,1539358875 dd 3266819957,3266819957 dd 486407649,486407649 dd 2928907069,2928907069 dd 1780885068,1780885068 dd 1513502316,1513502316 dd 1094664062,1094664062 dd 49805301,49805301 dd 1338821763,1338821763 dd 1546925160,1546925160 dd 4104496465,4104496465 dd 887481809,887481809 dd 150073849,150073849 dd 2473685474,2473685474 dd 1943591083,1943591083 dd 1395732834,1395732834 dd 1058346282,1058346282 dd 201589768,201589768 dd 1388824469,1388824469 dd 1696801606,1696801606 dd 1589887901,1589887901 dd 672667696,672667696 dd 2711000631,2711000631 dd 251987210,251987210 dd 3046808111,3046808111 dd 151455502,151455502 dd 907153956,907153956 dd 2608889883,2608889883 dd 1038279391,1038279391 dd 652995533,652995533 dd 1764173646,1764173646 dd 3451040383,3451040383 dd 2675275242,2675275242 dd 453576978,453576978 dd 2659418909,2659418909 dd 1949051992,1949051992 dd 773462580,773462580 dd 756751158,756751158 dd 2993581788,2993581788 dd 3998898868,3998898868 dd 4221608027,4221608027 dd 4132590244,4132590244 dd 1295727478,1295727478 dd 1641469623,1641469623 dd 3467883389,3467883389 dd 2066295122,2066295122 dd 1055122397,1055122397 dd 1898917726,1898917726 dd 2542044179,2542044179 dd 4115878822,4115878822 dd 1758581177,1758581177 dd 0,0 dd 753790401,753790401 dd 1612718144,1612718144 dd 536673507,536673507 dd 3367088505,3367088505 dd 3982187446,3982187446 dd 3194645204,3194645204 dd 1187761037,1187761037 dd 3653156455,3653156455 dd 1262041458,1262041458 dd 3729410708,3729410708 dd 3561770136,3561770136 dd 3898103984,3898103984 dd 1255133061,1255133061 dd 1808847035,1808847035 dd 720367557,720367557 dd 3853167183,3853167183 dd 385612781,385612781 dd 3309519750,3309519750 dd 3612167578,3612167578 dd 1429418854,1429418854 dd 2491778321,2491778321 dd 3477423498,3477423498 dd 284817897,284817897 dd 100794884,100794884 dd 2172616702,2172616702 dd 4031795360,4031795360 dd 1144798328,1144798328 dd 3131023141,3131023141 dd 3819481163,3819481163 dd 4082192802,4082192802 dd 4272137053,4272137053 dd 3225436288,3225436288 dd 2324664069,2324664069 dd 2912064063,2912064063 dd 3164445985,3164445985 dd 1211644016,1211644016 dd 83228145,83228145 dd 3753688163,3753688163 dd 3249976951,3249976951 dd 1977277103,1977277103 dd 1663115586,1663115586 dd 806359072,806359072 dd 452984805,452984805 dd 250868733,250868733 dd 1842533055,1842533055 dd 1288555905,1288555905 dd 336333848,336333848 dd 890442534,890442534 dd 804056259,804056259 dd 3781124030,3781124030 dd 2727843637,2727843637 dd 3427026056,3427026056 dd 957814574,957814574 dd 1472513171,1472513171 dd 4071073621,4071073621 dd 2189328124,2189328124 dd 1195195770,1195195770 dd 2892260552,2892260552 dd 3881655738,3881655738 dd 723065138,723065138 dd 2507371494,2507371494 dd 2690670784,2690670784 dd 2558624025,2558624025 dd 3511635870,3511635870 dd 2145180835,2145180835 dd 1713513028,1713513028 dd 2116692564,2116692564 dd 2878378043,2878378043 dd 2206763019,2206763019 dd 3393603212,3393603212 dd 703524551,703524551 dd 3552098411,3552098411 dd 1007948840,1007948840 dd 2044649127,2044649127 dd 3797835452,3797835452 dd 487262998,487262998 dd 1994120109,1994120109 dd 1004593371,1004593371 dd 1446130276,1446130276 dd 1312438900,1312438900 dd 503974420,503974420 dd 3679013266,3679013266 dd 168166924,168166924 dd 1814307912,1814307912 dd 3831258296,3831258296 dd 1573044895,1573044895 dd 1859376061,1859376061 dd 4021070915,4021070915 dd 2791465668,2791465668 dd 2828112185,2828112185 dd 2761266481,2761266481 dd 937747667,937747667 dd 2339994098,2339994098 dd 854058965,854058965 dd 1137232011,1137232011 dd 1496790894,1496790894 dd 3077402074,3077402074 dd 2358086913,2358086913 dd 1691735473,1691735473 dd 3528347292,3528347292 dd 3769215305,3769215305 dd 3027004632,3027004632 dd 4199962284,4199962284 dd 133494003,133494003 dd 636152527,636152527 dd 2942657994,2942657994 dd 2390391540,2390391540 dd 3920539207,3920539207 dd 403179536,403179536 dd 3585784431,3585784431 dd 2289596656,2289596656 dd 1864705354,1864705354 dd 1915629148,1915629148 dd 605822008,605822008 dd 4054230615,4054230615 dd 3350508659,3350508659 dd 1371981463,1371981463 dd 602466507,602466507 dd 2094914977,2094914977 dd 2624877800,2624877800 dd 555687742,555687742 dd 3712699286,3712699286 dd 3703422305,3703422305 dd 2257292045,2257292045 dd 2240449039,2240449039 dd 2423288032,2423288032 dd 1111375484,1111375484 dd 3300242801,3300242801 dd 2858837708,2858837708 dd 3628615824,3628615824 dd 84083462,84083462 dd 32962295,32962295 dd 302911004,302911004 dd 2741068226,2741068226 dd 1597322602,1597322602 dd 4183250862,4183250862 dd 3501832553,3501832553 dd 2441512471,2441512471 dd 1489093017,1489093017 dd 656219450,656219450 dd 3114180135,3114180135 dd 954327513,954327513 dd 335083755,335083755 dd 3013122091,3013122091 dd 856756514,856756514 dd 3144247762,3144247762 dd 1893325225,1893325225 dd 2307821063,2307821063 dd 2811532339,2811532339 dd 3063651117,3063651117 dd 572399164,572399164 dd 2458355477,2458355477 dd 552200649,552200649 dd 1238290055,1238290055 dd 4283782570,4283782570 dd 2015897680,2015897680 dd 2061492133,2061492133 dd 2408352771,2408352771 dd 4171342169,4171342169 dd 2156497161,2156497161 dd 386731290,386731290 dd 3669999461,3669999461 dd 837215959,837215959 dd 3326231172,3326231172 dd 3093850320,3093850320 dd 3275833730,3275833730 dd 2962856233,2962856233 dd 1999449434,1999449434 dd 286199582,286199582 dd 3417354363,3417354363 dd 4233385128,4233385128 dd 3602627437,3602627437 dd 974525996,974525996 db 99,124,119,123,242,107,111,197 db 48,1,103,43,254,215,171,118 db 202,130,201,125,250,89,71,240 db 173,212,162,175,156,164,114,192 db 183,253,147,38,54,63,247,204 db 52,165,229,241,113,216,49,21 db 4,199,35,195,24,150,5,154 db 7,18,128,226,235,39,178,117 db 9,131,44,26,27,110,90,160 db 82,59,214,179,41,227,47,132 db 83,209,0,237,32,252,177,91 db 106,203,190,57,74,76,88,207 db 208,239,170,251,67,77,51,133 db 69,249,2,127,80,60,159,168 db 81,163,64,143,146,157,56,245 db 188,182,218,33,16,255,243,210 db 205,12,19,236,95,151,68,23 db 196,167,126,61,100,93,25,115 db 96,129,79,220,34,42,144,136 db 70,238,184,20,222,94,11,219 db 224,50,58,10,73,6,36,92 db 194,211,172,98,145,149,228,121 db 231,200,55,109,141,213,78,169 db 108,86,244,234,101,122,174,8 db 186,120,37,46,28,166,180,198 db 232,221,116,31,75,189,139,138 db 112,62,181,102,72,3,246,14 db 97,53,87,185,134,193,29,158 db 225,248,152,17,105,217,142,148 db 155,30,135,233,206,85,40,223 db 140,161,137,13,191,230,66,104 db 65,153,45,15,176,84,187,22 db 99,124,119,123,242,107,111,197 db 48,1,103,43,254,215,171,118 db 202,130,201,125,250,89,71,240 db 173,212,162,175,156,164,114,192 db 183,253,147,38,54,63,247,204 db 52,165,229,241,113,216,49,21 db 4,199,35,195,24,150,5,154 db 7,18,128,226,235,39,178,117 db 9,131,44,26,27,110,90,160 db 82,59,214,179,41,227,47,132 db 83,209,0,237,32,252,177,91 db 106,203,190,57,74,76,88,207 db 208,239,170,251,67,77,51,133 db 69,249,2,127,80,60,159,168 db 81,163,64,143,146,157,56,245 db 188,182,218,33,16,255,243,210 db 205,12,19,236,95,151,68,23 db 196,167,126,61,100,93,25,115 db 96,129,79,220,34,42,144,136 db 70,238,184,20,222,94,11,219 db 224,50,58,10,73,6,36,92 db 194,211,172,98,145,149,228,121 db 231,200,55,109,141,213,78,169 db 108,86,244,234,101,122,174,8 db 186,120,37,46,28,166,180,198 db 232,221,116,31,75,189,139,138 db 112,62,181,102,72,3,246,14 db 97,53,87,185,134,193,29,158 db 225,248,152,17,105,217,142,148 db 155,30,135,233,206,85,40,223 db 140,161,137,13,191,230,66,104 db 65,153,45,15,176,84,187,22 db 99,124,119,123,242,107,111,197 db 48,1,103,43,254,215,171,118 db 202,130,201,125,250,89,71,240 db 173,212,162,175,156,164,114,192 db 183,253,147,38,54,63,247,204 db 52,165,229,241,113,216,49,21 db 4,199,35,195,24,150,5,154 db 7,18,128,226,235,39,178,117 db 9,131,44,26,27,110,90,160 db 82,59,214,179,41,227,47,132 db 83,209,0,237,32,252,177,91 db 106,203,190,57,74,76,88,207 db 208,239,170,251,67,77,51,133 db 69,249,2,127,80,60,159,168 db 81,163,64,143,146,157,56,245 db 188,182,218,33,16,255,243,210 db 205,12,19,236,95,151,68,23 db 196,167,126,61,100,93,25,115 db 96,129,79,220,34,42,144,136 db 70,238,184,20,222,94,11,219 db 224,50,58,10,73,6,36,92 db 194,211,172,98,145,149,228,121 db 231,200,55,109,141,213,78,169 db 108,86,244,234,101,122,174,8 db 186,120,37,46,28,166,180,198 db 232,221,116,31,75,189,139,138 db 112,62,181,102,72,3,246,14 db 97,53,87,185,134,193,29,158 db 225,248,152,17,105,217,142,148 db 155,30,135,233,206,85,40,223 db 140,161,137,13,191,230,66,104 db 65,153,45,15,176,84,187,22 db 99,124,119,123,242,107,111,197 db 48,1,103,43,254,215,171,118 db 202,130,201,125,250,89,71,240 db 173,212,162,175,156,164,114,192 db 183,253,147,38,54,63,247,204 db 52,165,229,241,113,216,49,21 db 4,199,35,195,24,150,5,154 db 7,18,128,226,235,39,178,117 db 9,131,44,26,27,110,90,160 db 82,59,214,179,41,227,47,132 db 83,209,0,237,32,252,177,91 db 106,203,190,57,74,76,88,207 db 208,239,170,251,67,77,51,133 db 69,249,2,127,80,60,159,168 db 81,163,64,143,146,157,56,245 db 188,182,218,33,16,255,243,210 db 205,12,19,236,95,151,68,23 db 196,167,126,61,100,93,25,115 db 96,129,79,220,34,42,144,136 db 70,238,184,20,222,94,11,219 db 224,50,58,10,73,6,36,92 db 194,211,172,98,145,149,228,121 db 231,200,55,109,141,213,78,169 db 108,86,244,234,101,122,174,8 db 186,120,37,46,28,166,180,198 db 232,221,116,31,75,189,139,138 db 112,62,181,102,72,3,246,14 db 97,53,87,185,134,193,29,158 db 225,248,152,17,105,217,142,148 db 155,30,135,233,206,85,40,223 db 140,161,137,13,191,230,66,104 db 65,153,45,15,176,84,187,22 dd 1,2,4,8 dd 16,32,64,128 dd 27,54,0,0 dd 0,0,0,0 global _AES_encrypt align 16 _AES_encrypt: L$_AES_encrypt_begin: push ebp push ebx push esi push edi mov esi,DWORD [20+esp] mov edi,DWORD [28+esp] mov eax,esp sub esp,36 and esp,-64 lea ebx,[edi-127] sub ebx,esp neg ebx and ebx,960 sub esp,ebx add esp,4 mov DWORD [28+esp],eax call L$004pic_point L$004pic_point: pop ebp lea eax,[_OPENSSL_ia32cap_P] lea ebp,[(L$AES_Te-L$004pic_point)+ebp] lea ebx,[764+esp] sub ebx,ebp and ebx,768 lea ebp,[2176+ebx*1+ebp] bt DWORD [eax],25 jnc NEAR L$005x86 movq mm0,[esi] movq mm4,[8+esi] call __sse_AES_encrypt_compact mov esp,DWORD [28+esp] mov esi,DWORD [24+esp] movq [esi],mm0 movq [8+esi],mm4 emms pop edi pop esi pop ebx pop ebp ret align 16 L$005x86: mov DWORD [24+esp],ebp mov eax,DWORD [esi] mov ebx,DWORD [4+esi] mov ecx,DWORD [8+esi] mov edx,DWORD [12+esi] call __x86_AES_encrypt_compact mov esp,DWORD [28+esp] mov esi,DWORD [24+esp] mov DWORD [esi],eax mov DWORD [4+esi],ebx mov DWORD [8+esi],ecx mov DWORD [12+esi],edx pop edi pop esi pop ebx pop ebp ret align 16 __x86_AES_decrypt_compact: mov DWORD [20+esp],edi xor eax,DWORD [edi] xor ebx,DWORD [4+edi] xor ecx,DWORD [8+edi] xor edx,DWORD [12+edi] mov esi,DWORD [240+edi] lea esi,[esi*1+esi-2] lea esi,[esi*8+edi] mov DWORD [24+esp],esi mov edi,DWORD [ebp-128] mov esi,DWORD [ebp-96] mov edi,DWORD [ebp-64] mov esi,DWORD [ebp-32] mov edi,DWORD [ebp] mov esi,DWORD [32+ebp] mov edi,DWORD [64+ebp] mov esi,DWORD [96+ebp] align 16 L$006loop: mov esi,eax and esi,255 movzx esi,BYTE [esi*1+ebp-128] movzx edi,dh movzx edi,BYTE [edi*1+ebp-128] shl edi,8 xor esi,edi mov edi,ecx shr edi,16 and edi,255 movzx edi,BYTE [edi*1+ebp-128] shl edi,16 xor esi,edi mov edi,ebx shr edi,24 movzx edi,BYTE [edi*1+ebp-128] shl edi,24 xor esi,edi mov DWORD [4+esp],esi mov esi,ebx and esi,255 movzx esi,BYTE [esi*1+ebp-128] movzx edi,ah movzx edi,BYTE [edi*1+ebp-128] shl edi,8 xor esi,edi mov edi,edx shr edi,16 and edi,255 movzx edi,BYTE [edi*1+ebp-128] shl edi,16 xor esi,edi mov edi,ecx shr edi,24 movzx edi,BYTE [edi*1+ebp-128] shl edi,24 xor esi,edi mov DWORD [8+esp],esi mov esi,ecx and esi,255 movzx esi,BYTE [esi*1+ebp-128] movzx edi,bh movzx edi,BYTE [edi*1+ebp-128] shl edi,8 xor esi,edi mov edi,eax shr edi,16 and edi,255 movzx edi,BYTE [edi*1+ebp-128] shl edi,16 xor esi,edi mov edi,edx shr edi,24 movzx edi,BYTE [edi*1+ebp-128] shl edi,24 xor esi,edi and edx,255 movzx edx,BYTE [edx*1+ebp-128] movzx ecx,ch movzx ecx,BYTE [ecx*1+ebp-128] shl ecx,8 xor edx,ecx mov ecx,esi shr ebx,16 and ebx,255 movzx ebx,BYTE [ebx*1+ebp-128] shl ebx,16 xor edx,ebx shr eax,24 movzx eax,BYTE [eax*1+ebp-128] shl eax,24 xor edx,eax mov edi,2155905152 and edi,ecx mov esi,edi shr edi,7 lea eax,[ecx*1+ecx] sub esi,edi and eax,4278124286 and esi,454761243 xor eax,esi mov edi,2155905152 and edi,eax mov esi,edi shr edi,7 lea ebx,[eax*1+eax] sub esi,edi and ebx,4278124286 and esi,454761243 xor eax,ecx xor ebx,esi mov edi,2155905152 and edi,ebx mov esi,edi shr edi,7 lea ebp,[ebx*1+ebx] sub esi,edi and ebp,4278124286 and esi,454761243 xor ebx,ecx rol ecx,8 xor ebp,esi xor ecx,eax xor eax,ebp xor ecx,ebx xor ebx,ebp rol eax,24 xor ecx,ebp rol ebx,16 xor ecx,eax rol ebp,8 xor ecx,ebx mov eax,DWORD [4+esp] xor ecx,ebp mov DWORD [12+esp],ecx mov edi,2155905152 and edi,edx mov esi,edi shr edi,7 lea ebx,[edx*1+edx] sub esi,edi and ebx,4278124286 and esi,454761243 xor ebx,esi mov edi,2155905152 and edi,ebx mov esi,edi shr edi,7 lea ecx,[ebx*1+ebx] sub esi,edi and ecx,4278124286 and esi,454761243 xor ebx,edx xor ecx,esi mov edi,2155905152 and edi,ecx mov esi,edi shr edi,7 lea ebp,[ecx*1+ecx] sub esi,edi and ebp,4278124286 and esi,454761243 xor ecx,edx rol edx,8 xor ebp,esi xor edx,ebx xor ebx,ebp xor edx,ecx xor ecx,ebp rol ebx,24 xor edx,ebp rol ecx,16 xor edx,ebx rol ebp,8 xor edx,ecx mov ebx,DWORD [8+esp] xor edx,ebp mov DWORD [16+esp],edx mov edi,2155905152 and edi,eax mov esi,edi shr edi,7 lea ecx,[eax*1+eax] sub esi,edi and ecx,4278124286 and esi,454761243 xor ecx,esi mov edi,2155905152 and edi,ecx mov esi,edi shr edi,7 lea edx,[ecx*1+ecx] sub esi,edi and edx,4278124286 and esi,454761243 xor ecx,eax xor edx,esi mov edi,2155905152 and edi,edx mov esi,edi shr edi,7 lea ebp,[edx*1+edx] sub esi,edi and ebp,4278124286 and esi,454761243 xor edx,eax rol eax,8 xor ebp,esi xor eax,ecx xor ecx,ebp xor eax,edx xor edx,ebp rol ecx,24 xor eax,ebp rol edx,16 xor eax,ecx rol ebp,8 xor eax,edx xor eax,ebp mov edi,2155905152 and edi,ebx mov esi,edi shr edi,7 lea ecx,[ebx*1+ebx] sub esi,edi and ecx,4278124286 and esi,454761243 xor ecx,esi mov edi,2155905152 and edi,ecx mov esi,edi shr edi,7 lea edx,[ecx*1+ecx] sub esi,edi and edx,4278124286 and esi,454761243 xor ecx,ebx xor edx,esi mov edi,2155905152 and edi,edx mov esi,edi shr edi,7 lea ebp,[edx*1+edx] sub esi,edi and ebp,4278124286 and esi,454761243 xor edx,ebx rol ebx,8 xor ebp,esi xor ebx,ecx xor ecx,ebp xor ebx,edx xor edx,ebp rol ecx,24 xor ebx,ebp rol edx,16 xor ebx,ecx rol ebp,8 xor ebx,edx mov ecx,DWORD [12+esp] xor ebx,ebp mov edx,DWORD [16+esp] mov edi,DWORD [20+esp] mov ebp,DWORD [28+esp] add edi,16 xor eax,DWORD [edi] xor ebx,DWORD [4+edi] xor ecx,DWORD [8+edi] xor edx,DWORD [12+edi] cmp edi,DWORD [24+esp] mov DWORD [20+esp],edi jb NEAR L$006loop mov esi,eax and esi,255 movzx esi,BYTE [esi*1+ebp-128] movzx edi,dh movzx edi,BYTE [edi*1+ebp-128] shl edi,8 xor esi,edi mov edi,ecx shr edi,16 and edi,255 movzx edi,BYTE [edi*1+ebp-128] shl edi,16 xor esi,edi mov edi,ebx shr edi,24 movzx edi,BYTE [edi*1+ebp-128] shl edi,24 xor esi,edi mov DWORD [4+esp],esi mov esi,ebx and esi,255 movzx esi,BYTE [esi*1+ebp-128] movzx edi,ah movzx edi,BYTE [edi*1+ebp-128] shl edi,8 xor esi,edi mov edi,edx shr edi,16 and edi,255 movzx edi,BYTE [edi*1+ebp-128] shl edi,16 xor esi,edi mov edi,ecx shr edi,24 movzx edi,BYTE [edi*1+ebp-128] shl edi,24 xor esi,edi mov DWORD [8+esp],esi mov esi,ecx and esi,255 movzx esi,BYTE [esi*1+ebp-128] movzx edi,bh movzx edi,BYTE [edi*1+ebp-128] shl edi,8 xor esi,edi mov edi,eax shr edi,16 and edi,255 movzx edi,BYTE [edi*1+ebp-128] shl edi,16 xor esi,edi mov edi,edx shr edi,24 movzx edi,BYTE [edi*1+ebp-128] shl edi,24 xor esi,edi mov edi,DWORD [20+esp] and edx,255 movzx edx,BYTE [edx*1+ebp-128] movzx ecx,ch movzx ecx,BYTE [ecx*1+ebp-128] shl ecx,8 xor edx,ecx mov ecx,esi shr ebx,16 and ebx,255 movzx ebx,BYTE [ebx*1+ebp-128] shl ebx,16 xor edx,ebx mov ebx,DWORD [8+esp] shr eax,24 movzx eax,BYTE [eax*1+ebp-128] shl eax,24 xor edx,eax mov eax,DWORD [4+esp] xor eax,DWORD [16+edi] xor ebx,DWORD [20+edi] xor ecx,DWORD [24+edi] xor edx,DWORD [28+edi] ret align 16 __sse_AES_decrypt_compact: pxor mm0,[edi] pxor mm4,[8+edi] mov esi,DWORD [240+edi] lea esi,[esi*1+esi-2] lea esi,[esi*8+edi] mov DWORD [24+esp],esi mov eax,454761243 mov DWORD [8+esp],eax mov DWORD [12+esp],eax mov eax,DWORD [ebp-128] mov ebx,DWORD [ebp-96] mov ecx,DWORD [ebp-64] mov edx,DWORD [ebp-32] mov eax,DWORD [ebp] mov ebx,DWORD [32+ebp] mov ecx,DWORD [64+ebp] mov edx,DWORD [96+ebp] align 16 L$007loop: pshufw mm1,mm0,12 pshufw mm5,mm4,9 movd eax,mm1 movd ebx,mm5 mov DWORD [20+esp],edi movzx esi,al movzx edx,ah pshufw mm2,mm0,6 movzx ecx,BYTE [esi*1+ebp-128] movzx edi,bl movzx edx,BYTE [edx*1+ebp-128] shr eax,16 shl edx,8 movzx esi,BYTE [edi*1+ebp-128] movzx edi,bh shl esi,16 pshufw mm6,mm4,3 or ecx,esi movzx esi,BYTE [edi*1+ebp-128] movzx edi,ah shl esi,24 shr ebx,16 or edx,esi movzx esi,BYTE [edi*1+ebp-128] movzx edi,bh shl esi,24 or ecx,esi movzx esi,BYTE [edi*1+ebp-128] movzx edi,al shl esi,8 movd eax,mm2 or ecx,esi movzx esi,BYTE [edi*1+ebp-128] movzx edi,bl shl esi,16 movd ebx,mm6 movd mm0,ecx movzx ecx,BYTE [edi*1+ebp-128] movzx edi,al or ecx,esi movzx esi,BYTE [edi*1+ebp-128] movzx edi,bl or edx,esi movzx esi,BYTE [edi*1+ebp-128] movzx edi,ah shl esi,16 shr eax,16 or edx,esi movzx esi,BYTE [edi*1+ebp-128] movzx edi,bh shr ebx,16 shl esi,8 movd mm1,edx movzx edx,BYTE [edi*1+ebp-128] movzx edi,bh shl edx,24 and ebx,255 or edx,esi punpckldq mm0,mm1 movzx esi,BYTE [edi*1+ebp-128] movzx edi,al shl esi,8 movzx eax,ah movzx ebx,BYTE [ebx*1+ebp-128] or ecx,esi movzx esi,BYTE [edi*1+ebp-128] or edx,ebx shl esi,16 movzx eax,BYTE [eax*1+ebp-128] or edx,esi shl eax,24 or ecx,eax mov edi,DWORD [20+esp] movd mm4,edx movd mm5,ecx punpckldq mm4,mm5 add edi,16 cmp edi,DWORD [24+esp] ja NEAR L$008out movq mm3,mm0 movq mm7,mm4 pshufw mm2,mm0,228 pshufw mm6,mm4,228 movq mm1,mm0 movq mm5,mm4 pshufw mm0,mm0,177 pshufw mm4,mm4,177 pslld mm2,8 pslld mm6,8 psrld mm3,8 psrld mm7,8 pxor mm0,mm2 pxor mm4,mm6 pxor mm0,mm3 pxor mm4,mm7 pslld mm2,16 pslld mm6,16 psrld mm3,16 psrld mm7,16 pxor mm0,mm2 pxor mm4,mm6 pxor mm0,mm3 pxor mm4,mm7 movq mm3,[8+esp] pxor mm2,mm2 pxor mm6,mm6 pcmpgtb mm2,mm1 pcmpgtb mm6,mm5 pand mm2,mm3 pand mm6,mm3 paddb mm1,mm1 paddb mm5,mm5 pxor mm1,mm2 pxor mm5,mm6 movq mm3,mm1 movq mm7,mm5 movq mm2,mm1 movq mm6,mm5 pxor mm0,mm1 pxor mm4,mm5 pslld mm3,24 pslld mm7,24 psrld mm2,8 psrld mm6,8 pxor mm0,mm3 pxor mm4,mm7 pxor mm0,mm2 pxor mm4,mm6 movq mm2,[8+esp] pxor mm3,mm3 pxor mm7,mm7 pcmpgtb mm3,mm1 pcmpgtb mm7,mm5 pand mm3,mm2 pand mm7,mm2 paddb mm1,mm1 paddb mm5,mm5 pxor mm1,mm3 pxor mm5,mm7 pshufw mm3,mm1,177 pshufw mm7,mm5,177 pxor mm0,mm1 pxor mm4,mm5 pxor mm0,mm3 pxor mm4,mm7 pxor mm3,mm3 pxor mm7,mm7 pcmpgtb mm3,mm1 pcmpgtb mm7,mm5 pand mm3,mm2 pand mm7,mm2 paddb mm1,mm1 paddb mm5,mm5 pxor mm1,mm3 pxor mm5,mm7 pxor mm0,mm1 pxor mm4,mm5 movq mm3,mm1 movq mm7,mm5 pshufw mm2,mm1,177 pshufw mm6,mm5,177 pxor mm0,mm2 pxor mm4,mm6 pslld mm1,8 pslld mm5,8 psrld mm3,8 psrld mm7,8 movq mm2,[edi] movq mm6,[8+edi] pxor mm0,mm1 pxor mm4,mm5 pxor mm0,mm3 pxor mm4,mm7 mov eax,DWORD [ebp-128] pslld mm1,16 pslld mm5,16 mov ebx,DWORD [ebp-64] psrld mm3,16 psrld mm7,16 mov ecx,DWORD [ebp] pxor mm0,mm1 pxor mm4,mm5 mov edx,DWORD [64+ebp] pxor mm0,mm3 pxor mm4,mm7 pxor mm0,mm2 pxor mm4,mm6 jmp NEAR L$007loop align 16 L$008out: pxor mm0,[edi] pxor mm4,[8+edi] ret align 16 __x86_AES_decrypt: mov DWORD [20+esp],edi xor eax,DWORD [edi] xor ebx,DWORD [4+edi] xor ecx,DWORD [8+edi] xor edx,DWORD [12+edi] mov esi,DWORD [240+edi] lea esi,[esi*1+esi-2] lea esi,[esi*8+edi] mov DWORD [24+esp],esi align 16 L$009loop: mov esi,eax and esi,255 mov esi,DWORD [esi*8+ebp] movzx edi,dh xor esi,DWORD [3+edi*8+ebp] mov edi,ecx shr edi,16 and edi,255 xor esi,DWORD [2+edi*8+ebp] mov edi,ebx shr edi,24 xor esi,DWORD [1+edi*8+ebp] mov DWORD [4+esp],esi mov esi,ebx and esi,255 mov esi,DWORD [esi*8+ebp] movzx edi,ah xor esi,DWORD [3+edi*8+ebp] mov edi,edx shr edi,16 and edi,255 xor esi,DWORD [2+edi*8+ebp] mov edi,ecx shr edi,24 xor esi,DWORD [1+edi*8+ebp] mov DWORD [8+esp],esi mov esi,ecx and esi,255 mov esi,DWORD [esi*8+ebp] movzx edi,bh xor esi,DWORD [3+edi*8+ebp] mov edi,eax shr edi,16 and edi,255 xor esi,DWORD [2+edi*8+ebp] mov edi,edx shr edi,24 xor esi,DWORD [1+edi*8+ebp] mov edi,DWORD [20+esp] and edx,255 mov edx,DWORD [edx*8+ebp] movzx ecx,ch xor edx,DWORD [3+ecx*8+ebp] mov ecx,esi shr ebx,16 and ebx,255 xor edx,DWORD [2+ebx*8+ebp] mov ebx,DWORD [8+esp] shr eax,24 xor edx,DWORD [1+eax*8+ebp] mov eax,DWORD [4+esp] add edi,16 xor eax,DWORD [edi] xor ebx,DWORD [4+edi] xor ecx,DWORD [8+edi] xor edx,DWORD [12+edi] cmp edi,DWORD [24+esp] mov DWORD [20+esp],edi jb NEAR L$009loop lea ebp,[2176+ebp] mov edi,DWORD [ebp-128] mov esi,DWORD [ebp-96] mov edi,DWORD [ebp-64] mov esi,DWORD [ebp-32] mov edi,DWORD [ebp] mov esi,DWORD [32+ebp] mov edi,DWORD [64+ebp] mov esi,DWORD [96+ebp] lea ebp,[ebp-128] mov esi,eax and esi,255 movzx esi,BYTE [esi*1+ebp] movzx edi,dh movzx edi,BYTE [edi*1+ebp] shl edi,8 xor esi,edi mov edi,ecx shr edi,16 and edi,255 movzx edi,BYTE [edi*1+ebp] shl edi,16 xor esi,edi mov edi,ebx shr edi,24 movzx edi,BYTE [edi*1+ebp] shl edi,24 xor esi,edi mov DWORD [4+esp],esi mov esi,ebx and esi,255 movzx esi,BYTE [esi*1+ebp] movzx edi,ah movzx edi,BYTE [edi*1+ebp] shl edi,8 xor esi,edi mov edi,edx shr edi,16 and edi,255 movzx edi,BYTE [edi*1+ebp] shl edi,16 xor esi,edi mov edi,ecx shr edi,24 movzx edi,BYTE [edi*1+ebp] shl edi,24 xor esi,edi mov DWORD [8+esp],esi mov esi,ecx and esi,255 movzx esi,BYTE [esi*1+ebp] movzx edi,bh movzx edi,BYTE [edi*1+ebp] shl edi,8 xor esi,edi mov edi,eax shr edi,16 and edi,255 movzx edi,BYTE [edi*1+ebp] shl edi,16 xor esi,edi mov edi,edx shr edi,24 movzx edi,BYTE [edi*1+ebp] shl edi,24 xor esi,edi mov edi,DWORD [20+esp] and edx,255 movzx edx,BYTE [edx*1+ebp] movzx ecx,ch movzx ecx,BYTE [ecx*1+ebp] shl ecx,8 xor edx,ecx mov ecx,esi shr ebx,16 and ebx,255 movzx ebx,BYTE [ebx*1+ebp] shl ebx,16 xor edx,ebx mov ebx,DWORD [8+esp] shr eax,24 movzx eax,BYTE [eax*1+ebp] shl eax,24 xor edx,eax mov eax,DWORD [4+esp] lea ebp,[ebp-2048] add edi,16 xor eax,DWORD [edi] xor ebx,DWORD [4+edi] xor ecx,DWORD [8+edi] xor edx,DWORD [12+edi] ret align 64 L$AES_Td: dd 1353184337,1353184337 dd 1399144830,1399144830 dd 3282310938,3282310938 dd 2522752826,2522752826 dd 3412831035,3412831035 dd 4047871263,4047871263 dd 2874735276,2874735276 dd 2466505547,2466505547 dd 1442459680,1442459680 dd 4134368941,4134368941 dd 2440481928,2440481928 dd 625738485,625738485 dd 4242007375,4242007375 dd 3620416197,3620416197 dd 2151953702,2151953702 dd 2409849525,2409849525 dd 1230680542,1230680542 dd 1729870373,1729870373 dd 2551114309,2551114309 dd 3787521629,3787521629 dd 41234371,41234371 dd 317738113,317738113 dd 2744600205,2744600205 dd 3338261355,3338261355 dd 3881799427,3881799427 dd 2510066197,2510066197 dd 3950669247,3950669247 dd 3663286933,3663286933 dd 763608788,763608788 dd 3542185048,3542185048 dd 694804553,694804553 dd 1154009486,1154009486 dd 1787413109,1787413109 dd 2021232372,2021232372 dd 1799248025,1799248025 dd 3715217703,3715217703 dd 3058688446,3058688446 dd 397248752,397248752 dd 1722556617,1722556617 dd 3023752829,3023752829 dd 407560035,407560035 dd 2184256229,2184256229 dd 1613975959,1613975959 dd 1165972322,1165972322 dd 3765920945,3765920945 dd 2226023355,2226023355 dd 480281086,480281086 dd 2485848313,2485848313 dd 1483229296,1483229296 dd 436028815,436028815 dd 2272059028,2272059028 dd 3086515026,3086515026 dd 601060267,601060267 dd 3791801202,3791801202 dd 1468997603,1468997603 dd 715871590,715871590 dd 120122290,120122290 dd 63092015,63092015 dd 2591802758,2591802758 dd 2768779219,2768779219 dd 4068943920,4068943920 dd 2997206819,2997206819 dd 3127509762,3127509762 dd 1552029421,1552029421 dd 723308426,723308426 dd 2461301159,2461301159 dd 4042393587,4042393587 dd 2715969870,2715969870 dd 3455375973,3455375973 dd 3586000134,3586000134 dd 526529745,526529745 dd 2331944644,2331944644 dd 2639474228,2639474228 dd 2689987490,2689987490 dd 853641733,853641733 dd 1978398372,1978398372 dd 971801355,971801355 dd 2867814464,2867814464 dd 111112542,111112542 dd 1360031421,1360031421 dd 4186579262,4186579262 dd 1023860118,1023860118 dd 2919579357,2919579357 dd 1186850381,1186850381 dd 3045938321,3045938321 dd 90031217,90031217 dd 1876166148,1876166148 dd 4279586912,4279586912 dd 620468249,620468249 dd 2548678102,2548678102 dd 3426959497,3426959497 dd 2006899047,2006899047 dd 3175278768,3175278768 dd 2290845959,2290845959 dd 945494503,945494503 dd 3689859193,3689859193 dd 1191869601,1191869601 dd 3910091388,3910091388 dd 3374220536,3374220536 dd 0,0 dd 2206629897,2206629897 dd 1223502642,1223502642 dd 2893025566,2893025566 dd 1316117100,1316117100 dd 4227796733,4227796733 dd 1446544655,1446544655 dd 517320253,517320253 dd 658058550,658058550 dd 1691946762,1691946762 dd 564550760,564550760 dd 3511966619,3511966619 dd 976107044,976107044 dd 2976320012,2976320012 dd 266819475,266819475 dd 3533106868,3533106868 dd 2660342555,2660342555 dd 1338359936,1338359936 dd 2720062561,2720062561 dd 1766553434,1766553434 dd 370807324,370807324 dd 179999714,179999714 dd 3844776128,3844776128 dd 1138762300,1138762300 dd 488053522,488053522 dd 185403662,185403662 dd 2915535858,2915535858 dd 3114841645,3114841645 dd 3366526484,3366526484 dd 2233069911,2233069911 dd 1275557295,1275557295 dd 3151862254,3151862254 dd 4250959779,4250959779 dd 2670068215,2670068215 dd 3170202204,3170202204 dd 3309004356,3309004356 dd 880737115,880737115 dd 1982415755,1982415755 dd 3703972811,3703972811 dd 1761406390,1761406390 dd 1676797112,1676797112 dd 3403428311,3403428311 dd 277177154,277177154 dd 1076008723,1076008723 dd 538035844,538035844 dd 2099530373,2099530373 dd 4164795346,4164795346 dd 288553390,288553390 dd 1839278535,1839278535 dd 1261411869,1261411869 dd 4080055004,4080055004 dd 3964831245,3964831245 dd 3504587127,3504587127 dd 1813426987,1813426987 dd 2579067049,2579067049 dd 4199060497,4199060497 dd 577038663,577038663 dd 3297574056,3297574056 dd 440397984,440397984 dd 3626794326,3626794326 dd 4019204898,4019204898 dd 3343796615,3343796615 dd 3251714265,3251714265 dd 4272081548,4272081548 dd 906744984,906744984 dd 3481400742,3481400742 dd 685669029,685669029 dd 646887386,646887386 dd 2764025151,2764025151 dd 3835509292,3835509292 dd 227702864,227702864 dd 2613862250,2613862250 dd 1648787028,1648787028 dd 3256061430,3256061430 dd 3904428176,3904428176 dd 1593260334,1593260334 dd 4121936770,4121936770 dd 3196083615,3196083615 dd 2090061929,2090061929 dd 2838353263,2838353263 dd 3004310991,3004310991 dd 999926984,999926984 dd 2809993232,2809993232 dd 1852021992,1852021992 dd 2075868123,2075868123 dd 158869197,158869197 dd 4095236462,4095236462 dd 28809964,28809964 dd 2828685187,2828685187 dd 1701746150,1701746150 dd 2129067946,2129067946 dd 147831841,147831841 dd 3873969647,3873969647 dd 3650873274,3650873274 dd 3459673930,3459673930 dd 3557400554,3557400554 dd 3598495785,3598495785 dd 2947720241,2947720241 dd 824393514,824393514 dd 815048134,815048134 dd 3227951669,3227951669 dd 935087732,935087732 dd 2798289660,2798289660 dd 2966458592,2966458592 dd 366520115,366520115 dd 1251476721,1251476721 dd 4158319681,4158319681 dd 240176511,240176511 dd 804688151,804688151 dd 2379631990,2379631990 dd 1303441219,1303441219 dd 1414376140,1414376140 dd 3741619940,3741619940 dd 3820343710,3820343710 dd 461924940,461924940 dd 3089050817,3089050817 dd 2136040774,2136040774 dd 82468509,82468509 dd 1563790337,1563790337 dd 1937016826,1937016826 dd 776014843,776014843 dd 1511876531,1511876531 dd 1389550482,1389550482 dd 861278441,861278441 dd 323475053,323475053 dd 2355222426,2355222426 dd 2047648055,2047648055 dd 2383738969,2383738969 dd 2302415851,2302415851 dd 3995576782,3995576782 dd 902390199,902390199 dd 3991215329,3991215329 dd 1018251130,1018251130 dd 1507840668,1507840668 dd 1064563285,1064563285 dd 2043548696,2043548696 dd 3208103795,3208103795 dd 3939366739,3939366739 dd 1537932639,1537932639 dd 342834655,342834655 dd 2262516856,2262516856 dd 2180231114,2180231114 dd 1053059257,1053059257 dd 741614648,741614648 dd 1598071746,1598071746 dd 1925389590,1925389590 dd 203809468,203809468 dd 2336832552,2336832552 dd 1100287487,1100287487 dd 1895934009,1895934009 dd 3736275976,3736275976 dd 2632234200,2632234200 dd 2428589668,2428589668 dd 1636092795,1636092795 dd 1890988757,1890988757 dd 1952214088,1952214088 dd 1113045200,1113045200 db 82,9,106,213,48,54,165,56 db 191,64,163,158,129,243,215,251 db 124,227,57,130,155,47,255,135 db 52,142,67,68,196,222,233,203 db 84,123,148,50,166,194,35,61 db 238,76,149,11,66,250,195,78 db 8,46,161,102,40,217,36,178 db 118,91,162,73,109,139,209,37 db 114,248,246,100,134,104,152,22 db 212,164,92,204,93,101,182,146 db 108,112,72,80,253,237,185,218 db 94,21,70,87,167,141,157,132 db 144,216,171,0,140,188,211,10 db 247,228,88,5,184,179,69,6 db 208,44,30,143,202,63,15,2 db 193,175,189,3,1,19,138,107 db 58,145,17,65,79,103,220,234 db 151,242,207,206,240,180,230,115 db 150,172,116,34,231,173,53,133 db 226,249,55,232,28,117,223,110 db 71,241,26,113,29,41,197,137 db 111,183,98,14,170,24,190,27 db 252,86,62,75,198,210,121,32 db 154,219,192,254,120,205,90,244 db 31,221,168,51,136,7,199,49 db 177,18,16,89,39,128,236,95 db 96,81,127,169,25,181,74,13 db 45,229,122,159,147,201,156,239 db 160,224,59,77,174,42,245,176 db 200,235,187,60,131,83,153,97 db 23,43,4,126,186,119,214,38 db 225,105,20,99,85,33,12,125 db 82,9,106,213,48,54,165,56 db 191,64,163,158,129,243,215,251 db 124,227,57,130,155,47,255,135 db 52,142,67,68,196,222,233,203 db 84,123,148,50,166,194,35,61 db 238,76,149,11,66,250,195,78 db 8,46,161,102,40,217,36,178 db 118,91,162,73,109,139,209,37 db 114,248,246,100,134,104,152,22 db 212,164,92,204,93,101,182,146 db 108,112,72,80,253,237,185,218 db 94,21,70,87,167,141,157,132 db 144,216,171,0,140,188,211,10 db 247,228,88,5,184,179,69,6 db 208,44,30,143,202,63,15,2 db 193,175,189,3,1,19,138,107 db 58,145,17,65,79,103,220,234 db 151,242,207,206,240,180,230,115 db 150,172,116,34,231,173,53,133 db 226,249,55,232,28,117,223,110 db 71,241,26,113,29,41,197,137 db 111,183,98,14,170,24,190,27 db 252,86,62,75,198,210,121,32 db 154,219,192,254,120,205,90,244 db 31,221,168,51,136,7,199,49 db 177,18,16,89,39,128,236,95 db 96,81,127,169,25,181,74,13 db 45,229,122,159,147,201,156,239 db 160,224,59,77,174,42,245,176 db 200,235,187,60,131,83,153,97 db 23,43,4,126,186,119,214,38 db 225,105,20,99,85,33,12,125 db 82,9,106,213,48,54,165,56 db 191,64,163,158,129,243,215,251 db 124,227,57,130,155,47,255,135 db 52,142,67,68,196,222,233,203 db 84,123,148,50,166,194,35,61 db 238,76,149,11,66,250,195,78 db 8,46,161,102,40,217,36,178 db 118,91,162,73,109,139,209,37 db 114,248,246,100,134,104,152,22 db 212,164,92,204,93,101,182,146 db 108,112,72,80,253,237,185,218 db 94,21,70,87,167,141,157,132 db 144,216,171,0,140,188,211,10 db 247,228,88,5,184,179,69,6 db 208,44,30,143,202,63,15,2 db 193,175,189,3,1,19,138,107 db 58,145,17,65,79,103,220,234 db 151,242,207,206,240,180,230,115 db 150,172,116,34,231,173,53,133 db 226,249,55,232,28,117,223,110 db 71,241,26,113,29,41,197,137 db 111,183,98,14,170,24,190,27 db 252,86,62,75,198,210,121,32 db 154,219,192,254,120,205,90,244 db 31,221,168,51,136,7,199,49 db 177,18,16,89,39,128,236,95 db 96,81,127,169,25,181,74,13 db 45,229,122,159,147,201,156,239 db 160,224,59,77,174,42,245,176 db 200,235,187,60,131,83,153,97 db 23,43,4,126,186,119,214,38 db 225,105,20,99,85,33,12,125 db 82,9,106,213,48,54,165,56 db 191,64,163,158,129,243,215,251 db 124,227,57,130,155,47,255,135 db 52,142,67,68,196,222,233,203 db 84,123,148,50,166,194,35,61 db 238,76,149,11,66,250,195,78 db 8,46,161,102,40,217,36,178 db 118,91,162,73,109,139,209,37 db 114,248,246,100,134,104,152,22 db 212,164,92,204,93,101,182,146 db 108,112,72,80,253,237,185,218 db 94,21,70,87,167,141,157,132 db 144,216,171,0,140,188,211,10 db 247,228,88,5,184,179,69,6 db 208,44,30,143,202,63,15,2 db 193,175,189,3,1,19,138,107 db 58,145,17,65,79,103,220,234 db 151,242,207,206,240,180,230,115 db 150,172,116,34,231,173,53,133 db 226,249,55,232,28,117,223,110 db 71,241,26,113,29,41,197,137 db 111,183,98,14,170,24,190,27 db 252,86,62,75,198,210,121,32 db 154,219,192,254,120,205,90,244 db 31,221,168,51,136,7,199,49 db 177,18,16,89,39,128,236,95 db 96,81,127,169,25,181,74,13 db 45,229,122,159,147,201,156,239 db 160,224,59,77,174,42,245,176 db 200,235,187,60,131,83,153,97 db 23,43,4,126,186,119,214,38 db 225,105,20,99,85,33,12,125 global _AES_decrypt align 16 _AES_decrypt: L$_AES_decrypt_begin: push ebp push ebx push esi push edi mov esi,DWORD [20+esp] mov edi,DWORD [28+esp] mov eax,esp sub esp,36 and esp,-64 lea ebx,[edi-127] sub ebx,esp neg ebx and ebx,960 sub esp,ebx add esp,4 mov DWORD [28+esp],eax call L$010pic_point L$010pic_point: pop ebp lea eax,[_OPENSSL_ia32cap_P] lea ebp,[(L$AES_Td-L$010pic_point)+ebp] lea ebx,[764+esp] sub ebx,ebp and ebx,768 lea ebp,[2176+ebx*1+ebp] bt DWORD [eax],25 jnc NEAR L$011x86 movq mm0,[esi] movq mm4,[8+esi] call __sse_AES_decrypt_compact mov esp,DWORD [28+esp] mov esi,DWORD [24+esp] movq [esi],mm0 movq [8+esi],mm4 emms pop edi pop esi pop ebx pop ebp ret align 16 L$011x86: mov DWORD [24+esp],ebp mov eax,DWORD [esi] mov ebx,DWORD [4+esi] mov ecx,DWORD [8+esi] mov edx,DWORD [12+esi] call __x86_AES_decrypt_compact mov esp,DWORD [28+esp] mov esi,DWORD [24+esp] mov DWORD [esi],eax mov DWORD [4+esi],ebx mov DWORD [8+esi],ecx mov DWORD [12+esi],edx pop edi pop esi pop ebx pop ebp ret global _AES_cbc_encrypt align 16 _AES_cbc_encrypt: L$_AES_cbc_encrypt_begin: push ebp push ebx push esi push edi mov ecx,DWORD [28+esp] cmp ecx,0 je NEAR L$012drop_out call L$013pic_point L$013pic_point: pop ebp lea eax,[_OPENSSL_ia32cap_P] cmp DWORD [40+esp],0 lea ebp,[(L$AES_Te-L$013pic_point)+ebp] jne NEAR L$014picked_te lea ebp,[(L$AES_Td-L$AES_Te)+ebp] L$014picked_te: pushfd cld cmp ecx,512 jb NEAR L$015slow_way test ecx,15 jnz NEAR L$015slow_way bt DWORD [eax],28 jc NEAR L$015slow_way lea esi,[esp-324] and esi,-64 mov eax,ebp lea ebx,[2304+ebp] mov edx,esi and eax,4095 and ebx,4095 and edx,4095 cmp edx,ebx jb NEAR L$016tbl_break_out sub edx,ebx sub esi,edx jmp NEAR L$017tbl_ok align 4 L$016tbl_break_out: sub edx,eax and edx,4095 add edx,384 sub esi,edx align 4 L$017tbl_ok: lea edx,[24+esp] xchg esp,esi add esp,4 mov DWORD [24+esp],ebp mov DWORD [28+esp],esi mov eax,DWORD [edx] mov ebx,DWORD [4+edx] mov edi,DWORD [12+edx] mov esi,DWORD [16+edx] mov edx,DWORD [20+edx] mov DWORD [32+esp],eax mov DWORD [36+esp],ebx mov DWORD [40+esp],ecx mov DWORD [44+esp],edi mov DWORD [48+esp],esi mov DWORD [316+esp],0 mov ebx,edi mov ecx,61 sub ebx,ebp mov esi,edi and ebx,4095 lea edi,[76+esp] cmp ebx,2304 jb NEAR L$018do_copy cmp ebx,3852 jb NEAR L$019skip_copy align 4 L$018do_copy: mov DWORD [44+esp],edi dd 2784229001 L$019skip_copy: mov edi,16 align 4 L$020prefetch_tbl: mov eax,DWORD [ebp] mov ebx,DWORD [32+ebp] mov ecx,DWORD [64+ebp] mov esi,DWORD [96+ebp] lea ebp,[128+ebp] sub edi,1 jnz NEAR L$020prefetch_tbl sub ebp,2048 mov esi,DWORD [32+esp] mov edi,DWORD [48+esp] cmp edx,0 je NEAR L$021fast_decrypt mov eax,DWORD [edi] mov ebx,DWORD [4+edi] align 16 L$022fast_enc_loop: mov ecx,DWORD [8+edi] mov edx,DWORD [12+edi] xor eax,DWORD [esi] xor ebx,DWORD [4+esi] xor ecx,DWORD [8+esi] xor edx,DWORD [12+esi] mov edi,DWORD [44+esp] call __x86_AES_encrypt mov esi,DWORD [32+esp] mov edi,DWORD [36+esp] mov DWORD [edi],eax mov DWORD [4+edi],ebx mov DWORD [8+edi],ecx mov DWORD [12+edi],edx lea esi,[16+esi] mov ecx,DWORD [40+esp] mov DWORD [32+esp],esi lea edx,[16+edi] mov DWORD [36+esp],edx sub ecx,16 mov DWORD [40+esp],ecx jnz NEAR L$022fast_enc_loop mov esi,DWORD [48+esp] mov ecx,DWORD [8+edi] mov edx,DWORD [12+edi] mov DWORD [esi],eax mov DWORD [4+esi],ebx mov DWORD [8+esi],ecx mov DWORD [12+esi],edx cmp DWORD [316+esp],0 mov edi,DWORD [44+esp] je NEAR L$023skip_ezero mov ecx,60 xor eax,eax align 4 dd 2884892297 L$023skip_ezero: mov esp,DWORD [28+esp] popfd L$012drop_out: pop edi pop esi pop ebx pop ebp ret pushfd align 16 L$021fast_decrypt: cmp esi,DWORD [36+esp] je NEAR L$024fast_dec_in_place mov DWORD [52+esp],edi align 4 align 16 L$025fast_dec_loop: mov eax,DWORD [esi] mov ebx,DWORD [4+esi] mov ecx,DWORD [8+esi] mov edx,DWORD [12+esi] mov edi,DWORD [44+esp] call __x86_AES_decrypt mov edi,DWORD [52+esp] mov esi,DWORD [40+esp] xor eax,DWORD [edi] xor ebx,DWORD [4+edi] xor ecx,DWORD [8+edi] xor edx,DWORD [12+edi] mov edi,DWORD [36+esp] mov esi,DWORD [32+esp] mov DWORD [edi],eax mov DWORD [4+edi],ebx mov DWORD [8+edi],ecx mov DWORD [12+edi],edx mov ecx,DWORD [40+esp] mov DWORD [52+esp],esi lea esi,[16+esi] mov DWORD [32+esp],esi lea edi,[16+edi] mov DWORD [36+esp],edi sub ecx,16 mov DWORD [40+esp],ecx jnz NEAR L$025fast_dec_loop mov edi,DWORD [52+esp] mov esi,DWORD [48+esp] mov eax,DWORD [edi] mov ebx,DWORD [4+edi] mov ecx,DWORD [8+edi] mov edx,DWORD [12+edi] mov DWORD [esi],eax mov DWORD [4+esi],ebx mov DWORD [8+esi],ecx mov DWORD [12+esi],edx jmp NEAR L$026fast_dec_out align 16 L$024fast_dec_in_place: L$027fast_dec_in_place_loop: mov eax,DWORD [esi] mov ebx,DWORD [4+esi] mov ecx,DWORD [8+esi] mov edx,DWORD [12+esi] lea edi,[60+esp] mov DWORD [edi],eax mov DWORD [4+edi],ebx mov DWORD [8+edi],ecx mov DWORD [12+edi],edx mov edi,DWORD [44+esp] call __x86_AES_decrypt mov edi,DWORD [48+esp] mov esi,DWORD [36+esp] xor eax,DWORD [edi] xor ebx,DWORD [4+edi] xor ecx,DWORD [8+edi] xor edx,DWORD [12+edi] mov DWORD [esi],eax mov DWORD [4+esi],ebx mov DWORD [8+esi],ecx mov DWORD [12+esi],edx lea esi,[16+esi] mov DWORD [36+esp],esi lea esi,[60+esp] mov eax,DWORD [esi] mov ebx,DWORD [4+esi] mov ecx,DWORD [8+esi] mov edx,DWORD [12+esi] mov DWORD [edi],eax mov DWORD [4+edi],ebx mov DWORD [8+edi],ecx mov DWORD [12+edi],edx mov esi,DWORD [32+esp] mov ecx,DWORD [40+esp] lea esi,[16+esi] mov DWORD [32+esp],esi sub ecx,16 mov DWORD [40+esp],ecx jnz NEAR L$027fast_dec_in_place_loop align 4 L$026fast_dec_out: cmp DWORD [316+esp],0 mov edi,DWORD [44+esp] je NEAR L$028skip_dzero mov ecx,60 xor eax,eax align 4 dd 2884892297 L$028skip_dzero: mov esp,DWORD [28+esp] popfd pop edi pop esi pop ebx pop ebp ret pushfd align 16 L$015slow_way: mov eax,DWORD [eax] mov edi,DWORD [36+esp] lea esi,[esp-80] and esi,-64 lea ebx,[edi-143] sub ebx,esi neg ebx and ebx,960 sub esi,ebx lea ebx,[768+esi] sub ebx,ebp and ebx,768 lea ebp,[2176+ebx*1+ebp] lea edx,[24+esp] xchg esp,esi add esp,4 mov DWORD [24+esp],ebp mov DWORD [28+esp],esi mov DWORD [52+esp],eax mov eax,DWORD [edx] mov ebx,DWORD [4+edx] mov esi,DWORD [16+edx] mov edx,DWORD [20+edx] mov DWORD [32+esp],eax mov DWORD [36+esp],ebx mov DWORD [40+esp],ecx mov DWORD [44+esp],edi mov DWORD [48+esp],esi mov edi,esi mov esi,eax cmp edx,0 je NEAR L$029slow_decrypt cmp ecx,16 mov edx,ebx jb NEAR L$030slow_enc_tail bt DWORD [52+esp],25 jnc NEAR L$031slow_enc_x86 movq mm0,[edi] movq mm4,[8+edi] align 16 L$032slow_enc_loop_sse: pxor mm0,[esi] pxor mm4,[8+esi] mov edi,DWORD [44+esp] call __sse_AES_encrypt_compact mov esi,DWORD [32+esp] mov edi,DWORD [36+esp] mov ecx,DWORD [40+esp] movq [edi],mm0 movq [8+edi],mm4 lea esi,[16+esi] mov DWORD [32+esp],esi lea edx,[16+edi] mov DWORD [36+esp],edx sub ecx,16 cmp ecx,16 mov DWORD [40+esp],ecx jae NEAR L$032slow_enc_loop_sse test ecx,15 jnz NEAR L$030slow_enc_tail mov esi,DWORD [48+esp] movq [esi],mm0 movq [8+esi],mm4 emms mov esp,DWORD [28+esp] popfd pop edi pop esi pop ebx pop ebp ret pushfd align 16 L$031slow_enc_x86: mov eax,DWORD [edi] mov ebx,DWORD [4+edi] align 4 L$033slow_enc_loop_x86: mov ecx,DWORD [8+edi] mov edx,DWORD [12+edi] xor eax,DWORD [esi] xor ebx,DWORD [4+esi] xor ecx,DWORD [8+esi] xor edx,DWORD [12+esi] mov edi,DWORD [44+esp] call __x86_AES_encrypt_compact mov esi,DWORD [32+esp] mov edi,DWORD [36+esp] mov DWORD [edi],eax mov DWORD [4+edi],ebx mov DWORD [8+edi],ecx mov DWORD [12+edi],edx mov ecx,DWORD [40+esp] lea esi,[16+esi] mov DWORD [32+esp],esi lea edx,[16+edi] mov DWORD [36+esp],edx sub ecx,16 cmp ecx,16 mov DWORD [40+esp],ecx jae NEAR L$033slow_enc_loop_x86 test ecx,15 jnz NEAR L$030slow_enc_tail mov esi,DWORD [48+esp] mov ecx,DWORD [8+edi] mov edx,DWORD [12+edi] mov DWORD [esi],eax mov DWORD [4+esi],ebx mov DWORD [8+esi],ecx mov DWORD [12+esi],edx mov esp,DWORD [28+esp] popfd pop edi pop esi pop ebx pop ebp ret pushfd align 16 L$030slow_enc_tail: emms mov edi,edx mov ebx,16 sub ebx,ecx cmp edi,esi je NEAR L$034enc_in_place align 4 dd 2767451785 jmp NEAR L$035enc_skip_in_place L$034enc_in_place: lea edi,[ecx*1+edi] L$035enc_skip_in_place: mov ecx,ebx xor eax,eax align 4 dd 2868115081 mov edi,DWORD [48+esp] mov esi,edx mov eax,DWORD [edi] mov ebx,DWORD [4+edi] mov DWORD [40+esp],16 jmp NEAR L$033slow_enc_loop_x86 align 16 L$029slow_decrypt: bt DWORD [52+esp],25 jnc NEAR L$036slow_dec_loop_x86 align 4 L$037slow_dec_loop_sse: movq mm0,[esi] movq mm4,[8+esi] mov edi,DWORD [44+esp] call __sse_AES_decrypt_compact mov esi,DWORD [32+esp] lea eax,[60+esp] mov ebx,DWORD [36+esp] mov ecx,DWORD [40+esp] mov edi,DWORD [48+esp] movq mm1,[esi] movq mm5,[8+esi] pxor mm0,[edi] pxor mm4,[8+edi] movq [edi],mm1 movq [8+edi],mm5 sub ecx,16 jc NEAR L$038slow_dec_partial_sse movq [ebx],mm0 movq [8+ebx],mm4 lea ebx,[16+ebx] mov DWORD [36+esp],ebx lea esi,[16+esi] mov DWORD [32+esp],esi mov DWORD [40+esp],ecx jnz NEAR L$037slow_dec_loop_sse emms mov esp,DWORD [28+esp] popfd pop edi pop esi pop ebx pop ebp ret pushfd align 16 L$038slow_dec_partial_sse: movq [eax],mm0 movq [8+eax],mm4 emms add ecx,16 mov edi,ebx mov esi,eax align 4 dd 2767451785 mov esp,DWORD [28+esp] popfd pop edi pop esi pop ebx pop ebp ret pushfd align 16 L$036slow_dec_loop_x86: mov eax,DWORD [esi] mov ebx,DWORD [4+esi] mov ecx,DWORD [8+esi] mov edx,DWORD [12+esi] lea edi,[60+esp] mov DWORD [edi],eax mov DWORD [4+edi],ebx mov DWORD [8+edi],ecx mov DWORD [12+edi],edx mov edi,DWORD [44+esp] call __x86_AES_decrypt_compact mov edi,DWORD [48+esp] mov esi,DWORD [40+esp] xor eax,DWORD [edi] xor ebx,DWORD [4+edi] xor ecx,DWORD [8+edi] xor edx,DWORD [12+edi] sub esi,16 jc NEAR L$039slow_dec_partial_x86 mov DWORD [40+esp],esi mov esi,DWORD [36+esp] mov DWORD [esi],eax mov DWORD [4+esi],ebx mov DWORD [8+esi],ecx mov DWORD [12+esi],edx lea esi,[16+esi] mov DWORD [36+esp],esi lea esi,[60+esp] mov eax,DWORD [esi] mov ebx,DWORD [4+esi] mov ecx,DWORD [8+esi] mov edx,DWORD [12+esi] mov DWORD [edi],eax mov DWORD [4+edi],ebx mov DWORD [8+edi],ecx mov DWORD [12+edi],edx mov esi,DWORD [32+esp] lea esi,[16+esi] mov DWORD [32+esp],esi jnz NEAR L$036slow_dec_loop_x86 mov esp,DWORD [28+esp] popfd pop edi pop esi pop ebx pop ebp ret pushfd align 16 L$039slow_dec_partial_x86: lea esi,[60+esp] mov DWORD [esi],eax mov DWORD [4+esi],ebx mov DWORD [8+esi],ecx mov DWORD [12+esi],edx mov esi,DWORD [32+esp] mov eax,DWORD [esi] mov ebx,DWORD [4+esi] mov ecx,DWORD [8+esi] mov edx,DWORD [12+esi] mov DWORD [edi],eax mov DWORD [4+edi],ebx mov DWORD [8+edi],ecx mov DWORD [12+edi],edx mov ecx,DWORD [40+esp] mov edi,DWORD [36+esp] lea esi,[60+esp] align 4 dd 2767451785 mov esp,DWORD [28+esp] popfd pop edi pop esi pop ebx pop ebp ret align 16 __x86_AES_set_encrypt_key: push ebp push ebx push esi push edi mov esi,DWORD [24+esp] mov edi,DWORD [32+esp] test esi,-1 jz NEAR L$040badpointer test edi,-1 jz NEAR L$040badpointer call L$041pic_point L$041pic_point: pop ebp lea ebp,[(L$AES_Te-L$041pic_point)+ebp] lea ebp,[2176+ebp] mov eax,DWORD [ebp-128] mov ebx,DWORD [ebp-96] mov ecx,DWORD [ebp-64] mov edx,DWORD [ebp-32] mov eax,DWORD [ebp] mov ebx,DWORD [32+ebp] mov ecx,DWORD [64+ebp] mov edx,DWORD [96+ebp] mov ecx,DWORD [28+esp] cmp ecx,128 je NEAR L$04210rounds cmp ecx,192 je NEAR L$04312rounds cmp ecx,256 je NEAR L$04414rounds mov eax,-2 jmp NEAR L$045exit L$04210rounds: mov eax,DWORD [esi] mov ebx,DWORD [4+esi] mov ecx,DWORD [8+esi] mov edx,DWORD [12+esi] mov DWORD [edi],eax mov DWORD [4+edi],ebx mov DWORD [8+edi],ecx mov DWORD [12+edi],edx xor ecx,ecx jmp NEAR L$04610shortcut align 4 L$04710loop: mov eax,DWORD [edi] mov edx,DWORD [12+edi] L$04610shortcut: movzx esi,dl movzx ebx,BYTE [esi*1+ebp-128] movzx esi,dh shl ebx,24 xor eax,ebx movzx ebx,BYTE [esi*1+ebp-128] shr edx,16 movzx esi,dl xor eax,ebx movzx ebx,BYTE [esi*1+ebp-128] movzx esi,dh shl ebx,8 xor eax,ebx movzx ebx,BYTE [esi*1+ebp-128] shl ebx,16 xor eax,ebx xor eax,DWORD [896+ecx*4+ebp] mov DWORD [16+edi],eax xor eax,DWORD [4+edi] mov DWORD [20+edi],eax xor eax,DWORD [8+edi] mov DWORD [24+edi],eax xor eax,DWORD [12+edi] mov DWORD [28+edi],eax inc ecx add edi,16 cmp ecx,10 jl NEAR L$04710loop mov DWORD [80+edi],10 xor eax,eax jmp NEAR L$045exit L$04312rounds: mov eax,DWORD [esi] mov ebx,DWORD [4+esi] mov ecx,DWORD [8+esi] mov edx,DWORD [12+esi] mov DWORD [edi],eax mov DWORD [4+edi],ebx mov DWORD [8+edi],ecx mov DWORD [12+edi],edx mov ecx,DWORD [16+esi] mov edx,DWORD [20+esi] mov DWORD [16+edi],ecx mov DWORD [20+edi],edx xor ecx,ecx jmp NEAR L$04812shortcut align 4 L$04912loop: mov eax,DWORD [edi] mov edx,DWORD [20+edi] L$04812shortcut: movzx esi,dl movzx ebx,BYTE [esi*1+ebp-128] movzx esi,dh shl ebx,24 xor eax,ebx movzx ebx,BYTE [esi*1+ebp-128] shr edx,16 movzx esi,dl xor eax,ebx movzx ebx,BYTE [esi*1+ebp-128] movzx esi,dh shl ebx,8 xor eax,ebx movzx ebx,BYTE [esi*1+ebp-128] shl ebx,16 xor eax,ebx xor eax,DWORD [896+ecx*4+ebp] mov DWORD [24+edi],eax xor eax,DWORD [4+edi] mov DWORD [28+edi],eax xor eax,DWORD [8+edi] mov DWORD [32+edi],eax xor eax,DWORD [12+edi] mov DWORD [36+edi],eax cmp ecx,7 je NEAR L$05012break inc ecx xor eax,DWORD [16+edi] mov DWORD [40+edi],eax xor eax,DWORD [20+edi] mov DWORD [44+edi],eax add edi,24 jmp NEAR L$04912loop L$05012break: mov DWORD [72+edi],12 xor eax,eax jmp NEAR L$045exit L$04414rounds: mov eax,DWORD [esi] mov ebx,DWORD [4+esi] mov ecx,DWORD [8+esi] mov edx,DWORD [12+esi] mov DWORD [edi],eax mov DWORD [4+edi],ebx mov DWORD [8+edi],ecx mov DWORD [12+edi],edx mov eax,DWORD [16+esi] mov ebx,DWORD [20+esi] mov ecx,DWORD [24+esi] mov edx,DWORD [28+esi] mov DWORD [16+edi],eax mov DWORD [20+edi],ebx mov DWORD [24+edi],ecx mov DWORD [28+edi],edx xor ecx,ecx jmp NEAR L$05114shortcut align 4 L$05214loop: mov edx,DWORD [28+edi] L$05114shortcut: mov eax,DWORD [edi] movzx esi,dl movzx ebx,BYTE [esi*1+ebp-128] movzx esi,dh shl ebx,24 xor eax,ebx movzx ebx,BYTE [esi*1+ebp-128] shr edx,16 movzx esi,dl xor eax,ebx movzx ebx,BYTE [esi*1+ebp-128] movzx esi,dh shl ebx,8 xor eax,ebx movzx ebx,BYTE [esi*1+ebp-128] shl ebx,16 xor eax,ebx xor eax,DWORD [896+ecx*4+ebp] mov DWORD [32+edi],eax xor eax,DWORD [4+edi] mov DWORD [36+edi],eax xor eax,DWORD [8+edi] mov DWORD [40+edi],eax xor eax,DWORD [12+edi] mov DWORD [44+edi],eax cmp ecx,6 je NEAR L$05314break inc ecx mov edx,eax mov eax,DWORD [16+edi] movzx esi,dl movzx ebx,BYTE [esi*1+ebp-128] movzx esi,dh xor eax,ebx movzx ebx,BYTE [esi*1+ebp-128] shr edx,16 shl ebx,8 movzx esi,dl xor eax,ebx movzx ebx,BYTE [esi*1+ebp-128] movzx esi,dh shl ebx,16 xor eax,ebx movzx ebx,BYTE [esi*1+ebp-128] shl ebx,24 xor eax,ebx mov DWORD [48+edi],eax xor eax,DWORD [20+edi] mov DWORD [52+edi],eax xor eax,DWORD [24+edi] mov DWORD [56+edi],eax xor eax,DWORD [28+edi] mov DWORD [60+edi],eax add edi,32 jmp NEAR L$05214loop L$05314break: mov DWORD [48+edi],14 xor eax,eax jmp NEAR L$045exit L$040badpointer: mov eax,-1 L$045exit: pop edi pop esi pop ebx pop ebp ret global _AES_set_encrypt_key align 16 _AES_set_encrypt_key: L$_AES_set_encrypt_key_begin: call __x86_AES_set_encrypt_key ret global _AES_set_decrypt_key align 16 _AES_set_decrypt_key: L$_AES_set_decrypt_key_begin: call __x86_AES_set_encrypt_key cmp eax,0 je NEAR L$054proceed ret L$054proceed: push ebp push ebx push esi push edi mov esi,DWORD [28+esp] mov ecx,DWORD [240+esi] lea ecx,[ecx*4] lea edi,[ecx*4+esi] align 4 L$055invert: mov eax,DWORD [esi] mov ebx,DWORD [4+esi] mov ecx,DWORD [edi] mov edx,DWORD [4+edi] mov DWORD [edi],eax mov DWORD [4+edi],ebx mov DWORD [esi],ecx mov DWORD [4+esi],edx mov eax,DWORD [8+esi] mov ebx,DWORD [12+esi] mov ecx,DWORD [8+edi] mov edx,DWORD [12+edi] mov DWORD [8+edi],eax mov DWORD [12+edi],ebx mov DWORD [8+esi],ecx mov DWORD [12+esi],edx add esi,16 sub edi,16 cmp esi,edi jne NEAR L$055invert mov edi,DWORD [28+esp] mov esi,DWORD [240+edi] lea esi,[esi*1+esi-2] lea esi,[esi*8+edi] mov DWORD [28+esp],esi mov eax,DWORD [16+edi] align 4 L$056permute: add edi,16 mov ebp,2155905152 and ebp,eax lea ebx,[eax*1+eax] mov esi,ebp shr ebp,7 sub esi,ebp and ebx,4278124286 and esi,454761243 xor ebx,esi mov ebp,2155905152 and ebp,ebx lea ecx,[ebx*1+ebx] mov esi,ebp shr ebp,7 sub esi,ebp and ecx,4278124286 and esi,454761243 xor ebx,eax xor ecx,esi mov ebp,2155905152 and ebp,ecx lea edx,[ecx*1+ecx] mov esi,ebp shr ebp,7 xor ecx,eax sub esi,ebp and edx,4278124286 and esi,454761243 rol eax,8 xor edx,esi mov ebp,DWORD [4+edi] xor eax,ebx xor ebx,edx xor eax,ecx rol ebx,24 xor ecx,edx xor eax,edx rol ecx,16 xor eax,ebx rol edx,8 xor eax,ecx mov ebx,ebp xor eax,edx mov DWORD [edi],eax mov ebp,2155905152 and ebp,ebx lea ecx,[ebx*1+ebx] mov esi,ebp shr ebp,7 sub esi,ebp and ecx,4278124286 and esi,454761243 xor ecx,esi mov ebp,2155905152 and ebp,ecx lea edx,[ecx*1+ecx] mov esi,ebp shr ebp,7 sub esi,ebp and edx,4278124286 and esi,454761243 xor ecx,ebx xor edx,esi mov ebp,2155905152 and ebp,edx lea eax,[edx*1+edx] mov esi,ebp shr ebp,7 xor edx,ebx sub esi,ebp and eax,4278124286 and esi,454761243 rol ebx,8 xor eax,esi mov ebp,DWORD [8+edi] xor ebx,ecx xor ecx,eax xor ebx,edx rol ecx,24 xor edx,eax xor ebx,eax rol edx,16 xor ebx,ecx rol eax,8 xor ebx,edx mov ecx,ebp xor ebx,eax mov DWORD [4+edi],ebx mov ebp,2155905152 and ebp,ecx lea edx,[ecx*1+ecx] mov esi,ebp shr ebp,7 sub esi,ebp and edx,4278124286 and esi,454761243 xor edx,esi mov ebp,2155905152 and ebp,edx lea eax,[edx*1+edx] mov esi,ebp shr ebp,7 sub esi,ebp and eax,4278124286 and esi,454761243 xor edx,ecx xor eax,esi mov ebp,2155905152 and ebp,eax lea ebx,[eax*1+eax] mov esi,ebp shr ebp,7 xor eax,ecx sub esi,ebp and ebx,4278124286 and esi,454761243 rol ecx,8 xor ebx,esi mov ebp,DWORD [12+edi] xor ecx,edx xor edx,ebx xor ecx,eax rol edx,24 xor eax,ebx xor ecx,ebx rol eax,16 xor ecx,edx rol ebx,8 xor ecx,eax mov edx,ebp xor ecx,ebx mov DWORD [8+edi],ecx mov ebp,2155905152 and ebp,edx lea eax,[edx*1+edx] mov esi,ebp shr ebp,7 sub esi,ebp and eax,4278124286 and esi,454761243 xor eax,esi mov ebp,2155905152 and ebp,eax lea ebx,[eax*1+eax] mov esi,ebp shr ebp,7 sub esi,ebp and ebx,4278124286 and esi,454761243 xor eax,edx xor ebx,esi mov ebp,2155905152 and ebp,ebx lea ecx,[ebx*1+ebx] mov esi,ebp shr ebp,7 xor ebx,edx sub esi,ebp and ecx,4278124286 and esi,454761243 rol edx,8 xor ecx,esi mov ebp,DWORD [16+edi] xor edx,eax xor eax,ecx xor edx,ebx rol eax,24 xor ebx,ecx xor edx,ecx rol ebx,16 xor edx,eax rol ecx,8 xor edx,ebx mov eax,ebp xor edx,ecx mov DWORD [12+edi],edx cmp edi,DWORD [28+esp] jb NEAR L$056permute xor eax,eax pop edi pop esi pop ebx pop ebp ret db 65,69,83,32,102,111,114,32,120,56,54,44,32,67,82,89 db 80,84,79,71,65,77,83,32,98,121,32,60,97,112,112,114 db 111,64,111,112,101,110,115,115,108,46,111,114,103,62,0 segment .bss common _OPENSSL_ia32cap_P 16
/*M/////////////////////////////////////////////////////////////////////////////////////// // // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. // // By downloading, copying, installing or using the software you agree to this license. // If you do not agree to this license, do not download, install, // copy or use the software. // // // License Agreement // For Open Source Computer Vision Library // // Copyright (C) 2010-2012, Multicoreware, Inc., all rights reserved. // Copyright (C) 2010-2012, Advanced Micro Devices, Inc., all rights reserved. // Third party copyrights are property of their respective owners. // // @Authors // Peng Xiao, pengxiao@multicorewareinc.com // // Redistribution and use in source and binary forms, with or without modification, // are permitted provided that the following conditions are met: // // * Redistribution's of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. // // * Redistribution's in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation // and/or other materials provided with the distribution. // // * The name of the copyright holders may not be used to endorse or promote products // derived from this software without specific prior written permission. // // This software is provided by the copyright holders and contributors as is and // any express or implied warranties, including, but not limited to, the implied // warranties of merchantability and fitness for a particular purpose are disclaimed. // In no event shall the Intel Corporation or contributors be liable for any direct, // indirect, incidental, special, exemplary, or consequential damages // (including, but not limited to, procurement of substitute goods or services; // loss of use, data, or profits; or business interruption) however caused // and on any theory of liability, whether in contract, strict liability, // or tort (including negligence or otherwise) arising in any way out of // the use of this software, even if advised of the possibility of such damage. // //M*/ #include "test_precomp.hpp" #include "opencv2/ts/ocl_test.hpp" #ifdef HAVE_OPENCL namespace cvtest { namespace ocl { /////////////////////////////////////////////////////////////////////////////////////////////////////// // cvtColor PARAM_TEST_CASE(CvtColor, MatDepth, bool) { int depth; bool use_roi; TEST_DECLARE_INPUT_PARAMETER(src) TEST_DECLARE_OUTPUT_PARAMETER(dst) virtual void SetUp() { depth = GET_PARAM(0); use_roi = GET_PARAM(1); } virtual void generateTestData(int channelsIn, int channelsOut) { const int srcType = CV_MAKE_TYPE(depth, channelsIn); const int dstType = CV_MAKE_TYPE(depth, channelsOut); Size roiSize = randomSize(1, MAX_VALUE); Border srcBorder = randomBorder(0, use_roi ? MAX_VALUE : 0); randomSubMat(src, src_roi, roiSize, srcBorder, srcType, 2, 100); Border dstBorder = randomBorder(0, use_roi ? MAX_VALUE : 0); randomSubMat(dst, dst_roi, roiSize, dstBorder, dstType, 5, 16); UMAT_UPLOAD_INPUT_PARAMETER(src) UMAT_UPLOAD_OUTPUT_PARAMETER(dst) } void Near(double threshold) { OCL_EXPECT_MATS_NEAR(dst, threshold) } void performTest(int channelsIn, int channelsOut, int code, double threshold = 1e-3) { for (int j = 0; j < test_loop_times; j++) { generateTestData(channelsIn, channelsOut); OCL_OFF(cv::cvtColor(src_roi, dst_roi, code, channelsOut)); OCL_ON(cv::cvtColor(usrc_roi, udst_roi, code, channelsOut)); Near(threshold); } } }; #define CVTCODE(name) COLOR_ ## name // RGB[A] <-> BGR[A] OCL_TEST_P(CvtColor, BGR2BGRA) { performTest(3, 4, CVTCODE(BGR2BGRA)); } OCL_TEST_P(CvtColor, RGB2RGBA) { performTest(3, 4, CVTCODE(RGB2RGBA)); } OCL_TEST_P(CvtColor, BGRA2BGR) { performTest(4, 3, CVTCODE(BGRA2BGR)); } OCL_TEST_P(CvtColor, RGBA2RGB) { performTest(4, 3, CVTCODE(RGBA2RGB)); } OCL_TEST_P(CvtColor, BGR2RGBA) { performTest(3, 4, CVTCODE(BGR2RGBA)); } OCL_TEST_P(CvtColor, RGB2BGRA) { performTest(3, 4, CVTCODE(RGB2BGRA)); } OCL_TEST_P(CvtColor, RGBA2BGR) { performTest(4, 3, CVTCODE(RGBA2BGR)); } OCL_TEST_P(CvtColor, BGRA2RGB) { performTest(4, 3, CVTCODE(BGRA2RGB)); } OCL_TEST_P(CvtColor, BGR2RGB) { performTest(3, 3, CVTCODE(BGR2RGB)); } OCL_TEST_P(CvtColor, RGB2BGR) { performTest(3, 3, CVTCODE(RGB2BGR)); } OCL_TEST_P(CvtColor, BGRA2RGBA) { performTest(4, 4, CVTCODE(BGRA2RGBA)); } OCL_TEST_P(CvtColor, RGBA2BGRA) { performTest(4, 4, CVTCODE(RGBA2BGRA)); } // RGB <-> Gray OCL_TEST_P(CvtColor, RGB2GRAY) { performTest(3, 1, CVTCODE(RGB2GRAY)); } OCL_TEST_P(CvtColor, GRAY2RGB) { performTest(1, 3, CVTCODE(GRAY2RGB)); } OCL_TEST_P(CvtColor, BGR2GRAY) { performTest(3, 1, CVTCODE(BGR2GRAY)); } OCL_TEST_P(CvtColor, GRAY2BGR) { performTest(1, 3, CVTCODE(GRAY2BGR)); } OCL_TEST_P(CvtColor, RGBA2GRAY) { performTest(4, 1, CVTCODE(RGBA2GRAY)); } OCL_TEST_P(CvtColor, GRAY2RGBA) { performTest(1, 4, CVTCODE(GRAY2RGBA)); } OCL_TEST_P(CvtColor, BGRA2GRAY) { performTest(4, 1, CVTCODE(BGRA2GRAY)); } OCL_TEST_P(CvtColor, GRAY2BGRA) { performTest(1, 4, CVTCODE(GRAY2BGRA)); } // RGB <-> YUV OCL_TEST_P(CvtColor, RGB2YUV) { performTest(3, 3, CVTCODE(RGB2YUV)); } OCL_TEST_P(CvtColor, BGR2YUV) { performTest(3, 3, CVTCODE(BGR2YUV)); } OCL_TEST_P(CvtColor, RGBA2YUV) { performTest(4, 3, CVTCODE(RGB2YUV)); } OCL_TEST_P(CvtColor, BGRA2YUV) { performTest(4, 3, CVTCODE(BGR2YUV)); } OCL_TEST_P(CvtColor, YUV2RGB) { performTest(3, 3, CVTCODE(YUV2RGB)); } OCL_TEST_P(CvtColor, YUV2BGR) { performTest(3, 3, CVTCODE(YUV2BGR)); } OCL_TEST_P(CvtColor, YUV2RGBA) { performTest(3, 4, CVTCODE(YUV2RGB)); } OCL_TEST_P(CvtColor, YUV2BGRA) { performTest(3, 4, CVTCODE(YUV2BGR)); } // RGB <-> YCrCb OCL_TEST_P(CvtColor, RGB2YCrCb) { performTest(3, 3, CVTCODE(RGB2YCrCb)); } OCL_TEST_P(CvtColor, BGR2YCrCb) { performTest(3, 3, CVTCODE(BGR2YCrCb)); } OCL_TEST_P(CvtColor, RGBA2YCrCb) { performTest(4, 3, CVTCODE(RGB2YCrCb)); } OCL_TEST_P(CvtColor, BGRA2YCrCb) { performTest(4, 3, CVTCODE(BGR2YCrCb)); } OCL_TEST_P(CvtColor, YCrCb2RGB) { performTest(3, 3, CVTCODE(YCrCb2RGB)); } OCL_TEST_P(CvtColor, YCrCb2BGR) { performTest(3, 3, CVTCODE(YCrCb2BGR)); } OCL_TEST_P(CvtColor, YCrCb2RGBA) { performTest(3, 4, CVTCODE(YCrCb2RGB)); } OCL_TEST_P(CvtColor, YCrCb2BGRA) { performTest(3, 4, CVTCODE(YCrCb2BGR)); } // RGB <-> XYZ OCL_TEST_P(CvtColor, RGB2XYZ) { performTest(3, 3, CVTCODE(RGB2XYZ)); } OCL_TEST_P(CvtColor, BGR2XYZ) { performTest(3, 3, CVTCODE(BGR2XYZ)); } OCL_TEST_P(CvtColor, RGBA2XYZ) { performTest(4, 3, CVTCODE(RGB2XYZ)); } OCL_TEST_P(CvtColor, BGRA2XYZ) { performTest(4, 3, CVTCODE(BGR2XYZ)); } OCL_TEST_P(CvtColor, XYZ2RGB) { performTest(3, 3, CVTCODE(XYZ2RGB)); } OCL_TEST_P(CvtColor, XYZ2BGR) { performTest(3, 3, CVTCODE(XYZ2BGR)); } OCL_TEST_P(CvtColor, XYZ2RGBA) { performTest(3, 4, CVTCODE(XYZ2RGB)); } OCL_TEST_P(CvtColor, XYZ2BGRA) { performTest(3, 4, CVTCODE(XYZ2BGR)); } // RGB <-> HSV typedef CvtColor CvtColor8u32f; OCL_TEST_P(CvtColor8u32f, RGB2HSV) { performTest(3, 3, CVTCODE(RGB2HSV)); } OCL_TEST_P(CvtColor8u32f, BGR2HSV) { performTest(3, 3, CVTCODE(BGR2HSV)); } OCL_TEST_P(CvtColor8u32f, RGBA2HSV) { performTest(4, 3, CVTCODE(RGB2HSV)); } OCL_TEST_P(CvtColor8u32f, BGRA2HSV) { performTest(4, 3, CVTCODE(BGR2HSV)); } OCL_TEST_P(CvtColor8u32f, RGB2HSV_FULL) { performTest(3, 3, CVTCODE(RGB2HSV_FULL)); } OCL_TEST_P(CvtColor8u32f, BGR2HSV_FULL) { performTest(3, 3, CVTCODE(BGR2HSV_FULL)); } OCL_TEST_P(CvtColor8u32f, RGBA2HSV_FULL) { performTest(4, 3, CVTCODE(RGB2HSV_FULL)); } OCL_TEST_P(CvtColor8u32f, BGRA2HSV_FULL) { performTest(4, 3, CVTCODE(BGR2HSV_FULL)); } OCL_TEST_P(CvtColor8u32f, HSV2RGB) { performTest(3, 3, CVTCODE(HSV2RGB), depth == CV_8U ? 1 : 4e-1); } OCL_TEST_P(CvtColor8u32f, HSV2BGR) { performTest(3, 3, CVTCODE(HSV2BGR), depth == CV_8U ? 1 : 4e-1); } OCL_TEST_P(CvtColor8u32f, HSV2RGBA) { performTest(3, 4, CVTCODE(HSV2RGB), depth == CV_8U ? 1 : 4e-1); } OCL_TEST_P(CvtColor8u32f, HSV2BGRA) { performTest(3, 4, CVTCODE(HSV2BGR), depth == CV_8U ? 1 : 4e-1); } OCL_TEST_P(CvtColor8u32f, HSV2RGB_FULL) { performTest(3, 3, CVTCODE(HSV2RGB_FULL), depth == CV_8U ? 1 : 4e-1); } OCL_TEST_P(CvtColor8u32f, HSV2BGR_FULL) { performTest(3, 3, CVTCODE(HSV2BGR_FULL), depth == CV_8U ? 1 : 4e-1); } OCL_TEST_P(CvtColor8u32f, HSV2RGBA_FULL) { performTest(3, 4, CVTCODE(HSV2BGR_FULL), depth == CV_8U ? 1 : 4e-1); } OCL_TEST_P(CvtColor8u32f, HSV2BGRA_FULL) { performTest(3, 4, CVTCODE(HSV2BGR_FULL), depth == CV_8U ? 1 : 4e-1); } // RGB <-> HLS OCL_TEST_P(CvtColor8u32f, RGB2HLS) { performTest(3, 3, CVTCODE(RGB2HLS), depth == CV_8U ? 1 : 1e-3); } OCL_TEST_P(CvtColor8u32f, BGR2HLS) { performTest(3, 3, CVTCODE(BGR2HLS), depth == CV_8U ? 1 : 1e-3); } OCL_TEST_P(CvtColor8u32f, RGBA2HLS) { performTest(4, 3, CVTCODE(RGB2HLS), depth == CV_8U ? 1 : 1e-3); } OCL_TEST_P(CvtColor8u32f, BGRA2HLS) { performTest(4, 3, CVTCODE(BGR2HLS), depth == CV_8U ? 1 : 1e-3); } OCL_TEST_P(CvtColor8u32f, RGB2HLS_FULL) { performTest(3, 3, CVTCODE(RGB2HLS_FULL), depth == CV_8U ? 1 : 1e-3); } OCL_TEST_P(CvtColor8u32f, BGR2HLS_FULL) { performTest(3, 3, CVTCODE(BGR2HLS_FULL), depth == CV_8U ? 1 : 1e-3); } OCL_TEST_P(CvtColor8u32f, RGBA2HLS_FULL) { performTest(4, 3, CVTCODE(RGB2HLS_FULL), depth == CV_8U ? 1 : 1e-3); } OCL_TEST_P(CvtColor8u32f, BGRA2HLS_FULL) { performTest(4, 3, CVTCODE(BGR2HLS_FULL), depth == CV_8U ? 1 : 1e-3); } OCL_TEST_P(CvtColor8u32f, HLS2RGB) { performTest(3, 3, CVTCODE(HLS2RGB), 1); } OCL_TEST_P(CvtColor8u32f, HLS2BGR) { performTest(3, 3, CVTCODE(HLS2BGR), 1); } OCL_TEST_P(CvtColor8u32f, HLS2RGBA) { performTest(3, 4, CVTCODE(HLS2RGB), 1); } OCL_TEST_P(CvtColor8u32f, HLS2BGRA) { performTest(3, 4, CVTCODE(HLS2BGR), 1); } OCL_TEST_P(CvtColor8u32f, HLS2RGB_FULL) { performTest(3, 3, CVTCODE(HLS2RGB_FULL), 1); } OCL_TEST_P(CvtColor8u32f, HLS2BGR_FULL) { performTest(3, 3, CVTCODE(HLS2BGR_FULL), 1); } OCL_TEST_P(CvtColor8u32f, HLS2RGBA_FULL) { performTest(3, 4, CVTCODE(HLS2RGB_FULL), 1); } OCL_TEST_P(CvtColor8u32f, HLS2BGRA_FULL) { performTest(3, 4, CVTCODE(HLS2BGR_FULL), 1); } // RGB5x5 <-> RGB typedef CvtColor CvtColor8u; OCL_TEST_P(CvtColor8u, BGR5652BGR) { performTest(2, 3, CVTCODE(BGR5652BGR)); } OCL_TEST_P(CvtColor8u, BGR5652RGB) { performTest(2, 3, CVTCODE(BGR5652RGB)); } OCL_TEST_P(CvtColor8u, BGR5652BGRA) { performTest(2, 4, CVTCODE(BGR5652BGRA)); } OCL_TEST_P(CvtColor8u, BGR5652RGBA) { performTest(2, 4, CVTCODE(BGR5652RGBA)); } OCL_TEST_P(CvtColor8u, BGR5552BGR) { performTest(2, 3, CVTCODE(BGR5552BGR)); } OCL_TEST_P(CvtColor8u, BGR5552RGB) { performTest(2, 3, CVTCODE(BGR5552RGB)); } OCL_TEST_P(CvtColor8u, BGR5552BGRA) { performTest(2, 4, CVTCODE(BGR5552BGRA)); } OCL_TEST_P(CvtColor8u, BGR5552RGBA) { performTest(2, 4, CVTCODE(BGR5552RGBA)); } OCL_TEST_P(CvtColor8u, BGR2BGR565) { performTest(3, 2, CVTCODE(BGR2BGR565)); } OCL_TEST_P(CvtColor8u, RGB2BGR565) { performTest(3, 2, CVTCODE(RGB2BGR565)); } OCL_TEST_P(CvtColor8u, BGRA2BGR565) { performTest(4, 2, CVTCODE(BGRA2BGR565)); } OCL_TEST_P(CvtColor8u, RGBA2BGR565) { performTest(4, 2, CVTCODE(RGBA2BGR565)); } OCL_TEST_P(CvtColor8u, BGR2BGR555) { performTest(3, 2, CVTCODE(BGR2BGR555)); } OCL_TEST_P(CvtColor8u, RGB2BGR555) { performTest(3, 2, CVTCODE(RGB2BGR555)); } OCL_TEST_P(CvtColor8u, BGRA2BGR555) { performTest(4, 2, CVTCODE(BGRA2BGR555)); } OCL_TEST_P(CvtColor8u, RGBA2BGR555) { performTest(4, 2, CVTCODE(RGBA2BGR555)); } // RGB5x5 <-> Gray OCL_TEST_P(CvtColor8u, BGR5652GRAY) { performTest(2, 1, CVTCODE(BGR5652GRAY)); } OCL_TEST_P(CvtColor8u, BGR5552GRAY) { performTest(2, 1, CVTCODE(BGR5552GRAY)); } OCL_TEST_P(CvtColor8u, GRAY2BGR565) { performTest(1, 2, CVTCODE(GRAY2BGR565)); } OCL_TEST_P(CvtColor8u, GRAY2BGR555) { performTest(1, 2, CVTCODE(GRAY2BGR555)); } // RGBA <-> mRGBA OCL_TEST_P(CvtColor8u, RGBA2mRGBA) { performTest(4, 4, CVTCODE(RGBA2mRGBA)); } OCL_TEST_P(CvtColor8u, mRGBA2RGBA) { performTest(4, 4, CVTCODE(mRGBA2RGBA)); } // RGB <-> Lab OCL_TEST_P(CvtColor8u32f, BGR2Lab) { performTest(3, 3, CVTCODE(BGR2Lab)); } OCL_TEST_P(CvtColor8u32f, RGB2Lab) { performTest(3, 3, CVTCODE(RGB2Lab)); } OCL_TEST_P(CvtColor8u32f, LBGR2Lab) { performTest(3, 3, CVTCODE(LBGR2Lab)); } OCL_TEST_P(CvtColor8u32f, LRGB2Lab) { performTest(3, 3, CVTCODE(LRGB2Lab)); } OCL_TEST_P(CvtColor8u32f, BGRA2Lab) { performTest(4, 3, CVTCODE(BGR2Lab)); } OCL_TEST_P(CvtColor8u32f, RGBA2Lab) { performTest(4, 3, CVTCODE(RGB2Lab)); } OCL_TEST_P(CvtColor8u32f, LBGRA2Lab) { performTest(4, 3, CVTCODE(LBGR2Lab)); } OCL_TEST_P(CvtColor8u32f, LRGBA2Lab) { performTest(4, 3, CVTCODE(LRGB2Lab)); } OCL_TEST_P(CvtColor8u32f, Lab2BGR) { performTest(3, 3, CVTCODE(Lab2BGR), depth == CV_8U ? 1 : 1e-5); } OCL_TEST_P(CvtColor8u32f, Lab2RGB) { performTest(3, 3, CVTCODE(Lab2RGB), depth == CV_8U ? 1 : 1e-5); } OCL_TEST_P(CvtColor8u32f, Lab2LBGR) { performTest(3, 3, CVTCODE(Lab2LBGR), depth == CV_8U ? 1 : 1e-5); } OCL_TEST_P(CvtColor8u32f, Lab2LRGB) { performTest(3, 3, CVTCODE(Lab2LRGB), depth == CV_8U ? 1 : 1e-5); } OCL_TEST_P(CvtColor8u32f, Lab2BGRA) { performTest(3, 4, CVTCODE(Lab2BGR), depth == CV_8U ? 1 : 1e-5); } OCL_TEST_P(CvtColor8u32f, Lab2RGBA) { performTest(3, 4, CVTCODE(Lab2RGB), depth == CV_8U ? 1 : 1e-5); } OCL_TEST_P(CvtColor8u32f, Lab2LBGRA) { performTest(3, 4, CVTCODE(Lab2LBGR), depth == CV_8U ? 1 : 1e-5); } OCL_TEST_P(CvtColor8u32f, Lab2LRGBA) { performTest(3, 4, CVTCODE(Lab2LRGB), depth == CV_8U ? 1 : 1e-5); } // YUV -> RGBA_NV12 struct CvtColor_YUV420 : public CvtColor { void generateTestData(int channelsIn, int channelsOut) { const int srcType = CV_MAKE_TYPE(depth, channelsIn); const int dstType = CV_MAKE_TYPE(depth, channelsOut); Size roiSize = randomSize(1, MAX_VALUE); roiSize.width *= 2; roiSize.height *= 3; Border srcBorder = randomBorder(0, use_roi ? MAX_VALUE : 0); randomSubMat(src, src_roi, roiSize, srcBorder, srcType, 2, 100); Border dstBorder = randomBorder(0, use_roi ? MAX_VALUE : 0); randomSubMat(dst, dst_roi, roiSize, dstBorder, dstType, 5, 16); UMAT_UPLOAD_INPUT_PARAMETER(src) UMAT_UPLOAD_OUTPUT_PARAMETER(dst) } }; OCL_TEST_P(CvtColor_YUV420, YUV2RGBA_NV12) { performTest(1, 4, COLOR_YUV2RGBA_NV12); } OCL_TEST_P(CvtColor_YUV420, YUV2BGRA_NV12) { performTest(1, 4, COLOR_YUV2BGRA_NV12); } OCL_TEST_P(CvtColor_YUV420, YUV2RGB_NV12) { performTest(1, 3, COLOR_YUV2RGB_NV12); } OCL_TEST_P(CvtColor_YUV420, YUV2BGR_NV12) { performTest(1, 3, COLOR_YUV2BGR_NV12); } OCL_INSTANTIATE_TEST_CASE_P(ImgProc, CvtColor8u, testing::Combine(testing::Values(MatDepth(CV_8U)), Bool())); OCL_INSTANTIATE_TEST_CASE_P(ImgProc, CvtColor8u32f, testing::Combine(testing::Values(MatDepth(CV_8U), MatDepth(CV_32F)), Bool())); OCL_INSTANTIATE_TEST_CASE_P(ImgProc, CvtColor, testing::Combine( testing::Values(MatDepth(CV_8U), MatDepth(CV_16U), MatDepth(CV_32F)), Bool())); OCL_INSTANTIATE_TEST_CASE_P(ImgProc, CvtColor_YUV420, testing::Combine( testing::Values(MatDepth(CV_8U)), Bool())); } } // namespace cvtest::ocl #endif
; ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved. ; ; Use of this source code is governed by a BSD-style license ; that can be found in the LICENSE file in the root of the source ; tree. An additional intellectual property rights grant can be found ; in the file PATENTS. All contributing project authors may ; be found in the AUTHORS file in the root of the source tree. ; %include "vpx_ports/x86_abi_support.asm" section .text global sym(vp8_short_fdct4x4_mmx) global sym(vp8_short_fdct8x4_wmt) %define DCTCONSTANTSBITS (16) %define DCTROUNDINGVALUE (1<< (DCTCONSTANTSBITS-1)) %define x_c1 (60547) ; cos(pi /8) * (1<<15) %define x_c2 (46341) ; cos(pi*2/8) * (1<<15) %define x_c3 (25080) ; cos(pi*3/8) * (1<<15) ;void vp8_short_fdct4x4_mmx(short *input, short *output, int pitch) sym(vp8_short_fdct4x4_mmx): push rbp mov rbp, rsp SHADOW_ARGS_TO_STACK 3 GET_GOT rbx push rsi push rdi ; end prolog mov rsi, arg(0) ;input mov rdi, arg(1) ;output lea rdx, [dct_const_mmx GLOBAL] movsxd rax, dword ptr arg(2) ;pitch lea rcx, [rsi + rax*2] ; read the input data movq mm0, [rsi] movq mm1, [rsi + rax ] movq mm2, [rcx] movq mm3, [rcx + rax] ; get the constants ;shift to left by 1 for prescision psllw mm0, 3 psllw mm1, 3 psllw mm2, 3 psllw mm3, 3 ; transpose for the second stage movq mm4, mm0 ; 00 01 02 03 movq mm5, mm2 ; 10 11 12 03 punpcklwd mm0, mm1 ; 00 10 01 11 punpckhwd mm4, mm1 ; 02 12 03 13 punpcklwd mm2, mm3 ; 20 30 21 31 punpckhwd mm5, mm3 ; 22 32 23 33 movq mm1, mm0 ; 00 10 01 11 punpckldq mm0, mm2 ; 00 10 20 30 punpckhdq mm1, mm2 ; 01 11 21 31 movq mm2, mm4 ; 02 12 03 13 punpckldq mm2, mm5 ; 02 12 22 32 punpckhdq mm4, mm5 ; 03 13 23 33 movq mm3, mm4 ; first stage movq mm5, mm0 movq mm4, mm1 paddw mm0, mm3 ; a = 0 + 3 paddw mm1, mm2 ; b = 1 + 2 psubw mm4, mm2 ; c = 1 - 2 psubw mm5, mm3 ; d = 0 - 3 ; output 0 and 2 movq mm6, [rdx + 16] ; c2 movq mm2, mm0 ; a paddw mm0, mm1 ; a + b psubw mm2, mm1 ; a - b movq mm1, mm0 ; a + b pmulhw mm0, mm6 ; 00 01 02 03 paddw mm0, mm1 ; output 00 01 02 03 pmulhw mm6, mm2 ; 20 21 22 23 paddw mm2, mm6 ; output 20 21 22 23 ; output 1 and 3 movq mm6, [rdx + 8] ; c1 movq mm7, [rdx + 24] ; c3 movq mm1, mm4 ; c movq mm3, mm5 ; d pmulhw mm1, mm7 ; c * c3 pmulhw mm3, mm6 ; d * c1 paddw mm3, mm5 ; d * c1 rounded paddw mm1, mm3 ; output 10 11 12 13 movq mm3, mm4 ; c pmulhw mm5, mm7 ; d * c3 pmulhw mm4, mm6 ; c * c1 paddw mm3, mm4 ; round c* c1 psubw mm5, mm3 ; output 30 31 32 33 movq mm3, mm5 ; done with vertical ; transpose for the second stage movq mm4, mm0 ; 00 01 02 03 movq mm5, mm2 ; 10 11 12 03 punpcklwd mm0, mm1 ; 00 10 01 11 punpckhwd mm4, mm1 ; 02 12 03 13 punpcklwd mm2, mm3 ; 20 30 21 31 punpckhwd mm5, mm3 ; 22 32 23 33 movq mm1, mm0 ; 00 10 01 11 punpckldq mm0, mm2 ; 00 10 20 30 punpckhdq mm1, mm2 ; 01 11 21 31 movq mm2, mm4 ; 02 12 03 13 punpckldq mm2, mm5 ; 02 12 22 32 punpckhdq mm4, mm5 ; 03 13 23 33 movq mm3, mm4 ; first stage movq mm5, mm0 movq mm4, mm1 paddw mm0, mm3 ; a = 0 + 3 paddw mm1, mm2 ; b = 1 + 2 psubw mm4, mm2 ; c = 1 - 2 psubw mm5, mm3 ; d = 0 - 3 ; output 0 and 2 movq mm6, [rdx + 16] ; c2 movq mm2, mm0 ; a paddw mm0, mm1 ; a + b psubw mm2, mm1 ; a - b movq mm1, mm0 ; a + b pmulhw mm0, mm6 ; 00 01 02 03 paddw mm0, mm1 ; output 00 01 02 03 pmulhw mm6, mm2 ; 20 21 22 23 paddw mm2, mm6 ; output 20 21 22 23 ; output 1 and 3 movq mm6, [rdx + 8] ; c1 movq mm7, [rdx + 24] ; c3 movq mm1, mm4 ; c movq mm3, mm5 ; d pmulhw mm1, mm7 ; c * c3 pmulhw mm3, mm6 ; d * c1 paddw mm3, mm5 ; d * c1 rounded paddw mm1, mm3 ; output 10 11 12 13 movq mm3, mm4 ; c pmulhw mm5, mm7 ; d * c3 pmulhw mm4, mm6 ; c * c1 paddw mm3, mm4 ; round c* c1 psubw mm5, mm3 ; output 30 31 32 33 movq mm3, mm5 ; done with vertical pcmpeqw mm4, mm4 pcmpeqw mm5, mm5 psrlw mm4, 15 psrlw mm5, 15 psllw mm4, 2 psllw mm5, 2 paddw mm0, mm4 paddw mm1, mm5 paddw mm2, mm4 paddw mm3, mm5 psraw mm0, 3 psraw mm1, 3 psraw mm2, 3 psraw mm3, 3 movq [rdi ], mm0 movq [rdi+ 8], mm1 movq [rdi+16], mm2 movq [rdi+24], mm3 ; begin epilog pop rdi pop rsi RESTORE_GOT UNSHADOW_ARGS pop rbp ret ;void vp8_short_fdct8x4_wmt(short *input, short *output, int pitch) sym(vp8_short_fdct8x4_wmt): push rbp mov rbp, rsp SHADOW_ARGS_TO_STACK 3 GET_GOT rbx push rsi push rdi ; end prolog mov rsi, arg(0) ;input mov rdi, arg(1) ;output lea rdx, [dct_const_xmm GLOBAL] movsxd rax, dword ptr arg(2) ;pitch lea rcx, [rsi + rax*2] ; read the input data movdqa xmm0, [rsi] movdqa xmm2, [rsi + rax] movdqa xmm4, [rcx] movdqa xmm3, [rcx + rax] ; get the constants ;shift to left by 1 for prescision psllw xmm0, 3 psllw xmm2, 3 psllw xmm4, 3 psllw xmm3, 3 ; transpose for the second stage movdqa xmm1, xmm0 ; 00 01 02 03 04 05 06 07 movdqa xmm5, xmm4 ; 20 21 22 23 24 25 26 27 punpcklwd xmm0, xmm2 ; 00 10 01 11 02 12 03 13 punpckhwd xmm1, xmm2 ; 04 14 05 15 06 16 07 17 punpcklwd xmm4, xmm3 ; 20 30 21 31 22 32 23 33 punpckhwd xmm5, xmm3 ; 24 34 25 35 26 36 27 37 movdqa xmm2, xmm0 ; 00 10 01 11 02 12 03 13 punpckldq xmm0, xmm4 ; 00 10 20 30 01 11 21 31 punpckhdq xmm2, xmm4 ; 02 12 22 32 03 13 23 33 movdqa xmm4, xmm1 ; 04 14 05 15 06 16 07 17 punpckldq xmm4, xmm5 ; 04 14 24 34 05 15 25 35 punpckhdq xmm1, xmm5 ; 06 16 26 36 07 17 27 37 movdqa xmm3, xmm2 ; 02 12 22 32 03 13 23 33 punpckhqdq xmm3, xmm1 ; 03 13 23 33 07 17 27 37 punpcklqdq xmm2, xmm1 ; 02 12 22 32 06 16 26 36 movdqa xmm1, xmm0 ; 00 10 20 30 01 11 21 31 punpcklqdq xmm0, xmm4 ; 00 10 20 30 04 14 24 34 punpckhqdq xmm1, xmm4 ; 01 11 21 32 05 15 25 35 ; xmm0 0 ; xmm1 1 ; xmm2 2 ; xmm3 3 ; first stage movdqa xmm5, xmm0 movdqa xmm4, xmm1 paddw xmm0, xmm3 ; a = 0 + 3 paddw xmm1, xmm2 ; b = 1 + 2 psubw xmm4, xmm2 ; c = 1 - 2 psubw xmm5, xmm3 ; d = 0 - 3 ; output 0 and 2 movdqa xmm6, [rdx + 32] ; c2 movdqa xmm2, xmm0 ; a paddw xmm0, xmm1 ; a + b psubw xmm2, xmm1 ; a - b movdqa xmm1, xmm0 ; a + b pmulhw xmm0, xmm6 ; 00 01 02 03 paddw xmm0, xmm1 ; output 00 01 02 03 pmulhw xmm6, xmm2 ; 20 21 22 23 paddw xmm2, xmm6 ; output 20 21 22 23 ; output 1 and 3 movdqa xmm6, [rdx + 16] ; c1 movdqa xmm7, [rdx + 48] ; c3 movdqa xmm1, xmm4 ; c movdqa xmm3, xmm5 ; d pmulhw xmm1, xmm7 ; c * c3 pmulhw xmm3, xmm6 ; d * c1 paddw xmm3, xmm5 ; d * c1 rounded paddw xmm1, xmm3 ; output 10 11 12 13 movdqa xmm3, xmm4 ; c pmulhw xmm5, xmm7 ; d * c3 pmulhw xmm4, xmm6 ; c * c1 paddw xmm3, xmm4 ; round c* c1 psubw xmm5, xmm3 ; output 30 31 32 33 movdqa xmm3, xmm5 ; done with vertical ; transpose for the second stage movdqa xmm4, xmm2 ; 02 12 22 32 06 16 26 36 movdqa xmm2, xmm1 ; 01 11 21 31 05 15 25 35 movdqa xmm1, xmm0 ; 00 10 20 30 04 14 24 34 movdqa xmm5, xmm4 ; 02 12 22 32 06 16 26 36 punpcklwd xmm0, xmm2 ; 00 01 10 11 20 21 30 31 punpckhwd xmm1, xmm2 ; 04 05 14 15 24 25 34 35 punpcklwd xmm4, xmm3 ; 02 03 12 13 22 23 32 33 punpckhwd xmm5, xmm3 ; 06 07 16 17 26 27 36 37 movdqa xmm2, xmm0 ; 00 01 10 11 20 21 30 31 punpckldq xmm0, xmm4 ; 00 01 02 03 10 11 12 13 punpckhdq xmm2, xmm4 ; 20 21 22 23 30 31 32 33 movdqa xmm4, xmm1 ; 04 05 14 15 24 25 34 35 punpckldq xmm4, xmm5 ; 04 05 06 07 14 15 16 17 punpckhdq xmm1, xmm5 ; 24 25 26 27 34 35 36 37 movdqa xmm3, xmm2 ; 20 21 22 23 30 31 32 33 punpckhqdq xmm3, xmm1 ; 30 31 32 33 34 35 36 37 punpcklqdq xmm2, xmm1 ; 20 21 22 23 24 25 26 27 movdqa xmm1, xmm0 ; 00 01 02 03 10 11 12 13 punpcklqdq xmm0, xmm4 ; 00 01 02 03 04 05 06 07 punpckhqdq xmm1, xmm4 ; 10 11 12 13 14 15 16 17 ; first stage movdqa xmm5, xmm0 movdqa xmm4, xmm1 paddw xmm0, xmm3 ; a = 0 + 3 paddw xmm1, xmm2 ; b = 1 + 2 psubw xmm4, xmm2 ; c = 1 - 2 psubw xmm5, xmm3 ; d = 0 - 3 ; output 0 and 2 movdqa xmm6, [rdx + 32] ; c2 movdqa xmm2, xmm0 ; a paddw xmm0, xmm1 ; a + b psubw xmm2, xmm1 ; a - b movdqa xmm1, xmm0 ; a + b pmulhw xmm0, xmm6 ; 00 01 02 03 paddw xmm0, xmm1 ; output 00 01 02 03 pmulhw xmm6, xmm2 ; 20 21 22 23 paddw xmm2, xmm6 ; output 20 21 22 23 ; output 1 and 3 movdqa xmm6, [rdx + 16] ; c1 movdqa xmm7, [rdx + 48] ; c3 movdqa xmm1, xmm4 ; c movdqa xmm3, xmm5 ; d pmulhw xmm1, xmm7 ; c * c3 pmulhw xmm3, xmm6 ; d * c1 paddw xmm3, xmm5 ; d * c1 rounded paddw xmm1, xmm3 ; output 10 11 12 13 movdqa xmm3, xmm4 ; c pmulhw xmm5, xmm7 ; d * c3 pmulhw xmm4, xmm6 ; c * c1 paddw xmm3, xmm4 ; round c* c1 psubw xmm5, xmm3 ; output 30 31 32 33 movdqa xmm3, xmm5 ; done with vertical pcmpeqw xmm4, xmm4 pcmpeqw xmm5, xmm5; psrlw xmm4, 15 psrlw xmm5, 15 psllw xmm4, 2 psllw xmm5, 2 paddw xmm0, xmm4 paddw xmm1, xmm5 paddw xmm2, xmm4 paddw xmm3, xmm5 psraw xmm0, 3 psraw xmm1, 3 psraw xmm2, 3 psraw xmm3, 3 movq QWORD PTR[rdi ], xmm0 movq QWORD PTR[rdi+ 8], xmm1 movq QWORD PTR[rdi+16], xmm2 movq QWORD PTR[rdi+24], xmm3 psrldq xmm0, 8 psrldq xmm1, 8 psrldq xmm2, 8 psrldq xmm3, 8 movq QWORD PTR[rdi+32], xmm0 movq QWORD PTR[rdi+40], xmm1 movq QWORD PTR[rdi+48], xmm2 movq QWORD PTR[rdi+56], xmm3 ; begin epilog pop rdi pop rsi RESTORE_GOT UNSHADOW_ARGS pop rbp ret SECTION_RODATA ;static const unsigned int dct1st_stage_rounding_mmx[2] = align 16 dct1st_stage_rounding_mmx: times 2 dd 8192 ;static const unsigned int dct2nd_stage_rounding_mmx[2] = align 16 dct2nd_stage_rounding_mmx: times 2 dd 32768 ;static const short dct_matrix[4][4]= align 16 dct_matrix: times 4 dw 23170 dw 30274 dw 12540 dw -12540 dw -30274 dw 23170 times 2 dw -23170 dw 23170 dw 12540 dw -30274 dw 30274 dw -12540 ;static const unsigned short dct_const_mmx[4 * 4]= align 16 dct_const_mmx: times 4 dw 0 times 4 dw 60547 times 4 dw 46341 times 4 dw 25080 ;static const unsigned short dct_const_xmm[8 * 4]= align 16 dct_const_xmm: times 8 dw 0 times 8 dw 60547 times 8 dw 46341 times 8 dw 25080
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r11 push %r14 push %rax push %rbp push %rcx push %rdi push %rsi lea addresses_WT_ht+0x110b4, %rsi lea addresses_WC_ht+0x61b4, %rdi nop nop add $63404, %rbp mov $45, %rcx rep movsb cmp $29612, %r14 lea addresses_UC_ht+0x26b4, %rax nop nop nop xor %r10, %r10 vmovups (%rax), %ymm5 vextracti128 $1, %ymm5, %xmm5 vpextrq $1, %xmm5, %rbp nop nop nop nop and %rcx, %rcx lea addresses_WT_ht+0xa514, %rax nop nop nop nop nop sub %rcx, %rcx mov (%rax), %edi cmp %rbp, %rbp lea addresses_WT_ht+0x1e4, %rsi lea addresses_normal_ht+0x5af8, %rdi clflush (%rsi) sub $22124, %r11 mov $56, %rcx rep movsl nop nop nop nop nop add %rcx, %rcx lea addresses_D_ht+0x1aacd, %rcx nop nop nop nop cmp $59146, %rsi mov $0x6162636465666768, %rdi movq %rdi, %xmm4 vmovups %ymm4, (%rcx) nop nop nop nop nop cmp %r10, %r10 pop %rsi pop %rdi pop %rcx pop %rbp pop %rax pop %r14 pop %r11 pop %r10 ret .global s_faulty_load s_faulty_load: push %r11 push %r12 push %r13 push %r8 push %rbx push %rdx // Store lea addresses_WT+0x6cb4, %rdx nop nop nop nop sub $31400, %r13 movb $0x51, (%rdx) nop nop nop nop cmp %r12, %r12 // Faulty Load mov $0x69e84e00000000b4, %r13 clflush (%r13) nop nop nop nop dec %rbx vmovups (%r13), %ymm6 vextracti128 $1, %ymm6, %xmm6 vpextrq $0, %xmm6, %r8 lea oracles, %r12 and $0xff, %r8 shlq $12, %r8 mov (%r12,%r8,1), %r8 pop %rdx pop %rbx pop %r8 pop %r13 pop %r12 pop %r11 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'size': 8, 'AVXalign': True, 'NT': True, 'congruent': 0, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WT', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 10, 'same': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}} <gen_prepare_buffer> {'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 11, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 6, 'same': True}} {'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 4, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 4, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 0, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}} {'49': 487, '00': 149, '47': 4} 49 49 49 49 00 00 49 49 49 49 49 00 49 49 00 49 49 49 49 49 49 49 49 00 49 49 00 49 49 49 00 49 49 49 00 49 49 49 00 00 49 49 49 49 49 49 00 49 00 00 49 49 00 49 00 49 49 49 49 49 49 49 00 00 49 49 49 00 49 49 49 49 49 49 49 49 49 49 00 49 00 49 49 00 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 00 49 49 00 49 49 00 00 49 49 49 49 49 49 49 49 49 00 49 49 00 49 00 49 49 49 00 49 49 49 49 49 49 49 00 49 49 00 00 49 49 49 49 49 49 49 49 49 49 00 00 49 49 00 49 49 49 49 49 49 00 49 49 49 00 49 00 00 49 49 47 00 00 49 00 00 49 49 49 00 49 49 49 49 00 00 49 49 49 00 49 49 49 49 49 49 49 00 49 49 49 00 49 49 49 49 00 00 49 00 00 49 00 49 49 49 49 49 49 49 00 49 49 49 49 00 49 49 49 49 00 49 49 49 49 49 49 49 49 00 00 49 49 00 49 00 49 49 49 00 49 49 49 49 49 49 49 49 49 49 49 49 00 49 00 49 49 49 49 49 49 49 49 00 49 49 49 49 49 49 49 00 49 49 00 49 49 00 49 49 49 49 49 49 49 49 00 49 49 49 49 49 00 49 49 00 49 49 49 00 49 49 49 49 49 00 00 49 49 49 49 49 49 49 49 00 49 00 00 49 00 49 49 49 49 49 49 00 00 00 49 00 49 49 49 00 49 49 49 49 49 49 49 49 49 49 49 00 49 49 49 49 49 49 49 00 49 49 00 00 49 49 47 00 49 49 49 49 49 49 00 49 49 49 49 00 49 49 49 00 49 49 00 49 49 00 49 49 00 00 49 49 49 49 49 49 49 49 00 49 49 49 49 49 49 47 49 00 00 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 47 49 00 49 49 00 49 49 49 49 00 49 00 49 49 49 49 00 49 00 49 49 49 49 49 49 00 49 49 00 00 49 00 49 00 00 00 00 49 49 49 49 49 00 49 00 00 49 00 00 49 49 49 49 49 49 49 49 00 00 00 49 49 49 00 49 49 49 49 49 49 49 00 49 49 49 49 49 49 49 00 00 49 49 49 00 49 00 49 49 00 00 49 00 49 49 00 49 49 49 49 49 00 00 49 49 49 49 00 49 49 00 49 49 49 49 49 49 49 49 00 49 00 49 00 00 49 49 49 00 00 49 49 49 49 49 00 49 49 49 49 49 49 49 49 00 49 49 49 49 49 00 49 00 49 49 49 00 00 49 49 49 49 49 49 49 49 49 49 00 49 49 49 00 49 49 49 49 49 49 49 49 49 49 49 00 49 49 49 49 49 49 */
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r12 push %r13 push %r14 push %rax push %rcx push %rdi push %rsi lea addresses_UC_ht+0x1eb97, %r14 nop nop nop nop cmp %rax, %rax mov (%r14), %r12w nop sub %rdi, %rdi lea addresses_UC_ht+0x1ccb7, %rsi lea addresses_A_ht+0x1fc9, %rdi clflush (%rdi) nop nop nop nop xor $48463, %r13 mov $125, %rcx rep movsb nop nop nop inc %rcx lea addresses_WC_ht+0x7a97, %r14 nop nop and $4158, %r13 mov $0x6162636465666768, %rdi movq %rdi, %xmm1 movups %xmm1, (%r14) nop nop nop xor %r14, %r14 lea addresses_A_ht+0x1e445, %rsi clflush (%rsi) xor %rcx, %rcx mov (%rsi), %r13 nop nop nop xor %rcx, %rcx lea addresses_A_ht+0x66a7, %r14 nop nop and %rcx, %rcx mov $0x6162636465666768, %r13 movq %r13, (%r14) nop nop and $23688, %rax lea addresses_D_ht+0x9e37, %rsi nop nop nop nop inc %rax mov $0x6162636465666768, %r13 movq %r13, %xmm3 movups %xmm3, (%rsi) nop nop add %r13, %r13 lea addresses_WC_ht+0x10db7, %r13 nop nop nop cmp $52181, %r12 movl $0x61626364, (%r13) nop nop nop nop add %rdi, %rdi lea addresses_normal_ht+0x13b7, %r13 sub %rsi, %rsi mov $0x6162636465666768, %rax movq %rax, %xmm3 movups %xmm3, (%r13) xor %r14, %r14 lea addresses_UC_ht+0x1167, %r12 nop nop nop nop nop add $1520, %r13 mov $0x6162636465666768, %rax movq %rax, %xmm7 movups %xmm7, (%r12) nop nop nop nop inc %rcx lea addresses_WT_ht+0x6b37, %r12 nop nop nop nop nop cmp $3628, %r13 mov $0x6162636465666768, %rsi movq %rsi, %xmm3 vmovups %ymm3, (%r12) nop nop nop nop nop xor $47646, %rdi lea addresses_WC_ht+0xd6e7, %rsi lfence mov (%rsi), %r14 sub %rax, %rax lea addresses_WT_ht+0x12cb7, %rax clflush (%rax) and $41224, %rcx movb $0x61, (%rax) nop nop dec %rax lea addresses_normal_ht+0x1649f, %r12 nop nop and $15365, %rsi mov $0x6162636465666768, %rax movq %rax, %xmm0 movups %xmm0, (%r12) inc %r12 lea addresses_WC_ht+0x120f7, %rsi lea addresses_D_ht+0x10f77, %rdi nop cmp %r10, %r10 mov $51, %rcx rep movsw xor %rsi, %rsi pop %rsi pop %rdi pop %rcx pop %rax pop %r14 pop %r13 pop %r12 pop %r10 ret .global s_faulty_load s_faulty_load: push %r12 push %r14 push %r8 push %rbp push %rbx push %rcx push %rdi // Store lea addresses_D+0x94b7, %rdi nop nop nop add $36845, %rcx mov $0x5152535455565758, %r14 movq %r14, (%rdi) nop nop nop cmp $20833, %r12 // Store lea addresses_WC+0x14fb7, %rbp nop nop nop and $63774, %r12 movl $0x51525354, (%rbp) and $44772, %rdi // Load mov $0xf5d, %rbx nop nop nop and %r8, %r8 movb (%rbx), %r14b nop cmp %r14, %r14 // Load mov $0x6d7, %rbp clflush (%rbp) nop nop nop add $32693, %rbx movups (%rbp), %xmm1 vpextrq $0, %xmm1, %rdi nop nop nop cmp %r12, %r12 // Load lea addresses_WT+0x13db7, %r14 nop nop nop nop inc %r8 vmovups (%r14), %ymm4 vextracti128 $1, %ymm4, %xmm4 vpextrq $0, %xmm4, %rbx nop nop nop nop and %rdi, %rdi // Store lea addresses_D+0xb1bb, %rcx nop nop nop xor $37781, %rdi movb $0x51, (%rcx) nop nop nop inc %rcx // Store lea addresses_WC+0x9d37, %rcx xor %r8, %r8 movb $0x51, (%rcx) add $62585, %rbx // Store lea addresses_A+0x11777, %r12 nop inc %r8 movb $0x51, (%r12) cmp %rcx, %rcx // Store lea addresses_WC+0x6ea3, %rbp nop nop nop nop add %r14, %r14 mov $0x5152535455565758, %rcx movq %rcx, %xmm4 movntdq %xmm4, (%rbp) nop nop xor $8154, %r12 // Faulty Load lea addresses_D+0x94b7, %rcx nop nop nop nop sub $57022, %r12 movups (%rcx), %xmm5 vpextrq $0, %xmm5, %r14 lea oracles, %r8 and $0xff, %r14 shlq $12, %r14 mov (%r8,%r14,1), %r14 pop %rdi pop %rcx pop %rbx pop %rbp pop %r8 pop %r14 pop %r12 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_D', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 0}} {'OP': 'STOR', 'dst': {'same': True, 'type': 'addresses_D', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 0}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WC', 'NT': False, 'AVXalign': True, 'size': 4, 'congruent': 8}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_P', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 1}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_P', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 5}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WT', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 3}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_D', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 2}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WC', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 7}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_A', 'NT': True, 'AVXalign': True, 'size': 1, 'congruent': 3}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WC', 'NT': True, 'AVXalign': False, 'size': 16, 'congruent': 2}} [Faulty Load] {'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_D', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 0}} <gen_prepare_buffer> {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_UC_ht', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 2}} {'OP': 'REPM', 'src': {'same': False, 'congruent': 11, 'type': 'addresses_UC_ht'}, 'dst': {'same': False, 'congruent': 1, 'type': 'addresses_A_ht'}} {'OP': 'STOR', 'dst': {'same': True, 'type': 'addresses_WC_ht', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 4}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_A_ht', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 1}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_A_ht', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 4}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_D_ht', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 5}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WC_ht', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 8}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_normal_ht', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 6}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_UC_ht', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 4}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WT_ht', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 6}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WC_ht', 'NT': True, 'AVXalign': False, 'size': 8, 'congruent': 3}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WT_ht', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 9}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_normal_ht', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 3}} {'OP': 'REPM', 'src': {'same': False, 'congruent': 6, 'type': 'addresses_WC_ht'}, 'dst': {'same': False, 'congruent': 6, 'type': 'addresses_D_ht'}} {'58': 21829} 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 */
<% from pwnlib.shellcraft import common %> <%docstring> An infinite loop. Example: >>> io = run_assembly(shellcraft.infloop()) >>> io.recvall(timeout=1) b'' >>> io.close() </%docstring> <% infloop = common.label("infloop") %> ${infloop}: b ${infloop}
INCLUDE "hardware.inc" SECTION "Image", ROM0 INCBIN "obj/image.2bpp" SECTION "MainCode", ROM0 ASSERT SIZEOF("Image") <= ((160 * 144 * 2) / 8), "Image is too large! Needs to be 160 x 144" EntryPoint:: ld sp, $E000 ; Set the stack pointer to the top of RAM to free up HRAM ; Turn off the LCD .waitVBlank: ld a, [rLY] cp 144 ; Check if the LCD is past VBlank jr c, .waitVBlank xor a ; turn off the LCD ld [rLCDC], a ; Copy image tileset into VRAM ld hl, _VRAM ld de, STARTOF("Image") ld bc, SIZEOF("Image") call memcpy ; Copy first chunk of tilemap into VRAM ld hl, _SCRN0 xor a ld bc, 12 ; Offset needed to jump from end of this line to start of next line ld e, 20 ; 20 tiles in a line .tilemapCopyLp1: ld [hli], a dec e jr nz, .noNewLine add hl, bc ld e, 20 .noNewLine: inc a cp $F0 jr nz, .tilemapCopyLp1 ; Copy second chunk of tilemap into VRAM ld hl, _SCRN1 + $180 ld a, -16 ld e, 20 .tilemapCopyLp2: ld [hli], a dec e jr nz, .noNewLine2 add hl, bc ld e, 20 .noNewLine2: inc a cp $68 jr nz, .tilemapCopyLp2 ; Init display registers ld a, %11100100 ; Init background palette ldh [rBGP], a xor a ; Init scroll registers ldh [rSCY], a ldh [rSCX], a ; Init mid-screen interrupt ld a, 96 ; Scanline to interrupt on ld [rLYC], a ld a, STATF_LYC ; Enable LY=LYC interrupt source ld [rSTAT], a ; Shut sound down xor a ldh [rNR52], a ; Enable screen and initialise screen settings ld a, LCDCF_ON | LCDCF_WIN9C00 | LCDCF_WINOFF | LCDCF_BG8000 \ | LCDCF_BG9800 | LCDCF_OBJ8 | LCDCF_OBJOFF | LCDCF_BGON ldh [rLCDC], a ; Disable all interrupts except VBlank and LCDC ld a, IEF_VBLANK | IEF_LCDC ldh [rIE], a ei MainLoop: halt jr MainLoop VBlank:: ld a, [rLCDC] set 4, a ; set background tileset to LCDCF_BG8000 res 3, a ; set background tilemap to LCDCF_BG9800 ld [rLCDC], a reti LCDInterrupt:: ld a, [rLCDC] res 4, a ; set background tileset to LCDCF_BG8800 set 3, a ; set background tilemap to LCDCF_BG9C00 ld [rLCDC], a reti ; Copies a block of data ; Input - HL = Destination address ; Input - DE = Start address ; Input - BC = Data length ; Sets - A B C to 0 ; Sets - H L D E to garbage memcpy:: ld a, [de] ; Grab 1 byte from the source ld [hli], a ; Place it at the destination, incrementing hl inc de ; Move to next byte dec bc ; Decrement count ld a, b ; Check if count is 0, since `dec bc` doesn't update flags or c jr nz, memcpy ret
;/* ; * FreeRTOS Kernel <DEVELOPMENT BRANCH> ; * Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. ; * ; * SPDX-License-Identifier: MIT ; * ; * Permission is hereby granted, free of charge, to any person obtaining a copy of ; * this software and associated documentation files (the "Software"), to deal in ; * the Software without restriction, including without limitation the rights to ; * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of ; * the Software, and to permit persons to whom the Software is furnished to do so, ; * subject to the following conditions: ; * ; * The above copyright notice and this permission notice shall be included in all ; * copies or substantial portions of the Software. ; * ; * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ; * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS ; * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR ; * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER ; * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN ; * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ; * ; * https://www.FreeRTOS.org ; * https://github.com/FreeRTOS ; * ; */ .extern pxCurrentTCB .extern vTaskSwitchContext .extern ulMaxSyscallInterruptPriorityConst .global _vector_14 .global _lc_ref__vector_pp_14 .global SVC_Handler .global vPortStartFirstTask .global vPortEnableVFP .global ulPortSetInterruptMask .global vPortClearInterruptMask ;----------------------------------------------------------- .section .text .thumb .align 4 _vector_14: .type func mrs r0, psp isb ;Get the location of the current TCB. ldr.w r3, =pxCurrentTCB ldr r2, [r3] ;Is the task using the FPU context? If so, push high vfp registers. tst r14, #0x10 it eq vstmdbeq r0!, {s16-s31} ;Save the core registers. stmdb r0!, {r4-r11, r14} ;Save the new top of stack into the first member of the TCB. str r0, [r2] stmdb sp!, {r0, r3} ldr.w r0, =ulMaxSyscallInterruptPriorityConst ldr r0, [r0] msr basepri, r0 bl vTaskSwitchContext mov r0, #0 msr basepri, r0 ldmia sp!, {r0, r3} ;The first item in pxCurrentTCB is the task top of stack. ldr r1, [r3] ldr r0, [r1] ;Pop the core registers. ldmia r0!, {r4-r11, r14} ;Is the task using the FPU context? If so, pop the high vfp registers too. tst r14, #0x10 it eq vldmiaeq r0!, {s16-s31} msr psp, r0 isb bx r14 .size _vector_14, $-_vector_14 .endsec ;----------------------------------------------------------- ; This function is an XMC4000 silicon errata workaround. It will get used when ; the SILICON_BUG_PMC_CM_001 linker macro is defined. .section .text .thumb .align 4 _lc_ref__vector_pp_14: .type func mrs r0, psp isb ;Get the location of the current TCB. ldr.w r3, =pxCurrentTCB ldr r2, [r3] ;Is the task using the FPU context? If so, push high vfp registers. tst r14, #0x10 it eq vstmdbeq r0!, {s16-s31} ;Save the core registers. stmdb r0!, {r4-r11, r14} ;Save the new top of stack into the first member of the TCB. str r0, [r2] stmdb sp!, {r3} ldr.w r0, =ulMaxSyscallInterruptPriorityConst ldr r0, [r0] msr basepri, r0 bl vTaskSwitchContext mov r0, #0 msr basepri, r0 ldmia sp!, {r3} ;The first item in pxCurrentTCB is the task top of stack. ldr r1, [r3] ldr r0, [r1] ;Pop the core registers. ldmia r0!, {r4-r11, r14} ;Is the task using the FPU context? If so, pop the high vfp registers too. tst r14, #0x10 it eq vldmiaeq r0!, {s16-s31} msr psp, r0 isb push { lr } pop { pc } ; XMC4000 specific errata workaround. Do not used "bx lr" here. .size _lc_ref__vector_pp_14, $-_lc_ref__vector_pp_14 .endsec ;----------------------------------------------------------- .section .text .thumb .align 4 SVC_Handler: .type func ;Get the location of the current TCB. ldr.w r3, =pxCurrentTCB ldr r1, [r3] ldr r0, [r1] ;Pop the core registers. ldmia r0!, {r4-r11, r14} msr psp, r0 isb mov r0, #0 msr basepri, r0 bx r14 .size SVC_Handler, $-SVC_Handler .endsec ;----------------------------------------------------------- .section .text .thumb .align 4 vPortStartFirstTask .type func ;Use the NVIC offset register to locate the stack. ldr.w r0, =0xE000ED08 ldr r0, [r0] ldr r0, [r0] ;Set the msp back to the start of the stack. msr msp, r0 ;Call SVC to start the first task. cpsie i cpsie f dsb isb svc 0 .size vPortStartFirstTask, $-vPortStartFirstTask .endsec ;----------------------------------------------------------- .section .text .thumb .align 4 vPortEnableVFP .type func ;The FPU enable bits are in the CPACR. ldr.w r0, =0xE000ED88 ldr r1, [r0] ;Enable CP10 and CP11 coprocessors, then save back. orr r1, r1, #( 0xf << 20 ) str r1, [r0] bx r14 .size vPortEnableVFP, $-vPortEnableVFP .endsec ;----------------------------------------------------------- .section .text .thumb .align 4 ulPortSetInterruptMask: mrs r0, basepri ldr.w r1, =ulMaxSyscallInterruptPriorityConst ldr r1, [r1] msr basepri, r1 bx r14 .size ulPortSetInterruptMask, $-ulPortSetInterruptMask .endsec ;----------------------------------------------------------- .section .text .thumb .align 4 vPortClearInterruptMask: msr basepri, r0 bx r14 .size vPortClearInterruptMask, $-vPortClearInterruptMask .endsec ;----------------------------------------------------------- .end
; A245326: Denominators of an enumeration system of the reduced nonnegative rational numbers. ; Submitted by Christian Krause ; 1,2,1,3,3,2,1,5,4,5,4,3,3,2,1,8,7,7,5,8,7,7,5,5,4,5,4,3,3,2,1,13,11,12,9,11,10,9,6,13,11,12,9,11,10,9,6,8,7,7,5,8,7,7,5,5,4,5,4,3,3,2,1,21,18,19,14,19,17,16,11,18,15,17,13,14,13,11,7,21,18,19,14,19,17,16,11,18,15,17,13,14,13,11,7,13,11,12,9,11 mul $0,2 mov $1,2 mov $2,2 lpb $0 div $0,2 sub $2,$3 add $3,$0 sub $0,1 mod $3,2 mov $4,$2 add $2,$1 mul $3,$4 add $1,$3 lpe mov $0,$1 div $0,2
; void *heap_calloc_unlocked_callee(void *heap, size_t nmemb, size_t size) SECTION code_clib SECTION code_alloc_malloc PUBLIC _heap_calloc_unlocked_callee EXTERN asm_heap_calloc_unlocked _heap_calloc_unlocked_callee: pop af pop de pop hl pop bc push af jp asm_heap_calloc_unlocked
; **************************************************************************************************************** ; **************************************************************************************************************** ; ; # : Goto line number, optional return. ; ; **************************************************************************************************************** ; **************************************************************************************************************** jmp __STGOTO_End __ST_Goto: xppc p3 ; check for '=' jp __STGOTO_End ; if error, end. xppc p3 ; evaluate rhs and push result ld @2(p2) ; unstack the result and saved space csa ; end if there was an error. jp __STGOTO_End ld -1(p2) ; if the result is zero or -2(p2) ; then exit, CY/L is set from the expression evaluator jz __STGOTO_End lpi p3,Variables ; copy current line number + 1 to ! (return address) ccl ld ('#' & 0x3F)*2(p3) adi 1 st ('!' & 0x3F)*2(p3) ld ('#' & 0x3F)*2+1(p3) adi 0 st ('!' & 0x3F)*2+1(p3) ldi 1 ; set IsRunning flag. st IsRunning-Variables(p3) ld ProgramBase-Variables(p3) ; put program base address into P1. xpal p1 ld ProgramBase-Variables+1(p3) xpah p1 __STGOTO_Search: ; look for line # ld (p1) ; read offset. jz __STGOTO_Found ; if offset is zero goto end of program (P1) xae ; save offset in E scl ld 1(p1) ; calculate current# - required but not worried about cad -2(p2) ; the actual answer. ld 2(p1) cad -1(p2) csa ; look at carry flag ani 0x80 jnz __STGOTO_Found ; if set then current# >= required# ld @-0x80(p1) ; use auto index to go to next one jmp __STGOTO_Search __STGOTO_Found: scl jmp ExecuteNextStatement __STGOTO_End:
// Copyright (c) Microsoft Corporation. All rights reserved. // SPDX-License-Identifier: MIT #pragma once namespace Azure { namespace Storage { constexpr static const char* AccountEncryptionKey = "$account-encryption-key"; constexpr static const char* ETagWildcard = "*"; namespace Details { constexpr static const char* BlobServicePackageName = "storage-blobs"; constexpr static const char* DatalakeServicePackageName = "storage-files-datalake"; constexpr static const char* FileServicePackageName = "storage-files-shares"; constexpr static const char* QueueServicePackageName = "storage-queues"; constexpr static const char* HttpQuerySnapshot = "snapshot"; constexpr static const char* HttpQueryVersionId = "versionid"; constexpr static const char* StorageScope = "https://storage.azure.com/.default"; constexpr static const char* HttpHeaderDate = "date"; constexpr static const char* HttpHeaderXMsVersion = "x-ms-version"; constexpr static const char* HttpHeaderRequestId = "x-ms-request-id"; constexpr static const char* HttpHeaderClientRequestId = "x-ms-client-request-id"; constexpr static const char* HttpHeaderContentType = "content-type"; constexpr static const char* DefaultSasVersion = "2020-02-10"; constexpr int ReliableStreamRetryCount = 3; } // namespace Details }} // namespace Azure::Storage
; A238236: Expansion of (1-x-x^2)/((x-1)*(x^3+3*x^2+2*x-1)). ; 1,2,6,18,55,169,520,1601,4930,15182,46754,143983,443409,1365520,4205249,12950466,39882198,122821042,378239143,1164823609,3587185688,11047081345,34020543362,104769516446,322647744322,993624581343,3059961912097,9423445312544,29020400942721,89371099735170,275226847611046,847587395370322,2610226433308951,8038441900339913 mov $2,$0 add $2,1 mov $3,$0 lpb $2 mov $0,$3 sub $2,1 sub $0,$2 mul $0,2 add $0,1 cal $0,5251 ; a(0) = 0, a(1) = a(2) = a(3) = 1; thereafter, a(n) = a(n-1) + a(n-2) + a(n-4). add $1,$0 lpe
; Copyright (c) 2004, Intel Corporation ; All rights reserved. This program and the accompanying materials ; are licensed and made available under the terms and conditions of the BSD License ; which accompanies this distribution. The full text of the license may be found at ; http://opensource.org/licenses/bsd-license.php ; ; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, ; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. ; ; Module Name: ; ; Wbinvd.Asm ; ; Abstract: ; ; AsmWbinvd function ; ; Notes: ; ;------------------------------------------------------------------------------ .code ;------------------------------------------------------------------------------ ; VOID ; EFIAPI ; AsmWbinvd ( ; VOID ; ); ;------------------------------------------------------------------------------ AsmWbinvd PROC wbinvd ret AsmWbinvd ENDP END
title Cpu.asm ;------------------------------------------------------------------------------ ; ; Copyright (c) 2006, Intel Corporation ; All rights reserved. This program and the accompanying materials ; are licensed and made available under the terms and conditions of the BSD License ; which accompanies this distribution. The full text of the license may be found at ; http://opensource.org/licenses/bsd-license.php ; ; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, ; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. ; ; Module Name: ; Cpu.asm ; ; Abstract: ; ;------------------------------------------------------------------------------ .686 .MODEL FLAT,C .CODE ;------------------------------------------------------------------------------ ; VOID * ; GetPageTableBase ( ; VOID ; ) ;------------------------------------------------------------------------------ GetPageTableBase PROC PUBLIC mov eax, cr3 ret GetPageTableBase ENDP END
; A033622: Good sequence of increments for Shell sort (best on big values). ; 1,5,19,41,109,209,505,929,2161,3905,8929,16001,36289,64769,146305,260609,587521,1045505,2354689,4188161,9427969,16764929,37730305,67084289,150958081,268386305,603906049,1073643521,2415771649,4294770689,9663381505,17179475969,38654115841,68718690305,154617643009,274876334081,618472931329,1099508482049,2473896443905,4398040219649,9895595212801,17592173461505,39582399725569,70368719011841,158329636651009,281474926379009,633318622101505,1125899806179329,2533274639400961,4503599426043905 add $0,4 mov $1,6 mov $2,4 lpb $0 sub $0,1 mul $1,2 sub $1,15 mov $3,3 add $3,$1 mov $1,$2 mov $2,$3 lpe add $0,2 mul $1,2 pow $1,$0 sub $1,576 div $1,512 mul $1,2 add $1,1
SECTION bss_fp_mbf32 PUBLIC FPREG PUBLIC FPEXP PUBLIC SGNRES PUBLIC FPSIGN PUBLIC VALTYP PUBLIC SEED PUBLIC LSTRND FPREG: defb 0 defb 0 defb 0 FPEXP: defb 0 SGNRES: FPSIGN: defb 0 VALTYP: defb 0 SEED: defs 4 LSTRND: defs 4 IF __CPU_GBZ80__ PUBLIC ___mbf32_savea ___mbf32_savea: defb 0 ENDIF
; Initialise vector area V2.01  1992 Tony Tebby section init xdef init_vec xdef init_wbase xref init_exv include 'dev8_keys_sys' include 'dev8_smsq_smsq_base_keys' include 'dev8_smsq_smsq_ini_keys' include 'dev8_keys_68000' include 'dev8_keys_err' include 'dev8_keys_qlv' include 'dev8_mac_assert' vec macro routine xref [routine] dc.w [routine]-* endm iv_veca0 move.w #jmp.l,d0 ; jmp bsr.s iv_wbase init_wbase iv_wba0 move.l a0,d0 ; to a0 iv_wbd0 swap d0 bsr.s iv_wbase swap d0 iv_wbase jmp sms.wbase ;+++ ; Initialise the whole vector area ;--- init_vec lea sms_uvect,a0 lea exv_accf,a5 ; bus error is first settable vector lea exv_top,a2 iv_pres bsr.s iv_wba0 ; preset all cmp.l a2,a5 blo.s iv_pres assert sms.sysb,exv_top lea ini_sysb,a0 bsr.s iv_wba0 ; set system base ; the basic area is filled in, now put in the soft reset vectors move.l #sms.resl,d0 ; long branch lea sms.res,a5 bsr.s iv_wbd0 lea sms.rese,a5 ; and lots of short branches moveq #sms.resn-1,d1 move.w #sms.ress,d0 ; the branch iv_res bsr.s iv_wbase subq.b #2,d0 ; next is further back dbra d1,iv_res ; now the nasty bit, the QL vectors lea iv_vector,a2 iv_qlva move.w (a2)+,d2 ; next group beq.l init_exv ; done, do the exception vectors move.w (a2)+,d1 ; offset move.w d2,a1 ; ql vector add.w d2,d2 lea qlv.off(a1),a5 ; staging post for this vector add.w d2,a5 ; = offset + 4* QLV iv_qlv move.l a2,a0 move.w (a2)+,d0 beq.s iv_qlva add.w d0,a0 ; address of routine move.w d1,d0 add.w a5,d0 ; offset vector exg a1,a5 bsr.s iv_wbase ; set vector exg a1,a5 bsr.s iv_veca0 ; and staging post bra.s iv_qlv iv_vector ; vectored utilities ; Common heap management dc.w mem.achp,0 vec mem_achp $00c0 ; Allocate space in Common HeaP vec mem_rchp $00c2 ; Return space to Common HeaP dc.w 0 ; General memory management dc.w mem.llst,0 vec mem_llst $00d2 ; Link into LiST vec mem_rlst $00d4 ; Remove from LiST vec mem_rlst $00d6 ; should be date, will be overwritten vec mem_alhp $00d8 ; ALlocate in HeaP vec mem_rehp $00da ; REturn to HeaP ; Queue handling utilities vec ioq_setq $00dc ; SET up a Queue in standard form vec ioq_test $00de ; TEST a queue for pending byte / space available vec ioq_pbyt $00e0 ; Put a BYTe into a queue vec ioq_gbyt $00e2 ; Get a BYTe out of a queue vec ioq_seof $00e4 ; Set EOF in queue ; string utilities vec uq_ssq $00e6 ; should be Compare STRings, will be overwritten ; Standard serial IO vec uq_ssq $00e8 ; Standard Serial Queue handling vec uq_ssio $00ea ; Standard Serial IO dc.w 0 ; IO dc.w iou.dnam,0 vec iou_dnam $0122 ; decode Device NAMe dc.w 0 ; Microdrive dc.w md.read,-$4000 vec md_read $0124 ; read a sector vec md_write $0126 ; write a sector vec md_verif $0128 ; verify a sector vec md_rdhdr $012a ; read sector header dc.w 0 dc.w 0 sms_uvect dc.l $4afbedeb bra.s sms_uvect dc.w 'Undefined Vector' end
//---------------------------------------------------------------------------------------------------------------------- // GRVC UAL //---------------------------------------------------------------------------------------------------------------------- // The MIT License (MIT) // // Copyright (c) 2016 GRVC University of Seville // // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated // documentation files (the "Software"), to deal in the Software without restriction, including without limitation the // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the // Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE // WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS // OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. //---------------------------------------------------------------------------------------------------------------------- #include <string> #include <chrono> #include <uav_abstraction_layer/backend_mavros.h> #include <Eigen/Eigen> #include <ros/ros.h> #include <ros/package.h> #include <tf2_ros/transform_listener.h> #include <tf2_geometry_msgs/tf2_geometry_msgs.h> #include <tf2/LinearMath/Quaternion.h> #include <uav_abstraction_layer/geographic_to_cartesian.h> #include <mavros_msgs/ParamGet.h> namespace grvc { namespace ual { BackendMavros::BackendMavros() : Backend() { // Parse arguments ros::NodeHandle pnh("~"); pnh.param<int>("uav_id", robot_id_, 1); pnh.param<std::string>("pose_frame_id", pose_frame_id_, ""); float position_th_param, orientation_th_param, hold_pose_time_param; pnh.param<float>("position_th", position_th_param, 0.33); pnh.param<float>("orientation_th", orientation_th_param, 0.65); pnh.param<float>("hold_pose_time", hold_pose_time_param, 3.0); position_th_ = position_th_param*position_th_param; orientation_th_ = 0.5*(1 - cos(orientation_th_param)); hold_pose_time_ = std::max(hold_pose_time_param, 0.001f); // Force min value ROS_INFO("BackendMavros constructor with id [%d]", robot_id_); // ROS_INFO("BackendMavros: thresholds = %f %f", position_th_, orientation_th_); // Init ros communications ros::NodeHandle nh; std::string mavros_ns = "mavros"; std::string set_mode_srv = mavros_ns + "/set_mode"; std::string arming_srv = mavros_ns + "/cmd/arming"; std::string get_param_srv = mavros_ns + "/param/get"; std::string set_pose_topic = mavros_ns + "/setpoint_position/local"; std::string set_pose_global_topic = mavros_ns + "/setpoint_raw/global"; std::string set_vel_topic = mavros_ns + "/setpoint_velocity/cmd_vel"; std::string pose_topic = mavros_ns + "/local_position/pose"; std::string geo_pose_topic = mavros_ns + "/global_position/global"; #ifdef MAVROS_VERSION_BELOW_0_29_0 std::string vel_topic_local = mavros_ns + "/local_position/velocity"; #else std::string vel_topic_local = mavros_ns + "/local_position/velocity_local"; #endif std::string vel_topic_body = mavros_ns + "/local_position/velocity_body"; std::string state_topic = mavros_ns + "/state"; std::string extended_state_topic = mavros_ns + "/extended_state"; flight_mode_client_ = nh.serviceClient<mavros_msgs::SetMode>(set_mode_srv.c_str()); arming_client_ = nh.serviceClient<mavros_msgs::CommandBool>(arming_srv.c_str()); mavros_ref_pose_pub_ = nh.advertise<geometry_msgs::PoseStamped>(set_pose_topic.c_str(), 1); mavros_ref_pose_global_pub_ = nh.advertise<mavros_msgs::GlobalPositionTarget>(set_pose_global_topic.c_str(), 1); mavros_ref_vel_pub_ = nh.advertise<geometry_msgs::TwistStamped>(set_vel_topic.c_str(), 1); mavros_cur_pose_sub_ = nh.subscribe<geometry_msgs::PoseStamped>(pose_topic.c_str(), 1, \ [this](const geometry_msgs::PoseStamped::ConstPtr& _msg) { this->cur_pose_ = *_msg; this->mavros_has_pose_ = true; }); mavros_cur_vel_sub_ = nh.subscribe<geometry_msgs::TwistStamped>(vel_topic_local.c_str(), 1, \ [this](const geometry_msgs::TwistStamped::ConstPtr& _msg) { this->cur_vel_ = *_msg; this->cur_vel_.header.frame_id = this->uav_home_frame_id_; #ifdef MAVROS_VERSION_BELOW_0_29_0 this->cur_vel_body_ = *_msg; this->cur_vel_body_.header.frame_id = this->uav_frame_id_; #endif }); mavros_cur_vel_body_sub_ = nh.subscribe<geometry_msgs::TwistStamped>(vel_topic_body.c_str(), 1, \ [this](const geometry_msgs::TwistStamped::ConstPtr& _msg) { this->cur_vel_body_ = *_msg; this->cur_vel_body_.header.frame_id = this->uav_frame_id_; }); mavros_cur_geo_pose_sub_ = nh.subscribe<sensor_msgs::NavSatFix>(geo_pose_topic.c_str(), 1, \ [this](const sensor_msgs::NavSatFix::ConstPtr& _msg) { this->cur_geo_pose_ = *_msg; if (!this->mavros_has_geo_pose_) { if (_msg->position_covariance[0] < 1.2 && _msg->position_covariance[0] > 0 && _msg->header.seq > 100) { this->mavros_has_geo_pose_ = true; // ROS_INFO("Has Geo Pose! %f",_msg->position_covariance[0]); } } }); mavros_cur_state_sub_ = nh.subscribe<mavros_msgs::State>(state_topic.c_str(), 1, \ [this](const mavros_msgs::State::ConstPtr& _msg) { this->mavros_state_ = *_msg; }); mavros_cur_extended_state_sub_ = nh.subscribe<mavros_msgs::ExtendedState>(extended_state_topic.c_str(), 1, \ [this](const mavros_msgs::ExtendedState::ConstPtr& _msg) { this->mavros_extended_state_ = *_msg; }); // Wait until mavros is connected while (!mavros_state_.connected && ros::ok()) { std::this_thread::sleep_for(std::chrono::milliseconds(200)); } // TODO: Check this and solve frames issue initHomeFrame(); // Thread publishing target pose at 10Hz for offboard mode offboard_thread_ = std::thread(&BackendMavros::offboardThreadLoop, this); // Client to get parameters from mavros and required default values get_param_client_ = nh.serviceClient<mavros_msgs::ParamGet>(get_param_srv.c_str()); mavros_params_["MPC_XY_VEL_MAX"] = 2.0; // [m/s] Default value mavros_params_["MPC_Z_VEL_MAX_UP"] = 3.0; // [m/s] Default value mavros_params_["MPC_Z_VEL_MAX_DN"] = 1.0; // [m/s] Default value mavros_params_["MC_YAWRATE_MAX"] = 200.0; // [deg/s] Default value mavros_params_["MPC_TKO_SPEED"] = 1.5; // [m/s] Default value // Updating here is non-sense as service seems to be slow in waking up ROS_INFO("BackendMavros [%d] running!", robot_id_); } BackendMavros::~BackendMavros() { if (offboard_thread_.joinable()) { offboard_thread_.join(); } } void BackendMavros::offboardThreadLoop(){ ros::param::param<double>("~mavros_offboard_rate", offboard_thread_frequency_, 30.0); int buffer_size = std::ceil(hold_pose_time_ * offboard_thread_frequency_); position_error_.set_size(buffer_size); orientation_error_.set_size(buffer_size); ros::Rate rate(offboard_thread_frequency_); while (ros::ok()) { switch(control_mode_){ case eControlMode::LOCAL_VEL: mavros_ref_vel_pub_.publish(ref_vel_); ref_pose_ = cur_pose_; if ( ros::Time::now().toSec() - last_command_time_.toSec() >=0.5 ) { control_mode_ = eControlMode::LOCAL_POSE; } break; case eControlMode::LOCAL_POSE: ref_pose_.header.stamp = ros::Time::now(); mavros_ref_pose_pub_.publish(ref_pose_); ref_vel_.twist.linear.x = 0; ref_vel_.twist.linear.y = 0; ref_vel_.twist.linear.z = 0; ref_vel_.twist.angular.z = 0; break; case eControlMode::GLOBAL_POSE: ref_vel_.twist.linear.x = 0; ref_vel_.twist.linear.y = 0; ref_vel_.twist.linear.z = 0; ref_vel_.twist.angular.z = 0; ref_pose_ = cur_pose_; mavros_msgs::GlobalPositionTarget msg; msg.latitude = ref_pose_global_.latitude; msg.longitude = ref_pose_global_.longitude; msg.altitude = ref_pose_global_.altitude; msg.header.stamp = ros::Time::now(); msg.coordinate_frame = mavros_msgs::GlobalPositionTarget::FRAME_GLOBAL_REL_ALT; msg.type_mask = 4088; //((4095^1)^2)^4; mavros_ref_pose_global_pub_.publish(msg); break; } // Error history update double dx = ref_pose_.pose.position.x - cur_pose_.pose.position.x; double dy = ref_pose_.pose.position.y - cur_pose_.pose.position.y; double dz = ref_pose_.pose.position.z - cur_pose_.pose.position.z; double positionD = dx*dx + dy*dy + dz*dz; // Equals distance^2 double quatInnerProduct = ref_pose_.pose.orientation.x*cur_pose_.pose.orientation.x + \ ref_pose_.pose.orientation.y*cur_pose_.pose.orientation.y + \ ref_pose_.pose.orientation.z*cur_pose_.pose.orientation.z + \ ref_pose_.pose.orientation.w*cur_pose_.pose.orientation.w; double orientationD = 1.0 - quatInnerProduct*quatInnerProduct; // Equals (1-cos(rotation))/2 position_error_.update(positionD); orientation_error_.update(orientationD); // State update this->state_ = guessState(); rate.sleep(); } } Backend::State BackendMavros::guessState() { // Sequentially checks allow state deduction if (!this->isReady()) { return UNINITIALIZED; } if (!this->mavros_state_.armed) { return LANDED_DISARMED; } if (this->mavros_extended_state_.landed_state == mavros_msgs::ExtendedState::LANDED_STATE_ON_GROUND) { return LANDED_ARMED; } // TODO(franreal): Use LANDED_STATE_IN_AIR instead? if (this->calling_takeoff) { return TAKING_OFF; } if (this->calling_land) { return LANDING; } if (this->mavros_state_.mode == "OFFBOARD") { return FLYING_AUTO; } return FLYING_MANUAL; } void BackendMavros::setFlightMode(const std::string& _flight_mode) { mavros_msgs::SetMode flight_mode_service; flight_mode_service.request.base_mode = 0; flight_mode_service.request.custom_mode = _flight_mode; // Set mode: unabortable? while (mavros_state_.mode != _flight_mode && ros::ok()) { if (!flight_mode_client_.call(flight_mode_service)) { ROS_ERROR("Error in set flight mode [%s] service calling!", _flight_mode.c_str()); } std::this_thread::sleep_for(std::chrono::milliseconds(300)); #ifdef MAVROS_VERSION_BELOW_0_20_0 ROS_INFO("Set flight mode [%s] response.success = %s", _flight_mode.c_str(), \ flight_mode_service.response.success ? "true" : "false"); #else ROS_INFO("Set flight mode [%s] response.success = %s", _flight_mode.c_str(), \ flight_mode_service.response.mode_sent ? "true" : "false"); #endif ROS_INFO("Trying to set [%s] mode; mavros_state_.mode = [%s]", _flight_mode.c_str(), mavros_state_.mode.c_str()); } } void BackendMavros::recoverFromManual() { if (!mavros_state_.armed || mavros_extended_state_.landed_state != mavros_msgs::ExtendedState::LANDED_STATE_IN_AIR) { ROS_WARN("Unable to recover from manual mode (not flying!)"); return; } if (mavros_state_.mode != "POSCTL" && mavros_state_.mode != "ALTCTL" && mavros_state_.mode != "STABILIZED") { ROS_WARN("Unable to recover from manual mode (not in manual!)"); return; } // Set mode to OFFBOARD and state to FLYING ref_pose_ = cur_pose_; control_mode_ = eControlMode::LOCAL_POSE; setFlightMode("OFFBOARD"); ROS_INFO("Recovered from manual mode!"); } void BackendMavros::setHome(bool set_z) { double z_offset = set_z ? cur_pose_.pose.position.z : 0.0; local_start_pos_ = -Eigen::Vector3d(cur_pose_.pose.position.x, \ cur_pose_.pose.position.y, z_offset); } void BackendMavros::takeOff(double _height) { if (_height < 0.0) { ROS_ERROR("Takeoff height must be positive!"); return; } calling_takeoff = true; control_mode_ = eControlMode::LOCAL_POSE; // Take off control is performed in position (not velocity) float acc_max = 1.0; // TODO: From param? float vel_max = updateParam("MPC_TKO_SPEED"); float a = sqrt(_height * acc_max); if (a < vel_max) { vel_max = a; } float t1 = vel_max / acc_max; float h1 = 0.5 * acc_max * t1 * t1; float t2 = t1 + (_height - 2.0 * h1) / vel_max; // float h2 = _height - h1; float t3 = t2 + t1; float t = 0.0; float delta_t = 0.1; // [s] ros::Rate rate(1.0 / delta_t); ref_pose_ = cur_pose_; float base_z = cur_pose_.pose.position.z; float delta_z = 0; setFlightMode("OFFBOARD"); while ((t < t3) && ros::ok()) { // Unabortable! if (t < t1) { delta_z = 0.5 * acc_max * t * t; } else if (t < t2) { delta_z = h1 + vel_max * (t - t1); } else { delta_z = _height - 0.5 * acc_max * (t3 - t) * (t3 - t); } if (delta_z > _height) { ROS_WARN("Unexpected delta_z value [%f]", delta_z); } else { ref_pose_.pose.position.z = base_z + delta_z; } rate.sleep(); t += delta_t; } ref_pose_.pose.position.z = base_z + _height; // Now wait (unabortable!) while (!referencePoseReached() && (this->mavros_state_.mode == "OFFBOARD") && ros::ok()) { std::this_thread::sleep_for(std::chrono::milliseconds(100)); } ROS_INFO("[%d]: Flying!", robot_id_); calling_takeoff = false; // Update state right now! this->state_ = guessState(); } void BackendMavros::land() { calling_land = true; control_mode_ = eControlMode::LOCAL_POSE; // Back to control in position (just in case) // Set land mode setFlightMode("AUTO.LAND"); ROS_INFO("Landing..."); ref_pose_ = cur_pose_; ref_pose_.pose.position.z = 0; // Landing is unabortable! while ((this->mavros_state_.mode == "AUTO.LAND") && ros::ok()) { std::this_thread::sleep_for(std::chrono::milliseconds(100)); if (mavros_extended_state_.landed_state == mavros_msgs::ExtendedState::LANDED_STATE_ON_GROUND) { // setArmed(false); // Disabled for safety and symmetry ROS_INFO("Landed!"); break; // Out-of-while condition } } calling_land = false; // Update state right now! this->state_ = guessState(); } void BackendMavros::setVelocity(const Velocity& _vel) { control_mode_ = eControlMode::LOCAL_VEL; // Velocity control! tf2_ros::Buffer tfBuffer; tf2_ros::TransformListener tfListener(tfBuffer); geometry_msgs::Vector3Stamped vel_in, vel_out; vel_in.header = _vel.header; vel_in.vector = _vel.twist.linear; std::string vel_frame_id = tf2::getFrameId(vel_in); if (vel_frame_id == "map" || vel_frame_id == "" || vel_frame_id == uav_home_frame_id_) { // No transform is needed ref_vel_ = _vel; } else { // We need to transform geometry_msgs::TransformStamped transform; bool tf_exists = true; try { transform = tfBuffer.lookupTransform(uav_home_frame_id_, vel_frame_id, ros::Time(0), ros::Duration(0.3)); } catch (tf2::TransformException &ex) { ROS_WARN("%s",ex.what()); tf_exists = false; ref_vel_ = _vel; } if(tf_exists) { tf2::doTransform(vel_in, vel_out, transform); ref_vel_.header = vel_out.header; ref_vel_.twist.linear = vel_out.vector; ref_vel_.twist.angular = _vel.twist.angular; } } last_command_time_ = ros::Time::now(); } bool BackendMavros::isReady() const { if (ros::param::has("~map_origin_geo")) { return mavros_has_geo_pose_; } else { return mavros_has_pose_ && (fabs(this->cur_pose_.pose.position.y) > 1e-8); // Means the filter has converged! } } void BackendMavros::setPose(const geometry_msgs::PoseStamped& _world) { control_mode_ = eControlMode::LOCAL_POSE; // Control in position geometry_msgs::PoseStamped homogen_world_pos; tf2_ros::Buffer tfBuffer; tf2_ros::TransformListener tfListener(tfBuffer); std::string waypoint_frame_id = tf2::getFrameId(_world); if ( waypoint_frame_id == "" || waypoint_frame_id == uav_home_frame_id_ ) { // No transform is needed homogen_world_pos = _world; } else { // We need to transform geometry_msgs::TransformStamped transformToHomeFrame; if ( cached_transforms_.find(waypoint_frame_id) == cached_transforms_.end() ) { // waypoint_frame_id not found in cached_transforms_ transformToHomeFrame = tfBuffer.lookupTransform(uav_home_frame_id_, waypoint_frame_id, ros::Time(0), ros::Duration(1.0)); cached_transforms_[waypoint_frame_id] = transformToHomeFrame; // Save transform in cache } else { // found in cache transformToHomeFrame = cached_transforms_[waypoint_frame_id]; } tf2::doTransform(_world, homogen_world_pos, transformToHomeFrame); } // std::cout << "Going to waypoint: " << homogen_world_pos.pose.position << std::endl; // Do we still need local_start_pos_? homogen_world_pos.pose.position.x -= local_start_pos_[0]; homogen_world_pos.pose.position.y -= local_start_pos_[1]; homogen_world_pos.pose.position.z -= local_start_pos_[2]; ref_pose_.pose = homogen_world_pos.pose; } // TODO: Move from here? struct PurePursuitOutput { geometry_msgs::Point next; float t_lookahead; }; // TODO: Move from here? PurePursuitOutput PurePursuit(geometry_msgs::Point _current, geometry_msgs::Point _initial, geometry_msgs::Point _final, float _lookahead) { PurePursuitOutput out; out.next = _current; out.t_lookahead = 0; if (_lookahead <= 0) { ROS_ERROR("Lookahead must be non-zero positive!"); return out; } Eigen::Vector3f x0 = Eigen::Vector3f(_current.x, _current.y, _current.z); Eigen::Vector3f x1 = Eigen::Vector3f(_initial.x, _initial.y, _initial.z); Eigen::Vector3f x2 = Eigen::Vector3f(_final.x, _final.y, _final.z); Eigen::Vector3f p = x0; Eigen::Vector3f x_21 = x2 - x1; float d_21 = x_21.norm(); float t_min = - x_21.dot(x1-x0) / (d_21*d_21); Eigen::Vector3f closest_point = x1 + t_min*(x2-x1); float distance = (closest_point - x0).norm(); float t_lookahead = t_min; if (_lookahead > distance) { float a = sqrt(_lookahead*_lookahead - distance*distance); t_lookahead = t_min + a/d_21; } if (t_lookahead <= 0.0) { p = x1; t_lookahead = 0.0; // ROS_INFO("p = x1"); } else if (t_lookahead >= 1.0) { p = x2; t_lookahead = 1.0; // ROS_INFO("p = x2"); } else { p = x1 + t_lookahead*(x2-x1); // ROS_INFO("L = %f; norm(x0-p) = %f", _lookahead, (x0-p).norm()); } out.next.x = p(0); out.next.y = p(1); out.next.z = p(2); out.t_lookahead = t_lookahead; return out; } void BackendMavros::goToWaypoint(const Waypoint& _world) { control_mode_ = eControlMode::LOCAL_POSE; // Control in position geometry_msgs::PoseStamped homogen_world_pos; tf2_ros::Buffer tfBuffer; tf2_ros::TransformListener tfListener(tfBuffer); std::string waypoint_frame_id = tf2::getFrameId(_world); if ( waypoint_frame_id == "" || waypoint_frame_id == uav_home_frame_id_ ) { // No transform is needed homogen_world_pos = _world; } else { // We need to transform geometry_msgs::TransformStamped transformToHomeFrame; if ( cached_transforms_.find(waypoint_frame_id) == cached_transforms_.end() ) { // waypoint_frame_id not found in cached_transforms_ transformToHomeFrame = tfBuffer.lookupTransform(uav_home_frame_id_, waypoint_frame_id, ros::Time(0), ros::Duration(1.0)); cached_transforms_[waypoint_frame_id] = transformToHomeFrame; // Save transform in cache } else { // found in cache transformToHomeFrame = cached_transforms_[waypoint_frame_id]; } tf2::doTransform(_world, homogen_world_pos, transformToHomeFrame); } // std::cout << "Going to waypoint: " << homogen_world_pos.pose.position << std::endl; // Do we still need local_start_pos_? homogen_world_pos.pose.position.x -= local_start_pos_[0]; homogen_world_pos.pose.position.y -= local_start_pos_[1]; homogen_world_pos.pose.position.z -= local_start_pos_[2]; // Smooth pose reference passing! geometry_msgs::Point final_position = homogen_world_pos.pose.position; geometry_msgs::Point initial_position = cur_pose_.pose.position; double ab_x = final_position.x - initial_position.x; double ab_y = final_position.y - initial_position.y; double ab_z = final_position.z - initial_position.z; Eigen::Quaterniond final_orientation = Eigen::Quaterniond(homogen_world_pos.pose.orientation.w, homogen_world_pos.pose.orientation.x, homogen_world_pos.pose.orientation.y, homogen_world_pos.pose.orientation.z); Eigen::Quaterniond initial_orientation = Eigen::Quaterniond(cur_pose_.pose.orientation.w, cur_pose_.pose.orientation.x, cur_pose_.pose.orientation.y, cur_pose_.pose.orientation.z); float linear_distance = sqrt(ab_x*ab_x + ab_y*ab_y + ab_z*ab_z); float linear_threshold = sqrt(position_th_); if (linear_distance > linear_threshold) { float mpc_xy_vel_max = updateParam("MPC_XY_VEL_MAX"); float mpc_z_vel_max_up = updateParam("MPC_Z_VEL_MAX_UP"); float mpc_z_vel_max_dn = updateParam("MPC_Z_VEL_MAX_DN"); float mc_yawrate_max = updateParam("MC_YAWRATE_MAX"); float mpc_z_vel_max = (ab_z > 0)? mpc_z_vel_max_up : mpc_z_vel_max_dn; float xy_distance = sqrt(ab_x*ab_x + ab_y*ab_y); float z_distance = fabs(ab_z); bool z_vel_is_limit = (mpc_z_vel_max*xy_distance < mpc_xy_vel_max*z_distance); ros::Rate rate(10); // [Hz] float next_to_final_distance = linear_distance; float lookahead = 0.05; while (next_to_final_distance > linear_threshold && !abort_ && ros::ok()) { float current_xy_vel = sqrt(cur_vel_.twist.linear.x*cur_vel_.twist.linear.x + cur_vel_.twist.linear.y*cur_vel_.twist.linear.y); float current_z_vel = fabs(cur_vel_.twist.linear.z); if (z_vel_is_limit) { if (current_z_vel > 0.8*mpc_z_vel_max) { lookahead -= 0.05; } // TODO: Other thesholds, other update politics? if (current_z_vel < 0.5*mpc_z_vel_max) { lookahead += 0.05; } // TODO: Other thesholds, other update politics? // ROS_INFO("current_z_vel = %f", current_z_vel); } else { if (current_xy_vel > 0.8*mpc_xy_vel_max) { lookahead -= 0.05; } // TODO: Other thesholds, other update politics? if (current_xy_vel < 0.5*mpc_xy_vel_max) { lookahead += 0.05; } // TODO: Other thesholds, other update politics? // ROS_INFO("current_xy_vel = %f", current_xy_vel); } PurePursuitOutput pp = PurePursuit(cur_pose_.pose.position, initial_position, final_position, lookahead); Waypoint wp_i; wp_i.pose.position.x = pp.next.x; wp_i.pose.position.y = pp.next.y; wp_i.pose.position.z = pp.next.z; Eigen::Quaterniond q_i = initial_orientation.slerp(pp.t_lookahead, final_orientation); wp_i.pose.orientation.w = q_i.w(); wp_i.pose.orientation.x = q_i.x(); wp_i.pose.orientation.y = q_i.y(); wp_i.pose.orientation.z = q_i.z(); ref_pose_.pose = wp_i.pose; next_to_final_distance = (1.0 - pp.t_lookahead) * linear_distance; // ROS_INFO("next_to_final_distance = %f", next_to_final_distance); rate.sleep(); } } // ROS_INFO("All points sent!"); // Finally set pose (if not aborted!) if (!abort_) { ref_pose_.pose = homogen_world_pos.pose; } position_error_.reset(); orientation_error_.reset(); // Wait until we arrive: abortable while(!referencePoseReached() && !abort_ && ros::ok()) { std::this_thread::sleep_for(std::chrono::milliseconds(100)); } // Freeze in case it's been aborted if (abort_ && freeze_) { ref_pose_ = cur_pose_; } } void BackendMavros::goToWaypointGeo(const WaypointGeo& _wp) { control_mode_ = eControlMode::GLOBAL_POSE; // Control in position ref_pose_global_.latitude = _wp.latitude; ref_pose_global_.longitude = _wp.longitude; ref_pose_global_.altitude = _wp.altitude; // Wait until we arrive: abortable while(!referencePoseReached() && !abort_ && ros::ok()) { std::this_thread::sleep_for(std::chrono::milliseconds(100)); } // Freeze in case it's been aborted if (abort_ && freeze_) { ref_pose_ = cur_pose_; } } /*void BackendMavros::trackPath(const WaypointList &_path) { // TODO: basic imlementation, ideally different from a stack of gotos }*/ Pose BackendMavros::pose() { Pose out; out.pose.position.x = cur_pose_.pose.position.x + local_start_pos_[0]; out.pose.position.y = cur_pose_.pose.position.y + local_start_pos_[1]; out.pose.position.z = cur_pose_.pose.position.z + local_start_pos_[2]; out.pose.orientation = cur_pose_.pose.orientation; if (pose_frame_id_ == "") { // Default: local pose out.header.frame_id = uav_home_frame_id_; } else { // Publish pose in different frame Pose aux = out; geometry_msgs::TransformStamped transformToPoseFrame; std::string pose_frame_id_map = "inv_" + pose_frame_id_; if ( cached_transforms_.find(pose_frame_id_map) == cached_transforms_.end() ) { // inv_pose_frame_id_ not found in cached_transforms_ tf2_ros::Buffer tfBuffer; tf2_ros::TransformListener tfListener(tfBuffer); transformToPoseFrame = tfBuffer.lookupTransform(pose_frame_id_,uav_home_frame_id_, ros::Time(0), ros::Duration(1.0)); cached_transforms_[pose_frame_id_map] = transformToPoseFrame; // Save transform in cache } else { // found in cache transformToPoseFrame = cached_transforms_[pose_frame_id_map]; } tf2::doTransform(aux, out, transformToPoseFrame); out.header.frame_id = pose_frame_id_; } out.header.stamp = cur_pose_.header.stamp; return out; } Velocity BackendMavros::velocity() const { return cur_vel_; } Odometry BackendMavros::odometry() const { Odometry odom; odom.header.stamp = ros::Time::now(); odom.header.frame_id = uav_home_frame_id_; odom.child_frame_id = uav_frame_id_; odom.pose.pose.position.x = cur_pose_.pose.position.x + local_start_pos_[0]; odom.pose.pose.position.y = cur_pose_.pose.position.y + local_start_pos_[1]; odom.pose.pose.position.z = cur_pose_.pose.position.z + local_start_pos_[2]; odom.pose.pose.orientation = cur_pose_.pose.orientation; odom.twist.twist = cur_vel_body_.twist; return odom; } Transform BackendMavros::transform() const { Transform out; out.header.stamp = ros::Time::now(); out.header.frame_id = uav_home_frame_id_; out.child_frame_id = uav_frame_id_; out.transform.translation.x = cur_pose_.pose.position.x + local_start_pos_[0]; out.transform.translation.y = cur_pose_.pose.position.y + local_start_pos_[1]; out.transform.translation.z = cur_pose_.pose.position.z + local_start_pos_[2]; out.transform.rotation = cur_pose_.pose.orientation; return out; } bool BackendMavros::referencePoseReached() { double position_min, position_mean, position_max; double orientation_min, orientation_mean, orientation_max; if (!position_error_.get_stats(position_min, position_mean, position_max)) { return false; } if (!orientation_error_.get_stats(orientation_min, orientation_mean, orientation_max)) { return false; } double position_diff = position_max - position_min; double orientation_diff = orientation_max - orientation_min; bool position_holds = (position_diff < position_th_) && (fabs(position_mean) < 0.5*position_th_); bool orientation_holds = (orientation_diff < orientation_th_) && (fabs(orientation_mean) < 0.5*orientation_th_); // if (position_holds && orientation_holds) { // DEBUG // ROS_INFO("position: %f < %f) && (%f < %f)", position_diff, position_th_, fabs(position_mean), 0.5*position_th_); // ROS_INFO("orientation: %f < %f) && (%f < %f)", orientation_diff, orientation_th_, fabs(orientation_mean), 0.5*orientation_th_); // ROS_INFO("Arrived!"); // } return position_holds && orientation_holds; } void BackendMavros::initHomeFrame() { local_start_pos_ << 0.0, 0.0, 0.0; // Get frame prefix from namespace std::string ns = ros::this_node::getNamespace(); uav_frame_id_ = ns + "/base_link"; uav_home_frame_id_ = ns + "/odom"; while (uav_frame_id_[0]=='/') { uav_frame_id_.erase(0,1); } while (uav_home_frame_id_[0]=='/') { uav_home_frame_id_.erase(0,1); } std::string parent_frame; ros::param::param<std::string>("~home_pose_parent_frame", parent_frame, "map"); std::vector<double> home_pose(3, 0.0); if (ros::param::has("~home_pose")) { ros::param::get("~home_pose",home_pose); } else if (ros::param::has("~map_origin_geo")) { ROS_WARN("Be careful, you should only use this mode with RTK GPS!"); while (!this->mavros_has_geo_pose_) { std::this_thread::sleep_for(std::chrono::milliseconds(200)); } std::vector<double> map_origin_geo(3, 0.0); ros::param::get("~map_origin_geo",map_origin_geo); geographic_msgs::GeoPoint origin_geo, actual_coordinate_geo; origin_geo.latitude = map_origin_geo[0]; origin_geo.longitude = map_origin_geo[1]; origin_geo.altitude = 0; //map_origin_geo[2]; actual_coordinate_geo.latitude = cur_geo_pose_.latitude; actual_coordinate_geo.longitude = cur_geo_pose_.longitude; actual_coordinate_geo.altitude = 0; //cur_geo_pose_.altitude; if(map_origin_geo[0]==0 && map_origin_geo[1]==0) { ROS_WARN("Map origin is set to 0. Define map_origin_geo param by a vector in format [lat,lon,alt]."); } geometry_msgs::Point32 map_origin_cartesian = geographic_to_cartesian (actual_coordinate_geo, origin_geo); home_pose[0] = map_origin_cartesian.x; home_pose[1] = map_origin_cartesian.y; home_pose[2] = map_origin_cartesian.z; } else { ROS_WARN("No home pose or map origin was defined. Home frame will be equal to map."); } geometry_msgs::TransformStamped static_transformStamped; static_transformStamped.header.stamp = ros::Time::now(); static_transformStamped.header.frame_id = parent_frame; static_transformStamped.child_frame_id = uav_home_frame_id_; static_transformStamped.transform.translation.x = home_pose[0]; static_transformStamped.transform.translation.y = home_pose[1]; static_transformStamped.transform.translation.z = home_pose[2]; if(parent_frame == "map" || parent_frame == "") { static_transformStamped.transform.rotation.x = 0; static_transformStamped.transform.rotation.y = 0; static_transformStamped.transform.rotation.z = 0; static_transformStamped.transform.rotation.w = 1; } else { tf2_ros::Buffer tfBuffer; tf2_ros::TransformListener tfListener(tfBuffer); geometry_msgs::TransformStamped transform_to_map; transform_to_map = tfBuffer.lookupTransform(parent_frame, "map", ros::Time(0), ros::Duration(2.0)); static_transformStamped.transform.rotation = transform_to_map.transform.rotation; } static_tf_broadcaster_ = new tf2_ros::StaticTransformBroadcaster(); static_tf_broadcaster_->sendTransform(static_transformStamped); } double BackendMavros::updateParam(const std::string& _param_id) { mavros_msgs::ParamGet get_param_service; get_param_service.request.param_id = _param_id; if (get_param_client_.call(get_param_service) && get_param_service.response.success) { mavros_params_[_param_id] = get_param_service.response.value.integer? get_param_service.response.value.integer : get_param_service.response.value.real; ROS_DEBUG("Parameter [%s] value is [%f]", get_param_service.request.param_id.c_str(), mavros_params_[_param_id]); } else if (mavros_params_.count(_param_id)) { ROS_WARN("Error in get param [%s] service calling, leaving current value [%f]", get_param_service.request.param_id.c_str(), mavros_params_[_param_id]); } else { mavros_params_[_param_id] = 0.0; ROS_ERROR("Error in get param [%s] service calling, initializing it to zero", get_param_service.request.param_id.c_str()); } return mavros_params_[_param_id]; } }} // namespace grvc::ual
; A022982: 26-n. ; 26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0,-1,-2,-3,-4,-5,-6,-7,-8,-9,-10,-11,-12,-13,-14,-15,-16,-17,-18,-19,-20,-21,-22,-23,-24,-25,-26,-27,-28,-29,-30,-31,-32,-33,-34 mov $1,26 sub $1,$0 mov $0,$1
<% from pwnlib import constants from pwnlib.shellcraft import arm %> <%page args="filename, fd=1"/> <%docstring> Opens a file and writes its contents to the specified file descriptor. Example: >>> f = tempfile.mktemp() >>> write(f, 'FLAG\n') >>> run_assembly(shellcraft.arm.linux.cat(f)).recvline() b'FLAG\n' </%docstring> ${arm.pushstr(filename)} ${arm.linux.open('sp', 0, int(constants.O_RDONLY))} ${arm.linux.sendfile(fd, 'r0', 0, 0x7fffffff)}
; A071235: a(n) = (n^12 + n^6)/2. ; 0,1,2080,266085,8390656,122078125,1088414496,6920702425,34359869440,141215033961,500000500000,1569215074141,4458051717120,11649044974645,28346959952416,64873174640625,140737496743936,291311130683665,578415707719200,1106657483056021,2048000032000000,3677913798576381,6427501372214560,10957312290028105,18260173813579776,29802322509765625,47714478485298976,75047317842209805,116109132785551360,176907391900146181,265720500364500000,393831392338026721,576460752840294400,833944758122226465,1193210342618952736,1689610254947453125,2369190670249199616,3291476004202880845,4532868955752965920,6190778829547584441,8388608002048000000,11281745152558145161,15064734746064356640,19979815401791969725,26327045392016951296,34476261781617703125,44881150841514765856,58095741559863896785,74793671555159162880,95790615697203850801,122070312507812500000,154814672196608851701,195438503253010401280,245629452139445257885,307393813100651655456,383108932719040515625,475583006918127517696,588123146968868057625,724612676023834942240,889598709140856625261,1088391168023328000000,1327174487174553266341,1613133381227350028320,1954594164270675690945,2361183241469182345216,2844004531590565890625,3415837726665040175136,4091359452361657763365,4887389560252904704000,5823164961442614787821,6920643600558824500000,8204841370384455709081,9704204980952328437760,11451024023320796468905,13481885708042495500576,15838176012128173828125,18566631236694100658176,21719944261086003014005,25357430078733118448160,29545755515958620418481,34359738368131072000000,39883221538577469699921,46210028135301952429600,53445003869494032391765,61705153508813716801536,71120878568274634328125,81837323872996040086816,94015841100965649409545,107835577911072703774720,123495201782879560797241,141214768240765720500000,161237743707086325958861,183833193827744298403840,209298148740008831859525,237960157407471623128096,270180043831686027390625,306354878665275060781056,346921180498135486149985,392358361867842937883680,443192435858535380404101 pow $0,6 mov $1,$0 bin $1,2 add $0,$1
; A105349: Characteristic sequence for the Pell numbers. ; 1,1,1,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 pow $0,2 div $0,2 seq $0,5369 ; a(n) = 1 if n is of the form m(m+1), else 0.
; A204623: Number of (n+1)X2 0..2 arrays with every 2X2 subblock having unequal diagonal elements or unequal antidiagonal elements, and new values 0..2 introduced in row major order ; 12,96,768,6144,49152,393216,3145728,25165824,201326592,1610612736,12884901888,103079215104,824633720832,6597069766656,52776558133248,422212465065984,3377699720527872,27021597764222976,216172782113783808,1729382256910270464,13835058055282163712,110680464442257309696,885443715538058477568,7083549724304467820544,56668397794435742564352,453347182355485940514816,3626777458843887524118528,29014219670751100192948224,232113757366008801543585792,1856910058928070412348686336,14855280471424563298789490688,118842243771396506390315925504,950737950171172051122527404032,7605903601369376408980219232256,60847228810955011271841753858048,486777830487640090174734030864384,3894222643901120721397872246915072,31153781151208965771182977975320576,249230249209671726169463823802564608 mov $1,8 pow $1,$0 mul $1,12 mov $0,$1
;------------------------------------------------------------------------------ ; ; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR> ; This program and the accompanying materials ; are licensed and made available under the terms and conditions of the BSD License ; which accompanies this distribution. The full text of the license may be found at ; http://opensource.org/licenses/bsd-license.php. ; ; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, ; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. ; ; Module Name: ; ; ReadDr4.Asm ; ; Abstract: ; ; AsmReadDr4 function ; ; Notes: ; ;------------------------------------------------------------------------------ SECTION .text ;------------------------------------------------------------------------------ ; UINTN ; EFIAPI ; AsmReadDr4 ( ; VOID ; ); ;------------------------------------------------------------------------------ global ASM_PFX(AsmReadDr4) ASM_PFX(AsmReadDr4): ; ; DR4 is alias to DR6 only if DE (in CR4) is cleared. Otherwise, reading ; this register will cause a #UD exception. ; ; MS assembler doesn't support this instruction since no one would use it ; under normal circustances. Here opcode is used. ; DB 0xf, 0x21, 0xe0 ret
#ifndef __WEATHERRETRIEVER_HH #define __WEATHERRETRIEVER_HH #include <iostream> #include <memory> #include <string> #include "../net/curl.hh" #include "../utils/timekeeper.hh" namespace weatherretriever { class Weather final { public: Weather() = default; std::string getTemperature(); private: struct WeatherInformation { std::string temperature; }; net::Http http{ "https://data.geo.admin.ch/ch.meteoschweiz.messwerte-aktuell/" "VQHA80.csv"}; utils::TimeKeeper timeKeeper{900}; WeatherInformation currentInformation{"-"}; bool firstRun{true}; void fetchInformation(); void extractInformationFromData(const net::Data& data); }; } // namespace weatherretriever #endif
#include "ctranslate2/ops/dequantize.h" #include "dispatch.h" namespace ctranslate2 { namespace ops { Dequantize::Dequantize(const ActivationType* activation_type) : _activation_type(activation_type) { } void Dequantize::operator()(const StorageView& input, const StorageView& scale, StorageView& output) const { PROFILE("Dequantize"); output.resize_as(input); switch (input.dtype()) { case DataType::INT16: { if (input.device() != Device::CPU) throw std::invalid_argument("INT16 dequantization is only supported on CPU"); if (!scale.is_scalar()) throw std::invalid_argument("INT16 quantization scale should be a scalar value"); dequantize<Device::CPU, int16_t, float>(input, scale, output); break; } case DataType::INT8: { const dim_t batch_size = input.size() / input.dim(-1); if (scale.size() != batch_size) throw std::invalid_argument("INT8 dequantization expects per-batch scales"); switch (output.dtype()) { case DataType::FLOAT: { DEVICE_DISPATCH(input.device(), (dequantize<D, int8_t, float>(input, scale, output))); break; } #ifdef CT2_WITH_CUDA case DataType::FLOAT16: { if (output.device() != Device::CUDA) throw std::invalid_argument("Dequantize: float16 ouput is only supported on CUDA"); dequantize<Device::CUDA, int8_t, float16_t>(input, scale, output); break; } #endif default: throw std::invalid_argument("Dequantize: output should have a float type"); } break; } default: throw std::invalid_argument("Dequantize: invalid quantized type " + dtype_name(input.dtype()) + ", expected int8 or int16"); } } void Dequantize::operator()(const StorageView& c, const StorageView& a_scale, const StorageView& b_scale, const bool transpose_a, const bool transpose_b, StorageView& y, const StorageView* bias) const { PROFILE("DequantizeGemmOutput"); y.resize_as(c); switch (y.dtype()) { case DataType::FLOAT: { DEVICE_DISPATCH(c.device(), (dequantize_gemm_output<D, float>(c, a_scale, b_scale, transpose_a, transpose_b, bias, y))); break; } #ifdef CT2_WITH_CUDA case DataType::FLOAT16: { if (y.device() != Device::CUDA) throw std::invalid_argument("DequantizeGemmOutput: float16 ouput is only supported on CUDA"); dequantize_gemm_output<Device::CUDA, float16_t>(c, a_scale, b_scale, transpose_a, transpose_b, bias, y); break; } #endif default: throw std::invalid_argument("DequantizeGemmOutput: output should have a float type"); } } } }
*=$0801 .byte $0c, $08, $0a, $00, $9e, $20 .byte $32, $30, $38, $30, $00, $00 .byte $00 *=$0820 sei ; turn off interrupts lda #$7f ldx #$01 sta $dc0d ; Turn off CIA 1 interrupts sta $dd0d ; Turn off CIA 2 interrupts stx $d01a ; Turn on raster interrupts lda #$1b ldx #$08 ldy #$14 sta $d011 ; Clear high bit of $d012, set text mode stx $d016 ; single-colour sty $d018 ; screen at $0400, charset at $2000 lda $d018 ; Changing character set to $3800 - $3800 + $800 (2048 bytes) and #$f0 ora #$08 sta $d018 jsr createchar jsr clearscr jsr incscreen lda #<int ; low part of address of interrupt handler code ldx #>int ; high part of address of interrupt handler code ldy #$80 ; line to trigger interrupt sta $0314 ; store in interrupt vector stx $0315 sty $d012 lda $dc0d ; ACK CIA 1 interrupts lda $dd0d ; ACK CIA 2 interrupts asl $d019 ; ACK VIC interrupts cli ;rts ; Return control to BASIC loop: jmp loop ; infinite loop ;-------------------------------------------------------------- ; Create character set ;-------------------------------------------------------------- charseq ;.byte $01, $01, $01, $01, $03, $03, $03, $03 ;.byte $07, $07, $07, $07, $0f, $0f, $0f, $0f ;.byte $1f, $1f, $1f, $1f, $3f, $3f, $3f, $3f ;.byte $7f, $7f, $7f, $7f, $ff, $ff, $ff, $ff .byte $00, $01, $01, $03, $03, $07, $07, $0f .byte $0f, $1f, $1f, $3f, $3f, $7f, $7f, $ff .byte $ff, $7f, $7f, $ef, $3f, $1f, $1f, $0f .byte $0f, $07, $07, $03, $03, $01, $01, $00 createchar: lda #$15 ldx #$00 ldy #$00 charloop: lda charseq, y sta $2000,x sta $2001,x sta $2002,x sta $2003,x sta $2004,x sta $2005,x sta $2006,x sta $2007,x sta $2100,x sta $2101,x sta $2102,x sta $2103,x sta $2104,x sta $2105,x sta $2106,x sta $2107,x sta $2200,x sta $2201,x sta $2202,x sta $2203,x sta $2204,x sta $2205,x sta $2206,x sta $2207,x sta $2300,x sta $2301,x sta $2302,x sta $2303,x sta $2304,x sta $2305,x sta $2306,x sta $2307,x sta $2400,x sta $2401,x sta $2402,x sta $2403,x sta $2404,x sta $2405,x sta $2406,x sta $2407,x sta $2500,x sta $2501,x sta $2502,x sta $2503,x sta $2504,x sta $2505,x sta $2506,x sta $2507,x sta $2600,x sta $2601,x sta $2602,x sta $2603,x sta $2604,x sta $2605,x sta $2606,x sta $2607,x sta $2700,x sta $2701,x sta $2702,x sta $2703,x sta $2704,x sta $2705,x sta $2706,x sta $2707,x iny inx inx inx inx inx inx inx inx beq endloop jmp charloop endloop rts ;-------------------------------------------------------------- ; Clear screen ;-------------------------------------------------------------- clearscr: lda #$00 ldx #$fa clear1: sta $03ff,x sta $04f9,x sta $05f3,x sta $06ed,x dex bne clear1 rts ;-------------------------------------------------------------- ; Inrement every character on the screen ;-------------------------------------------------------------- incscreen: ldx #$fa incscr1: inc $03ff,x dex bne incscr1 ldx #$fa incscr2: inc $04f9,x dex bne incscr2 ldx #$fa incscr3: inc $05f3,x dex bne incscr3 ldx #$fa incscr4: inc $06ed,x dex bne incscr4 rts ;-------------------------------------------------------------- ; Interupt routine ;-------------------------------------------------------------- int: inc $d020 ; increment screen colour jsr incscreen dec $d020 ; decrement screen colour asl $d019 ; ACK interrupt (to re-enable it) ;jmp $ea31 ; Return control to basic pla ; prepare to return from interupt tay pla tax pla rti ; return from interrupt
;------------------------------------------------------------------------------ ; ; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR> ; This program and the accompanying materials ; are licensed and made available under the terms and conditions of the BSD License ; which accompanies this distribution. The full text of the license may be found at ; http://opensource.org/licenses/bsd-license.php ; ; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, ; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. ; ; Module Name: ; ; ReadIdtr.Asm ; ; Abstract: ; ; AsmReadIdtr function ; ; Notes: ; ;------------------------------------------------------------------------------ .386 .model flat,C .code ;------------------------------------------------------------------------------ ; VOID ; EFIAPI ; InternalX86ReadIdtr ( ; OUT IA32_DESCRIPTOR *Idtr ; ); ;------------------------------------------------------------------------------ InternalX86ReadIdtr PROC mov eax, [esp + 4] sidt fword ptr [eax] ret InternalX86ReadIdtr ENDP END
.global s_prepare_buffers s_prepare_buffers: push %r12 push %r14 push %r9 push %rax push %rbp push %rcx push %rdi push %rsi lea addresses_WC_ht+0x4cd1, %rsi lea addresses_UC_ht+0x90d1, %rdi nop nop nop nop dec %rbp mov $126, %rcx rep movsb nop nop nop nop xor $51869, %r14 lea addresses_WC_ht+0x1d449, %rsi lea addresses_D_ht+0x1b9d1, %rdi inc %rbp mov $114, %rcx rep movsl nop nop nop nop cmp %rsi, %rsi lea addresses_UC_ht+0x58d1, %rsi lea addresses_WC_ht+0x88d1, %rdi clflush (%rdi) nop nop nop nop nop sub $38400, %r12 mov $30, %rcx rep movsw nop nop nop nop nop dec %r14 lea addresses_WT_ht+0x6b41, %rsi lea addresses_WT_ht+0x17971, %rdi nop nop nop nop sub %rax, %rax mov $20, %rcx rep movsl nop nop nop cmp %rbp, %rbp lea addresses_UC_ht+0x38d1, %rsi lea addresses_D_ht+0xcd1, %rdi add $46618, %r9 mov $55, %rcx rep movsq nop nop nop cmp %rcx, %rcx lea addresses_UC_ht+0x1aa51, %rcx nop nop add $58288, %rax vmovups (%rcx), %ymm5 vextracti128 $1, %ymm5, %xmm5 vpextrq $1, %xmm5, %rdi nop nop nop nop sub $17865, %rcx lea addresses_A_ht+0x14851, %rsi lea addresses_WT_ht+0x19b21, %rdi dec %rax mov $8, %rcx rep movsw nop nop nop nop add %r14, %r14 lea addresses_normal_ht+0x1d9d1, %rdi nop xor %r12, %r12 mov (%rdi), %bp nop nop nop nop xor %rbp, %rbp lea addresses_normal_ht+0x1d4d1, %rsi clflush (%rsi) nop nop dec %r14 mov (%rsi), %eax nop nop add %r14, %r14 lea addresses_WC_ht+0x4631, %rax cmp $1703, %r14 mov (%rax), %rdi cmp $45493, %rdi lea addresses_normal_ht+0xccd1, %rsi lea addresses_WT_ht+0xd621, %rdi nop nop nop sub %r14, %r14 mov $109, %rcx rep movsw nop nop nop nop add $4047, %rax lea addresses_UC_ht+0x19cd1, %rax nop nop nop nop nop mfence mov $0x6162636465666768, %rcx movq %rcx, (%rax) nop nop nop and %r9, %r9 lea addresses_WT_ht+0x19ed1, %rcx nop nop nop nop nop and $24668, %rsi mov (%rcx), %r12d nop nop xor $35347, %rdi lea addresses_A_ht+0x1c4d1, %r14 nop nop nop nop nop xor $23988, %rax movl $0x61626364, (%r14) dec %r14 lea addresses_D_ht+0x15d1, %rcx nop nop nop and $14995, %r14 mov $0x6162636465666768, %rbp movq %rbp, %xmm3 vmovups %ymm3, (%rcx) nop nop nop nop nop sub $8360, %r14 pop %rsi pop %rdi pop %rcx pop %rbp pop %rax pop %r9 pop %r14 pop %r12 ret .global s_faulty_load s_faulty_load: push %r10 push %r11 push %r15 push %rbx push %rcx push %rdi push %rdx push %rsi // Load lea addresses_normal+0x14b51, %rcx nop nop nop add %r10, %r10 mov (%rcx), %dx nop nop add $27342, %r11 // REPMOV lea addresses_D+0x14e72, %rsi lea addresses_WT+0x14081, %rdi nop nop nop nop nop add %r11, %r11 mov $34, %rcx rep movsl nop nop nop nop add $25364, %r15 // Faulty Load lea addresses_A+0xb4d1, %r10 nop nop nop and $20827, %rbx movups (%r10), %xmm5 vpextrq $0, %xmm5, %rcx lea oracles, %rdi and $0xff, %rcx shlq $12, %rcx mov (%rdi,%rcx,1), %rcx pop %rsi pop %rdx pop %rdi pop %rcx pop %rbx pop %r15 pop %r11 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_A', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 0}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_normal', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 6}} {'OP': 'REPM', 'src': {'same': False, 'congruent': 0, 'type': 'addresses_D'}, 'dst': {'same': False, 'congruent': 4, 'type': 'addresses_WT'}} [Faulty Load] {'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_A', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 0}} <gen_prepare_buffer> {'OP': 'REPM', 'src': {'same': False, 'congruent': 10, 'type': 'addresses_WC_ht'}, 'dst': {'same': False, 'congruent': 10, 'type': 'addresses_UC_ht'}} {'OP': 'REPM', 'src': {'same': False, 'congruent': 3, 'type': 'addresses_WC_ht'}, 'dst': {'same': False, 'congruent': 8, 'type': 'addresses_D_ht'}} {'OP': 'REPM', 'src': {'same': False, 'congruent': 10, 'type': 'addresses_UC_ht'}, 'dst': {'same': False, 'congruent': 10, 'type': 'addresses_WC_ht'}} {'OP': 'REPM', 'src': {'same': False, 'congruent': 2, 'type': 'addresses_WT_ht'}, 'dst': {'same': False, 'congruent': 5, 'type': 'addresses_WT_ht'}} {'OP': 'REPM', 'src': {'same': False, 'congruent': 10, 'type': 'addresses_UC_ht'}, 'dst': {'same': False, 'congruent': 6, 'type': 'addresses_D_ht'}} {'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_UC_ht', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 7}} {'OP': 'REPM', 'src': {'same': False, 'congruent': 5, 'type': 'addresses_A_ht'}, 'dst': {'same': False, 'congruent': 2, 'type': 'addresses_WT_ht'}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_normal_ht', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 8}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_normal_ht', 'NT': False, 'AVXalign': True, 'size': 4, 'congruent': 11}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WC_ht', 'NT': True, 'AVXalign': False, 'size': 8, 'congruent': 3}} {'OP': 'REPM', 'src': {'same': False, 'congruent': 8, 'type': 'addresses_normal_ht'}, 'dst': {'same': False, 'congruent': 4, 'type': 'addresses_WT_ht'}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_UC_ht', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 11}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WT_ht', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 9}} {'OP': 'STOR', 'dst': {'same': True, 'type': 'addresses_A_ht', 'NT': False, 'AVXalign': True, 'size': 4, 'congruent': 11}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_D_ht', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 7}} {'35': 21829} 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 */
; A004054: Expansion of (1-x)/((1+x)*(1-2*x)*(1-3*x)). ; 1,3,11,35,111,343,1051,3195,9671,29183,87891,264355,794431,2386023,7163531,21501515,64526391,193622863,580955971,1743042675,5229477551,15689131703,47068793211,141209175835,423633119911,1270910544543,3812754003251,11438306748995,34315009725471,102945208133383,308835982314091,926508662770155,2779527419966231,8338585123210223 mov $8,$0 mov $10,2 lpb $10,1 clr $0,8 mov $0,$8 sub $10,1 add $0,$10 sub $0,1 mov $5,$0 mov $7,$0 add $7,1 lpb $7,1 mov $0,$5 sub $7,1 sub $0,$7 add $0,2 mov $1,3 pow $1,$0 mov $2,3 mov $3,2 mov $4,0 add $4,$0 pow $3,$4 sub $3,$1 sub $2,$3 mov $1,$2 div $1,6 add $6,$1 lpe mov $1,$6 mov $11,$10 lpb $11,1 mov $9,$1 sub $11,1 lpe lpe lpb $8,1 mov $8,0 sub $9,$1 lpe mov $1,$9
; A110667: Sequence is {a(2,n)}, where a(m,n) is defined at sequence A110665. ; 0,1,2,0,-6,-12,-12,-5,2,0,-12,-24,-24,-11,2,0,-18,-36,-36,-17,2,0,-24,-48,-48,-23,2,0,-30,-60,-60,-29,2,0,-36,-72,-72,-35,2,0,-42,-84,-84,-41,2,0,-48,-96,-96,-47,2,0,-54,-108,-108,-53,2,0,-60,-120,-120,-59,2,0,-66,-132,-132,-65,2,0,-72,-144,-144,-71,2,0,-78,-156,-156,-77,2,0,-84,-168,-168,-83,2,0,-90,-180,-180,-89,2,0,-96,-192,-192,-95,2,0 lpb $0 mov $2,$0 sub $0,1 seq $2,110666 ; Sequence is {a(1,n)}, where a(m,n) is defined at sequence A110665. add $1,$2 lpe mov $0,$1
; A094734: Number of connected 2-element multiantichains on a labeled n-set. ; 0,1,1,4,19,76,271,904,2899,9076,27991,85504,259579,784876,2366911,7125304,21425059,64373476,193317031,580344304,1741819339,5227030876,15684238351,47059006504,141189602419,423593973076,1270832250871,3812597415904,11437993574299,34314383376076,102943955434591,308833476916504,926503651974979,2779517398375876,8338565080029511,25015721009892304,75047214569284459,225141746787068476,675425446519635631,2026276751875767304,6078831080261022739,18236494890050509876,54709487968686412951,164128470503129005504,492385424703526549819,1477156300498858716076,4431468954273134281471,13294406968372519110904,39883221116223789865699,119649663770883834663076,358948992157076434121191,1076846978160079162627504,3230540937857937208410379,9691622820329211066286876,29074868474498432080972111,87224605450516894007139304,261673816405593877549863859,785021449324868023706483476,2355064348190776853233234231,7065193045004676123927270304,21195579135878719500236946139,63586737409365540757621108876,190760212231555386786683867551,572280636701583689387692684504,1716841910118586126218360217219,5150525730383428494765644979076,15451577191205625716518063592071,46354731573727557613996448085904,139064194721404033770873858877099,417192584164654823170390605870076,1251577752494849913226709876087791,3754733257486320627111205745218504,11264199772462503656195769469565779,33792599317394594518311612876517876,101377797952197950654383447565194711,304133393856622186162047560566866304,912400181569923226883937117443163259 lpb $0 mov $2,$0 mul $0,0 seq $2,94033 ; Number of connected 2-element antichains on a labeled n-set. add $1,$2 add $1,1 lpe mov $0,$1
#include "guibot.hpp" namespace Bots { GUIPlayer::GUIPlayer(Graphics::RenderBoard& _board) : BasicBot(), m_board(_board) {} Game::Turn GUIPlayer::Step(const Game::Board& _state) { return Game::Turn(m_board.GetInput(_state, m_symbol), m_symbol); } void GUIPlayer::FinalizeGame(const Game::Board& _state) { m_board.ShowEndState(_state, m_symbol); } }
; --------------------------------------------------------------------------- ; Sprite mappings - giant ring ; --------------------------------------------------------------------------- dc.w byte_9FDA-Map_obj4B, byte_A00D-Map_obj4B dc.w byte_A036-Map_obj4B, byte_A04B-Map_obj4B byte_9FDA: dc.b $A dc.b $E0, 8, 0, 0, $E8 dc.b $E0, 8, 0, 3, 0 dc.b $E8, $C, 0, 6, $E0 dc.b $E8, $C, 0, $A, 0 dc.b $F0, 7, 0, $E, $E0 dc.b $F0, 7, 0, $16, $10 dc.b $10, $C, 0, $1E, $E0 dc.b $10, $C, 0, $22, 0 dc.b $18, 8, 0, $26, $E8 dc.b $18, 8, 0, $29, 0 byte_A00D: dc.b 8 dc.b $E0, $C, 0, $2C, $F0 dc.b $E8, 8, 0, $30, $E8 dc.b $E8, 9, 0, $33, 0 dc.b $F0, 7, 0, $39, $E8 dc.b $F8, 5, 0, $41, 8 dc.b 8, 9, 0, $45, 0 dc.b $10, 8, 0, $4B, $E8 dc.b $18, $C, 0, $4E, $F0 byte_A036: dc.b 4 dc.b $E0, 7, 0, $52, $F4 dc.b $E0, 3, 8, $52, 4 dc.b 0, 7, 0, $5A, $F4 dc.b 0, 3, 8, $5A, 4 byte_A04B: dc.b 8 dc.b $E0, $C, 8, $2C, $F0 dc.b $E8, 8, 8, $30, 0 dc.b $E8, 9, 8, $33, $E8 dc.b $F0, 7, 8, $39, 8 dc.b $F8, 5, 8, $41, $E8 dc.b 8, 9, 8, $45, $E8 dc.b $10, 8, 8, $4B, 0 dc.b $18, $C, 8, $4E, $F0 even
;Testname=test; Arguments=-fbin -ovmread.bin; Files=stdout stderr vmread.bin bits 32 vmread dword [0], eax vmwrite eax, dword [0] vmread [0], eax vmwrite eax, [0] bits 64 vmread qword [0], rax vmwrite rax, qword [0] vmread [0], rax vmwrite rax, [0] %ifdef ERROR bits 32 vmread qword [0], eax vmwrite eax, qword [0] bits 64 vmread dword [0], eax vmwrite eax, dword [0] vmread qword [0], eax vmwrite eax, qword [0] %endif
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Hookshot ; General-purpose library for injecting DLLs and hooking function calls. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Authored by Samuel Grossman ; Copyright (c) 2019-2021 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; INCLUDE TestDefinitions.inc ; When run in 64-bit mode, this test exercises RIP-relative addressing for loading an absolute jump target from memory. ; Hook function does nothing special for this test. _TEXT SEGMENT BEGIN_HOOKSHOT_TEST_FUNCTION JumpAbsolutePositionRelative_Original jmp SIZE_T PTR [$jumpTargetAbsolute] ud2 ud2 $return: mov sax, scx ret REPEAT 25 BYTE 255 ENDM $jumpTargetAbsolute: SIZE_T $return REPEAT 35 BYTE 255 ENDM END_HOOKSHOT_TEST_FUNCTION JumpAbsolutePositionRelative_Original BEGIN_HOOKSHOT_TEST_FUNCTION JumpAbsolutePositionRelative_Hook mov sax, scx shl sax, 1 ret END_HOOKSHOT_TEST_FUNCTION JumpAbsolutePositionRelative_Hook _TEXT ENDS END
.global s_prepare_buffers s_prepare_buffers: ret .global s_faulty_load s_faulty_load: push %r14 push %r15 push %rbp push %rcx push %rdi push %rdx push %rsi // Store lea addresses_RW+0x191b9, %rsi clflush (%rsi) nop add $24244, %rdx mov $0x5152535455565758, %r14 movq %r14, (%rsi) // Exception!!! nop nop nop nop mov (0), %rsi nop sub %rdi, %rdi // Store lea addresses_US+0x1e2b9, %rbp nop nop and $40187, %rcx mov $0x5152535455565758, %rsi movq %rsi, (%rbp) nop nop nop nop nop cmp %rbp, %rbp // Store lea addresses_WT+0x161ab, %rdi nop cmp %rsi, %rsi mov $0x5152535455565758, %r14 movq %r14, (%rdi) nop nop add %rbp, %rbp // Store lea addresses_PSE+0xb469, %rbp nop inc %r14 mov $0x5152535455565758, %rdi movq %rdi, (%rbp) nop nop nop nop nop xor $27880, %r14 // Faulty Load lea addresses_US+0x17cb9, %rcx and %rdx, %rdx mov (%rcx), %r15w lea oracles, %rsi and $0xff, %r15 shlq $12, %r15 mov (%rsi,%r15,1), %r15 pop %rsi pop %rdx pop %rdi pop %rcx pop %rbp pop %r15 pop %r14 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_US', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_RW', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 8, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_US', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 9, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WT', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 1, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_PSE', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 4, 'same': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_US', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}} <gen_prepare_buffer> {'00': 1} 00 */
stx $ff ldz $ff
; A214946: Number of squarefree words of length 7 in an (n+1)-ary alphabet. ; Submitted by Jon Maiga ; 0,60,1848,15960,80040,292740,868560,2218608,5062320,10575180,20577480,37769160,66015768,110690580,179077920,280842720,428571360,638388828,930657240,1330760760,1869981960,2586474660,3526338288,4744798800,6307501200,8291918700,10788883560,13904244648,17760656760,22499506740,28282981440,35296282560,43749993408,53882602620,65963189880,80294278680,97214861160,117103600068,140382212880,167519043120,199032823920,235496638860,277542085128,325863644040,381223263960,444455160660,516470840160,598264349088 mov $2,$0 mov $3,$0 add $3,2 mul $2,$3 mov $4,$2 mul $2,$3 lpb $0 mov $0,0 add $2,1 mul $2,$4 sub $4,1 mul $4,$2 lpe mov $0,$4
; A169280: Number of reduced words of length n in Coxeter group on 27 generators S_i with relations (S_i)^2 = (S_i S_j)^29 = I. ; 1,27,702,18252,474552,12338352,320797152,8340725952,216858874752,5638330743552,146596599332352,3811511582641152,99099301148669952,2576581829865418752,66991127576500887552,1741769316989023076352 add $0,1 mov $3,1 lpb $0 sub $0,1 add $2,$3 div $3,$2 mul $2,26 lpe mov $0,$2 div $0,26
; QXL_MAIN.ASM The main loop ; 2006.10.01 1.01 update led qxl_main: ASSUME ds:DGROUP ASSUME es:DGROUP qxm_loop: call qxl_rtc_check ; time changed? test phd_rlen,0ffffh ; read physical request? jns qxm_no_rphys ; S set for action call qxl_do_rphys qxm_no_rphys: test phd_wlen,0ffffh ; write physical request? jns qxm_no_wphys ; S set for action call qxl_do_wphys qxm_no_wphys: test lpt_txdata,0ffh ; data for printers? jz qxm_no_lpt call qxl_do_lptp ; yes, send if possible qxm_no_lpt: test com_txdata,0ffh ; data for com ports? jz qxm_no_com call qxl_do_comp ; yes, send if possible qxm_no_com: test vmod_set,0ffffh ; set video mode? js qxm_no_vmod call qxl_do_vmod ; yes, do it qxm_no_vmod: call qxl_do_led ; update led if needed qxm_no_op: test kbd_stop,0ffh jz qxm_loop call qld_from_bios retn
; Logo Design, Google Cardboard Design in 8-bit 80x80 Terminal. — GL_CB.asm ; Copyright (c) 2021 Janrey Licas ; This code is licensed under MIT license. (see LICENSE for details) .MODEL TINY .CODE MOV AX, 03H ; Pre-initialization. INT 10H ; Initiate Clear Screen MOV AH, 02H ; Move Screen in Initial Configuration. MOV DL, 19H ; Column. MOV DH, 05H ; Row. INT 10H ; Whole Rendering Code. JMP TOP_HEADER_BODY_CARDBOARD JMP WHOLE_BODY_CARDBOARD ; Once we done rendering the box, go to whole body render. MOV AX, 4C00H ; Syscall to Termination. INT 21H TOP_HEADER_BODY_CARDBOARD: JMP __EDGE_CURVED_SIDES_HEADER_CARDBOARD JMP __RENDER_BODY_HEADER_CARDBOARD __EDGE_CURVED_SIDES_HEADER_CARDBOARD: MOV AH, 09H MOV BL, 66H MOV CX, 1DH INT 10H MOV AH, 02H DEC DL DEC DL DEC DL INC DH INT 10H MOV AH, 09H MOV CX, 23H INT 10H __RENDER_BODY_HEADER_CARDBOARD: MOV AH, 02H INC DH INT 10H ; Increment by one to Render the Body. MOV AH, 09H MOV BL, 66H ; Use Brown Color. MOV CX, 23H ; To be reduced later. INT 10H ; Don't do another Curved Sides, let the Whole (Second) Body Renderer do it. CMP DH, 10H JL __RENDER_BODY_HEADER_CARDBOARD WHOLE_BODY_CARDBOARD: JMP __EDGE_CURVED_TOP_SECOND_BODY_CARDBOARD JMP __WHOLE_BODY_ITER_RENDER ; Whole Body JMP __EDGE_CURVED_BOTTOM_SECOND_BODY_CARDBOARD JMP WHOLE_EYE_LEFT_CARDBOARD JMP WHOLE_EYE_RGHT_CARDBOARD JMP TRIANGULAR_BOTTOM_ON_CARDBOARD __EDGE_CURVED_TOP_SECOND_BODY_CARDBOARD: MOV AH, 02H MOV DH, 08H MOV DL, 14H INT 10H ; Adjust Offset of Box Rendereing. MOV AH, 09H MOV BL, 77H ; Use Cyan instead. MOV CX, 27H INT 10H ; Render First Curved. MOV AH, 02H DEC DL DEC DL DEC DL INC DH INT 10H MOV AH, 09H MOV CX, 2DH INT 10H __WHOLE_BODY_ITER_RENDER: MOV AH, 02H INC DH INT 10H MOV AH, 09H MOV CX, 2DH INT 10H CMP DH, 11H JL __WHOLE_BODY_ITER_RENDER __EDGE_CURVED_BOTTOM_SECOND_BODY_CARDBOARD: MOV AH, 02H INC DH INC DL INC DL INT 10H ; Adjust Offset of Box Rendereing. MOV AH, 09H MOV BL, 77H ; Use Cyan Color. MOV CX, 29H INT 10H ; Render First Curved. WHOLE_EYE_LEFT_CARDBOARD: ; Have to do this manually. MOV AH, 02H ; 1st Line MOV DH, 0BH MOV DL, 17H INT 10H MOV AH, 09H MOV BL, 66H MOV CX, 09H INT 10H MOV AH, 02H ; 2nd Line INC DH INT 10H MOV AH, 09H MOV CX, 09H INT 10H MOV AH, 02H ; 3nd Line INC DH INT 10H MOV AH, 09H MOV CX, 09H INT 10H MOV AH, 02H ; 4th Line INC DH INT 10H MOV AH, 09H MOV CX, 09H INT 10H WHOLE_EYE_RGHT_CARDBOARD: MOV AH, 02H ; 1st Line MOV DH, 0BH MOV DL, 30H INT 10H MOV AH, 09H MOV CX, 09H INT 10H MOV AH, 02H ; 2nd Line INC DH INT 10H MOV AH, 09H MOV CX, 09H INT 10H MOV AH, 02H ; 3nd Line INC DH INT 10H MOV AH, 09H MOV CX, 09H INT 10H MOV AH, 02H ; 4th Line INC DH INT 10H MOV AH, 09H MOV CX, 09H INT 10H TRIANGULAR_BOTTOM_ON_CARDBOARD: MOV AH, 02H MOV DL, 27H MOV DH, 0EH ; Position in the quite BELOW center of the Whole Body Rectangle. INT 10H MOV CX, 03H ; Explicitly Declare this as Constant Temporarily. JMP __TRIANGULAR_ITER_RENDER_BROWN_ON_BODY_CARDBOARD RET ; End of Whole Rendering, Go back to Parent Label. __TRIANGULAR_ITER_RENDER_BROWN_ON_BODY_CARDBOARD: MOV AH, 09H MOV BL, 66H INT 10H INC CX INC CX MOV AH, 02H DEC DL INC DH ; Position in the quite BELOW center of the Whole Body Rectangle. INT 10H CMP DH, 011H JL __TRIANGULAR_ITER_RENDER_BROWN_ON_BODY_CARDBOARD JMP __TRIANGULAR_ITER_RENDER_BLACK_ON_BODY_CARDBOARD __TRIANGULAR_ITER_RENDER_BLACK_ON_BODY_CARDBOARD: ; Then Render last two triangle with black. MOV AH, 09H MOV BL, 00H INT 10H INC CX INC CX MOV AH, 02H DEC DL INC DH ; Position in the quite BELOW center of the Whole Body Rectangle. INT 10H CMP DH, 013H JL __TRIANGULAR_ITER_RENDER_BLACK_ON_BODY_CARDBOARD END
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r12 push %r13 push %rax push %rbx push %rcx push %rdi push %rsi lea addresses_A_ht+0x16824, %r13 nop nop nop nop nop add $24253, %rdi mov (%r13), %ecx nop nop and %rax, %rax lea addresses_D_ht+0xf44c, %rbx nop nop nop nop sub %r12, %r12 mov (%rbx), %r10w nop nop nop xor %r13, %r13 lea addresses_UC_ht+0x117e8, %rsi lea addresses_UC_ht+0x444c, %rdi nop nop nop nop add %r10, %r10 mov $103, %rcx rep movsl nop add $33705, %r10 lea addresses_D_ht+0x19f8c, %r13 nop nop nop nop nop and $45906, %rsi movl $0x61626364, (%r13) nop nop nop add %rsi, %rsi pop %rsi pop %rdi pop %rcx pop %rbx pop %rax pop %r13 pop %r12 pop %r10 ret .global s_faulty_load s_faulty_load: push %r12 push %r9 push %rcx push %rdi push %rsi // Faulty Load lea addresses_WC+0x6c4c, %rcx nop nop nop nop add $48391, %r12 mov (%rcx), %edi lea oracles, %r9 and $0xff, %rdi shlq $12, %rdi mov (%r9,%rdi,1), %rdi pop %rsi pop %rdi pop %rcx pop %r9 pop %r12 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'size': 4, 'NT': False, 'type': 'addresses_WC', 'same': False, 'AVXalign': False, 'congruent': 0}} [Faulty Load] {'OP': 'LOAD', 'src': {'size': 4, 'NT': False, 'type': 'addresses_WC', 'same': True, 'AVXalign': False, 'congruent': 0}} <gen_prepare_buffer> {'OP': 'LOAD', 'src': {'size': 4, 'NT': False, 'type': 'addresses_A_ht', 'same': False, 'AVXalign': False, 'congruent': 3}} {'OP': 'LOAD', 'src': {'size': 2, 'NT': False, 'type': 'addresses_D_ht', 'same': False, 'AVXalign': False, 'congruent': 11}} {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_UC_ht', 'congruent': 2}, 'dst': {'same': False, 'type': 'addresses_UC_ht', 'congruent': 11}} {'OP': 'STOR', 'dst': {'size': 4, 'NT': False, 'type': 'addresses_D_ht', 'same': False, 'AVXalign': False, 'congruent': 4}} {'00': 21829} 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 */
.global s_prepare_buffers s_prepare_buffers: push %r11 push %r12 push %r9 push %rcx push %rdi push %rsi lea addresses_WT_ht+0x14380, %rsi lea addresses_WT_ht+0x626, %rdi add %r9, %r9 mov $98, %rcx rep movsl nop nop nop nop nop and $29012, %r12 lea addresses_D_ht+0xd9c0, %r11 nop nop xor %r9, %r9 movl $0x61626364, (%r11) nop nop nop dec %rcx lea addresses_UC_ht+0x19f50, %rsi nop nop nop nop and $57739, %r11 mov $0x6162636465666768, %rdi movq %rdi, (%rsi) nop nop add %rcx, %rcx pop %rsi pop %rdi pop %rcx pop %r9 pop %r12 pop %r11 ret .global s_faulty_load s_faulty_load: push %r12 push %r13 push %r9 push %rcx push %rdi push %rsi // Store lea addresses_normal+0x19dc0, %r12 nop sub %r9, %r9 movw $0x5152, (%r12) nop nop nop and $6082, %r13 // Faulty Load lea addresses_UC+0x18dc0, %r13 mfence mov (%r13), %esi lea oracles, %r9 and $0xff, %rsi shlq $12, %rsi mov (%r9,%rsi,1), %rsi pop %rsi pop %rdi pop %rcx pop %r9 pop %r13 pop %r12 ret /* <gen_faulty_load> [REF] {'src': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_UC', 'size': 16, 'AVXalign': False}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 11, 'NT': False, 'type': 'addresses_normal', 'size': 2, 'AVXalign': True}} [Faulty Load] {'src': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_UC', 'size': 4, 'AVXalign': False}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'type': 'addresses_WT_ht', 'congruent': 0, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WT_ht', 'congruent': 1, 'same': False}} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 6, 'NT': False, 'type': 'addresses_D_ht', 'size': 4, 'AVXalign': False}} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 3, 'NT': True, 'type': 'addresses_UC_ht', 'size': 8, 'AVXalign': False}} {'37': 21829} 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 */
.global s_prepare_buffers s_prepare_buffers: push %r11 push %r14 push %r9 push %rbp push %rcx push %rdi push %rsi lea addresses_A_ht+0x1cc30, %rsi lea addresses_normal_ht+0x1a630, %rdi nop nop nop nop inc %rbp mov $101, %rcx rep movsq nop nop nop cmp %r14, %r14 lea addresses_A_ht+0x15fb0, %rsi lea addresses_WT_ht+0xe730, %rdi nop nop nop add %r9, %r9 mov $4, %rcx rep movsb nop nop xor $24289, %r14 lea addresses_normal_ht+0x6dec, %r9 nop nop nop xor %r11, %r11 mov $0x6162636465666768, %rcx movq %rcx, %xmm4 vmovups %ymm4, (%r9) inc %r14 pop %rsi pop %rdi pop %rcx pop %rbp pop %r9 pop %r14 pop %r11 ret .global s_faulty_load s_faulty_load: push %r10 push %r15 push %r9 push %rbp push %rbx push %rcx push %rdx // Store lea addresses_PSE+0x4330, %r10 nop nop nop nop nop cmp $26004, %rcx mov $0x5152535455565758, %rbx movq %rbx, %xmm0 movups %xmm0, (%r10) nop nop nop nop nop inc %rcx // Faulty Load lea addresses_PSE+0x4330, %r9 nop nop nop nop sub %rdx, %rdx movups (%r9), %xmm0 vpextrq $1, %xmm0, %r10 lea oracles, %r15 and $0xff, %r10 shlq $12, %r10 mov (%r15,%r10,1), %r10 pop %rdx pop %rcx pop %rbx pop %rbp pop %r9 pop %r15 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_PSE', 'same': False, 'size': 16, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_PSE', 'same': True, 'size': 16, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} [Faulty Load] {'src': {'type': 'addresses_PSE', 'same': True, 'size': 16, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'type': 'addresses_A_ht', 'congruent': 6, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 7, 'same': False}, 'OP': 'REPM'} {'src': {'type': 'addresses_A_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 10, 'same': False}, 'OP': 'REPM'} {'dst': {'type': 'addresses_normal_ht', 'same': False, 'size': 32, 'congruent': 1, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'00': 21829} 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 */
// Copyright 2021 gRPC authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #include <grpc/impl/codegen/port_platform.h> #include <grpc/grpc.h> #include <memory> #include <string> #include <utility> #include "absl/memory/memory.h" #include "src/core/ext/transport/binder/server/binder_server.h" #include "src/core/ext/transport/binder/transport/binder_transport.h" #include "src/core/ext/transport/binder/wire_format/binder_android.h" #include "src/core/lib/iomgr/exec_ctx.h" #include "src/core/lib/surface/server.h" #include "src/core/lib/transport/error_utils.h" namespace grpc { namespace experimental { namespace binder { void* GetEndpointBinder(const std::string& service) { return grpc_get_endpoint_binder(service); } void AddEndpointBinder(const std::string& service, void* endpoint_binder) { grpc_add_endpoint_binder(service, endpoint_binder); } void RemoveEndpointBinder(const std::string& service) { grpc_remove_endpoint_binder(service); } } // namespace binder } // namespace experimental } // namespace grpc grpc_core::Mutex* g_endpoint_binder_pool_mu = nullptr; absl::flat_hash_map<std::string, void*>* g_endpoint_binder_pool = nullptr; void grpc_endpoint_binder_pool_init() { g_endpoint_binder_pool_mu = new grpc_core::Mutex(); g_endpoint_binder_pool = new absl::flat_hash_map<std::string, void*>(); } void grpc_endpoint_binder_pool_shutdown() { g_endpoint_binder_pool_mu->Lock(); delete g_endpoint_binder_pool; g_endpoint_binder_pool_mu->Unlock(); delete g_endpoint_binder_pool_mu; } void grpc_add_endpoint_binder(const std::string& service, void* endpoint_binder) { grpc_core::MutexLock lock(g_endpoint_binder_pool_mu); (*g_endpoint_binder_pool)[service] = endpoint_binder; } void grpc_remove_endpoint_binder(const std::string& service) { grpc_core::MutexLock lock(g_endpoint_binder_pool_mu); g_endpoint_binder_pool->erase(service); } void* grpc_get_endpoint_binder(const std::string& service) { grpc_core::MutexLock lock(g_endpoint_binder_pool_mu); auto iter = g_endpoint_binder_pool->find(service); return iter == g_endpoint_binder_pool->end() ? nullptr : iter->second; } namespace grpc_core { class BinderServerListener : public Server::ListenerInterface { public: BinderServerListener(Server* server, std::string addr, BinderTxReceiverFactory factory) : server_(server), addr_(std::move(addr)), factory_(std::move(factory)) {} void Start(Server* /*server*/, const std::vector<grpc_pollset*>* /*pollsets*/) override { tx_receiver_ = factory_([this](transaction_code_t code, const grpc_binder::ReadableParcel* parcel) { return OnSetupTransport(code, parcel); }); endpoint_binder_ = tx_receiver_->GetRawBinder(); grpc_add_endpoint_binder(addr_, endpoint_binder_); } channelz::ListenSocketNode* channelz_listen_socket_node() const override { return nullptr; } void SetOnDestroyDone(grpc_closure* on_destroy_done) override { on_destroy_done_ = on_destroy_done; } void Orphan() override { delete this; } ~BinderServerListener() override { ExecCtx::Get()->Flush(); if (on_destroy_done_) { ExecCtx::Run(DEBUG_LOCATION, on_destroy_done_, GRPC_ERROR_NONE); ExecCtx::Get()->Flush(); } grpc_remove_endpoint_binder(addr_); } private: absl::Status OnSetupTransport(transaction_code_t code, const grpc_binder::ReadableParcel* parcel) { grpc_core::ExecCtx exec_ctx; if (grpc_binder::BinderTransportTxCode(code) != grpc_binder::BinderTransportTxCode::SETUP_TRANSPORT) { return absl::InvalidArgumentError("Not a SETUP_TRANSPORT request"); } int version; absl::Status status = parcel->ReadInt32(&version); if (!status.ok()) { return status; } gpr_log(GPR_INFO, "version = %d", version); // TODO(waynetu): Check supported version. std::unique_ptr<grpc_binder::Binder> client_binder{}; status = parcel->ReadBinder(&client_binder); if (!status.ok()) { return status; } if (!client_binder) { return absl::InvalidArgumentError("NULL binder read from the parcel"); } client_binder->Initialize(); // Finish the second half of SETUP_TRANSPORT in // grpc_create_binder_transport_server(). grpc_transport* server_transport = grpc_create_binder_transport_server(std::move(client_binder)); GPR_ASSERT(server_transport); grpc_channel_args* args = grpc_channel_args_copy(server_->channel_args()); grpc_error_handle error = server_->SetupTransport(server_transport, nullptr, args, nullptr, nullptr); grpc_channel_args_destroy(args); return grpc_error_to_absl_status(error); } Server* server_; grpc_closure* on_destroy_done_ = nullptr; std::string addr_; BinderTxReceiverFactory factory_; void* endpoint_binder_ = nullptr; std::unique_ptr<grpc_binder::TransactionReceiver> tx_receiver_; }; bool AddBinderPort(const std::string& addr, grpc_server* server, BinderTxReceiverFactory factory) { const std::string kBinderUriScheme = "binder:"; if (addr.compare(0, kBinderUriScheme.size(), kBinderUriScheme) != 0) { return false; } size_t pos = kBinderUriScheme.size(); while (pos < addr.size() && addr[pos] == '/') pos++; grpc_core::Server* core_server = server->core_server.get(); core_server->AddListener( grpc_core::OrphanablePtr<grpc_core::Server::ListenerInterface>( new grpc_core::BinderServerListener(core_server, addr.substr(pos), std::move(factory)))); return true; } } // namespace grpc_core
#ifndef math_geometry_distance_L2L #define math_geometry_distance_L2L // ::math::geometry::direction::L2L< scalar, dimension>.process( parametric, parametric ) // ::math::geometry::direction::distance( median, parametric, parametric, epsilon ) #include "../../../linear/vector/dot.hpp" #include "../../../linear/vector/subtraction.hpp" #include "../../../linear/vector/scale.hpp" #include "../../../linear/vector/addition.hpp" #include "../../../linear/vector/distance.hpp" #include "../parametric.hpp" namespace math { namespace geometry { namespace direction { template< typename scalar_name, unsigned dimension_number > class L2L { public: // http://geomalgorithms.com/a07-_distance.html typedef scalar_name scalar_type; typedef ::math::linear::vector::point< scalar_type, dimension_number > point_type; typedef ::math::geometry::direction::parametric< scalar_type, dimension_number > parametric_type; public: bool process( parametric_type const& first, parametric_type const& second, scalar_type const& epsilon = 1e-12 ) { point_type bond; ::math::linear::vector::subtraction( bond, first.origin(), second.origin() ); scalar_type a = ::math::linear::vector::dot( first.direction(), first.direction() ); scalar_type b = ::math::linear::vector::dot( first.direction(), second.direction() ); scalar_type c = ::math::linear::vector::dot( second.direction(), second.direction() ); scalar_type D = a * c - b * b; if( D < epsilon ) { return false; } scalar_type d = ::math::linear::vector::dot( first.direction(), bond ); scalar_type e = ::math::linear::vector::dot( second.direction(), bond ); m_lambdaF = ( b * e - c * d ) / D; m_lambdaS = ( a * e - b * d ) / D; ::math::linear::vector::scale( m_pointF, m_lambdaF, first.direction() ); ::math::linear::vector::addition( m_pointF, first.origin() ); ::math::linear::vector::scale( m_pointS, m_lambdaS , second.direction() ); ::math::linear::vector::addition( m_pointS, second.origin() ); return true; } public: scalar_type const& distance()const { return m_distance = ::math::linear::vector::distance( m_pointF, m_pointS ); } point_type const& median()const { ::math::linear::vector::addition( m_median, m_pointF, m_pointS ); ::math::linear::vector::scale<scalar_type>( m_median, 0.5 ); return m_median; } public: point_type const& first()const{ return m_pointF; } private: point_type m_pointF; public: point_type const& second()const{ return m_pointS; } private: point_type m_pointS; public: scalar_type const& lambdaF()const{ return m_lambdaF; } private: scalar_type m_lambdaF; public: scalar_type const& lambdaS()const{ return m_lambdaS; } private: scalar_type m_lambdaS; private: mutable scalar_type m_distance; mutable point_type m_median; }; template< typename scalar_name, unsigned dimension_number > bool distance ( scalar_name & distance ,::math::geometry::direction::parametric< scalar_name, dimension_number > const& first ,::math::geometry::direction::parametric< scalar_name, dimension_number > const& second ,scalar_name const& epsilon = 1e-12 ) { ::math::geometry::direction::L2L<scalar_name,dimension_number> calculator; if( false == calculator.process( first, second, epsilon ) ) { return false; } distance = calculator.distance(); return true; } } } } #endif
assume cs:code code segment start: mov ax,0b800h mov es,ax mov di,160*12 mov bx,offset s-offset se mov cx,80 s: mov byte ptr es:[di],'!' add di,2 int 7ch se: nop mov ax,4c00h int 21h code ends end start
[bits 32] [extern kernel_main] ; Declare that we will be referencing the external symbol 'kernel_main', [global _start] ; For avoiding linking issues, we have to define _start: ; a _start label ; so the linker can substitute the final address nop nop nop nop nop nop nop nop nop call kernel_main ; Invoke the function kernel_main() in our C kernel jmp $ ; Hang forever when we return from kernel
; A178489: a(n) = floor(n^(1/6)): integer part of sixth root of n. ; 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2 mul $0,2 lpb $0 div $0,128 add $1,108 lpe div $1,108 mov $0,$1
SECTION code_clib SECTION code_fp_math48 PUBLIC ___fs2schar_callee EXTERN cm48_sdccixp_ds2schar_callee defc ___fs2schar_callee = cm48_sdccixp_ds2schar_callee
db 0 ; 486 DEX NO db 110, 160, 110, 100, 80, 110 ; hp atk def spd sat sdf db NORMAL, NORMAL ; type db 3 ; catch rate db 220 ; base exp db NO_ITEM, NO_ITEM ; items db GENDER_UNKNOWN ; gender ratio db 100 ; unknown 1 db 120 ; step cycles to hatch db 5 ; unknown 2 INCBIN "gfx/pokemon/sinnoh/regigigas/front.dimensions" db 0, 0, 0, 0 ; padding db GROWTH_SLOW ; growth rate dn EGG_NONE, EGG_NONE ; egg groups ; tm/hm learnset tmhm ; end
#include "matchit.h" #include <string> #include <iostream> template <typename T> auto constexpr visitPat = [](auto func) { using namespace matchit; return as<T>(meet([func](auto&& param) { func(param); return true; })); }; template <typename T> auto constexpr visit = [](auto func) { using namespace matchit; return pattern | visitPat<T>(func) = []{}; }; template <typename T> void print(T&& x) { using namespace matchit; match(x)( visit<std::string>( [](const std::string& text) { std::cout << "Text message: " << text << std::endl; }), visit<int32_t>( [](const int32_t num) { std::cout << "Number: " << num << std::endl; }) ); } int main() { using namespace matchit; std::variant<int32_t, std::string> v1 = "123"; std::variant<int32_t, std::string> v2 = 123; print(v1); print(v2); return 0; }
.text draw_snake: # draw inital snake # # inputs: # - s4 = vector of coordinates to draw snake points # # output: # - addi sp, sp, -20 sw s4, 0(sp) sw t1, 4(sp) sw t2, 8(sp) sw t3, 12(sp) sw ra,16(sp) lw t0, 0(s4) # length of snake slli t1, t0, 2 # multiply length by 4 (alignment of vector) li t2, 0 # counter for loop snake_loop: beq t2, t1, end_loop #for(counter < length){...} addi t2, t2, 4 # increase counter by 4 add t3, t2, s4 # current element address lw a0, (t3) # current element value (arr[i]) li a3, 0x00FF00 # color of snake jal convert_coord #converts word in a0 to x and y coordinate jal draw_point j snake_loop end_loop: lw s4, 0(sp) lw t1, 4(sp) lw t2, 8(sp) lw t3, 12(sp) lw ra,16(sp) addi sp, sp, 20 ret
BYTE TILE_VOID, TILE_VOID, TILE_VOID, TILE_VOID, TILE_VOID, TILE_VOID, TILE_VOID, TILE_VOID, TILE_VOID, TILE_VOID, TILE_VOID, TILE_VOID, $FF MAP_KITCHEN_01 BYTE TILE_WALL_1, TILE_WALL_1, TILE_WALL_1, TILE_WALL_3, TILE_WALL_3, TILE_WALL_3, TILE_WALL_3, TILE_WALL_3, TILE_WALL_3, TILE_WALL_3, TILE_WALL_1, TILE_WALL_1, TILE_WALL_1, $FF BYTE TILE_WALL_1, TILE_FLOOR_1, TILE_FLOOR_0, TILE_WALL_0, TILE_BENCH, TILE_STOVE, TILE_WALL_2, TILE_STOVE, TILE_BENCH, TILE_WALL_0, TILE_FLOOR_0, TILE_FLOOR_0, TILE_WALL_1, $FF BYTE TILE_WALL_1, TILE_FLOOR_2, TILE_FLOOR_0, TILE_FLOOR_0, TILE_FLOOR_2, TILE_FLOOR_3, TILE_FLOOR_0, TILE_FLOOR_0, TILE_FLOOR_0, TILE_FLOOR_0, TILE_FLOOR_0, TILE_FLOOR_0, TILE_WALL_1, $FF BYTE TILE_BIN, TILE_FLOOR_0, TILE_FLOOR_1, TILE_FLOOR_0, TILE_FLOOR_0, TILE_FLOOR_1, TILE_FLOOR_2, TILE_FLOOR_0, TILE_FLOOR_2, TILE_FLOOR_0, TILE_FLOOR_2, TILE_FLOOR_3, TILE_SERVE, $FF BYTE TILE_WALL_1, TILE_FLOOR_0, TILE_FLOOR_0, TILE_WALL_0, TILE_CHOP, TILE_BENCH, TILE_WALL_2, TILE_BENCH, TILE_CHOP, TILE_WALL_0, TILE_FLOOR_0, TILE_FLOOR_1, TILE_WALL_1, $FF BYTE TILE_WALL_1, TILE_FLOOR_0, TILE_FLOOR_0, TILE_WALL_0, TILE_PLATE, TILE_BUN, TILE_MEAT, TILE_TOMATO, TILE_LETTUCE, TILE_WALL_0, TILE_FLOOR_0, TILE_FLOOR_0, TILE_WALL_1, $FF BYTE TILE_WALL_1, TILE_FLOOR_3, TILE_FLOOR_0, TILE_FLOOR_0, TILE_FLOOR_0, TILE_FLOOR_0, TILE_FLOOR_0, TILE_FLOOR_0, TILE_FLOOR_0, TILE_FLOOR_0, TILE_FLOOR_3, TILE_FLOOR_0, TILE_WALL_1, $FF BYTE TILE_WALL_1, TILE_WALL_1, TILE_WALL_1, TILE_WALL_1, TILE_WALL_1, TILE_WALL_1, TILE_WALL_1, TILE_WALL_1, TILE_WALL_1, TILE_WALL_1, TILE_WALL_1, TILE_WALL_1, TILE_WALL_1, $FF BYTE TILE_VOID, TILE_VOID, TILE_VOID, TILE_VOID, TILE_VOID, TILE_VOID, TILE_VOID, TILE_VOID, TILE_VOID, TILE_VOID, TILE_VOID, TILE_VOID, $FF
; Test that \ followed by whitespace after a macro invocation at the end of the ; file doesn't cause a segfault. bar: MACRO ENDM foo: bar baz\
/* * Copyright (c) 2015 Cryptonomex, Inc., and contributors. * * The MIT License * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #include <graphene/chain/config.hpp> #include <graphene/chain/protocol/types.hpp> #include <fc/crypto/base58.hpp> #include <fc/crypto/ripemd160.hpp> #include <fc/exception/exception.hpp> #include <fc/io/raw.hpp> namespace graphene { namespace chain { public_key_type::public_key_type():key_data(){}; public_key_type::public_key_type( const fc::ecc::public_key_data& data ) :key_data( data ) {}; public_key_type::public_key_type( const fc::ecc::public_key& pubkey ) :key_data( pubkey ) {}; public_key_type::public_key_type( const std::string& base58str ) { // TODO: Refactor syntactic checks into static is_valid() // to make public_key_type API more similar to address API std::string prefix( GRAPHENE_ADDRESS_PREFIX ); // TODO: This is temporary for testing try { if( is_valid_v1( base58str ) ) prefix = std::string(GRAPHENE_ADDRESS_PREFIX); } catch( ... ) { } const size_t prefix_len = prefix.size(); FC_ASSERT( base58str.size() > prefix_len ); FC_ASSERT( base58str.substr( 0, prefix_len ) == prefix , "", ("base58str", base58str) ); auto bin = fc::from_base58( base58str.substr( prefix_len ) ); auto bin_key = fc::raw::unpack<binary_key>(bin); key_data = bin_key.data; FC_ASSERT( fc::ripemd160::hash( key_data.data, key_data.size() )._hash[0] == bin_key.check ); }; // TODO: This is temporary for testing bool public_key_type::is_valid_v1( const std::string& base58str ) { std::string prefix(GRAPHENE_ADDRESS_PREFIX); const size_t prefix_len = prefix.size(); FC_ASSERT( base58str.size() > prefix_len ); FC_ASSERT( base58str.substr( 0, prefix_len ) == prefix , "", ("base58str", base58str) ); auto bin = fc::from_base58( base58str.substr( prefix_len ) ); auto bin_key = fc::raw::unpack<binary_key>(bin); fc::ecc::public_key_data key_data = bin_key.data; FC_ASSERT( fc::ripemd160::hash( key_data.data, key_data.size() )._hash[0] == bin_key.check ); return true; } public_key_type::operator fc::ecc::public_key_data() const { return key_data; }; public_key_type::operator fc::ecc::public_key() const { return fc::ecc::public_key( key_data ); }; public_key_type::operator std::string() const { binary_key k; k.data = key_data; k.check = fc::ripemd160::hash( k.data.data, k.data.size() )._hash[0]; auto data = fc::raw::pack( k ); return GRAPHENE_ADDRESS_PREFIX + fc::to_base58( data.data(), data.size() ); } bool operator == ( const public_key_type& p1, const fc::ecc::public_key& p2) { return p1.key_data == p2.serialize(); } bool operator == ( const public_key_type& p1, const public_key_type& p2) { return p1.key_data == p2.key_data; } bool operator != ( const public_key_type& p1, const public_key_type& p2) { return p1.key_data != p2.key_data; } // extended_public_key_type extended_public_key_type::extended_public_key_type():key_data(){}; extended_public_key_type::extended_public_key_type( const fc::ecc::extended_key_data& data ) :key_data( data ){}; extended_public_key_type::extended_public_key_type( const fc::ecc::extended_public_key& extpubkey ) { key_data = extpubkey.serialize_extended(); }; extended_public_key_type::extended_public_key_type( const std::string& base58str ) { std::string prefix( GRAPHENE_ADDRESS_PREFIX ); const size_t prefix_len = prefix.size(); FC_ASSERT( base58str.size() > prefix_len ); FC_ASSERT( base58str.substr( 0, prefix_len ) == prefix , "", ("base58str", base58str) ); auto bin = fc::from_base58( base58str.substr( prefix_len ) ); auto bin_key = fc::raw::unpack<binary_key>(bin); FC_ASSERT( fc::ripemd160::hash( bin_key.data.data, bin_key.data.size() )._hash[0] == bin_key.check ); key_data = bin_key.data; } extended_public_key_type::operator fc::ecc::extended_public_key() const { return fc::ecc::extended_public_key::deserialize( key_data ); } extended_public_key_type::operator std::string() const { binary_key k; k.data = key_data; k.check = fc::ripemd160::hash( k.data.data, k.data.size() )._hash[0]; auto data = fc::raw::pack( k ); return GRAPHENE_ADDRESS_PREFIX + fc::to_base58( data.data(), data.size() ); } bool operator == ( const extended_public_key_type& p1, const fc::ecc::extended_public_key& p2) { return p1.key_data == p2.serialize_extended(); } bool operator == ( const extended_public_key_type& p1, const extended_public_key_type& p2) { return p1.key_data == p2.key_data; } bool operator != ( const extended_public_key_type& p1, const extended_public_key_type& p2) { return p1.key_data != p2.key_data; } // extended_private_key_type extended_private_key_type::extended_private_key_type():key_data(){}; extended_private_key_type::extended_private_key_type( const fc::ecc::extended_key_data& data ) :key_data( data ){}; extended_private_key_type::extended_private_key_type( const fc::ecc::extended_private_key& extprivkey ) { key_data = extprivkey.serialize_extended(); }; extended_private_key_type::extended_private_key_type( const std::string& base58str ) { std::string prefix( GRAPHENE_ADDRESS_PREFIX ); const size_t prefix_len = prefix.size(); FC_ASSERT( base58str.size() > prefix_len ); FC_ASSERT( base58str.substr( 0, prefix_len ) == prefix , "", ("base58str", base58str) ); auto bin = fc::from_base58( base58str.substr( prefix_len ) ); auto bin_key = fc::raw::unpack<binary_key>(bin); FC_ASSERT( fc::ripemd160::hash( bin_key.data.data, bin_key.data.size() )._hash[0] == bin_key.check ); key_data = bin_key.data; } extended_private_key_type::operator fc::ecc::extended_private_key() const { return fc::ecc::extended_private_key::deserialize( key_data ); } extended_private_key_type::operator std::string() const { binary_key k; k.data = key_data; k.check = fc::ripemd160::hash( k.data.data, k.data.size() )._hash[0]; auto data = fc::raw::pack( k ); return GRAPHENE_ADDRESS_PREFIX + fc::to_base58( data.data(), data.size() ); } bool operator == ( const extended_private_key_type& p1, const fc::ecc::extended_public_key& p2) { return p1.key_data == p2.serialize_extended(); } bool operator == ( const extended_private_key_type& p1, const extended_private_key_type& p2) { return p1.key_data == p2.key_data; } bool operator != ( const extended_private_key_type& p1, const extended_private_key_type& p2) { return p1.key_data != p2.key_data; } } } // graphene::chain namespace fc { using namespace std; void to_variant( const graphene::chain::public_key_type& var, fc::variant& vo ) { vo = std::string( var ); } void from_variant( const fc::variant& var, graphene::chain::public_key_type& vo ) { vo = graphene::chain::public_key_type( var.as_string() ); } void to_variant( const graphene::chain::extended_public_key_type& var, fc::variant& vo ) { vo = std::string( var ); } void from_variant( const fc::variant& var, graphene::chain::extended_public_key_type& vo ) { vo = graphene::chain::extended_public_key_type( var.as_string() ); } void to_variant( const graphene::chain::extended_private_key_type& var, fc::variant& vo ) { vo = std::string( var ); } void from_variant( const fc::variant& var, graphene::chain::extended_private_key_type& vo ) { vo = graphene::chain::extended_private_key_type( var.as_string() ); } } // fc
#include <cstdio> int main(){ int n(0), m(0), k(0); scanf("%d %d %d", &n, &m, &k); int temp(0), numFirst(0), numSecond(0); for(int p = 0; p < n; p++){ scanf("%d", &temp); if(temp == 1){++numFirst;} else{++numSecond;} } int needed(0); if(numFirst >= m){needed = numFirst - m; m = 0;} else{m -= numFirst;} if(numSecond > k + m){needed += numSecond - k - m;} printf("%d\n", needed); return 0; }
/* * * Copyright (C) 1996-2010, OFFIS * * This software and supporting documentation were developed by * * Kuratorium OFFIS e.V. * Healthcare Information and Communication Systems * Escherweg 2 * D-26121 Oldenburg, Germany * * THIS SOFTWARE IS MADE AVAILABLE, AS IS, AND OFFIS MAKES NO WARRANTY * REGARDING THE SOFTWARE, ITS PERFORMANCE, ITS MERCHANTABILITY OR * FITNESS FOR ANY PARTICULAR USE, FREEDOM FROM ANY COMPUTER DISEASES OR * ITS CONFORMITY TO ANY SPECIFICATION. THE ENTIRE RISK AS TO QUALITY AND * PERFORMANCE OF THE SOFTWARE IS WITH THE USER. * * Module: dcmwlm * * Author: Thomas Wilkens * * Purpose: Class for managing file system interaction. * * Last Update: $Author: joergr $ * Update Date: $Date: 2010-02-15 13:11:13 $ * CVS/RCS Revision: $Revision: 1.21 $ * Status: $State: Exp $ * * CVS/RCS Log at end of file * */ // ---------------------------------------------------------------------------- #include "dcmtk/config/osconfig.h" #define INCLUDE_CLIMITS #include "dcmtk/ofstd/ofstdinc.h" BEGIN_EXTERN_C #ifdef HAVE_SYS_TYPES_H #include <sys/types.h> #endif #ifdef HAVE_SYS_FILE_H #include <sys/file.h> // for struct DIR, opendir() #endif #ifdef HAVE_DIRENT_H #include <dirent.h> // for struct DIR, opendir() #endif END_EXTERN_C #include "dcmtk/dcmnet/diutil.h" #include "dcmtk/ofstd/ofconsol.h" #include "dcmtk/ofstd/ofstd.h" #include "dcmtk/ofstd/ofoset.h" #include "dcmtk/ofstd/ofsetit.h" #include "dcmtk/ofstd/ofdate.h" #include "dcmtk/ofstd/oftime.h" #include "dcmtk/ofstd/oftypes.h" #include "dcmtk/dcmnet/dicom.h" #include "dcmtk/dcmdata/dcdatset.h" #include "dcmtk/dcmdata/dcitem.h" #include "dcmtk/dcmdata/dcvrda.h" #include "dcmtk/dcmdata/dcvrtm.h" #include "dcmtk/dcmwlm/wltypdef.h" #include "dcmtk/dcmwlm/wlds.h" #include "dcmtk/dcmdata/dctk.h" #include <stdio.h> #include <stdlib.h> #include "dcmtk/dcmwlm/wlfsim.h" // ---------------------------------------------------------------------------- WlmFileSystemInteractionManager::WlmFileSystemInteractionManager() // Date : July 11, 2002 // Author : Thomas Wilkens // Task : Constructor. // Parameters : none. // Return Value : none. : dfPath( "" ), enableRejectionOfIncompleteWlFiles( OFTrue ), calledApplicationEntityTitle( "" ), matchingRecords( NULL ), numOfMatchingRecords( 0 ) { } // ---------------------------------------------------------------------------- WlmFileSystemInteractionManager::~WlmFileSystemInteractionManager() // Date : July 11, 2002 // Author : Thomas Wilkens // Task : Destructor. // Parameters : none. // Return Value : none. { } // ---------------------------------------------------------------------------- void WlmFileSystemInteractionManager::SetEnableRejectionOfIncompleteWlFiles( OFBool value ) // Date : May 3, 2005 // Author : Thomas Wilkens // Task : Set value in member variable. // Parameters : value - [in] The value to set. // Return Value : none. { enableRejectionOfIncompleteWlFiles = value; } // ---------------------------------------------------------------------------- OFCondition WlmFileSystemInteractionManager::ConnectToFileSystem( const OFString& dfPathv ) // Date : July 11, 2002 // Author : Thomas Wilkens // Task : Connects to the worklist file system database. // Parameters : dfPathv - [in] Path to worklist file system database. // Return Value : Indicates if the connection could be established or not. { // check parameter if( dfPathv.length() == 0 ) { DCMWLM_WARN("Invalid parameters, cannot connect to worklist file system database..."); return( WLM_EC_CannotConnectToDataSource ); } // copy value dfPath = dfPathv; // check if the specified path is existent and accessible for reading if( !OFStandard::dirExists( dfPath ) || !OFStandard::isReadable( dfPath ) ) return( WLM_EC_CannotConnectToDataSource ); else return( EC_Normal ); } // ---------------------------------------------------------------------------- OFCondition WlmFileSystemInteractionManager::DisconnectFromFileSystem() // Date : July 11, 2002 // Author : Thomas Wilkens // Task : Disconnects from the worklist file system database. // Parameters : none. // Return Value : Indicates if the connection was disconnected successfully. { return( EC_Normal ); } // ---------------------------------------------------------------------------- OFBool WlmFileSystemInteractionManager::IsCalledApplicationEntityTitleSupported( const OFString& calledApplicationEntityTitlev ) // Date : July 11, 2002 // Author : Thomas Wilkens // Task : Checks if the given called application entity title is supported. If this is the case, // OFTrue will be returned, else OFFalse. // Parameters : calledApplicationEntityTitlev - [in] The application entity title which shall be checked // for support. Valid pointer expected. // Return Value : OFTrue - The called application entity title is supported. // OFFalse - The called application entity title is not supported or it is not given. { // copy value calledApplicationEntityTitle = calledApplicationEntityTitlev; // Determine complete path to the files that make up the data source. OFString fullPath( dfPath ); if( fullPath.length() > 0 && fullPath[fullPath.length()-1] != PATH_SEPARATOR ) fullPath += PATH_SEPARATOR; fullPath += calledApplicationEntityTitle; // in case the path is not existent, we need to return OFFalse if( !( OFStandard::dirExists( OFString( fullPath ) ) ) ) return( OFFalse ); // if we get to here, the path is existent and we need to return OFTrue return( OFTrue ); } // ---------------------------------------------------------------------------- unsigned long WlmFileSystemInteractionManager::DetermineMatchingRecords( DcmDataset *searchMask ) // Date : July 11, 2002 // Author : Thomas Wilkens // Task : This function determines the records from the worklist files which match // the given search mask and returns the number of matching records. Also, // this function will store the matching records in memory in the array // member variable matchingRecords. // Parameters : searchMask - [in] The search mask. // Return Value : Number of matching records. { OFOrderedSet<OFString> worklistFiles; // initialize member variables matchingRecords = NULL; numOfMatchingRecords = 0; // determine all worklist files DetermineWorklistFiles( worklistFiles ); // go through all worklist files for( unsigned int i=0 ; i<worklistFiles.NumberOfElements() ; i++ ) { // read information from worklist file DcmFileFormat fileform; if (fileform.loadFile(worklistFiles[i].c_str()).bad()) { DCMWLM_INFO("Could not read worklist file " << worklistFiles[i] << " properly. File will be ignored."); } else { // determine the data set which is contained in the worklist file DcmDataset *dataset = fileform.getDataset(); if( dataset == NULL ) { DCMWLM_INFO("Worklist file " << worklistFiles[i] << " is empty. File will be ignored."); } else { // in case option --enable-file-reject is set, we have to check if the current // .wl-file meets certain conditions; in detail, the file's dataset has to be // checked whether it contains all necessary return type 1 attributes and contains // information in all these attributes; if this is condition is not met, the // .wl-file shall be rejected if( enableRejectionOfIncompleteWlFiles && !DatasetIsComplete( dataset ) ) { DCMWLM_INFO("Worklist file " << worklistFiles[i] << " is incomplete. File will be ignored."); } else { // check if the current dataset matches the matching key attribute values if( !DatasetMatchesSearchMask( dataset, searchMask ) ) { DCMWLM_INFO("Information from worklist file " << worklistFiles[i] << " does not match query."); } else { DCMWLM_INFO("Information from worklist file " << worklistFiles[i] << " matches query."); // since the dataset matches the matching key attribute values // we need to insert it into the matchingRecords array if( numOfMatchingRecords == 0 ) { matchingRecords = new DcmDataset*[1]; matchingRecords[0] = new DcmDataset( *dataset ); } else { DcmDataset **tmp = new DcmDataset*[numOfMatchingRecords + 1]; for( unsigned long j=0 ; j<numOfMatchingRecords ; j++ ) tmp[j] = matchingRecords[j]; tmp[numOfMatchingRecords] = new DcmDataset( *dataset ); delete[] matchingRecords; matchingRecords = tmp; } numOfMatchingRecords++; } } } } } // return result return( numOfMatchingRecords ); } // ---------------------------------------------------------------------------- unsigned long WlmFileSystemInteractionManager::GetNumberOfSequenceItemsForMatchingRecord( DcmTagKey sequenceTag, WlmSuperiorSequenceInfoType *superiorSequenceArray, unsigned long numOfSuperiorSequences, unsigned long idx ) // Date : January 6, 2004 // Author : Thomas Wilkens // Task : For the matching record that is identified through idx, this function returns the number // of items that are contained in the sequence element that is referred to by sequenceTag. // In case this sequence element is itself contained in a certain item of another superior // sequence, superiorSequenceArray contains information about where to find the correct // sequence element. // Parameters : sequenceTag - [in] The tag of the sequence element for which the number of items // shall be determined. // superiorSequenceArray - [in] Array which contains information about superior sequence elements // the given sequence element is contained in. // numOfSuperiorSequences - [in] The number of elements in the above array. // idx - [in] Identifies the record from which the number of sequence items // shall be determined. // Return Value : The number of items that are contained in the sequence element that is referred to by // sequenceTag and that can be found in sequence items which are specified in superiorSequenceArray. { OFCondition cond; DcmSequenceOfItems *sequenceElement = NULL, *tmp = NULL; unsigned long i; // initialize result variable unsigned long numOfItems = 0; // if the sequence in question is not contained in another sequence if( numOfSuperiorSequences == 0 ) { // simply find and get this sequence in the matching dataset (on the main level) cond = matchingRecords[idx]->findAndGetSequence( sequenceTag, sequenceElement, OFFalse ); } else { // if it is contained in (an)other sequence(s), find it cond = matchingRecords[idx]->findAndGetSequence( superiorSequenceArray[0].sequenceTag, sequenceElement, OFFalse ); for( i=1 ; i<numOfSuperiorSequences && cond.good() ; i++ ) { cond = sequenceElement->getItem( superiorSequenceArray[i-1].currentItem )->findAndGetSequence( superiorSequenceArray[i].sequenceTag, tmp, OFFalse ); if( cond.good() ) sequenceElement = tmp; } if( cond.good() ) { cond = sequenceElement->getItem( superiorSequenceArray[ numOfSuperiorSequences - 1 ].currentItem )->findAndGetSequence( sequenceTag, tmp, OFFalse ); if( cond.good() ) sequenceElement = tmp; } } // determine number of items for the sequence in question if( cond.good() ) numOfItems = sequenceElement->card(); // return result return( numOfItems ); } // ---------------------------------------------------------------------------- void WlmFileSystemInteractionManager::GetAttributeValueForMatchingRecord( DcmTagKey tag, WlmSuperiorSequenceInfoType *superiorSequenceArray, unsigned long numOfSuperiorSequences, unsigned long idx, char *&value ) // Date : July 11, 2002 // Author : Thomas Wilkens // Task : This function determines an attribute value of a matching record // and returns this value in a newly created string to the caller. // Parameters : tag - [in] Attribute tag. Specifies which attribute's value shall be returned. // superiorSequenceArray - [in] Array which contains information about superior sequence elements // the given element is contained in. // numOfSuperiorSequences - [in] The number of elements in the above array. // idx - [in] Identifies the record from which the attribute value shall be retrieved. // value - [out] Pointer to a newly created string that contains the requested value. // If value was not found an emtpy string will be returned. // Return Value : none. { OFCondition cond; DcmSequenceOfItems *sequenceElement = NULL, *tmp = NULL; unsigned long i; const char *val = NULL; Uint16 v; // if the element in question is not contained in another sequence if( numOfSuperiorSequences == 0 ) { // simply find and get this element in the matching dataset (on the main level); // here, we have to distinguish two cases: attribute PregnancyStatus has to be re- // trieved as a Uint16 value (also note for this case, that this attribute can only // occur on the main level, it will never be contained in a sequence), all other // attributes have to be retrieved as strings if( tag == DCM_PregnancyStatus ) { cond = matchingRecords[idx]->findAndGetUint16( tag, v, 0, OFFalse ); if( cond.good() ) { value = new char[20]; sprintf( value, "%u", v ); } else { value = new char[ 2 ]; strcpy( value, "4" ); // a value of "4" in attribute PregnancyStatus means "unknown" in DICOM } } else { cond = matchingRecords[idx]->findAndGetString( tag, val, OFFalse ); if( cond.good() && val != NULL ) { value = new char[ strlen( val ) + 1 ]; strcpy( value, val ); } else { value = new char[ 1 ]; strcpy( value, "" ); } } } else { // if it is contained in (an)other sequence(s), go through all corresponding sequence items cond = matchingRecords[idx]->findAndGetSequence( superiorSequenceArray[0].sequenceTag, sequenceElement, OFFalse ); for( i=1 ; i<numOfSuperiorSequences && cond.good() ; i++ ) { cond = sequenceElement->getItem( superiorSequenceArray[i-1].currentItem )->findAndGetSequence( superiorSequenceArray[i].sequenceTag, tmp, OFFalse ); if( cond.good() ) sequenceElement = tmp; } // now sequenceElement points to the sequence element in which the attribute // in question can be found; retrieve a value for this attribute (note that // all attributes in sequences can actually be retrieved as strings) if( cond.good() ) { cond = sequenceElement->getItem( superiorSequenceArray[ numOfSuperiorSequences - 1 ].currentItem )->findAndGetString( tag, val, OFFalse ); if( cond.good() && val != NULL ) { value = new char[ strlen( val ) + 1 ]; strcpy( value, val ); } else { value = new char[ 1 ]; strcpy( value, "" ); } } else { value = new char[ 1 ]; strcpy( value, "" ); } } } // ---------------------------------------------------------------------------- void WlmFileSystemInteractionManager::ClearMatchingRecords() // Date : July 11, 2002 // Author : Thomas Wilkens // Task : This function frees the memory which was occupied by matchingRecords. // It shall be called when the matching records are no longer needed. // Parameters : none. // Return Value : none. { for( unsigned int i=0 ; i<numOfMatchingRecords ; i++ ) delete matchingRecords[i]; delete[] matchingRecords; matchingRecords = NULL; numOfMatchingRecords = 0; } // ---------------------------------------------------------------------------- void WlmFileSystemInteractionManager::DetermineWorklistFiles( OFOrderedSet<OFString> &worklistFiles ) // Date : July 11, 2002 // Author : Thomas Wilkens // Task : This function determines all worklist files in the directory specified by // dfPath and calledApplicationEntityTitle, and returns the complete path and // filename information in an array of strings. // Parameters : worklistFiles - [out] Set of strings, each specifying path and filename // to one worklist file. // Return Value : none. { // initialize out parameters worklistFiles.Clear(); // determine complete path to data source files // (dfPath + PATH_SEPARATOR + calledApplicationEntityTitle) OFString path( dfPath ); if( path.length() > 0 && path[path.length()-1] != PATH_SEPARATOR ) path += PATH_SEPARATOR; path += calledApplicationEntityTitle; // determine worklist files in this folder #ifdef HAVE__FINDFIRST OFString searchname = path + PATH_SEPARATOR + '*'; struct _finddata_t fileData; int ret = 0; // start a loop; in each iteration another directory entry is determined long hFile = _findfirst( (char*)searchname.c_str(), &fileData ); while( hFile != -1L && ret == 0 ) { // if the current entry refers to a worklist file, do something if( strcmp( fileData.name, "." ) !=0 && strcmp( fileData.name, ".." ) !=0 && IsWorklistFile( fileData.name ) ) { // Create a string that contains path and filename of the current worklist file. OFString subname( path ); subname += PATH_SEPARATOR; subname += fileData.name; // Add string to the set of strings worklistFiles.Insert( subname ); } ret = _findnext( hFile, &fileData ); } _findclose( hFile ); #else struct dirent *dp = NULL; // open directory DIR *dirp = opendir( path.c_str() ); if( dirp != NULL ) { // start a loop; in each iteration another directory entry is determined. #if defined(_REENTRANT) && !defined(_WIN32) && !defined(__CYGWIN__) unsigned char entryBuffer[sizeof(struct dirent) + _POSIX_PATH_MAX + 1]; #ifdef HAVE_OLD_READDIR_R for( dp = readdir_r( dirp, (struct dirent *)entryBuffer ) ; dp != NULL ; dp = readdir_r( dirp, (struct dirent *)entryBuffer ) ) #else for( int readResult = readdir_r( dirp, (struct dirent *)entryBuffer, &dp ) ; readResult == 0 && dp ; readResult = readdir_r( dirp, (struct dirent *)entryBuffer, &dp ) ) #endif #else for( dp = readdir( dirp ) ; dp != NULL ; dp = readdir( dirp ) ) #endif { // if the current entry refers to a worklist file if( IsWorklistFile( dp->d_name ) ) { // create a string that contains path and filename of the current worklist file. OFString subname( path ); subname += PATH_SEPARATOR; subname += dp->d_name; // add string to the set of strings worklistFiles.Insert( subname ); } } // close directory closedir( dirp ); } #endif // in case we are running in verbose mode, dump all worklist file information if (DCM_dcmwlmGetLogger().isEnabledFor(OFLogger::INFO_LOG_LEVEL)) { DCMWLM_INFO("============================="); DCMWLM_INFO("Worklist Database Files:"); if( worklistFiles.NumberOfElements() == 0 ) DCMWLM_INFO("<no files found>"); else { OFSetIterator<OFString> iter( worklistFiles ); while( iter.Object() ) { DCMWLM_INFO(*iter.Object()); iter.Next(); } } DCMWLM_INFO("============================="); } } // ---------------------------------------------------------------------------- OFBool WlmFileSystemInteractionManager::IsWorklistFile( const char *fname ) // Date : July 11, 2002 // Author : Thomas Wilkens // Task : This function returns OFTrue if the given filename refers to a worklist file, // i.e. has an extension of ".wl". // Parameters : fname - [in] The name of the file. // Return Value : OFTrue - The given filename refers to a worklist file. // OFFalse - The given filename does not refer to a worklist file. { // If no filename is specified, return OFFalse if( fname == NULL ) return( OFFalse ); // look for an '.' in the filename char *s = (char *)strrchr( fname, '.' ); // if there was no '.' return OFFalse if( s == NULL ) return( OFFalse ); // if the extension is ".wl" return OFTrue if( strcmp( s, ".wl" ) == 0 ) return( OFTrue ); // return OFFalse in all other cases return( OFFalse ); } // ---------------------------------------------------------------------------- OFBool WlmFileSystemInteractionManager::DatasetIsComplete( DcmDataset *dataset ) // Date : May 2, 2005 // Author : Thomas Wilkens // Task : This function checks if the given dataset (which represents the information from a // worklist file) contains all necessary return type 1 information. According to the // DICOM standard part 4 annex K, the following attributes are type 1 attributes in // C-Find RSP messages: // Attribute Tag Return Key Type // SpecificCharacterSet (0008,0005) 1C (will be checked in WlmDataSourceFileSystem::StartFindRequest(...); this attribute does not have to be checked here) // ScheduledProcedureStepSequence (0040,0100) 1 // > ScheduledStationAETitle (0040,0001) 1 // > ScheduledProcedureStepStartDate (0040,0002) 1 // > ScheduledProcedureStepStartTime (0040,0003) 1 // > Modality (0008,0060) 1 // > ScheduledProcedureStepDescription (0040,0007) 1C (The ScheduledProcedureStepDescription (0040,0007) or the ScheduledProtocolCodeSequence (0040,0008) or both shall be supported by the SCP; we actually support both, so we have to check if at least one of the two attributes contains valid information.) // > ScheduledProtocolCodeSequence (0040,0008) 1C (see abobve) // > > CodeValue (0008,0100) 1 // > > CodingSchemeDesignator (0008,0102) 1 // > ScheduledProcedureStepID (0040,0009) 1 // RequestedProcedureID (0040,1001) 1 // RequestedProcedureDescription (0032,1060) 1C (The RequestedProcedureDescription (0032,1060) or the RequestedProcedureCodeSequence (0032,1064) or both shall be supported by the SCP; we actually support both, so we have to check if at least one of the two attributes contains valid information.) // RequestedProcedureCodeSequence (0032,1064) 1C (see abobve) // > > CodeValue (0008,0100) 1 // > > CodingSchemeDesignator (0008,0102) 1 // StudyInstanceUID (0020,000D) 1 // ReferencedStudySequence (0008,1110) 2 // > ReferencedSOPClassUID (0008,1150) 1C (Required if a sequence item is present) // > ReferencedSOPInstanceUID (0008,1155) 1C (Required if a sequence item is present) // ReferencedPatientSequence (0008,1120) 2 // > ReferencedSOPClassUID (0008,1150) 1C (Required if a sequence item is present) // > ReferencedSOPInstanceUID (0008,1155) 1C (Required if a sequence item is present) // PatientsName (0010,0010) 1 // PatientID (0010,0020) 1 // Parameters : dataset - [in] The dataset of the worklist file which is currently examined. // Return Value : OFTrue in case the given dataset contains all necessary return type 1 information, // OFFalse otherwise. { DcmElement *scheduledProcedureStepSequence = NULL; // intialize returnValue OFBool complete = OFTrue; // the dataset is considered to be incomplete... // ...if the ScheduledProcedureStepSequence is missing or // ...if the ScheduledProcedureStepSequence does not have exactly one item if( dataset->findAndGetElement( DCM_ScheduledProcedureStepSequence, scheduledProcedureStepSequence ).bad() || ((DcmSequenceOfItems*)scheduledProcedureStepSequence)->card() != 1 ) complete = OFFalse; else { // so the ScheduledProcedureStepSequence is existent and has exactly one item; // get this one and only item from the ScheduledProcedureStepSequence DcmItem *scheduledProcedureStepSequenceItem = ((DcmSequenceOfItems*)scheduledProcedureStepSequence)->getItem(0); // the dataset is considered to be incomplete... // ...if ScheduledStationAETitle is missing or empty in the ScheduledProcedureStepSequence, or // ...if ScheduledProcedureStepStartDate is missing or empty in the ScheduledProcedureStepSequence, or // ...if ScheduledProcedureStepStartTime is missing or empty in the ScheduledProcedureStepSequence, or // ...if Modality is missing or empty in the ScheduledProcedureStepSequence, or // ...if ScheduledProcedureStepID is missing or empty in the ScheduledProcedureStepSequence, or // ...if RequestedProcedureID is missing or empty in the dataset, or // ...if StudyInstanceUID is missing or empty in the dataset, or // ...if PatientsName is missing or empty in the dataset, or // ...if PatientID is missing or empty in the dataset, or // ...if inside the ScheduledProcedureStepSequence, no information can be retrieved from // the ScheduledProcedureStepDescription attribute and (at the same time) also no // complete information can be retrieved from the ScheduledProtocolCodeSequence attribute, or // ...if inside the dataset, no information can be retrieved from the RequestedProcedureDescription // attribute and (at the same time) also no complete information can be retrieved from the // RequestedProcedureCodeSequence attribute, or // ...if inside the dataset, the ReferencedStudySequence is either absent or it is existent and non-empty but incomplete, or // ...if inside the dataset, the ReferencedPatientSequence is either absent or it is existent and non-empty but incomplete if( AttributeIsAbsentOrEmpty( DCM_ScheduledStationAETitle, scheduledProcedureStepSequenceItem ) || AttributeIsAbsentOrEmpty( DCM_ScheduledProcedureStepStartDate, scheduledProcedureStepSequenceItem ) || AttributeIsAbsentOrEmpty( DCM_ScheduledProcedureStepStartTime, scheduledProcedureStepSequenceItem ) || AttributeIsAbsentOrEmpty( DCM_Modality, scheduledProcedureStepSequenceItem ) || AttributeIsAbsentOrEmpty( DCM_ScheduledProcedureStepID, scheduledProcedureStepSequenceItem ) || AttributeIsAbsentOrEmpty( DCM_RequestedProcedureID, dataset ) || AttributeIsAbsentOrEmpty( DCM_StudyInstanceUID, dataset ) || AttributeIsAbsentOrEmpty( DCM_PatientsName, dataset ) || AttributeIsAbsentOrEmpty( DCM_PatientID, dataset ) || DescriptionAndCodeSequenceAttributesAreIncomplete( DCM_ScheduledProcedureStepDescription, DCM_ScheduledProtocolCodeSequence, scheduledProcedureStepSequenceItem ) || DescriptionAndCodeSequenceAttributesAreIncomplete( DCM_RequestedProcedureDescription, DCM_RequestedProcedureCodeSequence, dataset ) || ReferencedStudyOrPatientSequenceIsAbsentOrExistentButNonEmptyAndIncomplete( DCM_ReferencedStudySequence, dataset ) || ReferencedStudyOrPatientSequenceIsAbsentOrExistentButNonEmptyAndIncomplete( DCM_ReferencedPatientSequence, dataset ) ) complete = OFFalse; } // return result return( complete ); } // ---------------------------------------------------------------------------- OFBool WlmFileSystemInteractionManager::ReferencedStudyOrPatientSequenceIsAbsentOrExistentButNonEmptyAndIncomplete( DcmTagKey sequenceTagKey, DcmItem *dset ) // Date : May 4, 2005 // Author : Thomas Wilkens // Task : This function checks if the specified sequence attribute is absent or existent but non-empty // and incomplete in the given dataset. // Parameters : sequenceTagKey - [in] The sequence attribute which shall be checked. // dset - [in] The dataset in which the attribute is contained. // Return Value : OFTrue in case the sequence attribute is absent (and cannot be added to the dataset) // or existent but non-empty and incomplete, OFFalse otherwise. { DcmElement *sequence = NULL; OFBool result; // check whether the type 2 sequence attribute is absent if( dset->findAndGetElement( sequenceTagKey, sequence ).bad() ) { // try to add it to the dataset and return OFFalse if successful if (dset->insertEmptyElement(sequenceTagKey).good()) { DCMWLM_INFO("Added missing type 2 sequence attribute (" << STD_NAMESPACE hex << STD_NAMESPACE setw(4) << STD_NAMESPACE setfill('0') << sequenceTagKey.getGroup() << "," << STD_NAMESPACE hex << STD_NAMESPACE setw(4) << STD_NAMESPACE setfill('0') << sequenceTagKey.getElement() << ") to the current record."); result = OFFalse; } else result = OFTrue; } else { // if the sequence attribute is existent but empty, we want to return OFFalse // (note that the sequence is actually type 2, so being empty is ok) if( ((DcmSequenceOfItems*)sequence)->card() == 0 ) result = OFFalse; else { // if the sequence attribute is existent and non-empty, we need // to check every item in the sequence for completeness result = OFFalse; for( unsigned long i=0 ; i<((DcmSequenceOfItems*)sequence)->card() && !result ; i++ ) { if( AttributeIsAbsentOrEmpty( DCM_ReferencedSOPClassUID, ((DcmSequenceOfItems*)sequence)->getItem(i) ) || AttributeIsAbsentOrEmpty( DCM_ReferencedSOPInstanceUID, ((DcmSequenceOfItems*)sequence)->getItem(i) ) ) result = OFTrue; } } } // return result return( result ); } // ---------------------------------------------------------------------------- OFBool WlmFileSystemInteractionManager::DescriptionAndCodeSequenceAttributesAreIncomplete( DcmTagKey descriptionTagKey, DcmTagKey codeSequenceTagKey, DcmItem *dset ) // Date : May 4, 2005 // Author : Thomas Wilkens // Task : This function checks if the specified description and code sequence attribute are both incomplete in the given dataset. // Parameters : descriptionTagKey - [in] The description attribute which shall be checked. // codeSequenceTagKey - [in] The codeSequence attribute which shall be checked. // dset - [in] The dataset in which the attributes are contained. // Return Value : OFTrue in case both attributes are incomplete, OFFalse otherwise. { DcmElement *codeSequence = NULL; // check if the code sequence attribute is complete, // i.e. if complete information can be retrieved from this attribute // if the attribute is not existent or has no items, we consider it incomplete OFBool codeSequenceComplete = OFTrue; if( dset->findAndGetElement( codeSequenceTagKey, codeSequence ).bad() || ((DcmSequenceOfItems*)codeSequence)->card() == 0 ) codeSequenceComplete = OFFalse; else { // if it is existent and has items, check every item for completeness for( unsigned long i=0 ; i<((DcmSequenceOfItems*)codeSequence)->card() && codeSequenceComplete ; i++ ) { if( AttributeIsAbsentOrEmpty( DCM_CodeValue, ((DcmSequenceOfItems*)codeSequence)->getItem(i) ) || AttributeIsAbsentOrEmpty( DCM_CodingSchemeDesignator, ((DcmSequenceOfItems*)codeSequence)->getItem(i) ) ) codeSequenceComplete = OFFalse; } } // now check the above condition if( !codeSequenceComplete && AttributeIsAbsentOrEmpty( descriptionTagKey, dset ) ) return( OFTrue ); else return( OFFalse ); } // ---------------------------------------------------------------------------- OFBool WlmFileSystemInteractionManager::AttributeIsAbsentOrEmpty( DcmTagKey elemTagKey, DcmItem *dset ) // Date : May 4, 2005 // Author : Thomas Wilkens // Task : This function checks if the specified attribute is absent or contains an empty value in the given dataset. // Parameters : elemTagKey - [in] The attribute which shall be checked. // dset - [in] The dataset in which the attribute is contained. // Return Value : OFTrue in case the attribute is absent or contains an empty value, OFFalse otherwise. { DcmElement *elem = NULL; if( dset->findAndGetElement( elemTagKey, elem ).bad() || elem->getLength() == 0 ) return( OFTrue ); else return( OFFalse ); } // ---------------------------------------------------------------------------- OFBool WlmFileSystemInteractionManager::DatasetMatchesSearchMask( DcmDataset *dataset, DcmDataset *searchMask ) // Date : July 11, 2002 // Author : Thomas Wilkens // Task : This function returns OFTrue, if the matching key attribute values in the // dataset match the matching key attribute values in the search mask. // Parameters : dataset - [in] The dataset which shall be checked. // searchMask - [in] The search mask. // Return Value : OFTrue - The dataset matches the search mask in the matching key attribute values. // OFFalse - The dataset does not match the search mask in the matching key attribute values. { OFBool dateTimeMatchHasBeenPerformed = OFFalse; // initialize result variable OFBool matchFound = OFTrue; // determine matching key attribute values in the dataset const char **mkaValuesDataset = NULL; DetermineMatchingKeyAttributeValues( dataset, mkaValuesDataset ); // determine matching key attribute values in the search mask const char **mkaValuesSearchMask = NULL; DetermineMatchingKeyAttributeValues( searchMask, mkaValuesSearchMask ); // go through the arrays of matching key attribute values for( unsigned long i=0 ; i<NUMBER_OF_SUPPORTED_MATCHING_KEY_ATTRIBUTES && matchFound ; i++ ) { // check if the current matching key attribute actually had a value in the search mask if( mkaValuesSearchMask[i] != NULL ) { // if it did, check if the values from search mask and dataset match switch( i ) { case 0: // matching key attribute is DCM_ScheduledStationAETitle (AE, 1-n) matchFound = ScheduledStationAETitlesMatch( mkaValuesDataset[0], mkaValuesSearchMask[0] ); break; case 1: case 2: // matching key attributes are DCM_ScheduledProcedureStepStartDate (DA, 1) // and DCM_ScheduledProcedureStepStartTime (TM, 1) // only do something if a date time match has not yet been performed if( !dateTimeMatchHasBeenPerformed ) { matchFound = ScheduledProcedureStepStartDateTimesMatch( mkaValuesDataset[1], mkaValuesDataset[2], mkaValuesSearchMask[1], mkaValuesSearchMask[2] ); dateTimeMatchHasBeenPerformed = OFTrue; } break; case 3: // matching key attribute is DCM_Modality (CS, 1) matchFound = ModalitiesMatch( mkaValuesDataset[3], mkaValuesSearchMask[3] ); break; case 4: // matching key attribute is DCM_ScheduledPerformingPhysiciansName (PN, 1) matchFound = ScheduledPerformingPhysiciansNamesMatch( mkaValuesDataset[4], mkaValuesSearchMask[4] ); break; case 5: // matching key attribute is DCM_PatientsName (PN, 1) matchFound = PatientsNamesMatch( mkaValuesDataset[5], mkaValuesSearchMask[5] ); break; case 6: // matching key attribute is DCM_PatientID (LO, 1) matchFound = PatientIdsMatch( mkaValuesDataset[6], mkaValuesSearchMask[6] ); break; case 7: // matching key attribute is DCM_AccessionNumber (SH, 2) matchFound = AccessionNumbersMatch( mkaValuesDataset[7], mkaValuesSearchMask[7] ); break; case 8: // matching key attribute is DCM_RequestedProcedureID (SH, 1) matchFound = RequestedProcedureIdsMatch( mkaValuesDataset[8], mkaValuesSearchMask[8] ); break; case 9: // matching key attribute is DCM_ReferringPhysiciansName (PN, 2) matchFound = ReferringPhysiciansNamesMatch( mkaValuesDataset[9], mkaValuesSearchMask[9] ); break; case 10: // matching key attribute is DCM_PatientsSex (CS, 2) matchFound = PatientsSexesMatch( mkaValuesDataset[10], mkaValuesSearchMask[10] ); break; case 11: // matching key attribute is DCM_RequestingPhysician (PN, 2) matchFound = RequestingPhysiciansMatch( mkaValuesDataset[11], mkaValuesSearchMask[11] ); break; case 12: // matching key attribute is DCM_AdmissionID (LO, 2) matchFound = AdmissionIdsMatch( mkaValuesDataset[12], mkaValuesSearchMask[12] ); break; case 13: // matching key attribute is DCM_RequestedProcedurePriority (SH, 2) matchFound = RequestedProcedurePrioritiesMatch( mkaValuesDataset[13], mkaValuesSearchMask[13] ); break; case 14: // matching key attribute is DCM_PatientsBirthDate (DA, 2) matchFound = PatientsBirthDatesMatch( mkaValuesDataset[14], mkaValuesSearchMask[14] ); break; default: break; } } } // return result return( matchFound ); } // ---------------------------------------------------------------------------- void WlmFileSystemInteractionManager::DetermineMatchingKeyAttributeValues( DcmDataset *dataset, const char **&matchingKeyAttrValues ) // Date : July 12, 2002 // Author : Thomas Wilkens // Task : This function determines the values of the matching key attributes in the given dataset. // Parameters : dataset - [in] Dataset from which the values shall be extracted. // matchingKeyAttrValues - [out] Contains in the end the values of the matching key // attributes in the search mask. Is an array of pointers. // Return Value : none. { // Initialize array of strings because all currently // supported matching key attributes are strings matchingKeyAttrValues = new const char*[ NUMBER_OF_SUPPORTED_MATCHING_KEY_ATTRIBUTES ]; // find matching key attributes in the dataset and remember their values. for( unsigned long i=0 ; i<NUMBER_OF_SUPPORTED_MATCHING_KEY_ATTRIBUTES ; i++ ) { // initialize array field matchingKeyAttrValues[i] = NULL; // determine which matching key attribute we want to find DcmTagKey tag; switch( i ) { case 0 : tag = DCM_ScheduledStationAETitle ; break; case 1 : tag = DCM_ScheduledProcedureStepStartDate ; break; case 2 : tag = DCM_ScheduledProcedureStepStartTime ; break; case 3 : tag = DCM_Modality ; break; case 4 : tag = DCM_ScheduledPerformingPhysiciansName ; break; case 5 : tag = DCM_PatientsName ; break; case 6 : tag = DCM_PatientID ; break; case 7 : tag = DCM_AccessionNumber ; break; case 8 : tag = DCM_RequestedProcedureID ; break; case 9 : tag = DCM_ReferringPhysiciansName ; break; case 10 : tag = DCM_PatientsSex ; break; case 11 : tag = DCM_RequestingPhysician ; break; case 12 : tag = DCM_AdmissionID ; break; case 13 : tag = DCM_RequestedProcedurePriority ; break; case 14 : tag = DCM_PatientsBirthDate ; break; default: break; } // try to find matching key attribute in the dataset dataset->findAndGetString( tag, matchingKeyAttrValues[i], OFTrue ); } } // ---------------------------------------------------------------------------- OFBool WlmFileSystemInteractionManager::ScheduledStationAETitlesMatch( const char *datasetValue, const char *searchMaskValue ) // Date : July 12, 2002 // Author : Thomas Wilkens // Task : This function returns OFTrue if the dataset's and the search mask's values in // attribute scheduled station AE title match; otherwise OFFalse will be returned. // Parameters : datasetValue - [in] Value for the corresponding attribute in the dataset; might be NULL. // searchMaskValue - [in] Value for the corresponding attribute in the search mask; never NULL. // Return Value : OFTrue if the values match, OFFalse otherwise. { // if there is a value in the dataset, perform case sensitive single value matching if( datasetValue != NULL ) return( CaseSensitiveSingleValueMatch( datasetValue, searchMaskValue ) ); else { // if datasetValue is not existent, the search mask's value has to be empty to have // a match (universal matching); in all other cases, we do not have a match if( strcmp( searchMaskValue, "" ) == 0 ) return( OFTrue ); else return( OFFalse ); } } // ---------------------------------------------------------------------------- OFBool WlmFileSystemInteractionManager::ScheduledProcedureStepStartDateTimesMatch( const char *datasetDateValue, const char *datasetTimeValue, const char *searchMaskDateValue, const char *searchMaskTimeValue ) // Date : July 15, 2002 // Author : Thomas Wilkens // Task : This function returns OFTrue if the dataset's and the search mask's values in // attributes scheduled procedure step start date and scheduled procedure step // start time match; otherwise OFFalse will be returned. // Parameters : datasetDateValue - [in] Value for the corresponding attribute in the dataset; might be NULL. // datasetTimeValue - [in] Value for the corresponding attribute in the dataset; might be NULL. // searchMaskDateValue - [in] Value for the corresponding attribute in the search mask; might be NULL. // searchMaskTimeValue - [in] Value for the corresponding attribute in the search mask; might be NULL. // Return Value : OFTrue if the values match, OFFalse otherwise. { OFBool isMatch = OFFalse; // four things are of interest before matching OFBool dateGiven = ( searchMaskDateValue != NULL ) ? OFTrue : OFFalse; OFBool timeGiven = ( searchMaskTimeValue != NULL ) ? OFTrue : OFFalse; OFBool dateIsDateRange = ( dateGiven && strchr( searchMaskDateValue, '-' ) != NULL ) ? OFTrue : OFFalse; OFBool timeIsTimeRange = ( timeGiven && strchr( searchMaskTimeValue, '-' ) != NULL ) ? OFTrue : OFFalse; // depending on these four things perform different kinds of matching if( dateIsDateRange && timeIsTimeRange ) { // perform range matching taking into account date and time isMatch = DateTimeRangeMatch( datasetDateValue, datasetTimeValue, searchMaskDateValue, searchMaskTimeValue ); } else if( dateIsDateRange && !timeIsTimeRange ) { // perform range matching taking into account date only isMatch = DateRangeMatch( datasetDateValue, searchMaskDateValue ); } else if( dateGiven && !dateIsDateRange && timeIsTimeRange ) { // perform a date single value match and a time range match isMatch = DateSingleValueMatch( datasetDateValue, searchMaskDateValue ) && TimeRangeMatch( datasetTimeValue, searchMaskTimeValue ); } else if( !dateGiven && !dateIsDateRange && timeIsTimeRange ) { // perform range matching taking into account time only isMatch = TimeRangeMatch( datasetTimeValue, searchMaskTimeValue ); } else if( dateGiven && !dateIsDateRange && timeGiven && !timeIsTimeRange ) { // perform single value matching taking into account date and time isMatch = DateTimeSingleValueMatch( datasetDateValue, datasetTimeValue, searchMaskDateValue, searchMaskTimeValue ); } else if( dateGiven && !dateIsDateRange && !timeGiven && !timeIsTimeRange ) { // perform single value matching taking into account date only isMatch = DateSingleValueMatch( datasetDateValue, searchMaskDateValue ); } else if( !dateGiven && timeGiven && !timeIsTimeRange && !dateIsDateRange ) { // perform single value matching taking into account time only isMatch = TimeSingleValueMatch( datasetTimeValue, searchMaskTimeValue ); } else // if( !dateGiven && !timeGiven && !dateIsDateRange && !timeIsTimeRange ) // this case can actually never happen, because either time or date will always be given in this function { // return OFTrue isMatch = OFTrue; } // return result return( isMatch ); } // ---------------------------------------------------------------------------- OFBool WlmFileSystemInteractionManager::ModalitiesMatch( const char *datasetValue, const char *searchMaskValue ) // Date : July 12, 2002 // Author : Thomas Wilkens // Task : This function returns OFTrue if the dataset's and the search mask's values in // attribute modality match; otherwise OFFalse will be returned. // Parameters : datasetValue - [in] Value for the corresponding attribute in the dataset; might be NULL. // searchMaskValue - [in] Value for the corresponding attribute in the search mask; never NULL. // Return Value : OFTrue if the values match, OFFalse otherwise. { // if there is a value in the dataset, perform case sensitive single value matching if( datasetValue != NULL ) return( CaseSensitiveSingleValueMatch( datasetValue, searchMaskValue ) ); else { // if datasetValue is not existent, the search mask's value has to be empty to have // a match (universal matching); in all other cases, we do not have a match if( strcmp( searchMaskValue, "" ) == 0 ) return( OFTrue ); else return( OFFalse ); } } // ---------------------------------------------------------------------------- OFBool WlmFileSystemInteractionManager::ScheduledPerformingPhysiciansNamesMatch( const char *datasetValue, const char *searchMaskValue ) // Date : July 12, 2002 // Author : Thomas Wilkens // Task : This function returns OFTrue if the dataset's and the search mask's values in // attribute scheduled performing physician's names match; otherwise OFFalse will be returned. // Parameters : datasetValue - [in] Value for the corresponding attribute in the dataset; might be NULL. // searchMaskValue - [in] Value for the corresponding attribute in the search mask; never NULL. // Return Value : OFTrue if the values match, OFFalse otherwise. { // copy search mask value char *sv = new char[ strlen( searchMaskValue ) + 1 ]; strcpy( sv, searchMaskValue ); // strip trailing spaces sv = DU_stripTrailingSpaces( sv ); // if we are dealing with universal matching, there is always a match if( strcmp( sv, "" ) == 0 || strcmp( sv, "*" ) == 0 ) return( OFTrue ); else { // if we are not dealing with universal matching... // ...and the dataset value is not existent, there is no match if( datasetValue == NULL ) return( OFFalse ); // ...and the dataset value is existent, we have to perform case sensitive single value matching or wildcard matching else if( CaseSensitiveSingleValueMatch( datasetValue, searchMaskValue ) || WildcardMatch( datasetValue, searchMaskValue ) ) return( OFTrue ); else return( OFFalse ); } } // ---------------------------------------------------------------------------- OFBool WlmFileSystemInteractionManager::PatientsNamesMatch( const char *datasetValue, const char *searchMaskValue ) // Date : July 12, 2002 // Author : Thomas Wilkens // Task : This function returns OFTrue if the dataset's and the search mask's values in // attribute patient's names match; otherwise OFFalse will be returned. // Parameters : datasetValue - [in] Value for the corresponding attribute in the dataset; might be NULL. // searchMaskValue - [in] Value for the corresponding attribute in the search mask; never NULL. // Return Value : OFTrue if the values match, OFFalse otherwise. { // copy search mask value char *sv = new char[ strlen( searchMaskValue ) + 1 ]; strcpy( sv, searchMaskValue ); // strip trailing spaces sv = DU_stripTrailingSpaces( sv ); // if we are dealing with universal matching, there is always a match if( strcmp( sv, "" ) == 0 || strcmp( sv, "*" ) == 0 ) return( OFTrue ); else { // if we are not dealing with universal matching... // ...and the dataset value is not existent, there is no match if( datasetValue == NULL ) return( OFFalse ); // ...and the dataset value is existent, we have to perform case sensitive single value matching or wildcard matching else if( CaseSensitiveSingleValueMatch( datasetValue, searchMaskValue ) || WildcardMatch( datasetValue, searchMaskValue ) ) return( OFTrue ); else return( OFFalse ); } } // ---------------------------------------------------------------------------- OFBool WlmFileSystemInteractionManager::PatientIdsMatch( const char *datasetValue, const char *searchMaskValue ) // Date : July 12, 2002 // Author : Thomas Wilkens // Task : This function returns OFTrue if the dataset's and the search mask's values in // attribute patient id match; otherwise OFFalse will be returned. // Parameters : datasetValue - [in] Value for the corresponding attribute in the dataset; might be NULL. // searchMaskValue - [in] Value for the corresponding attribute in the search mask; never NULL. // Return Value : OFTrue if the values match, OFFalse otherwise. { // if there is a value in the dataset, perform case sensitive single value matching if( datasetValue != NULL ) return( CaseSensitiveSingleValueMatch( datasetValue, searchMaskValue ) ); else { // if datasetValue is not existent, the search mask's value has to be empty to have // a match (universal matching); in all other cases, we do not have a match if( strcmp( searchMaskValue, "" ) == 0 ) return( OFTrue ); else return( OFFalse ); } } // ---------------------------------------------------------------------------- OFBool WlmFileSystemInteractionManager::AccessionNumbersMatch( const char *datasetValue, const char *searchMaskValue ) // Date : December 22, 2003 // Author : Thomas Wilkens // Task : This function returns OFTrue if the dataset's and the search mask's values in // attribute accession number match; otherwise OFFalse will be returned. // Parameters : datasetValue - [in] Value for the corresponding attribute in the dataset; might be NULL. // searchMaskValue - [in] Value for the corresponding attribute in the search mask; never NULL. // Return Value : OFTrue if the values match, OFFalse otherwise. { // copy search mask value char *sv = new char[ strlen( searchMaskValue ) + 1 ]; strcpy( sv, searchMaskValue ); // strip trailing spaces sv = DU_stripTrailingSpaces( sv ); // if we are dealing with universal matching, there is always a match if( strcmp( sv, "" ) == 0 || strcmp( sv, "*" ) == 0 ) return( OFTrue ); else { // if we are not dealing with universal matching... // ...and the dataset value is not existent, there is no match if( datasetValue == NULL ) return( OFFalse ); // ...and the dataset value is existent, we want to perform wildcard matching else return( WildcardMatch( datasetValue, searchMaskValue ) ); } } // ---------------------------------------------------------------------------- OFBool WlmFileSystemInteractionManager::RequestedProcedureIdsMatch( const char *datasetValue, const char *searchMaskValue ) // Date : December 22, 2003 // Author : Thomas Wilkens // Task : This function returns OFTrue if the dataset's and the search mask's values in // attribute requested procedure id match; otherwise OFFalse will be returned. // Parameters : datasetValue - [in] Value for the corresponding attribute in the dataset; might be NULL. // searchMaskValue - [in] Value for the corresponding attribute in the search mask; never NULL. // Return Value : OFTrue if the values match, OFFalse otherwise. { // copy search mask value char *sv = new char[ strlen( searchMaskValue ) + 1 ]; strcpy( sv, searchMaskValue ); // strip trailing spaces sv = DU_stripTrailingSpaces( sv ); // if we are dealing with universal matching, there is always a match if( strcmp( sv, "" ) == 0 || strcmp( sv, "*" ) == 0 ) return( OFTrue ); else { // if we are not dealing with universal matching... // ...and the dataset value is not existent, there is no match if( datasetValue == NULL ) return( OFFalse ); // ...and the dataset value is existent, we want to perform wildcard matching else return( WildcardMatch( datasetValue, searchMaskValue ) ); } } // ---------------------------------------------------------------------------- OFBool WlmFileSystemInteractionManager::ReferringPhysiciansNamesMatch( const char *datasetValue, const char *searchMaskValue ) // Date : December 22, 2003 // Author : Thomas Wilkens // Task : This function returns OFTrue if the dataset's and the search mask's values in // attribute referring physician's name match; otherwise OFFalse will be returned. // Parameters : datasetValue - [in] Value for the corresponding attribute in the dataset; might be NULL. // searchMaskValue - [in] Value for the corresponding attribute in the search mask; never NULL. // Return Value : OFTrue if the values match, OFFalse otherwise. { // copy search mask value char *sv = new char[ strlen( searchMaskValue ) + 1 ]; strcpy( sv, searchMaskValue ); // strip trailing spaces sv = DU_stripTrailingSpaces( sv ); // if we are dealing with universal matching, there is always a match if( strcmp( sv, "" ) == 0 || strcmp( sv, "*" ) == 0 ) return( OFTrue ); else { // if we are not dealing with universal matching... // ...and the dataset value is not existent, there is no match if( datasetValue == NULL ) return( OFFalse ); // ...and the dataset value is existent, we want to perform wildcard matching else return( WildcardMatch( datasetValue, searchMaskValue ) ); } } // ---------------------------------------------------------------------------- OFBool WlmFileSystemInteractionManager::PatientsSexesMatch( const char *datasetValue, const char *searchMaskValue ) // Date : December 22, 2003 // Author : Thomas Wilkens // Task : This function returns OFTrue if the dataset's and the search mask's values in // attribute patient sex match; otherwise OFFalse will be returned. // Parameters : datasetValue - [in] Value for the corresponding attribute in the dataset; might be NULL. // searchMaskValue - [in] Value for the corresponding attribute in the search mask; never NULL. // Return Value : OFTrue if the values match, OFFalse otherwise. { // copy search mask value char *sv = new char[ strlen( searchMaskValue ) + 1 ]; strcpy( sv, searchMaskValue ); // strip trailing spaces sv = DU_stripTrailingSpaces( sv ); // if we are dealing with universal matching, there is always a match if( strcmp( sv, "" ) == 0 || strcmp( sv, "*" ) == 0 ) return( OFTrue ); else { // if we are not dealing with universal matching... // ...and the dataset value is not existent, there is no match if( datasetValue == NULL ) return( OFFalse ); // ...and the dataset value is existent, we want to perform wildcard matching else return( WildcardMatch( datasetValue, searchMaskValue ) ); } } // ---------------------------------------------------------------------------- OFBool WlmFileSystemInteractionManager::RequestingPhysiciansMatch( const char *datasetValue, const char *searchMaskValue ) // Date : December 22, 2003 // Author : Thomas Wilkens // Task : This function returns OFTrue if the dataset's and the search mask's values in // attribute requesting physician match; otherwise OFFalse will be returned. // Parameters : datasetValue - [in] Value for the corresponding attribute in the dataset; might be NULL. // searchMaskValue - [in] Value for the corresponding attribute in the search mask; never NULL. // Return Value : OFTrue if the values match, OFFalse otherwise. { // copy search mask value char *sv = new char[ strlen( searchMaskValue ) + 1 ]; strcpy( sv, searchMaskValue ); // strip trailing spaces sv = DU_stripTrailingSpaces( sv ); // if we are dealing with universal matching, there is always a match if( strcmp( sv, "" ) == 0 || strcmp( sv, "*" ) == 0 ) return( OFTrue ); else { // if we are not dealing with universal matching... // ...and the dataset value is not existent, there is no match if( datasetValue == NULL ) return( OFFalse ); // ...and the dataset value is existent, we want to perform wildcard matching else return( WildcardMatch( datasetValue, searchMaskValue ) ); } } // ---------------------------------------------------------------------------- OFBool WlmFileSystemInteractionManager::AdmissionIdsMatch( const char *datasetValue, const char *searchMaskValue ) // Date : December 22, 2003 // Author : Thomas Wilkens // Task : This function returns OFTrue if the dataset's and the search mask's values in // attribute admission id match; otherwise OFFalse will be returned. // Parameters : datasetValue - [in] Value for the corresponding attribute in the dataset; might be NULL. // searchMaskValue - [in] Value for the corresponding attribute in the search mask; never NULL. // Return Value : OFTrue if the values match, OFFalse otherwise. { // copy search mask value char *sv = new char[ strlen( searchMaskValue ) + 1 ]; strcpy( sv, searchMaskValue ); // strip trailing spaces sv = DU_stripTrailingSpaces( sv ); // if we are dealing with universal matching, there is always a match if( strcmp( sv, "" ) == 0 || strcmp( sv, "*" ) == 0 ) return( OFTrue ); else { // if we are not dealing with universal matching... // ...and the dataset value is not existent, there is no match if( datasetValue == NULL ) return( OFFalse ); // ...and the dataset value is existent, we want to perform wildcard matching else return( WildcardMatch( datasetValue, searchMaskValue ) ); } } // ---------------------------------------------------------------------------- OFBool WlmFileSystemInteractionManager::RequestedProcedurePrioritiesMatch( const char *datasetValue, const char *searchMaskValue ) // Date : December 22, 2003 // Author : Thomas Wilkens // Task : This function returns OFTrue if the dataset's and the search mask's values in // attribute requested procedure priorities match; otherwise OFFalse will be returned. // Parameters : datasetValue - [in] Value for the corresponding attribute in the dataset; might be NULL. // searchMaskValue - [in] Value for the corresponding attribute in the search mask; never NULL. // Return Value : OFTrue if the values match, OFFalse otherwise. { // copy search mask value char *sv = new char[ strlen( searchMaskValue ) + 1 ]; strcpy( sv, searchMaskValue ); // strip trailing spaces sv = DU_stripTrailingSpaces( sv ); // if we are dealing with universal matching, there is always a match if( strcmp( sv, "" ) == 0 || strcmp( sv, "*" ) == 0 ) return( OFTrue ); else { // if we are not dealing with universal matching... // ...and the dataset value is not existent, there is no match if( datasetValue == NULL ) return( OFFalse ); // ...and the dataset value is existent, we want to perform wildcard matching else return( WildcardMatch( datasetValue, searchMaskValue ) ); } } // ---------------------------------------------------------------------------- OFBool WlmFileSystemInteractionManager::PatientsBirthDatesMatch( const char *datasetValue, const char *searchMaskValue ) // Date : September 23, 2005 // Author : Thomas Wilkens // Task : This function returns OFTrue if the dataset's and the search mask's values in // attribute patient's birth date match; otherwise OFFalse will be returned. // Parameters : datasetValue - [in] Value for the corresponding attribute in the dataset; might be NULL. // searchMaskValue - [in] Value for the corresponding attribute in the search mask; never NULL. // Return Value : OFTrue if the values match, OFFalse otherwise. { OFBool isMatch = OFFalse; // before matching, determine if the date value is a date range value OFBool dateIsDateRange = ( strchr( searchMaskValue, '-' ) != NULL ) ? OFTrue : OFFalse; // depending upon this information, perform different kinds of matching if( dateIsDateRange ) { // perform range matching isMatch = DateRangeMatch( datasetValue, searchMaskValue ); } else { // perform single value matching isMatch = DateSingleValueMatch( datasetValue, searchMaskValue ); } // return result return( isMatch ); } // ---------------------------------------------------------------------------- OFBool WlmFileSystemInteractionManager::DateTimeRangeMatch( const char *datasetDateValue, const char *datasetTimeValue, const char *searchMaskDateValue, const char *searchMaskTimeValue ) // Date : July 15, 2002 // Author : Thomas Wilkens // Task : This function performs a date time range match and returns OFTrue if the dataset's // and the search mask's values in the corresponding attributes match; otherwise OFFalse // will be returned // Parameters : datasetDateValue - [in] Value for the corresponding attribute in the dataset; might be NULL. // datasetTimeValue - [in] Value for the corresponding attribute in the dataset; might be NULL. // searchMaskDateValue - [in] Value for the corresponding attribute in the search mask; never NULL. // searchMaskTimeValue - [in] Value for the corresponding attribute in the search mask; never NULL. // Return Value : OFTrue if the values match, OFFalse otherwise. { char *sdvv1 = NULL, *sdvv2 = NULL, *stvv1 = NULL, *stvv2 = NULL; OFDate datasetDateVal, searchMaskDateVal1, searchMaskDateVal2; OFTime datasetTimeVal, searchMaskTimeVal1, searchMaskTimeVal2; OFCondition cond; // if values in dataset are both given, perform date time range match if( datasetDateValue != NULL && datasetTimeValue != NULL ) { // initialize result OFBool isMatch = OFFalse; // copy values char *ddv = new char[ strlen( datasetDateValue ) + 1 ]; strcpy( ddv, datasetDateValue ); char *dtv = new char[ strlen( datasetTimeValue ) + 1 ]; strcpy( dtv, datasetTimeValue ); char *sdv = new char[ strlen( searchMaskDateValue ) + 1 ]; strcpy( sdv, searchMaskDateValue ); char *stv = new char[ strlen( searchMaskTimeValue ) + 1 ]; strcpy( stv, searchMaskTimeValue ); // strip trailing spaces ddv = DU_stripTrailingSpaces( ddv ); dtv = DU_stripTrailingSpaces( dtv ); sdv = DU_stripTrailingSpaces( sdv ); stv = DU_stripTrailingSpaces( stv ); // get actual date/time boundary values ExtractValuesFromRange( sdv, sdvv1, sdvv2 ); ExtractValuesFromRange( stv, stvv1, stvv2 ); // generate OFDate and OFTime objects from strings cond = DcmDate::getOFDateFromString( OFString( ddv ), datasetDateVal ); if( cond.good() ) { cond = DcmTime::getOFTimeFromString( OFString( dtv ), datasetTimeVal ); if( cond.good() ) { cond = DcmDate::getOFDateFromString( (( sdvv1 != NULL ) ? OFString( sdvv1 ) : OFString("19000101")), searchMaskDateVal1 ); if( cond.good() ) { cond = DcmDate::getOFDateFromString( (( sdvv2 != NULL ) ? OFString( sdvv2 ) : OFString("39991231")), searchMaskDateVal2 ); if( cond.good() ) { cond = DcmTime::getOFTimeFromString( (( stvv1 != NULL ) ? OFString( stvv1 ) : OFString("000000")), searchMaskTimeVal1 ); if( cond.good() ) { cond = DcmTime::getOFTimeFromString( (( stvv2 != NULL ) ? OFString( stvv2 ) : OFString("235959")), searchMaskTimeVal2 ); if( cond.good() ) { // now that we have the date and time objects we can actually // compare the date and time values and determine if it's a match // check if the lower value in the search mask is earlier // than or equal to the lower value in the dataset if( searchMaskDateVal1 < datasetDateVal || ( searchMaskDateVal1 == datasetDateVal && searchMaskTimeVal1 <= datasetTimeVal ) ) { // now check if the upper value in the search mask is later // than or equal to the upper value in the dataset if( searchMaskDateVal2 > datasetDateVal || ( searchMaskDateVal2 == datasetDateVal && searchMaskTimeVal2 >= datasetTimeVal ) ) { // if all these conditions are met, then this is considered to be a match isMatch = OFTrue; } } } } } } } } // free memory delete ddv; delete dtv; delete sdv; delete stv; if( sdvv1 != NULL ) delete sdvv1; if( sdvv2 != NULL ) delete sdvv2; if( stvv1 != NULL ) delete stvv1; if( stvv2 != NULL ) delete stvv2; // return result return( isMatch ); } else { // so at least one of the two values (date or time) or not given in // the dataset; in this case, since the date and time values in the // search mask are both non-universal, we do not have a match return( OFFalse ); } } // ---------------------------------------------------------------------------- OFBool WlmFileSystemInteractionManager::DateRangeMatch( const char *datasetDateValue, const char *searchMaskDateValue ) // Date : July 15, 2002 // Author : Thomas Wilkens // Task : This function performs a date range match and returns OFTrue if the dataset's and // the search mask's values in the corresponding attributes match; otherwise OFFalse // will be returned // Parameters : datasetDateValue - [in] Value for the corresponding attribute in the dataset; might be NULL. // searchMaskDateValue - [in] Value for the corresponding attribute in the search mask; never NULL. // Return Value : OFTrue if the values match, OFFalse otherwise. { char *sdvv1 = NULL, *sdvv2 = NULL; OFDate datasetDateVal, searchMaskDateVal1, searchMaskDateVal2; OFCondition cond; // if date value in dataset is given, perform date range match if( datasetDateValue != NULL ) { // initialize result OFBool isMatch = OFFalse; // copy values char *ddv = new char[ strlen( datasetDateValue ) + 1 ]; strcpy( ddv, datasetDateValue ); char *sdv = new char[ strlen( searchMaskDateValue ) + 1 ]; strcpy( sdv, searchMaskDateValue ); // strip trailing spaces ddv = DU_stripTrailingSpaces( ddv ); sdv = DU_stripTrailingSpaces( sdv ); // get actual date boundary values ExtractValuesFromRange( sdv, sdvv1, sdvv2 ); // generate OFDate objects from strings cond = DcmDate::getOFDateFromString( OFString( ddv ), datasetDateVal ); if( cond.good() ) { cond = DcmDate::getOFDateFromString( (( sdvv1 != NULL ) ? OFString( sdvv1 ) : OFString("19000101")), searchMaskDateVal1 ); if( cond.good() ) { cond = DcmDate::getOFDateFromString( (( sdvv2 != NULL ) ? OFString( sdvv2 ) : OFString("39991231")), searchMaskDateVal2 ); if( cond.good() ) { // now that we have the date objects we can actually // compare the date values and determine if it's a match // check if the lower value in the search mask is earlier // than or equal to the lower value in the dataset if( searchMaskDateVal1 <= datasetDateVal ) { // now check if the upper value in the search mask is later // than or equal to the upper value in the dataset if( searchMaskDateVal2 >= datasetDateVal ) { // if these conditions are met, then this is considered to be a match isMatch = OFTrue; } } } } } // free memory delete ddv; delete sdv; if( sdvv1 != NULL ) delete sdvv1; if( sdvv2 != NULL ) delete sdvv2; // return result return( isMatch ); } else { // so dataset date value is not given; in this case, since the date // value in the search mask is non-universal, we do not have a match return( OFFalse ); } } // ---------------------------------------------------------------------------- OFBool WlmFileSystemInteractionManager::TimeRangeMatch( const char *datasetTimeValue, const char *searchMaskTimeValue ) // Date : July 15, 2002 // Author : Thomas Wilkens // Task : This function performs a time range match and returns OFTrue if the dataset's and // the search mask's values in the corresponding attributes match; otherwise OFFalse // will be returned // Parameters : datasetTimeValue - [in] Value for the corresponding attribute in the dataset; might be NULL. // searchMaskTimeValue - [in] Value for the corresponding attribute in the search mask; never NULL. // Return Value : OFTrue if the values match, OFFalse otherwise. { char *stvv1 = NULL, *stvv2 = NULL; OFTime datasetTimeVal, searchMaskTimeVal1, searchMaskTimeVal2; OFCondition cond; // if time value in dataset is given, perform date range match if( datasetTimeValue != NULL ) { // initialize result OFBool isMatch = OFFalse; // copy values char *dtv = new char[ strlen( datasetTimeValue ) + 1 ]; strcpy( dtv, datasetTimeValue ); char *stv = new char[ strlen( searchMaskTimeValue ) + 1 ]; strcpy( stv, searchMaskTimeValue ); // strip trailing spaces dtv = DU_stripTrailingSpaces( dtv ); stv = DU_stripTrailingSpaces( stv ); // get actual time boundary values ExtractValuesFromRange( stv, stvv1, stvv2 ); // generate OFTime objects from strings cond = DcmTime::getOFTimeFromString( OFString( dtv ), datasetTimeVal ); if( cond.good() ) { cond = DcmTime::getOFTimeFromString( (( stvv1 != NULL ) ? OFString( stvv1 ) : OFString("000000")), searchMaskTimeVal1 ); if( cond.good() ) { cond = DcmTime::getOFTimeFromString( (( stvv2 != NULL ) ? OFString( stvv2 ) : OFString("235959")), searchMaskTimeVal2 ); if( cond.good() ) { // now that we have the time objects we can actually // compare the time values and determine if it's a match // check if the lower value in the search mask is earlier // than or equal to the lower value in the dataset if( searchMaskTimeVal1 <= datasetTimeVal ) { // now check if the upper value in the search mask is later // than or equal to the upper value in the dataset if( searchMaskTimeVal2 >= datasetTimeVal ) { // if these conditions are met, then this is considered to be a match isMatch = OFTrue; } } } } } // free memory delete dtv; delete stv; if( stvv1 != NULL ) delete stvv1; if( stvv2 != NULL ) delete stvv2; // return result return( isMatch ); } else { // so dataset time value is not given; in this case, since the time // value in the search mask is non-universal, we do not have a match return( OFFalse ); } } // ---------------------------------------------------------------------------- OFBool WlmFileSystemInteractionManager::DateTimeSingleValueMatch( const char *datasetDateValue, const char *datasetTimeValue, const char *searchMaskDateValue, const char *searchMaskTimeValue ) // Date : July 15, 2002 // Author : Thomas Wilkens // Task : This function performs a date time single value match and returns OFTrue if the dataset's // and the search mask's values in the corresponding attributes match; otherwise OFFalse // will be returned // Parameters : datasetDateValue - [in] Value for the corresponding attribute in the dataset; might be NULL. // datasetTimeValue - [in] Value for the corresponding attribute in the dataset; might be NULL. // searchMaskDateValue - [in] Value for the corresponding attribute in the search mask; never NULL. // searchMaskTimeValue - [in] Value for the corresponding attribute in the search mask; never NULL. // Return Value : OFTrue if the values match, OFFalse otherwise. { OFDate datasetDateVal, searchMaskDateVal; OFTime datasetTimeVal, searchMaskTimeVal; OFCondition cond; // if we are dealing with universal matching in date and time, there is a match if( strcmp( searchMaskDateValue, "" ) == 0 && strcmp( searchMaskTimeValue, "" ) == 0 ) { return( OFTrue ); } else { // so we are not dealing with universal matching in date and time, we have to check both values individually OFBool dateValuesMatch = OFFalse; OFBool timeValuesMatch = OFFalse; // check date values if( strcmp( searchMaskDateValue, "" ) == 0 ) { // a universal date always matches dateValuesMatch = OFTrue; } else { // so we do not have a universal date if( datasetDateValue == NULL ) { // if there is no date value in the dataset, the non-universal date is not matched dateValuesMatch = OFFalse; } else { // in this case that we are dealing with a non-universal date and a // date value in the dataset, perform the date match // copy values char *ddv = new char[ strlen( datasetDateValue ) + 1 ]; strcpy( ddv, datasetDateValue ); char *sdv = new char[ strlen( searchMaskDateValue ) + 1 ]; strcpy( sdv, searchMaskDateValue ); // strip trailing spaces ddv = DU_stripTrailingSpaces( ddv ); sdv = DU_stripTrailingSpaces( sdv ); // generate OFDate objects from strings cond = DcmDate::getOFDateFromString( OFString( ddv ), datasetDateVal ); if( cond.good() ) { cond = DcmDate::getOFDateFromString( OFString( sdv ), searchMaskDateVal ); if( cond.good() ) { // now that we have the date objects we can actually // compare the date values and determine if it's a match // check if the date value in the search mask equals the date value in the dataset if( searchMaskDateVal == datasetDateVal ) { // if these conditions are met, then this is considered to be a match dateValuesMatch = OFTrue; } } } // free memory delete ddv; delete sdv; } } // check time values if( strcmp( searchMaskTimeValue, "" ) == 0 ) { // a universal time always matches timeValuesMatch = OFTrue; } else { // so we do not have a universal time if( datasetTimeValue == NULL ) { // if there is no time value in the dataset, the non-universal time is not matched timeValuesMatch = OFFalse; } else { // in this case that we are dealing with a non-universal time and a // time value in the dataset, perform the time match // copy values char *dtv = new char[ strlen( datasetTimeValue ) + 1 ]; strcpy( dtv, datasetTimeValue ); char *stv = new char[ strlen( searchMaskTimeValue ) + 1 ]; strcpy( stv, searchMaskTimeValue ); // strip trailing spaces dtv = DU_stripTrailingSpaces( dtv ); stv = DU_stripTrailingSpaces( stv ); // generate OFTime objects from strings cond = DcmTime::getOFTimeFromString( OFString( dtv ), datasetTimeVal ); if( cond.good() ) { cond = DcmTime::getOFTimeFromString( OFString( stv ), searchMaskTimeVal ); if( cond.good() ) { // now that we have the time objects we can actually // compare the time values and determine if it's a match // check if the time value in the search mask equals the time value in the dataset if( searchMaskTimeVal == datasetTimeVal ) { // if these conditions are met, then this is considered to be a match timeValuesMatch = OFTrue; } } } // free memory delete dtv; delete stv; } } // in case date and time values match, we have a match if( dateValuesMatch && timeValuesMatch ) return( OFTrue ); else return( OFFalse ); } } // ---------------------------------------------------------------------------- OFBool WlmFileSystemInteractionManager::DateSingleValueMatch( const char *datasetDateValue, const char *searchMaskDateValue ) // Date : July 15, 2002 // Author : Thomas Wilkens // Task : This function performs a date single value match and returns OFTrue if the dataset's // and the search mask's values in the corresponding attributes match; otherwise OFFalse // will be returned // Parameters : datasetDateValue - [in] Value for the corresponding attribute in the dataset; might be NULL. // searchMaskDateValue - [in] Value for the corresponding attribute in the search mask; never NULL. // Return Value : OFTrue if the values match, OFFalse otherwise. { OFDate datasetDateVal, searchMaskDateVal; OFCondition cond; // if we are dealing with universal matching, there is a match if( strcmp( searchMaskDateValue, "" ) == 0 ) return( OFTrue ); else { // if we are not dealing with universal matching and there is a // date value in the dataset, compare the two date values if( datasetDateValue != NULL ) { // initialize result OFBool isMatch = OFFalse; // copy values char *ddv = new char[ strlen( datasetDateValue ) + 1 ]; strcpy( ddv, datasetDateValue ); char *sdv = new char[ strlen( searchMaskDateValue ) + 1 ]; strcpy( sdv, searchMaskDateValue ); // strip trailing spaces ddv = DU_stripTrailingSpaces( ddv ); sdv = DU_stripTrailingSpaces( sdv ); // generate OFDate objects from strings cond = DcmDate::getOFDateFromString( OFString( ddv ), datasetDateVal ); if( cond.good() ) { cond = DcmDate::getOFDateFromString( OFString( sdv ), searchMaskDateVal ); if( cond.good() ) { // now that we have the date objects we can actually // compare the date values and determine if it's a match // check if the date value in the search mask equals the date value in the dataset if( searchMaskDateVal == datasetDateVal ) { // if this condition is met, then this is considered to be a match isMatch = OFTrue; } } } // free memory delete ddv; delete sdv; // return result return( isMatch ); } else { // if we are not dealing with universal matching and there // is no date value in the dataset, there is no match return( OFFalse ); } } } // ---------------------------------------------------------------------------- OFBool WlmFileSystemInteractionManager::TimeSingleValueMatch( const char *datasetTimeValue, const char *searchMaskTimeValue ) // Date : July 15, 2002 // Author : Thomas Wilkens // Task : This function performs a time single value match and returns OFTrue if the dataset's // and the search mask's values in the corresponding attributes match; otherwise OFFalse // will be returned // Parameters : datasetTimeValue - [in] Value for the corresponding attribute in the dataset; might be NULL. // searchMaskTimeValue - [in] Value for the corresponding attribute in the search mask; never NULL. // Return Value : OFTrue if the values match, OFFalse otherwise. { OFTime datasetTimeVal, searchMaskTimeVal; OFCondition cond; // if we are dealing with universal matching, there is a match if( strcmp( searchMaskTimeValue, "" ) == 0 ) return( OFTrue ); else { // if we are not dealing with universal matching and there is a // time value in the dataset, compare the two date values if( datasetTimeValue != NULL ) { // initialize result OFBool isMatch = OFFalse; // copy values char *dtv = new char[ strlen( datasetTimeValue ) + 1 ]; strcpy( dtv, datasetTimeValue ); char *stv = new char[ strlen( searchMaskTimeValue ) + 1 ]; strcpy( stv, searchMaskTimeValue ); // strip trailing spaces dtv = DU_stripTrailingSpaces( dtv ); stv = DU_stripTrailingSpaces( stv ); // generate OFTime objects from strings cond = DcmTime::getOFTimeFromString( OFString( dtv ), datasetTimeVal ); if( cond.good() ) { cond = DcmTime::getOFTimeFromString( OFString( stv ), searchMaskTimeVal ); if( cond.good() ) { // now that we have the time objects we can actually // compare the time values and determine if it's a match // check if the time value in the search mask equals the time value in the dataset if( searchMaskTimeVal == datasetTimeVal ) { // if this condition is met, then this is considered to be a match isMatch = OFTrue; } } } // free memory delete dtv; delete stv; // return result return( isMatch ); } else { // if we are not dealing with universal matching and there // is no time value in the dataset, there is no match return( OFFalse ); } } } // ---------------------------------------------------------------------------- OFBool WlmFileSystemInteractionManager::CaseSensitiveSingleValueMatch( const char *datasetValue, const char *searchMaskValue ) // Date : July 12, 2002 // Author : Thomas Wilkens // Task : This function returns OFTrue if the dataset's and the search mask's values // match while performing a case sensitive single value match; otherwise OFFalse // will be returned // Parameters : datasetValue - [in] Value for the corresponding attribute in the dataset; never NULL. // searchMaskValue - [in] Value for the corresponding attribute in the search mask; never NULL. // Return Value : OFTrue if the values match, OFFalse otherwise. { // initialize result variable OFBool matchFound = OFTrue; // copy values char *dv = new char[ strlen( datasetValue ) + 1 ]; strcpy( dv, datasetValue ); char *sv = new char[ strlen( searchMaskValue ) + 1 ]; strcpy( sv, searchMaskValue ); // strip trailing spaces dv = DU_stripTrailingSpaces( dv ); sv = DU_stripTrailingSpaces( sv ); // perform match if( strcmp( dv, sv ) != 0 ) matchFound = OFFalse; // free memory delete dv; delete sv; // return result return( matchFound ); } // ---------------------------------------------------------------------------- OFBool WlmFileSystemInteractionManager::WildcardMatch( const char *datasetValue, const char *searchMaskValue ) // Date : July 12, 2002 // Author : Thomas Wilkens // Task : This function returns OFTrue if the dataset's and the search mask's values // match while performing a wildcard match; otherwise OFFalse will be returned. // Parameters : datasetValue - [in] Value for the corresponding attribute in the dataset; never NULL. // searchMaskValue - [in] Value for the corresponding attribute in the search mask; never NULL. // Return Value : OFTrue if the values match, OFFalse otherwise. { // initialize return value OFBool ok = OFFalse; // copy values char *dv = new char[ strlen( datasetValue ) + 1 ]; strcpy( dv, datasetValue ); char *sv = new char[ strlen( searchMaskValue ) + 1 ]; strcpy( sv, searchMaskValue ); // remember the pointers for delete char *dvanchor = dv; char *svanchor = sv; // strip trailing spaces dv = DU_stripTrailingSpaces( dv ); sv = DU_stripTrailingSpaces( sv ); // go through both strings character by character as long as // a) we do not see an EOS in sv AND // b) we do not see a '*' in sv AND // c) the current character in dv is equal to the // current character in the sv, or sv contains // a '?' and sv does not yet show an EOS. while( *sv != '\0' && *sv != '*' && ( *sv == *dv || ( *sv == '?' && *dv != '\0' ) ) ) { sv++; dv++; } // if the current pattern character equals the star symbol (wild card symbol) we need // to call another function. If this is not the case, ok will be set to OFTrue or // OFFalse, depending on if we got to the end of both strings in the above loop. if( *sv == '*' ) ok = MatchStarSymbol( dv, sv+1 ); else { if( *sv == '\0' && *dv == '\0' ) ok = OFTrue; else ok = OFFalse; } // free memory delete dvanchor; delete svanchor; // return result return( ok ); } // ---------------------------------------------------------------------------- OFBool WlmFileSystemInteractionManager::MatchStarSymbol( const char *dv, const char *sv ) // Date : July 12, 2002 // Author : Thomas Wilkens // Task : This function is called, if the search pattern contains a star symbol. It determines // if dv (the dataset's value) still matches sv (the search mask's value). This function // takes the star symbol in sv into account. (Note that the pattern value might contain // more wild card symbols.) The function will return OFTrue if there is a match; if there // is not a match it will return OFFalse. // Parameters : dv - [in] Dataset's value; never NULL. // sv - [in] Search mask's value (may contain wild card symbols); never NULL. // Return Value : OFTrue if the values match, OFFalse otherwise. { // initialize result value OFBool ok = OFFalse; // move pointer one char to the right as long as it points to a star symbol while( *sv == '*' ) sv++; // if we got to the end of sv, return OFTrue if( *sv == '\0' ) return OFTrue; // if there is something else at the end of sv, // we need to go ahead and compare the rest of the two strings // as long as ok equals OFFalse and we did not get to the end of the string while( !ok && *dv != '\0' ) { // if sv reveals a '?' or if both pointers refer to the same // character, we need to call WildcardMatch again, to determine a result if( *sv == '?' || *dv == *sv ) ok = WildcardMatch( dv+1, sv+1 ); // if ok still equals OFFalse, set pointer one character to the right if( !ok ) dv++; } // return result return( ok ); } // ---------------------------------------------------------------------------- void WlmFileSystemInteractionManager::ExtractValuesFromRange( const char *range, char *&lower, char *&upper ) // Date : July 15, 2002 // Author : Thomas Wilkens // Task : This function extracts the actual lower and upper date or time values from a given // date or time range. // Parameters : range - [in] Date or time range from which lower and upper values shall be extracted. // lower - [out] Newly created string specifying the lower value from the date/time range; // NULL if value is not specified in range. // upper - [out] Newly created string specifying the upper value from the date/time range; // NULL if value is not specified in range. // Return Value : none. { // get lower value const char *tmp = strchr( range, '-' ); int res = tmp - range; if( res == 0 ) lower = NULL; else { lower = new char[ res + 1 ]; strncpy( lower, range, res ); lower[res] = '\0'; } // get upper value int len = strlen( range ); if( res == len - 1 ) upper = NULL; else { upper = new char[ len - 1 - res + 1 ]; strncpy( upper, tmp + 1, len - 1 - res ); upper[len-1-res] = '\0'; } } // ---------------------------------------------------------------------------- /* ** CVS Log ** $Log: wlfsim.cc,v $ ** Revision 1.21 2010-02-15 13:11:13 joergr ** Fixed wrong output in verbose mode (string pointer instead of string value). ** ** Revision 1.20 2009-11-24 10:40:01 uli ** Switched to logging mechanism provided by the "new" oflog module. ** ** Revision 1.19 2006-12-15 14:49:28 onken ** Removed excessive use char* and C-array in favour of OFString and ** OFList. Simplified some implementation details. ** ** Revision 1.18 2006/08/15 16:15:48 meichel ** Updated the code in module dcmwlm to correctly compile when ** all standard C++ classes remain in namespace std. ** ** Revision 1.17 2006/01/27 15:07:33 joergr ** Fixed issue with missing type 2 attributes in worklist files being reported ** as incomplete. Now, the attributes are inserted automatically if required. ** Removed email address from CVS log. ** ** Revision 1.16 2005/12/08 15:48:34 meichel ** Changed include path schema for all DCMTK header files ** ** Revision 1.15 2005/09/23 12:57:02 wilkens ** Added attribute PatientsBirthDate as a matching key attribute to wlmscpfs. ** ** Revision 1.14 2005/07/01 10:01:31 wilkens ** Modified a couple of "delete" statements to "delete[]" in order to get rid of ** valgrind's "Mismatched free() / delete / delete []" error messages. ** ** Revision 1.13 2005/05/04 11:34:46 wilkens ** Added two command line options --enable-file-reject (default) and ** --disable-file-reject to wlmscpfs: these options can be used to enable or ** disable a file rejection mechanism which makes sure only complete worklist files ** will be used during the matching process. A worklist file is considered to be ** complete if it contains all necessary type 1 information which the SCP might ** have to return to an SCU in a C-Find response message. ** ** Revision 1.12 2004/01/07 08:32:34 wilkens ** Added new sequence type return key attributes to wlmscpfs. Fixed bug that for ** equally named attributes in sequences always the same value will be returned. ** Added functionality that also more than one item will be returned in sequence ** type return key attributes. ** ** Revision 1.11 2003/12/23 13:03:55 wilkens ** Integrated new matching key attributes into wlmscpfs. ** Updated matching algorithm in wlmscpfs so that universal matching key ** attributes will also lead to a match in case the corresponding attribute does ** does exist in the dataset. ** ** Revision 1.10 2003/10/13 13:28:19 meichel ** Minor code purifications, needed for Borland C++ ** ** Revision 1.9 2003/08/20 14:45:15 wilkens ** Added new class OFSetIterator, an iterator class for OFxxxSet data structures. ** ** Revision 1.8 2002/12/13 12:37:08 wilkens ** Modified code to keep Sun CC 2.0.1 happy on Solaris 2.5.1 (unreachable ** statement warning). ** ** Revision 1.7 2002/12/12 16:49:40 wilkens ** Added some code to avoid compiler warning (unsigned long passed as unsigned ** int) on Sun CC 2.0.1. ** ** Revision 1.6 2002/12/11 18:10:48 joergr ** Added const type specifier to a "char*" variable declaration to avoid ** compiler error on Sun CC 5.2. ** ** Revision 1.5 2002/12/09 13:42:22 joergr ** Renamed parameter to avoid name clash with global function index(). ** ** Revision 1.4 2002/11/28 11:04:47 meichel ** Adapted module dcmwlm to use of new header file ofstdinc.h ** ** Revision 1.3 2002/08/22 09:14:04 wilkens ** Adapted code to new loadFile and saveFile methods, thus removing direct ** use of the DICOM stream classes. ** ** Revision 1.2 2002/08/12 10:56:17 wilkens ** Made some modifications in in order to be able to create a new application ** which contains both wlmscpdb and ppsscpdb and another application which ** contains both wlmscpfs and ppsscpfs. ** ** Revision 1.1 2002/08/05 09:10:12 wilkens ** Modfified the project's structure in order to be able to create a new ** application which contains both wlmscpdb and ppsscpdb. ** ** Revision 1.1 2002/07/17 13:10:20 wilkens ** Corrected some minor logical errors in the wlmscpdb sources and completely ** updated the wlmscpfs so that it does not use the original wlistctn sources ** any more but standard wlm sources which are now used by all three variants ** of wlmscps. ** ** */
SECTION "HRAM", HRAM hTransferVirtualOAM:: ds 10 ; ff80 hROMBankBackup:: db ; ff8a hBuffer:: db ; ff8b hSRAMBank:: db ; ff8c hRTCDayHi:: db ; ff8d hRTCDayLo:: db ; ff8e hRTCHours:: db ; ff8f hRTCMinutes:: db ; ff90 hRTCSeconds:: db ; ff91 ds 2 hHours:: db ; ff94 ds 1 hMinutes:: db ; ff96 ds 1 hSeconds:: db ; ff98 ds 1 ds 1 hVBlankCounter:: db ; ff9b ds 1 hROMBank:: db ; ff9d hVBlank:: db ; ff9e hMapEntryMethod:: db ; ff9f hMenuReturn:: db ; ffa0 ds 1 hJoypadReleased:: db ; ffa2 hJoypadPressed:: db ; ffa3 hJoypadDown:: db ; ffa4 hJoypadSum:: db ; ffa5 hJoyReleased:: db ; ffa6 hJoyPressed:: db ; ffa7 hJoyDown:: db ; ffa8 hJoyLast:: db ; ffa9 hInMenu:: db ; ffaa ds 1 hPrinter:: db ; ffac hGraphicStartTile:: db ; ffad hMoveMon:: db ; ffae UNION ; ffaf hMapObjectIndexBuffer:: db ; ffaf hObjectStructIndexBuffer:: db ; ffb0 NEXTU ; ffaf hConnectionStripLength:: db ; ffaf hConnectedMapWidth:: db ; ffb0 ENDU ; ffb1 hEnemyMonSpeed:: dw ; ffb1 UNION ; ffb3 ; math-related values UNION ; ffb3 ; inputs to Multiply ds 1 hMultiplicand:: ds 3 ; ffb4 hMultiplier:: db ; ffb7 NEXTU ; ffb3 ; result of Multiply hProduct:: ds 4 ; ffb3 NEXTU ; ffb3 ; inputs to Divide hDividend:: ds 4 ; ffb3 hDivisor:: db ; ffb7 NEXTU ; ffb3 ; results of Divide hQuotient:: ds 4 ; ffb3 hRemainder:: db ; ffb7 ENDU ; ffb8 hMathBuffer:: ds 5 ; ffb8 NEXTU ; ffb3 ; PrintNum scratch space hPrintNumBuffer:: ds 10 ; ffb3 NEXTU ; ffb3 ; miscellaneous ds 9 hMGStatusFlags:: db ; ffbc ENDU ; ffbd hUsedSpriteIndex:: db ; ffbd hUsedSpriteTile:: db ; ffbe hFFBF:: db ; ffbf hFFC0:: db ; ffc0 hFFC1:: db ; ffc1 hFFC2:: db ; ffc2 UNION ; ffc3 hMoneyTemp:: ds 3 ; ffc3 NEXTU ; ffc3 hMGJoypadPressed:: db ; ffc3 hMGJoypadReleased:: db ; ffc4 ENDU ; ffc6 hLCDCPointer:: db ; ffc6 hLYOverrideStart:: db ; ffc7 hLYOverrideEnd:: db ; ffc8 hMobileReceive:: db ; ffc9 hSerialReceivedNewData:: db ; ffca hSerialConnectionStatus:: db ; ffcb hSerialIgnoringInitialData:: db ; ffcc hSerialSend:: db ; ffcd hSerialReceive:: db ; ffce hSCX:: db ; ffcf hSCY:: db ; ffd0 hWX:: db ; ffd1 hWY:: db ; ffd2 hTilesPerCycle:: db ; ffd3 hBGMapMode:: db ; ffd4 hBGMapThird:: db ; ffd5 hBGMapAddress:: dw ; ffd6 hOAMUpdate:: db ; ffd8 hSPBuffer:: dw ; ffd9 hBGMapUpdate:: db ; ffdb hBGMapTileCount:: db ; ffdc hTemp:: db ; ffdd hMapAnims:: db ; ffde hTileAnimFrame:: db ; ffdf hLastTalked:: db ; ffe0 hRandom:: IF DEF(_NEWRNG) hRandomAdd:: hRandomX:: db hRandomSub:: hRandomY:: db hRandomZ:: db hRandomA:: db ELSE hRandomAdd:: db ; ffe1 hRandomSub:: db ; ffe2 ENDC hSecondsBackup:: db ; ffe3 hBattleTurn:: ; ffe4 ; Which trainer's turn is it? 0: player, 1: opponent trainer db hCGBPalUpdate:: db ; ffe5 hCGB:: db ; ffe6 hSGB:: db ; ffe7 hDMATransfer:: db ; ffe8 hMobile:: db ; ffe9 hSystemBooted:: db ; ffea hClockResetTrigger:: db ; ffeb hSamplePlaying:: db ; ffec hSampleVolume:: db ; ffed hTimerInterrupt:: db ; ffee hBuffer2:: hMusicStore:: db ; ffef if DEF(_DEBUG) hDebugMenuCursorPos:: db hDebugMenuDataBuffer:: ds 8 endc
; A254368: a(n) = 5*2^n + 3^n + 15. ; Submitted by Jamie Morken(s2) ; 21,28,44,82,176,418,1064,2842,7856,22258,64184,187402,551936,1635298,4864904,14512762,43374416,129795538,388731224,1164882922,3492027296,10470838978,31402031144,94185121882,282513422576,847456381618,2542201372664,7626268573642,22878134632256,68633061719458,205896500803784,617684133702202,1853041663688336,5559103516228498,16677267599012504,50031716897691562,150094978894382816,450284593085764738,1350853092062526824,4052557901798045722,12157670956615067696,36473007372287064178 mov $1,3 pow $1,$0 mov $2,2 pow $2,$0 mul $2,5 add $1,$2 mov $0,$1 add $0,15
; A144479: a(0)=1, a(1)=3, a(n) = 8*a(n-1) - a(n-2). ; 1,3,23,181,1425,11219,88327,695397,5474849,43103395,339352311,2671715093,21034368433,165603232371,1303791490535,10264728691909,80814038044737,636247575665987,5009166567283159,39437084962599285 mov $1,1 lpb $0 sub $0,1 add $2,$1 add $1,$2 add $1,$2 add $2,$1 add $2,$1 lpe
#pragma once #include <memory> #include <string> #include <vector> #include <Core/RaCore.hpp> namespace Ra { namespace Core { namespace Asset { class AnimationData; class CameraData; class GeometryData; struct VolumeData; class HandleData; class LightData; class RA_CORE_API FileData final { public: /// CONSTRUCTOR FileData( const std::string& filename = "", const bool VERBOSE_MODE = false ); FileData( FileData&& data ) = default; /// DESTRUCTOR ~FileData(); /// FILENAME inline std::string getFileName() const; inline void setFileName( const std::string& filename ); /// TIMING inline Scalar getLoadingTime() const; /// DATA inline std::vector<GeometryData*> getGeometryData() const; inline std::vector<VolumeData*> getVolumeData() const; inline std::vector<HandleData*> getHandleData() const; inline std::vector<AnimationData*> getAnimationData() const; inline std::vector<LightData*> getLightData() const; inline std::vector<CameraData*> getCameraData() const; inline void setVerbose( const bool VERBOSE_MODE ); /// QUERY inline bool isInitialized() const; inline bool isProcessed() const; inline bool hasGeometry() const; inline bool hasHandle() const; inline bool hasAnimation() const; inline bool hasLight() const; inline bool hasCamera() const; inline bool isVerbose() const; /// RESET inline void reset(); inline void displayInfo() const; // TODO(Matthieu) : handle attributes in a better way than "public:" public: /// VARIABLE std::string m_filename; Scalar m_loadingTime; std::vector<std::unique_ptr<GeometryData>> m_geometryData; std::vector<std::unique_ptr<VolumeData>> m_volumeData; std::vector<std::unique_ptr<HandleData>> m_handleData; std::vector<std::unique_ptr<AnimationData>> m_animationData; std::vector<std::unique_ptr<LightData>> m_lightData; std::vector<std::unique_ptr<CameraData>> m_cameraData; bool m_processed; bool m_verbose; }; } // namespace Asset } // namespace Core } // namespace Ra #include <Core/Asset/FileData.inl>
;Exomizer 3 Z80 decoder ;Copyright (C) 2008-2018 by Jaime Tejedor Gomez (Metalbrain) ; ;Optimized by Antonio Villena and Urusergi ; ;Compression algorithm by Magnus Lind ; exomizer raw -P7 -T0 (literals=1) (reuse=0) ; exomizer raw -P7 -T1 (literals=0) (reuse=0) ; exomizer raw -P39 -T0 (literals=1) (reuse=1) ; exomizer raw -P39 -T1 (literals=0) (reuse=1) ; ; This depacker is free software; you can redistribute it and/or ; modify it under the terms of the GNU Lesser General Public ; License as published by the Free Software Foundation; either ; version 2.1 of the License, or (at your option) any later version. ; ; This library is distributed in the hope that it will be useful, ; but WITHOUT ANY WARRANTY; without even the implied warranty of ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ; Lesser General Public License for more details. ; ; You should have received a copy of the GNU Lesser General Public ; License along with this library; if not, write to the Free Software ; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ; IF mapbase-mapbase/256*256<240 AND mapbase-mapbase/256*256>135 ld iy, 256+mapbase/256*256 ELSE ld iy, (mapbase+16)/256*256+112 ENDIF xor a ; -P7/39 ;ld a, 128 ; -P15/47 ld b, 52 push de cp a init ld c, 16 jr nz, get4 ld de, 1 ld ixl, c defb 218 gb4 ld a, (hl) inc hl get4 adc a, a jr z, gb4 rl c jr nc, get4 ex af, af' ld a, c rrca inc a IF mapbase-mapbase/256*256<240 AND mapbase-mapbase/256*256>135 ld (iy-256+mapbase-mapbase/256*256), a ELSE ld (iy-112+mapbase-(mapbase+16)/256*256), a ENDIF jr nc, get5 xor 136 get5 push hl ld hl, 1 defb 56 setbit add hl, hl dec a jr nz, setbit ex af, af' IF mapbase-mapbase/256*256<240 AND mapbase-mapbase/256*256>135 ld (iy-204+mapbase-mapbase/256*256), e ld (iy-152+mapbase-mapbase/256*256), d ELSE ld (iy-60+mapbase-(mapbase+16)/256*256), e ld (iy-8+mapbase-(mapbase+16)/256*256), d ENDIF add hl, de ex de, hl inc iyl pop hl dec ixl djnz init IF reuse=1 push iy pop ix IF mapbase-mapbase/256*256<240 AND mapbase-mapbase/256*256>135 ld (ix-152+mapbase-mapbase/256*256), 1 ELSE ld (ix-6+mapbase-(mapbase+16)/256*256), 1 ENDIF scf ENDIF pop de litcop ldi mloo1 IF reuse=1 IF mapbase-mapbase/256*256<240 AND mapbase-mapbase/256*256>135 rl (ix-152+mapbase-mapbase/256*256) ELSE rl (ix-6+mapbase-(mapbase+16)/256*256) ENDIF ENDIF mloop add a, a IF reuse=0 jr z, gbm ELSE jr nz, gbm ld a, (hl) inc hl adc a, a gbm ENDIF jr c, litcop gbmc IF mapbase-mapbase/256*256<240 AND mapbase-mapbase/256*256>135 ld c, 256-1 ELSE ld c, 112-1 ENDIF getind add a, a jr z, gbi gbic inc c jr nc, getind ccf IF mapbase-mapbase/256*256<240 AND mapbase-mapbase/256*256>135 bit 4, c IF literals=1 jr nz, litcat ELSE ret nz ENDIF ELSE IF literals=1 jp m, litcat ELSE ret m ENDIF ENDIF push de ld iyl, c ld de, 0 IF mapbase-mapbase/256*256<240 AND mapbase-mapbase/256*256>135 ld b, (iy-256+mapbase-mapbase/256*256) ELSE ld b, (iy-112+mapbase-(mapbase+16)/256*256) ENDIF dec b call nz, getbits ex de, hl IF mapbase-mapbase/256*256<240 AND mapbase-mapbase/256*256>135 ld c, (iy-204+mapbase-mapbase/256*256) ld b, (iy-152+mapbase-mapbase/256*256) ELSE ld c, (iy-60+mapbase-(mapbase+16)/256*256) ld b, (iy-8+mapbase-(mapbase+16)/256*256) ENDIF add hl, bc IF reuse=1 IF mapbase-mapbase/256*256<240 AND mapbase-mapbase/256*256>135 rl (ix-152+mapbase-mapbase/256*256) ELSE rl (ix-6+mapbase-(mapbase+16)/256*256) ENDIF and a ENDIF ex de, hl push de inc d dec d jr nz,longlen IF mapbase-mapbase/256*256<240 AND mapbase-mapbase/256*256>135 ld bc, 512+48 dec e jr z, goit dec e longlen ld bc, 1024+32 jr z, goit ld c, 16 ELSE ld bc, 512+160 dec e jr z, goit dec e longlen ld bc, 1024+144 jr z, goit ld c, 128 ENDIF IF reuse=1 goit IF mapbase-mapbase/256*256<240 AND mapbase-mapbase/256*256>135 ld e, (ix-152+mapbase-mapbase/256*256) ELSE ld e, (ix-6+mapbase-(mapbase+16)/256*256) ENDIF bit 1, e jr z, aqui bit 2, e jr nz, aqui add a, a ld de, (mapbase+156) jr z, gba jr c, caof aqui ld de, 0 ELSE ld e, 0 goit ld d, e ENDIF call lee8 ld iyl, c add iy, de ld e, d IF mapbase-mapbase/256*256<240 AND mapbase-mapbase/256*256>135 ld b, (iy-256+mapbase-mapbase/256*256) ELSE ld b, (iy-112+mapbase-(mapbase+16)/256*256) ENDIF dec b call nz, getbits ex de, hl IF mapbase-mapbase/256*256<240 AND mapbase-mapbase/256*256>135 ld c, (iy-204+mapbase-mapbase/256*256) ld b, (iy-152+mapbase-mapbase/256*256) ELSE ld c, (iy-60+mapbase-(mapbase+16)/256*256) ld b, (iy-8+mapbase-(mapbase+16)/256*256) ENDIF add hl, bc IF reuse=0 ex de, hl caof ELSE ld (mapbase+156), hl ex de, hl caof and a ENDIF pop bc ex (sp), hl push hl sbc hl, de pop de ldir pop hl jr mloop IF literals=1 litcat IF mapbase-mapbase/256*256<240 AND mapbase-mapbase/256*256>135 rl c ENDIF ret pe ld b, (hl) inc hl ld c, (hl) inc hl ldir IF reuse=0 jr mloo1 ELSE scf jp mloo1 ENDIF ENDIF gbi ld a, (hl) inc hl adc a, a jp gbic IF reuse=0 gbm ld a, (hl) inc hl adc a, a jr nc, gbmc jp litcop ELSE gba ld a, (hl) inc hl adc a, a jr nc, aqui jp caof ENDIF getbits jp p, lee8 rl b jr z, gby srl b defb 250 xopy ld a, (hl) inc hl lee16 adc a, a jr z, xopy rl d djnz lee16 gby ld e, (hl) inc hl ret copy ld a, (hl) inc hl lee8 adc a, a jr z, copy rl e djnz lee8 ret
#include <antgame/World.h> #include <antgame/Ant.h> #include <easyloggingpp/easylogging++.h> #include <iostream> INITIALIZE_EASYLOGGINGPP int main(int argc, char **argv) { World world; // put some world objects into the world for ( unsigned i = 0 ; i < 10 ; ++i ) { // create a box Point point(i + 0.0f, i + 0.0f); auto newObj = std::make_shared<Ant>(point, std::to_string(i)); world.AddObject(std::move(newObj)); } for (size_t i = 0; i < 10000; i++) { world.Update(); } world.DbgPrint(); return 0; }
#ifndef MPACK_AVLITERATOR_IMPL_HPP #define MPACK_AVLITERATOR_IMPL_HPP namespace MPACK { namespace Algorithm { template<class T> AVL<T>::Iterator::Iterator() : m_avl(NULL), m_node(NULL), m_count(0) { } template<class T> AVL<T>::Iterator::Iterator(const Iterator& other) : m_avl(other.m_avl), m_node(other.m_node), m_count(other.m_count) { } template<class T> const typename AVL<T>::Iterator& AVL<T>::Iterator::operator= (const typename AVL<T>::Iterator& other) { m_avl = other.m_avl; m_node = other.m_node; m_count = other.m_count; return other; } template<class T> T AVL<T>::Iterator::operator* () const { return m_node->m_value; } template<class T> const T* AVL<T>::Iterator::operator-> () const { return &m_node->m_value; } template<class T> typename AVL<T>::Iterator& AVL<T>::Iterator::operator++ () { Next(); return *this; } template<class T> typename AVL<T>::Iterator AVL<T>::Iterator::operator++ (int) { Iterator tempIt=*this; Next(); return tempIt; } template<class T> typename AVL<T>::Iterator& AVL<T>::Iterator::operator-- () { Prev(); return *this; } template<class T> typename AVL<T>::Iterator AVL<T>::Iterator::operator-- (int) { Iterator tempIt=*this; Prev(); return tempIt; } template<class T> bool AVL<T>::Iterator::operator!= (const Iterator &other) const { return this->m_node!=other.m_node || this->m_count!=other.m_count; } template<class T> bool AVL<T>::Iterator::operator== (const Iterator &other) const { return this->m_node==other.m_node && this->m_count==other.m_count; } template<class T> AVL<T>::Iterator::Iterator(AVL<T> *avl, AVLNode<T> *node, int count) : m_avl(avl), m_node(node), m_count(count) { } template<class T> void AVL<T>::Iterator::Next() { ++m_count; if(m_count > m_node->m_count) { m_avl->m_param1 = m_node->m_value; m_node = m_avl->Next(m_avl->m_root); if(m_node) { m_count = 1; } else { m_count = 0; } } } template<class T> void AVL<T>::Iterator::Prev() { --m_count; if(m_count <= 0) { m_avl->m_param1 = m_node->m_value; m_node = m_avl->Prev(m_avl->m_root); if(m_node) { m_count = m_node->m_count; } else { m_count=0; } } } } } #endif
.global s_prepare_buffers s_prepare_buffers: push %r11 push %r12 push %r13 push %rbp push %rbx push %rcx push %rdi push %rsi lea addresses_D_ht+0x1863a, %rbp nop nop nop nop cmp $14806, %r12 mov (%rbp), %si nop nop nop nop nop and %r13, %r13 lea addresses_WC_ht+0x1697a, %rsi lea addresses_WC_ht+0x1e3a, %rdi nop nop nop nop nop xor $10042, %r13 mov $46, %rcx rep movsw nop nop nop nop nop sub %r13, %r13 lea addresses_normal_ht+0x793a, %rcx nop nop nop dec %rbx mov (%rcx), %edi add $13888, %rbx lea addresses_UC_ht+0x1aa3a, %rsi lea addresses_WC_ht+0x873a, %rdi nop and %r11, %r11 mov $8, %rcx rep movsw nop nop nop nop and $41200, %rbx lea addresses_normal_ht+0x1255a, %rdi nop nop nop and %rbp, %rbp mov $0x6162636465666768, %rbx movq %rbx, (%rdi) and %rcx, %rcx lea addresses_normal_ht+0xdf7a, %rsi lea addresses_WT_ht+0x1d4ba, %rdi nop nop nop nop nop sub $51351, %r12 mov $0, %rcx rep movsq nop sub %rbp, %rbp lea addresses_WC_ht+0xf35a, %rdi nop cmp $29716, %r12 mov (%rdi), %r11w nop nop nop nop sub %rcx, %rcx lea addresses_D_ht+0x1ba3a, %rsi lea addresses_UC_ht+0x1c43a, %rdi nop nop xor %r12, %r12 mov $43, %rcx rep movsw nop nop sub $39302, %rsi lea addresses_normal_ht+0x14f5a, %rsi lea addresses_normal_ht+0xc5f4, %rdi xor $20816, %r13 mov $121, %rcx rep movsl nop nop nop xor %rbx, %rbx lea addresses_WC_ht+0x963a, %rbp nop nop nop nop nop and %r12, %r12 movb $0x61, (%rbp) nop nop nop nop xor %r11, %r11 lea addresses_WT_ht+0x1de0a, %rsi cmp %r12, %r12 movw $0x6162, (%rsi) nop nop nop lfence lea addresses_UC_ht+0x4a3a, %r13 nop nop nop nop sub $45067, %rbx vmovups (%r13), %ymm0 vextracti128 $1, %ymm0, %xmm0 vpextrq $0, %xmm0, %rcx sub %r13, %r13 lea addresses_WC_ht+0xb83a, %rsi lea addresses_A_ht+0x10e3a, %rdi clflush (%rsi) sub %r11, %r11 mov $4, %rcx rep movsw nop nop nop nop cmp %rsi, %rsi lea addresses_normal_ht+0x1163a, %r12 nop nop nop cmp %r11, %r11 mov (%r12), %rbp nop nop nop nop sub %r13, %r13 pop %rsi pop %rdi pop %rcx pop %rbx pop %rbp pop %r13 pop %r12 pop %r11 ret .global s_faulty_load s_faulty_load: push %r10 push %r11 push %r13 push %r8 push %rbp push %rdi push %rsi // Store lea addresses_normal+0x1be3a, %rdi nop nop cmp %r11, %r11 mov $0x5152535455565758, %r8 movq %r8, %xmm1 movups %xmm1, (%rdi) nop nop nop cmp $64032, %r8 // Faulty Load lea addresses_UC+0x11e3a, %rbp nop nop nop nop nop dec %r10 vmovaps (%rbp), %ymm7 vextracti128 $0, %ymm7, %xmm7 vpextrq $0, %xmm7, %r13 lea oracles, %r11 and $0xff, %r13 shlq $12, %r13 mov (%r11,%r13,1), %r13 pop %rsi pop %rdi pop %rbp pop %r8 pop %r13 pop %r11 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_UC'}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'congruent': 11, 'AVXalign': False, 'same': False, 'size': 16, 'NT': False, 'type': 'addresses_normal'}} [Faulty Load] {'src': {'congruent': 0, 'AVXalign': True, 'same': True, 'size': 32, 'NT': False, 'type': 'addresses_UC'}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'congruent': 11, 'AVXalign': False, 'same': False, 'size': 2, 'NT': True, 'type': 'addresses_D_ht'}, 'OP': 'LOAD'} {'src': {'congruent': 5, 'same': True, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'dst': {'congruent': 7, 'same': False, 'type': 'addresses_WC_ht'}} {'src': {'congruent': 8, 'AVXalign': True, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_normal_ht'}, 'OP': 'LOAD'} {'src': {'congruent': 10, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'dst': {'congruent': 8, 'same': False, 'type': 'addresses_WC_ht'}} {'OP': 'STOR', 'dst': {'congruent': 3, 'AVXalign': False, 'same': False, 'size': 8, 'NT': False, 'type': 'addresses_normal_ht'}} {'src': {'congruent': 6, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'dst': {'congruent': 6, 'same': False, 'type': 'addresses_WT_ht'}} {'src': {'congruent': 5, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_WC_ht'}, 'OP': 'LOAD'} {'src': {'congruent': 9, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'dst': {'congruent': 6, 'same': False, 'type': 'addresses_UC_ht'}} {'src': {'congruent': 4, 'same': True, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'dst': {'congruent': 0, 'same': False, 'type': 'addresses_normal_ht'}} {'OP': 'STOR', 'dst': {'congruent': 5, 'AVXalign': False, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_WC_ht'}} {'OP': 'STOR', 'dst': {'congruent': 4, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_WT_ht'}} {'src': {'congruent': 9, 'AVXalign': False, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_UC_ht'}, 'OP': 'LOAD'} {'src': {'congruent': 9, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'dst': {'congruent': 10, 'same': False, 'type': 'addresses_A_ht'}} {'src': {'congruent': 9, 'AVXalign': False, 'same': False, 'size': 8, 'NT': False, 'type': 'addresses_normal_ht'}, 'OP': 'LOAD'} {'00': 1138, '5f': 18795, '58': 1896} 5f 5f 5f 5f 00 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 00 5f 5f 58 5f 00 00 58 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 58 5f 5f 5f 5f 5f 5f 5f 58 00 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 58 5f 58 5f 5f 5f 5f 58 5f 5f 5f 5f 5f 58 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 00 5f 5f 5f 58 00 5f 5f 00 58 5f 5f 58 5f 00 5f 5f 5f 5f 5f 5f 5f 5f 5f 58 5f 5f 58 5f 5f 58 5f 5f 58 58 5f 00 5f 5f 5f 58 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 58 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 00 5f 5f 58 5f 5f 5f 5f 00 5f 5f 5f 5f 5f 58 5f 5f 5f 5f 5f 58 5f 00 5f 5f 5f 5f 5f 5f 00 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 58 5f 5f 5f 5f 5f 5f 5f 5f 5f 00 00 5f 58 5f 5f 5f 5f 00 5f 58 5f 5f 5f 5f 5f 58 5f 5f 5f 5f 5f 5f 00 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 58 5f 00 5f 5f 5f 5f 5f 5f 5f 5f 00 5f 58 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 58 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 58 5f 5f 00 58 5f 5f 5f 5f 5f 58 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 58 00 5f 5f 5f 58 5f 5f 5f 5f 5f 5f 5f 00 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 00 5f 00 5f 00 5f 5f 5f 5f 5f 5f 5f 58 5f 5f 5f 5f 5f 5f 58 5f 5f 5f 5f 5f 5f 5f 5f 00 5f 58 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 00 00 5f 5f 5f 58 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 00 5f 58 5f 5f 5f 5f 58 5f 5f 5f 5f 5f 58 00 5f 5f 5f 5f 5f 5f 5f 58 5f 5f 5f 5f 5f 5f 00 5f 5f 5f 5f 5f 58 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 58 58 00 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 58 5f 5f 5f 5f 5f 5f 5f 58 58 00 5f 58 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 58 5f 5f 5f 58 00 5f 5f 5f 5f 58 5f 5f 5f 5f 5f 5f 5f 5f 58 58 5f 58 5f 5f 5f 5f 5f 5f 5f 5f 5f 58 5f 5f 5f 5f 5f 5f 5f 00 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 00 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 58 5f 5f 5f 5f 5f 5f 5f 00 5f 5f 5f 5f 5f 5f 5f 5f 58 5f 5f 00 5f 58 5f 5f 5f 5f 5f 5f 58 5f 5f 58 5f 5f 5f 5f 5f 58 5f 5f 5f 58 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 00 5f 5f 5f 5f 5f 5f 58 5f 5f 5f 5f 5f 5f 5f 5f 5f 00 5f 5f 58 5f 00 5f 5f 5f 5f 5f 5f 5f 5f 58 5f 00 5f 58 5f 5f 5f 5f 58 5f 5f 5f 5f 5f 58 5f 5f 5f 58 5f 5f 5f 5f 5f 58 5f 5f 5f 58 5f 58 5f 5f 58 5f 5f 5f 5f 5f 5f 00 00 5f 58 5f 00 5f 5f 5f 5f 5f 5f 5f 5f 5f 58 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 58 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 00 5f 5f 5f 5f 5f 58 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 58 5f 5f 5f 5f 5f 58 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 58 5f 5f 5f 58 5f 5f 5f 5f 5f 5f 58 00 5f 5f 5f 00 5f 5f 5f 5f 5f 5f 5f 00 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 00 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 58 5f 5f 5f 5f 5f 58 5f 5f 5f 5f 5f 5f 5f 5f 5f 58 00 5f 5f 5f 00 5f 5f 5f 5f 00 5f 5f 58 5f 5f 58 5f 5f 5f 5f 5f 5f 00 00 58 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 58 58 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 58 58 58 5f 5f 5f 5f 58 5f 5f 5f 5f 5f */
// Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2014 The Bitcoin developers // Copyright (c) 2015-2017 The HLF developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "primitives/block.h" #include "hash.h" #include "script/standard.h" #include "script/sign.h" #include "tinyformat.h" #include "utilstrencodings.h" #include "util.h" uint256 CBlockHeader::GetHash() const { return HashQuark(BEGIN(nVersion), END(nNonce)); } uint256 CBlock::BuildMerkleTree(bool* fMutated) const { /* WARNING! If you're reading this because you're learning about crypto and/or designing a new system that will use merkle trees, keep in mind that the following merkle tree algorithm has a serious flaw related to duplicate txids, resulting in a vulnerability (CVE-2012-2459). The reason is that if the number of hashes in the list at a given time is odd, the last one is duplicated before computing the next level (which is unusual in Merkle trees). This results in certain sequences of transactions leading to the same merkle root. For example, these two trees: A A / \ / \ B C B C / \ | / \ / \ D E F D E F F / \ / \ / \ / \ / \ / \ / \ 1 2 3 4 5 6 1 2 3 4 5 6 5 6 for transaction lists [1,2,3,4,5,6] and [1,2,3,4,5,6,5,6] (where 5 and 6 are repeated) result in the same root hash A (because the hash of both of (F) and (F,F) is C). The vulnerability results from being able to send a block with such a transaction list, with the same merkle root, and the same block hash as the original without duplication, resulting in failed validation. If the receiving node proceeds to mark that block as permanently invalid however, it will fail to accept further unmodified (and thus potentially valid) versions of the same block. We defend against this by detecting the case where we would hash two identical hashes at the end of the list together, and treating that identically to the block having an invalid merkle root. Assuming no double-SHA256 collisions, this will detect all known ways of changing the transactions without affecting the merkle root. */ vMerkleTree.clear(); vMerkleTree.reserve(vtx.size() * 2 + 16); // Safe upper bound for the number of total nodes. for (std::vector<CTransaction>::const_iterator it(vtx.begin()); it != vtx.end(); ++it) vMerkleTree.push_back(it->GetHash()); int j = 0; bool mutated = false; for (int nSize = vtx.size(); nSize > 1; nSize = (nSize + 1) / 2) { for (int i = 0; i < nSize; i += 2) { int i2 = std::min(i+1, nSize-1); if (i2 == i + 1 && i2 + 1 == nSize && vMerkleTree[j+i] == vMerkleTree[j+i2]) { // Two identical hashes at the end of the list at a particular level. mutated = true; } vMerkleTree.push_back(Hash(BEGIN(vMerkleTree[j+i]), END(vMerkleTree[j+i]), BEGIN(vMerkleTree[j+i2]), END(vMerkleTree[j+i2]))); } j += nSize; } if (fMutated) { *fMutated = mutated; } return (vMerkleTree.empty() ? uint256() : vMerkleTree.back()); } std::vector<uint256> CBlock::GetMerkleBranch(int nIndex) const { if (vMerkleTree.empty()) BuildMerkleTree(); std::vector<uint256> vMerkleBranch; int j = 0; for (int nSize = vtx.size(); nSize > 1; nSize = (nSize + 1) / 2) { int i = std::min(nIndex^1, nSize-1); vMerkleBranch.push_back(vMerkleTree[j+i]); nIndex >>= 1; j += nSize; } return vMerkleBranch; } uint256 CBlock::CheckMerkleBranch(uint256 hash, const std::vector<uint256>& vMerkleBranch, int nIndex) { if (nIndex == -1) return uint256(); for (std::vector<uint256>::const_iterator it(vMerkleBranch.begin()); it != vMerkleBranch.end(); ++it) { if (nIndex & 1) hash = Hash(BEGIN(*it), END(*it), BEGIN(hash), END(hash)); else hash = Hash(BEGIN(hash), END(hash), BEGIN(*it), END(*it)); nIndex >>= 1; } return hash; } std::string CBlock::ToString() const { std::stringstream s; s << strprintf("CBlock(hash=%s, ver=%d, hashPrevBlock=%s, hashMerkleRoot=%s, nTime=%u, nBits=%08x, nNonce=%u, vtx=%u)\n", GetHash().ToString(), nVersion, hashPrevBlock.ToString(), hashMerkleRoot.ToString(), nTime, nBits, nNonce, vtx.size()); for (unsigned int i = 0; i < vtx.size(); i++) { s << " " << vtx[i].ToString() << "\n"; } s << " vMerkleTree: "; for (unsigned int i = 0; i < vMerkleTree.size(); i++) s << " " << vMerkleTree[i].ToString(); s << "\n"; return s.str(); } void CBlock::print() const { LogPrintf("%s", ToString()); }
_wc: file format elf32-i386 Disassembly of section .text: 00000000 <main>: printf(1, "%d %d %d %s\n", l, w, c, name); } int main(int argc, char *argv[]) { 0: 8d 4c 24 04 lea 0x4(%esp),%ecx 4: 83 e4 f0 and $0xfffffff0,%esp 7: ff 71 fc pushl -0x4(%ecx) a: 55 push %ebp b: 89 e5 mov %esp,%ebp d: 57 push %edi e: 56 push %esi f: 53 push %ebx 10: 51 push %ecx 11: be 01 00 00 00 mov $0x1,%esi 16: 83 ec 18 sub $0x18,%esp 19: 8b 01 mov (%ecx),%eax 1b: 8b 59 04 mov 0x4(%ecx),%ebx 1e: 83 c3 04 add $0x4,%ebx int fd, i; if(argc <= 1){ 21: 83 f8 01 cmp $0x1,%eax { 24: 89 45 e4 mov %eax,-0x1c(%ebp) if(argc <= 1){ 27: 7e 56 jle 7f <main+0x7f> 29: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi wc(0, ""); exit(); } for(i = 1; i < argc; i++){ if((fd = open(argv[i], 0)) < 0){ 30: 83 ec 08 sub $0x8,%esp 33: 6a 00 push $0x0 35: ff 33 pushl (%ebx) 37: e8 d6 03 00 00 call 412 <open> 3c: 83 c4 10 add $0x10,%esp 3f: 85 c0 test %eax,%eax 41: 89 c7 mov %eax,%edi 43: 78 26 js 6b <main+0x6b> printf(1, "wc: cannot open %s\n", argv[i]); exit(); } wc(fd, argv[i]); 45: 83 ec 08 sub $0x8,%esp 48: ff 33 pushl (%ebx) for(i = 1; i < argc; i++){ 4a: 83 c6 01 add $0x1,%esi wc(fd, argv[i]); 4d: 50 push %eax 4e: 83 c3 04 add $0x4,%ebx 51: e8 4a 00 00 00 call a0 <wc> close(fd); 56: 89 3c 24 mov %edi,(%esp) 59: e8 9c 03 00 00 call 3fa <close> for(i = 1; i < argc; i++){ 5e: 83 c4 10 add $0x10,%esp 61: 39 75 e4 cmp %esi,-0x1c(%ebp) 64: 75 ca jne 30 <main+0x30> } exit(); 66: e8 67 03 00 00 call 3d2 <exit> printf(1, "wc: cannot open %s\n", argv[i]); 6b: 50 push %eax 6c: ff 33 pushl (%ebx) 6e: 68 bb 08 00 00 push $0x8bb 73: 6a 01 push $0x1 75: e8 c6 04 00 00 call 540 <printf> exit(); 7a: e8 53 03 00 00 call 3d2 <exit> wc(0, ""); 7f: 52 push %edx 80: 52 push %edx 81: 68 ad 08 00 00 push $0x8ad 86: 6a 00 push $0x0 88: e8 13 00 00 00 call a0 <wc> exit(); 8d: e8 40 03 00 00 call 3d2 <exit> 92: 66 90 xchg %ax,%ax 94: 66 90 xchg %ax,%ax 96: 66 90 xchg %ax,%ax 98: 66 90 xchg %ax,%ax 9a: 66 90 xchg %ax,%ax 9c: 66 90 xchg %ax,%ax 9e: 66 90 xchg %ax,%ax 000000a0 <wc>: { a0: 55 push %ebp a1: 89 e5 mov %esp,%ebp a3: 57 push %edi a4: 56 push %esi a5: 53 push %ebx l = w = c = 0; a6: 31 db xor %ebx,%ebx { a8: 83 ec 1c sub $0x1c,%esp inword = 0; ab: c7 45 e4 00 00 00 00 movl $0x0,-0x1c(%ebp) l = w = c = 0; b2: c7 45 e0 00 00 00 00 movl $0x0,-0x20(%ebp) b9: c7 45 dc 00 00 00 00 movl $0x0,-0x24(%ebp) while((n = read(fd, buf, sizeof(buf))) > 0){ c0: 83 ec 04 sub $0x4,%esp c3: 68 00 02 00 00 push $0x200 c8: 68 e0 0b 00 00 push $0xbe0 cd: ff 75 08 pushl 0x8(%ebp) d0: e8 15 03 00 00 call 3ea <read> d5: 83 c4 10 add $0x10,%esp d8: 83 f8 00 cmp $0x0,%eax db: 89 c6 mov %eax,%esi dd: 7e 61 jle 140 <wc+0xa0> for(i=0; i<n; i++){ df: 31 ff xor %edi,%edi e1: eb 13 jmp f6 <wc+0x56> e3: 90 nop e4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi inword = 0; e8: c7 45 e4 00 00 00 00 movl $0x0,-0x1c(%ebp) for(i=0; i<n; i++){ ef: 83 c7 01 add $0x1,%edi f2: 39 fe cmp %edi,%esi f4: 74 42 je 138 <wc+0x98> if(buf[i] == '\n') f6: 0f be 87 e0 0b 00 00 movsbl 0xbe0(%edi),%eax l++; fd: 31 c9 xor %ecx,%ecx ff: 3c 0a cmp $0xa,%al 101: 0f 94 c1 sete %cl if(strchr(" \r\t\n\v", buf[i])) 104: 83 ec 08 sub $0x8,%esp 107: 50 push %eax 108: 68 98 08 00 00 push $0x898 l++; 10d: 01 cb add %ecx,%ebx if(strchr(" \r\t\n\v", buf[i])) 10f: e8 3c 01 00 00 call 250 <strchr> 114: 83 c4 10 add $0x10,%esp 117: 85 c0 test %eax,%eax 119: 75 cd jne e8 <wc+0x48> else if(!inword){ 11b: 8b 55 e4 mov -0x1c(%ebp),%edx 11e: 85 d2 test %edx,%edx 120: 75 cd jne ef <wc+0x4f> for(i=0; i<n; i++){ 122: 83 c7 01 add $0x1,%edi w++; 125: 83 45 dc 01 addl $0x1,-0x24(%ebp) inword = 1; 129: c7 45 e4 01 00 00 00 movl $0x1,-0x1c(%ebp) for(i=0; i<n; i++){ 130: 39 fe cmp %edi,%esi 132: 75 c2 jne f6 <wc+0x56> 134: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 138: 01 75 e0 add %esi,-0x20(%ebp) 13b: eb 83 jmp c0 <wc+0x20> 13d: 8d 76 00 lea 0x0(%esi),%esi if(n < 0){ 140: 75 24 jne 166 <wc+0xc6> printf(1, "%d %d %d %s\n", l, w, c, name); 142: 83 ec 08 sub $0x8,%esp 145: ff 75 0c pushl 0xc(%ebp) 148: ff 75 e0 pushl -0x20(%ebp) 14b: ff 75 dc pushl -0x24(%ebp) 14e: 53 push %ebx 14f: 68 ae 08 00 00 push $0x8ae 154: 6a 01 push $0x1 156: e8 e5 03 00 00 call 540 <printf> } 15b: 83 c4 20 add $0x20,%esp 15e: 8d 65 f4 lea -0xc(%ebp),%esp 161: 5b pop %ebx 162: 5e pop %esi 163: 5f pop %edi 164: 5d pop %ebp 165: c3 ret printf(1, "wc: read error\n"); 166: 50 push %eax 167: 50 push %eax 168: 68 9e 08 00 00 push $0x89e 16d: 6a 01 push $0x1 16f: e8 cc 03 00 00 call 540 <printf> exit(); 174: e8 59 02 00 00 call 3d2 <exit> 179: 66 90 xchg %ax,%ax 17b: 66 90 xchg %ax,%ax 17d: 66 90 xchg %ax,%ax 17f: 90 nop 00000180 <strcpy>: #include "user.h" #include "x86.h" char* strcpy(char *s, const char *t) { 180: 55 push %ebp 181: 89 e5 mov %esp,%ebp 183: 53 push %ebx 184: 8b 45 08 mov 0x8(%ebp),%eax 187: 8b 4d 0c mov 0xc(%ebp),%ecx char *os; os = s; while((*s++ = *t++) != 0) 18a: 89 c2 mov %eax,%edx 18c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 190: 83 c1 01 add $0x1,%ecx 193: 0f b6 59 ff movzbl -0x1(%ecx),%ebx 197: 83 c2 01 add $0x1,%edx 19a: 84 db test %bl,%bl 19c: 88 5a ff mov %bl,-0x1(%edx) 19f: 75 ef jne 190 <strcpy+0x10> ; return os; } 1a1: 5b pop %ebx 1a2: 5d pop %ebp 1a3: c3 ret 1a4: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 1aa: 8d bf 00 00 00 00 lea 0x0(%edi),%edi 000001b0 <strcmp>: int strcmp(const char *p, const char *q) { 1b0: 55 push %ebp 1b1: 89 e5 mov %esp,%ebp 1b3: 53 push %ebx 1b4: 8b 55 08 mov 0x8(%ebp),%edx 1b7: 8b 4d 0c mov 0xc(%ebp),%ecx while(*p && *p == *q) 1ba: 0f b6 02 movzbl (%edx),%eax 1bd: 0f b6 19 movzbl (%ecx),%ebx 1c0: 84 c0 test %al,%al 1c2: 75 1c jne 1e0 <strcmp+0x30> 1c4: eb 2a jmp 1f0 <strcmp+0x40> 1c6: 8d 76 00 lea 0x0(%esi),%esi 1c9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi p++, q++; 1d0: 83 c2 01 add $0x1,%edx while(*p && *p == *q) 1d3: 0f b6 02 movzbl (%edx),%eax p++, q++; 1d6: 83 c1 01 add $0x1,%ecx 1d9: 0f b6 19 movzbl (%ecx),%ebx while(*p && *p == *q) 1dc: 84 c0 test %al,%al 1de: 74 10 je 1f0 <strcmp+0x40> 1e0: 38 d8 cmp %bl,%al 1e2: 74 ec je 1d0 <strcmp+0x20> return (uchar)*p - (uchar)*q; 1e4: 29 d8 sub %ebx,%eax } 1e6: 5b pop %ebx 1e7: 5d pop %ebp 1e8: c3 ret 1e9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 1f0: 31 c0 xor %eax,%eax return (uchar)*p - (uchar)*q; 1f2: 29 d8 sub %ebx,%eax } 1f4: 5b pop %ebx 1f5: 5d pop %ebp 1f6: c3 ret 1f7: 89 f6 mov %esi,%esi 1f9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00000200 <strlen>: uint strlen(const char *s) { 200: 55 push %ebp 201: 89 e5 mov %esp,%ebp 203: 8b 4d 08 mov 0x8(%ebp),%ecx int n; for(n = 0; s[n]; n++) 206: 80 39 00 cmpb $0x0,(%ecx) 209: 74 15 je 220 <strlen+0x20> 20b: 31 d2 xor %edx,%edx 20d: 8d 76 00 lea 0x0(%esi),%esi 210: 83 c2 01 add $0x1,%edx 213: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1) 217: 89 d0 mov %edx,%eax 219: 75 f5 jne 210 <strlen+0x10> ; return n; } 21b: 5d pop %ebp 21c: c3 ret 21d: 8d 76 00 lea 0x0(%esi),%esi for(n = 0; s[n]; n++) 220: 31 c0 xor %eax,%eax } 222: 5d pop %ebp 223: c3 ret 224: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 22a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi 00000230 <memset>: void* memset(void *dst, int c, uint n) { 230: 55 push %ebp 231: 89 e5 mov %esp,%ebp 233: 57 push %edi 234: 8b 55 08 mov 0x8(%ebp),%edx } static inline void stosb(void *addr, int data, int cnt) { asm volatile("cld; rep stosb" : 237: 8b 4d 10 mov 0x10(%ebp),%ecx 23a: 8b 45 0c mov 0xc(%ebp),%eax 23d: 89 d7 mov %edx,%edi 23f: fc cld 240: f3 aa rep stos %al,%es:(%edi) stosb(dst, c, n); return dst; } 242: 89 d0 mov %edx,%eax 244: 5f pop %edi 245: 5d pop %ebp 246: c3 ret 247: 89 f6 mov %esi,%esi 249: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00000250 <strchr>: char* strchr(const char *s, char c) { 250: 55 push %ebp 251: 89 e5 mov %esp,%ebp 253: 53 push %ebx 254: 8b 45 08 mov 0x8(%ebp),%eax 257: 8b 5d 0c mov 0xc(%ebp),%ebx for(; *s; s++) 25a: 0f b6 10 movzbl (%eax),%edx 25d: 84 d2 test %dl,%dl 25f: 74 1d je 27e <strchr+0x2e> if(*s == c) 261: 38 d3 cmp %dl,%bl 263: 89 d9 mov %ebx,%ecx 265: 75 0d jne 274 <strchr+0x24> 267: eb 17 jmp 280 <strchr+0x30> 269: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 270: 38 ca cmp %cl,%dl 272: 74 0c je 280 <strchr+0x30> for(; *s; s++) 274: 83 c0 01 add $0x1,%eax 277: 0f b6 10 movzbl (%eax),%edx 27a: 84 d2 test %dl,%dl 27c: 75 f2 jne 270 <strchr+0x20> return (char*)s; return 0; 27e: 31 c0 xor %eax,%eax } 280: 5b pop %ebx 281: 5d pop %ebp 282: c3 ret 283: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 289: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00000290 <gets>: char* gets(char *buf, int max) { 290: 55 push %ebp 291: 89 e5 mov %esp,%ebp 293: 57 push %edi 294: 56 push %esi 295: 53 push %ebx int i, cc; char c; for(i=0; i+1 < max; ){ 296: 31 f6 xor %esi,%esi 298: 89 f3 mov %esi,%ebx { 29a: 83 ec 1c sub $0x1c,%esp 29d: 8b 7d 08 mov 0x8(%ebp),%edi for(i=0; i+1 < max; ){ 2a0: eb 2f jmp 2d1 <gets+0x41> 2a2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi cc = read(0, &c, 1); 2a8: 8d 45 e7 lea -0x19(%ebp),%eax 2ab: 83 ec 04 sub $0x4,%esp 2ae: 6a 01 push $0x1 2b0: 50 push %eax 2b1: 6a 00 push $0x0 2b3: e8 32 01 00 00 call 3ea <read> if(cc < 1) 2b8: 83 c4 10 add $0x10,%esp 2bb: 85 c0 test %eax,%eax 2bd: 7e 1c jle 2db <gets+0x4b> break; buf[i++] = c; 2bf: 0f b6 45 e7 movzbl -0x19(%ebp),%eax 2c3: 83 c7 01 add $0x1,%edi 2c6: 88 47 ff mov %al,-0x1(%edi) if(c == '\n' || c == '\r') 2c9: 3c 0a cmp $0xa,%al 2cb: 74 23 je 2f0 <gets+0x60> 2cd: 3c 0d cmp $0xd,%al 2cf: 74 1f je 2f0 <gets+0x60> for(i=0; i+1 < max; ){ 2d1: 83 c3 01 add $0x1,%ebx 2d4: 3b 5d 0c cmp 0xc(%ebp),%ebx 2d7: 89 fe mov %edi,%esi 2d9: 7c cd jl 2a8 <gets+0x18> 2db: 89 f3 mov %esi,%ebx break; } buf[i] = '\0'; return buf; } 2dd: 8b 45 08 mov 0x8(%ebp),%eax buf[i] = '\0'; 2e0: c6 03 00 movb $0x0,(%ebx) } 2e3: 8d 65 f4 lea -0xc(%ebp),%esp 2e6: 5b pop %ebx 2e7: 5e pop %esi 2e8: 5f pop %edi 2e9: 5d pop %ebp 2ea: c3 ret 2eb: 90 nop 2ec: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 2f0: 8b 75 08 mov 0x8(%ebp),%esi 2f3: 8b 45 08 mov 0x8(%ebp),%eax 2f6: 01 de add %ebx,%esi 2f8: 89 f3 mov %esi,%ebx buf[i] = '\0'; 2fa: c6 03 00 movb $0x0,(%ebx) } 2fd: 8d 65 f4 lea -0xc(%ebp),%esp 300: 5b pop %ebx 301: 5e pop %esi 302: 5f pop %edi 303: 5d pop %ebp 304: c3 ret 305: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 309: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00000310 <stat>: int stat(const char *n, struct stat *st) { 310: 55 push %ebp 311: 89 e5 mov %esp,%ebp 313: 56 push %esi 314: 53 push %ebx int fd; int r; fd = open(n, O_RDONLY); 315: 83 ec 08 sub $0x8,%esp 318: 6a 00 push $0x0 31a: ff 75 08 pushl 0x8(%ebp) 31d: e8 f0 00 00 00 call 412 <open> if(fd < 0) 322: 83 c4 10 add $0x10,%esp 325: 85 c0 test %eax,%eax 327: 78 27 js 350 <stat+0x40> return -1; r = fstat(fd, st); 329: 83 ec 08 sub $0x8,%esp 32c: ff 75 0c pushl 0xc(%ebp) 32f: 89 c3 mov %eax,%ebx 331: 50 push %eax 332: e8 f3 00 00 00 call 42a <fstat> close(fd); 337: 89 1c 24 mov %ebx,(%esp) r = fstat(fd, st); 33a: 89 c6 mov %eax,%esi close(fd); 33c: e8 b9 00 00 00 call 3fa <close> return r; 341: 83 c4 10 add $0x10,%esp } 344: 8d 65 f8 lea -0x8(%ebp),%esp 347: 89 f0 mov %esi,%eax 349: 5b pop %ebx 34a: 5e pop %esi 34b: 5d pop %ebp 34c: c3 ret 34d: 8d 76 00 lea 0x0(%esi),%esi return -1; 350: be ff ff ff ff mov $0xffffffff,%esi 355: eb ed jmp 344 <stat+0x34> 357: 89 f6 mov %esi,%esi 359: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00000360 <atoi>: int atoi(const char *s) { 360: 55 push %ebp 361: 89 e5 mov %esp,%ebp 363: 53 push %ebx 364: 8b 4d 08 mov 0x8(%ebp),%ecx int n; n = 0; while('0' <= *s && *s <= '9') 367: 0f be 11 movsbl (%ecx),%edx 36a: 8d 42 d0 lea -0x30(%edx),%eax 36d: 3c 09 cmp $0x9,%al n = 0; 36f: b8 00 00 00 00 mov $0x0,%eax while('0' <= *s && *s <= '9') 374: 77 1f ja 395 <atoi+0x35> 376: 8d 76 00 lea 0x0(%esi),%esi 379: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi n = n*10 + *s++ - '0'; 380: 8d 04 80 lea (%eax,%eax,4),%eax 383: 83 c1 01 add $0x1,%ecx 386: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax while('0' <= *s && *s <= '9') 38a: 0f be 11 movsbl (%ecx),%edx 38d: 8d 5a d0 lea -0x30(%edx),%ebx 390: 80 fb 09 cmp $0x9,%bl 393: 76 eb jbe 380 <atoi+0x20> return n; } 395: 5b pop %ebx 396: 5d pop %ebp 397: c3 ret 398: 90 nop 399: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 000003a0 <memmove>: void* memmove(void *vdst, const void *vsrc, int n) { 3a0: 55 push %ebp 3a1: 89 e5 mov %esp,%ebp 3a3: 56 push %esi 3a4: 53 push %ebx 3a5: 8b 5d 10 mov 0x10(%ebp),%ebx 3a8: 8b 45 08 mov 0x8(%ebp),%eax 3ab: 8b 75 0c mov 0xc(%ebp),%esi char *dst; const char *src; dst = vdst; src = vsrc; while(n-- > 0) 3ae: 85 db test %ebx,%ebx 3b0: 7e 14 jle 3c6 <memmove+0x26> 3b2: 31 d2 xor %edx,%edx 3b4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi *dst++ = *src++; 3b8: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx 3bc: 88 0c 10 mov %cl,(%eax,%edx,1) 3bf: 83 c2 01 add $0x1,%edx while(n-- > 0) 3c2: 39 d3 cmp %edx,%ebx 3c4: 75 f2 jne 3b8 <memmove+0x18> return vdst; } 3c6: 5b pop %ebx 3c7: 5e pop %esi 3c8: 5d pop %ebp 3c9: c3 ret 000003ca <fork>: name: \ movl $SYS_ ## name, %eax; \ int $T_SYSCALL; \ ret SYSCALL(fork) 3ca: b8 01 00 00 00 mov $0x1,%eax 3cf: cd 40 int $0x40 3d1: c3 ret 000003d2 <exit>: SYSCALL(exit) 3d2: b8 02 00 00 00 mov $0x2,%eax 3d7: cd 40 int $0x40 3d9: c3 ret 000003da <wait>: SYSCALL(wait) 3da: b8 03 00 00 00 mov $0x3,%eax 3df: cd 40 int $0x40 3e1: c3 ret 000003e2 <pipe>: SYSCALL(pipe) 3e2: b8 04 00 00 00 mov $0x4,%eax 3e7: cd 40 int $0x40 3e9: c3 ret 000003ea <read>: SYSCALL(read) 3ea: b8 05 00 00 00 mov $0x5,%eax 3ef: cd 40 int $0x40 3f1: c3 ret 000003f2 <write>: SYSCALL(write) 3f2: b8 10 00 00 00 mov $0x10,%eax 3f7: cd 40 int $0x40 3f9: c3 ret 000003fa <close>: SYSCALL(close) 3fa: b8 15 00 00 00 mov $0x15,%eax 3ff: cd 40 int $0x40 401: c3 ret 00000402 <kill>: SYSCALL(kill) 402: b8 06 00 00 00 mov $0x6,%eax 407: cd 40 int $0x40 409: c3 ret 0000040a <exec>: SYSCALL(exec) 40a: b8 07 00 00 00 mov $0x7,%eax 40f: cd 40 int $0x40 411: c3 ret 00000412 <open>: SYSCALL(open) 412: b8 0f 00 00 00 mov $0xf,%eax 417: cd 40 int $0x40 419: c3 ret 0000041a <mknod>: SYSCALL(mknod) 41a: b8 11 00 00 00 mov $0x11,%eax 41f: cd 40 int $0x40 421: c3 ret 00000422 <unlink>: SYSCALL(unlink) 422: b8 12 00 00 00 mov $0x12,%eax 427: cd 40 int $0x40 429: c3 ret 0000042a <fstat>: SYSCALL(fstat) 42a: b8 08 00 00 00 mov $0x8,%eax 42f: cd 40 int $0x40 431: c3 ret 00000432 <link>: SYSCALL(link) 432: b8 13 00 00 00 mov $0x13,%eax 437: cd 40 int $0x40 439: c3 ret 0000043a <mkdir>: SYSCALL(mkdir) 43a: b8 14 00 00 00 mov $0x14,%eax 43f: cd 40 int $0x40 441: c3 ret 00000442 <chdir>: SYSCALL(chdir) 442: b8 09 00 00 00 mov $0x9,%eax 447: cd 40 int $0x40 449: c3 ret 0000044a <dup>: SYSCALL(dup) 44a: b8 0a 00 00 00 mov $0xa,%eax 44f: cd 40 int $0x40 451: c3 ret 00000452 <getpid>: SYSCALL(getpid) 452: b8 0b 00 00 00 mov $0xb,%eax 457: cd 40 int $0x40 459: c3 ret 0000045a <sbrk>: SYSCALL(sbrk) 45a: b8 0c 00 00 00 mov $0xc,%eax 45f: cd 40 int $0x40 461: c3 ret 00000462 <sleep>: SYSCALL(sleep) 462: b8 0d 00 00 00 mov $0xd,%eax 467: cd 40 int $0x40 469: c3 ret 0000046a <uptime>: SYSCALL(uptime) 46a: b8 0e 00 00 00 mov $0xe,%eax 46f: cd 40 int $0x40 471: c3 ret 00000472 <reentrant>: SYSCALL(reentrant) 472: b8 16 00 00 00 mov $0x16,%eax 477: cd 40 int $0x40 479: c3 ret 0000047a <initbarrier>: SYSCALL(initbarrier) 47a: b8 17 00 00 00 mov $0x17,%eax 47f: cd 40 int $0x40 481: c3 ret 00000482 <init_reentrant_lock>: SYSCALL(init_reentrant_lock) 482: b8 19 00 00 00 mov $0x19,%eax 487: cd 40 int $0x40 489: c3 ret 0000048a <barrier>: 48a: b8 18 00 00 00 mov $0x18,%eax 48f: cd 40 int $0x40 491: c3 ret 492: 66 90 xchg %ax,%ax 494: 66 90 xchg %ax,%ax 496: 66 90 xchg %ax,%ax 498: 66 90 xchg %ax,%ax 49a: 66 90 xchg %ax,%ax 49c: 66 90 xchg %ax,%ax 49e: 66 90 xchg %ax,%ax 000004a0 <printint>: write(fd, &c, 1); } static void printint(int fd, int xx, int base, int sgn) { 4a0: 55 push %ebp 4a1: 89 e5 mov %esp,%ebp 4a3: 57 push %edi 4a4: 56 push %esi 4a5: 53 push %ebx 4a6: 83 ec 3c sub $0x3c,%esp char buf[16]; int i, neg; uint x; neg = 0; if(sgn && xx < 0){ 4a9: 85 d2 test %edx,%edx { 4ab: 89 45 c0 mov %eax,-0x40(%ebp) neg = 1; x = -xx; 4ae: 89 d0 mov %edx,%eax if(sgn && xx < 0){ 4b0: 79 76 jns 528 <printint+0x88> 4b2: f6 45 08 01 testb $0x1,0x8(%ebp) 4b6: 74 70 je 528 <printint+0x88> x = -xx; 4b8: f7 d8 neg %eax neg = 1; 4ba: c7 45 c4 01 00 00 00 movl $0x1,-0x3c(%ebp) } else { x = xx; } i = 0; 4c1: 31 f6 xor %esi,%esi 4c3: 8d 5d d7 lea -0x29(%ebp),%ebx 4c6: eb 0a jmp 4d2 <printint+0x32> 4c8: 90 nop 4c9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi do{ buf[i++] = digits[x % base]; 4d0: 89 fe mov %edi,%esi 4d2: 31 d2 xor %edx,%edx 4d4: 8d 7e 01 lea 0x1(%esi),%edi 4d7: f7 f1 div %ecx 4d9: 0f b6 92 d8 08 00 00 movzbl 0x8d8(%edx),%edx }while((x /= base) != 0); 4e0: 85 c0 test %eax,%eax buf[i++] = digits[x % base]; 4e2: 88 14 3b mov %dl,(%ebx,%edi,1) }while((x /= base) != 0); 4e5: 75 e9 jne 4d0 <printint+0x30> if(neg) 4e7: 8b 45 c4 mov -0x3c(%ebp),%eax 4ea: 85 c0 test %eax,%eax 4ec: 74 08 je 4f6 <printint+0x56> buf[i++] = '-'; 4ee: c6 44 3d d8 2d movb $0x2d,-0x28(%ebp,%edi,1) 4f3: 8d 7e 02 lea 0x2(%esi),%edi 4f6: 8d 74 3d d7 lea -0x29(%ebp,%edi,1),%esi 4fa: 8b 7d c0 mov -0x40(%ebp),%edi 4fd: 8d 76 00 lea 0x0(%esi),%esi 500: 0f b6 06 movzbl (%esi),%eax write(fd, &c, 1); 503: 83 ec 04 sub $0x4,%esp 506: 83 ee 01 sub $0x1,%esi 509: 6a 01 push $0x1 50b: 53 push %ebx 50c: 57 push %edi 50d: 88 45 d7 mov %al,-0x29(%ebp) 510: e8 dd fe ff ff call 3f2 <write> while(--i >= 0) 515: 83 c4 10 add $0x10,%esp 518: 39 de cmp %ebx,%esi 51a: 75 e4 jne 500 <printint+0x60> putc(fd, buf[i]); } 51c: 8d 65 f4 lea -0xc(%ebp),%esp 51f: 5b pop %ebx 520: 5e pop %esi 521: 5f pop %edi 522: 5d pop %ebp 523: c3 ret 524: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi neg = 0; 528: c7 45 c4 00 00 00 00 movl $0x0,-0x3c(%ebp) 52f: eb 90 jmp 4c1 <printint+0x21> 531: eb 0d jmp 540 <printf> 533: 90 nop 534: 90 nop 535: 90 nop 536: 90 nop 537: 90 nop 538: 90 nop 539: 90 nop 53a: 90 nop 53b: 90 nop 53c: 90 nop 53d: 90 nop 53e: 90 nop 53f: 90 nop 00000540 <printf>: // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, const char *fmt, ...) { 540: 55 push %ebp 541: 89 e5 mov %esp,%ebp 543: 57 push %edi 544: 56 push %esi 545: 53 push %ebx 546: 83 ec 2c sub $0x2c,%esp int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 549: 8b 75 0c mov 0xc(%ebp),%esi 54c: 0f b6 1e movzbl (%esi),%ebx 54f: 84 db test %bl,%bl 551: 0f 84 b3 00 00 00 je 60a <printf+0xca> ap = (uint*)(void*)&fmt + 1; 557: 8d 45 10 lea 0x10(%ebp),%eax 55a: 83 c6 01 add $0x1,%esi state = 0; 55d: 31 ff xor %edi,%edi ap = (uint*)(void*)&fmt + 1; 55f: 89 45 d4 mov %eax,-0x2c(%ebp) 562: eb 2f jmp 593 <printf+0x53> 564: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi c = fmt[i] & 0xff; if(state == 0){ if(c == '%'){ 568: 83 f8 25 cmp $0x25,%eax 56b: 0f 84 a7 00 00 00 je 618 <printf+0xd8> write(fd, &c, 1); 571: 8d 45 e2 lea -0x1e(%ebp),%eax 574: 83 ec 04 sub $0x4,%esp 577: 88 5d e2 mov %bl,-0x1e(%ebp) 57a: 6a 01 push $0x1 57c: 50 push %eax 57d: ff 75 08 pushl 0x8(%ebp) 580: e8 6d fe ff ff call 3f2 <write> 585: 83 c4 10 add $0x10,%esp 588: 83 c6 01 add $0x1,%esi for(i = 0; fmt[i]; i++){ 58b: 0f b6 5e ff movzbl -0x1(%esi),%ebx 58f: 84 db test %bl,%bl 591: 74 77 je 60a <printf+0xca> if(state == 0){ 593: 85 ff test %edi,%edi c = fmt[i] & 0xff; 595: 0f be cb movsbl %bl,%ecx 598: 0f b6 c3 movzbl %bl,%eax if(state == 0){ 59b: 74 cb je 568 <printf+0x28> state = '%'; } else { putc(fd, c); } } else if(state == '%'){ 59d: 83 ff 25 cmp $0x25,%edi 5a0: 75 e6 jne 588 <printf+0x48> if(c == 'd'){ 5a2: 83 f8 64 cmp $0x64,%eax 5a5: 0f 84 05 01 00 00 je 6b0 <printf+0x170> printint(fd, *ap, 10, 1); ap++; } else if(c == 'x' || c == 'p'){ 5ab: 81 e1 f7 00 00 00 and $0xf7,%ecx 5b1: 83 f9 70 cmp $0x70,%ecx 5b4: 74 72 je 628 <printf+0xe8> printint(fd, *ap, 16, 0); ap++; } else if(c == 's'){ 5b6: 83 f8 73 cmp $0x73,%eax 5b9: 0f 84 99 00 00 00 je 658 <printf+0x118> s = "(null)"; while(*s != 0){ putc(fd, *s); s++; } } else if(c == 'c'){ 5bf: 83 f8 63 cmp $0x63,%eax 5c2: 0f 84 08 01 00 00 je 6d0 <printf+0x190> putc(fd, *ap); ap++; } else if(c == '%'){ 5c8: 83 f8 25 cmp $0x25,%eax 5cb: 0f 84 ef 00 00 00 je 6c0 <printf+0x180> write(fd, &c, 1); 5d1: 8d 45 e7 lea -0x19(%ebp),%eax 5d4: 83 ec 04 sub $0x4,%esp 5d7: c6 45 e7 25 movb $0x25,-0x19(%ebp) 5db: 6a 01 push $0x1 5dd: 50 push %eax 5de: ff 75 08 pushl 0x8(%ebp) 5e1: e8 0c fe ff ff call 3f2 <write> 5e6: 83 c4 0c add $0xc,%esp 5e9: 8d 45 e6 lea -0x1a(%ebp),%eax 5ec: 88 5d e6 mov %bl,-0x1a(%ebp) 5ef: 6a 01 push $0x1 5f1: 50 push %eax 5f2: ff 75 08 pushl 0x8(%ebp) 5f5: 83 c6 01 add $0x1,%esi } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); putc(fd, c); } state = 0; 5f8: 31 ff xor %edi,%edi write(fd, &c, 1); 5fa: e8 f3 fd ff ff call 3f2 <write> for(i = 0; fmt[i]; i++){ 5ff: 0f b6 5e ff movzbl -0x1(%esi),%ebx write(fd, &c, 1); 603: 83 c4 10 add $0x10,%esp for(i = 0; fmt[i]; i++){ 606: 84 db test %bl,%bl 608: 75 89 jne 593 <printf+0x53> } } } 60a: 8d 65 f4 lea -0xc(%ebp),%esp 60d: 5b pop %ebx 60e: 5e pop %esi 60f: 5f pop %edi 610: 5d pop %ebp 611: c3 ret 612: 8d b6 00 00 00 00 lea 0x0(%esi),%esi state = '%'; 618: bf 25 00 00 00 mov $0x25,%edi 61d: e9 66 ff ff ff jmp 588 <printf+0x48> 622: 8d b6 00 00 00 00 lea 0x0(%esi),%esi printint(fd, *ap, 16, 0); 628: 83 ec 0c sub $0xc,%esp 62b: b9 10 00 00 00 mov $0x10,%ecx 630: 6a 00 push $0x0 632: 8b 7d d4 mov -0x2c(%ebp),%edi 635: 8b 45 08 mov 0x8(%ebp),%eax 638: 8b 17 mov (%edi),%edx 63a: e8 61 fe ff ff call 4a0 <printint> ap++; 63f: 89 f8 mov %edi,%eax 641: 83 c4 10 add $0x10,%esp state = 0; 644: 31 ff xor %edi,%edi ap++; 646: 83 c0 04 add $0x4,%eax 649: 89 45 d4 mov %eax,-0x2c(%ebp) 64c: e9 37 ff ff ff jmp 588 <printf+0x48> 651: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi s = (char*)*ap; 658: 8b 45 d4 mov -0x2c(%ebp),%eax 65b: 8b 08 mov (%eax),%ecx ap++; 65d: 83 c0 04 add $0x4,%eax 660: 89 45 d4 mov %eax,-0x2c(%ebp) if(s == 0) 663: 85 c9 test %ecx,%ecx 665: 0f 84 8e 00 00 00 je 6f9 <printf+0x1b9> while(*s != 0){ 66b: 0f b6 01 movzbl (%ecx),%eax state = 0; 66e: 31 ff xor %edi,%edi s = (char*)*ap; 670: 89 cb mov %ecx,%ebx while(*s != 0){ 672: 84 c0 test %al,%al 674: 0f 84 0e ff ff ff je 588 <printf+0x48> 67a: 89 75 d0 mov %esi,-0x30(%ebp) 67d: 89 de mov %ebx,%esi 67f: 8b 5d 08 mov 0x8(%ebp),%ebx 682: 8d 7d e3 lea -0x1d(%ebp),%edi 685: 8d 76 00 lea 0x0(%esi),%esi write(fd, &c, 1); 688: 83 ec 04 sub $0x4,%esp s++; 68b: 83 c6 01 add $0x1,%esi 68e: 88 45 e3 mov %al,-0x1d(%ebp) write(fd, &c, 1); 691: 6a 01 push $0x1 693: 57 push %edi 694: 53 push %ebx 695: e8 58 fd ff ff call 3f2 <write> while(*s != 0){ 69a: 0f b6 06 movzbl (%esi),%eax 69d: 83 c4 10 add $0x10,%esp 6a0: 84 c0 test %al,%al 6a2: 75 e4 jne 688 <printf+0x148> 6a4: 8b 75 d0 mov -0x30(%ebp),%esi state = 0; 6a7: 31 ff xor %edi,%edi 6a9: e9 da fe ff ff jmp 588 <printf+0x48> 6ae: 66 90 xchg %ax,%ax printint(fd, *ap, 10, 1); 6b0: 83 ec 0c sub $0xc,%esp 6b3: b9 0a 00 00 00 mov $0xa,%ecx 6b8: 6a 01 push $0x1 6ba: e9 73 ff ff ff jmp 632 <printf+0xf2> 6bf: 90 nop write(fd, &c, 1); 6c0: 83 ec 04 sub $0x4,%esp 6c3: 88 5d e5 mov %bl,-0x1b(%ebp) 6c6: 8d 45 e5 lea -0x1b(%ebp),%eax 6c9: 6a 01 push $0x1 6cb: e9 21 ff ff ff jmp 5f1 <printf+0xb1> putc(fd, *ap); 6d0: 8b 7d d4 mov -0x2c(%ebp),%edi write(fd, &c, 1); 6d3: 83 ec 04 sub $0x4,%esp putc(fd, *ap); 6d6: 8b 07 mov (%edi),%eax write(fd, &c, 1); 6d8: 6a 01 push $0x1 ap++; 6da: 83 c7 04 add $0x4,%edi putc(fd, *ap); 6dd: 88 45 e4 mov %al,-0x1c(%ebp) write(fd, &c, 1); 6e0: 8d 45 e4 lea -0x1c(%ebp),%eax 6e3: 50 push %eax 6e4: ff 75 08 pushl 0x8(%ebp) 6e7: e8 06 fd ff ff call 3f2 <write> ap++; 6ec: 89 7d d4 mov %edi,-0x2c(%ebp) 6ef: 83 c4 10 add $0x10,%esp state = 0; 6f2: 31 ff xor %edi,%edi 6f4: e9 8f fe ff ff jmp 588 <printf+0x48> s = "(null)"; 6f9: bb cf 08 00 00 mov $0x8cf,%ebx while(*s != 0){ 6fe: b8 28 00 00 00 mov $0x28,%eax 703: e9 72 ff ff ff jmp 67a <printf+0x13a> 708: 66 90 xchg %ax,%ax 70a: 66 90 xchg %ax,%ax 70c: 66 90 xchg %ax,%ax 70e: 66 90 xchg %ax,%ax 00000710 <free>: static Header base; static Header *freep; void free(void *ap) { 710: 55 push %ebp Header *bp, *p; bp = (Header*)ap - 1; for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 711: a1 c0 0b 00 00 mov 0xbc0,%eax { 716: 89 e5 mov %esp,%ebp 718: 57 push %edi 719: 56 push %esi 71a: 53 push %ebx 71b: 8b 5d 08 mov 0x8(%ebp),%ebx bp = (Header*)ap - 1; 71e: 8d 4b f8 lea -0x8(%ebx),%ecx 721: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 728: 39 c8 cmp %ecx,%eax 72a: 8b 10 mov (%eax),%edx 72c: 73 32 jae 760 <free+0x50> 72e: 39 d1 cmp %edx,%ecx 730: 72 04 jb 736 <free+0x26> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 732: 39 d0 cmp %edx,%eax 734: 72 32 jb 768 <free+0x58> break; if(bp + bp->s.size == p->s.ptr){ 736: 8b 73 fc mov -0x4(%ebx),%esi 739: 8d 3c f1 lea (%ecx,%esi,8),%edi 73c: 39 fa cmp %edi,%edx 73e: 74 30 je 770 <free+0x60> bp->s.size += p->s.ptr->s.size; bp->s.ptr = p->s.ptr->s.ptr; } else bp->s.ptr = p->s.ptr; 740: 89 53 f8 mov %edx,-0x8(%ebx) if(p + p->s.size == bp){ 743: 8b 50 04 mov 0x4(%eax),%edx 746: 8d 34 d0 lea (%eax,%edx,8),%esi 749: 39 f1 cmp %esi,%ecx 74b: 74 3a je 787 <free+0x77> p->s.size += bp->s.size; p->s.ptr = bp->s.ptr; } else p->s.ptr = bp; 74d: 89 08 mov %ecx,(%eax) freep = p; 74f: a3 c0 0b 00 00 mov %eax,0xbc0 } 754: 5b pop %ebx 755: 5e pop %esi 756: 5f pop %edi 757: 5d pop %ebp 758: c3 ret 759: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 760: 39 d0 cmp %edx,%eax 762: 72 04 jb 768 <free+0x58> 764: 39 d1 cmp %edx,%ecx 766: 72 ce jb 736 <free+0x26> { 768: 89 d0 mov %edx,%eax 76a: eb bc jmp 728 <free+0x18> 76c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi bp->s.size += p->s.ptr->s.size; 770: 03 72 04 add 0x4(%edx),%esi 773: 89 73 fc mov %esi,-0x4(%ebx) bp->s.ptr = p->s.ptr->s.ptr; 776: 8b 10 mov (%eax),%edx 778: 8b 12 mov (%edx),%edx 77a: 89 53 f8 mov %edx,-0x8(%ebx) if(p + p->s.size == bp){ 77d: 8b 50 04 mov 0x4(%eax),%edx 780: 8d 34 d0 lea (%eax,%edx,8),%esi 783: 39 f1 cmp %esi,%ecx 785: 75 c6 jne 74d <free+0x3d> p->s.size += bp->s.size; 787: 03 53 fc add -0x4(%ebx),%edx freep = p; 78a: a3 c0 0b 00 00 mov %eax,0xbc0 p->s.size += bp->s.size; 78f: 89 50 04 mov %edx,0x4(%eax) p->s.ptr = bp->s.ptr; 792: 8b 53 f8 mov -0x8(%ebx),%edx 795: 89 10 mov %edx,(%eax) } 797: 5b pop %ebx 798: 5e pop %esi 799: 5f pop %edi 79a: 5d pop %ebp 79b: c3 ret 79c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 000007a0 <malloc>: return freep; } void* malloc(uint nbytes) { 7a0: 55 push %ebp 7a1: 89 e5 mov %esp,%ebp 7a3: 57 push %edi 7a4: 56 push %esi 7a5: 53 push %ebx 7a6: 83 ec 0c sub $0xc,%esp Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; 7a9: 8b 45 08 mov 0x8(%ebp),%eax if((prevp = freep) == 0){ 7ac: 8b 15 c0 0b 00 00 mov 0xbc0,%edx nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; 7b2: 8d 78 07 lea 0x7(%eax),%edi 7b5: c1 ef 03 shr $0x3,%edi 7b8: 83 c7 01 add $0x1,%edi if((prevp = freep) == 0){ 7bb: 85 d2 test %edx,%edx 7bd: 0f 84 9d 00 00 00 je 860 <malloc+0xc0> 7c3: 8b 02 mov (%edx),%eax 7c5: 8b 48 04 mov 0x4(%eax),%ecx base.s.ptr = freep = prevp = &base; base.s.size = 0; } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ if(p->s.size >= nunits){ 7c8: 39 cf cmp %ecx,%edi 7ca: 76 6c jbe 838 <malloc+0x98> 7cc: 81 ff 00 10 00 00 cmp $0x1000,%edi 7d2: bb 00 10 00 00 mov $0x1000,%ebx 7d7: 0f 43 df cmovae %edi,%ebx p = sbrk(nu * sizeof(Header)); 7da: 8d 34 dd 00 00 00 00 lea 0x0(,%ebx,8),%esi 7e1: eb 0e jmp 7f1 <malloc+0x51> 7e3: 90 nop 7e4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ 7e8: 8b 02 mov (%edx),%eax if(p->s.size >= nunits){ 7ea: 8b 48 04 mov 0x4(%eax),%ecx 7ed: 39 f9 cmp %edi,%ecx 7ef: 73 47 jae 838 <malloc+0x98> p->s.size = nunits; } freep = prevp; return (void*)(p + 1); } if(p == freep) 7f1: 39 05 c0 0b 00 00 cmp %eax,0xbc0 7f7: 89 c2 mov %eax,%edx 7f9: 75 ed jne 7e8 <malloc+0x48> p = sbrk(nu * sizeof(Header)); 7fb: 83 ec 0c sub $0xc,%esp 7fe: 56 push %esi 7ff: e8 56 fc ff ff call 45a <sbrk> if(p == (char*)-1) 804: 83 c4 10 add $0x10,%esp 807: 83 f8 ff cmp $0xffffffff,%eax 80a: 74 1c je 828 <malloc+0x88> hp->s.size = nu; 80c: 89 58 04 mov %ebx,0x4(%eax) free((void*)(hp + 1)); 80f: 83 ec 0c sub $0xc,%esp 812: 83 c0 08 add $0x8,%eax 815: 50 push %eax 816: e8 f5 fe ff ff call 710 <free> return freep; 81b: 8b 15 c0 0b 00 00 mov 0xbc0,%edx if((p = morecore(nunits)) == 0) 821: 83 c4 10 add $0x10,%esp 824: 85 d2 test %edx,%edx 826: 75 c0 jne 7e8 <malloc+0x48> return 0; } } 828: 8d 65 f4 lea -0xc(%ebp),%esp return 0; 82b: 31 c0 xor %eax,%eax } 82d: 5b pop %ebx 82e: 5e pop %esi 82f: 5f pop %edi 830: 5d pop %ebp 831: c3 ret 832: 8d b6 00 00 00 00 lea 0x0(%esi),%esi if(p->s.size == nunits) 838: 39 cf cmp %ecx,%edi 83a: 74 54 je 890 <malloc+0xf0> p->s.size -= nunits; 83c: 29 f9 sub %edi,%ecx 83e: 89 48 04 mov %ecx,0x4(%eax) p += p->s.size; 841: 8d 04 c8 lea (%eax,%ecx,8),%eax p->s.size = nunits; 844: 89 78 04 mov %edi,0x4(%eax) freep = prevp; 847: 89 15 c0 0b 00 00 mov %edx,0xbc0 } 84d: 8d 65 f4 lea -0xc(%ebp),%esp return (void*)(p + 1); 850: 83 c0 08 add $0x8,%eax } 853: 5b pop %ebx 854: 5e pop %esi 855: 5f pop %edi 856: 5d pop %ebp 857: c3 ret 858: 90 nop 859: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi base.s.ptr = freep = prevp = &base; 860: c7 05 c0 0b 00 00 c4 movl $0xbc4,0xbc0 867: 0b 00 00 86a: c7 05 c4 0b 00 00 c4 movl $0xbc4,0xbc4 871: 0b 00 00 base.s.size = 0; 874: b8 c4 0b 00 00 mov $0xbc4,%eax 879: c7 05 c8 0b 00 00 00 movl $0x0,0xbc8 880: 00 00 00 883: e9 44 ff ff ff jmp 7cc <malloc+0x2c> 888: 90 nop 889: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi prevp->s.ptr = p->s.ptr; 890: 8b 08 mov (%eax),%ecx 892: 89 0a mov %ecx,(%edx) 894: eb b1 jmp 847 <malloc+0xa7>
; A080957: Expansion of (5 - 9*x + 6*x^2)/(1-x)^4. ; 5,11,20,34,55,85,126,180,249,335,440,566,715,889,1090,1320,1581,1875,2204,2570,2975,3421,3910,4444,5025,5655,6336,7070,7859,8705,9610,10576,11605,12699,13860,15090,16391,17765,19214,20740,22345,24031,25800,27654,29595,31625,33746,35960,38269,40675,43180,45786,48495,51309,54230,57260,60401,63655,67024,70510,74115,77841,81690,85664,89765,93995,98356,102850,107479,112245,117150,122196,127385,132719,138200,143830,149611,155545,161634,167880,174285,180851,187580,194474,201535,208765,216166,223740 mov $2,5 lpb $0 add $2,$0 sub $0,1 add $1,$2 lpe add $1,5 mov $0,$1
; List of sections for MegaROMs IFNDEF CRT_ORG_BANK_01 defc CRT_ORG_BANK_01 = $8000 ENDIF IFNDEF CRT_ORG_BANK_02 defc CRT_ORG_BANK_02 = $8000 ENDIF IFNDEF CRT_ORG_BANK_03 defc CRT_ORG_BANK_03 = $8000 ENDIF IFNDEF CRT_ORG_BANK_04 defc CRT_ORG_BANK_04 = $8000 ENDIF IFNDEF CRT_ORG_BANK_05 defc CRT_ORG_BANK_05 = $8000 ENDIF IFNDEF CRT_ORG_BANK_06 defc CRT_ORG_BANK_06 = $8000 ENDIF IFNDEF CRT_ORG_BANK_07 defc CRT_ORG_BANK_07 = $8000 ENDIF IFNDEF CRT_ORG_BANK_08 defc CRT_ORG_BANK_08 = $8000 ENDIF IFNDEF CRT_ORG_BANK_09 defc CRT_ORG_BANK_09 = $8000 ENDIF IFNDEF CRT_ORG_BANK_0A defc CRT_ORG_BANK_0A = $8000 ENDIF IFNDEF CRT_ORG_BANK_0B defc CRT_ORG_BANK_0B = $8000 ENDIF IFNDEF CRT_ORG_BANK_0C defc CRT_ORG_BANK_0C = $8000 ENDIF IFNDEF CRT_ORG_BANK_0D defc CRT_ORG_BANK_0D = $8000 ENDIF IFNDEF CRT_ORG_BANK_0E defc CRT_ORG_BANK_0E = $8000 ENDIF IFNDEF CRT_ORG_BANK_0F defc CRT_ORG_BANK_0F = $8000 ENDIF IFNDEF CRT_ORG_BANK_10 defc CRT_ORG_BANK_10 = $8000 ENDIF IFNDEF CRT_ORG_BANK_11 defc CRT_ORG_BANK_11 = $8000 ENDIF IFNDEF CRT_ORG_BANK_12 defc CRT_ORG_BANK_12 = $8000 ENDIF IFNDEF CRT_ORG_BANK_13 defc CRT_ORG_BANK_13 = $8000 ENDIF IFNDEF CRT_ORG_BANK_14 defc CRT_ORG_BANK_14 = $8000 ENDIF IFNDEF CRT_ORG_BANK_15 defc CRT_ORG_BANK_15 = $8000 ENDIF IFNDEF CRT_ORG_BANK_16 defc CRT_ORG_BANK_16 = $8000 ENDIF IFNDEF CRT_ORG_BANK_17 defc CRT_ORG_BANK_17 = $8000 ENDIF IFNDEF CRT_ORG_BANK_18 defc CRT_ORG_BANK_18 = $8000 ENDIF IFNDEF CRT_ORG_BANK_19 defc CRT_ORG_BANK_19 = $8000 ENDIF IFNDEF CRT_ORG_BANK_1A defc CRT_ORG_BANK_1A = $8000 ENDIF IFNDEF CRT_ORG_BANK_1B defc CRT_ORG_BANK_1B = $8000 ENDIF IFNDEF CRT_ORG_BANK_1C defc CRT_ORG_BANK_1C = $8000 ENDIF IFNDEF CRT_ORG_BANK_1D defc CRT_ORG_BANK_1D = $8000 ENDIF IFNDEF CRT_ORG_BANK_1E defc CRT_ORG_BANK_1E = $8000 ENDIF IFNDEF CRT_ORG_BANK_1F defc CRT_ORG_BANK_1F = $8000 ENDIF IFNDEF CRT_ORG_BANK_20 defc CRT_ORG_BANK_20 = $8000 ENDIF IFNDEF CRT_ORG_BANK_21 defc CRT_ORG_BANK_21 = $8000 ENDIF IFNDEF CRT_ORG_BANK_22 defc CRT_ORG_BANK_22 = $8000 ENDIF IFNDEF CRT_ORG_BANK_23 defc CRT_ORG_BANK_23 = $8000 ENDIF IFNDEF CRT_ORG_BANK_24 defc CRT_ORG_BANK_24 = $8000 ENDIF IFNDEF CRT_ORG_BANK_25 defc CRT_ORG_BANK_25 = $8000 ENDIF IFNDEF CRT_ORG_BANK_26 defc CRT_ORG_BANK_26 = $8000 ENDIF IFNDEF CRT_ORG_BANK_27 defc CRT_ORG_BANK_27 = $8000 ENDIF IFNDEF CRT_ORG_BANK_28 defc CRT_ORG_BANK_28 = $8000 ENDIF IFNDEF CRT_ORG_BANK_29 defc CRT_ORG_BANK_29 = $8000 ENDIF IFNDEF CRT_ORG_BANK_2A defc CRT_ORG_BANK_2A = $8000 ENDIF IFNDEF CRT_ORG_BANK_2B defc CRT_ORG_BANK_2B = $8000 ENDIF IFNDEF CRT_ORG_BANK_2C defc CRT_ORG_BANK_2C = $8000 ENDIF IFNDEF CRT_ORG_BANK_2D defc CRT_ORG_BANK_2D = $8000 ENDIF IFNDEF CRT_ORG_BANK_2E defc CRT_ORG_BANK_2E = $8000 ENDIF IFNDEF CRT_ORG_BANK_2F defc CRT_ORG_BANK_2F = $8000 ENDIF IFNDEF CRT_ORG_BANK_30 defc CRT_ORG_BANK_30 = $8000 ENDIF IFNDEF CRT_ORG_BANK_31 defc CRT_ORG_BANK_31 = $8000 ENDIF IFNDEF CRT_ORG_BANK_32 defc CRT_ORG_BANK_32 = $8000 ENDIF IFNDEF CRT_ORG_BANK_33 defc CRT_ORG_BANK_33 = $8000 ENDIF IFNDEF CRT_ORG_BANK_34 defc CRT_ORG_BANK_34 = $8000 ENDIF IFNDEF CRT_ORG_BANK_35 defc CRT_ORG_BANK_35 = $8000 ENDIF IFNDEF CRT_ORG_BANK_36 defc CRT_ORG_BANK_36 = $8000 ENDIF IFNDEF CRT_ORG_BANK_37 defc CRT_ORG_BANK_37 = $8000 ENDIF IFNDEF CRT_ORG_BANK_38 defc CRT_ORG_BANK_38 = $8000 ENDIF IFNDEF CRT_ORG_BANK_39 defc CRT_ORG_BANK_39 = $8000 ENDIF IFNDEF CRT_ORG_BANK_3A defc CRT_ORG_BANK_3A = $8000 ENDIF IFNDEF CRT_ORG_BANK_3B defc CRT_ORG_BANK_3B = $8000 ENDIF IFNDEF CRT_ORG_BANK_3C defc CRT_ORG_BANK_3C = $8000 ENDIF IFNDEF CRT_ORG_BANK_3D defc CRT_ORG_BANK_3D = $8000 ENDIF IFNDEF CRT_ORG_BANK_3E defc CRT_ORG_BANK_3E = $8000 ENDIF IFNDEF CRT_ORG_BANK_3F defc CRT_ORG_BANK_3F = $8000 ENDIF IFNDEF CRT_ORG_BANK_40 defc CRT_ORG_BANK_40 = $8000 ENDIF IFNDEF CRT_ORG_BANK_41 defc CRT_ORG_BANK_41 = $8000 ENDIF IFNDEF CRT_ORG_BANK_42 defc CRT_ORG_BANK_42 = $8000 ENDIF IFNDEF CRT_ORG_BANK_43 defc CRT_ORG_BANK_43 = $8000 ENDIF IFNDEF CRT_ORG_BANK_44 defc CRT_ORG_BANK_44 = $8000 ENDIF IFNDEF CRT_ORG_BANK_45 defc CRT_ORG_BANK_45 = $8000 ENDIF IFNDEF CRT_ORG_BANK_46 defc CRT_ORG_BANK_46 = $8000 ENDIF IFNDEF CRT_ORG_BANK_47 defc CRT_ORG_BANK_47 = $8000 ENDIF IFNDEF CRT_ORG_BANK_48 defc CRT_ORG_BANK_48 = $8000 ENDIF IFNDEF CRT_ORG_BANK_49 defc CRT_ORG_BANK_49 = $8000 ENDIF IFNDEF CRT_ORG_BANK_4A defc CRT_ORG_BANK_4A = $8000 ENDIF IFNDEF CRT_ORG_BANK_4B defc CRT_ORG_BANK_4B = $8000 ENDIF IFNDEF CRT_ORG_BANK_4C defc CRT_ORG_BANK_4C = $8000 ENDIF IFNDEF CRT_ORG_BANK_4D defc CRT_ORG_BANK_4D = $8000 ENDIF IFNDEF CRT_ORG_BANK_4E defc CRT_ORG_BANK_4E = $8000 ENDIF IFNDEF CRT_ORG_BANK_4F defc CRT_ORG_BANK_4F = $8000 ENDIF IFNDEF CRT_ORG_BANK_50 defc CRT_ORG_BANK_50 = $8000 ENDIF IFNDEF CRT_ORG_BANK_51 defc CRT_ORG_BANK_51 = $8000 ENDIF IFNDEF CRT_ORG_BANK_52 defc CRT_ORG_BANK_52 = $8000 ENDIF IFNDEF CRT_ORG_BANK_53 defc CRT_ORG_BANK_53 = $8000 ENDIF IFNDEF CRT_ORG_BANK_54 defc CRT_ORG_BANK_54 = $8000 ENDIF IFNDEF CRT_ORG_BANK_55 defc CRT_ORG_BANK_55 = $8000 ENDIF IFNDEF CRT_ORG_BANK_56 defc CRT_ORG_BANK_56 = $8000 ENDIF IFNDEF CRT_ORG_BANK_57 defc CRT_ORG_BANK_57 = $8000 ENDIF IFNDEF CRT_ORG_BANK_58 defc CRT_ORG_BANK_58 = $8000 ENDIF IFNDEF CRT_ORG_BANK_59 defc CRT_ORG_BANK_59 = $8000 ENDIF IFNDEF CRT_ORG_BANK_5A defc CRT_ORG_BANK_5A = $8000 ENDIF IFNDEF CRT_ORG_BANK_5B defc CRT_ORG_BANK_5B = $8000 ENDIF IFNDEF CRT_ORG_BANK_5C defc CRT_ORG_BANK_5C = $8000 ENDIF IFNDEF CRT_ORG_BANK_5D defc CRT_ORG_BANK_5D = $8000 ENDIF IFNDEF CRT_ORG_BANK_5E defc CRT_ORG_BANK_5E = $8000 ENDIF IFNDEF CRT_ORG_BANK_5F defc CRT_ORG_BANK_5F = $8000 ENDIF IFNDEF CRT_ORG_BANK_60 defc CRT_ORG_BANK_60 = $8000 ENDIF IFNDEF CRT_ORG_BANK_61 defc CRT_ORG_BANK_61 = $8000 ENDIF IFNDEF CRT_ORG_BANK_62 defc CRT_ORG_BANK_62 = $8000 ENDIF IFNDEF CRT_ORG_BANK_63 defc CRT_ORG_BANK_63 = $8000 ENDIF IFNDEF CRT_ORG_BANK_64 defc CRT_ORG_BANK_64 = $8000 ENDIF IFNDEF CRT_ORG_BANK_65 defc CRT_ORG_BANK_65 = $8000 ENDIF IFNDEF CRT_ORG_BANK_66 defc CRT_ORG_BANK_66 = $8000 ENDIF IFNDEF CRT_ORG_BANK_67 defc CRT_ORG_BANK_67 = $8000 ENDIF IFNDEF CRT_ORG_BANK_68 defc CRT_ORG_BANK_68 = $8000 ENDIF IFNDEF CRT_ORG_BANK_69 defc CRT_ORG_BANK_69 = $8000 ENDIF IFNDEF CRT_ORG_BANK_6A defc CRT_ORG_BANK_6A = $8000 ENDIF IFNDEF CRT_ORG_BANK_6B defc CRT_ORG_BANK_6B = $8000 ENDIF IFNDEF CRT_ORG_BANK_6C defc CRT_ORG_BANK_6C = $8000 ENDIF IFNDEF CRT_ORG_BANK_6D defc CRT_ORG_BANK_6D = $8000 ENDIF IFNDEF CRT_ORG_BANK_6E defc CRT_ORG_BANK_6E = $8000 ENDIF IFNDEF CRT_ORG_BANK_6F defc CRT_ORG_BANK_6F = $8000 ENDIF IFNDEF CRT_ORG_BANK_70 defc CRT_ORG_BANK_70 = $8000 ENDIF IFNDEF CRT_ORG_BANK_71 defc CRT_ORG_BANK_71 = $8000 ENDIF IFNDEF CRT_ORG_BANK_72 defc CRT_ORG_BANK_72 = $8000 ENDIF IFNDEF CRT_ORG_BANK_73 defc CRT_ORG_BANK_73 = $8000 ENDIF IFNDEF CRT_ORG_BANK_74 defc CRT_ORG_BANK_74 = $8000 ENDIF IFNDEF CRT_ORG_BANK_75 defc CRT_ORG_BANK_75 = $8000 ENDIF IFNDEF CRT_ORG_BANK_76 defc CRT_ORG_BANK_76 = $8000 ENDIF IFNDEF CRT_ORG_BANK_77 defc CRT_ORG_BANK_77 = $8000 ENDIF IFNDEF CRT_ORG_BANK_78 defc CRT_ORG_BANK_78 = $8000 ENDIF IFNDEF CRT_ORG_BANK_79 defc CRT_ORG_BANK_79 = $8000 ENDIF IFNDEF CRT_ORG_BANK_7A defc CRT_ORG_BANK_7A = $8000 ENDIF IFNDEF CRT_ORG_BANK_7B defc CRT_ORG_BANK_7B = $8000 ENDIF IFNDEF CRT_ORG_BANK_7C defc CRT_ORG_BANK_7C = $8000 ENDIF IFNDEF CRT_ORG_BANK_7D defc CRT_ORG_BANK_7D = $8000 ENDIF IFNDEF CRT_ORG_BANK_7E defc CRT_ORG_BANK_7E = $8000 ENDIF IFNDEF CRT_ORG_BANK_7F defc CRT_ORG_BANK_7F = $8000 ENDIF IFNDEF CRT_ORG_BANK_80 defc CRT_ORG_BANK_80 = $8000 ENDIF IFNDEF CRT_ORG_BANK_81 defc CRT_ORG_BANK_81 = $8000 ENDIF IFNDEF CRT_ORG_BANK_82 defc CRT_ORG_BANK_82 = $8000 ENDIF IFNDEF CRT_ORG_BANK_83 defc CRT_ORG_BANK_83 = $8000 ENDIF IFNDEF CRT_ORG_BANK_84 defc CRT_ORG_BANK_84 = $8000 ENDIF IFNDEF CRT_ORG_BANK_85 defc CRT_ORG_BANK_85 = $8000 ENDIF IFNDEF CRT_ORG_BANK_86 defc CRT_ORG_BANK_86 = $8000 ENDIF IFNDEF CRT_ORG_BANK_87 defc CRT_ORG_BANK_87 = $8000 ENDIF IFNDEF CRT_ORG_BANK_88 defc CRT_ORG_BANK_88 = $8000 ENDIF IFNDEF CRT_ORG_BANK_89 defc CRT_ORG_BANK_89 = $8000 ENDIF IFNDEF CRT_ORG_BANK_8A defc CRT_ORG_BANK_8A = $8000 ENDIF IFNDEF CRT_ORG_BANK_8B defc CRT_ORG_BANK_8B = $8000 ENDIF IFNDEF CRT_ORG_BANK_8C defc CRT_ORG_BANK_8C = $8000 ENDIF IFNDEF CRT_ORG_BANK_8D defc CRT_ORG_BANK_8D = $8000 ENDIF IFNDEF CRT_ORG_BANK_8E defc CRT_ORG_BANK_8E = $8000 ENDIF IFNDEF CRT_ORG_BANK_8F defc CRT_ORG_BANK_8F = $8000 ENDIF IFNDEF CRT_ORG_BANK_90 defc CRT_ORG_BANK_90 = $8000 ENDIF IFNDEF CRT_ORG_BANK_91 defc CRT_ORG_BANK_91 = $8000 ENDIF IFNDEF CRT_ORG_BANK_92 defc CRT_ORG_BANK_92 = $8000 ENDIF IFNDEF CRT_ORG_BANK_93 defc CRT_ORG_BANK_93 = $8000 ENDIF IFNDEF CRT_ORG_BANK_94 defc CRT_ORG_BANK_94 = $8000 ENDIF IFNDEF CRT_ORG_BANK_95 defc CRT_ORG_BANK_95 = $8000 ENDIF IFNDEF CRT_ORG_BANK_96 defc CRT_ORG_BANK_96 = $8000 ENDIF IFNDEF CRT_ORG_BANK_97 defc CRT_ORG_BANK_97 = $8000 ENDIF IFNDEF CRT_ORG_BANK_98 defc CRT_ORG_BANK_98 = $8000 ENDIF IFNDEF CRT_ORG_BANK_99 defc CRT_ORG_BANK_99 = $8000 ENDIF IFNDEF CRT_ORG_BANK_9A defc CRT_ORG_BANK_9A = $8000 ENDIF IFNDEF CRT_ORG_BANK_9B defc CRT_ORG_BANK_9B = $8000 ENDIF IFNDEF CRT_ORG_BANK_9C defc CRT_ORG_BANK_9C = $8000 ENDIF IFNDEF CRT_ORG_BANK_9D defc CRT_ORG_BANK_9D = $8000 ENDIF IFNDEF CRT_ORG_BANK_9E defc CRT_ORG_BANK_9E = $8000 ENDIF IFNDEF CRT_ORG_BANK_9F defc CRT_ORG_BANK_9F = $8000 ENDIF IFNDEF CRT_ORG_BANK_A0 defc CRT_ORG_BANK_A0 = $8000 ENDIF IFNDEF CRT_ORG_BANK_A1 defc CRT_ORG_BANK_A1 = $8000 ENDIF IFNDEF CRT_ORG_BANK_A2 defc CRT_ORG_BANK_A2 = $8000 ENDIF IFNDEF CRT_ORG_BANK_A3 defc CRT_ORG_BANK_A3 = $8000 ENDIF IFNDEF CRT_ORG_BANK_A4 defc CRT_ORG_BANK_A4 = $8000 ENDIF IFNDEF CRT_ORG_BANK_A5 defc CRT_ORG_BANK_A5 = $8000 ENDIF IFNDEF CRT_ORG_BANK_A6 defc CRT_ORG_BANK_A6 = $8000 ENDIF IFNDEF CRT_ORG_BANK_A7 defc CRT_ORG_BANK_A7 = $8000 ENDIF IFNDEF CRT_ORG_BANK_A8 defc CRT_ORG_BANK_A8 = $8000 ENDIF IFNDEF CRT_ORG_BANK_A9 defc CRT_ORG_BANK_A9 = $8000 ENDIF IFNDEF CRT_ORG_BANK_AA defc CRT_ORG_BANK_AA = $8000 ENDIF IFNDEF CRT_ORG_BANK_AB defc CRT_ORG_BANK_AB = $8000 ENDIF IFNDEF CRT_ORG_BANK_AC defc CRT_ORG_BANK_AC = $8000 ENDIF IFNDEF CRT_ORG_BANK_AD defc CRT_ORG_BANK_AD = $8000 ENDIF IFNDEF CRT_ORG_BANK_AE defc CRT_ORG_BANK_AE = $8000 ENDIF IFNDEF CRT_ORG_BANK_AF defc CRT_ORG_BANK_AF = $8000 ENDIF IFNDEF CRT_ORG_BANK_B0 defc CRT_ORG_BANK_B0 = $8000 ENDIF IFNDEF CRT_ORG_BANK_B1 defc CRT_ORG_BANK_B1 = $8000 ENDIF IFNDEF CRT_ORG_BANK_B2 defc CRT_ORG_BANK_B2 = $8000 ENDIF IFNDEF CRT_ORG_BANK_B3 defc CRT_ORG_BANK_B3 = $8000 ENDIF IFNDEF CRT_ORG_BANK_B4 defc CRT_ORG_BANK_B4 = $8000 ENDIF IFNDEF CRT_ORG_BANK_B5 defc CRT_ORG_BANK_B5 = $8000 ENDIF IFNDEF CRT_ORG_BANK_B6 defc CRT_ORG_BANK_B6 = $8000 ENDIF IFNDEF CRT_ORG_BANK_B7 defc CRT_ORG_BANK_B7 = $8000 ENDIF IFNDEF CRT_ORG_BANK_B8 defc CRT_ORG_BANK_B8 = $8000 ENDIF IFNDEF CRT_ORG_BANK_B9 defc CRT_ORG_BANK_B9 = $8000 ENDIF IFNDEF CRT_ORG_BANK_BA defc CRT_ORG_BANK_BA = $8000 ENDIF IFNDEF CRT_ORG_BANK_BB defc CRT_ORG_BANK_BB = $8000 ENDIF IFNDEF CRT_ORG_BANK_BC defc CRT_ORG_BANK_BC = $8000 ENDIF IFNDEF CRT_ORG_BANK_BD defc CRT_ORG_BANK_BD = $8000 ENDIF IFNDEF CRT_ORG_BANK_BE defc CRT_ORG_BANK_BE = $8000 ENDIF IFNDEF CRT_ORG_BANK_BF defc CRT_ORG_BANK_BF = $8000 ENDIF IFNDEF CRT_ORG_BANK_C0 defc CRT_ORG_BANK_C0 = $8000 ENDIF IFNDEF CRT_ORG_BANK_C1 defc CRT_ORG_BANK_C1 = $8000 ENDIF IFNDEF CRT_ORG_BANK_C2 defc CRT_ORG_BANK_C2 = $8000 ENDIF IFNDEF CRT_ORG_BANK_C3 defc CRT_ORG_BANK_C3 = $8000 ENDIF IFNDEF CRT_ORG_BANK_C4 defc CRT_ORG_BANK_C4 = $8000 ENDIF IFNDEF CRT_ORG_BANK_C5 defc CRT_ORG_BANK_C5 = $8000 ENDIF IFNDEF CRT_ORG_BANK_C6 defc CRT_ORG_BANK_C6 = $8000 ENDIF IFNDEF CRT_ORG_BANK_C7 defc CRT_ORG_BANK_C7 = $8000 ENDIF IFNDEF CRT_ORG_BANK_C8 defc CRT_ORG_BANK_C8 = $8000 ENDIF IFNDEF CRT_ORG_BANK_C9 defc CRT_ORG_BANK_C9 = $8000 ENDIF IFNDEF CRT_ORG_BANK_CA defc CRT_ORG_BANK_CA = $8000 ENDIF IFNDEF CRT_ORG_BANK_CB defc CRT_ORG_BANK_CB = $8000 ENDIF IFNDEF CRT_ORG_BANK_CC defc CRT_ORG_BANK_CC = $8000 ENDIF IFNDEF CRT_ORG_BANK_CD defc CRT_ORG_BANK_CD = $8000 ENDIF IFNDEF CRT_ORG_BANK_CE defc CRT_ORG_BANK_CE = $8000 ENDIF IFNDEF CRT_ORG_BANK_CF defc CRT_ORG_BANK_CF = $8000 ENDIF IFNDEF CRT_ORG_BANK_D0 defc CRT_ORG_BANK_D0 = $8000 ENDIF IFNDEF CRT_ORG_BANK_D1 defc CRT_ORG_BANK_D1 = $8000 ENDIF IFNDEF CRT_ORG_BANK_D2 defc CRT_ORG_BANK_D2 = $8000 ENDIF IFNDEF CRT_ORG_BANK_D3 defc CRT_ORG_BANK_D3 = $8000 ENDIF IFNDEF CRT_ORG_BANK_D4 defc CRT_ORG_BANK_D4 = $8000 ENDIF IFNDEF CRT_ORG_BANK_D5 defc CRT_ORG_BANK_D5 = $8000 ENDIF IFNDEF CRT_ORG_BANK_D6 defc CRT_ORG_BANK_D6 = $8000 ENDIF IFNDEF CRT_ORG_BANK_D7 defc CRT_ORG_BANK_D7 = $8000 ENDIF IFNDEF CRT_ORG_BANK_D8 defc CRT_ORG_BANK_D8 = $8000 ENDIF IFNDEF CRT_ORG_BANK_D9 defc CRT_ORG_BANK_D9 = $8000 ENDIF IFNDEF CRT_ORG_BANK_DA defc CRT_ORG_BANK_DA = $8000 ENDIF IFNDEF CRT_ORG_BANK_DB defc CRT_ORG_BANK_DB = $8000 ENDIF IFNDEF CRT_ORG_BANK_DC defc CRT_ORG_BANK_DC = $8000 ENDIF IFNDEF CRT_ORG_BANK_DD defc CRT_ORG_BANK_DD = $8000 ENDIF IFNDEF CRT_ORG_BANK_DE defc CRT_ORG_BANK_DE = $8000 ENDIF IFNDEF CRT_ORG_BANK_DF defc CRT_ORG_BANK_DF = $8000 ENDIF IFNDEF CRT_ORG_BANK_E0 defc CRT_ORG_BANK_E0 = $8000 ENDIF IFNDEF CRT_ORG_BANK_E1 defc CRT_ORG_BANK_E1 = $8000 ENDIF IFNDEF CRT_ORG_BANK_E2 defc CRT_ORG_BANK_E2 = $8000 ENDIF IFNDEF CRT_ORG_BANK_E3 defc CRT_ORG_BANK_E3 = $8000 ENDIF IFNDEF CRT_ORG_BANK_E4 defc CRT_ORG_BANK_E4 = $8000 ENDIF IFNDEF CRT_ORG_BANK_E5 defc CRT_ORG_BANK_E5 = $8000 ENDIF IFNDEF CRT_ORG_BANK_E6 defc CRT_ORG_BANK_E6 = $8000 ENDIF IFNDEF CRT_ORG_BANK_E7 defc CRT_ORG_BANK_E7 = $8000 ENDIF IFNDEF CRT_ORG_BANK_E8 defc CRT_ORG_BANK_E8 = $8000 ENDIF IFNDEF CRT_ORG_BANK_E9 defc CRT_ORG_BANK_E9 = $8000 ENDIF IFNDEF CRT_ORG_BANK_EA defc CRT_ORG_BANK_EA = $8000 ENDIF IFNDEF CRT_ORG_BANK_EB defc CRT_ORG_BANK_EB = $8000 ENDIF IFNDEF CRT_ORG_BANK_EC defc CRT_ORG_BANK_EC = $8000 ENDIF IFNDEF CRT_ORG_BANK_ED defc CRT_ORG_BANK_ED = $8000 ENDIF IFNDEF CRT_ORG_BANK_EE defc CRT_ORG_BANK_EE = $8000 ENDIF IFNDEF CRT_ORG_BANK_EF defc CRT_ORG_BANK_EF = $8000 ENDIF IFNDEF CRT_ORG_BANK_F0 defc CRT_ORG_BANK_F0 = $8000 ENDIF IFNDEF CRT_ORG_BANK_F1 defc CRT_ORG_BANK_F1 = $8000 ENDIF IFNDEF CRT_ORG_BANK_F2 defc CRT_ORG_BANK_F2 = $8000 ENDIF IFNDEF CRT_ORG_BANK_F3 defc CRT_ORG_BANK_F3 = $8000 ENDIF IFNDEF CRT_ORG_BANK_F4 defc CRT_ORG_BANK_F4 = $8000 ENDIF IFNDEF CRT_ORG_BANK_F5 defc CRT_ORG_BANK_F5 = $8000 ENDIF IFNDEF CRT_ORG_BANK_F6 defc CRT_ORG_BANK_F6 = $8000 ENDIF IFNDEF CRT_ORG_BANK_F7 defc CRT_ORG_BANK_F7 = $8000 ENDIF IFNDEF CRT_ORG_BANK_F8 defc CRT_ORG_BANK_F8 = $8000 ENDIF IFNDEF CRT_ORG_BANK_F9 defc CRT_ORG_BANK_F9 = $8000 ENDIF IFNDEF CRT_ORG_BANK_FA defc CRT_ORG_BANK_FA = $8000 ENDIF IFNDEF CRT_ORG_BANK_FB defc CRT_ORG_BANK_FB = $8000 ENDIF IFNDEF CRT_ORG_BANK_FC defc CRT_ORG_BANK_FC = $8000 ENDIF IFNDEF CRT_ORG_BANK_FD defc CRT_ORG_BANK_FD = $8000 ENDIF IFNDEF CRT_ORG_BANK_FE defc CRT_ORG_BANK_FE = $8000 ENDIF IFNDEF CRT_ORG_BANK_FF defc CRT_ORG_BANK_FF = $8000 ENDIF SECTION BANK_01 org $010000 + CRT_ORG_BANK_01 SECTION CODE_1 SECTION RODATA_1 SECTION BANK_02 org $020000 + CRT_ORG_BANK_02 SECTION CODE_2 SECTION RODATA_2 SECTION BANK_03 org $030000 + CRT_ORG_BANK_03 SECTION CODE_3 SECTION RODATA_3 SECTION BANK_04 org $040000 + CRT_ORG_BANK_04 SECTION CODE_4 SECTION RODATA_4 SECTION BANK_05 org $050000 + CRT_ORG_BANK_05 SECTION CODE_5 SECTION RODATA_5 SECTION BANK_06 org $060000 + CRT_ORG_BANK_06 SECTION CODE_6 SECTION RODATA_6 SECTION BANK_07 org $070000 + CRT_ORG_BANK_07 SECTION CODE_7 SECTION RODATA_7 SECTION BANK_08 org $080000 + CRT_ORG_BANK_08 SECTION CODE_8 SECTION RODATA_8 SECTION BANK_09 org $090000 + CRT_ORG_BANK_09 SECTION CODE_9 SECTION RODATA_9 SECTION BANK_0A org $0a0000 + CRT_ORG_BANK_0A SECTION CODE_10 SECTION RODATA_10 SECTION BANK_0B org $0b0000 + CRT_ORG_BANK_0B SECTION CODE_11 SECTION RODATA_11 SECTION BANK_0C org $0c0000 + CRT_ORG_BANK_0C SECTION CODE_12 SECTION RODATA_12 SECTION BANK_0D org $0d0000 + CRT_ORG_BANK_0D SECTION CODE_13 SECTION RODATA_13 SECTION BANK_0E org $0e0000 + CRT_ORG_BANK_0E SECTION CODE_14 SECTION RODATA_14 SECTION BANK_0F org $0f0000 + CRT_ORG_BANK_0F SECTION CODE_15 SECTION RODATA_15 SECTION BANK_10 org $100000 + CRT_ORG_BANK_10 SECTION CODE_16 SECTION RODATA_16 SECTION BANK_11 org $110000 + CRT_ORG_BANK_11 SECTION CODE_17 SECTION RODATA_17 SECTION BANK_12 org $120000 + CRT_ORG_BANK_12 SECTION CODE_18 SECTION RODATA_18 SECTION BANK_13 org $130000 + CRT_ORG_BANK_13 SECTION CODE_19 SECTION RODATA_19 SECTION BANK_14 org $140000 + CRT_ORG_BANK_14 SECTION CODE_20 SECTION RODATA_20 SECTION BANK_15 org $150000 + CRT_ORG_BANK_15 SECTION CODE_21 SECTION RODATA_21 SECTION BANK_16 org $160000 + CRT_ORG_BANK_16 SECTION CODE_22 SECTION RODATA_22 SECTION BANK_17 org $170000 + CRT_ORG_BANK_17 SECTION CODE_23 SECTION RODATA_23 SECTION BANK_18 org $180000 + CRT_ORG_BANK_18 SECTION CODE_24 SECTION RODATA_24 SECTION BANK_19 org $190000 + CRT_ORG_BANK_19 SECTION CODE_25 SECTION RODATA_25 SECTION BANK_1A org $1a0000 + CRT_ORG_BANK_1A SECTION CODE_26 SECTION RODATA_26 SECTION BANK_1B org $1b0000 + CRT_ORG_BANK_1B SECTION CODE_27 SECTION RODATA_27 SECTION BANK_1C org $1c0000 + CRT_ORG_BANK_1C SECTION CODE_28 SECTION RODATA_28 SECTION BANK_1D org $1d0000 + CRT_ORG_BANK_1D SECTION CODE_29 SECTION RODATA_29 SECTION BANK_1E org $1e0000 + CRT_ORG_BANK_1E SECTION CODE_30 SECTION RODATA_30 SECTION BANK_1F org $1f0000 + CRT_ORG_BANK_1F SECTION CODE_31 SECTION RODATA_31 SECTION BANK_20 org $200000 + CRT_ORG_BANK_20 SECTION CODE_32 SECTION RODATA_32 SECTION BANK_21 org $210000 + CRT_ORG_BANK_21 SECTION CODE_33 SECTION RODATA_33 SECTION BANK_22 org $220000 + CRT_ORG_BANK_22 SECTION CODE_34 SECTION RODATA_34 SECTION BANK_23 org $230000 + CRT_ORG_BANK_23 SECTION CODE_35 SECTION RODATA_35 SECTION BANK_24 org $240000 + CRT_ORG_BANK_24 SECTION CODE_36 SECTION RODATA_36 SECTION BANK_25 org $250000 + CRT_ORG_BANK_25 SECTION CODE_37 SECTION RODATA_37 SECTION BANK_26 org $260000 + CRT_ORG_BANK_26 SECTION CODE_38 SECTION RODATA_38 SECTION BANK_27 org $270000 + CRT_ORG_BANK_27 SECTION CODE_39 SECTION RODATA_39 SECTION BANK_28 org $280000 + CRT_ORG_BANK_28 SECTION CODE_40 SECTION RODATA_40 SECTION BANK_29 org $290000 + CRT_ORG_BANK_29 SECTION CODE_41 SECTION RODATA_41 SECTION BANK_2A org $2a0000 + CRT_ORG_BANK_2A SECTION CODE_42 SECTION RODATA_42 SECTION BANK_2B org $2b0000 + CRT_ORG_BANK_2B SECTION CODE_43 SECTION RODATA_43 SECTION BANK_2C org $2c0000 + CRT_ORG_BANK_2C SECTION CODE_44 SECTION RODATA_44 SECTION BANK_2D org $2d0000 + CRT_ORG_BANK_2D SECTION CODE_45 SECTION RODATA_45 SECTION BANK_2E org $2e0000 + CRT_ORG_BANK_2E SECTION CODE_46 SECTION RODATA_46 SECTION BANK_2F org $2f0000 + CRT_ORG_BANK_2F SECTION CODE_47 SECTION RODATA_47 SECTION BANK_30 org $300000 + CRT_ORG_BANK_30 SECTION CODE_48 SECTION RODATA_48 SECTION BANK_31 org $310000 + CRT_ORG_BANK_31 SECTION CODE_49 SECTION RODATA_49 SECTION BANK_32 org $320000 + CRT_ORG_BANK_32 SECTION CODE_50 SECTION RODATA_50 SECTION BANK_33 org $330000 + CRT_ORG_BANK_33 SECTION CODE_51 SECTION RODATA_51 SECTION BANK_34 org $340000 + CRT_ORG_BANK_34 SECTION CODE_52 SECTION RODATA_52 SECTION BANK_35 org $350000 + CRT_ORG_BANK_35 SECTION CODE_53 SECTION RODATA_53 SECTION BANK_36 org $360000 + CRT_ORG_BANK_36 SECTION CODE_54 SECTION RODATA_54 SECTION BANK_37 org $370000 + CRT_ORG_BANK_37 SECTION CODE_55 SECTION RODATA_55 SECTION BANK_38 org $380000 + CRT_ORG_BANK_38 SECTION CODE_56 SECTION RODATA_56 SECTION BANK_39 org $390000 + CRT_ORG_BANK_39 SECTION CODE_57 SECTION RODATA_57 SECTION BANK_3A org $3a0000 + CRT_ORG_BANK_3A SECTION CODE_58 SECTION RODATA_58 SECTION BANK_3B org $3b0000 + CRT_ORG_BANK_3B SECTION CODE_59 SECTION RODATA_59 SECTION BANK_3C org $3c0000 + CRT_ORG_BANK_3C SECTION CODE_60 SECTION RODATA_60 SECTION BANK_3D org $3d0000 + CRT_ORG_BANK_3D SECTION CODE_61 SECTION RODATA_61 SECTION BANK_3E org $3e0000 + CRT_ORG_BANK_3E SECTION CODE_62 SECTION RODATA_62 SECTION BANK_3F org $3f0000 + CRT_ORG_BANK_3F SECTION CODE_63 SECTION RODATA_63 SECTION BANK_40 org $400000 + CRT_ORG_BANK_40 SECTION CODE_64 SECTION RODATA_64 SECTION BANK_41 org $410000 + CRT_ORG_BANK_41 SECTION CODE_65 SECTION RODATA_65 SECTION BANK_42 org $420000 + CRT_ORG_BANK_42 SECTION CODE_66 SECTION RODATA_66 SECTION BANK_43 org $430000 + CRT_ORG_BANK_43 SECTION CODE_67 SECTION RODATA_67 SECTION BANK_44 org $440000 + CRT_ORG_BANK_44 SECTION CODE_68 SECTION RODATA_68 SECTION BANK_45 org $450000 + CRT_ORG_BANK_45 SECTION CODE_69 SECTION RODATA_69 SECTION BANK_46 org $460000 + CRT_ORG_BANK_46 SECTION CODE_70 SECTION RODATA_70 SECTION BANK_47 org $470000 + CRT_ORG_BANK_47 SECTION CODE_71 SECTION RODATA_71 SECTION BANK_48 org $480000 + CRT_ORG_BANK_48 SECTION CODE_72 SECTION RODATA_72 SECTION BANK_49 org $490000 + CRT_ORG_BANK_49 SECTION CODE_73 SECTION RODATA_73 SECTION BANK_4A org $4a0000 + CRT_ORG_BANK_4A SECTION CODE_74 SECTION RODATA_74 SECTION BANK_4B org $4b0000 + CRT_ORG_BANK_4B SECTION CODE_75 SECTION RODATA_75 SECTION BANK_4C org $4c0000 + CRT_ORG_BANK_4C SECTION CODE_76 SECTION RODATA_76 SECTION BANK_4D org $4d0000 + CRT_ORG_BANK_4D SECTION CODE_77 SECTION RODATA_77 SECTION BANK_4E org $4e0000 + CRT_ORG_BANK_4E SECTION CODE_78 SECTION RODATA_78 SECTION BANK_4F org $4f0000 + CRT_ORG_BANK_4F SECTION CODE_79 SECTION RODATA_79 SECTION BANK_50 org $500000 + CRT_ORG_BANK_50 SECTION CODE_80 SECTION RODATA_80 SECTION BANK_51 org $510000 + CRT_ORG_BANK_51 SECTION CODE_81 SECTION RODATA_81 SECTION BANK_52 org $520000 + CRT_ORG_BANK_52 SECTION CODE_82 SECTION RODATA_82 SECTION BANK_53 org $530000 + CRT_ORG_BANK_53 SECTION CODE_83 SECTION RODATA_83 SECTION BANK_54 org $540000 + CRT_ORG_BANK_54 SECTION CODE_84 SECTION RODATA_84 SECTION BANK_55 org $550000 + CRT_ORG_BANK_55 SECTION CODE_85 SECTION RODATA_85 SECTION BANK_56 org $560000 + CRT_ORG_BANK_56 SECTION CODE_86 SECTION RODATA_86 SECTION BANK_57 org $570000 + CRT_ORG_BANK_57 SECTION CODE_87 SECTION RODATA_87 SECTION BANK_58 org $580000 + CRT_ORG_BANK_58 SECTION CODE_88 SECTION RODATA_88 SECTION BANK_59 org $590000 + CRT_ORG_BANK_59 SECTION CODE_89 SECTION RODATA_89 SECTION BANK_5A org $5a0000 + CRT_ORG_BANK_5A SECTION CODE_90 SECTION RODATA_90 SECTION BANK_5B org $5b0000 + CRT_ORG_BANK_5B SECTION CODE_91 SECTION RODATA_91 SECTION BANK_5C org $5c0000 + CRT_ORG_BANK_5C SECTION CODE_92 SECTION RODATA_92 SECTION BANK_5D org $5d0000 + CRT_ORG_BANK_5D SECTION CODE_93 SECTION RODATA_93 SECTION BANK_5E org $5e0000 + CRT_ORG_BANK_5E SECTION CODE_94 SECTION RODATA_94 SECTION BANK_5F org $5f0000 + CRT_ORG_BANK_5F SECTION CODE_95 SECTION RODATA_95 SECTION BANK_60 org $600000 + CRT_ORG_BANK_60 SECTION CODE_96 SECTION RODATA_96 SECTION BANK_61 org $610000 + CRT_ORG_BANK_61 SECTION CODE_97 SECTION RODATA_97 SECTION BANK_62 org $620000 + CRT_ORG_BANK_62 SECTION CODE_98 SECTION RODATA_98 SECTION BANK_63 org $630000 + CRT_ORG_BANK_63 SECTION CODE_99 SECTION RODATA_99 SECTION BANK_64 org $640000 + CRT_ORG_BANK_64 SECTION CODE_100 SECTION RODATA_100 SECTION BANK_65 org $650000 + CRT_ORG_BANK_65 SECTION CODE_101 SECTION RODATA_101 SECTION BANK_66 org $660000 + CRT_ORG_BANK_66 SECTION CODE_102 SECTION RODATA_102 SECTION BANK_67 org $670000 + CRT_ORG_BANK_67 SECTION CODE_103 SECTION RODATA_103 SECTION BANK_68 org $680000 + CRT_ORG_BANK_68 SECTION CODE_104 SECTION RODATA_104 SECTION BANK_69 org $690000 + CRT_ORG_BANK_69 SECTION CODE_105 SECTION RODATA_105 SECTION BANK_6A org $6a0000 + CRT_ORG_BANK_6A SECTION CODE_106 SECTION RODATA_106 SECTION BANK_6B org $6b0000 + CRT_ORG_BANK_6B SECTION CODE_107 SECTION RODATA_107 SECTION BANK_6C org $6c0000 + CRT_ORG_BANK_6C SECTION CODE_108 SECTION RODATA_108 SECTION BANK_6D org $6d0000 + CRT_ORG_BANK_6D SECTION CODE_109 SECTION RODATA_109 SECTION BANK_6E org $6e0000 + CRT_ORG_BANK_6E SECTION CODE_110 SECTION RODATA_110 SECTION BANK_6F org $6f0000 + CRT_ORG_BANK_6F SECTION CODE_111 SECTION RODATA_111 SECTION BANK_70 org $700000 + CRT_ORG_BANK_70 SECTION CODE_112 SECTION RODATA_112 SECTION BANK_71 org $710000 + CRT_ORG_BANK_71 SECTION CODE_113 SECTION RODATA_113 SECTION BANK_72 org $720000 + CRT_ORG_BANK_72 SECTION CODE_114 SECTION RODATA_114 SECTION BANK_73 org $730000 + CRT_ORG_BANK_73 SECTION CODE_115 SECTION RODATA_115 SECTION BANK_74 org $740000 + CRT_ORG_BANK_74 SECTION CODE_116 SECTION RODATA_116 SECTION BANK_75 org $750000 + CRT_ORG_BANK_75 SECTION CODE_117 SECTION RODATA_117 SECTION BANK_76 org $760000 + CRT_ORG_BANK_76 SECTION CODE_118 SECTION RODATA_118 SECTION BANK_77 org $770000 + CRT_ORG_BANK_77 SECTION CODE_119 SECTION RODATA_119 SECTION BANK_78 org $780000 + CRT_ORG_BANK_78 SECTION CODE_120 SECTION RODATA_120 SECTION BANK_79 org $790000 + CRT_ORG_BANK_79 SECTION CODE_121 SECTION RODATA_121 SECTION BANK_7A org $7a0000 + CRT_ORG_BANK_7A SECTION CODE_122 SECTION RODATA_122 SECTION BANK_7B org $7b0000 + CRT_ORG_BANK_7B SECTION CODE_123 SECTION RODATA_123 SECTION BANK_7C org $7c0000 + CRT_ORG_BANK_7C SECTION CODE_124 SECTION RODATA_124 SECTION BANK_7D org $7d0000 + CRT_ORG_BANK_7D SECTION CODE_125 SECTION RODATA_125 SECTION BANK_7E org $7e0000 + CRT_ORG_BANK_7E SECTION CODE_126 SECTION RODATA_126 SECTION BANK_7F org $7f0000 + CRT_ORG_BANK_7F SECTION CODE_127 SECTION RODATA_127 SECTION BANK_80 org $800000 + CRT_ORG_BANK_80 SECTION CODE_128 SECTION RODATA_128 SECTION BANK_81 org $810000 + CRT_ORG_BANK_81 SECTION CODE_129 SECTION RODATA_129 SECTION BANK_82 org $820000 + CRT_ORG_BANK_82 SECTION CODE_130 SECTION RODATA_130 SECTION BANK_83 org $830000 + CRT_ORG_BANK_83 SECTION CODE_131 SECTION RODATA_131 SECTION BANK_84 org $840000 + CRT_ORG_BANK_84 SECTION CODE_132 SECTION RODATA_132 SECTION BANK_85 org $850000 + CRT_ORG_BANK_85 SECTION CODE_133 SECTION RODATA_133 SECTION BANK_86 org $860000 + CRT_ORG_BANK_86 SECTION CODE_134 SECTION RODATA_134 SECTION BANK_87 org $870000 + CRT_ORG_BANK_87 SECTION CODE_135 SECTION RODATA_135 SECTION BANK_88 org $880000 + CRT_ORG_BANK_88 SECTION CODE_136 SECTION RODATA_136 SECTION BANK_89 org $890000 + CRT_ORG_BANK_89 SECTION CODE_137 SECTION RODATA_137 SECTION BANK_8A org $8a0000 + CRT_ORG_BANK_8A SECTION CODE_138 SECTION RODATA_138 SECTION BANK_8B org $8b0000 + CRT_ORG_BANK_8B SECTION CODE_139 SECTION RODATA_139 SECTION BANK_8C org $8c0000 + CRT_ORG_BANK_8C SECTION CODE_140 SECTION RODATA_140 SECTION BANK_8D org $8d0000 + CRT_ORG_BANK_8D SECTION CODE_141 SECTION RODATA_141 SECTION BANK_8E org $8e0000 + CRT_ORG_BANK_8E SECTION CODE_142 SECTION RODATA_142 SECTION BANK_8F org $8f0000 + CRT_ORG_BANK_8F SECTION CODE_143 SECTION RODATA_143 SECTION BANK_90 org $900000 + CRT_ORG_BANK_90 SECTION CODE_144 SECTION RODATA_144 SECTION BANK_91 org $910000 + CRT_ORG_BANK_91 SECTION CODE_145 SECTION RODATA_145 SECTION BANK_92 org $920000 + CRT_ORG_BANK_92 SECTION CODE_146 SECTION RODATA_146 SECTION BANK_93 org $930000 + CRT_ORG_BANK_93 SECTION CODE_147 SECTION RODATA_147 SECTION BANK_94 org $940000 + CRT_ORG_BANK_94 SECTION CODE_148 SECTION RODATA_148 SECTION BANK_95 org $950000 + CRT_ORG_BANK_95 SECTION CODE_149 SECTION RODATA_149 SECTION BANK_96 org $960000 + CRT_ORG_BANK_96 SECTION CODE_150 SECTION RODATA_150 SECTION BANK_97 org $970000 + CRT_ORG_BANK_97 SECTION CODE_151 SECTION RODATA_151 SECTION BANK_98 org $980000 + CRT_ORG_BANK_98 SECTION CODE_152 SECTION RODATA_152 SECTION BANK_99 org $990000 + CRT_ORG_BANK_99 SECTION CODE_153 SECTION RODATA_153 SECTION BANK_9A org $9a0000 + CRT_ORG_BANK_9A SECTION CODE_154 SECTION RODATA_154 SECTION BANK_9B org $9b0000 + CRT_ORG_BANK_9B SECTION CODE_155 SECTION RODATA_155 SECTION BANK_9C org $9c0000 + CRT_ORG_BANK_9C SECTION CODE_156 SECTION RODATA_156 SECTION BANK_9D org $9d0000 + CRT_ORG_BANK_9D SECTION CODE_157 SECTION RODATA_157 SECTION BANK_9E org $9e0000 + CRT_ORG_BANK_9E SECTION CODE_158 SECTION RODATA_158 SECTION BANK_9F org $9f0000 + CRT_ORG_BANK_9F SECTION CODE_159 SECTION RODATA_159 SECTION BANK_A0 org $a00000 + CRT_ORG_BANK_A0 SECTION CODE_160 SECTION RODATA_160 SECTION BANK_A1 org $a10000 + CRT_ORG_BANK_A1 SECTION CODE_161 SECTION RODATA_161 SECTION BANK_A2 org $a20000 + CRT_ORG_BANK_A2 SECTION CODE_162 SECTION RODATA_162 SECTION BANK_A3 org $a30000 + CRT_ORG_BANK_A3 SECTION CODE_163 SECTION RODATA_163 SECTION BANK_A4 org $a40000 + CRT_ORG_BANK_A4 SECTION CODE_164 SECTION RODATA_164 SECTION BANK_A5 org $a50000 + CRT_ORG_BANK_A5 SECTION CODE_165 SECTION RODATA_165 SECTION BANK_A6 org $a60000 + CRT_ORG_BANK_A6 SECTION CODE_166 SECTION RODATA_166 SECTION BANK_A7 org $a70000 + CRT_ORG_BANK_A7 SECTION CODE_167 SECTION RODATA_167 SECTION BANK_A8 org $a80000 + CRT_ORG_BANK_A8 SECTION CODE_168 SECTION RODATA_168 SECTION BANK_A9 org $a90000 + CRT_ORG_BANK_A9 SECTION CODE_169 SECTION RODATA_169 SECTION BANK_AA org $aa0000 + CRT_ORG_BANK_AA SECTION CODE_170 SECTION RODATA_170 SECTION BANK_AB org $ab0000 + CRT_ORG_BANK_AB SECTION CODE_171 SECTION RODATA_171 SECTION BANK_AC org $ac0000 + CRT_ORG_BANK_AC SECTION CODE_172 SECTION RODATA_172 SECTION BANK_AD org $ad0000 + CRT_ORG_BANK_AD SECTION CODE_173 SECTION RODATA_173 SECTION BANK_AE org $ae0000 + CRT_ORG_BANK_AE SECTION CODE_174 SECTION RODATA_174 SECTION BANK_AF org $af0000 + CRT_ORG_BANK_AF SECTION CODE_175 SECTION RODATA_175 SECTION BANK_B0 org $b00000 + CRT_ORG_BANK_B0 SECTION CODE_176 SECTION RODATA_176 SECTION BANK_B1 org $b10000 + CRT_ORG_BANK_B1 SECTION CODE_177 SECTION RODATA_177 SECTION BANK_B2 org $b20000 + CRT_ORG_BANK_B2 SECTION CODE_178 SECTION RODATA_178 SECTION BANK_B3 org $b30000 + CRT_ORG_BANK_B3 SECTION CODE_179 SECTION RODATA_179 SECTION BANK_B4 org $b40000 + CRT_ORG_BANK_B4 SECTION CODE_180 SECTION RODATA_180 SECTION BANK_B5 org $b50000 + CRT_ORG_BANK_B5 SECTION CODE_181 SECTION RODATA_181 SECTION BANK_B6 org $b60000 + CRT_ORG_BANK_B6 SECTION CODE_182 SECTION RODATA_182 SECTION BANK_B7 org $b70000 + CRT_ORG_BANK_B7 SECTION CODE_183 SECTION RODATA_183 SECTION BANK_B8 org $b80000 + CRT_ORG_BANK_B8 SECTION CODE_184 SECTION RODATA_184 SECTION BANK_B9 org $b90000 + CRT_ORG_BANK_B9 SECTION CODE_185 SECTION RODATA_185 SECTION BANK_BA org $ba0000 + CRT_ORG_BANK_BA SECTION CODE_186 SECTION RODATA_186 SECTION BANK_BB org $bb0000 + CRT_ORG_BANK_BB SECTION CODE_187 SECTION RODATA_187 SECTION BANK_BC org $bc0000 + CRT_ORG_BANK_BC SECTION CODE_188 SECTION RODATA_188 SECTION BANK_BD org $bd0000 + CRT_ORG_BANK_BD SECTION CODE_189 SECTION RODATA_189 SECTION BANK_BE org $be0000 + CRT_ORG_BANK_BE SECTION CODE_190 SECTION RODATA_190 SECTION BANK_BF org $bf0000 + CRT_ORG_BANK_BF SECTION CODE_191 SECTION RODATA_191 SECTION BANK_C0 org $c00000 + CRT_ORG_BANK_C0 SECTION CODE_192 SECTION RODATA_192 SECTION BANK_C1 org $c10000 + CRT_ORG_BANK_C1 SECTION CODE_193 SECTION RODATA_193 SECTION BANK_C2 org $c20000 + CRT_ORG_BANK_C2 SECTION CODE_194 SECTION RODATA_194 SECTION BANK_C3 org $c30000 + CRT_ORG_BANK_C3 SECTION CODE_195 SECTION RODATA_195 SECTION BANK_C4 org $c40000 + CRT_ORG_BANK_C4 SECTION CODE_196 SECTION RODATA_196 SECTION BANK_C5 org $c50000 + CRT_ORG_BANK_C5 SECTION CODE_197 SECTION RODATA_197 SECTION BANK_C6 org $c60000 + CRT_ORG_BANK_C6 SECTION CODE_198 SECTION RODATA_198 SECTION BANK_C7 org $c70000 + CRT_ORG_BANK_C7 SECTION CODE_199 SECTION RODATA_199 SECTION BANK_C8 org $c80000 + CRT_ORG_BANK_C8 SECTION CODE_200 SECTION RODATA_200 SECTION BANK_C9 org $c90000 + CRT_ORG_BANK_C9 SECTION CODE_201 SECTION RODATA_201 SECTION BANK_CA org $ca0000 + CRT_ORG_BANK_CA SECTION CODE_202 SECTION RODATA_202 SECTION BANK_CB org $cb0000 + CRT_ORG_BANK_CB SECTION CODE_203 SECTION RODATA_203 SECTION BANK_CC org $cc0000 + CRT_ORG_BANK_CC SECTION CODE_204 SECTION RODATA_204 SECTION BANK_CD org $cd0000 + CRT_ORG_BANK_CD SECTION CODE_205 SECTION RODATA_205 SECTION BANK_CE org $ce0000 + CRT_ORG_BANK_CE SECTION CODE_206 SECTION RODATA_206 SECTION BANK_CF org $cf0000 + CRT_ORG_BANK_CF SECTION CODE_207 SECTION RODATA_207 SECTION BANK_D0 org $d00000 + CRT_ORG_BANK_D0 SECTION CODE_208 SECTION RODATA_208 SECTION BANK_D1 org $d10000 + CRT_ORG_BANK_D1 SECTION CODE_209 SECTION RODATA_209 SECTION BANK_D2 org $d20000 + CRT_ORG_BANK_D2 SECTION CODE_210 SECTION RODATA_210 SECTION BANK_D3 org $d30000 + CRT_ORG_BANK_D3 SECTION CODE_211 SECTION RODATA_211 SECTION BANK_D4 org $d40000 + CRT_ORG_BANK_D4 SECTION CODE_212 SECTION RODATA_212 SECTION BANK_D5 org $d50000 + CRT_ORG_BANK_D5 SECTION CODE_213 SECTION RODATA_213 SECTION BANK_D6 org $d60000 + CRT_ORG_BANK_D6 SECTION CODE_214 SECTION RODATA_214 SECTION BANK_D7 org $d70000 + CRT_ORG_BANK_D7 SECTION CODE_215 SECTION RODATA_215 SECTION BANK_D8 org $d80000 + CRT_ORG_BANK_D8 SECTION CODE_216 SECTION RODATA_216 SECTION BANK_D9 org $d90000 + CRT_ORG_BANK_D9 SECTION CODE_217 SECTION RODATA_217 SECTION BANK_DA org $da0000 + CRT_ORG_BANK_DA SECTION CODE_218 SECTION RODATA_218 SECTION BANK_DB org $db0000 + CRT_ORG_BANK_DB SECTION CODE_219 SECTION RODATA_219 SECTION BANK_DC org $dc0000 + CRT_ORG_BANK_DC SECTION CODE_220 SECTION RODATA_220 SECTION BANK_DD org $dd0000 + CRT_ORG_BANK_DD SECTION CODE_221 SECTION RODATA_221 SECTION BANK_DE org $de0000 + CRT_ORG_BANK_DE SECTION CODE_222 SECTION RODATA_222 SECTION BANK_DF org $df0000 + CRT_ORG_BANK_DF SECTION CODE_223 SECTION RODATA_223 SECTION BANK_E0 org $e00000 + CRT_ORG_BANK_E0 SECTION CODE_224 SECTION RODATA_224 SECTION BANK_E1 org $e10000 + CRT_ORG_BANK_E1 SECTION CODE_225 SECTION RODATA_225 SECTION BANK_E2 org $e20000 + CRT_ORG_BANK_E2 SECTION CODE_226 SECTION RODATA_226 SECTION BANK_E3 org $e30000 + CRT_ORG_BANK_E3 SECTION CODE_227 SECTION RODATA_227 SECTION BANK_E4 org $e40000 + CRT_ORG_BANK_E4 SECTION CODE_228 SECTION RODATA_228 SECTION BANK_E5 org $e50000 + CRT_ORG_BANK_E5 SECTION CODE_229 SECTION RODATA_229 SECTION BANK_E6 org $e60000 + CRT_ORG_BANK_E6 SECTION CODE_230 SECTION RODATA_230 SECTION BANK_E7 org $e70000 + CRT_ORG_BANK_E7 SECTION CODE_231 SECTION RODATA_231 SECTION BANK_E8 org $e80000 + CRT_ORG_BANK_E8 SECTION CODE_232 SECTION RODATA_232 SECTION BANK_E9 org $e90000 + CRT_ORG_BANK_E9 SECTION CODE_233 SECTION RODATA_233 SECTION BANK_EA org $ea0000 + CRT_ORG_BANK_EA SECTION CODE_234 SECTION RODATA_234 SECTION BANK_EB org $eb0000 + CRT_ORG_BANK_EB SECTION CODE_235 SECTION RODATA_235 SECTION BANK_EC org $ec0000 + CRT_ORG_BANK_EC SECTION CODE_236 SECTION RODATA_236 SECTION BANK_ED org $ed0000 + CRT_ORG_BANK_ED SECTION CODE_237 SECTION RODATA_237 SECTION BANK_EE org $ee0000 + CRT_ORG_BANK_EE SECTION CODE_238 SECTION RODATA_238 SECTION BANK_EF org $ef0000 + CRT_ORG_BANK_EF SECTION CODE_239 SECTION RODATA_239 SECTION BANK_F0 org $f00000 + CRT_ORG_BANK_F0 SECTION CODE_240 SECTION RODATA_240 SECTION BANK_F1 org $f10000 + CRT_ORG_BANK_F1 SECTION CODE_241 SECTION RODATA_241 SECTION BANK_F2 org $f20000 + CRT_ORG_BANK_F2 SECTION CODE_242 SECTION RODATA_242 SECTION BANK_F3 org $f30000 + CRT_ORG_BANK_F3 SECTION CODE_243 SECTION RODATA_243 SECTION BANK_F4 org $f40000 + CRT_ORG_BANK_F4 SECTION CODE_244 SECTION RODATA_244 SECTION BANK_F5 org $f50000 + CRT_ORG_BANK_F5 SECTION CODE_245 SECTION RODATA_245 SECTION BANK_F6 org $f60000 + CRT_ORG_BANK_F6 SECTION CODE_246 SECTION RODATA_246 SECTION BANK_F7 org $f70000 + CRT_ORG_BANK_F7 SECTION CODE_247 SECTION RODATA_247 SECTION BANK_F8 org $f80000 + CRT_ORG_BANK_F8 SECTION CODE_248 SECTION RODATA_248 SECTION BANK_F9 org $f90000 + CRT_ORG_BANK_F9 SECTION CODE_249 SECTION RODATA_249 SECTION BANK_FA org $fa0000 + CRT_ORG_BANK_FA SECTION CODE_250 SECTION RODATA_250 SECTION BANK_FB org $fb0000 + CRT_ORG_BANK_FB SECTION CODE_251 SECTION RODATA_251 SECTION BANK_FC org $fc0000 + CRT_ORG_BANK_FC SECTION CODE_252 SECTION RODATA_252 SECTION BANK_FD org $fd0000 + CRT_ORG_BANK_FD SECTION CODE_253 SECTION RODATA_253 SECTION BANK_FE org $fe0000 + CRT_ORG_BANK_FE SECTION CODE_254 SECTION RODATA_254 SECTION BANK_FF org $ff0000 + CRT_ORG_BANK_FF SECTION CODE_255 SECTION RODATA_255
////////////////////////////////////////////////////////////////////////// // Author : Ngo Tien Dat // Email : dat.ngo@epfl.ch // Organization : EPFL // Purpose : 3D mesh unconstrained reconstruction // Date : 15 March 2012 ////////////////////////////////////////////////////////////////////////// #include "Reconstruction.h" #include <timer/Timer.h> #include <Linear/ObjectiveFunction.h> #include <Linear/EqualConstrFunction.h> #include <Linear/IneqConstrFunction.h> using namespace arma; const double Reconstruction::ROBUST_SCALE = 2; void Reconstruction::buildCorrespondenceMatrix(const mat& matches) { int nMatches = matches.n_rows; int nVertices = this->refMesh.GetNVertices(); this->Minit = zeros(2*nMatches, 3*nVertices); const mat& A = this->camCamera.GetA(); for (int i = 0; i < nMatches; i++) { const rowvec& vid = matches(i, span(0,2)); // Vertex ids in reference image const rowvec& bcs = matches(i, span(3,5)); // Barycentric coordinates in reference image const rowvec& uvs = matches(i, span(6,7)); // Image coordinates in input image // Vertex coordinates are ordered to be [x1,...,xN, y1,...,yN, z1,...,zN] for (int k = 0; k <= 2; k++) { // First row Minit(2*i, vid(0) + k*nVertices) = bcs(0) * (A(0,k) - uvs(0) * A(2,k)); Minit(2*i, vid(1) + k*nVertices) = bcs(1) * (A(0,k) - uvs(0) * A(2,k)); Minit(2*i, vid(2) + k*nVertices) = bcs(2) * (A(0,k) - uvs(0) * A(2,k)); // Second row Minit(2*i+1, vid(0) + k*nVertices) = bcs(0) * (A(1,k) - uvs(1) * A(2,k)); Minit(2*i+1, vid(1) + k*nVertices) = bcs(1) * (A(1,k) - uvs(1) * A(2,k)); Minit(2*i+1, vid(2) + k*nVertices) = bcs(2) * (A(1,k) - uvs(1) * A(2,k)); } } } vec Reconstruction::computeReprojectionErrors(const TriangleMesh& trigMesh, const mat& matchesInit, const uvec& currentMatchIdxs) { const mat& vertexCoords = trigMesh.GetVertexCoords(); int nMatches = currentMatchIdxs.n_rows; vec errors(nMatches); // Errors of all matches for (int i = 0; i < nMatches; i++) { // Facet (3 vertex IDs) that contains the matching point int idx = currentMatchIdxs(i); int vId1 = (int)matchesInit(idx, 0); int vId2 = (int)matchesInit(idx, 1); int vId3 = (int)matchesInit(idx, 2); // 3D vertex coordinates const rowvec& vertex1Coords = vertexCoords.row(vId1); const rowvec& vertex2Coords = vertexCoords.row(vId2); const rowvec& vertex3Coords = vertexCoords.row(vId3); double bary1 = matchesInit(idx, 3); double bary2 = matchesInit(idx, 4); double bary3 = matchesInit(idx, 5); // 3D feature point rowvec point3D = bary1*vertex1Coords + bary2*vertex2Coords + bary3*vertex3Coords; // TODO: Implement this function in stead of call projecting function for a single point. This can save expense of function calls // Projection vec point2D = camCamera.ProjectAPoint(point3D.t()); vec matchingPoint(2); matchingPoint(0) = matchesInit(idx, 6); matchingPoint(1) = matchesInit(idx, 7); errors(i) = norm(point2D - matchingPoint, 2); } return errors; } void Reconstruction::reconstructPlanarUnconstr(const uvec& matchIdxs, double wr, LaplacianMesh& resMesh) { Timer timer; const mat& paramMat = this->refMesh.GetParamMatrix(); // Parameterization matrix // Build the matrix MPwAP = [MP; wr*AP] and compute: (MPwAP)' * (MPwAP) this->computeCurrentMatrices( matchIdxs, wr); // --------------- Eigen value decomposition -------------------------- mat V; vec s; timer.start(); eig_sym(s, V, this->MPwAPtMPwAP); timer.stop(); //cout << "Eigen(): " << timer.getElapsedTimeInMilliSec() << " ms"<< endl; const vec& c = V.col(0); //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ mat matC = reshape(c, refMesh.GetNCtrlPoints(), 3); // Update vertex coordinates resMesh.SetVertexCoords(paramMat * matC); // Resulting mesh yields a correct projection on image but it does not preserve lengths. // So we need to compute the scale factor and multiply with matC // Determine on which side the mesh lies: -Z or Z double meanZ = mean(resMesh.GetVertexCoords().col(2)); int globalSign = meanZ > 0 ? 1 : -1; const vec& resMeshEdgeLens = resMesh.ComputeEdgeLengths(); const vec& refMeshEdgeLens = refMesh.GetEdgeLengths(); double scale = globalSign * norm(refMeshEdgeLens, 2) / norm(resMeshEdgeLens, 2); // Update vertex coordinates resMesh.SetVertexCoords(scale * paramMat * matC); } void Reconstruction::ReconstructPlanarUnconstrIter(const mat& matchesInit, LaplacianMesh& resMesh, uvec& inlierMatchIdxs) { // Input check if (matchesInit.n_rows == 0) { inlierMatchIdxs.resize(0); return; } Timer timer; double wr = this->wrInit; // Currently used regularization weight double radius = this->radiusInit; // Currently used radius of the estimator vec reprojErrors; // Reprojection errors // First, we need to build the correspondent matrix with all given matches to avoid re-computation this->buildCorrespondenceMatrix(matchesInit); // Then compute MPinit. Function reconstructPlanarUnconstr() will use part of MPinit w.r.t currently used matches this->MPinit = this->Minit * this->refMesh.GetBigParamMat(); uvec matchesInitIdxs = linspace<uvec>(0, matchesInit.n_rows-1, matchesInit.n_rows); // Currently used matches represented by their indices. Initially, use all matches: [0,1,2..n-1] inlierMatchIdxs = matchesInitIdxs; for (int i = 0; i < nUncstrIters; i++) { this->reconstructPlanarUnconstr(inlierMatchIdxs, wr, resMesh); // If it is the final iteration, break and don't update "inlierMatchIdxs" or "weights", "radius" if (i == nUncstrIters - 1) { //cout << "Current radius: " << radius << endl; //cout << "Current wr: " << wr << endl; //Reconstruction::computeCurrentMatrices(currentMatchIdxs, 325); // For Ferns break; } // Otherwise, remove outliers int iterTO = nUncstrIters - 2; if (i >= iterTO) reprojErrors = this->computeReprojectionErrors(resMesh, matchesInit, matchesInitIdxs); else reprojErrors = this->computeReprojectionErrors(resMesh, matchesInit, inlierMatchIdxs); uvec idxs = find( reprojErrors < radius ); if (idxs.n_elem == 0) break; if (i >= iterTO) inlierMatchIdxs = matchesInitIdxs.elem(idxs); else inlierMatchIdxs = inlierMatchIdxs.elem(idxs); // Update parameters wr = wr / Reconstruction::ROBUST_SCALE; radius = radius / Reconstruction::ROBUST_SCALE; } } void Reconstruction::computeCurrentMatrices(const uvec& matchIdxs, double wr) { int nMatches = matchIdxs.n_rows; // Number of currently used matches // Build matrix currentMP by taking some rows of MP corresponding to currently used match indices Timer timer; timer.start(); mat currentMP(2 * nMatches, this->MPinit.n_cols); for (int i = 0; i < nMatches; i++) { currentMP.rows(2*i, 2*i+1) = this->MPinit.rows(2*matchIdxs(i), 2*matchIdxs(i) + 1); } timer.stop(); //cout << "Build current MP matrix: " << timer.getElapsedTimeInMilliSec() << " ms"<< endl; timer.start(); MPwAP = join_cols( currentMP, wr*refMesh.GetBigAP() ); // TODO: Avoid computing this. Only needed in the last iteration MPwAPtMPwAP = currentMP.t() * currentMP + wr*wr * this->APtAP; timer.stop(); //cout << "Build (MPwAP)' * (MPwAP): " << timer.getElapsedTimeInMilliSec() << " ms"<< endl; } void Reconstruction::ReconstructEqualConstr(const vec& cInit, LaplacianMesh& resMesh) { const mat& paramMat = refMesh.GetParamMatrix(); const mat& bigP = refMesh.GetBigParamMat(); static bool isFirstFrame = true; static vec cOptimal = reshape(refMesh.GetVertexCoords().rows(refMesh.GetCtrlPointIDs()), refMesh.GetNCtrlPoints()*3, 1); // Objective function: use MPwAP which was already computed in unconstrained reconstruction ObjectiveFunction *objtFunction; if (this->useTemporal && !isFirstFrame) objtFunction = new ObjectiveFunction(this->GetMPwAP(), this->timeSmoothAlpha, cOptimal); else objtFunction = new ObjectiveFunction(this->GetMPwAP()); // Constrained function EqualConstrFunction cstrFunction(bigP, refMesh.GetEdges(), refMesh.GetEdgeLengths()); if (this->usePrevFrameToInit && !isFirstFrame) cOptimal = equalConstrOptimize.OptimizeNullSpace(cOptimal, *objtFunction, cstrFunction); else cOptimal = equalConstrOptimize.OptimizeNullSpace(cInit, *objtFunction, cstrFunction); mat cOptimalMat = reshape(cOptimal, refMesh.GetNCtrlPoints(), 3); if ( cOptimalMat(0,2) < 0 ) { // Change the sign if the reconstruction is behind the camera. This happens because we take cOptimal as initial value for constrained optimization. cOptimalMat = -cOptimalMat; } // Update vertex coordinates resMesh.SetVertexCoords(paramMat*cOptimalMat); isFirstFrame = false; delete objtFunction; } void Reconstruction::ReconstructIneqConstr(const vec& cInit, LaplacianMesh& resMesh) { const mat& paramMat = refMesh.GetParamMatrix(); const mat& bigP = refMesh.GetBigParamMat(); static bool isFirstFrame = true; static vec cOptimal = reshape(refMesh.GetVertexCoords().rows(refMesh.GetCtrlPointIDs()), refMesh.GetNCtrlPoints()*3, 1); // Objective function: use MPwAP which was already computed in unconstrained reconstruction ObjectiveFunction *objtFunction; if (this->useTemporal && !isFirstFrame) objtFunction = new ObjectiveFunction(this->GetMPwAP(), this->timeSmoothAlpha, cOptimal); else objtFunction = new ObjectiveFunction(this->GetMPwAP()); // Constrained function IneqConstrFunction cstrFunction(bigP, refMesh.GetEdges(), refMesh.GetEdgeLengths()); if (this->usePrevFrameToInit && !isFirstFrame) cOptimal = ineqConstrOptimize.OptimizeLagrange(cOptimal, *objtFunction, cstrFunction); else cOptimal = ineqConstrOptimize.OptimizeLagrange(cInit, *objtFunction, cstrFunction); mat cOptimalMat = reshape(cOptimal, refMesh.GetNCtrlPoints(), 3); if (cOptimalMat(0,2) < 0) { // Change the sign if the reconstruction is behind the camera. // This happens because we take cOptimal as initial value for constrained optimization. cOptimalMat = -cOptimalMat; } // Update vertex coordinates resMesh.SetVertexCoords(paramMat*cOptimalMat); isFirstFrame = false; delete objtFunction; }
; A017771: Binomial coefficients C(55,n). ; 1,55,1485,26235,341055,3478761,28989675,202927725,1217566350,6358402050,29248649430,119653565850,438729741450,1451182990950,4353548972850,11899700525790,29749251314475,68248282427325,144079707346575,280576272201225,505037289962205,841728816603675,1300853625660225,1866442158555975,2488589544741300,3085851035479212,3560597348629860,3824345300380220,3824345300380220,3560597348629860,3085851035479212,2488589544741300,1866442158555975,1300853625660225,841728816603675,505037289962205,280576272201225,144079707346575,68248282427325,29749251314475,11899700525790,4353548972850,1451182990950,438729741450,119653565850,29248649430,6358402050,1217566350,202927725,28989675,3478761,341055,26235,1485,55,1 mov $1,55 bin $1,$0
// Copyright 2019, Chen Shuaihao. // //Author: Chen Shuaihao // // #include <iostream> #include <functional> #include "HttpServer.h" HttpServer::HttpServer(EventLoop *loop, int port) : tcpserver_(loop, port), cnt(0) { tcpserver_.SetNewConnCallback(std::bind(&HttpServer::HandleNewConnection, this, std::placeholders::_1)); tcpserver_.SetMessageCallback(std::bind(&HttpServer::HandleMessage, this, std::placeholders::_1, std::placeholders::_2)); tcpserver_.SetSendCompleteCallback(std::bind(&HttpServer::HandleSendComplete, this, std::placeholders::_1)); tcpserver_.SetCloseCallback(std::bind(&HttpServer::HandleClose, this, std::placeholders::_1)); tcpserver_.SetErrorCallback(std::bind(&HttpServer::HandleError, this, std::placeholders::_1)); } HttpServer::~HttpServer() { } void HttpServer::HandleNewConnection(TcpConnection *ptcpconn) { //std::string msg(s); HttpSession *phttpsession = new HttpSession(); httpsessionnlist_[ptcpconn] = phttpsession; } void HttpServer::HandleMessage(TcpConnection *ptcpconn, std::string &s) { //std::cout << "http num is:" << ++cnt << std::endl; HttpSession *phttpsession = httpsessionnlist_[ptcpconn]; phttpsession->PraseHttpRequest(s); phttpsession->HttpProcess(); std::string msg; phttpsession->AddToBuf(msg); ptcpconn->Send(msg); if(!phttpsession->KeepAlive()) { //短连接,可以告诉框架层数据发完就可以关掉TCP连接,不过这里注释掉,还是交给客户端主动关闭吧 //ptcpconn->HandleClose(); } } void HttpServer::HandleSendComplete(TcpConnection *ptcpconn) { } void HttpServer::HandleClose(TcpConnection *ptcpconn) { HttpSession *phttpsession = httpsessionnlist_[ptcpconn]; httpsessionnlist_.erase(ptcpconn); delete phttpsession; } void HttpServer::HandleError(TcpConnection *ptcpconn) { HttpSession *phttpsession = httpsessionnlist_[ptcpconn]; httpsessionnlist_.erase(ptcpconn); delete phttpsession; } void HttpServer::Start() { tcpserver_.Start(); }
;------------------------------------------------------------- ; ; SINGLE THREAD FLOATING POINT MULTI-PRECISION CALCULATOR ; ; F.P. SUBROUTINES ; ; File: math-sub.asm ; Module: math.asm, math.o ; Exec: calc-pi ; ; Created: 10/15/14 ; Last RDIt: 12/22/14 ; ;-------------------------------------------------------------- ; MIT License ; ; Copyright 2014-2020 David Bolenbaugh ; ; Permission is hereby granted, free of charge, to any person obtaining a copy ; of this software and associated documentation files (the "Software"), to deal ; in the Software without restriction, including without limitation the rights ; to use, copy, modify, merge, publish, distribute, sublicense, and/or sell ; copies of the Software, and to permit persons to whom the Software is ; furnished to do so, subject to the following conditions: ; The above copyright notice and this permission notice shall be included in all ; copies or substantial portions of the Software. ; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE ; AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER ; LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, ; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE ; SOFTWARE. ;------------------------------------------------------------- ; GetVarNameAdd: ; ClearVariable: ; SetToOne: ; SetToTwo: ; CopyVariable: ; ExchangeVariable: ; FP_TwosCompliment: ; AddMantissa: ; FP_Load64BitNumber: ;-------------------------------------------------------------- ; Convert Variable Handle to Variable Name (String) address ; ; Input: RSI = Handle number of variable ; ; Output: RAX = Address of string (name of variable) ; ; Data comes from lookup table at: GetVarNameAddr ; ;-------------------------------------------------------------- GetVarNameAdd: push rbx push rsi mov rax, rsi ; get file handle number .skip2: mov rbx, RegNameTable ; Point to start of address table shl rax, 3 ; Mult by 8 byte per name add rax, rbx ; Now point to address table value pop rsi pop rbx ret ; Return with RAX = address ;-------------------------------------------------------------- ; Clear F.P. Variable to all zero's, ; ; Input: RSI = handle number of variable ; ; Output: none ; ;-------------------------------------------------------------- ClearVariable: ; Save registers push rax ; Working Reg push rbx ; Address Pointer push rcx ; Loop counter push rsi ; Handle number push rbp ; %ifdef PROFILE inc qword [iCntClear] %endif ; ; Source Address mov rbx, [RegAddTable+rsi*WSCALE] ; RSI (index) --> RBX (address) mov rbp, EXP_MSW_OFST ; RBP point at highest Word (top exponent word) mov rax, 0 ; zero value to write ; Setup Counter mov rcx, [No_Word] ; current size of mantissa add rcx, EXP_WSIZE ; bytes in exponent ; Clear Data (Mantissa and Exponent together) .loop1: mov [rbx+rbp], rax ; clean Word sub rbp, BYTE_PER_WORD ; next lower Word loop .loop1 ; decrement RCX and loop ; Restore registers pop rbp pop rsi pop rcx pop rbx pop rax ret ;-------------------------------------------------------------- ; Set Variable to 1.0 (integer value) ; ; Input: RSI = handle number of variable ; ; Output: none ; ;-------------------------------------------------------------- SetToOne: push rax push rbx push rsi ; call ClearVariable ; Using Handle in RSI, Clear variable mov rbx, [RegAddTable+rsi*WSCALE] ; RSI (index) --> RBX (address) ; FEDCBA9876543210 <-- Ruler mov rax, 0x4000000000000000 ; Mantissa mov [rbx+MAN_MSW_OFST], rax mov rax, 1 ; Exponent mov [rbx+EXP_WORD_OFST], rax ; pop rsi pop rbx pop rax ret ;-------------------------------------------------------------- ; Set Variable to 2.0 (integer value) ; ; Input: RSI = handle number of variable ; ; Output: none ; ;-------------------------------------------------------------- SetToTwo: push rax push rbx push rsi ; call ClearVariable ; Using Handle in RSI, Clear variable mov rbx, [RegAddTable+rsi*WSCALE] ; RSI (index) --> RBX (address) ; FEDCBA9876543210 <-- Ruler mov rax, 0x4000000000000000 ; Mantissa mov [rbx+MAN_MSW_OFST], rax mov rax, 2 ; Exponent mov [rbx+EXP_WORD_OFST], rax ; pop rsi pop rbx pop rax ret ; ;-------------------------------------------------------------- ; Move (Copy) F.P. Variable ; ; Input: RSI = Source Variable Handle Number ; RDI = Destination Variable Handle Number ; ; [RDI] = [RSI] (handle numbers) ; ; Output: none ; ;-------------------------------------------------------------- CopyVariable: ; Save registers push rax ; Working Reg push rbx ; Source Address push rcx ; Loop Counter push rdx ; Destination Address push rbp ; Pointer Index ; ; In case profiling, increment counter ; %ifdef PROFILE inc qword [iCntMove] %endif ; ; Source Address mov rbx, [RegAddTable+rsi*WSCALE] ; RSI (index) --> RBX (address) mov rbp, EXP_MSW_OFST ; RBX point at most significant Word ; Destination address mov rdx, [RegAddTable+rdi*WSCALE] ; RSI (index) --> RDX (address) ; Setup counter mov rcx, [No_Word] ; Current size of mantissa add rcx, EXP_WSIZE ; Bytes in exponent ; Copy data (Mantissa and Exponent) .loop1: mov rax, [rbx+rbp] ; Read Word mov [rdx+rbp], rax ; Write Word sub rbp, BYTE_PER_WORD ; Increment Address loop .loop1 ; Decrement RCX counter and loop ; Restore Registers pop rbp pop rdx pop rcx pop rbx pop rax ret ; ;-------------------------------------------------------------- ; Exchange F.P. Variable ; ; Input: RSI = Operand 1 Handle Number ; RDI = Operand 2 Handle Number ; ; Output: none ; ;-------------------------------------------------------------- ExchangeVariable: ; Save registers push rax ; Working Reg push rbx ; Source Address push rcx ; Loop counter push rdx ; Destination Address push rsi ; Operand 1 Handle Number push rdi ; Operand 2 Handle Number push rbp ; Pointer Index push r8 ; Working Reg ; Source Address mov rbx, [RegAddTable+rsi*WSCALE] ; RSI (index) --> RBX (address) mov rdx, [RegAddTable+rdi*WSCALE] ; RSI (index) --> RBX (address) mov rbp, EXP_WORD_OFST ; Top of variable mov rcx, [No_Word] ; Counter for num words inc rcx ; Adjust for exponent size .loop: mov r8, [rbx+rbp] ; Get OPR word mov rax, [rdx+rbp] ; Get ACC word mov [rbx+rbp], rax ; Save switched word to OPR mov [rdx+rbp], r8 ; Save switched word to ACC sub rbp, BYTE_PER_WORD ; Increment new address loop .loop ; Decrement RXC and loop until done ; Restore Registers pop r8 pop rbp pop rdi pop rsi pop rdx pop rcx pop rbx pop rax ret ; ;-------------------------------------------------------------- ; Perform Floating Point 2's Compliment on Variable ; ; Input: RSI = Handle Number of Variable ; ; Output: none ; ; To get a 2's complement number do the following binary ; subtraction: ; ; 000000000000 ; -original num. ; ============== ; two's comp. ; ; However, there is a catch. The floating point mantissa ; has designated sign and zero bits. ; ; Normalized Positive number 01xxxxxx ; Normalized Negative number 110xxxxx ; ; After forming the 2's complement some rotation may be needed ; ; Floating point mantissa ; Number Before 2's comp. final mantissa ; 1 01000000 (0x40) 11000000 (0xC0) (ok) ; 3 01100000 (0x60) 10100000 (0xA0) (right) 11010000 (0xD0) ; 5 01010000 (0x50) 10110000 (0xB0) (right) 11011000 (0xD8) ; 7 01110000 (0x70) 10010000 (0x90) (right) 11001000 (0xC8) ; -1 11000000 (0xC0) 01000000 (0x40) (ok) ; -3 11010000 (0xD0) 00110000 (0x50) (left) 011000000 (0x60) ; -5 11011000 (0xD8) 00101000 (0x48) (left) 010100000 (0x50) ; -7 11001000 (0xC8) 00111000 (0x38) (left) 011100000 (0x70) ; ;-------------------------------------------------------------- ; FP_TwosCompliment: ; Save Registers push rax ; Working Reg push rbx ; Address Pointer push rcx ; Loop Counter push rdx ; Variable to hold sign bit push rbp ; Pointer Index push r8 ; Working Reg push r9 ; Working Reg ; ; In case profiling, increment counter ; %IFDEF PROFILE inc qword [iCntFPTwoCom] %ENDIF ; ; Source Address mov rbx, [RegAddTable+rsi*WSCALE] ; RSI (index) --> RBX (address) test byte[rbx+MAN_MSB_OFST], 0x0FF ; Is it zero ? jz .skip4 ; yes, don't 2's compliment mov r8, [rbx+MAN_MSW_OFST] ; Save MSW for sign bit (used later) mov rbp, [LSWOfst] ; RBX+RBP point at mantissa L.S. Word ; Setup Counter mov rcx, [No_Word] ; RCX contains word count ; Mantissa Operations mov r9, 0 ; Will be used to save CF clc ; Clear carry flag .loop1: mov rax, 0 ; Load zero value into RAX sbb rax, [rbx+rbp] ; Subtract to get 2's Compliment mov [rbx+rbp], rax ; and Save result rcl r9, 1 ; Save CF add rbp, BYTE_PER_WORD ; Increment to next word rcr r9, 1 ; Restore CF loop .loop1 ; Decrement RCX and loop until finished ; ; Two's compliment may leave mantissa left or right 1 bit, this can be fixed in next section ; rcl r8, 1 ; Rotate original Sign bit (MSBit) into carry jnc .skip3 ; No, original number was positive, skip ahead ; ; Case of negative number becoming positive ; test byte[rbx+MAN_MSB_OFST], 0x40 ; Check for first bit mantissa too far right jnz .skip4 ; 01xxxx as expected? call Left1BitAdjExp ; 001xxxxx --> left --> 01xxxxxxx jmp short .skip4 ; Done ; ; Case of positve number becoming negative ; .skip3: mov al, [rbx+MAN_MSB_OFST] ; Get M.S. Byte Mantissa and al, 0x0C0 ; Save only top 3 bits cmp al, 0x0C0 ; expect 110xxxx je .skip4 ; as expected call Right1BitAdjExp ; Rotate right 1 bit, adjust exponent or byte[rbx+MAN_MSB_OFST], 0x080 ; Set sign bit that was rotated out .skip4: ; Exponent Operations ; (none) ; Restore Registers pop r9 pop r8 pop rbp pop rdx pop rcx pop rbx pop rax ret ; ;-------------------------------------------------------------- ; Add Mantissas of variables ; ; Input: RSI = Operand 1 handle number of variable ; RDI = Operand 2 handle number of varaible ; ; Output: RSI Operand 1 contains result ; ; [RSI]=[RSI]+[RDI] (handle numbers) ; ; Note: Calling routine must provide room for overflow ; as normalized bits may overflow. ; ; ;-------------------------------------------------------------- ; AddMantissa: ; Save Registers push rax ; Working Reg push rbx ; Address Pointer push rcx ; Loop Counter push rdx ; Address Pointer push rsi ; Operand 1 Variable Handle Number push rdi ; Operand 2 Variable Handle Number push rbp ; Pointer Index push r8 ; To hold Carry Flag ; Address Pointers mov rbx, [RegAddTable+rsi*WSCALE] ; RSI (index) --> RBX (address) mov rdx, [RegAddTable+rdi*WSCALE] ; RDI (index) --> RDX (address) mov rbp, [LSWOfst] ; RBP offset to one word below mantissa L.S. Word ; Setup Counter mov rcx, [No_Word] ; RCX contains word count ; Mantissa Operations mov r8, 0 ; need this to hold CF clc ; Clear carry flag ; ; This is the main loop for addition ; .loop1: mov rax, [rdx+rbp] ; Get source word adc [rbx+rbp], rax ; Add destination word rcr r8, 1 ; Save CF add rbp, BYTE_PER_WORD ; RBX increment to next word rcl r8, 1 ; Restore CF loop .loop1 ; Decrement RCX and loop until finished ; ; Restore Registers pop r8 pop rbp pop rdi pop rsi pop rdx pop rcx pop rbx pop rax ret ;-------------------------------------------------------------- ; Load 64 bit positive integer into variable ; ; Input: RSI = Handle number of variable ; RAX = 64 bit ( n > 0 ) value to load ; ; Output: none ; ;------------------------------------------------------------- FP_Load64BitNumber: ; Save Registers push rax ; 64 bit input value push rbx ; Address Pointer ; Clear variable call ClearVariable ; Using Index in RSI, clear the variable ; Address Pointers mov rbx, [RegAddTable+rsi*WSCALE] ; RSI (index) --> RBX (address) ; ; PLace registers into memory 1 word from top (32_64_CHECK) ; mov [rbx+MAN_MSW_OFST-BYTE_PER_WORD], rax ; ; Set Exponent for 1 word down (1 word is amost 2 words MSBit-LSBit) ; mov qword[rbx+EXP_WORD_OFST], ((BIT_PER_WORD*2)-1) ; call FP_Normalize ; Using RSI index, normalize number ; ; Restore Registers pop rbx pop rax ret ;------------------------------------- ; math-subr.asm - Include file - EOF ;-------------------------------------
// Distributed under the MIT License. // See LICENSE.txt for details. #include "tests/Unit/TestingFramework.hpp" #include <string> #include "DataStructures/Tensor/IndexType.hpp" // IWYU pragma: keep #include "PointwiseFunctions/Hydro/Tags.hpp" class DataVector; SPECTRE_TEST_CASE("Unit.PointwiseFunctions.Hydro.Tags", "[Unit][Hydro]") { CHECK(hydro::Tags::AlfvenSpeedSquared<DataVector>::name() == "AlfvenSpeedSquared"); CHECK(hydro::Tags::ComovingMagneticField<DataVector, 3, Frame::Inertial>::name() == "ComovingMagneticField"); CHECK(hydro::Tags::ComovingMagneticField<DataVector, 3, Frame::Logical>::name() == "Logical_ComovingMagneticField"); CHECK(hydro::Tags::DivergenceCleaningField<DataVector>::name() == "DivergenceCleaningField"); CHECK(hydro::Tags::EquationOfState<true, 2>::name() == "EquationOfState"); CHECK(hydro::Tags::LorentzFactor<DataVector>::name() == "LorentzFactor"); CHECK(hydro::Tags::MagneticField<DataVector, 3, Frame::Inertial>::name() == "MagneticField"); CHECK(hydro::Tags::MagneticField<DataVector, 3, Frame::Distorted>::name() == "Distorted_MagneticField"); CHECK(hydro::Tags::MagneticPressure<DataVector>::name() == "MagneticPressure"); CHECK(hydro::Tags::Pressure<DataVector>::name() == "Pressure"); CHECK(hydro::Tags::RestMassDensity<DataVector>::name() == "RestMassDensity"); CHECK(hydro::Tags::SoundSpeedSquared<DataVector>::name() == "SoundSpeedSquared"); /// [prefix_example] CHECK(hydro::Tags::SpatialVelocity<DataVector, 3, Frame::Inertial>::name() == "SpatialVelocity"); CHECK(hydro::Tags::SpatialVelocity<DataVector, 3, Frame::Grid>::name() == "Grid_SpatialVelocity"); CHECK(hydro::Tags::SpatialVelocityOneForm<DataVector, 3, Frame::Inertial>::name() == "SpatialVelocityOneForm"); CHECK(hydro::Tags::SpatialVelocityOneForm<DataVector, 3, Frame::Logical>::name() == "Logical_SpatialVelocityOneForm"); /// [prefix_example] CHECK(hydro::Tags::SpatialVelocitySquared<double>::name() == "SpatialVelocitySquared"); CHECK(hydro::Tags::SpatialVelocitySquared<DataVector>::name() == "SpatialVelocitySquared"); CHECK(hydro::Tags::SpecificEnthalpy<double>::name() == "SpecificEnthalpy"); CHECK(hydro::Tags::SpecificEnthalpy<DataVector>::name() == "SpecificEnthalpy"); CHECK(hydro::Tags::SpecificInternalEnergy<double>::name() == "SpecificInternalEnergy"); CHECK(hydro::Tags::SpecificInternalEnergy<DataVector>::name() == "SpecificInternalEnergy"); }
#include <QtGlobal> // Automatically generated by extract_strings.py #ifdef __GNUC__ #define UNUSED __attribute__((unused)) #else #define UNUSED #endif static const char UNUSED *bitcoin_strings[] = { QT_TRANSLATE_NOOP("bitcoin-core", "" "%s, you must set a rpcpassword in the configuration file:\n" "%s\n" "It is recommended you use the following random password:\n" "rpcuser=ieatsmallchilrpcen\n" "rpcpassword=%s\n" "(you do not need to remember this password)\n" "The username and password MUST NOT be the same.\n" "If the file does not exist, create it with owner-readable-only file " "permissions.\n" "It is also recommended to set alertnotify so you are notified of problems;\n" "for example: alertnotify=echo %%s | mail -s \"Tacocoin Alert\" chef@taqueria.com\n"), QT_TRANSLATE_NOOP("bitcoin-core", "" "Acceptable ciphers (default: TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:" "@STRENGTH)"), QT_TRANSLATE_NOOP("bitcoin-core", "" "An error occurred while setting up the RPC port %u for listening on IPv4: %s"), QT_TRANSLATE_NOOP("bitcoin-core", "" "An error occurred while setting up the RPC port %u for listening on IPv6, " "falling back to IPv4: %s"), QT_TRANSLATE_NOOP("bitcoin-core", "" "Bind to given address and always listen on it. Use [host]:port notation for " "IPv6"), QT_TRANSLATE_NOOP("bitcoin-core", "" "Cannot obtain a lock on data directory %s. Tacocoin is probably already " "running."), QT_TRANSLATE_NOOP("bitcoin-core", "" "Error: The transaction was rejected! This might happen if some of the coins " "in your wallet were already spent, such as if you used a copy of wallet.dat " "and coins were spent in the copy but not marked as spent here."), QT_TRANSLATE_NOOP("bitcoin-core", "" "Error: This transaction requires a transaction fee of at least %s because of " "its amount, complexity, or use of recently received funds!"), QT_TRANSLATE_NOOP("bitcoin-core", "" "Execute command when a relevant alert is received (%s in cmd is replaced by " "message)"), QT_TRANSLATE_NOOP("bitcoin-core", "" "Execute command when a wallet transaction changes (%s in cmd is replaced by " "TxID)"), QT_TRANSLATE_NOOP("bitcoin-core", "" "Execute command when the best block changes (%s in cmd is replaced by block " "hash)"), QT_TRANSLATE_NOOP("bitcoin-core", "" "Listen for JSON-RPC connections on <port> (default: 21042 or testnet: 121042)"), QT_TRANSLATE_NOOP("bitcoin-core", "" "Number of seconds to keep misbehaving peers from reconnecting (default: " "86400)"), QT_TRANSLATE_NOOP("bitcoin-core", "" "Set maximum size of high-priority/low-fee transactions in bytes (default: " "27000)"), QT_TRANSLATE_NOOP("bitcoin-core", "" "Set the number of script verification threads (up to 16, 0 = auto, <0 = " "leave that many cores free, default: 0)"), QT_TRANSLATE_NOOP("bitcoin-core", "" "This is a pre-release test build - use at your own risk - do not use for " "mining or merchant applications"), QT_TRANSLATE_NOOP("bitcoin-core", "" "Unable to bind to %s on this computer. Tacocoin is probably already running."), QT_TRANSLATE_NOOP("bitcoin-core", "" "Warning: -paytxfee is set very high! This is the transaction fee you will " "pay if you send a transaction."), QT_TRANSLATE_NOOP("bitcoin-core", "" "Warning: Displayed transactions may not be correct! You may need to upgrade, " "or other nodes may need to upgrade."), QT_TRANSLATE_NOOP("bitcoin-core", "" "Warning: Please check that your computer's date and time are correct! If " "your clock is wrong Tacocoin will not work properly."), QT_TRANSLATE_NOOP("bitcoin-core", "" "Warning: error reading wallet.dat! All keys read correctly, but transaction " "data or address book entries might be missing or incorrect."), QT_TRANSLATE_NOOP("bitcoin-core", "" "Warning: wallet.dat corrupt, data salvaged! Original wallet.dat saved as " "wallet.{timestamp}.bak in %s; if your balance or transactions are incorrect " "you should restore from a backup."), QT_TRANSLATE_NOOP("bitcoin-core", "" "You must set rpcpassword=<password> in the configuration file:\n" "%s\n" "If the file does not exist, create it with owner-readable-only file " "permissions."), QT_TRANSLATE_NOOP("bitcoin-core", "Accept command line and JSON-RPC commands"), QT_TRANSLATE_NOOP("bitcoin-core", "Accept connections from outside (default: 1 if no -proxy or -connect)"), QT_TRANSLATE_NOOP("bitcoin-core", "Add a node to connect to and attempt to keep the connection open"), QT_TRANSLATE_NOOP("bitcoin-core", "Allow DNS lookups for -addnode, -seednode and -connect"), QT_TRANSLATE_NOOP("bitcoin-core", "Allow JSON-RPC connections from specified IP address"), QT_TRANSLATE_NOOP("bitcoin-core", "Attempt to recover private keys from a corrupt wallet.dat"), QT_TRANSLATE_NOOP("bitcoin-core", "Tacocoin version"), QT_TRANSLATE_NOOP("bitcoin-core", "Block creation options:"), QT_TRANSLATE_NOOP("bitcoin-core", "Cannot downgrade wallet"), QT_TRANSLATE_NOOP("bitcoin-core", "Cannot resolve -bind address: '%s'"), QT_TRANSLATE_NOOP("bitcoin-core", "Cannot resolve -externalip address: '%s'"), QT_TRANSLATE_NOOP("bitcoin-core", "Cannot write default address"), QT_TRANSLATE_NOOP("bitcoin-core", "Connect only to the specified node(s)"), QT_TRANSLATE_NOOP("bitcoin-core", "Connect through socks proxy"), QT_TRANSLATE_NOOP("bitcoin-core", "Connect to a node to retrieve peer addresses, and disconnect"), QT_TRANSLATE_NOOP("bitcoin-core", "Corrupted block database detected"), QT_TRANSLATE_NOOP("bitcoin-core", "Discover own IP address (default: 1 when listening and no -externalip)"), QT_TRANSLATE_NOOP("bitcoin-core", "Do you want to rebuild the block database now?"), QT_TRANSLATE_NOOP("bitcoin-core", "Done loading"), QT_TRANSLATE_NOOP("bitcoin-core", "Error initializing block database"), QT_TRANSLATE_NOOP("bitcoin-core", "Error initializing wallet database environment %s!"), QT_TRANSLATE_NOOP("bitcoin-core", "Error loading block database"), QT_TRANSLATE_NOOP("bitcoin-core", "Error loading wallet.dat"), QT_TRANSLATE_NOOP("bitcoin-core", "Error loading wallet.dat: Wallet corrupted"), QT_TRANSLATE_NOOP("bitcoin-core", "Error loading wallet.dat: Wallet requires newer version of Tacocoin"), QT_TRANSLATE_NOOP("bitcoin-core", "Error opening block database"), QT_TRANSLATE_NOOP("bitcoin-core", "Error"), QT_TRANSLATE_NOOP("bitcoin-core", "Error: Disk space is low!"), QT_TRANSLATE_NOOP("bitcoin-core", "Error: Wallet locked, unable to create transaction!"), QT_TRANSLATE_NOOP("bitcoin-core", "Error: system error: "), QT_TRANSLATE_NOOP("bitcoin-core", "Failed to listen on any port. Use -listen=0 if you want this."), QT_TRANSLATE_NOOP("bitcoin-core", "Failed to read block info"), QT_TRANSLATE_NOOP("bitcoin-core", "Failed to read block"), QT_TRANSLATE_NOOP("bitcoin-core", "Failed to sync block index"), QT_TRANSLATE_NOOP("bitcoin-core", "Failed to write block index"), QT_TRANSLATE_NOOP("bitcoin-core", "Failed to write block info"), QT_TRANSLATE_NOOP("bitcoin-core", "Failed to write block"), QT_TRANSLATE_NOOP("bitcoin-core", "Failed to write file info"), QT_TRANSLATE_NOOP("bitcoin-core", "Failed to write to coin database"), QT_TRANSLATE_NOOP("bitcoin-core", "Failed to write transaction index"), QT_TRANSLATE_NOOP("bitcoin-core", "Failed to write undo data"), QT_TRANSLATE_NOOP("bitcoin-core", "Fee per KB to add to transactions you send"), QT_TRANSLATE_NOOP("bitcoin-core", "Find peers using DNS lookup (default: 1 unless -connect)"), QT_TRANSLATE_NOOP("bitcoin-core", "Generate coins (default: 0)"), QT_TRANSLATE_NOOP("bitcoin-core", "Get help for a command"), QT_TRANSLATE_NOOP("bitcoin-core", "How many blocks to check at startup (default: 288, 0 = all)"), QT_TRANSLATE_NOOP("bitcoin-core", "How thorough the block verification is (0-4, default: 3)"), QT_TRANSLATE_NOOP("bitcoin-core", "Imports blocks from external blk000??.dat file"), QT_TRANSLATE_NOOP("bitcoin-core", "Information"), QT_TRANSLATE_NOOP("bitcoin-core", "Insufficient funds"), QT_TRANSLATE_NOOP("bitcoin-core", "Invalid -proxy address: '%s'"), QT_TRANSLATE_NOOP("bitcoin-core", "Invalid -tor address: '%s'"), QT_TRANSLATE_NOOP("bitcoin-core", "Invalid amount for -minrelaytxfee=<amount>: '%s'"), QT_TRANSLATE_NOOP("bitcoin-core", "Invalid amount for -mintxfee=<amount>: '%s'"), QT_TRANSLATE_NOOP("bitcoin-core", "Invalid amount for -paytxfee=<amount>: '%s'"), QT_TRANSLATE_NOOP("bitcoin-core", "Invalid amount"), QT_TRANSLATE_NOOP("bitcoin-core", "List commands"), QT_TRANSLATE_NOOP("bitcoin-core", "Listen for connections on <port> (default: 11042 or testnet: 5744)"), QT_TRANSLATE_NOOP("bitcoin-core", "Loading addresses..."), QT_TRANSLATE_NOOP("bitcoin-core", "Loading block index..."), QT_TRANSLATE_NOOP("bitcoin-core", "Loading wallet..."), QT_TRANSLATE_NOOP("bitcoin-core", "Maintain a full transaction index (default: 0)"), QT_TRANSLATE_NOOP("bitcoin-core", "Maintain at most <n> connections to peers (default: 125)"), QT_TRANSLATE_NOOP("bitcoin-core", "Maximum per-connection receive buffer, <n>*1000 bytes (default: 5000)"), QT_TRANSLATE_NOOP("bitcoin-core", "Maximum per-connection send buffer, <n>*1000 bytes (default: 1000)"), QT_TRANSLATE_NOOP("bitcoin-core", "Not enough file descriptors available."), QT_TRANSLATE_NOOP("bitcoin-core", "Only accept block chain matching built-in checkpoints (default: 1)"), QT_TRANSLATE_NOOP("bitcoin-core", "Only connect to nodes in network <net> (IPv4, IPv6 or Tor)"), QT_TRANSLATE_NOOP("bitcoin-core", "Options:"), QT_TRANSLATE_NOOP("bitcoin-core", "Output extra debugging information. Implies all other -debug* options"), QT_TRANSLATE_NOOP("bitcoin-core", "Output extra network debugging information"), QT_TRANSLATE_NOOP("bitcoin-core", "Password for JSON-RPC connections"), QT_TRANSLATE_NOOP("bitcoin-core", "Prepend debug output with timestamp"), QT_TRANSLATE_NOOP("bitcoin-core", "Rebuild block chain index from current blk000??.dat files"), QT_TRANSLATE_NOOP("bitcoin-core", "Rescan the block chain for missing wallet transactions"), QT_TRANSLATE_NOOP("bitcoin-core", "Rescanning..."), QT_TRANSLATE_NOOP("bitcoin-core", "Run in the background as a daemon and accept commands"), QT_TRANSLATE_NOOP("bitcoin-core", "SSL options: (see the Tacocoin Wiki for SSL setup instructions)"), QT_TRANSLATE_NOOP("bitcoin-core", "Select the version of socks proxy to use (4-5, default: 5)"), QT_TRANSLATE_NOOP("bitcoin-core", "Send command to -server or tacocoind"), QT_TRANSLATE_NOOP("bitcoin-core", "Send commands to node running on <ip> (default: 127.0.0.1)"), QT_TRANSLATE_NOOP("bitcoin-core", "Send trace/debug info to console instead of debug.log file"), QT_TRANSLATE_NOOP("bitcoin-core", "Send trace/debug info to debugger"), QT_TRANSLATE_NOOP("bitcoin-core", "Server certificate file (default: server.cert)"), QT_TRANSLATE_NOOP("bitcoin-core", "Server private key (default: server.pem)"), QT_TRANSLATE_NOOP("bitcoin-core", "Set database cache size in megabytes (default: 25)"), QT_TRANSLATE_NOOP("bitcoin-core", "Set key pool size to <n> (default: 100)"), QT_TRANSLATE_NOOP("bitcoin-core", "Set maximum block size in bytes (default: 250000)"), QT_TRANSLATE_NOOP("bitcoin-core", "Set minimum block size in bytes (default: 0)"), QT_TRANSLATE_NOOP("bitcoin-core", "Set the number of threads to service RPC calls (default: 4)"), QT_TRANSLATE_NOOP("bitcoin-core", "Shrink debug.log file on client startup (default: 1 when no -debug)"), QT_TRANSLATE_NOOP("bitcoin-core", "Signing transaction failed"), QT_TRANSLATE_NOOP("bitcoin-core", "Specify configuration file (default: tacocoin.conf)"), QT_TRANSLATE_NOOP("bitcoin-core", "Specify connection timeout in milliseconds (default: 5000)"), QT_TRANSLATE_NOOP("bitcoin-core", "Specify data directory"), QT_TRANSLATE_NOOP("bitcoin-core", "Specify pid file (default: tacocoind.pid)"), QT_TRANSLATE_NOOP("bitcoin-core", "Specify your own public address"), QT_TRANSLATE_NOOP("bitcoin-core", "System error: "), QT_TRANSLATE_NOOP("bitcoin-core", "This help message"), QT_TRANSLATE_NOOP("bitcoin-core", "Threshold for disconnecting misbehaving peers (default: 100)"), QT_TRANSLATE_NOOP("bitcoin-core", "To use the %s option"), QT_TRANSLATE_NOOP("bitcoin-core", "Transaction amount too small"), QT_TRANSLATE_NOOP("bitcoin-core", "Transaction amounts must be positive"), QT_TRANSLATE_NOOP("bitcoin-core", "Transaction too large"), QT_TRANSLATE_NOOP("bitcoin-core", "Unable to bind to %s on this computer (bind returned error %d, %s)"), QT_TRANSLATE_NOOP("bitcoin-core", "Unknown -socks proxy version requested: %i"), QT_TRANSLATE_NOOP("bitcoin-core", "Unknown network specified in -onlynet: '%s'"), QT_TRANSLATE_NOOP("bitcoin-core", "Upgrade wallet to latest format"), QT_TRANSLATE_NOOP("bitcoin-core", "Usage:"), QT_TRANSLATE_NOOP("bitcoin-core", "Use OpenSSL (https) for JSON-RPC connections"), QT_TRANSLATE_NOOP("bitcoin-core", "Use UPnP to map the listening port (default: 0)"), QT_TRANSLATE_NOOP("bitcoin-core", "Use UPnP to map the listening port (default: 1 when listening)"), QT_TRANSLATE_NOOP("bitcoin-core", "Use proxy to reach tor hidden services (default: same as -proxy)"), QT_TRANSLATE_NOOP("bitcoin-core", "Use the test network"), QT_TRANSLATE_NOOP("bitcoin-core", "Username for JSON-RPC connections"), QT_TRANSLATE_NOOP("bitcoin-core", "Verifying blocks..."), QT_TRANSLATE_NOOP("bitcoin-core", "Verifying wallet..."), QT_TRANSLATE_NOOP("bitcoin-core", "Wallet needed to be rewritten: restart Tacocoin to complete"), QT_TRANSLATE_NOOP("bitcoin-core", "Warning"), QT_TRANSLATE_NOOP("bitcoin-core", "Warning: This version is obsolete, upgrade required!"), QT_TRANSLATE_NOOP("bitcoin-core", "You need to rebuild the database using -reindex to change -txindex"), QT_TRANSLATE_NOOP("bitcoin-core", "wallet.dat corrupt, salvage failed"), };
section .multiboot_header header_start: dd 0xe85250d6 ; magic number (multiboot 2) dd 0 ; architecture 0 (protected mode i386) dd header_end - header_start ; header length dd 0x100000000 - (0xe85250d6 + 0 + (header_end - header_start)) ; checksum ;; insert optional multiboot tags here ;; required end tag dw 0 ; type dw 0 ; flags dd 8 ; size header_end:
; A315693: Coordination sequence Gal.3.50.3 where G.u.t.v denotes the coordination sequence for a vertex of type v in tiling number t in the Galebach list of u-uniform tilings. ; Submitted by Jon Maiga ; 1,6,12,17,22,28,34,40,46,51,56,62,68,74,80,85,90,96,102,108,114,119,124,130,136,142,148,153,158,164,170,176,182,187,192,198,204,210,216,221,226,232,238,244,250,255,260,266,272,278 mov $2,$0 sub $0,1 mov $4,5 lpb $0 trn $0,3 add $3,4 mov $4,2 add $4,$0 trn $0,3 mov $5,$3 lpe sub $4,4 add $5,$4 mov $1,$5 lpb $2 add $1,5 sub $2,1 lpe mov $0,$1
title "Compute Checksum" ;/*++ ; ; Copyright (c) 1992 Microsoft Corporation ; ; Module Name: ; ; chksum.asm ; ; Abstract: ; ; This module implements a fucntion to compute the checksum of a buffer. ; ; Author: ; ; David N. Cutler (davec) 27-Jan-1992 ; ; Environment: ; ; Any mode. ; ; Revision History: ; ;--*/ .386 .model small,c assume cs:FLAT,ds:FLAT,es:FLAT,ss:FLAT assume fs:nothing,gs:nothing .xlist include callconv.inc include ks386.inc .list .code ;++ ; ; USHORT ; ChkSum( ; IN ULONG cksum, ; IN PUSHORT buf, ; IN ULONG len ; ) ; ; Routine Description: ; ; This function computes the checksum of the specified buffer. ; ; Arguments: ; ; cksum - Suppiles the initial checksum value. ; ; buf - Supplies a pointer to the buffer that is checksumed. ; ; len - Supplies the of the buffer in words. ; ; Return Value: ; ; The computed checksum is returned as the function value. ; ;-- cksum equ 8 ; stack offset to initial checksum buf equ 12 ; stack offset to source address len equ 16 ; stack offset to length in words cPublicProc ChkSum,3 push esi ; save nonvolatile register mov ecx,[esp + len] ; get length in words mov esi,[esp + buf] ; get source address mov eax,[esp + cksum] ; get initial checksum shl ecx,1 ; convert to length in bytes jz cks80 ; if z set, no words to checksum ; ; Compute checksum in cascading order of block size until 128 byte blocks ; are all that is left, then loop on 128-bute blocks. ; test esi,02h ; check if source dword aligned jz short cks10 ; if z set, source is dword aligned sub edx,edx ; get initial word for alignment mov dx,[esi + 0] ; add eax,edx ; update partial checkcum adc eax,0 ; add carry add esi,2 ; update source address sub ecx,2 ; reduce length in bytes cks10: mov edx,ecx ; isolate residual bytes and edx,07h ; sub ecx,edx ; subtract residual bytes jz cks60 ; if z set, no 8-byte blocks test ecx,08h ; test if initial 8-byte block jz short cks20 ; if z set, no initial 8-byte block add eax,[esi + 0] ; compute 8-byte checksum adc eax,[esi + 4] ; adc eax,0 ; add carry add esi,8 ; update source address sub ecx,8 ; reduce length of checksum jz cks60 ; if z set, end of 8-byte blocks cks20: test ecx,010h ; test if initial 16-byte block jz short cks30 ; if z set, no initial 16-byte block add eax,[esi + 0] ; compute 16-byte checksum adc eax,[esi + 4] ; adc eax,[esi + 8] ; adc eax,[esi + 12] ; adc eax,0 ; add carry add esi,16 ; update source address sub ecx,16 ; reduce length of checksum jz cks60 ; if z set, end of 8-byte blocks cks30: test ecx,020h ; test if initial 32-byte block jz short cks40 ; if z set, no initial 32-byte block add eax,[esi + 0] ; compute 32-byte checksum adc eax,[esi + 4] ; adc eax,[esi + 8] ; adc eax,[esi + 12] ; adc eax,[esi + 16] ; adc eax,[esi + 20] ; adc eax,[esi + 24] ; adc eax,[esi + 28] ; adc eax,0 ; add carry add esi,32 ; update source address sub ecx,32 ; reduce length of checksum jz cks60 ; if z set, end of 8-byte blocks cks40: test ecx,040h ; test if initial 64-byte block jz cks50 ; if z set, no initial 64-byte block add eax,[esi + 0] ; compute 64-byte checksum adc eax,[esi + 4] ; adc eax,[esi + 8] ; adc eax,[esi + 12] ; adc eax,[esi + 16] ; adc eax,[esi + 20] ; adc eax,[esi + 24] ; adc eax,[esi + 28] ; adc eax,[esi + 32] ; adc eax,[esi + 36] ; adc eax,[esi + 40] ; adc eax,[esi + 44] ; adc eax,[esi + 48] ; adc eax,[esi + 52] ; adc eax,[esi + 56] ; adc eax,[esi + 60] ; adc eax,0 ; add carry add esi,64 ; update source address sub ecx,64 ; reduce length of checksum jz short cks60 ; if z set, end of 8-byte blocks cks50: add eax,[esi + 0] ; compute 64-byte checksum adc eax,[esi + 4] ; adc eax,[esi + 8] ; adc eax,[esi + 12] ; adc eax,[esi + 16] ; adc eax,[esi + 20] ; adc eax,[esi + 24] ; adc eax,[esi + 28] ; adc eax,[esi + 32] ; adc eax,[esi + 36] ; adc eax,[esi + 40] ; adc eax,[esi + 44] ; adc eax,[esi + 48] ; adc eax,[esi + 52] ; adc eax,[esi + 56] ; adc eax,[esi + 60] ; adc eax,[esi + 64] ; adc eax,[esi + 68] ; adc eax,[esi + 72] ; adc eax,[esi + 76] ; adc eax,[esi + 80] ; adc eax,[esi + 84] ; adc eax,[esi + 88] ; adc eax,[esi + 92] ; adc eax,[esi + 96] ; adc eax,[esi + 100] ; adc eax,[esi + 104] ; adc eax,[esi + 108] ; adc eax,[esi + 112] ; adc eax,[esi + 116] ; adc eax,[esi + 120] ; adc eax,[esi + 124] ; adc eax,0 ; add carry add esi,128 ; update source address sub ecx,128 ; reduce length of checksum jnz short cks50 ; if z clear, not end of 8-byte blocks ; ; Compute checksum on 2-byte blocks. ; cks60: test edx,edx ; check if any 2-byte blocks jz short cks80 ; if z set, no 2-byte blocks cks70: sub ecx,ecx ; load 2-byte block mov cx,[esi + 0] ; add eax,ecx ; compue 2-byte checksum adc eax,0 ; add esi,2 ; update source address sub edx,2 ; reduce length of checksum jnz short cks70 ; if z clear, more 2-bytes blocks ; ; Fold 32-but checksum into 16-bits ; cks80: mov edx,eax ; copy checksum value shr edx,16 ; isolate high order bits and eax,0ffffh ; isolate low order bits add eax,edx ; sum high and low order bits mov edx,eax ; isolate possible carry shr edx,16 ; add eax,edx ; add carry and eax,0ffffh ; clear possible carry bit pop esi ; restore nonvolatile register stdRET ChkSum stdENDP ChkSum end
; A248558: Squares of the digits of the decimal expansion of e. ; 4,49,1,64,4,64,1,64,4,64,16,25,81,0,16,25,4,9,25,9,36,0,4,64,49,16,49,1,9,25,4,36,36,4,16,81,49,49,25,49,4,16,49,0,81,9,36,81,81,81,25,81,25,49,16,81,36,36,81,36,49,36,4,49,49,4,16,0,49,36 seq $0,1113 ; Decimal expansion of e. pow $0,2
/* ;******************************************************************************************************** ; uC/OS-III ; The Real-Time Kernel ; ; Copyright 2009-2020 Silicon Laboratories Inc. www.silabs.com ; ; SPDX-License-Identifier: APACHE-2.0 ; ; This software is subject to an open source license and is distributed by ; Silicon Laboratories Inc. pursuant to the terms of the Apache License, ; Version 2.0 available at www.apache.org/licenses/LICENSE-2.0. ; ;******************************************************************************************************** */ /* ;******************************************************************************************************** ; ; Generic Coldfire with EMAC Port for CodeWarrior Compiler ; ; File : os_cpu_i.asm ; Version : V3.08.00 ;******************************************************************************************************** */ /* ;************************************************************************************************** ; MACROS ;************************************************************************************************** */ .macro OS_EMAC_SAVE /* CODE BELOW TO SAVE EMAC REGISTERS */ MOVE.L MACSR,D7 /* Save the MACSR */ CLR.L D0 /* Disable rounding in the MACSR */ MOVE.L D0,MACSR /* Save the accumulators */ MOVE.L ACC0,D0 MOVE.L ACC1,D1 MOVE.L ACC2,D2 MOVE.L ACC3,D3 MOVE.L ACCEXT01,D4 /* Save the accumulator extensions */ MOVE.L ACCEXT23,D5 MOVE.L MASK,D6 /* Save the address mask */ LEA -32(A7),A7 /* Move the EMAC state to the task's stack */ MOVEM.L D0-D7,(A7) .endm .macro OS_EMAC_RESTORE /* CODE BELOW TO RESTORE EMAC REGISTERS */ MOVEM.L (A7),D0-D7 /* Restore the EMAC state */ MOVE.L #0,MACSR /* Disable rounding in the MACSR */ MOVE.L D0,ACC0 /* Restore the accumulators */ MOVE.L D1,ACC1 MOVE.L D2,ACC2 MOVE.L D3,ACC3 MOVE.L D4,ACCEXT01 MOVE.L D5,ACCEXT23 MOVE.L D6,MASK MOVE.L D7,MACSR LEA 32(A7),A7 .endm
; A283768: Numbers k such that U(k) is odd, where U = A001950 = upper Wythoff sequence. ; Submitted by Jon Maiga ; 2,3,5,6,9,12,15,16,18,19,22,25,28,29,31,32,34,35,38,41,42,44,45,47,48,51,54,55,57,58,60,61,64,67,70,71,73,74,77,80,83,84,86,87,89,90,93,96,97,99,100,102,103,106,109,110,112,113,115,116,119,122,125,126,128,129,132,135,138,139,141,142,145,148,151,152,154,155,157,158,161,164,165,167,168,170,171,174,177,180,181,183,184,187,190,193,194,196,197,200 mov $2,$0 add $2,2 pow $2,2 lpb $2 mov $3,$1 seq $3,171587 ; Sequence of the diagonal variant of the Fibonacci word fractal. Sequence of the Fibonacci tile. sub $0,$3 add $1,1 mov $4,$0 max $4,0 cmp $4,$0 mul $2,$4 sub $2,1 lpe mov $0,$1 add $0,1
.global s_prepare_buffers s_prepare_buffers: push %r11 push %r14 push %r15 push %r8 push %rcx push %rdi push %rdx push %rsi lea addresses_WT_ht+0xe0d9, %rdx nop sub $12967, %r14 mov $0x6162636465666768, %r15 movq %r15, %xmm5 and $0xffffffffffffffc0, %rdx movaps %xmm5, (%rdx) nop nop nop nop nop cmp %r11, %r11 lea addresses_D_ht+0xa391, %r8 cmp $22177, %r15 mov $0x6162636465666768, %r14 movq %r14, %xmm3 and $0xffffffffffffffc0, %r8 vmovaps %ymm3, (%r8) nop nop nop inc %rdx lea addresses_D_ht+0xca71, %rsi lea addresses_D_ht+0x16351, %rdi add $30228, %r15 mov $87, %rcx rep movsq nop nop nop nop nop cmp $33557, %rdi lea addresses_WC_ht+0xd815, %rdi nop nop nop nop nop xor %r15, %r15 movups (%rdi), %xmm6 vpextrq $1, %xmm6, %r8 nop nop nop nop nop xor $13577, %rsi lea addresses_WC_ht+0x13bfd, %rsi nop nop nop nop dec %rcx mov (%rsi), %di nop dec %rdx lea addresses_WT_ht+0x4acd, %rsi nop nop nop nop nop sub $62024, %r11 vmovups (%rsi), %ymm1 vextracti128 $0, %ymm1, %xmm1 vpextrq $0, %xmm1, %r8 nop nop xor $31574, %r15 lea addresses_UC_ht+0x5df1, %r15 nop nop nop nop sub $11623, %rcx mov (%r15), %r14d nop nop xor $61714, %r8 pop %rsi pop %rdx pop %rdi pop %rcx pop %r8 pop %r15 pop %r14 pop %r11 ret .global s_faulty_load s_faulty_load: push %r11 push %r8 push %rbp push %rcx push %rsi // Faulty Load lea addresses_RW+0x3c71, %r11 nop nop nop nop dec %rcx movb (%r11), %r8b lea oracles, %r11 and $0xff, %r8 shlq $12, %r8 mov (%r11,%r8,1), %r8 pop %rsi pop %rcx pop %rbp pop %r8 pop %r11 ret /* <gen_faulty_load> [REF] {'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_RW', 'AVXalign': False, 'size': 2}, 'OP': 'LOAD'} [Faulty Load] {'src': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_RW', 'AVXalign': False, 'size': 1}, 'OP': 'LOAD'} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 3, 'type': 'addresses_WT_ht', 'AVXalign': True, 'size': 16}} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 5, 'type': 'addresses_D_ht', 'AVXalign': True, 'size': 32}} {'src': {'same': False, 'congruent': 9, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 4, 'type': 'addresses_D_ht'}} {'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 16}, 'OP': 'LOAD'} {'src': {'NT': False, 'same': False, 'congruent': 2, 'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 2}, 'OP': 'LOAD'} {'src': {'NT': False, 'same': False, 'congruent': 2, 'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 32}, 'OP': 'LOAD'} {'src': {'NT': False, 'same': False, 'congruent': 2, 'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 4}, 'OP': 'LOAD'} {'32': 21829} 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 */
// This file is only here to verify (to the extent possible) the self sufficiency of the header #include "catch_suppress_warnings.h" #include "catch_interfaces_registry_hub.h"
_CardKeySuccessText1:: text "Bingo!@" text_end _CardKeySuccessText2:: text_start line "The CARD KEY" cont "opened the door!" done _CardKeyFailText:: text "Darn! It needs a" line "CARD KEY!" done _TrainerNameText:: text_ram wcd6d text ": @" text_end _NoNibbleText:: text "Not even a nibble!" prompt _NothingHereText:: text "Looks like there's" line "nothing here." prompt _ItsABiteText:: text "Oh!" line "It's a bite!" prompt _ExclamationText:: text "!" done _GroundRoseText:: text "Ground rose up" line "somewhere!" done _BoulderText:: text "This requires" line "STRENGTH to move!" done _MartSignText:: text "All your item" line "needs fulfilled!" cont "#MON MART" done _PokeCenterSignText:: text "Heal Your #MON!" line "#MON CENTER" done _FoundItemText:: text "<PLAYER> found" line "@" text_ram wcf4b text "!@" text_end _NoMoreRoomForItemText:: text "No more room for" line "items!" done _OaksAideHiText:: text "Hi! Remember me?" line "I'm PROF.OAK's" cont "AIDE!" para "If you caught @" text_decimal hOaksAideRequirement, 1, 3 text_start line "kinds of #MON," cont "I'm supposed to" cont "give you an" cont "@" text_ram wOaksAideRewardItemName text "!" para "So, <PLAYER>! Have" line "you caught at" cont "least @" text_decimal hOaksAideRequirement, 1, 3 text " kinds of" cont "#MON?" done _OaksAideUhOhText:: text "Let's see..." line "Uh-oh! You have" cont "caught only @" text_decimal hOaksAideNumMonsOwned, 1, 3 text_start cont "kinds of #MON!" para "You need @" text_decimal hOaksAideRequirement, 1, 3 text " kinds" line "if you want the" cont "@" text_ram wOaksAideRewardItemName text "." done _OaksAideComeBackText:: text "Oh. I see." para "When you get @" text_decimal hOaksAideRequirement, 1, 3 text_start line "kinds, come back" cont "for @" text_ram wOaksAideRewardItemName text "." done _OaksAideHereYouGoText:: text "Great! You have" line "caught @" text_decimal hOaksAideNumMonsOwned, 1, 3 text " kinds " cont "of #MON!" cont "Congratulations!" para "Here you go!" prompt _OaksAideGotItemText:: text "<PLAYER> got the" line "@" text_ram wOaksAideRewardItemName text "!@" text_end _OaksAideNoRoomText:: text "Oh! I see you" line "don't have any" cont "room for the" cont "@" text_ram wOaksAideRewardItemName text "." done
// Copyright (c) 2011-2019 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include <qt/qrimagewidget.h> #include <qt/guiutil.h> #include <QApplication> #include <QClipboard> #include <QDrag> #include <QMenu> #include <QMimeData> #include <QMouseEvent> #include <QPainter> #if defined(HAVE_CONFIG_H) #include <config/bitcoin-config.h> /* for USE_QRCODE */ #endif #ifdef USE_QRCODE #include <qrencode.h> #endif QRImageWidget::QRImageWidget(QWidget *parent): QLabel(parent), contextMenu(nullptr) { contextMenu = new QMenu(this); QAction *saveImageAction = new QAction(tr("&Save Image..."), this); connect(saveImageAction, &QAction::triggered, this, &QRImageWidget::saveImage); contextMenu->addAction(saveImageAction); QAction *copyImageAction = new QAction(tr("&Copy Image"), this); connect(copyImageAction, &QAction::triggered, this, &QRImageWidget::copyImage); contextMenu->addAction(copyImageAction); } bool QRImageWidget::setQR(const QString& data, const QString& text) { #ifdef USE_QRCODE setText(""); if (data.isEmpty()) return false; // limit length if (data.length() > MAX_URI_LENGTH) { setText(tr("Resulting URI too long, try to reduce the text for label / message.")); return false; } QRcode *code = QRcode_encodeString(data.toUtf8().constData(), 0, QR_ECLEVEL_L, QR_MODE_8, 1); if (!code) { setText(tr("Error encoding URI into QR Code.")); return false; } QImage qrImage = QImage(code->width + 8, code->width + 8, QImage::Format_RGB32); qrImage.fill(0xffffff); unsigned char *p = code->data; for (int y = 0; y < code->width; ++y) { for (int x = 0; x < code->width; ++x) { qrImage.setPixel(x + 4, y + 4, ((*p & 1) ? 0x0 : 0xffffff)); ++p; } } QRcode_free(code); QImage qrAddrImage = QImage(QR_IMAGE_SIZE, QR_IMAGE_SIZE + (text.isEmpty() ? 0 : 20), QImage::Format_RGB32); qrAddrImage.fill(0xffffff); QPainter painter(&qrAddrImage); painter.drawImage(0, 0, qrImage.scaled(QR_IMAGE_SIZE, QR_IMAGE_SIZE)); if (!text.isEmpty()) { QFont font("Lato", 9, QFont::ExtraBold); QRect paddedRect = qrAddrImage.rect(); // calculate ideal font size qreal font_size = GUIUtil::calculateIdealFontSize(paddedRect.width(), text, font); font.setPointSizeF(font_size); painter.setFont(font); paddedRect.setHeight(QR_IMAGE_SIZE+12); painter.drawText(QRect(paddedRect.left(), paddedRect.top(), paddedRect.width(), paddedRect.height()), Qt::AlignBottom|Qt::AlignCenter, text); } painter.end(); setPixmap(QPixmap::fromImage(qrAddrImage)); return true; #else setText(tr("QR code support not available.")); return false; #endif } QImage QRImageWidget::exportImage() { if(!pixmap()) return QImage(); return pixmap()->toImage(); } void QRImageWidget::mousePressEvent(QMouseEvent *event) { if(event->button() == Qt::LeftButton && pixmap()) { event->accept(); QMimeData *mimeData = new QMimeData; mimeData->setImageData(exportImage()); QDrag *drag = new QDrag(this); drag->setMimeData(mimeData); drag->exec(); } else { QLabel::mousePressEvent(event); } } void QRImageWidget::saveImage() { if(!pixmap()) return; QString fn = GUIUtil::getSaveFileName(this, tr("Save QR Code"), QString(), tr("PNG Image (*.png)"), nullptr); if (!fn.isEmpty()) { exportImage().save(fn); } } void QRImageWidget::copyImage() { if(!pixmap()) return; QApplication::clipboard()->setImage(exportImage()); } void QRImageWidget::contextMenuEvent(QContextMenuEvent *event) { if(!pixmap()) return; contextMenu->exec(event->globalPos()); }
; Copyright Oliver Kowalke 2009. ; Distributed under the Boost Software License, Version 1.0. ; (See accompanying file LICENSE_1_0.txt or copy at ; http://www.boost.org/LICENSE_1_0.txt) ; -------------------------------------------------------------- ; | 0 | 1 | 2 | 3 | 4 | 5 | ; -------------------------------------------------------------- ; | 0h | 04h | 08h | 0ch | 010h | 014h | ; -------------------------------------------------------------- ; | EDI | ESI | EBX | EBP | ESP | EIP | ; -------------------------------------------------------------- ; -------------------------------------------------------------- ; | 6 | 7 | 8 | | ; -------------------------------------------------------------- ; | 018h | 01ch | 020h | | ; -------------------------------------------------------------- ; | sp | size | limit | | ; -------------------------------------------------------------- ; -------------------------------------------------------------- ; | 9 | | ; -------------------------------------------------------------- ; | 024h | | ; -------------------------------------------------------------- ; |fc_execpt| | ; -------------------------------------------------------------- ; -------------------------------------------------------------- ; | 10 | | ; -------------------------------------------------------------- ; | 028h | | ; -------------------------------------------------------------- ; |fc_strage| | ; -------------------------------------------------------------- ; -------------------------------------------------------------- ; | 11 | 12 | | ; -------------------------------------------------------------- ; | 02ch | 030h | | ; -------------------------------------------------------------- ; | fc_mxcsr|fc_x87_cw| | ; -------------------------------------------------------------- .386 .XMM .model flat, c _exit PROTO, value:SDWORD align_stack PROTO, vp:DWORD seh_fcontext PROTO, except:DWORD, frame:DWORD, context:DWORD, dispatch:DWORD .code jump_fcontext PROC EXPORT mov ecx, [esp+04h] ; load address of the first fcontext_t arg mov [ecx], edi ; save EDI mov [ecx+04h], esi ; save ESI mov [ecx+08h], ebx ; save EBX mov [ecx+0ch], ebp ; save EBP assume fs:nothing mov edx, fs:[018h] ; load NT_TIB assume fs:error mov eax, [edx] ; load current SEH exception list mov [ecx+024h], eax ; save current exception list mov eax, [edx+04h] ; load current stack base mov [ecx+018h], eax ; save current stack base mov eax, [edx+08h] ; load current stack limit mov [ecx+020h], eax ; save current stack limit mov eax, [edx+010h] ; load fiber local storage mov [ecx+028h], eax ; save fiber local storage lea eax, [esp+04h] ; exclude the return address mov [ecx+010h], eax ; save as stack pointer mov eax, [esp] ; load return address mov [ecx+014h], eax ; save return address mov edx, [esp+08h] ; load address of the second fcontext_t arg mov edi, [edx] ; restore EDI mov esi, [edx+04h] ; restore ESI mov ebx, [edx+08h] ; restore EBX mov ebp, [edx+0ch] ; restore EBP mov eax, [esp+010h] ; check if fpu enve preserving was requested test eax, eax je nxt stmxcsr [ecx+02ch] ; save MMX control word fnstcw [ecx+030h] ; save x87 control word ldmxcsr [edx+02ch] ; restore MMX control word fldcw [edx+030h] ; restore x87 control word nxt: mov ecx, edx assume fs:nothing mov edx, fs:[018h] ; load NT_TIB assume fs:error mov eax, [ecx+024h] ; load SEH exception list mov [edx], eax ; restore next SEH item mov eax, [ecx+018h] ; load stack base mov [edx+04h], eax ; restore stack base mov eax, [ecx+020h] ; load stack limit mov [edx+08h], eax ; restore stack limit mov eax, [ecx+028h] ; load fiber local storage mov [edx+010h], eax ; restore fiber local storage mov eax, [esp+0ch] ; use third arg as return value after jump mov esp, [ecx+010h] ; restore ESP mov [esp+04h], eax ; use third arg as first arg in context function mov ecx, [ecx+014h] ; fetch the address to return to jmp ecx ; indirect jump to context jump_fcontext ENDP END
/* Code generated by IfcQuery EXPRESS generator, www.ifcquery.com */ #include <sstream> #include <limits> #include "ifcpp/model/AttributeObject.h" #include "ifcpp/model/BuildingException.h" #include "ifcpp/model/BuildingGuid.h" #include "ifcpp/reader/ReaderUtil.h" #include "ifcpp/writer/WriterUtil.h" #include "ifcpp/IFC4/include/IfcChiller.h" #include "ifcpp/IFC4/include/IfcChillerTypeEnum.h" #include "ifcpp/IFC4/include/IfcGloballyUniqueId.h" #include "ifcpp/IFC4/include/IfcIdentifier.h" #include "ifcpp/IFC4/include/IfcLabel.h" #include "ifcpp/IFC4/include/IfcObjectPlacement.h" #include "ifcpp/IFC4/include/IfcOwnerHistory.h" #include "ifcpp/IFC4/include/IfcProductRepresentation.h" #include "ifcpp/IFC4/include/IfcRelAggregates.h" #include "ifcpp/IFC4/include/IfcRelAssigns.h" #include "ifcpp/IFC4/include/IfcRelAssignsToProduct.h" #include "ifcpp/IFC4/include/IfcRelAssociates.h" #include "ifcpp/IFC4/include/IfcRelConnectsElements.h" #include "ifcpp/IFC4/include/IfcRelConnectsPortToElement.h" #include "ifcpp/IFC4/include/IfcRelConnectsWithRealizingElements.h" #include "ifcpp/IFC4/include/IfcRelContainedInSpatialStructure.h" #include "ifcpp/IFC4/include/IfcRelCoversBldgElements.h" #include "ifcpp/IFC4/include/IfcRelDeclares.h" #include "ifcpp/IFC4/include/IfcRelDefinesByObject.h" #include "ifcpp/IFC4/include/IfcRelDefinesByProperties.h" #include "ifcpp/IFC4/include/IfcRelDefinesByType.h" #include "ifcpp/IFC4/include/IfcRelFillsElement.h" #include "ifcpp/IFC4/include/IfcRelFlowControlElements.h" #include "ifcpp/IFC4/include/IfcRelInterferesElements.h" #include "ifcpp/IFC4/include/IfcRelNests.h" #include "ifcpp/IFC4/include/IfcRelProjectsElement.h" #include "ifcpp/IFC4/include/IfcRelReferencedInSpatialStructure.h" #include "ifcpp/IFC4/include/IfcRelSpaceBoundary.h" #include "ifcpp/IFC4/include/IfcRelVoidsElement.h" #include "ifcpp/IFC4/include/IfcText.h" // ENTITY IfcChiller IfcChiller::IfcChiller( int id ) { m_entity_id = id; } shared_ptr<BuildingObject> IfcChiller::getDeepCopy( BuildingCopyOptions& options ) { shared_ptr<IfcChiller> copy_self( new IfcChiller() ); if( m_GlobalId ) { if( options.create_new_IfcGloballyUniqueId ) { copy_self->m_GlobalId = make_shared<IfcGloballyUniqueId>( createBase64Uuid<wchar_t>().data() ); } else { copy_self->m_GlobalId = dynamic_pointer_cast<IfcGloballyUniqueId>( m_GlobalId->getDeepCopy(options) ); } } if( m_OwnerHistory ) { if( options.shallow_copy_IfcOwnerHistory ) { copy_self->m_OwnerHistory = m_OwnerHistory; } else { copy_self->m_OwnerHistory = dynamic_pointer_cast<IfcOwnerHistory>( m_OwnerHistory->getDeepCopy(options) ); } } if( m_Name ) { copy_self->m_Name = dynamic_pointer_cast<IfcLabel>( m_Name->getDeepCopy(options) ); } if( m_Description ) { copy_self->m_Description = dynamic_pointer_cast<IfcText>( m_Description->getDeepCopy(options) ); } if( m_ObjectType ) { copy_self->m_ObjectType = dynamic_pointer_cast<IfcLabel>( m_ObjectType->getDeepCopy(options) ); } if( m_ObjectPlacement ) { copy_self->m_ObjectPlacement = dynamic_pointer_cast<IfcObjectPlacement>( m_ObjectPlacement->getDeepCopy(options) ); } if( m_Representation ) { copy_self->m_Representation = dynamic_pointer_cast<IfcProductRepresentation>( m_Representation->getDeepCopy(options) ); } if( m_Tag ) { copy_self->m_Tag = dynamic_pointer_cast<IfcIdentifier>( m_Tag->getDeepCopy(options) ); } if( m_PredefinedType ) { copy_self->m_PredefinedType = dynamic_pointer_cast<IfcChillerTypeEnum>( m_PredefinedType->getDeepCopy(options) ); } return copy_self; } void IfcChiller::getStepLine( std::stringstream& stream ) const { stream << "#" << m_entity_id << "= IFCCHILLER" << "("; if( m_GlobalId ) { m_GlobalId->getStepParameter( stream ); } else { stream << "$"; } stream << ","; if( m_OwnerHistory ) { stream << "#" << m_OwnerHistory->m_entity_id; } else { stream << "$"; } stream << ","; if( m_Name ) { m_Name->getStepParameter( stream ); } else { stream << "$"; } stream << ","; if( m_Description ) { m_Description->getStepParameter( stream ); } else { stream << "$"; } stream << ","; if( m_ObjectType ) { m_ObjectType->getStepParameter( stream ); } else { stream << "$"; } stream << ","; if( m_ObjectPlacement ) { stream << "#" << m_ObjectPlacement->m_entity_id; } else { stream << "$"; } stream << ","; if( m_Representation ) { stream << "#" << m_Representation->m_entity_id; } else { stream << "$"; } stream << ","; if( m_Tag ) { m_Tag->getStepParameter( stream ); } else { stream << "$"; } stream << ","; if( m_PredefinedType ) { m_PredefinedType->getStepParameter( stream ); } else { stream << "$"; } stream << ");"; } void IfcChiller::getStepParameter( std::stringstream& stream, bool /*is_select_type*/ ) const { stream << "#" << m_entity_id; } const std::wstring IfcChiller::toString() const { return L"IfcChiller"; } void IfcChiller::readStepArguments( const std::vector<std::wstring>& args, const std::map<int,shared_ptr<BuildingEntity> >& map ) { const size_t num_args = args.size(); if( num_args != 9 ){ std::stringstream err; err << "Wrong parameter count for entity IfcChiller, expecting 9, having " << num_args << ". Entity ID: " << m_entity_id << std::endl; throw BuildingException( err.str().c_str() ); } m_GlobalId = IfcGloballyUniqueId::createObjectFromSTEP( args[0], map ); readEntityReference( args[1], m_OwnerHistory, map ); m_Name = IfcLabel::createObjectFromSTEP( args[2], map ); m_Description = IfcText::createObjectFromSTEP( args[3], map ); m_ObjectType = IfcLabel::createObjectFromSTEP( args[4], map ); readEntityReference( args[5], m_ObjectPlacement, map ); readEntityReference( args[6], m_Representation, map ); m_Tag = IfcIdentifier::createObjectFromSTEP( args[7], map ); m_PredefinedType = IfcChillerTypeEnum::createObjectFromSTEP( args[8], map ); } void IfcChiller::getAttributes( std::vector<std::pair<std::string, shared_ptr<BuildingObject> > >& vec_attributes ) const { IfcEnergyConversionDevice::getAttributes( vec_attributes ); vec_attributes.emplace_back( std::make_pair( "PredefinedType", m_PredefinedType ) ); } void IfcChiller::getAttributesInverse( std::vector<std::pair<std::string, shared_ptr<BuildingObject> > >& vec_attributes_inverse ) const { IfcEnergyConversionDevice::getAttributesInverse( vec_attributes_inverse ); } void IfcChiller::setInverseCounterparts( shared_ptr<BuildingEntity> ptr_self_entity ) { IfcEnergyConversionDevice::setInverseCounterparts( ptr_self_entity ); } void IfcChiller::unlinkFromInverseCounterparts() { IfcEnergyConversionDevice::unlinkFromInverseCounterparts(); }
#make_bin# ; BIN is plain binary format similar to .com format, but not limited to 1 segment; ; All values between # are directives, these values are saved into a separate .binf file. ; Before loading .bin file emulator reads .binf file with the same file name. ; All directives are optional, if you don't need them, delete them. ; set loading address, .bin file will be loaded to this address: #LOAD_SEGMENT=FFFFh# #LOAD_OFFSET=0000h# ; set entry point: #CS=0000h# ; same as loading segment #IP=0000h# ; same as loading offset ; set segment registers #DS=0000h# ; same as loading segment #ES=0000h# ; same as loading segment ; set stack #SS=0000h# ; same as loading segment #SP=FFFEh# ; set to top of loading segment ; set general registers (optional) #AX=0000h# #BX=0000h# #CX=0000h# #DX=0000h# #SI=0000h# #DI=0000h# #BP=0000h# jmp st1 nop db 1024 dup(0) ; Main program st1: cli ; intialize ds,es,ss to start of RAM mov ax,0200h mov ds,ax mov es,ax mov ss,ax mov sp,0FFFEH mov si,0000 ; DATA JMP START PORTA1 EQU 00h PORTB1 EQU 02h PORTC1 EQU 04h CREG1 EQU 06h PORTA2 EQU 08h PORTB2 EQU 0ah PORTC2 EQU 0ch CREG2 EQU 0eh CNT0 EQU 10H CREG3 EQU 16H STEPPER_MOTOR EQU 88H PERKC DB 100 FIVEC DB 100 DMC DB 100 PERKID EQU 36 FIVEID EQU 61 DMID EQU 86 PRICE DB ? START: ; Initialize 8255A ; portA1 as input, portB1 is NC, portC1 lower as output and portc1 upper as input. MOV AL, 9AH ;10011010b OUT CREG1, AL ; portA2 as output, portB2 as output, portC2 lower as output and portc2 upper as input MOV AL, 88H ;10001000b OUT CREG2, AL ; initialise all ouput as 0 MOV AL,00 OUT PORTC1,AL MOV AL,00H OUT PORTA2,AL MOV AL,00H OUT PORTB2,AL Main: ;first making sure that all keys are released x1 : IN AL,PORTC2 CMP AL,70H JNZ X1 ;checking for a key press x2: IN AL,PORTC2 AND AL,70H CMP AL,60H JZ PERK CMP AL,50H JZ FIVESTAR CMP AL,30H JZ DM JMP X2 ; loop back if no button pressed PERK: ; checking count of available Perk chocolates CMP PERKC,0 JZ LED_GLOW_PERK ; if available then process starts CALL ACCEPT_COIN MOV PRICE,PERKID CALL PRICE_INITIATE CALL DELAY_20MS CALL DISPENSE_PERK CALL DELAY_20MS DEC PERKC CALL CLOSE_COIN JMP START FIVESTAR: ; checking count of available Five Star chocolates CMP FIVEC,0 JZ LED_GLOW_FIVE ; if available then process starts CALL ACCEPT_COIN MOV PRICE,FIVEID CALL PRICE_INITIATE CALL DISPENSE_FIVE DEC FIVEC CALL CLOSE_COIN JMP START DM: ; checking count of available Dairy Milk chocolates CMP DMC,0 JZ LED_GLOW_DM ; if available then process starts CALL ACCEPT_COIN MOV PRICE,DMID CALL PRICE_INITIATE CALL DISPENSE_DM DEC DMC CALL CLOSE_COIN JMP START LED_GLOW_PERK: ; to glow LED red indicating no Perk chocolate available ;PC0 IS HIGH FOR PERK MOV AL,01H OUT PORTC2,AL LED_GLOW_FIVE: ; to glow LED red indicating no Five Star chocolate available ;PC1 IS HIGH FOR FIVESTAR MOV AL,02H ;00000010B OUT PORTC2,AL LED_GLOW_DM: ; to glow LED red indicating no Dairy Milk chocolate available ;PC2 IS HIGH FOR DAIRYMILK MOV AL,04H ;00000100B OUT PORTC2,AL hlt ACCEPT_COIN PROC NEAR ; moves the stepper motor-4 to open the coin aceptance flap PUSHF PUSH AX PUSH BX PUSH CX MOV AL,STEPPER_MOTOR MOV CX,50 ; 50 is equivalent to 180 Deg rotation ROT_MOTOR_4_CLKWISE: ; rotates the motor clockwise MOV BL,AL AND AL,0F0H OUT PORTB2,AL CALL DELAY_20MS MOV AL,BL ROR AL,01 DEC CX JNZ ROT_MOTOR_4_CLKWISE ; shut off motor MOV AL,00H OUT PORTB2,AL POP CX POP BX POP AX POPF RET ACCEPT_COIN ENDP PRICE_INITIATE PROC NEAR ; takes ADC input and waits until it becomes equal to required coin weight PUSHF PUSH AX PUSH BX PUSH CX mov cl,PRICE ;ale activated X8: mov AL,01H ;00000001B OUT PORTC1,AL ;soc high mov AL,03H ;00000011B OUT PORTC1,AL ; waiting nop nop nop nop ;ale low and AL,11111110b OUT PORTC1,AL ;soc low and AL,11111101b OUT PORTC1,AL X7: ; checking for EOC high IN AL,PORTC1 AND AL,10H JZ X7 ; OE high MOV AL,04H OUT PORTC1,AL ; taking ADC input IN AL,PORTA1 CMP AL,CL ; comparing to pre-defined coin weight required for the selected chocolate JNZ X8 ; looping back to take another input from ADC if weight not matched POP CX POP BX POP AX POPF RET PRICE_INITIATE ENDP DISPENSE_PERK PROC NEAR ; rotates the motor-1 to dispense Perk Chocolate PUSHF PUSH AX PUSH BX PUSH CX MOV AL,STEPPER_MOTOR MOV CX,100 ;100 IS EQUIVALENT TO 360 DEG ROTATION ROT_MOTOR_1: MOV BL,AL AND AL,0FH OUT PORTA2,AL CALL DELAY_20MS MOV AL,BL ROL AL,01 DEC CX JNZ ROT_MOTOR_1 MOV AL,00 OUT PORTA2,AL POP CX POP BX POP AX POPF RET DISPENSE_PERK ENDP DISPENSE_FIVE PROC NEAR ; rotates the motor-2 to dispense Five Star Chocolate PUSHF PUSH AX PUSH BX PUSH CX MOV AL,STEPPER_MOTOR MOV CX,100 ;100 IS EQUIVALENT TO 360 DEG ROTATION ROT_MOTOR_2: MOV BL,AL AND AL,0F0H OUT PORTA2,AL CALL DELAY_20MS MOV AL,BL ROL AL,01 DEC CX JNZ ROT_MOTOR_2 MOV AL,00 OUT PORTA2,AL POP CX POP BX POP AX POPF RET DISPENSE_FIVE ENDP DISPENSE_DM PROC NEAR ; rotates the motor-3 to dispense Dairy Milk Chocolate PUSHF PUSH AX PUSH BX PUSH CX MOV AL,STEPPER_MOTOR MOV CX,100 ;100 IS EQUIVALENT TO 360 DEG ROTATION ROT_MOTOR_3: MOV BL,AL AND AL,0FH OUT PORTB2,AL CALL DELAY_20MS MOV AL,BL ROL AL,01 DEC CX JNZ ROT_MOTOR_3 MOV AL,00 OUT PORTB2,AL POP CX POP BX POP AX POPF RET DISPENSE_DM ENDP CLOSE_COIN PROC NEAR ; moves the stepper motor-4 to close the coin aceptance flap PUSHF PUSH AX PUSH BX PUSH CX MOV AL,STEPPER_MOTOR MOV CX,50 ;50 IS EQUIVALENT TO 180 DEG ROTATION ROT_MOTOR_4_ANTICLKWISE: MOV BL,AL AND AL,0F0H OUT PORTB2,AL CALL DELAY_20MS MOV AL,BL ROL AL,01 DEC CX JNZ ROT_MOTOR_4_ANTICLKWISE MOV AL,00 OUT PORTB2,AL POP CX POP BX POP AX POPF RET CLOSE_COIN ENDP DELAY_20MS PROC NEAR ; general delay function PUSHF PUSH AX PUSH BX PUSH CX PUSH DX NOP NOP NOP NOP NOP NOP POP DX POP CX POP BX POP AX POPF RET DELAY_20MS ENDP
/** * Copyright (C) 2017 MongoDB Inc. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License, version 3, * as published by the Free Software Foundation. * * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * * As a special exception, the copyright holders give permission to link the * code of portions of this program with the OpenSSL library under certain * conditions as described in each individual source file and distribute * linked combinations including the program with the OpenSSL library. You * must comply with the GNU Affero General Public License in all respects for * all of the code used other than as permitted herein. If you modify file(s) * with this exception, you may extend this exception to your version of the * file(s), but you are not obligated to do so. If you do not wish to do so, * delete this exception statement from your version. If you delete this * exception statement from all source files in the program, then also delete * it in the license file. */ #include "mongo/platform/basic.h" #include "mongo/db/storage/encryption_hooks.h" #include <boost/filesystem/path.hpp> #include "mongo/base/init.h" #include "mongo/db/service_context.h" #include "mongo/db/storage/data_protector.h" #include "mongo/stdx/memory.h" namespace mongo { /* Make a EncryptionHooks pointer a decoration on the global ServiceContext */ GlobalInitializerRegisterer encryptionHooksInitializer( "SetEncryptionHooks", {"ServiceContext"}, [](InitializerContext* context) { EncryptionHooks::set(getGlobalServiceContext(), stdx::make_unique<EncryptionHooks>()); return Status::OK(); }, [](DeinitializerContext* context) { EncryptionHooks::set(getGlobalServiceContext(), nullptr); return Status::OK(); }); namespace { const auto getEncryptionHooks = ServiceContext::declareDecoration<std::unique_ptr<EncryptionHooks>>(); } // namespace void EncryptionHooks::set(ServiceContext* service, std::unique_ptr<EncryptionHooks> custHooks) { getEncryptionHooks(service) = std::move(custHooks); } EncryptionHooks* EncryptionHooks::get(ServiceContext* service) { return getEncryptionHooks(service).get(); } EncryptionHooks::~EncryptionHooks() {} bool EncryptionHooks::enabled() const { return false; } bool EncryptionHooks::restartRequired() { return false; } std::unique_ptr<DataProtector> EncryptionHooks::getDataProtector() { return std::unique_ptr<DataProtector>(); } boost::filesystem::path EncryptionHooks::getProtectedPathSuffix() { return ""; } Status EncryptionHooks::protectTmpData( const uint8_t* in, size_t inLen, uint8_t* out, size_t outLen, size_t* resultLen) { return Status(ErrorCodes::InternalError, "Encryption hooks must be enabled to use preprocessTmpData."); } Status EncryptionHooks::unprotectTmpData( const uint8_t* in, size_t inLen, uint8_t* out, size_t outLen, size_t* resultLen) { return Status(ErrorCodes::InternalError, "Encryption hooks must be enabled to use postprocessTmpData."); } } // namespace mongo
; A290398: Number of tiles in distance d from a given heptagon in the truncated order-3 tiling of the heptagonal plane (a.k.a. the "hyperbolic soccerball"). ; Submitted by Jamie Morken(w3) ; 1,7,14,28,49,84,147,252,434,749,1288,2219,3822,6580,11333,19516,33607,57876,99666,171633,295568,508991,876526,1509452,2599401,4476388,7708715,13275052,22860754,39368133,67795224,116749059,201051662,346227812,596233309,1026763724,1768173183,3044942404,5243646002,9029997865,15550413088,26779114551,46115879502,79415409276,136759990241,235512164468,405571684483,698428429916,1202752288626,2071240238557,3566849272616,6142413369883,10577750592430,18215772996372,31369087686069,54020197904988 mov $1,1 lpb $0 sub $0,1 add $2,$1 add $1,$3 add $2,6 add $4,$2 add $3,$4 sub $4,$3 add $3,$4 add $3,$4 lpe trn $2,1 mov $0,$2 add $0,1
#pragma once // ARKSurvivalEvolved (329.9) SDK #ifdef _MSC_VER #pragma pack(push, 0x8) #endif #include "ARKSurvivalEvolved_Basic.hpp" namespace sdk { //--------------------------------------------------------------------------- //Enums //--------------------------------------------------------------------------- // UserDefinedEnum E_TekThrusterState.E_TekThrusterState enum class E_TekThrusterState : uint8_t { E_TekThrusterState__NewEnumerator0 = 0, E_TekThrusterState__NewEnumerator1 = 1, E_TekThrusterState__NewEnumerator2 = 2, E_TekThrusterState__NewEnumerator4 = 3, E_TekThrusterState__E_MAX = 4 }; } #ifdef _MSC_VER #pragma pack(pop) #endif
; This is a smaller version of test_instruction.asm than more or less only ; tests the load and the str instruction. It does not need any memory. It ; should run on a 8 bit processor and the debug array is assumed to be at ; the address 0x80. ; At the end, the array should end up with the values: 2, 4, 6, and 8 ;---------------------------------- Main code ---------------------------------; label main ; Generation the array address in R2, R3, and R4 set 4 cpy R1 set 8 lsl R1 cpy R2 cpy R3 cpy R4 ; Fill the array set 2 cpy R5 write_in_r3_and_increment update_from_R5_and_arr update_from_R5_and_arr update_from_R5_and_arr ; debug the content debug_from_r2_and_increment debug_from_r2_and_increment debug_from_r2_and_increment debug_from_r2_and_increment quit ;----------------------------------- Macros -----------------------------------; @define write_in_r3_and_increment 0 str R3 set 1 add R3 cpy R3 @end @define debug_from_r2_and_increment 0 load R2 debug set 1 add R2 cpy R2 @end @define update_from_R5_and_arr 0 load R4 add R5 cpy R5 write_in_r3_and_increment @end
; A002940: Arrays of dumbbells. ; 1,4,11,26,56,114,223,424,789,1444,2608,4660,8253,14508,25343,44030,76136,131110,224955,384720,656041,1115784,1893216,3205416,5416441,9136084,15384563,25866914,43429784,72821274,121953943,204002680,340886973,569047468,949022608,1581316060,2632672821,4379569020,7280156135,12093219590,20074784456,33302907214,55214003571,91488125856,151509656401,250776524304,414872449728,686013985104,1133837714929,1873167991204,3093273277403,5106025131050,8425149842168,13896610269378,22913046841423,37766379136840,62227434734181,102498544652980,168778718925040,277834733897860,457223662680621,752226076756044,1237227629471951,2034399276440846,3344350366160936,5496418673062774,9031161529932843 mov $6,$0 mov $7,$0 add $7,1 lpb $7 mov $0,$6 sub $7,1 sub $0,$7 mov $2,4 mov $3,$0 add $3,$0 add $0,2 add $2,$3 mov $5,$2 sub $5,3 mul $5,2 mov $8,$2 lpb $0 sub $0,1 add $5,$2 mov $2,$8 mov $4,1 mov $8,$5 trn $9,3 lpe mov $2,$5 add $4,2 mul $2,$4 add $9,7 mul $2,$9 sub $2,209 div $2,210 add $2,1 add $1,$2 lpe
// seed 2 lbi r0, 79 // icount 0 slbi r0, 247 // icount 1 lbi r1, 42 // icount 2 slbi r1, 90 // icount 3 lbi r2, 142 // icount 4 slbi r2, 219 // icount 5 lbi r3, 133 // icount 6 slbi r3, 28 // icount 7 lbi r4, 33 // icount 8 slbi r4, 127 // icount 9 lbi r5, 72 // icount 10 slbi r5, 147 // icount 11 lbi r6, 22 // icount 12 slbi r6, 30 // icount 13 lbi r7, 29 // icount 14 slbi r7, 111 // icount 15 rori r3, r6, 13 // icount 16 rori r6, r7, 4 // icount 17 rori r7, r5, 11 // icount 18 rori r4, r1, 0 // icount 19 rori r2, r1, 12 // icount 20 rori r1, r3, 6 // icount 21 rori r7, r2, 7 // icount 22 rori r2, r4, 7 // icount 23 rori r0, r5, 3 // icount 24 rori r3, r0, 15 // icount 25 rori r6, r3, 14 // icount 26 rori r5, r4, 1 // icount 27 rori r6, r3, 1 // icount 28 rori r4, r4, 4 // icount 29 rori r6, r5, 3 // icount 30 rori r6, r3, 15 // icount 31 halt // icount 32