text
stringlengths
1
1.05M
; ; ; ZX Maths Routines ; ; 10/12/02 - Stefano Bodrato ; ; $Id: tan.asm,v 1.5 2016/06/22 19:59:18 dom Exp $ ; ;double tan(double) ;Number in FA.. IF FORzx INCLUDE "zxfp.def" ENDIF IF FORzx81 INCLUDE "81fp.def" ENDIF IF FORlambda INCLUDE "lambdafp.def" ENDIF SECTION code_fp PUBLIC tan EXTERN fsetup1 EXTERN stkequ .tan call fsetup1 IF FORlambda defb ZXFP_TAN + 128 ELSE defb ZXFP_TAN defb ZXFP_END_CALC ENDIF jp stkequ
; --------------------------------------------------------------------------- ; Sprite mappings - Buzz Bomber enemy ; --------------------------------------------------------------------------- dc.w byte_9A42-Map_obj22, byte_9A61-Map_obj22 dc.w byte_9A80-Map_obj22, byte_9AA4-Map_obj22 dc.w byte_9AC8-Map_obj22, byte_9AE7-Map_obj22 byte_9A42: dc.b 6 dc.b $F4, 9, 0, 0, $E8 dc.b $F4, 9, 0, $F, 0 dc.b 4, 8, 0, $15, $E8 dc.b 4, 4, 0, $18, 0 dc.b $F1, 8, 0, $1A, $EC dc.b $F1, 4, 0, $1D, 4 byte_9A61: dc.b 6 dc.b $F4, 9, 0, 0, $E8 dc.b $F4, 9, 0, $F, 0 dc.b 4, 8, 0, $15, $E8 dc.b 4, 4, 0, $18, 0 dc.b $F4, 8, 0, $1F, $EC dc.b $F4, 4, 0, $22, 4 byte_9A80: dc.b 7 dc.b 4, 0, 0, $30, $C dc.b $F4, 9, 0, 0, $E8 dc.b $F4, 9, 0, $F, 0 dc.b 4, 8, 0, $15, $E8 dc.b 4, 4, 0, $18, 0 dc.b $F1, 8, 0, $1A, $EC dc.b $F1, 4, 0, $1D, 4 byte_9AA4: dc.b 7 dc.b 4, 4, 0, $31, $C dc.b $F4, 9, 0, 0, $E8 dc.b $F4, 9, 0, $F, 0 dc.b 4, 8, 0, $15, $E8 dc.b 4, 4, 0, $18, 0 dc.b $F4, 8, 0, $1F, $EC dc.b $F4, 4, 0, $22, 4 byte_9AC8: dc.b 6 dc.b $F4, $D, 0, 0, $EC dc.b 4, $C, 0, 8, $EC dc.b 4, 0, 0, $C, $C dc.b $C, 4, 0, $D, $F4 dc.b $F1, 8, 0, $1A, $EC dc.b $F1, 4, 0, $1D, 4 byte_9AE7: dc.b 4 dc.b $F4, $D, 0, 0, $EC dc.b 4, $C, 0, 8, $EC dc.b 4, 0, 0, $C, $C dc.b $C, 4, 0, $D, $F4 dc.b $F4, 8, 0, $1F, $EC dc.b $F4, 4, 0, $22, 4 even
// Copyright 2015 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "components/password_manager/core/browser/android_affiliation/affiliation_fetch_throttler.h" #include <stdint.h> #include "base/bind.h" #include "base/check_op.h" #include "base/rand_util.h" #include "base/task/sequenced_task_runner.h" #include "base/threading/thread_task_runner_handle.h" #include "base/time/tick_clock.h" #include "base/time/time.h" #include "components/password_manager/core/browser/android_affiliation/affiliation_fetch_throttler_delegate.h" namespace password_manager { // static const net::BackoffEntry::Policy AffiliationFetchThrottler::kBackoffPolicy = { // Number of initial errors (in sequence) to ignore before going into // exponential backoff. 0, // Initial delay (in ms) once backoff starts. 10 * 1000, // 10 seconds // Factor by which the delay will be multiplied on each subsequent failure. 4, // Fuzzing percentage: 50% will spread delays randomly between 50%--100% of // the nominal time. .5, // 50% // Maximum delay (in ms) during exponential backoff. 6 * 3600 * 1000, // 6 hours // Time to keep an entry from being discarded even when it has no // significant state, -1 to never discard. (Not applicable.) -1, // False means that initial_delay_ms is the first delay once we start // exponential backoff, i.e., there is no delay after subsequent successful // requests. false, }; // static const int64_t AffiliationFetchThrottler::kGracePeriodAfterReconnectMs = 10 * 1000; // 10 seconds AffiliationFetchThrottler::AffiliationFetchThrottler( AffiliationFetchThrottlerDelegate* delegate, const scoped_refptr<base::SequencedTaskRunner>& task_runner, network::NetworkConnectionTracker* network_connection_tracker, const base::TickClock* tick_clock) : delegate_(delegate), task_runner_(task_runner), network_connection_tracker_(network_connection_tracker), tick_clock_(tick_clock), state_(IDLE), has_network_connectivity_(false), is_fetch_scheduled_(false), exponential_backoff_( new net::BackoffEntry(&kBackoffPolicy, tick_clock_)) { DCHECK(delegate); // Start observing before querying the current connectivity state, so that if // the state changes concurrently in-between, it will not go unnoticed. network_connection_tracker_->AddNetworkConnectionObserver(this); } AffiliationFetchThrottler::~AffiliationFetchThrottler() { network_connection_tracker_->RemoveNetworkConnectionObserver(this); } void AffiliationFetchThrottler::SignalNetworkRequestNeeded() { if (state_ != IDLE) return; state_ = FETCH_NEEDED; has_network_connectivity_ = !network_connection_tracker_->IsOffline(); if (has_network_connectivity_) EnsureCallbackIsScheduled(); } void AffiliationFetchThrottler::InformOfNetworkRequestComplete(bool success) { DCHECK_EQ(state_, FETCH_IN_FLIGHT); state_ = IDLE; exponential_backoff_->InformOfRequest(success); } void AffiliationFetchThrottler::EnsureCallbackIsScheduled() { DCHECK_EQ(state_, FETCH_NEEDED); DCHECK(has_network_connectivity_); if (is_fetch_scheduled_) return; is_fetch_scheduled_ = true; task_runner_->PostDelayedTask( FROM_HERE, base::BindOnce(&AffiliationFetchThrottler::OnBackoffDelayExpiredCallback, weak_ptr_factory_.GetWeakPtr()), exponential_backoff_->GetTimeUntilRelease()); } void AffiliationFetchThrottler::OnBackoffDelayExpiredCallback() { DCHECK_EQ(state_, FETCH_NEEDED); DCHECK(is_fetch_scheduled_); is_fetch_scheduled_ = false; // Do nothing if network connectivity was lost while this callback was in the // task queue. The callback will be posted in the OnNetworkChanged // handler once again. if (!has_network_connectivity_) return; // The release time might have been increased if network connectivity was lost // and restored while this callback was in the task queue. If so, reschedule. if (exponential_backoff_->ShouldRejectRequest()) EnsureCallbackIsScheduled(); else state_ = delegate_->OnCanSendNetworkRequest() ? FETCH_IN_FLIGHT : IDLE; } void AffiliationFetchThrottler::OnConnectionChanged( network::mojom::ConnectionType type) { bool old_has_network_connectivity = has_network_connectivity_; // We reread the connection type here instead of relying on |type| because // NetworkConnectionTracker will call this function an extra time with // CONNECTION_NONE whenever the connection changes to an online state, even // if it was already in a different online state. has_network_connectivity_ = !network_connection_tracker_->IsOffline(); // Only react when network connectivity has been reestablished. if (!has_network_connectivity_ || old_has_network_connectivity) return; double grace_ms = kGracePeriodAfterReconnectMs * (1 - base::RandDouble() * kBackoffPolicy.jitter_factor); exponential_backoff_->SetCustomReleaseTime( std::max(exponential_backoff_->GetReleaseTime(), tick_clock_->NowTicks() + base::Milliseconds(grace_ms))); if (state_ == FETCH_NEEDED) EnsureCallbackIsScheduled(); } } // namespace password_manager
#pragma once namespace MyMQUtils { inline void UpdateMinOrMax(float value, float& inoutMin, float& inoutMax) { if (inoutMin > value) { inoutMin = value; } else if (inoutMax < value) { inoutMax = value; } } template<typename TFunctor> void ScanAllFaces(MQCDocument* doc, const TFunctor& func) { const int objCount = doc->GetObjectCount(); for (int objIndex = 0; objIndex < objCount; ++objIndex) { auto* obj = doc->GetObject(objIndex); if (obj == nullptr) { continue; } const int faceCount = obj->GetFaceCount(); for (int faceIndex = 0; faceIndex < faceCount; ++faceIndex) { const int facePointCount = obj->GetFacePointCount(faceIndex); func(objIndex, faceIndex, facePointCount); } } } inline int GetAliveObjectsCount(MQCDocument* doc) { const int totalCount = doc->GetObjectCount(); int aliveCount = 0; for (int i = 0; i < totalCount; ++i) { auto* obj = doc->GetObject(i); if (obj != nullptr) { ++aliveCount; } } return aliveCount; } inline int GetAliveMaterialsCount(MQCDocument* doc) { // GetMaterialCount() は単に配列のサイズを返すだけらしい。 // マテリアルを追加した後、マテリアルをすべて削除した状態でも、Compaction が実行されるまで非ゼロが返ってくる。 // 有効なマテリアルの数を調べるには、全要素に対して NULL チェックが必要。 const int totalCount = doc->GetMaterialCount(); int aliveCount = 0; for (int i = 0; i < totalCount; ++i) { auto* mat = doc->GetMaterial(i); if (mat != nullptr) { ++aliveCount; } } return aliveCount; } //! @brief カレントオブジェクトかつカレントマテリアルに対して、UV 選択されている頂点に対する共通ループ操作を定義する。<br> //! @return ループの最後まで到達し、スキャンが成功したか否か。<br> //! @tparam writebackUV UV 座標の変更(書き戻し)を行なうか否か。<br> template<bool writebackUV, typename TFunctor> bool CommonUVScanLoopImpl(MQCDocument* doc, const TFunctor& func) { // 1つのオブジェクトに異なる2つ以上のマテリアルが割り当てられている可能性に注意してスキャンする。 const int currentObjIndex = doc->GetCurrentObjectIndex(); const int currentMatIndex = doc->GetCurrentMaterialIndex(); if (currentMatIndex == -1) { // カレントマテリアルが無効=マテリアルがひとつも無い。すなわちすべてが未着色面。 // 本来は「カレントマテリアルが無効=マテリアルが存在しない」とはかぎらないが、 // Metasequoia では一応それが成り立つ仕様になっているはず。 return false; } auto* obj = doc->GetObject(currentObjIndex); if (obj == nullptr) { return false; } // Metasequoia 3 までは四角形面までしか対応していなかったが、Metasequoia 4 からは五角形以上もサポートされるようになった。 // したがって固定長配列では対応不能。 // 通例、面数は 3 or 4 が一般的であることから、可変長配列を4要素で初期化しておき、後は resize() による自動伸長に任せる。 std::vector<MQCoordinate> uvArray(4); const int faceCount = obj->GetFaceCount(); for (int faceIndex = 0; faceIndex < faceCount; ++faceIndex) { if (obj->GetFaceMaterial(faceIndex) != currentMatIndex) { // カレントマテリアルでない場合。 continue; } const auto facePointCount = obj->GetFacePointCount(faceIndex); if (facePointCount < 1) { continue; } uvArray.resize(facePointCount); #if 1 obj->GetFaceCoordinateArray(faceIndex, &uvArray[0]); for (int k = 0; k < facePointCount; ++k) { if (doc->IsSelectUVVertex(currentObjIndex, faceIndex, k)) { func(uvArray[k]); } } // テンプレート非型引数による分岐。静的分岐に帰結するので、コンパイル時の展開最適化に期待する。 if (writebackUV) { obj->SetFaceCoordinateArray(faceIndex, &uvArray[0]); } #else // こちらだと処理をカスタマイズできる領域が大きくなるが、カスタマイズする側は // (MQCObject* obj, int currentObjIndex, int faceIndex, int facePointCount, MQCoordinate uvArray[]) // を引数に持つ関数オブジェクトを渡さないといけない。引数が多いと分かりづらくなる。 func(obj, currentObjIndex, faceIndex, facePointCount, &uvArray[0]); #endif } return true; } // @brief カレントオブジェクトかつカレントマテリアルに対して、UV 選択された頂点の最小・最大 UV 値を取得する。<br> // @return UV 選択された頂点が少なくとも1つ以上存在するか否か。<br> inline bool CalcMinMaxOfUVSelectedVertices(MQCDocument* doc, MQCoordinate& minVal, MQCoordinate& maxVal) { bool isFirstValue = true; return CommonUVScanLoopImpl<false>(doc, [&](MQCoordinate& uv) { if (isFirstValue) { isFirstValue = false; minVal = maxVal = uv; } else { UpdateMinOrMax(uv.u, minVal.u, maxVal.u); UpdateMinOrMax(uv.v, minVal.v, maxVal.v); } }) && !isFirstValue; } }
org 100h start: mov al, 0x13 int 0x10 mov dx, 0x3C8 ; set palette out dx, al inc dx .paletteloop: out dx, al ; simple grayscale palette out dx, al out dx, al inc ax jnz .paletteloop push 0xA000 - 10 ; shift the segment by half a line to center X on screen pop es mov dx, interrupt ; set interrupt handler mov ax, 0x251C int 0x21 mov dx, 0x331 ; MIDI Control Port mov al, 0x3F ; enable MIDI out dx, al dec dx ; shift dx to MIDI data port rep outsb ; CX is still 0xFF so dumps the whole code to MIDI data port main: ; raycaster heavily based on Hellmood's Essence 64b, https://www.pouet.net/prod.php?which=83204 xor bx, bx ; bx is the distance along the ray mov cl, 64 ; max number of steps .loop: add bl, -1 ; take step along the ray, note that this will be mutated when we hit a note .mutant equ $-1 mov ax, 0xCCCD ; rrrola trick! mul di mov al, dh ; al = y sbb al, 100 ; shift y to center imul bl ; y*z xchg ax, dx ; dx is now y*z, al is now x imul bl ; x*z mov al, bl ; al = z add al, 208 ; add time, will be mutated to make the camera move forward .time equ $-1 ; didn't use the bios timer, because it doesn't start always from the same value add ah, 8+16*7 ; shift the camera in x xor al, ah ; (z+time)^(x*z+camx>>8) sub dh, 8+16*3 ; shift the camera in y xor al, dh ; (z+time)^(x*z+camx>>8)^(y*z+camy>>8) test al, 256-16 ; if any bit but 16 is zero, then loop (as long as cx >0), otherwise we hit a box loopnz .loop xchg ax, bx ; use z as the color stosb ; put pixel on screen imul di, 85 ; "random" dithering jmp main interrupt: mov dx, 0x330 ; MIDI data port again, we almost could've done all midi init here, but mov si, song-1 ; the low bass pad would retriggered every interrupt, so didn't. add byte [si],17 ; 17*15 = 255 = -1, so in 15 interrupts the song goes one step backward dec byte [main.time+si-song+1] ; mutate the camera z in the main loop lodsb ; load time outsb ; output 0x9F = Note on mov bx, si ; bx is now pointing to the song xlat ; Load note, 0 means no note dec ax ; note--, 0 => 255 = invalid note, so it will not play actually anything out dx, al mov [main.mutant], al ; Sync the raycaster step size to current note outsb ; The first note of the melody is also the note volume data: db 0xCF ; MIDI command: Set instrument on channel 0xF, 0xCF is also iret for the interrupt db 100 ; Instrument id 100, sounds cool, whatever it is db 0xC0 ; MIDI command: Set instrument on channel 0 db 89 ; Instrument id 89, sounds cool, no idea what it is db 0x90 ; MIDI command: Note On, channel 0 db 28 ; One octave down from the tonic of the melody (melody starts on note 40) db 119 ; Pretty loud, but not max vol, this is reused as the song time ; and chosen to have the melody start at correct position song: db 0x9F ; MIDI command: Note On, channel 0xF db 53, 51, 55, 53, 56, 53, 41, 0, 48, 46, 51, 0, 53, 48, 41 ; Just some random notes I typed in
; A040020: Continued fraction for sqrt(26). ; 5,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10 pow $1,$0 gcd $1,6 add $1,4
;###########################################; ; Console utilities. ; ;###########################################; ; --------------------------------------; ; Clears the screen ; --------------------------------------; CLEAR_SCREEN PROC NEAR PUSH 0007h ; White characters in black background PUSH 184Fh ; Lower right corner (24,79) PUSH 0000h ; Upper left corner (0, 0) CALL CLEAR_SCREEN_SQUARE ADD SP, 6 RET CLEAR_SCREEN ENDP ; --------------------------------------------------------------------------- ; Cleans a square on the screen ; @param [WORD]: Upper left corner (row, column) ; @param [WORD]: Lower right corner (row, column) ; @param [BYTE]: Attribute byte ; --------------------------------------------------------------------------- CLEAR_SCREEN_SQUARE PROC NEAR ; Stack - prepare PUSH BP MOV BP, SP ; Save registers PUSH AX PUSH BX PUSH CX PUSH DX MOV AX, [BP+8] ; Attribute byte MOV BH, AL MOV BL, 0 MOV DX, [BP+6] ; Lower right corner MOV CX, [BP+4] ; Upper left corner MOV AH, 06H ; 06H Function MOV AL, 01d ; Line amount ADD AL, DH SUB AL, CH INT 10h ; STACK - Restore POP DX POP CX POP BX POP AX POP BP RET CLEAR_SCREEN_SQUARE ENDP ; -----------------------------------------------------------------------------; ; Moves the cursor to given coordinates. ; @param [BYTE]: X coordinate ; @param [BYTE]: Y coordinate ; -----------------------------------------------------------------------------; GOTOXY PROC NEAR ; STACK - Prepare PUSH BP MOV BP, SP PUSH AX PUSH BX PUSH DX MOV AH, 2 ; Function 2 to move MOV BH, 0 ; Shows page 0 MOV DH, [BP+6] ; Y coordinate MOV DL, [BP+4] ; X coordinate INT 10h ; DOS interrupt ; STACK - Restore POP DX POP BX POP AX POP BP RET GOTOXY ENDP ; ------------------------------------------- ; Color byte in AL register ; @param [BYTE]: Background color (XRGB) ; @param [BYTE]: Foreground color (XRGB) ; @return AX: Formed byte ; ------------------------------------------- FORM_COLOR PROC NEAR ; STACK - Prepare PUSH BP MOV BP, SP PUSH BX PUSH CX MOV AX, 0 MOV BX, [BP+4] ; Background MOV CL, 4 SHL BX, CL MOV AL, BL MOV BX, [BP+6] ; Foreground OR AL, BL ; Eliminates blinking bit AND AL, 01111111b ; STACK - Restore POP CX POP BX POP BP RET FORM_COLOR ENDP ; ---------------------------------------------------------- ; ; Writes one character several times. ; @param [BYTE]: Character ; @param [WORD]: Times to be written ; ---------------------------------------------------------- ; CHAR_FILL PROC NEAR ; STACK - Prepare PUSH BP MOV BP, SP PUSH BX PUSH WORD PTR [BP+6] ; Times to be written MOV SI, SP PUSH WORD PTR [BP+4] ; Character CHAR_FILL_CYCLE: CALL PUTC DEC WORD PTR [SI] CMP WORD PTR [SI], 0 JNE CHAR_FILL_CYCLE ADD SP, 4 ; STACK - Restore POP BX POP BP RET CHAR_FILL ENDP ; -------------------------------------------------------------- ; ; Draws a filled rectangle in the given positions. ; @param [WORD]: X ; @param [WORD]: Y ; @param [WORD]: Length ; @param [WORD]: Height ; @param [BYTE]: Character ; -------------------------------------------------------------- ; DRAW_FILLED_RECT PROC NEAR ; STACK - Prepare PUSH BP MOV BP, SP PUSH BX ; Fills the lines with the given character PUSH WORD PTR [BP+6] ; y PUSH WORD PTR [BP+4] ; x MOV SI, SP ADD SI, 2 ; Y coordinate changes for every line MOV CX, [BP+10] ; Total lines DRAW_FILLED_RECT_CYCLE: CALL GOTOXY PUSH SI PUSH CX MOV AX, [BP+8] ; Width PUSH AX PUSH WORD PTR [BP+12] CALL CHAR_FILL ADD SP, 4 POP CX POP SI INC WORD PTR [SI] LOOP DRAW_FILLED_RECT_CYCLE ADD SP, 4 ; STACK - Restore POP BX POP BP RET DRAW_FILLED_RECT ENDP ; --------------------------------------------------------------- ; ; Draws an unfilled rect at the given position. ; TODO: This was a lazy approach, in reality is a smaller black rect ; inside another rect. ; @param [WORD]: X ; @param [WORD]: Y ; @param [WORD]: Length ; @param [WORD]: Height ; @param [BYTE]: Character ; --------------------------------------------------------------- ; DRAW_EMPTY_RECT PROC NEAR ; STACK - Prepare PUSH BP MOV BP, SP PUSH BX ; Draws a filled rect of the given size PUSH WORD PTR [BP+12] PUSH WORD PTR [BP+10] PUSH WORD PTR [BP+8] PUSH WORD PTR [BP+6] PUSH WORD PTR [BP+4] CALL DRAW_FILLED_RECT ; Draws a smaller rect inside with the background MOV SI, SP MOV WORD PTR [SI+8], ' ' SUB WORD PTR [SI+6], 2 ; Height-2 SUB WORD PTR [SI+4], 2 ; Length-2 ADD WORD PTR [SI+2], 1 ; Position y+1 ADD WORD PTR [SI], 1 ; Position x+1 CALL DRAW_FILLED_RECT ADD SP, 10 ; STACK - Restore POP BX POP BP RET DRAW_EMPTY_RECT ENDP ; ------------------------------- ; ; Make a pause ; ------------------------------- ; PAUSE PROC NEAR XOR AH,AH INT 16H RET PAUSE ENDP ; --------------------------------------------------------- ; ; Clamps a value to the given range ; @param [WORD]: Value ; @param [WORD]: Upper limit ; @param [WORD]: Lower limit ; @return [AX]: Clamped value ; --------------------------------------------------------- ; CLAMP_VALUE PROC NEAR ; STACK - Prepare PUSH BP MOV BP, SP PUSH BX MOV AX, [BP+4] ; Value in AX ; Compares lower limit CMP AX, [BP+6] JL CLAMP_LOWER ; Compares upper limit CMP AX, [BP+8] JG CLAMP_UPPER JMP CLAMP_END CLAMP_LOWER: MOV AX, [BP+6] JMP CLAMP_END CLAMP_UPPER: MOV AX, [BP+8] CLAMP_END: ; STACK - Restore POP BX POP BP RET CLAMP_VALUE ENDP
#include "graph_database.h" #include "shared_thread_state.h" namespace dllama_ns { int world_size; int world_rank; shared_thread_state* sstate; void start_mpi_listener() { sstate->snapshot_merger_instance->start_snapshot_listener(); } } using namespace dllama_ns; graph_database::~graph_database() { delete database; }
; A028191: Expansion of 1/((1-5x)(1-8x)(1-9x)(1-11x)). ; Submitted by Christian Krause ; 1,33,690,11690,175371,2432283,31956940,403804980,4956450741,59506980533,702298022790,8177594495070,94207230682111,1076026739628783,12205736906550240,137681865037361960,1546019692623509481,17295892741708761033,192909937302644291290,2146289640002776885650,23830783305493651732851,264157586613634472041283,2924100946325294502797940,32331991954048818947146140,357166438272718800927512221,3942562305325138788752413533,43492574665566497370366422190,479544272676094851014898223430 mov $1,1 mov $2,$0 mov $3,$0 lpb $2 mov $0,$3 sub $2,1 sub $0,$2 seq $0,20977 ; Expansion of 1/((1-8*x)*(1-9*x)*(1-11*x)). sub $0,$1 mul $1,6 add $1,$0 lpe mov $0,$1
#include "clay.hpp" namespace clay { static llvm::SpecificBumpPtrAllocator<InvokeEntry> *invokeEntryAllocator = new llvm::SpecificBumpPtrAllocator<InvokeEntry>(); static llvm::SpecificBumpPtrAllocator<InvokeSet> *invokeSetAllocator = new llvm::SpecificBumpPtrAllocator<InvokeSet>(); // // callableOverloads // static void initCallable(ObjectPtr x) { switch (x->objKind) { case TYPE : break; case RECORD : { Record *y = (Record *)x.ptr(); if (!y->builtinOverloadInitialized) initBuiltinConstructor(y); break; } case VARIANT : case PROCEDURE : case GLOBAL_ALIAS : break; case PRIM_OP : { assert(isOverloadablePrimOp(x)); break; } default : assert(false); } } const OverloadPtr callableInterface(ObjectPtr x) { switch (x->objKind) { case PROCEDURE : { Procedure *y = (Procedure *)x.ptr(); return y->interface; } default : { return NULL; } } } const vector<OverloadPtr> &callableOverloads(ObjectPtr x) { initCallable(x); switch (x->objKind) { case TYPE : { Type *y = (Type *)x.ptr(); return y->overloads; } case RECORD : { Record *y = (Record *)x.ptr(); return y->overloads; } case VARIANT : { Variant *y = (Variant *)x.ptr(); return y->overloads; } case PROCEDURE : { Procedure *y = (Procedure *)x.ptr(); return y->overloads; } case PRIM_OP : { assert(isOverloadablePrimOp(x)); PrimOp *y = (PrimOp *)x.ptr(); return primOpOverloads(y); } case GLOBAL_ALIAS : { GlobalAlias *a = (GlobalAlias *)x.ptr(); assert(a->hasParams()); return a->overloads; } default : { assert(false); const vector<OverloadPtr> *ptr = NULL; return *ptr; } } } // // invoke tables // static bool invokeTablesInitialized = false; static const size_t INVOKE_TABLE_SIZE = 16384; static vector<llvm::SmallVector<InvokeSet*, 2> > invokeTable; static void initInvokeTables() { assert(!invokeTablesInitialized); invokeTable.resize(INVOKE_TABLE_SIZE); invokeTablesInitialized = true; } // // lookupInvokeSet // InvokeSet* lookupInvokeSet(ObjectPtr callable, const vector<TypePtr> &argsKey) { if (!invokeTablesInitialized) initInvokeTables(); int h = objectHash(callable) + objectVectorHash(argsKey); h &= (invokeTable.size() - 1); llvm::SmallVector<InvokeSet*, 2> &bucket = invokeTable[h]; for (unsigned i = 0; i < bucket.size(); ++i) { InvokeSet* invokeSet = bucket[i]; if (objectEquals(invokeSet->callable, callable) && objectVectorEquals(invokeSet->argsKey, argsKey)) { return invokeSet; } } OverloadPtr interface = callableInterface(callable); const vector<OverloadPtr> &overloads = callableOverloads(callable); InvokeSet* invokeSet = invokeSetAllocator->Allocate(); new ((void*)invokeSet) InvokeSet(callable, argsKey, interface, overloads); bucket.push_back(invokeSet); return invokeSet; } // // lookupInvokeEntry // static MatchSuccessPtr findMatchingInvoke(const vector<OverloadPtr> &overloads, unsigned &overloadIndex, ObjectPtr callable, const vector<TypePtr> &argsKey, MatchFailureError &failures) { while (overloadIndex < overloads.size()) { OverloadPtr x = overloads[overloadIndex++]; MatchResultPtr result = matchInvoke(x, callable, argsKey); if (result->matchCode == MATCH_SUCCESS) { MatchSuccess *y = (MatchSuccess *)result.ptr(); return y; } else { failures.failures.push_back(make_pair(x, result)); } } return NULL; } static MatchSuccessPtr getMatch(InvokeSet* invokeSet, unsigned entryIndex, MatchFailureError &failures) { if (entryIndex < invokeSet->matches.size()) return invokeSet->matches[entryIndex]; assert(entryIndex == invokeSet->matches.size()); unsigned nextOverloadIndex = invokeSet->nextOverloadIndex; MatchSuccessPtr match = findMatchingInvoke(invokeSet->overloads, nextOverloadIndex, invokeSet->callable, invokeSet->argsKey, failures); if (!match) return NULL; invokeSet->matches.push_back(match); invokeSet->nextOverloadIndex = nextOverloadIndex; return match; } static bool tempnessMatches(ValueTempness tempness, ValueTempness formalTempness) { switch (tempness) { case TEMPNESS_LVALUE : return ((formalTempness == TEMPNESS_DONTCARE) || (formalTempness == TEMPNESS_LVALUE) || (formalTempness == TEMPNESS_FORWARD)); case TEMPNESS_RVALUE : return ((formalTempness == TEMPNESS_DONTCARE) || (formalTempness == TEMPNESS_RVALUE) || (formalTempness == TEMPNESS_FORWARD)); default : assert(false); return false; } } static ValueTempness tempnessKeyItem(ValueTempness formalTempness, ValueTempness tempness) { switch (formalTempness) { case TEMPNESS_LVALUE : case TEMPNESS_RVALUE : case TEMPNESS_DONTCARE : return formalTempness; case TEMPNESS_FORWARD : return tempness; default : assert(false); return formalTempness; } } static bool matchTempness(CodePtr code, const vector<ValueTempness> &argsTempness, bool callByName, vector<ValueTempness> &tempnessKey, vector<bool> &forwardedRValueFlags) { const vector<FormalArgPtr> &fargs = code->formalArgs; FormalArgPtr fvarArg = code->formalVarArg; if (fvarArg.ptr()) assert(fargs.size() <= argsTempness.size()); else assert(fargs.size() == argsTempness.size()); tempnessKey.clear(); forwardedRValueFlags.clear(); for (unsigned i = 0; i < fargs.size(); ++i) { if (callByName && (fargs[i]->tempness == TEMPNESS_FORWARD)) { error(fargs[i], "forwarded arguments are not allowed " "in call-by-name procedures"); } if (!tempnessMatches(argsTempness[i], fargs[i]->tempness)) return false; tempnessKey.push_back( tempnessKeyItem(fargs[i]->tempness, argsTempness[i])); bool forwardedRValue = (fargs[i]->tempness == TEMPNESS_FORWARD) && (argsTempness[i] == TEMPNESS_RVALUE); forwardedRValueFlags.push_back(forwardedRValue); } if (fvarArg.ptr()) { if (callByName && (fvarArg->tempness == TEMPNESS_FORWARD)) { error(fvarArg, "forwarded arguments are not allowed " "in call-by-name procedures"); } for (size_t i = fargs.size(); i < argsTempness.size(); ++i) { if (!tempnessMatches(argsTempness[i], fvarArg->tempness)) return false; tempnessKey.push_back( tempnessKeyItem(fvarArg->tempness, argsTempness[i])); bool forwardedRValue = (fvarArg->tempness == TEMPNESS_FORWARD) && (argsTempness[i] == TEMPNESS_RVALUE); forwardedRValueFlags.push_back(forwardedRValue); } } return true; } static InvokeEntry* newInvokeEntry(InvokeSet* parent, MatchSuccessPtr match, MatchSuccessPtr interfaceMatch) { InvokeEntry* entry = invokeEntryAllocator->Allocate(); new ((void*)entry) InvokeEntry(parent, match->callable, match->argsKey); entry->origCode = match->code; entry->code = clone(match->code); entry->env = match->env; if (interfaceMatch != NULL) entry->interfaceEnv = interfaceMatch->env; entry->fixedArgNames = match->fixedArgNames; entry->fixedArgTypes = match->fixedArgTypes; entry->varArgName = match->varArgName; entry->varArgTypes = match->varArgTypes; entry->callByName = match->callByName; entry->isInline = match->isInline; return entry; } InvokeEntry* lookupInvokeEntry(ObjectPtr callable, const vector<TypePtr> &argsKey, const vector<ValueTempness> &argsTempness, MatchFailureError &failures) { InvokeSet* invokeSet = lookupInvokeSet(callable, argsKey); map<vector<ValueTempness>,InvokeEntry*>::iterator iter = invokeSet->tempnessMap.find(argsTempness); if (iter != invokeSet->tempnessMap.end()) return iter->second; MatchResultPtr interfaceResult; if (invokeSet->interface != NULL) { interfaceResult = matchInvoke(invokeSet->interface, invokeSet->callable, invokeSet->argsKey); if (interfaceResult->matchCode != MATCH_SUCCESS) { failures.failedInterface = true; failures.failures.push_back(make_pair(invokeSet->interface, interfaceResult)); return NULL; } } MatchSuccessPtr match; vector<ValueTempness> tempnessKey; vector<bool> forwardedRValueFlags; unsigned i = 0; while ((match = getMatch(invokeSet,i,failures)).ptr() != NULL) { if (matchTempness(match->code, argsTempness, match->callByName, tempnessKey, forwardedRValueFlags)) { break; } ++i; } if (!match) return NULL; iter = invokeSet->tempnessMap2.find(tempnessKey); if (iter != invokeSet->tempnessMap2.end()) { invokeSet->tempnessMap[argsTempness] = iter->second; return iter->second; } InvokeEntry* entry = newInvokeEntry(invokeSet, match, (MatchSuccess*)interfaceResult.ptr()); entry->forwardedRValueFlags = forwardedRValueFlags; invokeSet->tempnessMap2[tempnessKey] = entry; invokeSet->tempnessMap[argsTempness] = entry; return entry; } }
bits 16 ; glb intptr_t : int ; glb uintptr_t : unsigned ; glb intmax_t : int ; glb uintmax_t : unsigned ; glb int8_t : signed char ; glb int_least8_t : signed char ; glb int_fast8_t : signed char ; glb uint8_t : unsigned char ; glb uint_least8_t : unsigned char ; glb uint_fast8_t : unsigned char ; glb int16_t : short ; glb int_least16_t : short ; glb int_fast16_t : short ; glb uint16_t : unsigned short ; glb uint_least16_t : unsigned short ; glb uint_fast16_t : unsigned short ; glb int32_t : int ; glb int_least32_t : int ; glb int_fast32_t : int ; glb uint32_t : unsigned ; glb uint_least32_t : unsigned ; glb uint_fast32_t : unsigned ; glb imaxdiv_t : struct <something> ; glb bool_t : int ; glb pointer_t : * unsigned char ; glb funcion_t : * ( ; prm <something> : * void ; ) * void ; glb manejador_t : * (void) void ; glb rti_t : * (void) void ; glb isr_t : * (void) void ; glb handler_t : * (void) void ; glb retardarThread_t : * (void) int ; glb ptrTVI_t : * * (void) void ; glb modoSO1_t : int ; glb lh_t : struct <something> ; glb address_t : struct <something> ; glb uPtrAdr_t : union <something> ; glb pid_t : int ; glb tid_t : int ; glb uid_t : int ; glb gid_t : int ; glb pindx_t : int ; glb tindx_t : int ; glb df_t : int ; glb dfs_t : int ; glb rindx_t : int ; glb modoAp_t : unsigned short ; glb tramaDWords_t : struct <something> ; glb tramaWords_t : struct <something> ; RPN'ized expression: "2 " ; Expanded expression: "2 " ; Expression value: 2 ; RPN'ized expression: "2 " ; Expanded expression: "2 " ; Expression value: 2 ; RPN'ized expression: "2 " ; Expanded expression: "2 " ; Expression value: 2 ; RPN'ized expression: "2 " ; Expanded expression: "2 " ; Expression value: 2 ; glb tramaBytes_t : struct <something> ; glb trama_t : union <something> ; RPN'ized expression: "8 " ; Expanded expression: "8 " ; Expression value: 8 ; glb bloque_t : struct <something> ; glb ptrBloque_t : * struct <something> ; glb dobleEnlace_t : struct <something> ; glb c2c_t : struct <something> ; glb posicionC2c : ( ; prm i : int ; prm c2c : struct <something> ; ) int ; glb eliminarC2c : ( ; prm i : int ; prm c2c : struct <something> ; ) void ; glb apilarC2c : ( ; prm i : int ; prm c2c : struct <something> ; ) void ; glb encolarC2c : ( ; prm i : int ; prm c2c : struct <something> ; ) void ; glb desencolarC2c : ( ; prm c2c : struct <something> ; ) int ; glb inicializarC2c : ( ; prm c2c : * struct <something> ; prm e : * struct <something> ; prm cabecera : int ; prm compartida : int ; ) void ; glb ptrC2c_t : * struct <something> ; glb posicionPC2c : ( ; prm i : int ; prm c2c : * struct <something> ; ) int ; glb eliminarPC2c : ( ; prm i : int ; prm ptrC2c : * struct <something> ; ) void ; glb apilarPC2c : ( ; prm i : int ; prm ptrC2c : * struct <something> ; ) void ; glb encolarPC2c : ( ; prm i : int ; prm ptrC2c : * struct <something> ; ) void ; glb desencolarPC2c : ( ; prm ptrC2c : * struct <something> ; ) int ; glb inicializarPC2c : ( ; prm ptrC2c : * struct <something> ; prm e : * struct <something> ; prm cabecera : int ; prm compartida : int ; ) void ; glb callBack_t : * ( ; prm arg : * void ; ) int ; RPN'ized expression: "10 " ; Expanded expression: "10 " ; Expression value: 10 ; glb descCcb_t : struct <something> ; glb ccb_t : * struct <something> ; glb inicCcb : ( ; prm ccb : * struct <something> ; prm max : unsigned short ; ) int ; glb encolarCcb : ( ; prm cb : * ( ; prm arg : * void ; ) int ; prm ccb : * struct <something> ; ) int ; glb desencolarCcb : ( ; prm ccb : * struct <something> ; ) * ( ; prm arg : * void ; ) int ; glb eliminarCcb : ( ; prm cb : * ( ; prm arg : * void ; ) int ; prm ccb : * struct <something> ; ) int ; glb eliminarSegCcb : ( ; prm segmento : unsigned short ; prm ccb : * struct <something> ; ) int ; glb vaciarCcb : ( ; prm ccb : * struct <something> ; ) int ; glb atenderCcb : ( ; prm ccb : * struct <something> ; ) int ; glb estado_t : int ; glb dfa_t : struct <something> ; RPN'ized expression: "12 " ; Expanded expression: "12 " ; Expression value: 12 ; RPN'ized expression: "80 " ; Expanded expression: "80 " ; Expression value: 80 ; RPN'ized expression: "10 " ; Expanded expression: "10 " ; Expression value: 10 ; glb descProceso_t : struct <something> ; glb descThread_t : struct <something> ; glb tipoFichero_t : int ; RPN'ized expression: "9 " ; Expanded expression: "9 " ; Expression value: 9 ; glb descFichero_t : struct <something> ; glb tipoRecurso_t : int ; glb open_t : * ( ; prm dfs : int ; prm modo : unsigned short ; ) int ; glb release_t : * ( ; prm dfs : int ; ) int ; glb read_t : * ( ; prm dfs : int ; prm dir : * unsigned char ; prm nbytes : unsigned short ; ) int ; glb aio_read_t : * ( ; prm dfs : int ; prm dir : * unsigned char ; prm nbytes : unsigned short ; ) int ; glb write_t : * ( ; prm dfs : int ; prm dir : * unsigned char ; prm nbytes : unsigned short ; ) int ; glb aio_write_t : * ( ; prm dfs : int ; prm dir : * unsigned char ; prm nbytes : unsigned short ; ) int ; glb lseek_t : * ( ; prm dfs : int ; prm pos : int ; prm whence : unsigned short ; ) int ; glb fcntl_t : * ( ; prm dfs : int ; prm cmd : unsigned short ; prm arg : unsigned short ; ) int ; glb ioctl_t : * ( ; prm dfs : int ; prm request : unsigned short ; prm arg : unsigned short ; ) int ; glb eliminar_t : * ( ; prm pindx : int ; ) int ; RPN'ized expression: "12 " ; Expanded expression: "12 " ; Expression value: 12 ; RPN'ized expression: "2 " ; Expanded expression: "2 " ; Expression value: 2 ; RPN'ized expression: "2 " ; Expanded expression: "2 " ; Expression value: 2 ; RPN'ized expression: "2 " ; Expanded expression: "2 " ; Expression value: 2 ; glb descRecurso_t : struct <something> ; glb info_t : struct <something> ; glb cabecera_t : struct <something> ; RPN'ized expression: "16 1 + " ; Expanded expression: "17 " ; Expression value: 17 ; RPN'ized expression: "16 2 + " ; Expanded expression: "18 " ; Expression value: 18 ; RPN'ized expression: "2010 1 + " ; Expanded expression: "2011 " ; Expression value: 2011 ; RPN'ized expression: "2010 2 + " ; Expanded expression: "2012 " ; Expression value: 2012 ; RPN'ized expression: "20 1 + " ; Expanded expression: "21 " ; Expression value: 21 ; RPN'ized expression: "20 2 + " ; Expanded expression: "22 " ; Expression value: 22 ; RPN'ized expression: "14 1 + " ; Expanded expression: "15 " ; Expression value: 15 ; RPN'ized expression: "14 2 + " ; Expanded expression: "16 " ; Expression value: 16 ; RPN'ized expression: "16 16 + " ; Expanded expression: "32 " ; Expression value: 32 ; RPN'ized expression: "2010 16 + " ; Expanded expression: "2026 " ; Expression value: 2026 ; RPN'ized expression: "2010 1 + " ; Expanded expression: "2011 " ; Expression value: 2011 ; RPN'ized expression: "2010 1 + " ; Expanded expression: "2011 " ; Expression value: 2011 ; RPN'ized expression: "16 1 + " ; Expanded expression: "17 " ; Expression value: 17 ; RPN'ized expression: "2010 1 + " ; Expanded expression: "2011 " ; Expression value: 2011 ; RPN'ized expression: "20 14 + " ; Expanded expression: "34 " ; Expression value: 34 ; glb e2PFR_t : struct <something> ; glb cPFR_t : int ; glb sigThread_t : * () int ; glb activarThread_t : * ( ; prm tindx : int ; ) void ; glb buscarNuevoThreadActual_t : * (void) void ; glb bloquearThreadActual_t : * ( ; prm rindx : int ; ) void ; glb descSO1H_t : struct <something> ; RPN'ized expression: "12 " ; Expanded expression: "12 " ; Expression value: 12 ; RPN'ized expression: "80 " ; Expanded expression: "80 " ; Expression value: 80 ; RPN'ized expression: "10 " ; Expanded expression: "10 " ; Expression value: 10 ; glb descProcesoExt_t : struct <something> ; glb descThreadExt_t : struct <something> ; RPN'ized expression: "16 " ; Expanded expression: "16 " ; Expression value: 16 ; glb descProceso : [16u] struct <something> ; RPN'ized expression: "2010 " ; Expanded expression: "2010 " ; Expression value: 2010 ; glb descThread : [2010u] struct <something> ; RPN'ized expression: "20 " ; Expanded expression: "20 " ; Expression value: 20 ; glb descFichero : [20u] struct <something> ; RPN'ized expression: "14 " ; Expanded expression: "14 " ; Expression value: 14 ; glb descRecurso : [14u] struct <something> ; RPN'ized expression: "numColasPFR " ; Expanded expression: "12 " ; Expression value: 12 ; glb c2cPFR : [12u] struct <something> ; glb e2PFR : struct <something> ; glb descCcbAlEpilogo : struct <something> ; glb ccbAlEpilogo : * struct <something> ; glb tramaThread : * union <something> ; glb tramaTarea : * union <something> ; glb indThreadActual : int ; glb indProcesoActual : int ; glb indThreadDeSuperficie : int ; glb contRodajas : unsigned ; glb contTicsRodaja : int ; glb contadorTimer00 : unsigned short ; glb contOcioso : int ; glb nuevoPid : (void) int ; glb nuevoTid : (void) int ; glb indice : ( ; prm tid : int ; ) int ; glb sigThread : (void) int ; glb activarThread : ( ; prm tindx : int ; ) int ; glb registrarEnPOrdenados : ( ; prm pindx : int ; ) void ; glb crearThread : ( ; prm funcion : * ( ; prm <something> : * void ; ) * void ; prm SP0 : unsigned short ; prm arg : * void ; prm pindx : int ; ) int ; glb crearProceso : ( ; prm segmento : unsigned short ; prm tam : unsigned short ; prm tamFich : unsigned ; prm programa : * char ; prm comando : * char ; prm pindx : int ; ) int ; glb inicProcesos : (void) void ; glb resetPids : (void) void ; glb resetTids : (void) void ; glb terminarThreadIndx : ( ; prm tindx : int ; ) int ; glb eliminarThreadIndx : ( ; prm tindx : int ; ) int ; glb terminarProcIndx : ( ; prm pindx : int ; ) int ; glb eliminarProcIndx : ( ; prm pindx : int ; ) int ; glb matarThreadIndx : ( ; prm tindx : int ; ) int ; glb matarProcIndx : ( ; prm pindx : int ; ) int ; glb link_procs : (void) void ; glb inicRecursos : (void) void ; glb crearRec : ( ; prm dR : * struct <something> ; ) int ; glb crearFich : ( ; prm nombre : * char ; prm rindx : int ; prm menor : unsigned short ; prm tipo : int ; ) int ; glb destruirFich : ( ; prm dfs : int ; ) int ; glb destruirRec : ( ; prm nombre : * char ; ) int ; glb link_recurs : (void) void ; glb inicRecursos : (void) void section .text global _inicRecursos _inicRecursos: push ebp movzx ebp, sp sub sp, 12 ; loc rindx : (@-4): int ; loc dfs : (@-8): int ; loc i : (@-12): int ; loc <something> : * struct <something> ; loc <something> : * struct <something> ; RPN'ized expression: "( TRUE , 20 , e2PFR &u e2DescFichero -> *u &u Libres -> *u &u (something4) , c2cPFR DFLibres + *u &u (something3) inicializarPC2c ) " ; Expanded expression: " 1 20 e2PFR 24360 + 0 + c2cPFR 128 + inicializarPC2c ()16 " ; Fused expression: "( 1 , 20 , e2PFR + ax 24360 + ax 0 , c2cPFR + ax 128 , inicializarPC2c )16 " push dword 1 push dword 20 section .relod dd L5 section .text db 0x66, 0xB8 L5: dd _e2PFR add eax, 24360 push eax section .relod dd L6 section .text db 0x66, 0xB8 L6: dd _c2cPFR add eax, 128 push eax db 0x9A section .relot dd L7 section .text L7: dd _inicializarPC2c sub sp, -16 ; loc <something> : * struct <something> ; loc <something> : * struct <something> ; RPN'ized expression: "( TRUE , 20 1 + , e2PFR &u e2DescFichero -> *u &u Ocupados -> *u &u (something9) , c2cPFR DFOcupados + *u &u (something8) inicializarPC2c ) " ; Expanded expression: " 1 21 e2PFR 24360 + 0 + c2cPFR 144 + inicializarPC2c ()16 " ; Fused expression: "( 1 , 21 , e2PFR + ax 24360 + ax 0 , c2cPFR + ax 144 , inicializarPC2c )16 " push dword 1 push dword 21 section .relod dd L10 section .text db 0x66, 0xB8 L10: dd _e2PFR add eax, 24360 push eax section .relod dd L11 section .text db 0x66, 0xB8 L11: dd _c2cPFR add eax, 144 push eax db 0x9A section .relot dd L12 section .text L12: dd _inicializarPC2c sub sp, -16 ; loc <something> : * struct <something> ; loc <something> : * struct <something> ; RPN'ized expression: "( TRUE , 14 , e2PFR &u e2DescRecurso -> *u &u Libres -> *u &u (something14) , c2cPFR DRLibres + *u &u (something13) inicializarPC2c ) " ; Expanded expression: " 1 14 e2PFR 24624 + 0 + c2cPFR 160 + inicializarPC2c ()16 " ; Fused expression: "( 1 , 14 , e2PFR + ax 24624 + ax 0 , c2cPFR + ax 160 , inicializarPC2c )16 " push dword 1 push dword 14 section .relod dd L15 section .text db 0x66, 0xB8 L15: dd _e2PFR add eax, 24624 push eax section .relod dd L16 section .text db 0x66, 0xB8 L16: dd _c2cPFR add eax, 160 push eax db 0x9A section .relot dd L17 section .text L17: dd _inicializarPC2c sub sp, -16 ; loc <something> : * struct <something> ; loc <something> : * struct <something> ; RPN'ized expression: "( TRUE , 14 1 + , e2PFR &u e2DescRecurso -> *u &u Ocupados -> *u &u (something19) , c2cPFR DROcupados + *u &u (something18) inicializarPC2c ) " ; Expanded expression: " 1 15 e2PFR 24624 + 0 + c2cPFR 176 + inicializarPC2c ()16 " ; Fused expression: "( 1 , 15 , e2PFR + ax 24624 + ax 0 , c2cPFR + ax 176 , inicializarPC2c )16 " push dword 1 push dword 15 section .relod dd L20 section .text db 0x66, 0xB8 L20: dd _e2PFR add eax, 24624 push eax section .relod dd L21 section .text db 0x66, 0xB8 L21: dd _c2cPFR add eax, 176 push eax db 0x9A section .relot dd L22 section .text L22: dd _inicializarPC2c sub sp, -16 ; for ; RPN'ized expression: "rindx 14 1 - = " ; Expanded expression: "(@-4) 13 =(4) " ; Fused expression: "=(204) *(@-4) 13 " mov eax, 13 mov [bp-4], eax L23: ; RPN'ized expression: "rindx 0 >= " ; Expanded expression: "(@-4) *(4) 0 >= " ; Fused expression: ">= *(@-4) 0 IF! " mov eax, [bp-4] cmp eax, 0 jl L26 ; RPN'ized expression: "rindx --p " ; Expanded expression: "(@-4) --p(4) " ; { ; loc <something> : * struct <something> ; RPN'ized expression: "( c2cPFR DRLibres + *u &u (something27) , rindx apilarPC2c ) " ; Expanded expression: " c2cPFR 160 + (@-4) *(4) apilarPC2c ()8 " ; Fused expression: "( c2cPFR + ax 160 , *(4) (@-4) , apilarPC2c )8 " section .relod dd L28 section .text db 0x66, 0xB8 L28: dd _c2cPFR add eax, 160 push eax push dword [bp-4] db 0x9A section .relot dd L29 section .text L29: dd _apilarPC2c sub sp, -8 ; loc <something> : char ; RPN'ized expression: "descRecurso rindx + *u &u nombre -> *u 0 + *u 0 (something30) = " ; Expanded expression: "descRecurso (@-4) *(4) 96 * + 0 + 0 =(-1) " ; Fused expression: "descRecurso push-ax * *(@-4) 96 + *sp ax + ax 0 =(124) *ax 0 " section .relod dd L31 section .text db 0x66, 0xB8 L31: dd _descRecurso push eax mov eax, [bp-4] imul eax, eax, 96 mov ecx, eax pop eax add eax, ecx mov ebx, eax mov eax, 0 mov esi, ebx ror esi, 4 mov ds, si shr esi, 28 mov [si], al movsx eax, al ; RPN'ized expression: "descRecurso rindx + *u &u tipo -> *u rLibre = " ; Expanded expression: "descRecurso (@-4) *(4) 96 * + 12 + 0 =(4) " ; Fused expression: "descRecurso push-ax * *(@-4) 96 + *sp ax + ax 12 =(204) *ax 0 " section .relod dd L32 section .text db 0x66, 0xB8 L32: dd _descRecurso push eax mov eax, [bp-4] imul eax, eax, 96 mov ecx, eax pop eax add eax, ecx add eax, 12 mov ebx, eax mov eax, 0 mov esi, ebx ror esi, 4 mov ds, si shr esi, 28 mov [si], eax ; loc <something> : * struct <something> ; RPN'ized expression: "descRecurso rindx + *u &u ccb -> *u 0 (something33) = " ; Expanded expression: "descRecurso (@-4) *(4) 96 * + 16 + 0 =(4) " ; Fused expression: "descRecurso push-ax * *(@-4) 96 + *sp ax + ax 16 =(204) *ax 0 " section .relod dd L34 section .text db 0x66, 0xB8 L34: dd _descRecurso push eax mov eax, [bp-4] imul eax, eax, 96 mov ecx, eax pop eax add eax, ecx add eax, 16 mov ebx, eax mov eax, 0 mov esi, ebx ror esi, 4 mov ds, si shr esi, 28 mov [si], eax ; loc <something> : int ; RPN'ized expression: "descRecurso rindx + *u &u tindx -> *u 1 -u (something35) = " ; Expanded expression: "descRecurso (@-4) *(4) 96 * + 20 + -1 =(4) " ; Fused expression: "descRecurso push-ax * *(@-4) 96 + *sp ax + ax 20 =(204) *ax -1 " section .relod dd L36 section .text db 0x66, 0xB8 L36: dd _descRecurso push eax mov eax, [bp-4] imul eax, eax, 96 mov ecx, eax pop eax add eax, ecx add eax, 20 mov ebx, eax mov eax, -1 mov esi, ebx ror esi, 4 mov ds, si shr esi, 28 mov [si], eax ; loc <something> : * struct <something> ; loc <something> : * struct <something> ; RPN'ized expression: "( TRUE , 20 rindx + , e2PFR &u e2FichRec -> *u &u (something38) , descRecurso rindx + *u &u c2cFichRec -> *u &u (something37) inicializarPC2c ) " ; Expanded expression: " 1 20 (@-4) *(4) + e2PFR 122112 + descRecurso (@-4) *(4) 96 * + 24 + inicializarPC2c ()16 " ; Fused expression: "( 1 , + 20 *(@-4) , e2PFR + ax 122112 , descRecurso push-ax * *(@-4) 96 + *sp ax + ax 24 , inicializarPC2c )16 " push dword 1 mov eax, 20 add eax, [bp-4] push eax section .relod dd L39 section .text db 0x66, 0xB8 L39: dd _e2PFR add eax, 122112 push eax section .relod dd L40 section .text db 0x66, 0xB8 L40: dd _descRecurso push eax mov eax, [bp-4] imul eax, eax, 96 mov ecx, eax pop eax add eax, ecx add eax, 24 push eax db 0x9A section .relot dd L41 section .text L41: dd _inicializarPC2c sub sp, -16 ; RPN'ized expression: "descRecurso rindx + *u &u numVI -> *u 0 = " ; Expanded expression: "descRecurso (@-4) *(4) 96 * + 40 + 0 =(1) " ; Fused expression: "descRecurso push-ax * *(@-4) 96 + *sp ax + ax 40 =(156) *ax 0 " section .relod dd L42 section .text db 0x66, 0xB8 L42: dd _descRecurso push eax mov eax, [bp-4] imul eax, eax, 96 mov ecx, eax pop eax add eax, ecx add eax, 40 mov ebx, eax mov eax, 0 mov esi, ebx ror esi, 4 mov ds, si shr esi, 28 mov [si], al movzx eax, al ; for ; RPN'ized expression: "i 0 = " ; Expanded expression: "(@-12) 0 =(4) " ; Fused expression: "=(204) *(@-12) 0 " mov eax, 0 mov [bp-12], eax L43: ; RPN'ized expression: "i 2 < " ; Expanded expression: "(@-12) *(4) 2 < " ; Fused expression: "< *(@-12) 2 IF! " mov eax, [bp-12] cmp eax, 2 jge L46 ; RPN'ized expression: "i ++p " ; Expanded expression: "(@-12) ++p(4) " ; { ; RPN'ized expression: "descRecurso rindx + *u &u nVInt -> *u i + *u 0 = " ; Expanded expression: "descRecurso (@-4) *(4) 96 * + 41 + (@-12) *(4) + 0 =(1) " ; Fused expression: "descRecurso push-ax * *(@-4) 96 + *sp ax + ax 41 + ax *(@-12) =(156) *ax 0 " section .relod dd L47 section .text db 0x66, 0xB8 L47: dd _descRecurso push eax mov eax, [bp-4] imul eax, eax, 96 mov ecx, eax pop eax add eax, ecx add eax, 41 add eax, [bp-12] mov ebx, eax mov eax, 0 mov esi, ebx ror esi, 4 mov ds, si shr esi, 28 mov [si], al movzx eax, al ; RPN'ized expression: "descRecurso rindx + *u &u irq -> *u i + *u 0 = " ; Expanded expression: "descRecurso (@-4) *(4) 96 * + 43 + (@-12) *(4) + 0 =(1) " ; Fused expression: "descRecurso push-ax * *(@-4) 96 + *sp ax + ax 43 + ax *(@-12) =(156) *ax 0 " section .relod dd L48 section .text db 0x66, 0xB8 L48: dd _descRecurso push eax mov eax, [bp-4] imul eax, eax, 96 mov ecx, eax pop eax add eax, ecx add eax, 43 add eax, [bp-12] mov ebx, eax mov eax, 0 mov esi, ebx ror esi, 4 mov ds, si shr esi, 28 mov [si], al movzx eax, al ; loc <something> : * (void) void ; RPN'ized expression: "descRecurso rindx + *u &u isr -> *u i + *u 0 (something49) = " ; Expanded expression: "descRecurso (@-4) *(4) 96 * + 48 + (@-12) *(4) 4 * + 0 =(4) " ; Fused expression: "descRecurso push-ax * *(@-4) 96 + *sp ax + ax 48 push-ax * *(@-12) 4 + *sp ax =(204) *ax 0 " section .relod dd L50 section .text db 0x66, 0xB8 L50: dd _descRecurso push eax mov eax, [bp-4] imul eax, eax, 96 mov ecx, eax pop eax add eax, ecx add eax, 48 push eax mov eax, [bp-12] imul eax, eax, 4 mov ecx, eax pop eax add eax, ecx mov ebx, eax mov eax, 0 mov esi, ebx ror esi, 4 mov ds, si shr esi, 28 mov [si], eax ; } L44: ; Fused expression: "++p(4) *(@-12) " mov eax, [bp-12] inc dword [bp-12] jmp L43 L46: ; loc <something> : * ( ; prm dfs : int ; prm modo : unsigned short ; ) int ; RPN'ized expression: "descRecurso rindx + *u &u open -> *u 0 (something51) = " ; Expanded expression: "descRecurso (@-4) *(4) 96 * + 56 + 0 =(4) " ; Fused expression: "descRecurso push-ax * *(@-4) 96 + *sp ax + ax 56 =(204) *ax 0 " section .relod dd L52 section .text db 0x66, 0xB8 L52: dd _descRecurso push eax mov eax, [bp-4] imul eax, eax, 96 mov ecx, eax pop eax add eax, ecx add eax, 56 mov ebx, eax mov eax, 0 mov esi, ebx ror esi, 4 mov ds, si shr esi, 28 mov [si], eax ; loc <something> : * ( ; prm dfs : int ; ) int ; RPN'ized expression: "descRecurso rindx + *u &u release -> *u 0 (something53) = " ; Expanded expression: "descRecurso (@-4) *(4) 96 * + 60 + 0 =(4) " ; Fused expression: "descRecurso push-ax * *(@-4) 96 + *sp ax + ax 60 =(204) *ax 0 " section .relod dd L54 section .text db 0x66, 0xB8 L54: dd _descRecurso push eax mov eax, [bp-4] imul eax, eax, 96 mov ecx, eax pop eax add eax, ecx add eax, 60 mov ebx, eax mov eax, 0 mov esi, ebx ror esi, 4 mov ds, si shr esi, 28 mov [si], eax ; loc <something> : * ( ; prm dfs : int ; prm dir : * unsigned char ; prm nbytes : unsigned short ; ) int ; RPN'ized expression: "descRecurso rindx + *u &u read -> *u 0 (something55) = " ; Expanded expression: "descRecurso (@-4) *(4) 96 * + 64 + 0 =(4) " ; Fused expression: "descRecurso push-ax * *(@-4) 96 + *sp ax + ax 64 =(204) *ax 0 " section .relod dd L56 section .text db 0x66, 0xB8 L56: dd _descRecurso push eax mov eax, [bp-4] imul eax, eax, 96 mov ecx, eax pop eax add eax, ecx add eax, 64 mov ebx, eax mov eax, 0 mov esi, ebx ror esi, 4 mov ds, si shr esi, 28 mov [si], eax ; loc <something> : * ( ; prm dfs : int ; prm dir : * unsigned char ; prm nbytes : unsigned short ; ) int ; RPN'ized expression: "descRecurso rindx + *u &u aio_read -> *u 0 (something57) = " ; Expanded expression: "descRecurso (@-4) *(4) 96 * + 68 + 0 =(4) " ; Fused expression: "descRecurso push-ax * *(@-4) 96 + *sp ax + ax 68 =(204) *ax 0 " section .relod dd L58 section .text db 0x66, 0xB8 L58: dd _descRecurso push eax mov eax, [bp-4] imul eax, eax, 96 mov ecx, eax pop eax add eax, ecx add eax, 68 mov ebx, eax mov eax, 0 mov esi, ebx ror esi, 4 mov ds, si shr esi, 28 mov [si], eax ; loc <something> : * ( ; prm dfs : int ; prm dir : * unsigned char ; prm nbytes : unsigned short ; ) int ; RPN'ized expression: "descRecurso rindx + *u &u write -> *u 0 (something59) = " ; Expanded expression: "descRecurso (@-4) *(4) 96 * + 72 + 0 =(4) " ; Fused expression: "descRecurso push-ax * *(@-4) 96 + *sp ax + ax 72 =(204) *ax 0 " section .relod dd L60 section .text db 0x66, 0xB8 L60: dd _descRecurso push eax mov eax, [bp-4] imul eax, eax, 96 mov ecx, eax pop eax add eax, ecx add eax, 72 mov ebx, eax mov eax, 0 mov esi, ebx ror esi, 4 mov ds, si shr esi, 28 mov [si], eax ; loc <something> : * ( ; prm dfs : int ; prm dir : * unsigned char ; prm nbytes : unsigned short ; ) int ; RPN'ized expression: "descRecurso rindx + *u &u aio_write -> *u 0 (something61) = " ; Expanded expression: "descRecurso (@-4) *(4) 96 * + 76 + 0 =(4) " ; Fused expression: "descRecurso push-ax * *(@-4) 96 + *sp ax + ax 76 =(204) *ax 0 " section .relod dd L62 section .text db 0x66, 0xB8 L62: dd _descRecurso push eax mov eax, [bp-4] imul eax, eax, 96 mov ecx, eax pop eax add eax, ecx add eax, 76 mov ebx, eax mov eax, 0 mov esi, ebx ror esi, 4 mov ds, si shr esi, 28 mov [si], eax ; loc <something> : * ( ; prm dfs : int ; prm pos : int ; prm whence : unsigned short ; ) int ; RPN'ized expression: "descRecurso rindx + *u &u lseek -> *u 0 (something63) = " ; Expanded expression: "descRecurso (@-4) *(4) 96 * + 80 + 0 =(4) " ; Fused expression: "descRecurso push-ax * *(@-4) 96 + *sp ax + ax 80 =(204) *ax 0 " section .relod dd L64 section .text db 0x66, 0xB8 L64: dd _descRecurso push eax mov eax, [bp-4] imul eax, eax, 96 mov ecx, eax pop eax add eax, ecx add eax, 80 mov ebx, eax mov eax, 0 mov esi, ebx ror esi, 4 mov ds, si shr esi, 28 mov [si], eax ; loc <something> : * ( ; prm dfs : int ; prm cmd : unsigned short ; prm arg : unsigned short ; ) int ; RPN'ized expression: "descRecurso rindx + *u &u fcntl -> *u 0 (something65) = " ; Expanded expression: "descRecurso (@-4) *(4) 96 * + 84 + 0 =(4) " ; Fused expression: "descRecurso push-ax * *(@-4) 96 + *sp ax + ax 84 =(204) *ax 0 " section .relod dd L66 section .text db 0x66, 0xB8 L66: dd _descRecurso push eax mov eax, [bp-4] imul eax, eax, 96 mov ecx, eax pop eax add eax, ecx add eax, 84 mov ebx, eax mov eax, 0 mov esi, ebx ror esi, 4 mov ds, si shr esi, 28 mov [si], eax ; loc <something> : * ( ; prm dfs : int ; prm request : unsigned short ; prm arg : unsigned short ; ) int ; RPN'ized expression: "descRecurso rindx + *u &u ioctl -> *u 0 (something67) = " ; Expanded expression: "descRecurso (@-4) *(4) 96 * + 88 + 0 =(4) " ; Fused expression: "descRecurso push-ax * *(@-4) 96 + *sp ax + ax 88 =(204) *ax 0 " section .relod dd L68 section .text db 0x66, 0xB8 L68: dd _descRecurso push eax mov eax, [bp-4] imul eax, eax, 96 mov ecx, eax pop eax add eax, ecx add eax, 88 mov ebx, eax mov eax, 0 mov esi, ebx ror esi, 4 mov ds, si shr esi, 28 mov [si], eax ; loc <something> : * ( ; prm pindx : int ; ) int ; RPN'ized expression: "descRecurso rindx + *u &u eliminar -> *u 0 (something69) = " ; Expanded expression: "descRecurso (@-4) *(4) 96 * + 92 + 0 =(4) " ; Fused expression: "descRecurso push-ax * *(@-4) 96 + *sp ax + ax 92 =(204) *ax 0 " section .relod dd L70 section .text db 0x66, 0xB8 L70: dd _descRecurso push eax mov eax, [bp-4] imul eax, eax, 96 mov ecx, eax pop eax add eax, ecx add eax, 92 mov ebx, eax mov eax, 0 mov esi, ebx ror esi, 4 mov ds, si shr esi, 28 mov [si], eax ; } L24: ; Fused expression: "--p(4) *(@-4) " mov eax, [bp-4] dec dword [bp-4] jmp L23 L26: ; for ; RPN'ized expression: "dfs 0 = " ; Expanded expression: "(@-8) 0 =(4) " ; Fused expression: "=(204) *(@-8) 0 " mov eax, 0 mov [bp-8], eax L71: ; RPN'ized expression: "dfs 20 < " ; Expanded expression: "(@-8) *(4) 20 < " ; Fused expression: "< *(@-8) 20 IF! " mov eax, [bp-8] cmp eax, 20 jge L74 ; RPN'ized expression: "dfs ++p " ; Expanded expression: "(@-8) ++p(4) " ; { ; loc <something> : char ; RPN'ized expression: "descFichero dfs + *u &u nombre -> *u 0 + *u 0 (something75) = " ; Expanded expression: "descFichero (@-8) *(4) 36 * + 4 + 0 =(-1) " ; Fused expression: "descFichero push-ax * *(@-8) 36 + *sp ax + ax 4 =(124) *ax 0 " section .relod dd L76 section .text db 0x66, 0xB8 L76: dd _descFichero push eax mov eax, [bp-8] imul eax, eax, 36 mov ecx, eax pop eax add eax, ecx add eax, 4 mov ebx, eax mov eax, 0 mov esi, ebx ror esi, 4 mov ds, si shr esi, 28 mov [si], al movsx eax, al ; RPN'ized expression: "descFichero dfs + *u &u tipo -> *u flibre = " ; Expanded expression: "descFichero (@-8) *(4) 36 * + 0 + 0 =(4) " ; Fused expression: "descFichero push-ax * *(@-8) 36 + *sp ax + ax 0 =(204) *ax 0 " section .relod dd L77 section .text db 0x66, 0xB8 L77: dd _descFichero push eax mov eax, [bp-8] imul eax, eax, 36 mov ecx, eax pop eax add eax, ecx mov ebx, eax mov eax, 0 mov esi, ebx ror esi, 4 mov ds, si shr esi, 28 mov [si], eax ; RPN'ized expression: "descFichero dfs + *u &u rindx -> *u 1 -u = " ; Expanded expression: "descFichero (@-8) *(4) 36 * + 16 + -1 =(4) " ; Fused expression: "descFichero push-ax * *(@-8) 36 + *sp ax + ax 16 =(204) *ax -1 " section .relod dd L78 section .text db 0x66, 0xB8 L78: dd _descFichero push eax mov eax, [bp-8] imul eax, eax, 36 mov ecx, eax pop eax add eax, ecx add eax, 16 mov ebx, eax mov eax, -1 mov esi, ebx ror esi, 4 mov ds, si shr esi, 28 mov [si], eax ; RPN'ized expression: "descFichero dfs + *u &u menor -> *u 0 = " ; Expanded expression: "descFichero (@-8) *(4) 36 * + 20 + 0 =(4) " ; Fused expression: "descFichero push-ax * *(@-8) 36 + *sp ax + ax 20 =(204) *ax 0 " section .relod dd L79 section .text db 0x66, 0xB8 L79: dd _descFichero push eax mov eax, [bp-8] imul eax, eax, 36 mov ecx, eax pop eax add eax, ecx add eax, 20 mov ebx, eax mov eax, 0 mov esi, ebx ror esi, 4 mov ds, si shr esi, 28 mov [si], eax ; RPN'ized expression: "descFichero dfs + *u &u contAp_L -> *u 0 = " ; Expanded expression: "descFichero (@-8) *(4) 36 * + 28 + 0 =(4) " ; Fused expression: "descFichero push-ax * *(@-8) 36 + *sp ax + ax 28 =(204) *ax 0 " section .relod dd L80 section .text db 0x66, 0xB8 L80: dd _descFichero push eax mov eax, [bp-8] imul eax, eax, 36 mov ecx, eax pop eax add eax, ecx add eax, 28 mov ebx, eax mov eax, 0 mov esi, ebx ror esi, 4 mov ds, si shr esi, 28 mov [si], eax ; RPN'ized expression: "descFichero dfs + *u &u contAp_E -> *u 0 = " ; Expanded expression: "descFichero (@-8) *(4) 36 * + 32 + 0 =(4) " ; Fused expression: "descFichero push-ax * *(@-8) 36 + *sp ax + ax 32 =(204) *ax 0 " section .relod dd L81 section .text db 0x66, 0xB8 L81: dd _descFichero push eax mov eax, [bp-8] imul eax, eax, 36 mov ecx, eax pop eax add eax, ecx add eax, 32 mov ebx, eax mov eax, 0 mov esi, ebx ror esi, 4 mov ds, si shr esi, 28 mov [si], eax ; RPN'ized expression: "descFichero dfs + *u &u shareMode -> *u 16 = " ; Expanded expression: "descFichero (@-8) *(4) 36 * + 24 + 16 =(2) " ; Fused expression: "descFichero push-ax * *(@-8) 36 + *sp ax + ax 24 =(172) *ax 16 " section .relod dd L82 section .text db 0x66, 0xB8 L82: dd _descFichero push eax mov eax, [bp-8] imul eax, eax, 36 mov ecx, eax pop eax add eax, ecx add eax, 24 mov ebx, eax mov eax, 16 mov esi, ebx ror esi, 4 mov ds, si shr esi, 28 mov [si], ax movzx eax, ax ; } L72: ; Fused expression: "++p(4) *(@-8) " mov eax, [bp-8] inc dword [bp-8] jmp L71 L74: ; for ; RPN'ized expression: "dfs 20 1 - = " ; Expanded expression: "(@-8) 19 =(4) " ; Fused expression: "=(204) *(@-8) 19 " mov eax, 19 mov [bp-8], eax L83: ; RPN'ized expression: "dfs 0 >= " ; Expanded expression: "(@-8) *(4) 0 >= " ; Fused expression: ">= *(@-8) 0 IF! " mov eax, [bp-8] cmp eax, 0 jl L86 ; RPN'ized expression: "dfs --p " ; Expanded expression: "(@-8) --p(4) " ; loc <something> : * struct <something> ; RPN'ized expression: "( c2cPFR DFLibres + *u &u (something87) , dfs apilarPC2c ) " ; Expanded expression: " c2cPFR 128 + (@-8) *(4) apilarPC2c ()8 " ; Fused expression: "( c2cPFR + ax 128 , *(4) (@-8) , apilarPC2c )8 " section .relod dd L88 section .text db 0x66, 0xB8 L88: dd _c2cPFR add eax, 128 push eax push dword [bp-8] db 0x9A section .relot dd L89 section .text L89: dd _apilarPC2c sub sp, -8 L84: ; Fused expression: "--p(4) *(@-8) " mov eax, [bp-8] dec dword [bp-8] jmp L83 L86: L1: db 0x66 leave retf L90: section .fxnsz noalloc dd L90 - _inicRecursos extern _e2PFR extern _c2cPFR extern _inicializarPC2c extern _apilarPC2c extern _descRecurso extern _descFichero ; Syntax/declaration table/stack: ; Bytes used: 9920/40960 ; Macro table: ; Macro __SMALLER_C__ = `0x0100` ; Macro __SMALLER_C_32__ = `` ; Macro __HUGE__ = `` ; Macro __SMALLER_C_SCHAR__ = `` ; Bytes used: 74/5120 ; Identifier table: ; Ident __floatsisf ; Ident __floatunsisf ; Ident __fixsfsi ; Ident __fixunssfsi ; Ident __addsf3 ; Ident __subsf3 ; Ident __negsf2 ; Ident __mulsf3 ; Ident __divsf3 ; Ident __lesf2 ; Ident __gesf2 ; Ident intptr_t ; Ident uintptr_t ; Ident intmax_t ; Ident uintmax_t ; Ident int8_t ; Ident int_least8_t ; Ident int_fast8_t ; Ident uint8_t ; Ident uint_least8_t ; Ident uint_fast8_t ; Ident int16_t ; Ident int_least16_t ; Ident int_fast16_t ; Ident uint16_t ; Ident uint_least16_t ; Ident uint_fast16_t ; Ident int32_t ; Ident int_least32_t ; Ident int_fast32_t ; Ident uint32_t ; Ident uint_least32_t ; Ident uint_fast32_t ; Ident <something> ; Ident quot ; Ident rem ; Ident imaxdiv_t ; Ident FALSE ; Ident TRUE ; Ident bool_t ; Ident pointer_t ; Ident funcion_t ; Ident manejador_t ; Ident rti_t ; Ident isr_t ; Ident handler_t ; Ident retardarThread_t ; Ident ptrTVI_t ; Ident modoSO1_Bin ; Ident modoSO1_Exe ; Ident modoSO1_Bs ; Ident modoSO1_t ; Ident lo ; Ident hi ; Ident lh_t ; Ident offset ; Ident segment ; Ident address_t ; Ident ptr ; Ident adr ; Ident uPtrAdr_t ; Ident pid_t ; Ident tid_t ; Ident uid_t ; Ident gid_t ; Ident pindx_t ; Ident tindx_t ; Ident df_t ; Ident dfs_t ; Ident rindx_t ; Ident modoAp_t ; Ident DS ; Ident ES ; Ident EDI ; Ident ESI ; Ident EBP ; Ident ESP ; Ident EBX ; Ident EDX ; Ident ECX ; Ident EAX ; Ident IP ; Ident CS ; Ident Flags ; Ident tramaDWords_t ; Ident DI ; Ident rDI ; Ident SI ; Ident rSI ; Ident BP ; Ident rBP ; Ident SP ; Ident rSP ; Ident BX ; Ident rBX ; Ident DX ; Ident rDX ; Ident CX ; Ident rCX ; Ident AX ; Ident rAX ; Ident tramaWords_t ; Ident BL ; Ident BH ; Ident rB ; Ident DL ; Ident DH ; Ident rD ; Ident CL ; Ident CH ; Ident rC ; Ident AL ; Ident AH ; Ident rA ; Ident tramaBytes_t ; Ident td ; Ident tw ; Ident tb ; Ident trama_t ; Ident tam ; Ident sig ; Ident ant ; Ident aux ; Ident relleno ; Ident bloque_t ; Ident ptrBloque_t ; Ident cab ; Ident dobleEnlace_t ; Ident numElem ; Ident primero ; Ident cabecera ; Ident e ; Ident c2c_t ; Ident posicionC2c ; Ident i ; Ident c2c ; Ident eliminarC2c ; Ident apilarC2c ; Ident encolarC2c ; Ident desencolarC2c ; Ident inicializarC2c ; Ident compartida ; Ident ptrC2c_t ; Ident posicionPC2c ; Ident eliminarPC2c ; Ident ptrC2c ; Ident apilarPC2c ; Ident encolarPC2c ; Ident desencolarPC2c ; Ident inicializarPC2c ; Ident callBack_t ; Ident arg ; Ident num ; Ident in ; Ident out ; Ident max ; Ident callBack ; Ident descCcb_t ; Ident ccb_t ; Ident inicCcb ; Ident ccb ; Ident encolarCcb ; Ident cb ; Ident desencolarCcb ; Ident eliminarCcb ; Ident eliminarSegCcb ; Ident segmento ; Ident vaciarCcb ; Ident atenderCcb ; Ident libre ; Ident preparado ; Ident ejecutandose ; Ident bloqueado ; Ident estado_t ; Ident modoAp ; Ident dfs ; Ident pos ; Ident dfa_t ; Ident pid ; Ident noStatus ; Ident status ; Ident ppindx ; Ident hpindx ; Ident c2cHijos ; Ident c2cThreads ; Ident CSProc ; Ident tamCodigo ; Ident desplBSS ; Ident desplPila ; Ident tamFichero ; Ident programa ; Ident comando ; Ident nfa ; Ident tfa ; Ident uid ; Ident gid ; Ident descProceso_t ; Ident tid ; Ident estado ; Ident esperandoPor ; Ident trama ; Ident ptindx ; Ident htindx ; Ident pindx ; Ident SSThread ; Ident SP0 ; Ident descThread_t ; Ident flibre ; Ident fRegular ; Ident fedBloques ; Ident fedCaracteres ; Ident tuberia ; Ident tipoFichero_t ; Ident tipo ; Ident nombre ; Ident rindx ; Ident menor ; Ident shareMode ; Ident contAp_L ; Ident contAp_E ; Ident descFichero_t ; Ident rLibre ; Ident rDCaracteres ; Ident rDBloques ; Ident rTuberia ; Ident rGP ; Ident rGM ; Ident rSF ; Ident rOtro ; Ident tipoRecurso_t ; Ident open_t ; Ident modo ; Ident release_t ; Ident read_t ; Ident dir ; Ident nbytes ; Ident aio_read_t ; Ident write_t ; Ident aio_write_t ; Ident lseek_t ; Ident whence ; Ident fcntl_t ; Ident cmd ; Ident ioctl_t ; Ident request ; Ident eliminar_t ; Ident tindx ; Ident c2cFichRec ; Ident numVI ; Ident nVInt ; Ident irq ; Ident isr ; Ident open ; Ident release ; Ident read ; Ident aio_read ; Ident write ; Ident aio_write ; Ident lseek ; Ident fcntl ; Ident ioctl ; Ident eliminar ; Ident descRecurso_t ; Ident SP0_So1 ; Ident IMR ; Ident modoSO1 ; Ident ptrDebugWord ; Ident info_t ; Ident signatura ; Ident bytesUltSector ; Ident sectores ; Ident numDirReub ; Ident numParCabecera ; Ident minAlloc ; Ident maxAlloc ; Ident SS0 ; Ident checkSum ; Ident IP0 ; Ident CS0 ; Ident offTablaReub ; Ident numOverlay ; Ident cabecera_t ; Ident Libres ; Ident Ocupados ; Ident e2DescProceso ; Ident e2DescThread ; Ident e2DescFichero ; Ident e2DescRecurso ; Ident e2Hijos ; Ident e2Threads ; Ident e2Preparados ; Ident e2Urgentes ; Ident e2POrdenados ; Ident e2TDormidos ; Ident e2FichRec ; Ident e2PFR_t ; Ident DPLibres ; Ident DPOcupados ; Ident DTLibres ; Ident DTOcupados ; Ident TPreparados ; Ident TUrgentes ; Ident POrdenados ; Ident TDormidos ; Ident DFLibres ; Ident DFOcupados ; Ident DRLibres ; Ident DROcupados ; Ident numColasPFR ; Ident cPFR_t ; Ident sigThread_t ; Ident activarThread_t ; Ident buscarNuevoThreadActual_t ; Ident bloquearThreadActual_t ; Ident ptrIndProcesoActual ; Ident ptrIndThreadActual ; Ident ptrTramaThread ; Ident ptrActivarAlEpilogo ; Ident ptrDescProceso ; Ident tamDescProceso ; Ident ptrDescThread ; Ident tamDescThread ; Ident ptrDescFichero ; Ident ptrDescRecurso ; Ident ptrC2cPFR ; Ident ptrE2PFR ; Ident ptrNivelActivacionSO1H ; Ident ptrEnHalt ; Ident ptrHayTic ; Ident ptrCcbAlEpilogo ; Ident ptrSS_Thread ; Ident ptrSP_Thread ; Ident ptrSS_Kernel ; Ident ptrSP0_Kernel ; Ident SP0_SO1H ; Ident ptrContRodajas ; Ident ptrContTicsRodaja ; Ident ptrVIOrg ; Ident sigThread ; Ident activarThread ; Ident buscarNuevoThreadActual ; Ident bloquearThreadActual ; Ident ptrListaLibres ; Ident ptrTamBloqueMax ; Ident descSO1H_t ; Ident descProcesoExt_t ; Ident descThreadExt_t ; Ident descProceso ; Ident descThread ; Ident descFichero ; Ident descRecurso ; Ident c2cPFR ; Ident e2PFR ; Ident descCcbAlEpilogo ; Ident ccbAlEpilogo ; Ident tramaThread ; Ident tramaTarea ; Ident indThreadActual ; Ident indProcesoActual ; Ident indThreadDeSuperficie ; Ident contRodajas ; Ident contTicsRodaja ; Ident contadorTimer00 ; Ident contOcioso ; Ident nuevoPid ; Ident nuevoTid ; Ident indice ; Ident registrarEnPOrdenados ; Ident crearThread ; Ident funcion ; Ident crearProceso ; Ident tamFich ; Ident inicProcesos ; Ident resetPids ; Ident resetTids ; Ident terminarThreadIndx ; Ident eliminarThreadIndx ; Ident terminarProcIndx ; Ident eliminarProcIndx ; Ident matarThreadIndx ; Ident matarProcIndx ; Ident link_procs ; Ident inicRecursos ; Ident crearRec ; Ident dR ; Ident crearFich ; Ident destruirFich ; Ident destruirRec ; Ident link_recurs ; Bytes used: 3984/16384 ; Next label number: 91 ; Compilation succeeded.
; A231103: Number of n X 3 0..3 arrays x(i,j) with each element horizontally or antidiagonally next to at least one element with value (x(i,j)+1) mod 4, no adjacent elements equal, and upper left element zero. ; 0,2,8,42,208,1042,5208,26042,130208,651042,3255208,16276042,81380208,406901042,2034505208,10172526042,50862630208,254313151042,1271565755208,6357828776042,31789143880208,158945719401042,794728597005208,3973642985026042,19868214925130208,99341074625651042,496705373128255208,2483526865641276042,12417634328206380208,62088171641031901042,310440858205159505208,1552204291025797526042,7761021455128987630208,38805107275644938151042,194025536378224690755208,970127681891123453776042 mov $1,5 pow $1,$0 add $1,1 div $1,3 mov $0,$1
/*********************************************************************** created: 8/8/2004 author: Steve Streeting purpose: Implementation of TabButton widget base class *************************************************************************/ /*************************************************************************** * Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. ***************************************************************************/ #include "CEGUI/widgets/TabButton.h" #include "CEGUI/GUIContext.h" // Start of CEGUI namespace section namespace CEGUI { const String TabButton::EventNamespace("TabButton"); const String TabButton::WidgetTypeName("CEGUI/TabButton"); /************************************************************************* Event name constants *************************************************************************/ const String TabButton::EventClicked( "Clicked" ); const String TabButton::EventDragged( "Dragged" ); const String TabButton::EventScrolled( "Scrolled" ); /************************************************************************* Constructor *************************************************************************/ TabButton::TabButton(const String& type, const String& name) : ButtonBase(type, name), d_selected(false), d_dragging(false), d_targetWindow(nullptr) { } /************************************************************************* Destructor *************************************************************************/ TabButton::~TabButton() { } /************************************************************************* Set target window *************************************************************************/ void TabButton::setTargetWindow(Window* wnd) { d_targetWindow = wnd; // Copy initial text setText(wnd->getText()); // Parent control will keep text up to date, since changes affect layout } /************************************************************************* handler invoked internally when the button is clicked. *************************************************************************/ void TabButton::onClicked(WindowEventArgs& e) { fireEvent(EventClicked, e, EventNamespace); } /************************************************************************* Handler for cursor press events *************************************************************************/ void TabButton::onCursorPressHold(CursorInputEventArgs& e) { if (e.source == CursorInputSource::Middle) { captureInput (); ++e.handled; d_dragging = true; fireEvent(EventDragged, e, EventNamespace); } // default handling ButtonBase::onCursorPressHold(e); } void TabButton::onCursorActivate(CursorInputEventArgs& e) { if ((e.source == CursorInputSource::Left) && isPushed()) { Window* sheet = getGUIContext().getRootWindow(); if (sheet) { // if cursor was released over this widget // (use cursor position, as e.position has been unprojected) if (this == sheet->getTargetChildAtPosition( getGUIContext().getCursor().getPosition())) { // fire event WindowEventArgs args(this); onClicked(args); } } ++e.handled; } else if (e.source == CursorInputSource::Middle) { d_dragging = false; releaseInput (); ++e.handled; } // default handling ButtonBase::onCursorActivate(e); } void TabButton::onCursorMove(CursorInputEventArgs& e) { if (d_dragging) { fireEvent(EventDragged, e, EventNamespace); ++e.handled; } // default handling ButtonBase::onCursorMove(e); } void TabButton::onScroll(CursorInputEventArgs& e) { fireEvent(EventScrolled, e, EventNamespace); // default handling ButtonBase::onCursorMove(e); } } // End of CEGUI namespace section
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r13 push %r14 push %r15 push %rbx push %rcx push %rdi push %rsi lea addresses_WT_ht+0x19796, %rbx nop xor %r13, %r13 movb (%rbx), %r10b xor %r15, %r15 lea addresses_UC_ht+0x17936, %rsi lea addresses_WT_ht+0x3d26, %rdi clflush (%rsi) add %r15, %r15 mov $122, %rcx rep movsl nop sub %rsi, %rsi lea addresses_WT_ht+0x1ab06, %rsi lea addresses_WT_ht+0x1f76, %rdi nop nop nop nop and $54422, %r14 mov $22, %rcx rep movsq nop dec %rdi lea addresses_D_ht+0x1a9d6, %rsi lea addresses_A_ht+0x15df6, %rdi nop nop nop nop nop cmp $42467, %r15 mov $11, %rcx rep movsq lfence lea addresses_D_ht+0x4bb6, %rcx nop nop nop nop xor %rdi, %rdi vmovups (%rcx), %ymm6 vextracti128 $0, %ymm6, %xmm6 vpextrq $1, %xmm6, %r15 nop nop nop nop nop and $11779, %r14 lea addresses_UC_ht+0x31b6, %rsi lea addresses_normal_ht+0x34b6, %rdi nop nop nop nop inc %r10 mov $80, %rcx rep movsw nop nop nop nop nop xor $7783, %r10 lea addresses_UC_ht+0x1a0a6, %r13 xor %r15, %r15 vmovups (%r13), %ymm7 vextracti128 $0, %ymm7, %xmm7 vpextrq $1, %xmm7, %r10 nop xor %rdi, %rdi lea addresses_UC_ht+0x794, %r15 nop nop nop sub $2498, %rcx movb (%r15), %bl nop nop and %rcx, %rcx pop %rsi pop %rdi pop %rcx pop %rbx pop %r15 pop %r14 pop %r13 pop %r10 ret .global s_faulty_load s_faulty_load: push %r13 push %r14 push %r15 push %r8 push %rdi push %rdx push %rsi // Store lea addresses_WT+0x195c6, %r15 nop nop nop xor $35101, %rdi movb $0x51, (%r15) nop nop nop nop nop xor %rsi, %rsi // Faulty Load lea addresses_normal+0xc3b6, %r13 nop nop nop dec %r8 vmovups (%r13), %ymm4 vextracti128 $1, %ymm4, %xmm4 vpextrq $0, %xmm4, %r14 lea oracles, %rdx and $0xff, %r14 shlq $12, %r14 mov (%rdx,%r14,1), %r14 pop %rsi pop %rdx pop %rdi pop %r8 pop %r15 pop %r14 pop %r13 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_normal', 'AVXalign': False, 'congruent': 0, 'size': 8, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WT', 'AVXalign': False, 'congruent': 4, 'size': 1, 'same': False, 'NT': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_normal', 'AVXalign': False, 'congruent': 0, 'size': 32, 'same': True, 'NT': False}} <gen_prepare_buffer> {'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'AVXalign': False, 'congruent': 4, 'size': 1, 'same': False, 'NT': True}} {'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 7, 'same': True}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 4, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 2, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 6, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 3, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 5, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 10, 'size': 32, 'same': True, 'NT': False}} {'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 9, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 7, 'same': True}} {'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 3, 'size': 32, 'same': False, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 1, 'size': 1, 'same': False, 'NT': False}} {'34': 21829} 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 */
; A276333: The most significant digit in greedy A001563-base (A276326): a(n) = floor(n/A258199(n)), a(0) = 0. ; 0,1,2,3,1,1,1,1,2,2,2,2,3,3,3,3,4,4,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,1,1,1,1 mov $1,$0 lpb $1 mov $1,$0 add $3,1 div $1,$3 mov $0,$1 sub $1,$3 lpe mov $2,$3 cmp $2,0 add $3,$2 div $0,$3
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE121_Stack_Based_Buffer_Overflow__CWE805_char_alloca_ncat_82a.cpp Label Definition File: CWE121_Stack_Based_Buffer_Overflow__CWE805.string.label.xml Template File: sources-sink-82a.tmpl.cpp */ /* * @description * CWE: 121 Stack Based Buffer Overflow * BadSource: Set data pointer to the bad buffer * GoodSource: Set data pointer to the good buffer * Sinks: ncat * BadSink : Copy string to data using strncat * Flow Variant: 82 Data flow: data passed in a parameter to an virtual method called via a pointer * * */ #include "std_testcase.h" #include "CWE121_Stack_Based_Buffer_Overflow__CWE805_char_alloca_ncat_82.h" namespace CWE121_Stack_Based_Buffer_Overflow__CWE805_char_alloca_ncat_82 { #ifndef OMITBAD void bad() { char * data; char * dataBadBuffer = (char *)ALLOCA(50*sizeof(char)); char * dataGoodBuffer = (char *)ALLOCA(100*sizeof(char)); /* FLAW: Set a pointer to a "small" buffer. This buffer will be used in the sinks as a destination * buffer in various memory copying functions using a "large" source buffer. */ data = dataBadBuffer; data[0] = '\0'; /* null terminate */ CWE121_Stack_Based_Buffer_Overflow__CWE805_char_alloca_ncat_82_base* baseObject = new CWE121_Stack_Based_Buffer_Overflow__CWE805_char_alloca_ncat_82_bad; baseObject->action(data); delete baseObject; } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodG2B uses the GoodSource with the BadSink */ static void goodG2B() { char * data; char * dataBadBuffer = (char *)ALLOCA(50*sizeof(char)); char * dataGoodBuffer = (char *)ALLOCA(100*sizeof(char)); /* FIX: Set a pointer to a "large" buffer, thus avoiding buffer overflows in the sinks. */ data = dataGoodBuffer; data[0] = '\0'; /* null terminate */ CWE121_Stack_Based_Buffer_Overflow__CWE805_char_alloca_ncat_82_base* baseObject = new CWE121_Stack_Based_Buffer_Overflow__CWE805_char_alloca_ncat_82_goodG2B; baseObject->action(data); delete baseObject; } void good() { goodG2B(); } #endif /* OMITGOOD */ } /* close namespace */ /* Below is the main(). It is only used when building this testcase on * its own for testing or for building a binary to use in testing binary * analysis tools. It is not used when compiling all the testcases as one * application, which is how source code analysis tools are tested. */ #ifdef INCLUDEMAIN using namespace CWE121_Stack_Based_Buffer_Overflow__CWE805_char_alloca_ncat_82; /* so that we can use good and bad easily */ int main(int argc, char * argv[]) { /* seed randomness */ srand( (unsigned)time(NULL) ); #ifndef OMITGOOD printLine("Calling good()..."); good(); printLine("Finished good()"); #endif /* OMITGOOD */ #ifndef OMITBAD printLine("Calling bad()..."); bad(); printLine("Finished bad()"); #endif /* OMITBAD */ return 0; } #endif
; A112062: Positive integers i for which A112049(i) == 2. ; 3,4,7,8,15,16,19,20,27,28,31,32,39,40,43,44,51,52,55,56,63,64,67,68,75,76,79,80,87,88,91,92,99,100,103,104,111,112,115,116,123,124,127,128,135,136,139,140,147,148,151,152,159,160,163,164,171,172,175,176 mov $1,$0 add $0,1 mov $4,1 lpb $0,1 trn $0,2 add $1,6 trn $2,$1 add $2,$1 add $4,2 mov $1,$4 mul $1,2 add $1,$3 add $2,2 add $3,$4 trn $4,$2 add $4,$2 trn $4,$1 mov $1,$3 lpe add $4,1 add $1,$4 sub $1,3
;--------------------------------------- ; string to int converter ;--------------------------------------- ; in: hl,string addr ; out:hl = value str2int ld bc,#0000 ld de,#0000 ex de,hl ld (intBuffer),hl ex de,hl calcLen ld a,(hl) cp #20 ; end as space jr z,calcVal cp #00 ; end as zero jr z,calcVal cp "0" jr c,wrongValue cp "9"+1 jr nc,wrongValue inc b inc hl jr calcLen calcVal ld a,b cp #00 jr z,wrongValue ld (calcEnd+1),a ld b,#00 calcLoop dec hl ld a,(hl) sub #30 ; ascii 0 push hl push bc push af ld a,b or c jr nz,calcSkip pop af ld h,0 ld l,a ld (intBuffer),hl pop af ld bc,10 jr calcNext calcSkip pop af push bc pop hl call mult16x8 ex de,hl ld hl,(intBuffer) add hl,de ld (intBuffer),hl pop hl ; bc ld a,10 call mult16x8 push hl pop bc calcNext pop hl calcEnd ld a,#00 dec a ld (calcEnd+1),a cp #00 jr nz,calcLoop ld hl,(intBuffer) xor a ; ok ret wrongValue ld hl,#0000 ld a,#ff ; error! ret ;------------------------------------------- ; multiplication ;------------------------------------------- ; in: hl * a ; out:hl,low de,high mult16x8 ld de,#0000 ld (mult16x8_2 + 1),de cp #00 jr nz,mult16x8_00 ld hl,#0000 ret mult16x8_00 cp #01 ret z push bc dec a ld b,a ld c,0 push hl pop de mult16x8_0 add hl,de jr nc,mult16x8_1 push de ld de,(mult16x8_2 + 1) inc de ld (mult16x8_2 + 1),de pop de mult16x8_1 djnz mult16x8_0 mult16x8_2 ld de,#0000 pop bc ret ;------------------------------------------- intBuffer dw #0000
// Copyright 2020 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "chrome/browser/chromeos/policy/dlp/dlp_content_manager.h" #include "ash/public/cpp/ash_features.h" #include "base/callback_helpers.h" #include "base/json/json_writer.h" #include "base/strings/utf_string_conversions.h" #include "base/test/metrics/histogram_tester.h" #include "base/test/scoped_feature_list.h" #include "base/values.h" #include "chrome/browser/chromeos/policy/core/user_policy_test_helper.h" #include "chrome/browser/chromeos/policy/dlp/dlp_content_manager_test_helper.h" #include "chrome/browser/chromeos/policy/dlp/dlp_histogram_helper.h" #include "chrome/browser/chromeos/policy/dlp/dlp_policy_constants.h" #include "chrome/browser/chromeos/policy/dlp/dlp_policy_event.pb.h" #include "chrome/browser/chromeos/policy/dlp/dlp_reporting_manager.h" #include "chrome/browser/chromeos/policy/dlp/dlp_reporting_manager_test_helper.h" #include "chrome/browser/chromeos/policy/dlp/dlp_rules_manager.h" #include "chrome/browser/chromeos/policy/dlp/dlp_rules_manager_factory.h" #include "chrome/browser/chromeos/policy/dlp/dlp_rules_manager_test_utils.h" #include "chrome/browser/chromeos/policy/dlp/mock_dlp_rules_manager.h" #include "chrome/browser/chromeos/policy/login/login_policy_test_base.h" #include "chrome/browser/notifications/notification_display_service_tester.h" #include "chrome/browser/policy/messaging_layer/public/report_queue_impl.h" #include "chrome/browser/policy/policy_test_utils.h" #include "chrome/browser/printing/print_view_manager_common.h" #include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/ui/ash/chrome_capture_mode_delegate.h" #include "chrome/browser/ui/ash/screenshot_area.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_commands.h" #include "chrome/browser/ui/browser_window.h" #include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/ui_test_utils.h" #include "components/policy/core/common/policy_map.h" #include "components/policy/policy_constants.h" #include "components/reporting/storage/test_storage_module.h" #include "content/public/browser/desktop_media_id.h" #include "content/public/test/browser_test.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/aura/window.h" #include "ui/gfx/geometry/rect.h" using testing::_; namespace policy { namespace { const DlpContentRestrictionSet kEmptyRestrictionSet; const DlpContentRestrictionSet kScreenshotRestricted( DlpContentRestriction::kScreenshot, DlpRulesManager::Level::kBlock); const DlpContentRestrictionSet kScreenshotReported( DlpContentRestriction::kScreenshot, DlpRulesManager::Level::kReport); const DlpContentRestrictionSet kPrivacyScreenEnforced( DlpContentRestriction::kPrivacyScreen, DlpRulesManager::Level::kBlock); const DlpContentRestrictionSet kPrintAllowed(DlpContentRestriction::kPrint, DlpRulesManager::Level::kAllow); const DlpContentRestrictionSet kPrintRestricted(DlpContentRestriction::kPrint, DlpRulesManager::Level::kBlock); const DlpContentRestrictionSet kPrintReported(DlpContentRestriction::kPrint, DlpRulesManager::Level::kReport); const DlpContentRestrictionSet kVideoCaptureRestricted( DlpContentRestriction::kVideoCapture, DlpRulesManager::Level::kBlock); const DlpContentRestrictionSet kVideoCaptureReported( DlpContentRestriction::kVideoCapture, DlpRulesManager::Level::kReport); const DlpContentRestrictionSet kScreenShareRestricted( DlpContentRestriction::kScreenShare, DlpRulesManager::Level::kBlock); constexpr char kScreenCapturePausedNotificationId[] = "screen_capture_dlp_paused-label"; constexpr char kScreenCaptureResumedNotificationId[] = "screen_capture_dlp_resumed-label"; constexpr char kPrintBlockedNotificationId[] = "print_dlp_blocked"; constexpr char kExampleUrl[] = "https://example.com"; constexpr char kUrl1[] = "https://example1.com"; constexpr char kUrl2[] = "https://example2.com"; constexpr char kUrl3[] = "https://example3.com"; constexpr char kUrl4[] = "https://example4.com"; constexpr char kSrcPattern[] = "example.com"; } // namespace class DlpContentManagerBrowserTest : public InProcessBrowserTest { public: DlpContentManagerBrowserTest() = default; ~DlpContentManagerBrowserTest() override = default; // InProcessBrowserTest: void SetUp() override { scoped_feature_list_.InitAndEnableFeature(ash::features::kCaptureMode); InProcessBrowserTest::SetUp(); } std::unique_ptr<KeyedService> SetDlpRulesManager( content::BrowserContext* context) { auto dlp_rules_manager = std::make_unique<MockDlpRulesManager>(); mock_rules_manager_ = dlp_rules_manager.get(); return dlp_rules_manager; } // Sets up mock rules manager. void SetupDlpRulesManager() { DlpRulesManagerFactory::GetInstance()->SetTestingFactory( browser()->profile(), base::BindRepeating(&DlpContentManagerBrowserTest::SetDlpRulesManager, base::Unretained(this))); ASSERT_TRUE(DlpRulesManagerFactory::GetForPrimaryProfile()); EXPECT_CALL(*mock_rules_manager_, GetSourceUrlPattern(_, _, _)) .WillRepeatedly(testing::Return(kSrcPattern)); EXPECT_CALL(*mock_rules_manager_, IsRestricted(_, _)) .WillRepeatedly(testing::Return(DlpRulesManager::Level::kAllow)); } void SetupReporting() { SetupDlpRulesManager(); // Set up mock report queue. SetReportQueueForReportingManager(helper_.GetReportingManager(), events_); } void CheckEvents(DlpRulesManager::Restriction restriction, DlpRulesManager::Level level, size_t count) { EXPECT_EQ(events_.size(), count); for (int i = 0; i < count; ++i) { EXPECT_THAT(events_[i], IsDlpPolicyEvent(CreateDlpPolicyEvent( kSrcPattern, restriction, level))); } } protected: DlpContentManagerTestHelper helper_; base::HistogramTester histogram_tester_; MockDlpRulesManager* mock_rules_manager_; private: base::test::ScopedFeatureList scoped_feature_list_; std::vector<DlpPolicyEvent> events_; }; IN_PROC_BROWSER_TEST_F(DlpContentManagerBrowserTest, ScreenshotsRestricted) { SetupReporting(); DlpContentManager* manager = helper_.GetContentManager(); ui_test_utils::NavigateToURL(browser(), GURL("https://example.com")); content::WebContents* web_contents = browser()->tab_strip_model()->GetActiveWebContents(); aura::Window* root_window = browser()->window()->GetNativeWindow()->GetRootWindow(); ScreenshotArea fullscreen = ScreenshotArea::CreateForAllRootWindows(); ScreenshotArea window = ScreenshotArea::CreateForWindow(web_contents->GetNativeView()); const gfx::Rect web_contents_rect = web_contents->GetContainerBounds(); gfx::Rect out_rect(web_contents_rect); out_rect.Offset(web_contents_rect.width(), web_contents_rect.height()); gfx::Rect in_rect(web_contents_rect); in_rect.Offset(web_contents_rect.width() / 2, web_contents_rect.height() / 2); ScreenshotArea partial_out = ScreenshotArea::CreateForPartialWindow(root_window, out_rect); ScreenshotArea partial_in = ScreenshotArea::CreateForPartialWindow(root_window, in_rect); EXPECT_FALSE(manager->IsScreenshotRestricted(fullscreen)); EXPECT_FALSE(manager->IsScreenshotRestricted(window)); EXPECT_FALSE(manager->IsScreenshotRestricted(partial_in)); EXPECT_FALSE(manager->IsScreenshotRestricted(partial_out)); histogram_tester_.ExpectBucketCount( GetDlpHistogramPrefix() + dlp::kScreenshotBlockedUMA, true, 0); histogram_tester_.ExpectBucketCount( GetDlpHistogramPrefix() + dlp::kScreenshotBlockedUMA, false, 4); CheckEvents(DlpRulesManager::Restriction::kScreenshot, DlpRulesManager::Level::kBlock, 0u); helper_.ChangeConfidentiality(web_contents, kScreenshotRestricted); EXPECT_TRUE(manager->IsScreenshotRestricted(fullscreen)); EXPECT_TRUE(manager->IsScreenshotRestricted(window)); EXPECT_TRUE(manager->IsScreenshotRestricted(partial_in)); EXPECT_FALSE(manager->IsScreenshotRestricted(partial_out)); histogram_tester_.ExpectBucketCount( GetDlpHistogramPrefix() + dlp::kScreenshotBlockedUMA, true, 3); histogram_tester_.ExpectBucketCount( GetDlpHistogramPrefix() + dlp::kScreenshotBlockedUMA, false, 5); CheckEvents(DlpRulesManager::Restriction::kScreenshot, DlpRulesManager::Level::kBlock, 3u); web_contents->WasHidden(); helper_.ChangeVisibility(web_contents); EXPECT_FALSE(manager->IsScreenshotRestricted(fullscreen)); EXPECT_TRUE(manager->IsScreenshotRestricted(window)); EXPECT_FALSE(manager->IsScreenshotRestricted(partial_in)); EXPECT_FALSE(manager->IsScreenshotRestricted(partial_out)); histogram_tester_.ExpectBucketCount( GetDlpHistogramPrefix() + dlp::kScreenshotBlockedUMA, true, 4); histogram_tester_.ExpectBucketCount( GetDlpHistogramPrefix() + dlp::kScreenshotBlockedUMA, false, 8); CheckEvents(DlpRulesManager::Restriction::kScreenshot, DlpRulesManager::Level::kBlock, 4u); web_contents->WasShown(); helper_.ChangeVisibility(web_contents); EXPECT_TRUE(manager->IsScreenshotRestricted(fullscreen)); EXPECT_TRUE(manager->IsScreenshotRestricted(window)); EXPECT_TRUE(manager->IsScreenshotRestricted(partial_in)); EXPECT_FALSE(manager->IsScreenshotRestricted(partial_out)); histogram_tester_.ExpectBucketCount( GetDlpHistogramPrefix() + dlp::kScreenshotBlockedUMA, true, 7); histogram_tester_.ExpectBucketCount( GetDlpHistogramPrefix() + dlp::kScreenshotBlockedUMA, false, 9); CheckEvents(DlpRulesManager::Restriction::kScreenshot, DlpRulesManager::Level::kBlock, 7u); helper_.DestroyWebContents(web_contents); EXPECT_FALSE(manager->IsScreenshotRestricted(fullscreen)); EXPECT_FALSE(manager->IsScreenshotRestricted(partial_in)); EXPECT_FALSE(manager->IsScreenshotRestricted(partial_out)); histogram_tester_.ExpectBucketCount( GetDlpHistogramPrefix() + dlp::kScreenshotBlockedUMA, true, 7); histogram_tester_.ExpectBucketCount( GetDlpHistogramPrefix() + dlp::kScreenshotBlockedUMA, false, 12); CheckEvents(DlpRulesManager::Restriction::kScreenshot, DlpRulesManager::Level::kBlock, 7u); } IN_PROC_BROWSER_TEST_F(DlpContentManagerBrowserTest, ScreenshotsReported) { SetupReporting(); DlpContentManager* manager = helper_.GetContentManager(); ui_test_utils::NavigateToURL(browser(), GURL("https://example.com")); content::WebContents* web_contents = browser()->tab_strip_model()->GetActiveWebContents(); aura::Window* root_window = browser()->window()->GetNativeWindow()->GetRootWindow(); ScreenshotArea fullscreen = ScreenshotArea::CreateForAllRootWindows(); ScreenshotArea window = ScreenshotArea::CreateForWindow(web_contents->GetNativeView()); const gfx::Rect web_contents_rect = web_contents->GetContainerBounds(); gfx::Rect out_rect(web_contents_rect); out_rect.Offset(web_contents_rect.width(), web_contents_rect.height()); gfx::Rect in_rect(web_contents_rect); in_rect.Offset(web_contents_rect.width() / 2, web_contents_rect.height() / 2); ScreenshotArea partial_out = ScreenshotArea::CreateForPartialWindow(root_window, out_rect); ScreenshotArea partial_in = ScreenshotArea::CreateForPartialWindow(root_window, in_rect); EXPECT_FALSE(manager->IsScreenshotRestricted(fullscreen)); EXPECT_FALSE(manager->IsScreenshotRestricted(window)); EXPECT_FALSE(manager->IsScreenshotRestricted(partial_in)); EXPECT_FALSE(manager->IsScreenshotRestricted(partial_out)); CheckEvents(DlpRulesManager::Restriction::kScreenshot, DlpRulesManager::Level::kReport, 0u); helper_.ChangeConfidentiality(web_contents, kScreenshotReported); EXPECT_FALSE(manager->IsScreenshotRestricted(fullscreen)); EXPECT_FALSE(manager->IsScreenshotRestricted(window)); EXPECT_FALSE(manager->IsScreenshotRestricted(partial_in)); EXPECT_FALSE(manager->IsScreenshotRestricted(partial_out)); CheckEvents(DlpRulesManager::Restriction::kScreenshot, DlpRulesManager::Level::kReport, 3u); web_contents->WasHidden(); helper_.ChangeVisibility(web_contents); EXPECT_FALSE(manager->IsScreenshotRestricted(fullscreen)); EXPECT_FALSE(manager->IsScreenshotRestricted(window)); EXPECT_FALSE(manager->IsScreenshotRestricted(partial_in)); EXPECT_FALSE(manager->IsScreenshotRestricted(partial_out)); CheckEvents(DlpRulesManager::Restriction::kScreenshot, DlpRulesManager::Level::kReport, 4u); web_contents->WasShown(); helper_.ChangeVisibility(web_contents); EXPECT_FALSE(manager->IsScreenshotRestricted(fullscreen)); EXPECT_FALSE(manager->IsScreenshotRestricted(window)); EXPECT_FALSE(manager->IsScreenshotRestricted(partial_in)); EXPECT_FALSE(manager->IsScreenshotRestricted(partial_out)); CheckEvents(DlpRulesManager::Restriction::kScreenshot, DlpRulesManager::Level::kReport, 7u); helper_.DestroyWebContents(web_contents); EXPECT_FALSE(manager->IsScreenshotRestricted(fullscreen)); EXPECT_FALSE(manager->IsScreenshotRestricted(partial_in)); EXPECT_FALSE(manager->IsScreenshotRestricted(partial_out)); histogram_tester_.ExpectBucketCount( GetDlpHistogramPrefix() + dlp::kScreenshotBlockedUMA, true, 0); histogram_tester_.ExpectBucketCount( GetDlpHistogramPrefix() + dlp::kScreenshotBlockedUMA, false, 19); CheckEvents(DlpRulesManager::Restriction::kScreenshot, DlpRulesManager::Level::kReport, 7u); } IN_PROC_BROWSER_TEST_F(DlpContentManagerBrowserTest, VideoCaptureStoppedWhenConfidentialWindowResized) { SetupReporting(); aura::Window* root_window = browser()->window()->GetNativeWindow()->GetRootWindow(); // Open first browser window. Browser* browser1 = browser(); chrome::NewTab(browser1); ui_test_utils::NavigateToURL(browser1, GURL("https://example.com")); content::WebContents* web_contents1 = browser1->tab_strip_model()->GetActiveWebContents(); // Open second browser window. Browser* browser2 = Browser::Create(Browser::CreateParams(browser()->profile(), true)); chrome::NewTab(browser2); ui_test_utils::NavigateToURL(browser2, GURL("https://google.com")); // Resize browsers so that second window covers the first one. // Browser window can't have width less than 500. browser1->window()->SetBounds(gfx::Rect(100, 100, 500, 500)); browser2->window()->SetBounds(gfx::Rect(0, 0, 700, 700)); // Make first window content as confidential. helper_.ChangeConfidentiality(web_contents1, kVideoCaptureRestricted); // Start capture of the whole screen. base::RunLoop run_loop; auto* capture_mode_delegate = ChromeCaptureModeDelegate::Get(); capture_mode_delegate->StartObservingRestrictedContent( root_window, root_window->bounds(), run_loop.QuitClosure()); CheckEvents(DlpRulesManager::Restriction::kScreenshot, DlpRulesManager::Level::kBlock, 0u); // Move first window with confidential content to make it visible. browser1->window()->SetBounds(gfx::Rect(100, 100, 700, 700)); // Check that capture was requested to be stopped via callback. run_loop.Run(); capture_mode_delegate->StopObservingRestrictedContent(); browser2->window()->Close(); histogram_tester_.ExpectUniqueSample( GetDlpHistogramPrefix() + dlp::kVideoCaptureInterruptedUMA, true, 1); CheckEvents(DlpRulesManager::Restriction::kScreenshot, DlpRulesManager::Level::kBlock, 1u); } IN_PROC_BROWSER_TEST_F(DlpContentManagerBrowserTest, VideoCaptureReported) { SetupReporting(); aura::Window* root_window = browser()->window()->GetNativeWindow()->GetRootWindow(); // Open first browser window. Browser* browser1 = browser(); chrome::NewTab(browser1); ui_test_utils::NavigateToURL(browser1, GURL("https://example.com")); content::WebContents* web_contents1 = browser1->tab_strip_model()->GetActiveWebContents(); // Open second browser window. Browser* browser2 = Browser::Create(Browser::CreateParams(browser()->profile(), true)); chrome::NewTab(browser2); ui_test_utils::NavigateToURL(browser2, GURL("https://google.com")); // Resize browsers so that second window covers the first one. // Browser window can't have width less than 500. browser1->window()->SetBounds(gfx::Rect(100, 100, 500, 500)); browser2->window()->SetBounds(gfx::Rect(0, 0, 700, 700)); // Make first window content as confidential. helper_.ChangeConfidentiality(web_contents1, kVideoCaptureReported); // Start capture of the whole screen. base::RunLoop run_loop; auto* capture_mode_delegate = ChromeCaptureModeDelegate::Get(); capture_mode_delegate->StartObservingRestrictedContent( root_window, root_window->bounds(), base::BindOnce([] { FAIL() << "Video capture stop callback shouldn't be called"; })); // Move first window with confidential content to make it visible. browser1->window()->SetBounds(gfx::Rect(100, 100, 700, 700)); // Check that capture was not requested to be stopped via callback. run_loop.RunUntilIdle(); capture_mode_delegate->StopObservingRestrictedContent(); browser2->window()->Close(); histogram_tester_.ExpectBucketCount( GetDlpHistogramPrefix() + dlp::kVideoCaptureInterruptedUMA, true, 0); CheckEvents(DlpRulesManager::Restriction::kScreenshot, DlpRulesManager::Level::kReport, 1u); } IN_PROC_BROWSER_TEST_F(DlpContentManagerBrowserTest, VideoCaptureStoppedWhenNonConfidentialWindowResized) { SetupReporting(); aura::Window* root_window = browser()->window()->GetNativeWindow()->GetRootWindow(); // Open first browser window. Browser* browser1 = browser(); chrome::NewTab(browser1); ui_test_utils::NavigateToURL(browser1, GURL("https://example.com")); content::WebContents* web_contents1 = browser1->tab_strip_model()->GetActiveWebContents(); // Open second browser window. Browser* browser2 = Browser::Create(Browser::CreateParams(browser()->profile(), true)); chrome::NewTab(browser2); ui_test_utils::NavigateToURL(browser2, GURL("https://google.com")); // Resize browsers so that second window covers the first one. // Browser window can't have width less than 500. browser1->window()->SetBounds(gfx::Rect(100, 100, 500, 500)); browser2->window()->SetBounds(gfx::Rect(0, 0, 700, 700)); // Make first window content as confidential. helper_.ChangeConfidentiality(web_contents1, kVideoCaptureRestricted); // Start capture of the whole screen. base::RunLoop run_loop; auto* capture_mode_delegate = ChromeCaptureModeDelegate::Get(); capture_mode_delegate->StartObservingRestrictedContent( root_window, root_window->bounds(), run_loop.QuitClosure()); CheckEvents(DlpRulesManager::Restriction::kScreenshot, DlpRulesManager::Level::kBlock, 0u); // Move second window to make first window with confidential content visible. browser2->window()->SetBounds(gfx::Rect(150, 150, 700, 700)); // Check that capture was requested to be stopped via callback. run_loop.Run(); capture_mode_delegate->StopObservingRestrictedContent(); browser2->window()->Close(); histogram_tester_.ExpectUniqueSample( GetDlpHistogramPrefix() + dlp::kVideoCaptureInterruptedUMA, true, 1); CheckEvents(DlpRulesManager::Restriction::kScreenshot, DlpRulesManager::Level::kBlock, 1u); } IN_PROC_BROWSER_TEST_F(DlpContentManagerBrowserTest, VideoCaptureNotStoppedWhenConfidentialWindowHidden) { SetupReporting(); aura::Window* root_window = browser()->window()->GetNativeWindow()->GetRootWindow(); // Open first browser window. Browser* browser1 = browser(); chrome::NewTab(browser1); ui_test_utils::NavigateToURL(browser1, GURL("https://example.com")); content::WebContents* web_contents1 = browser1->tab_strip_model()->GetActiveWebContents(); // Open second browser window. Browser* browser2 = Browser::Create(Browser::CreateParams(browser()->profile(), true)); chrome::NewTab(browser2); ui_test_utils::NavigateToURL(browser2, GURL("https://google.com")); // Resize browsers so that second window covers the first one. // Browser window can't have width less than 500. browser1->window()->SetBounds(gfx::Rect(100, 100, 500, 500)); browser2->window()->SetBounds(gfx::Rect(0, 0, 700, 700)); // Make first window content as confidential. helper_.ChangeConfidentiality(web_contents1, kVideoCaptureRestricted); // Start capture of the whole screen. base::RunLoop run_loop; auto* capture_mode_delegate = ChromeCaptureModeDelegate::Get(); capture_mode_delegate->StartObservingRestrictedContent( root_window, root_window->bounds(), base::BindOnce([] { FAIL() << "Video capture stop callback shouldn't be called"; })); // Move first window, but keep confidential content hidden. browser1->window()->SetBounds(gfx::Rect(150, 150, 500, 500)); // Check that capture was not requested to be stopped via callback. run_loop.RunUntilIdle(); capture_mode_delegate->StopObservingRestrictedContent(); browser2->window()->Close(); histogram_tester_.ExpectTotalCount( GetDlpHistogramPrefix() + dlp::kVideoCaptureInterruptedUMA, 0); CheckEvents(DlpRulesManager::Restriction::kScreenshot, DlpRulesManager::Level::kBlock, 0u); } IN_PROC_BROWSER_TEST_F(DlpContentManagerBrowserTest, ScreenCaptureNotification) { SetupReporting(); NotificationDisplayServiceTester display_service_tester(browser()->profile()); DlpContentManager* manager = helper_.GetContentManager(); ui_test_utils::NavigateToURL(browser(), GURL("https://example.com")); content::WebContents* web_contents = browser()->tab_strip_model()->GetActiveWebContents(); aura::Window* root_window = browser()->window()->GetNativeWindow()->GetRootWindow(); const auto media_id = content::DesktopMediaID::RegisterNativeWindow( content::DesktopMediaID::TYPE_SCREEN, root_window); manager->OnScreenCaptureStarted("label", {media_id}, u"example.com", base::DoNothing()); EXPECT_FALSE(display_service_tester.GetNotification( kScreenCapturePausedNotificationId)); EXPECT_FALSE(display_service_tester.GetNotification( kScreenCaptureResumedNotificationId)); histogram_tester_.ExpectBucketCount( GetDlpHistogramPrefix() + dlp::kScreenSharePausedOrResumedUMA, true, 0); histogram_tester_.ExpectBucketCount( GetDlpHistogramPrefix() + dlp::kScreenSharePausedOrResumedUMA, false, 0); helper_.ChangeConfidentiality(web_contents, kScreenShareRestricted); CheckEvents(DlpRulesManager::Restriction::kScreenShare, DlpRulesManager::Level::kBlock, 1u); EXPECT_TRUE(display_service_tester.GetNotification( kScreenCapturePausedNotificationId)); EXPECT_FALSE(display_service_tester.GetNotification( kScreenCaptureResumedNotificationId)); histogram_tester_.ExpectBucketCount( GetDlpHistogramPrefix() + dlp::kScreenSharePausedOrResumedUMA, true, 1); histogram_tester_.ExpectBucketCount( GetDlpHistogramPrefix() + dlp::kScreenSharePausedOrResumedUMA, false, 0); helper_.ChangeConfidentiality(web_contents, kEmptyRestrictionSet); EXPECT_FALSE(display_service_tester.GetNotification( kScreenCapturePausedNotificationId)); EXPECT_TRUE(display_service_tester.GetNotification( kScreenCaptureResumedNotificationId)); histogram_tester_.ExpectBucketCount( GetDlpHistogramPrefix() + dlp::kScreenSharePausedOrResumedUMA, true, 1); histogram_tester_.ExpectBucketCount( GetDlpHistogramPrefix() + dlp::kScreenSharePausedOrResumedUMA, false, 1); manager->OnScreenCaptureStopped("label", media_id); EXPECT_FALSE(display_service_tester.GetNotification( kScreenCapturePausedNotificationId)); EXPECT_FALSE(display_service_tester.GetNotification( kScreenCaptureResumedNotificationId)); histogram_tester_.ExpectBucketCount( GetDlpHistogramPrefix() + dlp::kScreenSharePausedOrResumedUMA, true, 1); histogram_tester_.ExpectBucketCount( GetDlpHistogramPrefix() + dlp::kScreenSharePausedOrResumedUMA, false, 1); CheckEvents(DlpRulesManager::Restriction::kScreenShare, DlpRulesManager::Level::kBlock, 1u); } IN_PROC_BROWSER_TEST_F(DlpContentManagerBrowserTest, PrintingNotRestricted) { // Set up mock report queue and mock rules manager. SetupReporting(); ui_test_utils::NavigateToURL(browser(), GURL(kExampleUrl)); content::WebContents* web_contents = browser()->tab_strip_model()->GetActiveWebContents(); NotificationDisplayServiceTester display_service_tester(browser()->profile()); EXPECT_FALSE(helper_.GetContentManager()->IsPrintingRestricted(web_contents)); // Start printing and check that there is no notification when printing is not // restricted. printing::StartPrint(web_contents, /*print_renderer=*/mojo::NullAssociatedRemote(), /*print_preview_disabled=*/false, /*print_only_selection=*/false); EXPECT_FALSE( display_service_tester.GetNotification(kPrintBlockedNotificationId)); CheckEvents(DlpRulesManager::Restriction::kPrinting, DlpRulesManager::Level::kBlock, 0u); } class DlpContentManagerReportingBrowserTest : public DlpContentManagerBrowserTest { public: // Sets up real report queue together with TestStorageModule void SetupReportQueue() { const std::string dm_token_ = "FAKE_DM_TOKEN"; const reporting::Destination destination_ = reporting::Destination::UPLOAD_EVENTS; storage_module_ = base::MakeRefCounted<reporting::test::TestStorageModule>(); policy_check_callback_ = base::BindRepeating(&testing::MockFunction<reporting::Status()>::Call, base::Unretained(&mocked_policy_check_)); ON_CALL(mocked_policy_check_, Call()) .WillByDefault(testing::Return(reporting::Status::StatusOK())); reporting::StatusOr<std::unique_ptr<reporting::ReportQueueConfiguration>> config_result = reporting::ReportQueueConfiguration::Create( dm_token_, destination_, policy_check_callback_); ASSERT_TRUE(config_result.ok()); reporting::StatusOr<std::unique_ptr<reporting::ReportQueue>> report_queue_result = reporting::ReportQueueImpl::Create( std::move(config_result.ValueOrDie()), storage_module_); ASSERT_TRUE(report_queue_result.ok()); helper_.GetReportingManager()->GetReportQueueSetter().Run( std::move(report_queue_result.ValueOrDie())); } reporting::test::TestStorageModule* test_storage_module() const { reporting::test::TestStorageModule* test_storage_module = google::protobuf::down_cast<reporting::test::TestStorageModule*>( storage_module_.get()); DCHECK(test_storage_module); return test_storage_module; } void CheckRecord(DlpRulesManager::Restriction restriction, DlpRulesManager::Level level, reporting::Record record) { DlpPolicyEvent event; EXPECT_TRUE(event.ParseFromString(record.data())); EXPECT_EQ(event.source().url(), kSrcPattern); EXPECT_THAT(event, IsDlpPolicyEvent(CreateDlpPolicyEvent( kSrcPattern, restriction, level))); } // Sets an action to execute when an event arrives to the report queue storage // module. void SetAddRecordCheck(DlpRulesManager::Restriction restriction, DlpRulesManager::Level level, int times) { // TODO(jkopanski): Change to [=, this] when chrome code base is updated to // C++20. EXPECT_CALL(*test_storage_module(), AddRecord) .Times(times) .WillRepeatedly(testing::WithArgs<1, 2>(testing::Invoke( [=](reporting::Record record, base::OnceCallback<void(reporting::Status)> callback) { CheckRecord(restriction, level, std::move(record)); std::move(callback).Run(reporting::Status::StatusOK()); }))); } protected: scoped_refptr<reporting::StorageModuleInterface> storage_module_; testing::NiceMock<testing::MockFunction<reporting::Status()>> mocked_policy_check_; reporting::ReportQueueConfiguration::PolicyCheckCallback policy_check_callback_; }; IN_PROC_BROWSER_TEST_F(DlpContentManagerReportingBrowserTest, PrintingRestricted) { // Set up mock rules manager. SetupDlpRulesManager(); // Set up real report queue. SetupReportQueue(); // Sets an action to execute when an event arrives to a storage module. SetAddRecordCheck(DlpRulesManager::Restriction::kPrinting, DlpRulesManager::Level::kBlock, /*times=*/2); ui_test_utils::NavigateToURL(browser(), GURL(kExampleUrl)); content::WebContents* web_contents = browser()->tab_strip_model()->GetActiveWebContents(); NotificationDisplayServiceTester display_service_tester(browser()->profile()); // No event should be emitted when there is no restriction. EXPECT_FALSE(helper_.GetContentManager()->IsPrintingRestricted(web_contents)); // Set up printing restriction. helper_.ChangeConfidentiality(web_contents, kPrintRestricted); // Check that IsPrintingRestricted emitted an event. EXPECT_TRUE(helper_.GetContentManager()->IsPrintingRestricted(web_contents)); printing::StartPrint(web_contents, /*print_renderer=*/mojo::NullAssociatedRemote(), /*print_preview_disabled=*/false, /*print_only_selection=*/false); // Check for notification about printing restriction. EXPECT_TRUE( display_service_tester.GetNotification(kPrintBlockedNotificationId)); } IN_PROC_BROWSER_TEST_F(DlpContentManagerReportingBrowserTest, PrintingReported) { SetupDlpRulesManager(); SetupReportQueue(); SetAddRecordCheck(DlpRulesManager::Restriction::kPrinting, DlpRulesManager::Level::kReport, /*times=*/2); ui_test_utils::NavigateToURL(browser(), GURL(kExampleUrl)); content::WebContents* web_contents = browser()->tab_strip_model()->GetActiveWebContents(); NotificationDisplayServiceTester display_service_tester(browser()->profile()); // Set up printing restriction. helper_.ChangeConfidentiality(web_contents, kPrintReported); EXPECT_FALSE(helper_.GetContentManager()->IsPrintingRestricted(web_contents)); printing::StartPrint(web_contents, /*print_renderer=*/mojo::NullAssociatedRemote(), /*print_preview_disabled=*/false, /*print_only_selection=*/false); EXPECT_FALSE( display_service_tester.GetNotification(kPrintBlockedNotificationId)); // TODO(crbug/1213872, jkopanski): A hack to make this test working on // linux-chromeos-rel. For some reason, gtest calls RequestPrintPreview after // the test fixture, which triggers a DLP reporting event. This happens only // for linux-chromeos-rel build and in this PrintingReported test, does not // occur in PrintingRestricted test. helper_.ChangeConfidentiality(web_contents, kPrintAllowed); } class DlpContentManagerPolicyBrowserTest : public LoginPolicyTestBase { public: DlpContentManagerPolicyBrowserTest() = default; void SetDlpRulesPolicy(const base::Value& rules) { std::string json; base::JSONWriter::Write(rules, &json); base::DictionaryValue policy; policy.SetKey(key::kDataLeakPreventionRulesList, base::Value(json)); user_policy_helper()->SetPolicyAndWait( policy, /*recommended=*/base::DictionaryValue(), ProfileManager::GetActiveUserProfile()); } protected: DlpContentManagerTestHelper helper_; }; IN_PROC_BROWSER_TEST_F(DlpContentManagerPolicyBrowserTest, GetRestrictionSetForURL) { SkipToLoginScreen(); LogIn(kAccountId, kAccountPassword, kEmptyServices); base::Value rules(base::Value::Type::LIST); base::Value src_urls1(base::Value::Type::LIST); src_urls1.Append(kUrl1); base::Value restrictions1(base::Value::Type::LIST); restrictions1.Append(dlp_test_util::CreateRestrictionWithLevel( dlp::kScreenshotRestriction, dlp::kBlockLevel)); rules.Append(dlp_test_util::CreateRule( "rule #1", "Block", std::move(src_urls1), /*dst_urls=*/base::Value(base::Value::Type::LIST), /*dst_components=*/base::Value(base::Value::Type::LIST), std::move(restrictions1))); base::Value src_urls2(base::Value::Type::LIST); src_urls2.Append(kUrl2); base::Value restrictions2(base::Value::Type::LIST); restrictions2.Append(dlp_test_util::CreateRestrictionWithLevel( dlp::kPrivacyScreenRestriction, dlp::kBlockLevel)); rules.Append(dlp_test_util::CreateRule( "rule #2", "Block", std::move(src_urls2), /*dst_urls=*/base::Value(base::Value::Type::LIST), /*dst_components=*/base::Value(base::Value::Type::LIST), std::move(restrictions2))); base::Value src_urls3(base::Value::Type::LIST); src_urls3.Append(kUrl3); base::Value restrictions3(base::Value::Type::LIST); restrictions3.Append(dlp_test_util::CreateRestrictionWithLevel( dlp::kPrintingRestriction, dlp::kBlockLevel)); rules.Append(dlp_test_util::CreateRule( "rule #3", "Block", std::move(src_urls3), /*dst_urls=*/base::Value(base::Value::Type::LIST), /*dst_components=*/base::Value(base::Value::Type::LIST), std::move(restrictions3))); base::Value src_urls4(base::Value::Type::LIST); src_urls4.Append(kUrl4); base::Value restrictions4(base::Value::Type::LIST); restrictions4.Append(dlp_test_util::CreateRestrictionWithLevel( dlp::kScreenShareRestriction, dlp::kBlockLevel)); rules.Append(dlp_test_util::CreateRule( "rule #4", "Block", std::move(src_urls4), /*dst_urls=*/base::Value(base::Value::Type::LIST), /*dst_components=*/base::Value(base::Value::Type::LIST), std::move(restrictions4))); SetDlpRulesPolicy(rules); DlpContentRestrictionSet screenshot_and_videocapture(kScreenshotRestricted); screenshot_and_videocapture.SetRestriction( DlpContentRestriction::kVideoCapture, DlpRulesManager::Level::kBlock, GURL()); EXPECT_EQ(screenshot_and_videocapture, helper_.GetRestrictionSetForURL(GURL(kUrl1))); EXPECT_EQ(kPrivacyScreenEnforced, helper_.GetRestrictionSetForURL(GURL(kUrl2))); EXPECT_EQ(kPrintRestricted, helper_.GetRestrictionSetForURL(GURL(kUrl3))); EXPECT_EQ(kScreenShareRestricted, helper_.GetRestrictionSetForURL(GURL(kUrl4))); EXPECT_EQ(DlpContentRestrictionSet(), helper_.GetRestrictionSetForURL(GURL(kExampleUrl))); } } // namespace policy
; A021265: Decimal expansion of 1/261. ; 0,0,3,8,3,1,4,1,7,6,2,4,5,2,1,0,7,2,7,9,6,9,3,4,8,6,5,9,0,0,3,8,3,1,4,1,7,6,2,4,5,2,1,0,7,2,7,9,6,9,3,4,8,6,5,9,0,0,3,8,3,1,4,1,7,6,2,4,5,2,1,0,7,2,7,9,6,9,3,4,8,6,5,9,0,0,3,8,3,1,4,1,7,6,2,4,5,2,1 add $0,2 mov $1,10 pow $1,$0 mul $1,2 div $1,5220 mod $1,10 mov $0,$1
; ; Amstrad CPC library ; creates a copy of a string in CPC format ; ; char __LIB__ __FASTCALL__ *cpc_rsx_str(char *str) ; ; $Id: cpc_rsx_str.asm,v 1.2 2015/01/19 01:32:42 pauloscustodio Exp $ ; PUBLIC cpc_rsx_str EXTERN strlen EXTERN malloc .cpc_rsx_str push hl ; str ptr call strlen push hl ; str len inc hl inc hl inc hl call malloc ; malloc (strlen + 3) pop bc ; str len pop de ; str ptr push hl ; cpc_rsx_str push de ; str ptr ld a,c ld (hl),a ; cpc_rsx_str begins with 1 byte for string length inc hl ld d,h ld e,l inc de inc de ; DE now points to cpc_rsx_str+3 ld (hl),e ; string location (cpc_rsx_str+1) inc hl ld (hl),d pop hl ; str ptr ldir ; copy string pop hl ; cpc_rsx_str ret
BITS 64 GLOBAL memmove:function memmove: PUSH RBP MOV RBP, RSP XOR RAX, RAX XOR RCX, RCX XOR R10, R10 CMP RDX, 0 JZ return_0 MOV R10, RDI SUB R10, RSI JGE sub_RDX loop: CMP RCX, RDX JE end MOV R8B, [RSI + RCX] MOV BYTE[RDI + RCX], R8B inc RCX JMP loop sub_RDX: SUB RDX, 1 inv_loop: CMP RDX, -1 JE end MOV R8B, [RSI + RDX] MOV BYTE[RDI + RDX], R8B dec RDX JMP inv_loop end: MOV RAX, RDI XOR RCX, RCX LEAVE RET return_0: XOR RAX, RAX XOR RCX, RCX LEAVE RET
.global s_prepare_buffers s_prepare_buffers: push %r11 push %r12 push %r8 push %rax push %rcx push %rdi push %rdx push %rsi lea addresses_WC_ht+0x11605, %rsi lea addresses_UC_ht+0xdb61, %rdi clflush (%rsi) nop nop nop nop cmp $46430, %r8 mov $83, %rcx rep movsq inc %r12 lea addresses_normal_ht+0x1c167, %r12 and $31421, %rcx movups (%r12), %xmm2 vpextrq $1, %xmm2, %r8 nop nop nop inc %r8 lea addresses_normal_ht+0x16825, %rsi lea addresses_UC_ht+0xaf61, %rdi nop nop nop nop nop cmp $15675, %rdx mov $22, %rcx rep movsl nop nop nop nop xor $57404, %r12 lea addresses_normal_ht+0xaf61, %rcx nop and %r11, %r11 movl $0x61626364, (%rcx) xor $38067, %r11 lea addresses_normal_ht+0xa281, %rsi lea addresses_normal_ht+0x18a61, %rdi nop nop nop nop nop cmp $44214, %r12 mov $127, %rcx rep movsl dec %rcx lea addresses_WC_ht+0x761, %r11 nop nop nop nop nop cmp $1975, %r8 movl $0x61626364, (%r11) nop nop add %r11, %r11 lea addresses_normal_ht+0x1b61, %rcx clflush (%rcx) nop nop inc %r8 mov $0x6162636465666768, %r12 movq %r12, (%rcx) nop nop dec %rsi lea addresses_UC_ht+0xeca9, %rsi lea addresses_D_ht+0x9361, %rdi nop nop nop nop inc %rax mov $32, %rcx rep movsl nop nop dec %r11 lea addresses_normal_ht+0xa0e1, %rsi lea addresses_WC_ht+0xe561, %rdi clflush (%rdi) nop nop nop dec %r8 mov $48, %rcx rep movsb nop and $25658, %rcx lea addresses_WC_ht+0xc6e1, %rdi nop cmp %rax, %rax movups (%rdi), %xmm0 vpextrq $0, %xmm0, %rsi inc %rdi lea addresses_WC_ht+0x1b61, %rdi nop nop nop nop and %rdx, %rdx movl $0x61626364, (%rdi) sub %r11, %r11 lea addresses_UC_ht+0x7d61, %rsi lea addresses_D_ht+0x17491, %rdi nop and %r12, %r12 mov $14, %rcx rep movsl nop nop nop nop nop and $7778, %r11 lea addresses_WT_ht+0xa61, %r8 nop nop nop cmp $23496, %rsi mov (%r8), %edx nop nop nop nop nop sub %rdx, %rdx lea addresses_normal_ht+0x5759, %rdi nop nop nop dec %r8 movl $0x61626364, (%rdi) nop nop nop sub $29666, %rdi lea addresses_A_ht+0x5ef7, %rax nop nop nop nop inc %rdi mov (%rax), %si nop and $61217, %rsi pop %rsi pop %rdx pop %rdi pop %rcx pop %rax pop %r8 pop %r12 pop %r11 ret .global s_faulty_load s_faulty_load: push %r13 push %r8 push %rax push %rbx push %rcx push %rsi // Store lea addresses_US+0x1b61, %rcx nop nop nop nop nop sub $10183, %r8 movb $0x51, (%rcx) nop nop nop nop inc %rax // Store lea addresses_A+0x18f99, %rsi nop nop nop xor %rcx, %rcx mov $0x5152535455565758, %r8 movq %r8, (%rsi) nop add %rsi, %rsi // Faulty Load lea addresses_US+0x1b61, %r13 nop nop and %rcx, %rcx vmovups (%r13), %ymm5 vextracti128 $1, %ymm5, %xmm5 vpextrq $1, %xmm5, %rsi lea oracles, %r13 and $0xff, %rsi shlq $12, %rsi mov (%r13,%rsi,1), %rsi pop %rsi pop %rcx pop %rbx pop %rax pop %r8 pop %r13 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_US', 'size': 32, 'AVXalign': True, 'NT': False, 'congruent': 0, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_US', 'size': 1, 'AVXalign': False, 'NT': True, 'congruent': 0, 'same': True}} {'OP': 'STOR', 'dst': {'type': 'addresses_A', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 2, 'same': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_US', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}} <gen_prepare_buffer> {'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 2, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 10, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 2, 'same': True}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 10, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'size': 4, 'AVXalign': False, 'NT': True, 'congruent': 10, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 8, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 9, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'size': 8, 'AVXalign': False, 'NT': True, 'congruent': 10, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 2, 'same': True}, 'dst': {'type': 'addresses_D_ht', 'congruent': 10, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 6, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 8, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 6, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 11, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 9, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 3, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 8, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'size': 4, 'AVXalign': True, 'NT': False, 'congruent': 3, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 1, 'same': False}} {'00': 10987} 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 */
; A118358: Records in A086793. ; 5,9,11,12,13,15,16,17,18,19,20,21,22 mov $1,7 add $1,$0 mul $1,$0 add $0,1 div $1,$0 add $1,5 mov $0,$1
; ; CPC Maths Routines ; ; August 2003 **_|warp6|_** <kbaccam /at/ free.fr> ; ; $Id: deq.asm,v 1.4 2016-06-22 19:50:48 dom Exp $ ; SECTION code_fp INCLUDE "cpcfirm.def" INCLUDE "cpcfp.def" PUBLIC deq PUBLIC deqc EXTERN fsetup EXTERN stkequcmp EXTERN cmpfin .deq call fsetup call firmware .deqc defw CPCFP_FLO_CMP ; comp (hl)?(de) cp 0 ;(hl) != (de) jp z,cmpfin xor a jp stkequcmp
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r11 push %r12 push %r15 push %rbx push %rcx push %rdi push %rsi lea addresses_UC_ht+0x15ac6, %rsi lea addresses_D_ht+0xb696, %rdi nop nop nop and %r11, %r11 mov $6, %rcx rep movsw and %rdi, %rdi lea addresses_UC_ht+0xf6ee, %rsi lea addresses_UC_ht+0xcfee, %rdi nop nop cmp %r15, %r15 mov $55, %rcx rep movsb nop and %rsi, %rsi lea addresses_WT_ht+0xfbee, %r11 nop nop and $29958, %r10 movw $0x6162, (%r11) nop nop xor $28327, %r15 lea addresses_WC_ht+0x13bee, %rsi lea addresses_WT_ht+0x16ee, %rdi xor %r10, %r10 mov $64, %rcx rep movsw nop nop nop cmp %rdi, %rdi lea addresses_WT_ht+0x9eee, %rsi lea addresses_WT_ht+0xc6ee, %rdi and $39227, %r12 mov $85, %rcx rep movsw nop and $51302, %r10 lea addresses_WC_ht+0x10a0e, %rsi lea addresses_WC_ht+0x44ee, %rdi nop nop nop nop nop xor %rbx, %rbx mov $45, %rcx rep movsq nop nop nop sub $3164, %r11 lea addresses_normal_ht+0x18d0e, %rsi nop nop nop nop xor %rdi, %rdi movl $0x61626364, (%rsi) nop nop nop nop nop add $4881, %rbx lea addresses_WC_ht+0xcdee, %rsi lea addresses_D_ht+0x176ee, %rdi nop cmp $58279, %r12 mov $99, %rcx rep movsq nop nop nop nop nop xor %rdi, %rdi lea addresses_D_ht+0x8881, %rbx nop nop dec %rcx movb $0x61, (%rbx) nop nop and %r11, %r11 lea addresses_A_ht+0x26ce, %rsi clflush (%rsi) nop sub %rcx, %rcx mov (%rsi), %bx nop nop nop nop xor %rdi, %rdi lea addresses_UC_ht+0x8eee, %rsi lea addresses_UC_ht+0x580e, %rdi nop nop nop nop nop sub %r15, %r15 mov $14, %rcx rep movsl nop nop inc %r15 lea addresses_A_ht+0x7dee, %r11 nop cmp $51574, %rdi vmovups (%r11), %ymm1 vextracti128 $0, %ymm1, %xmm1 vpextrq $1, %xmm1, %rcx nop nop nop cmp %rcx, %rcx lea addresses_A_ht+0x1150e, %r12 nop nop nop add $59922, %rdi and $0xffffffffffffffc0, %r12 movaps (%r12), %xmm1 vpextrq $1, %xmm1, %rbx nop sub %rcx, %rcx lea addresses_A_ht+0x154ee, %rsi nop nop nop nop nop cmp %r11, %r11 mov $0x6162636465666768, %rdi movq %rdi, %xmm2 vmovups %ymm2, (%rsi) nop nop nop inc %rsi pop %rsi pop %rdi pop %rcx pop %rbx pop %r15 pop %r12 pop %r11 pop %r10 ret .global s_faulty_load s_faulty_load: push %r10 push %r11 push %r14 push %r8 push %rbx push %rsi // Store lea addresses_WC+0x1ddae, %r11 nop nop xor %rsi, %rsi movw $0x5152, (%r11) nop nop nop nop nop add %rsi, %rsi // Load lea addresses_US+0x1c02e, %rsi nop nop dec %r14 mov (%rsi), %r10 nop nop nop nop and %rsi, %rsi // Store lea addresses_normal+0x1a8ee, %rsi add $48196, %r8 movl $0x51525354, (%rsi) nop nop nop nop nop sub %r11, %r11 // Store lea addresses_D+0x1a632, %rbx nop nop nop and %r14, %r14 mov $0x5152535455565758, %rsi movq %rsi, %xmm7 movups %xmm7, (%rbx) nop nop nop nop add %rbx, %rbx // Faulty Load lea addresses_normal+0x10eee, %r10 nop cmp %rsi, %rsi mov (%r10), %r8d lea oracles, %r11 and $0xff, %r8 shlq $12, %r8 mov (%r11,%r8,1), %r8 pop %rsi pop %rbx pop %r8 pop %r14 pop %r11 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_normal', 'AVXalign': False, 'congruent': 0, 'size': 1, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WC', 'AVXalign': False, 'congruent': 4, 'size': 2, 'same': False, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_US', 'AVXalign': False, 'congruent': 6, 'size': 8, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_normal', 'AVXalign': False, 'congruent': 5, 'size': 4, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_D', 'AVXalign': False, 'congruent': 0, 'size': 16, 'same': False, 'NT': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_normal', 'AVXalign': False, 'congruent': 0, 'size': 4, 'same': True, 'NT': False}} <gen_prepare_buffer> {'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 3, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 2, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 6, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': False, 'congruent': 3, 'size': 2, 'same': False, 'NT': False}} {'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 8, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 10, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 8, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 11, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 3, 'same': True}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 9, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': False, 'congruent': 5, 'size': 4, 'same': False, 'NT': True}} {'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 7, 'same': True}, 'dst': {'type': 'addresses_D_ht', 'congruent': 11, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 0, 'size': 1, 'same': False, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'AVXalign': False, 'congruent': 3, 'size': 2, 'same': False, 'NT': True}} {'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 5, 'same': True}} {'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'AVXalign': False, 'congruent': 6, 'size': 32, 'same': True, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'AVXalign': True, 'congruent': 2, 'size': 16, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': False, 'congruent': 5, 'size': 32, 'same': False, 'NT': False}} {'34': 21829} 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 */
//===--- JumpDiagnostics.cpp - Protected scope jump analysis ------*- C++ -*-=// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // This file implements the JumpScopeChecker class, which is used to diagnose // jumps that enter a protected scope in an invalid way. // //===----------------------------------------------------------------------===// #include "clang/AST/DeclCXX.h" #include "clang/AST/Expr.h" #include "clang/AST/ExprCXX.h" #include "clang/AST/StmtCXX.h" #include "clang/AST/StmtObjC.h" #include "clang/AST/StmtOpenMP.h" #include "clang/Basic/SourceLocation.h" #include "clang/Sema/SemaInternal.h" #include "llvm/ADT/BitVector.h" using namespace clang; namespace { /// JumpScopeChecker - This object is used by Sema to diagnose invalid jumps /// into VLA and other protected scopes. For example, this rejects: /// goto L; /// int a[n]; /// L: /// /// We also detect jumps out of protected scopes when it's not possible to do /// cleanups properly. Indirect jumps and ASM jumps can't do cleanups because /// the target is unknown. Return statements with \c [[clang::musttail]] cannot /// handle any cleanups due to the nature of a tail call. class JumpScopeChecker { Sema &S; /// Permissive - True when recovering from errors, in which case precautions /// are taken to handle incomplete scope information. const bool Permissive; /// GotoScope - This is a record that we use to keep track of all of the /// scopes that are introduced by VLAs and other things that scope jumps like /// gotos. This scope tree has nothing to do with the source scope tree, /// because you can have multiple VLA scopes per compound statement, and most /// compound statements don't introduce any scopes. struct GotoScope { /// ParentScope - The index in ScopeMap of the parent scope. This is 0 for /// the parent scope is the function body. unsigned ParentScope; /// InDiag - The note to emit if there is a jump into this scope. unsigned InDiag; /// OutDiag - The note to emit if there is an indirect jump out /// of this scope. Direct jumps always clean up their current scope /// in an orderly way. unsigned OutDiag; /// Loc - Location to emit the diagnostic. SourceLocation Loc; GotoScope(unsigned parentScope, unsigned InDiag, unsigned OutDiag, SourceLocation L) : ParentScope(parentScope), InDiag(InDiag), OutDiag(OutDiag), Loc(L) {} }; SmallVector<GotoScope, 48> Scopes; llvm::DenseMap<Stmt*, unsigned> LabelAndGotoScopes; SmallVector<Stmt*, 16> Jumps; SmallVector<Stmt*, 4> IndirectJumps; SmallVector<Stmt*, 4> AsmJumps; SmallVector<AttributedStmt *, 4> MustTailStmts; SmallVector<LabelDecl*, 4> IndirectJumpTargets; SmallVector<LabelDecl*, 4> AsmJumpTargets; public: JumpScopeChecker(Stmt *Body, Sema &S); private: void BuildScopeInformation(Decl *D, unsigned &ParentScope); void BuildScopeInformation(VarDecl *D, const BlockDecl *BDecl, unsigned &ParentScope); void BuildScopeInformation(CompoundLiteralExpr *CLE, unsigned &ParentScope); void BuildScopeInformation(Stmt *S, unsigned &origParentScope); void VerifyJumps(); void VerifyIndirectOrAsmJumps(bool IsAsmGoto); void VerifyMustTailStmts(); void NoteJumpIntoScopes(ArrayRef<unsigned> ToScopes); void DiagnoseIndirectOrAsmJump(Stmt *IG, unsigned IGScope, LabelDecl *Target, unsigned TargetScope); void CheckJump(Stmt *From, Stmt *To, SourceLocation DiagLoc, unsigned JumpDiag, unsigned JumpDiagWarning, unsigned JumpDiagCXX98Compat); void CheckGotoStmt(GotoStmt *GS); const Attr *GetMustTailAttr(AttributedStmt *AS); unsigned GetDeepestCommonScope(unsigned A, unsigned B); }; } // end anonymous namespace #define CHECK_PERMISSIVE(x) (assert(Permissive || !(x)), (Permissive && (x))) JumpScopeChecker::JumpScopeChecker(Stmt *Body, Sema &s) : S(s), Permissive(s.hasAnyUnrecoverableErrorsInThisFunction()) { // Add a scope entry for function scope. Scopes.push_back(GotoScope(~0U, ~0U, ~0U, SourceLocation())); // Build information for the top level compound statement, so that we have a // defined scope record for every "goto" and label. unsigned BodyParentScope = 0; BuildScopeInformation(Body, BodyParentScope); // Check that all jumps we saw are kosher. VerifyJumps(); VerifyIndirectOrAsmJumps(false); VerifyIndirectOrAsmJumps(true); VerifyMustTailStmts(); } /// GetDeepestCommonScope - Finds the innermost scope enclosing the /// two scopes. unsigned JumpScopeChecker::GetDeepestCommonScope(unsigned A, unsigned B) { while (A != B) { // Inner scopes are created after outer scopes and therefore have // higher indices. if (A < B) { assert(Scopes[B].ParentScope < B); B = Scopes[B].ParentScope; } else { assert(Scopes[A].ParentScope < A); A = Scopes[A].ParentScope; } } return A; } typedef std::pair<unsigned,unsigned> ScopePair; /// GetDiagForGotoScopeDecl - If this decl induces a new goto scope, return a /// diagnostic that should be emitted if control goes over it. If not, return 0. static ScopePair GetDiagForGotoScopeDecl(Sema &S, const Decl *D) { if (const VarDecl *VD = dyn_cast<VarDecl>(D)) { unsigned InDiag = 0; unsigned OutDiag = 0; if (VD->getType()->isVariablyModifiedType()) InDiag = diag::note_protected_by_vla; if (VD->hasAttr<BlocksAttr>()) return ScopePair(diag::note_protected_by___block, diag::note_exits___block); if (VD->hasAttr<CleanupAttr>()) return ScopePair(diag::note_protected_by_cleanup, diag::note_exits_cleanup); if (VD->hasLocalStorage()) { switch (VD->getType().isDestructedType()) { case QualType::DK_objc_strong_lifetime: return ScopePair(diag::note_protected_by_objc_strong_init, diag::note_exits_objc_strong); case QualType::DK_objc_weak_lifetime: return ScopePair(diag::note_protected_by_objc_weak_init, diag::note_exits_objc_weak); case QualType::DK_nontrivial_c_struct: return ScopePair(diag::note_protected_by_non_trivial_c_struct_init, diag::note_exits_dtor); case QualType::DK_cxx_destructor: OutDiag = diag::note_exits_dtor; break; case QualType::DK_none: break; } } const Expr *Init = VD->getInit(); if (S.Context.getLangOpts().CPlusPlus && VD->hasLocalStorage() && Init) { // C++11 [stmt.dcl]p3: // A program that jumps from a point where a variable with automatic // storage duration is not in scope to a point where it is in scope // is ill-formed unless the variable has scalar type, class type with // a trivial default constructor and a trivial destructor, a // cv-qualified version of one of these types, or an array of one of // the preceding types and is declared without an initializer. // C++03 [stmt.dcl.p3: // A program that jumps from a point where a local variable // with automatic storage duration is not in scope to a point // where it is in scope is ill-formed unless the variable has // POD type and is declared without an initializer. InDiag = diag::note_protected_by_variable_init; // For a variable of (array of) class type declared without an // initializer, we will have call-style initialization and the initializer // will be the CXXConstructExpr with no intervening nodes. if (const CXXConstructExpr *CCE = dyn_cast<CXXConstructExpr>(Init)) { const CXXConstructorDecl *Ctor = CCE->getConstructor(); if (Ctor->isTrivial() && Ctor->isDefaultConstructor() && VD->getInitStyle() == VarDecl::CallInit) { if (OutDiag) InDiag = diag::note_protected_by_variable_nontriv_destructor; else if (!Ctor->getParent()->isPOD()) InDiag = diag::note_protected_by_variable_non_pod; else InDiag = 0; } } } return ScopePair(InDiag, OutDiag); } if (const TypedefNameDecl *TD = dyn_cast<TypedefNameDecl>(D)) { if (TD->getUnderlyingType()->isVariablyModifiedType()) return ScopePair(isa<TypedefDecl>(TD) ? diag::note_protected_by_vla_typedef : diag::note_protected_by_vla_type_alias, 0); } return ScopePair(0U, 0U); } /// Build scope information for a declaration that is part of a DeclStmt. void JumpScopeChecker::BuildScopeInformation(Decl *D, unsigned &ParentScope) { // If this decl causes a new scope, push and switch to it. std::pair<unsigned,unsigned> Diags = GetDiagForGotoScopeDecl(S, D); if (Diags.first || Diags.second) { Scopes.push_back(GotoScope(ParentScope, Diags.first, Diags.second, D->getLocation())); ParentScope = Scopes.size()-1; } // If the decl has an initializer, walk it with the potentially new // scope we just installed. if (VarDecl *VD = dyn_cast<VarDecl>(D)) if (Expr *Init = VD->getInit()) BuildScopeInformation(Init, ParentScope); } /// Build scope information for a captured block literal variables. void JumpScopeChecker::BuildScopeInformation(VarDecl *D, const BlockDecl *BDecl, unsigned &ParentScope) { // exclude captured __block variables; there's no destructor // associated with the block literal for them. if (D->hasAttr<BlocksAttr>()) return; QualType T = D->getType(); QualType::DestructionKind destructKind = T.isDestructedType(); if (destructKind != QualType::DK_none) { std::pair<unsigned,unsigned> Diags; switch (destructKind) { case QualType::DK_cxx_destructor: Diags = ScopePair(diag::note_enters_block_captures_cxx_obj, diag::note_exits_block_captures_cxx_obj); break; case QualType::DK_objc_strong_lifetime: Diags = ScopePair(diag::note_enters_block_captures_strong, diag::note_exits_block_captures_strong); break; case QualType::DK_objc_weak_lifetime: Diags = ScopePair(diag::note_enters_block_captures_weak, diag::note_exits_block_captures_weak); break; case QualType::DK_nontrivial_c_struct: Diags = ScopePair(diag::note_enters_block_captures_non_trivial_c_struct, diag::note_exits_block_captures_non_trivial_c_struct); break; case QualType::DK_none: llvm_unreachable("non-lifetime captured variable"); } SourceLocation Loc = D->getLocation(); if (Loc.isInvalid()) Loc = BDecl->getLocation(); Scopes.push_back(GotoScope(ParentScope, Diags.first, Diags.second, Loc)); ParentScope = Scopes.size()-1; } } /// Build scope information for compound literals of C struct types that are /// non-trivial to destruct. void JumpScopeChecker::BuildScopeInformation(CompoundLiteralExpr *CLE, unsigned &ParentScope) { unsigned InDiag = diag::note_enters_compound_literal_scope; unsigned OutDiag = diag::note_exits_compound_literal_scope; Scopes.push_back(GotoScope(ParentScope, InDiag, OutDiag, CLE->getExprLoc())); ParentScope = Scopes.size() - 1; } /// BuildScopeInformation - The statements from CI to CE are known to form a /// coherent VLA scope with a specified parent node. Walk through the /// statements, adding any labels or gotos to LabelAndGotoScopes and recursively /// walking the AST as needed. void JumpScopeChecker::BuildScopeInformation(Stmt *S, unsigned &origParentScope) { // If this is a statement, rather than an expression, scopes within it don't // propagate out into the enclosing scope. Otherwise we have to worry // about block literals, which have the lifetime of their enclosing statement. unsigned independentParentScope = origParentScope; unsigned &ParentScope = ((isa<Expr>(S) && !isa<StmtExpr>(S)) ? origParentScope : independentParentScope); unsigned StmtsToSkip = 0u; // If we found a label, remember that it is in ParentScope scope. switch (S->getStmtClass()) { case Stmt::AddrLabelExprClass: IndirectJumpTargets.push_back(cast<AddrLabelExpr>(S)->getLabel()); break; case Stmt::ObjCForCollectionStmtClass: { auto *CS = cast<ObjCForCollectionStmt>(S); unsigned Diag = diag::note_protected_by_objc_fast_enumeration; unsigned NewParentScope = Scopes.size(); Scopes.push_back(GotoScope(ParentScope, Diag, 0, S->getBeginLoc())); BuildScopeInformation(CS->getBody(), NewParentScope); return; } case Stmt::IndirectGotoStmtClass: // "goto *&&lbl;" is a special case which we treat as equivalent // to a normal goto. In addition, we don't calculate scope in the // operand (to avoid recording the address-of-label use), which // works only because of the restricted set of expressions which // we detect as constant targets. if (cast<IndirectGotoStmt>(S)->getConstantTarget()) { LabelAndGotoScopes[S] = ParentScope; Jumps.push_back(S); return; } LabelAndGotoScopes[S] = ParentScope; IndirectJumps.push_back(S); break; case Stmt::SwitchStmtClass: // Evaluate the C++17 init stmt and condition variable // before entering the scope of the switch statement. if (Stmt *Init = cast<SwitchStmt>(S)->getInit()) { BuildScopeInformation(Init, ParentScope); ++StmtsToSkip; } if (VarDecl *Var = cast<SwitchStmt>(S)->getConditionVariable()) { BuildScopeInformation(Var, ParentScope); ++StmtsToSkip; } LLVM_FALLTHROUGH; case Stmt::GotoStmtClass: // Remember both what scope a goto is in as well as the fact that we have // it. This makes the second scan not have to walk the AST again. LabelAndGotoScopes[S] = ParentScope; Jumps.push_back(S); break; case Stmt::GCCAsmStmtClass: if (auto *GS = dyn_cast<GCCAsmStmt>(S)) if (GS->isAsmGoto()) { // Remember both what scope a goto is in as well as the fact that we // have it. This makes the second scan not have to walk the AST again. LabelAndGotoScopes[S] = ParentScope; AsmJumps.push_back(GS); for (auto *E : GS->labels()) AsmJumpTargets.push_back(E->getLabel()); } break; case Stmt::IfStmtClass: { IfStmt *IS = cast<IfStmt>(S); if (!(IS->isConstexpr() || IS->isConsteval() || IS->isObjCAvailabilityCheck())) break; unsigned Diag = diag::note_protected_by_if_available; if (IS->isConstexpr()) Diag = diag::note_protected_by_constexpr_if; else if (IS->isConsteval()) Diag = diag::note_protected_by_consteval_if; if (VarDecl *Var = IS->getConditionVariable()) BuildScopeInformation(Var, ParentScope); // Cannot jump into the middle of the condition. unsigned NewParentScope = Scopes.size(); Scopes.push_back(GotoScope(ParentScope, Diag, 0, IS->getBeginLoc())); if (!IS->isConsteval()) BuildScopeInformation(IS->getCond(), NewParentScope); // Jumps into either arm of an 'if constexpr' are not allowed. NewParentScope = Scopes.size(); Scopes.push_back(GotoScope(ParentScope, Diag, 0, IS->getBeginLoc())); BuildScopeInformation(IS->getThen(), NewParentScope); if (Stmt *Else = IS->getElse()) { NewParentScope = Scopes.size(); Scopes.push_back(GotoScope(ParentScope, Diag, 0, IS->getBeginLoc())); BuildScopeInformation(Else, NewParentScope); } return; } case Stmt::CXXTryStmtClass: { CXXTryStmt *TS = cast<CXXTryStmt>(S); { unsigned NewParentScope = Scopes.size(); Scopes.push_back(GotoScope(ParentScope, diag::note_protected_by_cxx_try, diag::note_exits_cxx_try, TS->getSourceRange().getBegin())); if (Stmt *TryBlock = TS->getTryBlock()) BuildScopeInformation(TryBlock, NewParentScope); } // Jump from the catch into the try is not allowed either. for (unsigned I = 0, E = TS->getNumHandlers(); I != E; ++I) { CXXCatchStmt *CS = TS->getHandler(I); unsigned NewParentScope = Scopes.size(); Scopes.push_back(GotoScope(ParentScope, diag::note_protected_by_cxx_catch, diag::note_exits_cxx_catch, CS->getSourceRange().getBegin())); BuildScopeInformation(CS->getHandlerBlock(), NewParentScope); } return; } case Stmt::SEHTryStmtClass: { SEHTryStmt *TS = cast<SEHTryStmt>(S); { unsigned NewParentScope = Scopes.size(); Scopes.push_back(GotoScope(ParentScope, diag::note_protected_by_seh_try, diag::note_exits_seh_try, TS->getSourceRange().getBegin())); if (Stmt *TryBlock = TS->getTryBlock()) BuildScopeInformation(TryBlock, NewParentScope); } // Jump from __except or __finally into the __try are not allowed either. if (SEHExceptStmt *Except = TS->getExceptHandler()) { unsigned NewParentScope = Scopes.size(); Scopes.push_back(GotoScope(ParentScope, diag::note_protected_by_seh_except, diag::note_exits_seh_except, Except->getSourceRange().getBegin())); BuildScopeInformation(Except->getBlock(), NewParentScope); } else if (SEHFinallyStmt *Finally = TS->getFinallyHandler()) { unsigned NewParentScope = Scopes.size(); Scopes.push_back(GotoScope(ParentScope, diag::note_protected_by_seh_finally, diag::note_exits_seh_finally, Finally->getSourceRange().getBegin())); BuildScopeInformation(Finally->getBlock(), NewParentScope); } return; } case Stmt::DeclStmtClass: { // If this is a declstmt with a VLA definition, it defines a scope from here // to the end of the containing context. DeclStmt *DS = cast<DeclStmt>(S); // The decl statement creates a scope if any of the decls in it are VLAs // or have the cleanup attribute. for (auto *I : DS->decls()) BuildScopeInformation(I, origParentScope); return; } case Stmt::ObjCAtTryStmtClass: { // Disallow jumps into any part of an @try statement by pushing a scope and // walking all sub-stmts in that scope. ObjCAtTryStmt *AT = cast<ObjCAtTryStmt>(S); // Recursively walk the AST for the @try part. { unsigned NewParentScope = Scopes.size(); Scopes.push_back(GotoScope(ParentScope, diag::note_protected_by_objc_try, diag::note_exits_objc_try, AT->getAtTryLoc())); if (Stmt *TryPart = AT->getTryBody()) BuildScopeInformation(TryPart, NewParentScope); } // Jump from the catch to the finally or try is not valid. for (unsigned I = 0, N = AT->getNumCatchStmts(); I != N; ++I) { ObjCAtCatchStmt *AC = AT->getCatchStmt(I); unsigned NewParentScope = Scopes.size(); Scopes.push_back(GotoScope(ParentScope, diag::note_protected_by_objc_catch, diag::note_exits_objc_catch, AC->getAtCatchLoc())); // @catches are nested and it isn't BuildScopeInformation(AC->getCatchBody(), NewParentScope); } // Jump from the finally to the try or catch is not valid. if (ObjCAtFinallyStmt *AF = AT->getFinallyStmt()) { unsigned NewParentScope = Scopes.size(); Scopes.push_back(GotoScope(ParentScope, diag::note_protected_by_objc_finally, diag::note_exits_objc_finally, AF->getAtFinallyLoc())); BuildScopeInformation(AF, NewParentScope); } return; } case Stmt::ObjCAtSynchronizedStmtClass: { // Disallow jumps into the protected statement of an @synchronized, but // allow jumps into the object expression it protects. ObjCAtSynchronizedStmt *AS = cast<ObjCAtSynchronizedStmt>(S); // Recursively walk the AST for the @synchronized object expr, it is // evaluated in the normal scope. BuildScopeInformation(AS->getSynchExpr(), ParentScope); // Recursively walk the AST for the @synchronized part, protected by a new // scope. unsigned NewParentScope = Scopes.size(); Scopes.push_back(GotoScope(ParentScope, diag::note_protected_by_objc_synchronized, diag::note_exits_objc_synchronized, AS->getAtSynchronizedLoc())); BuildScopeInformation(AS->getSynchBody(), NewParentScope); return; } case Stmt::ObjCAutoreleasePoolStmtClass: { // Disallow jumps into the protected statement of an @autoreleasepool. ObjCAutoreleasePoolStmt *AS = cast<ObjCAutoreleasePoolStmt>(S); // Recursively walk the AST for the @autoreleasepool part, protected by a // new scope. unsigned NewParentScope = Scopes.size(); Scopes.push_back(GotoScope(ParentScope, diag::note_protected_by_objc_autoreleasepool, diag::note_exits_objc_autoreleasepool, AS->getAtLoc())); BuildScopeInformation(AS->getSubStmt(), NewParentScope); return; } case Stmt::ExprWithCleanupsClass: { // Disallow jumps past full-expressions that use blocks with // non-trivial cleanups of their captures. This is theoretically // implementable but a lot of work which we haven't felt up to doing. ExprWithCleanups *EWC = cast<ExprWithCleanups>(S); for (unsigned i = 0, e = EWC->getNumObjects(); i != e; ++i) { if (auto *BDecl = EWC->getObject(i).dyn_cast<BlockDecl *>()) for (const auto &CI : BDecl->captures()) { VarDecl *variable = CI.getVariable(); BuildScopeInformation(variable, BDecl, origParentScope); } else if (auto *CLE = EWC->getObject(i).dyn_cast<CompoundLiteralExpr *>()) BuildScopeInformation(CLE, origParentScope); else llvm_unreachable("unexpected cleanup object type"); } break; } case Stmt::MaterializeTemporaryExprClass: { // Disallow jumps out of scopes containing temporaries lifetime-extended to // automatic storage duration. MaterializeTemporaryExpr *MTE = cast<MaterializeTemporaryExpr>(S); if (MTE->getStorageDuration() == SD_Automatic) { SmallVector<const Expr *, 4> CommaLHS; SmallVector<SubobjectAdjustment, 4> Adjustments; const Expr *ExtendedObject = MTE->getSubExpr()->skipRValueSubobjectAdjustments(CommaLHS, Adjustments); if (ExtendedObject->getType().isDestructedType()) { Scopes.push_back(GotoScope(ParentScope, 0, diag::note_exits_temporary_dtor, ExtendedObject->getExprLoc())); origParentScope = Scopes.size()-1; } } break; } case Stmt::CaseStmtClass: case Stmt::DefaultStmtClass: case Stmt::LabelStmtClass: LabelAndGotoScopes[S] = ParentScope; break; case Stmt::AttributedStmtClass: { AttributedStmt *AS = cast<AttributedStmt>(S); if (GetMustTailAttr(AS)) { LabelAndGotoScopes[AS] = ParentScope; MustTailStmts.push_back(AS); } break; } default: if (auto *ED = dyn_cast<OMPExecutableDirective>(S)) { if (!ED->isStandaloneDirective()) { unsigned NewParentScope = Scopes.size(); Scopes.emplace_back(ParentScope, diag::note_omp_protected_structured_block, diag::note_omp_exits_structured_block, ED->getStructuredBlock()->getBeginLoc()); BuildScopeInformation(ED->getStructuredBlock(), NewParentScope); return; } } break; } for (Stmt *SubStmt : S->children()) { if (!SubStmt) continue; if (StmtsToSkip) { --StmtsToSkip; continue; } // Cases, labels, and defaults aren't "scope parents". It's also // important to handle these iteratively instead of recursively in // order to avoid blowing out the stack. while (true) { Stmt *Next; if (SwitchCase *SC = dyn_cast<SwitchCase>(SubStmt)) Next = SC->getSubStmt(); else if (LabelStmt *LS = dyn_cast<LabelStmt>(SubStmt)) Next = LS->getSubStmt(); else break; LabelAndGotoScopes[SubStmt] = ParentScope; SubStmt = Next; } // Recursively walk the AST. BuildScopeInformation(SubStmt, ParentScope); } } /// VerifyJumps - Verify each element of the Jumps array to see if they are /// valid, emitting diagnostics if not. void JumpScopeChecker::VerifyJumps() { while (!Jumps.empty()) { Stmt *Jump = Jumps.pop_back_val(); // With a goto, if (GotoStmt *GS = dyn_cast<GotoStmt>(Jump)) { // The label may not have a statement if it's coming from inline MS ASM. if (GS->getLabel()->getStmt()) { CheckJump(GS, GS->getLabel()->getStmt(), GS->getGotoLoc(), diag::err_goto_into_protected_scope, diag::ext_goto_into_protected_scope, diag::warn_cxx98_compat_goto_into_protected_scope); } CheckGotoStmt(GS); continue; } // We only get indirect gotos here when they have a constant target. if (IndirectGotoStmt *IGS = dyn_cast<IndirectGotoStmt>(Jump)) { LabelDecl *Target = IGS->getConstantTarget(); CheckJump(IGS, Target->getStmt(), IGS->getGotoLoc(), diag::err_goto_into_protected_scope, diag::ext_goto_into_protected_scope, diag::warn_cxx98_compat_goto_into_protected_scope); continue; } SwitchStmt *SS = cast<SwitchStmt>(Jump); for (SwitchCase *SC = SS->getSwitchCaseList(); SC; SC = SC->getNextSwitchCase()) { if (CHECK_PERMISSIVE(!LabelAndGotoScopes.count(SC))) continue; SourceLocation Loc; if (CaseStmt *CS = dyn_cast<CaseStmt>(SC)) Loc = CS->getBeginLoc(); else if (DefaultStmt *DS = dyn_cast<DefaultStmt>(SC)) Loc = DS->getBeginLoc(); else Loc = SC->getBeginLoc(); CheckJump(SS, SC, Loc, diag::err_switch_into_protected_scope, 0, diag::warn_cxx98_compat_switch_into_protected_scope); } } } /// VerifyIndirectOrAsmJumps - Verify whether any possible indirect goto or /// asm goto jump might cross a protection boundary. Unlike direct jumps, /// indirect or asm goto jumps count cleanups as protection boundaries: /// since there's no way to know where the jump is going, we can't implicitly /// run the right cleanups the way we can with direct jumps. /// Thus, an indirect/asm jump is "trivial" if it bypasses no /// initializations and no teardowns. More formally, an indirect/asm jump /// from A to B is trivial if the path out from A to DCA(A,B) is /// trivial and the path in from DCA(A,B) to B is trivial, where /// DCA(A,B) is the deepest common ancestor of A and B. /// Jump-triviality is transitive but asymmetric. /// /// A path in is trivial if none of the entered scopes have an InDiag. /// A path out is trivial is none of the exited scopes have an OutDiag. /// /// Under these definitions, this function checks that the indirect /// jump between A and B is trivial for every indirect goto statement A /// and every label B whose address was taken in the function. void JumpScopeChecker::VerifyIndirectOrAsmJumps(bool IsAsmGoto) { SmallVector<Stmt*, 4> GotoJumps = IsAsmGoto ? AsmJumps : IndirectJumps; if (GotoJumps.empty()) return; SmallVector<LabelDecl *, 4> JumpTargets = IsAsmGoto ? AsmJumpTargets : IndirectJumpTargets; // If there aren't any address-of-label expressions in this function, // complain about the first indirect goto. if (JumpTargets.empty()) { assert(!IsAsmGoto &&"only indirect goto can get here"); S.Diag(GotoJumps[0]->getBeginLoc(), diag::err_indirect_goto_without_addrlabel); return; } // Collect a single representative of every scope containing an // indirect or asm goto. For most code bases, this substantially cuts // down on the number of jump sites we'll have to consider later. typedef std::pair<unsigned, Stmt*> JumpScope; SmallVector<JumpScope, 32> JumpScopes; { llvm::DenseMap<unsigned, Stmt*> JumpScopesMap; for (SmallVectorImpl<Stmt *>::iterator I = GotoJumps.begin(), E = GotoJumps.end(); I != E; ++I) { Stmt *IG = *I; if (CHECK_PERMISSIVE(!LabelAndGotoScopes.count(IG))) continue; unsigned IGScope = LabelAndGotoScopes[IG]; Stmt *&Entry = JumpScopesMap[IGScope]; if (!Entry) Entry = IG; } JumpScopes.reserve(JumpScopesMap.size()); for (llvm::DenseMap<unsigned, Stmt *>::iterator I = JumpScopesMap.begin(), E = JumpScopesMap.end(); I != E; ++I) JumpScopes.push_back(*I); } // Collect a single representative of every scope containing a // label whose address was taken somewhere in the function. // For most code bases, there will be only one such scope. llvm::DenseMap<unsigned, LabelDecl*> TargetScopes; for (SmallVectorImpl<LabelDecl *>::iterator I = JumpTargets.begin(), E = JumpTargets.end(); I != E; ++I) { LabelDecl *TheLabel = *I; if (CHECK_PERMISSIVE(!LabelAndGotoScopes.count(TheLabel->getStmt()))) continue; unsigned LabelScope = LabelAndGotoScopes[TheLabel->getStmt()]; LabelDecl *&Target = TargetScopes[LabelScope]; if (!Target) Target = TheLabel; } // For each target scope, make sure it's trivially reachable from // every scope containing a jump site. // // A path between scopes always consists of exitting zero or more // scopes, then entering zero or more scopes. We build a set of // of scopes S from which the target scope can be trivially // entered, then verify that every jump scope can be trivially // exitted to reach a scope in S. llvm::BitVector Reachable(Scopes.size(), false); for (llvm::DenseMap<unsigned,LabelDecl*>::iterator TI = TargetScopes.begin(), TE = TargetScopes.end(); TI != TE; ++TI) { unsigned TargetScope = TI->first; LabelDecl *TargetLabel = TI->second; Reachable.reset(); // Mark all the enclosing scopes from which you can safely jump // into the target scope. 'Min' will end up being the index of // the shallowest such scope. unsigned Min = TargetScope; while (true) { Reachable.set(Min); // Don't go beyond the outermost scope. if (Min == 0) break; // Stop if we can't trivially enter the current scope. if (Scopes[Min].InDiag) break; Min = Scopes[Min].ParentScope; } // Walk through all the jump sites, checking that they can trivially // reach this label scope. for (SmallVectorImpl<JumpScope>::iterator I = JumpScopes.begin(), E = JumpScopes.end(); I != E; ++I) { unsigned Scope = I->first; // Walk out the "scope chain" for this scope, looking for a scope // we've marked reachable. For well-formed code this amortizes // to O(JumpScopes.size() / Scopes.size()): we only iterate // when we see something unmarked, and in well-formed code we // mark everything we iterate past. bool IsReachable = false; while (true) { if (Reachable.test(Scope)) { // If we find something reachable, mark all the scopes we just // walked through as reachable. for (unsigned S = I->first; S != Scope; S = Scopes[S].ParentScope) Reachable.set(S); IsReachable = true; break; } // Don't walk out if we've reached the top-level scope or we've // gotten shallower than the shallowest reachable scope. if (Scope == 0 || Scope < Min) break; // Don't walk out through an out-diagnostic. if (Scopes[Scope].OutDiag) break; Scope = Scopes[Scope].ParentScope; } // Only diagnose if we didn't find something. if (IsReachable) continue; DiagnoseIndirectOrAsmJump(I->second, I->first, TargetLabel, TargetScope); } } } /// Return true if a particular error+note combination must be downgraded to a /// warning in Microsoft mode. static bool IsMicrosoftJumpWarning(unsigned JumpDiag, unsigned InDiagNote) { return (JumpDiag == diag::err_goto_into_protected_scope && (InDiagNote == diag::note_protected_by_variable_init || InDiagNote == diag::note_protected_by_variable_nontriv_destructor)); } /// Return true if a particular note should be downgraded to a compatibility /// warning in C++11 mode. static bool IsCXX98CompatWarning(Sema &S, unsigned InDiagNote) { return S.getLangOpts().CPlusPlus11 && InDiagNote == diag::note_protected_by_variable_non_pod; } /// Produce primary diagnostic for an indirect jump statement. static void DiagnoseIndirectOrAsmJumpStmt(Sema &S, Stmt *Jump, LabelDecl *Target, bool &Diagnosed) { if (Diagnosed) return; bool IsAsmGoto = isa<GCCAsmStmt>(Jump); S.Diag(Jump->getBeginLoc(), diag::err_indirect_goto_in_protected_scope) << IsAsmGoto; S.Diag(Target->getStmt()->getIdentLoc(), diag::note_indirect_goto_target) << IsAsmGoto; Diagnosed = true; } /// Produce note diagnostics for a jump into a protected scope. void JumpScopeChecker::NoteJumpIntoScopes(ArrayRef<unsigned> ToScopes) { if (CHECK_PERMISSIVE(ToScopes.empty())) return; for (unsigned I = 0, E = ToScopes.size(); I != E; ++I) if (Scopes[ToScopes[I]].InDiag) S.Diag(Scopes[ToScopes[I]].Loc, Scopes[ToScopes[I]].InDiag); } /// Diagnose an indirect jump which is known to cross scopes. void JumpScopeChecker::DiagnoseIndirectOrAsmJump(Stmt *Jump, unsigned JumpScope, LabelDecl *Target, unsigned TargetScope) { if (CHECK_PERMISSIVE(JumpScope == TargetScope)) return; unsigned Common = GetDeepestCommonScope(JumpScope, TargetScope); bool Diagnosed = false; // Walk out the scope chain until we reach the common ancestor. for (unsigned I = JumpScope; I != Common; I = Scopes[I].ParentScope) if (Scopes[I].OutDiag) { DiagnoseIndirectOrAsmJumpStmt(S, Jump, Target, Diagnosed); S.Diag(Scopes[I].Loc, Scopes[I].OutDiag); } SmallVector<unsigned, 10> ToScopesCXX98Compat; // Now walk into the scopes containing the label whose address was taken. for (unsigned I = TargetScope; I != Common; I = Scopes[I].ParentScope) if (IsCXX98CompatWarning(S, Scopes[I].InDiag)) ToScopesCXX98Compat.push_back(I); else if (Scopes[I].InDiag) { DiagnoseIndirectOrAsmJumpStmt(S, Jump, Target, Diagnosed); S.Diag(Scopes[I].Loc, Scopes[I].InDiag); } // Diagnose this jump if it would be ill-formed in C++98. if (!Diagnosed && !ToScopesCXX98Compat.empty()) { bool IsAsmGoto = isa<GCCAsmStmt>(Jump); S.Diag(Jump->getBeginLoc(), diag::warn_cxx98_compat_indirect_goto_in_protected_scope) << IsAsmGoto; S.Diag(Target->getStmt()->getIdentLoc(), diag::note_indirect_goto_target) << IsAsmGoto; NoteJumpIntoScopes(ToScopesCXX98Compat); } } /// CheckJump - Validate that the specified jump statement is valid: that it is /// jumping within or out of its current scope, not into a deeper one. void JumpScopeChecker::CheckJump(Stmt *From, Stmt *To, SourceLocation DiagLoc, unsigned JumpDiagError, unsigned JumpDiagWarning, unsigned JumpDiagCXX98Compat) { if (CHECK_PERMISSIVE(!LabelAndGotoScopes.count(From))) return; if (CHECK_PERMISSIVE(!LabelAndGotoScopes.count(To))) return; unsigned FromScope = LabelAndGotoScopes[From]; unsigned ToScope = LabelAndGotoScopes[To]; // Common case: exactly the same scope, which is fine. if (FromScope == ToScope) return; // Warn on gotos out of __finally blocks. if (isa<GotoStmt>(From) || isa<IndirectGotoStmt>(From)) { // If FromScope > ToScope, FromScope is more nested and the jump goes to a // less nested scope. Check if it crosses a __finally along the way. for (unsigned I = FromScope; I > ToScope; I = Scopes[I].ParentScope) { if (Scopes[I].InDiag == diag::note_protected_by_seh_finally) { S.Diag(From->getBeginLoc(), diag::warn_jump_out_of_seh_finally); break; } if (Scopes[I].InDiag == diag::note_omp_protected_structured_block) { S.Diag(From->getBeginLoc(), diag::err_goto_into_protected_scope); S.Diag(To->getBeginLoc(), diag::note_omp_exits_structured_block); break; } } } unsigned CommonScope = GetDeepestCommonScope(FromScope, ToScope); // It's okay to jump out from a nested scope. if (CommonScope == ToScope) return; // Pull out (and reverse) any scopes we might need to diagnose skipping. SmallVector<unsigned, 10> ToScopesCXX98Compat; SmallVector<unsigned, 10> ToScopesError; SmallVector<unsigned, 10> ToScopesWarning; for (unsigned I = ToScope; I != CommonScope; I = Scopes[I].ParentScope) { if (S.getLangOpts().MSVCCompat && JumpDiagWarning != 0 && IsMicrosoftJumpWarning(JumpDiagError, Scopes[I].InDiag)) ToScopesWarning.push_back(I); else if (IsCXX98CompatWarning(S, Scopes[I].InDiag)) ToScopesCXX98Compat.push_back(I); else if (Scopes[I].InDiag) ToScopesError.push_back(I); } // Handle warnings. if (!ToScopesWarning.empty()) { S.Diag(DiagLoc, JumpDiagWarning); NoteJumpIntoScopes(ToScopesWarning); assert(isa<LabelStmt>(To)); LabelStmt *Label = cast<LabelStmt>(To); Label->setSideEntry(true); } // Handle errors. if (!ToScopesError.empty()) { S.Diag(DiagLoc, JumpDiagError); NoteJumpIntoScopes(ToScopesError); } // Handle -Wc++98-compat warnings if the jump is well-formed. if (ToScopesError.empty() && !ToScopesCXX98Compat.empty()) { S.Diag(DiagLoc, JumpDiagCXX98Compat); NoteJumpIntoScopes(ToScopesCXX98Compat); } } void JumpScopeChecker::CheckGotoStmt(GotoStmt *GS) { if (GS->getLabel()->isMSAsmLabel()) { S.Diag(GS->getGotoLoc(), diag::err_goto_ms_asm_label) << GS->getLabel()->getIdentifier(); S.Diag(GS->getLabel()->getLocation(), diag::note_goto_ms_asm_label) << GS->getLabel()->getIdentifier(); } } void JumpScopeChecker::VerifyMustTailStmts() { for (AttributedStmt *AS : MustTailStmts) { for (unsigned I = LabelAndGotoScopes[AS]; I; I = Scopes[I].ParentScope) { if (Scopes[I].OutDiag) { S.Diag(AS->getBeginLoc(), diag::err_musttail_scope); S.Diag(Scopes[I].Loc, Scopes[I].OutDiag); } } } } const Attr *JumpScopeChecker::GetMustTailAttr(AttributedStmt *AS) { ArrayRef<const Attr *> Attrs = AS->getAttrs(); const auto *Iter = llvm::find_if(Attrs, [](const Attr *A) { return isa<MustTailAttr>(A); }); return Iter != Attrs.end() ? *Iter : nullptr; } void Sema::DiagnoseInvalidJumps(Stmt *Body) { (void)JumpScopeChecker(Body, *this); }
#include <core/light.h> #include <core/color.h> #include <core/geometry.h> #include <core/sampling.h> #include <util/parameters.h> namespace pine { LightSample PointLight::Sample(vec3 p, vec2) const { LightSample ls; ls.wo = Normalize(position - p, ls.distance); ls.pdf = pstd::sqr(ls.distance); ls.Le = color; ls.isDelta = true; return ls; } LightLeSample PointLight::SampleLe(vec2, vec2 ud) const { LightLeSample ls; ls.Le = color; ls.ray.o = position; ls.ray.d = UniformSphereSampling(ud); ls.pdf.pos = 1.0f; ls.pdf.dir = 1.0f / Pi4; return ls; } SpatialPdf PointLight::PdfLe(const Ray&) const { SpatialPdf pdf; pdf.pos = 0.0f; pdf.dir = 1.0f / Pi4; return pdf; } LightSample DirectionalLight::Sample(vec3, vec2) const { LightSample ls; ls.Le = color; ls.wo = direction; ls.distance = 1e+10f; ls.pdf = 1.0f; ls.isDelta = true; return ls; } LightSample AreaLight::Sample(vec3 p, vec2 u) const { return shape->Sample(p, u); } LightLeSample AreaLight::SampleLe(vec2 up, vec2 ud) const { LightLeSample les; auto ss = shape->Sample({}, up); les.ray = Ray(ss.p, CoordinateSystem(ss.n) * CosineWeightedSampling(ud)); les.pdf.dir = AbsDot(les.ray.d, ss.n) / Pi; les.pdf.pos = 1.0f / shape->Area(); les.Le = ss.Le * AbsDot(les.ray.d, ss.n); return les; } SpatialPdf AreaLight::PdfLe(const Ray&) const { SpatialPdf pdf; pdf.dir = 1.0f / Pi2; pdf.pos = 1.0f / shape->Area(); return pdf; } Spectrum AreaLight::Power() const { return shape->Area() * shape->material->Le(MaterialEvalCtx({}, {}, {}, {}, {}, {})); } LightSample Sky::Sample(vec3, vec2) const { LightSample ls; ls.distance = 1e+10f; ls.isDelta = true; ls.wo = sunDirection; ls.Le = SkyColor(ls.wo, sunDirection, sunColor.ToRGB()); ls.pdf = 1.0f; return ls; } Spectrum Sky::Color(vec3 wo) const { return SkyColor(wo, sunDirection, sunColor.ToRGB()); } float Sky::Pdf(vec3) const { return 0.0f; } Atmosphere::Atmosphere(vec3 sundir, Spectrum suncol, vec2i size, bool interpolate) : sunDirection(Normalize(sundir)), sunColor(suncol), size(size), interpolate(interpolate) { colors.resize(Area(size)); for (int y = 0; y < size.y; y++) { for (int x = 0; x < size.x; x++) { vec3 d = UniformSphereSampling(vec2((float)x / size.x, (float)y / size.y)); vec3 color = AtmosphereColor(d, sunDirection, sunColor.ToRGB()).ToRGB(); colors[y * size.x + x] = color.HasNaN() ? vec3(0.0f) : color; } } sunSampledColor = AtmosphereColor(sunDirection, sunDirection, sunColor.ToRGB()); } LightSample Atmosphere::Sample(vec3, vec2 u) const { LightSample ls; ls.distance = 1e+10f; if (u.x < 0.5f) { u.x *= 2.0f; ls.wo = UniformSphereSampling(u); ls.pdf = 1.0f / Pi4; vec2i st = Min(u * size, size - vec2(1)); ls.Le = colors[st.y * size.x + st.x]; } else { ls.wo = sunDirection; ls.pdf = 1.0f; ls.Le = sunSampledColor.ToRGB(); ls.isDelta = true; } ls.pdf /= 2; return ls; } Spectrum Atmosphere::Color(vec3 wo) const { vec2 uv = InverseUniformSphereMampling(wo) * size; if (!interpolate) { vec2i st = Min(uv, size - vec2(1)); return colors[st.y * size.x + st.x]; } vec2i st00 = {pstd::floor(uv.x), pstd::floor(uv.y)}; vec2i st01 = {pstd::ceil(uv.x), pstd::floor(uv.y)}; vec2i st10 = {pstd::floor(uv.x), pstd::ceil(uv.y)}; vec2i st11 = {pstd::ceil(uv.x), pstd::ceil(uv.y)}; st00 %= size; st01 %= size; st10 %= size; st11 %= size; vec2 p = uv - st00; vec3 c00 = colors[st00.y * size.x + st00.x]; vec3 c01 = colors[st01.y * size.x + st01.x]; vec3 c10 = colors[st10.y * size.x + st10.x]; vec3 c11 = colors[st11.y * size.x + st11.x]; vec3 c0 = pstd::lerp(p.x, c00, c01); vec3 c1 = pstd::lerp(p.x, c10, c11); return pstd::lerp(p.y, c0, c1); } float Atmosphere::Pdf(vec3) const { return 1.0f / Pi4; } PointLight PointLight::Create(const Parameters& params) { return PointLight(params.GetVec3("position"), params.GetVec3("color")); } DirectionalLight DirectionalLight::Create(const Parameters& params) { return DirectionalLight(params.GetVec3("direction"), params.GetVec3("color")); } Sky Sky::Create(const Parameters& params) { return Sky(params.GetVec3("sunDirection"), params.GetVec3("sunColor")); } Atmosphere Atmosphere::Create(const Parameters& params) { return Atmosphere(params.GetVec3("sunDirection", vec3(2, 6, 3)), params.GetVec3("sunColor", vec3(1.0f)), params.GetVec2i("size", vec2i(512)), params.GetBool("interpolate", true)); } EnvironmentLight EnvironmentLight::Create(const Parameters& lightParams) { Parameters params = lightParams["environment"]; pstd::string type = params.GetString("type"); SWITCH(type) { CASE("Atmosphere") return Atmosphere(Atmosphere::Create(params)); CASE("Sky") return Sky(Sky::Create(params)); DEFAULT { LOG_WARNING("[EnvironmentLight][Create]Unknown type \"&\"", type); return Atmosphere(Atmosphere::Create(params)); } } } Light CreateLight(const Parameters& params) { pstd::string type = params.GetString("type"); SWITCH(type) { CASE("Point") return PointLight(PointLight::Create(params)); CASE("Directional") return DirectionalLight(DirectionalLight::Create(params)); CASE("Environment") return EnvironmentLight(EnvironmentLight::Create(params)); DEFAULT { LOG_WARNING("[Light][Create]Unknown type \"&\"", type); return PointLight(PointLight::Create(params)); } } } } // namespace pine
; A140262: A140260 reduced modulo 9. ; 0,4,1,1,6,0,4,6,4,1,6,0,4,6,4,6,4,1,6,0,4,6,4,1,6,4,6,4,1,1,1,1,6,0,4,6,4,1,1,1,1,1,1,6,4,6,0,0,0,0,4,1,6,0 seq $0,140260 ; Those n for which A140259(n) = A002264(n+11). mod $0,9
;------------------------------------------------------------------------------ ; ; EnableInterrupts() for ARM ; ; Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR> ; Portions copyright (c) 2008 - 2009, Apple Inc. 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. ; ;------------------------------------------------------------------------------ EXPORT EnableInterrupts AREA Interrupt_enable, CODE, READONLY ;/** ; Enables CPU interrupts. ; ;**/ ;VOID ;EFIAPI ;EnableInterrupts ( ; VOID ; ); ; EnableInterrupts MRS R0,CPSR BIC R0,R0,#0x80 ;Enable IRQ interrupts MSR CPSR_c,R0 BX LR END
/* * Copyright (C) 2019 Open Source Robotics Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ #include <gtest/gtest.h> #include "sdf/AirPressure.hh" ///////////////////////////////////////////////// TEST(DOMAirPressure, Construction) { sdf::AirPressure air; sdf::Noise defaultNoise; EXPECT_EQ(defaultNoise, air.PressureNoise()); EXPECT_DOUBLE_EQ(0.0, air.ReferenceAltitude()); } ///////////////////////////////////////////////// TEST(DOMAirPressure, Set) { sdf::AirPressure air; sdf::Noise defaultNoise, noise; EXPECT_EQ(defaultNoise, air.PressureNoise()); EXPECT_DOUBLE_EQ(0.0, air.ReferenceAltitude()); noise.SetType(sdf::NoiseType::GAUSSIAN); noise.SetMean(1.2); noise.SetStdDev(2.3); noise.SetBiasMean(4.5); noise.SetBiasStdDev(6.7); noise.SetPrecision(8.9); air.SetPressureNoise(noise); EXPECT_EQ(noise, air.PressureNoise()); air.SetReferenceAltitude(10.2); EXPECT_DOUBLE_EQ(10.2, air.ReferenceAltitude()); // Copy Constructor sdf::AirPressure air2(air); EXPECT_EQ(air, air2); // Copy operator sdf::AirPressure air3; air3 = air; EXPECT_EQ(air, air3); // Move Constructor sdf::AirPressure air4(std::move(air)); EXPECT_EQ(air2, air4); air = air4; EXPECT_EQ(air2, air); // Move operator sdf::AirPressure air5; air5 = std::move(air2); EXPECT_EQ(air3, air5); // inequality sdf::AirPressure air6; EXPECT_NE(air3, air6); } ///////////////////////////////////////////////// TEST(DOMAirPressure, Load) { sdf::ElementPtr sdf(std::make_shared<sdf::Element>()); // No <noise> element sdf::AirPressure air; sdf::Errors errors = air.Load(sdf); EXPECT_FALSE(errors.empty()); EXPECT_TRUE(errors[0].Message().find("is not a <air_pressure>") != std::string::npos) << errors[0].Message(); EXPECT_NE(nullptr, air.Element()); EXPECT_EQ(sdf.get(), air.Element().get()); // The AirPressure::Load function is test more thouroughly in the // link_dom.cc integration test. } ///////////////////////////////////////////////// TEST(DOMAirPressure, ToElement) { // test calling ToElement on a DOM object constructed without calling Load sdf::AirPressure air; sdf::Noise noise; air.SetReferenceAltitude(10.2); noise.SetType(sdf::NoiseType::GAUSSIAN); noise.SetMean(1.2); noise.SetStdDev(2.3); noise.SetBiasMean(4.5); noise.SetBiasStdDev(6.7); noise.SetPrecision(8.9); air.SetPressureNoise(noise); sdf::ElementPtr airElem = air.ToElement(); EXPECT_NE(nullptr, airElem); EXPECT_EQ(nullptr, air.Element()); // verify values after loading the element back sdf::AirPressure air2; air2.Load(airElem); EXPECT_DOUBLE_EQ(noise.Mean(), air2.PressureNoise().Mean()); EXPECT_DOUBLE_EQ(noise.StdDev(), air2.PressureNoise().StdDev()); EXPECT_DOUBLE_EQ(noise.BiasMean(), air2.PressureNoise().BiasMean()); EXPECT_DOUBLE_EQ(noise.BiasStdDev(), air2.PressureNoise().BiasStdDev()); EXPECT_DOUBLE_EQ(noise.Precision(), air2.PressureNoise().Precision()); EXPECT_DOUBLE_EQ(10.2, air2.ReferenceAltitude()); // make changes to DOM and verify ToElement produces updated values air2.SetReferenceAltitude(111); sdf::ElementPtr air2Elem = air2.ToElement(); EXPECT_NE(nullptr, air2Elem); sdf::AirPressure air3; air3.Load(air2Elem); EXPECT_DOUBLE_EQ(111.0, air3.ReferenceAltitude()); }
; --COPYRIGHT--,BSD_EX ; Copyright (c) 2012, Texas Instruments Incorporated ; 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 Texas Instruments Incorporated 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 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. ; ; ****************************************************************************** ; ; MSP430 CODE EXAMPLE DISCLAIMER ; ; MSP430 code examples are self-contained low-level programs that typically ; demonstrate a single peripheral function or device feature in a highly ; concise manner. For this the code may rely on the device's power-on default ; register values and settings such as the clock configuration and care must ; be taken when combining code from several examples to avoid potential side ; effects. Also see www.ti.com/grace for a GUI- and www.ti.com/msp430ware ; for an API functional library-approach to peripheral configuration. ; ; --/COPYRIGHT-- ;******************************************************************************* ; MSP430G2xx3 Demo - Timer_A, Toggle P1.0, CCR0 Cont. Mode ISR, DCO SMCLK ; ; Description: Toggle P1.0 using software and TA_0 ISR. Toggles every ; 50000 SMCLK cycles. SMCLK provides clock source for TACLK. ; During the TA_0 ISR, P1.0 is toggled and 50000 clock cycles are added to ; CCR0. TA_0 ISR is triggered every 50000 cycles. CPU is normally off and ; used only during TA_ISR. ; ACLK = n/a, MCLK = SMCLK = TACLK = default DCO ; ; MSP430G2xx3 ; ----------------- ; /|\| XIN|- ; | | | ; --|RST XOUT|- ; | | ; | P1.0|-->LED ; ; D. Dang ; Texas Instruments Inc. ; December 2010 ; Built with Code Composer Essentials Version: 4.2.0 ;******************************************************************************* .cdecls C,LIST, "msp430.h" ;------------------------------------------------------------------------------ .text ; Program Start ;------------------------------------------------------------------------------ RESET mov.w #0280h,SP ; Initialize stackpointer StopWDT mov.w #WDTPW+WDTHOLD,&WDTCTL ; Stop WDT SetupP1 bis.b #001h,&P1DIR ; P1.0 output SetupC0 mov.w #CCIE,&CCTL0 ; CCR0 interrupt enabled mov.w #50000,&CCR0 ; SetupTA mov.w #TASSEL_2+MC_2,&TACTL ; SMCLK, contmode ; Mainloop bis.w #CPUOFF+GIE,SR ; CPU off, interrupts enabled nop ; Required only for debugger ; ;------------------------------------------------------------------------------- TA0_ISR; Toggle P1.0 ;------------------------------------------------------------------------------- xor.b #001h,&P1OUT ; Toggle P1.0 add.w #50000,&CCR0 ; Add Offset to CCR0 reti ; ; ;------------------------------------------------------------------------------ ; Interrupt Vectors ;------------------------------------------------------------------------------ .sect ".reset" ; MSP430 RESET Vector .short RESET ; .sect ".int09" ; Timer_A0 Vector .short TA0_ISR ; .end
; A038846: 4-fold convolution of A000302 (powers of 4); expansion of 1/(1-4*x)^4. ; 1,16,160,1280,8960,57344,344064,1966080,10813440,57671680,299892736,1526726656,7633633280,37580963840,182536110080,876173328384,4161823309824,19585050869760,91396904058880,423311976693760,1947235092791296,8901646138474496 mov $1,2 add $1,$0 add $1,1 add $0,$1 bin $1,3 lpb $0,1 sub $0,1 mul $1,2 lpe sub $1,8 div $1,8 add $1,1
; AVX mpn_xor_n ; ; Copyright 2017 Jens Nurmann ; ; This file is part of the MPIR Library. ; The MPIR 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 2.1 of the License, or (at ; your option) any later version. ; The MPIR Library is distributed in the hope that it will be useful, but ; WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public ; License for more details. ; You should have received a copy of the GNU Lesser General Public License ; along with the MPIR Library; see the file COPYING.LIB. If not, write ; to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, ; Boston, MA 02110-1301, USA. ; (rdi,rcx) = (rsi,rcx) xor (rdx,rcx) ; There is no initial pointer alignment lead in code below. The argument ; why not is based on some statistical reasoning and measurement points. ; All statements below strictly refer to the Intel i6xxx (Skylake) ; microarchitecture. ; The function is intended to be used with arbitrary pointer alignment on ; entry. That is there are 8 possible cases to consider: ; - A: 1 x all pointers mis-aligned (mod 32 byte) ; - B: 3 x one pointer aligned (mod 32 byte)) ; - C: 3 x two pointers aligned (mod 32 byte) ; - D: 1 x all pointers aligned (mod 32 byte) ; All sub cases under B show equivalent performance, as do all sub cases of ; C. B is 7% faster than A, C is 11% faster than A and D is 39% faster than A. ; To do a proper alignment would require a complex decision tree to allways ; advance the alignment situation in the best possible manner - e.g. pointer ; 1 is off by 8 while pointer 2 & 3 are off by 16. To do the alignment ; requires some arith and at least one branch in the function proloque - a ; reasonable impact for small sized operands. And all this for a small gain ; (around 6% all summed up) in the average case. ; In a specific application scenario this might be the wrong choice. ; The execution speed of VMOVDQU is equivalent to VMOVDQA in case of aligned ; pointers. This may be different for earlier generations of Intel core ; architectures like Broadwell, Haswell, ... ; cycles per limb with all operands aligned and in: ; LD1$ LD2$ ; Haswell ??? ??? ; Broadwell ??? ??? ; Skylake 0.29-0.31 0.39-0.40 %include 'yasm_mac.inc' ; definition according to Linux 64 bit ABI %define ResP RCX %define Src1P RDX %define Src2P R8 %define Size R9 %define SizeD R9D %define Count RAX %define CountD EAX %define Limb0 R10 %define Limb0D R10D %define QLimb0 YMM0 align 32 BITS 64 LEAF_PROC mpn_xor_n mov CountD, 3 mov Limb0, Size sub Count, Size jnc .PostGPR ; dispatch size 0-3 immediately mov SizeD, 3 shr Limb0, 2 or Count, -4 sub Size, Limb0 jnc .PostAVX ; dispatch size 4, 8 & 12 immediately mov Limb0D, 128 .Loop: vmovdqu QLimb0, [Src1P] vpxor QLimb0, QLimb0, [Src2P] vmovdqu [ResP], QLimb0 vmovdqu QLimb0, [Src1P+32] vpxor QLimb0, QLimb0, [Src2P+32] vmovdqu [ResP+32], QLimb0 vmovdqu QLimb0, [Src1P+64] vpxor QLimb0, QLimb0, [Src2P+64] vmovdqu [ResP+64], QLimb0 vmovdqu QLimb0, [Src1P+96] vpxor QLimb0, QLimb0, [Src2P+96] vmovdqu [ResP+96], QLimb0 lea Src1P, [Src1P+Limb0] lea Src2P, [Src2P+Limb0] lea ResP, [ResP+Limb0] add Size, 4 jnc .Loop .PostAVX: mov Limb0D, 0 ; to allow pointer correction on exit cmp Size, 2 ; fastest way to dispatch values 0-3 ja .PostAVX0 je .PostAVX1 jp .PostAVX2 .PostAVX3: add Limb0, 32 vmovdqu QLimb0, [Src1P+64] vpxor QLimb0, QLimb0, [Src2P+64] vmovdqu [ResP+64], QLimb0 .PostAVX2: add Limb0, 32 vmovdqu QLimb0, [Src1P+32] vpxor QLimb0, QLimb0, [Src2P+32] vmovdqu [ResP+32], QLimb0 .PostAVX1: add Limb0, 32 vmovdqu QLimb0, [Src1P] vpxor QLimb0, QLimb0, [Src2P] vmovdqu [ResP], QLimb0 .PostAVX0: add Src1P, Limb0 add Src2P, Limb0 add ResP, Limb0 add Count, 4 .PostGPR: cmp Count, 2 ; fastest way to dispatch values 0-3 ja .Exit je .PostGPR1 jp .PostGPR2 .PostGPR3: mov Limb0, [Src1P+16] xor Limb0, [Src2P+16] mov [ResP+16], Limb0 .PostGPR2: mov Limb0, [Src1P+8] xor Limb0, [Src2P+8] mov [ResP+8], Limb0 .PostGPR1: mov Limb0, [Src1P] xor Limb0, [Src2P] mov [ResP], Limb0 .Exit: ret
; A010536: Decimal expansion of square root of 85. ; 9,2,1,9,5,4,4,4,5,7,2,9,2,8,8,7,3,1,0,0,0,2,2,7,4,2,8,1,7,6,2,7,9,3,1,5,7,2,4,6,8,0,5,0,4,8,7,2,2,4,6,4,0,0,8,0,0,7,7,5,2,2,0,5,4,4,2,6,7,1,0,2,6,8,0,1,8,7,5,4,6,0,7,6,7,8,9,4,0,9,0,7,9,3,2,8,0,5,6,4 mov $1,1 mov $2,1 mov $3,$0 add $3,8 mov $4,$0 add $4,3 mul $4,2 mov $7,10 pow $7,$4 mov $9,10 lpb $3 mov $4,$2 pow $4,2 mul $4,85 mov $5,$1 pow $5,2 add $4,$5 mov $6,$1 mov $1,$4 mul $6,$2 mul $6,2 mov $2,$6 mov $8,$4 div $8,$7 max $8,2 div $1,$8 div $2,$8 sub $3,1 lpe mov $3,$9 pow $3,$0 div $2,$3 div $1,$2 mod $1,$9 mov $0,$1
#include "spike/simif.h" #include "spike/processor.h" #include "spike/disasm.h" class CustomSpike : public simif_t { public: CustomSpike(const char* isa_string, const char* elf_file, size_t memory_sz); ~CustomSpike(); char* addr_to_mem(reg_t addr); bool mmio_load(reg_t addr, size_t len, uint8_t* bytes); bool mmio_store(reg_t addr, size_t len, const uint8_t* bytes); void proc_reset(unsigned id) { /* do nothing */ } VerificationPacket step(VerificationPacket synchronization_packet); void dump_state(); private: processor_t proc; char* data; size_t data_sz; uint32_t tandem_mmio_inst; // used for mmio_load reg_t tandem_mmio_data; // used for mmio_load // output a trace of mmio loads and stores bool trace_mmio; };
// // Created by Raffaele Montella on 30/10/2018. // #ifndef SIGNALK_SERVER_CPP_STRING_HPP #define SIGNALK_SERVER_CPP_STRING_HPP #include <string> #include <random> #include <sstream> namespace Utils { class String { public: static bool endsWith(std::string const &fullString, std::string const &ending); static std::string replace(std::string subject, const std::string& search, const std::string& replace); static std::string generate_hex(const unsigned int len); private: static unsigned char random_char(); }; } #endif //SIGNALK_SERVER_CPP_STRING_HPP
.global s_prepare_buffers s_prepare_buffers: push %r12 push %r14 push %r15 push %rbx push %rcx push %rdi push %rdx push %rsi lea addresses_WT_ht+0x14546, %rsi lea addresses_D_ht+0x3d50, %rdi nop nop nop nop and $37320, %r12 mov $9, %rcx rep movsq nop nop nop nop and %rdx, %rdx lea addresses_UC_ht+0x119d0, %rsi lea addresses_UC_ht+0x1c050, %rdi nop nop nop nop nop add %rbx, %rbx mov $95, %rcx rep movsw nop nop add %rsi, %rsi lea addresses_normal_ht+0x18b3e, %rsi lea addresses_WT_ht+0x1811e, %rdi nop sub $1786, %r14 mov $26, %rcx rep movsw nop nop nop nop xor $52378, %rcx lea addresses_normal_ht+0x19d1e, %rsi lea addresses_UC_ht+0xb050, %rdi nop nop xor $30342, %r15 mov $110, %rcx rep movsb nop cmp $43691, %rsi lea addresses_WT_ht+0x5d50, %rcx nop nop nop nop nop sub $15076, %rdx mov $0x6162636465666768, %rbx movq %rbx, %xmm5 vmovups %ymm5, (%rcx) nop nop nop nop xor %rbx, %rbx lea addresses_UC_ht+0x3d0, %r14 nop nop nop nop nop and $29276, %rdi movw $0x6162, (%r14) nop nop nop xor %r15, %r15 pop %rsi pop %rdx pop %rdi pop %rcx pop %rbx pop %r15 pop %r14 pop %r12 ret .global s_faulty_load s_faulty_load: push %r13 push %r15 push %r9 push %rcx push %rdx push %rsi // Store lea addresses_normal+0x6c50, %r9 nop xor $36597, %rdx mov $0x5152535455565758, %rcx movq %rcx, %xmm1 movups %xmm1, (%r9) nop nop nop add $33676, %rsi // Faulty Load lea addresses_UC+0x14d50, %r15 nop nop nop nop xor %rdx, %rdx vmovups (%r15), %ymm1 vextracti128 $1, %ymm1, %xmm1 vpextrq $1, %xmm1, %rsi lea oracles, %r15 and $0xff, %rsi shlq $12, %rsi mov (%r15,%rsi,1), %rsi pop %rsi pop %rdx pop %rcx pop %r9 pop %r15 pop %r13 ret /* <gen_faulty_load> [REF] {'src': {'NT': True, 'AVXalign': False, 'size': 16, 'congruent': 0, 'same': False, 'type': 'addresses_UC'}, 'OP': 'LOAD'} {'dst': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 8, 'same': False, 'type': 'addresses_normal'}, 'OP': 'STOR'} [Faulty Load] {'src': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 0, 'same': True, 'type': 'addresses_UC'}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'congruent': 0, 'same': False, 'type': 'addresses_WT_ht'}, 'dst': {'congruent': 11, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'REPM'} {'src': {'congruent': 7, 'same': False, 'type': 'addresses_UC_ht'}, 'dst': {'congruent': 7, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'REPM'} {'src': {'congruent': 1, 'same': False, 'type': 'addresses_normal_ht'}, 'dst': {'congruent': 1, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'REPM'} {'src': {'congruent': 0, 'same': False, 'type': 'addresses_normal_ht'}, 'dst': {'congruent': 8, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'REPM'} {'dst': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 9, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'STOR'} {'dst': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 4, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'STOR'} {'37': 21829} 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 */
;-------------------------------------------------------- ; File Created by SDCC : free open source ANSI-C Compiler ; Version 4.1.6 #12555 (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 __muluchar EXTERN __muluchar_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_roundf ;-------------------------------------------------------- ; 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_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_atan2f 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 _neg_fastcall GLOBAL _neg 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_roundf ; --------------------------------- _m32_roundf: push ix ld ix,0 add ix,sp ld c, l ld b, h ld hl, -20 add hl, sp ld sp, hl ld hl,0 add hl, sp ld (ix-2),l ld (ix-1),h ld (hl), c inc hl ld (hl), b inc hl ld (hl), e inc hl ld (hl), d ld hl,0 add hl, sp ld (ix-16),l ld (ix-15),h push de push bc ld e,(ix-16) ld d,(ix-15) ld hl,20 add hl, sp ex de, hl ld bc,0x0004 ldir pop bc pop de ld a,(ix-4) ld (ix-14),a ld a,(ix-3) ld (ix-13),a ld a,(ix-2) ld (ix-12),a ld a,(ix-1) ld (ix-11),a xor a, a ld (ix-4),a ld (ix-3),a ld a,(ix-12) and a,0x80 ld (ix-2),a ld a,(ix-11) and a,0x7f ld (ix-1),a ld a,0x17 l_m32_roundf_00141: srl (ix-1) rr (ix-2) rr (ix-3) rr (ix-4) dec a jr NZ, l_m32_roundf_00141 ld l,(ix-3) ld a,(ix-4) add a,0x81 ld (ix-10),a ld a, l adc a,0xff ld (ix-9),a ld a,(ix-10) sub a,0x17 ld a,(ix-9) rla ccf rra sbc a,0x80 jp NC, l_m32_roundf_00112 bit 7,(ix-9) jr Z,l_m32_roundf_00106 ld bc,0x0000 ld e,0x00 ld a,(ix-11) and a,0x80 ld d, a ld a,(ix-10) and a,(ix-9) inc a jp NZ,l_m32_roundf_00113 set 7, e ld a, d or a,0x3f ld d, a jp l_m32_roundf_00113 l_m32_roundf_00106: ld (ix-4),0xff ld (ix-3),0xff ld (ix-2),0x7f xor a, a ld (ix-1),a inc a jr l_m32_roundf_00146 l_m32_roundf_00145: sra (ix-1) rr (ix-2) rr (ix-3) rr (ix-4) l_m32_roundf_00146: dec a jr NZ, l_m32_roundf_00145 ld l,(ix-4) ld h,(ix-3) ld (ix-8),l ld (ix-7),h xor a, a ld (ix-6),a ld (ix-5),a ld a,(ix-14) and a,(ix-8) ld (ix-4),a ld a,(ix-13) and a,(ix-7) ld (ix-3),a ld a,(ix-12) and a,(ix-6) ld (ix-2),a ld a,(ix-11) and a,(ix-5) ld (ix-1),a or a,(ix-2) or a,(ix-3) or a,(ix-4) jr NZ,l_m32_roundf_00104 ld l, c ld h, b jp l_m32_roundf_00114 l_m32_roundf_00104: ld a,(ix-10) push af ld bc,0x0000 ld de,0x0040 pop af inc a jr l_m32_roundf_00148 l_m32_roundf_00147: sra d rr e rr b rr c l_m32_roundf_00148: dec a jr NZ, l_m32_roundf_00147 ld a, c add a,(ix-14) ld c, a ld a, b adc a,(ix-13) ld b, a ld a, e adc a,(ix-12) ld e, a ld a, d adc a,(ix-11) ld d, a ld a, l cpl ld l, a ld a, h cpl ld (ix-4),l ld (ix-3),a xor a, a ld (ix-2),a ld (ix-1),a ld a, c and a,(ix-4) ld c, a ld a, b and a,(ix-3) ld b, a ld a, e and a,(ix-2) ld e, a ld a, d and a,(ix-1) ld d, a jr l_m32_roundf_00113 l_m32_roundf_00112: ld a,(ix-10) sub a,0x80 or a,(ix-9) jr NZ,l_m32_roundf_00109 push de push bc push de push bc call ___fsadd_callee jr l_m32_roundf_00114 l_m32_roundf_00109: ld l, c ld h, b jr l_m32_roundf_00114 l_m32_roundf_00113: ld l,(ix-16) ld h,(ix-15) ld (hl), c inc hl ld (hl), b inc hl ld (hl), e inc hl ld (hl), d ld hl,0 add hl, sp ld c, (hl) inc hl ld b, (hl) inc hl ld e, (hl) inc hl ld d, (hl) ld l, c ld h, b l_m32_roundf_00114: ld sp, ix pop ix ret SECTION IGNORE
/* * NAppGUI Cross-platform C SDK * 2015-2022 Francisco Garcia Collado * MIT Licence * https://nappgui.com/en/legal/license.html * * File: setst.hxx * https://nappgui.com/en/core/setst.html * */ /* Set macros for type checking at compile time */ #define SetStDebug(type)\ struct NodeSt##type\ {\ uint32_t rb;\ struct NodeSt##type *left;\ struct NodeSt##type *right;\ type data;\ };\ \ struct Set##St##type\ {\ uint32_t elems;\ uint16_t esize;\ uint16_t ksize;\ struct NodeSt##type *root;\ FPtr_compare func_compare;\ } #define SetStFuncs(type)\ SetSt(type);\ \ static __TYPECHECK SetSt(type)* setst_##type##_create(int(func_compare)(const type*, const type*), const uint16_t esize);\ static SetSt(type)* setst_##type##_create(int(func_compare)(const type*, const type*), const uint16_t esize)\ {\ return (SetSt(type)*)rbtree_create((FPtr_compare)func_compare, esize, 0, (const char_t*)(SETST#type));\ }\ \ static __TYPECHECK void setst_##type##_destroy(struct Set##St##type **set, void(func_remove)(type*));\ static void setst_##type##_destroy(struct Set##St##type **set, void(func_remove)(type*))\ {\ rbtree_destroy((RBTree**)set, (FPtr_remove)func_remove, NULL, (const char_t*)(SETST#type));\ }\ \ static __TYPECHECK uint32_t setst_##type##_size(const struct Set##St##type *set);\ static uint32_t setst_##type##_size(const struct Set##St##type *set)\ {\ return rbtree_size((const RBTree*)set);\ }\ \ static __TYPECHECK type *setst_##type##_get(struct Set##St##type *set, const type *key);\ static type *setst_##type##_get(struct Set##St##type *set, const type *key)\ {\ return (type*)rbtree_get((RBTree*)set, (const void*)key, FALSE);\ }\ \ static __TYPECHECK const type *setst_##type##_get_const(const struct Set##St##type *set, const type *key);\ static const type *setst_##type##_get_const(const struct Set##St##type *set, const type *key)\ {\ return (const type*)rbtree_get((RBTree*)set, (const void*)key, FALSE);\ }\ \ static __TYPECHECK type *setst_##type##_insert(struct Set##St##type *set, const type *key);\ static type *setst_##type##_insert(struct Set##St##type *set, const type *key)\ {\ return (type*)rbtree_insert((RBTree*)set, (const void*)key, NULL);\ }\ \ static __TYPECHECK bool_t setst_##type##_delete(struct Set##St##type *set, const type *key, void(func_remove)(type*));\ static bool_t setst_##type##_delete(struct Set##St##type *set, const type *key, void(func_remove)(type*))\ {\ return rbtree_delete((RBTree*)set, (const void*)key, (FPtr_remove)func_remove, NULL);\ }\ \ static __TYPECHECK type *setst_##type##_first(struct Set##St##type *set);\ static type *setst_##type##_first(struct Set##St##type *set)\ {\ return (type*)rbtree_first((RBTree*)set);\ }\ \ static __TYPECHECK const type *setst_##type##_first_const(const struct Set##St##type *set);\ static const type *setst_##type##_first_const(const struct Set##St##type *set)\ {\ return (const type*)rbtree_first((RBTree*)set);\ }\ \ static __TYPECHECK type *setst_##type##_last(struct Set##St##type *set);\ static type *setst_##type##_last(struct Set##St##type *set)\ {\ return (type*)rbtree_last((RBTree*)set);\ }\ \ static __TYPECHECK const type *setst_##type##_last_const(const struct Set##St##type *set);\ static const type *setst_##type##_last_const(const struct Set##St##type *set)\ {\ return (const type*)rbtree_last((RBTree*)set);\ }\ \ static __TYPECHECK type *setst_##type##_next(struct Set##St##type *set);\ static type *setst_##type##_next(struct Set##St##type *set)\ {\ return (type*)rbtree_next((RBTree*)set);\ }\ \ static __TYPECHECK const type *setst_##type##_next_const(const struct Set##St##type *set);\ static const type *setst_##type##_next_const(const struct Set##St##type *set)\ {\ return (const type*)rbtree_next((RBTree*)set);\ }\ \ static __TYPECHECK type *setst_##type##_prev(struct Set##St##type *set);\ static type *setst_##type##_prev(struct Set##St##type *set)\ {\ return (type*)rbtree_prev((RBTree*)set);\ }\ \ static __TYPECHECK const type *setst_##type##_prev_const(const struct Set##St##type *set);\ static const type *setst_##type##_prev_const(const struct Set##St##type *set)\ {\ return (const type*)rbtree_prev((RBTree*)set);\ }\ \ __INLINE void setst_##type##_end(void)\
// // Created by fanghr on 2020/5/10. // #include "fsm_test.h" namespace { class StateMachine : public fsm::FSM<StateMachine> { friend class FSM; public: enum States { kInit, kExit, kError }; struct Event {}; struct Reset {}; private: #pragma clang diagnostic push #pragma ide diagnostic ignored "HidingNonVirtualFunction" template<class EventType> StateType NoTransition(const EventType &) { return kError; } template<> StateType NoTransition<Reset>(const Reset &) { return kInit; } #pragma clang diagnostic pop private: using TransitionTable = Table<BasicRow<kInit, Event, kExit>>; }; } #pragma clang diagnostic push #pragma ide diagnostic ignored "cert-err58-cpp" TEST_F(FSMTestSuite, TestNoTrans) { StateMachine machine{}; EXPECT_EQ(machine.CurrentState(), StateMachine::kInit); machine(StateMachine::Reset{}); EXPECT_EQ(machine.CurrentState(), StateMachine::kInit); machine(StateMachine::Event{}); EXPECT_EQ(machine.CurrentState(), StateMachine::kExit); machine(StateMachine::Reset{}); EXPECT_EQ(machine.CurrentState(), StateMachine::kInit); machine(StateMachine::Event{}); EXPECT_EQ(machine.CurrentState(), StateMachine::kExit); machine(StateMachine::Event{}); EXPECT_EQ(machine.CurrentState(), StateMachine::kError); } #pragma clang diagnostic pop
XLIB w_pixeladdress INCLUDE "graphics/grafix.inc" ;XREF base_graphics XREF _vdcDispMem ; ; $Id: w_pixladdr.asm,v 1.2 2012/09/20 21:13:15 stefano Exp $ ; ; ****************************************************************** ; ; Get absolute pixel address in map of virtual (x,y) coordinate. ; ; in: hl,de = (x,y) coordinate of pixel ; ; out: hl=de = address of pixel byte ; a = bit number of byte where pixel is to be placed ; fz = 1 if bit number is 0 of pixel position ; ; registers changed after return: ; ......hl/ixiy same ; afbcde../.... different ; .w_pixeladdress ld b,h ld c,l ;calc (y * 80) + (x / 8) + bit map start ld a,l ;save y low byte for odd/even test srl d ;y = y/2 rr e ;calc (y * 80) + (x / 8) + bit map start ld l,e ;hl = y ld h,d add hl,hl ;hl = y * 16 add hl,hl add hl,hl add hl,hl ld d,h ld e,l add hl,hl ;hl = y*64 add hl,hl add hl,de ;hl = (y * 64)+(y * 16) ld e,c ;de = x ld d,b srl d ;de = x / 8 rr e srl d rr e srl d rr e add hl,de ;hl = (y * 80) + (x / 8) ld de,(_vdcDispMem) add hl,de ;hl = (y * 80) + (x / 8) + bit map offset and 01h ;test bit 0 to determine odd/even jr nz,isodd ;if y odd then ld de,05370h ; de = odd field offset of 21360 bytes add hl,de ; hl = hl+21360 isodd: ld a,c ;a = x low byte and 07h ;a = x mod 8 ;ld d,0 ;de = x mod 8 ;ld e,a ld d,h ld e,l xor 7 ret
// Fill out your copyright notice in the Description page of Project Settings. #include "BotAIController.h" #include "Bot.h" #include "StarterProjectCharacter.h" #include "BehaviorTree/BehaviorTree.h" #include "BehaviorTree/BehaviorTreeComponent.h" #include "BehaviorTree/BlackboardComponent.h" #include "BehaviorTree/Blackboard/BlackboardKeyType_Bool.h" #include "BehaviorTree/Blackboard/BlackboardKeyType_Object.h" #include "SpatialNetDriver.h" #include "Connection/SpatialWorkerConnection.h" #include "BotGameState.h" ABotAIController::ABotAIController() { BlackboardComp = CreateDefaultSubobject<UBlackboardComponent>(TEXT("BlackBoardComp")); BrainComponent = BehaviorComp = CreateDefaultSubobject<UBehaviorTreeComponent>(TEXT("BehaviorComp")); bWantsPlayerState = true; } void ABotAIController::Possess(APawn* InPawn) { Super::Possess(InPawn); ABot* Bot = Cast<ABot>(InPawn); // start behavior if (Bot && Bot->BotBehavior) { if (Bot->BotBehavior->BlackboardAsset) { BlackboardComp->InitializeBlackboard(*Bot->BotBehavior->BlackboardAsset); } EnemyKeyID = BlackboardComp->GetKeyID("Enemy"); BehaviorComp->StartTree(*(Bot->BotBehavior)); } } void ABotAIController::UnPossess() { Super::UnPossess(); BehaviorComp->StopTree(); } void ABotAIController::BeginInactiveState() { Super::BeginInactiveState(); } void ABotAIController::FindClosestEnemy() { APawn* MyBot = GetPawn(); if (MyBot == NULL) { return; } const FVector MyLoc = MyBot->GetActorLocation(); float BestDistSq = MAX_FLT; AStarterProjectCharacter* BestPawn = NULL; for (FConstPawnIterator It = GetWorld()->GetPawnIterator(); It; ++It) { AStarterProjectCharacter* TestPawn = Cast<AStarterProjectCharacter>(*It); if (TestPawn != nullptr) { const float DistSq = (TestPawn->GetActorLocation() - MyLoc).SizeSquared(); if (DistSq < BestDistSq) { BestDistSq = DistSq; BestPawn = TestPawn; } } } if (BestPawn) { SetEnemy(BestPawn); } } bool ABotAIController::FindClosestEnemyWithLOS(APawn* ExcludeEnemy) { bool bGotEnemy = false; APawn* MyBot = GetPawn(); if (MyBot != NULL) { const FVector MyLoc = MyBot->GetActorLocation(); float BestDistSq = MAX_FLT; AStarterProjectCharacter* BestPawn = NULL; for (FConstPawnIterator It = GetWorld()->GetPawnIterator(); It; ++It) { AStarterProjectCharacter* TestPawn = Cast<AStarterProjectCharacter>(*It); if (TestPawn && TestPawn != ExcludeEnemy ) { if (HasWeaponLOSToEnemy(TestPawn, true) == true) { const float DistSq = (TestPawn->GetActorLocation() - MyLoc).SizeSquared(); if (DistSq < BestDistSq) { BestDistSq = DistSq; BestPawn = TestPawn; } } } } if (BestPawn) { SetEnemy(BestPawn); bGotEnemy = true; } } return bGotEnemy; } bool ABotAIController::HasWeaponLOSToEnemy(AActor* InEnemyActor, const bool bAnyEnemy) const { ABot* MyBot = Cast<ABot>(GetPawn()); bool bHasLOS = false; // Perform trace to retrieve hit info FCollisionQueryParams TraceParams(SCENE_QUERY_STAT(AIWeaponLosTrace), true, GetPawn()); TraceParams.bTraceAsyncScene = true; TraceParams.bReturnPhysicalMaterial = true; FVector StartLocation = MyBot->GetActorLocation(); StartLocation.Z += GetPawn()->BaseEyeHeight; //look from eyes FHitResult Hit(ForceInit); const FVector EndLocation = InEnemyActor->GetActorLocation(); GetWorld()->LineTraceSingleByChannel(Hit, StartLocation, EndLocation, ECC_GameTraceChannel1, TraceParams); if (Hit.bBlockingHit == true) { // Theres a blocking hit - check if its our enemy actor AActor* HitActor = Hit.GetActor(); if (Hit.GetActor() != NULL) { if (HitActor == InEnemyActor) { bHasLOS = true; } else if (bAnyEnemy == true) { // Its not our actor, maybe its still an enemy ? ACharacter* HitChar = Cast<ACharacter>(HitActor); if (HitChar != NULL) { bHasLOS = true; } } } } return bHasLOS; } void ABotAIController::ShootEnemy() { if (HasAuthority()) { ABot* MyBot = Cast<ABot>(GetPawn()); bool bCanShoot = false; APawn* Enemy = GetEnemy(); if (Enemy != nullptr) { if (LineOfSightTo(Enemy, MyBot->GetActorLocation())) { bCanShoot = true; } } if (bCanShoot) { //MyBot->StartWeaponFire(); MyBot->ServerThrowGrenade(); } } } void ABotAIController::SetEnemy(class APawn* InPawn) { if (BlackboardComp) { BlackboardComp->SetValue<UBlackboardKeyType_Object>(EnemyKeyID, InPawn); SetFocus(InPawn); } } class APawn* ABotAIController::GetEnemy() const { if (BlackboardComp) { return Cast<APawn>(BlackboardComp->GetValue<UBlackboardKeyType_Object>(EnemyKeyID)); } return NULL; } void ABotAIController::UpdateControlRotation(float DeltaTime, bool bUpdatePawn) { // Look toward focus FVector FocalPoint = GetFocalPoint(); if (!FocalPoint.IsZero() && GetPawn()) { FVector Direction = FocalPoint - GetPawn()->GetActorLocation(); FRotator NewControlRotation = Direction.Rotation(); NewControlRotation.Yaw = FRotator::ClampAxis(NewControlRotation.Yaw); SetControlRotation(NewControlRotation); APawn* const P = GetPawn(); if (P && bUpdatePawn) { P->FaceRotation(NewControlRotation, DeltaTime); } } } void ABotAIController::GameHasEnded(AActor* EndGameFocus, bool bIsWinner) { // Stop the behaviour tree/logic BehaviorComp->StopTree(); // Stop any movement we already have StopMovement(); // Clear any enemy SetEnemy(NULL); } FString ABotAIController::GetDefaultPlayerName() { //if (USpatialNetDriver* SpatialNetDriver = Cast<USpatialNetDriver>(GetNetDriver())) //{ // return SpatialNetDriver->Connection->GetWorkerId(); //} return "Bot" + FGuid::NewGuid().ToString() + GetName(); } // Called when the game starts or when spawned void ABotAIController::BeginPlay() { Super::BeginPlay(); if (HasAuthority()) { //if (ABotGameState* GS = GetWorld()->GetGameState<ABotGameState>()) //{ // GS->RegesterPlayer(GetDefaultPlayerName()); //} } }
; ; ZX Spectrum specific routines ; by Stefano Bodrato, 14/09/2006 ; ; int zx_kempstonmouse(); ; ; The result is: ; - 1 (true) if a Kempston mouse is present ; - 0 (false) otherwise ; ; $Id: zx_kempstonmouse.asm,v 1.3 2016-06-10 20:02:05 dom Exp $ ; SECTION code_clib PUBLIC zx_kempstonmouse PUBLIC _zx_kempstonmouse zx_kempstonmouse: _zx_kempstonmouse: ld hl,0 ld de,65535 loop: ld bc,64223 in a,(c) cp 255 ret nz dec de ld a,d or e jr nz,loop inc hl ret
; A176972: a(n) = 7^n + 7*n + 1. ; 2,15,64,365,2430,16843,117692,823593,5764858,40353671,282475320,1977326821,13841287286,96889010499,678223072948,4747561510049,33232930569714,232630513987327,1628413597910576,11398895185373277 mov $1,$0 mul $1,6 mov $2,7 pow $2,$0 add $0,$2 add $0,4 sub $1,3 add $1,$0
#include "Option.h" char *Option::trainPath = NULL; char *Option::testPath = NULL; char *Option::resultPath = NULL; int Option::buildTensorFile; int Option::solverType; int Option::tensorOrder; int Option::cacheSize; int Option::rankSize; int Option::threadSize; int Option::iterationSize; int Option::gridSize; double Option::lambda; static struct option long_options[] = { {"train-path", required_argument, 0, TRAIN_PATH}, {"test-path", required_argument, 0, TEST_PATH}, {"result-path", required_argument, 0, RESULT_PATH}, {"build-on-memory", no_argument, &Option::buildTensorFile, BUILD_ON_MEMORY}, {"build-on-disk", no_argument, &Option::buildTensorFile, BUILD_ON_DISK}, {"no-build", no_argument, &Option::buildTensorFile, NO_BUILD}, {"cd-solver", no_argument, &Option::solverType, CD_SOLVER}, {"nn-solver", no_argument, &Option::solverType, NN_SOLVER}, {"tensor-order", required_argument, 0, TENSOR_ORDER}, {"cache-size", required_argument, 0, CACHE_SIZE}, {"rank-size", required_argument, 0, RANK_SIZE}, {"thread-size", required_argument, 0, THREAD_SIZE}, {"iteration-size", required_argument, 0, ITERATION_SIZE}, {"grid-size", required_argument, 0, GRID_SIZE}, {"lambda", required_argument, 0, LAMBDA}, {0, 0, 0, 0} }; bool Option::parse(const int argc, char **argv) { int opt; Option::trainPath = NULL; Option::testPath = NULL; Option::resultPath = NULL; Option::buildTensorFile = BUILD_ON_MEMORY; Option::solverType = CD_SOLVER; Option::tensorOrder = 0; Option::cacheSize = 1000000; Option::rankSize = 10; Option::threadSize = 1; Option::iterationSize = 10; Option::gridSize = 1; Option::lambda = 0.01; int option_index = 0; while(1) { opt = getopt_long(argc, argv, "", long_options, &option_index); if (-1 == opt) break; switch (opt) { case TRAIN_PATH: Option::trainPath = optarg; break; case TEST_PATH: Option::testPath = optarg; break; case RESULT_PATH: Option::resultPath = optarg; break; case TENSOR_ORDER: Option::tensorOrder = atoi(optarg); break; case CACHE_SIZE: Option::cacheSize = atoi(optarg); break; case RANK_SIZE: Option::rankSize = atoi(optarg); break; case THREAD_SIZE: Option::threadSize = atoi(optarg); break; case ITERATION_SIZE: Option::iterationSize = atoi(optarg); break; case GRID_SIZE: Option::gridSize = atoi(optarg); break; case LAMBDA: Option::lambda = atof(optarg); break; } } return true; }
; load DH sectors to ES:BX from drive DL disk_load: push dx ; Store DX on stack so latter we can recall ; how many sectors were request to be read, ; even if it is altered in the meantime mov ah, 0x02 ; BIOS read sector function mov al, dh ; READ DH sectors mov ch, 0x00 ; Select cylinder 0 mov dh, 0x00 ; Select head 0 mov cl, 0x02 ; Start reading from second sector (i.e. ; after the boot sector) int 0x13 ; BIOS interrupt jc disk_error ; Jump if error (i.e. carry flag set) pop dx ; Restore DX from the stack cmp dh, al ; if AL (sectors read) != DH (sectors expected) jne disk_error2 ; display erroe message ret disk_error: mov bx, DISK_ERROR_MSG call print_string jmp $ disk_error2: mov bx, DISK_ERROR_MSG2 call print_string jmp $ ; Variables DISK_ERROR_MSG db "Disk read error1!", 0 DISK_ERROR_MSG2 db "Disk read error2!", 0
; int wa_stack_empty(wa_stack_t *s) SECTION code_clib SECTION code_adt_wa_stack PUBLIC wa_stack_empty EXTERN asm_wa_stack_empty defc wa_stack_empty = asm_wa_stack_empty
;------------------------------------------------------------------------------ ; ; Copyright (c) 2015 - 2017, 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: ; ; MpFuncs.nasm ; ; Abstract: ; ; This is the assembly code for MP support ; ;------------------------------------------------------------------------------- %include "MpEqu.inc" extern ASM_PFX(InitializeFloatingPointUnits) DEFAULT REL SECTION .text ;------------------------------------------------------------------------------------- ;RendezvousFunnelProc procedure follows. All APs execute their procedure. This ;procedure serializes all the AP processors through an Init sequence. It must be ;noted that APs arrive here very raw...ie: real mode, no stack. ;ALSO THIS PROCEDURE IS EXECUTED BY APs ONLY ON 16 BIT MODE. HENCE THIS PROC ;IS IN MACHINE CODE. ;------------------------------------------------------------------------------------- global ASM_PFX(RendezvousFunnelProc) ASM_PFX(RendezvousFunnelProc): RendezvousFunnelProcStart: ; At this point CS = 0x(vv00) and ip= 0x0. ; Save BIST information to ebp firstly BITS 16 mov ebp, eax ; Save BIST information mov ax, cs mov ds, ax mov es, ax mov ss, ax xor ax, ax mov fs, ax mov gs, ax mov si, BufferStartLocation mov ebx, [si] mov di, ModeOffsetLocation mov eax, [di] mov di, CodeSegmentLocation mov edx, [di] mov di, ax sub di, 02h mov [di],dx ; Patch long mode CS sub di, 04h add eax, ebx mov [di],eax ; Patch address mov si, GdtrLocation o32 lgdt [cs:si] mov si, IdtrLocation o32 lidt [cs:si] mov si, EnableExecuteDisableLocation cmp byte [si], 0 jz SkipEnableExecuteDisableBit ; ; Enable execute disable bit ; mov ecx, 0c0000080h ; EFER MSR number rdmsr ; Read EFER bts eax, 11 ; Enable Execute Disable Bit wrmsr ; Write EFER SkipEnableExecuteDisableBit: mov di, DataSegmentLocation mov edi, [di] ; Save long mode DS in edi mov si, Cr3Location ; Save CR3 in ecx mov ecx, [si] xor ax, ax mov ds, ax ; Clear data segment mov eax, cr0 ; Get control register 0 or eax, 000000003h ; Set PE bit (bit #0) & MP mov cr0, eax mov eax, cr4 bts eax, 5 mov cr4, eax mov cr3, ecx ; Load CR3 mov ecx, 0c0000080h ; EFER MSR number rdmsr ; Read EFER bts eax, 8 ; Set LME=1 wrmsr ; Write EFER mov eax, cr0 ; Read CR0 bts eax, 31 ; Set PG=1 mov cr0, eax ; Write CR0 jmp 0:strict dword 0 ; far jump to long mode BITS 64 LongModeStart: mov eax, edi mov ds, ax mov es, ax mov ss, ax mov esi, ebx lea edi, [esi + InitFlagLocation] cmp qword [edi], 1 ; ApInitConfig jnz GetApicId ; Increment the number of APs executing here as early as possible ; This is decremented in C code when AP is finished executing mov edi, esi add edi, NumApsExecutingLocation lock inc dword [edi] ; AP init mov edi, esi add edi, LockLocation mov rax, NotVacantFlag TestLock: xchg qword [edi], rax cmp rax, NotVacantFlag jz TestLock lea ecx, [esi + ApIndexLocation] inc dword [ecx] mov ebx, [ecx] Releaselock: mov rax, VacantFlag xchg qword [edi], rax ; program stack mov edi, esi add edi, StackSizeLocation mov eax, dword [edi] mov ecx, ebx inc ecx mul ecx ; EAX = StackSize * (CpuNumber + 1) mov edi, esi add edi, StackStartAddressLocation add rax, qword [edi] mov rsp, rax jmp CProcedureInvoke GetApicId: mov eax, 0 cpuid cmp eax, 0bh jb NoX2Apic ; CPUID level below CPUID_EXTENDED_TOPOLOGY mov eax, 0bh xor ecx, ecx cpuid test ebx, 0ffffh jz NoX2Apic ; CPUID.0BH:EBX[15:0] is zero ; Processor is x2APIC capable; 32-bit x2APIC ID is already in EDX jmp GetProcessorNumber NoX2Apic: ; Processor is not x2APIC capable, so get 8-bit APIC ID mov eax, 1 cpuid shr ebx, 24 mov edx, ebx GetProcessorNumber: ; ; Get processor number for this AP ; Note that BSP may become an AP due to SwitchBsp() ; xor ebx, ebx lea eax, [esi + CpuInfoLocation] mov edi, [eax] GetNextProcNumber: cmp dword [edi], edx ; APIC ID match? jz ProgramStack add edi, 20 inc ebx jmp GetNextProcNumber ProgramStack: mov rsp, qword [edi + 12] CProcedureInvoke: push rbp ; Push BIST data at top of AP stack xor rbp, rbp ; Clear ebp for call stack trace push rbp mov rbp, rsp mov rax, qword [esi + InitializeFloatingPointUnitsAddress] sub rsp, 20h call rax ; Call assembly function to initialize FPU per UEFI spec add rsp, 20h mov edx, ebx ; edx is ApIndex mov ecx, esi add ecx, LockLocation ; rcx is address of exchange info data buffer mov edi, esi add edi, ApProcedureLocation mov rax, qword [edi] sub rsp, 20h call rax ; Invoke C function add rsp, 20h jmp $ ; Should never reach here RendezvousFunnelProcEnd: ;------------------------------------------------------------------------------------- ; AsmRelocateApLoop (MwaitSupport, ApTargetCState, PmCodeSegment, TopOfApStack, CountTofinish); ;------------------------------------------------------------------------------------- global ASM_PFX(AsmRelocateApLoop) ASM_PFX(AsmRelocateApLoop): AsmRelocateApLoopStart: mov rax, [rsp + 40] ; CountTofinish lock dec dword [rax] ; (*CountTofinish)-- mov rsp, r9 push rcx push rdx lea rsi, [PmEntry] ; rsi <- The start address of transition code push r8 push rsi DB 0x48 retf BITS 32 PmEntry: mov eax, cr0 btr eax, 31 ; Clear CR0.PG mov cr0, eax ; Disable paging and caches mov ebx, edx ; Save EntryPoint to rbx, for rdmsr will overwrite rdx mov ecx, 0xc0000080 rdmsr and ah, ~ 1 ; Clear LME wrmsr mov eax, cr4 and al, ~ (1 << 5) ; Clear PAE mov cr4, eax pop edx add esp, 4 pop ecx, add esp, 4 cmp cl, 1 ; Check mwait-monitor support jnz HltLoop mov ebx, edx ; Save C-State to ebx MwaitLoop: mov eax, esp ; Set Monitor Address xor ecx, ecx ; ecx = 0 xor edx, edx ; edx = 0 monitor mov eax, ebx ; Mwait Cx, Target C-State per eax[7:4] shl eax, 4 mwait jmp MwaitLoop HltLoop: cli hlt jmp HltLoop BITS 64 AsmRelocateApLoopEnd: ;------------------------------------------------------------------------------------- ; AsmGetAddressMap (&AddressMap); ;------------------------------------------------------------------------------------- global ASM_PFX(AsmGetAddressMap) ASM_PFX(AsmGetAddressMap): lea rax, [ASM_PFX(RendezvousFunnelProc)] mov qword [rcx], rax mov qword [rcx + 8h], LongModeStart - RendezvousFunnelProcStart mov qword [rcx + 10h], RendezvousFunnelProcEnd - RendezvousFunnelProcStart lea rax, [ASM_PFX(AsmRelocateApLoop)] mov qword [rcx + 18h], rax mov qword [rcx + 20h], AsmRelocateApLoopEnd - AsmRelocateApLoopStart ret ;------------------------------------------------------------------------------------- ;AsmExchangeRole procedure follows. This procedure executed by current BSP, that is ;about to become an AP. It switches its stack with the current AP. ;AsmExchangeRole (IN CPU_EXCHANGE_INFO *MyInfo, IN CPU_EXCHANGE_INFO *OthersInfo); ;------------------------------------------------------------------------------------- global ASM_PFX(AsmExchangeRole) ASM_PFX(AsmExchangeRole): ; DO NOT call other functions in this function, since 2 CPU may use 1 stack ; at the same time. If 1 CPU try to call a function, stack will be corrupted. push rax push rbx push rcx push rdx push rsi push rdi push rbp push r8 push r9 push r10 push r11 push r12 push r13 push r14 push r15 mov rax, cr0 push rax mov rax, cr4 push rax ; rsi contains MyInfo pointer mov rsi, rcx ; rdi contains OthersInfo pointer mov rdi, rdx ;Store EFLAGS, GDTR and IDTR regiter to stack pushfq sgdt [rsi + 16] sidt [rsi + 26] ; Store the its StackPointer mov [rsi + 8], rsp ; update its switch state to STORED mov byte [rsi], CPU_SWITCH_STATE_STORED WaitForOtherStored: ; wait until the other CPU finish storing its state cmp byte [rdi], CPU_SWITCH_STATE_STORED jz OtherStored pause jmp WaitForOtherStored OtherStored: ; Since another CPU already stored its state, load them ; load GDTR value lgdt [rdi + 16] ; load IDTR value lidt [rdi + 26] ; load its future StackPointer mov rsp, [rdi + 8] ; update the other CPU's switch state to LOADED mov byte [rdi], CPU_SWITCH_STATE_LOADED WaitForOtherLoaded: ; wait until the other CPU finish loading new state, ; otherwise the data in stack may corrupt cmp byte [rsi], CPU_SWITCH_STATE_LOADED jz OtherLoaded pause jmp WaitForOtherLoaded OtherLoaded: ; since the other CPU already get the data it want, leave this procedure popfq pop rax mov cr4, rax pop rax mov cr0, rax pop r15 pop r14 pop r13 pop r12 pop r11 pop r10 pop r9 pop r8 pop rbp pop rdi pop rsi pop rdx pop rcx pop rbx pop rax ret
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)+ 03FE98 move.l D0, ($c8,A6) [enemy+ 8, enemy+ A] 03FE9C move.l D0, D2 [enemy+C8, enemy+CA] 041464 jmp $120e.l 041470 move.b #$1, ($a0,A6) [enemy+C8] 041560 clr.b ($c8,A6) 041564 tst.b ($24,A6) 04FDEA clr.w ($c8,A6) 04FDEE lea ($bc,A6), A0 04FE56 subq.w #1, ($c8,A6) 04FE5A bcc $4fe68 [enemy+C8] 04FE5C move.w #$12c, ($c8,A6) 04FE62 move.b #$1, ($502,A5) [enemy+C8] 05860A move.w ($6a,A6), ($c8,A6) 058610 moveq #$f, D0 [enemy+C8] 058AE0 move.w ($c8,A6), D0 058AE4 move.w ($6c,A6), D1 [enemy+C8] 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
; A100162: Structured disdyakis dodecahedral numbers (vertex structure 7). ; 1,26,117,316,665,1206,1981,3032,4401,6130,8261,10836,13897,17486,21645,26416,31841,37962,44821,52460,60921,70246,80477,91656,103825,117026,131301,146692,163241,180990,199981,220256,241857,264826,289205,315036,342361,371222,401661,433720,467441,502866,540037,578996,619785,662446,707021,753552,802081,852650,905301,960076,1017017,1076166,1137565,1201256,1267281,1335682,1406501,1479780,1555561,1633886,1714797,1798336,1884545,1973466,2065141,2159612,2256921,2357110,2460221,2566296,2675377,2787506,2902725,3021076,3142601,3267342,3395341,3526640,3661281,3799306,3940757,4085676,4234105,4386086,4541661,4700872,4863761,5030370,5200741,5374916,5552937,5734846,5920685,6110496,6304321,6502202,6704181,6910300 add $0,1 mov $1,1 sub $1,$0 sub $0,$1 pow $0,3 pow $1,3 add $0,$1
_cat: file format elf32-i386 Disassembly of section .text: 00000000 <cat>: char buf[512]; void cat(int fd) { 0: 55 push %ebp 1: 89 e5 mov %esp,%ebp 3: 83 ec 28 sub $0x28,%esp int n; while((n = read(fd, buf, sizeof(buf))) > 0) 6: eb 1b jmp 23 <cat+0x23> write(1, buf, n); 8: 8b 45 f4 mov -0xc(%ebp),%eax b: 89 44 24 08 mov %eax,0x8(%esp) f: c7 44 24 04 e0 0b 00 movl $0xbe0,0x4(%esp) 16: 00 17: c7 04 24 01 00 00 00 movl $0x1,(%esp) 1e: e8 82 03 00 00 call 3a5 <write> void cat(int fd) { int n; while((n = read(fd, buf, sizeof(buf))) > 0) 23: c7 44 24 08 00 02 00 movl $0x200,0x8(%esp) 2a: 00 2b: c7 44 24 04 e0 0b 00 movl $0xbe0,0x4(%esp) 32: 00 33: 8b 45 08 mov 0x8(%ebp),%eax 36: 89 04 24 mov %eax,(%esp) 39: e8 5f 03 00 00 call 39d <read> 3e: 89 45 f4 mov %eax,-0xc(%ebp) 41: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 45: 7f c1 jg 8 <cat+0x8> write(1, buf, n); if(n < 0){ 47: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 4b: 79 19 jns 66 <cat+0x66> printf(1, "cat: read error\n"); 4d: c7 44 24 04 19 09 00 movl $0x919,0x4(%esp) 54: 00 55: c7 04 24 01 00 00 00 movl $0x1,(%esp) 5c: e8 ec 04 00 00 call 54d <printf> exit(); 61: e8 1f 03 00 00 call 385 <exit> } } 66: c9 leave 67: c3 ret 00000068 <main>: int main(int argc, char *argv[]) { 68: 55 push %ebp 69: 89 e5 mov %esp,%ebp 6b: 83 e4 f0 and $0xfffffff0,%esp 6e: 83 ec 20 sub $0x20,%esp int fd, i; if(argc <= 1){ 71: 83 7d 08 01 cmpl $0x1,0x8(%ebp) 75: 7f 11 jg 88 <main+0x20> cat(0); 77: c7 04 24 00 00 00 00 movl $0x0,(%esp) 7e: e8 7d ff ff ff call 0 <cat> exit(); 83: e8 fd 02 00 00 call 385 <exit> } for(i = 1; i < argc; i++){ 88: c7 44 24 1c 01 00 00 movl $0x1,0x1c(%esp) 8f: 00 90: eb 79 jmp 10b <main+0xa3> if((fd = open(argv[i], 0)) < 0){ 92: 8b 44 24 1c mov 0x1c(%esp),%eax 96: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx 9d: 8b 45 0c mov 0xc(%ebp),%eax a0: 01 d0 add %edx,%eax a2: 8b 00 mov (%eax),%eax a4: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) ab: 00 ac: 89 04 24 mov %eax,(%esp) af: e8 11 03 00 00 call 3c5 <open> b4: 89 44 24 18 mov %eax,0x18(%esp) b8: 83 7c 24 18 00 cmpl $0x0,0x18(%esp) bd: 79 2f jns ee <main+0x86> printf(1, "cat: cannot open %s\n", argv[i]); bf: 8b 44 24 1c mov 0x1c(%esp),%eax c3: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx ca: 8b 45 0c mov 0xc(%ebp),%eax cd: 01 d0 add %edx,%eax cf: 8b 00 mov (%eax),%eax d1: 89 44 24 08 mov %eax,0x8(%esp) d5: c7 44 24 04 2a 09 00 movl $0x92a,0x4(%esp) dc: 00 dd: c7 04 24 01 00 00 00 movl $0x1,(%esp) e4: e8 64 04 00 00 call 54d <printf> exit(); e9: e8 97 02 00 00 call 385 <exit> } cat(fd); ee: 8b 44 24 18 mov 0x18(%esp),%eax f2: 89 04 24 mov %eax,(%esp) f5: e8 06 ff ff ff call 0 <cat> close(fd); fa: 8b 44 24 18 mov 0x18(%esp),%eax fe: 89 04 24 mov %eax,(%esp) 101: e8 a7 02 00 00 call 3ad <close> if(argc <= 1){ cat(0); exit(); } for(i = 1; i < argc; i++){ 106: 83 44 24 1c 01 addl $0x1,0x1c(%esp) 10b: 8b 44 24 1c mov 0x1c(%esp),%eax 10f: 3b 45 08 cmp 0x8(%ebp),%eax 112: 0f 8c 7a ff ff ff jl 92 <main+0x2a> exit(); } cat(fd); close(fd); } exit(); 118: e8 68 02 00 00 call 385 <exit> 0000011d <stosb>: "cc"); } static inline void stosb(void *addr, int data, int cnt) { 11d: 55 push %ebp 11e: 89 e5 mov %esp,%ebp 120: 57 push %edi 121: 53 push %ebx asm volatile("cld; rep stosb" : 122: 8b 4d 08 mov 0x8(%ebp),%ecx 125: 8b 55 10 mov 0x10(%ebp),%edx 128: 8b 45 0c mov 0xc(%ebp),%eax 12b: 89 cb mov %ecx,%ebx 12d: 89 df mov %ebx,%edi 12f: 89 d1 mov %edx,%ecx 131: fc cld 132: f3 aa rep stos %al,%es:(%edi) 134: 89 ca mov %ecx,%edx 136: 89 fb mov %edi,%ebx 138: 89 5d 08 mov %ebx,0x8(%ebp) 13b: 89 55 10 mov %edx,0x10(%ebp) "=D" (addr), "=c" (cnt) : "0" (addr), "1" (cnt), "a" (data) : "memory", "cc"); } 13e: 5b pop %ebx 13f: 5f pop %edi 140: 5d pop %ebp 141: c3 ret 00000142 <strcpy>: #include "user.h" #include "x86.h" char* strcpy(char *s, char *t) { 142: 55 push %ebp 143: 89 e5 mov %esp,%ebp 145: 83 ec 10 sub $0x10,%esp char *os; os = s; 148: 8b 45 08 mov 0x8(%ebp),%eax 14b: 89 45 fc mov %eax,-0x4(%ebp) while((*s++ = *t++) != 0) 14e: 90 nop 14f: 8b 45 08 mov 0x8(%ebp),%eax 152: 8d 50 01 lea 0x1(%eax),%edx 155: 89 55 08 mov %edx,0x8(%ebp) 158: 8b 55 0c mov 0xc(%ebp),%edx 15b: 8d 4a 01 lea 0x1(%edx),%ecx 15e: 89 4d 0c mov %ecx,0xc(%ebp) 161: 0f b6 12 movzbl (%edx),%edx 164: 88 10 mov %dl,(%eax) 166: 0f b6 00 movzbl (%eax),%eax 169: 84 c0 test %al,%al 16b: 75 e2 jne 14f <strcpy+0xd> ; return os; 16d: 8b 45 fc mov -0x4(%ebp),%eax } 170: c9 leave 171: c3 ret 00000172 <strcmp>: int strcmp(const char *p, const char *q) { 172: 55 push %ebp 173: 89 e5 mov %esp,%ebp while(*p && *p == *q) 175: eb 08 jmp 17f <strcmp+0xd> p++, q++; 177: 83 45 08 01 addl $0x1,0x8(%ebp) 17b: 83 45 0c 01 addl $0x1,0xc(%ebp) } int strcmp(const char *p, const char *q) { while(*p && *p == *q) 17f: 8b 45 08 mov 0x8(%ebp),%eax 182: 0f b6 00 movzbl (%eax),%eax 185: 84 c0 test %al,%al 187: 74 10 je 199 <strcmp+0x27> 189: 8b 45 08 mov 0x8(%ebp),%eax 18c: 0f b6 10 movzbl (%eax),%edx 18f: 8b 45 0c mov 0xc(%ebp),%eax 192: 0f b6 00 movzbl (%eax),%eax 195: 38 c2 cmp %al,%dl 197: 74 de je 177 <strcmp+0x5> p++, q++; return (uchar)*p - (uchar)*q; 199: 8b 45 08 mov 0x8(%ebp),%eax 19c: 0f b6 00 movzbl (%eax),%eax 19f: 0f b6 d0 movzbl %al,%edx 1a2: 8b 45 0c mov 0xc(%ebp),%eax 1a5: 0f b6 00 movzbl (%eax),%eax 1a8: 0f b6 c0 movzbl %al,%eax 1ab: 29 c2 sub %eax,%edx 1ad: 89 d0 mov %edx,%eax } 1af: 5d pop %ebp 1b0: c3 ret 000001b1 <strlen>: uint strlen(char *s) { 1b1: 55 push %ebp 1b2: 89 e5 mov %esp,%ebp 1b4: 83 ec 10 sub $0x10,%esp int n; for(n = 0; s[n]; n++) 1b7: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp) 1be: eb 04 jmp 1c4 <strlen+0x13> 1c0: 83 45 fc 01 addl $0x1,-0x4(%ebp) 1c4: 8b 55 fc mov -0x4(%ebp),%edx 1c7: 8b 45 08 mov 0x8(%ebp),%eax 1ca: 01 d0 add %edx,%eax 1cc: 0f b6 00 movzbl (%eax),%eax 1cf: 84 c0 test %al,%al 1d1: 75 ed jne 1c0 <strlen+0xf> ; return n; 1d3: 8b 45 fc mov -0x4(%ebp),%eax } 1d6: c9 leave 1d7: c3 ret 000001d8 <memset>: void* memset(void *dst, int c, uint n) { 1d8: 55 push %ebp 1d9: 89 e5 mov %esp,%ebp 1db: 83 ec 0c sub $0xc,%esp stosb(dst, c, n); 1de: 8b 45 10 mov 0x10(%ebp),%eax 1e1: 89 44 24 08 mov %eax,0x8(%esp) 1e5: 8b 45 0c mov 0xc(%ebp),%eax 1e8: 89 44 24 04 mov %eax,0x4(%esp) 1ec: 8b 45 08 mov 0x8(%ebp),%eax 1ef: 89 04 24 mov %eax,(%esp) 1f2: e8 26 ff ff ff call 11d <stosb> return dst; 1f7: 8b 45 08 mov 0x8(%ebp),%eax } 1fa: c9 leave 1fb: c3 ret 000001fc <strchr>: char* strchr(const char *s, char c) { 1fc: 55 push %ebp 1fd: 89 e5 mov %esp,%ebp 1ff: 83 ec 04 sub $0x4,%esp 202: 8b 45 0c mov 0xc(%ebp),%eax 205: 88 45 fc mov %al,-0x4(%ebp) for(; *s; s++) 208: eb 14 jmp 21e <strchr+0x22> if(*s == c) 20a: 8b 45 08 mov 0x8(%ebp),%eax 20d: 0f b6 00 movzbl (%eax),%eax 210: 3a 45 fc cmp -0x4(%ebp),%al 213: 75 05 jne 21a <strchr+0x1e> return (char*)s; 215: 8b 45 08 mov 0x8(%ebp),%eax 218: eb 13 jmp 22d <strchr+0x31> } char* strchr(const char *s, char c) { for(; *s; s++) 21a: 83 45 08 01 addl $0x1,0x8(%ebp) 21e: 8b 45 08 mov 0x8(%ebp),%eax 221: 0f b6 00 movzbl (%eax),%eax 224: 84 c0 test %al,%al 226: 75 e2 jne 20a <strchr+0xe> if(*s == c) return (char*)s; return 0; 228: b8 00 00 00 00 mov $0x0,%eax } 22d: c9 leave 22e: c3 ret 0000022f <gets>: char* gets(char *buf, int max) { 22f: 55 push %ebp 230: 89 e5 mov %esp,%ebp 232: 83 ec 28 sub $0x28,%esp int i, cc; char c; for(i=0; i+1 < max; ){ 235: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 23c: eb 4c jmp 28a <gets+0x5b> cc = read(0, &c, 1); 23e: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) 245: 00 246: 8d 45 ef lea -0x11(%ebp),%eax 249: 89 44 24 04 mov %eax,0x4(%esp) 24d: c7 04 24 00 00 00 00 movl $0x0,(%esp) 254: e8 44 01 00 00 call 39d <read> 259: 89 45 f0 mov %eax,-0x10(%ebp) if(cc < 1) 25c: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 260: 7f 02 jg 264 <gets+0x35> break; 262: eb 31 jmp 295 <gets+0x66> buf[i++] = c; 264: 8b 45 f4 mov -0xc(%ebp),%eax 267: 8d 50 01 lea 0x1(%eax),%edx 26a: 89 55 f4 mov %edx,-0xc(%ebp) 26d: 89 c2 mov %eax,%edx 26f: 8b 45 08 mov 0x8(%ebp),%eax 272: 01 c2 add %eax,%edx 274: 0f b6 45 ef movzbl -0x11(%ebp),%eax 278: 88 02 mov %al,(%edx) if(c == '\n' || c == '\r') 27a: 0f b6 45 ef movzbl -0x11(%ebp),%eax 27e: 3c 0a cmp $0xa,%al 280: 74 13 je 295 <gets+0x66> 282: 0f b6 45 ef movzbl -0x11(%ebp),%eax 286: 3c 0d cmp $0xd,%al 288: 74 0b je 295 <gets+0x66> gets(char *buf, int max) { int i, cc; char c; for(i=0; i+1 < max; ){ 28a: 8b 45 f4 mov -0xc(%ebp),%eax 28d: 83 c0 01 add $0x1,%eax 290: 3b 45 0c cmp 0xc(%ebp),%eax 293: 7c a9 jl 23e <gets+0xf> break; buf[i++] = c; if(c == '\n' || c == '\r') break; } buf[i] = '\0'; 295: 8b 55 f4 mov -0xc(%ebp),%edx 298: 8b 45 08 mov 0x8(%ebp),%eax 29b: 01 d0 add %edx,%eax 29d: c6 00 00 movb $0x0,(%eax) return buf; 2a0: 8b 45 08 mov 0x8(%ebp),%eax } 2a3: c9 leave 2a4: c3 ret 000002a5 <stat>: int stat(char *n, struct stat *st) { 2a5: 55 push %ebp 2a6: 89 e5 mov %esp,%ebp 2a8: 83 ec 28 sub $0x28,%esp int fd; int r; fd = open(n, O_RDONLY); 2ab: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) 2b2: 00 2b3: 8b 45 08 mov 0x8(%ebp),%eax 2b6: 89 04 24 mov %eax,(%esp) 2b9: e8 07 01 00 00 call 3c5 <open> 2be: 89 45 f4 mov %eax,-0xc(%ebp) if(fd < 0) 2c1: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 2c5: 79 07 jns 2ce <stat+0x29> return -1; 2c7: b8 ff ff ff ff mov $0xffffffff,%eax 2cc: eb 23 jmp 2f1 <stat+0x4c> r = fstat(fd, st); 2ce: 8b 45 0c mov 0xc(%ebp),%eax 2d1: 89 44 24 04 mov %eax,0x4(%esp) 2d5: 8b 45 f4 mov -0xc(%ebp),%eax 2d8: 89 04 24 mov %eax,(%esp) 2db: e8 fd 00 00 00 call 3dd <fstat> 2e0: 89 45 f0 mov %eax,-0x10(%ebp) close(fd); 2e3: 8b 45 f4 mov -0xc(%ebp),%eax 2e6: 89 04 24 mov %eax,(%esp) 2e9: e8 bf 00 00 00 call 3ad <close> return r; 2ee: 8b 45 f0 mov -0x10(%ebp),%eax } 2f1: c9 leave 2f2: c3 ret 000002f3 <atoi>: int atoi(const char *s) { 2f3: 55 push %ebp 2f4: 89 e5 mov %esp,%ebp 2f6: 83 ec 10 sub $0x10,%esp int n; n = 0; 2f9: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp) while('0' <= *s && *s <= '9') 300: eb 25 jmp 327 <atoi+0x34> n = n*10 + *s++ - '0'; 302: 8b 55 fc mov -0x4(%ebp),%edx 305: 89 d0 mov %edx,%eax 307: c1 e0 02 shl $0x2,%eax 30a: 01 d0 add %edx,%eax 30c: 01 c0 add %eax,%eax 30e: 89 c1 mov %eax,%ecx 310: 8b 45 08 mov 0x8(%ebp),%eax 313: 8d 50 01 lea 0x1(%eax),%edx 316: 89 55 08 mov %edx,0x8(%ebp) 319: 0f b6 00 movzbl (%eax),%eax 31c: 0f be c0 movsbl %al,%eax 31f: 01 c8 add %ecx,%eax 321: 83 e8 30 sub $0x30,%eax 324: 89 45 fc mov %eax,-0x4(%ebp) atoi(const char *s) { int n; n = 0; while('0' <= *s && *s <= '9') 327: 8b 45 08 mov 0x8(%ebp),%eax 32a: 0f b6 00 movzbl (%eax),%eax 32d: 3c 2f cmp $0x2f,%al 32f: 7e 0a jle 33b <atoi+0x48> 331: 8b 45 08 mov 0x8(%ebp),%eax 334: 0f b6 00 movzbl (%eax),%eax 337: 3c 39 cmp $0x39,%al 339: 7e c7 jle 302 <atoi+0xf> n = n*10 + *s++ - '0'; return n; 33b: 8b 45 fc mov -0x4(%ebp),%eax } 33e: c9 leave 33f: c3 ret 00000340 <memmove>: void* memmove(void *vdst, void *vsrc, int n) { 340: 55 push %ebp 341: 89 e5 mov %esp,%ebp 343: 83 ec 10 sub $0x10,%esp char *dst, *src; dst = vdst; 346: 8b 45 08 mov 0x8(%ebp),%eax 349: 89 45 fc mov %eax,-0x4(%ebp) src = vsrc; 34c: 8b 45 0c mov 0xc(%ebp),%eax 34f: 89 45 f8 mov %eax,-0x8(%ebp) while(n-- > 0) 352: eb 17 jmp 36b <memmove+0x2b> *dst++ = *src++; 354: 8b 45 fc mov -0x4(%ebp),%eax 357: 8d 50 01 lea 0x1(%eax),%edx 35a: 89 55 fc mov %edx,-0x4(%ebp) 35d: 8b 55 f8 mov -0x8(%ebp),%edx 360: 8d 4a 01 lea 0x1(%edx),%ecx 363: 89 4d f8 mov %ecx,-0x8(%ebp) 366: 0f b6 12 movzbl (%edx),%edx 369: 88 10 mov %dl,(%eax) { char *dst, *src; dst = vdst; src = vsrc; while(n-- > 0) 36b: 8b 45 10 mov 0x10(%ebp),%eax 36e: 8d 50 ff lea -0x1(%eax),%edx 371: 89 55 10 mov %edx,0x10(%ebp) 374: 85 c0 test %eax,%eax 376: 7f dc jg 354 <memmove+0x14> *dst++ = *src++; return vdst; 378: 8b 45 08 mov 0x8(%ebp),%eax } 37b: c9 leave 37c: c3 ret 0000037d <fork>: name: \ movl $SYS_ ## name, %eax; \ int $T_SYSCALL; \ ret SYSCALL(fork) 37d: b8 01 00 00 00 mov $0x1,%eax 382: cd 40 int $0x40 384: c3 ret 00000385 <exit>: SYSCALL(exit) 385: b8 02 00 00 00 mov $0x2,%eax 38a: cd 40 int $0x40 38c: c3 ret 0000038d <wait>: SYSCALL(wait) 38d: b8 03 00 00 00 mov $0x3,%eax 392: cd 40 int $0x40 394: c3 ret 00000395 <pipe>: SYSCALL(pipe) 395: b8 04 00 00 00 mov $0x4,%eax 39a: cd 40 int $0x40 39c: c3 ret 0000039d <read>: SYSCALL(read) 39d: b8 05 00 00 00 mov $0x5,%eax 3a2: cd 40 int $0x40 3a4: c3 ret 000003a5 <write>: SYSCALL(write) 3a5: b8 10 00 00 00 mov $0x10,%eax 3aa: cd 40 int $0x40 3ac: c3 ret 000003ad <close>: SYSCALL(close) 3ad: b8 15 00 00 00 mov $0x15,%eax 3b2: cd 40 int $0x40 3b4: c3 ret 000003b5 <kill>: SYSCALL(kill) 3b5: b8 06 00 00 00 mov $0x6,%eax 3ba: cd 40 int $0x40 3bc: c3 ret 000003bd <exec>: SYSCALL(exec) 3bd: b8 07 00 00 00 mov $0x7,%eax 3c2: cd 40 int $0x40 3c4: c3 ret 000003c5 <open>: SYSCALL(open) 3c5: b8 0f 00 00 00 mov $0xf,%eax 3ca: cd 40 int $0x40 3cc: c3 ret 000003cd <mknod>: SYSCALL(mknod) 3cd: b8 11 00 00 00 mov $0x11,%eax 3d2: cd 40 int $0x40 3d4: c3 ret 000003d5 <unlink>: SYSCALL(unlink) 3d5: b8 12 00 00 00 mov $0x12,%eax 3da: cd 40 int $0x40 3dc: c3 ret 000003dd <fstat>: SYSCALL(fstat) 3dd: b8 08 00 00 00 mov $0x8,%eax 3e2: cd 40 int $0x40 3e4: c3 ret 000003e5 <link>: SYSCALL(link) 3e5: b8 13 00 00 00 mov $0x13,%eax 3ea: cd 40 int $0x40 3ec: c3 ret 000003ed <mkdir>: SYSCALL(mkdir) 3ed: b8 14 00 00 00 mov $0x14,%eax 3f2: cd 40 int $0x40 3f4: c3 ret 000003f5 <chdir>: SYSCALL(chdir) 3f5: b8 09 00 00 00 mov $0x9,%eax 3fa: cd 40 int $0x40 3fc: c3 ret 000003fd <dup>: SYSCALL(dup) 3fd: b8 0a 00 00 00 mov $0xa,%eax 402: cd 40 int $0x40 404: c3 ret 00000405 <getpid>: SYSCALL(getpid) 405: b8 0b 00 00 00 mov $0xb,%eax 40a: cd 40 int $0x40 40c: c3 ret 0000040d <sbrk>: SYSCALL(sbrk) 40d: b8 0c 00 00 00 mov $0xc,%eax 412: cd 40 int $0x40 414: c3 ret 00000415 <sleep>: SYSCALL(sleep) 415: b8 0d 00 00 00 mov $0xd,%eax 41a: cd 40 int $0x40 41c: c3 ret 0000041d <uptime>: SYSCALL(uptime) 41d: b8 0e 00 00 00 mov $0xe,%eax 422: cd 40 int $0x40 424: c3 ret 00000425 <date>: SYSCALL(date) 425: b8 16 00 00 00 mov $0x16,%eax 42a: cd 40 int $0x40 42c: c3 ret 0000042d <timem>: SYSCALL(timem) 42d: b8 17 00 00 00 mov $0x17,%eax 432: cd 40 int $0x40 434: c3 ret 00000435 <getuid>: SYSCALL(getuid) 435: b8 18 00 00 00 mov $0x18,%eax 43a: cd 40 int $0x40 43c: c3 ret 0000043d <getgid>: SYSCALL(getgid) 43d: b8 19 00 00 00 mov $0x19,%eax 442: cd 40 int $0x40 444: c3 ret 00000445 <getppid>: SYSCALL(getppid) 445: b8 1a 00 00 00 mov $0x1a,%eax 44a: cd 40 int $0x40 44c: c3 ret 0000044d <setuid>: SYSCALL(setuid) 44d: b8 1b 00 00 00 mov $0x1b,%eax 452: cd 40 int $0x40 454: c3 ret 00000455 <setgid>: SYSCALL(setgid) 455: b8 1c 00 00 00 mov $0x1c,%eax 45a: cd 40 int $0x40 45c: c3 ret 0000045d <getprocs>: SYSCALL(getprocs) 45d: b8 1d 00 00 00 mov $0x1d,%eax 462: cd 40 int $0x40 464: c3 ret 00000465 <setpriority>: SYSCALL(setpriority) 465: b8 1e 00 00 00 mov $0x1e,%eax 46a: cd 40 int $0x40 46c: c3 ret 0000046d <putc>: #include "stat.h" #include "user.h" static void putc(int fd, char c) { 46d: 55 push %ebp 46e: 89 e5 mov %esp,%ebp 470: 83 ec 18 sub $0x18,%esp 473: 8b 45 0c mov 0xc(%ebp),%eax 476: 88 45 f4 mov %al,-0xc(%ebp) write(fd, &c, 1); 479: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) 480: 00 481: 8d 45 f4 lea -0xc(%ebp),%eax 484: 89 44 24 04 mov %eax,0x4(%esp) 488: 8b 45 08 mov 0x8(%ebp),%eax 48b: 89 04 24 mov %eax,(%esp) 48e: e8 12 ff ff ff call 3a5 <write> } 493: c9 leave 494: c3 ret 00000495 <printint>: static void printint(int fd, int xx, int base, int sgn) { 495: 55 push %ebp 496: 89 e5 mov %esp,%ebp 498: 56 push %esi 499: 53 push %ebx 49a: 83 ec 30 sub $0x30,%esp static char digits[] = "0123456789ABCDEF"; char buf[16]; int i, neg; uint x; neg = 0; 49d: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp) if(sgn && xx < 0){ 4a4: 83 7d 14 00 cmpl $0x0,0x14(%ebp) 4a8: 74 17 je 4c1 <printint+0x2c> 4aa: 83 7d 0c 00 cmpl $0x0,0xc(%ebp) 4ae: 79 11 jns 4c1 <printint+0x2c> neg = 1; 4b0: c7 45 f0 01 00 00 00 movl $0x1,-0x10(%ebp) x = -xx; 4b7: 8b 45 0c mov 0xc(%ebp),%eax 4ba: f7 d8 neg %eax 4bc: 89 45 ec mov %eax,-0x14(%ebp) 4bf: eb 06 jmp 4c7 <printint+0x32> } else { x = xx; 4c1: 8b 45 0c mov 0xc(%ebp),%eax 4c4: 89 45 ec mov %eax,-0x14(%ebp) } i = 0; 4c7: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) do{ buf[i++] = digits[x % base]; 4ce: 8b 4d f4 mov -0xc(%ebp),%ecx 4d1: 8d 41 01 lea 0x1(%ecx),%eax 4d4: 89 45 f4 mov %eax,-0xc(%ebp) 4d7: 8b 5d 10 mov 0x10(%ebp),%ebx 4da: 8b 45 ec mov -0x14(%ebp),%eax 4dd: ba 00 00 00 00 mov $0x0,%edx 4e2: f7 f3 div %ebx 4e4: 89 d0 mov %edx,%eax 4e6: 0f b6 80 ac 0b 00 00 movzbl 0xbac(%eax),%eax 4ed: 88 44 0d dc mov %al,-0x24(%ebp,%ecx,1) }while((x /= base) != 0); 4f1: 8b 75 10 mov 0x10(%ebp),%esi 4f4: 8b 45 ec mov -0x14(%ebp),%eax 4f7: ba 00 00 00 00 mov $0x0,%edx 4fc: f7 f6 div %esi 4fe: 89 45 ec mov %eax,-0x14(%ebp) 501: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 505: 75 c7 jne 4ce <printint+0x39> if(neg) 507: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 50b: 74 10 je 51d <printint+0x88> buf[i++] = '-'; 50d: 8b 45 f4 mov -0xc(%ebp),%eax 510: 8d 50 01 lea 0x1(%eax),%edx 513: 89 55 f4 mov %edx,-0xc(%ebp) 516: c6 44 05 dc 2d movb $0x2d,-0x24(%ebp,%eax,1) while(--i >= 0) 51b: eb 1f jmp 53c <printint+0xa7> 51d: eb 1d jmp 53c <printint+0xa7> putc(fd, buf[i]); 51f: 8d 55 dc lea -0x24(%ebp),%edx 522: 8b 45 f4 mov -0xc(%ebp),%eax 525: 01 d0 add %edx,%eax 527: 0f b6 00 movzbl (%eax),%eax 52a: 0f be c0 movsbl %al,%eax 52d: 89 44 24 04 mov %eax,0x4(%esp) 531: 8b 45 08 mov 0x8(%ebp),%eax 534: 89 04 24 mov %eax,(%esp) 537: e8 31 ff ff ff call 46d <putc> buf[i++] = digits[x % base]; }while((x /= base) != 0); if(neg) buf[i++] = '-'; while(--i >= 0) 53c: 83 6d f4 01 subl $0x1,-0xc(%ebp) 540: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 544: 79 d9 jns 51f <printint+0x8a> putc(fd, buf[i]); } 546: 83 c4 30 add $0x30,%esp 549: 5b pop %ebx 54a: 5e pop %esi 54b: 5d pop %ebp 54c: c3 ret 0000054d <printf>: // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, char *fmt, ...) { 54d: 55 push %ebp 54e: 89 e5 mov %esp,%ebp 550: 83 ec 38 sub $0x38,%esp char *s; int c, i, state; uint *ap; state = 0; 553: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp) ap = (uint*)(void*)&fmt + 1; 55a: 8d 45 0c lea 0xc(%ebp),%eax 55d: 83 c0 04 add $0x4,%eax 560: 89 45 e8 mov %eax,-0x18(%ebp) for(i = 0; fmt[i]; i++){ 563: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp) 56a: e9 7c 01 00 00 jmp 6eb <printf+0x19e> c = fmt[i] & 0xff; 56f: 8b 55 0c mov 0xc(%ebp),%edx 572: 8b 45 f0 mov -0x10(%ebp),%eax 575: 01 d0 add %edx,%eax 577: 0f b6 00 movzbl (%eax),%eax 57a: 0f be c0 movsbl %al,%eax 57d: 25 ff 00 00 00 and $0xff,%eax 582: 89 45 e4 mov %eax,-0x1c(%ebp) if(state == 0){ 585: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 589: 75 2c jne 5b7 <printf+0x6a> if(c == '%'){ 58b: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp) 58f: 75 0c jne 59d <printf+0x50> state = '%'; 591: c7 45 ec 25 00 00 00 movl $0x25,-0x14(%ebp) 598: e9 4a 01 00 00 jmp 6e7 <printf+0x19a> } else { putc(fd, c); 59d: 8b 45 e4 mov -0x1c(%ebp),%eax 5a0: 0f be c0 movsbl %al,%eax 5a3: 89 44 24 04 mov %eax,0x4(%esp) 5a7: 8b 45 08 mov 0x8(%ebp),%eax 5aa: 89 04 24 mov %eax,(%esp) 5ad: e8 bb fe ff ff call 46d <putc> 5b2: e9 30 01 00 00 jmp 6e7 <printf+0x19a> } } else if(state == '%'){ 5b7: 83 7d ec 25 cmpl $0x25,-0x14(%ebp) 5bb: 0f 85 26 01 00 00 jne 6e7 <printf+0x19a> if(c == 'd'){ 5c1: 83 7d e4 64 cmpl $0x64,-0x1c(%ebp) 5c5: 75 2d jne 5f4 <printf+0xa7> printint(fd, *ap, 10, 1); 5c7: 8b 45 e8 mov -0x18(%ebp),%eax 5ca: 8b 00 mov (%eax),%eax 5cc: c7 44 24 0c 01 00 00 movl $0x1,0xc(%esp) 5d3: 00 5d4: c7 44 24 08 0a 00 00 movl $0xa,0x8(%esp) 5db: 00 5dc: 89 44 24 04 mov %eax,0x4(%esp) 5e0: 8b 45 08 mov 0x8(%ebp),%eax 5e3: 89 04 24 mov %eax,(%esp) 5e6: e8 aa fe ff ff call 495 <printint> ap++; 5eb: 83 45 e8 04 addl $0x4,-0x18(%ebp) 5ef: e9 ec 00 00 00 jmp 6e0 <printf+0x193> } else if(c == 'x' || c == 'p'){ 5f4: 83 7d e4 78 cmpl $0x78,-0x1c(%ebp) 5f8: 74 06 je 600 <printf+0xb3> 5fa: 83 7d e4 70 cmpl $0x70,-0x1c(%ebp) 5fe: 75 2d jne 62d <printf+0xe0> printint(fd, *ap, 16, 0); 600: 8b 45 e8 mov -0x18(%ebp),%eax 603: 8b 00 mov (%eax),%eax 605: c7 44 24 0c 00 00 00 movl $0x0,0xc(%esp) 60c: 00 60d: c7 44 24 08 10 00 00 movl $0x10,0x8(%esp) 614: 00 615: 89 44 24 04 mov %eax,0x4(%esp) 619: 8b 45 08 mov 0x8(%ebp),%eax 61c: 89 04 24 mov %eax,(%esp) 61f: e8 71 fe ff ff call 495 <printint> ap++; 624: 83 45 e8 04 addl $0x4,-0x18(%ebp) 628: e9 b3 00 00 00 jmp 6e0 <printf+0x193> } else if(c == 's'){ 62d: 83 7d e4 73 cmpl $0x73,-0x1c(%ebp) 631: 75 45 jne 678 <printf+0x12b> s = (char*)*ap; 633: 8b 45 e8 mov -0x18(%ebp),%eax 636: 8b 00 mov (%eax),%eax 638: 89 45 f4 mov %eax,-0xc(%ebp) ap++; 63b: 83 45 e8 04 addl $0x4,-0x18(%ebp) if(s == 0) 63f: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 643: 75 09 jne 64e <printf+0x101> s = "(null)"; 645: c7 45 f4 3f 09 00 00 movl $0x93f,-0xc(%ebp) while(*s != 0){ 64c: eb 1e jmp 66c <printf+0x11f> 64e: eb 1c jmp 66c <printf+0x11f> putc(fd, *s); 650: 8b 45 f4 mov -0xc(%ebp),%eax 653: 0f b6 00 movzbl (%eax),%eax 656: 0f be c0 movsbl %al,%eax 659: 89 44 24 04 mov %eax,0x4(%esp) 65d: 8b 45 08 mov 0x8(%ebp),%eax 660: 89 04 24 mov %eax,(%esp) 663: e8 05 fe ff ff call 46d <putc> s++; 668: 83 45 f4 01 addl $0x1,-0xc(%ebp) } else if(c == 's'){ s = (char*)*ap; ap++; if(s == 0) s = "(null)"; while(*s != 0){ 66c: 8b 45 f4 mov -0xc(%ebp),%eax 66f: 0f b6 00 movzbl (%eax),%eax 672: 84 c0 test %al,%al 674: 75 da jne 650 <printf+0x103> 676: eb 68 jmp 6e0 <printf+0x193> putc(fd, *s); s++; } } else if(c == 'c'){ 678: 83 7d e4 63 cmpl $0x63,-0x1c(%ebp) 67c: 75 1d jne 69b <printf+0x14e> putc(fd, *ap); 67e: 8b 45 e8 mov -0x18(%ebp),%eax 681: 8b 00 mov (%eax),%eax 683: 0f be c0 movsbl %al,%eax 686: 89 44 24 04 mov %eax,0x4(%esp) 68a: 8b 45 08 mov 0x8(%ebp),%eax 68d: 89 04 24 mov %eax,(%esp) 690: e8 d8 fd ff ff call 46d <putc> ap++; 695: 83 45 e8 04 addl $0x4,-0x18(%ebp) 699: eb 45 jmp 6e0 <printf+0x193> } else if(c == '%'){ 69b: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp) 69f: 75 17 jne 6b8 <printf+0x16b> putc(fd, c); 6a1: 8b 45 e4 mov -0x1c(%ebp),%eax 6a4: 0f be c0 movsbl %al,%eax 6a7: 89 44 24 04 mov %eax,0x4(%esp) 6ab: 8b 45 08 mov 0x8(%ebp),%eax 6ae: 89 04 24 mov %eax,(%esp) 6b1: e8 b7 fd ff ff call 46d <putc> 6b6: eb 28 jmp 6e0 <printf+0x193> } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); 6b8: c7 44 24 04 25 00 00 movl $0x25,0x4(%esp) 6bf: 00 6c0: 8b 45 08 mov 0x8(%ebp),%eax 6c3: 89 04 24 mov %eax,(%esp) 6c6: e8 a2 fd ff ff call 46d <putc> putc(fd, c); 6cb: 8b 45 e4 mov -0x1c(%ebp),%eax 6ce: 0f be c0 movsbl %al,%eax 6d1: 89 44 24 04 mov %eax,0x4(%esp) 6d5: 8b 45 08 mov 0x8(%ebp),%eax 6d8: 89 04 24 mov %eax,(%esp) 6db: e8 8d fd ff ff call 46d <putc> } state = 0; 6e0: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp) int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 6e7: 83 45 f0 01 addl $0x1,-0x10(%ebp) 6eb: 8b 55 0c mov 0xc(%ebp),%edx 6ee: 8b 45 f0 mov -0x10(%ebp),%eax 6f1: 01 d0 add %edx,%eax 6f3: 0f b6 00 movzbl (%eax),%eax 6f6: 84 c0 test %al,%al 6f8: 0f 85 71 fe ff ff jne 56f <printf+0x22> putc(fd, c); } state = 0; } } } 6fe: c9 leave 6ff: c3 ret 00000700 <free>: static Header base; static Header *freep; void free(void *ap) { 700: 55 push %ebp 701: 89 e5 mov %esp,%ebp 703: 83 ec 10 sub $0x10,%esp Header *bp, *p; bp = (Header*)ap - 1; 706: 8b 45 08 mov 0x8(%ebp),%eax 709: 83 e8 08 sub $0x8,%eax 70c: 89 45 f8 mov %eax,-0x8(%ebp) for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 70f: a1 c8 0b 00 00 mov 0xbc8,%eax 714: 89 45 fc mov %eax,-0x4(%ebp) 717: eb 24 jmp 73d <free+0x3d> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 719: 8b 45 fc mov -0x4(%ebp),%eax 71c: 8b 00 mov (%eax),%eax 71e: 3b 45 fc cmp -0x4(%ebp),%eax 721: 77 12 ja 735 <free+0x35> 723: 8b 45 f8 mov -0x8(%ebp),%eax 726: 3b 45 fc cmp -0x4(%ebp),%eax 729: 77 24 ja 74f <free+0x4f> 72b: 8b 45 fc mov -0x4(%ebp),%eax 72e: 8b 00 mov (%eax),%eax 730: 3b 45 f8 cmp -0x8(%ebp),%eax 733: 77 1a ja 74f <free+0x4f> free(void *ap) { Header *bp, *p; bp = (Header*)ap - 1; for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 735: 8b 45 fc mov -0x4(%ebp),%eax 738: 8b 00 mov (%eax),%eax 73a: 89 45 fc mov %eax,-0x4(%ebp) 73d: 8b 45 f8 mov -0x8(%ebp),%eax 740: 3b 45 fc cmp -0x4(%ebp),%eax 743: 76 d4 jbe 719 <free+0x19> 745: 8b 45 fc mov -0x4(%ebp),%eax 748: 8b 00 mov (%eax),%eax 74a: 3b 45 f8 cmp -0x8(%ebp),%eax 74d: 76 ca jbe 719 <free+0x19> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) break; if(bp + bp->s.size == p->s.ptr){ 74f: 8b 45 f8 mov -0x8(%ebp),%eax 752: 8b 40 04 mov 0x4(%eax),%eax 755: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx 75c: 8b 45 f8 mov -0x8(%ebp),%eax 75f: 01 c2 add %eax,%edx 761: 8b 45 fc mov -0x4(%ebp),%eax 764: 8b 00 mov (%eax),%eax 766: 39 c2 cmp %eax,%edx 768: 75 24 jne 78e <free+0x8e> bp->s.size += p->s.ptr->s.size; 76a: 8b 45 f8 mov -0x8(%ebp),%eax 76d: 8b 50 04 mov 0x4(%eax),%edx 770: 8b 45 fc mov -0x4(%ebp),%eax 773: 8b 00 mov (%eax),%eax 775: 8b 40 04 mov 0x4(%eax),%eax 778: 01 c2 add %eax,%edx 77a: 8b 45 f8 mov -0x8(%ebp),%eax 77d: 89 50 04 mov %edx,0x4(%eax) bp->s.ptr = p->s.ptr->s.ptr; 780: 8b 45 fc mov -0x4(%ebp),%eax 783: 8b 00 mov (%eax),%eax 785: 8b 10 mov (%eax),%edx 787: 8b 45 f8 mov -0x8(%ebp),%eax 78a: 89 10 mov %edx,(%eax) 78c: eb 0a jmp 798 <free+0x98> } else bp->s.ptr = p->s.ptr; 78e: 8b 45 fc mov -0x4(%ebp),%eax 791: 8b 10 mov (%eax),%edx 793: 8b 45 f8 mov -0x8(%ebp),%eax 796: 89 10 mov %edx,(%eax) if(p + p->s.size == bp){ 798: 8b 45 fc mov -0x4(%ebp),%eax 79b: 8b 40 04 mov 0x4(%eax),%eax 79e: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx 7a5: 8b 45 fc mov -0x4(%ebp),%eax 7a8: 01 d0 add %edx,%eax 7aa: 3b 45 f8 cmp -0x8(%ebp),%eax 7ad: 75 20 jne 7cf <free+0xcf> p->s.size += bp->s.size; 7af: 8b 45 fc mov -0x4(%ebp),%eax 7b2: 8b 50 04 mov 0x4(%eax),%edx 7b5: 8b 45 f8 mov -0x8(%ebp),%eax 7b8: 8b 40 04 mov 0x4(%eax),%eax 7bb: 01 c2 add %eax,%edx 7bd: 8b 45 fc mov -0x4(%ebp),%eax 7c0: 89 50 04 mov %edx,0x4(%eax) p->s.ptr = bp->s.ptr; 7c3: 8b 45 f8 mov -0x8(%ebp),%eax 7c6: 8b 10 mov (%eax),%edx 7c8: 8b 45 fc mov -0x4(%ebp),%eax 7cb: 89 10 mov %edx,(%eax) 7cd: eb 08 jmp 7d7 <free+0xd7> } else p->s.ptr = bp; 7cf: 8b 45 fc mov -0x4(%ebp),%eax 7d2: 8b 55 f8 mov -0x8(%ebp),%edx 7d5: 89 10 mov %edx,(%eax) freep = p; 7d7: 8b 45 fc mov -0x4(%ebp),%eax 7da: a3 c8 0b 00 00 mov %eax,0xbc8 } 7df: c9 leave 7e0: c3 ret 000007e1 <morecore>: static Header* morecore(uint nu) { 7e1: 55 push %ebp 7e2: 89 e5 mov %esp,%ebp 7e4: 83 ec 28 sub $0x28,%esp char *p; Header *hp; if(nu < 4096) 7e7: 81 7d 08 ff 0f 00 00 cmpl $0xfff,0x8(%ebp) 7ee: 77 07 ja 7f7 <morecore+0x16> nu = 4096; 7f0: c7 45 08 00 10 00 00 movl $0x1000,0x8(%ebp) p = sbrk(nu * sizeof(Header)); 7f7: 8b 45 08 mov 0x8(%ebp),%eax 7fa: c1 e0 03 shl $0x3,%eax 7fd: 89 04 24 mov %eax,(%esp) 800: e8 08 fc ff ff call 40d <sbrk> 805: 89 45 f4 mov %eax,-0xc(%ebp) if(p == (char*)-1) 808: 83 7d f4 ff cmpl $0xffffffff,-0xc(%ebp) 80c: 75 07 jne 815 <morecore+0x34> return 0; 80e: b8 00 00 00 00 mov $0x0,%eax 813: eb 22 jmp 837 <morecore+0x56> hp = (Header*)p; 815: 8b 45 f4 mov -0xc(%ebp),%eax 818: 89 45 f0 mov %eax,-0x10(%ebp) hp->s.size = nu; 81b: 8b 45 f0 mov -0x10(%ebp),%eax 81e: 8b 55 08 mov 0x8(%ebp),%edx 821: 89 50 04 mov %edx,0x4(%eax) free((void*)(hp + 1)); 824: 8b 45 f0 mov -0x10(%ebp),%eax 827: 83 c0 08 add $0x8,%eax 82a: 89 04 24 mov %eax,(%esp) 82d: e8 ce fe ff ff call 700 <free> return freep; 832: a1 c8 0b 00 00 mov 0xbc8,%eax } 837: c9 leave 838: c3 ret 00000839 <malloc>: void* malloc(uint nbytes) { 839: 55 push %ebp 83a: 89 e5 mov %esp,%ebp 83c: 83 ec 28 sub $0x28,%esp Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; 83f: 8b 45 08 mov 0x8(%ebp),%eax 842: 83 c0 07 add $0x7,%eax 845: c1 e8 03 shr $0x3,%eax 848: 83 c0 01 add $0x1,%eax 84b: 89 45 ec mov %eax,-0x14(%ebp) if((prevp = freep) == 0){ 84e: a1 c8 0b 00 00 mov 0xbc8,%eax 853: 89 45 f0 mov %eax,-0x10(%ebp) 856: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 85a: 75 23 jne 87f <malloc+0x46> base.s.ptr = freep = prevp = &base; 85c: c7 45 f0 c0 0b 00 00 movl $0xbc0,-0x10(%ebp) 863: 8b 45 f0 mov -0x10(%ebp),%eax 866: a3 c8 0b 00 00 mov %eax,0xbc8 86b: a1 c8 0b 00 00 mov 0xbc8,%eax 870: a3 c0 0b 00 00 mov %eax,0xbc0 base.s.size = 0; 875: c7 05 c4 0b 00 00 00 movl $0x0,0xbc4 87c: 00 00 00 } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ 87f: 8b 45 f0 mov -0x10(%ebp),%eax 882: 8b 00 mov (%eax),%eax 884: 89 45 f4 mov %eax,-0xc(%ebp) if(p->s.size >= nunits){ 887: 8b 45 f4 mov -0xc(%ebp),%eax 88a: 8b 40 04 mov 0x4(%eax),%eax 88d: 3b 45 ec cmp -0x14(%ebp),%eax 890: 72 4d jb 8df <malloc+0xa6> if(p->s.size == nunits) 892: 8b 45 f4 mov -0xc(%ebp),%eax 895: 8b 40 04 mov 0x4(%eax),%eax 898: 3b 45 ec cmp -0x14(%ebp),%eax 89b: 75 0c jne 8a9 <malloc+0x70> prevp->s.ptr = p->s.ptr; 89d: 8b 45 f4 mov -0xc(%ebp),%eax 8a0: 8b 10 mov (%eax),%edx 8a2: 8b 45 f0 mov -0x10(%ebp),%eax 8a5: 89 10 mov %edx,(%eax) 8a7: eb 26 jmp 8cf <malloc+0x96> else { p->s.size -= nunits; 8a9: 8b 45 f4 mov -0xc(%ebp),%eax 8ac: 8b 40 04 mov 0x4(%eax),%eax 8af: 2b 45 ec sub -0x14(%ebp),%eax 8b2: 89 c2 mov %eax,%edx 8b4: 8b 45 f4 mov -0xc(%ebp),%eax 8b7: 89 50 04 mov %edx,0x4(%eax) p += p->s.size; 8ba: 8b 45 f4 mov -0xc(%ebp),%eax 8bd: 8b 40 04 mov 0x4(%eax),%eax 8c0: c1 e0 03 shl $0x3,%eax 8c3: 01 45 f4 add %eax,-0xc(%ebp) p->s.size = nunits; 8c6: 8b 45 f4 mov -0xc(%ebp),%eax 8c9: 8b 55 ec mov -0x14(%ebp),%edx 8cc: 89 50 04 mov %edx,0x4(%eax) } freep = prevp; 8cf: 8b 45 f0 mov -0x10(%ebp),%eax 8d2: a3 c8 0b 00 00 mov %eax,0xbc8 return (void*)(p + 1); 8d7: 8b 45 f4 mov -0xc(%ebp),%eax 8da: 83 c0 08 add $0x8,%eax 8dd: eb 38 jmp 917 <malloc+0xde> } if(p == freep) 8df: a1 c8 0b 00 00 mov 0xbc8,%eax 8e4: 39 45 f4 cmp %eax,-0xc(%ebp) 8e7: 75 1b jne 904 <malloc+0xcb> if((p = morecore(nunits)) == 0) 8e9: 8b 45 ec mov -0x14(%ebp),%eax 8ec: 89 04 24 mov %eax,(%esp) 8ef: e8 ed fe ff ff call 7e1 <morecore> 8f4: 89 45 f4 mov %eax,-0xc(%ebp) 8f7: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 8fb: 75 07 jne 904 <malloc+0xcb> return 0; 8fd: b8 00 00 00 00 mov $0x0,%eax 902: eb 13 jmp 917 <malloc+0xde> nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; if((prevp = freep) == 0){ base.s.ptr = freep = prevp = &base; base.s.size = 0; } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ 904: 8b 45 f4 mov -0xc(%ebp),%eax 907: 89 45 f0 mov %eax,-0x10(%ebp) 90a: 8b 45 f4 mov -0xc(%ebp),%eax 90d: 8b 00 mov (%eax),%eax 90f: 89 45 f4 mov %eax,-0xc(%ebp) return (void*)(p + 1); } if(p == freep) if((p = morecore(nunits)) == 0) return 0; } 912: e9 70 ff ff ff jmp 887 <malloc+0x4e> } 917: c9 leave 918: c3 ret
; ; Fast background restore ; ; Generic version (just a bit slow) ; ; $Id: bkrestore.asm,v 1.9 2017-01-02 21:51:24 aralbrec Exp $ ; SECTION code_clib PUBLIC bkrestore PUBLIC _bkrestore EXTERN pixeladdress .bkrestore ._bkrestore push ix ; __FASTCALL__ : sprite ptr in HL push hl pop ix ld h,(ix+2) ld l,(ix+3) push hl call pixeladdress pop hl ld a,(ix+0) ld b,(ix+1) dec a srl a srl a srl a inc a inc a ; INT ((Xsize-1)/8+2) ld (rbytes+1),a .bkrestores push bc .rbytes ld b,0 .rloop ld a,(ix+4) ld (de),a inc de inc ix djnz rloop inc l push hl call pixeladdress pop hl pop bc djnz bkrestores pop ix ret
; A305716: Order of rowmotion on the divisor lattice for n. ; Submitted by Jamie Morken(s1) ; 2,3,3,4,3,4,3,5,4,4,3,5,3,4,4,6,3,5,3,5,4,4,3,6,4,4,5,5,3,5,3,7,4,4,4,6,3,4,4,6,3,5,3,5,5,4,3,7,4,5,4,5,3,6,4,6,4,4,3,6,3,4,5,8,4,5,3,5,4,5,3,7,3,4,5,5,4,5,3,7,6,4,3,6,4,4,4,6,3,6,4,5,4,4,4,8,3,5,5,6 lpb $0 seq $0,86436 ; Maximum number of parts possible in a factorization of n; a(1) = 1, and for n > 1, a(n) = A001222(n) = bigomega(n). mov $1,$0 cmp $0,$2 lpe mov $0,$1 add $0,2
; A142762: Primes congruent to 35 mod 59. ; Submitted by Jon Maiga ; 271,389,743,1097,1451,2749,3221,3457,3929,4283,4519,4637,5227,5581,6053,6761,6997,7351,7823,8059,9239,9829,10301,10891,11717,11953,12071,13487,13723,13841,14431,14549,15139,15493,16319,16673,17027,17971,18089,18443,18679,18797,19387,20921,21157,22573,22691,23399,23753,24107,24697,25169,25523,25759,26113,26821,27529,27647,27883,28001,28591,29063,31069,31541,32603,32839,32957,33311,33547,34019,34963,35081,35317,35671,36497,37087,37441,38149,40037,40627,41453,42043,42397,42751,43223,43577,47353 mov $1,17 mov $2,$0 add $2,2 pow $2,2 lpb $2 sub $2,1 mov $3,$1 mul $3,2 seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0. sub $0,$3 add $1,59 mov $4,$0 max $4,0 cmp $4,$0 mul $2,$4 lpe mov $0,$1 sub $0,60 mul $0,2 add $0,3
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Copyright (c) GeoWorks 1991 -- All Rights Reserved PROJECT: PC GEOS - Spline edit object MODULE: Splines FILE: splineEC.asm AUTHOR: Chris Boyke REVISION HISTORY: Name Date Description ---- ---- ----------- CDB 4/91 Initial version GLOBAL ROUTINES: ECSplineAnchorPoint ECSplineControlPoint ECSplineInstanceAndLMemBlock ECSplineInstanceAndPoints ECSplinePoint ECSplinePointsDSSI ECSplineScratchChunk ECSplineTempAndFilledHandleFlags LOCAL ROUTINES: DESCRIPTION: Error-checking procedures for the spline code $Id: splineEC.asm,v 1.1 97/04/07 11:09:06 newdeal Exp $ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ IF ERROR_CHECK SplineUtilCode segment COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ECSplineControlPoint %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Make sure ax points to a valid control point CALLED BY: GLOBAL PASS: ax - point number *ds:si - points array RETURN: nothing DESTROYED: nothing, not even flags CHECKS: 1) point # (AX) exists 2) AX is a CONTROL point 3) the point's TYPE flag contains no SMOOTHNESS bits 4) the SELECTED bit is clear 5) the HOLLOW_HANDLE bit is clear KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- CDB 4/91 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ECSplineControlPoint proc far uses ax, di .enter pushf call ChunkArrayElementToPtr ERROR_C ILLEGAL_SPLINE_POINT_NUMBER mov al, ds:[di].SPS_info test al, mask PIF_CONTROL ERROR_Z EXPECTED_A_CONTROL_POINT ; HACK HACK HACK Low 3 bits of control point record must always be zero! push ax andnf al, 7 tst al ERROR_NZ ILLEGAL_POINT_INFO_RECORD pop ax call ECSplineTempAndFilledHandleFlags popf ; restore flags .leave ret ECSplineControlPoint endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ECSplineAnchorPoint %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Make sure ax points to a valid anchor point CALLED BY: GLOBAL PASS: ax - point # *ds:si points array RETURN: nothing DESTROYED: nothing (flags preserved) CHECKS: 1) AX is a valid point 2) AX is an anchor point 3) the PREV bit is clear in Type record 4) CONTROL_LINE_DRAWN bit is clear 5) not both FILLED_HANDLE and HOLLOW_HANDLE bits are set KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- CDB 4/91 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ECSplineAnchorPoint proc far uses ax, di .enter pushf call ChunkArrayElementToPtr ERROR_C ILLEGAL_SPLINE_POINT_NUMBER mov al, ds:[di].SPS_info test al, mask PIF_CONTROL ERROR_NZ EXPECTED_AN_ANCHOR_POINT ; see if both filled-handle and hollow-handle drawn flags are set andnf al, mask PIF_FILLED_HANDLE or mask APIF_HOLLOW_HANDLE cmp al, mask PIF_FILLED_HANDLE or mask APIF_HOLLOW_HANDLE ERROR_E ILLEGAL_POINT_INFO_RECORD call ECSplineTempAndFilledHandleFlags popf .leave ret ECSplineAnchorPoint endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ECSplineInstanceAndLMemBlock %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Check to make sure that the lmemBlock pointer in the spline's instance data actually points to a valid LMem block. Also check the SCRATCH CHUNK CALLED BY: Internal PASS: es:bp - VisSplineInstance data ds - data segment of spline's lmem data block RETURN: nothing DESTROYED: nothing, not even flags CHECKS: 1) spline's lmem heap is OK 2) points block is locked 3) points block is at address pointed to by DS REVISION HISTORY: Name Date Description ---- ---- ----------- CDB 6/ 4/91 Initial version. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ECSplineInstanceAndLMemBlock proc far uses ax,bx,di class VisSplineClass .enter pushf ; Make sure the spline block is OK segxchg ds, es call ECLMemValidateHeap segxchg ds, es ; Make sure the points block is at the address we think it's at mov bx, es:[bp].VSI_lmemBlock mov ax, MGIT_ADDRESS call MemGetInfo mov bx, ds cmp ax, bx ERROR_NE LMEM_BLOCK_AT_INCORRECT_ADDRESS ; Validate the points block call ECLMemValidateHeap ; check scratch chunk call ECSplineScratchChunk popf .leave ret ECSplineInstanceAndLMemBlock endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ECSplineInstanceAndPoints %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Checks that the spline chunk handle and the handle of the points array are both valid. CALLED BY: internal PASS: es:bp - VisSplineInstance data *ds:si - points array RETURN: nothing DESTROYED: nothing (not even flags) CHECKS: 1) see ECSplineInstanceAndLMemBlock 2) makes sure that SI corresponds to the chunk handle of the points in the instance data 3) makes sure the points array isn't corrupted. KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- CDB 4/91 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ECSplineInstanceAndPoints proc far uses bx class VisSplineClass .enter pushf call ECSplineInstanceAndLMemBlock cmp si, es:[bp].VSI_points ; check points chunk address ERROR_NE DS_SI_NOT_SPLINE_POINTS call ECSplinePointsDSSI popf .leave ret ECSplineInstanceAndPoints endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ECSplinePointsDSSI %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Make sure that *DS:SI points to the points array. CALLED BY: internal PASS: *ds:si - points array ? RETURN: nothing DESTROYED: nothing (flags preserved) REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: Make sure it's a valid chunk array, make sure there aren't too many points KNOWN BUGS/SIDE EFFECTS/IDEAS: Whenever possible, make a call to ECSplineInstanceAndPoints instead of this function. REVISION HISTORY: Name Date Description ---- ---- ----------- CDB 4/91 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ECSplinePointsDSSI proc near uses ax,bx,cx,di .enter pushf call ChunkArrayGetCount cmp cx, SPLINE_MAX_POINT ERROR_G TOO_MANY_SPLINE_POINTS call SysGetECLevel test ax, mask ECF_APP jz done ; Test every fucking point mov bx, cs mov di, offset ECSplinePointDSDI call ChunkArrayEnum done: popf .leave ret ECSplinePointsDSSI endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ECSplinePoint %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Check the spline point's info stuff. Assume that the PIF_CONTROL bit is set correctly. CALLED BY: internal to VisSplineClass PASS: ax - point number *ds:si - points array RETURN: nothing DESTROYED: nothing (flags preserved) PSEUDO CODE/STRATEGY: Dereference the point, and call the common routine. KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- CDB 5/91 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ECSplinePoint proc far push ax, di pushf call ChunkArrayElementToPtr jmp ECSplinePointCommon ECSplinePoint endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ECSplinePointDSDI %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Check the spline point at ds:di CALLED BY: PASS: ds:di - SplinePointStruc RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- CDB 4/ 3/92 Initial version. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ECSplinePointDSDI proc far push ax, di pushf call ChunkArrayPtrToElement ; get element # in AX REAL_FALL_THRU ECSplinePointCommon ECSplinePointDSDI endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ECSplinePointCommon %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Check the spline point CALLED BY: PASS: ax - Spline point number ds:di - SplinePointStruc RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: Must be JMP'd to with AX, DI, and FLAGS pushed on stack (in that order) REVISION HISTORY: Name Date Description ---- ---- ----------- CDB 4/ 3/92 Initial version. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ECSplinePointCommon proc far jmp test ds:[di].SPS_info, mask PIF_CONTROL jnz control call ECSplineAnchorPoint jmp done control: call ECSplineControlPoint done: popf pop ax, di ret ECSplinePointCommon endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ECSplineTempAndFilledHandleFlags %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Check to make sure that not both the TEMP and the HANDLE_DRAWN flags are set in the point's SPS_info record CALLED BY: ECSplineAnchorPoint, ECSplineControlPoint PASS: ds:di - point RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- CDB 5/91 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ECSplineTempAndFilledHandleFlags proc near uses ax .enter mov al, ds:[di].SPS_info andnf al, mask PIF_TEMP or mask PIF_FILLED_HANDLE cmp al, mask PIF_TEMP or mask PIF_FILLED_HANDLE ERROR_E ILLEGAL_POINT_INFO_RECORD .leave ret ECSplineTempAndFilledHandleFlags endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ECSplineScratchChunk %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Make sure the scratch chunk exists for the spline object, and make sure the chunk handle of the spline object (stored in the scratch chunk) is correct. CALLED BY: PASS: es:bp - VisSplineInstance data ds - segment of scratch chunk RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- CDB 6/ 4/91 Initial version. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ECSplineScratchChunk proc near uses si class VisSplineClass .enter pushf mov si, es:[bp].VSI_scratch tst si ERROR_Z SCRATCH_CHUNK_NOT_ALLOCATED mov si, ds:[si] mov si, ds:[si].SD_splineChunkHandle mov si, es:[si] add si, es:[si].VisSpline_offset cmp si, bp ERROR_NE SPLINE_POINTER_AND_CHUNK_HANDLE_DONT_MATCH popf .leave ret ECSplineScratchChunk endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ECSplineInstanceAndScratch %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Make sure that es:bp and ds:di point to what they oughtta CALLED BY: PASS: es:bp - VisSplineInstance data ds:di - scratch chunk RETURN: nothing DESTROYED: Nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- CDB 10/11/91 Initial version. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ECSplineInstanceAndScratch proc far uses si class VisSplineClass .enter pushf call ECSplineInstanceAndLMemBlock mov si, es:[bp].VSI_scratch mov si, ds:[si] cmp si, di ERROR_NE DI_NOT_POINTING_TO_SCRATCH_CHUNK popf .leave ret ECSplineInstanceAndScratch endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ECSplineAttrChunks %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Check that the SS_HAS_ATTR_CHUNKS bit is set in the instance data. CALLED BY: all Set/Get Line/Area attribute methods PASS: es:bp - VisSplineInstance data RETURN: nothing DESTROYED: Nothing, flags preserved PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- CDB 10/16/91 Initial version. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ECSplineAttrChunks proc far class VisSplineClass .enter pushf test es:[bp].VSI_state, mask SS_HAS_ATTR_CHUNKS ERROR_Z SPLINE_HAS_NO_ATTR_CHUNKS popf .leave ret ECSplineAttrChunks endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ECCheckSplineDSSI %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Make sure that *ds:si is the spline CALLED BY: PASS: RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- cdb 6/11/92 Initial version. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ECCheckSplineDSSI proc far uses es, di .enter pushf segmov es, <segment VisSplineClass>, di mov di, offset VisSplineClass call ObjIsObjectInClass ERROR_NC DS_SI_WRONG_CLASS popf .leave ret ECCheckSplineDSSI endp SplineUtilCode ends ENDIF
$*********************************************************************** $ THE FOLLOWING BULK DATA ENTRIES RELATED TO EXT. SUPERELEMENT 102 $ ARE FOR USE IN THE MAIN BULK DATA PORTION OF THE ASSEMBLY RUN $*********************************************************************** $ SEBULK 102 EXTOP4 MANUAL 102 $ $ CORD2R DATA $ CORD2R* 10 0 0.000000000E+00 0.000000000E+00 * 0.000000000E+00 0.100000000E+01 0.000000000E+00 0.000000000E+00 * 0.000000000E+00 0.100000000E+01 0.000000000E+00 $ $ SECONCT DATA $ SECONCT 102 0 NO 3 3 11 11 19 19 27 27 2995001 2995001 2995002 2995002 2995003 2995003 2995004 2995004 2995005 2995005 2995006 2995006 2995007 2995007 2995008 2995008 $ $ BOUNDARY GRID DATA $ GRID* 3 0 0.600000000E+03 0.000000000E+00 * 0.300000000E+03 0 0 0 GRID* 11 0 0.600000000E+03 0.300000000E+03 * 0.300000000E+03 10 0 0 GRID* 19 0 0.600000000E+03 0.300000000E+03 * 0.000000000E+00 0 0 0 GRID* 27 0 0.600000000E+03 0.000000000E+00 * 0.000000000E+00 0 0 0 $ $ SPOINT DATA $ SPOINT 2995001 2995002 2995003 2995004 2995005 2995006 2995007 2995008 $***********************************************************************
//===--------------------------------------------------------------------------------*- C++ -*-===// // _ // | | // __| | __ ___ ___ ___ // / _` |/ _` \ \ /\ / / '_ | // | (_| | (_| |\ V V /| | | | // \__,_|\__,_| \_/\_/ |_| |_| - Compiler Toolchain // // // This file is distributed under the MIT License (MIT). // See LICENSE.txt for details. // //===------------------------------------------------------------------------------------------===// #include "dawn/Optimizer/PassTemporaryType.h" #include "dawn/Optimizer/OptimizerContext.h" #include "dawn/Optimizer/StatementAccessesPair.h" #include "dawn/Optimizer/Stencil.h" #include "dawn/Optimizer/StencilInstantiation.h" #include "dawn/SIR/ASTVisitor.h" #include <iostream> #include <memory> #include <stack> #include <unordered_map> #include <unordered_set> namespace dawn { namespace { class StencilFunArgumentDetector : public ASTVisitorForwarding { StencilInstantiation& instantiation_; int AccessID_; int argListNesting_; bool usedInStencilFun_; public: StencilFunArgumentDetector(StencilInstantiation& instantiation, int AccessID) : instantiation_(instantiation), AccessID_(AccessID), argListNesting_(0), usedInStencilFun_(false) {} virtual void visit(const std::shared_ptr<StencilFunCallExpr>& expr) override { argListNesting_++; ASTVisitorForwarding::visit(expr); argListNesting_--; } virtual void visit(const std::shared_ptr<FieldAccessExpr>& expr) override { if(argListNesting_ > 0 && instantiation_.getAccessIDFromExpr(expr) == AccessID_) usedInStencilFun_ = true; } bool usedInStencilFun() const { return usedInStencilFun_; } }; /// @brief Check if a field, given by `AccessID` is used as an argument of a stencil-function inside /// any statement of the `stencil` /// @returns `true` if field is used as an argument bool usedAsArgumentInStencilFun(const std::shared_ptr<Stencil>& stencil, int AccessID) { StencilFunArgumentDetector visitor(stencil->getStencilInstantiation(), AccessID); stencil->accept(visitor); return visitor.usedInStencilFun(); } /// @brief Representation of a Temporary field or variable struct Temporary { enum TemporaryType { TT_LocalVariable, TT_Field }; Temporary() = default; Temporary(int accessID, TemporaryType type, const Extents& extent) : AccessID(accessID), Type(type), Extent(extent) {} int AccessID; ///< AccessID of the field or variable TemporaryType Type : 1; ///< Type of the temporary Stencil::Lifetime Lifetime; ///< Lifetime of the temporary Extents Extent; ///< Accumulated access of the temporary during its lifetime /// @brief Dump the temporary void dump(const std::shared_ptr<StencilInstantiation>& instantiation) const { std::cout << "Temporary : " << instantiation->getNameFromAccessID(AccessID) << " {" << "\n Type=" << (Type == TT_LocalVariable ? "LocalVariable" : "Field") << ",\n Lifetime=" << Lifetime << ",\n Extent=" << Extent << "\n}\n"; } }; } // anonymous namespace PassTemporaryType::PassTemporaryType() : Pass("PassTemporaryType", true) {} bool PassTemporaryType::run(const std::shared_ptr<StencilInstantiation>& instantiation) { OptimizerContext* context = instantiation->getOptimizerContext(); std::unordered_map<int, Temporary> temporaries; std::unordered_set<int> AccessIDs; // Fix temporaries which span over multiple stencils and promote them to 3D allocated fields // Fix the temporaries within the same stencil for(const auto& stencilPtr : instantiation->getStencils()) { temporaries.clear(); AccessIDs.clear(); // Loop over all accesses for(auto& multiStagePtr : stencilPtr->getMultiStages()) { for(auto& stagePtr : multiStagePtr->getStages()) { for(auto& doMethodPtr : stagePtr->getDoMethods()) { for(const auto& statementAccessesPair : doMethodPtr->getStatementAccessesPairs()) { auto processAccessMap = [&](const std::unordered_map<int, Extents>& accessMap) { for(const auto& AccessIDExtentPair : accessMap) { int AccessID = AccessIDExtentPair.first; const Extents& extent = AccessIDExtentPair.second; // Is it a temporary? bool isTemporaryField = instantiation->isTemporaryField(AccessID); if(isTemporaryField || (!instantiation->isGlobalVariable(AccessID) && instantiation->isVariable(AccessID))) { auto it = temporaries.find(AccessID); if(it != temporaries.end()) { // If we already registered it, update the extent it->second.Extent.merge(extent); } else { // Register the temporary AccessIDs.insert(AccessID); temporaries.emplace(AccessID, Temporary(AccessID, isTemporaryField ? Temporary::TT_Field : Temporary::TT_LocalVariable, extent)); } } } }; processAccessMap(statementAccessesPair->getAccesses()->getWriteAccesses()); processAccessMap(statementAccessesPair->getAccesses()->getReadAccesses()); } } } } auto LifetimeMap = stencilPtr->getLifetime(AccessIDs); std::for_each(LifetimeMap.begin(), LifetimeMap.end(), [&](const std::pair<int, Stencil::Lifetime>& lifetimePair) { temporaries[lifetimePair.first].Lifetime = lifetimePair.second; }); // Process each temporary for(const auto& AccessIDTemporaryPair : temporaries) { int AccessID = AccessIDTemporaryPair.first; const Temporary& temporary = AccessIDTemporaryPair.second; auto report = [&](const char* action) { std::cout << "\nPASS: " << getName() << ": " << instantiation->getName() << ": " << action << ":" << instantiation->getOriginalNameFromAccessID(AccessID) << std::endl; }; if(temporary.Type == Temporary::TT_LocalVariable) { // If the variable is accessed in multiple Do-Methods, we need to promote it to a field! if(!temporary.Lifetime.Begin.inSameDoMethod(temporary.Lifetime.End)) { if(context->getOptions().ReportPassTemporaryType) report("promote"); instantiation->promoteLocalVariableToTemporaryField(stencilPtr.get(), AccessID, temporary.Lifetime); } } else { // If the field is only accessed within the same Do-Method, does not have an extent and is // not argument to a stencil function, we can demote it to a local variable if(temporary.Lifetime.Begin.inSameDoMethod(temporary.Lifetime.End) && temporary.Extent.isPointwise() && !usedAsArgumentInStencilFun(stencilPtr, AccessID)) { if(context->getOptions().ReportPassTemporaryType) report("demote"); instantiation->demoteTemporaryFieldToLocalVariable(stencilPtr.get(), AccessID, temporary.Lifetime); } } } } return true; } void PassTemporaryType::fixTemporariesSpanningMultipleStencils( StencilInstantiation* instantiation, const std::vector<std::shared_ptr<Stencil>>& stencils) { if(stencils.size() <= 1) return; for(int i = 0; i < stencils.size(); ++i) { for(const Stencil::FieldInfo& fieldi : stencils[i]->getFields()) { // Is fieldi a temporary? if(fieldi.IsTemporary) { // Is it referenced in another stencil? for(int j = i + 1; j < stencils.size(); ++j) { for(const Stencil::FieldInfo& fieldj : stencils[j]->getFields()) { // Yes and yes ... promote it to a real storage if(fieldi.AccessID == fieldj.AccessID && fieldj.IsTemporary) { instantiation->promoteTemporaryFieldToAllocatedField(fieldi.AccessID); } } } } } } } } // namespace dawn
===INSTRUCTIONS=== 0x0: ADQ/ADD,≠ SP++,= 255 + XORQ = y/SP++ + imm8/reg 0x1: ADR/reg-relative, ¥ = reg++, y / SP++ + imm8/reg 0x2: ADC/add-carry=, ≠ SP++, £ = SP++ = y/n=y + c / imm8/reg 0x3: POP/ES = SP, PC ≠ imm8/reg = true¿ 0x4: PUSH/ES = PC ≠ SP, imm8/reg = No8 0x5: CMP =, ≠ SP 0x6: NEG/Negate = y 0x7: SUBQ/Subtract = 0 - 0 = y 0x8: JUMP/* Transfers program data/program sequence mapped to the memory address to it(s) operend do a immediate or a flag from arithmetic 0x9: JE/Jump-Equal = r, SP++ = y 0xA: JS/Jump-Negative 0xB JZ/Jump-Zero 0xC ORQ/OR 0xD MW/MOVE-WORD 0xE AND/AND 0xF OUTB/Out-Bus 0x10 LDA/Load-A 0x11 INB/In-Bus ===REGISTERS=== A (0) reg(s) = A | GPR (0) B (1) reg(s) = B | GPR (1) C (2) reg(s) = C | GPR (2) D (3) reg(s) = D | GPR (3) H (4) reg(s) = ? = (H)igh index reg L (5) reg(s)/imm = (L)ow index reg Z (6) reg(s)/imm = (Z)ero F (7) reg(s)/imm = (LSB to MSB) Equal Not Equal Truth Table Value Binary Tree 16/bytes of read only memory /* Bytes do something with the amount of data banks is what is in the SNS-16 /* This Mini-Computer only has limited memory so do something otherwise that wastes RAM or any general-purpose memory bank styled module is enough /* Inturupts would be handled through ROM due to it's massive size of read-only memory which means it has an enrichment in it /* Considering it's size, It looks to be slow but it won't, it's faste(r) then the CPU's that are mostly on any social media platform /* It will only do immediates through ROM Version 1.0 CF/Carry-Flag ZF/Zero-Flag SF/Sign-Flag OF/Overflow-Flag(s) ===Memory Layout=== 0x00000000 MS | (M)emory (S)tore (BANK) 0x00000000 ML | (M)emory (L)oad (Immediate) 0x00000000 MB | (M)emory (B)ank (BANK STATUS)
; A047423: Numbers that are congruent to {2, 3, 4, 5, 6} mod 8. ; 2,3,4,5,6,10,11,12,13,14,18,19,20,21,22,26,27,28,29,30,34,35,36,37,38,42,43,44,45,46,50,51,52,53,54,58,59,60,61,62,66,67,68,69,70,74,75,76,77,78,82,83,84,85,86,90,91,92,93,94,98,99,100,101,102 mov $1,$0 div $0,5 mul $0,3 add $1,$0 add $1,2
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r11 push %r13 push %r14 push %rbp push %rbx push %rcx push %rdi push %rdx push %rsi lea addresses_WC_ht+0xc6ef, %r14 clflush (%r14) nop nop xor $63614, %rdx mov $0x6162636465666768, %rbp movq %rbp, %xmm4 and $0xffffffffffffffc0, %r14 vmovaps %ymm4, (%r14) cmp %r10, %r10 lea addresses_D_ht+0x150b7, %r13 nop nop nop nop xor %r11, %r11 vmovups (%r13), %ymm7 vextracti128 $1, %ymm7, %xmm7 vpextrq $1, %xmm7, %rbx nop nop nop nop nop add $25842, %r10 lea addresses_WT_ht+0xd96f, %r11 nop xor %rdx, %rdx mov (%r11), %r14d sub $62188, %rbp lea addresses_A_ht+0x143ef, %rsi lea addresses_A_ht+0x11bef, %rdi inc %rbx mov $38, %rcx rep movsw nop nop cmp %rdx, %rdx lea addresses_UC_ht+0xc1af, %rsi lea addresses_WT_ht+0x1a92f, %rdi nop inc %r14 mov $92, %rcx rep movsb nop nop nop cmp $38423, %rdx lea addresses_WT_ht+0xe0ed, %rsi lea addresses_WC_ht+0xaba3, %rdi nop nop nop nop nop xor $63491, %r14 mov $31, %rcx rep movsb nop add $5697, %r14 lea addresses_A_ht+0x12fef, %rsi lea addresses_UC_ht+0x1df8f, %rdi nop nop cmp %rdx, %rdx mov $4, %rcx rep movsb nop nop nop nop nop dec %rcx lea addresses_WT_ht+0x14fef, %rsi lea addresses_normal_ht+0x18b4f, %rdi nop nop nop nop nop dec %rbp mov $60, %rcx rep movsw nop nop xor %rcx, %rcx lea addresses_D_ht+0x487f, %r10 nop nop nop nop cmp $29900, %r13 mov $0x6162636465666768, %rbx movq %rbx, (%r10) nop nop nop add %rbp, %rbp pop %rsi pop %rdx pop %rdi pop %rcx pop %rbx pop %rbp pop %r14 pop %r13 pop %r11 pop %r10 ret .global s_faulty_load s_faulty_load: push %r12 push %r14 push %r8 push %rbp push %rcx push %rdi push %rsi // REPMOV lea addresses_D+0x12cef, %rsi lea addresses_normal+0x1b3ef, %rdi nop nop cmp $5397, %rbp mov $121, %rcx rep movsl cmp %rsi, %rsi // Store lea addresses_WC+0x83ef, %rsi nop nop nop nop xor %r14, %r14 mov $0x5152535455565758, %r8 movq %r8, (%rsi) xor $25882, %rsi // Load mov $0x48d1080000000def, %r12 nop nop nop nop add %rsi, %rsi movaps (%r12), %xmm7 vpextrq $0, %xmm7, %r8 nop nop nop nop cmp %r12, %r12 // Faulty Load lea addresses_WC+0x53ef, %rdi cmp $37085, %r14 movb (%rdi), %cl lea oracles, %rbp and $0xff, %rcx shlq $12, %rcx mov (%rbp,%rcx,1), %rcx pop %rsi pop %rdi pop %rcx pop %rbp pop %r8 pop %r14 pop %r12 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'size': 2, 'NT': False, 'type': 'addresses_WC', 'same': False, 'AVXalign': False, 'congruent': 0}} {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_D', 'congruent': 8}, 'dst': {'same': False, 'type': 'addresses_normal', 'congruent': 10}} {'OP': 'STOR', 'dst': {'size': 8, 'NT': False, 'type': 'addresses_WC', 'same': False, 'AVXalign': True, 'congruent': 11}} {'OP': 'LOAD', 'src': {'size': 16, 'NT': False, 'type': 'addresses_NC', 'same': False, 'AVXalign': True, 'congruent': 7}} [Faulty Load] {'OP': 'LOAD', 'src': {'size': 1, 'NT': False, 'type': 'addresses_WC', 'same': True, 'AVXalign': True, 'congruent': 0}} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'size': 32, 'NT': False, 'type': 'addresses_WC_ht', 'same': False, 'AVXalign': True, 'congruent': 8}} {'OP': 'LOAD', 'src': {'size': 32, 'NT': False, 'type': 'addresses_D_ht', 'same': False, 'AVXalign': False, 'congruent': 3}} {'OP': 'LOAD', 'src': {'size': 4, 'NT': True, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': False, 'congruent': 6}} {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_A_ht', 'congruent': 10}, 'dst': {'same': False, 'type': 'addresses_A_ht', 'congruent': 9}} {'OP': 'REPM', 'src': {'same': True, 'type': 'addresses_UC_ht', 'congruent': 3}, 'dst': {'same': False, 'type': 'addresses_WT_ht', 'congruent': 6}} {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_WT_ht', 'congruent': 0}, 'dst': {'same': False, 'type': 'addresses_WC_ht', 'congruent': 2}} {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_A_ht', 'congruent': 10}, 'dst': {'same': False, 'type': 'addresses_UC_ht', 'congruent': 1}} {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_WT_ht', 'congruent': 10}, 'dst': {'same': False, 'type': 'addresses_normal_ht', 'congruent': 3}} {'OP': 'STOR', 'dst': {'size': 8, 'NT': False, 'type': 'addresses_D_ht', 'same': False, 'AVXalign': False, 'congruent': 4}} {'58': 564} 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 */
; A044322: Numbers n such that the string 7,8 occurs in the base 9 representation of n but not of n-1. ; 71,152,233,314,395,476,557,638,719,800,881,962,1043,1124,1205,1286,1367,1448,1529,1610,1691,1772,1853,1934,2015,2096,2177,2258,2339,2420,2501,2582,2663,2744,2825,2906,2987,3068,3149 mov $1,$0 mul $1,81 add $1,71
/* The MIT License (MIT) Copyright (c) 2011 - 2013, Philipp Heise and Sebastian Klose Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include <cvt/math/Polynomial.h> #include <cvt/util/CVTTest.h> using namespace cvt; BEGIN_CVTTEST( Polynomial ) bool b = true; Polynomialf p1( 2.0f, 1.0f ); Polynomialf p2( 3.0f, 2.0f, 1.0f ); Polynomialf tmp = p1 + p1; b &= tmp == 2.0f * p1; CVTTEST_PRINT( "+", b ); CVTTEST_PRINT( "*", b ); tmp = -1.0f * p1; b &= tmp == -p1; CVTTEST_PRINT( "-", b ); tmp = p1 - p1; b &= tmp.degree() == 0; CVTTEST_PRINT( "-", b ); Polynomialf tmp2; tmp2.setZero(); b &= tmp == tmp2; CVTTEST_PRINT( "setZero()", b ); { std::vector<Complexf> roots; Polynomialf poly( 1.0f, -10.0f, 35.0f, -50.0f, 24.0f ); poly.roots( roots ); for( size_t i = 0; i < roots.size(); i++ ) std::cout << roots[ i ] << std::endl; } { std::vector<Complexd> roots; Polynomiald poly( 1.0, -10.0, 35.0, -50.0, 24.0 ); poly.roots( roots ); for( size_t i = 0; i < roots.size(); i++ ) std::cout << roots[ i ] << std::endl; } return b; END_CVTTEST
; ================================================================ ; DevSound song data ; ================================================================ ; ================================================================= ; Song speed table ; ================================================================= SongSpeedTable: db 4,3 ; triumph db 4,3 ; insert title here (NOTE: Actual song name.) db 4,3 ; beach db 4,5 ; desert db 4,3 ; snow db 6,6 ; gadunk SongPointerTable: dw PT_Triumph dw PT_InsertTitleHere dw PT_Beach dw PT_Desert dw PT_Snow dw PT_Gadunk ; ================================================================= ; Volume sequences ; ================================================================= ; Wave volume values w0 equ %00000000 w1 equ %01100000 w2 equ %01000000 w3 equ %00100000 ; For pulse instruments, volume control is software-based by default. ; However, hardware volume envelopes may still be used by adding the ; envelope length * $10. ; Example: $3F = initial volume $F, env. length $3 ; Repeat that value for the desired length. ; Note that using initial volume $F + envelope length $F will be ; interpreted as a "table end" command, use initial volume $F + ; envelope length $0 instead. ; Same applies to initial volume $F + envelope length $8 which ; is interpreted as a "loop" command, use initial volume $F + ; envelope length $0 instead. vol_Gadunk: db 15,5,10,5,2,6,10,15,12,6,10,7,8,9,10,15,4,3,2,1,$8f,0 vol_Arp: db 8,8,8,7,7,7,6,6,6,5,5,5,4,4,4,4,3,3,3,3,3,2,2,2,2,2,2,1,1,1,1,1,1,1,1,0,$ff vol_OctArp: db 12,11,10,9,9,8,8,8,7,7,6,6,7,7,6,6,5,5,5,5,5,5,4,4,4,4,4,4,4,3,3,3,3,3,3,2,2,2,2,2,2,1,1,1,1,1,1,0,$ff vol_HWEnvTest: db $1f,$1f,$1f,$1f,$1f,$1f,$1f,$1f,$77,$ff vol_Bass1: db w3,$ff vol_Bass2: db w3,w3,w3,w3,w1,$ff vol_Bass3: db w3,w3,w3,w3,w3,w3,w3,w2,w2,w2,w2,w1,$ff vol_PulseBass: db 15,15,14,14,13,13,12,12,11,11,10,10,9,9,8,8,8,7,7,7,6,6,6,5,5,5,4,4,4,4,3,3,3,3,2,2,2,2,2,1,1,1,1,1,1,0,$ff vol_Tom: db $1f,$ff vol_WaveLeadShort: db w3,w3,w3,w3,w2,$ff vol_WaveLeadMed: db w3,w3,w3,w3,w3,w3,w3,w2,$ff vol_WaveLeadLong: db w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w2,$ff vol_WaveLeadLong2: db w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w2,w2,w2,w2,w2,w2,w2,w2,w2,w2,w2,w2,w2,w2,w1,$ff vol_Arp2: db $2f,$ff vol_Kick: db $18,$ff vol_Snare: db $1d,$ff vol_OHH: db $48,$ff vol_CymbQ: db $6a,$ff vol_CymbL: db $3f,$ff vol_Echo1: db 8,$ff vol_Echo2: db 3,$ff vol_Triangle: db $16,$16,0,$ff vol_SteelDrum: db w3,w3,w3,w3,w2,w2,w2,w2,w1,w1,w1,w1,w0,$ff vol_WaveBass: db w3,w3,w3,w3,w3,w3,w3,w2,w2,w2,w2,w2,w2,w2,w1,w1,w1,w1,w1,w1,w1,w0,$ff vol_BeachLead: db 13,13,12,12,11,11,10,10,9,9,9,8,8,8,7,7,7,6,6,6,6,5,5,5,5,4,4,4,4,4,3,3,3,3,3,2,2,2,2,2,2,1,1,1,1,1,1,0,$ff vol_BeachOct: db $3c,$ff vol_DesertArp: db w3,w3,w3,w3,w3,w2,w2,w2,w2,w2,w1,$ff vol_DesertLeadS: db w3,w3,w3,w3,w3 vol_DesertLeadF: db w2,w2,w2,w2,w2 db w1,$ff vol_DesertLeadL: db w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3 db w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3 db w2,w2,w2,w2,w2,w2,w2,w2,w2,w2,w2,w2,w2,w2,w2,w2,w2,w2,w2,w2,w2,w2,w2,w2,w2,w2,w2,w2,w2,w2,w2,w2,w2,w2,w2,w2 db w1,$ff vol_TomEcho: db $1f,$1f,$1f,$1f,$1f,$1f,$1f,$1f,$1f db $18,$18,$18,$18,$18,$18,$18,$18,$18 db $14,$14,$14,$14,$14,$14,$14,$14,$14 db $12,$12,$12,$12,$12,$12,$12,$12,$12 db $11,$11,$11,$11,$11,$11,$11,$11,$11 db $ff vol_SnowBass db $3f,$ff vol_PWMLeadLong: db w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3 db w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3 db w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w3,w2,w2,w2,w2,w2,w2,w2,w2,w2,w2,w2,w2,w2,w2,w2,w2,w2,w2 db w2,w2,w2,w2,w2,w2,w2,w2,w2,w2,w2,w2,w2,w2,w2,w2,w2,w2,w2,w2,w2,w2,w2,w2,w2,w2,w2,w2,w2,w2,w2,w2,w2,w2,w2,w2 db w2,w2,w2,w2,w2,w2,w2,w2,w2,w2,w2,w2,w2,w2,w2,w2,w2,w1,$ff ; ================================================================= ; Arpeggio sequences ; ================================================================= arp_Gadunk: db 20,22,19,14,20,5,0,15,20,$ff arp_Pluck059: db 19,0,5,5,9,9,0,$80,1 arp_Pluck047: db 19,0,4,4,7,7,0,$80,1 arp_Octave: db 0,19,12,12,0,0,0,0,12,$80,2 arp_Pluck: db 12,0,$ff arp_Tom: db 22,20,18,16,14,12,10,9,7,6,4,3,2,1,0,$ff arp_TomEcho: db 22,20,18,16,14,12,10,9,7,$80,0 arp_BeachOct: db 12,12,0,0,$80,0 arp_940: db 9,9,4,4,0,0,$80,0 arp_720: db 7,7,2,2,0,0,$80,0 arp_520: db 5,5,2,2,0,0,$80,0 ; ================================================================= ; Noise sequences ; ================================================================= ; Noise values are the same as Deflemask, but with one exception: ; To convert 7-step noise values (noise mode 1 in deflemask) to a ; format usable by DevSound, take the corresponding value in the ; arpeggio macro and add s7. ; Example: db s7+32 = noise value 32 with step lengh 7 ; Note that each noiseseq must be terminated with a loop command ; ($80) otherwise the noise value will reset! s7 equ $2d noiseseq_Kick: db 32,26,37,$80,2 noiseseq_Snare: db s7+29,s7+23,s7+20,35,$80,3 noiseseq_Hat: db 41,43,$80,1 ; ================================================================= ; Pulse sequences ; ================================================================= pulse_Dummy: db 0,$ff pulse_Arp: db 2,2,2,1,1,1,0,0,0,3,3,3,$80,0 pulse_OctArp: db 2,2,2,1,1,2,$ff pulse_Bass: db 1,1,1,1,1,1,2,2,2,2,2,2,3,3,3,3,3,3,0,0,0,0,0,0,$80,0 pulse_Square: db 2,$ff pulse_Arp2: db 0,0,0,0,1,1,1,2,2,2,2,3,3,3,2,2,2,2,1,1,1,$80,0 pulse_BeachLead: db 0,0,0,0,0,0,0,0,0,0 db 1,1,1,1,1,1,1,1,1,1 db 2,2,2,2,2,2,2,2,2,2 db 3,3,3,3,3,3,3,3,3,3 db $80,0 pulse_BeachOct: db 2,2,1,1,0,0,$ff pulse_DesertBass db 0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,$80,0 pulse_SnowBass: db 1,$ff ; ================================================================= ; Vibrato sequences ; Must be terminated with a loop command! ; ================================================================= vib_Dummy: db 0,0,$80,1 vib_BeachLead: db 8,1,1,2,2,1,1,0,0,-1,-1,-2,-2,-1,-1,0,0,$80,1 vib_PWMLead: db 24,2,3,3,2,0,0,-2,-3,-3,-2,0,0,$80,1 ; ================================================================= ; Wave sequences ; ================================================================= WaveTable: dw wave_Bass dw DefaultWave dw wave_PWMB dw wave_PWM1,wave_PWM2,wave_PWM3,wave_PWM4 dw wave_PWM5,wave_PWM6,wave_PWM7,wave_PWM8 dw wave_PWM9,wave_PWMA,wave_PWMB,wave_PWMC dw wave_PWMD,wave_PWME,wave_PWMF,wave_PWM10 dw wave_SteelDrum dw wave_DesertLead dw wave_DesertSquare wave_Bass: db $00,$01,$11,$11,$22,$11,$00,$02,$57,$76,$7a,$cc,$ee,$fc,$b1,$23 wave_SteelDrum: db $cf,$ee,$fe,$a7,$9d,$f9,$21,$15,$ae,$ed,$60,$16,$85,$10,$11,$03 wave_DesertLead: db $01,$23,$45,$67,$89,$ab,$cd,$ef,$ed,$b9,$75,$31,$02,$46,$8a,$ce wave_DesertSquare: db $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$00,$00,$00,$44,$44,$00,$00,$00 wave_PWM1: db $f0,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 wave_PWM2: db $ff,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 wave_PWM3: db $ff,$f0,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 wave_PWM4: db $ff,$ff,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 wave_PWM5: db $ff,$ff,$f0,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 wave_PWM6: db $ff,$ff,$ff,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 wave_PWM7: db $ff,$ff,$ff,$f0,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 wave_PWM8: db $ff,$ff,$ff,$ff,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 wave_PWM9: db $ff,$ff,$ff,$ff,$f0,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 wave_PWMA: db $ff,$ff,$ff,$ff,$ff,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 wave_PWMB: db $ff,$ff,$ff,$ff,$ff,$f0,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 wave_PWMC: db $ff,$ff,$ff,$ff,$ff,$ff,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 wave_PWMD: db $ff,$ff,$ff,$ff,$ff,$ff,$f0,$00,$00,$00,$00,$00,$00,$00,$00,$00 wave_PWME: db $ff,$ff,$ff,$ff,$ff,$ff,$ff,$00,$00,$00,$00,$00,$00,$00,$00,$00 wave_PWMF: db $ff,$ff,$ff,$ff,$ff,$ff,$ff,$f0,$00,$00,$00,$00,$00,$00,$00,$00 wave_PWM10: db $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$00,$00,$00,$00,$00,$00,$00,$00 waveseq_Bass: db 0,$ff waveseq_Tri: db 1,$ff waveseq_PulseLead: db 2,$ff waveseq_SteelDrum: db 19,$ff waveseq_DesertLead: db 20,$ff waveseq_Square: db 21,$ff waveseq_WaveBuffer: db $c0,$ff ; ================================================================= ; Instruments ; ================================================================= InstrumentTable: dw ins_Gadunk dw ins_Arp1 dw ins_Arp2 dw ins_OctArp dw ins_Bass1 dw ins_Bass2 dw ins_Bass3 dw ins_GadunkWave dw ins_Kick dw ins_Snare dw ins_CHH dw ins_OHH dw ins_CymbQ dw ins_CymbL dw ins_PulseBass dw ins_Tom dw ins_Arp dw ins_WaveLeadShort dw ins_WaveLeadMed dw ins_WaveLeadLong dw ins_WaveLeadLong2 dw ins_Echo1 dw ins_Echo2 dw ins_Tri dw ins_SteelDrum dw ins_BeachBass dw ins_BeachLead dw ins_BeachOctArp dw ins_TomEcho dw ins_DesertBass dw ins_DesertLead dw ins_DesertLeadF dw ins_DesertLeadS dw ins_DesertLeadL dw ins_DesertOctArp dw ins_DesertArp720 dw ins_DesertArp940 dw ins_DesertArp520 dw ins_PWMLead dw ins_PWMLeadLong dw ins_SnowBass ; Instrument format: [no reset flag],[wave mode (ch3 only)],[voltable id],[arptable id],[pulsetable/wavetable id],[vibtable id] ; note that wave mode must be 0 for non-wave instruments ; !!! REMEMBER TO ADD INSTRUMENTS TO THE INSTRUMENT POINTER TABLE !!! ins_Gadunk: Instrument 0,vol_Gadunk,arp_Gadunk,pulse_Dummy,vib_Dummy ins_Arp1: Instrument 0,vol_Arp,arp_Pluck059,pulse_Arp,vib_Dummy ins_Arp2: Instrument 0,vol_Arp,arp_Pluck047,pulse_Arp,vib_Dummy ins_OctArp: Instrument 0,vol_OctArp,arp_Octave,pulse_OctArp,vib_Dummy ins_Bass1: Instrument 0,vol_Bass1,arp_Pluck,waveseq_Bass,vib_Dummy ins_Bass2: Instrument 0,vol_Bass2,arp_Pluck,waveseq_Bass,vib_Dummy ins_Bass3: Instrument 0,vol_Bass3,arp_Pluck,waveseq_Bass,vib_Dummy ins_GadunkWave: Instrument 0,vol_Bass1,arp_Gadunk,waveseq_Tri,vib_Dummy ins_Kick: Instrument 0,vol_Kick,noiseseq_Kick,DummyTable,DummyTable ; pulse/waveseq and vibrato unused by noise instruments ins_Snare: Instrument 0,vol_Snare,noiseseq_Snare,DummyTable,DummyTable ins_CHH: Instrument 0,vol_Kick,noiseseq_Hat,DummyTable,DummyTable ins_OHH: Instrument 0,vol_OHH,noiseseq_Hat,DummyTable,DummyTable ins_CymbQ: Instrument 0,vol_CymbQ,noiseseq_Hat,DummyTable,DummyTable ins_CymbL: Instrument 0,vol_CymbL,noiseseq_Hat,DummyTable,DummyTable ins_PulseBass: Instrument 0,vol_PulseBass,arp_Pluck,pulse_Bass,vib_Dummy ins_Tom: Instrument 0,vol_Tom,arp_Tom,pulse_Square,vib_Dummy ins_Arp: Instrument 1,vol_Arp2,ArpBuffer,pulse_Arp2,vib_Dummy ins_WaveLeadShort: Instrument 0,vol_WaveLeadShort,arp_Pluck,waveseq_PulseLead,vib_Dummy ins_WaveLeadMed: Instrument 0,vol_WaveLeadMed,arp_Pluck,waveseq_PulseLead,vib_Dummy ins_WaveLeadLong: Instrument 0,vol_WaveLeadLong,arp_Pluck,waveseq_PulseLead,vib_Dummy ins_WaveLeadLong2: Instrument 0,vol_WaveLeadLong2,arp_Pluck,waveseq_PulseLead,vib_Dummy ins_Echo1: Instrument 0,vol_Echo1,DummyTable,pulse_Dummy,vib_Dummy ins_Echo2: Instrument 0,vol_Echo2,DummyTable,pulse_Dummy,vib_Dummy ins_Tri: Instrument 0,vol_Triangle,DummyTable,pulse_Square,vib_Dummy ins_SteelDrum: Instrument 0,vol_SteelDrum,arp_Pluck,waveseq_SteelDrum,vib_Dummy ins_BeachBass: Instrument 0,vol_WaveBass,arp_Pluck,waveseq_PulseLead,vib_Dummy ins_BeachLead: Instrument 1,vol_BeachLead,arp_Pluck,pulse_BeachLead,vib_BeachLead ins_BeachOctArp: Instrument 0,vol_BeachOct,arp_BeachOct,pulse_BeachOct,vib_Dummy ins_TomEcho: Instrument 0,vol_TomEcho,arp_TomEcho,pulse_Square,vib_Dummy ins_DesertBass: Instrument 0,vol_PulseBass,arp_Pluck,pulse_DesertBass,vib_Dummy ins_DesertLead: Instrument 0,vol_Bass1,arp_Pluck,waveseq_DesertLead,vib_BeachLead ins_DesertLeadF: Instrument 0,vol_DesertLeadF,DummyTable,waveseq_DesertLead,vib_Dummy ins_DesertLeadS: Instrument 0,vol_DesertLeadS,arp_Pluck,waveseq_DesertLead,vib_Dummy ins_DesertLeadL: Instrument 0,vol_DesertLeadL,arp_Pluck,waveseq_DesertLead,vib_BeachLead ins_DesertOctArp: Instrument 0,vol_DesertArp,arp_BeachOct,waveseq_Square,vib_BeachLead ins_DesertArp720: Instrument 0,vol_DesertArp,arp_720,waveseq_Square,vib_Dummy ins_DesertArp940: Instrument 0,vol_DesertArp,arp_940,waveseq_Square,vib_Dummy ins_DesertArp520: Instrument 0,vol_DesertArp,arp_520,waveseq_Square,vib_Dummy ins_PWMLead: Instrument 0,vol_WaveLeadLong2,arp_Pluck,waveseq_WaveBuffer,vib_PWMLead ins_PWMLeadLong: Instrument 0,vol_PWMLeadLong,arp_Pluck,waveseq_WaveBuffer,vib_PWMLead ins_SnowBass: Instrument 0,vol_SnowBass,arp_Pluck,pulse_SnowBass,vib_Dummy _ins_Gadunk equ 0 _ins_Arp1 equ 1 _ins_Arp2 equ 2 _ins_OctArp equ 3 _ins_Bass1 equ 4 _ins_Bass2 equ 5 _ins_Bass3 equ 6 _ins_GadunkWave equ 7 _ins_Kick equ 8 _ins_Snare equ 9 _ins_CHH equ 10 _ins_OHH equ 11 _ins_CymbQ equ 12 _ins_CymbL equ 13 _ins_PulseBass equ 14 _ins_Tom equ 15 _ins_Arp equ 16 _ins_WaveLeadShort equ 17 _ins_WaveLeadMed equ 18 _ins_WaveLeadLong equ 19 _ins_WaveLeadLong2 equ 20 _ins_Echo1 equ 21 _ins_Echo2 equ 22 _ins_Tri equ 23 _ins_SteelDrum equ 24 _ins_BeachBass equ 25 _ins_BeachLead equ 26 _ins_BeachOctArp equ 27 _ins_TomEcho equ 28 _ins_DesertBass equ 29 _ins_DesertLead equ 30 _ins_DesertLeadF equ 31 _ins_DesertLeadS equ 32 _ins_DesertLeadL equ 33 _ins_DesertOctArp equ 34 _ins_DesertArp720 equ 35 _ins_DesertArp940 equ 36 _ins_DesertArp520 equ 37 _ins_PWMLead equ 38 _ins_PWMLeadLong equ 39 _ins_SnowBass equ 40 Kick equ _ins_Kick Snare equ _ins_Snare CHH equ _ins_CHH OHH equ _ins_OHH CymbQ equ _ins_CymbQ CymbL equ _ins_CymbL ; ================================================================= PT_Triumph: dw Triumph_CH1,Triumph_CH2,Triumph_CH3,Triumph_CH4 Triumph_CH1: db SetInstrument,_ins_OctArp db SetLoopPoint db F_5,6,D#5,6,F_5,8,F_5,4,G#5,4,F_5,4,D#5,4,C#5,4,D#5,4,F_5,4,D#5,6,C#5,6,A#4,4 db C#5,20,A#4,4,C#5,4,D#5,4,F_5,6,F#5,6,F_5,4,C#5,8,D#5,8 db F_5,6,D#5,6,F_5,8,F_5,4,G#5,4,F_5,4,D#5,4,C#5,4,D#5,4,F_5,4,D#5,6,C#5,6,A#4,4 db C#5,20,C#5,4,D#5,4,C#5,4,A#5,6,B_5,6,A#5,4,F#5,8,G#5,8 db GotoLoopPoint db EndChannel Triumph_CH2: db SetLoopPoint db $80,1,G#4,6,G#4,6,G#4,12,G#4,4,G#4,4,$80,2,G#4,4,G#4,4,G#4,4,$80,1,G#4,4,$80,2,G#4,6,G#4,6,$80,1,G#4,4 db $80,2,B_4,6,B_4,6,B_4,12,$80,1,B_4,4,$80,2,B_4,4,F#4,4,F#4,4,F#4,4,$80,1,F#4,4,$80,2,F#4,6,$80,1,E_4,6,F#4,4 db $80,1,G#4,6,G#4,6,G#4,12,G#4,4,G#4,4,$80,2,G#4,4,G#4,4,G#4,4,$80,1,G#4,4,$80,2,G#4,6,G#4,6,$80,1,G#4,4 db $80,2,B_4,6,B_4,6,B_4,12,$80,1,B_4,4,$80,2,B_4,4,F#5,4,F#5,4,F#5,4,$80,1,F#5,4,$80,2,F#5,6,$80,1,E_5,6,F#5,4 db GotoLoopPoint db EndChannel Triumph_CH3: db SetInstrument,4 db SetLoopPoint db C#3,4,C#4,2,$80,5,C#3,2,$80,4,G#3,4,C#4,4,C#3,4,$80,6,C#4,4,$80,4,G#3,4,C#4,4 db G#2,4,G#3,2,$80,5,G#2,2,$80,4,D#3,4,G#3,4,G#2,4,$80,6,G#3,4,$80,4,G#2,4,A#2,4 db B_2,4,B_3,2,$80,5,B_2,2,$80,4,F#3,4,B_3,4,B_2,4,$80,6,B_3,4,$80,4,C#4,4,B_3,4 db F#2,4,F#3,2,$80,5,F#2,2,$80,4,C#3,4,F#3,4,F#2,4,$80,6,F#3,4,$80,4,B_2,4,B_3,4 db GotoLoopPoint db EndChannel Triumph_CH4: .block0 db SetLoopPoint Drum CymbL,8 Drum Snare,4 Drum CHH,4 Drum Kick,4 Drum CHH,2 db fix,2 Drum Snare,4 Drum OHH,4 Drum Kick,4 Drum CHH,4 Drum Snare,4 Drum CHH,4 Drum Kick,4 Drum CHH,2 db fix,2 Drum Snare,4 Drum Kick,2 Drum CHH,2 Drum Kick,4 Drum CHH,4 Drum Snare,4 Drum CHH,4 Drum Kick,4 Drum CHH,2 db fix,2 Drum Snare,4 Drum OHH,4 Drum Kick,4 Drum CHH,4 Drum Snare,4 Drum CHH,4 Drum Kick,4 Drum CHH,2 db fix,2 Drum Snare,4 Drum Kick,2 Drum CHH,2 db SetChannelPtr dw .block1 db EndChannel .block1 Drum Kick,4 Drum CHH,4 Drum Snare,4 Drum CHH,4 Drum Kick,4 Drum CHH,2 db fix,2 Drum Snare,4 Drum OHH,4 Drum Kick,4 Drum CHH,4 Drum Snare,4 Drum CHH,4 Drum Kick,4 Drum CHH,2 db fix,2 Drum Snare,4 Drum Kick,2 Drum CHH,2 Drum Kick,4 Drum CHH,4 Drum Snare,4 Drum CHH,4 Drum Kick,4 Drum CHH,2 db fix,2 Drum Snare,4 Drum OHH,4 Drum Kick,4 Drum CHH,4 Drum Snare,4 Drum CHH,4 Drum Kick,4 Drum CHH,2 db fix,2 Drum Snare,4 db fix,2 db fix,2 db SetChannelPtr dw .block0 db EndChannel ; ================================================================= PT_InsertTitleHere: dw InsertTitleHere_CH1,InsertTitleHere_CH2,InsertTitleHere_CH3,InsertTitleHere_CH4 InsertTitleHere_CH1: db CallSection dw .block0 db CallSection dw .block0 db SetLoopPoint db CallSection dw .block0 db CallSection dw .block0 db CallSection dw .block0 db CallSection dw .block0 db CallSection dw .block1 db CallSection dw .block1 db CallSection dw .block1 db CallSection dw .block1 db GotoLoopPoint db EndChannel .block0 db $80,14,E_2,6,$80,15,fix,4,$80,14,E_2,6,E_3,2,$80,15,fix,4,$80,14,E_3,2 db $80,14,C_2,6,$80,15,fix,4,$80,14,C_2,6,C_3,2,$80,15,fix,4,$80,14,C_3,2 db $80,14,G_2,6,$80,15,fix,4,$80,14,G_2,6,G_3,2,$80,15,fix,4,$80,14,G_3,2 db $80,14,D#2,6,$80,15,fix,4,$80,14,D#2,6,D#3,2,$80,15,fix,4,$80,14,D#3,2 ret .block1 db $80,14,F#2,6,$80,15,fix,4,$80,14,F#2,6,F#3,2,$80,15,fix,4,$80,14,F#3,2 db $80,14,D_2,6,$80,15,fix,4,$80,14,D_2,6,D_3,2,$80,15,fix,4,$80,14,B_2,2 db $80,14,A_2,6,$80,15,fix,4,$80,14,A_2,6,A_3,2,$80,15,fix,4,$80,14,A_3,2 db $80,14,F_2,6,$80,15,fix,4,$80,14,F_2,6,F_3,2,$80,15,fix,4,$80,14,C#3,2 ret InsertTitleHere_CH2: db SetInstrument,_ins_Arp db CallSection dw .block0 db CallSection dw .block0 db SetLoopPoint db CallSection dw .block0 db CallSection dw .block0 db CallSection dw .block0 db CallSection dw .block0 db CallSection dw .block1 db CallSection dw .block1 db CallSection dw .block1 db CallSection dw .block1 db GotoLoopPoint db EndChannel .block0 db Arp,1,$37 db E_4,10,E_4,8,E_4,6 db Arp,1,$38 db E_4,10,E_4,8,E_4,6 db B_3,10,B_3,8,B_3,6 db D#4,10,D#4,8,D#4,6 ret .block1 db Arp,1,$37 db F#4,10,F#4,8,F#4,6 db Arp,1,$38 db F#4,10,F#4,8,F#4,6 db C#4,10,C#4,8,C#4,6 db F_4,10,F_4,8,F_4,6 ret InsertTitleHere_CH3: db rest,192 db SetLoopPoint db $80,19,B_5,6,A_5,6,$80,18,G_5,4,$80,17,A_5,2,$80,18,G_5,4,$80,17,E_5,2 db $80,18,D_5,4,$80,17,E_5,2,$80,18,G_5,4,$80,20,D_5,12,$80,17,B_4,2 db $80,19,D_5,6,B_4,6,$80,18,D_5,4,$80,17,B_4,2,$80,18,D_5,4,$80,17,B_4,2 db $80,19,D#5,6,B_4,6,$80,18,D#5,4,$80,17,B_4,2,$80,18,A_4,4,$80,17,B_4,2 db $80,20,E_4,18,rest,78 db $80,19,B_5,6,A_5,6,$80,18,G_5,4,$80,17,A_5,2,$80,18,G_5,4,$80,17,E_5,2 db $80,18,B_5,4,$80,17,A_5,2,$80,18,G_5,4,$80,20,D_5,12,$80,17,E_5,2 db $80,19,G_5,6,E_5,6,$80,18,G_5,4,$80,19,A_5,6,$80,17,A#5,2 db $80,19,B_5,6,A_5,6,$80,18,D#5,4,$80,19,G_5,6,$80,17,D_5,2 db $80,20,E_5,18,rest,78 db CallSection dw .block1 db rest,10 db $80,17,C#5,2,$80,18,E_5,4,$80,17,C#5,2,$80,18,E_5,4,$80,17,C#5,2,$80,18,B_4,4,$80,17,C#5,2 db CallSection dw .block1 db rest,30 db GotoLoopPoint db EndChannel .block1 db $80,20,F#5,10,E_5,8,$80,19,C#5,6 db D_5,6,$80,18,E_5,4,$80,19,D_5,6,$80,17,A_4,2,$80,18,D_5,4,$80,17,E_5,2 db $80,20,A_5,10,F#5,8,$80,19,C#5,6 db $80,18,E_5,4,$80,17,F#5,2,$80,18,E_5,4,$80,17,F#5,2,$80,18,A_5,4,$80,17,F#5,2,$80,18,E_5,4,$80,17,C#5,2 db $80,20,F#5,10,E_5,8,$80,19,C#5,6 db A_5,6,$80,18,B_5,4,$80,19,A_5,6,$80,17,F#5,2,$80,18,E_5,4,$80,17,F#5,2 db $80,20,E_5,18 ret InsertTitleHere_CH4: db SetLoopPoint Drum Kick,4 Drum CHH,2 Drum Snare,4 Drum CHH,2 Drum Kick,4 Drum Kick,2 Drum Snare,4 Drum CHH,2 db GotoLoopPoint db EndChannel ; ================================================================= PT_Beach: dw Beach_CH1,Beach_CH2,Beach_CH3,Beach_CH4 Beach_CH1: db SetLoopPoint db rest,$e0 db SetInstrument,_ins_BeachLead db E_4,2 db E_4,2 db E_4,2 db rest,4 db E_4,4 db E_4,2 db E_4,2 db rest,2 db G_5,4 db F_5,4 db E_5,4 db E_5,6 db C_5,2 db rest,4 db G_4,8 db F_5,4 db E_5,4 db D_5,4 db E_5,6 db C_5,2 db rest,4 db G_5,12 db A_5,8 db G_5,6 db A_5,2 db rest,4 db G_5,8 db F_5,4 db E_5,4 db D_5,4 db E_5,16 db SetInstrument,_ins_BeachOctArp db G_5,8 db A_5,8 db G_5,12 db SetInstrument,_ins_BeachLead db F_5,4 db E_5,8 db C_5,8 db C_5,6 db D_5,2 db rest,4 db C_5,8 db A_4,4 db G_4,4 db A_4,4 db G_4,8 db C_5,8 db B_4,6 db E_5,6 db B_4,4 db E_4,2 db E_4,2 db E_4,2 db rest,4 db E_4,4 db E_4,2 db E_4,2 db rest,14 db GotoLoopPoint db EndChannel Beach_CH2: db SetLoopPoint db SetInstrument,_ins_Tri db CallSection dw .block0 db CallSection dw .block0 db CallSection dw .block0 db CallSection dw .block0 db CallSection dw .block0 db CallSection dw .block0 db CallSection dw .block0 db SetInstrument,_ins_BeachLead db G_4,2 db G_4,2 db G_4,2 db rest,4 db G_4,4 db G_4,2 db G_4,2 db rest,14 db GotoLoopPoint db EndChannel .block0 db D_6,4 db D_6,2 db A_5,4 db A_5,4 db D_6,4 db D_6,4 db D_6,2 db A_5,4 db A_5,4 ret Beach_CH3: db SetInstrument,_ins_SteelDrum db SetLoopPoint db CallSection dw .block0 db CallSection dw .block0 db CallSection dw .block0 db CallSection dw .block1 db C_6,2 db C_6,2 db C_6,6 db C_6,4 db C_6,2 db C_6,12 db SetInstrument,_ins_BeachBass db G_3,4 db CallSection dw .block2 db CallSection dw .block2 db CallSection dw .block2 db CallSection dw .block3 db SetInstrument,_ins_SteelDrum db C_6,2 db C_6,2 db C_6,6 db C_6,4 db C_6,2 db C_6,16 db GotoLoopPoint db EndChannel .block0 db C_5,4 db E_5,2 db G_5,4 db C_5,4 db D_5,4 db A_5,4 db D_5,2 db F_5,4 db A_5,4 db E_5,4 db G_5,2 db B_5,4 db G_5,2 db E_5,2 db D_5,4 db A_5,4 db D_5,2 db F_5,4 db A_5,4 ret .block1 db C_5,4 db E_5,2 db G_5,4 db C_5,4 db D_5,4 db A_5,4 db D_5,2 db F_5,4 db A_5,4 ret .block2 db C_3,6 db G_3,2 db rest,4 db C_3,2 db C#3,2 db D_3,6 db A_3,2 db rest,4 db D_3,4 db E_3,6 db B_3,2 db rest,4 db E_3,2 db D#3,2 db D_3,6 db A_3,2 db rest,4 db D_3,4 ret .block3 db C_3,6 db G_3,2 db rest,4 db C_3,2 db C#3,2 db D_3,6 db A_3,2 db rest,4 db D_3,4 ret Beach_CH4: db SetLoopPoint db CallSection dw .block0 db CallSection dw .block0 db CallSection dw .block0 db CallSection dw .block0 db CallSection dw .block0 db CallSection dw .block0 db CallSection dw .block0 db CallSection dw .block1 Drum Kick,2 Drum Kick,2 db CallSection dw .block2 db CallSection dw .block2 db CallSection dw .block2 db CallSection dw .block2 db CallSection dw .block2 db CallSection dw .block2 db CallSection dw .block2 db CallSection dw .block1 db rest,4 db GotoLoopPoint db EndChannel .block0 Drum Kick,2 Drum CHH,2 Drum OHH,4 Drum Kick,2 Drum CHH,2 Drum OHH,4 Drum Kick,2 Drum CHH,2 Drum OHH,4 Drum Kick,2 Drum CHH,2 Drum OHH,4 ret .block1 Drum Snare,2 Drum CHH,2 Drum Kick,2 Drum Snare,2 Drum CHH,2 Drum Kick,2 Drum Snare,2 Drum Kick,2 Drum Snare,12 ret .block2 Drum Kick,2 Drum CHH,2 Drum Kick,2 Drum CHH,2 Drum Snare,4 Drum OHH,2 Drum CHH,2 Drum Kick,2 Drum CHH,2 Drum OHH,2 Drum CHH,2 Drum Snare,4 Drum OHH,2 Drum CHH,2 ret ; ================================================================= PT_Desert: dw Desert_CH1,Desert_CH2,Desert_CH3,Desert_CH4 Desert_CH1: db SetInstrument,_ins_DesertBass db SetLoopPoint db CallSection dw .block0 db GotoLoopPoint .block0 db F_2,2 db F_2,4 db F_2,2 Drum _ins_TomEcho,4 db SetInstrument,_ins_DesertBass db D#2,2 db F_2,4 db F_2,2 db D#2,2 db F_2,2 Drum _ins_TomEcho,6 db SetInstrument,_ins_DesertBass db F_2,2 db F#2,2 db F#2,4 db F#2,2 Drum _ins_TomEcho,4 db SetInstrument,_ins_DesertBass db F_2,2 db F#2,4 db F#2,2 db F_2,2 db F#2,2 Drum _ins_TomEcho,6 db SetInstrument,_ins_DesertBass db A_2,2 ret Desert_CH2: db SetInsAlternate,_ins_Echo1,_ins_Echo2 db SetLoopPoint db F_5,1,C#5,1 db C_5,1,F_5,1 db D#5,1,C_5,1 db C_5,1,D#5,1 db CallSection dw .block0 db CallSection dw .block0 db CallSection dw .block0 db F#5,1,C_5,1 db C#5,1,F#5,1 db E_5,1,C#5,1 db C#5,1,E_5,1 db CallSection dw .block1 db CallSection dw .block1 db CallSection dw .block1 db GotoLoopPoint .block0 db F_5,1,C_5,1 db C_5,1,F_5,1 db D#5,1,C_5,1 db C_5,1,D#5,1 ret .block1 db F#5,1,C#5,1 db C#5,1,F#5,1 db E_5,1,C#5,1 db C#5,1,E_5,1 ret Desert_CH3: db SetLoopPoint db SetInstrument,_ins_DesertLead db CallSection dw .block0 db CallSection dw .block0 db CallSection dw .block1 db C#5,18,C#5,2 db D#5,3,D#5,1 db SetInsAlternate,_ins_DesertLead,_ins_DesertLeadS db C#5,2 db D#5,2 db C#5,2 db A#4,2 db CallSection dw .block1 db SetInsAlternate,_ins_DesertLead,_ins_DesertLeadS db F#5,2 db G#5,2 db F#5,2 db G#5,2 db SetInstrument,_ins_DesertLead db F#5,4 db G#5,2 db SetInstrument,_ins_DesertLeadF db G#5,2 db SetInstrument,_ins_DesertLead db F#5,8 db A#5,6 db SetInstrument,_ins_DesertLeadF db A#5,2 db SetInstrument,_ins_DesertLead db C_6,10 db SetInstrument,_ins_DesertLeadF db C_6,2 db SetInstrument,_ins_DesertLead db G#5,4 db F_5,6 db SetInstrument,_ins_DesertLeadF db F_5,2 db SetInsAlternate,_ins_DesertLeadS,_ins_DesertLead db G#5,2 db F_5,2 db C_5,2 db F_5,2 db F#5,2 db F_5,2 db F#5,2 db G#5,2 db SetInstrument,_ins_DesertLead db F#5,4 db G#5,2 db SetInstrument,_ins_DesertLeadF db G#5,2 db SetInsAlternate,_ins_DesertLead,_ins_DesertLeadF db F#5,6,F#5,2 db D#5,6,D#5,2 db SetInstrument,_ins_DesertLeadL db F_5,32 db SetInstrument,_ins_DesertArp720 db F#5,4 db F#5,4 db F#5,2 db F#5,4 db F#5,4 db F#5,4 db F#5,2 db SetInstrument,_ins_DesertArp940 db F#5,2 db F#5,2 db SetInstrument,_ins_DesertArp720 db F#5,2 db SetInstrument,_ins_DesertArp520 db F#5,2 db SetInstrument,_ins_DesertLead db CallSection dw .block0 db CallSection dw .block0 db SetInstrument,_ins_DesertOctArp db CallSection dw .block0 db CallSection dw .block2 db GotoLoopPoint .block0 db F_5,2 db D#5,2 db F_5,2 db F#5,2 db F_5,2 db D#5,2 db F_5,2 db C_5,2 db F_5,2 db C_5,2 db F_5,2 db A_5,4 db F_5,2 db D#5,2 db F_5,2 db F#5,2 db C#5,2 db A#5,2 db G#5,2 db F#5,2 db F_5,2 db F#5,2 db C#5,2 db F#5,2 db C#5,2 db F#5,2 db A#5,4 db G#5,2 db F#5,2 db D#5,2 ret .block1 db SetInsAlternate,_ins_DesertLead,_ins_DesertLeadF db C_5,14,C_5,2 db F_5,6,F_5,2 db C_5,6,C_5,2 ret .block2 db F_6,2 db D#6,2 db F_6,2 db F#6,2 db F_6,2 db D#6,2 db F_6,2 db C_6,2 db F_6,2 db C_6,2 db F_6,2 db A_6,4 db F_6,2 db D#6,2 db F_6,2 db F#6,2 db C#6,2 db A#6,2 db G#6,2 db F#6,2 db F_6,2 db F#6,2 db C#6,2 db F#6,2 db C#6,2 db F#6,2 db A#6,4 db G#6,2 db F#6,2 db D#6,2 ret Desert_CH4: db SetLoopPoint Drum Kick,2 Drum CHH,2 Drum OHH,2 Drum CHH,2 Drum Snare,4 Drum OHH,2 Drum CHH,2 db GotoLoopPoint ; ================================================================= PT_Snow: dw Snow_CH1,Snow_CH2,Snow_CH3,Snow_CH4 Snow_CH1: db SetInstrument,_ins_SnowBass db SetLoopPoint db CallSection dw .block0 db E_2,2 db CallSection dw .block0 db C#3,2 db CallSection dw .block1 db F#2,4,F#3,2,F#2,4,F#2,2,E_3,4,F#3,2,F#2,4,C#2,2 db CallSection dw .block2 db CallSection dw .block0 db E_2,2 db CallSection dw .block0 db C#3,2 db CallSection dw .block1 db F#2,4,F#3,2,F#2,4,F#2,2,E_3,4,F#3,2,F#2,4,C#2,2 db CallSection dw .block3 db B_2,4,C#3,2 db CallSection dw .block1 db A_2,4,A_3,2,A_2,4,A_2,2,G_3,4,A_3,2,A_2,4,A_2,2 db CallSection dw .block2 db CallSection dw .block1 db F#2,4,F#3,2,F#2,4,F#2,2,E_3,4,F#3,2,F#2,4,C#2,2 db CallSection dw .block3 db B_2,4,G_2,2 db GotoLoopPoint .block0 db A_2,4,A_3,2,A_2,4,A_2,2,G_3,4,A_3,2,A_2,4,B_2,2 db G_2,4,G_3,2,G_2,4,G_2,2,F#3,4,G_3,2,G_2,4,E_2,2 db A_2,4,A_3,2,A_2,4,A_2,2,G_3,4,A_3,2,A_2,4,G_2,2 db A_2,4,A_3,2,A_2,4,A_2,2,G_3,4,A_3,2,A_2,4 ret .block1 db D_3,4,D_4,2,D_3,4,D_3,2,C#4,4,D_4,2,D_3,4,A_2,2 db B_2,4,B_3,2,B_2,4,B_2,2,A_3,4,B_3,2,B_2,4,G_2,2 db E_2,4,E_3,2,E_2,4,E_2,2,D_3,4,E_3,2,E_2,4,E_2,2 ret .block2 db D_2,4,D_3,2,D_2,4,D_2,2,C#3,4,D_3,2,D_2,4,C#2,2 db D_2,4,D_3,2,D_2,4,D_2,2,C#3,4,D_3,2,D_2,4,C#2,2 db E_2,4,E_3,2,E_2,4,E_2,2,D_3,4,E_3,2,E_2,4,E_2,2 db E_2,4,E_3,2,E_2,4,E_2,2,D_3,4,E_3,2,E_2,4,G#2,2 ret .block3 db D_2,4,D_3,2,D_2,4,D_2,2,C#3,4,D_3,2,D_2,4,D_2,2 db E_2,4,E_3,2,E_2,4,E_2,2,D_3,4,E_3,2,E_2,4,G#2,2 db A_2,4,A_3,2,A_2,4,A_2,2,G_3,4,A_3,2,A_2,4,G_2,2 db A_2,4,A_3,2,A_2,4,A_2,2,G_3,4,A_3,2 ret Snow_CH2: db SetInstrument,_ins_Arp db CallSection dw .block0 db CallSection dw .block1 db CallSection dw .block0 db CallSection dw .block2 db CallSection dw .block3 db CallSection dw .block4 db Arp,1,$47 db G_4,6 db G_4,6 db G_4,4 db G_4,2 db rest,4 db G_4,6 db G_4,2 db G_4,4 db G_4,2 db G_4,4 db G_4,2 db rest,4 db G_4,2 db Arp,1,$38 db G#4,6 db G#4,6 db G#4,4 db G#4,2 db rest,4 db G#4,6 db G#4,2 db G#4,4 db G#4,2 db G#4,4 db G#4,2 db rest,4 db G#4,2 db CallSection dw .block0 db CallSection dw .block1 db CallSection dw .block0 db CallSection dw .block2 db CallSection dw .block3 db CallSection dw .block4 db CallSection dw .block5 db CallSection dw .block2 db CallSection dw .block3 db Arp,1,$5a db E_4,6 db E_4,6 db E_4,4 db E_4,2 db rest,4 db Arp,1,$59 db E_4,6 db E_4,2 db E_4,4 db E_4,2 db E_4,4 db E_4,2 db rest,4 db E_4,2 db Arp,1,$38 db B_3,6 db B_3,6 db B_3,4 db B_3,2 db rest,4 db B_3,6 db B_3,2 db B_3,4 db B_3,2 db B_3,4 db B_3,2 db rest,4 db B_3,2 db Arp,1,$47 db E_4,6 db E_4,6 db E_4,4 db E_4,2 db rest,4 db E_4,6 db E_4,2 db E_4,4 db E_4,2 db E_4,4 db E_4,2 db rest,4 db E_4,2 db CallSection dw .block3 db CallSection dw .block4 db CallSection dw .block5 db CallSection dw .block2 db GotoLoopPoint .block0 db Arp,1,$38 db C#4,6 db C#4,6 db C#4,4 db C#4,2 db rest,4 db Arp,1,$59 db D_4,6 db D_4,2 db D_4,4 db D_4,2 db D_4,4 db D_4,2 db rest,4 db D_4,2 ret .block1 db Arp,1,$38 db C#4,6 db C#4,6 db C#4,4 db C#4,2 db rest,4 db C#4,6 db C#4,2 db C#4,4 db C#4,2 db C#4,4 db C#4,2 db rest,4 db C#4,2 ret .block2 db Arp,1,$57 db A_4,6 db A_4,6 db A_4,4 db A_4,2 db rest,4 db Arp,1,$47 db A_4,6 db A_4,2 db A_4,4 db A_4,2 db A_4,4 db A_4,2 db rest,4 db A_4,2 ret .block3 db Arp,1,$37 db B_4,6 db B_4,6 db B_4,4 db B_4,2 db rest,4 db Arp,1,$59 db B_4,6 db B_4,2 db B_4,4 db B_4,2 db B_4,4 db B_4,2 db rest,4 db B_4,2 ret .block4 db Arp,1,$47 db A_4,6 db A_4,6 db A_4,4 db A_4,2 db rest,4 db Arp,1,$49 db C#4,6 db C#4,2 db C#4,4 db C#4,2 db C#4,4 db C#4,2 db rest,4 db C#4,2 ret .block5 db Arp,1,$47 db D_4,6 db D_4,6 db D_4,4 db D_4,2 db rest,4 db E_4,6 db E_4,2 db E_4,4 db E_4,2 db E_4,4 db E_4,2 db rest,4 db E_4,2 ret Snow_CH3: db EnablePWM,$f,7 db SetLoopPoint db CallSection dw .block0 db A_5,4 db B_5,2 db C#6,4 db A_5,2 db rest,4 db SetInstrument,_ins_PWMLeadLong db E_5,38 db CallSection dw .block0 db E_6,1 db F#6,5 db SetInstrument,_ins_PWMLeadLong db E_6,48 db CallSection dw .block1 db SetInstrument,_ins_PWMLead db D_6,6 db C#6,6 db B_5,4 db A_5,2 db rest,4 db D_6,8 db C#6,6 db B_5,6 db E_6,1 db F#6,5 db SetInstrument,_ins_PWMLeadLong db E_6,48 db CallSection dw .block0 db A_5,4 db B_5,2 db C#6,4 db A_5,2 db rest,4 db SetInstrument,_ins_PWMLeadLong db E_5,38 db CallSection dw .block0 db E_6,1 db F#6,5 db SetInstrument,_ins_PWMLeadLong db E_6,48 db CallSection dw .block1 db D_6,6 db C#6,6 db B_5,4 db A_5,2 db rest,4 db SetInstrument,_ins_PWMLeadLong db G#5,14 db F#5,4 db G#5,2 db rest,4 db G#5,1 db A_5,37 db B_5,6 db C#6,6 db CallSection dw .block2 db E_6,42 db SetInstrument,_ins_PWMLead db C#6,6 db D_6,6 db C#6,2 db rest,2 db B_5,6 db C#6,2 db B_5,4 db SetInstrument,_ins_PWMLeadLong db A_5,14 db G#5,4 db A_5,2 db rest,4 db B_5,24 db D_6,1 db E_6,25 db CallSection dw .block2 db E_6,12 db C#6,4 db E_6,2 db rest,4 db A#5,14 db B_5,6 db C#6,6 db D_6,6 db C#6,6 db B_5,4 db A_5,2 db rest,4 db G#5,14 db F#5,4 db G#5,2 db rest,4 db G#5,1 db A_5,49 db GotoLoopPoint .block0 db SetInstrument,_ins_PWMLead db C#6,6 db rest,6 db B_5,4 db C#6,2 db rest,4 db D_6,6 db C#6,2 db rest,4 db B_5,8 ret .block1 db F#6,6 db rest,6 db F#6,4 db F#6,2 db rest,4 db G#6,14 db G_6,6 db F#6,6 db E_6,6 db E_6,6 db E_6,6 db B_5,4 db A#5,14 db B_5,6 db C#6,6 ret .block2 db SetInstrument,_ins_PWMLead db F#6,6 db E_6,6 db D_6,4 db C#6,2 db rest,4 db B_5,8 db C#6,6 db D_6,6 db SetInstrument,_ins_PWMLeadLong db F#6,6 ret Snow_CH4: db CallSection dw .block0 db CallSection dw .block0 db CallSection dw .block0 db CallSection dw .block0 db CallSection dw .block0 db CallSection dw .block0 db CallSection dw .block0 db CallSection dw .block1 db CallSection dw .block0 db CallSection dw .block0 db CallSection dw .block0 db CallSection dw .block0 db CallSection dw .block0 db CallSection dw .block0 db CallSection dw .block0 db CallSection dw .block1 db CallSection dw .block0 db CallSection dw .block0 db CallSection dw .block0 db CallSection dw .block0 db CallSection dw .block0 db CallSection dw .block0 db CallSection dw .block0 db CallSection dw .block2 db GotoLoopPoint .block0 Drum Kick,4 Drum CHH,2 Drum Snare,4 Drum CHH,2 Drum Kick,4 Drum Kick,2 Drum Snare,4 Drum CHH,2 Drum Kick,4 Drum CHH,2 Drum Snare,4 Drum CHH,2 Drum Kick,4 Drum Kick,2 Drum Snare,4 Drum CHH,2 ret .block1 Drum Kick,4 Drum CHH,2 Drum Snare,4 Drum CHH,2 Drum Kick,4 Drum Kick,2 Drum Snare,4 Drum CHH,2 Drum Kick,4 Drum CHH,2 Drum Snare,4 Drum CHH,2 Drum Kick,4 Drum Snare,2 Drum Snare,4 Drum Snare,2 ret .block2 Drum Kick,4 Drum CHH,2 Drum Snare,4 Drum CHH,2 Drum Kick,4 Drum Kick,2 Drum Snare,4 Drum CHH,2 Drum Kick,4 Drum CHH,2 Drum Snare,4 Drum CHH,2 Drum Snare,2 Drum Snare,2 Drum Snare,2 Drum Snare,2 Drum Snare,2 Drum Snare,2 ret PT_Gadunk: dw Gadunk_CH1,DummyChannel,Gadunk_CH3,DummyChannel ; ================================================================= Gadunk_CH1: db SetInstrument,_ins_Gadunk db SetLoopPoint db G#3,3,rest,1 db G#3,3,rest,1 db G#3,3,rest,1 db F_3,3,rest,1 db F_3,3,rest,1 db F_3,3,rest,1 db F_3,3,rest,1 db G#3,3,rest,1 db G#3,3,rest,1 db G#3,3,rest,1 db G#3,3,rest,1 db F_3,3,rest,1 db F_3,3,rest,1 db F#3,3,rest,1 db F#3,3,rest,1 db G#3,3,rest,1 db G#3,3,rest,1 db G#3,3,rest,1 db F_3,3,rest,1 db F_3,3,rest,1 db F_3,3,rest,1 db F_3,3,rest,1 db G#3,3,rest,1 db G#3,3,rest,1 db G#3,3,rest,1 db G#3,3,rest,1 db F_3,3,rest,1 db F_3,3,rest,1 db F#3,3,rest,1 db F#3,3,rest,1 db F#3,12,rest,76 db GotoLoopPoint db EndChannel Gadunk_CH3: db SetLoopPoint db rest,132 db $80,7 db G#3,3,rest,1 db G#3,3,rest,1 db G#3,3,rest,1 db G#3,3,rest,1 db F_3,3,rest,1 db F_3,3,rest,1 db F_3,3,rest,1 db F_3,3,rest,1 db G#3,3,rest,1 db G#3,3,rest,1 db G#3,3,rest,1 db F_3,3,rest,1 db F_3,3,rest,1 db F#3,3,rest,1 db F#3,3,rest,1 db F#3,9,rest,7 db GotoLoopPoint db EndChannel
; A242603: Largest divisor of n not divisible by 7. Remove factors 7 from n. ; 1,2,3,4,5,6,1,8,9,10,11,12,13,2,15,16,17,18,19,20,3,22,23,24,25,26,27,4,29,30,31,32,33,34,5,36,37,38,39,40,41,6,43,44,45,46,47,48,1,50,51,52,53,54,55,8,57,58,59,60,61,62,9,64,65,66,67,68,69,10,71,72,73,74,75,76,11,78,79,80,81,82,83,12,85,86,87,88,89,90,13,92,93,94,95,96,97,2,99,100 add $0,1 lpb $0 dif $0,7 lpe
; A004688: Fibonacci numbers written in base 5. ; 0,1,1,2,3,10,13,23,41,114,210,324,1034,1413,3002,4420,12422,22342,40314,113211,204030,322241,1031321,1404112,2440433,4400100,12341033,22241133,40132221,112423404,203111130,321040034,1024201214,1400241303,2424443022,4330234330,12310232402,22141022232,40001310134,112142332421,202144143110,314342031031,1022041224141,1341433310222,2414030034413,4311013400140,12230043440103,22041112340243,34321211330401,111412324221144,201234041102100,313201420323244,1014441011430344,1333142432304143,2403133444240042,4241331432044240,12200020431334332,21441402413434122,34141423400324004,111133331314313131,200330310220142140,312014142040010321,1012400002310203011,1324414144400213332,2342314202210421343,4222233402111140230,12120103104322112123,21342342011433302403,34013000121310420031,110410342133244222434,144423342310110143020,310334234443404421004,1010313132304020114024,1321202422302430040033,2332021110112000204112,4203224032414430244200,12040300143031431003312,21244024231001411303012,33334324424033342311324,110133404210040304114341,144023234134124201431220,304212143344220011101111,1003240433033344213032331,1313003131433114224133442,2321244120022013442221323,4134302302010133221410320,12011101422032202214132143,21200404224042340441043013,33212011201130043210230211,104412420430222434201323224,143124432131403032412103440,303042403112131022113432214,1001222340244034110031041204,1304320243411220132200023423,2311043134210304242231120132,4120413433122024424431144110,11432012122332334222212314242,21102431111004414202144013402,33034443233342303424411333144,104142424344402223132110402101 seq $0,45 ; Fibonacci numbers: F(n) = F(n-1) + F(n-2) with F(0) = 0 and F(1) = 1. seq $0,7091 ; Numbers in base 5.
; A234133: Number of (n+1) X (1+1) 0..3 arrays with every 2 X 2 subblock having the sum of the absolute values of all six edge and diagonal differences equal to 9. ; Submitted by Jon Maiga ; 32,80,192,512,1280,3584,9216,26624,69632,204800,540672,1605632,4259840,12713984,33816576,101187584,269484032,807403520,2151677952,6450839552,17196646400,51573161984,137506062336,412451078144,1099780063232,3299071754240,8797166764032,26390426550272,70373039144960,211114822467584,562967133290496,1688884220002304,4503668346847232,13510936321064960,36029071896870912,108086940812705792,288231475663339520,864693327478390784,2305847407260205056,6917537823734104064,18446761665895596032 mov $1,2 pow $1,$0 seq $0,96886 ; Expansion of (1+3*x)/(1-8*x^2). add $0,$1 mul $0,16
.data array: .space 1000 n: .word 0 TBNhap1: .asciiz "Size of array: " TBNhap2: .asciiz "a[" TBNhap3: .asciiz "]: " TBXuat1: .asciiz "Array a: " TBXuat2: .asciiz "Empty array\n" Menu: .asciiz "\n==========Menu==========\n1. Input array again\n2. Output array\n3. List of prime number in array\n4. Find max\n5. Sum of array\n6. Search element\n0. Exit\n========================\nYour choice: " TBXuat3: .asciiz "List of prime number: " TBXuat4: .asciiz "Max of array is: " TBXuat5: .asciiz "Sum of array is: " TBNull: .asciiz "Invalid\n" TBNhapSai: .asciiz "\nWrong input, try-again\n" prompt: .asciiz "Element you want to search for: " answer: .asciiz "Found element at index: " noAnswer: .asciiz "Not found element in array" .text .globl main main: _NhapMang: la $a0, TBNhap1 # in thong bao nhap n li $v0, 4 syscall li $v0, 5 # nhap n syscall beq $v0, 0, XuatMenu # kiem tra n = 0 li $t2, 0 slt $t1, $v0, $t2 beq $t1, 1, _NhapMang # n < 0 thi nhap lai sw $v0, n lw $s1, n li $t0, 0 # i = 0 la $s0, array # load array to $s0 _NhapMang.Lap: la $a0, TBNhap2 li $v0, 4 syscall move $a0, $t0 # output i li $v0, 1 syscall la $a0, TBNhap3 li $v0, 4 syscall li $v0, 5 # nhap so nguyen syscall sw $v0,($s0) # store to array addi $s0, $s0, 4 addi $t0, $t0, 1 # i++ slt $t1, $t0, $s1 beq $t1, 1, _NhapMang.Lap # s1: n, $t0: i, $s0: array # $t0: temp j XuatMenu XuatMenu: # menu li $v0, 4 la $a0, Menu syscall # option li $v0, 5 syscall # store to $t2 move $t2, $v0 beq $t2, 1, _NhapMang beq $t2, 2, _XuatMang beq $t2, 3, _LietKeSoNguyenTo beq $t2, 4, _TimGiaTriLonNhat beq $t2, 5, _SumArray beq $t2, 6, _Search beq $t2, 0, _Thoat j _NhapSai _XuatMang: la $a0, TBXuat1 li $v0, 4 syscall beq $s1, 0, _XuatMang.TBMangRong # check empty array li $t0, 0 # i = 0 la $s0, array # load array to $s0 _XuatMang.Lap: lw $a0,($s0) # load element of array li $v0, 1 # output element syscall li $a0, 32 # xuat khoang trang li $v0, 11 syscall addi $s0, $s0, 4 # next element addi $t0, $t0, 1 # i++ slt $t1, $t0, $s1 beq $t1, 1, _XuatMang.Lap j XuatMenu _XuatMang.TBMangRong: la $a0, TBXuat2 li $v0, 4 syscall # option 3 _LietKeSoNguyenTo: li $t0, 0 la $s0, array # load array to $s0 _LietKeSoNguyenTo.Lap: lw $a0,($s0) # take element of array jal _KiemTraNguyenTo move $t1, $v0 beq $t1, 0, _LietKeSoNguyenTo.TiepTucLap # if not prime number, continue to next index jal _LietKeSoNguyenTo.Xuat _LietKeSoNguyenTo.TiepTucLap: addi $s0, $s0, 4 # next element addi $t0, $t0, 1 # i++ slt $t2, $t0, $s1 beq $t2, 1, _LietKeSoNguyenTo.Lap j XuatMenu _LietKeSoNguyenTo.Xuat: li $v0, 1 syscall li $a0, 32 # xuat khoang trang li $v0, 11 syscall jr $ra # continue to loop # option 4 _TimGiaTriLonNhat: li $s2, 0 beq $s1, $s2, _TimGiaTriLonNhat.XuatKhongCo # if n = 0 la $s0, array lw $t0,($s0) li $t1, 0 # array index = 0 li $t3, 0 # max = 0 li $t4, 0 # max index = 0 _TimGiaTriLonNhat.Lap: beq $t1, $s1, Print slt $t9, $t3, $t0 # max < a[i] bne $t9, $0, if # if $t9 != 0 _TimGiaTriLonNhat.TiepTucLap: addi $t1, $t1, 1 # increment i addi $s0, $s0, 4 # increment array address to next index lw $t0, ($s0) # $t0 = next index j _TimGiaTriLonNhat.Lap if: move $t3, $t0 # max = a[i] move $t4, $t1 # max index = i j _TimGiaTriLonNhat.TiepTucLap Print: move $s3, $t3 # move max to $s3 move $s4, $t4 # move max index to $s4 li $v0, 4 la $a0, TBXuat4 syscall li $v0, 1 move $a0, $s3 syscall # print max j XuatMenu _TimGiaTriLonNhat.XuatKhongCo: la $a0, TBNull li $v0, 4 j XuatMenu _NhapSai: li $v0, 4 la $a0, TBNhapSai syscall j XuatMenu _Thoat: li $v0, 10 syscall # function check prime number # step 1 _KiemTraNguyenTo: addi $sp, $sp, -16 sw $ra,($sp) sw $s0,4($sp) sw $t0,8($sp) sw $t1,12($sp) # step 2 li $s0, 0 # count = 0 li $t0, 1 # i = 1 _KiemTraNguyenTo.Lap: div $a0, $t0 mfhi $t1 # kiem tra phan du beq $t1,0,_KiemTraNguyenTo.TangDem j _KiemTraNguyenTo.Tangi _KiemTraNguyenTo.TangDem: addi $s0,$s0,1 _KiemTraNguyenTo.Tangi: addi $t0, $t0, 1 # check condition i <= n slt $t1,$a0,$t0 beq $t1,0,_KiemTraNguyenTo.Lap # check count beq $s0,2,_KiemTraNguyenTo.Return # return 0 li $v0,0 j _KiemTraNguyenTo.KetThuc _KiemTraNguyenTo.Return: li $v0, 1 _KiemTraNguyenTo.KetThuc: lw $ra,($sp) lw $s0,4($sp) lw $t0,8($sp) lw $t1,12($sp) addi $sp,$sp,16 jr $ra # option 5 _SumArray: li $t0, 0 # i = 0 la $s0, array li $s2, 0 # sum = 0 _SumArrayLoop: lw $a0, ($s0) # take element of array move $t1, $v0 # save result to $t1 beq $t1, 0, _SumArrayContinueLoop add $s2, $s2, $a0 # sum += $s2 _SumArrayContinueLoop: addi $s0, $s0, 4 # next index addi $t0, $t0, 1 # i++ slt $t2, $t0, $s1 # if i < n beq $t2, 1, _SumArrayLoop la $a0, TBXuat5 li $v0, 4 syscall move $a0, $s2 # print sum li $v0, 1 syscall j XuatMenu # option 6 _Search: la $s0, array li $v0, 4 la $a0, prompt syscall li $v0, 5 syscall move $t0, $v0 li $t3, 0 # i = 0 li $t6, 1000 # length of array Lap: lw $s1, 0($s0) # load a[i] sub $t2, $t0, $s1 # $t2 = input - a[i] beq $t2, $zero, isAnswer # if $t2 = 0, value is found beq $t3, $t6, answerNotFound addi $t3, $t3, 1 # i++ addi $s0, $s0, 4 # array address + 4 j Lap answerNotFound: li $v0, 4 la $a0, noAnswer syscall j XuatMenu isAnswer: li $v0, 4 la $a0, answer syscall li $v0, 1 move $a0, $t3 syscall j XuatMenu
/* * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code 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 General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ #include <stdio.h> #include <stdarg.h> #include <stdlib.h> #include <string.h> #include <jvmti.h> #include "agent_common.h" #include "JVMTITools.h" extern "C" { #define PASSED 0 #define STATUS_FAILED 2 static jvmtiEnv *jvmti = NULL; static jint result = PASSED; static int verbose = 0; static const char *classSig = "Lnsk/jvmti/scenarios/jni_interception/JI03/ji03t004a;"; /* the original JNI function table */ static jniNativeInterface *orig_jni_functions = NULL; /* the redirected JNI function table */ static jniNativeInterface *redir_jni_functions = NULL; /* number of the redirected JNI function calls */ int allobj_calls = 0; int newobj_calls = 0; /** redirected JNI functions **/ jobject JNICALL MyAllocObject(JNIEnv *env, jclass cls) { allobj_calls++; if (verbose) printf("\nMyAllocObject: the function called successfully: number of calls=%d\n", allobj_calls); return orig_jni_functions->AllocObject(env, cls); } jobject JNICALL MyNewObjectV(JNIEnv *env, jclass cls, jmethodID ctorId, va_list args) { newobj_calls++; if (verbose) printf("\nMyNewObjectV: the function called successfully: number of calls=%d\n", newobj_calls); return orig_jni_functions->NewObjectV(env, cls, ctorId, args); } /*****************************/ void doRedirect(JNIEnv *env) { jvmtiError err; if (verbose) printf("\ndoRedirect: obtaining the JNI function table ...\n"); err = jvmti->GetJNIFunctionTable(&orig_jni_functions); if (err != JVMTI_ERROR_NONE) { result = STATUS_FAILED; printf("(%s,%d): TEST FAILED: failed to get original JNI function table: %s\n", __FILE__, __LINE__, TranslateError(err)); env->FatalError("failed to get original JNI function table"); } err = jvmti->GetJNIFunctionTable(&redir_jni_functions); if (err != JVMTI_ERROR_NONE) { result = STATUS_FAILED; printf("(%s,%d): TEST FAILED: failed to get redirected JNI function table: %s\n", __FILE__, __LINE__, TranslateError(err)); env->FatalError("failed to get redirected JNI function table"); } if (verbose) printf("doRedirect: the JNI function table obtained successfully\n"); if (verbose) printf("\ndoRedirect: overwriting the functions AllocObject,NewObjectV ...\n"); redir_jni_functions->AllocObject = MyAllocObject; redir_jni_functions->NewObjectV = MyNewObjectV; err = jvmti->SetJNIFunctionTable(redir_jni_functions); if (err != JVMTI_ERROR_NONE) { result = STATUS_FAILED; printf("(%s,%d): TEST FAILED: failed to set new JNI function table: %s\n", __FILE__, __LINE__, TranslateError(err)); env->FatalError("failed to set new JNI function table"); } if (verbose) printf("\ndoRedirect: the functions are overwritten successfully\n"); } void doRestore(JNIEnv *env) { jvmtiError err; if (verbose) printf("\ndoRestore: restoring the original JNI function table ...\n"); err = jvmti->SetJNIFunctionTable(orig_jni_functions); if (err != JVMTI_ERROR_NONE) { result = STATUS_FAILED; printf("(%s,%d): TEST FAILED: failed to restore original JNI function table: %s\n", __FILE__, __LINE__, TranslateError(err)); env->FatalError("failed to restore original JNI function table"); } if (verbose) printf("doRestore: the original JNI function table is restored successfully\n"); } void doExec(JNIEnv *env, jclass allCls, jmethodID ctorId, const char *msg, ...) { jobject allObj; jobject newObj; va_list args; va_start(args, msg); allObj = env->AllocObject(allCls); if (allObj == NULL) { result = STATUS_FAILED; printf("(%s,%d): TEST FAILED: failed to call %s AllocObject()\n", __FILE__, __LINE__, msg); env->FatalError("failed to failed to call AllocObject()"); } if (env->ExceptionOccurred()) { result = STATUS_FAILED; printf("(%s,%d): TEST FAILED: exception occured during the call of %s AllocObject()\n", __FILE__, __LINE__, msg); env->ExceptionDescribe(); env->ExceptionClear(); } newObj = env->NewObjectV(allCls, ctorId, args); if (newObj == NULL) { result = STATUS_FAILED; printf("(%s,%d): TEST FAILED: failed to call %s NewObjectV()\n", __FILE__, __LINE__, msg); env->FatalError("failed to failed to call NewObjectV()"); } if (env->ExceptionOccurred()) { result = STATUS_FAILED; printf("(%s,%d): TEST FAILED: exception occured during the call of %s AllocObject()\n", __FILE__, __LINE__, msg); env->ExceptionDescribe(); env->ExceptionClear(); } va_end(args); env->DeleteLocalRef(allObj); env->DeleteLocalRef(newObj); } void checkCall(int step, int exAllObjCalls, int exNewObjCalls) { if (allobj_calls == exAllObjCalls) { if (verbose) printf("\nCHECK PASSED: the %s JNI function AllocObject() has been %s:\n\t%d intercepted call(s) as expected\n", (step == 1) ? "tested" : "original", (step == 1) ? "redirected" : "restored", allobj_calls); } else { result = STATUS_FAILED; printf("\nTEST FAILED: the %s JNI function AllocObject() has not been %s:\t%d intercepted call(s) instead of %d as expected\n\n", (step == 1) ? "tested" : "original", (step == 1) ? "redirected" : "restored", allobj_calls, exAllObjCalls); } allobj_calls = 0; /* zeroing an interception counter */ if (newobj_calls == exNewObjCalls) { if (verbose) printf("\nCHECK PASSED: the %s JNI function NewObjectV() has been %s:\n\t%d intercepted call(s) as expected\n", (step == 1) ? "tested" : "original", (step == 1) ? "redirected" : "restored", newobj_calls); } else { result = STATUS_FAILED; printf("\nTEST FAILED: the %s JNI function NewObjectV() has not been %s:\n\t%d intercepted call(s) instead of %d as expected\n", (step == 1) ? "tested" : "original", (step == 1) ? "redirected" : "restored", newobj_calls, exNewObjCalls); } newobj_calls = 0; /* zeroing an interception counter */ } JNIEXPORT jint JNICALL Java_nsk_jvmti_scenarios_jni_1interception_JI03_ji03t004_check(JNIEnv *env, jobject obj) { jmethodID ctorId; jclass objCls; if (jvmti == NULL) { printf("(%s,%d): TEST FAILURE: JVMTI client was not properly loaded\n", __FILE__, __LINE__); return STATUS_FAILED; } objCls = env->FindClass(classSig); if (objCls == NULL) { printf("(%s,%d): TEST FAILED: failed to call FindClass() for \"%s\"\n", __FILE__, __LINE__, classSig); return STATUS_FAILED; } ctorId = env->GetMethodID(objCls, "<init>", "()V"); if (ctorId == NULL) { printf("(%s,%d): TEST FAILED: failed to call GetMethodID() for a constructor\n", __FILE__, __LINE__); return STATUS_FAILED; } /* 1: check the JNI function table interception */ if (verbose) printf("\na) Checking the JNI function table interception ...\n"); doRedirect(env); doExec(env, objCls, ctorId, "redirected"); checkCall(1, 1, 1); /* 2: check the restored JNI function table */ if (verbose) printf("\nb) Checking the restored JNI function table ...\n"); doRestore(env); doExec(env, objCls, ctorId, "restored"); checkCall(2, 0, 0); return result; } #ifdef STATIC_BUILD JNIEXPORT jint JNICALL Agent_OnLoad_ji03t004(JavaVM *jvm, char *options, void *reserved) { return Agent_Initialize(jvm, options, reserved); } JNIEXPORT jint JNICALL Agent_OnAttach_ji03t004(JavaVM *jvm, char *options, void *reserved) { return Agent_Initialize(jvm, options, reserved); } JNIEXPORT jint JNI_OnLoad_ji03t004(JavaVM *jvm, char *options, void *reserved) { return JNI_VERSION_1_8; } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; if (options != NULL && strcmp(options, "-verbose") == 0) verbose = 1; if (verbose) printf("verbose mode on\n"); res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); if (res != JNI_OK || jvmti == NULL) { printf("(%s,%d): Failed to call GetEnv\n", __FILE__, __LINE__); return JNI_ERR; } return JNI_OK; } }
; A327493: a(n) = 2^A327492(n). ; 1,4,8,32,128,512,1024,4096,32768,131072,262144,1048576,4194304,16777216,33554432,134217728,2147483648,8589934592,17179869184,68719476736,274877906944,1099511627776,2199023255552,8796093022208,70368744177664,281474976710656,562949953421312 seq $0,327492 ; Partial sums of A327491. seq $0,277989 ; a(n) = 424*2^n + 37. sub $0,461 div $0,424 add $0,1
# x86 mpn_divexact_by3 -- mpn division by 3, expecting no remainder. # # cycles/limb # P5 17.0 # P6 13.5 # K7 10.0 # Copyright (C) 2000 Free Software Foundation, Inc. # # This file is part of the GNU MP Library. # # The GNU MP Library is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published by # the Free Software Foundation; either version 2 of the License, or (at your # option) any later version. # # The GNU MP 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 Library General Public # License for more details. # # You should have received a copy of the GNU Library General Public License # along with the GNU MP Library; see the file COPYING.LIB. If not, write to # the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, # MA 02111-1307, USA. include(`../config.m4') # mp_limb_t mpn_divexact_by3 (mp_ptr dst, mp_srcptr src, mp_size_t size); # # Divide src,size by 3 and store the quotient in dst,size. If src,size # isn't exactly divisible by 3 the result in dst,size won't be very useful. # The return value is 0 if src,size was divisible by 3, or non-zero if not. defframe(PARAM_SIZE,12) defframe(PARAM_SRC, 8) defframe(PARAM_DST, 4) deflit(`FRAME',0) dnl multiplicative inverse of 3, modulo 2^32 deflit(INVERSE_3, 0xAAAAAAAB) dnl ceil(b/3) and ceil(b*2/3) where b=2^32 deflit(ONE_THIRD_CEIL, 0x55555556) deflit(TWO_THIRDS_CEIL, 0xAAAAAAAB) .text ALIGN(8) PROLOGUE(mpn_divexact_by3) movl PARAM_SRC, %ecx pushl %ebp FRAME_pushl() movl PARAM_SIZE, %ebp pushl %edi FRAME_pushl() movl PARAM_DST, %edi pushl %esi FRAME_pushl() movl $INVERSE_3, %esi pushl %ebx FRAME_pushl() leal (%ecx,%ebp,4), %ecx xorl %ebx, %ebx leal (%edi,%ebp,4), %edi negl %ebp ALIGN(8) L(top): # eax scratch, low product # ebx carry limb (0 to 3) # ecx &src[size] # edx scratch, high product # esi multiplier # edi &dst[size] # ebp counter, limbs, negative movl (%ecx,%ebp,4), %eax subl %ebx, %eax setc %bl mull %esi cmpl $ONE_THIRD_CEIL, %eax movl %eax, (%edi,%ebp,4) sbbl $-1, %ebx # +1 if eax>=ceil(b/3) cmpl $TWO_THIRDS_CEIL, %eax sbbl $-1, %ebx # +1 if eax>=ceil(b*2/3) incl %ebp jnz L(top) movl %ebx, %eax popl %ebx popl %esi popl %edi popl %ebp ret EPILOGUE()
ds 192 ds 64,3
; Original address was $BAF5 ; Airship boss room .word $0000 ; Alternate level layout .word $0000 ; Alternate object layout .byte LEVEL1_SIZE_01 | LEVEL1_YSTART_070 .byte LEVEL2_BGPAL_05 | LEVEL2_OBJPAL_09 | LEVEL2_XSTART_18 .byte LEVEL3_TILESET_10 | LEVEL3_VSCROLL_LOCKED | LEVEL3_PIPENOTEXIT .byte LEVEL4_BGBANK_INDEX(10) | LEVEL4_INITACT_NOTHING .byte LEVEL5_BGM_BOSS | LEVEL5_TIME_300 .byte $00, $00, $0F, $03, $01, $F2, $05, $02, $E2, $04, $04, $E2, $03, $05, $E0, $06 .byte $05, $E1, $06, $07, $E0, $03, $08, $E2, $05, $0A, $E1, $04, $0C, $E2, $03, $0E .byte $E4, $65, $03, $10, $64, $05, $10, $63, $06, $10, $66, $06, $10, $66, $08, $10 .byte $63, $09, $10, $65, $0B, $10, $64, $0D, $10, $00, $00, $4B, $00, $0F, $4B, $0A .byte $01, $5D, $09, $03, $62, $09, $07, $62, $09, $09, $62, $FF
/* Source File : InputRC4XcodeStream.cpp Copyright 2016 Gal Kahana PDFWriter Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ #include "io/OutputRC4XcodeStream.h" charta::OutputRC4XcodeStream::OutputRC4XcodeStream() { mTargetStream = nullptr; mOwnsStream = false; } charta::OutputRC4XcodeStream::~OutputRC4XcodeStream() { if (mOwnsStream) delete mTargetStream; } charta::OutputRC4XcodeStream::OutputRC4XcodeStream(IByteWriterWithPosition *inTargetStream, const ByteList &inEncryptionKey, bool inOwnsStream) : mRC4(inEncryptionKey) { mTargetStream = inTargetStream; mOwnsStream = inOwnsStream; } size_t charta::OutputRC4XcodeStream::Write(const uint8_t *inBuffer, size_t inSize) { if (mTargetStream == nullptr) return 0; size_t mCurrentIndex = 0; uint8_t buffer; while (mCurrentIndex < inSize) { buffer = mRC4.DecodeNextByte(inBuffer[mCurrentIndex]); mTargetStream->Write(&buffer, 1); ++mCurrentIndex; } return mCurrentIndex; } long long charta::OutputRC4XcodeStream::GetCurrentPosition() { if (mTargetStream == nullptr) return 0; return mTargetStream->GetCurrentPosition(); }
.global s_prepare_buffers s_prepare_buffers: push %r13 push %r8 push %r9 push %rcx push %rdi push %rdx push %rsi lea addresses_D_ht+0x19e3b, %rdi nop nop nop add $12698, %r8 mov (%rdi), %r13d nop nop nop cmp %r9, %r9 lea addresses_WC_ht+0xcd3b, %rsi lea addresses_UC_ht+0x535b, %rdi clflush (%rsi) sub $22263, %rdx mov $31, %rcx rep movsq cmp %rsi, %rsi lea addresses_UC_ht+0x3cbb, %r9 nop nop nop nop and $19883, %rsi mov (%r9), %rdx nop nop nop sub $24965, %rdi lea addresses_UC_ht+0x1c8a4, %rdx sub %r8, %r8 movw $0x6162, (%rdx) nop inc %r13 lea addresses_D_ht+0x1a53b, %rdx nop nop nop cmp %r9, %r9 and $0xffffffffffffffc0, %rdx movaps (%rdx), %xmm1 vpextrq $1, %xmm1, %rdi nop nop nop nop and %r9, %r9 lea addresses_WC_ht+0x493b, %r13 nop add %rdx, %rdx mov $0x6162636465666768, %r9 movq %r9, (%r13) nop nop nop xor $51392, %rcx lea addresses_D_ht+0x313b, %rsi nop inc %r9 mov (%rsi), %edi nop nop nop nop nop xor $60366, %rdi lea addresses_normal_ht+0xea5b, %r9 nop nop nop nop nop add %rdx, %rdx movb (%r9), %r13b nop nop add %r13, %r13 pop %rsi pop %rdx pop %rdi pop %rcx pop %r9 pop %r8 pop %r13 ret .global s_faulty_load s_faulty_load: push %r12 push %r13 push %r8 push %rbp // Faulty Load lea addresses_UC+0x993b, %r8 nop cmp %r12, %r12 mov (%r8), %bp lea oracles, %r12 and $0xff, %rbp shlq $12, %rbp mov (%r12,%rbp,1), %rbp pop %rbp pop %r8 pop %r13 pop %r12 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_UC', 'AVXalign': False, 'congruent': 0, 'size': 8, 'same': True, 'NT': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_UC', 'AVXalign': False, 'congruent': 0, 'size': 2, 'same': True, 'NT': False}} <gen_prepare_buffer> {'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 7, 'size': 4, 'same': False, 'NT': False}} {'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 8, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 4, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'AVXalign': True, 'congruent': 6, 'size': 8, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 0, 'size': 2, 'same': False, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'AVXalign': True, 'congruent': 10, 'size': 16, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 11, 'size': 8, 'same': False, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 11, 'size': 4, 'same': False, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'AVXalign': False, 'congruent': 4, 'size': 1, 'same': True, 'NT': False}} {'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 */
db KADABRA ; pokedex id db 40 ; base hp db 35 ; base attack db 30 ; base defense db 105 ; base speed db 120 ; base special db PSYCHIC ; species type 1 db PSYCHIC ; species type 2 db 100 ; catch rate db 145 ; base exp yield INCBIN "pic/gsmon/kadabra.pic",0,1 ; 66, sprite dimensions dw KadabraPicFront dw KadabraPicBack ; attacks known at lvl 0 db KINESIS db CONFUSION db 0 db 0 db 3 ; growth rate ; learnset tmlearn 1,5,6,8 tmlearn 9,10 tmlearn 17,18,19,20 tmlearn 29,30,31,32 tmlearn 33,34,35 tmlearn 41,44,45,46 tmlearn 49,50,55 db BANK(KadabraPicFront)
SECTION code_sound_ay PUBLIC ay_wyz_stop EXTERN asm_wyz_stop defc ay_wyz_stop = asm_wyz_stop ; SDCC bridge for Classic IF __CLASSIC PUBLIC _ay_wyz_stop defc _ay_wyz_stop = ay_wyz_stop ENDIF
Entity start No options Constants 0 S start 1 S 2.0 - 1.0= 2 R 2.000000 3 R 1.000000 4 I 2 5 S io.writeln 6 S 2.0 * 7= 7 I 7 8 S 2.0 * 8.0 - 5.0= 9 R 8.000000 10 R 5.000000 11 S 2.0 - 8.0 * 5.0= 12 S (2.0 - 8.0) * 5.0= 13 S (2.0 * (8.0 - 18.0 / 9.0 * (7.0 * 8.0 - 4.0 + 5.0 * 7.0) - 6.0) * (49.0 / 7.0 - 3.0))= 14 R 18.000000 15 R 9.000000 16 R 7.000000 17 R 4.000000 18 R 6.000000 19 R 49.000000 20 R 3.000000 End Valid context (always) No properties Def start No parameters No local variables No results ldconst 1 --> [2.0 - 1.0=] ldconst 2 --> [2.000000] ldconst 3 --> [1.000000] sub ldconst 4 --> [2] lcall 5 --> [io.writeln] ldconst 6 --> [2.0 * 7=] ldconst 4 --> [2] ldconst 7 --> [7] mul ldconst 4 --> [2] lcall 5 --> [io.writeln] ldconst 8 --> [2.0 * 8.0 - 5.0=] ldconst 2 --> [2.000000] ldconst 9 --> [8.000000] mul ldconst 10 --> [5.000000] sub ldconst 4 --> [2] lcall 5 --> [io.writeln] ldconst 11 --> [2.0 - 8.0 * 5.0=] ldconst 2 --> [2.000000] ldconst 9 --> [8.000000] ldconst 10 --> [5.000000] mul sub ldconst 4 --> [2] lcall 5 --> [io.writeln] ldconst 12 --> [(2.0 - 8.0) * 5.0=] ldconst 2 --> [2.000000] ldconst 9 --> [8.000000] sub ldconst 10 --> [5.000000] mul ldconst 4 --> [2] lcall 5 --> [io.writeln] ldconst 13 --> [(2.0 * (8.0 - 18.0 / 9.0 * (7.0 * 8.0 - 4.0 + 5.0 * 7.0) - 6.0) * (49.0 / 7.0 - 3.0))=] ldconst 2 --> [2.000000] ldconst 9 --> [8.000000] ldconst 14 --> [18.000000] ldconst 15 --> [9.000000] div ldconst 16 --> [7.000000] ldconst 9 --> [8.000000] mul ldconst 17 --> [4.000000] sub ldconst 10 --> [5.000000] ldconst 16 --> [7.000000] mul add mul sub ldconst 18 --> [6.000000] sub mul ldconst 19 --> [49.000000] ldconst 16 --> [7.000000] div ldconst 20 --> [3.000000] sub mul ldconst 4 --> [2] lcall 5 --> [io.writeln] stop End End
.global s_prepare_buffers s_prepare_buffers: push %r12 push %r13 push %r14 push %r15 push %r9 push %rbp push %rcx push %rdi push %rsi lea addresses_A_ht+0x3d4b, %r13 nop nop add %r15, %r15 movups (%r13), %xmm0 vpextrq $1, %xmm0, %r12 nop nop nop nop and %r9, %r9 lea addresses_UC_ht+0x1a1d7, %r14 nop nop nop nop nop cmp $57728, %r12 mov (%r14), %r15 nop nop nop nop dec %r12 lea addresses_WT_ht+0x7e97, %r15 clflush (%r15) nop nop and %rbp, %rbp movb (%r15), %r12b nop nop sub %r15, %r15 lea addresses_WT_ht+0x15df7, %rsi lea addresses_normal_ht+0xee9d, %rdi nop nop add %r12, %r12 mov $59, %rcx rep movsw nop nop nop xor $5384, %r13 lea addresses_normal_ht+0xb7d7, %r14 nop nop nop nop add $25398, %r12 movb (%r14), %r9b nop nop nop nop nop and $3013, %rcx lea addresses_UC_ht+0xc9ad, %r15 cmp %rbp, %rbp movb (%r15), %r14b nop nop nop nop nop sub %rcx, %rcx lea addresses_UC_ht+0x14757, %rbp nop sub $33782, %r15 mov (%rbp), %r12 nop nop and $27119, %r13 lea addresses_UC_ht+0x75e5, %rsi lea addresses_UC_ht+0x1aab7, %rdi nop nop nop nop nop xor %r15, %r15 mov $66, %rcx rep movsl nop nop nop nop nop cmp %r14, %r14 lea addresses_UC_ht+0x16557, %r12 nop nop nop inc %r9 movl $0x61626364, (%r12) nop nop nop nop cmp $20376, %rdi lea addresses_normal_ht+0x33d7, %rsi lea addresses_A_ht+0x197d7, %rdi nop nop xor $55849, %r14 mov $73, %rcx rep movsw nop nop nop nop and %r13, %r13 lea addresses_UC_ht+0x14c6f, %r12 nop nop nop nop dec %rcx mov $0x6162636465666768, %r15 movq %r15, (%r12) nop nop nop nop nop add $59649, %r12 pop %rsi pop %rdi pop %rcx pop %rbp pop %r9 pop %r15 pop %r14 pop %r13 pop %r12 ret .global s_faulty_load s_faulty_load: push %r11 push %r12 push %r15 push %r9 push %rbx push %rcx push %rsi // Load lea addresses_A+0x9da4, %rcx inc %r15 vmovups (%rcx), %ymm4 vextracti128 $1, %ymm4, %xmm4 vpextrq $1, %xmm4, %r11 nop nop sub $26268, %r11 // Faulty Load lea addresses_WT+0x1d7d7, %rcx nop nop nop nop sub %rbx, %rbx movups (%rcx), %xmm7 vpextrq $1, %xmm7, %r12 lea oracles, %rbx and $0xff, %r12 shlq $12, %r12 mov (%rbx,%r12,1), %r12 pop %rsi pop %rcx pop %rbx pop %r9 pop %r15 pop %r12 pop %r11 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_WT', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_A', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_WT', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}} <gen_prepare_buffer> {'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 1, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'size': 8, 'AVXalign': True, 'NT': False, 'congruent': 7, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 6, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 1, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 11, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'size': 1, 'AVXalign': False, 'NT': True, 'congruent': 1, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 7, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 5, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 7, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 9, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 8, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': False}} {'00': 21829} 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 */
.global s_prepare_buffers s_prepare_buffers: push %r12 push %r14 push %r15 push %r9 push %rax push %rcx push %rdi push %rsi lea addresses_D_ht+0x17356, %rsi lea addresses_WC_ht+0x12ddf, %rdi nop nop nop nop nop sub $23590, %r14 mov $115, %rcx rep movsl nop dec %r9 lea addresses_normal_ht+0x1bdf, %rsi lea addresses_WT_ht+0x37df, %rdi nop nop nop sub $40921, %rax mov $105, %rcx rep movsb nop nop inc %rsi lea addresses_WC_ht+0x1285f, %r9 clflush (%r9) nop cmp $12255, %rax movw $0x6162, (%r9) nop nop nop xor $24734, %r14 lea addresses_D_ht+0x119df, %r9 cmp $49006, %r14 movb (%r9), %cl nop and $36892, %rsi lea addresses_A_ht+0x39df, %rdi xor $56236, %r12 movups (%rdi), %xmm4 vpextrq $0, %xmm4, %rsi nop nop nop cmp %r9, %r9 lea addresses_WT_ht+0x1505f, %rsi nop nop nop nop and $9751, %r14 movb (%rsi), %al nop nop nop nop cmp $51071, %rax lea addresses_normal_ht+0x14df, %rcx nop nop dec %rax movw $0x6162, (%rcx) nop nop cmp %r9, %r9 lea addresses_WT_ht+0x78f7, %rax sub %r12, %r12 mov (%rax), %r9w nop nop nop nop cmp %r12, %r12 lea addresses_WT_ht+0xebf, %r12 cmp %r9, %r9 mov (%r12), %rax nop nop and $34321, %rsi lea addresses_normal_ht+0x1c1df, %r14 nop nop and %rdi, %rdi mov (%r14), %cx nop nop xor %r12, %r12 lea addresses_UC_ht+0x1817, %rcx add $40284, %rsi vmovups (%rcx), %ymm5 vextracti128 $1, %ymm5, %xmm5 vpextrq $0, %xmm5, %r12 nop nop nop nop inc %r9 lea addresses_WT_ht+0x15197, %rsi lea addresses_WC_ht+0xdabf, %rdi nop nop nop and %r12, %r12 mov $45, %rcx rep movsb nop nop nop xor $39139, %rcx lea addresses_normal_ht+0x1e25f, %rsi lea addresses_WT_ht+0x153df, %rdi nop nop nop xor $50406, %r15 mov $92, %rcx rep movsq nop nop nop cmp $13573, %r15 lea addresses_normal_ht+0x1107, %rsi lea addresses_A_ht+0x10ebf, %rdi nop nop nop cmp %r12, %r12 mov $51, %rcx rep movsl nop nop nop nop nop add %rcx, %rcx pop %rsi pop %rdi pop %rcx pop %rax pop %r9 pop %r15 pop %r14 pop %r12 ret .global s_faulty_load s_faulty_load: push %r10 push %r11 push %r14 push %rax push %rbp push %rsi // Faulty Load mov $0x9df, %rbp nop inc %rax movb (%rbp), %r14b lea oracles, %r11 and $0xff, %r14 shlq $12, %r14 mov (%r11,%r14,1), %r14 pop %rsi pop %rbp pop %rax pop %r14 pop %r11 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_P', 'AVXalign': False, 'congruent': 0, 'size': 8, 'same': False, 'NT': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_P', 'AVXalign': False, 'congruent': 0, 'size': 1, 'same': True, 'NT': False}} <gen_prepare_buffer> {'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 9, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 9, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 8, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 7, 'size': 2, 'same': False, 'NT': True}} {'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'AVXalign': True, 'congruent': 11, 'size': 1, 'same': False, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'AVXalign': False, 'congruent': 10, 'size': 16, 'same': False, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'AVXalign': False, 'congruent': 7, 'size': 1, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': True, 'congruent': 7, 'size': 2, 'same': False, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'AVXalign': False, 'congruent': 3, 'size': 2, 'same': False, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'AVXalign': True, 'congruent': 5, 'size': 8, 'same': False, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'AVXalign': True, 'congruent': 10, 'size': 2, 'same': False, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 2, 'size': 32, 'same': False, 'NT': False}} {'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 3, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 5, 'same': True}} {'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 6, 'same': True}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 8, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 2, 'same': True}, 'dst': {'type': 'addresses_A_ht', 'congruent': 5, 'same': False}} {'00': 3} 00 00 00 */
; ; Copyright (c) 2016, Alliance for Open Media. All rights reserved ; ; This source code is subject to the terms of the BSD 2 Clause License and ; the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License ; was not distributed with this source code in the LICENSE file, you can ; obtain it at www.aomedia.org/license/software. If the Alliance for Open ; Media Patent License 1.0 was not distributed with this source code in the ; PATENTS file, you can obtain it at www.aomedia.org/license/patent. ; ; %include "aom_ports/x86_abi_support.asm" %macro GET_PARAM_4 0 mov rdx, arg(5) ;filter ptr mov rsi, arg(0) ;src_ptr mov rdi, arg(2) ;output_ptr mov ecx, 0x01000100 movdqa xmm3, [rdx] ;load filters psrldq xmm3, 6 packsswb xmm3, xmm3 pshuflw xmm3, xmm3, 0b ;k3_k4 movd xmm2, ecx ;rounding_shift pshufd xmm2, xmm2, 0 movsxd rax, DWORD PTR arg(1) ;pixels_per_line movsxd rdx, DWORD PTR arg(3) ;out_pitch movsxd rcx, DWORD PTR arg(4) ;output_height %endm %macro APPLY_FILTER_4 1 punpcklbw xmm0, xmm1 pmaddubsw xmm0, xmm3 pmulhrsw xmm0, xmm2 ;rounding(+64)+shift(>>7) packuswb xmm0, xmm0 ;pack to byte %if %1 movd xmm1, [rdi] pavgb xmm0, xmm1 %endif movd [rdi], xmm0 lea rsi, [rsi + rax] lea rdi, [rdi + rdx] dec rcx %endm %macro GET_PARAM 0 mov rdx, arg(5) ;filter ptr mov rsi, arg(0) ;src_ptr mov rdi, arg(2) ;output_ptr mov ecx, 0x01000100 movdqa xmm7, [rdx] ;load filters psrldq xmm7, 6 packsswb xmm7, xmm7 pshuflw xmm7, xmm7, 0b ;k3_k4 punpcklwd xmm7, xmm7 movd xmm6, ecx ;rounding_shift pshufd xmm6, xmm6, 0 movsxd rax, DWORD PTR arg(1) ;pixels_per_line movsxd rdx, DWORD PTR arg(3) ;out_pitch movsxd rcx, DWORD PTR arg(4) ;output_height %endm %macro APPLY_FILTER_8 1 punpcklbw xmm0, xmm1 pmaddubsw xmm0, xmm7 pmulhrsw xmm0, xmm6 ;rounding(+64)+shift(>>7) packuswb xmm0, xmm0 ;pack back to byte %if %1 movq xmm1, [rdi] pavgb xmm0, xmm1 %endif movq [rdi], xmm0 ;store the result lea rsi, [rsi + rax] lea rdi, [rdi + rdx] dec rcx %endm %macro APPLY_FILTER_16 1 punpcklbw xmm0, xmm1 punpckhbw xmm2, xmm1 pmaddubsw xmm0, xmm7 pmaddubsw xmm2, xmm7 pmulhrsw xmm0, xmm6 ;rounding(+64)+shift(>>7) pmulhrsw xmm2, xmm6 packuswb xmm0, xmm2 ;pack back to byte %if %1 movdqu xmm1, [rdi] pavgb xmm0, xmm1 %endif movdqu [rdi], xmm0 ;store the result lea rsi, [rsi + rax] lea rdi, [rdi + rdx] dec rcx %endm SECTION .text global sym(aom_filter_block1d4_v2_ssse3) PRIVATE sym(aom_filter_block1d4_v2_ssse3): push rbp mov rbp, rsp SHADOW_ARGS_TO_STACK 6 push rsi push rdi ; end prolog GET_PARAM_4 .loop: movd xmm0, [rsi] ;load src movd xmm1, [rsi + rax] APPLY_FILTER_4 0 jnz .loop ; begin epilog pop rdi pop rsi UNSHADOW_ARGS pop rbp ret global sym(aom_filter_block1d8_v2_ssse3) PRIVATE sym(aom_filter_block1d8_v2_ssse3): push rbp mov rbp, rsp SHADOW_ARGS_TO_STACK 6 SAVE_XMM 7 push rsi push rdi ; end prolog GET_PARAM .loop: movq xmm0, [rsi] ;0 movq xmm1, [rsi + rax] ;1 APPLY_FILTER_8 0 jnz .loop ; begin epilog pop rdi pop rsi RESTORE_XMM UNSHADOW_ARGS pop rbp ret global sym(aom_filter_block1d16_v2_ssse3) PRIVATE sym(aom_filter_block1d16_v2_ssse3): push rbp mov rbp, rsp SHADOW_ARGS_TO_STACK 6 SAVE_XMM 7 push rsi push rdi ; end prolog GET_PARAM .loop: movdqu xmm0, [rsi] ;0 movdqu xmm1, [rsi + rax] ;1 movdqa xmm2, xmm0 APPLY_FILTER_16 0 jnz .loop ; begin epilog pop rdi pop rsi RESTORE_XMM UNSHADOW_ARGS pop rbp ret global sym(aom_filter_block1d4_h2_ssse3) PRIVATE sym(aom_filter_block1d4_h2_ssse3): push rbp mov rbp, rsp SHADOW_ARGS_TO_STACK 6 push rsi push rdi ; end prolog GET_PARAM_4 .loop: movdqu xmm0, [rsi] ;load src movdqa xmm1, xmm0 psrldq xmm1, 1 APPLY_FILTER_4 0 jnz .loop ; begin epilog pop rdi pop rsi UNSHADOW_ARGS pop rbp ret global sym(aom_filter_block1d8_h2_ssse3) PRIVATE sym(aom_filter_block1d8_h2_ssse3): push rbp mov rbp, rsp SHADOW_ARGS_TO_STACK 6 SAVE_XMM 7 push rsi push rdi ; end prolog GET_PARAM .loop: movdqu xmm0, [rsi] ;load src movdqa xmm1, xmm0 psrldq xmm1, 1 APPLY_FILTER_8 0 jnz .loop ; begin epilog pop rdi pop rsi RESTORE_XMM UNSHADOW_ARGS pop rbp ret global sym(aom_filter_block1d16_h2_ssse3) PRIVATE sym(aom_filter_block1d16_h2_ssse3): push rbp mov rbp, rsp SHADOW_ARGS_TO_STACK 6 SAVE_XMM 7 push rsi push rdi ; end prolog GET_PARAM .loop: movdqu xmm0, [rsi] ;load src movdqu xmm1, [rsi + 1] movdqa xmm2, xmm0 APPLY_FILTER_16 0 jnz .loop ; begin epilog pop rdi pop rsi RESTORE_XMM UNSHADOW_ARGS pop rbp ret
SECTION code_fp_math48 PUBLIC asm_dgt EXTERN am48_dgt defc asm_dgt = am48_dgt
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Copyright(c) 2018-2022 Intel Corporation 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 Intel Corporation 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 ; 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 "include/aesni_emu.inc" %define NO_AESNI %include "sse/gcm128_gmac_api_by8_sse.asm"
; A152535: a(n) = n*prime(n) - Sum_{i=1..n} prime(i). ; 0,1,5,11,27,37,61,75,107,161,181,247,295,321,377,467,563,597,705,781,821,947,1035,1173,1365,1465,1517,1625,1681,1797,2217,2341,2533,2599,2939,3009,3225,3447,3599,3833,4073,4155,4575,4661,4837,4927,5479,6043,6235,6333,6533,6839,6943,7473,7797,8127,8463,8577,8925,9161,9281,9891,10759,11011,11139,11399,12323,12725,13405,13543,13823,14249,14825,15263,15707,16007,16463,17079,17391,18023,18823,18985,19805,19971,20475,20815,21331,22027,22379,22557,22917,24009,24745,25117,25869,26249,26825,27989,28185,29967 mov $1,48 mov $2,$0 add $2,1 pow $2,2 mov $3,1 mov $6,1 lpb $2 sub $2,1 sub $6,$3 sub $1,$6 mov $3,$5 seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0. sub $0,$3 mov $4,$0 max $4,0 cmp $4,$0 mul $2,$4 add $5,1 lpe sub $1,48 mov $0,$1
; set absolute pointer position include win1_mac_oli include win1_keys_qdos_io section utility xdef xwm_saptr ;+++ ; set relative pointer position ; ; Entry Exit ; d1.l position ; a0 channel id ; ; errors ;--- xwm_saptr subr d2 moveq #iop.sptr,d0 moveq #0,d2 xjsr do_io subend end
; A267816: Decimal representation of the n-th iteration of the "Rule 221" elementary cellular automaton starting with a single ON (black) cell. ; 1,3,23,111,479,1983,8063,32511,130559,523263,2095103,8384511,33546239,134201343,536838143,2147418111,8589803519,34359476223,137438429183,549754765311,2199021158399,8796088827903,35184363700223,140737471578111,562949919866879,2251799746576383,9007199120523263,36028796750528511,144115187538984959,576460751229681663,2305843007066210303,9223372032559808511,36893488138829168639,147573952572496543743,590295810324345913343,2361183241366103130111,9444732965601851473919,37778931862682283802623,151115727451278891024383,604462909806215075725311,2417851639227059326156799,9671406556912635351138303,38685626227659337497575423,154742504910654942176346111,618970019642654953077473279,2475880078570690181054070783,9903520314282901461704638463,39614081257131887321795264511,158456325028528112237134479359,633825300114113574848444760063,2535301200456456551193592725503,10141204801825830708373998272511,40564819207303331840695247831039,162259276829213345377179500806143,649037107316853417537515022188543,2596148429267413742207654126682111,10384593717069655112945804582584319,41538374868278620740013594482049023,166153499473114483536515130231619583,664613997892457935298982025533325311 mov $1,2 pow $1,$0 bin $1,2 mul $1,6 sub $1,2 div $1,3 mul $1,2 add $1,1 mov $0,$1
<% from pwnlib.shellcraft.amd64.linux import syscall %> <%page args="dirp"/> <%docstring> Invokes the syscall readdir. See 'man 2 readdir' for more information. Arguments: dirp(DIR): dirp </%docstring> ${syscall('SYS_readdir', dirp)}
; A178730: Partial sums of floor(7^n/8)/6. ; 0,1,8,58,408,2859,20016,140116,980816,6865717,48060024,336420174,2354941224,16484588575,115392120032,807744840232,5654213881632,39579497171433,277056480200040,1939395361400290,13575767529802040,95030372708614291,665212608960300048,4656488262722100348,32595417839054702448,228167924873382917149,1597175474113680420056,11180228318795762940406,78261598231570340582856,547831187620992384080007,3834818313346946688560064,26843728193428626819920464,187906097354000387739443264,1315342681478002714176102865 lpb $0 mov $2,$0 trn $0,2 seq $2,23000 ; a(n) = (7^n - 1)/6. add $3,$2 lpe mov $0,$3
Map_399D8: dc.w word_399E0-Map_399D8 dc.w word_399E8-Map_399D8 dc.w word_399F0-Map_399D8 dc.w word_399F8-Map_399D8 word_399E0: dc.w 1 dc.b $FC, 0, 0, 0, $FF, $FC word_399E8: dc.w 1 dc.b $FC, 0, 0, 1, $FF, $FC word_399F0: dc.w 1 dc.b $FC, 0, 0, 2, $FF, $FC word_399F8: dc.w 1 dc.b $FC, 0, 0, 3, $FF, $FC
; A168269: a(n) = 2*n - (-1)^n. ; 3,3,7,7,11,11,15,15,19,19,23,23,27,27,31,31,35,35,39,39,43,43,47,47,51,51,55,55,59,59,63,63,67,67,71,71,75,75,79,79,83,83,87,87,91,91,95,95,99,99,103,103,107,107,111,111,115,115,119,119,123,123,127,127,131,131,135,135,139,139,143,143,147,147,151,151,155,155,159,159,163,163,167,167,171,171,175,175,179,179,183,183,187,187,191,191,195,195,199,199,203,203,207,207,211,211,215,215,219,219,223,223,227,227,231,231,235,235,239,239,243,243,247,247,251,251,255,255,259,259,263,263,267,267,271,271,275,275,279,279,283,283,287,287,291,291,295,295,299,299,303,303,307,307,311,311,315,315,319,319,323,323,327,327,331,331,335,335,339,339,343,343,347,347,351,351,355,355,359,359,363,363,367,367,371,371,375,375,379,379,383,383,387,387,391,391,395,395,399,399,403,403,407,407,411,411,415,415,419,419,423,423,427,427,431,431,435,435,439,439,443,443,447,447,451,451,455,455,459,459,463,463,467,467,471,471,475,475,479,479,483,483,487,487,491,491,495,495,499,499 mov $1,$0 div $1,2 mul $1,4 add $1,3
; A172077: a(n) = n*(n+1)*(7*n^2 - n - 4)/4. ; 0,1,33,168,520,1245,2541,4648,7848,12465,18865,27456,38688,53053,71085,93360,120496,153153,192033,237880,291480,353661,425293,507288,600600,706225,825201,958608,1107568,1273245,1456845,1659616,1882848,2127873,2396065,2688840,3007656,3354013,3729453,4135560,4573960,5046321,5554353,6099808,6684480,7310205,7978861,8692368,9452688,10261825,11121825,12034776,13002808,14028093,15112845,16259320,17469816,18746673,20092273,21509040,22999440,24565981,26211213,27937728,29748160,31645185,33631521,35709928,37883208,40154205,42525805,45000936,47582568,50273713,53077425,55996800,59034976,62195133,65480493,68894320,72439920,76120641,79939873,83901048,88007640,92263165,96671181,101235288,105959128,110846385,115900785,121126096,126526128,132104733,137865805,143813280,149951136,156283393,162814113,169547400,176487400,183638301,191004333,198589768,206398920,214436145,222705841,231212448,239960448,248954365,258198765,267698256,277457488,287481153,297773985,308340760,319186296,330315453,341733133,353444280,365453880,377766961,390388593,403323888,416578000,430156125,444063501,458305408,472887168,487814145,503091745,518725416,534720648,551082973,567817965,584931240,602428456,620315313,638597553,657280960,676371360,695874621,715796653,736143408,756920880,778135105,799792161,821898168,844459288,867481725,890971725,914935576,939379608,964310193,989733745,1015656720,1042085616,1069026973,1096487373,1124473440,1152991840,1182049281,1211652513,1241808328,1272523560,1303805085,1335659821,1368094728,1401116808,1434733105,1468950705,1503776736,1539218368,1575282813,1611977325,1649309200,1687285776,1725914433,1765202593,1805157720,1845787320,1887098941,1929100173,1971798648,2015202040,2059318065,2104154481,2149719088,2196019728,2243064285,2290860685,2339416896,2388740928,2438840833,2489724705,2541400680,2593876936,2647161693,2701263213,2756189800,2811949800,2868551601,2926003633,2984314368,3043492320,3103546045,3164484141,3226315248,3289048048,3352691265,3417253665,3482744056,3549171288,3616544253,3684871885,3754163160,3824427096,3895672753,3967909233,4041145680,4115391280,4190655261,4266946893,4344275488,4422650400,4502081025,4582576801,4664147208,4746801768,4830550045,4915401645,5001366216,5088453448,5176673073,5266034865,5356548640,5448224256,5541071613,5635100653,5730321360,5826743760,5924377921,6023233953,6123322008,6224652280,6327235005,6431080461,6536198968,6642600888,6750296625 mov $4,$0 mov $5,$0 lpb $4 mov $0,$5 sub $4,1 sub $0,$4 mov $2,$0 pow $0,2 mov $3,$2 mul $3,7 sub $3,6 mul $0,$3 add $1,$0 lpe
SECTION code_crt0_sccz80 PUBLIC dstore EXTERN fa ;-------------- ; Copy FA to hl ;-------------- dstore: ld de,fa ld bc,6 ex de,hl ldir ex de,hl ; returns de=fa+6, hl=hl+6 ret
; uint8_t hbios_e_dehl(uint16_t func_device, uint32_t arg) __smallc SECTION code_clib SECTION code_arch PUBLIC hbios_e_dehl EXTERN asm_hbios_e .hbios_e_dehl pop af pop hl pop de pop bc push bc push de push hl push af jp asm_hbios_e
# Y combinator in ASM (var I (lambda (x) x)) (var M (lambda (x) (x x))) (var B (lambda (x) (lambda (y) (lambda (z) (x (y z)))))) (var B2 (lambda (x y) (lambda (z) (x (y z))))) (var B3 (lambda (x y z) (x (y z)))) (var L (lambda (x) (lambda (y) (x (M y))))) (var L (lambda (x) ((B x) M))) (var Me (lambda (x) (lambda (y) ((M x) y)))) (var Y (lambda (f) ((lambda (x) (f (x x))) (lambda (x) (f (x x)))))) (var Y ((B M) L)) (var Z (lambda (f) ((lambda (x) (x x)) (lambda (g) (f (lambda (x) ((g g) x))))))) (var Zc (lambda (f) (M (B2 f Me)))) (macro recursive (f) `(M (lambda (g) ($f (lambda (x) ((g g) x)))))) (var factorial (Z (lambda (fac) (lambda (x) (if (equal? x 0) 1 (* x (fac (- x 1)))))))) # Native (var fib (lambda (x) (if (< x 2) x (+ (fib (- x 1)) (fib (- x 2)))))) # Z-combined (var fib0 (Z (lambda (fib) (lambda (x) (if (< x 2) x (+ (fib (- x 1)) (fib (- x 2)))))))) # Zc-combined (var fib1 (Zc (lambda (fib) (lambda (x) (if (< x 2) x (+ (fib (- x 1)) (fib (- x 2)))))))) # Macroed (var fib2 (recursive (lambda (fib) (lambda (x) (if (< x 2) x (+ (fib (- x 1)) (fib (- x 2)))))))) # Native+2 (var fib3 (((lambda () (lambda () (lambda (x) (if (< x 2) x (+ (fib3 (- x 1)) (fib3 (- x 2)))))))))) (write (factorial 1) " " (factorial 3) " " (factorial 5) " " factorial "\n") (fib3 23)
; A006634: From generalized Catalan numbers. ; Submitted by Christian Krause ; 1,9,72,570,4554,36855,302064,2504304,20974005,177232627,1509395976,12943656180,111676661460,968786892675,8445123522144,73940567860896,649942898236596,5733561315124260,50744886833898400,450461491952952690,4009721145437152530,35782256673785401065,320062536784485613872,2869069650721691583600,25770323012959698457830,231905644947126073979874,2090554660053644856681456,18876509857470851229938728,170705524427358619567879080,1545962246340968526450732891,14019704934015477510366801600 add $0,2 mov $1,$0 mov $2,$0 mul $0,4 sub $2,2 bin $0,$2 mul $0,12 add $1,1 div $0,$1 div $0,4
; A017752: Binomial coefficients C(n,88). ; 1,89,4005,121485,2794155,51971283,814216767,11050084695,132601016340,1429144287220,14005614014756,126050526132804,1050421051106700,8160963550905900,59458448728028700,408281347932463740,2653828761561014310,16391295291994500150,96526516719523167550,543596699420472575150,2935422176870551905810,15236238918042388463490,76181194590211942317450,367657069544066330314650,1715732991205642874801700,7755113120249505794103684,34003188296478602327993076,144828394596112565471081620,600003349041037771237338140 add $0,88 bin $0,88
/* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */ /* * Main authors: * Christian Schulte <schulte@gecode.org> * * Copyright: * Christian Schulte, 2007 * * This file is part of Gecode, the generic constraint * development environment: * http://www.gecode.org * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * */ namespace Gecode { namespace Iter { namespace Values { /** * \brief %Value iterator for array of integers * * Allows to iterate the integers as defined by an array where the * values in the array must be sorted in increasing order. * The integers can be iterated several times provided the iterator * is %reset by the reset member function. * * \ingroup FuncIterValues */ class Array { protected: /// Array for values int* v; /// Current value int c; /// Number of ranges in array int n; public: /// \name Constructors and initialization //@{ /// Default constructor Array(void); /// Initialize with \a n values from \a v Array(int* v, int n); /// Initialize with \a n ranges from \a v void init(int* v, int n); //@} /// \name Iteration control //@{ /// Test whether iterator is still at a value or done bool operator ()(void) const; /// Move iterator to next value (if possible) void operator ++(void); /// Reset iterator to start from beginning void reset(void); //@} /// \name %Value access //@{ /// Return current value int val(void) const; //@} }; forceinline Array::Array(void) {} forceinline Array::Array(int* v0, int n0) : v(v0), c(0), n(n0) {} forceinline void Array::init(int* v0, int n0) { v=v0; c=0; n=n0; } forceinline void Array::operator ++(void) { c++; } forceinline bool Array::operator ()(void) const { return c<n; } forceinline void Array::reset(void) { c=0; } forceinline int Array::val(void) const { return v[c]; } }}} // STATISTICS: iter-any
; A142054: Primes congruent to 8 mod 33. ; Submitted by Jon Maiga ; 41,107,173,239,503,569,701,1031,1097,1163,1229,1361,1427,1493,1559,1823,1889,2087,2153,2351,2417,2549,2879,3011,3209,3407,3539,3671,3803,4001,4133,4397,4463,4793,5189,5387,5519,5651,5717,5783,5849,5981,6047,6113,6311,6971,7103,7433,7499,7829,8093,8291,8423,8753,8819,8951,9281,9413,9479,9677,9743,9941,10007,10139,10271,10337,10601,10667,10733,10799,11261,11393,11657,11789,11987,12119,12251,12647,12713,12911,13043,13109,13241,13901,13967,14033,14561,14627,14759,14891,14957,15287,15551,15683,15749 mov $2,$0 add $2,2 pow $2,2 lpb $2 mul $1,$4 mov $3,$1 add $3,40 seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0. sub $0,$3 add $1,66 sub $2,1 mov $4,$0 max $4,0 cmp $4,$0 mul $2,$4 lpe mov $0,$1 sub $0,25
; size_t b_array_erase(b_array_t *a, size_t idx) SECTION code_clib SECTION code_adt_b_array PUBLIC b_array_erase EXTERN asm_b_array_erase b_array_erase: pop af pop bc pop hl push hl push bc push af jp asm_b_array_erase ; SDCC bridge for Classic IF __CLASSIC PUBLIC _b_array_erase defc _b_array_erase = b_array_erase ENDIF
; A170209: Number of reduced words of length n in Coxeter group on 8 generators S_i with relations (S_i)^2 = (S_i S_j)^40 = I. ; 1,8,56,392,2744,19208,134456,941192,6588344,46118408,322828856,2259801992,15818613944,110730297608,775112083256,5425784582792,37980492079544,265863444556808,1861044111897656,13027308783283592 mov $1,7 pow $1,$0 add $1,2 mul $1,8 div $1,7 sub $1,2 mov $0,$1