text
stringlengths
1
1.05M
; ------------------------------------------------------------------ ; MichalOS Image Viewer ; ------------------------------------------------------------------ %INCLUDE "michalos.inc" start: cmp byte [0E0h], 0 ; Were we passed a filename? je .no_param_passed cmp byte [already_displayed], 1 je .exit mov byte [already_displayed], 1 mov ax, 0E0h jmp .check_file .no_param_passed: call .draw_background mov byte [0087h], 1 mov bx, extension_number call os_file_selector ; Get filename mov byte [0087h], 0 jc .exit .check_file: mov bx, ax ; Save filename for now mov di, ax call os_string_length add di, ax ; DI now points to last char in filename dec di dec di dec di ; ...and now to first char of extension! pusha mov si, pcx_extension mov cx, 3 rep cmpsb ; Does the extension contain 'PCX'? je .valid_pcx_extension ; Skip ahead if so popa ; Otherwise show error dialog mov dx, 0 ; One button for dialog box mov ax, err_string mov bx, err_string2 mov cx, 0 call os_dialog_box jmp start ; And retry .valid_pcx_extension: call os_get_memory cmp ax, 192 ; Do we have enough RAM? jl .not_enough_ram popa push ds push es mov ax, gs mov es, ax mov ax, bx mov cx, 0 ; Load PCX at GS:0000h call os_load_file mov byte [0082h], 1 mov ah, 0 ; Switch to graphics mode mov al, 13h int 10h mov ax, 0A000h ; ES = video memory mov es, ax mov ax, gs ; DS = source file mov ds, ax mov si, 80h ; Move source to start of image data (First 80h bytes is header) mov di, 0 ; Start our loop at top of video RAM .decode: mov cx, 1 lodsb cmp al, 192 ; Single pixel or string? jb .single and al, 63 ; String, so 'mod 64' it mov cl, al ; Result in CL for following 'rep' lodsb ; Get byte to put on screen .single: rep stosb ; And show it (or all of them) cmp di, 64001 jb .decode mov dx, 3c8h ; Palette index register mov al, 0 ; Start at colour 0 out dx, al ; Tell VGA controller that... inc dx ; ...3c9h = palette data register mov cx, 768 ; 256 colours, 3 bytes each .setpal: lodsb ; Grab the next byte. shr al, 2 ; Palettes divided by 4, so undo out dx, al ; Send to VGA controller loop .setpal pop es pop ds call os_wait_for_key mov byte [0082h], 0 mov ax, 3 ; Back to text mode mov bx, 0 int 10h mov ax, 1003h ; No blinking text! int 10h mov al, 09h ; Set bright attribute for CGA mov dx, 03D8h out dx, al call os_reset_font call os_clear_screen jmp start .draw_background: mov ax, title_msg ; Set up screen mov bx, footer_msg mov cx, 256 call os_draw_background ret .not_enough_ram: popa mov ax, no_ram mov bx, 0 mov cx, 0 mov dx, 0 call os_dialog_box jmp start .exit: ret extension_number db 1 pcx_extension db 'PCX', 0 no_ram db 'Not enough RAM!', 0 err_string db 'Invalid file type!', 0 err_string2 db '320x200x8bpp PCX only!', 0 title_msg db 'MichalOS Image Viewer', 0 footer_msg db '', 0 already_displayed db 0 ; ------------------------------------------------------------------
; A070893: Let r, s, t be three permutations of the set {1,2,3,..,n}; a(n) = value of Sum_{i=1..n} r(i)*s(i)*t(i), with r={1,2,3,..,n}; s={n,n-1,..,1} and t={n,n-2,n-4,...,1,...,n-3,n-1}. ; 1,6,19,46,94,172,290,460,695,1010,1421,1946,2604,3416,4404,5592,7005,8670,10615,12870,15466,18436,21814,25636,29939,34762,40145,46130,52760,60080,68136,76976,86649,97206,108699,121182,134710,149340,165130,182140,200431,220066,241109,263626,287684,313352,340700,369800,400725,433550,468351,505206,544194,585396,628894,674772,723115,774010,827545,883810,942896,1004896,1069904,1138016,1209329,1283942,1361955,1443470,1528590,1617420,1710066,1806636,1907239,2011986,2120989,2234362,2352220,2474680,2601860,2733880,2870861,3012926,3160199,3312806,3470874,3634532,3803910,3979140,4160355,4347690,4541281,4741266,4947784,5160976,5380984,5607952,5842025,6083350,6332075,6588350 mul $0,2 seq $0,82290 ; Expansion of (1+x+x^2)/((1+x^2)*(1+x)^4*(1-x)^5).
; A212769: p*q modulo (p+q) with p, q consecutive primes. ; 1,7,11,5,23,11,35,17,43,59,59,35,83,41,91,103,119,119,65,143,143,77,163,77,95,203,101,215,107,191,125,259,275,263,299,299,311,161,331,343,359,347,383,191,395,169,181,221,455,227,463,479,467,499,511,523,539,539,275,563,551,551,305,623,311,599,659,659,695,347,703,347,731,743,377,763,377,395,389,803,839,827,863,863,437,883,437,455,923,461,437,467,485,479,497,1003,479,1043,983,1079 mov $2,$0 add $0,1 seq $0,40 ; The prime numbers. mov $1,$0 seq $2,40 ; The prime numbers. mul $0,$2 ; Now $2 holds p * q add $1,$2 ; Now $0 holds p + q mod $0,$1 ; Compute (p*q) mod (p+q)
; A275163: a(n) = 13*2^(n+1) - 19. ; 7,33,85,189,397,813,1645,3309,6637,13293,26605,53229,106477,212973,425965,851949,1703917,3407853,6815725,13631469,27262957,54525933,109051885,218103789,436207597,872415213,1744830445,3489660909,6979321837,13958643693 mov $1,2 pow $1,$0 sub $1,1 mul $1,26 add $1,7
; A132209: a(0) = 0 and a(n) = 2*n^2 + 2*n - 1, for n>=1. ; 0,3,11,23,39,59,83,111,143,179,219,263,311,363,419,479,543,611,683,759,839,923,1011,1103,1199,1299,1403,1511,1623,1739,1859,1983,2111,2243,2379,2519,2663,2811,2963,3119,3279,3443,3611,3783,3959,4139,4323,4511,4703,4899,5099,5303,5511,5723,5939,6159,6383,6611,6843,7079,7319,7563,7811,8063,8319,8579,8843,9111,9383,9659,9939,10223,10511,10803,11099,11399,11703,12011,12323,12639,12959,13283,13611,13943,14279,14619,14963,15311,15663,16019,16379,16743,17111,17483,17859,18239,18623,19011,19403,19799 mov $1,1 add $1,$0 mul $1,$0 mul $1,2 trn $1,1 mov $0,$1
copyright zengfr site:http://github.com/zengfr/romhack 00042A move.l D1, (A0)+ 00042C dbra D0, $42a 004D3C move.l D0, (A4)+ 004D3E move.l D0, (A4)+ 0844CE move.w D0, ($aa,A6) 0844D2 move.w D0, ($b0,A6) 0849DA addi.w #$1, ($aa,A6) 0849E0 cmpi.w #$2, ($aa,A6) [etc+AA] 0849EA move.w #$0, ($aa,A6) 0849F0 tst.w D0 086DD0 move.w (A0,D1.w), ($aa,A6) 086DD6 rts [etc+AA] 0888FA move.l ($a0,A6), ($a8,A6) [etc+A0, etc+A2] 088900 move.l (A0), ($ac,A6) [etc+A8, etc+AA] 0889A0 movea.l ($a8,A6), A0 [etc+B0] 0889A4 move.l (A0)+, D0 [etc+A8, etc+AA] 091FF0 move.l #$0, ($aa,A6) [etc+A0] 091FF8 move.w #$1e, ($b6,A6) 0921FA move.l #$0, ($aa,A6) [etc+A0] 092202 rts 092266 move.b #$1, ($aa,A6) [etc+A9] 09226C rts [etc+AA] 09226E subq.b #1, ($aa,A6) 092272 bne $922c0 [etc+AA] 092274 move.b ($a9,A6), ($aa,A6) 09227A movea.l ($a4,A6), A0 [etc+AA] 0AAACA move.l (A0), D2 0AAACC move.w D0, (A0) [123p+11A, 123p+11C, 123p+11E, 123p+120, 123p+122, 123p+124, 123p+126, 123p+128, 123p+12A, enemy+BC, enemy+C0, enemy+C2, enemy+C4, enemy+CC, enemy+CE, enemy+D0, enemy+D2, enemy+D4, enemy+D6, enemy+D8, enemy+DA, enemy+DE, item+86, item+88, item+8A, item+98, item+9A, item+9C, item+9E, item+A0, item+A2, item+A4, item+A6, scr1] 0AAACE move.w D0, ($2,A0) 0AAAD2 cmp.l (A0), D0 0AAAD4 bne $aaafc 0AAAD8 move.l D2, (A0)+ 0AAADA cmpa.l A0, A1 [123p+11A, 123p+11C, 123p+11E, 123p+120, 123p+122, 123p+124, 123p+126, 123p+128, 123p+12A, enemy+BC, enemy+C0, enemy+C2, enemy+C4, enemy+CC, enemy+CE, enemy+D0, enemy+D2, enemy+D4, enemy+D6, enemy+D8, enemy+DA, enemy+DE, item+86, item+88, item+8A, item+98, item+9A, item+9C, item+9E, item+A0, item+A2, item+A4, item+A6, scr1] 0AAAE6 move.l (A0), D2 0AAAE8 move.w D0, (A0) [123p+11A, 123p+11C, 123p+11E, 123p+120, 123p+122, 123p+124, 123p+126, 123p+128, 123p+12A, enemy+BC, enemy+C0, enemy+C2, enemy+C4, enemy+CC, enemy+CE, enemy+D0, enemy+D2, enemy+D4, enemy+D6, enemy+D8, enemy+DA, enemy+DE, item+86, item+88, item+8A, item+98, item+9A, item+9C, item+9E, item+A0, item+A2, item+A4, item+A6, scr1] 0AAAF4 move.l D2, (A0)+ 0AAAF6 cmpa.l A0, A1 [123p+11A, 123p+11C, 123p+11E, 123p+120, 123p+122, 123p+124, 123p+126, 123p+128, 123p+12A, enemy+BC, enemy+C0, enemy+C2, enemy+C4, enemy+CC, enemy+CE, enemy+D0, enemy+D2, enemy+D4, enemy+D6, enemy+D8, enemy+DA, enemy+DE, item+86, item+88, item+8A, item+98, item+9A, item+9C, item+9E, item+A0, item+A2, item+A4, item+A6, scr1] copyright zengfr site:http://github.com/zengfr/romhack
.size 8000 .text@48 jp lstatint .text@100 jp lbegin .data@143 c0 .text@150 lbegin: ld a, 00 ldff(ff), a ld a, 30 ldff(00), a ld a, 01 ldff(4d), a stop, 00 ld a, ff ldff(45), a ld b, 91 call lwaitly_b ld hl, fe00 ld d, 10 ld a, d ld(hl++), a ld a, 08 ld(hl++), a inc l inc l ld a, d ld(hl++), a ld(hl++), a inc l inc l ld(hl++), a ld a, 18 ld(hl++), a inc l inc l ld a, d ld(hl++), a ld a, 20 ld(hl++), a inc l inc l ld a, d ld(hl++), a ld a, 28 ld(hl++), a inc l inc l ld a, d ld(hl++), a ld a, 30 ld(hl++), a inc l inc l ld a, d ld(hl++), a ld a, 38 ld(hl++), a inc l inc l ld a, d ld(hl++), a ld a, 40 ld(hl++), a ld a, 40 ldff(41), a ld a, 02 ldff(ff), a xor a, a ldff(0f), a ei ld a, 01 ldff(45), a ld c, 41 ld a, 93 ldff(40), a .text@1000 lstatint: nop .text@10a0 ldff a, (c) and a, 03 jp lprint_a .text@7000 lprint_a: push af ld b, 91 call lwaitly_b xor a, a ldff(40), a pop af ld(9800), a ld bc, 7a00 ld hl, 8000 ld d, a0 lprint_copytiles: ld a, (bc) inc bc ld(hl++), a dec d jrnz lprint_copytiles ld a, c0 ldff(47), a ld a, 80 ldff(68), a ld a, ff ldff(69), a ldff(69), a ldff(69), a ldff(69), a ldff(69), a ldff(69), a xor a, a ldff(69), a ldff(69), a ldff(43), a ld a, 91 ldff(40), a lprint_limbo: jr lprint_limbo .text@7400 lwaitly_b: ld c, 44 lwaitly_b_loop: ldff a, (c) cmp a, b jrnz lwaitly_b_loop ret .data@7a00 00 00 7f 7f 41 41 41 41 41 41 41 41 41 41 7f 7f 00 00 08 08 08 08 08 08 08 08 08 08 08 08 08 08 00 00 7f 7f 01 01 01 01 7f 7f 40 40 40 40 7f 7f 00 00 7f 7f 01 01 01 01 3f 3f 01 01 01 01 7f 7f 00 00 41 41 41 41 41 41 7f 7f 01 01 01 01 01 01 00 00 7f 7f 40 40 40 40 7e 7e 01 01 01 01 7e 7e 00 00 7f 7f 40 40 40 40 7f 7f 41 41 41 41 7f 7f 00 00 7f 7f 01 01 02 02 04 04 08 08 10 10 10 10 00 00 3e 3e 41 41 41 41 3e 3e 41 41 41 41 3e 3e 00 00 7f 7f 41 41 41 41 7f 7f 01 01 01 01 7f 7f
%define safe_copy_memory _ZN6kernel16safe_copy_memoryEPKvPvm %define length_of_user_string _ZN6kernel21length_of_user_stringEPKv %define copy_until_null_or_n_from_user _ZN6kernel30copy_until_null_or_n_from_userEPKvPvm ; Safe function ABI: ; During a safe operation E(R)BX contains the address to go to in case of a fault, ; E(R)IP gets set to this address in case of a fault by the memory manager. section .safe_operations ; Copies exactly bytes into dst, returns 1 if success or 0 if faulted. ; bool safe_copy_memory(void* src, void* dst, size_t bytes) global safe_copy_memory safe_copy_memory: ; preserve non-scratch registers push esi push edi push ebx mov esi, [esp + 16] ; src mov edi, [esp + 20] ; dst mov ecx, [esp + 24] ; bytes mov ebx, .on_access_violation ; label to jump to in case of a fault rep movsb mov eax, 1 jmp .done .on_access_violation: xor eax, eax .done: pop ebx pop edi pop esi ret ; Returns string length including the null terminator, or 0 if faulted ; size_t length_of_user_string(void* str) global length_of_user_string length_of_user_string: ; preserve non-scratch push ecx push edi push ebx mov ebx, .on_access_violation mov eax, 0 ; null terminator mov ecx, 0xFFFFFFFF mov edi, [esp + 16] repnz scasb mov eax, 0xFFFFFFFF sub eax, ecx jmp .done .on_access_violation: xor eax, eax .done: pop ebx pop edi pop ecx ret ; Copies up to max_length or up to the null byte to the dst from src. ; Returns the number of bytes copied including the null byte, or 0 if faulted. ; size_t copy_until_null_or_n_from_user(void* src, void* dst, size_t max_length) global copy_until_null_or_n_from_user copy_until_null_or_n_from_user: ; preserve non-scratch push ebx push esi push edi mov ebx, .on_access_violation xor eax, eax mov edi, [esp + 16] mov esi, [esp + 20] mov ecx, [esp + 24] .next: ; if (length == 0) return or ecx, ecx jz .done ; char c = *src mov dl, byte [edi] ; *dst = c mov [esi], dl ; bytes_copied++ inc eax ; if (c == \0) return or dl, dl jz .done ; src++, dst++, length-- inc edi inc esi dec ecx jmp .next .on_access_violation: xor eax, eax .done: pop edi pop esi pop ebx ret
.ORG $300 INBUF = $200 ;GETLN input buffer. WAIT = $FCA8 ;Monitor wait routine. BELL = $FF3A ;Monitor bell routine. EXTRNCMD = $BE06 ;External cmd JMP vector. XTRNADDR = $BE50 ;Ext cmd implementation addr. XLEN = $BE52 ;length of command string-1. XCNUM = $BE53 ;CI cmd no. (ext cmd - 0). PBITS = $BE54 ;Command parameter bits. XRETURN = $FF58 ;Known RTS instruction. InputByte = $c0fe OutputByte = $c0fd InputFlags = $c0fb OutputFlags = $c0f7 ReadBlockCommand = $01 WriteBlockCommand = $02 GetTimeCommand = $03 ChangeDriveCommand = $04 ExecCommand = $05 LoadFileCommand = $06 SaveFileCommand = $07 MenuCommand = $08 InputString = $fd67 PrintChar = $fded Keyboard = $c000 ClearKeyboard = $c010 Wait = $fca8 ; ; FIRST SAVE THE EXTERNAL COMMAND ADDRESS SO YOU WON'T ; DISCONNECT ANY PREVIOUSLY CONNECTED COMMAND. ; LDA EXTRNCMD+1 STA NXTCMD LDA EXTRNCMD+2 STA NXTCMD+1 ; LDA #<RPI ;Install the address of our STA EXTRNCMD+1 ; command handler in the LDA #>RPI ; external command JMP STA EXTRNCMD+2 ; vector. RTS ; RPI: LDX #0 ;Check for our command. NXTCHR: LDA INBUF,X ;Get first character. ora #$20 ;Make it lower case CMP CMD,X ;Does it match? BNE NOTOURS ;No, back to CI. INX ;Next character CPX #CMDLEN ;All characters yet? BNE NXTCHR ;No, read next one. ; LDA #CMDLEN-1 ;Our cmd! Put cmd length-1 ;lda #$8d ;sta $02ff ;lda #$fe STA XLEN ; in CI global XLEN. LDA #<XRETURN ;Point XTRNADDR to a known STA XTRNADDR ; RTS since we'll handle LDA #>XRETURN ; at the time we intercept STA XTRNADDR+1 ; our command. LDA #0 ;Mark the cmd number as STA XCNUM ; zero (external). STA PBITS ;And indicate no parameters STA PBITS+1 ; to be parsed. lda #$8d jsr $fded clc bcc SendCommand ; NOTOURS: SEC ; ALWAYS SET CARRY IF NOT YOUR JMP (NXTCMD) ; CMD AND LET NEXT COMMAND TRY ; ; TO CLAIM IT. SendCommand: bit ClearKeyboard lda #$05 ;send command 5 = exec jsr SendByte ldy #$03 ;skip over "RPI" getInput: lda $0200,y cmp #$8d beq sendNullTerminator and #$7f jsr SendByte iny bne getInput sendNullTerminator: lda #$00 jsr SendByte DumpOutput: jsr GetByte bcs skipOutput cmp #$00 beq endOutput jsr PrintChar skipOutput: bit Keyboard ;check for keypress bpl DumpOutput ;keep dumping output if no keypress lda Keyboard ;send keypress to RPi jsr PrintChar and #$7f jsr SendByte bit ClearKeyboard clc bcc DumpOutput endOutput: clc jmp (NXTCMD) HelpCommand: .byte "a2help",$00 SendByte: pha waitWrite: lda InputFlags rol rol bcs waitWrite pla sta OutputByte lda #$1e ; set bit 0 low to indicate write started sta OutputFlags finishWrite: lda InputFlags rol rol bcc finishWrite lda #$1f sta OutputFlags rts GetByte: lda #$1d ;set read flag low sta OutputFlags waitRead: lda InputFlags rol bcc readByte bit Keyboard ;keypress will abort waiting to read bpl waitRead lda #$1f ;set all flags high and exit sta OutputFlags sec ;failure rts readByte: lda InputByte pha lda #$1f ;set all flags high sta OutputFlags finishRead: lda InputFlags rol bcc finishRead pla clc ;success rts ;macro for string with high-bit set .macro aschi str .repeat .strlen (str), c .byte .strat (str, c) | $80 .endrep .endmacro CMD: aschi "rpi" CMDLEN = 3 ;Our command length ; NXTCMD: .byte 0,0 ; STORE THE NEXT EXT CMD'S ; ADDRESS HERE.
/* Copyright 2003-2015 Joaquin M Lopez Munoz. * 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) * * See http://www.boost.org/libs/multi_index for library home page. * * The internal implementation of red-black trees is based on that of SGI STL * stl_tree.h file: * * Copyright (c) 1996,1997 * Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Silicon Graphics makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. * * * Copyright (c) 1994 * Hewlett-Packard Company * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Hewlett-Packard Company makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. * */ #ifndef BOOST_MULTI_INDEX_DETAIL_ORD_INDEX_IMPL_HPP #define BOOST_MULTI_INDEX_DETAIL_ORD_INDEX_IMPL_HPP #if defined(_MSC_VER) #pragma once #endif #include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */ #include <algorithm> #include <boost/call_traits.hpp> #include <boost/detail/no_exceptions_support.hpp> #include <boost/detail/workaround.hpp> #include <boost/foreach_fwd.hpp> #include <boost/iterator/reverse_iterator.hpp> #include <boost/move/core.hpp> #include <boost/mpl/bool.hpp> #include <boost/mpl/if.hpp> #include <boost/mpl/push_front.hpp> #include <boost/multi_index/detail/access_specifier.hpp> #include <boost/multi_index/detail/bidir_node_iterator.hpp> #include <boost/multi_index/detail/do_not_copy_elements_tag.hpp> #include <boost/multi_index/detail/index_node_base.hpp> #include <boost/multi_index/detail/modify_key_adaptor.hpp> #include <boost/multi_index/detail/ord_index_node.hpp> #include <boost/multi_index/detail/ord_index_ops.hpp> #include <boost/multi_index/detail/safe_mode.hpp> #include <boost/multi_index/detail/scope_guard.hpp> #include <boost/multi_index/detail/unbounded.hpp> #include <boost/multi_index/detail/value_compare.hpp> #include <boost/multi_index/detail/vartempl_support.hpp> #include <boost/multi_index/detail/ord_index_impl_fwd.hpp> #include <boost/ref.hpp> #include <boost/tuple/tuple.hpp> #include <boost/type_traits/is_same.hpp> #include <utility> #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) #include <initializer_list> #endif #if !defined(BOOST_MULTI_INDEX_DISABLE_SERIALIZATION) #include <boost/archive/archive_exception.hpp> #include <boost/bind.hpp> #include <boost/multi_index/detail/duplicates_iterator.hpp> #include <boost/throw_exception.hpp> #endif #if defined(BOOST_MULTI_INDEX_ENABLE_INVARIANT_CHECKING) #define BOOST_MULTI_INDEX_ORD_INDEX_CHECK_INVARIANT_OF(x) \ detail::scope_guard BOOST_JOIN(check_invariant_,__LINE__)= \ detail::make_obj_guard(x,&ordered_index_impl::check_invariant_); \ BOOST_JOIN(check_invariant_,__LINE__).touch(); #define BOOST_MULTI_INDEX_ORD_INDEX_CHECK_INVARIANT \ BOOST_MULTI_INDEX_ORD_INDEX_CHECK_INVARIANT_OF(*this) #else #define BOOST_MULTI_INDEX_ORD_INDEX_CHECK_INVARIANT_OF(x) #define BOOST_MULTI_INDEX_ORD_INDEX_CHECK_INVARIANT #endif namespace boost{ namespace multi_index{ namespace detail{ /* ordered_index adds a layer of ordered indexing to a given Super and accepts * an augmenting policy for optional addition of order statistics. */ /* Most of the implementation of unique and non-unique indices is * shared. We tell from one another on instantiation time by using * these tags. */ struct ordered_unique_tag{}; struct ordered_non_unique_tag{}; template< typename KeyFromValue,typename Compare, typename SuperMeta,typename TagList,typename Category,typename AugmentPolicy > class ordered_index; template< typename KeyFromValue,typename Compare, typename SuperMeta,typename TagList,typename Category,typename AugmentPolicy > class ordered_index_impl: BOOST_MULTI_INDEX_PROTECTED_IF_MEMBER_TEMPLATE_FRIENDS SuperMeta::type #if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) ,public safe_mode::safe_container< ordered_index_impl< KeyFromValue,Compare,SuperMeta,TagList,Category,AugmentPolicy> > #endif { #if defined(BOOST_MULTI_INDEX_ENABLE_INVARIANT_CHECKING)&&\ BOOST_WORKAROUND(__MWERKS__,<=0x3003) /* The "ISO C++ Template Parser" option in CW8.3 has a problem with the * lifetime of const references bound to temporaries --precisely what * scopeguards are. */ #pragma parse_mfunc_templ off #endif typedef typename SuperMeta::type super; protected: typedef ordered_index_node< AugmentPolicy,typename super::node_type> node_type; protected: /* for the benefit of AugmentPolicy::augmented_interface */ typedef typename node_type::impl_type node_impl_type; typedef typename node_impl_type::pointer node_impl_pointer; public: /* types */ typedef typename KeyFromValue::result_type key_type; typedef typename node_type::value_type value_type; typedef KeyFromValue key_from_value; typedef Compare key_compare; typedef value_comparison< value_type,KeyFromValue,Compare> value_compare; typedef tuple<key_from_value,key_compare> ctor_args; typedef typename super::final_allocator_type allocator_type; typedef typename allocator_type::reference reference; typedef typename allocator_type::const_reference const_reference; #if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) typedef safe_mode::safe_iterator< bidir_node_iterator<node_type>, ordered_index_impl> iterator; #else typedef bidir_node_iterator<node_type> iterator; #endif typedef iterator const_iterator; typedef std::size_t size_type; typedef std::ptrdiff_t difference_type; typedef typename allocator_type::pointer pointer; typedef typename allocator_type::const_pointer const_pointer; typedef typename boost::reverse_iterator<iterator> reverse_iterator; typedef typename boost::reverse_iterator<const_iterator> const_reverse_iterator; typedef TagList tag_list; protected: typedef typename super::final_node_type final_node_type; typedef tuples::cons< ctor_args, typename super::ctor_args_list> ctor_args_list; typedef typename mpl::push_front< typename super::index_type_list, ordered_index< KeyFromValue,Compare, SuperMeta,TagList,Category,AugmentPolicy > >::type index_type_list; typedef typename mpl::push_front< typename super::iterator_type_list, iterator>::type iterator_type_list; typedef typename mpl::push_front< typename super::const_iterator_type_list, const_iterator>::type const_iterator_type_list; typedef typename super::copy_map_type copy_map_type; #if !defined(BOOST_MULTI_INDEX_DISABLE_SERIALIZATION) typedef typename super::index_saver_type index_saver_type; typedef typename super::index_loader_type index_loader_type; #endif protected: #if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) typedef safe_mode::safe_container< ordered_index_impl> safe_super; #endif typedef typename call_traits< value_type>::param_type value_param_type; typedef typename call_traits< key_type>::param_type key_param_type; /* Needed to avoid commas in BOOST_MULTI_INDEX_OVERLOADS_TO_VARTEMPL * expansion. */ typedef std::pair<iterator,bool> emplace_return_type; public: /* construct/copy/destroy * Default and copy ctors are in the protected section as indices are * not supposed to be created on their own. No range ctor either. * Assignment operators defined at ordered_index rather than here. */ allocator_type get_allocator()const BOOST_NOEXCEPT { return this->final().get_allocator(); } /* iterators */ iterator begin()BOOST_NOEXCEPT{return make_iterator(leftmost());} const_iterator begin()const BOOST_NOEXCEPT{return make_iterator(leftmost());} iterator end()BOOST_NOEXCEPT{return make_iterator(header());} const_iterator end()const BOOST_NOEXCEPT{return make_iterator(header());} reverse_iterator rbegin()BOOST_NOEXCEPT{return boost::make_reverse_iterator(end());} const_reverse_iterator rbegin()const BOOST_NOEXCEPT{return boost::make_reverse_iterator(end());} reverse_iterator rend()BOOST_NOEXCEPT{return boost::make_reverse_iterator(begin());} const_reverse_iterator rend()const BOOST_NOEXCEPT{return boost::make_reverse_iterator(begin());} const_iterator cbegin()const BOOST_NOEXCEPT{return begin();} const_iterator cend()const BOOST_NOEXCEPT{return end();} const_reverse_iterator crbegin()const BOOST_NOEXCEPT{return rbegin();} const_reverse_iterator crend()const BOOST_NOEXCEPT{return rend();} iterator iterator_to(const value_type& x) { return make_iterator(node_from_value<node_type>(&x)); } const_iterator iterator_to(const value_type& x)const { return make_iterator(node_from_value<node_type>(&x)); } /* capacity */ bool empty()const BOOST_NOEXCEPT{return this->final_empty_();} size_type size()const BOOST_NOEXCEPT{return this->final_size_();} size_type max_size()const BOOST_NOEXCEPT{return this->final_max_size_();} /* modifiers */ BOOST_MULTI_INDEX_OVERLOADS_TO_VARTEMPL( emplace_return_type,emplace,emplace_impl) BOOST_MULTI_INDEX_OVERLOADS_TO_VARTEMPL_EXTRA_ARG( iterator,emplace_hint,emplace_hint_impl,iterator,position) std::pair<iterator,bool> insert(const value_type& x) { BOOST_MULTI_INDEX_ORD_INDEX_CHECK_INVARIANT; std::pair<final_node_type*,bool> p=this->final_insert_(x); return std::pair<iterator,bool>(make_iterator(p.first),p.second); } std::pair<iterator,bool> insert(BOOST_RV_REF(value_type) x) { BOOST_MULTI_INDEX_ORD_INDEX_CHECK_INVARIANT; std::pair<final_node_type*,bool> p=this->final_insert_rv_(x); return std::pair<iterator,bool>(make_iterator(p.first),p.second); } iterator insert(iterator position,const value_type& x) { BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position); BOOST_MULTI_INDEX_CHECK_IS_OWNER(position,*this); BOOST_MULTI_INDEX_ORD_INDEX_CHECK_INVARIANT; std::pair<final_node_type*,bool> p=this->final_insert_( x,static_cast<final_node_type*>(position.get_node())); return make_iterator(p.first); } iterator insert(iterator position,BOOST_RV_REF(value_type) x) { BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position); BOOST_MULTI_INDEX_CHECK_IS_OWNER(position,*this); BOOST_MULTI_INDEX_ORD_INDEX_CHECK_INVARIANT; std::pair<final_node_type*,bool> p=this->final_insert_rv_( x,static_cast<final_node_type*>(position.get_node())); return make_iterator(p.first); } template<typename InputIterator> void insert(InputIterator first,InputIterator last) { BOOST_MULTI_INDEX_ORD_INDEX_CHECK_INVARIANT; node_type* hint=header(); /* end() */ for(;first!=last;++first){ hint=this->final_insert_ref_( *first,static_cast<final_node_type*>(hint)).first; node_type::increment(hint); } } #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) void insert(std::initializer_list<value_type> list) { insert(list.begin(),list.end()); } #endif iterator erase(iterator position) { BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position); BOOST_MULTI_INDEX_CHECK_DEREFERENCEABLE_ITERATOR(position); BOOST_MULTI_INDEX_CHECK_IS_OWNER(position,*this); BOOST_MULTI_INDEX_ORD_INDEX_CHECK_INVARIANT; this->final_erase_(static_cast<final_node_type*>(position++.get_node())); return position; } size_type erase(key_param_type x) { BOOST_MULTI_INDEX_ORD_INDEX_CHECK_INVARIANT; std::pair<iterator,iterator> p=equal_range(x); size_type s=0; while(p.first!=p.second){ p.first=erase(p.first); ++s; } return s; } iterator erase(iterator first,iterator last) { BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(first); BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(last); BOOST_MULTI_INDEX_CHECK_IS_OWNER(first,*this); BOOST_MULTI_INDEX_CHECK_IS_OWNER(last,*this); BOOST_MULTI_INDEX_CHECK_VALID_RANGE(first,last); BOOST_MULTI_INDEX_ORD_INDEX_CHECK_INVARIANT; while(first!=last){ first=erase(first); } return first; } bool replace(iterator position,const value_type& x) { BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position); BOOST_MULTI_INDEX_CHECK_DEREFERENCEABLE_ITERATOR(position); BOOST_MULTI_INDEX_CHECK_IS_OWNER(position,*this); BOOST_MULTI_INDEX_ORD_INDEX_CHECK_INVARIANT; return this->final_replace_( x,static_cast<final_node_type*>(position.get_node())); } bool replace(iterator position,BOOST_RV_REF(value_type) x) { BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position); BOOST_MULTI_INDEX_CHECK_DEREFERENCEABLE_ITERATOR(position); BOOST_MULTI_INDEX_CHECK_IS_OWNER(position,*this); BOOST_MULTI_INDEX_ORD_INDEX_CHECK_INVARIANT; return this->final_replace_rv_( x,static_cast<final_node_type*>(position.get_node())); } template<typename Modifier> bool modify(iterator position,Modifier mod) { BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position); BOOST_MULTI_INDEX_CHECK_DEREFERENCEABLE_ITERATOR(position); BOOST_MULTI_INDEX_CHECK_IS_OWNER(position,*this); BOOST_MULTI_INDEX_ORD_INDEX_CHECK_INVARIANT; #if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) /* MSVC++ 6.0 optimizer on safe mode code chokes if this * this is not added. Left it for all compilers as it does no * harm. */ position.detach(); #endif return this->final_modify_( mod,static_cast<final_node_type*>(position.get_node())); } template<typename Modifier,typename Rollback> bool modify(iterator position,Modifier mod,Rollback back_) { BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position); BOOST_MULTI_INDEX_CHECK_DEREFERENCEABLE_ITERATOR(position); BOOST_MULTI_INDEX_CHECK_IS_OWNER(position,*this); BOOST_MULTI_INDEX_ORD_INDEX_CHECK_INVARIANT; #if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) /* MSVC++ 6.0 optimizer on safe mode code chokes if this * this is not added. Left it for all compilers as it does no * harm. */ position.detach(); #endif return this->final_modify_( mod,back_,static_cast<final_node_type*>(position.get_node())); } template<typename Modifier> bool modify_key(iterator position,Modifier mod) { BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position); BOOST_MULTI_INDEX_CHECK_DEREFERENCEABLE_ITERATOR(position); BOOST_MULTI_INDEX_CHECK_IS_OWNER(position,*this); BOOST_MULTI_INDEX_ORD_INDEX_CHECK_INVARIANT; return modify( position,modify_key_adaptor<Modifier,value_type,KeyFromValue>(mod,key)); } template<typename Modifier,typename Rollback> bool modify_key(iterator position,Modifier mod,Rollback back_) { BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position); BOOST_MULTI_INDEX_CHECK_DEREFERENCEABLE_ITERATOR(position); BOOST_MULTI_INDEX_CHECK_IS_OWNER(position,*this); BOOST_MULTI_INDEX_ORD_INDEX_CHECK_INVARIANT; return modify( position, modify_key_adaptor<Modifier,value_type,KeyFromValue>(mod,key), modify_key_adaptor<Rollback,value_type,KeyFromValue>(back_,key)); } void swap( ordered_index< KeyFromValue,Compare,SuperMeta,TagList,Category,AugmentPolicy>& x) { BOOST_MULTI_INDEX_ORD_INDEX_CHECK_INVARIANT; BOOST_MULTI_INDEX_ORD_INDEX_CHECK_INVARIANT_OF(x); this->final_swap_(x.final()); } void clear()BOOST_NOEXCEPT { BOOST_MULTI_INDEX_ORD_INDEX_CHECK_INVARIANT; this->final_clear_(); } /* observers */ key_from_value key_extractor()const{return key;} key_compare key_comp()const{return comp_;} value_compare value_comp()const{return value_compare(key,comp_);} /* set operations */ /* Internally, these ops rely on const_iterator being the same * type as iterator. */ template<typename CompatibleKey> iterator find(const CompatibleKey& x)const { return make_iterator(ordered_index_find(root(),header(),key,x,comp_)); } template<typename CompatibleKey,typename CompatibleCompare> iterator find( const CompatibleKey& x,const CompatibleCompare& comp)const { return make_iterator(ordered_index_find(root(),header(),key,x,comp)); } template<typename CompatibleKey> size_type count(const CompatibleKey& x)const { return count(x,comp_); } template<typename CompatibleKey,typename CompatibleCompare> size_type count(const CompatibleKey& x,const CompatibleCompare& comp)const { std::pair<iterator,iterator> p=equal_range(x,comp); size_type n=std::distance(p.first,p.second); return n; } template<typename CompatibleKey> iterator lower_bound(const CompatibleKey& x)const { return make_iterator( ordered_index_lower_bound(root(),header(),key,x,comp_)); } template<typename CompatibleKey,typename CompatibleCompare> iterator lower_bound( const CompatibleKey& x,const CompatibleCompare& comp)const { return make_iterator( ordered_index_lower_bound(root(),header(),key,x,comp)); } template<typename CompatibleKey> iterator upper_bound(const CompatibleKey& x)const { return make_iterator( ordered_index_upper_bound(root(),header(),key,x,comp_)); } template<typename CompatibleKey,typename CompatibleCompare> iterator upper_bound( const CompatibleKey& x,const CompatibleCompare& comp)const { return make_iterator( ordered_index_upper_bound(root(),header(),key,x,comp)); } template<typename CompatibleKey> std::pair<iterator,iterator> equal_range( const CompatibleKey& x)const { std::pair<node_type*,node_type*> p= ordered_index_equal_range(root(),header(),key,x,comp_); return std::pair<iterator,iterator>( make_iterator(p.first),make_iterator(p.second)); } template<typename CompatibleKey,typename CompatibleCompare> std::pair<iterator,iterator> equal_range( const CompatibleKey& x,const CompatibleCompare& comp)const { std::pair<node_type*,node_type*> p= ordered_index_equal_range(root(),header(),key,x,comp); return std::pair<iterator,iterator>( make_iterator(p.first),make_iterator(p.second)); } /* range */ template<typename LowerBounder,typename UpperBounder> std::pair<iterator,iterator> range(LowerBounder lower,UpperBounder upper)const { typedef typename mpl::if_< is_same<LowerBounder,unbounded_type>, BOOST_DEDUCED_TYPENAME mpl::if_< is_same<UpperBounder,unbounded_type>, both_unbounded_tag, lower_unbounded_tag >::type, BOOST_DEDUCED_TYPENAME mpl::if_< is_same<UpperBounder,unbounded_type>, upper_unbounded_tag, none_unbounded_tag >::type >::type dispatch; return range(lower,upper,dispatch()); } BOOST_MULTI_INDEX_PROTECTED_IF_MEMBER_TEMPLATE_FRIENDS: ordered_index_impl(const ctor_args_list& args_list,const allocator_type& al): super(args_list.get_tail(),al), key(tuples::get<0>(args_list.get_head())), comp_(tuples::get<1>(args_list.get_head())) { empty_initialize(); } ordered_index_impl( const ordered_index_impl< KeyFromValue,Compare,SuperMeta,TagList,Category,AugmentPolicy>& x): super(x), #if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) safe_super(), #endif key(x.key), comp_(x.comp_) { /* Copy ctor just takes the key and compare objects from x. The rest is * done in a subsequent call to copy_(). */ } ordered_index_impl( const ordered_index_impl< KeyFromValue,Compare,SuperMeta,TagList,Category,AugmentPolicy>& x, do_not_copy_elements_tag): super(x,do_not_copy_elements_tag()), #if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) safe_super(), #endif key(x.key), comp_(x.comp_) { empty_initialize(); } ~ordered_index_impl() { /* the container is guaranteed to be empty by now */ } #if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) iterator make_iterator(node_type* node){return iterator(node,this);} const_iterator make_iterator(node_type* node)const {return const_iterator(node,const_cast<ordered_index_impl*>(this));} #else iterator make_iterator(node_type* node){return iterator(node);} const_iterator make_iterator(node_type* node)const {return const_iterator(node);} #endif void copy_( const ordered_index_impl< KeyFromValue,Compare,SuperMeta,TagList,Category,AugmentPolicy>& x, const copy_map_type& map) { if(!x.root()){ empty_initialize(); } else{ header()->color()=x.header()->color(); AugmentPolicy::copy(x.header()->impl(),header()->impl()); node_type* root_cpy=map.find(static_cast<final_node_type*>(x.root())); header()->parent()=root_cpy->impl(); node_type* leftmost_cpy=map.find( static_cast<final_node_type*>(x.leftmost())); header()->left()=leftmost_cpy->impl(); node_type* rightmost_cpy=map.find( static_cast<final_node_type*>(x.rightmost())); header()->right()=rightmost_cpy->impl(); typedef typename copy_map_type::const_iterator copy_map_iterator; for(copy_map_iterator it=map.begin(),it_end=map.end();it!=it_end;++it){ node_type* org=it->first; node_type* cpy=it->second; cpy->color()=org->color(); AugmentPolicy::copy(org->impl(),cpy->impl()); node_impl_pointer parent_org=org->parent(); if(parent_org==node_impl_pointer(0))cpy->parent()=node_impl_pointer(0); else{ node_type* parent_cpy=map.find( static_cast<final_node_type*>(node_type::from_impl(parent_org))); cpy->parent()=parent_cpy->impl(); if(parent_org->left()==org->impl()){ parent_cpy->left()=cpy->impl(); } else if(parent_org->right()==org->impl()){ /* header() does not satisfy this nor the previous check */ parent_cpy->right()=cpy->impl(); } } if(org->left()==node_impl_pointer(0)) cpy->left()=node_impl_pointer(0); if(org->right()==node_impl_pointer(0)) cpy->right()=node_impl_pointer(0); } } super::copy_(x,map); } template<typename Variant> final_node_type* insert_( value_param_type v,final_node_type*& x,Variant variant) { link_info inf; if(!link_point(key(v),inf,Category())){ return static_cast<final_node_type*>(node_type::from_impl(inf.pos)); } final_node_type* res=super::insert_(v,x,variant); if(res==x){ node_impl_type::link( static_cast<node_type*>(x)->impl(),inf.side,inf.pos,header()->impl()); } return res; } template<typename Variant> final_node_type* insert_( value_param_type v,node_type* position,final_node_type*& x,Variant variant) { link_info inf; if(!hinted_link_point(key(v),position,inf,Category())){ return static_cast<final_node_type*>(node_type::from_impl(inf.pos)); } final_node_type* res=super::insert_(v,position,x,variant); if(res==x){ node_impl_type::link( static_cast<node_type*>(x)->impl(),inf.side,inf.pos,header()->impl()); } return res; } void erase_(node_type* x) { node_impl_type::rebalance_for_erase( x->impl(),header()->parent(),header()->left(),header()->right()); super::erase_(x); #if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) detach_iterators(x); #endif } void delete_all_nodes_() { delete_all_nodes(root()); } void clear_() { super::clear_(); empty_initialize(); #if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) safe_super::detach_dereferenceable_iterators(); #endif } void swap_( ordered_index_impl< KeyFromValue,Compare,SuperMeta,TagList,Category,AugmentPolicy>& x) { std::swap(key,x.key); std::swap(comp_,x.comp_); #if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) safe_super::swap(x); #endif super::swap_(x); } void swap_elements_( ordered_index_impl< KeyFromValue,Compare,SuperMeta,TagList,Category,AugmentPolicy>& x) { #if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) safe_super::swap(x); #endif super::swap_elements_(x); } template<typename Variant> bool replace_(value_param_type v,node_type* x,Variant variant) { if(in_place(v,x,Category())){ return super::replace_(v,x,variant); } node_type* next=x; node_type::increment(next); node_impl_type::rebalance_for_erase( x->impl(),header()->parent(),header()->left(),header()->right()); BOOST_TRY{ link_info inf; if(link_point(key(v),inf,Category())&&super::replace_(v,x,variant)){ node_impl_type::link(x->impl(),inf.side,inf.pos,header()->impl()); return true; } node_impl_type::restore(x->impl(),next->impl(),header()->impl()); return false; } BOOST_CATCH(...){ node_impl_type::restore(x->impl(),next->impl(),header()->impl()); BOOST_RETHROW; } BOOST_CATCH_END } bool modify_(node_type* x) { bool b; BOOST_TRY{ b=in_place(x->value(),x,Category()); } BOOST_CATCH(...){ erase_(x); BOOST_RETHROW; } BOOST_CATCH_END if(!b){ node_impl_type::rebalance_for_erase( x->impl(),header()->parent(),header()->left(),header()->right()); BOOST_TRY{ link_info inf; if(!link_point(key(x->value()),inf,Category())){ super::erase_(x); #if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) detach_iterators(x); #endif return false; } node_impl_type::link(x->impl(),inf.side,inf.pos,header()->impl()); } BOOST_CATCH(...){ super::erase_(x); #if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) detach_iterators(x); #endif BOOST_RETHROW; } BOOST_CATCH_END } BOOST_TRY{ if(!super::modify_(x)){ node_impl_type::rebalance_for_erase( x->impl(),header()->parent(),header()->left(),header()->right()); #if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) detach_iterators(x); #endif return false; } else return true; } BOOST_CATCH(...){ node_impl_type::rebalance_for_erase( x->impl(),header()->parent(),header()->left(),header()->right()); #if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) detach_iterators(x); #endif BOOST_RETHROW; } BOOST_CATCH_END } bool modify_rollback_(node_type* x) { if(in_place(x->value(),x,Category())){ return super::modify_rollback_(x); } node_type* next=x; node_type::increment(next); node_impl_type::rebalance_for_erase( x->impl(),header()->parent(),header()->left(),header()->right()); BOOST_TRY{ link_info inf; if(link_point(key(x->value()),inf,Category())&& super::modify_rollback_(x)){ node_impl_type::link(x->impl(),inf.side,inf.pos,header()->impl()); return true; } node_impl_type::restore(x->impl(),next->impl(),header()->impl()); return false; } BOOST_CATCH(...){ node_impl_type::restore(x->impl(),next->impl(),header()->impl()); BOOST_RETHROW; } BOOST_CATCH_END } #if !defined(BOOST_MULTI_INDEX_DISABLE_SERIALIZATION) /* serialization */ template<typename Archive> void save_( Archive& ar,const unsigned int version,const index_saver_type& sm)const { save_(ar,version,sm,Category()); } template<typename Archive> void load_(Archive& ar,const unsigned int version,const index_loader_type& lm) { load_(ar,version,lm,Category()); } #endif #if defined(BOOST_MULTI_INDEX_ENABLE_INVARIANT_CHECKING) /* invariant stuff */ bool invariant_()const { if(size()==0||begin()==end()){ if(size()!=0||begin()!=end()|| header()->left()!=header()->impl()|| header()->right()!=header()->impl())return false; } else{ if((size_type)std::distance(begin(),end())!=size())return false; std::size_t len=node_impl_type::black_count( leftmost()->impl(),root()->impl()); for(const_iterator it=begin(),it_end=end();it!=it_end;++it){ node_type* x=it.get_node(); node_type* left_x=node_type::from_impl(x->left()); node_type* right_x=node_type::from_impl(x->right()); if(x->color()==red){ if((left_x&&left_x->color()==red)|| (right_x&&right_x->color()==red))return false; } if(left_x&&comp_(key(x->value()),key(left_x->value())))return false; if(right_x&&comp_(key(right_x->value()),key(x->value())))return false; if(!left_x&&!right_x&& node_impl_type::black_count(x->impl(),root()->impl())!=len) return false; if(!AugmentPolicy::invariant(x->impl()))return false; } if(leftmost()->impl()!=node_impl_type::minimum(root()->impl())) return false; if(rightmost()->impl()!=node_impl_type::maximum(root()->impl())) return false; } return super::invariant_(); } /* This forwarding function eases things for the boost::mem_fn construct * in BOOST_MULTI_INDEX_ORD_INDEX_CHECK_INVARIANT. Actually, * final_check_invariant is already an inherited member function of * ordered_index_impl. */ void check_invariant_()const{this->final_check_invariant_();} #endif protected: /* for the benefit of AugmentPolicy::augmented_interface */ node_type* header()const{return this->final_header();} node_type* root()const{return node_type::from_impl(header()->parent());} node_type* leftmost()const{return node_type::from_impl(header()->left());} node_type* rightmost()const{return node_type::from_impl(header()->right());} private: void empty_initialize() { header()->color()=red; /* used to distinguish header() from root, in iterator.operator++ */ header()->parent()=node_impl_pointer(0); header()->left()=header()->impl(); header()->right()=header()->impl(); } struct link_info { /* coverity[uninit_ctor]: suppress warning */ link_info():side(to_left){} ordered_index_side side; node_impl_pointer pos; }; bool link_point(key_param_type k,link_info& inf,ordered_unique_tag) { node_type* y=header(); node_type* x=root(); bool c=true; while(x){ y=x; c=comp_(k,key(x->value())); x=node_type::from_impl(c?x->left():x->right()); } node_type* yy=y; if(c){ if(yy==leftmost()){ inf.side=to_left; inf.pos=y->impl(); return true; } else node_type::decrement(yy); } if(comp_(key(yy->value()),k)){ inf.side=c?to_left:to_right; inf.pos=y->impl(); return true; } else{ inf.pos=yy->impl(); return false; } } bool link_point(key_param_type k,link_info& inf,ordered_non_unique_tag) { node_type* y=header(); node_type* x=root(); bool c=true; while (x){ y=x; c=comp_(k,key(x->value())); x=node_type::from_impl(c?x->left():x->right()); } inf.side=c?to_left:to_right; inf.pos=y->impl(); return true; } bool lower_link_point(key_param_type k,link_info& inf,ordered_non_unique_tag) { node_type* y=header(); node_type* x=root(); bool c=false; while (x){ y=x; c=comp_(key(x->value()),k); x=node_type::from_impl(c?x->right():x->left()); } inf.side=c?to_right:to_left; inf.pos=y->impl(); return true; } bool hinted_link_point( key_param_type k,node_type* position,link_info& inf,ordered_unique_tag) { if(position->impl()==header()->left()){ if(size()>0&&comp_(k,key(position->value()))){ inf.side=to_left; inf.pos=position->impl(); return true; } else return link_point(k,inf,ordered_unique_tag()); } else if(position==header()){ if(comp_(key(rightmost()->value()),k)){ inf.side=to_right; inf.pos=rightmost()->impl(); return true; } else return link_point(k,inf,ordered_unique_tag()); } else{ node_type* before=position; node_type::decrement(before); if(comp_(key(before->value()),k)&&comp_(k,key(position->value()))){ if(before->right()==node_impl_pointer(0)){ inf.side=to_right; inf.pos=before->impl(); return true; } else{ inf.side=to_left; inf.pos=position->impl(); return true; } } else return link_point(k,inf,ordered_unique_tag()); } } bool hinted_link_point( key_param_type k,node_type* position,link_info& inf,ordered_non_unique_tag) { if(position->impl()==header()->left()){ if(size()>0&&!comp_(key(position->value()),k)){ inf.side=to_left; inf.pos=position->impl(); return true; } else return lower_link_point(k,inf,ordered_non_unique_tag()); } else if(position==header()){ if(!comp_(k,key(rightmost()->value()))){ inf.side=to_right; inf.pos=rightmost()->impl(); return true; } else return link_point(k,inf,ordered_non_unique_tag()); } else{ node_type* before=position; node_type::decrement(before); if(!comp_(k,key(before->value()))){ if(!comp_(key(position->value()),k)){ if(before->right()==node_impl_pointer(0)){ inf.side=to_right; inf.pos=before->impl(); return true; } else{ inf.side=to_left; inf.pos=position->impl(); return true; } } else return lower_link_point(k,inf,ordered_non_unique_tag()); } else return link_point(k,inf,ordered_non_unique_tag()); } } void delete_all_nodes(node_type* x) { if(!x)return; delete_all_nodes(node_type::from_impl(x->left())); delete_all_nodes(node_type::from_impl(x->right())); this->final_delete_node_(static_cast<final_node_type*>(x)); } bool in_place(value_param_type v,node_type* x,ordered_unique_tag) { node_type* y; if(x!=leftmost()){ y=x; node_type::decrement(y); if(!comp_(key(y->value()),key(v)))return false; } y=x; node_type::increment(y); return y==header()||comp_(key(v),key(y->value())); } bool in_place(value_param_type v,node_type* x,ordered_non_unique_tag) { node_type* y; if(x!=leftmost()){ y=x; node_type::decrement(y); if(comp_(key(v),key(y->value())))return false; } y=x; node_type::increment(y); return y==header()||!comp_(key(y->value()),key(v)); } #if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) void detach_iterators(node_type* x) { iterator it=make_iterator(x); safe_mode::detach_equivalent_iterators(it); } #endif template<BOOST_MULTI_INDEX_TEMPLATE_PARAM_PACK> std::pair<iterator,bool> emplace_impl(BOOST_MULTI_INDEX_FUNCTION_PARAM_PACK) { BOOST_MULTI_INDEX_ORD_INDEX_CHECK_INVARIANT; std::pair<final_node_type*,bool>p= this->final_emplace_(BOOST_MULTI_INDEX_FORWARD_PARAM_PACK); return std::pair<iterator,bool>(make_iterator(p.first),p.second); } template<BOOST_MULTI_INDEX_TEMPLATE_PARAM_PACK> iterator emplace_hint_impl( iterator position,BOOST_MULTI_INDEX_FUNCTION_PARAM_PACK) { BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position); BOOST_MULTI_INDEX_CHECK_IS_OWNER(position,*this); BOOST_MULTI_INDEX_ORD_INDEX_CHECK_INVARIANT; std::pair<final_node_type*,bool>p= this->final_emplace_hint_( static_cast<final_node_type*>(position.get_node()), BOOST_MULTI_INDEX_FORWARD_PARAM_PACK); return make_iterator(p.first); } template<typename LowerBounder,typename UpperBounder> std::pair<iterator,iterator> range(LowerBounder lower,UpperBounder upper,none_unbounded_tag)const { node_type* y=header(); node_type* z=root(); while(z){ if(!lower(key(z->value()))){ z=node_type::from_impl(z->right()); } else if(!upper(key(z->value()))){ y=z; z=node_type::from_impl(z->left()); } else{ return std::pair<iterator,iterator>( make_iterator( lower_range(node_type::from_impl(z->left()),z,lower)), make_iterator( upper_range(node_type::from_impl(z->right()),y,upper))); } } return std::pair<iterator,iterator>(make_iterator(y),make_iterator(y)); } template<typename LowerBounder,typename UpperBounder> std::pair<iterator,iterator> range(LowerBounder,UpperBounder upper,lower_unbounded_tag)const { return std::pair<iterator,iterator>( begin(), make_iterator(upper_range(root(),header(),upper))); } template<typename LowerBounder,typename UpperBounder> std::pair<iterator,iterator> range(LowerBounder lower,UpperBounder,upper_unbounded_tag)const { return std::pair<iterator,iterator>( make_iterator(lower_range(root(),header(),lower)), end()); } template<typename LowerBounder,typename UpperBounder> std::pair<iterator,iterator> range(LowerBounder,UpperBounder,both_unbounded_tag)const { return std::pair<iterator,iterator>(begin(),end()); } template<typename LowerBounder> node_type * lower_range(node_type* top,node_type* y,LowerBounder lower)const { while(top){ if(lower(key(top->value()))){ y=top; top=node_type::from_impl(top->left()); } else top=node_type::from_impl(top->right()); } return y; } template<typename UpperBounder> node_type * upper_range(node_type* top,node_type* y,UpperBounder upper)const { while(top){ if(!upper(key(top->value()))){ y=top; top=node_type::from_impl(top->left()); } else top=node_type::from_impl(top->right()); } return y; } #if !defined(BOOST_MULTI_INDEX_DISABLE_SERIALIZATION) template<typename Archive> void save_( Archive& ar,const unsigned int version,const index_saver_type& sm, ordered_unique_tag)const { super::save_(ar,version,sm); } template<typename Archive> void load_( Archive& ar,const unsigned int version,const index_loader_type& lm, ordered_unique_tag) { super::load_(ar,version,lm); } template<typename Archive> void save_( Archive& ar,const unsigned int version,const index_saver_type& sm, ordered_non_unique_tag)const { typedef duplicates_iterator<node_type,value_compare> dup_iterator; sm.save( dup_iterator(begin().get_node(),end().get_node(),value_comp()), dup_iterator(end().get_node(),value_comp()), ar,version); super::save_(ar,version,sm); } template<typename Archive> void load_( Archive& ar,const unsigned int version,const index_loader_type& lm, ordered_non_unique_tag) { lm.load( ::boost::bind( &ordered_index_impl::rearranger,this, ::boost::arg<1>(),::boost::arg<2>()), ar,version); super::load_(ar,version,lm); } void rearranger(node_type* position,node_type *x) { if(!position||comp_(key(position->value()),key(x->value()))){ position=lower_bound(key(x->value())).get_node(); } else if(comp_(key(x->value()),key(position->value()))){ /* inconsistent rearrangement */ throw_exception( archive::archive_exception( archive::archive_exception::other_exception)); } else node_type::increment(position); if(position!=x){ node_impl_type::rebalance_for_erase( x->impl(),header()->parent(),header()->left(),header()->right()); node_impl_type::restore( x->impl(),position->impl(),header()->impl()); } } #endif /* serialization */ protected: /* for the benefit of AugmentPolicy::augmented_interface */ key_from_value key; key_compare comp_; #if defined(BOOST_MULTI_INDEX_ENABLE_INVARIANT_CHECKING)&&\ BOOST_WORKAROUND(__MWERKS__,<=0x3003) #pragma parse_mfunc_templ reset #endif }; template< typename KeyFromValue,typename Compare, typename SuperMeta,typename TagList,typename Category,typename AugmentPolicy > class ordered_index: public AugmentPolicy::template augmented_interface< ordered_index_impl< KeyFromValue,Compare,SuperMeta,TagList,Category,AugmentPolicy > >::type { typedef typename AugmentPolicy::template augmented_interface< ordered_index_impl< KeyFromValue,Compare, SuperMeta,TagList,Category,AugmentPolicy > >::type super; public: typedef typename super::ctor_args_list ctor_args_list; typedef typename super::allocator_type allocator_type; typedef typename super::iterator iterator; /* construct/copy/destroy * Default and copy ctors are in the protected section as indices are * not supposed to be created on their own. No range ctor either. */ ordered_index& operator=(const ordered_index& x) { this->final()=x.final(); return *this; } #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) ordered_index& operator=( std::initializer_list<BOOST_DEDUCED_TYPENAME super::value_type> list) { this->final()=list; return *this; } #endif protected: ordered_index( const ctor_args_list& args_list,const allocator_type& al): super(args_list,al){} ordered_index(const ordered_index& x):super(x){}; ordered_index(const ordered_index& x,do_not_copy_elements_tag): super(x,do_not_copy_elements_tag()){}; }; /* comparison */ template< typename KeyFromValue1,typename Compare1, typename SuperMeta1,typename TagList1,typename Category1, typename AugmentPolicy1, typename KeyFromValue2,typename Compare2, typename SuperMeta2,typename TagList2,typename Category2, typename AugmentPolicy2 > bool operator==( const ordered_index< KeyFromValue1,Compare1,SuperMeta1,TagList1,Category1,AugmentPolicy1>& x, const ordered_index< KeyFromValue2,Compare2,SuperMeta2,TagList2,Category2,AugmentPolicy2>& y) { return x.size()==y.size()&&std::equal(x.begin(),x.end(),y.begin()); } template< typename KeyFromValue1,typename Compare1, typename SuperMeta1,typename TagList1,typename Category1, typename AugmentPolicy1, typename KeyFromValue2,typename Compare2, typename SuperMeta2,typename TagList2,typename Category2, typename AugmentPolicy2 > bool operator<( const ordered_index< KeyFromValue1,Compare1,SuperMeta1,TagList1,Category1,AugmentPolicy1>& x, const ordered_index< KeyFromValue2,Compare2,SuperMeta2,TagList2,Category2,AugmentPolicy2>& y) { return std::lexicographical_compare(x.begin(),x.end(),y.begin(),y.end()); } template< typename KeyFromValue1,typename Compare1, typename SuperMeta1,typename TagList1,typename Category1, typename AugmentPolicy1, typename KeyFromValue2,typename Compare2, typename SuperMeta2,typename TagList2,typename Category2, typename AugmentPolicy2 > bool operator!=( const ordered_index< KeyFromValue1,Compare1,SuperMeta1,TagList1,Category1,AugmentPolicy1>& x, const ordered_index< KeyFromValue2,Compare2,SuperMeta2,TagList2,Category2,AugmentPolicy2>& y) { return !(x==y); } template< typename KeyFromValue1,typename Compare1, typename SuperMeta1,typename TagList1,typename Category1, typename AugmentPolicy1, typename KeyFromValue2,typename Compare2, typename SuperMeta2,typename TagList2,typename Category2, typename AugmentPolicy2 > bool operator>( const ordered_index< KeyFromValue1,Compare1,SuperMeta1,TagList1,Category1,AugmentPolicy1>& x, const ordered_index< KeyFromValue2,Compare2,SuperMeta2,TagList2,Category2,AugmentPolicy2>& y) { return y<x; } template< typename KeyFromValue1,typename Compare1, typename SuperMeta1,typename TagList1,typename Category1, typename AugmentPolicy1, typename KeyFromValue2,typename Compare2, typename SuperMeta2,typename TagList2,typename Category2, typename AugmentPolicy2 > bool operator>=( const ordered_index< KeyFromValue1,Compare1,SuperMeta1,TagList1,Category1,AugmentPolicy1>& x, const ordered_index< KeyFromValue2,Compare2,SuperMeta2,TagList2,Category2,AugmentPolicy2>& y) { return !(x<y); } template< typename KeyFromValue1,typename Compare1, typename SuperMeta1,typename TagList1,typename Category1, typename AugmentPolicy1, typename KeyFromValue2,typename Compare2, typename SuperMeta2,typename TagList2,typename Category2, typename AugmentPolicy2 > bool operator<=( const ordered_index< KeyFromValue1,Compare1,SuperMeta1,TagList1,Category1,AugmentPolicy1>& x, const ordered_index< KeyFromValue2,Compare2,SuperMeta2,TagList2,Category2,AugmentPolicy2>& y) { return !(x>y); } /* specialized algorithms */ template< typename KeyFromValue,typename Compare, typename SuperMeta,typename TagList,typename Category,typename AugmentPolicy > void swap( ordered_index< KeyFromValue,Compare,SuperMeta,TagList,Category,AugmentPolicy>& x, ordered_index< KeyFromValue,Compare,SuperMeta,TagList,Category,AugmentPolicy>& y) { x.swap(y); } } /* namespace multi_index::detail */ } /* namespace multi_index */ } /* namespace boost */ /* Boost.Foreach compatibility */ template< typename KeyFromValue,typename Compare, typename SuperMeta,typename TagList,typename Category,typename AugmentPolicy > inline boost::mpl::true_* boost_foreach_is_noncopyable( boost::multi_index::detail::ordered_index< KeyFromValue,Compare,SuperMeta,TagList,Category,AugmentPolicy>*&, boost::foreach::tag) { return 0; } #undef BOOST_MULTI_INDEX_ORD_INDEX_CHECK_INVARIANT #undef BOOST_MULTI_INDEX_ORD_INDEX_CHECK_INVARIANT_OF #endif
SECTION "GBS", ROM0[0] INCBIN "bin/tmp.bin", 0, $70 INCBIN "bin/tmp.bin", $470
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Copyright (c) GeoWorks 1990 -- All Rights Reserved PROJECT: PC GEOS MODULE: Video Driver FILE: simp4bitAdmin.asm AUTHOR: Jim DeFrisco ROUTINES: Name Description ---- ----------- VidScreenOff turn off video VidScreenOn turn on video VidTestSimp4Bit look for device VidSetSimp4Bit set proper video mode REVISION HISTORY: Name Date Description ---- ---- ----------- Jim 7/90 Initial Version DESCRIPTION: a few bookeeping routines for the driver $Id: simp4bitAdmin.asm,v 1.1 97/04/18 11:43:46 newdeal Exp $ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ VideoMisc segment resource COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% VidScreenOff %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Disable video output, for a screen saver CALLED BY: GLOBAL PASS: nothing RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: Disable the video output KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- Jim 12/89 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ VidScreenOff proc far .enter .leave ret VidScreenOff endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% VidScreenOn %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Enable video output, for a screen saver CALLED BY: GLOBAL PASS: nothing RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: Disable the video output KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- Jim 12/89 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ VidScreenOn proc far .enter .leave ret VidScreenOn endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% VidTestSimp4Bit %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Test for the existance of a device CALLED BY: GLOBAL VidTestDevice PASS: nothing RETURN: ax - DevicePresent enum DESTROYED: nothing PSEUDO CODE/STRATEGY: check for the device KNOWN BUGS/SIDE EFFECTS/IDEAS: There is no non-device-specific way to check for this device REVISION HISTORY: Name Date Description ---- ---- ----------- Jim 08/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ VidTestSimp4Bit proc near mov ax, DP_CANT_TELL ; fake it for now ret VidTestSimp4Bit endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% VidSetSimp4Bit %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Set the video controller into 4 bit/pixel mode CALLED BY: INTERNAL VidSetDevice PASS: nothing RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: set the video mode KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- Jim 03/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ if not NT_DRIVER VidSetSimp4Bit proc near if _BOR1 push ds, si, ax, dx, bx ; ; Set appropriate registers as listed in the table below. ; segmov ds, cs, ax mov si, offset vidSetRegisters tableLoop: lodsb mov bl, al ; DisplayControlRegisterType in bl lodsw mov_tr dx, ax lodsw ; dx = reg, ax = value test bl, mask DCRT_INDIRECT jnz handleIndirectTable test bl, mask DCRT_WORD jnz doWord out dx, al jmp nextLoop doWord: out dx, ax jmp nextLoop handleIndirectTable: push ax mov ax, E3G_DCADDR xchg ax, dx ; dx = E3G_DCADDR, al = register # out dx, al ; write out register to DCADDR inc dx pop ax ; dx = E3G_DCDATA, al = value out dx, al ; write out value to register, indirect nextLoop: test bl, mask DCRT_END_OF_TABLE jz tableLoop pop ds, si, ax, dx, bx endif ; _PENELOPE or _BOR1 ret VidSetSimp4Bit endp if _BOR1 vidSetRegisters DisplayControlRegister \ <mask DCRT_WORD, E3G_DCPATR5, 04411h>, ; col 1 = light gray <mask DCRT_WORD, E3G_DCPATR11, 02842h>, <mask DCRT_WORD, E3G_DCPATR4, 05555h>, ; col 2 = dark gray <mask DCRT_WORD, E3G_DCPATR10, 0aaaah>, <mask DCRT_WORD, E3G_DCPATR3, 00000h>, ; col 3 = white <mask DCRT_WORD, E3G_DCPATR9, 00000h>, <mask DCRT_WORD, E3G_DCPATR2, 0ffffh>, ; col 4 = black <mask DCRT_WORD, E3G_DCPATR8, 0ffffh>, <mask DCRT_WORD, E3G_DCPATR1, 04411h>, ; col 5 = light gray <mask DCRT_WORD, E3G_DCPATR7, 02842h>, <mask DCRT_WORD, E3G_DCPATR0, 05555h>, ; col 6 = dark gray <mask DCRT_WORD or mask DCRT_END_OF_TABLE, E3G_DCPATR6, 0aaaah> endif ; _PENELOPE or _BOR1 endif ; !NT_DRIVER if NT_DRIVER idata segment vddHandle word 0 ; used by NT driver idata ends DllName DB "GEOSVDD.DLL",0 InitFunc DB "VDDRegisterInit",0 DispFunc DB "VDDDispatch",0 yScreenSizeStr char "yScreenSize", 0 screenSizeCategoryStr char "ui", 0 VidSetSimp4Bit proc near push ds, es push ax, si, di, bx, dx ; ; Find out how big they want the screen to be by checking the .ini file ; segmov ds, cs, cx mov si, offset screenSizeCategoryStr mov dx, offset yScreenSizeStr ; call InitFileReadInteger ; jnc afterY ; mov ax, 480 ; default to height of 480 mov ax, 200 afterY: push ax ; screen height mov ax, cs mov ds, ax mov es, ax ; ; Register the dll ; ; Load ioctlvdd.dll mov si, offset DllName ; ds:si = dll name mov di, offset InitFunc ; es:di = init routine mov bx, offset DispFunc ; ds:bx = dispatch routine RegisterModule mov si, dgroup mov ds, si mov ds:[vddHandle], ax pop cx ; screen size mov bx, 108 ; VDD_CREATE_WINDOW ; create window DispatchCall mov bx, 113 ; VDD_FUNC_SET_BPP mov cx, 4 ; 4 bits per pixel DispatchCall ; ; Create a buffer for scan lines ; if 0 mov ax, 4000 mov cl, mask HF_FIXED mov ch, mask HAF_ZERO_INIT call MemAlloc mov ds:[bufferSeg],ax endif ; ; Clear video memory ; mov cx, SCREEN_BYTE_WIDTH * SCREEN_HEIGHT / 2 mov ax, 0xA000 mov es, ax clr ax, di rep stosw pop ax, si, di, bx, dx pop ds, es ret VidSetSimp4Bit endp endif ; WINNT VideoMisc ends
////////////////////////////////////////////////////////////////////////// // // Copyright (c) 2012, John Haddon. All rights reserved. // Copyright (c) 2013-2015, Image Engine Design Inc. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // * Redistributions 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. // // * Neither the name of Image Engine Design nor the names of any // other contributors to this software may 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 COPYRIGHT OWNER 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. // ////////////////////////////////////////////////////////////////////////// #include "boost/python.hpp" #include "CoreBinding.h" #include "GafferImage/AtomicFormatPlug.h" #include "GafferImage/FormatData.h" #include "GafferImage/FormatPlug.h" #include "GafferImage/ImageNode.h" #include "GafferImage/ImagePlug.h" #include "GafferImage/ImageProcessor.h" #include "GafferImage/Sampler.h" #include "GafferImage/FlatImageSource.h" #include "GafferBindings/ComputeNodeBinding.h" #include "GafferBindings/Serialisation.h" #include "GafferBindings/TypedPlugBinding.h" #include "GafferBindings/ValuePlugBinding.h" #include "Gaffer/ScriptNode.h" #include "IECorePython/SimpleTypedDataBinding.h" using namespace boost::python; using namespace Gaffer; using namespace GafferImage; using namespace GafferBindings; namespace { IECore::FloatVectorDataPtr channelData( const ImagePlug &plug, const std::string &channelName, const Imath::V2i &tile, bool copy ) { IECorePython::ScopedGILRelease gilRelease; IECore::ConstFloatVectorDataPtr d = plug.channelData( channelName, tile ); return copy ? d->copy() : boost::const_pointer_cast<IECore::FloatVectorData>( d ); } IECore::MurmurHash channelDataHash( const ImagePlug &plug, const std::string &channelName, const Imath::V2i &tileOrigin ) { IECorePython::ScopedGILRelease gilRelease; return plug.channelDataHash( channelName, tileOrigin ); } GafferImage::Format format( const ImagePlug &plug ) { IECorePython::ScopedGILRelease gilRelease; return plug.format(); } IECore::MurmurHash formatHash( const ImagePlug &plug ) { IECorePython::ScopedGILRelease gilRelease; return plug.formatHash(); } Imath::Box2i dataWindow( const ImagePlug &plug ) { IECorePython::ScopedGILRelease gilRelease; return plug.dataWindow(); } IECore::MurmurHash dataWindowHash( const ImagePlug &plug ) { IECorePython::ScopedGILRelease gilRelease; return plug.dataWindowHash(); } IECore::StringVectorDataPtr channelNames( const ImagePlug &plug, bool copy ) { IECorePython::ScopedGILRelease gilRelease; IECore::ConstStringVectorDataPtr d = plug.channelNames(); return copy ? d->copy() : boost::const_pointer_cast<IECore::StringVectorData>( d ); } IECore::MurmurHash channelNamesHash( const ImagePlug &plug ) { IECorePython::ScopedGILRelease gilRelease; return plug.channelNamesHash(); } IECore::CompoundDataPtr metadata( const ImagePlug &plug, bool copy ) { IECorePython::ScopedGILRelease gilRelease; IECore::ConstCompoundDataPtr d = plug.metadata(); return copy ? d->copy() : boost::const_pointer_cast<IECore::CompoundData>( d ); } IECore::MurmurHash metadataHash( const ImagePlug &plug ) { IECorePython::ScopedGILRelease gilRelease; return plug.metadataHash(); } bool deep( const ImagePlug &plug ) { IECorePython::ScopedGILRelease gilRelease; return plug.deep(); } IECore::MurmurHash deepHash( const ImagePlug &plug ) { IECorePython::ScopedGILRelease gilRelease; return plug.deepHash(); } IECore::IntVectorDataPtr sampleOffsets( const ImagePlug &plug, const Imath::V2i &tile, bool copy ) { IECorePython::ScopedGILRelease gilRelease; IECore::ConstIntVectorDataPtr d = plug.sampleOffsets( tile ); return copy ? d->copy() : boost::const_pointer_cast<IECore::IntVectorData>( d ); } IECore::MurmurHash sampleOffsetsHash( const ImagePlug &plug, const Imath::V2i &tile ) { IECorePython::ScopedGILRelease gilRelease; return plug.sampleOffsetsHash( tile ); } IECore::IntVectorDataPtr emptyTileSampleOffsets( bool copy ) { IECore::ConstIntVectorDataPtr d = ImagePlug::emptyTileSampleOffsets(); return copy ? d->copy() : boost::const_pointer_cast<IECore::IntVectorData>( d ); } IECore::IntVectorDataPtr flatTileSampleOffsets( bool copy ) { IECore::ConstIntVectorDataPtr d = ImagePlug::flatTileSampleOffsets(); return copy ? d->copy() : boost::const_pointer_cast<IECore::IntVectorData>( d ); } IECore::FloatVectorDataPtr emptyTile( bool copy ) { IECore::ConstFloatVectorDataPtr d = ImagePlug::emptyTile(); return copy ? d->copy() : boost::const_pointer_cast<IECore::FloatVectorData>( d ); } IECore::FloatVectorDataPtr blackTile( bool copy ) { IECore::ConstFloatVectorDataPtr d = ImagePlug::blackTile(); return copy ? d->copy() : boost::const_pointer_cast<IECore::FloatVectorData>( d ); } IECore::FloatVectorDataPtr whiteTile( bool copy ) { IECore::ConstFloatVectorDataPtr d = ImagePlug::whiteTile(); return copy ? d->copy() : boost::const_pointer_cast<IECore::FloatVectorData>( d ); } boost::python::list registeredFormats() { std::vector<std::string> names; Format::registeredFormats( names ); boost::python::list result; for( std::vector<std::string>::const_iterator it = names.begin(), eIt = names.end(); it != eIt; ++it ) { result.append( *it ); } return result; } std::string formatRepr( const GafferImage::Format &format ) { if ( format.getDisplayWindow().isEmpty() ) { return std::string( "GafferImage.Format()" ); } else if ( format.getDisplayWindow().min == Imath::V2i( 0 ) ) { Imath::Box2i box( format.getDisplayWindow() ); return std::string( boost::str( boost::format( "GafferImage.Format( %d, %d, %.3f )" ) % box.max.x % box.max.y % format.getPixelAspect() ) ); } else { Imath::Box2i box( format.getDisplayWindow() ); return std::string( boost::str( boost::format( "GafferImage.Format( imath.Box2i( imath.V2i( %d, %d ), imath.V2i( %d, %d ) ), %.3f )" ) % box.min.x % box.min.y % box.max.x % box.max.y % format.getPixelAspect() ) ); } } class AtomicFormatPlugSerialiser : public GafferBindings::ValuePlugSerialiser { public : void moduleDependencies( const Gaffer::GraphComponent *graphComponent, std::set<std::string> &modules, const Serialisation &serialisation ) const override { // Imath is needed when reloading Format values which reference Box2i. ValuePlugSerialiser::moduleDependencies( graphComponent, modules, serialisation ); modules.insert( "imath" ); } }; void setValue( FormatPlug *plug, const Format &value ) { // we use a GIL release here to prevent a lock in the case where this triggers a graph // evaluation which decides to go back into python on another thread: IECorePython::ScopedGILRelease r; plug->setValue( value ); } Format getValue( const FormatPlug *plug ) { // Must release GIL in case computation spawns threads which need // to reenter Python. IECorePython::ScopedGILRelease r; return plug->getValue(); } class FormatPlugSerialiser : public GafferBindings::ValuePlugSerialiser { public : void moduleDependencies( const Gaffer::GraphComponent *graphComponent, std::set<std::string> &modules, const Serialisation &serialisation ) const override { // Imath is needed when reloading Format values which reference Box2i. ValuePlugSerialiser::moduleDependencies( graphComponent, modules, serialisation ); modules.insert( "imath" ); } }; } // namespace void GafferImageModule::bindCore() { PlugClass<ImagePlug>() .def( init< const std::string &, Gaffer::Plug::Direction, unsigned > ( ( arg( "name" ) = Gaffer::GraphComponent::defaultName<ImagePlug>(), arg( "direction" ) = Gaffer::Plug::In, arg( "flags" ) = Gaffer::Plug::Default ) ) ) .def( "channelData", &channelData, ( arg( "_copy" ) = true ) ) .def( "channelDataHash", &channelDataHash ) .def( "format", &format ) .def( "formatHash", &formatHash ) .def( "dataWindow", &dataWindow ) .def( "dataWindowHash", &dataWindowHash ) .def( "channelNames", &channelNames, ( arg( "_copy" ) = true ) ) .def( "channelNamesHash", &channelNamesHash ) .def( "metadata", &metadata, ( arg( "_copy" ) = true ) ) .def( "metadataHash", &metadataHash ) .def( "deep", &deep ) .def( "deepHash", &deepHash ) .def( "sampleOffsets", &sampleOffsets, ( arg( "_copy" ) = true ) ) .def( "sampleOffsetsHash", &sampleOffsetsHash ) .def( "tileSize", &ImagePlug::tileSize ).staticmethod( "tileSize" ) .def( "tilePixels", &ImagePlug::tilePixels ).staticmethod( "tilePixels" ) .def( "tileIndex", &ImagePlug::tileIndex ).staticmethod( "tileIndex" ) .def( "tileOrigin", &ImagePlug::tileOrigin ).staticmethod( "tileOrigin" ) .def( "pixelIndex", &ImagePlug::pixelIndex ).staticmethod( "pixelIndex" ) .def( "emptyTileSampleOffsets", &emptyTileSampleOffsets, ( arg( "_copy" ) = true ) ).staticmethod( "emptyTileSampleOffsets" ) .def( "flatTileSampleOffsets", &flatTileSampleOffsets, ( arg( "_copy" ) = true ) ).staticmethod( "flatTileSampleOffsets" ) .def( "emptyTile", &emptyTile, ( arg( "_copy" ) = true ) ).staticmethod( "emptyTile" ) .def( "blackTile", &blackTile, ( arg( "_copy" ) = true ) ).staticmethod( "blackTile" ) .def( "whiteTile", &whiteTile, ( arg( "_copy" ) = true ) ).staticmethod( "whiteTile" ) ; typedef ComputeNodeWrapper<ImageNode> ImageNodeWrapper; GafferBindings::DependencyNodeClass<ImageNode, ImageNodeWrapper>(); typedef ComputeNodeWrapper<FlatImageSource> FlatImageSourceWrapper; GafferBindings::DependencyNodeClass<FlatImageSource, FlatImageSourceWrapper>(); class_<Format>( "Format" ) .def( init<int, int, double>( ( boost::python::arg( "width" ), boost::python::arg( "height" ), boost::python::arg( "pixelAspect" ) = 1.0f ) ) ) .def( init<const Imath::Box2i &, double, bool>( ( boost::python::arg( "displayWindow" ), boost::python::arg( "pixelAspect" ) = 1.0f, boost::python::arg( "fromEXRSpace" ) = false ) ) ) .def( "width", &Format::width ) .def( "height", &Format::height ) .def( "getPixelAspect", &Format::getPixelAspect ) .def( "setPixelAspect", &Format::setPixelAspect ) .def( "getDisplayWindow", &Format::getDisplayWindow, return_value_policy<copy_const_reference>() ) .def( "setDisplayWindow", &Format::setDisplayWindow ) .def( "fromEXRSpace", ( int (Format::*)( int ) const )&Format::fromEXRSpace ) .def( "fromEXRSpace", ( Imath::V2i (Format::*)( const Imath::V2i & ) const )&Format::fromEXRSpace ) .def( "fromEXRSpace", ( Imath::Box2i (Format::*)( const Imath::Box2i & ) const )&Format::fromEXRSpace ) .def( "toEXRSpace", ( int (Format::*)( int ) const )&Format::toEXRSpace ) .def( "toEXRSpace", ( Imath::V2i (Format::*)( const Imath::V2i & ) const )&Format::toEXRSpace ) .def( "toEXRSpace", ( Imath::Box2i (Format::*)( const Imath::Box2i & ) const )&Format::toEXRSpace ) .def( "__eq__", &Format::operator== ) .def( "__repr__", &formatRepr ) .def( "__str__", &boost::lexical_cast<std::string, Format> ) .def( "registerFormat", &Format::registerFormat ).staticmethod( "registerFormat" ) .def( "deregisterFormat", &Format::deregisterFormat ).staticmethod( "deregisterFormat" ) .def( "registeredFormats", &registeredFormats ).staticmethod( "registeredFormats" ) .def( "format", &Format::format ).staticmethod( "format" ) .def( "name", &Format::name ).staticmethod( "name" ) ; IECorePython::RunTimeTypedClass<FormatData>() .def( init<>() ) .def( init<const Format &>() ) .add_property( "value", make_function( &FormatData::writable, return_internal_reference<1>() ) ) .def( "hasBase", &FormatData::hasBase ).staticmethod( "hasBase" ) ; IECorePython::TypedDataFromType<FormatData>(); TypedPlugClass<AtomicFormatPlug>(); Serialisation::registerSerialiser( static_cast<IECore::TypeId>(AtomicFormatPlugTypeId), new AtomicFormatPlugSerialiser ); PlugClass<FormatPlug>() .def( boost::python::init<const std::string &, Gaffer::Plug::Direction, const Format &, unsigned>( ( boost::python::arg_( "name" ) = GraphComponent::defaultName<FormatPlug>(), boost::python::arg_( "direction" ) = Plug::In, boost::python::arg_( "defaultValue" ) = Format(), boost::python::arg_( "flags" ) = Plug::Default ) ) ) .def( "defaultValue", &FormatPlug::defaultValue, return_value_policy<boost::python::copy_const_reference>() ) .def( "setValue", &setValue ) .def( "getValue", &getValue ) .def( "setDefaultFormat", &FormatPlug::setDefaultFormat ) .staticmethod( "setDefaultFormat" ) .def( "getDefaultFormat", &FormatPlug::getDefaultFormat ) .staticmethod( "getDefaultFormat" ) .def( "acquireDefaultFormatPlug", &FormatPlug::acquireDefaultFormatPlug, return_value_policy<IECorePython::CastToIntrusivePtr>() ) .staticmethod( "acquireDefaultFormatPlug" ) ; Serialisation::registerSerialiser( FormatPlug::staticTypeId(), new FormatPlugSerialiser ); class_<Sampler> cls( "Sampler", no_init ); { // Must bind the BoundingMode first, so that it can be used in the default // arguments to the init methods. scope s = cls; enum_<Sampler::BoundingMode>( "BoundingMode" ) .value( "Black", Sampler::Black ) .value( "Clamp", Sampler::Clamp ) ; } cls.def( init<const GafferImage::ImagePlug *, const std::string &, const Imath::Box2i &, Sampler::BoundingMode> ( ( arg( "boundingMode" ) = Sampler::Black ) ) ) .def( "hash", (IECore::MurmurHash (Sampler::*)() const)&Sampler::hash ) .def( "hash", (void (Sampler::*)( IECore::MurmurHash & ) const)&Sampler::hash ) .def( "sample", (float (Sampler::*)( float, float ) )&Sampler::sample ) .def( "sample", (float (Sampler::*)( int, int ) )&Sampler::sample ) ; }
<% from pwnlib.shellcraft.arm.linux import syscall %> <%page args="pid, stat_loc, options"/> <%docstring> Invokes the syscall waitpid. See 'man 2 waitpid' for more information. Arguments: pid(pid_t): pid stat_loc(int): stat_loc options(int): options </%docstring> ${syscall('SYS_waitpid', pid, stat_loc, options)}
dw $0040 track_17_08: db $F7, $77, $86, $3C, $7B, $D8, $E0, $60, $3B, $5D db $D8, $E9, $EF, $63, $81, $80, $0E, $97, $76, $38 db $FB, $D8, $E0, $60, $39, $5D, $D8, $E1, $EF, $60 db $00, $E3, $77, $63, $87, $BD, $80, $35, $DD, $8D db $EF, $60, $00
// Commodore 64 PRG executable file .file [name="bresenhamarr.prg", type="prg", segments="Program"] .segmentdef Program [segments="Basic, Code, Data"] .segmentdef Basic [start=$0801] .segmentdef Code [start=$80d] .segmentdef Data [startAfter="Code"] .segment Basic :BasicUpstart(main) .segment Code main: { .const STAR = $51 .const x0 = 0 .const y0 = 0 .const x1 = $27 .const y1 = $18 .label screen = $400 .label x = 7 .label idx = 2 .label y = 4 .label __15 = 5 lda #y0 sta.z y ldx #y1/2 lda #x0 sta.z x lda #<0 sta.z idx sta.z idx+1 __b1: // screen[idx] = STAR lda.z idx clc adc #<screen sta.z __15 lda.z idx+1 adc #>screen sta.z __15+1 lda #STAR ldy #0 sta (__15),y // x = x + 1 inc.z x // idx = idx + 1 inc.z idx bne !+ inc.z idx+1 !: // e = e+yd txa axs #-[y1] // if(xd<e) cpx #x1 bcc __b2 beq __b2 // y = y+1 inc.z y // idx = idx + 40 lda #$28 clc adc.z idx sta.z idx bcc !+ inc.z idx+1 !: // e = e - xd txa axs #x1 __b2: // while (x<(x1+1)) lda.z x cmp #x1+1 bcc __b1 // } rts }
#pragma once #include <Std/Span.hpp> #include <Std/Singleton.hpp> #include <Kernel/FileSystem/VirtualFileSystem.hpp> namespace Kernel { class ConsoleFileHandle final : public VirtualFileHandle { public: KernelResult<usize> read(Bytes bytes) override; KernelResult<usize> write(ReadonlyBytes bytes) override; VirtualFile& file() override; }; class ConsoleFile final : public Singleton<ConsoleFile> , public VirtualFile { public: VirtualFileHandle& create_handle_impl() override { return *new ConsoleFileHandle; } void truncate() override { VERIFY_NOT_REACHED(); } private: friend Singleton<ConsoleFile>; ConsoleFile(); }; }
; A286727: Positions of 0 in A286063; complement of A286728. ; 1,2,5,6,8,9,10,11,14,15,16,17,19,20,23,24,26,27,28,29,31,32,35,36,37,38,41,42,44,45,46,47,50,51,52,53,55,56,59,60,61,62,65,66,68,69,70,71,73,74,77,78,80,81,82,83,86,87,88,89,91,92,95,96,98,99,100,101,103,104,107,108,109,110,113,114,116,117,118,119,121,122,125,126,128,129,130,131,134,135,136,137,139,140,143,144,145,146,149,150 mov $1,$0 lpb $1 mov $2,$1 mod $1,2 div $2,2 seq $2,93505 ; a(n) = floor(A001969(n)/2 + 1/2). add $0,$2 lpe add $0,1
#ifndef PARSER_PREBUILT_MATH_FUNCTION_EXECPTIONS_HPP #define PARSER_PREBUILT_MATH_FUNCTION_EXECPTIONS_HPP #include <stdexcept> namespace ratl::math_function { class not_simplifiable { }; }// namespace ratl::math_function #endif// PARSER_PREBUILT_MATH_FUNCTION_EXECPTIONS_HPP
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Copyright (c) GeoWorks 1991 -- All Rights Reserved PROJECT: PC GEOS MODULE: FILE: uiType.asm AUTHOR: Chris Boyke METHODS: Name Description ---- ----------- FUNCTIONS: Scope Name Description ----- ---- ----------- REVISION HISTORY: Name Date Description ---- ---- ----------- CDB 12/16/91 Initial version. DESCRIPTION: implementation of ChartTypeControlClass $Id: uiType.asm,v 1.1 97/04/04 17:47:26 newdeal Exp $ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ COMMENT @---------------------------------------------------------------------- MESSAGE: ChartTypeControlGetInfo -- MSG_GEN_CONTROL_GET_INFO for ChartTypeControlClass DESCRIPTION: Return group PASS: *ds:si - instance data es - segment of ChartTypeControlClass ax - The message cx:dx - GenControlBuildInfo structure to fill in RETURN: none DESTROYED: bx, si, di, ds, es (message handler) REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 10/31/91 Initial version ------------------------------------------------------------------------------@ ChartTypeControlGetInfo method dynamic ChartTypeControlClass, MSG_GEN_CONTROL_GET_INFO mov si, offset CTC_dupInfo call CopyDupInfoCommon ret ChartTypeControlGetInfo endm CTC_dupInfo GenControlBuildInfo < mask GCBF_SUSPEND_ON_APPLY, ; GCBI_flags CTC_IniFileKey, ; GCBI_initFileKey CTC_gcnList, ; GCBI_gcnList length CTC_gcnList, ; GCBI_gcnCount CTC_notifyTypeList, ; GCBI_notificationList length CTC_notifyTypeList, ; GCBI_notificationCount CTCName, ; GCBI_controllerName handle TypeControlUI, ; GCBI_dupBlock CTC_childList, ; GCBI_childList length CTC_childList, ; GCBI_childCount CTC_featuresList, ; GCBI_featuresList length CTC_featuresList, ; GCBI_featuresCount CTC_DEFAULT_FEATURES, ; GCBI_features handle TypeControlToolboxUI, ; GCBI_toolBlock CTC_toolList, ; GCBI_toolList length CTC_toolList, ; GCBI_toolCount CTC_toolFeaturesList, ; GCBI_toolFeaturesList length CTC_toolFeaturesList, ; GCBI_toolFeaturesCount CTC_DEFAULT_TOOLBOX_FEATURES, ; GCBI_toolFeatures CTC_helpContext> ; GCBI_helpContext CTC_helpContext char "dbChrtType", 0 ifdef SPIDER_CHART CTC_DEFAULT_FEATURES equ mask CTCF_COLUMN or mask CTCF_BAR or \ mask CTCF_LINE or mask CTCF_AREA or \ mask CTCF_PIE or mask CTCF_SCATTER or \ mask CTCF_HIGH_LOW or mask CTCF_SPIDER else ; SPIDER_CHART CTC_DEFAULT_FEATURES equ mask CTCF_COLUMN or mask CTCF_BAR or \ mask CTCF_LINE or mask CTCF_AREA or \ mask CTCF_PIE or mask CTCF_SCATTER or \ mask CTCF_HIGH_LOW endif ; SPIDER_CHART CTC_IniFileKey char "chartType", 0 CTC_gcnList GCNListType \ <MANUFACTURER_ID_GEOWORKS, GAGCNLT_APP_TARGET_NOTIFY_CHART_TYPE_CHANGE> CTC_notifyTypeList NotificationType \ <MANUFACTURER_ID_GEOWORKS, GWNT_CHART_TYPE_CHANGE> ;--- ifdef SPIDER_CHART CTC_childList GenControlChildInfo \ <offset ChartTypeInteraction, mask CTCF_COLUMN or mask CTCF_BAR or mask CTCF_LINE or mask CTCF_AREA or mask CTCF_SCATTER or mask CTCF_PIE or mask CTCF_HIGH_LOW or mask CTCF_SPIDER, 0> else ; SPIDER_CHART CTC_childList GenControlChildInfo \ <offset ChartTypeInteraction, mask CTCF_COLUMN or mask CTCF_BAR or mask CTCF_LINE or mask CTCF_AREA or mask CTCF_SCATTER or mask CTCF_PIE or mask CTCF_HIGH_LOW, 0> endif ; SPIDER_CHART ; Careful, this table is in the *opposite* order as the record which ; it corresponds to. ifdef SPIDER_CHART CTC_featuresList GenControlFeaturesInfo \ <offset SpiderItemGroup, SpiderName, 0>, <offset HighLowItemGroup, HighLowName, 0>, <offset PieItemGroup, PieName, 0>, <offset ScatterItemGroup, ScatterName, 0>, <offset AreaItemGroup, AreaName, 0>, <offset LineItemGroup, LineName, 0>, <offset BarItemGroup, BarName, 0>, <offset ColumnItemGroup, ColumnName, 0> else ; SPIDER_CHART CTC_featuresList GenControlFeaturesInfo \ <offset HighLowItemGroup, HighLowName, 0>, <offset PieItemGroup, PieName, 0>, <offset ScatterItemGroup, ScatterName, 0>, <offset AreaItemGroup, AreaName, 0>, <offset LineItemGroup, LineName, 0>, <offset BarItemGroup, BarName, 0>, <offset ColumnItemGroup, ColumnName, 0> endif ; SPIDER_CHART ifdef SPIDER_CHART CTC_toolList GenControlChildInfo \ <offset ChartTypeTool, mask CTCTF_COLUMN or mask CTCTF_BAR or mask CTCTF_LINE or mask CTCTF_AREA or mask CTCTF_SCATTER or mask CTCTF_PIE or mask CTCF_HIGH_LOW or mask CTCF_SPIDER, 0> else ; SPIDER_CHART CTC_toolList GenControlChildInfo \ <offset ChartTypeTool, mask CTCTF_COLUMN or mask CTCTF_BAR or mask CTCTF_LINE or mask CTCTF_AREA or mask CTCTF_SCATTER or mask CTCTF_PIE or mask CTCF_HIGH_LOW, 0> endif ; SPIDER_CHART ; Careful, this table is in the *opposite* order as the record which ; it corresponds to. ifdef SPIDER_CHART CTC_toolFeaturesList GenControlFeaturesInfo \ <offset SpiderTool, SpiderName, 0>, <offset HighLowTool, HighLowName, 0>, <offset PieTool, PieName, 0>, <offset ScatterTool, ScatterName, 0>, <offset AreaTool, AreaName, 0>, <offset LineTool, LineName, 0>, <offset BarTool, BarName, 0>, <offset ColumnTool, ColumnName, 0> else ; SPIDER_CHART CTC_toolFeaturesList GenControlFeaturesInfo \ <offset HighLowTool, HighLowName, 0>, <offset PieTool, PieName, 0>, <offset ScatterTool, ScatterName, 0>, <offset AreaTool, AreaName, 0>, <offset LineTool, LineName, 0>, <offset BarTool, BarName, 0>, <offset ColumnTool, ColumnName, 0> endif ; SPIDER_CHART COMMENT @---------------------------------------------------------------------- MESSAGE: ChartTypeControlTypeChange -- MSG_CTC_TYPE_CHANGE for ChartTypeControlClass DESCRIPTION: Update the UI stuff based on the setting of the ChartType. PASS: *ds:si - instance data es - segment of ChartTypeControlClass ax - The message cl - ChartType RETURN: DESTROYED: bx, si, di, ds, es (message handler) REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: Only update on a USER change KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 10/31/91 Initial version ------------------------------------------------------------------------------@ ChartTypeControlTypeChange method dynamic ChartTypeControlClass, MSG_CTC_TYPE_CHANGE clr ch ; set variation as "Standard" call UpdateUICommon ret ChartTypeControlTypeChange endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ChartTypeControlVariationChange %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DESCRIPTION: PASS: *ds:si = ChartTypeControlClass object ds:di = ChartTypeControlClass instance data es = Segment of ChartTypeControlClass. cl = chart type ch = chart variation bp low - ListEntryState bp high - ListUpdateFlags RETURN: DESTROYED: everything REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- CDB 12/27/91 Initial version. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ChartTypeControlVariationChange method dynamic ChartTypeControlClass, MSG_CTC_VARIATION_CHANGE FALL_THRU ChartTypeChangeCommon ChartTypeControlVariationChange endm ChartTypeChangeCommon proc far ; ; cl - ChartType ; ch - ChartVariation ; mov ax, MSG_CHART_GROUP_SET_CHART_TYPE mov bx, segment ChartGroupClass mov di, offset ChartGroupClass call GenControlOutputActionRegs ; ; Don't set any BuildChangeFlags, because the chart group will ; have calculated them for itself. ; clr bp mov ax, MSG_CHART_OBJECT_BUILD call GenControlOutputActionRegs ret ChartTypeChangeCommon endp COMMENT @---------------------------------------------------------------------- MESSAGE: ChartTypeControlUpdateUI -- MSG_GEN_CONTROL_UPDATE_UI for ChartTypeControlClass DESCRIPTION: Handle notification of type change PASS: *ds:si - instance data es - segment of ChartTypeControlClass ax - The message dx - NotificationStandardNotificationType ss:bp - GenControlUpdateUIParams RETURN: DESTROYED: bx, si, di, ds, es (message handler) REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 11/12/91 Initial version ------------------------------------------------------------------------------@ ChartTypeControlUpdateUI method ChartTypeControlClass, MSG_GEN_CONTROL_UPDATE_UI ; get notification data push ds mov bx, ss:[bp].GCUUIP_dataBlock call MemLock mov ds, ax mov cl, ds:[TNB_type] mov ch, ds:[TNB_variation] call MemUnlock pop ds call UpdateUICommon ; ; Update the tool UI, if any ; test ss:[bp].GCUUIP_toolboxFeatures, \ mask ChartTypeControlToolboxFeatures jz noTools mov bx, ss:[bp].GCUUIP_toolBlock ;;; ;;; HACK ALERT!!! ;;; The high byte of the type tool identifier stores the default ;;; chart variation type. If ch != the high byte of the identifier, ;;; the tool won't be selected, so force ch to be the same as ;;; the value set in the ChartTypeTools identifiers in uiType.ui. ;;; clr ch cmp cl, CT_PIE jne noPie mov ch, CPV_CATEGORY_TITLES noPie: push si mov si, offset ChartTypeTool ;^lbx:si <- OD of list call SetItemGroupSelection pop si noTools: .leave ret ChartTypeControlUpdateUI endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% UpdateUICommon %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Update the various UI pieces based on the current chart selection. CALLED BY: PASS: cl - ChartType ch - ChartVariation *ds:si - GenControl object RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- CDB 12/26/91 Initial version. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ UpdateUICommon proc near uses ax,bx,cx,dx,di,si,bp .enter call GetChildBlock ; bx <= child block ; Set all the variation lists not usable, except the one ; corresponding to the current chart type mov dl, VUM_DELAYED_VIA_UI_QUEUE clr di startLoop: mov si, cs:ChartVariationsTable[di] push cx clr ch cmp di, cx ; chartType pop cx jne notUsable ; Set the current variation list usable,, and set its value call SetObjUsable call SetItemGroupSelection jmp endLoop notUsable: ; Set the variation not usable, and set it indeterminate call SetObjNotUsable endLoop: add di, 2 cmp di, size ChartVariationsTable jl startLoop ; set the main chart list. CL may contain a valid chart type, ; or -1. mov si, offset ChartTypeItemGroup mov al, cl cbw mov cx, ax call SetItemGroupSelection .leave ret UpdateUICommon endp ifdef SPIDER_CHART ChartVariationsTable word \ offset ColumnItemGroup, offset BarItemGroup, offset LineItemGroup, offset AreaItemGroup, offset ScatterItemGroup, offset PieItemGroup, offset HighLowItemGroup, offset SpiderItemGroup else ; SPIDER_CHART ChartVariationsTable word \ offset ColumnItemGroup, offset BarItemGroup, offset LineItemGroup, offset AreaItemGroup, offset ScatterItemGroup, offset PieItemGroup, offset HighLowItemGroup endif ; SPIDER_CHART COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ChartTypeControlToolChange %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Handle changing the ChartType from the tool list CALLED BY: MSG_CTC_TYPE_TOOL_CHANGE PASS: *ds:si - instance data ds:di - *ds:si es - seg addr of ChartTypeControlClass ax - the message cl - ChartType ch - ChartVariation RETURN: none DESTROYED: bx, si, di, ds, es (method handler) PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- eca 6/17/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ChartTypeControlToolChange method dynamic ChartTypeControlClass, \ MSG_CTC_TYPE_TOOL_CHANGE GOTO ChartTypeChangeCommon ChartTypeControlToolChange endm
#include "Font.hpp"
// Copyright (c) 2017-2021 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/json/ #ifndef TAO_JSON_INTERNAL_ENDIAN_WIN_HPP #define TAO_JSON_INTERNAL_ENDIAN_WIN_HPP #include <cstdint> #include <cstring> #include <stdlib.h> // TODO: Or is intrin.h the 'more correct' header for the _byteswap_foo() functions? namespace tao::json::internal { template< unsigned S > struct to_and_from_le { template< typename T > [[nodiscard]] static T convert( const T t ) noexcept { return t; } }; template< unsigned S > struct to_and_from_be; template<> struct to_and_from_be< 1 > { [[nodiscard]] static std::int8_t convert( const std::int8_t n ) noexcept { return n; } [[nodiscard]] static std::uint8_t convert( const std::uint8_t n ) noexcept { return n; } }; template<> struct to_and_from_be< 2 > { [[nodiscard]] static std::int16_t convert( const std::int16_t n ) noexcept { return std::int16_t( _byteswap_ushort( std::uint16_t( n ) ) ); } [[nodiscard]] static std::uint16_t convert( const std::uint16_t n ) noexcept { return _byteswap_ushort( n ); } }; template<> struct to_and_from_be< 4 > { [[nodiscard]] static float convert( float n ) noexcept { std::uint32_t u; std::memcpy( &u, &n, 4 ); u = convert( u ); std::memcpy( &n, &u, 4 ); return n; } [[nodiscard]] static std::int32_t convert( const std::int32_t n ) noexcept { return std::int32_t( _byteswap_ulong( std::uint32_t( n ) ) ); } [[nodiscard]] static std::uint32_t convert( const std::uint32_t n ) noexcept { return _byteswap_ulong( n ); } }; template<> struct to_and_from_be< 8 > { [[nodiscard]] static double convert( double n ) noexcept { std::uint64_t u; std::memcpy( &u, &n, 8 ); u = convert( u ); std::memcpy( &n, &u, 8 ); return n; } [[nodiscard]] static std::int64_t convert( const std::int64_t n ) noexcept { return std::int64_t( _byteswap_uint64( std::uint64_t( n ) ) ); } [[nodiscard]] static std::uint64_t convert( const std::uint64_t n ) noexcept { return _byteswap_uint64( n ); } }; } // namespace tao::json::internal #endif
#include "CameraController.h" #include <glm/gtc/matrix_transform.hpp> #include <glm/gtc/quaternion.hpp> void CameraController::updateCamera(Camera& camera) { const float speed = m_cam_speed; //Delta time here? if (InputModule::isKeyPressed(GLFW_KEY_R)) //reset camera { camera.setPosition(glm::vec3{ 0.0f, 0.0f, -3.5f }); camera.setViewMatrix(glm::lookAt(glm::vec3{ 0.0f, 0.0f, -3.5f }, glm::vec3{ 0.0f, 0.0f, 0.0f }, glm::vec3{ 0.0f, 1.0f, 0.0f })); camera.setFoV(55); } if (InputModule::isKeyPressed(GLFW_KEY_W)) { camera.setPosition( camera.position() + (speed * camera.front())); } if (InputModule::isKeyPressed(GLFW_KEY_S)) { camera.setPosition(camera.position() - (speed * camera.front())); } if (InputModule::isKeyPressed(GLFW_KEY_A)) { camera.setPosition(camera.position() - (speed * camera.right())); } if (InputModule::isKeyPressed(GLFW_KEY_D)) { camera.setPosition(camera.position() + (speed * camera.right())); } if (InputModule::isKeyPressed(GLFW_KEY_SPACE)) { camera.setPosition(camera.position() + (speed * camera.up())); } if (InputModule::isKeyPressed(GLFW_KEY_LEFT_SHIFT)) { camera.setPosition(camera.position() - (speed * camera.up())); } if (InputModule::isMouseButtonPressed(GLFW_MOUSE_BUTTON_2)) { float deltaX = InputModule::getMouseDeltaX() * m_sensitivity; float deltaY = InputModule::getMouseDeltaY() * m_sensitivity; glm::vec3 world_up = glm::vec3{ 0.0f, 1.0f, 0.0f }; auto pitch_qt = glm::angleAxis(deltaY, camera.right()); auto yaw_qt = glm::angleAxis(deltaX, world_up); //world up glm::vec3 cam_front = pitch_qt * yaw_qt * camera.front(); glm::vec3 cam_right = yaw_qt * camera.right(); if (glm::length(glm::cross(cam_front, world_up)) > 0.01f) {//limit 90 and -90 degrees camera.setViewMatrix(glm::lookAt(camera.position(), camera.position() + cam_front, glm::cross(-cam_front, cam_right ))); } } if (InputModule::getMouseScroll() != 0) { camera.setFoV(camera.fov() - InputModule::getMouseScroll()); if (camera.fov() > 105.0f) { camera.setFoV(105.5); } if (camera.fov() < 30.0f) { camera.setFoV(30.0f); } } }
PUBLIC GetCPUID .CODE GetCPUID PROC NEAR mov r8, rdx ; Save rdx in a register that isn't used by the function. mov r9, rbx ; Save rbx (it's to be preserved by the called function if modified, and CPUID instruction sets it). mov eax, ecx ; Set up for reading the CPUID. cpuid ; Do it.. mov dword ptr [r8], eax mov dword ptr [r8+4], ebx mov dword ptr [r8+8], ecx mov dword ptr [r8+12], edx mov rbx, r9 ret GetCPUID ENDP END
; void ba_priority_queue_clear(ba_priority_queue_t *q) SECTION code_clib SECTION code_adt_ba_priority_queue PUBLIC ba_priority_queue_clear EXTERN asm_ba_priority_queue_clear defc ba_priority_queue_clear = asm_ba_priority_queue_clear ; SDCC bridge for Classic IF __CLASSIC PUBLIC _ba_priority_queue_clear defc _ba_priority_queue_clear = ba_priority_queue_clear ENDIF
; A194726: Number of 6-ary words either empty or beginning with the first character of the alphabet, that can be built by inserting n doublets into the initially empty word. ; Submitted by Jon Maiga ; 1,1,11,146,2131,32966,530526,8786436,148733571,2561439806,44731364266,790211926076,14095578557486,253519929631996,4592415708939356,83709533881191816,1534227271236577251,28256420350942562286,522675506718404898546,9706083027629177910156,180879637531332533671866,3381650423952067891874676,63407289073996245865300836,1192105264883011579666455096,22467843127397418027660352206,424420960108556270797530491916,8034289859519645698051918021476,152386990526482288617417876898136 mul $0,2 trn $0,1 seq $0,128387 ; Expansion of c(5x^2)/(1-x*c(5x^2)), where c(x) is the g.f. of A000108.
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Copyright (c) GeoWorks 1991 -- All Rights Reserved PROJECT: PC GEOS MODULE: FILE: mainDelete.asm AUTHOR: John Wedgwood, Nov 13, 1991 METHODS: Name Description ---- ----------- REVISION HISTORY: Name Date Description ---- ---- ----------- John 11/13/91 Initial revision DESCRIPTION: Code for deleting charts. $Id: mainDelete.asm,v 1.1 97/04/04 17:46:41 newdeal Exp $ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ChartBodyCode segment resource COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ChartDeleteChart %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Delete a chart and all related data structures. CALLED BY: Global PASS: bx = VM file handle ax = VM block handle of chart object block RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- jcw 11/13/91 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ChartDeleteChart proc far ret ChartDeleteChart endp ChartBodyCode ends
; This file is generated from a similarly-named Perl script in the BoringSSL ; source tree. Do not edit by hand. default rel %define XMMWORD %define YMMWORD %define ZMMWORD section .text code align=64 EXTERN GFp_ia32cap_P global GFp_bn_mul_mont_gather5 ALIGN 64 GFp_bn_mul_mont_gather5: mov QWORD[8+rsp],rdi ;WIN64 prologue mov QWORD[16+rsp],rsi mov rax,rsp $L$SEH_begin_GFp_bn_mul_mont_gather5: mov rdi,rcx mov rsi,rdx mov rdx,r8 mov rcx,r9 mov r8,QWORD[40+rsp] mov r9,QWORD[48+rsp] mov r9d,r9d mov rax,rsp test r9d,7 jnz NEAR $L$mul_enter lea r11,[GFp_ia32cap_P] mov r11d,DWORD[8+r11] jmp NEAR $L$mul4x_enter ALIGN 16 $L$mul_enter: movd xmm5,DWORD[56+rsp] push rbx push rbp push r12 push r13 push r14 push r15 neg r9 mov r11,rsp lea r10,[((-280))+r9*8+rsp] neg r9 and r10,-1024 sub r11,r10 and r11,-4096 lea rsp,[r11*1+r10] mov r11,QWORD[rsp] cmp rsp,r10 ja NEAR $L$mul_page_walk jmp NEAR $L$mul_page_walk_done $L$mul_page_walk: lea rsp,[((-4096))+rsp] mov r11,QWORD[rsp] cmp rsp,r10 ja NEAR $L$mul_page_walk $L$mul_page_walk_done: lea r10,[$L$inc] mov QWORD[8+r9*8+rsp],rax $L$mul_body: lea r12,[128+rdx] movdqa xmm0,XMMWORD[r10] movdqa xmm1,XMMWORD[16+r10] lea r10,[((24-112))+r9*8+rsp] and r10,-16 pshufd xmm5,xmm5,0 movdqa xmm4,xmm1 movdqa xmm2,xmm1 paddd xmm1,xmm0 pcmpeqd xmm0,xmm5 DB 0x67 movdqa xmm3,xmm4 paddd xmm2,xmm1 pcmpeqd xmm1,xmm5 movdqa XMMWORD[112+r10],xmm0 movdqa xmm0,xmm4 paddd xmm3,xmm2 pcmpeqd xmm2,xmm5 movdqa XMMWORD[128+r10],xmm1 movdqa xmm1,xmm4 paddd xmm0,xmm3 pcmpeqd xmm3,xmm5 movdqa XMMWORD[144+r10],xmm2 movdqa xmm2,xmm4 paddd xmm1,xmm0 pcmpeqd xmm0,xmm5 movdqa XMMWORD[160+r10],xmm3 movdqa xmm3,xmm4 paddd xmm2,xmm1 pcmpeqd xmm1,xmm5 movdqa XMMWORD[176+r10],xmm0 movdqa xmm0,xmm4 paddd xmm3,xmm2 pcmpeqd xmm2,xmm5 movdqa XMMWORD[192+r10],xmm1 movdqa xmm1,xmm4 paddd xmm0,xmm3 pcmpeqd xmm3,xmm5 movdqa XMMWORD[208+r10],xmm2 movdqa xmm2,xmm4 paddd xmm1,xmm0 pcmpeqd xmm0,xmm5 movdqa XMMWORD[224+r10],xmm3 movdqa xmm3,xmm4 paddd xmm2,xmm1 pcmpeqd xmm1,xmm5 movdqa XMMWORD[240+r10],xmm0 movdqa xmm0,xmm4 paddd xmm3,xmm2 pcmpeqd xmm2,xmm5 movdqa XMMWORD[256+r10],xmm1 movdqa xmm1,xmm4 paddd xmm0,xmm3 pcmpeqd xmm3,xmm5 movdqa XMMWORD[272+r10],xmm2 movdqa xmm2,xmm4 paddd xmm1,xmm0 pcmpeqd xmm0,xmm5 movdqa XMMWORD[288+r10],xmm3 movdqa xmm3,xmm4 paddd xmm2,xmm1 pcmpeqd xmm1,xmm5 movdqa XMMWORD[304+r10],xmm0 paddd xmm3,xmm2 DB 0x67 pcmpeqd xmm2,xmm5 movdqa XMMWORD[320+r10],xmm1 pcmpeqd xmm3,xmm5 movdqa XMMWORD[336+r10],xmm2 pand xmm0,XMMWORD[64+r12] pand xmm1,XMMWORD[80+r12] pand xmm2,XMMWORD[96+r12] movdqa XMMWORD[352+r10],xmm3 pand xmm3,XMMWORD[112+r12] por xmm0,xmm2 por xmm1,xmm3 movdqa xmm4,XMMWORD[((-128))+r12] movdqa xmm5,XMMWORD[((-112))+r12] movdqa xmm2,XMMWORD[((-96))+r12] pand xmm4,XMMWORD[112+r10] movdqa xmm3,XMMWORD[((-80))+r12] pand xmm5,XMMWORD[128+r10] por xmm0,xmm4 pand xmm2,XMMWORD[144+r10] por xmm1,xmm5 pand xmm3,XMMWORD[160+r10] por xmm0,xmm2 por xmm1,xmm3 movdqa xmm4,XMMWORD[((-64))+r12] movdqa xmm5,XMMWORD[((-48))+r12] movdqa xmm2,XMMWORD[((-32))+r12] pand xmm4,XMMWORD[176+r10] movdqa xmm3,XMMWORD[((-16))+r12] pand xmm5,XMMWORD[192+r10] por xmm0,xmm4 pand xmm2,XMMWORD[208+r10] por xmm1,xmm5 pand xmm3,XMMWORD[224+r10] por xmm0,xmm2 por xmm1,xmm3 movdqa xmm4,XMMWORD[r12] movdqa xmm5,XMMWORD[16+r12] movdqa xmm2,XMMWORD[32+r12] pand xmm4,XMMWORD[240+r10] movdqa xmm3,XMMWORD[48+r12] pand xmm5,XMMWORD[256+r10] por xmm0,xmm4 pand xmm2,XMMWORD[272+r10] por xmm1,xmm5 pand xmm3,XMMWORD[288+r10] por xmm0,xmm2 por xmm1,xmm3 por xmm0,xmm1 pshufd xmm1,xmm0,0x4e por xmm0,xmm1 lea r12,[256+r12] DB 102,72,15,126,195 mov r8,QWORD[r8] mov rax,QWORD[rsi] xor r14,r14 xor r15,r15 mov rbp,r8 mul rbx mov r10,rax mov rax,QWORD[rcx] imul rbp,r10 mov r11,rdx mul rbp add r10,rax mov rax,QWORD[8+rsi] adc rdx,0 mov r13,rdx lea r15,[1+r15] jmp NEAR $L$1st_enter ALIGN 16 $L$1st: add r13,rax mov rax,QWORD[r15*8+rsi] adc rdx,0 add r13,r11 mov r11,r10 adc rdx,0 mov QWORD[((-16))+r15*8+rsp],r13 mov r13,rdx $L$1st_enter: mul rbx add r11,rax mov rax,QWORD[r15*8+rcx] adc rdx,0 lea r15,[1+r15] mov r10,rdx mul rbp cmp r15,r9 jne NEAR $L$1st add r13,rax adc rdx,0 add r13,r11 adc rdx,0 mov QWORD[((-16))+r9*8+rsp],r13 mov r13,rdx mov r11,r10 xor rdx,rdx add r13,r11 adc rdx,0 mov QWORD[((-8))+r9*8+rsp],r13 mov QWORD[r9*8+rsp],rdx lea r14,[1+r14] jmp NEAR $L$outer ALIGN 16 $L$outer: lea rdx,[((24+128))+r9*8+rsp] and rdx,-16 pxor xmm4,xmm4 pxor xmm5,xmm5 movdqa xmm0,XMMWORD[((-128))+r12] movdqa xmm1,XMMWORD[((-112))+r12] movdqa xmm2,XMMWORD[((-96))+r12] movdqa xmm3,XMMWORD[((-80))+r12] pand xmm0,XMMWORD[((-128))+rdx] pand xmm1,XMMWORD[((-112))+rdx] por xmm4,xmm0 pand xmm2,XMMWORD[((-96))+rdx] por xmm5,xmm1 pand xmm3,XMMWORD[((-80))+rdx] por xmm4,xmm2 por xmm5,xmm3 movdqa xmm0,XMMWORD[((-64))+r12] movdqa xmm1,XMMWORD[((-48))+r12] movdqa xmm2,XMMWORD[((-32))+r12] movdqa xmm3,XMMWORD[((-16))+r12] pand xmm0,XMMWORD[((-64))+rdx] pand xmm1,XMMWORD[((-48))+rdx] por xmm4,xmm0 pand xmm2,XMMWORD[((-32))+rdx] por xmm5,xmm1 pand xmm3,XMMWORD[((-16))+rdx] por xmm4,xmm2 por xmm5,xmm3 movdqa xmm0,XMMWORD[r12] movdqa xmm1,XMMWORD[16+r12] movdqa xmm2,XMMWORD[32+r12] movdqa xmm3,XMMWORD[48+r12] pand xmm0,XMMWORD[rdx] pand xmm1,XMMWORD[16+rdx] por xmm4,xmm0 pand xmm2,XMMWORD[32+rdx] por xmm5,xmm1 pand xmm3,XMMWORD[48+rdx] por xmm4,xmm2 por xmm5,xmm3 movdqa xmm0,XMMWORD[64+r12] movdqa xmm1,XMMWORD[80+r12] movdqa xmm2,XMMWORD[96+r12] movdqa xmm3,XMMWORD[112+r12] pand xmm0,XMMWORD[64+rdx] pand xmm1,XMMWORD[80+rdx] por xmm4,xmm0 pand xmm2,XMMWORD[96+rdx] por xmm5,xmm1 pand xmm3,XMMWORD[112+rdx] por xmm4,xmm2 por xmm5,xmm3 por xmm4,xmm5 pshufd xmm0,xmm4,0x4e por xmm0,xmm4 lea r12,[256+r12] mov rax,QWORD[rsi] DB 102,72,15,126,195 xor r15,r15 mov rbp,r8 mov r10,QWORD[rsp] mul rbx add r10,rax mov rax,QWORD[rcx] adc rdx,0 imul rbp,r10 mov r11,rdx mul rbp add r10,rax mov rax,QWORD[8+rsi] adc rdx,0 mov r10,QWORD[8+rsp] mov r13,rdx lea r15,[1+r15] jmp NEAR $L$inner_enter ALIGN 16 $L$inner: add r13,rax mov rax,QWORD[r15*8+rsi] adc rdx,0 add r13,r10 mov r10,QWORD[r15*8+rsp] adc rdx,0 mov QWORD[((-16))+r15*8+rsp],r13 mov r13,rdx $L$inner_enter: mul rbx add r11,rax mov rax,QWORD[r15*8+rcx] adc rdx,0 add r10,r11 mov r11,rdx adc r11,0 lea r15,[1+r15] mul rbp cmp r15,r9 jne NEAR $L$inner add r13,rax adc rdx,0 add r13,r10 mov r10,QWORD[r9*8+rsp] adc rdx,0 mov QWORD[((-16))+r9*8+rsp],r13 mov r13,rdx xor rdx,rdx add r13,r11 adc rdx,0 add r13,r10 adc rdx,0 mov QWORD[((-8))+r9*8+rsp],r13 mov QWORD[r9*8+rsp],rdx lea r14,[1+r14] cmp r14,r9 jb NEAR $L$outer xor r14,r14 mov rax,QWORD[rsp] lea rsi,[rsp] mov r15,r9 jmp NEAR $L$sub ALIGN 16 $L$sub: sbb rax,QWORD[r14*8+rcx] mov QWORD[r14*8+rdi],rax mov rax,QWORD[8+r14*8+rsi] lea r14,[1+r14] dec r15 jnz NEAR $L$sub sbb rax,0 mov rbx,-1 xor rbx,rax xor r14,r14 mov r15,r9 $L$copy: mov rcx,QWORD[r14*8+rdi] mov rdx,QWORD[r14*8+rsp] and rcx,rbx and rdx,rax mov QWORD[r14*8+rsp],r14 or rdx,rcx mov QWORD[r14*8+rdi],rdx lea r14,[1+r14] sub r15,1 jnz NEAR $L$copy mov rsi,QWORD[8+r9*8+rsp] mov rax,1 mov r15,QWORD[((-48))+rsi] mov r14,QWORD[((-40))+rsi] mov r13,QWORD[((-32))+rsi] mov r12,QWORD[((-24))+rsi] mov rbp,QWORD[((-16))+rsi] mov rbx,QWORD[((-8))+rsi] lea rsp,[rsi] $L$mul_epilogue: mov rdi,QWORD[8+rsp] ;WIN64 epilogue mov rsi,QWORD[16+rsp] DB 0F3h,0C3h ;repret $L$SEH_end_GFp_bn_mul_mont_gather5: ALIGN 32 bn_mul4x_mont_gather5: mov QWORD[8+rsp],rdi ;WIN64 prologue mov QWORD[16+rsp],rsi mov rax,rsp $L$SEH_begin_bn_mul4x_mont_gather5: mov rdi,rcx mov rsi,rdx mov rdx,r8 mov rcx,r9 mov r8,QWORD[40+rsp] mov r9,QWORD[48+rsp] DB 0x67 mov rax,rsp $L$mul4x_enter: and r11d,0x80108 cmp r11d,0x80108 je NEAR $L$mulx4x_enter push rbx push rbp push r12 push r13 push r14 push r15 $L$mul4x_prologue: DB 0x67 shl r9d,3 lea r10,[r9*2+r9] neg r9 lea r11,[((-320))+r9*2+rsp] mov rbp,rsp sub r11,rdi and r11,4095 cmp r10,r11 jb NEAR $L$mul4xsp_alt sub rbp,r11 lea rbp,[((-320))+r9*2+rbp] jmp NEAR $L$mul4xsp_done ALIGN 32 $L$mul4xsp_alt: lea r10,[((4096-320))+r9*2] lea rbp,[((-320))+r9*2+rbp] sub r11,r10 mov r10,0 cmovc r11,r10 sub rbp,r11 $L$mul4xsp_done: and rbp,-64 mov r11,rsp sub r11,rbp and r11,-4096 lea rsp,[rbp*1+r11] mov r10,QWORD[rsp] cmp rsp,rbp ja NEAR $L$mul4x_page_walk jmp NEAR $L$mul4x_page_walk_done $L$mul4x_page_walk: lea rsp,[((-4096))+rsp] mov r10,QWORD[rsp] cmp rsp,rbp ja NEAR $L$mul4x_page_walk $L$mul4x_page_walk_done: neg r9 mov QWORD[40+rsp],rax $L$mul4x_body: call mul4x_internal mov rsi,QWORD[40+rsp] mov rax,1 mov r15,QWORD[((-48))+rsi] mov r14,QWORD[((-40))+rsi] mov r13,QWORD[((-32))+rsi] mov r12,QWORD[((-24))+rsi] mov rbp,QWORD[((-16))+rsi] mov rbx,QWORD[((-8))+rsi] lea rsp,[rsi] $L$mul4x_epilogue: mov rdi,QWORD[8+rsp] ;WIN64 epilogue mov rsi,QWORD[16+rsp] DB 0F3h,0C3h ;repret $L$SEH_end_bn_mul4x_mont_gather5: ALIGN 32 mul4x_internal: shl r9,5 movd xmm5,DWORD[56+rax] lea rax,[$L$inc] lea r13,[128+r9*1+rdx] shr r9,5 movdqa xmm0,XMMWORD[rax] movdqa xmm1,XMMWORD[16+rax] lea r10,[((88-112))+r9*1+rsp] lea r12,[128+rdx] pshufd xmm5,xmm5,0 movdqa xmm4,xmm1 DB 0x67,0x67 movdqa xmm2,xmm1 paddd xmm1,xmm0 pcmpeqd xmm0,xmm5 DB 0x67 movdqa xmm3,xmm4 paddd xmm2,xmm1 pcmpeqd xmm1,xmm5 movdqa XMMWORD[112+r10],xmm0 movdqa xmm0,xmm4 paddd xmm3,xmm2 pcmpeqd xmm2,xmm5 movdqa XMMWORD[128+r10],xmm1 movdqa xmm1,xmm4 paddd xmm0,xmm3 pcmpeqd xmm3,xmm5 movdqa XMMWORD[144+r10],xmm2 movdqa xmm2,xmm4 paddd xmm1,xmm0 pcmpeqd xmm0,xmm5 movdqa XMMWORD[160+r10],xmm3 movdqa xmm3,xmm4 paddd xmm2,xmm1 pcmpeqd xmm1,xmm5 movdqa XMMWORD[176+r10],xmm0 movdqa xmm0,xmm4 paddd xmm3,xmm2 pcmpeqd xmm2,xmm5 movdqa XMMWORD[192+r10],xmm1 movdqa xmm1,xmm4 paddd xmm0,xmm3 pcmpeqd xmm3,xmm5 movdqa XMMWORD[208+r10],xmm2 movdqa xmm2,xmm4 paddd xmm1,xmm0 pcmpeqd xmm0,xmm5 movdqa XMMWORD[224+r10],xmm3 movdqa xmm3,xmm4 paddd xmm2,xmm1 pcmpeqd xmm1,xmm5 movdqa XMMWORD[240+r10],xmm0 movdqa xmm0,xmm4 paddd xmm3,xmm2 pcmpeqd xmm2,xmm5 movdqa XMMWORD[256+r10],xmm1 movdqa xmm1,xmm4 paddd xmm0,xmm3 pcmpeqd xmm3,xmm5 movdqa XMMWORD[272+r10],xmm2 movdqa xmm2,xmm4 paddd xmm1,xmm0 pcmpeqd xmm0,xmm5 movdqa XMMWORD[288+r10],xmm3 movdqa xmm3,xmm4 paddd xmm2,xmm1 pcmpeqd xmm1,xmm5 movdqa XMMWORD[304+r10],xmm0 paddd xmm3,xmm2 DB 0x67 pcmpeqd xmm2,xmm5 movdqa XMMWORD[320+r10],xmm1 pcmpeqd xmm3,xmm5 movdqa XMMWORD[336+r10],xmm2 pand xmm0,XMMWORD[64+r12] pand xmm1,XMMWORD[80+r12] pand xmm2,XMMWORD[96+r12] movdqa XMMWORD[352+r10],xmm3 pand xmm3,XMMWORD[112+r12] por xmm0,xmm2 por xmm1,xmm3 movdqa xmm4,XMMWORD[((-128))+r12] movdqa xmm5,XMMWORD[((-112))+r12] movdqa xmm2,XMMWORD[((-96))+r12] pand xmm4,XMMWORD[112+r10] movdqa xmm3,XMMWORD[((-80))+r12] pand xmm5,XMMWORD[128+r10] por xmm0,xmm4 pand xmm2,XMMWORD[144+r10] por xmm1,xmm5 pand xmm3,XMMWORD[160+r10] por xmm0,xmm2 por xmm1,xmm3 movdqa xmm4,XMMWORD[((-64))+r12] movdqa xmm5,XMMWORD[((-48))+r12] movdqa xmm2,XMMWORD[((-32))+r12] pand xmm4,XMMWORD[176+r10] movdqa xmm3,XMMWORD[((-16))+r12] pand xmm5,XMMWORD[192+r10] por xmm0,xmm4 pand xmm2,XMMWORD[208+r10] por xmm1,xmm5 pand xmm3,XMMWORD[224+r10] por xmm0,xmm2 por xmm1,xmm3 movdqa xmm4,XMMWORD[r12] movdqa xmm5,XMMWORD[16+r12] movdqa xmm2,XMMWORD[32+r12] pand xmm4,XMMWORD[240+r10] movdqa xmm3,XMMWORD[48+r12] pand xmm5,XMMWORD[256+r10] por xmm0,xmm4 pand xmm2,XMMWORD[272+r10] por xmm1,xmm5 pand xmm3,XMMWORD[288+r10] por xmm0,xmm2 por xmm1,xmm3 por xmm0,xmm1 pshufd xmm1,xmm0,0x4e por xmm0,xmm1 lea r12,[256+r12] DB 102,72,15,126,195 mov QWORD[((16+8))+rsp],r13 mov QWORD[((56+8))+rsp],rdi mov r8,QWORD[r8] mov rax,QWORD[rsi] lea rsi,[r9*1+rsi] neg r9 mov rbp,r8 mul rbx mov r10,rax mov rax,QWORD[rcx] imul rbp,r10 lea r14,[((64+8))+rsp] mov r11,rdx mul rbp add r10,rax mov rax,QWORD[8+r9*1+rsi] adc rdx,0 mov rdi,rdx mul rbx add r11,rax mov rax,QWORD[8+rcx] adc rdx,0 mov r10,rdx mul rbp add rdi,rax mov rax,QWORD[16+r9*1+rsi] adc rdx,0 add rdi,r11 lea r15,[32+r9] lea rcx,[32+rcx] adc rdx,0 mov QWORD[r14],rdi mov r13,rdx jmp NEAR $L$1st4x ALIGN 32 $L$1st4x: mul rbx add r10,rax mov rax,QWORD[((-16))+rcx] lea r14,[32+r14] adc rdx,0 mov r11,rdx mul rbp add r13,rax mov rax,QWORD[((-8))+r15*1+rsi] adc rdx,0 add r13,r10 adc rdx,0 mov QWORD[((-24))+r14],r13 mov rdi,rdx mul rbx add r11,rax mov rax,QWORD[((-8))+rcx] adc rdx,0 mov r10,rdx mul rbp add rdi,rax mov rax,QWORD[r15*1+rsi] adc rdx,0 add rdi,r11 adc rdx,0 mov QWORD[((-16))+r14],rdi mov r13,rdx mul rbx add r10,rax mov rax,QWORD[rcx] adc rdx,0 mov r11,rdx mul rbp add r13,rax mov rax,QWORD[8+r15*1+rsi] adc rdx,0 add r13,r10 adc rdx,0 mov QWORD[((-8))+r14],r13 mov rdi,rdx mul rbx add r11,rax mov rax,QWORD[8+rcx] adc rdx,0 mov r10,rdx mul rbp add rdi,rax mov rax,QWORD[16+r15*1+rsi] adc rdx,0 add rdi,r11 lea rcx,[32+rcx] adc rdx,0 mov QWORD[r14],rdi mov r13,rdx add r15,32 jnz NEAR $L$1st4x mul rbx add r10,rax mov rax,QWORD[((-16))+rcx] lea r14,[32+r14] adc rdx,0 mov r11,rdx mul rbp add r13,rax mov rax,QWORD[((-8))+rsi] adc rdx,0 add r13,r10 adc rdx,0 mov QWORD[((-24))+r14],r13 mov rdi,rdx mul rbx add r11,rax mov rax,QWORD[((-8))+rcx] adc rdx,0 mov r10,rdx mul rbp add rdi,rax mov rax,QWORD[r9*1+rsi] adc rdx,0 add rdi,r11 adc rdx,0 mov QWORD[((-16))+r14],rdi mov r13,rdx lea rcx,[r9*1+rcx] xor rdi,rdi add r13,r10 adc rdi,0 mov QWORD[((-8))+r14],r13 jmp NEAR $L$outer4x ALIGN 32 $L$outer4x: lea rdx,[((16+128))+r14] pxor xmm4,xmm4 pxor xmm5,xmm5 movdqa xmm0,XMMWORD[((-128))+r12] movdqa xmm1,XMMWORD[((-112))+r12] movdqa xmm2,XMMWORD[((-96))+r12] movdqa xmm3,XMMWORD[((-80))+r12] pand xmm0,XMMWORD[((-128))+rdx] pand xmm1,XMMWORD[((-112))+rdx] por xmm4,xmm0 pand xmm2,XMMWORD[((-96))+rdx] por xmm5,xmm1 pand xmm3,XMMWORD[((-80))+rdx] por xmm4,xmm2 por xmm5,xmm3 movdqa xmm0,XMMWORD[((-64))+r12] movdqa xmm1,XMMWORD[((-48))+r12] movdqa xmm2,XMMWORD[((-32))+r12] movdqa xmm3,XMMWORD[((-16))+r12] pand xmm0,XMMWORD[((-64))+rdx] pand xmm1,XMMWORD[((-48))+rdx] por xmm4,xmm0 pand xmm2,XMMWORD[((-32))+rdx] por xmm5,xmm1 pand xmm3,XMMWORD[((-16))+rdx] por xmm4,xmm2 por xmm5,xmm3 movdqa xmm0,XMMWORD[r12] movdqa xmm1,XMMWORD[16+r12] movdqa xmm2,XMMWORD[32+r12] movdqa xmm3,XMMWORD[48+r12] pand xmm0,XMMWORD[rdx] pand xmm1,XMMWORD[16+rdx] por xmm4,xmm0 pand xmm2,XMMWORD[32+rdx] por xmm5,xmm1 pand xmm3,XMMWORD[48+rdx] por xmm4,xmm2 por xmm5,xmm3 movdqa xmm0,XMMWORD[64+r12] movdqa xmm1,XMMWORD[80+r12] movdqa xmm2,XMMWORD[96+r12] movdqa xmm3,XMMWORD[112+r12] pand xmm0,XMMWORD[64+rdx] pand xmm1,XMMWORD[80+rdx] por xmm4,xmm0 pand xmm2,XMMWORD[96+rdx] por xmm5,xmm1 pand xmm3,XMMWORD[112+rdx] por xmm4,xmm2 por xmm5,xmm3 por xmm4,xmm5 pshufd xmm0,xmm4,0x4e por xmm0,xmm4 lea r12,[256+r12] DB 102,72,15,126,195 mov r10,QWORD[r9*1+r14] mov rbp,r8 mul rbx add r10,rax mov rax,QWORD[rcx] adc rdx,0 imul rbp,r10 mov r11,rdx mov QWORD[r14],rdi lea r14,[r9*1+r14] mul rbp add r10,rax mov rax,QWORD[8+r9*1+rsi] adc rdx,0 mov rdi,rdx mul rbx add r11,rax mov rax,QWORD[8+rcx] adc rdx,0 add r11,QWORD[8+r14] adc rdx,0 mov r10,rdx mul rbp add rdi,rax mov rax,QWORD[16+r9*1+rsi] adc rdx,0 add rdi,r11 lea r15,[32+r9] lea rcx,[32+rcx] adc rdx,0 mov r13,rdx jmp NEAR $L$inner4x ALIGN 32 $L$inner4x: mul rbx add r10,rax mov rax,QWORD[((-16))+rcx] adc rdx,0 add r10,QWORD[16+r14] lea r14,[32+r14] adc rdx,0 mov r11,rdx mul rbp add r13,rax mov rax,QWORD[((-8))+r15*1+rsi] adc rdx,0 add r13,r10 adc rdx,0 mov QWORD[((-32))+r14],rdi mov rdi,rdx mul rbx add r11,rax mov rax,QWORD[((-8))+rcx] adc rdx,0 add r11,QWORD[((-8))+r14] adc rdx,0 mov r10,rdx mul rbp add rdi,rax mov rax,QWORD[r15*1+rsi] adc rdx,0 add rdi,r11 adc rdx,0 mov QWORD[((-24))+r14],r13 mov r13,rdx mul rbx add r10,rax mov rax,QWORD[rcx] adc rdx,0 add r10,QWORD[r14] adc rdx,0 mov r11,rdx mul rbp add r13,rax mov rax,QWORD[8+r15*1+rsi] adc rdx,0 add r13,r10 adc rdx,0 mov QWORD[((-16))+r14],rdi mov rdi,rdx mul rbx add r11,rax mov rax,QWORD[8+rcx] adc rdx,0 add r11,QWORD[8+r14] adc rdx,0 mov r10,rdx mul rbp add rdi,rax mov rax,QWORD[16+r15*1+rsi] adc rdx,0 add rdi,r11 lea rcx,[32+rcx] adc rdx,0 mov QWORD[((-8))+r14],r13 mov r13,rdx add r15,32 jnz NEAR $L$inner4x mul rbx add r10,rax mov rax,QWORD[((-16))+rcx] adc rdx,0 add r10,QWORD[16+r14] lea r14,[32+r14] adc rdx,0 mov r11,rdx mul rbp add r13,rax mov rax,QWORD[((-8))+rsi] adc rdx,0 add r13,r10 adc rdx,0 mov QWORD[((-32))+r14],rdi mov rdi,rdx mul rbx add r11,rax mov rax,rbp mov rbp,QWORD[((-8))+rcx] adc rdx,0 add r11,QWORD[((-8))+r14] adc rdx,0 mov r10,rdx mul rbp add rdi,rax mov rax,QWORD[r9*1+rsi] adc rdx,0 add rdi,r11 adc rdx,0 mov QWORD[((-24))+r14],r13 mov r13,rdx mov QWORD[((-16))+r14],rdi lea rcx,[r9*1+rcx] xor rdi,rdi add r13,r10 adc rdi,0 add r13,QWORD[r14] adc rdi,0 mov QWORD[((-8))+r14],r13 cmp r12,QWORD[((16+8))+rsp] jb NEAR $L$outer4x xor rax,rax sub rbp,r13 adc r15,r15 or rdi,r15 sub rax,rdi lea rbx,[r9*1+r14] mov r12,QWORD[rcx] lea rbp,[rcx] mov rcx,r9 sar rcx,3+2 mov rdi,QWORD[((56+8))+rsp] dec r12 xor r10,r10 mov r13,QWORD[8+rbp] mov r14,QWORD[16+rbp] mov r15,QWORD[24+rbp] jmp NEAR $L$sqr4x_sub_entry global GFp_bn_power5 ALIGN 32 GFp_bn_power5: mov QWORD[8+rsp],rdi ;WIN64 prologue mov QWORD[16+rsp],rsi mov rax,rsp $L$SEH_begin_GFp_bn_power5: mov rdi,rcx mov rsi,rdx mov rdx,r8 mov rcx,r9 mov r8,QWORD[40+rsp] mov r9,QWORD[48+rsp] mov rax,rsp lea r11,[GFp_ia32cap_P] mov r11d,DWORD[8+r11] and r11d,0x80108 cmp r11d,0x80108 je NEAR $L$powerx5_enter push rbx push rbp push r12 push r13 push r14 push r15 $L$power5_prologue: shl r9d,3 lea r10d,[r9*2+r9] neg r9 mov r8,QWORD[r8] lea r11,[((-320))+r9*2+rsp] mov rbp,rsp sub r11,rdi and r11,4095 cmp r10,r11 jb NEAR $L$pwr_sp_alt sub rbp,r11 lea rbp,[((-320))+r9*2+rbp] jmp NEAR $L$pwr_sp_done ALIGN 32 $L$pwr_sp_alt: lea r10,[((4096-320))+r9*2] lea rbp,[((-320))+r9*2+rbp] sub r11,r10 mov r10,0 cmovc r11,r10 sub rbp,r11 $L$pwr_sp_done: and rbp,-64 mov r11,rsp sub r11,rbp and r11,-4096 lea rsp,[rbp*1+r11] mov r10,QWORD[rsp] cmp rsp,rbp ja NEAR $L$pwr_page_walk jmp NEAR $L$pwr_page_walk_done $L$pwr_page_walk: lea rsp,[((-4096))+rsp] mov r10,QWORD[rsp] cmp rsp,rbp ja NEAR $L$pwr_page_walk $L$pwr_page_walk_done: mov r10,r9 neg r9 mov QWORD[32+rsp],r8 mov QWORD[40+rsp],rax $L$power5_body: DB 102,72,15,110,207 DB 102,72,15,110,209 DB 102,73,15,110,218 DB 102,72,15,110,226 call __bn_sqr8x_internal call __bn_post4x_internal call __bn_sqr8x_internal call __bn_post4x_internal call __bn_sqr8x_internal call __bn_post4x_internal call __bn_sqr8x_internal call __bn_post4x_internal call __bn_sqr8x_internal call __bn_post4x_internal DB 102,72,15,126,209 DB 102,72,15,126,226 mov rdi,rsi mov rax,QWORD[40+rsp] lea r8,[32+rsp] call mul4x_internal mov rsi,QWORD[40+rsp] mov rax,1 mov r15,QWORD[((-48))+rsi] mov r14,QWORD[((-40))+rsi] mov r13,QWORD[((-32))+rsi] mov r12,QWORD[((-24))+rsi] mov rbp,QWORD[((-16))+rsi] mov rbx,QWORD[((-8))+rsi] lea rsp,[rsi] $L$power5_epilogue: mov rdi,QWORD[8+rsp] ;WIN64 epilogue mov rsi,QWORD[16+rsp] DB 0F3h,0C3h ;repret $L$SEH_end_GFp_bn_power5: global GFp_bn_sqr8x_internal ALIGN 32 GFp_bn_sqr8x_internal: __bn_sqr8x_internal: lea rbp,[32+r10] lea rsi,[r9*1+rsi] mov rcx,r9 mov r14,QWORD[((-32))+rbp*1+rsi] lea rdi,[((48+8))+r9*2+rsp] mov rax,QWORD[((-24))+rbp*1+rsi] lea rdi,[((-32))+rbp*1+rdi] mov rbx,QWORD[((-16))+rbp*1+rsi] mov r15,rax mul r14 mov r10,rax mov rax,rbx mov r11,rdx mov QWORD[((-24))+rbp*1+rdi],r10 mul r14 add r11,rax mov rax,rbx adc rdx,0 mov QWORD[((-16))+rbp*1+rdi],r11 mov r10,rdx mov rbx,QWORD[((-8))+rbp*1+rsi] mul r15 mov r12,rax mov rax,rbx mov r13,rdx lea rcx,[rbp] mul r14 add r10,rax mov rax,rbx mov r11,rdx adc r11,0 add r10,r12 adc r11,0 mov QWORD[((-8))+rcx*1+rdi],r10 jmp NEAR $L$sqr4x_1st ALIGN 32 $L$sqr4x_1st: mov rbx,QWORD[rcx*1+rsi] mul r15 add r13,rax mov rax,rbx mov r12,rdx adc r12,0 mul r14 add r11,rax mov rax,rbx mov rbx,QWORD[8+rcx*1+rsi] mov r10,rdx adc r10,0 add r11,r13 adc r10,0 mul r15 add r12,rax mov rax,rbx mov QWORD[rcx*1+rdi],r11 mov r13,rdx adc r13,0 mul r14 add r10,rax mov rax,rbx mov rbx,QWORD[16+rcx*1+rsi] mov r11,rdx adc r11,0 add r10,r12 adc r11,0 mul r15 add r13,rax mov rax,rbx mov QWORD[8+rcx*1+rdi],r10 mov r12,rdx adc r12,0 mul r14 add r11,rax mov rax,rbx mov rbx,QWORD[24+rcx*1+rsi] mov r10,rdx adc r10,0 add r11,r13 adc r10,0 mul r15 add r12,rax mov rax,rbx mov QWORD[16+rcx*1+rdi],r11 mov r13,rdx adc r13,0 lea rcx,[32+rcx] mul r14 add r10,rax mov rax,rbx mov r11,rdx adc r11,0 add r10,r12 adc r11,0 mov QWORD[((-8))+rcx*1+rdi],r10 cmp rcx,0 jne NEAR $L$sqr4x_1st mul r15 add r13,rax lea rbp,[16+rbp] adc rdx,0 add r13,r11 adc rdx,0 mov QWORD[rdi],r13 mov r12,rdx mov QWORD[8+rdi],rdx jmp NEAR $L$sqr4x_outer ALIGN 32 $L$sqr4x_outer: mov r14,QWORD[((-32))+rbp*1+rsi] lea rdi,[((48+8))+r9*2+rsp] mov rax,QWORD[((-24))+rbp*1+rsi] lea rdi,[((-32))+rbp*1+rdi] mov rbx,QWORD[((-16))+rbp*1+rsi] mov r15,rax mul r14 mov r10,QWORD[((-24))+rbp*1+rdi] add r10,rax mov rax,rbx adc rdx,0 mov QWORD[((-24))+rbp*1+rdi],r10 mov r11,rdx mul r14 add r11,rax mov rax,rbx adc rdx,0 add r11,QWORD[((-16))+rbp*1+rdi] mov r10,rdx adc r10,0 mov QWORD[((-16))+rbp*1+rdi],r11 xor r12,r12 mov rbx,QWORD[((-8))+rbp*1+rsi] mul r15 add r12,rax mov rax,rbx adc rdx,0 add r12,QWORD[((-8))+rbp*1+rdi] mov r13,rdx adc r13,0 mul r14 add r10,rax mov rax,rbx adc rdx,0 add r10,r12 mov r11,rdx adc r11,0 mov QWORD[((-8))+rbp*1+rdi],r10 lea rcx,[rbp] jmp NEAR $L$sqr4x_inner ALIGN 32 $L$sqr4x_inner: mov rbx,QWORD[rcx*1+rsi] mul r15 add r13,rax mov rax,rbx mov r12,rdx adc r12,0 add r13,QWORD[rcx*1+rdi] adc r12,0 DB 0x67 mul r14 add r11,rax mov rax,rbx mov rbx,QWORD[8+rcx*1+rsi] mov r10,rdx adc r10,0 add r11,r13 adc r10,0 mul r15 add r12,rax mov QWORD[rcx*1+rdi],r11 mov rax,rbx mov r13,rdx adc r13,0 add r12,QWORD[8+rcx*1+rdi] lea rcx,[16+rcx] adc r13,0 mul r14 add r10,rax mov rax,rbx adc rdx,0 add r10,r12 mov r11,rdx adc r11,0 mov QWORD[((-8))+rcx*1+rdi],r10 cmp rcx,0 jne NEAR $L$sqr4x_inner DB 0x67 mul r15 add r13,rax adc rdx,0 add r13,r11 adc rdx,0 mov QWORD[rdi],r13 mov r12,rdx mov QWORD[8+rdi],rdx add rbp,16 jnz NEAR $L$sqr4x_outer mov r14,QWORD[((-32))+rsi] lea rdi,[((48+8))+r9*2+rsp] mov rax,QWORD[((-24))+rsi] lea rdi,[((-32))+rbp*1+rdi] mov rbx,QWORD[((-16))+rsi] mov r15,rax mul r14 add r10,rax mov rax,rbx mov r11,rdx adc r11,0 mul r14 add r11,rax mov rax,rbx mov QWORD[((-24))+rdi],r10 mov r10,rdx adc r10,0 add r11,r13 mov rbx,QWORD[((-8))+rsi] adc r10,0 mul r15 add r12,rax mov rax,rbx mov QWORD[((-16))+rdi],r11 mov r13,rdx adc r13,0 mul r14 add r10,rax mov rax,rbx mov r11,rdx adc r11,0 add r10,r12 adc r11,0 mov QWORD[((-8))+rdi],r10 mul r15 add r13,rax mov rax,QWORD[((-16))+rsi] adc rdx,0 add r13,r11 adc rdx,0 mov QWORD[rdi],r13 mov r12,rdx mov QWORD[8+rdi],rdx mul rbx add rbp,16 xor r14,r14 sub rbp,r9 xor r15,r15 add rax,r12 adc rdx,0 mov QWORD[8+rdi],rax mov QWORD[16+rdi],rdx mov QWORD[24+rdi],r15 mov rax,QWORD[((-16))+rbp*1+rsi] lea rdi,[((48+8))+rsp] xor r10,r10 mov r11,QWORD[8+rdi] lea r12,[r10*2+r14] shr r10,63 lea r13,[r11*2+rcx] shr r11,63 or r13,r10 mov r10,QWORD[16+rdi] mov r14,r11 mul rax neg r15 mov r11,QWORD[24+rdi] adc r12,rax mov rax,QWORD[((-8))+rbp*1+rsi] mov QWORD[rdi],r12 adc r13,rdx lea rbx,[r10*2+r14] mov QWORD[8+rdi],r13 sbb r15,r15 shr r10,63 lea r8,[r11*2+rcx] shr r11,63 or r8,r10 mov r10,QWORD[32+rdi] mov r14,r11 mul rax neg r15 mov r11,QWORD[40+rdi] adc rbx,rax mov rax,QWORD[rbp*1+rsi] mov QWORD[16+rdi],rbx adc r8,rdx lea rbp,[16+rbp] mov QWORD[24+rdi],r8 sbb r15,r15 lea rdi,[64+rdi] jmp NEAR $L$sqr4x_shift_n_add ALIGN 32 $L$sqr4x_shift_n_add: lea r12,[r10*2+r14] shr r10,63 lea r13,[r11*2+rcx] shr r11,63 or r13,r10 mov r10,QWORD[((-16))+rdi] mov r14,r11 mul rax neg r15 mov r11,QWORD[((-8))+rdi] adc r12,rax mov rax,QWORD[((-8))+rbp*1+rsi] mov QWORD[((-32))+rdi],r12 adc r13,rdx lea rbx,[r10*2+r14] mov QWORD[((-24))+rdi],r13 sbb r15,r15 shr r10,63 lea r8,[r11*2+rcx] shr r11,63 or r8,r10 mov r10,QWORD[rdi] mov r14,r11 mul rax neg r15 mov r11,QWORD[8+rdi] adc rbx,rax mov rax,QWORD[rbp*1+rsi] mov QWORD[((-16))+rdi],rbx adc r8,rdx lea r12,[r10*2+r14] mov QWORD[((-8))+rdi],r8 sbb r15,r15 shr r10,63 lea r13,[r11*2+rcx] shr r11,63 or r13,r10 mov r10,QWORD[16+rdi] mov r14,r11 mul rax neg r15 mov r11,QWORD[24+rdi] adc r12,rax mov rax,QWORD[8+rbp*1+rsi] mov QWORD[rdi],r12 adc r13,rdx lea rbx,[r10*2+r14] mov QWORD[8+rdi],r13 sbb r15,r15 shr r10,63 lea r8,[r11*2+rcx] shr r11,63 or r8,r10 mov r10,QWORD[32+rdi] mov r14,r11 mul rax neg r15 mov r11,QWORD[40+rdi] adc rbx,rax mov rax,QWORD[16+rbp*1+rsi] mov QWORD[16+rdi],rbx adc r8,rdx mov QWORD[24+rdi],r8 sbb r15,r15 lea rdi,[64+rdi] add rbp,32 jnz NEAR $L$sqr4x_shift_n_add lea r12,[r10*2+r14] DB 0x67 shr r10,63 lea r13,[r11*2+rcx] shr r11,63 or r13,r10 mov r10,QWORD[((-16))+rdi] mov r14,r11 mul rax neg r15 mov r11,QWORD[((-8))+rdi] adc r12,rax mov rax,QWORD[((-8))+rsi] mov QWORD[((-32))+rdi],r12 adc r13,rdx lea rbx,[r10*2+r14] mov QWORD[((-24))+rdi],r13 sbb r15,r15 shr r10,63 lea r8,[r11*2+rcx] shr r11,63 or r8,r10 mul rax neg r15 adc rbx,rax adc r8,rdx mov QWORD[((-16))+rdi],rbx mov QWORD[((-8))+rdi],r8 DB 102,72,15,126,213 __bn_sqr8x_reduction: xor rax,rax lea rcx,[rbp*1+r9] lea rdx,[((48+8))+r9*2+rsp] mov QWORD[((0+8))+rsp],rcx lea rdi,[((48+8))+r9*1+rsp] mov QWORD[((8+8))+rsp],rdx neg r9 jmp NEAR $L$8x_reduction_loop ALIGN 32 $L$8x_reduction_loop: lea rdi,[r9*1+rdi] DB 0x66 mov rbx,QWORD[rdi] mov r9,QWORD[8+rdi] mov r10,QWORD[16+rdi] mov r11,QWORD[24+rdi] mov r12,QWORD[32+rdi] mov r13,QWORD[40+rdi] mov r14,QWORD[48+rdi] mov r15,QWORD[56+rdi] mov QWORD[rdx],rax lea rdi,[64+rdi] DB 0x67 mov r8,rbx imul rbx,QWORD[((32+8))+rsp] mov rax,QWORD[rbp] mov ecx,8 jmp NEAR $L$8x_reduce ALIGN 32 $L$8x_reduce: mul rbx mov rax,QWORD[8+rbp] neg r8 mov r8,rdx adc r8,0 mul rbx add r9,rax mov rax,QWORD[16+rbp] adc rdx,0 add r8,r9 mov QWORD[((48-8+8))+rcx*8+rsp],rbx mov r9,rdx adc r9,0 mul rbx add r10,rax mov rax,QWORD[24+rbp] adc rdx,0 add r9,r10 mov rsi,QWORD[((32+8))+rsp] mov r10,rdx adc r10,0 mul rbx add r11,rax mov rax,QWORD[32+rbp] adc rdx,0 imul rsi,r8 add r10,r11 mov r11,rdx adc r11,0 mul rbx add r12,rax mov rax,QWORD[40+rbp] adc rdx,0 add r11,r12 mov r12,rdx adc r12,0 mul rbx add r13,rax mov rax,QWORD[48+rbp] adc rdx,0 add r12,r13 mov r13,rdx adc r13,0 mul rbx add r14,rax mov rax,QWORD[56+rbp] adc rdx,0 add r13,r14 mov r14,rdx adc r14,0 mul rbx mov rbx,rsi add r15,rax mov rax,QWORD[rbp] adc rdx,0 add r14,r15 mov r15,rdx adc r15,0 dec ecx jnz NEAR $L$8x_reduce lea rbp,[64+rbp] xor rax,rax mov rdx,QWORD[((8+8))+rsp] cmp rbp,QWORD[((0+8))+rsp] jae NEAR $L$8x_no_tail DB 0x66 add r8,QWORD[rdi] adc r9,QWORD[8+rdi] adc r10,QWORD[16+rdi] adc r11,QWORD[24+rdi] adc r12,QWORD[32+rdi] adc r13,QWORD[40+rdi] adc r14,QWORD[48+rdi] adc r15,QWORD[56+rdi] sbb rsi,rsi mov rbx,QWORD[((48+56+8))+rsp] mov ecx,8 mov rax,QWORD[rbp] jmp NEAR $L$8x_tail ALIGN 32 $L$8x_tail: mul rbx add r8,rax mov rax,QWORD[8+rbp] mov QWORD[rdi],r8 mov r8,rdx adc r8,0 mul rbx add r9,rax mov rax,QWORD[16+rbp] adc rdx,0 add r8,r9 lea rdi,[8+rdi] mov r9,rdx adc r9,0 mul rbx add r10,rax mov rax,QWORD[24+rbp] adc rdx,0 add r9,r10 mov r10,rdx adc r10,0 mul rbx add r11,rax mov rax,QWORD[32+rbp] adc rdx,0 add r10,r11 mov r11,rdx adc r11,0 mul rbx add r12,rax mov rax,QWORD[40+rbp] adc rdx,0 add r11,r12 mov r12,rdx adc r12,0 mul rbx add r13,rax mov rax,QWORD[48+rbp] adc rdx,0 add r12,r13 mov r13,rdx adc r13,0 mul rbx add r14,rax mov rax,QWORD[56+rbp] adc rdx,0 add r13,r14 mov r14,rdx adc r14,0 mul rbx mov rbx,QWORD[((48-16+8))+rcx*8+rsp] add r15,rax adc rdx,0 add r14,r15 mov rax,QWORD[rbp] mov r15,rdx adc r15,0 dec ecx jnz NEAR $L$8x_tail lea rbp,[64+rbp] mov rdx,QWORD[((8+8))+rsp] cmp rbp,QWORD[((0+8))+rsp] jae NEAR $L$8x_tail_done mov rbx,QWORD[((48+56+8))+rsp] neg rsi mov rax,QWORD[rbp] adc r8,QWORD[rdi] adc r9,QWORD[8+rdi] adc r10,QWORD[16+rdi] adc r11,QWORD[24+rdi] adc r12,QWORD[32+rdi] adc r13,QWORD[40+rdi] adc r14,QWORD[48+rdi] adc r15,QWORD[56+rdi] sbb rsi,rsi mov ecx,8 jmp NEAR $L$8x_tail ALIGN 32 $L$8x_tail_done: xor rax,rax add r8,QWORD[rdx] adc r9,0 adc r10,0 adc r11,0 adc r12,0 adc r13,0 adc r14,0 adc r15,0 adc rax,0 neg rsi $L$8x_no_tail: adc r8,QWORD[rdi] adc r9,QWORD[8+rdi] adc r10,QWORD[16+rdi] adc r11,QWORD[24+rdi] adc r12,QWORD[32+rdi] adc r13,QWORD[40+rdi] adc r14,QWORD[48+rdi] adc r15,QWORD[56+rdi] adc rax,0 mov rcx,QWORD[((-8))+rbp] xor rsi,rsi DB 102,72,15,126,213 mov QWORD[rdi],r8 mov QWORD[8+rdi],r9 DB 102,73,15,126,217 mov QWORD[16+rdi],r10 mov QWORD[24+rdi],r11 mov QWORD[32+rdi],r12 mov QWORD[40+rdi],r13 mov QWORD[48+rdi],r14 mov QWORD[56+rdi],r15 lea rdi,[64+rdi] cmp rdi,rdx jb NEAR $L$8x_reduction_loop DB 0F3h,0C3h ;repret ALIGN 32 __bn_post4x_internal: mov r12,QWORD[rbp] lea rbx,[r9*1+rdi] mov rcx,r9 DB 102,72,15,126,207 neg rax DB 102,72,15,126,206 sar rcx,3+2 dec r12 xor r10,r10 mov r13,QWORD[8+rbp] mov r14,QWORD[16+rbp] mov r15,QWORD[24+rbp] jmp NEAR $L$sqr4x_sub_entry ALIGN 16 $L$sqr4x_sub: mov r12,QWORD[rbp] mov r13,QWORD[8+rbp] mov r14,QWORD[16+rbp] mov r15,QWORD[24+rbp] $L$sqr4x_sub_entry: lea rbp,[32+rbp] not r12 not r13 not r14 not r15 and r12,rax and r13,rax and r14,rax and r15,rax neg r10 adc r12,QWORD[rbx] adc r13,QWORD[8+rbx] adc r14,QWORD[16+rbx] adc r15,QWORD[24+rbx] mov QWORD[rdi],r12 lea rbx,[32+rbx] mov QWORD[8+rdi],r13 sbb r10,r10 mov QWORD[16+rdi],r14 mov QWORD[24+rdi],r15 lea rdi,[32+rdi] inc rcx jnz NEAR $L$sqr4x_sub mov r10,r9 neg r9 DB 0F3h,0C3h ;repret global GFp_bn_from_montgomery ALIGN 32 GFp_bn_from_montgomery: test DWORD[48+rsp],7 jz NEAR bn_from_mont8x xor eax,eax DB 0F3h,0C3h ;repret ALIGN 32 bn_from_mont8x: mov QWORD[8+rsp],rdi ;WIN64 prologue mov QWORD[16+rsp],rsi mov rax,rsp $L$SEH_begin_bn_from_mont8x: mov rdi,rcx mov rsi,rdx mov rdx,r8 mov rcx,r9 mov r8,QWORD[40+rsp] mov r9,QWORD[48+rsp] DB 0x67 mov rax,rsp push rbx push rbp push r12 push r13 push r14 push r15 $L$from_prologue: shl r9d,3 lea r10,[r9*2+r9] neg r9 mov r8,QWORD[r8] lea r11,[((-320))+r9*2+rsp] mov rbp,rsp sub r11,rdi and r11,4095 cmp r10,r11 jb NEAR $L$from_sp_alt sub rbp,r11 lea rbp,[((-320))+r9*2+rbp] jmp NEAR $L$from_sp_done ALIGN 32 $L$from_sp_alt: lea r10,[((4096-320))+r9*2] lea rbp,[((-320))+r9*2+rbp] sub r11,r10 mov r10,0 cmovc r11,r10 sub rbp,r11 $L$from_sp_done: and rbp,-64 mov r11,rsp sub r11,rbp and r11,-4096 lea rsp,[rbp*1+r11] mov r10,QWORD[rsp] cmp rsp,rbp ja NEAR $L$from_page_walk jmp NEAR $L$from_page_walk_done $L$from_page_walk: lea rsp,[((-4096))+rsp] mov r10,QWORD[rsp] cmp rsp,rbp ja NEAR $L$from_page_walk $L$from_page_walk_done: mov r10,r9 neg r9 mov QWORD[32+rsp],r8 mov QWORD[40+rsp],rax $L$from_body: mov r11,r9 lea rax,[48+rsp] pxor xmm0,xmm0 jmp NEAR $L$mul_by_1 ALIGN 32 $L$mul_by_1: movdqu xmm1,XMMWORD[rsi] movdqu xmm2,XMMWORD[16+rsi] movdqu xmm3,XMMWORD[32+rsi] movdqa XMMWORD[r9*1+rax],xmm0 movdqu xmm4,XMMWORD[48+rsi] movdqa XMMWORD[16+r9*1+rax],xmm0 DB 0x48,0x8d,0xb6,0x40,0x00,0x00,0x00 movdqa XMMWORD[rax],xmm1 movdqa XMMWORD[32+r9*1+rax],xmm0 movdqa XMMWORD[16+rax],xmm2 movdqa XMMWORD[48+r9*1+rax],xmm0 movdqa XMMWORD[32+rax],xmm3 movdqa XMMWORD[48+rax],xmm4 lea rax,[64+rax] sub r11,64 jnz NEAR $L$mul_by_1 DB 102,72,15,110,207 DB 102,72,15,110,209 DB 0x67 mov rbp,rcx DB 102,73,15,110,218 lea r11,[GFp_ia32cap_P] mov r11d,DWORD[8+r11] and r11d,0x80108 cmp r11d,0x80108 jne NEAR $L$from_mont_nox lea rdi,[r9*1+rax] call __bn_sqrx8x_reduction call __bn_postx4x_internal pxor xmm0,xmm0 lea rax,[48+rsp] jmp NEAR $L$from_mont_zero ALIGN 32 $L$from_mont_nox: call __bn_sqr8x_reduction call __bn_post4x_internal pxor xmm0,xmm0 lea rax,[48+rsp] jmp NEAR $L$from_mont_zero ALIGN 32 $L$from_mont_zero: mov rsi,QWORD[40+rsp] movdqa XMMWORD[rax],xmm0 movdqa XMMWORD[16+rax],xmm0 movdqa XMMWORD[32+rax],xmm0 movdqa XMMWORD[48+rax],xmm0 lea rax,[64+rax] sub r9,32 jnz NEAR $L$from_mont_zero mov rax,1 mov r15,QWORD[((-48))+rsi] mov r14,QWORD[((-40))+rsi] mov r13,QWORD[((-32))+rsi] mov r12,QWORD[((-24))+rsi] mov rbp,QWORD[((-16))+rsi] mov rbx,QWORD[((-8))+rsi] lea rsp,[rsi] $L$from_epilogue: mov rdi,QWORD[8+rsp] ;WIN64 epilogue mov rsi,QWORD[16+rsp] DB 0F3h,0C3h ;repret $L$SEH_end_bn_from_mont8x: ALIGN 32 bn_mulx4x_mont_gather5: mov QWORD[8+rsp],rdi ;WIN64 prologue mov QWORD[16+rsp],rsi mov rax,rsp $L$SEH_begin_bn_mulx4x_mont_gather5: mov rdi,rcx mov rsi,rdx mov rdx,r8 mov rcx,r9 mov r8,QWORD[40+rsp] mov r9,QWORD[48+rsp] mov rax,rsp $L$mulx4x_enter: push rbx push rbp push r12 push r13 push r14 push r15 $L$mulx4x_prologue: shl r9d,3 lea r10,[r9*2+r9] neg r9 mov r8,QWORD[r8] lea r11,[((-320))+r9*2+rsp] mov rbp,rsp sub r11,rdi and r11,4095 cmp r10,r11 jb NEAR $L$mulx4xsp_alt sub rbp,r11 lea rbp,[((-320))+r9*2+rbp] jmp NEAR $L$mulx4xsp_done $L$mulx4xsp_alt: lea r10,[((4096-320))+r9*2] lea rbp,[((-320))+r9*2+rbp] sub r11,r10 mov r10,0 cmovc r11,r10 sub rbp,r11 $L$mulx4xsp_done: and rbp,-64 mov r11,rsp sub r11,rbp and r11,-4096 lea rsp,[rbp*1+r11] mov r10,QWORD[rsp] cmp rsp,rbp ja NEAR $L$mulx4x_page_walk jmp NEAR $L$mulx4x_page_walk_done $L$mulx4x_page_walk: lea rsp,[((-4096))+rsp] mov r10,QWORD[rsp] cmp rsp,rbp ja NEAR $L$mulx4x_page_walk $L$mulx4x_page_walk_done: mov QWORD[32+rsp],r8 mov QWORD[40+rsp],rax $L$mulx4x_body: call mulx4x_internal mov rsi,QWORD[40+rsp] mov rax,1 mov r15,QWORD[((-48))+rsi] mov r14,QWORD[((-40))+rsi] mov r13,QWORD[((-32))+rsi] mov r12,QWORD[((-24))+rsi] mov rbp,QWORD[((-16))+rsi] mov rbx,QWORD[((-8))+rsi] lea rsp,[rsi] $L$mulx4x_epilogue: mov rdi,QWORD[8+rsp] ;WIN64 epilogue mov rsi,QWORD[16+rsp] DB 0F3h,0C3h ;repret $L$SEH_end_bn_mulx4x_mont_gather5: ALIGN 32 mulx4x_internal: mov QWORD[8+rsp],r9 mov r10,r9 neg r9 shl r9,5 neg r10 lea r13,[128+r9*1+rdx] shr r9,5+5 movd xmm5,DWORD[56+rax] sub r9,1 lea rax,[$L$inc] mov QWORD[((16+8))+rsp],r13 mov QWORD[((24+8))+rsp],r9 mov QWORD[((56+8))+rsp],rdi movdqa xmm0,XMMWORD[rax] movdqa xmm1,XMMWORD[16+rax] lea r10,[((88-112))+r10*1+rsp] lea rdi,[128+rdx] pshufd xmm5,xmm5,0 movdqa xmm4,xmm1 DB 0x67 movdqa xmm2,xmm1 DB 0x67 paddd xmm1,xmm0 pcmpeqd xmm0,xmm5 movdqa xmm3,xmm4 paddd xmm2,xmm1 pcmpeqd xmm1,xmm5 movdqa XMMWORD[112+r10],xmm0 movdqa xmm0,xmm4 paddd xmm3,xmm2 pcmpeqd xmm2,xmm5 movdqa XMMWORD[128+r10],xmm1 movdqa xmm1,xmm4 paddd xmm0,xmm3 pcmpeqd xmm3,xmm5 movdqa XMMWORD[144+r10],xmm2 movdqa xmm2,xmm4 paddd xmm1,xmm0 pcmpeqd xmm0,xmm5 movdqa XMMWORD[160+r10],xmm3 movdqa xmm3,xmm4 paddd xmm2,xmm1 pcmpeqd xmm1,xmm5 movdqa XMMWORD[176+r10],xmm0 movdqa xmm0,xmm4 paddd xmm3,xmm2 pcmpeqd xmm2,xmm5 movdqa XMMWORD[192+r10],xmm1 movdqa xmm1,xmm4 paddd xmm0,xmm3 pcmpeqd xmm3,xmm5 movdqa XMMWORD[208+r10],xmm2 movdqa xmm2,xmm4 paddd xmm1,xmm0 pcmpeqd xmm0,xmm5 movdqa XMMWORD[224+r10],xmm3 movdqa xmm3,xmm4 paddd xmm2,xmm1 pcmpeqd xmm1,xmm5 movdqa XMMWORD[240+r10],xmm0 movdqa xmm0,xmm4 paddd xmm3,xmm2 pcmpeqd xmm2,xmm5 movdqa XMMWORD[256+r10],xmm1 movdqa xmm1,xmm4 paddd xmm0,xmm3 pcmpeqd xmm3,xmm5 movdqa XMMWORD[272+r10],xmm2 movdqa xmm2,xmm4 paddd xmm1,xmm0 pcmpeqd xmm0,xmm5 movdqa XMMWORD[288+r10],xmm3 movdqa xmm3,xmm4 DB 0x67 paddd xmm2,xmm1 pcmpeqd xmm1,xmm5 movdqa XMMWORD[304+r10],xmm0 paddd xmm3,xmm2 pcmpeqd xmm2,xmm5 movdqa XMMWORD[320+r10],xmm1 pcmpeqd xmm3,xmm5 movdqa XMMWORD[336+r10],xmm2 pand xmm0,XMMWORD[64+rdi] pand xmm1,XMMWORD[80+rdi] pand xmm2,XMMWORD[96+rdi] movdqa XMMWORD[352+r10],xmm3 pand xmm3,XMMWORD[112+rdi] por xmm0,xmm2 por xmm1,xmm3 movdqa xmm4,XMMWORD[((-128))+rdi] movdqa xmm5,XMMWORD[((-112))+rdi] movdqa xmm2,XMMWORD[((-96))+rdi] pand xmm4,XMMWORD[112+r10] movdqa xmm3,XMMWORD[((-80))+rdi] pand xmm5,XMMWORD[128+r10] por xmm0,xmm4 pand xmm2,XMMWORD[144+r10] por xmm1,xmm5 pand xmm3,XMMWORD[160+r10] por xmm0,xmm2 por xmm1,xmm3 movdqa xmm4,XMMWORD[((-64))+rdi] movdqa xmm5,XMMWORD[((-48))+rdi] movdqa xmm2,XMMWORD[((-32))+rdi] pand xmm4,XMMWORD[176+r10] movdqa xmm3,XMMWORD[((-16))+rdi] pand xmm5,XMMWORD[192+r10] por xmm0,xmm4 pand xmm2,XMMWORD[208+r10] por xmm1,xmm5 pand xmm3,XMMWORD[224+r10] por xmm0,xmm2 por xmm1,xmm3 movdqa xmm4,XMMWORD[rdi] movdqa xmm5,XMMWORD[16+rdi] movdqa xmm2,XMMWORD[32+rdi] pand xmm4,XMMWORD[240+r10] movdqa xmm3,XMMWORD[48+rdi] pand xmm5,XMMWORD[256+r10] por xmm0,xmm4 pand xmm2,XMMWORD[272+r10] por xmm1,xmm5 pand xmm3,XMMWORD[288+r10] por xmm0,xmm2 por xmm1,xmm3 pxor xmm0,xmm1 pshufd xmm1,xmm0,0x4e por xmm0,xmm1 lea rdi,[256+rdi] DB 102,72,15,126,194 lea rbx,[((64+32+8))+rsp] mov r9,rdx mulx rax,r8,QWORD[rsi] mulx r12,r11,QWORD[8+rsi] add r11,rax mulx r13,rax,QWORD[16+rsi] adc r12,rax adc r13,0 mulx r14,rax,QWORD[24+rsi] mov r15,r8 imul r8,QWORD[((32+8))+rsp] xor rbp,rbp mov rdx,r8 mov QWORD[((8+8))+rsp],rdi lea rsi,[32+rsi] adcx r13,rax adcx r14,rbp mulx r10,rax,QWORD[rcx] adcx r15,rax adox r10,r11 mulx r11,rax,QWORD[8+rcx] adcx r10,rax adox r11,r12 mulx r12,rax,QWORD[16+rcx] mov rdi,QWORD[((24+8))+rsp] mov QWORD[((-32))+rbx],r10 adcx r11,rax adox r12,r13 mulx r15,rax,QWORD[24+rcx] mov rdx,r9 mov QWORD[((-24))+rbx],r11 adcx r12,rax adox r15,rbp lea rcx,[32+rcx] mov QWORD[((-16))+rbx],r12 jmp NEAR $L$mulx4x_1st ALIGN 32 $L$mulx4x_1st: adcx r15,rbp mulx rax,r10,QWORD[rsi] adcx r10,r14 mulx r14,r11,QWORD[8+rsi] adcx r11,rax mulx rax,r12,QWORD[16+rsi] adcx r12,r14 mulx r14,r13,QWORD[24+rsi] DB 0x67,0x67 mov rdx,r8 adcx r13,rax adcx r14,rbp lea rsi,[32+rsi] lea rbx,[32+rbx] adox r10,r15 mulx r15,rax,QWORD[rcx] adcx r10,rax adox r11,r15 mulx r15,rax,QWORD[8+rcx] adcx r11,rax adox r12,r15 mulx r15,rax,QWORD[16+rcx] mov QWORD[((-40))+rbx],r10 adcx r12,rax mov QWORD[((-32))+rbx],r11 adox r13,r15 mulx r15,rax,QWORD[24+rcx] mov rdx,r9 mov QWORD[((-24))+rbx],r12 adcx r13,rax adox r15,rbp lea rcx,[32+rcx] mov QWORD[((-16))+rbx],r13 dec rdi jnz NEAR $L$mulx4x_1st mov rax,QWORD[8+rsp] adc r15,rbp lea rsi,[rax*1+rsi] add r14,r15 mov rdi,QWORD[((8+8))+rsp] adc rbp,rbp mov QWORD[((-8))+rbx],r14 jmp NEAR $L$mulx4x_outer ALIGN 32 $L$mulx4x_outer: lea r10,[((16-256))+rbx] pxor xmm4,xmm4 DB 0x67,0x67 pxor xmm5,xmm5 movdqa xmm0,XMMWORD[((-128))+rdi] movdqa xmm1,XMMWORD[((-112))+rdi] movdqa xmm2,XMMWORD[((-96))+rdi] pand xmm0,XMMWORD[256+r10] movdqa xmm3,XMMWORD[((-80))+rdi] pand xmm1,XMMWORD[272+r10] por xmm4,xmm0 pand xmm2,XMMWORD[288+r10] por xmm5,xmm1 pand xmm3,XMMWORD[304+r10] por xmm4,xmm2 por xmm5,xmm3 movdqa xmm0,XMMWORD[((-64))+rdi] movdqa xmm1,XMMWORD[((-48))+rdi] movdqa xmm2,XMMWORD[((-32))+rdi] pand xmm0,XMMWORD[320+r10] movdqa xmm3,XMMWORD[((-16))+rdi] pand xmm1,XMMWORD[336+r10] por xmm4,xmm0 pand xmm2,XMMWORD[352+r10] por xmm5,xmm1 pand xmm3,XMMWORD[368+r10] por xmm4,xmm2 por xmm5,xmm3 movdqa xmm0,XMMWORD[rdi] movdqa xmm1,XMMWORD[16+rdi] movdqa xmm2,XMMWORD[32+rdi] pand xmm0,XMMWORD[384+r10] movdqa xmm3,XMMWORD[48+rdi] pand xmm1,XMMWORD[400+r10] por xmm4,xmm0 pand xmm2,XMMWORD[416+r10] por xmm5,xmm1 pand xmm3,XMMWORD[432+r10] por xmm4,xmm2 por xmm5,xmm3 movdqa xmm0,XMMWORD[64+rdi] movdqa xmm1,XMMWORD[80+rdi] movdqa xmm2,XMMWORD[96+rdi] pand xmm0,XMMWORD[448+r10] movdqa xmm3,XMMWORD[112+rdi] pand xmm1,XMMWORD[464+r10] por xmm4,xmm0 pand xmm2,XMMWORD[480+r10] por xmm5,xmm1 pand xmm3,XMMWORD[496+r10] por xmm4,xmm2 por xmm5,xmm3 por xmm4,xmm5 pshufd xmm0,xmm4,0x4e por xmm0,xmm4 lea rdi,[256+rdi] DB 102,72,15,126,194 mov QWORD[rbx],rbp lea rbx,[32+rax*1+rbx] mulx r11,r8,QWORD[rsi] xor rbp,rbp mov r9,rdx mulx r12,r14,QWORD[8+rsi] adox r8,QWORD[((-32))+rbx] adcx r11,r14 mulx r13,r15,QWORD[16+rsi] adox r11,QWORD[((-24))+rbx] adcx r12,r15 mulx r14,rdx,QWORD[24+rsi] adox r12,QWORD[((-16))+rbx] adcx r13,rdx lea rcx,[rax*1+rcx] lea rsi,[32+rsi] adox r13,QWORD[((-8))+rbx] adcx r14,rbp adox r14,rbp mov r15,r8 imul r8,QWORD[((32+8))+rsp] mov rdx,r8 xor rbp,rbp mov QWORD[((8+8))+rsp],rdi mulx r10,rax,QWORD[rcx] adcx r15,rax adox r10,r11 mulx r11,rax,QWORD[8+rcx] adcx r10,rax adox r11,r12 mulx r12,rax,QWORD[16+rcx] adcx r11,rax adox r12,r13 mulx r15,rax,QWORD[24+rcx] mov rdx,r9 mov rdi,QWORD[((24+8))+rsp] mov QWORD[((-32))+rbx],r10 adcx r12,rax mov QWORD[((-24))+rbx],r11 adox r15,rbp mov QWORD[((-16))+rbx],r12 lea rcx,[32+rcx] jmp NEAR $L$mulx4x_inner ALIGN 32 $L$mulx4x_inner: mulx rax,r10,QWORD[rsi] adcx r15,rbp adox r10,r14 mulx r14,r11,QWORD[8+rsi] adcx r10,QWORD[rbx] adox r11,rax mulx rax,r12,QWORD[16+rsi] adcx r11,QWORD[8+rbx] adox r12,r14 mulx r14,r13,QWORD[24+rsi] mov rdx,r8 adcx r12,QWORD[16+rbx] adox r13,rax adcx r13,QWORD[24+rbx] adox r14,rbp lea rsi,[32+rsi] lea rbx,[32+rbx] adcx r14,rbp adox r10,r15 mulx r15,rax,QWORD[rcx] adcx r10,rax adox r11,r15 mulx r15,rax,QWORD[8+rcx] adcx r11,rax adox r12,r15 mulx r15,rax,QWORD[16+rcx] mov QWORD[((-40))+rbx],r10 adcx r12,rax adox r13,r15 mov QWORD[((-32))+rbx],r11 mulx r15,rax,QWORD[24+rcx] mov rdx,r9 lea rcx,[32+rcx] mov QWORD[((-24))+rbx],r12 adcx r13,rax adox r15,rbp mov QWORD[((-16))+rbx],r13 dec rdi jnz NEAR $L$mulx4x_inner mov rax,QWORD[((0+8))+rsp] adc r15,rbp sub rdi,QWORD[rbx] mov rdi,QWORD[((8+8))+rsp] mov r10,QWORD[((16+8))+rsp] adc r14,r15 lea rsi,[rax*1+rsi] adc rbp,rbp mov QWORD[((-8))+rbx],r14 cmp rdi,r10 jb NEAR $L$mulx4x_outer mov r10,QWORD[((-8))+rcx] mov r8,rbp mov r12,QWORD[rax*1+rcx] lea rbp,[rax*1+rcx] mov rcx,rax lea rdi,[rax*1+rbx] xor eax,eax xor r15,r15 sub r10,r14 adc r15,r15 or r8,r15 sar rcx,3+2 sub rax,r8 mov rdx,QWORD[((56+8))+rsp] dec r12 mov r13,QWORD[8+rbp] xor r8,r8 mov r14,QWORD[16+rbp] mov r15,QWORD[24+rbp] jmp NEAR $L$sqrx4x_sub_entry ALIGN 32 bn_powerx5: mov QWORD[8+rsp],rdi ;WIN64 prologue mov QWORD[16+rsp],rsi mov rax,rsp $L$SEH_begin_bn_powerx5: mov rdi,rcx mov rsi,rdx mov rdx,r8 mov rcx,r9 mov r8,QWORD[40+rsp] mov r9,QWORD[48+rsp] mov rax,rsp $L$powerx5_enter: push rbx push rbp push r12 push r13 push r14 push r15 $L$powerx5_prologue: shl r9d,3 lea r10,[r9*2+r9] neg r9 mov r8,QWORD[r8] lea r11,[((-320))+r9*2+rsp] mov rbp,rsp sub r11,rdi and r11,4095 cmp r10,r11 jb NEAR $L$pwrx_sp_alt sub rbp,r11 lea rbp,[((-320))+r9*2+rbp] jmp NEAR $L$pwrx_sp_done ALIGN 32 $L$pwrx_sp_alt: lea r10,[((4096-320))+r9*2] lea rbp,[((-320))+r9*2+rbp] sub r11,r10 mov r10,0 cmovc r11,r10 sub rbp,r11 $L$pwrx_sp_done: and rbp,-64 mov r11,rsp sub r11,rbp and r11,-4096 lea rsp,[rbp*1+r11] mov r10,QWORD[rsp] cmp rsp,rbp ja NEAR $L$pwrx_page_walk jmp NEAR $L$pwrx_page_walk_done $L$pwrx_page_walk: lea rsp,[((-4096))+rsp] mov r10,QWORD[rsp] cmp rsp,rbp ja NEAR $L$pwrx_page_walk $L$pwrx_page_walk_done: mov r10,r9 neg r9 pxor xmm0,xmm0 DB 102,72,15,110,207 DB 102,72,15,110,209 DB 102,73,15,110,218 DB 102,72,15,110,226 mov QWORD[32+rsp],r8 mov QWORD[40+rsp],rax $L$powerx5_body: call __bn_sqrx8x_internal call __bn_postx4x_internal call __bn_sqrx8x_internal call __bn_postx4x_internal call __bn_sqrx8x_internal call __bn_postx4x_internal call __bn_sqrx8x_internal call __bn_postx4x_internal call __bn_sqrx8x_internal call __bn_postx4x_internal mov r9,r10 mov rdi,rsi DB 102,72,15,126,209 DB 102,72,15,126,226 mov rax,QWORD[40+rsp] call mulx4x_internal mov rsi,QWORD[40+rsp] mov rax,1 mov r15,QWORD[((-48))+rsi] mov r14,QWORD[((-40))+rsi] mov r13,QWORD[((-32))+rsi] mov r12,QWORD[((-24))+rsi] mov rbp,QWORD[((-16))+rsi] mov rbx,QWORD[((-8))+rsi] lea rsp,[rsi] $L$powerx5_epilogue: mov rdi,QWORD[8+rsp] ;WIN64 epilogue mov rsi,QWORD[16+rsp] DB 0F3h,0C3h ;repret $L$SEH_end_bn_powerx5: global GFp_bn_sqrx8x_internal ALIGN 32 GFp_bn_sqrx8x_internal: __bn_sqrx8x_internal: lea rdi,[((48+8))+rsp] lea rbp,[r9*1+rsi] mov QWORD[((0+8))+rsp],r9 mov QWORD[((8+8))+rsp],rbp jmp NEAR $L$sqr8x_zero_start ALIGN 32 DB 0x66,0x66,0x66,0x2e,0x0f,0x1f,0x84,0x00,0x00,0x00,0x00,0x00 $L$sqrx8x_zero: DB 0x3e movdqa XMMWORD[rdi],xmm0 movdqa XMMWORD[16+rdi],xmm0 movdqa XMMWORD[32+rdi],xmm0 movdqa XMMWORD[48+rdi],xmm0 $L$sqr8x_zero_start: movdqa XMMWORD[64+rdi],xmm0 movdqa XMMWORD[80+rdi],xmm0 movdqa XMMWORD[96+rdi],xmm0 movdqa XMMWORD[112+rdi],xmm0 lea rdi,[128+rdi] sub r9,64 jnz NEAR $L$sqrx8x_zero mov rdx,QWORD[rsi] xor r10,r10 xor r11,r11 xor r12,r12 xor r13,r13 xor r14,r14 xor r15,r15 lea rdi,[((48+8))+rsp] xor rbp,rbp jmp NEAR $L$sqrx8x_outer_loop ALIGN 32 $L$sqrx8x_outer_loop: mulx rax,r8,QWORD[8+rsi] adcx r8,r9 adox r10,rax mulx rax,r9,QWORD[16+rsi] adcx r9,r10 adox r11,rax DB 0xc4,0xe2,0xab,0xf6,0x86,0x18,0x00,0x00,0x00 adcx r10,r11 adox r12,rax DB 0xc4,0xe2,0xa3,0xf6,0x86,0x20,0x00,0x00,0x00 adcx r11,r12 adox r13,rax mulx rax,r12,QWORD[40+rsi] adcx r12,r13 adox r14,rax mulx rax,r13,QWORD[48+rsi] adcx r13,r14 adox rax,r15 mulx r15,r14,QWORD[56+rsi] mov rdx,QWORD[8+rsi] adcx r14,rax adox r15,rbp adc r15,QWORD[64+rdi] mov QWORD[8+rdi],r8 mov QWORD[16+rdi],r9 sbb rcx,rcx xor rbp,rbp mulx rbx,r8,QWORD[16+rsi] mulx rax,r9,QWORD[24+rsi] adcx r8,r10 adox r9,rbx mulx rbx,r10,QWORD[32+rsi] adcx r9,r11 adox r10,rax DB 0xc4,0xe2,0xa3,0xf6,0x86,0x28,0x00,0x00,0x00 adcx r10,r12 adox r11,rbx DB 0xc4,0xe2,0x9b,0xf6,0x9e,0x30,0x00,0x00,0x00 adcx r11,r13 adox r12,r14 DB 0xc4,0x62,0x93,0xf6,0xb6,0x38,0x00,0x00,0x00 mov rdx,QWORD[16+rsi] adcx r12,rax adox r13,rbx adcx r13,r15 adox r14,rbp adcx r14,rbp mov QWORD[24+rdi],r8 mov QWORD[32+rdi],r9 mulx rbx,r8,QWORD[24+rsi] mulx rax,r9,QWORD[32+rsi] adcx r8,r10 adox r9,rbx mulx rbx,r10,QWORD[40+rsi] adcx r9,r11 adox r10,rax DB 0xc4,0xe2,0xa3,0xf6,0x86,0x30,0x00,0x00,0x00 adcx r10,r12 adox r11,r13 DB 0xc4,0x62,0x9b,0xf6,0xae,0x38,0x00,0x00,0x00 DB 0x3e mov rdx,QWORD[24+rsi] adcx r11,rbx adox r12,rax adcx r12,r14 mov QWORD[40+rdi],r8 mov QWORD[48+rdi],r9 mulx rax,r8,QWORD[32+rsi] adox r13,rbp adcx r13,rbp mulx rbx,r9,QWORD[40+rsi] adcx r8,r10 adox r9,rax mulx rax,r10,QWORD[48+rsi] adcx r9,r11 adox r10,r12 mulx r12,r11,QWORD[56+rsi] mov rdx,QWORD[32+rsi] mov r14,QWORD[40+rsi] adcx r10,rbx adox r11,rax mov r15,QWORD[48+rsi] adcx r11,r13 adox r12,rbp adcx r12,rbp mov QWORD[56+rdi],r8 mov QWORD[64+rdi],r9 mulx rax,r9,r14 mov r8,QWORD[56+rsi] adcx r9,r10 mulx rbx,r10,r15 adox r10,rax adcx r10,r11 mulx rax,r11,r8 mov rdx,r14 adox r11,rbx adcx r11,r12 adcx rax,rbp mulx rbx,r14,r15 mulx r13,r12,r8 mov rdx,r15 lea rsi,[64+rsi] adcx r11,r14 adox r12,rbx adcx r12,rax adox r13,rbp DB 0x67,0x67 mulx r14,r8,r8 adcx r13,r8 adcx r14,rbp cmp rsi,QWORD[((8+8))+rsp] je NEAR $L$sqrx8x_outer_break neg rcx mov rcx,-8 mov r15,rbp mov r8,QWORD[64+rdi] adcx r9,QWORD[72+rdi] adcx r10,QWORD[80+rdi] adcx r11,QWORD[88+rdi] adc r12,QWORD[96+rdi] adc r13,QWORD[104+rdi] adc r14,QWORD[112+rdi] adc r15,QWORD[120+rdi] lea rbp,[rsi] lea rdi,[128+rdi] sbb rax,rax mov rdx,QWORD[((-64))+rsi] mov QWORD[((16+8))+rsp],rax mov QWORD[((24+8))+rsp],rdi xor eax,eax jmp NEAR $L$sqrx8x_loop ALIGN 32 $L$sqrx8x_loop: mov rbx,r8 mulx r8,rax,QWORD[rbp] adcx rbx,rax adox r8,r9 mulx r9,rax,QWORD[8+rbp] adcx r8,rax adox r9,r10 mulx r10,rax,QWORD[16+rbp] adcx r9,rax adox r10,r11 mulx r11,rax,QWORD[24+rbp] adcx r10,rax adox r11,r12 DB 0xc4,0x62,0xfb,0xf6,0xa5,0x20,0x00,0x00,0x00 adcx r11,rax adox r12,r13 mulx r13,rax,QWORD[40+rbp] adcx r12,rax adox r13,r14 mulx r14,rax,QWORD[48+rbp] mov QWORD[rcx*8+rdi],rbx mov ebx,0 adcx r13,rax adox r14,r15 DB 0xc4,0x62,0xfb,0xf6,0xbd,0x38,0x00,0x00,0x00 mov rdx,QWORD[8+rcx*8+rsi] adcx r14,rax adox r15,rbx adcx r15,rbx DB 0x67 inc rcx jnz NEAR $L$sqrx8x_loop lea rbp,[64+rbp] mov rcx,-8 cmp rbp,QWORD[((8+8))+rsp] je NEAR $L$sqrx8x_break sub rbx,QWORD[((16+8))+rsp] DB 0x66 mov rdx,QWORD[((-64))+rsi] adcx r8,QWORD[rdi] adcx r9,QWORD[8+rdi] adc r10,QWORD[16+rdi] adc r11,QWORD[24+rdi] adc r12,QWORD[32+rdi] adc r13,QWORD[40+rdi] adc r14,QWORD[48+rdi] adc r15,QWORD[56+rdi] lea rdi,[64+rdi] DB 0x67 sbb rax,rax xor ebx,ebx mov QWORD[((16+8))+rsp],rax jmp NEAR $L$sqrx8x_loop ALIGN 32 $L$sqrx8x_break: xor rbp,rbp sub rbx,QWORD[((16+8))+rsp] adcx r8,rbp mov rcx,QWORD[((24+8))+rsp] adcx r9,rbp mov rdx,QWORD[rsi] adc r10,0 mov QWORD[rdi],r8 adc r11,0 adc r12,0 adc r13,0 adc r14,0 adc r15,0 cmp rdi,rcx je NEAR $L$sqrx8x_outer_loop mov QWORD[8+rdi],r9 mov r9,QWORD[8+rcx] mov QWORD[16+rdi],r10 mov r10,QWORD[16+rcx] mov QWORD[24+rdi],r11 mov r11,QWORD[24+rcx] mov QWORD[32+rdi],r12 mov r12,QWORD[32+rcx] mov QWORD[40+rdi],r13 mov r13,QWORD[40+rcx] mov QWORD[48+rdi],r14 mov r14,QWORD[48+rcx] mov QWORD[56+rdi],r15 mov r15,QWORD[56+rcx] mov rdi,rcx jmp NEAR $L$sqrx8x_outer_loop ALIGN 32 $L$sqrx8x_outer_break: mov QWORD[72+rdi],r9 DB 102,72,15,126,217 mov QWORD[80+rdi],r10 mov QWORD[88+rdi],r11 mov QWORD[96+rdi],r12 mov QWORD[104+rdi],r13 mov QWORD[112+rdi],r14 lea rdi,[((48+8))+rsp] mov rdx,QWORD[rcx*1+rsi] mov r11,QWORD[8+rdi] xor r10,r10 mov r9,QWORD[((0+8))+rsp] adox r11,r11 mov r12,QWORD[16+rdi] mov r13,QWORD[24+rdi] ALIGN 32 $L$sqrx4x_shift_n_add: mulx rbx,rax,rdx adox r12,r12 adcx rax,r10 DB 0x48,0x8b,0x94,0x0e,0x08,0x00,0x00,0x00 DB 0x4c,0x8b,0x97,0x20,0x00,0x00,0x00 adox r13,r13 adcx rbx,r11 mov r11,QWORD[40+rdi] mov QWORD[rdi],rax mov QWORD[8+rdi],rbx mulx rbx,rax,rdx adox r10,r10 adcx rax,r12 mov rdx,QWORD[16+rcx*1+rsi] mov r12,QWORD[48+rdi] adox r11,r11 adcx rbx,r13 mov r13,QWORD[56+rdi] mov QWORD[16+rdi],rax mov QWORD[24+rdi],rbx mulx rbx,rax,rdx adox r12,r12 adcx rax,r10 mov rdx,QWORD[24+rcx*1+rsi] lea rcx,[32+rcx] mov r10,QWORD[64+rdi] adox r13,r13 adcx rbx,r11 mov r11,QWORD[72+rdi] mov QWORD[32+rdi],rax mov QWORD[40+rdi],rbx mulx rbx,rax,rdx adox r10,r10 adcx rax,r12 jrcxz $L$sqrx4x_shift_n_add_break DB 0x48,0x8b,0x94,0x0e,0x00,0x00,0x00,0x00 adox r11,r11 adcx rbx,r13 mov r12,QWORD[80+rdi] mov r13,QWORD[88+rdi] mov QWORD[48+rdi],rax mov QWORD[56+rdi],rbx lea rdi,[64+rdi] nop jmp NEAR $L$sqrx4x_shift_n_add ALIGN 32 $L$sqrx4x_shift_n_add_break: adcx rbx,r13 mov QWORD[48+rdi],rax mov QWORD[56+rdi],rbx lea rdi,[64+rdi] DB 102,72,15,126,213 __bn_sqrx8x_reduction: xor eax,eax mov rbx,QWORD[((32+8))+rsp] mov rdx,QWORD[((48+8))+rsp] lea rcx,[((-64))+r9*1+rbp] mov QWORD[((0+8))+rsp],rcx mov QWORD[((8+8))+rsp],rdi lea rdi,[((48+8))+rsp] jmp NEAR $L$sqrx8x_reduction_loop ALIGN 32 $L$sqrx8x_reduction_loop: mov r9,QWORD[8+rdi] mov r10,QWORD[16+rdi] mov r11,QWORD[24+rdi] mov r12,QWORD[32+rdi] mov r8,rdx imul rdx,rbx mov r13,QWORD[40+rdi] mov r14,QWORD[48+rdi] mov r15,QWORD[56+rdi] mov QWORD[((24+8))+rsp],rax lea rdi,[64+rdi] xor rsi,rsi mov rcx,-8 jmp NEAR $L$sqrx8x_reduce ALIGN 32 $L$sqrx8x_reduce: mov rbx,r8 mulx r8,rax,QWORD[rbp] adcx rax,rbx adox r8,r9 mulx r9,rbx,QWORD[8+rbp] adcx r8,rbx adox r9,r10 mulx r10,rbx,QWORD[16+rbp] adcx r9,rbx adox r10,r11 mulx r11,rbx,QWORD[24+rbp] adcx r10,rbx adox r11,r12 DB 0xc4,0x62,0xe3,0xf6,0xa5,0x20,0x00,0x00,0x00 mov rax,rdx mov rdx,r8 adcx r11,rbx adox r12,r13 mulx rdx,rbx,QWORD[((32+8))+rsp] mov rdx,rax mov QWORD[((64+48+8))+rcx*8+rsp],rax mulx r13,rax,QWORD[40+rbp] adcx r12,rax adox r13,r14 mulx r14,rax,QWORD[48+rbp] adcx r13,rax adox r14,r15 mulx r15,rax,QWORD[56+rbp] mov rdx,rbx adcx r14,rax adox r15,rsi adcx r15,rsi DB 0x67,0x67,0x67 inc rcx jnz NEAR $L$sqrx8x_reduce mov rax,rsi cmp rbp,QWORD[((0+8))+rsp] jae NEAR $L$sqrx8x_no_tail mov rdx,QWORD[((48+8))+rsp] add r8,QWORD[rdi] lea rbp,[64+rbp] mov rcx,-8 adcx r9,QWORD[8+rdi] adcx r10,QWORD[16+rdi] adc r11,QWORD[24+rdi] adc r12,QWORD[32+rdi] adc r13,QWORD[40+rdi] adc r14,QWORD[48+rdi] adc r15,QWORD[56+rdi] lea rdi,[64+rdi] sbb rax,rax xor rsi,rsi mov QWORD[((16+8))+rsp],rax jmp NEAR $L$sqrx8x_tail ALIGN 32 $L$sqrx8x_tail: mov rbx,r8 mulx r8,rax,QWORD[rbp] adcx rbx,rax adox r8,r9 mulx r9,rax,QWORD[8+rbp] adcx r8,rax adox r9,r10 mulx r10,rax,QWORD[16+rbp] adcx r9,rax adox r10,r11 mulx r11,rax,QWORD[24+rbp] adcx r10,rax adox r11,r12 DB 0xc4,0x62,0xfb,0xf6,0xa5,0x20,0x00,0x00,0x00 adcx r11,rax adox r12,r13 mulx r13,rax,QWORD[40+rbp] adcx r12,rax adox r13,r14 mulx r14,rax,QWORD[48+rbp] adcx r13,rax adox r14,r15 mulx r15,rax,QWORD[56+rbp] mov rdx,QWORD[((72+48+8))+rcx*8+rsp] adcx r14,rax adox r15,rsi mov QWORD[rcx*8+rdi],rbx mov rbx,r8 adcx r15,rsi inc rcx jnz NEAR $L$sqrx8x_tail cmp rbp,QWORD[((0+8))+rsp] jae NEAR $L$sqrx8x_tail_done sub rsi,QWORD[((16+8))+rsp] mov rdx,QWORD[((48+8))+rsp] lea rbp,[64+rbp] adc r8,QWORD[rdi] adc r9,QWORD[8+rdi] adc r10,QWORD[16+rdi] adc r11,QWORD[24+rdi] adc r12,QWORD[32+rdi] adc r13,QWORD[40+rdi] adc r14,QWORD[48+rdi] adc r15,QWORD[56+rdi] lea rdi,[64+rdi] sbb rax,rax sub rcx,8 xor rsi,rsi mov QWORD[((16+8))+rsp],rax jmp NEAR $L$sqrx8x_tail ALIGN 32 $L$sqrx8x_tail_done: xor rax,rax add r8,QWORD[((24+8))+rsp] adc r9,0 adc r10,0 adc r11,0 adc r12,0 adc r13,0 adc r14,0 adc r15,0 adc rax,0 sub rsi,QWORD[((16+8))+rsp] $L$sqrx8x_no_tail: adc r8,QWORD[rdi] DB 102,72,15,126,217 adc r9,QWORD[8+rdi] mov rsi,QWORD[56+rbp] DB 102,72,15,126,213 adc r10,QWORD[16+rdi] adc r11,QWORD[24+rdi] adc r12,QWORD[32+rdi] adc r13,QWORD[40+rdi] adc r14,QWORD[48+rdi] adc r15,QWORD[56+rdi] adc rax,0 mov rbx,QWORD[((32+8))+rsp] mov rdx,QWORD[64+rcx*1+rdi] mov QWORD[rdi],r8 lea r8,[64+rdi] mov QWORD[8+rdi],r9 mov QWORD[16+rdi],r10 mov QWORD[24+rdi],r11 mov QWORD[32+rdi],r12 mov QWORD[40+rdi],r13 mov QWORD[48+rdi],r14 mov QWORD[56+rdi],r15 lea rdi,[64+rcx*1+rdi] cmp r8,QWORD[((8+8))+rsp] jb NEAR $L$sqrx8x_reduction_loop DB 0F3h,0C3h ;repret ALIGN 32 __bn_postx4x_internal: mov r12,QWORD[rbp] mov r10,rcx mov r9,rcx neg rax sar rcx,3+2 DB 102,72,15,126,202 DB 102,72,15,126,206 dec r12 mov r13,QWORD[8+rbp] xor r8,r8 mov r14,QWORD[16+rbp] mov r15,QWORD[24+rbp] jmp NEAR $L$sqrx4x_sub_entry ALIGN 16 $L$sqrx4x_sub: mov r12,QWORD[rbp] mov r13,QWORD[8+rbp] mov r14,QWORD[16+rbp] mov r15,QWORD[24+rbp] $L$sqrx4x_sub_entry: andn r12,r12,rax lea rbp,[32+rbp] andn r13,r13,rax andn r14,r14,rax andn r15,r15,rax neg r8 adc r12,QWORD[rdi] adc r13,QWORD[8+rdi] adc r14,QWORD[16+rdi] adc r15,QWORD[24+rdi] mov QWORD[rdx],r12 lea rdi,[32+rdi] mov QWORD[8+rdx],r13 sbb r8,r8 mov QWORD[16+rdx],r14 mov QWORD[24+rdx],r15 lea rdx,[32+rdx] inc rcx jnz NEAR $L$sqrx4x_sub neg r9 DB 0F3h,0C3h ;repret global GFp_bn_scatter5 ALIGN 16 GFp_bn_scatter5: cmp edx,0 jz NEAR $L$scatter_epilogue lea r8,[r9*8+r8] $L$scatter: mov rax,QWORD[rcx] lea rcx,[8+rcx] mov QWORD[r8],rax lea r8,[256+r8] sub edx,1 jnz NEAR $L$scatter $L$scatter_epilogue: DB 0F3h,0C3h ;repret global GFp_bn_gather5 ALIGN 32 GFp_bn_gather5: $L$SEH_begin_GFp_bn_gather5: DB 0x4c,0x8d,0x14,0x24 DB 0x48,0x81,0xec,0x08,0x01,0x00,0x00 lea rax,[$L$inc] and rsp,-16 movd xmm5,r9d movdqa xmm0,XMMWORD[rax] movdqa xmm1,XMMWORD[16+rax] lea r11,[128+r8] lea rax,[128+rsp] pshufd xmm5,xmm5,0 movdqa xmm4,xmm1 movdqa xmm2,xmm1 paddd xmm1,xmm0 pcmpeqd xmm0,xmm5 movdqa xmm3,xmm4 paddd xmm2,xmm1 pcmpeqd xmm1,xmm5 movdqa XMMWORD[(-128)+rax],xmm0 movdqa xmm0,xmm4 paddd xmm3,xmm2 pcmpeqd xmm2,xmm5 movdqa XMMWORD[(-112)+rax],xmm1 movdqa xmm1,xmm4 paddd xmm0,xmm3 pcmpeqd xmm3,xmm5 movdqa XMMWORD[(-96)+rax],xmm2 movdqa xmm2,xmm4 paddd xmm1,xmm0 pcmpeqd xmm0,xmm5 movdqa XMMWORD[(-80)+rax],xmm3 movdqa xmm3,xmm4 paddd xmm2,xmm1 pcmpeqd xmm1,xmm5 movdqa XMMWORD[(-64)+rax],xmm0 movdqa xmm0,xmm4 paddd xmm3,xmm2 pcmpeqd xmm2,xmm5 movdqa XMMWORD[(-48)+rax],xmm1 movdqa xmm1,xmm4 paddd xmm0,xmm3 pcmpeqd xmm3,xmm5 movdqa XMMWORD[(-32)+rax],xmm2 movdqa xmm2,xmm4 paddd xmm1,xmm0 pcmpeqd xmm0,xmm5 movdqa XMMWORD[(-16)+rax],xmm3 movdqa xmm3,xmm4 paddd xmm2,xmm1 pcmpeqd xmm1,xmm5 movdqa XMMWORD[rax],xmm0 movdqa xmm0,xmm4 paddd xmm3,xmm2 pcmpeqd xmm2,xmm5 movdqa XMMWORD[16+rax],xmm1 movdqa xmm1,xmm4 paddd xmm0,xmm3 pcmpeqd xmm3,xmm5 movdqa XMMWORD[32+rax],xmm2 movdqa xmm2,xmm4 paddd xmm1,xmm0 pcmpeqd xmm0,xmm5 movdqa XMMWORD[48+rax],xmm3 movdqa xmm3,xmm4 paddd xmm2,xmm1 pcmpeqd xmm1,xmm5 movdqa XMMWORD[64+rax],xmm0 movdqa xmm0,xmm4 paddd xmm3,xmm2 pcmpeqd xmm2,xmm5 movdqa XMMWORD[80+rax],xmm1 movdqa xmm1,xmm4 paddd xmm0,xmm3 pcmpeqd xmm3,xmm5 movdqa XMMWORD[96+rax],xmm2 movdqa xmm2,xmm4 movdqa XMMWORD[112+rax],xmm3 jmp NEAR $L$gather ALIGN 32 $L$gather: pxor xmm4,xmm4 pxor xmm5,xmm5 movdqa xmm0,XMMWORD[((-128))+r11] movdqa xmm1,XMMWORD[((-112))+r11] movdqa xmm2,XMMWORD[((-96))+r11] pand xmm0,XMMWORD[((-128))+rax] movdqa xmm3,XMMWORD[((-80))+r11] pand xmm1,XMMWORD[((-112))+rax] por xmm4,xmm0 pand xmm2,XMMWORD[((-96))+rax] por xmm5,xmm1 pand xmm3,XMMWORD[((-80))+rax] por xmm4,xmm2 por xmm5,xmm3 movdqa xmm0,XMMWORD[((-64))+r11] movdqa xmm1,XMMWORD[((-48))+r11] movdqa xmm2,XMMWORD[((-32))+r11] pand xmm0,XMMWORD[((-64))+rax] movdqa xmm3,XMMWORD[((-16))+r11] pand xmm1,XMMWORD[((-48))+rax] por xmm4,xmm0 pand xmm2,XMMWORD[((-32))+rax] por xmm5,xmm1 pand xmm3,XMMWORD[((-16))+rax] por xmm4,xmm2 por xmm5,xmm3 movdqa xmm0,XMMWORD[r11] movdqa xmm1,XMMWORD[16+r11] movdqa xmm2,XMMWORD[32+r11] pand xmm0,XMMWORD[rax] movdqa xmm3,XMMWORD[48+r11] pand xmm1,XMMWORD[16+rax] por xmm4,xmm0 pand xmm2,XMMWORD[32+rax] por xmm5,xmm1 pand xmm3,XMMWORD[48+rax] por xmm4,xmm2 por xmm5,xmm3 movdqa xmm0,XMMWORD[64+r11] movdqa xmm1,XMMWORD[80+r11] movdqa xmm2,XMMWORD[96+r11] pand xmm0,XMMWORD[64+rax] movdqa xmm3,XMMWORD[112+r11] pand xmm1,XMMWORD[80+rax] por xmm4,xmm0 pand xmm2,XMMWORD[96+rax] por xmm5,xmm1 pand xmm3,XMMWORD[112+rax] por xmm4,xmm2 por xmm5,xmm3 por xmm4,xmm5 lea r11,[256+r11] pshufd xmm0,xmm4,0x4e por xmm0,xmm4 movq QWORD[rcx],xmm0 lea rcx,[8+rcx] sub edx,1 jnz NEAR $L$gather lea rsp,[r10] DB 0F3h,0C3h ;repret $L$SEH_end_GFp_bn_gather5: ALIGN 64 $L$inc: DD 0,0,1,1 DD 2,2,2,2 DB 77,111,110,116,103,111,109,101,114,121,32,77,117,108,116,105 DB 112,108,105,99,97,116,105,111,110,32,119,105,116,104,32,115 DB 99,97,116,116,101,114,47,103,97,116,104,101,114,32,102,111 DB 114,32,120,56,54,95,54,52,44,32,67,82,89,80,84,79 DB 71,65,77,83,32,98,121,32,60,97,112,112,114,111,64,111 DB 112,101,110,115,115,108,46,111,114,103,62,0 EXTERN __imp_RtlVirtualUnwind ALIGN 16 mul_handler: push rsi push rdi push rbx push rbp push r12 push r13 push r14 push r15 pushfq sub rsp,64 mov rax,QWORD[120+r8] mov rbx,QWORD[248+r8] mov rsi,QWORD[8+r9] mov r11,QWORD[56+r9] mov r10d,DWORD[r11] lea r10,[r10*1+rsi] cmp rbx,r10 jb NEAR $L$common_seh_tail mov r10d,DWORD[4+r11] lea r10,[r10*1+rsi] cmp rbx,r10 jb NEAR $L$common_pop_regs mov rax,QWORD[152+r8] mov r10d,DWORD[8+r11] lea r10,[r10*1+rsi] cmp rbx,r10 jae NEAR $L$common_seh_tail lea r10,[$L$mul_epilogue] cmp rbx,r10 ja NEAR $L$body_40 mov r10,QWORD[192+r8] mov rax,QWORD[8+r10*8+rax] jmp NEAR $L$common_pop_regs $L$body_40: mov rax,QWORD[40+rax] $L$common_pop_regs: mov rbx,QWORD[((-8))+rax] mov rbp,QWORD[((-16))+rax] mov r12,QWORD[((-24))+rax] mov r13,QWORD[((-32))+rax] mov r14,QWORD[((-40))+rax] mov r15,QWORD[((-48))+rax] mov QWORD[144+r8],rbx mov QWORD[160+r8],rbp mov QWORD[216+r8],r12 mov QWORD[224+r8],r13 mov QWORD[232+r8],r14 mov QWORD[240+r8],r15 $L$common_seh_tail: mov rdi,QWORD[8+rax] mov rsi,QWORD[16+rax] mov QWORD[152+r8],rax mov QWORD[168+r8],rsi mov QWORD[176+r8],rdi mov rdi,QWORD[40+r9] mov rsi,r8 mov ecx,154 DD 0xa548f3fc mov rsi,r9 xor rcx,rcx mov rdx,QWORD[8+rsi] mov r8,QWORD[rsi] mov r9,QWORD[16+rsi] mov r10,QWORD[40+rsi] lea r11,[56+rsi] lea r12,[24+rsi] mov QWORD[32+rsp],r10 mov QWORD[40+rsp],r11 mov QWORD[48+rsp],r12 mov QWORD[56+rsp],rcx call QWORD[__imp_RtlVirtualUnwind] mov eax,1 add rsp,64 popfq pop r15 pop r14 pop r13 pop r12 pop rbp pop rbx pop rdi pop rsi DB 0F3h,0C3h ;repret section .pdata rdata align=4 ALIGN 4 DD $L$SEH_begin_GFp_bn_mul_mont_gather5 wrt ..imagebase DD $L$SEH_end_GFp_bn_mul_mont_gather5 wrt ..imagebase DD $L$SEH_info_GFp_bn_mul_mont_gather5 wrt ..imagebase DD $L$SEH_begin_bn_mul4x_mont_gather5 wrt ..imagebase DD $L$SEH_end_bn_mul4x_mont_gather5 wrt ..imagebase DD $L$SEH_info_bn_mul4x_mont_gather5 wrt ..imagebase DD $L$SEH_begin_GFp_bn_power5 wrt ..imagebase DD $L$SEH_end_GFp_bn_power5 wrt ..imagebase DD $L$SEH_info_GFp_bn_power5 wrt ..imagebase DD $L$SEH_begin_bn_from_mont8x wrt ..imagebase DD $L$SEH_end_bn_from_mont8x wrt ..imagebase DD $L$SEH_info_bn_from_mont8x wrt ..imagebase DD $L$SEH_begin_bn_mulx4x_mont_gather5 wrt ..imagebase DD $L$SEH_end_bn_mulx4x_mont_gather5 wrt ..imagebase DD $L$SEH_info_bn_mulx4x_mont_gather5 wrt ..imagebase DD $L$SEH_begin_bn_powerx5 wrt ..imagebase DD $L$SEH_end_bn_powerx5 wrt ..imagebase DD $L$SEH_info_GFp_bn_powerx5 wrt ..imagebase DD $L$SEH_begin_GFp_bn_gather5 wrt ..imagebase DD $L$SEH_end_GFp_bn_gather5 wrt ..imagebase DD $L$SEH_info_GFp_bn_gather5 wrt ..imagebase section .xdata rdata align=8 ALIGN 8 $L$SEH_info_GFp_bn_mul_mont_gather5: DB 9,0,0,0 DD mul_handler wrt ..imagebase DD $L$mul_body wrt ..imagebase,$L$mul_body wrt ..imagebase,$L$mul_epilogue wrt ..imagebase ALIGN 8 $L$SEH_info_bn_mul4x_mont_gather5: DB 9,0,0,0 DD mul_handler wrt ..imagebase DD $L$mul4x_prologue wrt ..imagebase,$L$mul4x_body wrt ..imagebase,$L$mul4x_epilogue wrt ..imagebase ALIGN 8 $L$SEH_info_GFp_bn_power5: DB 9,0,0,0 DD mul_handler wrt ..imagebase DD $L$power5_prologue wrt ..imagebase,$L$power5_body wrt ..imagebase,$L$power5_epilogue wrt ..imagebase ALIGN 8 $L$SEH_info_bn_from_mont8x: DB 9,0,0,0 DD mul_handler wrt ..imagebase DD $L$from_prologue wrt ..imagebase,$L$from_body wrt ..imagebase,$L$from_epilogue wrt ..imagebase ALIGN 8 $L$SEH_info_bn_mulx4x_mont_gather5: DB 9,0,0,0 DD mul_handler wrt ..imagebase DD $L$mulx4x_prologue wrt ..imagebase,$L$mulx4x_body wrt ..imagebase,$L$mulx4x_epilogue wrt ..imagebase ALIGN 8 $L$SEH_info_GFp_bn_powerx5: DB 9,0,0,0 DD mul_handler wrt ..imagebase DD $L$powerx5_prologue wrt ..imagebase,$L$powerx5_body wrt ..imagebase,$L$powerx5_epilogue wrt ..imagebase ALIGN 8 $L$SEH_info_GFp_bn_gather5: DB 0x01,0x0b,0x03,0x0a DB 0x0b,0x01,0x21,0x00 DB 0x04,0xa3,0x00,0x00 ALIGN 8
; A083884: a(n) = (3^(2*n) + 1) / 2. ; 1,5,41,365,3281,29525,265721,2391485,21523361,193710245,1743392201,15690529805,141214768241,1270932914165,11438396227481,102945566047325,926510094425921,8338590849833285,75047317648499561,675425858836496045,6078832729528464401,54709494565756179605,492385451091805616441,4431469059826250547965,39883221538436254931681,358948993845926294385125,3230540944613336649466121,29074868501520029845195085,261673816513680268606755761,2355064348623122417460801845,21195579137608101757147216601,190760212238472915814324949405,1716841910146256242328924544641,15451577191316306180960320901765,139064194721846755628642888115881,1251577752496620800657785993042925,11264199772469587205920073937386321,101377797952226284853280665436476885,912400181570036563679525988928291961 mov $1,9 pow $1,$0 div $1,2 add $1,1 mov $0,$1
; A243514: Number of length n+2 0..5 arrays with no three elements in a row with pattern aba or abb (with a!=b) and new values 0..5 introduced in 0..5 order. ; 3,5,10,25,76,263,978,3773,14824,58771,234046,934121,3732372,14921279,59668714,238642069,954502720,3817879787,15271256982,61084503617,244336965868,977345766295,3909378870850,15637507094765,62550011601816,250200012852803,1000799984302318,4003199802991513 mov $1,$0 add $1,5 mov $2,1 mov $3,5 lpb $0 sub $0,1 mov $4,$2 mul $2,2 mul $4,$3 add $1,$4 add $3,$2 lpe sub $1,5 div $1,3 add $1,3
; Neurotic Mutation Engine v1.00 for Neuropath ; by MnemoniX 1994 engine proc near call randomize get_reg_1: mov ax,7 ; counter register call _random inc ax cmp al,4 je get_reg_1 cmp al,5 ja get_reg_1 mov ds:reg_1,al push di ; save this push ax call garbage_dump ; crap pop ax add al,0B8h ; store MOV instruction stosb mov ax,cx stosw call garbage_dump ; more crap mov al,0BFh stosb push di ; use this later stosw call garbage_dump ; even more crap mov ax,0F78Bh stosw push di ; use this later too call garbage_dump ; more crap mov al,0ADh ; a LODSW stosb call garbage_dump ; yet more crap mov al,2 call _random test al,al je add_it mov al,35h mov bl,al je decryptor add_it: mov al,5 mov bl,2Dh decryptor: stosb mov ds:encrypt_act,bl ; for encryption mov ax,-1 call _random stosw mov ds:encrypt_key,ax ; for encryption call garbage_dump ; just pilin' on the crap mov al,0ABh ; a STOSW stosb call garbage_dump ; the crap continues ... mov al,ds:reg_1 ; decrement counter add al,48h mov ah,9Ch ; and a PUSHF stosw call garbage_dump ; C-R-A-P ... mov ax,749Dh ; a POPF and JZ stosw mov ax,4 call _random ; use later mov bx,ax add al,3 stosb mov al,0E9h ; a JMP stosb pop ax ; use LODSW offset sub ax,di dec ax dec ax stosw add di,bx ; fix up DI pop bx ; now fix up offset value pop bp sub bp,di neg bp push bp ; size of decryptor - for l8r add bp,dx mov es:[bx],bp push cx push si mov si,offset one_byters ; swap one-byte instructions mov ax,7 ; around for variety call _random mov bx,ax mov al,7 call _random mov ah,[bx+si] mov bl,al mov [bx+si],ah pop si ; now we encrypt encrypt_it: lodsw encrypt_act db 0 encrypt_key dw 0 stosw loop encrypt_it pop cx pop dx add cx,dx ret reg_1 db 0 rnd_seed_1 dw 0 rnd_seed_2 dw 0 garbage_dump: mov ax,7 ; garbage instructions call _random add ax,5 push cx mov cx,ax dump_it: ; El Basurero - "The GarbageMan" mov ax,8 call _random cmp al,2 jb next_one je garbage_1 ; a MOV ??,AX cmp al,3 je garbage_2 ; operate ??,AX cmp al,4 je garbage_3 ; CMP or TEST AX/AL,?? cmp al,5 ; a few little instructions jae garbage_4 next_one: loop dump_it pop cx ret garbage_1: mov al,8Bh stosb call get_mov_reg shl ax,1 shl ax,1 shl ax,1 add al,0C0h stosb jmp next_one garbage_2: mov al,8 call _random shl ax,1 shl ax,1 shl ax,1 add al,3 stosb call get_mov_reg shl ax,1 shl ax,1 shl ax,1 add al,0C0h stosb jmp next_one garbage_3: mov al,2 call _random test al,al je a_cmp mov al,0A9h jmp storage a_cmp: mov al,3Dh storage: stosb mov ax,-1 call _random stosw jmp next_one garbage_4: push cx mov ax,4 call _random add ax,3 mov cx,ax push si mov bx,offset one_byters filler_loop: mov ax,8 call _random cmp al,7 je make_inc_dec mov si,ax mov al,[bx+si] proceed: stosb loop filler_loop pop si cx jmp next_one make_inc_dec: call get_mov_reg add al,40h jmp proceed get_mov_reg: mov ax,8 call _random test al,al je get_mov_reg cmp al,4 je get_mov_reg cmp al,5 ja get_mov_reg cmp al,reg_1 je get_mov_reg ret one_byters: db 0CCh stc clc cmc sti nop cld randomize: push cx dx xor ah,ah int 1Ah mov rnd_seed_1,dx add dx,cx mov rnd_seed_2,dx pop dx cx ret _random: push cx dx ax add dx,rnd_seed_2 add dx,17 mov ax,dx xor dx,dx test ax,ax je rnd_done pop cx div cx mov ax,dx ; AX now holds our random # rnd_done: mov dx,rnd_seed_1 add rnd_seed_2,dx pop dx cx ret engine endp
; A214630: a(n) is the reduced numerator of 1/4 - 1/A109043(n)^2 = (1 - 1/A026741(n)^2)/4. ; -1,0,0,2,3,6,2,12,15,20,6,30,35,42,12,56,63,72,20,90,99,110,30,132,143,156,42,182,195,210,56,240,255,272,72,306,323,342,90,380,399,420,110,462,483,506,132,552,575,600,156,650,675,702,182,756,783,812,210,870,899,930,240,992,1023,1056,272,1122,1155,1190,306,1260,1295,1332,342,1406,1443,1482,380,1560,1599,1640,420,1722,1763,1806,462,1892,1935,1980,506,2070,2115,2162,552,2256,2303,2352,600,2450,2499,2550,650,2652,2703,2756,702,2862,2915,2970,756,3080,3135,3192,812,3306,3363,3422,870,3540,3599,3660,930,3782,3843,3906,992,4032,4095,4160,1056,4290,4355,4422,1122,4556,4623,4692,1190,4830,4899,4970,1260,5112,5183,5256,1332,5402,5475,5550,1406,5700,5775,5852,1482,6006,6083,6162,1560,6320,6399,6480,1640,6642,6723,6806,1722,6972,7055,7140,1806,7310,7395,7482,1892,7656,7743,7832,1980,8010,8099,8190,2070,8372,8463,8556,2162,8742,8835,8930,2256,9120,9215,9312,2352,9506,9603,9702,2450,9900,9999,10100,2550,10302,10403,10506,2652,10712,10815,10920,2756,11130,11235,11342,2862,11556,11663,11772,2970,11990,12099,12210,3080,12432,12543,12656,3192,12882,12995,13110,3306,13340,13455,13572,3422,13806,13923,14042,3540,14280,14399,14520,3660,14762,14883,15006,3782,15252,15375,15500 pow $0,2 sub $0,1 mov $1,$0 lpb $0,1 mov $0,$1 div $1,4 lpb $0,1 sub $0,4 lpe lpe
// Expensive Calculator // Demonstrates built-in arithmetic operators #include <iostream> using namespace std; int main() { cout << "7 + 3 = " << 7 + 3 << endl; cout << "7 - 3 = " << 7 - 2 << endl; cout << "7 * 3 = " << 7 * 3 << endl; cout << "7 / 3 = " << 7 / 3 << endl; cout << "7.0 / 3.0 = " << 7.0 / 3.0 << endl; cout << "7 % 3 = " << 7 % 3 << endl; cout << "7 + 3 * 5 = " << 7 + 3 * 5 << endl; cout << "(7 + 3) * 5 = " << (7 + 3) * 5 << endl; return 0; }
# add test cases to data section # Test your code with different Network layouts # Don't assume that we will use the same layout in all our tests .data Name1: .asciiz "Cacophonix" Name2: .asciiz "Getafix" Name_prop: .asciiz "NAME" Network: .word 5 #total_nodes (bytes 0 - 3) .word 10 #total_edges (bytes 4- 7) .word 12 #size_of_node (bytes 8 - 11) .word 12 #size_of_edge (bytes 12 - 15) .word 4 #curr_num_of_nodes (bytes 16 - 19) .word 2 #curr_num_of_edges (bytes 20 - 23) .asciiz "NAME" # Name property (bytes 24 - 28) .asciiz "FRIEND" # FRIEND property (bytes 29 - 35) # nodes (bytes 36 - 95) .byte 't' 'i' 'm' 'm' 'y' 0 0 0 0 0 0 0 'J' 'o' 'h' 'n' ' ' 'D' 'o' 'e' 0 0 0 0 'A' 'l' 'i' ' ' 'T' 'o' 'u' 'r' 'r' 'e' 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 # set of edges (bytes 96 - 215) .word 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 .text: main: la $t0, Network addi $t1, $t0, 36 sw $t1, 96($t0) addi $t1, $t0, 72 sw $t1, 100($t0) addi $t1, $t0, 48 sw $t1, 108($t0) addi $t1, $t0, 72 sw $t1, 112($t0) #write test code la $a0, Network addi $a1, $a0, 72 addi $a2, $a0, 48 jal is_relation_exists move $a0, $v0 li $v0, 1 syscall li $v0, 10 syscall .include "hw4.asm"
// Copyright 2019 Google LLC // // 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 // // https://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 "iree/compiler/Dialect/Flow/Transforms/Passes.h" #include <memory> #include "iree/compiler/Conversion/HLOToLinalg/HLOToLinalgOnTensorPasses.h" #include "iree/compiler/Dialect/Shape/Conversion/Passes.h" #include "iree/compiler/Dialect/Shape/Transforms/Passes.h" #include "mlir-hlo/Dialect/mhlo/transforms/passes.h" #include "mlir/Conversion/TosaToLinalg/TosaToLinalg.h" #include "mlir/Dialect/Shape/Transforms/Passes.h" #include "mlir/Pass/PassOptions.h" #include "mlir/Pass/PassRegistry.h" #include "mlir/Transforms/Passes.h" static llvm::cl::opt<bool> clEnableLinalgOnTensorsDispatch( "iree-flow-dispatch-linalg-on-tensors", llvm::cl::desc( "Enable use of Linalg on tensors for dispatch region creation"), llvm::cl::init(false)); static llvm::cl::list<int64_t> clLinalgOnTensorsTileSizes( "iree-flow-dispatch-linalg-on-tensors-tile-sizes", llvm::cl::desc("Comma-separated list of tile sizes for tiling on tensors"), llvm::cl::CommaSeparated); // TODO(ravishankarm): Remove this option after addressing fusion. static llvm::cl::opt<bool> clLinalgOnTensorsEnableFusion( "iree-flow-dispatch-linalg-on-tensors-enable-fusion", llvm::cl::desc("Enable fusion on linalg on tensors path"), llvm::cl::init(false)); // TODO(benvanik): change to a pipeline option. static llvm::cl::opt<bool> clTraceDispatchTensors( "iree-flow-trace-dispatch-tensors2", llvm::cl::desc( "Trace runtime input/output tensors for each dispatch function"), llvm::cl::init(false)); namespace mlir { namespace iree_compiler { namespace IREE { namespace Flow { void buildFlowTransformPassPipeline(OpPassManager &passManager) { //---------------------------------------------------------------------------- // Input dialect sanitization and type legalization. // On completion: // - All ops remain at the input-dialect tensor-level. // - Loose shapex.get_ranked_shape ops can exist at points where dynamic // dims are required. //---------------------------------------------------------------------------- passManager.addPass(createCanonicalizerPass()); // Frontload linalg-on-tensors transformations and dispatch region creation. if (clEnableLinalgOnTensorsDispatch) { addHLOToLinalgOnTensorsPasses(passManager); passManager.addNestedPass<FuncOp>(createDispatchLinalgOnTensorsPass( clLinalgOnTensorsTileSizes, clLinalgOnTensorsEnableFusion)); } // Flatten structured control flow to our CFG. passManager.addNestedPass<FuncOp>(mhlo::createLegalizeControlFlowPass()); passManager.addNestedPass<FuncOp>(createHLOPreprocessingPass()); // Convert TOSA ops to Linalg-on-tensor ops. passManager.addNestedPass<FuncOp>(tosa::createTosaToLinalgOnTensors()); // Run passes to remove shape constraints. HLO lowering inserts them, but they // are not desired here. // // TODO(GH-2277): Lower HLO shape constraints instead of eliding them here. passManager.addNestedPass<FuncOp>(createRemoveShapeConstraintsPass()); passManager.addNestedPass<FuncOp>(createCanonicalizerPass()); // Convert `shape` dialect to `shapex` dialect. passManager.addPass(Shape::createConvertShapeToShapexPass()); // Flatten tuples (like tuple<tensor<...>, tensor<...>>) so we can do // fine-grained tensor tracking. passManager.addPass(IREE::Flow::createFlattenTuplesInCFGPass()); // Perform inlining and cleanup after CFG manipulation. passManager.addPass(createInlinerPass()); passManager.addNestedPass<FuncOp>(createCanonicalizerPass()); passManager.addNestedPass<FuncOp>(createCSEPass()); // Legalize input types. We do this after flattening tuples so that we don't // have to deal with them. // TODO(nicolasvasilache): createLegalizeInputTypesPass is old and does not // handle region conversion properly (parent cloned before children). Revisit // when using ops with regions such as scf.for and linalg.generic. if (!clEnableLinalgOnTensorsDispatch) { passManager.addPass(IREE::Flow::createLegalizeInputTypesPass()); } //---------------------------------------------------------------------------- // Shape and reflection ABI materialization. // Must happen after: // - Type conversion and sanitization of public function signatures // - Conversion to CFG // Must happen before: // - Dependencies on shape metadata ops // - Dependencies on reflection attributes //---------------------------------------------------------------------------- // Materialize default arg/result reflection metadata. // This pass must come before any 1:N type expansion that will not be retained // in the public ABI (i.e. loose shape dims, etc). passManager.addNestedPass<FuncOp>( IREE::Flow::createMaterializeExportedReflection()); // Materialize dynamic shapes in the IR, also expanding function signatures // such that: // - Dynamic ranked tensors: (tensor<?x?xf32>) expands to // (tensor<?x?xf32>, ranked_shape<[?,?]>), and ultimately expands to // (tensor<?x?xf32>, i32, i32) // - Unranked tensors: TODO // The generated ABI wrappers assume such an expansion and will generate code // to produce it from the original reflection metadata captured in the // previous pass. passManager.addNestedPass<FuncOp>( Shape::createExpandFunctionDynamicDimsPass()); // Merge arg/result reflection metadata. // NOTE(laurenzo): This will eventually not be the right place for this as // it should happen after the HAL has further annotated the exported // functions (such as with synthetic barrier arguments). passManager.addNestedPass<FuncOp>( IREE::Flow::createMergeExportedReflection()); //---------------------------------------------------------------------------- // Shape materialization for buffer assignment and stream formation. // // Phase ordering constraints: // - All tensor-level transformations which alter shapes must be complete // prior to this phase. // // Pre-conditions: // - "Root" dynamic tensors all pass through a single shapex.tie_shape // use which associates them to their shape. // - Loose, non-associated shapex.get_ranked_shape ops can exist anywhere // and will be resolved. // Post-conditions: // - All dynamic tensors bridge through a shapex.tie_shape op with the // appropriate shape. // - No shapex.get_ranked_shape ops exist (they have been converted to // concrete IR which materializes the shapes, either statically or // dynamically). // - Shape folding and canonicalization has been done. // TODO(laurenzo): Investigate whether this can be done more incrementally // during dispatch/stream formation versus having such a large phase // ordering constraint. //---------------------------------------------------------------------------- SmallVector<std::string> doNotRecurseOpNames = {"flow.dispatch.workgroups"}; passManager.addNestedPass<FuncOp>( Shape::createTieDynamicShapesPass(doNotRecurseOpNames)); passManager.addNestedPass<FuncOp>( Shape::createMaterializeShapeCalculationsPass()); passManager.addNestedPass<FuncOp>(Shape::createHoistShapeCalculationsPass()); //---------------------------------------------------------------------------- // Partitioning and dispatch region formation // // Phase ordering constraints: // - Must precede dependencies on fully formed flow.dispatch and // flow.dispatch_region ops // Pre-conditions: // - Conversion to CFG // - Materialization of shape metadata ops // Post-conditions: // - Dispatch functions have been outlined such that only their dynamic // root tensors are tied via shapex.tie_shape // - Non-dispatchable ops have either been converted to flow ops or deemed // legal. // - shapex.tie_shape ops exist at any dispatch operands/results that are // dynamic, preserving the shape association. // TODO(laurenzo): determine if this is needed versus only preserving // for non-dispatchable ops. //---------------------------------------------------------------------------- // Convert into our expected input and (hopefully) some flow ops. passManager.addNestedPass<FuncOp>( IREE::Flow::createPrePartitioningConversionPass()); // First perform module-level analysis that following passes will use to query // per-function dispatchability information. We run this first so that it only // needs to run once and will be cached for all of the following passes. passManager.addPass(IREE::Flow::createDispatchabilityAnalysisPass()); // Create all of the dispatch regions, CSE their workloads, and fold. passManager.addNestedPass<FuncOp>( IREE::Flow::createIdentifyDispatchRegions2Pass()); passManager.addNestedPass<FuncOp>(createCSEPass()); passManager.addNestedPass<FuncOp>( IREE::Flow::createFoldCompatibleDispatchRegionsPass()); // Note that as we are rematerializing things here it's critical we do not run // the canonicalizer/CSE between now and when we outline - otherwise it'll // undo all of our work! if (!clEnableLinalgOnTensorsDispatch) { passManager.addNestedPass<FuncOp>( IREE::Flow::createRematerializeDispatchConstantsPass()); } // Outline the dispatch regions into their own functions wrapped in // executables. This separates sequencer functions performing dispatches from // dispatchees. passManager.addPass(IREE::Flow::createOutlineDispatchRegionsPass()); passManager.addPass(IREE::Flow::createOutlineDispatchRegions2Pass()); // Cleanup identity ops that clutter up the IR and canonicalize. passManager.addNestedPass<FuncOp>(createCanonicalizerPass()); // Deduplicate executables created from dispatch regions. // Note: this only deduplicates equivalent executables. We could in addition // generalize executables to prune further (e.g. by promoting a dimension to // an argument if two executables differ only in that one dimension). passManager.addPass(IREE::Flow::createDeduplicateExecutablesPass()); // Inject tracing that logs both input and output tensors from all dispatches. // We do this after deduping so that the executable names match later stages. if (clTraceDispatchTensors) { passManager.addNestedPass<FuncOp>(createInjectDispatchTracingPass()); } // Convert any leftover ops outside of dispatch regions to flow ops. passManager.addNestedPass<FuncOp>(createPostPartitioningConversionPass()); //---------------------------------------------------------------------------- // Stream formation. // Pre-conditions: // - Full formation of dispatch regions //---------------------------------------------------------------------------- // Form streams. // Cleanup the IR before we try to form streams. passManager.addNestedPass<FuncOp>(createCanonicalizerPass()); passManager.addNestedPass<FuncOp>(createCSEPass()); // Reorder blocks to increase the grouping of streamable ops. passManager.addNestedPass<FuncOp>(createHoistUnstreamableOpsPass()); // The hoisting pass does some reordering. Canonicalize to avoid unnecessary // arbitrary ordering. passManager.addNestedPass<FuncOp>(createCanonicalizerPass()); passManager.addNestedPass<FuncOp>(IREE::Flow::createFormStreamsPass()); // Forming streams involves a fair amount of subgraph stitching, which can // cause duplication. Run CSE to collapse. passManager.addNestedPass<FuncOp>(createCanonicalizerPass()); passManager.addNestedPass<FuncOp>(createCSEPass()); // Prior to leaving the pipeline we need to clean things up for following // layers. These transforms may be undone by subsequent CSE/folding passes. passManager.addPass(createOutlineLargeConstantsPass()); // Symbol DCE any remaining variables/functions that are now no longer // required. passManager.addPass(createSymbolDCEPass()); } void registerFlowTransformPassPipeline() { PassPipelineRegistration<> transformPassPipeline( "iree-flow-transformation-pipeline", "Runs the full IREE flow dialect transformation pipeline", [](OpPassManager &passManager) { buildFlowTransformPassPipeline(passManager); }); } void buildExportDispatchesTransformPassPipeline(OpPassManager &passManager) { passManager.addPass(IREE::Flow::createCreateBenchmarkFuncs()); passManager.addNestedPass<FuncOp>( IREE::Flow::createMaterializeExportedReflection()); passManager.addNestedPass<FuncOp>( IREE::Flow::createMergeExportedReflection()); passManager.addNestedPass<FuncOp>(IREE::Flow::createFormStreamsPass()); passManager.addNestedPass<FuncOp>(createCanonicalizerPass()); passManager.addNestedPass<FuncOp>(createCSEPass()); passManager.addPass(createSymbolDCEPass()); } void registerExportDispatchesTransformPassPipeline() { PassPipelineRegistration<> transformPassPipeline( "iree-flow-export-dispatches", "Runs the pipeline to export dispatch functions", [](OpPassManager &passManager) { buildExportDispatchesTransformPassPipeline(passManager); }); } } // namespace Flow } // namespace IREE } // namespace iree_compiler } // namespace mlir
;************************************************************************** ;* ;* FILE sys.asm ;* Copyright (c) 2001, 2003 Daniel Kahlin <daniel@kahlin.net> ;* Written by Daniel Kahlin <daniel@kahlin.net> ;* $Id: sys.asm,v 1.13 2003/08/09 12:04:01 tlr Exp $ ;* ;* DESCRIPTION ;* This is the sysline ;* ;****** RELYEAR EQU "2004-10-02" PROCESSOR 6502 include "include/macros.i" include "include/vic20.i" seg code org $1201 asm_start: ;************************************************************************** ;* ;* Basic line! ;* ;****** StartOfFile: dc.w EndLine dc.w RELYEAR dc.b TOKEN_SYS,"(",TOKEN_PEEK,"(43)",TOKEN_PLUS,"256",TOKEN_TIMES,TOKEN_PEEK,"(44)",TOKEN_PLUS,"36) /T.L.R/",0 ; 200x SYS(PEEK(43)+256*PEEK(44)+36) /T.L.R/ EndLine: dc.w 0 ;************************************************************************** ;* ;* SysAddress... When run we will enter here! ;* ;****** SysAddress: ; check if we are running on a vic-20 here ; by checking the basic rom. lda $c002 cmp #$67 bne sa_print2 lda $c003 cmp #$e4 bne sa_print2 lda $c00c cmp #$30 bne sa_print2 lda $c00d cmp #$c8 bne sa_print2 ; get memtop and calculate start-page sec jsr $ff99 ;MEMTOP tya cmp #$5c bcc sa_print ; Memtop less than $5c00 ; all ok, do it. jmp CopyDown sa_print2: ldy #<[mem2_msg-asm_start] dc.b $2c ; bit $xxxx sa_print: ldy #<[mem_msg-asm_start] sa_lp1: lda ($2b),y iny jsr $ffd2 bne sa_lp1 ; ; 'READY.' has already been printed. ; set direct mode, ; set stack and jump through the basic main loop vector ; lda #$80 jsr $ff90 ;SETMSG ldx #$fa txs jmp ($0302) ;IMAIN mem2_msg: dc.b 13,"THIS IS NOT A VIC-20!",13 mem_msg: dc.b 13,"VIC-TRACKER ONLY RUNS",13 dc.b "ON A VIC-20 WITH 16KB",13 dc.b "MEMORY OR MORE.",13 dc.b 13,"READY.",13,0 asm_end: IFCONST LENCHECK CopyDown EQU $1000 ELSE ;LENCHECK ;************************************************************************** ;* ;* The copy down tail code ;* ;****** TARGET EQU $120d incbin "tail.bin" CopyDown: ldx #head_end-head_start cd_lp1: lda head_start-1,x sta TARGET-1,x dex bne cd_lp1 jmp TARGET head_start: incbin "head.bin" head_end: ENDIF ;!LENCHECK ;************************************************************************** ;* ;* status messages ;* ;****** SHOWRANGE "syscode",asm_start,asm_end SHOWRANGE "head_data",head_start,head_end ; eof
.global s_prepare_buffers s_prepare_buffers: push %r12 push %r14 push %r15 push %r8 push %rbx push %rcx push %rdi push %rsi lea addresses_UC_ht+0xaff6, %r8 nop nop nop nop nop add $5599, %r15 mov $0x6162636465666768, %rsi movq %rsi, %xmm2 movups %xmm2, (%r8) nop nop nop add %r12, %r12 lea addresses_A_ht+0x1ff6, %rsi lea addresses_normal_ht+0xc026, %rdi nop nop nop nop nop cmp %r8, %r8 mov $119, %rcx rep movsb nop nop nop nop nop inc %r12 lea addresses_WT_ht+0xadd6, %rsi lea addresses_WC_ht+0xc3f6, %rdi clflush (%rsi) nop xor $49339, %r15 mov $35, %rcx rep movsl nop cmp $59968, %r15 lea addresses_UC_ht+0x1ed9a, %rsi and $52823, %r12 vmovups (%rsi), %ymm6 vextracti128 $1, %ymm6, %xmm6 vpextrq $0, %xmm6, %r15 nop add $38761, %rdi lea addresses_WT_ht+0xdfe6, %r15 nop nop nop cmp $27692, %r14 mov $0x6162636465666768, %r8 movq %r8, (%r15) nop dec %rcx lea addresses_normal_ht+0x183f6, %rsi lea addresses_WC_ht+0x172b4, %rdi add $43359, %rbx mov $4, %rcx rep movsb nop and %r12, %r12 lea addresses_WC_ht+0x133f6, %rdi nop nop nop nop xor $24247, %r8 mov (%rdi), %r12d nop nop nop nop cmp $22371, %r8 lea addresses_D_ht+0x1b9f6, %rsi nop nop nop nop nop sub $1379, %rbx mov (%rsi), %r14 nop nop nop nop nop add $20718, %rcx lea addresses_normal_ht+0xe316, %rsi lea addresses_UC_ht+0x12956, %rdi nop nop nop and %r15, %r15 mov $68, %rcx rep movsb nop add $62004, %r8 lea addresses_UC_ht+0x1c0e, %rcx sub %r14, %r14 movl $0x61626364, (%rcx) nop nop nop nop mfence lea addresses_normal_ht+0x13d26, %r12 nop nop nop nop and %r8, %r8 movups (%r12), %xmm2 vpextrq $1, %xmm2, %rdi nop nop xor $19372, %r14 pop %rsi pop %rdi pop %rcx pop %rbx pop %r8 pop %r15 pop %r14 pop %r12 ret .global s_faulty_load s_faulty_load: push %r10 push %r13 push %rbx push %rsi // Faulty Load lea addresses_UC+0x103f6, %r10 nop nop nop nop inc %r13 movaps (%r10), %xmm2 vpextrq $1, %xmm2, %rbx lea oracles, %r10 and $0xff, %rbx shlq $12, %rbx mov (%r10,%rbx,1), %rbx pop %rsi pop %rbx pop %r13 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_UC', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_UC', 'size': 16, 'AVXalign': True, 'NT': False, 'congruent': 0, 'same': True}} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 7, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 9, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 0, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 10, 'same': True}} {'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 2, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 1, 'same': True}} {'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 10, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 8, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 1, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': False}} {'00': 13653} 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 */
BITS 64 ;TEST_FILE_META_BEGIN ;TEST_TYPE=TEST_F ;TEST_IGNOREFLAGS= ;TEST_FILE_META_END FLDZ ;TEST_BEGIN_RECORDING FINCSTP ;TEST_END_RECORDING
// Copyright (c) 2017 The STRAKS developers // Copyright (c) 2017-2018 The Methuselah Developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "wallet/test/wallet_test_fixture.h" #include "rpc/server.h" #include "wallet/db.h" #include "wallet/wallet.h" WalletTestingSetup::WalletTestingSetup(const std::string& chainName): TestingSetup(chainName) { bitdb.MakeMock(); bool fFirstRun; pwalletMain = new CWallet("wallet_test.dat"); pwalletMain->LoadWallet(fFirstRun); RegisterValidationInterface(pwalletMain); RegisterWalletRPCCommands(tableRPC); } WalletTestingSetup::~WalletTestingSetup() { UnregisterValidationInterface(pwalletMain); delete pwalletMain; pwalletMain = NULL; bitdb.Flush(true); bitdb.Reset(); }
;-------------------------------------------------------- ; File Created by SDCC : free open source ANSI-C Compiler ; Version 4.0.3 #11868 (Linux) ;-------------------------------------------------------- ; Processed by Z88DK ;-------------------------------------------------------- EXTERN __divschar EXTERN __divschar_callee EXTERN __divsint EXTERN __divsint_callee EXTERN __divslong EXTERN __divslong_callee EXTERN __divslonglong EXTERN __divslonglong_callee EXTERN __divsuchar EXTERN __divsuchar_callee EXTERN __divuchar EXTERN __divuchar_callee EXTERN __divuint EXTERN __divuint_callee EXTERN __divulong EXTERN __divulong_callee EXTERN __divulonglong EXTERN __divulonglong_callee EXTERN __divuschar EXTERN __divuschar_callee EXTERN __modschar EXTERN __modschar_callee EXTERN __modsint EXTERN __modsint_callee EXTERN __modslong EXTERN __modslong_callee EXTERN __modslonglong EXTERN __modslonglong_callee EXTERN __modsuchar EXTERN __modsuchar_callee EXTERN __moduchar EXTERN __moduchar_callee EXTERN __moduint EXTERN __moduint_callee EXTERN __modulong EXTERN __modulong_callee EXTERN __modulonglong EXTERN __modulonglong_callee EXTERN __moduschar EXTERN __moduschar_callee EXTERN __mulint EXTERN __mulint_callee EXTERN __mullong EXTERN __mullong_callee EXTERN __mullonglong EXTERN __mullonglong_callee EXTERN __mulschar EXTERN __mulschar_callee EXTERN __mulsuchar EXTERN __mulsuchar_callee EXTERN __muluschar EXTERN __muluschar_callee EXTERN __rlslonglong EXTERN __rlslonglong_callee EXTERN __rlulonglong EXTERN __rlulonglong_callee EXTERN __rrslonglong EXTERN __rrslonglong_callee EXTERN __rrulonglong EXTERN __rrulonglong_callee EXTERN ___sdcc_call_hl EXTERN ___sdcc_call_iy EXTERN ___sdcc_enter_ix EXTERN _banked_call EXTERN _banked_ret EXTERN ___fs2schar EXTERN ___fs2schar_callee EXTERN ___fs2sint EXTERN ___fs2sint_callee EXTERN ___fs2slong EXTERN ___fs2slong_callee EXTERN ___fs2slonglong EXTERN ___fs2slonglong_callee EXTERN ___fs2uchar EXTERN ___fs2uchar_callee EXTERN ___fs2uint EXTERN ___fs2uint_callee EXTERN ___fs2ulong EXTERN ___fs2ulong_callee EXTERN ___fs2ulonglong EXTERN ___fs2ulonglong_callee EXTERN ___fsadd EXTERN ___fsadd_callee EXTERN ___fsdiv EXTERN ___fsdiv_callee EXTERN ___fseq EXTERN ___fseq_callee EXTERN ___fsgt EXTERN ___fsgt_callee EXTERN ___fslt EXTERN ___fslt_callee EXTERN ___fsmul EXTERN ___fsmul_callee EXTERN ___fsneq EXTERN ___fsneq_callee EXTERN ___fssub EXTERN ___fssub_callee EXTERN ___schar2fs EXTERN ___schar2fs_callee EXTERN ___sint2fs EXTERN ___sint2fs_callee EXTERN ___slong2fs EXTERN ___slong2fs_callee EXTERN ___slonglong2fs EXTERN ___slonglong2fs_callee EXTERN ___uchar2fs EXTERN ___uchar2fs_callee EXTERN ___uint2fs EXTERN ___uint2fs_callee EXTERN ___ulong2fs EXTERN ___ulong2fs_callee EXTERN ___ulonglong2fs EXTERN ___ulonglong2fs_callee EXTERN ____sdcc_2_copy_src_mhl_dst_deix EXTERN ____sdcc_2_copy_src_mhl_dst_bcix EXTERN ____sdcc_4_copy_src_mhl_dst_deix EXTERN ____sdcc_4_copy_src_mhl_dst_bcix EXTERN ____sdcc_4_copy_src_mhl_dst_mbc EXTERN ____sdcc_4_ldi_nosave_bc EXTERN ____sdcc_4_ldi_save_bc EXTERN ____sdcc_4_push_hlix EXTERN ____sdcc_4_push_mhl EXTERN ____sdcc_lib_setmem_hl EXTERN ____sdcc_ll_add_de_bc_hl EXTERN ____sdcc_ll_add_de_bc_hlix EXTERN ____sdcc_ll_add_de_hlix_bc EXTERN ____sdcc_ll_add_de_hlix_bcix EXTERN ____sdcc_ll_add_deix_bc_hl EXTERN ____sdcc_ll_add_deix_hlix EXTERN ____sdcc_ll_add_hlix_bc_deix EXTERN ____sdcc_ll_add_hlix_deix_bc EXTERN ____sdcc_ll_add_hlix_deix_bcix EXTERN ____sdcc_ll_asr_hlix_a EXTERN ____sdcc_ll_asr_mbc_a EXTERN ____sdcc_ll_copy_src_de_dst_hlix EXTERN ____sdcc_ll_copy_src_de_dst_hlsp EXTERN ____sdcc_ll_copy_src_deix_dst_hl EXTERN ____sdcc_ll_copy_src_deix_dst_hlix EXTERN ____sdcc_ll_copy_src_deixm_dst_hlsp EXTERN ____sdcc_ll_copy_src_desp_dst_hlsp EXTERN ____sdcc_ll_copy_src_hl_dst_de EXTERN ____sdcc_ll_copy_src_hlsp_dst_de EXTERN ____sdcc_ll_copy_src_hlsp_dst_deixm EXTERN ____sdcc_ll_lsl_hlix_a EXTERN ____sdcc_ll_lsl_mbc_a EXTERN ____sdcc_ll_lsr_hlix_a EXTERN ____sdcc_ll_lsr_mbc_a EXTERN ____sdcc_ll_push_hlix EXTERN ____sdcc_ll_push_mhl EXTERN ____sdcc_ll_sub_de_bc_hl EXTERN ____sdcc_ll_sub_de_bc_hlix EXTERN ____sdcc_ll_sub_de_hlix_bc EXTERN ____sdcc_ll_sub_de_hlix_bcix EXTERN ____sdcc_ll_sub_deix_bc_hl EXTERN ____sdcc_ll_sub_deix_hlix EXTERN ____sdcc_ll_sub_hlix_bc_deix EXTERN ____sdcc_ll_sub_hlix_deix_bc EXTERN ____sdcc_ll_sub_hlix_deix_bcix EXTERN ____sdcc_load_debc_deix EXTERN ____sdcc_load_dehl_deix EXTERN ____sdcc_load_debc_mhl EXTERN ____sdcc_load_hlde_mhl EXTERN ____sdcc_store_dehl_bcix EXTERN ____sdcc_store_debc_hlix EXTERN ____sdcc_store_debc_mhl EXTERN ____sdcc_cpu_pop_ei EXTERN ____sdcc_cpu_pop_ei_jp EXTERN ____sdcc_cpu_push_di EXTERN ____sdcc_outi EXTERN ____sdcc_outi_128 EXTERN ____sdcc_outi_256 EXTERN ____sdcc_ldi EXTERN ____sdcc_ldi_128 EXTERN ____sdcc_ldi_256 EXTERN ____sdcc_4_copy_srcd_hlix_dst_deix EXTERN ____sdcc_4_and_src_mbc_mhl_dst_deix EXTERN ____sdcc_4_or_src_mbc_mhl_dst_deix EXTERN ____sdcc_4_xor_src_mbc_mhl_dst_deix EXTERN ____sdcc_4_or_src_dehl_dst_bcix EXTERN ____sdcc_4_xor_src_dehl_dst_bcix EXTERN ____sdcc_4_and_src_dehl_dst_bcix EXTERN ____sdcc_4_xor_src_mbc_mhl_dst_debc EXTERN ____sdcc_4_or_src_mbc_mhl_dst_debc EXTERN ____sdcc_4_and_src_mbc_mhl_dst_debc EXTERN ____sdcc_4_cpl_src_mhl_dst_debc EXTERN ____sdcc_4_xor_src_debc_mhl_dst_debc EXTERN ____sdcc_4_or_src_debc_mhl_dst_debc EXTERN ____sdcc_4_and_src_debc_mhl_dst_debc EXTERN ____sdcc_4_and_src_debc_hlix_dst_debc EXTERN ____sdcc_4_or_src_debc_hlix_dst_debc EXTERN ____sdcc_4_xor_src_debc_hlix_dst_debc ;-------------------------------------------------------- ; Public variables in this module ;-------------------------------------------------------- GLOBAL _m32_atan2f ;-------------------------------------------------------- ; Externals used ;-------------------------------------------------------- GLOBAL _m32_polyf GLOBAL _m32_hypotf GLOBAL _m32_ldexpf GLOBAL _m32_frexpf GLOBAL _m32_invsqrtf GLOBAL _m32_sqrtf GLOBAL _m32_invf GLOBAL _m32_sqrf GLOBAL _m32_div2f GLOBAL _m32_mul2f GLOBAL _m32_modff GLOBAL _m32_fmodf GLOBAL _m32_roundf GLOBAL _m32_floorf GLOBAL _m32_fabsf GLOBAL _m32_ceilf GLOBAL _m32_powf GLOBAL _m32_log10f GLOBAL _m32_log2f GLOBAL _m32_logf GLOBAL _m32_exp10f GLOBAL _m32_exp2f GLOBAL _m32_expf GLOBAL _m32_atanhf GLOBAL _m32_acoshf GLOBAL _m32_asinhf GLOBAL _m32_tanhf GLOBAL _m32_coshf GLOBAL _m32_sinhf GLOBAL _m32_atanf GLOBAL _m32_acosf GLOBAL _m32_asinf GLOBAL _m32_tanf GLOBAL _m32_cosf GLOBAL _m32_sinf GLOBAL _poly_callee GLOBAL _poly GLOBAL _exp10_fastcall GLOBAL _exp10 GLOBAL _mul10u_fastcall GLOBAL _mul10u GLOBAL _mul2_fastcall GLOBAL _mul2 GLOBAL _div2_fastcall GLOBAL _div2 GLOBAL _invsqrt_fastcall GLOBAL _invsqrt GLOBAL _inv_fastcall GLOBAL _inv GLOBAL _sqr_fastcall GLOBAL _sqr GLOBAL _isunordered_callee GLOBAL _isunordered GLOBAL _islessgreater_callee GLOBAL _islessgreater GLOBAL _islessequal_callee GLOBAL _islessequal GLOBAL _isless_callee GLOBAL _isless GLOBAL _isgreaterequal_callee GLOBAL _isgreaterequal GLOBAL _isgreater_callee GLOBAL _isgreater GLOBAL _fma_callee GLOBAL _fma GLOBAL _fmin_callee GLOBAL _fmin GLOBAL _fmax_callee GLOBAL _fmax GLOBAL _fdim_callee GLOBAL _fdim GLOBAL _nexttoward_callee GLOBAL _nexttoward GLOBAL _nextafter_callee GLOBAL _nextafter GLOBAL _nan_fastcall GLOBAL _nan GLOBAL _copysign_callee GLOBAL _copysign GLOBAL _remquo_callee GLOBAL _remquo GLOBAL _remainder_callee GLOBAL _remainder GLOBAL _fmod_callee GLOBAL _fmod GLOBAL _modf_callee GLOBAL _modf GLOBAL _trunc_fastcall GLOBAL _trunc GLOBAL _lround_fastcall GLOBAL _lround GLOBAL _round_fastcall GLOBAL _round GLOBAL _lrint_fastcall GLOBAL _lrint GLOBAL _rint_fastcall GLOBAL _rint GLOBAL _nearbyint_fastcall GLOBAL _nearbyint GLOBAL _floor_fastcall GLOBAL _floor GLOBAL _ceil_fastcall GLOBAL _ceil GLOBAL _tgamma_fastcall GLOBAL _tgamma GLOBAL _lgamma_fastcall GLOBAL _lgamma GLOBAL _erfc_fastcall GLOBAL _erfc GLOBAL _erf_fastcall GLOBAL _erf GLOBAL _cbrt_fastcall GLOBAL _cbrt GLOBAL _sqrt_fastcall GLOBAL _sqrt GLOBAL _pow_callee GLOBAL _pow GLOBAL _hypot_callee GLOBAL _hypot GLOBAL _fabs_fastcall GLOBAL _fabs GLOBAL _logb_fastcall GLOBAL _logb GLOBAL _log2_fastcall GLOBAL _log2 GLOBAL _log1p_fastcall GLOBAL _log1p GLOBAL _log10_fastcall GLOBAL _log10 GLOBAL _log_fastcall GLOBAL _log GLOBAL _scalbln_callee GLOBAL _scalbln GLOBAL _scalbn_callee GLOBAL _scalbn GLOBAL _ldexp_callee GLOBAL _ldexp GLOBAL _ilogb_fastcall GLOBAL _ilogb GLOBAL _frexp_callee GLOBAL _frexp GLOBAL _expm1_fastcall GLOBAL _expm1 GLOBAL _exp2_fastcall GLOBAL _exp2 GLOBAL _exp_fastcall GLOBAL _exp GLOBAL _tanh_fastcall GLOBAL _tanh GLOBAL _sinh_fastcall GLOBAL _sinh GLOBAL _cosh_fastcall GLOBAL _cosh GLOBAL _atanh_fastcall GLOBAL _atanh GLOBAL _asinh_fastcall GLOBAL _asinh GLOBAL _acosh_fastcall GLOBAL _acosh GLOBAL _tan_fastcall GLOBAL _tan GLOBAL _sin_fastcall GLOBAL _sin GLOBAL _cos_fastcall GLOBAL _cos GLOBAL _atan2_callee GLOBAL _atan2 GLOBAL _atan_fastcall GLOBAL _atan GLOBAL _asin_fastcall GLOBAL _asin GLOBAL _acos_fastcall GLOBAL _acos ;-------------------------------------------------------- ; special function registers ;-------------------------------------------------------- ;-------------------------------------------------------- ; ram data ;-------------------------------------------------------- SECTION bss_compiler ;-------------------------------------------------------- ; ram data ;-------------------------------------------------------- IF 0 ; .area _INITIALIZED removed by z88dk ENDIF ;-------------------------------------------------------- ; absolute external ram data ;-------------------------------------------------------- SECTION IGNORE ;-------------------------------------------------------- ; global & static initialisations ;-------------------------------------------------------- SECTION code_crt_init ;-------------------------------------------------------- ; Home ;-------------------------------------------------------- SECTION IGNORE ;-------------------------------------------------------- ; code ;-------------------------------------------------------- SECTION code_compiler ; --------------------------------- ; Function m32_atan2f ; --------------------------------- _m32_atan2f: push ix ld ix,0 add ix,sp ld hl, -6 add hl, sp ld sp, hl ld hl,0x0000 push hl push hl ld l,(ix+6) ld h,(ix+7) push hl ld l,(ix+4) ld h,(ix+5) push hl call ___fslt_callee ld (ix-6),l ld a,(ix+11) and a,0x7f or a,(ix+10) or a,(ix+9) or a,(ix+8) jp Z, l_m32_atan2f_00117 ld e,(ix+10) ld d,(ix+11) ld l,(ix+8) ld h,(ix+9) call _m32_fabsf ld (ix-5),l ld (ix-4),h ld (ix-3),e ld (ix-2),d ld e,(ix+6) ld d,(ix+7) ld l,(ix+4) ld h,(ix+5) call _m32_fabsf push hl push de ld hl,0x0000 push hl push hl ld l,(ix+10) ld h,(ix+11) push hl ld l,(ix+8) ld h,(ix+9) push hl call ___fslt_callee ld (ix-1),l pop de pop bc push de push bc ld l,(ix-3) ld h,(ix-2) push hl ld l,(ix-5) ld h,(ix-4) push hl call ___fslt_callee ld a, l or a, a jr NZ,l_m32_atan2f_00107 ld l,(ix+10) ld h,(ix+11) push hl ld l,(ix+8) ld h,(ix+9) push hl ld l,(ix+6) ld h,(ix+7) push hl ld l,(ix+4) ld h,(ix+5) push hl call ___fsdiv_callee call _m32_atanf ld a,(ix-1) or a,a ld c,l ld b,h jr Z,l_m32_atan2f_00105 bit 0,(ix-6) jr NZ,l_m32_atan2f_00102 ld hl,0x4049 push hl ld hl,0x0fdb push hl push de push bc call ___fsadd_callee ld c, l ld b, h jr l_m32_atan2f_00105 l_m32_atan2f_00102: ld hl,0x4049 push hl ld hl,0x0fdb push hl push de push bc call ___fssub_callee ld c, l ld b, h l_m32_atan2f_00105: ld l, c ld h, b jp l_m32_atan2f_00119 l_m32_atan2f_00107: ld l,(ix+6) ld h,(ix+7) push hl ld l,(ix+4) ld h,(ix+5) push hl ld l,(ix+10) ld h,(ix+11) push hl ld l,(ix+8) ld h,(ix+9) push hl call ___fsdiv_callee call _m32_atanf ld a,d xor a,0x80 ld d,a ld a,(ix-1) or a,a ld c,l ld b,h jr Z,l_m32_atan2f_00109 ld hl,0x3fc9 push hl ld hl,0x0fdb push hl push de push bc call ___fssub_callee ld c, l ld b, h jr l_m32_atan2f_00110 l_m32_atan2f_00109: ld hl,0x3fc9 push hl ld hl,0x0fdb push hl push de push bc call ___fsadd_callee ld c, l ld b, h l_m32_atan2f_00110: ld l, c ld h, b jr l_m32_atan2f_00119 l_m32_atan2f_00117: ld l,(ix+6) ld h,(ix+7) push hl ld l,(ix+4) ld h,(ix+5) push hl ld hl,0x0000 push hl push hl call ___fslt_callee ld a, l or a, a jr Z,l_m32_atan2f_00114 ld de,0x3fc9 ld hl,0x0fdb jr l_m32_atan2f_00119 l_m32_atan2f_00114: ld a,(ix-6) or a, a jr Z,l_m32_atan2f_00118 ld de,0xbfc9 ld hl,0x0fdb jr l_m32_atan2f_00119 l_m32_atan2f_00118: ld hl,0x0000 ld e,l ld d,h l_m32_atan2f_00119: ld sp, ix pop ix ret SECTION IGNORE
.global s_prepare_buffers s_prepare_buffers: push %r10 push %rbp push %rcx push %rdi push %rdx push %rsi lea addresses_WC_ht+0x16767, %rsi lea addresses_D_ht+0xf4f2, %rdi nop nop nop nop add $65475, %r10 mov $15, %rcx rep movsl nop nop add $55307, %rcx lea addresses_D_ht+0x4972, %rsi lea addresses_WT_ht+0x3f2a, %rdi nop nop nop dec %rbp mov $63, %rcx rep movsb nop nop nop sub $59629, %rbp lea addresses_D_ht+0x121da, %rsi lea addresses_WC_ht+0xa2f2, %rdi nop nop nop nop nop dec %rdx mov $71, %rcx rep movsw nop nop nop nop nop xor %rcx, %rcx pop %rsi pop %rdx pop %rdi pop %rcx pop %rbp pop %r10 ret .global s_faulty_load s_faulty_load: push %r12 push %r13 push %r14 push %rax push %rdx // Faulty Load lea addresses_RW+0x1a4f2, %rax nop nop nop inc %r14 mov (%rax), %r13d lea oracles, %rdx and $0xff, %r13 shlq $12, %r13 mov (%rdx,%r13,1), %r13 pop %rdx pop %rax pop %r14 pop %r13 pop %r12 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'size': 16, 'NT': False, 'type': 'addresses_RW', 'same': False, 'AVXalign': False, 'congruent': 0}} [Faulty Load] {'OP': 'LOAD', 'src': {'size': 4, 'NT': True, 'type': 'addresses_RW', 'same': True, 'AVXalign': False, 'congruent': 0}} <gen_prepare_buffer> {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_WC_ht', 'congruent': 0}, 'dst': {'same': False, 'type': 'addresses_D_ht', 'congruent': 10}} {'OP': 'REPM', 'src': {'same': True, 'type': 'addresses_D_ht', 'congruent': 6}, 'dst': {'same': False, 'type': 'addresses_WT_ht', 'congruent': 2}} {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_D_ht', 'congruent': 3}, 'dst': {'same': False, 'type': 'addresses_WC_ht', 'congruent': 9}} {'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 */
; A103128: a(n) = floor(sqrt(2n-1)). ; 1,1,2,2,3,3,3,3,4,4,4,4,5,5,5,5,5,5,6,6,6,6,6,6,7,7,7,7,7,7,7,7,8,8,8,8,8,8,8,8,9,9,9,9,9,9,9,9,9,9,10,10,10,10,10,10,10,10,10,10,11,11,11,11,11,11,11,11,11,11,11,11,12,12,12,12,12,12,12,12,12,12,12,12,13,13,13,13,13,13,13,13,13,13,13,13,13,13,14,14,14,14,14,14,14,14,14,14,14,14,14,14,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,22,22,22,22,22,22,22,22 mov $1,1 lpb $0,1 add $1,1 sub $0,$1 lpe
; A233099: Number of 2 X n 0..3 arrays with no element x(i,j) adjacent to value 3-x(i,j) horizontally, diagonally or antidiagonally, top left element zero, and 1 appearing before 2 in row major order. ; 3,11,65,386,2315,13886,83315,499886,2999315,17995886,107975315,647851886,3887111315,23322667886,139936007315,839616043886,5037696263315,30226177579886,181357065479315,1088142392875886,6528854357255315,39173126143531886,235038756861191315,1410232541167147886,8461395247002887315,50768371482017323886,304610228892103943315,1827661373352623659886,10965968240115741959315,65795809440694451755886,394774856644166710535315,2368649139865000263211886,14211894839190001579271315,85271369035140009475627886 seq $0,92165 ; Let M = 2 X 2 matrix [ 1 2 / 5 4 ]; a(n) = (1,2) entry of M^n. mov $3,$0 sub $3,$0 sub $0,1 mov $2,-1 mul $2,$0 seq $3,270567 ; Expansion of (1+4*x)/(1-5*x). sub $3,25 div $2,$3 add $0,$2 mul $0,4 sub $0,4 div $0,4 add $0,3
; size_t wa_stack_size(wa_stack_t *s) SECTION code_clib SECTION code_adt_wa_stack PUBLIC wa_stack_size EXTERN asm_wa_stack_size defc wa_stack_size = asm_wa_stack_size ; SDCC bridge for Classic IF __CLASSIC PUBLIC _wa_stack_size defc _wa_stack_size = wa_stack_size ENDIF
#include <lix/parser/parse.hpp> #include <algorithm> #include <fstream> #include <iostream> namespace { int parse_istream(std::istream& in) { std::string code; using iter = std::istreambuf_iterator<char>; std::copy(iter(in), iter{}, std::back_inserter(code)); try { auto node = lix::ast::parse(code); std::cout << node << '\n'; } catch (const lix::ast::parse_error& e) { std::cerr << "FAIL:\n" << e.what() << '\n'; return 1; } return 0; } } int main(int argc, char** argv) { if (argc == 2) { std::ifstream in{argv[1]}; if (!in) { std::cerr << "Failed to open filed: " << argv[1] << '\n'; return 2; } return parse_istream(in); } else { return parse_istream(std::cin); } }
dc.w word_1613E6-Map_Madmole dc.w word_161406-Map_Madmole dc.w word_161426-Map_Madmole dc.w word_161446-Map_Madmole dc.w word_16145A-Map_Madmole dc.w word_161468-Map_Madmole dc.w word_161476-Map_Madmole dc.w word_16147E-Map_Madmole dc.w word_16148C-Map_Madmole dc.w word_161494-Map_Madmole dc.w word_1614A2-Map_Madmole dc.w word_1614AA-Map_Madmole dc.w word_1614B8-Map_Madmole dc.w word_1614C0-Map_Madmole word_1613E6: dc.w 5 dc.b $F4, $A, $20, 0, $FF, $FA dc.b $FC, 0, $20, 9, $FF, $F2 dc.b $E8, 9, $40, $E, $FF, $FD dc.b $F8, 0, $40, $14, 0, 5 dc.b 4, 1, $20, $A, 0, $A word_161406: dc.w 5 dc.b $F4, $A, $20, 0, $FF, $FA dc.b $FC, 0, $20, 9, $FF, $F2 dc.b $E8, 9, $40, $E, $FF, $F5 dc.b $F8, 0, $40, $14, $FF, $FD dc.b 4, 1, $20, $A, 0, 2 word_161426: dc.w 5 dc.b $F4, $A, $20, 0, $FF, $FA dc.b $FC, 0, $20, 9, $FF, $F2 dc.b $E8, 9, $40, $E, $FF, $ED dc.b $F8, 0, $40, $14, $FF, $F5 dc.b 4, 1, $20, $A, $FF, $FA word_161446: dc.w 3 dc.b $F4, $A, $20, 0, $FF, $FA dc.b $FC, 0, $20, 9, $FF, $F2 dc.b $F8, 1, $20, $C, $FF, $F2 word_16145A: dc.w 2 dc.b $F4, $A, $20, 0, $FF, $FA dc.b $FC, 0, $20, 9, $FF, $F2 word_161468: dc.w 2 dc.b $F4, 9, $40, $E, $FF, $F4 dc.b 4, 0, $40, $14, $FF, $FC word_161476: dc.w 1 dc.b $F4, $A, $40, $15, $FF, $F4 word_16147E: dc.w 2 dc.b $FC, 0, $40, $1E, $FF, $F4 dc.b $F4, 6, $40, $1F, $FF, $FC word_16148C: dc.w 1 dc.b $F4, $A, $50, $15, $FF, $F4 word_161494: dc.w 2 dc.b $FC, 9, $50, $E, $FF, $F4 dc.b $F4, 0, $50, $14, $FF, $FC word_1614A2: dc.w 1 dc.b $F4, $A, $58, $15, $FF, $F4 word_1614AA: dc.w 2 dc.b $FC, 0, $48, $1E, 0, 4 dc.b $F4, 6, $48, $1F, $FF, $F4 word_1614B8: dc.w 1 dc.b $F4, $A, $48, $15, $FF, $F4 word_1614C0: dc.w 2 dc.b $FC, 8, $20, $25, $FF, $E8 dc.b $FC, 8, $28, $25, 0, 0
SECTION rodata_font SECTION rodata_font_fzx PUBLIC _ff_dkud3_AzbukaBold _ff_dkud3_AzbukaBold: BINARY "font/fzx/fonts/dkud3/Azbuka/azbukabold.fzx"
; A207449: Number of n X 4 0..1 arrays avoiding 0 0 0 and 0 0 1 horizontally and 0 0 1 and 1 0 1 vertically. ; 10,100,330,760,1450,2460,3850,5680,8010,10900,14410,18600,23530,29260,35850,43360,51850,61380,72010,83800,96810,111100,126730,143760,162250,182260,203850,227080,252010,278700,307210,337600,369930,404260,440650,479160,519850,562780,608010,655600,705610,758100,813130,870760,931050,994060,1059850,1128480,1200010,1274500,1352010,1432600,1516330,1603260,1693450,1786960,1883850,1984180,2088010,2195400,2306410,2421100,2539530,2661760,2787850,2917860,3051850,3189880,3332010,3478300,3628810,3783600,3942730,4106260,4274250,4446760,4623850,4805580,4992010,5183200,5379210,5580100,5785930,5996760,6212650,6433660,6659850,6891280,7128010,7370100,7617610,7870600,8129130,8393260,8663050,8938560,9219850,9506980,9800010,10099000,10404010,10715100,11032330,11355760,11685450,12021460,12363850,12712680,13068010,13429900,13798410,14173600,14555530,14944260,15339850,15742360,16151850,16568380,16992010,17422800,17860810,18306100,18758730,19218760,19686250,20161260,20643850,21134080,21632010,22137700,22651210,23172600,23701930,24239260,24784650,25338160,25899850,26469780,27048010,27634600,28229610,28833100,29445130,30065760,30695050,31333060,31979850,32635480,33300010,33973500,34656010,35347600,36048330,36758260,37477450,38205960,38943850,39691180,40448010,41214400,41990410,42776100,43571530,44376760,45191850,46016860,46851850,47696880,48552010,49417300,50292810,51178600,52074730,52981260,53898250,54825760,55763850,56712580,57672010,58642200,59623210,60615100,61617930,62631760,63656650,64692660,65739850,66798280,67868010,68949100,70041610,71145600,72261130,73388260,74527050,75677560,76839850,78013980,79200010,80398000,81608010,82830100,84064330,85310760,86569450,87840460,89123850,90419680,91728010,93048900 mov $1,$0 add $1,2 pow $1,2 mul $1,$0 mul $1,10 add $1,10
%include 'felipos.inc' main: mov ax, 1 call os_serial_port_enable mov si, help_msg call os_print_string .loop: call os_wait_for_key cmp al, 27 je .exit mov si, output mov [si], al call os_print_string call os_send_via_serial test ah, 10000000b jnz .error jmp .loop .error: mov si, error_msg call os_print_string .exit: ret help_msg db 'Sending data to serial port. Press ESC to exit.', 13, 10, 0 error_msg db 'Send serial error.', 13, 10, 0 output db ' ', 0
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* * Copyright (c) 2013-2018 Regents of the University of California. * * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions). * * ndn-cxx library 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 3 of the License, or (at your option) any later version. * * ndn-cxx 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 copies of the GNU General Public License and GNU Lesser * General Public License along with ndn-cxx, e.g., in COPYING.md file. If not, see * <http://www.gnu.org/licenses/>. * * See AUTHORS.md for complete list of ndn-cxx authors and contributors. */ #include "signing-helpers.hpp" namespace ndn { namespace security { SigningInfo signingByIdentity(const Name& identityName) { return SigningInfo(SigningInfo::SIGNER_TYPE_ID, identityName); } SigningInfo signingByIdentity(const Identity& identity) { return SigningInfo(identity); } SigningInfo signingByKey(const Name& keyName) { return SigningInfo(SigningInfo::SIGNER_TYPE_KEY, keyName); } SigningInfo signingByKey(const Key& key) { return SigningInfo(key); } SigningInfo signingByCertificate(const Name& certName) { return SigningInfo(SigningInfo::SIGNER_TYPE_CERT, certName); } SigningInfo signingByCertificate(const v2::Certificate& cert) { return SigningInfo(SigningInfo::SIGNER_TYPE_CERT, cert.getName()); } SigningInfo signingWithSha256() { return SigningInfo(SigningInfo::SIGNER_TYPE_SHA256); } } // namespace security } // namespace ndn
title t1_ywt DATA SEGMENT ARRAY DW 23, 36, 2, 100, 32000, 54, 0; ZERO DW ? DATA ENDS CODE SEGMENT START: ;; set ZERO in the (1) way mov ax, DATA mov ds, ax lea bx, ARRAY mov WORD PTR [bx+2*7], 0 ;; reset ZERO to 0ffffh mov [bx+2*7], 0ffffh; ;; set ZERO in the (2) way lea bx, ARRAY[2*6] mov WORD PTR [bx+2], 0 ;; Back to DOS mov ax,4c00h int 21h CODE ENDS END START
;代码清单6-1 ;文件名:c06_mbr.asm ;文件说明:硬盘引导扇区代码 ;创建日期:2011-4-12 22:12 jmp near start mytext db 'L',0x07,'a',0x07,'b',0x07,'e',0x07,'l',0x07,' ',0x07,'o',0x07,\ 'f',0x07,'f',0x07,'s',0x07,'e',0x07,'t',0x07,':',0x07 number db 0,0,0,0,0 start: mov ax,0x7c0 ;设置数据段基地址 mov ds,ax mov ax,0xb800 ;设置附加段基地址 mov es,ax cld mov si,mytext mov di,0 mov cx,(number-mytext)/2 ;实际上等于 13 rep movsw ;得到标号所代表的偏移地址 mov ax,number ;计算各个数位 mov bx,ax; bx中存入的是number,后文[bx]将是number首个字 mov cx,5 ;循环次数 mov si,10 ;除数 digit: xor dx,dx div si mov [bx],dl ;保存数位 inc bx loop digit ;显示各个数位 mov bx,number mov si,4 show: mov al,[bx+si] add al,0x30 mov ah,0x04 mov [es:di],ax add di,2 dec si jns show mov word [es:di],0x0744 jmp near $ times 510-($-$$) db 0 db 0x55,0xaa
#include "common.h" namespace bpftrace { namespace test { namespace codegen { TEST(codegen, call_exit) { test("kprobe:f { exit() }", NAME); } } // namespace codegen } // namespace test } // namespace bpftrace
frame 1, 06 frame 2, 12 frame 1, 08 frame 2, 16 setrepeat 3 frame 3, 06 frame 0, 06 dorepeat 5 endanim
extern open_file_arg global _start IO_BUF_SIZE EQU 2048 STDIN_FD EQU 0 STDOUT_FD EQU 1 section .data file_not_found_msg: db 'File not found', 10, 15 failed_to_read_msg: db 'Failed to read', 10, 15 io_buf: times IO_BUF_SIZE db 0 newline: db 10, 1 section .text _start: pop rax ; argc cmp rax, 1 je stdin_init ; if we don't have any arguments, read from stdin ; we do have at least one argument, open the file pop rbx ; program name pop rax ; filename call open_file_arg ; test whether there was an error cmp rax, 0 jl file_not_found mov r12, rax jmp init stdin_init: mov r12, STDIN_FD init: ; the input fd is in r12 at this point process: ; read in from the file mov rdi, r12 mov rax, 0 mov rsi, io_buf mov rdx, IO_BUF_SIZE syscall cmp rax, 0 jz finish jl failed_to_read ; write to the file mov rdx, rax mov rax, 1 mov rsi, io_buf mov rdi, STDOUT_FD syscall jmp process finish: ; write a trailing newline mov rax, 1 mov rdx, 1 mov rsi, newline mov rdi, STDOUT_FD syscall exit_success: xor rdi, rdi exit: mov rax, 60 syscall failed_to_read: mov rax, 1 ; write mov rdi, 2 ; stderr mov rsi, failed_to_read_msg ; buf mov rdx, 15 ; len jmp exit file_not_found: mov rax, 1 ; write mov rdi, 2 ; stderr mov rsi, file_not_found_msg ; buf mov rdx, 15 ; len syscall mov rdi, 1 jmp exit
; A boot sector that starts in 16 bit and switch to 32 bit Protected Mode [org 0x7c00] ; tell the assembler where this code ; should be loaded to mov bp, 0x9000 mov sp, bp mov bx, MSG_REAL_MODE call print_string call switch_to_pm ; never return from here jmp $ %include 'print_string.asm' %include 'print_hex.asm' %include 'disk_load.asm' %include 'print_string_pm.asm' %include 'gdt.asm' %include 'switch_to_pm.asm' ; this is where we arrive after switching to PM BEGIN_PM: mov ebx, MSG_PROT_MODE call print_string_pm jmp $ MSG_REAL_MODE db "Started in 16 bit real mode", 0 MSG_PROT_MODE db "Successfully landed in 32-bit protected mode", 0 ; ; padding the magic number ; times 510-($-$$) db 0 dw 0xaa55 ; last two bytes for magic number ; so that BIOS knows we are a boot sector
;++ ; ; WOW v1.0 ; ; Copyright (c) 1991, Microsoft Corporation ; ; WINSTR.ASM ; Win16 string services ; ; History: ; ; Created 18-Jun-1991 by Jeff Parsons (jeffpar) ; Copied from WIN31 and edited (as little as possible) for WOW16 ;-- ;**************************************************************************** ;* * ;* WinStr.ASM - * ;* * ;* String related API calls to support different lanuages * ;* * ;**************************************************************************** TITLE WinStr.ASM ifdef WOW NOEXTERNS equ 1 endif NOTEXT = 1 .xlist include user.inc .list sBegin DATA sEnd createSeg _TEXT, CODE, WORD, PUBLIC, CODE sBegin CODE assumes CS,CODE assumes DS,DATA ExternNP Loc_IsConvertibleToUpperCase ExternNP Loc_Upper ExternFP IAnsiUpper ExternFP IAnsiLower ExternFP Ilstrcmpi ifdef FE_SB ExternFP IsDBCSLeadByte endif ; Function codes for all the string functions in USER ; ANSINEXT_ID equ 1 ANSIPREV_ID equ 2 ANSIUPPER_ID equ 3 ANSILOWER_ID equ 4 ;-------------------------------------------------------------------------- ; The order of entries in the following table can not be changed ; unless the *_ID codes are also changed in KERNEL also. ; ((FunctionCode - 1) << 1) is used as the index into this table ; ; Function Codes: ; ; NOTE: If you change the entries in this table, kindly update the ; *_ID statements above and also lString.asm of KERNEL. ; ;-------------------------------------------------------------------------- LabelW StringFuncTable dw codeOFFSET IAnsiNext dw codeOFFSET IAnsiPrev dw codeOFFSET IAnsiUpper dw codeOFFSET IAnsiLower ;*----------------------------------------------------------------------* ;* StringFunc() * ;* The string manipulation functions in kernel have been moved * ;* into USER. * ;* This is the common entry point in USER for all the string * ;* manipulation functions Kernel wants to call. Kernel jumps to * ;* this function with the function code in CX * ;* * ;* Input Parameters: * ;* [CX] contains the Function code. * ;* [sp] contains the FAR return address of the original caller of * ;* the string manipulation functions in Kernel * ;*----------------------------------------------------------------------* cProc StringFunc, <FAR, PUBLIC> cBegin nogen xchg bx,cx ; move function code to BX dec bx shl bx, 1 jmp StringFuncTable[bx] ; Control does not comeback here. It returns directly ; to the caller cEnd nogen ;*----------------------------------------------------------------------* ;* * ;* AnsiPrev() * ;* * ;*----------------------------------------------------------------------* ifdef FE_SB cProc IAnsiPrev,<PUBLIC,FAR> ; parmD pFirst ; [bx+10] es:di ; parmD pStr ; [bx+6] ds:si cBegin nogen push bp mov bp,sp push ds push si push di lds si,[bp+6] les di,[bp+10] regptr dssi,ds,si regptr esdi,es,di cld cmp si,di ; pointer to first char? jz ap5 ; yes, just quit dec si ; backup once cmp si,di ; pointer to first char? jz ap5 ; yse, just quit ap1: dec si ; backup once mov al, [si] ; fetch a character cCall IsDBCSLeadByte,<ax> ; DBCS lead byte candidate? test ax,ax ; jz ap2 ; jump if not. cmp si,di ; backword exhausted? jz ap3 ; jump if so jmp ap1 ; repeat if not ap2: inc si ; adjust pointer correctly ap3: mov bx, [bp+6] ; mov di, bx ; result in DI dec di ; sub bx, si ; how many characters backworded test bx, 1 ; see even or odd... jnz ap4 ; odd - previous char is SBCS dec di ; make DI for DBCS ap4: mov si, di ; final result in SI ap5: mov ax,si mov dx,ds pop di pop si pop ds pop bp ret 8 cEnd nogen else cProc IAnsiPrev,<PUBLIC,FAR> ; parmD pFirst ; [bx+8] es:di ; parmD pStr ; [bx+4] ds:si cBegin nogen mov bx,sp push ds push si push di lds si,ss:[bx+4] les di,ss:[bx+8] regptr dssi,ds,si regptr esdi,es,di cld cmp si,di ; pointer to first char? jz ap3 ; yes, just quit ;;ifdef FE_SB ;; xchg si,di ;;ap1: mov dx,si ;; lodsb ; get a char ;; cCall IsDBCSLeadByte,<ax> ; is it kanji? ;; cmp al,0 ;; je ap2 ; no, get next char ;; inc si ; yes, inc past second part ;;ap2: cmp si,di ; have we at or past end? ;; jb ap1 ; no, keep going ;; mov si,dx ; return previous pointer ;;else dec si ; assume easy case... ;;endif ; FE_SB ap3: mov ax,si mov dx,ds pop di pop si pop ds ret 8 cEnd nogen endif ;*----------------------------------------------------------------------* ;* * ;* AnsiNext() * ;* * ;*----------------------------------------------------------------------* cProc IAnsiNext,<PUBLIC,FAR> ; parmD pStr cBegin nogen mov bx,sp push di les di,ss:[bx+4] mov al,es:[di] or al,al jz an1 inc di ifdef FE_SB cCall IsDBCSLeadByte,<ax> cmp al,0 je an1 inc di endif ; FE_SB an1: mov ax,di mov dx,es pop di ret 4 cEnd nogen ;----------------------------------------------------------------------- ; MyAnsiUpper() ; convert string at es:di to upper case ;----------------------------------------------------------------------- public MyAnsiUpper MyAnsiUpper: cld mov si,di mau1: lods byte ptr es:[si] ifdef FE_SB push ax cCall IsDBCSLeadByte,<ax> cmp ax,0 pop ax je mau2 inc si inc di inc di jmp short mau1 endif mau2: call MyUpper stosb or al,al jnz mau1 ret ;----------------------------------------------------------------------- ; MyAnsiLower() ; convert string at es:di to lower case ;----------------------------------------------------------------------- public MyAnsiLower MyAnsiLower: cld mov si,di mal1: lods byte ptr es:[si] ifdef FE_SB push ax cCall IsDBCSLeadByte,<ax> ; first byte of double byte? cmp ax,0 pop ax je mal2 ; no just do normal stuff inc si ; skip the two bytes inc di inc di jmp short mal1 endif mal2: call MyLower stosb or al,al jnz mal1 ret ;------------------------------------------------------------------------- ; MyUpper() ; convert lower case to upper, must preserve es,di,cx ;------------------------------------------------------------------------- public MyUpper MyUpper: call Loc_IsConvertibleToUpperCase ; Check if it is a lower case char ; that has an uppercase equivalent jnc myu1 ; sub al,'a'-'A' myu1: ret ifdef KANJI #################### KANJI ############################################### ; convert upper case to lower, must preserve es,di,cx public MyLower MyLower: cmp al,'A' jb myl2 cmp al,'Z' jbe myl1 push ds SetKernelDS cmp [fFarEast],1 ; this is a far east kbd 1/12/87 linsh pop ds UnSetKernelDS jge myl2 ; yes do nothing to the 0C0H - 0DEH range cmp al,0C0H ; this is lower case a with a back slash jb myl2 cmp al,0DEH ja myl2 myl1: add al,'a'-'A' myl2: ret #################### KANJI ############################################### endif ;-------------------------------------------------------------------------- ; MyLower() ; convert upper case to lower, must preserve es,di,cx ;-------------------------------------------------------------------------- public MyLower MyLower: call Loc_Upper jnc myl1 add al, 'a'-'A' myl1: ret sEnd CODE end
#ifndef OpticalElements_Filter_hpp #define OpticalElements_Filter_hpp /** @file Filter.hpp * @brief * @author C.D. Clark III * @date 07/26/16 */ #include "BaseOpticalElement.hpp" class Filter : public BaseOpticalElement<units::t::centimeter> { public: // the required interface double getPowerLoss() const; protected: double absorbance; public: // absorbance getters and setters template<typename U> void setAbsorbance(U v) { this->absorbance = v; } ///< sets absorbance inline double getAbsorbance() const { return this->absorbance; } ///< returns absorbance template<typename U> void setOpticalDensity(U v) { this->setAbsorbance(v); } ///< sets absorbance inline double getOpticalDensity() const { return this->getAbsorbance(); } ///< returns absorbance }; inline double Filter::getPowerLoss() const { // absorbance is the logarithm of the ratio of transmitted to incident power. // we need to return the percentage of power lost, which is 1 - this // transmitted/incident power ratio double loss = 1. - 1. / pow(10, this->absorbance); return loss; } #endif // include protector
header_VmSetSp vm_set_sp PROC push ebp mov ebp, esp ; read the argument push [ebp+arg0] call_vm_stack_pop_enc ; set the Stack Pointer mov ebx, [ebp+arg0] mov [ebx+vm_sp], eax mov esp, ebp pop ebp ret vm_set_sp ENDP header_marker
; A159981: Catalan numbers read modulo 4. ; 1,1,2,1,2,2,0,1,2,2,0,2,0,0,0,1,2,2,0,2,0,0,0,2,0,0,0,0,0,0,0,1,2,2,0,2,0,0,0,2,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,2,0,2,0,0,0,2,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0 lpb $0 mul $0,2 sub $0,2 dif $0,4 lpe mov $2,2 lpb $2 lpb $0 dif $0,2 lpe mov $1,$0 add $1,1 mov $2,$0 lpe mov $0,$1
/* * Seabird Galactic Filesystem by 2021 seabird. */ #include <vector> #include <map> #include <string> #include <cstdio> #include <bits/stl_pair.h> #include "accounts.hpp" using namespace std; #ifndef _SG_FILESYSTEM #define _SG_FILESYSTEM #define _SG_FSVER 202101L #define P_READ 4 #define P_WRITE 2 #define P_EXEC 1 // First, administrator always have highest permission (7). // Second, creater always have highest permission (7), and others will be 4. #define ADMIN_PERM 7 #define CREATE_PERM 7 #define DEFAULT_PERM 4 typedef map<account,int> permission; struct fdirnode { string this_name; fdirnode *parent; map<account,int> dir_perm; map<string,fdirnode*> subdir; map<string,pair<string,map<account,int> > > files; bool delete_symbol; int *_resv_filesize; }; int isHavePerm(fdirnode dn, account ac, string pcd_file) { if (ac.account_premission > 0) return ADMIN_PERM; if (pcd_file == "") { if (dn.parent==NULL) return CREATE_PERM; // everyone can change root! if (dn.dir_perm.count(ac)) return dn.dir_perm[ac]; else return DEFAULT_PERM; } else { if (dn.files.count(pcd_file)) { if (dn.files[pcd_file].second.count(ac)) return dn.files[pcd_file].second[ac]; else return DEFAULT_PERM; } else { return 0; // you must have no permission } } } inline bool isNotHavingPerm(fdirnode dn, account ac, string pcd_file, int perm) { return !(isHavePerm(dn,ac,pcd_file)&perm); } fdirnode createFNode(const string dir_name, fdirnode *tparent) { fdirnode f; f.this_name=dir_name; f.parent=tparent; f.delete_symbol=false; return f; } fdirnode* newFNode(const string dir_name, fdirnode *tparent) { fdirnode *f = new fdirnode; f->this_name=dir_name; f->parent=tparent; f->delete_symbol=false; map<string,fdirnode*> mf; mf["."]=f; mf[".."]=tparent; f->subdir=mf; return f; } inline bool isSubdirExists(const string dirname,const fdirnode *dir) { if (dir == NULL) return false; return dir->subdir.count(dirname); } inline bool isFileExists(const string dirname,const fdirnode *dir) { if (dir == NULL) return false; return dir->files.count(dirname); } /* * parameter: path (likes '/folder', must be folder), root of entire filesystem * return: folder node */ string getName(const string filename,const bool fullname) { int i; if (fullname) { for (i = filename.length()-1; i >= 0; i--) { if (filename[i]=='.') break; } } else { for (i = 0; i < filename.length(); i++) { if (filename[i]=='.') break; } } return filename.substr(0,i); } string getExt(const string filename,const bool fullname) { int i; if (fullname) { for (i = filename.length()-1; i >= 0; i--) { if (filename[i]=='.') break; } } else { for (i = 0; i < filename.length(); i++) { if (filename[i]=='.') break; } } return filename.substr(i+1,filename.length()); } string getFirst(const string path) { string folder_part = "",finale = "/"; if (path=="/") return "/"; bool flag = false; for (int i = 1; i < path.length(); i++) { if (path[i]=='/') { finale = finale + folder_part + "/"; folder_part = ""; flag = true; } else { folder_part = folder_part + path[i]; } } if (finale!="/") finale.erase(finale.end()-1); return finale; } string getLast(const string path) { string folder_part = "",finale = "/"; if (path=="/") return "/"; int fskip=0; if (path[0]=='/') fskip=1; for (int i = fskip; i < path.length(); i++) { if (path[i]=='/') { finale = finale + folder_part; folder_part = ""; } else { folder_part = folder_part + path[i]; } } return folder_part; } fdirnode* resolve(const string path,fdirnode *root) { string folder_part = ""; fdirnode *curs; curs = root; if (path=="/") return root; for (int i = 1; i < path.length(); i++) { if (path[i]=='/') { if (!isSubdirExists(folder_part,curs)) return NULL; curs = curs->subdir[folder_part]; folder_part = ""; } else { folder_part = folder_part + path[i]; } } //printf("%s\n%s\n",folder_part.c_str(),curs->this_name.c_str()); if (!isSubdirExists(folder_part,curs)) return NULL; return curs->subdir[folder_part]; } /* * parameter: folder node * do: clean deleted folder node * return: cleaned node */ // remix all like this! void cleanup(fdirnode *dnode) { map<string,fdirnode*> dnode_fmap; dnode_fmap = dnode->subdir; map<string,fdirnode*>::iterator i; for (i = dnode_fmap.begin(); i != dnode_fmap.end(); i++) { if (i->second->delete_symbol) dnode_fmap.erase(i++); if (dnode_fmap.empty()) break; } fdirnode f; f = createFNode(dnode->this_name,dnode->parent); f.files=dnode->files; f.subdir=dnode_fmap; *dnode = f; } /* * parameter: folder node * do: delete this! * actually, It'll do cleanup. */ int SGRmDir(fdirnode *fd, account curlogin) { if (isNotHavingPerm(*fd,curlogin,"",2)) return 0; fd->delete_symbol = true; cleanup(fd->parent); return 1; } int SGRmFile(fdirnode *dir,const string filename,account curlogin) { if (!isFileExists(filename,dir)) return 0; if (isNotHavingPerm(*dir,curlogin,filename,2)) return 0; dir->files.erase(filename); return 1; } /* * parameter: parent folder * do: create something! * */ // Can we just modify the node? int pullDir(fdirnode *father, fdirnode *son) { // pull directory. son->parent = father; map<string,fdirnode*> mfd; mfd = father->subdir; if (mfd.count(son->this_name)) return 0; mfd[son->this_name]=son; fdirnode f; f = createFNode(father->this_name,father->parent); f.files=father->files; f.subdir=mfd; *father = f; return 1; } // As this algorithm I can only return an address. // return: created folder node. fdirnode* SGCreateFolder(fdirnode *father,const string dir_name,account curlogin) { if (isNotHavingPerm(*father,curlogin,"",2)) return NULL; fdirnode *f; f = newFNode(dir_name,father); f->dir_perm[curlogin]=CREATE_PERM; pullDir(father,f); return f; } int SGRenameFolder(fdirnode *old_folder,const string dir_name,account curlogin) { if (isNotHavingPerm(*old_folder,curlogin,"",2)) return 0; if (dir_name=="") return 0; map<string,fdirnode*> am; am = old_folder->parent->subdir; am.erase(old_folder->this_name); old_folder->this_name=dir_name; am[dir_name]=old_folder; old_folder->parent->subdir = am; return 1; } // YOU SHOULD NOT CALL THIS DIRECTLY! int SGProceedFile(fdirnode *father,const string file_name,const string file_content,account curlogin) { if (isNotHavingPerm(*father,curlogin,file_name,2) && father->files.count(file_name)) return 0; father->files[file_name].first=file_content; return 1; } inline int SGProceedFileA(fdirnode *root, const string path, const string file_name,const string file_content, account curlogin) { return SGProceedFile(resolve(path,root),file_name,file_content,curlogin); } // New Feature: Set Permission (Requires Write) // But I can only do like a macro... int SGSetPermission(fdirnode *father,const string file_name,int perm,account setting,account curlogin) { if (file_name != "" && !isFileExists(file_name,father)) return 0; if (isNotHavingPerm(*father,curlogin,file_name,2)) return 0; if (file_name == "") { father->dir_perm[setting]=perm; // return father->dir_perm; } else { father->files[file_name].second[setting]=perm; // return father->files[file_name].second; } } int SGCreateFile(fdirnode *father,const string file_name,const string file_content,account curlogin) { if (isNotHavingPerm(*father,curlogin,"",2)) return 0; // ONLY GETTING PERMISSION IF EXIST if (isFileExists(file_name,father)) return 0; SGProceedFile(father,file_name,file_content,curlogin); father->files[file_name].second[curlogin]=CREATE_PERM; return 1; } // Modify file int SGModifyFile(fdirnode *dir,const string file_name,const string file_content,account curlogin) { if (isNotHavingPerm(*dir,curlogin,file_name,2)) return 0; if (!isFileExists(file_name,dir)) return 0; SGProceedFile(dir,file_name,file_content,curlogin); return 1; } // We need read file... // currently I can only write this. You can just use sscanf() to do something. string SGReadFile(fdirnode *dir,const string file_name,account curlogin) { if (isNotHavingPerm(*dir,curlogin,file_name,4)) return ""; if (!isFileExists(file_name,dir)) return ""; return dir->files[file_name].first; } int SGGetFileLength(fdirnode *dir,const string file_name,account curlogin) { if (isNotHavingPerm(*dir,curlogin,file_name,4)) return 0; if (!isFileExists(file_name,dir)) return -1; return SGReadFile(dir,file_name,curlogin).length(); } // actually we need to move file and copy file. // ! It'll override target if target exists!! int SGCopyFile(fdirnode *source_dir,const string source_filename,fdirnode *dest_dir,const string dest_filename,account curlogin) { if (!isFileExists(source_filename,source_dir)) return 0; if (isNotHavingPerm(*source_dir,curlogin,source_filename,4)) return 0; if (isNotHavingPerm(*dest_dir,curlogin,"",2)) return 0; SGProceedFile(dest_dir,dest_filename,SGReadFile(source_dir,source_filename,curlogin),curlogin); return 1; } int SGMoveFile(fdirnode *source_dir,const string source_filename,fdirnode *dest_dir,const string dest_filename,account curlogin) { if (!isFileExists(source_filename,source_dir)) return 0; SGProceedFile(dest_dir,dest_filename,SGReadFile(source_dir,source_filename,curlogin),curlogin); return SGRmFile(source_dir,source_filename,curlogin); } // Also, we need to list files likes DIR or LS. #define LIST_DIR 1 #define LIST_FILE 2 vector<string> SGListFile(fdirnode *rootdir,const int mode,account curlogin) { vector<string> tresult; if (isNotHavingPerm(*rootdir,curlogin,"",4)) return tresult; // means a empty vector if (mode&1) { map<string,fdirnode*>::iterator i; for (i = rootdir->subdir.begin(); i != rootdir->subdir.end(); i++) { tresult.push_back("[" + i->first + "]"); } } if (mode&2) { map<string,pair<string,permission> >::iterator i; for (i = rootdir->files.begin(); i != rootdir->files.end(); i++) { tresult.push_back(i->first); } } return tresult; } inline int SGWriteFile(fdirnode *root,const string file_name,const string file_content,account curlogin) { if (!isFileExists(file_name,root)) { return SGCreateFile(root,file_name,file_content,curlogin); } else { return SGModifyFile(root,file_name,file_content,curlogin); } } // some easier call using root node inline int SGWriteFileA(fdirnode *root,const string folder_path,const string file_name,const string file_content,account curlogin) { return SGWriteFile(resolve(folder_path,root),file_name,file_content,curlogin); } inline int SGGetFileLengthA(fdirnode *root,const string folder_path,const string dir_name,account curlogin) { return SGGetFileLength(resolve(folder_path,root),dir_name,curlogin); } inline int SGRenameFolderA(fdirnode *root,const string folder_path,const string dir_name,account curlogin) { return SGRenameFolder(resolve(folder_path,root),dir_name,curlogin); } inline int SGCopyFileA(fdirnode *root, const string source_path, const string source_filename, const string dest_path, const string dest_filename,account curlogin) { return SGCopyFile(resolve(source_path,root),source_filename,resolve(dest_path,root),dest_filename,curlogin); } inline int SGMoveFileA(fdirnode *root, const string source_path, const string source_filename, const string dest_path, const string dest_filename,account curlogin) { return SGMoveFile(resolve(source_path,root),source_filename,resolve(dest_path,root),dest_filename,curlogin); } inline vector<string> SGListFileA(fdirnode *root,const string path,const int mode,account curlogin) { return SGListFile(resolve(path,root),mode,curlogin); } inline string SGReadFileA(fdirnode *root,const string path,const string file_name,account curlogin) { return SGReadFile(resolve(path,root),file_name,curlogin); } inline int SGCreateFileA(fdirnode *root,const string path,const string file_name,const string file_content,account curlogin) { return SGCreateFile(resolve(path,root),file_name,file_content,curlogin); } inline int SGModifyFileA(fdirnode *root,const string path,const string file_name,const string file_content,account curlogin) { return SGModifyFile(resolve(path,root),file_name,file_content,curlogin); } inline fdirnode* SGCreateFolderA(fdirnode *root,const string path,const string dir_name,account curlogin) { return SGCreateFolder(resolve(path,root),dir_name,curlogin); } inline bool isFileExistsA(fdirnode *root,const string path,const string dirname) { return isFileExists(dirname,resolve(path,root)); } inline bool isSubdirExistsA(fdirnode *root,const string path,const string dirname) { return isSubdirExists(dirname,resolve(path,root)); } inline int SGRmDirA(fdirnode *root,const string path,account curlogin) { return SGRmDir(resolve(path,root),curlogin); } inline int SGRmFileA(fdirnode *root,const string path,const string filename,account curlogin) { return SGRmFile(resolve(path,root),filename,curlogin); } inline int SGSetPermissionA(fdirnode *root,const string path,const string filename,int perm,account setting,account curlogin) { return SGSetPermission(resolve(path,root),filename,perm,setting,curlogin); } inline int isHavePermA(fdirnode *root,const string path,account query,const string filename) { return isHavePerm(*resolve(path,root),query,filename); } inline int isNotHavingPermA(fdirnode *root,const string path,account query,const string filename,int perm) { return isNotHavingPerm(*resolve(path,root),query,filename,perm); } // for more // they are deprecated by security problem and you should NOT use them anymore. #define rmDir(fd) SGRmDir(fd,curlogin) #define rmDirA(root,path) SGRmDirA(root,path,curlogin) #define rmFile(fd,name) SGRmFile(fd,name,curlogin) #define rmFileA(root,path,name) SGRmFileA(root,path,name,curlogin) #define createFolder(father,dirname) SGCreateFolder(father,dirname,curlogin) #define createFolderA(root,path,dirname) SGCreateFolderA(root,path,dirname,curlogin) #define renameFolder(old_folder,dirname) SGRenameFolder(old_folder,dirname,curlogin) #define renameFolderA(root,path,dirname) SGRenameFolderA(root,path,dirname,curlogin) #define createFile(father,name,content) SGCreateFile(father,name,content,curlogin) #define createFileA(root,path,name,content) SGCreateFileA(root,path,name,content,curlogin) #define modifyFile(dir,filename,filecontent) SGModifyFile(dir,filename,filecontent,curlogin) #define modifyFileA(root,path,filename,filecontent) SGModifyFileA(root,path,filename,filecontent,curlogin) #define readFile(father,name) SGReadFile(father,name,curlogin) #define readFileA(root,path,name) SGReadFileA(root,path,name,curlogin) #define copyFile(sd,sf,dd,df) SGCopyFile(sd,sf,dd,df,curlogin) #define copyFileA(root,sp,sf,dp,df) SGCopyFileA(root,sp,sf,dp,df,curlogin) #define moveFile(sd,sf,dd,df) SGMoveFile(sd,sf,dd,df,curlogin) #define moveFileA(root,sp,sf,dp,df) SGMoveFileA(root,sp,sf,dp,df,curlogin) #define listFile(rd,mode) SGListFile(rd,mode,curlogin) #define listFileA(root,path,mode) SGListFileA(root,path,mode,curlogin) #define getFileLength(dir,fn) SGGetFileLength(dir,fn,curlogin) #define getFileLengthA(root,path,fn) SGGetFileLengthA(root,path,fn,curlogin) #define _proceedFile(father,file_name,file_content) SGWriteFile(father,file_name,file_content,curlogin) // I see we need to initalize root. void rootInit(fdirnode *root,int filesize) { root->delete_symbol=false; root->this_name=""; root->_resv_filesize = new int; *(root->_resv_filesize) = filesize; root->parent=NULL;//Only the root's parent is NULL. map<string,fdirnode*> mf; mf["."]=root; mf[".."]=root;// for avoid override. root->subdir=mf; } #endif
############################################################################### # Copyright 2018 Intel Corporation # All Rights Reserved. # # If this software was obtained under the Intel Simplified Software License, # the following terms apply: # # The source code, information and material ("Material") contained herein is # owned by Intel Corporation or its suppliers or licensors, and title to such # Material remains with Intel Corporation or its suppliers or licensors. The # Material contains proprietary information of Intel or its suppliers and # licensors. The Material is protected by worldwide copyright laws and treaty # provisions. No part of the Material may be used, copied, reproduced, # modified, published, uploaded, posted, transmitted, distributed or disclosed # in any way without Intel's prior express written permission. No license under # any patent, copyright or other intellectual property rights in the Material # is granted to or conferred upon you, either expressly, by implication, # inducement, estoppel or otherwise. Any license under such intellectual # property rights must be express and approved by Intel in writing. # # Unless otherwise agreed by Intel in writing, you may not remove or alter this # notice or any other notice embedded in Materials by Intel or Intel's # suppliers or licensors in any way. # # # If this software was obtained under the Apache License, Version 2.0 (the # "License"), the following terms apply: # # 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. ############################################################################### .section .note.GNU-stack,"",%progbits .text .globl cpGetReg .type cpGetReg, @function cpGetReg: push %ebx push %esi mov (16)(%esp), %eax mov (20)(%esp), %ecx xor %ebx, %ebx xor %edx, %edx mov (12)(%esp), %esi cpuid mov %eax, (%esi) mov %ebx, (4)(%esi) mov %ecx, (8)(%esi) mov %edx, (12)(%esi) pop %esi pop %ebx ret .Lfe1: .size cpGetReg, .Lfe1-(cpGetReg) .globl cp_is_avx_extension .type cp_is_avx_extension, @function cp_is_avx_extension: push %ebp mov %esp, %ebp push %ecx push %edx push %ebx mov $(1), %eax cpuid xor %eax, %eax and $(402653184), %ecx cmp $(402653184), %ecx jne .Lnot_avxgas_2 xor %ecx, %ecx .byte 0xf, 0x1, 0xd0 mov %eax, %ecx xor %eax, %eax and $(6), %ecx cmp $(6), %ecx jne .Lnot_avxgas_2 mov $(1), %eax .Lnot_avxgas_2: pop %ebx pop %edx pop %ecx pop %ebp ret .Lfe2: .size cp_is_avx_extension, .Lfe2-(cp_is_avx_extension) .globl cp_is_avx512_extension .type cp_is_avx512_extension, @function cp_is_avx512_extension: push %ebp mov %esp, %ebp push %ecx push %edx push %ebx mov $(1), %eax cpuid xor %eax, %eax and $(134217728), %ecx cmp $(134217728), %ecx jne .Lnot_avx512gas_3 xor %ecx, %ecx .byte 0xf, 0x1, 0xd0 mov %eax, %ecx xor %eax, %eax and $(224), %ecx cmp $(224), %ecx jne .Lnot_avx512gas_3 mov $(1), %eax .Lnot_avx512gas_3: pop %ebx pop %edx pop %ecx pop %ebp ret .Lfe3: .size cp_is_avx512_extension, .Lfe3-(cp_is_avx512_extension) .weak __ashldi3 .globl __ashldi3 .type __ashldi3, @function __ashldi3: mov (4)(%esp), %eax mov (8)(%esp), %edx mov (12)(%esp), %ecx test $(32), %cl je .Llessgas_4 mov %eax, %edx xor %eax, %eax shl %cl, %edx ret .Llessgas_4: shld %cl, %eax, %edx shl %cl, %eax ret .Lfe4: .size __ashldi3, .Lfe4-(__ashldi3) .p2align 5, 0x90 .weak __ashrdi3 .globl __ashrdi3 .type __ashrdi3, @function __ashrdi3: mov (4)(%esp), %eax mov (8)(%esp), %edx mov (12)(%esp), %ecx test $(32), %cl je .Llessgas_5 mov %edx, %eax sar $(31), %edx sar %cl, %eax ret .Llessgas_5: shrd %cl, %edx, %eax sar %cl, %edx ret .Lfe5: .size __ashrdi3, .Lfe5-(__ashrdi3) .weak __divdi3 .globl __divdi3 .type __divdi3, @function __divdi3: xor %ecx, %ecx movl (8)(%esp), %eax or %eax, %eax jge .LApositivegas_6 mov $(1), %ecx movl (4)(%esp), %edx neg %eax neg %edx sbb $(0), %eax movl %edx, (4)(%esp) movl %eax, (8)(%esp) .LApositivegas_6: movl (16)(%esp), %eax or %eax, %eax jge .LABpositivegas_6 sub $(1), %ecx movl (12)(%esp), %edx neg %eax neg %edx sbb $(0), %eax movl %edx, (12)(%esp) movl %eax, (16)(%esp) .LABpositivegas_6: movl (16)(%esp), %eax xor %edx, %edx push %ecx test %eax, %eax jne .Lnon_zero_higas_6 movl (12)(%esp), %eax divl (16)(%esp) mov %eax, %ecx movl (8)(%esp), %eax divl (16)(%esp) mov %ecx, %edx jmp .Lreturngas_6 .Lnon_zero_higas_6: movl (12)(%esp), %ecx cmp %ecx, %eax jb .Ldivisor_greatergas_6 jne .Lreturn_zerogas_6 movl (16)(%esp), %ecx movl (8)(%esp), %eax cmp %eax, %ecx ja .Lreturn_zerogas_6 .Lreturn_onegas_6: mov $(1), %eax jmp .Lreturngas_6 .Lreturn_zerogas_6: add $(4), %esp xor %eax, %eax ret .Ldivisor_greatergas_6: test $(2147483648), %eax jne .Lreturn_onegas_6 .Lfind_hi_bitgas_6: bsr %eax, %ecx add $(1), %ecx .Lhi_bit_foundgas_6: movl (16)(%esp), %edx push %ebx shrd %cl, %eax, %edx mov %edx, %ebx movl (12)(%esp), %eax movl (16)(%esp), %edx shrd %cl, %edx, %eax shr %cl, %edx .Lmake_divgas_6: div %ebx mov %eax, %ebx mull (24)(%esp) mov %eax, %ecx movl (20)(%esp), %eax mul %ebx add %ecx, %edx jb .Lneed_decgas_6 cmpl %edx, (16)(%esp) jb .Lneed_decgas_6 ja .Lafter_decgas_6 cmpl %eax, (12)(%esp) jae .Lafter_decgas_6 .Lneed_decgas_6: sub $(1), %ebx .Lafter_decgas_6: xor %edx, %edx mov %ebx, %eax pop %ebx .Lreturngas_6: pop %ecx test %ecx, %ecx jne .Lch_signgas_6 ret .Lch_signgas_6: neg %edx neg %eax sbb $(0), %edx ret .Lfe6: .size __divdi3, .Lfe6-(__divdi3) .weak __udivdi3 .globl __udivdi3 .type __udivdi3, @function __udivdi3: xor %ecx, %ecx .LABpositivegas_7: movl (16)(%esp), %eax xor %edx, %edx push %ecx test %eax, %eax jne .Lnon_zero_higas_7 movl (12)(%esp), %eax divl (16)(%esp) mov %eax, %ecx movl (8)(%esp), %eax divl (16)(%esp) mov %ecx, %edx jmp .Lreturngas_7 .Lnon_zero_higas_7: movl (12)(%esp), %ecx cmp %ecx, %eax jb .Ldivisor_greatergas_7 jne .Lreturn_zerogas_7 movl (16)(%esp), %ecx movl (8)(%esp), %eax cmp %eax, %ecx ja .Lreturn_zerogas_7 .Lreturn_onegas_7: mov $(1), %eax jmp .Lreturngas_7 .Lreturn_zerogas_7: add $(4), %esp xor %eax, %eax ret .Ldivisor_greatergas_7: test $(2147483648), %eax jne .Lreturn_onegas_7 .Lfind_hi_bitgas_7: bsr %eax, %ecx add $(1), %ecx .Lhi_bit_foundgas_7: movl (16)(%esp), %edx push %ebx shrd %cl, %eax, %edx mov %edx, %ebx movl (12)(%esp), %eax movl (16)(%esp), %edx shrd %cl, %edx, %eax shr %cl, %edx .Lmake_divgas_7: div %ebx mov %eax, %ebx mull (24)(%esp) mov %eax, %ecx movl (20)(%esp), %eax mul %ebx add %ecx, %edx jb .Lneed_decgas_7 cmpl %edx, (16)(%esp) jb .Lneed_decgas_7 ja .Lafter_decgas_7 cmpl %eax, (12)(%esp) jae .Lafter_decgas_7 .Lneed_decgas_7: sub $(1), %ebx .Lafter_decgas_7: xor %edx, %edx mov %ebx, %eax pop %ebx .Lreturngas_7: pop %ecx test %ecx, %ecx jne .Lch_signgas_7 ret .Lch_signgas_7: neg %edx neg %eax sbb $(0), %edx ret .Lfe7: .size __udivdi3, .Lfe7-(__udivdi3) .weak __moddi3 .globl __moddi3 .type __moddi3, @function __moddi3: sub $(8), %esp movl $(0), (%esp) movl (16)(%esp), %eax or %eax, %eax jge .LApositivegas_8 incl (%esp) movl (12)(%esp), %edx neg %eax neg %edx sbb $(0), %eax movl %eax, (16)(%esp) movl %edx, (12)(%esp) .LApositivegas_8: movl (24)(%esp), %eax or %eax, %eax jge .LABpositivegas_8 movl (20)(%esp), %edx neg %eax neg %edx sbb $(0), %eax movl %eax, (24)(%esp) movl %edx, (20)(%esp) jmp .LABpositivegas_8 lea (%esi), %esi lea (%edi), %edi sub $(8), %esp movl $(0), (%esp) .LABpositivegas_8: movl (24)(%esp), %eax test %eax, %eax jne .Lnon_zero_higas_8 movl (16)(%esp), %eax mov $(0), %edx divl (20)(%esp) mov %eax, %ecx movl (12)(%esp), %eax divl (20)(%esp) mov %edx, %eax xor %edx, %edx jmp .Lreturngas_8 .Lnon_zero_higas_8: movl (16)(%esp), %ecx cmp %ecx, %eax jb .Ldivisor_greatergas_8 jne .Lreturn_devisorgas_8 movl (20)(%esp), %ecx cmpl (12)(%esp), %ecx ja .Lreturn_devisorgas_8 .Lreturn_difgas_8: movl (12)(%esp), %eax movl (16)(%esp), %edx subl (20)(%esp), %eax sbbl (24)(%esp), %edx jmp .Lreturngas_8 .Lreturn_devisorgas_8: movl (12)(%esp), %eax movl (16)(%esp), %edx jmp .Lreturngas_8 .Ldivisor_greatergas_8: test $(2147483648), %eax jne .Lreturn_difgas_8 .Lfind_hi_bitgas_8: bsr %eax, %ecx add $(1), %ecx .Lhi_bit_foundgas_8: push %ebx movl (24)(%esp), %edx shrd %cl, %eax, %edx mov %edx, %ebx movl (16)(%esp), %eax movl (20)(%esp), %edx shrd %cl, %edx, %eax shr %cl, %edx div %ebx mov %eax, %ebx .Lmultiplegas_8: mull (28)(%esp) mov %eax, %ecx movl (24)(%esp), %eax mul %ebx add %ecx, %edx jb .Lneed_decgas_8 cmpl %edx, (20)(%esp) jb .Lneed_decgas_8 ja .Lafter_decgas_8 cmpl %eax, (16)(%esp) jb .Lneed_decgas_8 .Lafter_decgas_8: mov %eax, %ebx movl (16)(%esp), %eax sub %ebx, %eax mov %edx, %ebx movl (20)(%esp), %edx sbb %ebx, %edx pop %ebx .Lreturngas_8: movl %eax, (4)(%esp) movl (%esp), %eax test %eax, %eax jne .Lch_signgas_8 movl (4)(%esp), %eax add $(8), %esp ret .Lch_signgas_8: movl (4)(%esp), %eax neg %edx neg %eax sbb $(0), %edx add $(8), %esp ret .Lneed_decgas_8: dec %ebx mov %ebx, %eax jmp .Lmultiplegas_8 .Lfe8: .size __moddi3, .Lfe8-(__moddi3) .weak __umoddi3 .globl __umoddi3 .type __umoddi3, @function __umoddi3: sub $(8), %esp movl $(0), (%esp) .LABpositivegas_9: movl (24)(%esp), %eax test %eax, %eax jne .Lnon_zero_higas_9 movl (16)(%esp), %eax mov $(0), %edx divl (20)(%esp) mov %eax, %ecx movl (12)(%esp), %eax divl (20)(%esp) mov %edx, %eax xor %edx, %edx jmp .Lreturngas_9 .Lnon_zero_higas_9: movl (16)(%esp), %ecx cmp %ecx, %eax jb .Ldivisor_greatergas_9 jne .Lreturn_devisorgas_9 movl (20)(%esp), %ecx cmpl (12)(%esp), %ecx ja .Lreturn_devisorgas_9 .Lreturn_difgas_9: movl (12)(%esp), %eax movl (16)(%esp), %edx subl (20)(%esp), %eax sbbl (24)(%esp), %edx jmp .Lreturngas_9 .Lreturn_devisorgas_9: movl (12)(%esp), %eax movl (16)(%esp), %edx jmp .Lreturngas_9 .Ldivisor_greatergas_9: test $(2147483648), %eax jne .Lreturn_difgas_9 .Lfind_hi_bitgas_9: bsr %eax, %ecx add $(1), %ecx .Lhi_bit_foundgas_9: push %ebx movl (24)(%esp), %edx shrd %cl, %eax, %edx mov %edx, %ebx movl (16)(%esp), %eax movl (20)(%esp), %edx shrd %cl, %edx, %eax shr %cl, %edx div %ebx mov %eax, %ebx .Lmultiplegas_9: mull (28)(%esp) mov %eax, %ecx movl (24)(%esp), %eax mul %ebx add %ecx, %edx jb .Lneed_decgas_9 cmpl %edx, (20)(%esp) jb .Lneed_decgas_9 ja .Lafter_decgas_9 cmpl %eax, (16)(%esp) jb .Lneed_decgas_9 .Lafter_decgas_9: mov %eax, %ebx movl (16)(%esp), %eax sub %ebx, %eax mov %edx, %ebx movl (20)(%esp), %edx sbb %ebx, %edx pop %ebx .Lreturngas_9: movl %eax, (4)(%esp) movl (%esp), %eax test %eax, %eax jne .Lch_signgas_9 movl (4)(%esp), %eax add $(8), %esp ret .Lch_signgas_9: movl (4)(%esp), %eax neg %edx neg %eax sbb $(0), %edx add $(8), %esp ret .Lneed_decgas_9: dec %ebx mov %ebx, %eax jmp .Lmultiplegas_9 .Lfe9: .size __umoddi3, .Lfe9-(__umoddi3) .weak __muldi3 .globl __muldi3 .type __muldi3, @function __muldi3: movl (8)(%esp), %eax mull (12)(%esp) mov %eax, %ecx movl (4)(%esp), %eax mull (16)(%esp) add %eax, %ecx movl (4)(%esp), %eax mull (12)(%esp) add %ecx, %edx ret .Lfe10: .size __muldi3, .Lfe10-(__muldi3) .globl cp_get_pentium_counter .type cp_get_pentium_counter, @function cp_get_pentium_counter: rdtsc ret .Lfe11: .size cp_get_pentium_counter, .Lfe11-(cp_get_pentium_counter) .globl cpStartTscp .type cpStartTscp, @function cpStartTscp: push %ebx xor %eax, %eax cpuid pop %ebx rdtscp ret .Lfe12: .size cpStartTscp, .Lfe12-(cpStartTscp) .globl cpStopTscp .type cpStopTscp, @function cpStopTscp: rdtscp push %eax push %edx push %ebx xor %eax, %eax cpuid pop %ebx pop %edx pop %eax ret .Lfe13: .size cpStopTscp, .Lfe13-(cpStopTscp) .globl cpStartTsc .type cpStartTsc, @function cpStartTsc: push %ebx xor %eax, %eax cpuid pop %ebx rdtsc ret .Lfe14: .size cpStartTsc, .Lfe14-(cpStartTsc) .globl cpStopTsc .type cpStopTsc, @function cpStopTsc: rdtsc push %eax push %edx push %ebx xor %eax, %eax cpuid pop %ebx pop %edx pop %eax ret .Lfe15: .size cpStopTsc, .Lfe15-(cpStopTsc) .globl cpGetCacheSize .type cpGetCacheSize, @function cpGetCacheSize: push %edi push %esi push %ebx push %ebp sub $(16), %esp mov (13)(%esp), %edi mov %esp, %ebp xor %esi, %esi mov $(2), %eax cpuid cmp $(1), %al jne .LGetCacheSize_11gas_16 test $(2147483648), %eax jz .LGetCacheSize_00gas_16 xor %eax, %eax .LGetCacheSize_00gas_16: test $(2147483648), %ebx jz .LGetCacheSize_01gas_16 xor %ebx, %ebx .LGetCacheSize_01gas_16: test $(2147483648), %ecx jz .LGetCacheSize_02gas_16 xor %ecx, %ecx .LGetCacheSize_02gas_16: test $(2147483648), %edx jz .LGetCacheSize_03gas_16 xor %edx, %edx .LGetCacheSize_03gas_16: test %eax, %eax jz .LGetCacheSize_04gas_16 mov %eax, (%ebp) add $(4), %ebp add $(3), %esi .LGetCacheSize_04gas_16: test %ebx, %ebx jz .LGetCacheSize_05gas_16 mov %ebx, (%ebp) add $(4), %ebp add $(4), %esi .LGetCacheSize_05gas_16: test %ecx, %ecx jz .LGetCacheSize_06gas_16 mov %ecx, (%ebp) add $(4), %ebp add $(4), %esi .LGetCacheSize_06gas_16: test %edx, %edx jz .LGetCacheSize_07gas_16 mov %edx, (%ebp) add $(4), %esi .LGetCacheSize_07gas_16: test %esi, %esi jz .LGetCacheSize_11gas_16 mov $(-1), %eax .LGetCacheSize_08gas_16: xor %edx, %edx add (%edi), %edx jz .LExitGetCacheSize00gas_16 add $(8), %edi mov %esi, %ecx .LGetCacheSize_09gas_16: cmpb (%esp,%ecx), %dl je .LGetCacheSize_10gas_16 dec %ecx jnz .LGetCacheSize_09gas_16 jmp .LGetCacheSize_08gas_16 .LGetCacheSize_10gas_16: mov (-4)(%edi), %eax .LExitGetCacheSize00gas_16: add $(16), %esp pop %ebp pop %ebx pop %esi pop %edi ret .LGetCacheSize_11gas_16: mov $(-1), %eax jmp .LExitGetCacheSize00gas_16 .Lfe16: .size cpGetCacheSize, .Lfe16-(cpGetCacheSize)
.global s_prepare_buffers s_prepare_buffers: push %r11 push %r13 push %r14 push %rax push %rcx push %rdi push %rdx push %rsi lea addresses_D_ht+0x19a7b, %rsi lea addresses_normal_ht+0xa2db, %rdi nop nop nop and %r11, %r11 mov $54, %rcx rep movsq xor %rax, %rax lea addresses_D_ht+0x12e5b, %rdx nop sub %r13, %r13 vmovups (%rdx), %ymm0 vextracti128 $1, %ymm0, %xmm0 vpextrq $0, %xmm0, %r11 nop nop nop xor $26732, %rsi lea addresses_UC_ht+0xc6f, %rdx nop nop nop and $46788, %r13 mov $0x6162636465666768, %rax movq %rax, %xmm6 movups %xmm6, (%rdx) nop nop and %rcx, %rcx lea addresses_normal_ht+0x82db, %rsi lea addresses_A_ht+0xeedb, %rdi nop nop nop and %r14, %r14 mov $124, %rcx rep movsw nop nop nop nop and %r14, %r14 lea addresses_UC_ht+0xe2db, %rsi lea addresses_UC_ht+0x1df2b, %rdi nop and $60867, %r14 mov $72, %rcx rep movsw nop nop nop nop nop cmp %rsi, %rsi lea addresses_WC_ht+0x10b43, %rdi nop nop nop nop add %r14, %r14 mov $0x6162636465666768, %rsi movq %rsi, %xmm2 movups %xmm2, (%rdi) nop nop nop inc %r11 pop %rsi pop %rdx pop %rdi pop %rcx pop %rax pop %r14 pop %r13 pop %r11 ret .global s_faulty_load s_faulty_load: push %r12 push %r13 push %rax push %rbp push %rbx push %rdi push %rsi // Store lea addresses_WC+0x4adb, %rbp nop nop and %r13, %r13 movb $0x51, (%rbp) nop nop nop nop cmp $33235, %rbp // Store lea addresses_D+0x143e5, %r13 clflush (%r13) nop nop nop nop inc %rbx movb $0x51, (%r13) nop nop nop nop add $48889, %rbx // Faulty Load lea addresses_WC+0x4adb, %rax nop nop nop add $45942, %rbp movups (%rax), %xmm6 vpextrq $1, %xmm6, %rdi lea oracles, %rbx and $0xff, %rdi shlq $12, %rdi mov (%rbx,%rdi,1), %rdi pop %rsi pop %rdi pop %rbx pop %rbp pop %rax pop %r13 pop %r12 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_WC', 'AVXalign': False, 'size': 8, 'NT': True, 'same': False, 'congruent': 0}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'type': 'addresses_WC', 'AVXalign': False, 'size': 1, 'NT': False, 'same': True, 'congruent': 0}} {'OP': 'STOR', 'dst': {'type': 'addresses_D', 'AVXalign': False, 'size': 1, 'NT': True, 'same': False, 'congruent': 1}} [Faulty Load] {'src': {'type': 'addresses_WC', 'AVXalign': False, 'size': 16, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'type': 'addresses_D_ht', 'congruent': 5, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_normal_ht', 'congruent': 8, 'same': False}} {'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'size': 32, 'NT': False, 'same': True, 'congruent': 7}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 1}} {'src': {'type': 'addresses_normal_ht', 'congruent': 11, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_A_ht', 'congruent': 10, 'same': False}} {'src': {'type': 'addresses_UC_ht', 'congruent': 11, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_UC_ht', 'congruent': 4, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 16, 'NT': False, 'same': True, 'congruent': 1}} {'38': 21829} 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 */
; Copyright 2015-2021 Matt "MateoConLechuga" Waltz ; ; Redistribution and use in source and binary forms, with or without ; modification, are permitted provided that the following conditions are met: ; ; 1. Redistributions of source code must retain the above copyright notice, ; this list of conditions and the following disclaimer. ; ; 2. Redistributions 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. ; ; 3. Neither the name of the copyright holder nor the names of its contributors ; may 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 COPYRIGHT HOLDER 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. cesium_name := 'Cesium' cesium_version := '3.4.1' cesium_copyright := '(C) 2015-2021 Matt Waltz' include 'include/macros.inc' ; start by executing the installer code ; this is run once in order to create the application include 'installer.asm' ; this is the start of the actual application app_start cesium_name, cesium_copyright cesium_start: cesium_code.run relocate cesium_code, cesium_execution_base include 'main.asm' include 'exit.asm' include 'edit.asm' include 'search.asm' include 'view-vat-items.asm' include 'view-apps.asm' include 'view-usb.asm' include 'features.asm' include 'settings.asm' include 'gui.asm' include 'lcd.asm' include 'util.asm' include 'libload.asm' include 'usb.asm' include 'find.asm' include 'sort.asm' include 'luts.asm' include 'ports.asm' include 'sprites.asm' include 'strings.asm' end relocate ; we want to keep these things in flash include 'execute.asm' include 'flash.asm' include 'hooks.asm' include 'data.asm'
#include "taichi/backends/opengl/opengl_program.h" #include "taichi/backends/opengl/aot_module_builder_impl.h" using namespace taichi::lang::opengl; namespace taichi { namespace lang { FunctionType OpenglProgramImpl::compile(Kernel *kernel, OffloadedStmt *offloaded) { #ifdef TI_WITH_OPENGL opengl::OpenglCodeGen codegen(kernel->name, &opengl_struct_compiled_.value()); auto ptr = opengl_runtime_->keep(codegen.compile(*kernel)); return [ptr, runtime = opengl_runtime_.get()](Context &ctx) { ptr->launch(ctx, runtime); }; #else return [](Context &ctx) {}; #endif } void OpenglProgramImpl::materialize_runtime(MemoryPool *memory_pool, KernelProfilerBase *profiler, uint64 **result_buffer_ptr) { #ifdef TI_WITH_OPENGL *result_buffer_ptr = (uint64 *)memory_pool->allocate( sizeof(uint64) * taichi_result_buffer_entries, 8); opengl_runtime_ = std::make_unique<opengl::OpenGlRuntime>(); #else TI_NOT_IMPLEMENTED; #endif } void OpenglProgramImpl::compile_snode_tree_types(SNodeTree *tree) { // TODO: support materializing multiple snode trees opengl::OpenglStructCompiler scomp; opengl_struct_compiled_ = scomp.run(*(tree->root())); TI_TRACE("OpenGL root buffer size: {} B", opengl_struct_compiled_->root_size); } void OpenglProgramImpl::materialize_snode_tree( SNodeTree *tree, std::vector<std::unique_ptr<SNodeTree>> &, uint64 *result_buffer) { #ifdef TI_WITH_OPENGL compile_snode_tree_types(tree); opengl_runtime_->add_snode_tree(opengl_struct_compiled_->root_size); opengl_runtime_->result_buffer = result_buffer; #else TI_NOT_IMPLEMENTED; #endif } std::unique_ptr<AotModuleBuilder> OpenglProgramImpl::make_aot_module_builder() { // TODO: Remove this compilation guard -- AOT is a compile-time thing, so it's // fine to JIT to GLSL on systems without the OpenGL runtime. #ifdef TI_WITH_OPENGL return std::make_unique<AotModuleBuilderImpl>( opengl_struct_compiled_.value()); #else TI_NOT_IMPLEMENTED; return nullptr; #endif } } // namespace lang } // namespace taichi
SilphCo10Object: db $2e ; border block db $6 ; warps db $0, $8, $0, SILPH_CO_9F db $0, $a, $0, SILPH_CO_11F db $0, $c, $0, SILPH_CO_ELEVATOR db $b, $9, $3, SILPH_CO_4F db $f, $d, $5, SILPH_CO_4F db $7, $d, $6, SILPH_CO_4F db $0 ; signs db $6 ; objects object SPRITE_ROCKET, $1, $9, STAY, RIGHT, $1, OPP_ROCKET, $27 object SPRITE_OAK_AIDE, $a, $2, STAY, LEFT, $2, OPP_SCIENTIST, $b object SPRITE_ERIKA, $9, $f, WALK, $0, $3 ; person object SPRITE_BALL, $2, $c, STAY, NONE, $4, TM_26 object SPRITE_BALL, $4, $e, STAY, NONE, $5, RARE_CANDY object SPRITE_BALL, $5, $b, STAY, NONE, $6, CARBOS ; warp-to EVENT_DISP SILPH_CO_10F_WIDTH, $0, $8 ; SILPH_CO_9F EVENT_DISP SILPH_CO_10F_WIDTH, $0, $a ; SILPH_CO_11F EVENT_DISP SILPH_CO_10F_WIDTH, $0, $c ; SILPH_CO_ELEVATOR EVENT_DISP SILPH_CO_10F_WIDTH, $b, $9 ; SILPH_CO_4F EVENT_DISP SILPH_CO_10F_WIDTH, $f, $d ; SILPH_CO_4F EVENT_DISP SILPH_CO_10F_WIDTH, $7, $d ; SILPH_CO_4F
//------------------------------------------------------------- // ___ __ ___ _ _ _ // KRATOS| _ \/ _|___ _ __ | __| |_ _(_)__| | // | _/ _/ -_) ' \| _|| | || | / _` | // |_| |_| \___|_|_|_|_| |_|\_,_|_\__,_|DYNAMICS // // BSD License: PfemFluidDynamicsApplication/license.txt // // Main authors: Jordi Cotela // Collaborators: Massimiliano Zecchetto // //------------------------------------------------------------- // #include "fluid_constitutive_law.h" namespace Kratos { // Life cycle ///////////////////////////////////////////////////////////////// PfemFluidConstitutiveLaw::PfemFluidConstitutiveLaw() : ConstitutiveLaw() {} PfemFluidConstitutiveLaw::PfemFluidConstitutiveLaw(const PfemFluidConstitutiveLaw& rOther) : ConstitutiveLaw(rOther) {} PfemFluidConstitutiveLaw::~PfemFluidConstitutiveLaw() {} // Public operations ////////////////////////////////////////////////////////// ConstitutiveLaw::Pointer PfemFluidConstitutiveLaw::Clone() const { KRATOS_ERROR << "Calling base PfemFluidConstitutiveLaw::Clone method. This " "class should not be instantiated. Please check your " "constitutive law." << std::endl; return Kratos::make_shared<PfemFluidConstitutiveLaw>(*this); } void PfemFluidConstitutiveLaw::CalculateMaterialResponseCauchy(Parameters& rValues) { KRATOS_ERROR << "Calling base " "PfemFluidConstitutiveLaw::CalculateMaterialResponseCauchy " "method. This class should not be instantiated. Please " "check your constitutive law." << std::endl; } int PfemFluidConstitutiveLaw::Check(const Properties& rMaterialProperties, const GeometryType& rElementGeometry, const ProcessInfo& rCurrentProcessInfo) { KRATOS_ERROR << "Calling base " "PfemFluidConstitutiveLaw::Check " "method. This class should not be instantiated. Please " "check your constitutive law." << std::endl; return 999; } // Access ///////////////////////////////////////////////////////////////////// double& PfemFluidConstitutiveLaw::CalculateValue(ConstitutiveLaw::Parameters& rParameters, const Variable<double>& rThisVariable, double& rValue) { rValue = this->GetEffectiveDensity(rParameters); return rValue; } // Inquiry //////////////////////////////////////////////////////////////////// ConstitutiveLaw::SizeType PfemFluidConstitutiveLaw::WorkingSpaceDimension() { KRATOS_ERROR << "Calling base " "PfemFluidConstitutiveLaw::WorkingSpaceDimension " "method. This class should not be instantiated. Please " "check your constitutive law." << std::endl; return 0; } ConstitutiveLaw::SizeType PfemFluidConstitutiveLaw::GetStrainSize() { KRATOS_ERROR << "Calling base " "PfemFluidConstitutiveLaw::GetStrainSize " "method. This class should not be instantiated. Please " "check your constitutive law." << std::endl; return 0; } // Info /////////////////////////////////////////////////////////////////////// std::string PfemFluidConstitutiveLaw::Info() const { return "PfemFluidConstitutiveLaw"; } void PfemFluidConstitutiveLaw::PrintInfo(std::ostream& rOStream) const { rOStream << this->Info(); } void PfemFluidConstitutiveLaw::PrintData(std::ostream& rOStream) const { rOStream << this->Info(); } // Protected operations /////////////////////////////////////////////////////// void PfemFluidConstitutiveLaw::EffectiveViscousConstitutiveMatrix2D(double EffectiveDynamicViscosity, Matrix& rConstitutiveMatrix) { constexpr double two_thirds = 2.0 / 3.0; constexpr double four_thirds = 4.0 / 3.0; rConstitutiveMatrix(0, 0) = +EffectiveDynamicViscosity * four_thirds; rConstitutiveMatrix(0, 1) = -EffectiveDynamicViscosity * two_thirds; rConstitutiveMatrix(0, 2) = 0.0; rConstitutiveMatrix(1, 0) = -EffectiveDynamicViscosity * two_thirds; rConstitutiveMatrix(1, 1) = +EffectiveDynamicViscosity * four_thirds; rConstitutiveMatrix(1, 2) = 0.0; rConstitutiveMatrix(2, 0) = 0.0; rConstitutiveMatrix(2, 1) = 0.0; rConstitutiveMatrix(2, 2) = +EffectiveDynamicViscosity; } void PfemFluidConstitutiveLaw::EffectiveViscousConstitutiveMatrix3D(double EffectiveDynamicViscosity, Matrix& rConstitutiveMatrix) { rConstitutiveMatrix.clear(); constexpr double two_thirds = 2.0 / 3.0; constexpr double four_thirds = 4.0 / 3.0; rConstitutiveMatrix(0, 0) = +EffectiveDynamicViscosity * four_thirds; rConstitutiveMatrix(0, 1) = -EffectiveDynamicViscosity * two_thirds; rConstitutiveMatrix(0, 2) = -EffectiveDynamicViscosity * two_thirds; rConstitutiveMatrix(1, 0) = -EffectiveDynamicViscosity * two_thirds; rConstitutiveMatrix(1, 1) = +EffectiveDynamicViscosity * four_thirds; rConstitutiveMatrix(1, 2) = -EffectiveDynamicViscosity * two_thirds; rConstitutiveMatrix(2, 0) = -EffectiveDynamicViscosity * two_thirds; rConstitutiveMatrix(2, 1) = -EffectiveDynamicViscosity * two_thirds; rConstitutiveMatrix(2, 2) = +EffectiveDynamicViscosity * four_thirds; rConstitutiveMatrix(3, 3) = +EffectiveDynamicViscosity; rConstitutiveMatrix(4, 4) = +EffectiveDynamicViscosity; rConstitutiveMatrix(5, 5) = +EffectiveDynamicViscosity; } // Protected access /////////////////////////////////////////////////////////// double PfemFluidConstitutiveLaw::GetEffectiveViscosity(ConstitutiveLaw::Parameters& rParameters) const { KRATOS_ERROR << "Accessing base class PfemFluidConstitutiveLaw::GetEffectiveViscosity." << std::endl; return 0.0; } double PfemFluidConstitutiveLaw::GetEffectiveDensity(ConstitutiveLaw::Parameters& rParameters) const { KRATOS_ERROR << "Accessing base class PfemFluidConstitutiveLaw::GetEffectiveDensity." << std::endl; return 0.0; } double PfemFluidConstitutiveLaw::CalculateAveragedVariable(const Variable<double>& rVariableInput, ConstitutiveLaw::Parameters& rParameters, unsigned int step) const { const GeometryType& r_geometry = rParameters.GetElementGeometry(); const unsigned int number_of_nodes = r_geometry.size(); double result = 0; for (unsigned int i = 0; i < number_of_nodes; i++) { result += r_geometry[i].FastGetSolutionStepValue(rVariableInput, step); } result /= number_of_nodes; return result; } double PfemFluidConstitutiveLaw::CalculateInGaussPoint(const Variable<double>& rVariableInput, ConstitutiveLaw::Parameters& rParameters, unsigned int step) const { const GeometryType& r_geometry = rParameters.GetElementGeometry(); const unsigned int number_of_nodes = r_geometry.size(); const auto& r_shape_function = rParameters.GetShapeFunctionsValues(); double result = 0; for (unsigned int i = 0; i < number_of_nodes; i++) { result += r_shape_function[i] * r_geometry[i].FastGetSolutionStepValue(rVariableInput, step); } return result; } double PfemFluidConstitutiveLaw::GetValueFromTable(const Variable<double>& rIndependentVariable, const Variable<double>& rDependentVariable, ConstitutiveLaw::Parameters& rParameters) const { // Get material properties from constitutive law parameters const Properties& r_properties = rParameters.GetMaterialProperties(); // Get geometry and Gauss points data const auto& r_geometry = rParameters.GetElementGeometry(); const auto& r_N = rParameters.GetShapeFunctionsValues(); // Compute the independent variable at the Gauss point double independent_at_gauss = 0.0; double dependent_at_gauss = 0.0; for (unsigned int i = 0; i < r_N.size(); ++i) { const double& r_val = r_geometry[i].FastGetSolutionStepValue(rIndependentVariable); independent_at_gauss += r_val * r_N[i]; } // Retrieve the dependent variable from the table const auto& r_table = r_properties.GetTable(rIndependentVariable, rDependentVariable); dependent_at_gauss = r_table.GetValue(independent_at_gauss); return dependent_at_gauss; } // Serialization ////////////////////////////////////////////////////////////// void PfemFluidConstitutiveLaw::save(Serializer& rSerializer) const { KRATOS_SERIALIZE_SAVE_BASE_CLASS(rSerializer, ConstitutiveLaw); } void PfemFluidConstitutiveLaw::load(Serializer& rSerializer) { KRATOS_SERIALIZE_LOAD_BASE_CLASS(rSerializer, ConstitutiveLaw); } } // namespace Kratos
;------------------------------------------------------------------------------ ; ; 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: ; ; SetJump.Asm ; ; Abstract: ; ; Implementation of SetJump() on IA-32. ; ;------------------------------------------------------------------------------ .386 .model flat,C .code InternalAssertJumpBuffer PROTO C ;------------------------------------------------------------------------------ ; UINTN ; EFIAPI ; SetJump ( ; OUT BASE_LIBRARY_JUMP_BUFFER *JumpBuffer ; ); ;------------------------------------------------------------------------------ SetJump PROC push [esp + 4] call InternalAssertJumpBuffer ; To validate JumpBuffer pop ecx pop ecx ; ecx <- return address mov edx, [esp] mov [edx], ebx mov [edx + 4], esi mov [edx + 8], edi mov [edx + 12], ebp mov [edx + 16], esp mov [edx + 20], ecx ; eip value to restore in LongJump xor eax, eax jmp ecx SetJump ENDP END
// Copyright Henrik Steffen Gaßmann 2020. // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE or copy at // https://www.boost.org/LICENSE_1_0.txt) #pragma once #include <cstddef> #include <cstring> #include <concepts> #include <memory> #include <new> #include <span> #include <type_traits> #include <utility> #include <dplx/dp/disappointment.hpp> namespace dplx::dp { template <typename T> class basic_memory_buffer { T *mWindowBegin{}; unsigned mWindowSize{}; unsigned mAllocationSize{}; public: using element_type = T; using value_type = std::remove_cv_t<T>; using pointer = T *; using const_pointer = T const *; using reference = T &; using const_reference = T const &; using size_type = unsigned; using difference_type = int; explicit constexpr basic_memory_buffer() noexcept = default; explicit constexpr basic_memory_buffer(pointer memory, size_type allocationSize, difference_type consumed) noexcept : mWindowBegin(memory + static_cast<size_type>(consumed)) , mWindowSize(allocationSize - static_cast<size_type>(consumed)) , mAllocationSize(allocationSize) { } template <typename U, std::size_t Extent> // NOLINTNEXTLINE(modernize-avoid-c-arrays) requires(std::convertible_to<U (*)[], T (*)[]>) explicit constexpr basic_memory_buffer(std::span<U, Extent> const &memory) : basic_memory_buffer( memory.data(), static_cast<size_type>(memory.size_bytes()), 0) { } template <typename U> // NOLINTNEXTLINE(modernize-avoid-c-arrays) requires(std::convertible_to<U (*)[], T (*)[]>) explicit constexpr basic_memory_buffer(basic_memory_buffer<U> const &other) : mWindowBegin(other.remaining_begin()) , mWindowSize(other.remaining_size()) , mAllocationSize(other.buffer_size()) { } friend inline void swap(basic_memory_buffer &lhs, basic_memory_buffer &rhs) noexcept { using std::swap; swap(lhs.mWindowBegin, rhs.mWindowBegin); swap(lhs.mWindowSize, rhs.mWindowSize); swap(lhs.mAllocationSize, rhs.mAllocationSize); } [[nodiscard]] inline auto consumed_begin() const noexcept -> pointer { return mWindowBegin + mWindowSize - mAllocationSize; } [[nodiscard]] inline auto consumed_end() const noexcept -> pointer { return mWindowBegin; } [[nodiscard]] inline auto consumed_size() const noexcept -> size_type { return mAllocationSize - mWindowSize; } [[nodiscard]] inline auto consumed() const noexcept -> std::span<element_type> { return {mWindowBegin + mWindowSize - mAllocationSize, mAllocationSize - mWindowSize}; } [[nodiscard]] inline auto remaining_begin() const noexcept -> pointer { return mWindowBegin; } [[nodiscard]] inline auto remaining_end() const noexcept -> pointer { return mWindowBegin + mWindowSize; } [[nodiscard]] inline auto remaining_size() const noexcept -> size_type { return mWindowSize; } [[nodiscard]] inline auto remaining() const noexcept -> std::span<element_type> { return {mWindowBegin, mWindowSize}; } [[nodiscard]] inline auto buffer_size() const noexcept -> size_type { return mAllocationSize; } inline void reset() noexcept { mWindowBegin += mWindowSize - mAllocationSize; mWindowSize = mAllocationSize; } [[nodiscard]] inline auto consume(difference_type const amount) noexcept -> pointer { mWindowSize -= static_cast<size_type>(amount); return std::exchange(mWindowBegin, mWindowBegin + amount); } inline void move_consumer(difference_type const amount) noexcept { mWindowBegin += amount; mWindowSize -= static_cast<size_type>(amount); } inline void move_consumer_to(difference_type const absoluteOffset) noexcept { auto const newSize = mAllocationSize - absoluteOffset; mWindowBegin += mWindowSize - newSize; mWindowSize = newSize; } }; using memory_buffer = basic_memory_buffer<std::byte>; using memory_view = basic_memory_buffer<std::byte const>; template <typename Allocator> requires std::same_as<typename Allocator::value_type, std::byte> class memory_allocation final { public: using allocator_type = Allocator; using allocator_traits = std::allocator_traits<allocator_type>; private: std::span<std::byte> mBuffer{}; /*[[no_unique_address]]*/ allocator_type mAllocator{}; public: using size_type = unsigned; ~memory_allocation() noexcept { if (mBuffer.data() != nullptr) { allocator_traits::deallocate(mAllocator, mBuffer.data(), mBuffer.size()); } } explicit memory_allocation() noexcept = default; memory_allocation(memory_allocation const &) = delete; auto operator=(memory_allocation const &) -> memory_allocation & = delete; memory_allocation(memory_allocation &&other) noexcept : mBuffer(std::exchange(other.mBuffer, {})) , mAllocator(std::move(other.mAllocator)) { } auto operator=(memory_allocation &&other) noexcept -> memory_allocation & { mBuffer = std::exchange(other.mBuffer, {}); if constexpr (allocator_traits::propagate_on_container_move_assignment:: value) { mAllocator = std::move(other.mAllocator); } return *this; } explicit memory_allocation(allocator_type bufferAllocator) : mBuffer() , mAllocator(std::move(bufferAllocator)) { } friend inline void swap(memory_allocation &lhs, memory_allocation &rhs) noexcept { std::ranges::swap(lhs.mBuffer, rhs.mBuffer); std::ranges::swap(lhs.mAllocator, rhs.mAllocator); } [[nodiscard]] inline auto as_memory_buffer() const noexcept -> memory_buffer { return dp::memory_buffer(mBuffer); } [[nodiscard /*, deprecated*/]] auto as_buffer_view() const noexcept -> memory_buffer { return dp::memory_buffer(mBuffer); } [[nodiscard]] auto as_span() const noexcept -> std::span<std::byte> { return mBuffer; } [[nodiscard]] inline auto size() const noexcept -> size_type { return static_cast<size_type>(mBuffer.size()); } inline auto resize(size_type const newSize) noexcept -> result<void> { if (mBuffer.size() == newSize) { return dp::success(); } if (mBuffer.data() != nullptr) { allocator_traits::deallocate(mAllocator, mBuffer.data(), mBuffer.size()); mBuffer = std::span<std::byte>(); } return allocate(newSize); } inline auto grow(size_type const newSize) noexcept -> result<void> { if (newSize <= mBuffer.size()) { return errc::bad; // TODO: appropriate error code for invalid // parameter values } auto const *const oldMemory = mBuffer.data(); auto const oldSize = mBuffer.size(); auto allocRx = allocate(newSize); if (allocRx) { std::memcpy(mBuffer.data(), oldMemory, oldSize); allocator_traits::deallocate(mAllocator, oldMemory, oldSize); } return allocRx; } private: inline auto allocate(size_type const bufferSize) noexcept -> result<void> { try { auto const memory = allocator_traits::allocate(mAllocator, bufferSize); mBuffer = std::span<std::byte>(memory, bufferSize); return dp::success(); } catch (std::bad_alloc const &) { return errc::not_enough_memory; } } }; } // namespace dplx::dp
# ========================================================================= # # NAME: # DATE: June 13, 2001 # ASSIGNMENT: Homework #8, CSC-201-01 # OBJECTIVE: Read any amount of numbers from the keyboard. Find the total # sum and product for the numbers. Also print the amount of # numbers given. Also find the average. # # ========================================================================= .data .align 2 prompt1: .asciiz "Enter any amount of numbers (0 to exit)\n" prompt2: .asciiz "The sum is " prompt3: .asciiz "The product is " prompt4: .asciiz "The average is " prompt5: .asciiz "The number of integers entered is " newline: .asciiz "\n" .text .align 2 main: # ========================================================================= # # $t0 - counter # $t1 - sum # $t2 - product # # ========================================================================= # ::::: OP :::: ARGUMENTS ::::::::::::: COMMENTS :::::::::::::::::::::::::: # ========================================================================= la $a0, prompt1 li $v0, 4 syscall # print "Enter 4 numbers.\n" li $t0, 0 # counter = 0 li $t1, 0 # sum = 0 li $t2, 1 # product = 1 # ========================================================================= read_number: li $v0, 5 syscall # read integer beq $v0, 0, check # exit if not a number or 0 add $t0, $t0, 1 # increment counter add $t1, $t1, $v0 # store sum mul $t2, $t2, $v0 # store product j read_number # jump to beginning of loop check: bne $t0, 0, read_number_e # exit if numbers were entered li $t2, 0 # product = 0 read_number_e: # ========================================================================= la $a0, prompt2 li $v0, 4 syscall # print "The sum is " add $a0, $t1, $zero # copy sum li $v0, 1 syscall # print sum la $a0, newline li $v0, 4 syscall # print new line # ========================================================================= la $a0, prompt3 li $v0, 4 syscall # print "The product is " move $a0, $t2 li $v0, 1 syscall # print product la $a0, newline li $v0, 4 syscall # print new line # ========================================================================= la $a0, prompt4 li $v0, 4 syscall # print "The average is ... " div $a0, $t1, $t0 # $a0 = sum / counter li $v0, 1 syscall # print counter la $a0, newline li $v0, 4 syscall # print new line # ========================================================================= la $a0, prompt5 li $v0, 4 syscall # print "The number of ... " add $a0, $t0, $zero # copy counter li $v0, 1 syscall # print counter la $a0, newline li $v0, 4 syscall # print new line # ========================================================================= li $v0, 10 syscall # exit program # ========================================================================= # :::::::::::::::::::::::::::: END OF PROGRAM! :::::::::::::::::::::::::::: # =========================================================================
; A130330: Triangle read by rows, the matrix product A130321 * A000012, both taken as infinite lower triangular matrices. ; 1,3,1,7,3,1,15,7,3,1,31,15,7,3,1,63,31,15,7,3,1,127,63,31,15,7,3,1,255,127,63,31,15,7,3,1,511,255,127,63,31,15,7,3,1,1023,511,255,127,63,31,15,7,3,1,2047,1023,511,255,127,63,31,15,7,3,1,4095,2047,1023,511,255,127,63,31,15,7,3,1,8191,4095,2047,1023,511,255,127,63,31,15,7,3,1,16383,8191,4095,2047,1023,511,255,127,63,31,15,7,3,1,32767,16383,8191,4095,2047,1023,511,255,127,63,31,15,7,3,1,65535,32767,16383,8191,4095,2047,1023,511,255,127,63,31,15,7,3,1,131071,65535,32767,16383,8191,4095,2047,1023,511,255,127,63,31,15,7,3,1,262143,131071,65535,32767,16383,8191,4095,2047,1023,511,255,127,63,31,15,7,3,1,524287,262143,131071,65535,32767,16383,8191,4095,2047,1023,511,255,127,63,31,15,7,3,1,1048575,524287,262143,131071,65535,32767,16383,8191,4095,2047,1023,511,255,127,63,31,15,7,3,1,2097151,1048575,524287,262143,131071,65535,32767,16383,8191,4095,2047,1023,511,255,127,63,31,15,7,3,1,4194303,2097151,1048575,524287,262143,131071,65535,32767,16383,8191,4095,2047,1023,511,255,127,63,31,15 cal $0,25676 ; Exponent of 8 (value of i) in n-th number of form 8^i*9^j. mov $2,2 pow $2,$0 add $1,$2 sub $1,1 mul $1,2 add $1,1
;****************************************************************************** ;* MMX/SSE2-optimized functions for the VP6 decoder ;* Copyright (C) 2009 Sebastien Lucas <sebastien.lucas@gmail.com> ;* Copyright (C) 2009 Zuxy Meng <zuxy.meng@gmail.com> ;* ;* This file is part of Libav. ;* ;* Libav 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. ;* ;* Libav 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 Libav; if not, write to the Free Software ;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ;****************************************************************************** %include "libavutil/x86/x86util.asm" cextern pw_64 SECTION .text %macro DIAG4 6 %if mmsize == 8 movq m0, [%1+%2] movq m1, [%1+%3] movq m3, m0 movq m4, m1 punpcklbw m0, m7 punpcklbw m1, m7 punpckhbw m3, m7 punpckhbw m4, m7 pmullw m0, [rsp+8*11] ; src[x-8 ] * biweight [0] pmullw m1, [rsp+8*12] ; src[x ] * biweight [1] pmullw m3, [rsp+8*11] ; src[x-8 ] * biweight [0] pmullw m4, [rsp+8*12] ; src[x ] * biweight [1] paddw m0, m1 paddw m3, m4 movq m1, [%1+%4] movq m2, [%1+%5] movq m4, m1 movq m5, m2 punpcklbw m1, m7 punpcklbw m2, m7 punpckhbw m4, m7 punpckhbw m5, m7 pmullw m1, [rsp+8*13] ; src[x+8 ] * biweight [2] pmullw m2, [rsp+8*14] ; src[x+16] * biweight [3] pmullw m4, [rsp+8*13] ; src[x+8 ] * biweight [2] pmullw m5, [rsp+8*14] ; src[x+16] * biweight [3] paddw m1, m2 paddw m4, m5 paddsw m0, m1 paddsw m3, m4 paddsw m0, m6 ; Add 64 paddsw m3, m6 ; Add 64 psraw m0, 7 psraw m3, 7 packuswb m0, m3 movq [%6], m0 %else ; mmsize == 16 movq m0, [%1+%2] movq m1, [%1+%3] punpcklbw m0, m7 punpcklbw m1, m7 pmullw m0, m4 ; src[x-8 ] * biweight [0] pmullw m1, m5 ; src[x ] * biweight [1] paddw m0, m1 movq m1, [%1+%4] movq m2, [%1+%5] punpcklbw m1, m7 punpcklbw m2, m7 pmullw m1, m6 ; src[x+8 ] * biweight [2] pmullw m2, m3 ; src[x+16] * biweight [3] paddw m1, m2 paddsw m0, m1 paddsw m0, [pw_64] ; Add 64 psraw m0, 7 packuswb m0, m0 movq [%6], m0 %endif ; mmsize == 8/16 %endmacro %macro SPLAT4REGS 0 %if mmsize == 8 movq m5, m3 punpcklwd m3, m3 movq m4, m3 punpckldq m3, m3 punpckhdq m4, m4 punpckhwd m5, m5 movq m2, m5 punpckhdq m2, m2 punpckldq m5, m5 movq [rsp+8*11], m3 movq [rsp+8*12], m4 movq [rsp+8*13], m5 movq [rsp+8*14], m2 %else ; mmsize == 16 pshuflw m4, m3, 0x0 pshuflw m5, m3, 0x55 pshuflw m6, m3, 0xAA pshuflw m3, m3, 0xFF punpcklqdq m4, m4 punpcklqdq m5, m5 punpcklqdq m6, m6 punpcklqdq m3, m3 %endif ; mmsize == 8/16 %endmacro %macro vp6_filter_diag4 0 ; void ff_vp6_filter_diag4_<opt>(uint8_t *dst, uint8_t *src, ptrdiff_t stride, ; const int16_t h_weight[4], const int16_t v_weights[4]) cglobal vp6_filter_diag4, 5, 7, 8 mov r5, rsp ; backup stack pointer and rsp, ~(mmsize-1) ; align stack %if mmsize == 16 sub rsp, 8*11 %else sub rsp, 8*15 movq m6, [pw_64] %endif sub r1, r2 pxor m7, m7 movq m3, [r3] SPLAT4REGS mov r3, rsp mov r6, 11 .nextrow: DIAG4 r1, -1, 0, 1, 2, r3 add r3, 8 add r1, r2 dec r6 jnz .nextrow movq m3, [r4] SPLAT4REGS lea r3, [rsp+8] mov r6, 8 .nextcol: DIAG4 r3, -8, 0, 8, 16, r0 add r3, 8 add r0, r2 dec r6 jnz .nextcol mov rsp, r5 ; restore stack pointer RET %endmacro %if ARCH_X86_32 INIT_MMX mmx vp6_filter_diag4 %endif INIT_XMM sse2 vp6_filter_diag4
;/** ; * @file ; * ; * Agesa library 64bit ; * ; * Contains AMD AGESA Library ; * ; * @xrefitem bom "File Content Label" "Release Content" ; * @e project: AGESA ; * @e sub-project: Lib ; * @e \$Revision: 17071 $ @e \$Date: 2009-07-30 10:13:11 -0700 (Thu, 30 Jul 2009) $ ; */ ;***************************************************************************** ; ; Copyright (c) 2011, Advanced Micro Devices, Inc. ; All rights reserved. ; ; Redistribution and use in source and binary forms, with or without ; modification, are permitted provided that the following conditions are met: ; * Redistributions of source code must retain the above copyright ; notice, this list of conditions and the following disclaimer. ; * Redistributions 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. ; * Neither the name of Advanced Micro Devices, Inc. nor the names of ; its contributors may 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 ADVANCED MICRO DEVICES, INC. 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. ; ;***************************************************************************** .code ;/*++ ;/*---------------------------------------------------------------------------------------*/ ;/** ; * Write IO byte ; * ; * @param[in] CX IO port address ; * @param[in] DL IO port Value ; */ PUBLIC WriteIo8 WriteIo8 PROC mov al, dl mov dx, cx out dx, al ret WriteIo8 ENDP ;/*---------------------------------------------------------------------------------------*/ ;/** ; * Write IO word ; * ; * @param[in] CX IO port address ; * @param[in] DX IO port Value ; */ PUBLIC WriteIo16 WriteIo16 PROC mov ax, dx mov dx, cx out dx, ax ret WriteIo16 ENDP ;/*---------------------------------------------------------------------------------------*/ ;/** ; * Write IO dword ; * ; * @param[in] CX IO port address ; * @param[in] EDX IO port Value ; */ PUBLIC WriteIo32 WriteIo32 PROC mov eax, edx mov dx, cx out dx, eax ret WriteIo32 ENDP ;/*---------------------------------------------------------------------------------------*/ ;/** ; * Read IO byte ; * ; * @param[in] CX IO port address ; * @retval AL IO port Value ; */ PUBLIC ReadIo8 ReadIo8 PROC mov dx, cx in al, dx ret ReadIo8 ENDP ;/*---------------------------------------------------------------------------------------*/ ;/** ; * Read IO word ; * ; * @param[in] CX IO port address ; * @retval AX IO port Value ; */ PUBLIC ReadIo16 ReadIo16 PROC mov dx, cx in ax, dx ret ReadIo16 ENDP ;/*---------------------------------------------------------------------------------------*/ ;/** ; * Read IO dword ; * ; * @param[in] CX IO port address ; * @retval EAX IO port Value ; */ PUBLIC ReadIo32 ReadIo32 PROC mov dx, cx in eax, dx ret ReadIo32 ENDP ;/*---------------------------------------------------------------------------------------*/ ;/** ; * Read MSR ; * ; * @param[in] RCX MSR Address ; * @param[in] RDX Pointer to data ; * @param[in] R8D ConfigPtr (Optional) ; */ PUBLIC LibAmdMsrRead LibAmdMsrRead PROC push rsi mov rsi, rdx rdmsr mov [rsi], eax mov [rsi+4], edx pop rsi ret LibAmdMsrRead ENDP ;/*---------------------------------------------------------------------------------------*/ ;/** ; * Write MSR ; * ; * @param[in] RCX MSR Address ; * @param[in] RDX Pointer to data ; * @param[in] R8D ConfigPtr (Optional) ; */ PUBLIC LibAmdMsrWrite LibAmdMsrWrite PROC push rsi mov rsi, rdx mov eax, [rsi] and rax, 0ffffffffh mov edx, [rsi+4] and rdx, 0ffffffffh wrmsr pop rsi ret LibAmdMsrWrite ENDP ;/*---------------------------------------------------------------------------------------*/ ;/** ; * Read CPUID ; * ; * @param[in] RCX CPUID function ; * @param[in] RDX Pointer to CPUID_DATA to save cpuid data ; * @param[in] R8D ConfigPtr (Optional) ; */ PUBLIC LibAmdCpuidRead LibAmdCpuidRead PROC push rbx push rsi mov rsi, rdx mov rax, rcx cpuid mov [rsi], eax mov [rsi+4], ebx mov [rsi+8], ecx mov [rsi+12],edx pop rsi pop rbx ret LibAmdCpuidRead ENDP ;/*---------------------------------------------------------------------------------------*/ ;/** ; * Read TSC ; * ; * ; * @retval RAX Time stamp counter value ; */ PUBLIC ReadTSC ReadTSC PROC rdtsc and rax, 0ffffffffh shl rdx, 32 or rax, rdx ret ReadTSC ENDP ;/*---------------------------------------------------------------------------------------*/ ;/** ; * Read memory/MMIO byte ; * ; * @param[in] RCX - Memory Address ; * @retval Memory byte at given address ; */ PUBLIC Read64Mem8 Read64Mem8 PROC xor rax, rax mov al, [rcx] ret Read64Mem8 ENDP ;/*---------------------------------------------------------------------------------------*/ ;/** ; * Read memory/MMIO word ; * ; * @param[in] RCX - Memory Address ; * @retval Memory word at given address ; */ PUBLIC Read64Mem16 Read64Mem16 PROC xor rax, rax mov ax, [rcx] ret Read64Mem16 ENDP ;/*---------------------------------------------------------------------------------------*/ ;/** ; * Read memory/MMIO dword ; * ; * @param[in] RCX - Memory Address ; * @retval Memory dword at given address ; */ PUBLIC Read64Mem32 Read64Mem32 PROC xor rax, rax mov eax, [rcx] ret Read64Mem32 ENDP ;/*---------------------------------------------------------------------------------------*/ ;/** ; * Write memory/MMIO byte ; * ; * @param[in] RCX Memory Address ; * @param[in] DL Value to write ; */ PUBLIC Write64Mem8 Write64Mem8 PROC xor rax, rax mov rax, rdx mov [rcx], al ret Write64Mem8 ENDP ;/*---------------------------------------------------------------------------------------*/ ;/** ; * Write memory/MMIO word ; * ; * @param[in] RCX Memory Address ; * @param[in] DX Value to write ; */ PUBLIC Write64Mem16 Write64Mem16 PROC xor rax, rax mov rax, rdx mov [rcx], ax ret Write64Mem16 ENDP ;/*---------------------------------------------------------------------------------------*/ ;/** ; * Write memory/MMIO dword ; * ; * @param[in] RCX Memory Address ; * @param[in] EDX Value to write ; */ PUBLIC Write64Mem32 Write64Mem32 PROC xor rax, rax mov rax, rdx mov [rcx], eax ret Write64Mem32 ENDP ;/*---------------------------------------------------------------------------------------*/ ;/** ; * Read various CPU registers ; * ; * @param[in] CL Register ID (0/4 - CR0/CR4, 10h/11h/12h/13h/17h - DR0/DR1/DR2/DR3/DR7) ; * @param[in] RDX Pointer to value ; */ PUBLIC LibAmdReadCpuReg LibAmdReadCpuReg PROC push rax xor rax, rax Reg00h: cmp cl, 00h jne Reg04h mov rax, cr0 jmp RegRead Reg04h: cmp cl, 04h jne Reg10h mov rax, cr4 jmp RegRead Reg10h: cmp cl, 10h jne Reg11h mov rax, dr0 jmp RegRead Reg11h: cmp cl, 11h jne Reg12h mov rax, dr1 jmp RegRead Reg12h: cmp cl, 12h jne Reg13h mov rax, dr2 jmp RegRead Reg13h: cmp cl, 13h jne Reg17h mov rax, dr3 jmp RegRead Reg17h: cmp cl, 17h jne RegRead mov rax, dr7 RegRead: mov [rdx], eax pop rax ret LibAmdReadCpuReg ENDP ;/*---------------------------------------------------------------------------------------*/ ;/** ; * Write various CPU registers ; * ; * @param[in] CL Register ID (0/4 - CR0/CR4, 10h/11h/12h/13h/17h - DR0/DR1/DR2/DR3/DR7) ; * @param[in] RDX Value to write ; */ PUBLIC LibAmdWriteCpuReg LibAmdWriteCpuReg PROC push rax Reg00h: cmp cl, 00h jne Reg04h mov rax, cr0 mov eax, edx mov cr0, rax jmp Done Reg04h: cmp cl, 04h jne Reg10h mov rax, cr4 mov eax, edx mov cr4, rax jmp Done Reg10h: cmp cl, 10h jne Reg11h mov rax, dr0 mov eax, edx mov dr0, rax jmp Done Reg11h: cmp cl, 11h jne Reg12h mov rax, dr1 mov eax, edx mov dr1, rax jmp Done Reg12h: cmp cl, 12h jne Reg13h mov rax, dr2 mov eax, edx mov dr2, rax jmp Done Reg13h: cmp cl, 13h jne Reg17h mov rax, dr3 mov eax, edx mov dr3, rax jmp Done Reg17h: cmp cl, 17h jne Done mov rax, dr7 mov eax, edx mov dr7, rax Done: pop rax ret LibAmdWriteCpuReg ENDP ;/*---------------------------------------------------------------------------------------*/ ;/** ; * Write back invalidate caches using wbinvd. ; * ; * ; * ; */ PUBLIC LibAmdWriteBackInvalidateCache LibAmdWriteBackInvalidateCache PROC wbinvd ret LibAmdWriteBackInvalidateCache ENDP ;/*---------------------------------------------------------------------------------------*/ ;/** ; * Stop CPU ; * ; * ; * ; */ PUBLIC StopHere StopHere PROC @@: jmp short @b StopHere ENDP ;/*---------------------------------------------------------------------------------------*/ ;/** ; * Enter debugger on SimNow ; * ; * ; * ; */ PUBLIC LibAmdSimNowEnterDebugger LibAmdSimNowEnterDebugger PROC pushfq mov rax, 0BACCD00Bh ; Backdoor in SimNow mov rbx, 2 ; Select breakpoint feature cpuid @@: jmp short @b popfq ret LibAmdSimNowEnterDebugger ENDP ;/*---------------------------------------------------------------------------------------*/ ;/** ; * IDS IO port write ; * ; * @param[in] ECX IO Port Address ; * @param[in] EDX Value to write ; * @param[in] R8D IDS flags ; * ; */ PUBLIC IdsOutPort IdsOutPort PROC push rbx push rax mov ebx, r8d mov eax, edx mov edx, ecx out dx, eax pop rax pop rbx ret IdsOutPort ENDP ;/*---------------------------------------------------------------------------------------*/ ;/** ; * Force breakpoint on HDT ; * ; * ; */ PUBLIC LibAmdHDTBreakPoint LibAmdHDTBreakPoint PROC push rbx mov rcx, 0C001100Ah ;bit 0 = HDT redirect mov rdi, 09C5A203Ah ;Password rdmsr and rax, 0ffffffffh or rax, 1 wrmsr mov rax, 0B2h ;Marker = B2 db 0F1h ;ICEBP pop rbx ret LibAmdHDTBreakPoint ENDP ;/*---------------------------------------------------------------------------------------*/ ;/** ; * Find the most right hand side non-zero bit with ; * ; * @param[in] ECX Value ; */ PUBLIC LibAmdBitScanForward LibAmdBitScanForward PROC bsf eax, ecx jnz nonZeroSource mov al,32 nonZeroSource: ret LibAmdBitScanForward ENDP ;/*---------------------------------------------------------------------------------------*/ ;/** ; * Find the most left hand side non-zero bit. ; * ; * @param[in] ECX Value ; */ PUBLIC LibAmdBitScanReverse LibAmdBitScanReverse PROC bsr eax, ecx jnz nonZeroSource mov al,0FFh nonZeroSource: ret LibAmdBitScanReverse ENDP ;/*---------------------------------------------------------------------------------------*/ ;/** ; * Flush specified number of cache line ; * ; * @param[in] RCX Physical address to be flushed ; * @param[in] DL number of cachelines to be flushed ; */ PUBLIC LibAmdCLFlush LibAmdCLFlush PROC push rax mov rax, rcx movzx rcx, dl @@: mfence clflush [rax] mfence add rax,64 loop @B pop rax ret LibAmdCLFlush 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_normal_ht+0x1b694, %rcx nop nop sub $25409, %r14 movw $0x6162, (%rcx) nop nop nop nop cmp $27902, %r14 lea addresses_UC_ht+0x3df4, %rdi nop dec %r12 mov $0x6162636465666768, %rax movq %rax, %xmm7 vmovups %ymm7, (%rdi) nop nop nop xor $51077, %r12 lea addresses_D_ht+0x17194, %rax nop nop nop nop dec %rbp mov $0x6162636465666768, %r14 movq %r14, %xmm4 movups %xmm4, (%rax) nop nop nop nop add $16334, %r14 lea addresses_WC_ht+0x94, %r9 nop xor $52410, %r12 mov $0x6162636465666768, %rbp movq %rbp, (%r9) nop nop nop nop cmp $54860, %r12 lea addresses_A_ht+0x11094, %rsi lea addresses_A_ht+0x12894, %rdi nop and %r14, %r14 mov $56, %rcx rep movsl nop nop nop nop nop dec %rsi lea addresses_D_ht+0x1d094, %rsi lea addresses_D_ht+0x12794, %rdi nop cmp $3786, %r14 mov $32, %rcx rep movsb nop add $44085, %rbp lea addresses_A_ht+0x3094, %r9 nop nop nop cmp $6860, %rdi mov $0x6162636465666768, %rsi movq %rsi, (%r9) nop cmp %rdi, %rdi lea addresses_WT_ht+0x950c, %rsi lea addresses_UC_ht+0x18094, %rdi nop nop inc %r9 mov $93, %rcx rep movsb nop sub %rsi, %rsi lea addresses_WT_ht+0x15d94, %rsi lea addresses_UC_ht+0xfd4c, %rdi clflush (%rdi) nop nop and %r12, %r12 mov $33, %rcx rep movsw nop nop nop sub $1291, %r14 lea addresses_WT_ht+0x3774, %rdi nop nop cmp $24224, %rsi mov $0x6162636465666768, %rbp movq %rbp, (%rdi) nop nop nop nop dec %rsi 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 %r11 push %r12 push %r15 push %r8 push %rbx push %rcx // Faulty Load lea addresses_RW+0x1c894, %r8 nop nop nop xor %r15, %r15 mov (%r8), %bx lea oracles, %r15 and $0xff, %rbx shlq $12, %rbx mov (%r15,%rbx,1), %rbx pop %rcx pop %rbx pop %r8 pop %r15 pop %r12 pop %r11 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 16, 'type': 'addresses_RW', 'congruent': 0}} [Faulty Load] {'OP': 'LOAD', 'src': {'same': True, 'NT': False, 'AVXalign': False, 'size': 2, 'type': 'addresses_RW', 'congruent': 0}} <gen_prepare_buffer> {'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 2, 'type': 'addresses_normal_ht', 'congruent': 9}, 'OP': 'STOR'} {'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_UC_ht', 'congruent': 4}, 'OP': 'STOR'} {'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 16, 'type': 'addresses_D_ht', 'congruent': 6}, 'OP': 'STOR'} {'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_WC_ht', 'congruent': 10}, 'OP': 'STOR'} {'dst': {'same': False, 'congruent': 8, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 9, 'type': 'addresses_A_ht'}} {'dst': {'same': False, 'congruent': 7, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 11, 'type': 'addresses_D_ht'}} {'dst': {'same': False, 'NT': False, 'AVXalign': True, 'size': 8, 'type': 'addresses_A_ht', 'congruent': 8}, 'OP': 'STOR'} {'dst': {'same': False, 'congruent': 10, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 3, 'type': 'addresses_WT_ht'}} {'dst': {'same': False, 'congruent': 1, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 8, 'type': 'addresses_WT_ht'}} {'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_WT_ht', 'congruent': 4}, 'OP': 'STOR'} {'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 */
; A214493: Numbers of the form ((6k+5)^2+9)/2 or 2(3k+4)^2-9. ; 17,23,65,89,149,191,269,329,425,503,617,713,845,959,1109,1241,1409,1559,1745,1913,2117,2303,2525,2729,2969,3191,3449,3689,3965,4223,4517,4793,5105,5399,5729,6041,6389,6719,7085,7433,7817,8183,8585,8969,9389,9791,10229,10649,11105,11543,12017,12473,12965,13439,13949 mov $1,$0 pow $0,2 lpb $1 add $0,5 sub $1,1 sub $0,$1 sub $1,1 lpe mul $0,6 add $0,17
; A346145: Primes of the form k^2 + 25. ; Submitted by Christian Krause ; 29,41,61,89,281,349,509,601,701,809,1049,1181,1321,1789,2141,2729,3389,4649,5209,5501,5801,8861,9241,9629,10429,11261,11689,12569,15401,15901,17449,17981,18521,19069,21341,21929,23741,24989,26921,27581,33149,39229,40829,41641,42461,45821,46681,52009 mov $2,332203 mov $5,24 lpb $2 mov $3,$6 seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0. sub $0,$3 add $5,$1 add $1,4 mov $4,$0 max $4,0 cmp $4,$0 mul $2,$4 sub $2,18 add $5,$1 mov $6,$5 lpe mov $0,$5 add $0,1
; ;================================================================================================== ; DSKYNG (DISPLAY AND KEYBOARD NEXT GENERATION) ROUTINES ;================================================================================================== ; ; A DSKYNG CAN SHARE A PPI BUS WITH EITHER A PPIDE OR PPISD. ; SEE PPI_BUS.TXT FOR MORE INFORMATION. ; ; LED SEGMENTS (BIT VALUES) ; ; +--01--+ ; 20 02 ; +--40--+ ; 10 04 ; +--08--+ 80 ; ; KEY CODE MAP (KEY CODES) CSCCCRRR ; |||||||| ; |||||+++-- ROW ; ||+++----- COL ; |+-------- SHIFT ; +--------- CONTROL ; ; 00 08 10 18 23 ; 01 09 11 19 22 ; 02 0A 12 1A 21 ; 03 0B 13 1B 20 ; 04 0C 14 1C SHIFT ; 05 0D 15 1D CTRL ; ; LED BIT MAP (BIT VALUES) ; ; $08 $09 $0A $0B $0C $0D $0E $0F ; --- --- --- --- --- --- --- --- ; 01 01 01 01 01 ; 02 02 02 02 02 ; 04 04 04 04 04 ; 08 08 08 08 08 ; 10 10 10 10 10 ; 20 20 20 20 20 L1 L2 BUZZ ; PPIA .EQU DSKYPPIBASE + 0 ; PORT A PPIB .EQU DSKYPPIBASE + 1 ; PORT B PPIC .EQU DSKYPPIBASE + 2 ; PORT C PPIX .EQU DSKYPPIBASE + 3 ; PPI CONTROL PORT ; DSKY_PPIX_RD: .EQU %10010010 ; PPIX VALUE FOR READS DSKY_PPIX_WR: .EQU %10000010 ; PPIX VALUE FOR WRITES ; ; PIO CHANNEL C: ; ; 7 6 5 4 3 2 1 0 ; RES 0 0 CS CS /RD /WR A0 ; ; SETTING BITS 3 & 4 WILL ASSERT /CS ON 3279 ; CLEAR BITS 1 OR 2 TO ASSERT READ/WRITE ; DSKY_PPI_IDLE: .EQU %00000110 ; DSKY_CMD_CLR: .EQU %11011111 ; CLEAR (ALL OFF) DSKY_CMD_CLRX: .EQU %11010011 ; CLEAR (ALL ON) DSKY_CMD_WDSP: .EQU %10010000 ; WRITE DISPLAY RAM DSKY_CMD_RDSP: .EQU %01110000 ; READ DISPLAY RAM DSKY_CMD_CLK: .EQU %00100000 ; SET CLK PRESCALE DSKY_CMD_FIFO: .EQU %01000000 ; READ FIFO ; DSKY_PRESCL: .EQU DSKYOSC/100000 ; PRESCALER ; ;__DSKY_PREINIT______________________________________________________________________________________ ; ; CONFIGURE PARALLEL PORT AND INITIALIZE 8279 ;____________________________________________________________________________________________________ ; ; ; HARDWARE RESET 8279 BY PULSING RESET LINE ; DSKY_PREINIT: ; CHECK FOR PPI CALL DSKY_PPIDETECT ; TEST FOR PPI HARDWARE RET NZ ; BAIL OUT IF NOT THERE ; SETUP PPI TO DEFAULT MODE CALL DSKY_PPIRD ; INIT 8279 VALUES TO IDLE STATE LD A,DSKY_PPI_IDLE OUT (PPIC),A ; PULSE RESET SIGNAL ON 8279 SET 7,A OUT (PPIC),A RES 7,A OUT (PPIC),A ; INITIALIZE 8279 CALL DSKY_REINIT ; NOW SEE IF A DSKYNG IS REALLY THERE... LD A,$A5 LD (DSKY_BUF),A LD HL,DSKY_BUF LD C,0 LD B,1 CALL DSKY_PUTSTR LD HL,DSKY_BUF LD C,0 LD B,1 CALL DSKY_GETSTR LD A,(DSKY_BUF) CP $A5 RET NZ ; BAIL OUT IF MISCOMPARE LD A,$FF LD (DSKY_PRESENT),A RET ; DSKY_REINIT: CALL DSKY_PPIIDLE ; SET CLOCK SCALER TO 20 LD A,DSKY_CMD_CLK | DSKY_PRESCL CALL DSKY_CMD ; FALL THRU ; DSKY_RESET: ; RESET DSKY -- CLEAR RAM AND FIFO LD A,DSKY_CMD_CLR CALL DSKY_CMD ; ; 8259 TAKES ~160US TO CLEAR RAM DURING WHICH TIME WRITES TO ; DISPLAY RAM ARE INHIBITED. HIGH BIT OF STATUS BYTE IS SET ; DURING THIS WINDOW. TO PREVENT A DEADLOCK, A LOOP COUNTER ; IS USED TO IMPLEMENT A TIMEOUT. LD B,0 ; TIMEOUT LOOP COUNTER DSKY_RESET1: PUSH BC ; SAVE COUNTER CALL DSKY_ST ; GET STATUS BYTE POP BC ; RECOVER COUNTER BIT 7,A ; BIT 7 IS DISPLAY RAM BUSY JR Z,DSKY_RESET2 ; MOVE ON IF DONE DJNZ DSKY_RESET1 ; LOOP TILL TIMEOUT ; DSKY_RESET2: RET ; ;__DSKY_INIT_________________________________________________________________________________________ ; ; DISPLAY DSKY INFO ;____________________________________________________________________________________________________ ; #IFDEF HBIOS ; DSKY_INIT: CALL NEWLINE ; FORMATTING PRTS("DSKY:$") ; FORMATTING ; PRTS(" IO=0x$") ; FORMATTING LD A,DSKYPPIBASE ; GET BASE PORT CALL PRTHEXBYTE ; PRINT BASE PORT PRTS(" MODE=$") ; FORMATTING PRTS("NG$") ; PRINT DSKY TYPE ; LD A,(DSKY_PRESENT) ; PRESENT? OR A ; SET FLAGS RET NZ ; YES, ALL DONE PRTS(" NOT PRESENT$") ; NOT PRESENT RET ; DONE ; #ENDIF ; ;__DSKY_PPIDETECT____________________________________________________________________________________ ; ; PROBE FOR PPI HARDWARE ;____________________________________________________________________________________________________ ; DSKY_PPIDETECT: ; ; TEST FOR PPI EXISTENCE ; WE SETUP THE PPI TO WRITE, THEN WRITE A VALUE OF ZERO ; TO PORT A (DATALO), THEN READ IT BACK. IF THE PPI IS THERE ; THEN THE BUS HOLD CIRCUITRY WILL READ BACK THE ZERO. SINCE ; WE ARE IN WRITE MODE, AN IDE CONTROLLER WILL NOT BE ABLE TO ; INTERFERE WITH THE VALUE BEING READ. CALL DSKY_PPIWR ; LD C,PPIA ; PPI PORT A XOR A ; VALUE ZERO OUT (C),A ; PUSH VALUE TO PORT IN A,(C) ; GET PORT VALUE OR A ; SET FLAGS RET ; AND RETURN ; #IFDEF DSKY_KBD ; KY_0 .EQU $00 KY_1 .EQU $01 KY_2 .EQU $02 KY_3 .EQU $03 KY_4 .EQU $04 KY_5 .EQU $05 KY_6 .EQU $06 KY_7 .EQU $07 KY_8 .EQU $08 KY_9 .EQU $09 KY_A .EQU $0A KY_B .EQU $0B KY_C .EQU $0C KY_D .EQU $0D KY_E .EQU $0E KY_F .EQU $0F KY_FW .EQU $10 ; FORWARD KY_BK .EQU $11 ; BACKWARD KY_CL .EQU $12 ; CLEAR KY_EN .EQU $13 ; ENTER KY_DE .EQU $14 ; DEPOSIT KY_EX .EQU $15 ; EXAMINE KY_GO .EQU $16 ; GO KY_BO .EQU $17 ; BOOT KY_F4 .EQU $18 ; F4 KY_F3 .EQU $19 ; F3 KY_F2 .EQU $20 ; F2 KY_F1 .EQU $21 ; F1 ; ;__DSKY_STAT_________________________________________________________________________________________ ; ; CHECK FOR KEY PRESS, SAVE RAW VALUE, RETURN STATUS ;____________________________________________________________________________________________________ ; DSKY_STAT: LD A,(DSKY_PRESENT) ; DOES IT EXIST? OR A ; SET FLAGS RET Z ; ABORT WITH A=0 IF NOT THERE CALL DSKY_ST AND $0F ; ISOLATE THE CUR FIFO LEN RET ; ;__DSKY_GETKEY_____________________________________________________________________________________ ; ; WAIT FOR A DSKY KEYPRESS AND RETURN ;____________________________________________________________________________________________________ ; DSKY_GETKEY: LD A,(DSKY_PRESENT) ; DOES IT EXIST? OR A ; SET FLAGS JR Z,DSKY_GETKEY1A ; ABORT IF NOT PRESENT CALL DSKY_STAT JR Z,DSKY_GETKEY ; LOOP IF NOTHING THERE LD A,DSKY_CMD_FIFO CALL DSKY_CMD CALL DSKY_DIN XOR %11000000 ; FLIP POLARITY OF SHIFT/CTL BITS PUSH AF ; SAVE VALUE AND $3F ; STRIP SHIFT/CTL BITS FOR LOOKUP LD B,28 ; SIZE OF DECODE TABLE LD C,0 ; INDEX LD HL,DSKY_KEYMAP ; POINT TO BEGINNING OF TABLE DSKY_GETKEY1: CP (HL) ; MATCH? JR Z,DSKY_GETKEY2 ; FOUND, DONE INC HL INC C ; BUMP INDEX DJNZ DSKY_GETKEY1 ; LOOP UNTIL EOT POP AF ; FIX STACK DSKY_GETKEY1A: LD A,$FF ; NOT FOUND ERR, RETURN $FF RET DSKY_GETKEY2: ; RETURN THE INDEX POSITION WHERE THE SCAN CODE WAS FOUND ; THE ORIGINAL SHIFT/CTRL BITS ARE RESTORED POP AF ; RESTORE RAW VALUE AND %11000000 ; ISOLATE SHIFT/CTRL BITS OR C ; COMBINE WITH INDEX VALUE RET ; ;_KEYMAP_TABLE_____________________________________________________________________________________________________________ ; DSKY_KEYMAP: ; POS $00 $01 $02 $03 $04 $05 $06 $07 ; KEY [0] [1] [2] [3] [4] [5] [6] [7] .DB $0D, $04, $0C, $14, $03, $0B, $13, $02 ; ; POS $08 $09 $0A $0B $0C $0D $0E $0F ; KEY [8] [9] [A] [B] [C] [D] [E] [F] .DB $0A, $12, $01, $09, $11, $00, $08, $10 ; ; POS $10 $11 $12 $13 $14 $15 $16 $17 ; KEY [FW] [BK] [CL] [EN] [DE] [EX] [GO] [BO] .DB $05, $15, $1D, $1C, $1B, $1A, $19, $18 ; POS $18 $19 $20 $21 ; KEY [F4] [F3] [F2] [F1] .DB $23, $22, $21, $20 ; #ENDIF ; DSKY_KBD ; ;================================================================================================== ; CONVERT 32 BIT BINARY TO 8 BYTE HEX SEGMENT DISPLAY ;================================================================================================== ; ; HL: ADR OF 32 BIT BINARY ; DE: ADR OF DEST LED SEGMENT DISPLAY BUFFER (8 BYTES) ; DSKY_BIN2SEG: PUSH HL PUSH DE LD B,4 ; 4 BYTES OF INPUT EX DE,HL DSKY_BIN2SEG1: LD A,(DE) ; FIRST NIBBLE SRL A SRL A SRL A SRL A PUSH HL LD HL,DSKY_HEXMAP CALL DSKY_ADDHLA LD A,(HL) POP HL LD (HL),A INC HL LD A,(DE) ; SECOND NIBBLE AND 0FH PUSH HL LD HL,DSKY_HEXMAP CALL DSKY_ADDHLA LD A,(HL) POP HL LD (HL),A INC HL INC DE ; NEXT BYTE DJNZ DSKY_BIN2SEG1 POP DE POP HL RET ; ;================================================================================================== ; DSKY SHOW BUFFER ; HL: ADDRESS OF BUFFER ;================================================================================================== ; DSKY_SHOW: LD C,0 ; STARTING DISPLAY POSITION LD B,DSKY_BUFLEN ; NUMBER OF CHARS JP DSKY_PUTSTR ; ;================================================================================================== ; DSKYNG OUTPUT ROUTINES ;================================================================================================== ; ; SEND DSKY COMMAND BYTE IN REGISTER A ; TRASHES BC ; DSKY_CMD: LD B,$01 JR DSKY_DOUT2 ; ; SEND DSKY DATA BYTE IN REGISTER A ; TRASHES BC ; DSKY_DOUT: LD B,$00 ; DSKY_DOUT2: ; ; SAVE INCOMING DATA BYTE PUSH AF ; ; SET PPI LINE CONFIG TO WRITE MODE CALL DSKY_PPIWR ; ; SETUP LD C,PPIC ; ; SET ADDRESS FIRST LD A,DSKY_PPI_IDLE OR B OUT (C),A ; ; ASSERT 8279 /CS SET 3,A SET 4,A OUT (C),A ; ; PPIC WORKING VALUE TO REG B NOW LD B,A ; ; ASSERT DATA BYTE VALUE POP AF OUT (PPIA),A ; ; PULSE /WR RES 1,B OUT (C),B NOP ; MAY NOT BE NEEDED SET 1,B OUT (C),B ; ; DEASSERT /CS RES 3,B RES 4,B OUT (C),B ; ; CLEAR ADDRESS BIT RES 0,B OUT (C),B ; ; DONE CALL DSKY_PPIIDLE RET ; ;================================================================================================== ; DSKYNG OUTPUT ROUTINES ;================================================================================================== ; ; RETURN DSKY STATUS VALUE IN A ; TRASHES BC ; DSKY_ST: LD B,$01 JR DSKY_DIN2 ; ; RETURN NEXT DATA VALUE IN A ; TRASHES BC ; DSKY_DIN: LD B,$00 ; DSKY_DIN2: ; SET PPI LINE CONFIG TO READ MODE CALL DSKY_PPIRD ; ; SETUP LD C,PPIC ; ; SET ADDRESS FIRST LD A,DSKY_PPI_IDLE OR B OUT (C),A ; ; ASSERT 8279 /CS SET 3,A SET 4,A OUT (C),A ; ; PPIC WORKING VALUE TO REG B NOW LD B,A ; ; ASSERT /RD RES 2,B OUT (C),B ; ; GET VALUE IN A,(PPIA) ; ; DEASSERT /RD SET 2,B OUT (C),B ; ; DEASSERT /CS RES 3,B RES 4,B OUT (C),B ; ; CLEAR ADDRESS BIT RES 0,B OUT (C),B ; ; DONE CALL DSKY_PPIIDLE RET ; ;================================================================================================== ; DSKYNG UTILITY ROUTINES ;================================================================================================== ; ; BLANK DSKYNG DISPLAY (WITHOUT USING CLEAR) ; DSKY_BLANK: LD A,DSKY_CMD_WDSP CALL DSKY_CMD LD B,16 DSKY_BLANK1: PUSH BC LD A,$FF CALL DSKY_DOUT POP BC DJNZ DSKY_BLANK1 RET ; ; WRITE A RAW BYTE VALUE TO DSKY DISPLAY RAM ; AT LOCATION IN REGISTER C, VALUE IN A. ; DSKY_PUTBYTE: PUSH BC PUSH AF LD A,C ADD A,DSKY_CMD_WDSP CALL DSKY_CMD POP AF XOR $FF CALL DSKY_DOUT POP BC RET ; ; READ A RAW BYTE VALUE FROM DSKY DISPLAY RAM ; AT LOCATION IN REGISTER C, VALUE RETURNED IN A ; DSKY_GETBYTE: PUSH BC LD A,C ADD A,DSKY_CMD_RDSP CALL DSKY_CMD CALL DSKY_DIN XOR $FF POP BC RET ; ; WRITE A STRING OF RAW BYTE VALUES TO DSKY DISPLAY RAM ; AT LOCATION IN REGISTER C, LENGTH IN B, ADDRESS IN HL. ; DSKY_PUTSTR: PUSH BC LD A,C ADD A,DSKY_CMD_WDSP CALL DSKY_CMD POP BC ; DSKY_PUTSTR1: LD A,(HL) XOR $FF INC HL PUSH BC CALL DSKY_DOUT POP BC DJNZ DSKY_PUTSTR1 RET ; ; READ A STRING OF RAW BYTE VALUES FROM DSKY DISPLAY RAM ; AT LOCATION IN REGISTER C, LENGTH IN B, ADDRESS IN HL. ; DSKY_GETSTR: PUSH BC LD A,C ADD A,DSKY_CMD_RDSP CALL DSKY_CMD POP BC ; DSKY_GETSTR1: PUSH BC CALL DSKY_DIN POP BC XOR $FF LD (HL),A INC HL DJNZ DSKY_GETSTR1 RET ; ; This function is intended to update the LEDs. It expects 8 bytes ; following the call, and updates the entire matrix. ; ; EXAMPLE: ; CALL DSKY_PUTLED ; .DB $00,$00,$00,$00,$00,$00,$00,$00 ; DSKY_PUTLED: EX (SP),HL PUSH AF PUSH BC LD C,8 DSKY_PUTLED_1: LD A,(HL) PUSH BC CALL DSKY_PUTBYTE POP BC INC C INC HL LD A,C CP $10 JP NZ,DSKY_PUTLED_1 POP BC POP AF EX (SP),HL RET ; ; This function is intended to beep the speaker on the DSKY ; DSKY_BEEP: PUSH AF PUSH BC LD C,$0F CALL DSKY_GETBYTE OR $20 LD C,$0F CALL DSKY_PUTBYTE ;;; timer . . . PUSH HL LD hl,$8FFF DSKY_BEEP1: DEC HL LD A,H CP 0 JP NZ,DSKY_BEEP1 POP HL LD C,$0F CALL DSKY_GETBYTE AND $DF LD C,$0F CALL DSKY_PUTBYTE POP BC POP AF RET ; ; This function is intended to turn on DSKY L1 ; DSKY_L1ON: PUSH AF PUSH BC LD C,$0D CALL DSKY_GETBYTE OR $20 LD C,$0D CALL DSKY_PUTBYTE POP BC POP AF RET ; ; This function is intended to turn on DSKY L2 ; DSKY_L2ON: PUSH AF PUSH BC LD C,$0E CALL DSKY_GETBYTE OR $20 LD C,$0E CALL DSKY_PUTBYTE POP BC POP AF RET ; ; This function is intended to turn off DSKY L1 ; DSKY_L1OFF: PUSH AF PUSH BC LD C,$0D CALL DSKY_GETBYTE AND $DF LD C,$0D CALL DSKY_PUTBYTE POP BC POP AF RET ; ; This function is intended to turn off DSKY L2 ; DSKY_L2OFF: PUSH AF PUSH BC LD C,$0E CALL DSKY_GETBYTE AND $DF LD C,$0E CALL DSKY_PUTBYTE POP BC POP AF RET ; ;================================================================================================== ; DSKYNG LINE CONTROL ROUTINES ;================================================================================================== ; ; SETUP PPI FOR WRITING: PUT PPI PORT A IN OUTPUT MODE ; AVOID REWRTING PPIX IF ALREADY IN OUTPUT MODE ; DSKY_PPIWR: PUSH AF ; ; CHECK FOR WRITE MODE LD A,(DSKY_PPIX_VAL) CP DSKY_PPIX_WR JR Z,DSKY_PPIWR1 ; ; SET PPI TO WRITE MODE LD A,DSKY_PPIX_WR OUT (PPIX),A LD (DSKY_PPIX_VAL),A ; ; RESTORE PORT C (MAY NOT BE NEEDED) LD A,DSKY_PPI_IDLE OUT (PPIC),A ; DSKY_PPIWR1: ; POP AF RET ; ; SETUP PPI FOR READING: PUT PPI PORT A IN INPUT MODE ; AVOID REWRTING PPIX IF ALREADY IN INPUT MODE ; DSKY_PPIRD: PUSH AF ; ; CHECK FOR READ MODE LD A,(DSKY_PPIX_VAL) CP DSKY_PPIX_RD JR Z,DSKY_PPIRD1 ; ; SET PPI TO READ MODE LD A,DSKY_PPIX_RD OUT (PPIX),A LD (DSKY_PPIX_VAL),A ; DSKY_PPIRD1: POP AF RET ; ; RELEASE USE OF PPI ; DSKY_PPIIDLE: JR DSKY_PPIRD ; SAME AS READ MODE ; ;================================================================================================== ; UTILTITY FUNCTIONS ;================================================================================================== ; DSKY_ADDHLA: ADD A,L LD L,A RET NC INC H RET ; ;================================================================================================== ; STORAGE ;================================================================================================== ; ; CODES FOR NUMERICS ; HIGH BIT ALWAYS CLEAR TO SUPPRESS DECIMAL POINT ; SET HIGH BIT TO SHOW DECIMAL POINT ; DSKY_HEXMAP: .DB $3F ; 0 .DB $06 ; 1 .DB $5B ; 2 .DB $4F ; 3 .DB $66 ; 4 .DB $6D ; 5 .DB $7D ; 6 .DB $07 ; 7 .DB $7F ; 8 .DB $67 ; 9 .DB $77 ; A .DB $7C ; B .DB $39 ; C .DB $5E ; D .DB $79 ; E .DB $71 ; F ; DSKY_PPIX_VAL: .DB 0 DSKY_PRESENT: .DB 0 ; ; SEG DISPLAY WORKING STORAGE ; DSKY_BUF .FILL 8,0 DSKY_BUFLEN .EQU $ - DSKY_BUF DSKY_HEXBUF .FILL 4,0 DSKY_HEXBUFLEN .EQU $ - DSKY_HEXBUF
; A292228: Denominators of partial sums of the series 1 + 2*Sum_{k >= 1} 1/(4*k^4 + 1). ; Submitted by Christian Krause ; 1,5,65,325,13325,812825,13818025,1561436825,45281667925,8195981894425,482116582025,434387040404525,135963143646616325,9925309486202991725,4178555293691459516225,154606545866584002100325,16852113499457656228935425,10330345575167543268337415525,1415257343797953427762225926925,1077010838630242558527053930389925,31233314320277034197284563981307825,31233314320277034197284563981307825,31639347406440635641849263313064826725,2433795954341587357065327947158832825 mov $1,1 lpb $0 mov $2,$0 sub $0,1 pow $2,4 mul $2,4 add $2,1 mul $3,$2 add $3,$1 mul $1,$2 lpe gcd $3,$1 div $1,$3 mov $0,$1
; sprites.asm AnimateDemo proc ld a, (FRAMES) ; Read the LSB of the ROM frame counter (0.255) and %00000111 ; Take the lowest 3 bits (effectively FRAMES modulus 8), ret nz ; and return 7 out of every 8 frames. ld a, (Sprites.AIndex) ; For every 8th frame, read Sprite A's tile index, xor %00000001 ; alternate between (0 => 1 => 0 => 1=> etc), ld (Sprites.AIndex), a ; then save it back. ret pend
.global s_prepare_buffers s_prepare_buffers: push %r12 push %r13 push %r9 push %rbp push %rcx push %rdi push %rdx push %rsi lea addresses_A_ht+0x17d4b, %rsi lea addresses_WT_ht+0x1e4b, %rdi sub $23569, %rdx mov $32, %rcx rep movsl nop nop nop nop cmp %r12, %r12 lea addresses_WC_ht+0xd14b, %rsi lea addresses_WC_ht+0x13f9b, %rdi nop nop nop nop nop sub %r13, %r13 mov $76, %rcx rep movsl cmp %r12, %r12 lea addresses_WC_ht+0xbecb, %rdi add $31760, %r9 mov (%rdi), %rdx nop dec %rdi lea addresses_UC_ht+0x1394b, %rsi lea addresses_UC_ht+0xb07b, %rdi clflush (%rdi) nop nop add $48689, %rbp mov $44, %rcx rep movsb nop nop nop inc %r12 lea addresses_normal_ht+0xe64b, %r9 nop nop nop cmp %r13, %r13 mov (%r9), %rbp nop nop and $1710, %rdi lea addresses_WT_ht+0x19f4b, %rsi lea addresses_A_ht+0x494b, %rdi nop nop cmp %r12, %r12 mov $51, %rcx rep movsl nop inc %r13 lea addresses_WC_ht+0x1954b, %r13 nop nop nop nop inc %rcx mov (%r13), %r9 nop nop nop nop add %r12, %r12 lea addresses_UC_ht+0x4d4b, %rbp cmp %r12, %r12 mov (%rbp), %edx nop nop cmp $41611, %r9 lea addresses_A_ht+0x1724b, %rsi lea addresses_normal_ht+0x1484b, %rdi nop nop and $23178, %rdx mov $80, %rcx rep movsq nop nop nop nop nop and $18253, %rsi lea addresses_A_ht+0x74e9, %rsi lea addresses_WT_ht+0x214b, %rdi nop nop nop nop nop inc %r9 mov $120, %rcx rep movsl nop nop nop nop nop sub %rcx, %rcx lea addresses_WC_ht+0x1194b, %r9 nop nop nop nop add $20070, %r12 mov (%r9), %bp nop nop nop nop nop cmp %rbp, %rbp pop %rsi pop %rdx pop %rdi pop %rcx pop %rbp pop %r9 pop %r13 pop %r12 ret .global s_faulty_load s_faulty_load: push %r10 push %r12 push %r15 push %rbp push %rbx push %rcx push %rdx // Store lea addresses_WT+0x8d4b, %rdx nop nop nop and $32744, %rbp movl $0x51525354, (%rdx) nop nop nop cmp %rdx, %rdx // Store mov $0x361, %r12 nop nop nop nop nop xor $16651, %r15 mov $0x5152535455565758, %r10 movq %r10, %xmm1 vmovups %ymm1, (%r12) nop nop nop add %r10, %r10 // Store lea addresses_US+0x1f9cb, %rdx clflush (%rdx) dec %rbx mov $0x5152535455565758, %r12 movq %r12, %xmm6 movups %xmm6, (%rdx) nop nop nop nop nop dec %rdx // Faulty Load lea addresses_D+0x1b94b, %r10 nop nop nop nop nop inc %r12 mov (%r10), %bp lea oracles, %r12 and $0xff, %rbp shlq $12, %rbp mov (%r12,%rbp,1), %rbp pop %rdx pop %rcx pop %rbx pop %rbp pop %r15 pop %r12 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 16, 'NT': False, 'type': 'addresses_D'}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'congruent': 10, 'AVXalign': True, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_WT'}} {'OP': 'STOR', 'dst': {'congruent': 1, 'AVXalign': False, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_P'}} {'OP': 'STOR', 'dst': {'congruent': 6, 'AVXalign': False, 'same': False, 'size': 16, 'NT': False, 'type': 'addresses_US'}} [Faulty Load] {'src': {'congruent': 0, 'AVXalign': False, 'same': True, 'size': 2, 'NT': False, 'type': 'addresses_D'}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'congruent': 10, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'dst': {'congruent': 8, 'same': False, 'type': 'addresses_WT_ht'}} {'src': {'congruent': 11, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'dst': {'congruent': 4, 'same': False, 'type': 'addresses_WC_ht'}} {'src': {'congruent': 7, 'AVXalign': False, 'same': False, 'size': 8, 'NT': False, 'type': 'addresses_WC_ht'}, 'OP': 'LOAD'} {'src': {'congruent': 10, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'dst': {'congruent': 3, 'same': False, 'type': 'addresses_UC_ht'}} {'src': {'congruent': 8, 'AVXalign': False, 'same': False, 'size': 8, 'NT': False, 'type': 'addresses_normal_ht'}, 'OP': 'LOAD'} {'src': {'congruent': 9, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'dst': {'congruent': 10, 'same': False, 'type': 'addresses_A_ht'}} {'src': {'congruent': 9, 'AVXalign': False, 'same': False, 'size': 8, 'NT': True, 'type': 'addresses_WC_ht'}, 'OP': 'LOAD'} {'src': {'congruent': 10, 'AVXalign': True, 'same': True, 'size': 4, 'NT': False, 'type': 'addresses_UC_ht'}, 'OP': 'LOAD'} {'src': {'congruent': 7, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'dst': {'congruent': 5, 'same': False, 'type': 'addresses_normal_ht'}} {'src': {'congruent': 1, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'dst': {'congruent': 11, 'same': True, 'type': 'addresses_WT_ht'}} {'src': {'congruent': 11, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_WC_ht'}, 'OP': 'LOAD'} {'36': 21829} 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 */
[section .data] [section .text] global out_byte global in_byte out_byte: mov edx ,[esp+4] mov al ,[esp+8] out dx ,al nop nop ret in_byte: mov edx ,[esp+4] xor eax ,eax in al ,dx nop nop ret
/* * Sumo Maze Bot Demo Code * * org: 10/16/2014 * rev: 01/21/2015 * auth: Nels "Chip" Pearson * * Target: Sumo Maze Bot Board, 20MHz, ATmega164P, Sumo Bot base * * Dependentcies * floor_det_service.asm * range_service.asm * sys_timers.asm * * Resources * SRAM * * IO * */ .equ DEMO_DELAY_COUNT = 1 ; 10msec .equ DEMO_MODE_SQUARE = 1 .equ DEMO_MODE_UPBACK = 2 .equ DEMO_MODE_AVOID = 3 ; avoid black line, table edge, stairs, drop-offs .equ DEMO_MODE_MAZE_LEFT = 4 .equ DEMO_MODE_MAZE_RIGHT = 5 // SQUARE .equ DEMO_SQUARE_FWD = 0 ; go forward .equ DEMO_SQUARE_TURN90 = 2 ; turn right // AVOID .equ DEMO_AVOID_FWD = 0 ; go forward .equ DEMO_AVOID_CONTINUE = 1 ; continue forward .equ DEMO_AVOID_BACKUP = 2 ; go reverse .equ DEMO_AVOID_TURN180 = 3 ; go forward // MAZE WALL FOLLOW .DSEG demo_delay: .BYTE 1 demo_mode: .BYTE 1 ; 0=Square, 1=Up-Back demo_state: .BYTE 1 ; mode state demo_s_time: .BYTE 1 ; state time .CSEG sumo_demo_init: ldi R16, DEMO_DELAY_COUNT sts demo_delay, R16 ; ;;; ldi R16, DEMO_MODE_SQUARE ;;; sts demo_mode, R16 ;;; ldi R16, DEMO_SQUARE_FWD ;;; sts demo_state, R16 ; next state ;;; ldi R16, 100 ;;; sts demo_s_time, R16 ; run for 1 sec ; ldi R16, DEMO_MODE_AVOID sts demo_mode, R16 ldi r16, DEMO_AVOID_FWD sts demo_state, r16 ; next state ; ret /* * Some simple state machines to demonstrate to system. */ sumo_demo: sbis GPIOR0, DEMO_10MS_TIC ; test 10ms tic ret ; EXIT..not set ; cbi GPIOR0, DEMO_10MS_TIC ; clear tic10ms flag set by interrup ; check delay lds R16, demo_delay dec R16 sts demo_delay, R16 breq sd_skip00 ret ; EXIT..not time ; sd_skip00: ldi R16, DEMO_DELAY_COUNT ; reset sts demo_delay, R16 // Run service ; Get MODE lds R16, demo_mode ; switch(mode) cpi R16, DEMO_MODE_SQUARE brne sd_skip10 lds R16, demo_state // DEMO - SQUARE ; switch(state) cpi R16, DEMO_SQUARE_FWD brne sd_skip010 ; Done with last state? lds R16, demo_s_time dec R16 sts demo_s_time, R16 ; update breq sd_skip001 rjmp sd_exit ; no sd_skip001: ; Go forward ; DB++ ;; call smb_led1_on ; DB-- ldi r18, high(PWM_R_MED_F) ldi r17, low(PWM_R_MED_F) call pwm_set_right ldi r18, high(PWM_L_MED_F) ldi r17, low(PWM_L_MED_F) call pwm_set_left ; ldi R16, 100 sts demo_s_time, R16 ; run for 1 sec ; ldi R16, DEMO_SQUARE_TURN90 sts demo_state, R16 ; next state rjmp sd_exit ; sd_skip010: cpi R16, DEMO_SQUARE_TURN90 brne sd_skip020 ; Done with last state? lds R16, demo_s_time dec R16 sts demo_s_time, R16 ; update breq sd_skip011 rjmp sd_exit ; no ; yes sd_skip011: ; DB++ ;; call smb_led1_off ; DB-- call pwm_stop_left ; ldi R16, 90 sts demo_s_time, R16 ; run for n sec ; ldi R16, DEMO_SQUARE_FWD sts demo_state, R16 ; next state rjmp sd_exit ; ; sd_skip020: clr R16 sts demo_state, R16 ; reset to default rjmp sd_exit ; sd_skip10: cpi R16, DEMO_MODE_UPBACK brne sd_skip20 ret ; not supported ; sd_skip20: cpi R16, DEMO_MODE_AVOID breq sd_skip21 rjmp sd_skip30 ; sd_skip21: // DEMO - AVOID lds R16, demo_state ; switch(state) cpi R16, DEMO_AVOID_FWD brne sd_skip210 ; Done with last state? lds R16, demo_s_time dec R16 sts demo_s_time, R16 ; update breq sd_skip201 rjmp sd_exit ; sd_skip201: ; Go forward ldi r18, high(PWM_R_MED_F) ldi r17, low(PWM_R_MED_F) call pwm_set_right ldi r18, high(PWM_L_MED_F) ldi r17, low(PWM_L_MED_F) call pwm_set_left ; ldi r16, DEMO_AVOID_CONTINUE sts demo_state, r16 ; next state rjmp sd_exit ; sd_skip210: cpi R16, DEMO_AVOID_CONTINUE brne sd_skip220 ; Check detectors..ALL must be zero lds R16, floor_det_status ;; cpi R16, FLOOR_DET_LEFT | FLOOR_DET_CENTER | FLOOR_DET_RIGHT ;; brne sd_skip211 andi R16, FLOOR_DET_CENTER ; test center only brne sd_skip211 rjmp sd_exit ; ok to continue ; Detected BLACK sd_skip211: ; Backup ldi r18, high(PWM_R_MED_R) ldi r17, low(PWM_R_MED_R) call pwm_set_right ldi r18, high(PWM_L_MED_R) ldi r17, low(PWM_L_MED_R) call pwm_set_left ; ldi R16, 30 sts demo_s_time, R16 ; run for 1 sec ; ldi R16, DEMO_AVOID_BACKUP ; start back up and turn around sts demo_state, R16 ; next state rjmp sd_exit ; ok to continue ; sd_skip220: cpi R16, DEMO_AVOID_BACKUP brne sd_skip230 ; Done with last state? lds R16, demo_s_time dec R16 sts demo_s_time, R16 ; update brne sd_exit ; no ; Turn around ldi r18, high(PWM_R_MED_R) ldi r17, low(PWM_R_MED_R) call pwm_set_right ldi r18, high(PWM_L_MED_F) ldi r17, low(PWM_L_MED_F) call pwm_set_left ; ldi R16, 105 sts demo_s_time, R16 ; run for 1 sec ; ldi R16, DEMO_AVOID_FWD sts demo_state, R16 ; next state rjmp sd_exit ; recover sd_skip230: ldi R16, DEMO_AVOID_FWD sts demo_state, R16 ; next state rjmp sd_exit ; sd_skip30: call pwm_stop_left call pwm_stop_right ; sd_exit: ret
; Title: Win32 Socket Initialization ; Platforms: Windows NT 4.0, Windows 2000, Windows XP, Windows 2003 ; Author: hdm[at]metasploit.com [BITS 32] %include "win32_stage_api.asm" sub esp, 0x100 push eax ; [ebp + 12] = VirtualAlloc push edi ; [ebp + 8] = LoadLibraryA push esi ; [ebp + 4] = LGetProcAddress push ebx ; [ebp + 0] = kernel32.dll base mov ebp, esp call LLoadWinsock %define FN_RECV [ebp + 24] %define FN_SEND [ebp + 28] %define FN_ACCEPT [ebp + 32] %define FN_BIND [ebp + 36] %define FN_LISTEN [ebp + 40] %define FN_WSASOCK [ebp + 44] %define FN_WSASTART [ebp + 48] LWSDataSegment: ;======================== dd 0x190 ; used by wsastartup dd 0xe71819b6 ; recv [ebp + 24] dd 0xe97019a4 ; send [ebp + 28] dd 0x498649e5 ; accept [ebp + 32] dd 0xc7701aa4 ; bind [ebp + 36] dd 0xe92eada4 ; listen [ebp + 40] dd 0xadf509d9 ; WSASocketA [ebp + 44] dd 0x3bfcedcb ; WSAStartup [ebp + 48] db "WS2_32", 0x00 ;======================== LLoadWinsock: pop ebx ; save address to data in ebx lea ecx, [ebx + 32] ; find address of "WS2_32.DLL" push ecx ; push address of "WS2_32.DLL" call edi ; call LoadLibraryA("WS2_32.DLL") mov edi, ebx ; store base of data section in edi mov ebx, eax ; store base of winsock in ebx lea esi, [ebp + 20] ; store base of function table push byte 0x07 ; load five functions by hash pop ecx ; configure the counter Looper: push ecx ; save the counter push ebx ; dll handle push dword [edi + ecx * 4] ; function hash value call [ebp + 4] ; find the address pop ecx ; restore the counter mov [esi + ecx * 4], eax ; stack segment to store addresses loop Looper LWSAStartup: ; WSAStartup (0x101, DATA) sub esp, [edi] push esp push dword [edi] call FN_WSASTART xor eax, eax LWSASocketA: ; WSASocketA (2,1,0,0,0,0) push eax push eax push eax push eax inc eax push eax inc eax push eax call FN_WSASOCK mov edi, eax
/** * @file dx.cpp * * Implementation of functions setting up the graphics pipeline. */ #include "dx.h" #include <SDL.h> #include "engine.h" #include "options.h" #include "storm/storm.h" #include "utils/display.h" #include "utils/log.hpp" #include "utils/sdl_mutex.h" #ifdef __3DS__ #include <3ds.h> #endif namespace devilution { int refreshDelay; SDL_Renderer *renderer; SDL_Texture *texture; /** Currently active palette */ SDL_Palette *Palette; unsigned int pal_surface_palette_version = 0; /** 24-bit renderer texture surface */ SDL_Surface *renderer_texture_surface = nullptr; /** 8-bit surface that we render to */ SDL_Surface *pal_surface; /** Whether we render directly to the screen surface, i.e. `pal_surface == GetOutputSurface()` */ bool RenderDirectlyToOutputSurface; namespace { int sgdwLockCount; #ifdef _DEBUG int locktbl[256]; #endif SdlMutex MemCrit; bool CanRenderDirectlyToOutputSurface() { #ifdef USE_SDL1 #ifdef SDL1_FORCE_DIRECT_RENDER return true; #else auto *outputSurface = GetOutputSurface(); return ((outputSurface->flags & SDL_DOUBLEBUF) == SDL_DOUBLEBUF && outputSurface->w == gnScreenWidth && outputSurface->h == gnScreenHeight && outputSurface->format->BitsPerPixel == 8); #endif #else // !USE_SDL1 return false; #endif } void CreateBackBuffer() { if (CanRenderDirectlyToOutputSurface()) { Log("{}", "Will render directly to the SDL output surface"); pal_surface = GetOutputSurface(); RenderDirectlyToOutputSurface = true; } else { pal_surface = SDL_CreateRGBSurfaceWithFormat( /*flags=*/0, /*width=*/gnScreenWidth, /*height=*/gnScreenHeight, /*depth=*/8, SDL_PIXELFORMAT_INDEX8); if (pal_surface == nullptr) { ErrSdl(); } } #ifndef USE_SDL1 // In SDL2, `pal_surface` points to the global `palette`. if (SDL_SetSurfacePalette(pal_surface, Palette) < 0) ErrSdl(); #else // In SDL1, `pal_surface` owns its palette and we must update it every // time the global `palette` is changed. No need to do anything here as // the global `palette` doesn't have any colors set yet. #endif pal_surface_palette_version = 1; } void CreatePrimarySurface() { #ifndef USE_SDL1 if (renderer != nullptr) { int width = 0; int height = 0; SDL_RenderGetLogicalSize(renderer, &width, &height); Uint32 format; if (SDL_QueryTexture(texture, &format, nullptr, nullptr, nullptr) < 0) ErrSdl(); renderer_texture_surface = SDL_CreateRGBSurfaceWithFormat(0, width, height, SDL_BITSPERPIXEL(format), format); } #endif if (GetOutputSurface() == nullptr) { ErrSdl(); } } void LockBufPriv() { MemCrit.lock(); if (sgdwLockCount != 0) { sgdwLockCount++; return; } sgdwLockCount++; } void UnlockBufPriv() { if (sgdwLockCount == 0) app_fatal("draw main unlock error"); sgdwLockCount--; MemCrit.unlock(); } /** * @brief Limit FPS to avoid high CPU load, use when v-sync isn't available */ void LimitFrameRate() { if (!sgOptions.Graphics.bFPSLimit) return; static uint32_t frameDeadline; uint32_t tc = SDL_GetTicks() * 1000; uint32_t v = 0; if (frameDeadline > tc) { v = tc % refreshDelay; SDL_Delay(v / 1000 + 1); // ceil } frameDeadline = tc + v + refreshDelay; } } // namespace void dx_init() { #ifndef USE_SDL1 SDL_RaiseWindow(ghMainWnd); SDL_ShowWindow(ghMainWnd); #endif CreatePrimarySurface(); palette_init(); CreateBackBuffer(); } void lock_buf(int idx) // NOLINT(misc-unused-parameters) { #ifdef _DEBUG ++locktbl[idx]; #endif LockBufPriv(); } void unlock_buf(int idx) // NOLINT(misc-unused-parameters) { #ifdef _DEBUG if (locktbl[idx] == 0) app_fatal("Draw lock underflow: 0x%x", idx); --locktbl[idx]; #endif UnlockBufPriv(); } Surface GlobalBackBuffer() { if (sgdwLockCount == 0) { Log("WARNING: Trying to obtain GlobalBackBuffer() without holding a lock"); return Surface(); } return Surface(pal_surface, SDL_Rect { 0, 0, gnScreenWidth, gnScreenHeight }); } void dx_cleanup() { #ifndef USE_SDL1 if (ghMainWnd != nullptr) SDL_HideWindow(ghMainWnd); #endif MemCrit.lock(); sgdwLockCount = 0; MemCrit.unlock(); if (pal_surface == nullptr) return; SDL_FreeSurface(pal_surface); pal_surface = nullptr; SDL_FreePalette(Palette); SDL_FreeSurface(renderer_texture_surface); #ifndef USE_SDL1 SDL_DestroyTexture(texture); SDL_DestroyRenderer(renderer); #endif SDL_DestroyWindow(ghMainWnd); } void dx_reinit() { #ifdef USE_SDL1 Uint32 flags = ghMainWnd->flags ^ SDL_FULLSCREEN; if (!IsFullScreen()) { flags |= SDL_FULLSCREEN; } ghMainWnd = SDL_SetVideoMode(0, 0, 0, flags); if (ghMainWnd == NULL) { ErrSdl(); } #else Uint32 flags = 0; if (!IsFullScreen()) { flags = renderer != nullptr ? SDL_WINDOW_FULLSCREEN_DESKTOP : SDL_WINDOW_FULLSCREEN; } if (SDL_SetWindowFullscreen(ghMainWnd, flags) != 0) { ErrSdl(); } #endif force_redraw = 255; } void InitPalette() { Palette = SDL_AllocPalette(256); if (Palette == nullptr) { ErrSdl(); } } void BltFast(SDL_Rect *srcRect, SDL_Rect *dstRect) { if (RenderDirectlyToOutputSurface) return; Blit(pal_surface, srcRect, dstRect); } void Blit(SDL_Surface *src, SDL_Rect *srcRect, SDL_Rect *dstRect) { SDL_Surface *dst = GetOutputSurface(); #ifndef USE_SDL1 if (SDL_BlitSurface(src, srcRect, dst, dstRect) < 0) ErrSdl(); #else if (!OutputRequiresScaling()) { if (SDL_BlitSurface(src, srcRect, dst, dstRect) < 0) ErrSdl(); return; } SDL_Rect scaledDstRect; if (dstRect != NULL) { scaledDstRect = *dstRect; ScaleOutputRect(&scaledDstRect); dstRect = &scaledDstRect; } // Same pixel format: We can call BlitScaled directly. if (SDLBackport_PixelFormatFormatEq(src->format, dst->format)) { if (SDL_BlitScaled(src, srcRect, dst, dstRect) < 0) ErrSdl(); return; } // If the surface has a color key, we must stretch first and can then call BlitSurface. if (SDL_HasColorKey(src)) { SDL_Surface *stretched = SDL_CreateRGBSurface(SDL_SWSURFACE, dstRect->w, dstRect->h, src->format->BitsPerPixel, src->format->Rmask, src->format->Gmask, src->format->BitsPerPixel, src->format->Amask); SDL_SetColorKey(stretched, SDL_SRCCOLORKEY, src->format->colorkey); if (src->format->palette != NULL) SDL_SetPalette(stretched, SDL_LOGPAL, src->format->palette->colors, 0, src->format->palette->ncolors); SDL_Rect stretched_rect = { 0, 0, dstRect->w, dstRect->h }; if (SDL_SoftStretch(src, srcRect, stretched, &stretched_rect) < 0 || SDL_BlitSurface(stretched, &stretched_rect, dst, dstRect) < 0) { SDL_FreeSurface(stretched); ErrSdl(); } SDL_FreeSurface(stretched); return; } // A surface with a non-output pixel format but without a color key needs scaling. // We can convert the format and then call BlitScaled. SDL_Surface *converted = SDL_ConvertSurface(src, dst->format, 0); if (SDL_BlitScaled(converted, srcRect, dst, dstRect) < 0) { SDL_FreeSurface(converted); ErrSdl(); } SDL_FreeSurface(converted); #endif } void RenderPresent() { SDL_Surface *surface = GetOutputSurface(); if (!gbActive) { LimitFrameRate(); return; } #ifndef USE_SDL1 if (renderer != nullptr) { if (SDL_UpdateTexture(texture, nullptr, surface->pixels, surface->pitch) <= -1) { //pitch is 2560 ErrSdl(); } // Clear buffer to avoid artifacts in case the window was resized if (SDL_SetRenderDrawColor(renderer, 0, 0, 0, 255) <= -1) { // TODO only do this if window was resized ErrSdl(); } if (SDL_RenderClear(renderer) <= -1) { ErrSdl(); } if (SDL_RenderCopy(renderer, texture, nullptr, nullptr) <= -1) { ErrSdl(); } SDL_RenderPresent(renderer); if (!sgOptions.Graphics.bVSync && !timedemo) { LimitFrameRate(); } } else { if (SDL_UpdateWindowSurface(ghMainWnd) <= -1) { ErrSdl(); } LimitFrameRate(); } #else if (SDL_Flip(surface) <= -1) { ErrSdl(); } if (RenderDirectlyToOutputSurface) pal_surface = GetOutputSurface(); LimitFrameRate(); #endif } void PaletteGetEntries(int dwNumEntries, SDL_Color *lpEntries) { for (int i = 0; i < dwNumEntries; i++) { lpEntries[i] = system_palette[i]; } } } // namespace devilution
.global s_prepare_buffers s_prepare_buffers: push %r11 push %r9 push %rbp push %rbx push %rcx push %rdi push %rsi lea addresses_WC_ht+0x3e1b, %rsi lea addresses_D_ht+0xe26d, %rdi nop nop nop nop nop xor $59720, %r9 mov $85, %rcx rep movsb nop nop nop nop nop sub %rbp, %rbp lea addresses_D_ht+0x13ddb, %r11 nop nop nop nop xor $50153, %rsi mov (%r11), %r9 nop and $56189, %rdi lea addresses_UC_ht+0x1bf6f, %r11 nop nop nop nop add $62872, %rbp movl $0x61626364, (%r11) nop nop nop xor $25130, %rsi lea addresses_WC_ht+0x1251b, %rsi lea addresses_D_ht+0x4407, %rdi clflush (%rsi) nop add %rbx, %rbx mov $122, %rcx rep movsw nop nop sub %rcx, %rcx pop %rsi pop %rdi pop %rcx pop %rbx pop %rbp pop %r9 pop %r11 ret .global s_faulty_load s_faulty_load: push %r12 push %r13 push %r14 push %rcx push %rdi push %rdx push %rsi // REPMOV lea addresses_PSE+0x941b, %rsi lea addresses_PSE+0x941b, %rdi nop nop nop nop nop add %rdx, %rdx mov $43, %rcx rep movsb nop nop nop nop nop xor $24879, %rsi // Load lea addresses_UC+0x18c1b, %rdx sub $64765, %r13 mov (%rdx), %di nop sub $16734, %rcx // Faulty Load lea addresses_PSE+0x941b, %r13 nop nop nop nop add $36726, %rcx mov (%r13), %rdx lea oracles, %r13 and $0xff, %rdx shlq $12, %rdx mov (%r13,%rdx,1), %rdx pop %rsi pop %rdx pop %rdi pop %rcx pop %r14 pop %r13 pop %r12 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_PSE', 'AVXalign': False, 'congruent': 0, 'size': 2, 'same': False, 'NT': False}} {'OP': 'REPM', 'src': {'type': 'addresses_PSE', 'congruent': 0, 'same': True}, 'dst': {'type': 'addresses_PSE', 'congruent': 0, 'same': True}} {'OP': 'LOAD', 'src': {'type': 'addresses_UC', 'AVXalign': True, 'congruent': 10, 'size': 2, 'same': False, 'NT': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_PSE', 'AVXalign': False, 'congruent': 0, 'size': 8, 'same': True, 'NT': False}} <gen_prepare_buffer> {'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 9, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 1, 'same': True}} {'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 4, 'size': 8, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 2, 'size': 4, 'same': True, 'NT': False}} {'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 8, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 2, 'same': False}} {'33': 21829} 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 */
.global s_prepare_buffers s_prepare_buffers: push %r12 push %r14 push %r15 push %r8 push %rbx push %rcx push %rdi push %rdx push %rsi lea addresses_normal_ht+0x11861, %rdi nop nop nop nop nop add %rbx, %rbx mov (%rdi), %r12d nop nop nop nop sub $34068, %r14 lea addresses_WC_ht+0x11d01, %r8 nop sub $16573, %rdi mov (%r8), %r15w nop and $5474, %rdi lea addresses_D_ht+0x1d661, %r15 nop nop nop cmp $33157, %rbx mov $0x6162636465666768, %rdi movq %rdi, %xmm6 vmovups %ymm6, (%r15) nop nop dec %r15 lea addresses_UC_ht+0x1d8a1, %r15 clflush (%r15) nop nop nop nop add %rdx, %rdx mov (%r15), %r12 nop add %rdi, %rdi lea addresses_WC_ht+0x9461, %r8 add %rdx, %rdx mov (%r8), %di nop and $44667, %rbx lea addresses_D_ht+0x16ba1, %rsi lea addresses_A_ht+0x19961, %rdi cmp %r8, %r8 mov $76, %rcx rep movsq nop xor $39836, %rbx lea addresses_WT_ht+0xc341, %rsi lea addresses_WC_ht+0x8b59, %rdi clflush (%rsi) nop nop nop and $65438, %rdx mov $97, %rcx rep movsb nop nop nop nop xor $36623, %rcx lea addresses_A_ht+0xed59, %r14 nop nop nop nop nop add $33921, %rsi mov $0x6162636465666768, %rdx movq %rdx, %xmm2 vmovups %ymm2, (%r14) nop nop nop nop cmp %r8, %r8 lea addresses_D_ht+0x11e1, %rsi lea addresses_WC_ht+0x17061, %rdi clflush (%rdi) nop add %r15, %r15 mov $85, %rcx rep movsw dec %rbx lea addresses_WT_ht+0x12161, %rsi lea addresses_WC_ht+0xc61, %rdi clflush (%rdi) nop nop nop cmp $32847, %r12 mov $75, %rcx rep movsq nop nop nop nop nop and %r14, %r14 lea addresses_D_ht+0x11521, %rcx nop nop nop cmp $49351, %r8 mov (%rcx), %rdx nop nop add %rbx, %rbx lea addresses_WT_ht+0x6861, %r14 nop nop nop nop nop cmp %r12, %r12 movw $0x6162, (%r14) nop nop nop nop inc %r15 lea addresses_WC_ht+0xcfd5, %r12 nop nop nop nop nop dec %rdx mov $0x6162636465666768, %rsi movq %rsi, (%r12) nop and $28176, %rcx lea addresses_A_ht+0x14061, %r12 clflush (%r12) nop nop nop nop nop cmp %r15, %r15 movb $0x61, (%r12) nop nop nop sub $65324, %r12 lea addresses_WT_ht+0x1b861, %rcx nop nop nop dec %r14 mov (%rcx), %r8d nop sub %rdx, %rdx pop %rsi pop %rdx pop %rdi pop %rcx pop %rbx pop %r8 pop %r15 pop %r14 pop %r12 ret .global s_faulty_load s_faulty_load: push %r12 push %r13 push %r15 push %r8 push %rdi push %rdx push %rsi // Store lea addresses_D+0x1ccfb, %r13 nop nop nop cmp %rsi, %rsi movb $0x51, (%r13) nop nop and %rdx, %rdx // Store lea addresses_RW+0x131e1, %r8 nop nop nop nop nop add %r12, %r12 movw $0x5152, (%r8) nop nop nop nop add $4916, %rdi // Store lea addresses_PSE+0x11661, %r13 nop nop nop nop nop sub $32686, %rdi mov $0x5152535455565758, %r15 movq %r15, %xmm7 movntdq %xmm7, (%r13) nop nop xor $316, %rsi // Faulty Load lea addresses_WC+0x15461, %rdi nop nop nop nop nop sub $57496, %rdx movntdqa (%rdi), %xmm1 vpextrq $0, %xmm1, %r12 lea oracles, %rdx and $0xff, %r12 shlq $12, %r12 mov (%rdx,%r12,1), %r12 pop %rsi pop %rdx pop %rdi pop %r8 pop %r15 pop %r13 pop %r12 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_WC', 'same': False, 'size': 2, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_D', 'same': False, 'size': 1, 'congruent': 0, 'NT': False, 'AVXalign': True}, 'OP': 'STOR'} {'dst': {'type': 'addresses_RW', 'same': False, 'size': 2, 'congruent': 6, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'dst': {'type': 'addresses_PSE', 'same': False, 'size': 16, 'congruent': 7, 'NT': True, 'AVXalign': False}, 'OP': 'STOR'} [Faulty Load] {'src': {'type': 'addresses_WC', 'same': True, 'size': 16, 'congruent': 0, 'NT': True, 'AVXalign': False}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'type': 'addresses_normal_ht', 'same': False, 'size': 4, 'congruent': 10, 'NT': False, 'AVXalign': True}, 'OP': 'LOAD'} {'src': {'type': 'addresses_WC_ht', 'same': False, 'size': 2, 'congruent': 5, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_D_ht', 'same': True, 'size': 32, 'congruent': 5, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'src': {'type': 'addresses_UC_ht', 'same': False, 'size': 8, 'congruent': 6, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_WC_ht', 'same': False, 'size': 2, 'congruent': 10, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_D_ht', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 8, 'same': True}, 'OP': 'REPM'} {'src': {'type': 'addresses_WT_ht', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 2, 'same': False}, 'OP': 'REPM'} {'dst': {'type': 'addresses_A_ht', 'same': False, 'size': 32, 'congruent': 1, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'src': {'type': 'addresses_D_ht', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 10, 'same': False}, 'OP': 'REPM'} {'src': {'type': 'addresses_WT_ht', 'congruent': 6, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 10, 'same': False}, 'OP': 'REPM'} {'src': {'type': 'addresses_D_ht', 'same': False, 'size': 8, 'congruent': 6, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_WT_ht', 'same': False, 'size': 2, 'congruent': 10, 'NT': False, 'AVXalign': True}, 'OP': 'STOR'} {'dst': {'type': 'addresses_WC_ht', 'same': False, 'size': 8, 'congruent': 2, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'dst': {'type': 'addresses_A_ht', 'same': False, 'size': 1, 'congruent': 9, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'src': {'type': 'addresses_WT_ht', 'same': False, 'size': 4, 'congruent': 10, 'NT': True, 'AVXalign': False}, 'OP': 'LOAD'} {'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 */
; A227291: Characteristic function of squarefree numbers squared (A062503). ; 1,0,0,1,0,0,0,0,1,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,1,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,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,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,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,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,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 cal $0,5 ; d(n) (also called tau(n) or sigma_0(n)), the number of divisors of n. mov $1,$0 div $1,4 add $2,$0 mul $1,$2 add $1,$0 add $1,1 gcd $1,2 sub $1,1
; A023594: a(n) = sum of distinct prime divisors of 2*prime(n)+1. ; 5,7,11,8,23,3,12,16,47,59,10,8,83,32,24,107,24,44,8,24,10,56,167,179,21,36,26,48,76,227,25,263,16,34,36,104,15,112,72,347,359,14,383,46,84,29,50,152,25,20,467,479,33,503,108,48,18,184,45,563,10 seq $0,40 ; The prime numbers. mul $0,2 seq $0,8472 ; Sum of the distinct primes dividing n.
sll a0, a1, a2 sll x10, a1, a2 sub sp, sp, t0 mul a0, s0, a1 sltu a0, zero, a0
; A015203: Sum of Gaussian binomial coefficients for q=15. ; Submitted by Stefano Spezia ; 1,2,18,484,61700,24625416,46902626632,280592659752848,8014314610618754064,719144325473017534005280,308098615000966585021543006496,414695472396278556489315958364507712,2664978629760569684020787743089224873508928,53805224213196755064738886369755408721132007510144,5186568374133591196396660614178159846661764069523516511360,1570731940608546059545204557776880235245265579603189837446275512576,2271166606217150694057697153874215901056633336827949704099458242087784513792 mov $1,$0 mov $0,0 add $1,1 mov $2,1 lpb $1 sub $1,1 mov $4,$2 mul $2,15 mul $4,$3 add $0,$4 sub $3,$4 add $3,$0 add $3,$2 lpe mov $0,$3 div $0,225 add $0,1
COMMENT }%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Copyright (c) GeoWorks 1988 -- All Rights Reserved PROJECT: PC GEOS MODULE: Monochrome EGA screen driver FILE: megaManager.asm AUTHOR: Jeremy Dashe REVISION HISTORY: Name Date Description ---- ---- ----------- Jim 4/88 initial version jeremy 5/91 monochrome version DESCRIPTION: This file contains the source for the Monochrome EGA screen driver. There are a number of actual files included in this one that actually contain the actual source code. They are located in the EGA and MEGA directories. The complete specification for screen drivers can be found on the system in the pcgeos spec directory (/staff/pcgeos/Spec). $Id: megaManager.asm,v 1.1 97/04/18 11:42:19 newdeal Exp $ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%} ;-------------------------------------- ; Include files ;-------------------------------------- _VideoDriver = 1 VIDEO_STACK_SIZE equ 512 ; size of local stack include vidcomGeode.def ; common include files ;--------------------------------------------------------------------- ; Data area ;--------------------------------------------------------------------- include megaConstant.def include vgacomConstant.def include vidcomConstant.def include megaMacro.def include vgacomMacro.def include vidcomMacro.def ;------------------------------------------------------------------------------ ; Variables ;------------------------------------------------------------------------------ idata segment include megaDevInfo.asm ; device info block include vidcomTables.asm ; common tables include megaTables.asm ; important tabular information idata ends udata segment include vidcomVariable.def include vgacomVariable.def ; local buffer space udata ends ;------------------------------------------------------------------------------ ; Variables ;------------------------------------------------------------------------------ VideoDevices segment lmem LMEM_TYPE_GENERAL include megaStringTab.asm ; device names VideoDevices ends ;------------------------------------------------------------------------------ ; Code ;------------------------------------------------------------------------------ idata segment include vidcomEntry.asm ; entry point,jump tab include vidcomOutput.asm ; common output routines include vidcomChars.asm ; common character output routines include megaGenChar.asm ; routines for larger characters include vidcomFont.asm ; routines for rotating, building chars include vidcomUnder.asm ; save under routines include vidcomUtils.asm ; utility routines include vidcomRegion.asm ; region drawing routines include vidcomXOR.asm ; xor region support include vidcomInfo.asm ; device setting/naming include vidcomEscape.asm ; implements some escape functions include vidcomPalette.asm ; support for VidGetPixel include vgacomPointer.asm ; pointer support include vgacomUtils.asm ; misc utility routines include dumbcomUtils.asm ; misc utility routines include dumbcomPalette.asm ; color tables include megaOutput.asm ; output routines include megaChars.asm ; character drawing routines include megaEscTab.asm ; escape code jump table idata ends include vidcomPolygon.asm ; polygon drawing include vidcomLine.asm ; line drawing routine include vidcomPutLine.asm ; line drawing routine include vidcomRaster.asm ; raster primitive support include vidcomExclBounds.asm ; bounds accumulation include vgacomRaster.asm ; raster primitive support include megaAdmin.asm ; misc admin routines end
; A081005: a(n) = Fibonacci(4n+3) + 1, or Fibonacci(2n+1)*Lucas(2n+2). ; 3,14,90,611,4182,28658,196419,1346270,9227466,63245987,433494438,2971215074,20365011075,139583862446,956722026042,6557470319843,44945570212854,308061521170130,2111485077978051,14472334024676222,99194853094755498,679891637638612259,4660046610375530310,31940434634990099906,218922995834555169027,1500520536206896083278,10284720757613717413914,70492524767089125814115,483162952612010163284886,3311648143516982017180082,22698374052006863956975683,155576970220531065681649694,1066340417491710595814572170,7308805952221443105020355491,50095301248058391139327916262,343358302784187294870275058338,2353412818241252672952597492099,16130531424904581415797907386350,110560307156090817237632754212346,757791618667731139247631372100067,5193981023518027157495786850488118,35600075545958458963222876581316754,244006547798191185585064349218729155 mul $0,2 mov $1,2 mov $2,1 lpb $0 sub $0,1 add $2,$1 add $1,$2 lpe add $1,1 mov $0,$1
#include "aspch.h" #include "OpenGLContext.h" #include "GLFW/glfw3.h" #include "glad/glad.h" namespace Asaurus { OpenGLContext::OpenGLContext(GLFWwindow* windowHandle) :m_WindowHandle(windowHandle) { AS_CORE_ASSERT(m_WindowHandle, "Window Handle is null!"); } void OpenGLContext::Init() { AS_PROFILE_FUNCTION(); // Initialize Glad glfwMakeContextCurrent(m_WindowHandle); int statusGlad = gladLoadGLLoader((GLADloadproc)glfwGetProcAddress); AS_CORE_ASSERT(statusGlad, "Failed to initialize Glad!"); AS_CORE_INFO("OpenGL Info:"); AS_CORE_INFO(" Vendor: {0}", glGetString(GL_VENDOR)); AS_CORE_INFO(" Renderer: {0}", glGetString(GL_RENDERER)); AS_CORE_INFO(" Version: {0}", glGetString(GL_VERSION)); // Version check #ifdef AS_ENABLE_ASSERTS int versionMajor; int versionMinor; glGetIntegerv(GL_MAJOR_VERSION, &versionMajor); glGetIntegerv(GL_MINOR_VERSION, &versionMinor); AS_CORE_ASSERT(versionMajor > 4 || (versionMajor == 4 && versionMinor >= 5), "Asaurus requires atleast OpenGL version 4.5!"); #endif } void OpenGLContext::SwapBuffers() { AS_PROFILE_FUNCTION(); glfwSwapBuffers(m_WindowHandle); } }
INCLUDE "hardware.inc" SECTION "Helper Functions",HOME ;-------------------------------------------------------------------------- ;- CPU_fast() - ;- CPU_slow() - ;-------------------------------------------------------------------------- CPU_fast:: ld a,[rKEY1] bit 7,a jr z,__CPU_switch ret CPU_slow:: ld a,[rKEY1] bit 7,a jr nz,__CPU_switch ret __CPU_switch: ld a,[rIE] ld b,a ; save IE xor a,a ld [rIE],a ld a,$30 ld [rP1],a ld a,$01 ld [rKEY1],a stop ld a,b ld [rIE],a ; restore IE ret ;-------------------------------------------------------------------------- ;- wait_ly() b = ly to wait for - ;-------------------------------------------------------------------------- wait_ly:: ld c,rLY & $FF .no_same_ly: ld a,[$FF00+c] cp a,b jr nz,.no_same_ly ret ;-------------------------------------------------------------------------- ;- screen_off() - ;-------------------------------------------------------------------------- screen_off:: ld a,[rLCDC] and a,LCDCF_ON ret z ld b,$91 call wait_ly xor a,a ld [rLCDC],a ;Shutdown LCD ret ;-------------------------------------------------------------------------- ;- memset() d = value hl = start address bc = size - ;-------------------------------------------------------------------------- memset:: ld a,d ld [hl+],a dec bc ld a,b or a,c jr nz,memset ret ;-------------------------------------------------------------------------- ;- memcopy() bc = size hl = source address de = dest address - ;-------------------------------------------------------------------------- memcopy:: ld a,[hl+] ld [de],a inc de dec bc ld a,b or a,c jr nz,memcopy ret ;-------------------------------------------------------------------------- SECTION "VAR",BSS[$C100] MAGIC_VALUE: ;-------------------------------------------------------------------------- ;- CARTRIDGE HEADER - ;-------------------------------------------------------------------------- SECTION "Cartridge Header",HOME[$0100] nop nop jr Main DB $CE,$ED,$66,$66,$CC,$0D,$00,$0B,$03,$73,$00,$83,$00,$0C,$00,$0D DB $00,$08,$11,$1F,$88,$89,$00,$0E,$DC,$CC,$6E,$E6,$DD,$DD,$D9,$99 DB $BB,$BB,$67,$63,$6E,$0E,$EC,$CC,$DD,$DC,$99,$9F,$BB,$B9,$33,$3E ; 0123456789ABC DB "DMA OAM TIME." DW $0000 DB $C0 ;GBC flag DB 0,0,0 ;SuperGameboy DB $1B ;CARTTYPE (MBC5+RAM+BATTERY) DB 0 ;ROMSIZE DB 3 ;RAMSIZE (4*8KB) DB $01 ;Destination (0 = Japan, 1 = Non Japan) DB $00 ;Manufacturer DB 0 ;Version DB 0 ;Complement check DW 0 ;Checksum ;-------------------------------------------------------------------------- ;- Main() - ;-------------------------------------------------------------------------- Main: di ld a,$DB ; debug :) ld [MAGIC_VALUE],a call screen_off call CPU_fast ld a,$0A ld [$0000],a ld d,0 ld hl,$A000 ld bc,$2000 call memset ld a,0 ld hl,$C000 .fillram: ld [hl+],a inc a cp a,$A0 jr nz,.fillram ;-------------------- ld bc,DMA0_END-DMA0_START ld hl,DMA0_START ld de,$FF80 call memcopy call $FF80 ld bc,DMA1_END-DMA1_START ld hl,DMA1_START ld de,$FF80 call memcopy call $FF80 ld bc,DMA2_END-DMA2_START ld hl,DMA2_START ld de,$FF80 call memcopy call $FF80 ld bc,DMA3_END-DMA3_START ld hl,DMA3_START ld de,$FF80 call memcopy call $FF80 ld bc,DMA4_END-DMA4_START ld hl,DMA4_START ld de,$FF80 call memcopy call $FF80 ld bc,DMA5_END-DMA5_START ld hl,DMA5_START ld de,$FF80 call memcopy call $FF80 ld bc,DMA6_END-DMA6_START ld hl,DMA6_START ld de,$FF80 call memcopy call $FF80 ld bc,DMA7_END-DMA7_START ld hl,DMA7_START ld de,$FF80 call memcopy call $FF80 ld bc,DMA8_END-DMA8_START ld hl,DMA8_START ld de,$FF80 call memcopy call $FF80 ld bc,DMA9_END-DMA9_START ld hl,DMA9_START ld de,$FF80 call memcopy call $FF80 ld bc,DMA10_END-DMA10_START ld hl,DMA10_START ld de,$FF80 call memcopy call $FF80 ld bc,DMA11_END-DMA11_START ld hl,DMA11_START ld de,$FF80 call memcopy call $FF80 ld bc,DMA12_END-DMA12_START ld hl,DMA12_START ld de,$FF80 call memcopy call $FF80 ld bc,DMA13_END-DMA13_START ld hl,DMA13_START ld de,$FF80 call memcopy call $FF80 ld bc,DMA14_END-DMA14_START ld hl,DMA14_START ld de,$FF80 call memcopy call $FF80 ld bc,DMA15_END-DMA15_START ld hl,DMA15_START ld de,$FF80 call memcopy call $FF80 ld bc,DMA16_END-DMA16_START ld hl,DMA16_START ld de,$FF80 call memcopy call $FF80 ld bc,DMA17_END-DMA17_START ld hl,DMA17_START ld de,$FF80 call memcopy call $FF80 ld bc,DMA18_END-DMA18_START ld hl,DMA18_START ld de,$FF80 call memcopy call $FF80 ld bc,DMA19_END-DMA19_START ld hl,DMA19_START ld de,$FF80 call memcopy call $FF80 ;-------------------- ld a,$00 ld [$0000],a .end: halt jr .end ;-------------------------------------------------------------------------- SECTION "Functions",HOME ;-------------------------------------------------------------------------- DMA_FN: MACRO ld a,$C0 ld [rDMA],a ld a,37 delay\@: dec a jr nz,delay\@ REPT \1 nop ENDR ld a,[MAGIC_VALUE] ld [$A000+\1],a ld a,9 delay2\@: dec a jr nz,delay2\@ ret ENDM ;-------------------------------------------------------------------------- DMA0_START: DMA_FN 0 DMA0_END: DMA1_START: DMA_FN 1 DMA1_END: DMA2_START: DMA_FN 2 DMA2_END: DMA3_START: DMA_FN 3 DMA3_END: DMA4_START: DMA_FN 4 DMA4_END: DMA5_START: DMA_FN 5 DMA5_END: DMA6_START: DMA_FN 6 DMA6_END: DMA7_START: DMA_FN 7 DMA7_END: DMA8_START: DMA_FN 8 DMA8_END: DMA9_START: DMA_FN 9 DMA9_END: DMA10_START: DMA_FN 10 DMA10_END: DMA11_START: DMA_FN 11 DMA11_END: DMA12_START: DMA_FN 12 DMA12_END: DMA13_START: DMA_FN 13 DMA13_END: DMA14_START: DMA_FN 14 DMA14_END: DMA15_START: DMA_FN 15 DMA15_END: DMA16_START: DMA_FN 16 DMA16_END: DMA17_START: DMA_FN 17 DMA17_END: DMA18_START: DMA_FN 18 DMA18_END: DMA19_START: DMA_FN 19 DMA19_END: ;--------------------------------------------------------------------------
; A124845: Triangle read by rows: T(n,k) = (3 - (-1)^k)*binomial(n,k)/2 (0 <= k <= n). ; Submitted by Jon Maiga ; 1,1,2,1,4,1,1,6,3,2,1,8,6,8,1,1,10,10,20,5,2,1,12,15,40,15,12,1,1,14,21,70,35,42,7,2,1,16,28,112,70,112,28,16,1,1,18,36,168,126,252,84,72,9,2,1,20,45,240,210,504,210,240,45,20,1,1,22,55,330,330,924,462,660,165 lpb $0 add $1,1 sub $0,$1 lpe bin $1,$0 mod $0,2 add $0,1 mul $1,$0 mov $0,$1
// // Created by Orange on 6/25/17. // #include "Timer.h" using namespace xnet; std::atomic<int64_t> Timer::numCreated_; void Timer::restart(const TimePoint& now) { if (repeat_) { expiration_ = addTime(now, interval_); } else { expiration_ = TimePoint::invalid(); } }
// Copyright (c) 2009-2014 The Bitcoin developers // Copyright (c) 2014-2015 The Dash developers // Copyright (c) 2015-2017 The PIVX developers // Copyright (c) 2018-2020 The Kabberry developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "checkpoints.h" #include "chainparams.h" #include "main.h" #include "uint256.h" #include <stdint.h> #include <boost/foreach.hpp> namespace Checkpoints { /** * How many times we expect transactions after the last checkpoint to * be slower. This number is a compromise, as it can't be accurate for * every system. When reindexing from a fast disk with a slow CPU, it * can be up to 20, while when downloading from a slow network with a * fast multicore CPU, it won't be much higher than 1. */ static const double SIGCHECK_VERIFICATION_FACTOR = 5.0; bool fEnabled = true; bool CheckBlock(int nHeight, const uint256& hash, bool fMatchesCheckpoint) { if (!fEnabled) return true; const MapCheckpoints& checkpoints = *Params().Checkpoints().mapCheckpoints; MapCheckpoints::const_iterator i = checkpoints.find(nHeight); // If looking for an exact match, then return false if (i == checkpoints.end()) return !fMatchesCheckpoint; return hash == i->second; } //! Guess how far we are in the verification process at the given block index double GuessVerificationProgress(CBlockIndex* pindex, bool fSigchecks) { if (pindex == NULL) return 0.0; int64_t nNow = time(NULL); double fSigcheckVerificationFactor = fSigchecks ? SIGCHECK_VERIFICATION_FACTOR : 1.0; double fWorkBefore = 0.0; // Amount of work done before pindex double fWorkAfter = 0.0; // Amount of work left after pindex (estimated) // Work is defined as: 1.0 per transaction before the last checkpoint, and // fSigcheckVerificationFactor per transaction after. const CCheckpointData& data = Params().Checkpoints(); if (pindex->nChainTx <= data.nTransactionsLastCheckpoint) { double nCheapBefore = pindex->nChainTx; double nCheapAfter = data.nTransactionsLastCheckpoint - pindex->nChainTx; double nExpensiveAfter = (nNow - data.nTimeLastCheckpoint) / 86400.0 * data.fTransactionsPerDay; fWorkBefore = nCheapBefore; fWorkAfter = nCheapAfter + nExpensiveAfter * fSigcheckVerificationFactor; } else { double nCheapBefore = data.nTransactionsLastCheckpoint; double nExpensiveBefore = pindex->nChainTx - data.nTransactionsLastCheckpoint; double nExpensiveAfter = (nNow - pindex->GetBlockTime()) / 86400.0 * data.fTransactionsPerDay; fWorkBefore = nCheapBefore + nExpensiveBefore * fSigcheckVerificationFactor; fWorkAfter = nExpensiveAfter * fSigcheckVerificationFactor; } return fWorkBefore / (fWorkBefore + fWorkAfter); } int GetTotalBlocksEstimate() { if (!fEnabled) return 0; const MapCheckpoints& checkpoints = *Params().Checkpoints().mapCheckpoints; return checkpoints.rbegin()->first; } CBlockIndex* GetLastCheckpoint() { if (!fEnabled) return NULL; const MapCheckpoints& checkpoints = *Params().Checkpoints().mapCheckpoints; BOOST_REVERSE_FOREACH (const MapCheckpoints::value_type& i, checkpoints) { const uint256& hash = i.second; BlockMap::const_iterator t = mapBlockIndex.find(hash); if (t != mapBlockIndex.end()) return t->second; } return NULL; } } // namespace Checkpoints
; Codigo ASM para TPMV ; Tecnología de la Programación - FDI (UCM) ; Marco Antonio Gómez Martín ; ; Programa con dos "funciones", una que escribe un entero ; que recibe como parámetro y otra que hace un cout << endl. ; La primera se basa en otra función auxiliar que implementa ; la funcionalidad de forma recursiva. ; ; El programa utiliza las funciones anteriores para escribir ; un 6583 y un 49 en líneas independientes. ; ; El código es generado por un pequeño compilador de terceros. ; ; El código es generado por un pequeño compilador de terceros. ; JUMP 1 PUSH 3 STORE 1 PUSH 3 STORE 0 JUMP 170 LOAD 0 PUSH 2 ADD LOAD 2 STOREIND LOAD 0 PUSH 3 ADD STORE 2 LOAD 0 PUSH 4 ADD STORE 0 LOAD 2 PUSH 0 ADD LOADIND PUSH 0 eq not BF 70 LOAD 0 PUSH 1 ADD PUSH 45 STOREIND LOAD 0 PUSH 3 ADD DUP LOAD 2 PUSH 0 ADD LOADIND PUSH 10 DIV STOREIND POP JUMP 6 LOAD 2 PUSH 1 ADD LOAD 2 PUSH 0 ADD LOADIND PUSH 10 DIV STOREIND PUSH 48 LOAD 2 PUSH 0 ADD LOADIND ADD PUSH 10 LOAD 2 PUSH 1 ADD LOADIND MUL SUB OUT JUMP 70 LOAD 2 PUSH 2 SUB LOADIND LOAD 2 PUSH 3 SUB DUP STORE 0 PUSH 2 ADD LOADIND STORE 2 JUMPIND LOAD 0 PUSH 2 ADD LOAD 2 STOREIND LOAD 0 PUSH 3 ADD STORE 2 LOAD 0 PUSH 3 ADD STORE 0 LOAD 2 PUSH 0 ADD LOADIND PUSH 0 EQ BF 109 PUSH 48 PUSH 0 ADD OUT JUMP 125 LOAD 0 PUSH 1 ADD PUSH 125 STOREIND LOAD 0 PUSH 3 ADD DUP LOAD 2 PUSH 0 ADD LOADIND STOREIND POP JUMP 6 LOAD 2 PUSH 2 SUB LOADIND LOAD 2 PUSH 3 SUB DUP STORE 0 PUSH 2 ADD LOADIND STORE 2 JUMPIND LOAD 0 PUSH 2 ADD LOAD 2 STOREIND LOAD 0 PUSH 3 ADD STORE 2 LOAD 0 PUSH 2 ADD STORE 0 PUSH 10 OUT PUSH 13 OUT LOAD 2 PUSH 2 SUB LOADIND LOAD 2 PUSH 3 SUB DUP STORE 0 PUSH 2 ADD LOADIND STORE 2 JUMPIND LOAD 0 PUSH 1 ADD PUSH 183 STOREIND LOAD 0 PUSH 3 ADD DUP PUSH 6583 STOREIND POP JUMP 84 LOAD 0 PUSH 1 ADD PUSH 189 STOREIND JUMP 139 LOAD 0 PUSH 1 ADD PUSH 202 STOREIND LOAD 0 PUSH 3 ADD DUP PUSH 49 STOREIND POP JUMP 84 LOAD 0 PUSH 1 ADD PUSH 208 STOREIND JUMP 139 HALT
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Copyright (c) GeoWorks 1992 -- All Rights Reserved PROJECT: PC GEOS MODULE: Kernel/Graphics FILE: graphicsPatternHatch.asm AUTHOR: Don Reeves, Mar 19, 1992 REVISION HISTORY: Name Date Description ---- ---- ----------- Don 3/19/92 Initial revision DESCRIPTION: Contains the definitions of the system hatch patterns. $Id: graphicsPatternHatch.asm,v 1.1 97/04/05 01:13:12 newdeal Exp $ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ SystemBitmapsAndHatches segment lmem LMEM_TYPE_GENERAL, mask LMF_IN_RESOURCE StartPatterns <(SystemBitmap + SystemHatch)> ;--- Bitmaps --- ;--- Hatches --- DefPattern HatchVertical MakeHatch HatchVertical, 1, TRUE MakeHatchLine <0.0>,<0.0>, <0.0>,<4.0>, <90.0>, \ <0,CF_SAME,0,0>, 0 EndHatch HatchVertical DefPattern HatchHorizontal MakeHatch HatchHorizontal, 1, TRUE MakeHatchLine <0.0>,<0.0>, <0.0>,<4.0>, <0.0>, \ <0,CF_SAME,0,0>, 0 EndHatch HatchHorizontal DefPattern Hatch45Degree MakeHatch Hatch45Degree, 1, TRUE MakeHatchLine <0.0>,<0.0>, <0.0>,<4.0>, <45.0>, \ <0,CF_SAME,0,0>, 0 EndHatch Hatch45Degree DefPattern Hatch135Degree MakeHatch Hatch135Degree, 1, TRUE MakeHatchLine <0.0>,<0.0>, <0.0>,<4.0>, <135.0>, \ <0,CF_SAME,0,0>, 0 EndHatch Hatch135Degree DefPattern HatchBrick MakeHatch HatchBrick, 2, TRUE MakeHatchLine <0.0>,<0.0>, <0.0>,<4.0>, <0.0>, \ <0,CF_SAME,0,0>, 0 MakeHatchLine <0.0>,<0.0>, <4.0>,<4.0>, <90.0>, \ <0,CF_SAME,0,0>, 1 MakeHatchDash <4.0>, <4.0> EndHatch HatchBrick DefPattern HatchBrickSlanted MakeHatch HatchBrickSlanted, 2, TRUE MakeHatchLine <0.0>,<0.0>, <0.0>,<4.0>, <45.0>, \ <0,CF_SAME,0,0>, 0 MakeHatchLine <0.0>,<0.0>, <4.0>,<4.0>, <135.0>, \ <0,CF_SAME,0,0>, 1 MakeHatchDash <4.0>, <4.0> EndHatch HatchBrickSlanted EndPatterns SystemBitmapsAndHatches ends
; ; Copyright (C) 2021 by Intel Corporation ; ; Permission to use, copy, modify, and/or distribute this software for any ; purpose with or without fee is hereby granted. ; ; THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH ; REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY ; AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, ; INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM ; LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR ; OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR ; PERFORMANCE OF THIS SOFTWARE. ; ; .globl embedded_rounding ; void void embedded_rounding(const float *a, const float *b, float* out); ; ; On entry: ; rcx = a ; rdx = b ; r8 = out .code embedded_rounding PROC public vmovups zmm2, [rcx] vmovups zmm4, [rdx] mov eax, 0ffffh kmovw k6, eax vaddps zmm7 {k6}, zmm2, zmm4 {ru-sae} vmovups [r8], zmm7 vzeroupper ret embedded_rounding ENDP end