text
stringlengths
1
1.05M
[SECTION .s32] BITS 32 call main mov edx, 4 ;返回内核 int 02Dh api_putchar: mov edx, 1 mov al, [esp + 4] int 02Dh ret %include "app.asm"
// Copyright (c) 2014-2018 The Btcgreen Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "chainparams.h" #include "validation.h" #include "test/test_btcgreen.h" #include <boost/test/unit_test.hpp> BOOST_FIXTURE_TEST_SUITE(subsidy_tests, TestingSetup) BOOST_AUTO_TEST_CASE(block_subsidy_test) { const Consensus::Params& consensusParams = Params(CBaseChainParams::MAIN).GetConsensus(); uint32_t nPrevBits; int32_t nPrevHeight; CAmount nSubsidy; // details for block 4249 (subsidy returned will be for block 4250) nPrevBits = 0x1c4a47c4; nPrevHeight = 4249; nSubsidy = GetBlockSubsidy(nPrevBits, nPrevHeight, consensusParams, false); BOOST_CHECK_EQUAL(nSubsidy, 50000000000ULL); // details for block 4501 (subsidy returned will be for block 4502) nPrevBits = 0x1c4a47c4; nPrevHeight = 4501; nSubsidy = GetBlockSubsidy(nPrevBits, nPrevHeight, consensusParams, false); BOOST_CHECK_EQUAL(nSubsidy, 5600000000ULL); // details for block 5464 (subsidy returned will be for block 5465) nPrevBits = 0x1c29ec00; nPrevHeight = 5464; nSubsidy = GetBlockSubsidy(nPrevBits, nPrevHeight, consensusParams, false); BOOST_CHECK_EQUAL(nSubsidy, 2100000000ULL); // details for block 5465 (subsidy returned will be for block 5466) nPrevBits = 0x1c29ec00; nPrevHeight = 5465; nSubsidy = GetBlockSubsidy(nPrevBits, nPrevHeight, consensusParams, false); BOOST_CHECK_EQUAL(nSubsidy, 12200000000ULL); // details for block 17588 (subsidy returned will be for block 17589) nPrevBits = 0x1c08ba34; nPrevHeight = 17588; nSubsidy = GetBlockSubsidy(nPrevBits, nPrevHeight, consensusParams, false); BOOST_CHECK_EQUAL(nSubsidy, 6100000000ULL); // details for block 99999 (subsidy returned will be for block 100000) nPrevBits = 0x1b10cf42; nPrevHeight = 99999; nSubsidy = GetBlockSubsidy(nPrevBits, nPrevHeight, consensusParams, false); BOOST_CHECK_EQUAL(nSubsidy, 500000000ULL); // details for block 210239 (subsidy returned will be for block 210240) nPrevBits = 0x1b11548e; nPrevHeight = 210239; nSubsidy = GetBlockSubsidy(nPrevBits, nPrevHeight, consensusParams, false); BOOST_CHECK_EQUAL(nSubsidy, 500000000ULL); // 1st subsidy reduction happens here // details for block 210240 (subsidy returned will be for block 210241) nPrevBits = 0x1b10d50b; nPrevHeight = 210240; nSubsidy = GetBlockSubsidy(nPrevBits, nPrevHeight, consensusParams, false); BOOST_CHECK_EQUAL(nSubsidy, 464285715ULL); } BOOST_AUTO_TEST_SUITE_END()
//===- llvm/Analysis/TargetTransformInfo.cpp ------------------------------===// // // 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 // //===----------------------------------------------------------------------===// #include "llvm/Analysis/TargetTransformInfo.h" #include "llvm/Analysis/CFG.h" #include "llvm/Analysis/LoopIterator.h" #include "llvm/Analysis/TargetTransformInfoImpl.h" #include "llvm/IR/CFG.h" #include "llvm/IR/CallSite.h" #include "llvm/IR/DataLayout.h" #include "llvm/IR/Instruction.h" #include "llvm/IR/Instructions.h" #include "llvm/IR/IntrinsicInst.h" #include "llvm/IR/Module.h" #include "llvm/IR/Operator.h" #include "llvm/IR/PatternMatch.h" #include "llvm/InitializePasses.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/ErrorHandling.h" #include <utility> using namespace llvm; using namespace PatternMatch; #define DEBUG_TYPE "tti" static cl::opt<bool> EnableReduxCost("costmodel-reduxcost", cl::init(false), cl::Hidden, cl::desc("Recognize reduction patterns.")); namespace { /// No-op implementation of the TTI interface using the utility base /// classes. /// /// This is used when no target specific information is available. struct NoTTIImpl : TargetTransformInfoImplCRTPBase<NoTTIImpl> { explicit NoTTIImpl(const DataLayout &DL) : TargetTransformInfoImplCRTPBase<NoTTIImpl>(DL) {} }; } bool HardwareLoopInfo::canAnalyze(LoopInfo &LI) { // If the loop has irreducible control flow, it can not be converted to // Hardware loop. LoopBlocksRPO RPOT(L); RPOT.perform(&LI); if (containsIrreducibleCFG<const BasicBlock *>(RPOT, LI)) return false; return true; } bool HardwareLoopInfo::isHardwareLoopCandidate(ScalarEvolution &SE, LoopInfo &LI, DominatorTree &DT, bool ForceNestedLoop, bool ForceHardwareLoopPHI) { SmallVector<BasicBlock *, 4> ExitingBlocks; L->getExitingBlocks(ExitingBlocks); for (BasicBlock *BB : ExitingBlocks) { // If we pass the updated counter back through a phi, we need to know // which latch the updated value will be coming from. if (!L->isLoopLatch(BB)) { if (ForceHardwareLoopPHI || CounterInReg) continue; } const SCEV *EC = SE.getExitCount(L, BB); if (isa<SCEVCouldNotCompute>(EC)) continue; if (const SCEVConstant *ConstEC = dyn_cast<SCEVConstant>(EC)) { if (ConstEC->getValue()->isZero()) continue; } else if (!SE.isLoopInvariant(EC, L)) continue; if (SE.getTypeSizeInBits(EC->getType()) > CountType->getBitWidth()) continue; // If this exiting block is contained in a nested loop, it is not eligible // for insertion of the branch-and-decrement since the inner loop would // end up messing up the value in the CTR. if (!IsNestingLegal && LI.getLoopFor(BB) != L && !ForceNestedLoop) continue; // We now have a loop-invariant count of loop iterations (which is not the // constant zero) for which we know that this loop will not exit via this // existing block. // We need to make sure that this block will run on every loop iteration. // For this to be true, we must dominate all blocks with backedges. Such // blocks are in-loop predecessors to the header block. bool NotAlways = false; for (BasicBlock *Pred : predecessors(L->getHeader())) { if (!L->contains(Pred)) continue; if (!DT.dominates(BB, Pred)) { NotAlways = true; break; } } if (NotAlways) continue; // Make sure this blocks ends with a conditional branch. Instruction *TI = BB->getTerminator(); if (!TI) continue; if (BranchInst *BI = dyn_cast<BranchInst>(TI)) { if (!BI->isConditional()) continue; ExitBranch = BI; } else continue; // Note that this block may not be the loop latch block, even if the loop // has a latch block. ExitBlock = BB; ExitCount = EC; break; } if (!ExitBlock) return false; return true; } TargetTransformInfo::TargetTransformInfo(const DataLayout &DL) : TTIImpl(new Model<NoTTIImpl>(NoTTIImpl(DL))) {} TargetTransformInfo::~TargetTransformInfo() {} TargetTransformInfo::TargetTransformInfo(TargetTransformInfo &&Arg) : TTIImpl(std::move(Arg.TTIImpl)) {} TargetTransformInfo &TargetTransformInfo::operator=(TargetTransformInfo &&RHS) { TTIImpl = std::move(RHS.TTIImpl); return *this; } int TargetTransformInfo::getOperationCost(unsigned Opcode, Type *Ty, Type *OpTy) const { int Cost = TTIImpl->getOperationCost(Opcode, Ty, OpTy); assert(Cost >= 0 && "TTI should not produce negative costs!"); return Cost; } int TargetTransformInfo::getCallCost(FunctionType *FTy, int NumArgs, const User *U) const { int Cost = TTIImpl->getCallCost(FTy, NumArgs, U); assert(Cost >= 0 && "TTI should not produce negative costs!"); return Cost; } int TargetTransformInfo::getCallCost(const Function *F, ArrayRef<const Value *> Arguments, const User *U) const { int Cost = TTIImpl->getCallCost(F, Arguments, U); assert(Cost >= 0 && "TTI should not produce negative costs!"); return Cost; } unsigned TargetTransformInfo::getInliningThresholdMultiplier() const { return TTIImpl->getInliningThresholdMultiplier(); } int TargetTransformInfo::getInlinerVectorBonusPercent() const { return TTIImpl->getInlinerVectorBonusPercent(); } int TargetTransformInfo::getGEPCost(Type *PointeeType, const Value *Ptr, ArrayRef<const Value *> Operands) const { return TTIImpl->getGEPCost(PointeeType, Ptr, Operands); } int TargetTransformInfo::getExtCost(const Instruction *I, const Value *Src) const { return TTIImpl->getExtCost(I, Src); } int TargetTransformInfo::getIntrinsicCost( Intrinsic::ID IID, Type *RetTy, ArrayRef<const Value *> Arguments, const User *U) const { int Cost = TTIImpl->getIntrinsicCost(IID, RetTy, Arguments, U); assert(Cost >= 0 && "TTI should not produce negative costs!"); return Cost; } unsigned TargetTransformInfo::getEstimatedNumberOfCaseClusters( const SwitchInst &SI, unsigned &JTSize, ProfileSummaryInfo *PSI, BlockFrequencyInfo *BFI) const { return TTIImpl->getEstimatedNumberOfCaseClusters(SI, JTSize, PSI, BFI); } int TargetTransformInfo::getUserCost(const User *U, ArrayRef<const Value *> Operands) const { int Cost = TTIImpl->getUserCost(U, Operands); assert(Cost >= 0 && "TTI should not produce negative costs!"); return Cost; } bool TargetTransformInfo::hasBranchDivergence() const { return TTIImpl->hasBranchDivergence(); } bool TargetTransformInfo::isSourceOfDivergence(const Value *V) const { return TTIImpl->isSourceOfDivergence(V); } bool llvm::TargetTransformInfo::isAlwaysUniform(const Value *V) const { return TTIImpl->isAlwaysUniform(V); } unsigned TargetTransformInfo::getFlatAddressSpace() const { return TTIImpl->getFlatAddressSpace(); } bool TargetTransformInfo::collectFlatAddressOperands( SmallVectorImpl<int> &OpIndexes, Intrinsic::ID IID) const { return TTIImpl->collectFlatAddressOperands(OpIndexes, IID); } bool TargetTransformInfo::rewriteIntrinsicWithAddressSpace( IntrinsicInst *II, Value *OldV, Value *NewV) const { return TTIImpl->rewriteIntrinsicWithAddressSpace(II, OldV, NewV); } bool TargetTransformInfo::isLoweredToCall(const Function *F) const { return TTIImpl->isLoweredToCall(F); } bool TargetTransformInfo::isHardwareLoopProfitable( Loop *L, ScalarEvolution &SE, AssumptionCache &AC, TargetLibraryInfo *LibInfo, HardwareLoopInfo &HWLoopInfo) const { return TTIImpl->isHardwareLoopProfitable(L, SE, AC, LibInfo, HWLoopInfo); } bool TargetTransformInfo::preferPredicateOverEpilogue(Loop *L, LoopInfo *LI, ScalarEvolution &SE, AssumptionCache &AC, TargetLibraryInfo *TLI, DominatorTree *DT, const LoopAccessInfo *LAI) const { return TTIImpl->preferPredicateOverEpilogue(L, LI, SE, AC, TLI, DT, LAI); } void TargetTransformInfo::getUnrollingPreferences( Loop *L, ScalarEvolution &SE, UnrollingPreferences &UP) const { return TTIImpl->getUnrollingPreferences(L, SE, UP); } bool TargetTransformInfo::isLegalAddImmediate(int64_t Imm) const { return TTIImpl->isLegalAddImmediate(Imm); } bool TargetTransformInfo::isLegalICmpImmediate(int64_t Imm) const { return TTIImpl->isLegalICmpImmediate(Imm); } bool TargetTransformInfo::isLegalAddressingMode(Type *Ty, GlobalValue *BaseGV, int64_t BaseOffset, bool HasBaseReg, int64_t Scale, unsigned AddrSpace, Instruction *I) const { return TTIImpl->isLegalAddressingMode(Ty, BaseGV, BaseOffset, HasBaseReg, Scale, AddrSpace, I); } bool TargetTransformInfo::isLSRCostLess(LSRCost &C1, LSRCost &C2) const { return TTIImpl->isLSRCostLess(C1, C2); } bool TargetTransformInfo::canMacroFuseCmp() const { return TTIImpl->canMacroFuseCmp(); } bool TargetTransformInfo::canSaveCmp(Loop *L, BranchInst **BI, ScalarEvolution *SE, LoopInfo *LI, DominatorTree *DT, AssumptionCache *AC, TargetLibraryInfo *LibInfo) const { return TTIImpl->canSaveCmp(L, BI, SE, LI, DT, AC, LibInfo); } bool TargetTransformInfo::shouldFavorPostInc() const { return TTIImpl->shouldFavorPostInc(); } bool TargetTransformInfo::shouldFavorBackedgeIndex(const Loop *L) const { return TTIImpl->shouldFavorBackedgeIndex(L); } bool TargetTransformInfo::isLegalMaskedStore(Type *DataType, MaybeAlign Alignment) const { return TTIImpl->isLegalMaskedStore(DataType, Alignment); } bool TargetTransformInfo::isLegalMaskedLoad(Type *DataType, MaybeAlign Alignment) const { return TTIImpl->isLegalMaskedLoad(DataType, Alignment); } bool TargetTransformInfo::isLegalNTStore(Type *DataType, Align Alignment) const { return TTIImpl->isLegalNTStore(DataType, Alignment); } bool TargetTransformInfo::isLegalNTLoad(Type *DataType, Align Alignment) const { return TTIImpl->isLegalNTLoad(DataType, Alignment); } bool TargetTransformInfo::isLegalMaskedGather(Type *DataType) const { return TTIImpl->isLegalMaskedGather(DataType); } bool TargetTransformInfo::isLegalMaskedScatter(Type *DataType) const { return TTIImpl->isLegalMaskedScatter(DataType); } bool TargetTransformInfo::isLegalMaskedCompressStore(Type *DataType) const { return TTIImpl->isLegalMaskedCompressStore(DataType); } bool TargetTransformInfo::isLegalMaskedExpandLoad(Type *DataType) const { return TTIImpl->isLegalMaskedExpandLoad(DataType); } bool TargetTransformInfo::hasDivRemOp(Type *DataType, bool IsSigned) const { return TTIImpl->hasDivRemOp(DataType, IsSigned); } bool TargetTransformInfo::hasVolatileVariant(Instruction *I, unsigned AddrSpace) const { return TTIImpl->hasVolatileVariant(I, AddrSpace); } bool TargetTransformInfo::prefersVectorizedAddressing() const { return TTIImpl->prefersVectorizedAddressing(); } int TargetTransformInfo::getScalingFactorCost(Type *Ty, GlobalValue *BaseGV, int64_t BaseOffset, bool HasBaseReg, int64_t Scale, unsigned AddrSpace) const { int Cost = TTIImpl->getScalingFactorCost(Ty, BaseGV, BaseOffset, HasBaseReg, Scale, AddrSpace); assert(Cost >= 0 && "TTI should not produce negative costs!"); return Cost; } bool TargetTransformInfo::LSRWithInstrQueries() const { return TTIImpl->LSRWithInstrQueries(); } bool TargetTransformInfo::isTruncateFree(Type *Ty1, Type *Ty2) const { return TTIImpl->isTruncateFree(Ty1, Ty2); } bool TargetTransformInfo::isProfitableToHoist(Instruction *I) const { return TTIImpl->isProfitableToHoist(I); } bool TargetTransformInfo::useAA() const { return TTIImpl->useAA(); } bool TargetTransformInfo::isTypeLegal(Type *Ty) const { return TTIImpl->isTypeLegal(Ty); } bool TargetTransformInfo::shouldBuildLookupTables() const { return TTIImpl->shouldBuildLookupTables(); } bool TargetTransformInfo::shouldBuildLookupTablesForConstant(Constant *C) const { return TTIImpl->shouldBuildLookupTablesForConstant(C); } bool TargetTransformInfo::useColdCCForColdCall(Function &F) const { return TTIImpl->useColdCCForColdCall(F); } unsigned TargetTransformInfo:: getScalarizationOverhead(Type *Ty, bool Insert, bool Extract) const { return TTIImpl->getScalarizationOverhead(Ty, Insert, Extract); } unsigned TargetTransformInfo:: getOperandsScalarizationOverhead(ArrayRef<const Value *> Args, unsigned VF) const { return TTIImpl->getOperandsScalarizationOverhead(Args, VF); } bool TargetTransformInfo::supportsEfficientVectorElementLoadStore() const { return TTIImpl->supportsEfficientVectorElementLoadStore(); } bool TargetTransformInfo::enableAggressiveInterleaving(bool LoopHasReductions) const { return TTIImpl->enableAggressiveInterleaving(LoopHasReductions); } TargetTransformInfo::MemCmpExpansionOptions TargetTransformInfo::enableMemCmpExpansion(bool OptSize, bool IsZeroCmp) const { return TTIImpl->enableMemCmpExpansion(OptSize, IsZeroCmp); } bool TargetTransformInfo::enableInterleavedAccessVectorization() const { return TTIImpl->enableInterleavedAccessVectorization(); } bool TargetTransformInfo::enableMaskedInterleavedAccessVectorization() const { return TTIImpl->enableMaskedInterleavedAccessVectorization(); } bool TargetTransformInfo::isFPVectorizationPotentiallyUnsafe() const { return TTIImpl->isFPVectorizationPotentiallyUnsafe(); } bool TargetTransformInfo::allowsMisalignedMemoryAccesses(LLVMContext &Context, unsigned BitWidth, unsigned AddressSpace, unsigned Alignment, bool *Fast) const { return TTIImpl->allowsMisalignedMemoryAccesses(Context, BitWidth, AddressSpace, Alignment, Fast); } TargetTransformInfo::PopcntSupportKind TargetTransformInfo::getPopcntSupport(unsigned IntTyWidthInBit) const { return TTIImpl->getPopcntSupport(IntTyWidthInBit); } bool TargetTransformInfo::haveFastSqrt(Type *Ty) const { return TTIImpl->haveFastSqrt(Ty); } bool TargetTransformInfo::isFCmpOrdCheaperThanFCmpZero(Type *Ty) const { return TTIImpl->isFCmpOrdCheaperThanFCmpZero(Ty); } int TargetTransformInfo::getFPOpCost(Type *Ty) const { int Cost = TTIImpl->getFPOpCost(Ty); assert(Cost >= 0 && "TTI should not produce negative costs!"); return Cost; } int TargetTransformInfo::getIntImmCodeSizeCost(unsigned Opcode, unsigned Idx, const APInt &Imm, Type *Ty) const { int Cost = TTIImpl->getIntImmCodeSizeCost(Opcode, Idx, Imm, Ty); assert(Cost >= 0 && "TTI should not produce negative costs!"); return Cost; } int TargetTransformInfo::getIntImmCost(const APInt &Imm, Type *Ty) const { int Cost = TTIImpl->getIntImmCost(Imm, Ty); assert(Cost >= 0 && "TTI should not produce negative costs!"); return Cost; } int TargetTransformInfo::getIntImmCostInst(unsigned Opcode, unsigned Idx, const APInt &Imm, Type *Ty) const { int Cost = TTIImpl->getIntImmCostInst(Opcode, Idx, Imm, Ty); assert(Cost >= 0 && "TTI should not produce negative costs!"); return Cost; } int TargetTransformInfo::getIntImmCostIntrin(Intrinsic::ID IID, unsigned Idx, const APInt &Imm, Type *Ty) const { int Cost = TTIImpl->getIntImmCostIntrin(IID, Idx, Imm, Ty); assert(Cost >= 0 && "TTI should not produce negative costs!"); return Cost; } unsigned TargetTransformInfo::getNumberOfRegisters(unsigned ClassID) const { return TTIImpl->getNumberOfRegisters(ClassID); } unsigned TargetTransformInfo::getRegisterClassForType(bool Vector, Type *Ty) const { return TTIImpl->getRegisterClassForType(Vector, Ty); } const char* TargetTransformInfo::getRegisterClassName(unsigned ClassID) const { return TTIImpl->getRegisterClassName(ClassID); } unsigned TargetTransformInfo::getRegisterBitWidth(bool Vector) const { return TTIImpl->getRegisterBitWidth(Vector); } unsigned TargetTransformInfo::getMinVectorRegisterBitWidth() const { return TTIImpl->getMinVectorRegisterBitWidth(); } bool TargetTransformInfo::shouldMaximizeVectorBandwidth(bool OptSize) const { return TTIImpl->shouldMaximizeVectorBandwidth(OptSize); } unsigned TargetTransformInfo::getMinimumVF(unsigned ElemWidth) const { return TTIImpl->getMinimumVF(ElemWidth); } bool TargetTransformInfo::shouldConsiderAddressTypePromotion( const Instruction &I, bool &AllowPromotionWithoutCommonHeader) const { return TTIImpl->shouldConsiderAddressTypePromotion( I, AllowPromotionWithoutCommonHeader); } unsigned TargetTransformInfo::getCacheLineSize() const { return TTIImpl->getCacheLineSize(); } llvm::Optional<unsigned> TargetTransformInfo::getCacheSize(CacheLevel Level) const { return TTIImpl->getCacheSize(Level); } llvm::Optional<unsigned> TargetTransformInfo::getCacheAssociativity( CacheLevel Level) const { return TTIImpl->getCacheAssociativity(Level); } unsigned TargetTransformInfo::getPrefetchDistance() const { return TTIImpl->getPrefetchDistance(); } unsigned TargetTransformInfo::getMinPrefetchStride() const { return TTIImpl->getMinPrefetchStride(); } unsigned TargetTransformInfo::getMaxPrefetchIterationsAhead() const { return TTIImpl->getMaxPrefetchIterationsAhead(); } unsigned TargetTransformInfo::getMaxInterleaveFactor(unsigned VF) const { return TTIImpl->getMaxInterleaveFactor(VF); } TargetTransformInfo::OperandValueKind TargetTransformInfo::getOperandInfo(Value *V, OperandValueProperties &OpProps) { OperandValueKind OpInfo = OK_AnyValue; OpProps = OP_None; if (auto *CI = dyn_cast<ConstantInt>(V)) { if (CI->getValue().isPowerOf2()) OpProps = OP_PowerOf2; return OK_UniformConstantValue; } // A broadcast shuffle creates a uniform value. // TODO: Add support for non-zero index broadcasts. // TODO: Add support for different source vector width. if (auto *ShuffleInst = dyn_cast<ShuffleVectorInst>(V)) if (ShuffleInst->isZeroEltSplat()) OpInfo = OK_UniformValue; const Value *Splat = getSplatValue(V); // Check for a splat of a constant or for a non uniform vector of constants // and check if the constant(s) are all powers of two. if (isa<ConstantVector>(V) || isa<ConstantDataVector>(V)) { OpInfo = OK_NonUniformConstantValue; if (Splat) { OpInfo = OK_UniformConstantValue; if (auto *CI = dyn_cast<ConstantInt>(Splat)) if (CI->getValue().isPowerOf2()) OpProps = OP_PowerOf2; } else if (auto *CDS = dyn_cast<ConstantDataSequential>(V)) { OpProps = OP_PowerOf2; for (unsigned I = 0, E = CDS->getNumElements(); I != E; ++I) { if (auto *CI = dyn_cast<ConstantInt>(CDS->getElementAsConstant(I))) if (CI->getValue().isPowerOf2()) continue; OpProps = OP_None; break; } } } // Check for a splat of a uniform value. This is not loop aware, so return // true only for the obviously uniform cases (argument, globalvalue) if (Splat && (isa<Argument>(Splat) || isa<GlobalValue>(Splat))) OpInfo = OK_UniformValue; return OpInfo; } int TargetTransformInfo::getArithmeticInstrCost( unsigned Opcode, Type *Ty, OperandValueKind Opd1Info, OperandValueKind Opd2Info, OperandValueProperties Opd1PropInfo, OperandValueProperties Opd2PropInfo, ArrayRef<const Value *> Args, const Instruction *CxtI) const { int Cost = TTIImpl->getArithmeticInstrCost( Opcode, Ty, Opd1Info, Opd2Info, Opd1PropInfo, Opd2PropInfo, Args, CxtI); assert(Cost >= 0 && "TTI should not produce negative costs!"); return Cost; } int TargetTransformInfo::getShuffleCost(ShuffleKind Kind, Type *Ty, int Index, Type *SubTp) const { int Cost = TTIImpl->getShuffleCost(Kind, Ty, Index, SubTp); assert(Cost >= 0 && "TTI should not produce negative costs!"); return Cost; } int TargetTransformInfo::getCastInstrCost(unsigned Opcode, Type *Dst, Type *Src, const Instruction *I) const { assert ((I == nullptr || I->getOpcode() == Opcode) && "Opcode should reflect passed instruction."); int Cost = TTIImpl->getCastInstrCost(Opcode, Dst, Src, I); assert(Cost >= 0 && "TTI should not produce negative costs!"); return Cost; } int TargetTransformInfo::getExtractWithExtendCost(unsigned Opcode, Type *Dst, VectorType *VecTy, unsigned Index) const { int Cost = TTIImpl->getExtractWithExtendCost(Opcode, Dst, VecTy, Index); assert(Cost >= 0 && "TTI should not produce negative costs!"); return Cost; } int TargetTransformInfo::getCFInstrCost(unsigned Opcode) const { int Cost = TTIImpl->getCFInstrCost(Opcode); assert(Cost >= 0 && "TTI should not produce negative costs!"); return Cost; } int TargetTransformInfo::getCmpSelInstrCost(unsigned Opcode, Type *ValTy, Type *CondTy, const Instruction *I) const { assert ((I == nullptr || I->getOpcode() == Opcode) && "Opcode should reflect passed instruction."); int Cost = TTIImpl->getCmpSelInstrCost(Opcode, ValTy, CondTy, I); assert(Cost >= 0 && "TTI should not produce negative costs!"); return Cost; } int TargetTransformInfo::getVectorInstrCost(unsigned Opcode, Type *Val, unsigned Index) const { int Cost = TTIImpl->getVectorInstrCost(Opcode, Val, Index); assert(Cost >= 0 && "TTI should not produce negative costs!"); return Cost; } int TargetTransformInfo::getMemoryOpCost(unsigned Opcode, Type *Src, MaybeAlign Alignment, unsigned AddressSpace, const Instruction *I) const { assert ((I == nullptr || I->getOpcode() == Opcode) && "Opcode should reflect passed instruction."); int Cost = TTIImpl->getMemoryOpCost(Opcode, Src, Alignment, AddressSpace, I); assert(Cost >= 0 && "TTI should not produce negative costs!"); return Cost; } int TargetTransformInfo::getMaskedMemoryOpCost(unsigned Opcode, Type *Src, unsigned Alignment, unsigned AddressSpace) const { int Cost = TTIImpl->getMaskedMemoryOpCost(Opcode, Src, Alignment, AddressSpace); assert(Cost >= 0 && "TTI should not produce negative costs!"); return Cost; } int TargetTransformInfo::getGatherScatterOpCost(unsigned Opcode, Type *DataTy, Value *Ptr, bool VariableMask, unsigned Alignment) const { int Cost = TTIImpl->getGatherScatterOpCost(Opcode, DataTy, Ptr, VariableMask, Alignment); assert(Cost >= 0 && "TTI should not produce negative costs!"); return Cost; } int TargetTransformInfo::getInterleavedMemoryOpCost( unsigned Opcode, Type *VecTy, unsigned Factor, ArrayRef<unsigned> Indices, unsigned Alignment, unsigned AddressSpace, bool UseMaskForCond, bool UseMaskForGaps) const { int Cost = TTIImpl->getInterleavedMemoryOpCost(Opcode, VecTy, Factor, Indices, Alignment, AddressSpace, UseMaskForCond, UseMaskForGaps); assert(Cost >= 0 && "TTI should not produce negative costs!"); return Cost; } int TargetTransformInfo::getIntrinsicInstrCost(Intrinsic::ID ID, Type *RetTy, ArrayRef<Type *> Tys, FastMathFlags FMF, unsigned ScalarizationCostPassed) const { int Cost = TTIImpl->getIntrinsicInstrCost(ID, RetTy, Tys, FMF, ScalarizationCostPassed); assert(Cost >= 0 && "TTI should not produce negative costs!"); return Cost; } int TargetTransformInfo::getIntrinsicInstrCost(Intrinsic::ID ID, Type *RetTy, ArrayRef<Value *> Args, FastMathFlags FMF, unsigned VF) const { int Cost = TTIImpl->getIntrinsicInstrCost(ID, RetTy, Args, FMF, VF); assert(Cost >= 0 && "TTI should not produce negative costs!"); return Cost; } int TargetTransformInfo::getCallInstrCost(Function *F, Type *RetTy, ArrayRef<Type *> Tys) const { int Cost = TTIImpl->getCallInstrCost(F, RetTy, Tys); assert(Cost >= 0 && "TTI should not produce negative costs!"); return Cost; } unsigned TargetTransformInfo::getNumberOfParts(Type *Tp) const { return TTIImpl->getNumberOfParts(Tp); } int TargetTransformInfo::getAddressComputationCost(Type *Tp, ScalarEvolution *SE, const SCEV *Ptr) const { int Cost = TTIImpl->getAddressComputationCost(Tp, SE, Ptr); assert(Cost >= 0 && "TTI should not produce negative costs!"); return Cost; } int TargetTransformInfo::getMemcpyCost(const Instruction *I) const { int Cost = TTIImpl->getMemcpyCost(I); assert(Cost >= 0 && "TTI should not produce negative costs!"); return Cost; } int TargetTransformInfo::getArithmeticReductionCost(unsigned Opcode, Type *Ty, bool IsPairwiseForm) const { int Cost = TTIImpl->getArithmeticReductionCost(Opcode, Ty, IsPairwiseForm); assert(Cost >= 0 && "TTI should not produce negative costs!"); return Cost; } int TargetTransformInfo::getMinMaxReductionCost(Type *Ty, Type *CondTy, bool IsPairwiseForm, bool IsUnsigned) const { int Cost = TTIImpl->getMinMaxReductionCost(Ty, CondTy, IsPairwiseForm, IsUnsigned); assert(Cost >= 0 && "TTI should not produce negative costs!"); return Cost; } unsigned TargetTransformInfo::getCostOfKeepingLiveOverCall(ArrayRef<Type *> Tys) const { return TTIImpl->getCostOfKeepingLiveOverCall(Tys); } bool TargetTransformInfo::getTgtMemIntrinsic(IntrinsicInst *Inst, MemIntrinsicInfo &Info) const { return TTIImpl->getTgtMemIntrinsic(Inst, Info); } unsigned TargetTransformInfo::getAtomicMemIntrinsicMaxElementSize() const { return TTIImpl->getAtomicMemIntrinsicMaxElementSize(); } Value *TargetTransformInfo::getOrCreateResultFromMemIntrinsic( IntrinsicInst *Inst, Type *ExpectedType) const { return TTIImpl->getOrCreateResultFromMemIntrinsic(Inst, ExpectedType); } Type *TargetTransformInfo::getMemcpyLoopLoweringType(LLVMContext &Context, Value *Length, unsigned SrcAlign, unsigned DestAlign) const { return TTIImpl->getMemcpyLoopLoweringType(Context, Length, SrcAlign, DestAlign); } void TargetTransformInfo::getMemcpyLoopResidualLoweringType( SmallVectorImpl<Type *> &OpsOut, LLVMContext &Context, unsigned RemainingBytes, unsigned SrcAlign, unsigned DestAlign) const { TTIImpl->getMemcpyLoopResidualLoweringType(OpsOut, Context, RemainingBytes, SrcAlign, DestAlign); } bool TargetTransformInfo::areInlineCompatible(const Function *Caller, const Function *Callee) const { return TTIImpl->areInlineCompatible(Caller, Callee); } bool TargetTransformInfo::areFunctionArgsABICompatible( const Function *Caller, const Function *Callee, SmallPtrSetImpl<Argument *> &Args) const { return TTIImpl->areFunctionArgsABICompatible(Caller, Callee, Args); } bool TargetTransformInfo::isIndexedLoadLegal(MemIndexedMode Mode, Type *Ty) const { return TTIImpl->isIndexedLoadLegal(Mode, Ty); } bool TargetTransformInfo::isIndexedStoreLegal(MemIndexedMode Mode, Type *Ty) const { return TTIImpl->isIndexedStoreLegal(Mode, Ty); } unsigned TargetTransformInfo::getLoadStoreVecRegBitWidth(unsigned AS) const { return TTIImpl->getLoadStoreVecRegBitWidth(AS); } bool TargetTransformInfo::isLegalToVectorizeLoad(LoadInst *LI) const { return TTIImpl->isLegalToVectorizeLoad(LI); } bool TargetTransformInfo::isLegalToVectorizeStore(StoreInst *SI) const { return TTIImpl->isLegalToVectorizeStore(SI); } bool TargetTransformInfo::isLegalToVectorizeLoadChain( unsigned ChainSizeInBytes, unsigned Alignment, unsigned AddrSpace) const { return TTIImpl->isLegalToVectorizeLoadChain(ChainSizeInBytes, Alignment, AddrSpace); } bool TargetTransformInfo::isLegalToVectorizeStoreChain( unsigned ChainSizeInBytes, unsigned Alignment, unsigned AddrSpace) const { return TTIImpl->isLegalToVectorizeStoreChain(ChainSizeInBytes, Alignment, AddrSpace); } unsigned TargetTransformInfo::getLoadVectorFactor(unsigned VF, unsigned LoadSize, unsigned ChainSizeInBytes, VectorType *VecTy) const { return TTIImpl->getLoadVectorFactor(VF, LoadSize, ChainSizeInBytes, VecTy); } unsigned TargetTransformInfo::getStoreVectorFactor(unsigned VF, unsigned StoreSize, unsigned ChainSizeInBytes, VectorType *VecTy) const { return TTIImpl->getStoreVectorFactor(VF, StoreSize, ChainSizeInBytes, VecTy); } bool TargetTransformInfo::useReductionIntrinsic(unsigned Opcode, Type *Ty, ReductionFlags Flags) const { return TTIImpl->useReductionIntrinsic(Opcode, Ty, Flags); } bool TargetTransformInfo::shouldExpandReduction(const IntrinsicInst *II) const { return TTIImpl->shouldExpandReduction(II); } unsigned TargetTransformInfo::getGISelRematGlobalCost() const { return TTIImpl->getGISelRematGlobalCost(); } int TargetTransformInfo::getInstructionLatency(const Instruction *I) const { return TTIImpl->getInstructionLatency(I); } static bool matchPairwiseShuffleMask(ShuffleVectorInst *SI, bool IsLeft, unsigned Level) { // We don't need a shuffle if we just want to have element 0 in position 0 of // the vector. if (!SI && Level == 0 && IsLeft) return true; else if (!SI) return false; SmallVector<int, 32> Mask(SI->getType()->getVectorNumElements(), -1); // Build a mask of 0, 2, ... (left) or 1, 3, ... (right) depending on whether // we look at the left or right side. for (unsigned i = 0, e = (1 << Level), val = !IsLeft; i != e; ++i, val += 2) Mask[i] = val; SmallVector<int, 16> ActualMask = SI->getShuffleMask(); return Mask == ActualMask; } namespace { /// Kind of the reduction data. enum ReductionKind { RK_None, /// Not a reduction. RK_Arithmetic, /// Binary reduction data. RK_MinMax, /// Min/max reduction data. RK_UnsignedMinMax, /// Unsigned min/max reduction data. }; /// Contains opcode + LHS/RHS parts of the reduction operations. struct ReductionData { ReductionData() = delete; ReductionData(ReductionKind Kind, unsigned Opcode, Value *LHS, Value *RHS) : Opcode(Opcode), LHS(LHS), RHS(RHS), Kind(Kind) { assert(Kind != RK_None && "expected binary or min/max reduction only."); } unsigned Opcode = 0; Value *LHS = nullptr; Value *RHS = nullptr; ReductionKind Kind = RK_None; bool hasSameData(ReductionData &RD) const { return Kind == RD.Kind && Opcode == RD.Opcode; } }; } // namespace static Optional<ReductionData> getReductionData(Instruction *I) { Value *L, *R; if (m_BinOp(m_Value(L), m_Value(R)).match(I)) return ReductionData(RK_Arithmetic, I->getOpcode(), L, R); if (auto *SI = dyn_cast<SelectInst>(I)) { if (m_SMin(m_Value(L), m_Value(R)).match(SI) || m_SMax(m_Value(L), m_Value(R)).match(SI) || m_OrdFMin(m_Value(L), m_Value(R)).match(SI) || m_OrdFMax(m_Value(L), m_Value(R)).match(SI) || m_UnordFMin(m_Value(L), m_Value(R)).match(SI) || m_UnordFMax(m_Value(L), m_Value(R)).match(SI)) { auto *CI = cast<CmpInst>(SI->getCondition()); return ReductionData(RK_MinMax, CI->getOpcode(), L, R); } if (m_UMin(m_Value(L), m_Value(R)).match(SI) || m_UMax(m_Value(L), m_Value(R)).match(SI)) { auto *CI = cast<CmpInst>(SI->getCondition()); return ReductionData(RK_UnsignedMinMax, CI->getOpcode(), L, R); } } return llvm::None; } static ReductionKind matchPairwiseReductionAtLevel(Instruction *I, unsigned Level, unsigned NumLevels) { // Match one level of pairwise operations. // %rdx.shuf.0.0 = shufflevector <4 x float> %rdx, <4 x float> undef, // <4 x i32> <i32 0, i32 2 , i32 undef, i32 undef> // %rdx.shuf.0.1 = shufflevector <4 x float> %rdx, <4 x float> undef, // <4 x i32> <i32 1, i32 3, i32 undef, i32 undef> // %bin.rdx.0 = fadd <4 x float> %rdx.shuf.0.0, %rdx.shuf.0.1 if (!I) return RK_None; assert(I->getType()->isVectorTy() && "Expecting a vector type"); Optional<ReductionData> RD = getReductionData(I); if (!RD) return RK_None; ShuffleVectorInst *LS = dyn_cast<ShuffleVectorInst>(RD->LHS); if (!LS && Level) return RK_None; ShuffleVectorInst *RS = dyn_cast<ShuffleVectorInst>(RD->RHS); if (!RS && Level) return RK_None; // On level 0 we can omit one shufflevector instruction. if (!Level && !RS && !LS) return RK_None; // Shuffle inputs must match. Value *NextLevelOpL = LS ? LS->getOperand(0) : nullptr; Value *NextLevelOpR = RS ? RS->getOperand(0) : nullptr; Value *NextLevelOp = nullptr; if (NextLevelOpR && NextLevelOpL) { // If we have two shuffles their operands must match. if (NextLevelOpL != NextLevelOpR) return RK_None; NextLevelOp = NextLevelOpL; } else if (Level == 0 && (NextLevelOpR || NextLevelOpL)) { // On the first level we can omit the shufflevector <0, undef,...>. So the // input to the other shufflevector <1, undef> must match with one of the // inputs to the current binary operation. // Example: // %NextLevelOpL = shufflevector %R, <1, undef ...> // %BinOp = fadd %NextLevelOpL, %R if (NextLevelOpL && NextLevelOpL != RD->RHS) return RK_None; else if (NextLevelOpR && NextLevelOpR != RD->LHS) return RK_None; NextLevelOp = NextLevelOpL ? RD->RHS : RD->LHS; } else return RK_None; // Check that the next levels binary operation exists and matches with the // current one. if (Level + 1 != NumLevels) { Optional<ReductionData> NextLevelRD = getReductionData(cast<Instruction>(NextLevelOp)); if (!NextLevelRD || !RD->hasSameData(*NextLevelRD)) return RK_None; } // Shuffle mask for pairwise operation must match. if (matchPairwiseShuffleMask(LS, /*IsLeft=*/true, Level)) { if (!matchPairwiseShuffleMask(RS, /*IsLeft=*/false, Level)) return RK_None; } else if (matchPairwiseShuffleMask(RS, /*IsLeft=*/true, Level)) { if (!matchPairwiseShuffleMask(LS, /*IsLeft=*/false, Level)) return RK_None; } else { return RK_None; } if (++Level == NumLevels) return RD->Kind; // Match next level. return matchPairwiseReductionAtLevel(cast<Instruction>(NextLevelOp), Level, NumLevels); } static ReductionKind matchPairwiseReduction(const ExtractElementInst *ReduxRoot, unsigned &Opcode, Type *&Ty) { if (!EnableReduxCost) return RK_None; // Need to extract the first element. ConstantInt *CI = dyn_cast<ConstantInt>(ReduxRoot->getOperand(1)); unsigned Idx = ~0u; if (CI) Idx = CI->getZExtValue(); if (Idx != 0) return RK_None; auto *RdxStart = dyn_cast<Instruction>(ReduxRoot->getOperand(0)); if (!RdxStart) return RK_None; Optional<ReductionData> RD = getReductionData(RdxStart); if (!RD) return RK_None; Type *VecTy = RdxStart->getType(); unsigned NumVecElems = VecTy->getVectorNumElements(); if (!isPowerOf2_32(NumVecElems)) return RK_None; // We look for a sequence of shuffle,shuffle,add triples like the following // that builds a pairwise reduction tree. // // (X0, X1, X2, X3) // (X0 + X1, X2 + X3, undef, undef) // ((X0 + X1) + (X2 + X3), undef, undef, undef) // // %rdx.shuf.0.0 = shufflevector <4 x float> %rdx, <4 x float> undef, // <4 x i32> <i32 0, i32 2 , i32 undef, i32 undef> // %rdx.shuf.0.1 = shufflevector <4 x float> %rdx, <4 x float> undef, // <4 x i32> <i32 1, i32 3, i32 undef, i32 undef> // %bin.rdx.0 = fadd <4 x float> %rdx.shuf.0.0, %rdx.shuf.0.1 // %rdx.shuf.1.0 = shufflevector <4 x float> %bin.rdx.0, <4 x float> undef, // <4 x i32> <i32 0, i32 undef, i32 undef, i32 undef> // %rdx.shuf.1.1 = shufflevector <4 x float> %bin.rdx.0, <4 x float> undef, // <4 x i32> <i32 1, i32 undef, i32 undef, i32 undef> // %bin.rdx8 = fadd <4 x float> %rdx.shuf.1.0, %rdx.shuf.1.1 // %r = extractelement <4 x float> %bin.rdx8, i32 0 if (matchPairwiseReductionAtLevel(RdxStart, 0, Log2_32(NumVecElems)) == RK_None) return RK_None; Opcode = RD->Opcode; Ty = VecTy; return RD->Kind; } static std::pair<Value *, ShuffleVectorInst *> getShuffleAndOtherOprd(Value *L, Value *R) { ShuffleVectorInst *S = nullptr; if ((S = dyn_cast<ShuffleVectorInst>(L))) return std::make_pair(R, S); S = dyn_cast<ShuffleVectorInst>(R); return std::make_pair(L, S); } static ReductionKind matchVectorSplittingReduction(const ExtractElementInst *ReduxRoot, unsigned &Opcode, Type *&Ty) { if (!EnableReduxCost) return RK_None; // Need to extract the first element. ConstantInt *CI = dyn_cast<ConstantInt>(ReduxRoot->getOperand(1)); unsigned Idx = ~0u; if (CI) Idx = CI->getZExtValue(); if (Idx != 0) return RK_None; auto *RdxStart = dyn_cast<Instruction>(ReduxRoot->getOperand(0)); if (!RdxStart) return RK_None; Optional<ReductionData> RD = getReductionData(RdxStart); if (!RD) return RK_None; Type *VecTy = ReduxRoot->getOperand(0)->getType(); unsigned NumVecElems = VecTy->getVectorNumElements(); if (!isPowerOf2_32(NumVecElems)) return RK_None; // We look for a sequence of shuffles and adds like the following matching one // fadd, shuffle vector pair at a time. // // %rdx.shuf = shufflevector <4 x float> %rdx, <4 x float> undef, // <4 x i32> <i32 2, i32 3, i32 undef, i32 undef> // %bin.rdx = fadd <4 x float> %rdx, %rdx.shuf // %rdx.shuf7 = shufflevector <4 x float> %bin.rdx, <4 x float> undef, // <4 x i32> <i32 1, i32 undef, i32 undef, i32 undef> // %bin.rdx8 = fadd <4 x float> %bin.rdx, %rdx.shuf7 // %r = extractelement <4 x float> %bin.rdx8, i32 0 unsigned MaskStart = 1; Instruction *RdxOp = RdxStart; SmallVector<int, 32> ShuffleMask(NumVecElems, 0); unsigned NumVecElemsRemain = NumVecElems; while (NumVecElemsRemain - 1) { // Check for the right reduction operation. if (!RdxOp) return RK_None; Optional<ReductionData> RDLevel = getReductionData(RdxOp); if (!RDLevel || !RDLevel->hasSameData(*RD)) return RK_None; Value *NextRdxOp; ShuffleVectorInst *Shuffle; std::tie(NextRdxOp, Shuffle) = getShuffleAndOtherOprd(RDLevel->LHS, RDLevel->RHS); // Check the current reduction operation and the shuffle use the same value. if (Shuffle == nullptr) return RK_None; if (Shuffle->getOperand(0) != NextRdxOp) return RK_None; // Check that shuffle masks matches. for (unsigned j = 0; j != MaskStart; ++j) ShuffleMask[j] = MaskStart + j; // Fill the rest of the mask with -1 for undef. std::fill(&ShuffleMask[MaskStart], ShuffleMask.end(), -1); SmallVector<int, 16> Mask = Shuffle->getShuffleMask(); if (ShuffleMask != Mask) return RK_None; RdxOp = dyn_cast<Instruction>(NextRdxOp); NumVecElemsRemain /= 2; MaskStart *= 2; } Opcode = RD->Opcode; Ty = VecTy; return RD->Kind; } int TargetTransformInfo::getInstructionThroughput(const Instruction *I) const { switch (I->getOpcode()) { case Instruction::GetElementPtr: return getUserCost(I); case Instruction::Ret: case Instruction::PHI: case Instruction::Br: { return getCFInstrCost(I->getOpcode()); } case Instruction::Add: case Instruction::FAdd: case Instruction::Sub: case Instruction::FSub: case Instruction::Mul: case Instruction::FMul: case Instruction::UDiv: case Instruction::SDiv: case Instruction::FDiv: case Instruction::URem: case Instruction::SRem: case Instruction::FRem: case Instruction::Shl: case Instruction::LShr: case Instruction::AShr: case Instruction::And: case Instruction::Or: case Instruction::Xor: { TargetTransformInfo::OperandValueKind Op1VK, Op2VK; TargetTransformInfo::OperandValueProperties Op1VP, Op2VP; Op1VK = getOperandInfo(I->getOperand(0), Op1VP); Op2VK = getOperandInfo(I->getOperand(1), Op2VP); SmallVector<const Value *, 2> Operands(I->operand_values()); return getArithmeticInstrCost(I->getOpcode(), I->getType(), Op1VK, Op2VK, Op1VP, Op2VP, Operands, I); } case Instruction::FNeg: { TargetTransformInfo::OperandValueKind Op1VK, Op2VK; TargetTransformInfo::OperandValueProperties Op1VP, Op2VP; Op1VK = getOperandInfo(I->getOperand(0), Op1VP); Op2VK = OK_AnyValue; Op2VP = OP_None; SmallVector<const Value *, 2> Operands(I->operand_values()); return getArithmeticInstrCost(I->getOpcode(), I->getType(), Op1VK, Op2VK, Op1VP, Op2VP, Operands, I); } case Instruction::Select: { const SelectInst *SI = cast<SelectInst>(I); Type *CondTy = SI->getCondition()->getType(); return getCmpSelInstrCost(I->getOpcode(), I->getType(), CondTy, I); } case Instruction::ICmp: case Instruction::FCmp: { Type *ValTy = I->getOperand(0)->getType(); return getCmpSelInstrCost(I->getOpcode(), ValTy, I->getType(), I); } case Instruction::Store: { const StoreInst *SI = cast<StoreInst>(I); Type *ValTy = SI->getValueOperand()->getType(); return getMemoryOpCost(I->getOpcode(), ValTy, MaybeAlign(SI->getAlignment()), SI->getPointerAddressSpace(), I); } case Instruction::Load: { const LoadInst *LI = cast<LoadInst>(I); return getMemoryOpCost(I->getOpcode(), I->getType(), MaybeAlign(LI->getAlignment()), LI->getPointerAddressSpace(), I); } case Instruction::ZExt: case Instruction::SExt: case Instruction::FPToUI: case Instruction::FPToSI: case Instruction::FPExt: case Instruction::PtrToInt: case Instruction::IntToPtr: case Instruction::SIToFP: case Instruction::UIToFP: case Instruction::Trunc: case Instruction::FPTrunc: case Instruction::BitCast: case Instruction::AddrSpaceCast: { Type *SrcTy = I->getOperand(0)->getType(); return getCastInstrCost(I->getOpcode(), I->getType(), SrcTy, I); } case Instruction::ExtractElement: { const ExtractElementInst * EEI = cast<ExtractElementInst>(I); ConstantInt *CI = dyn_cast<ConstantInt>(I->getOperand(1)); unsigned Idx = -1; if (CI) Idx = CI->getZExtValue(); // Try to match a reduction sequence (series of shufflevector and vector // adds followed by a extractelement). unsigned ReduxOpCode; Type *ReduxType; switch (matchVectorSplittingReduction(EEI, ReduxOpCode, ReduxType)) { case RK_Arithmetic: return getArithmeticReductionCost(ReduxOpCode, ReduxType, /*IsPairwiseForm=*/false); case RK_MinMax: return getMinMaxReductionCost( ReduxType, CmpInst::makeCmpResultType(ReduxType), /*IsPairwiseForm=*/false, /*IsUnsigned=*/false); case RK_UnsignedMinMax: return getMinMaxReductionCost( ReduxType, CmpInst::makeCmpResultType(ReduxType), /*IsPairwiseForm=*/false, /*IsUnsigned=*/true); case RK_None: break; } switch (matchPairwiseReduction(EEI, ReduxOpCode, ReduxType)) { case RK_Arithmetic: return getArithmeticReductionCost(ReduxOpCode, ReduxType, /*IsPairwiseForm=*/true); case RK_MinMax: return getMinMaxReductionCost( ReduxType, CmpInst::makeCmpResultType(ReduxType), /*IsPairwiseForm=*/true, /*IsUnsigned=*/false); case RK_UnsignedMinMax: return getMinMaxReductionCost( ReduxType, CmpInst::makeCmpResultType(ReduxType), /*IsPairwiseForm=*/true, /*IsUnsigned=*/true); case RK_None: break; } return getVectorInstrCost(I->getOpcode(), EEI->getOperand(0)->getType(), Idx); } case Instruction::InsertElement: { const InsertElementInst * IE = cast<InsertElementInst>(I); ConstantInt *CI = dyn_cast<ConstantInt>(IE->getOperand(2)); unsigned Idx = -1; if (CI) Idx = CI->getZExtValue(); return getVectorInstrCost(I->getOpcode(), IE->getType(), Idx); } case Instruction::ExtractValue: return 0; // Model all ExtractValue nodes as free. case Instruction::ShuffleVector: { const ShuffleVectorInst *Shuffle = cast<ShuffleVectorInst>(I); Type *Ty = Shuffle->getType(); Type *SrcTy = Shuffle->getOperand(0)->getType(); // TODO: Identify and add costs for insert subvector, etc. int SubIndex; if (Shuffle->isExtractSubvectorMask(SubIndex)) return TTIImpl->getShuffleCost(SK_ExtractSubvector, SrcTy, SubIndex, Ty); if (Shuffle->changesLength()) return -1; if (Shuffle->isIdentity()) return 0; if (Shuffle->isReverse()) return TTIImpl->getShuffleCost(SK_Reverse, Ty, 0, nullptr); if (Shuffle->isSelect()) return TTIImpl->getShuffleCost(SK_Select, Ty, 0, nullptr); if (Shuffle->isTranspose()) return TTIImpl->getShuffleCost(SK_Transpose, Ty, 0, nullptr); if (Shuffle->isZeroEltSplat()) return TTIImpl->getShuffleCost(SK_Broadcast, Ty, 0, nullptr); if (Shuffle->isSingleSource()) return TTIImpl->getShuffleCost(SK_PermuteSingleSrc, Ty, 0, nullptr); return TTIImpl->getShuffleCost(SK_PermuteTwoSrc, Ty, 0, nullptr); } case Instruction::Call: if (const IntrinsicInst *II = dyn_cast<IntrinsicInst>(I)) { SmallVector<Value *, 4> Args(II->arg_operands()); FastMathFlags FMF; if (auto *FPMO = dyn_cast<FPMathOperator>(II)) FMF = FPMO->getFastMathFlags(); return getIntrinsicInstrCost(II->getIntrinsicID(), II->getType(), Args, FMF); } return -1; default: // We don't have any information on this instruction. return -1; } } TargetTransformInfo::Concept::~Concept() {} TargetIRAnalysis::TargetIRAnalysis() : TTICallback(&getDefaultTTI) {} TargetIRAnalysis::TargetIRAnalysis( std::function<Result(const Function &)> TTICallback) : TTICallback(std::move(TTICallback)) {} TargetIRAnalysis::Result TargetIRAnalysis::run(const Function &F, FunctionAnalysisManager &) { return TTICallback(F); } AnalysisKey TargetIRAnalysis::Key; TargetIRAnalysis::Result TargetIRAnalysis::getDefaultTTI(const Function &F) { return Result(F.getParent()->getDataLayout()); } // Register the basic pass. INITIALIZE_PASS(TargetTransformInfoWrapperPass, "tti", "Target Transform Information", false, true) char TargetTransformInfoWrapperPass::ID = 0; void TargetTransformInfoWrapperPass::anchor() {} TargetTransformInfoWrapperPass::TargetTransformInfoWrapperPass() : ImmutablePass(ID) { initializeTargetTransformInfoWrapperPassPass( *PassRegistry::getPassRegistry()); } TargetTransformInfoWrapperPass::TargetTransformInfoWrapperPass( TargetIRAnalysis TIRA) : ImmutablePass(ID), TIRA(std::move(TIRA)) { initializeTargetTransformInfoWrapperPassPass( *PassRegistry::getPassRegistry()); } TargetTransformInfo &TargetTransformInfoWrapperPass::getTTI(const Function &F) { FunctionAnalysisManager DummyFAM; TTI = TIRA.run(F, DummyFAM); return *TTI; } ImmutablePass * llvm::createTargetTransformInfoWrapperPass(TargetIRAnalysis TIRA) { return new TargetTransformInfoWrapperPass(std::move(TIRA)); }
; A319007: Sum of the next n nonnegative integers repeated (A004526). ; 0,1,5,14,29,51,82,124,178,245,327,426,543,679,836,1016,1220,1449,1705,1990,2305,2651,3030,3444,3894,4381,4907,5474,6083,6735,7432,8176,8968,9809,10701,11646,12645,13699,14810,15980,17210,18501,19855,21274,22759,24311,25932,27624,29388,31225,33137,35126,37193,39339,41566,43876,46270,48749,51315,53970,56715,59551,62480,65504,68624,71841,75157,78574,82093,85715,89442,93276,97218,101269,105431,109706,114095,118599,123220,127960,132820,137801,142905,148134,153489,158971,164582,170324,176198,182205,188347,194626,201043,207599,214296,221136,228120,235249,242525,249950 mov $3,$0 add $0,3 mov $2,1 pow $3,2 add $2,$3 mul $2,2 mul $0,$2 sub $0,5 div $0,8
// Copyright (c) 2015 GitHub, Inc. // Use of this source code is governed by the MIT license that can be // found in the LICENSE file. #include "atom/common/native_mate_converters/net_converter.h" #include <string> #include <vector> #include "atom/common/native_mate_converters/gurl_converter.h" #include "atom/common/native_mate_converters/value_converter.h" #include "atom/common/node_includes.h" #include "base/strings/string_number_conversions.h" #include "base/values.h" #include "native_mate/dictionary.h" #include "net/base/upload_bytes_element_reader.h" #include "net/base/upload_data_stream.h" #include "net/base/upload_element_reader.h" #include "net/base/upload_file_element_reader.h" #include "net/cert/x509_certificate.h" #include "net/http/http_response_headers.h" #include "net/url_request/url_request.h" namespace mate { // static v8::Local<v8::Value> Converter<const net::AuthChallengeInfo*>::ToV8( v8::Isolate* isolate, const net::AuthChallengeInfo* val) { mate::Dictionary dict = mate::Dictionary::CreateEmpty(isolate); dict.Set("isProxy", val->is_proxy); dict.Set("scheme", val->scheme); dict.Set("host", val->challenger.host()); dict.Set("port", static_cast<uint32_t>(val->challenger.port())); dict.Set("realm", val->realm); return mate::ConvertToV8(isolate, dict); } // static v8::Local<v8::Value> Converter<scoped_refptr<net::X509Certificate>>::ToV8( v8::Isolate* isolate, const scoped_refptr<net::X509Certificate>& val) { mate::Dictionary dict(isolate, v8::Object::New(isolate)); std::string encoded_data; net::X509Certificate::GetPEMEncoded( val->os_cert_handle(), &encoded_data); dict.Set("data", encoded_data); dict.Set("issuerName", val->issuer().GetDisplayName()); dict.Set("subjectName", val->subject().GetDisplayName()); dict.Set("serialNumber", base::HexEncode(val->serial_number().data(), val->serial_number().size())); dict.Set("validStart", val->valid_start().ToDoubleT()); dict.Set("validExpiry", val->valid_expiry().ToDoubleT()); dict.Set("fingerprint", net::HashValue( val->CalculateFingerprint256(val->os_cert_handle())).ToString()); return dict.GetHandle(); } } // namespace mate namespace atom { void FillRequestDetails(base::DictionaryValue* details, const net::URLRequest* request) { details->SetString("method", request->method()); std::string url; if (!request->url_chain().empty()) url = request->url().spec(); details->SetStringWithoutPathExpansion("url", url); details->SetString("referrer", request->referrer()); std::unique_ptr<base::ListValue> list(new base::ListValue); GetUploadData(list.get(), request); if (!list->empty()) details->Set("uploadData", std::move(list)); } void GetUploadData(base::ListValue* upload_data_list, const net::URLRequest* request) { const net::UploadDataStream* upload_data = request->get_upload(); if (!upload_data) return; const std::vector<std::unique_ptr<net::UploadElementReader>>* readers = upload_data->GetElementReaders(); for (const auto& reader : *readers) { std::unique_ptr<base::DictionaryValue> upload_data_dict( new base::DictionaryValue); if (reader->AsBytesReader()) { const net::UploadBytesElementReader* bytes_reader = reader->AsBytesReader(); std::unique_ptr<base::Value> bytes( base::BinaryValue::CreateWithCopiedBuffer(bytes_reader->bytes(), bytes_reader->length())); upload_data_dict->Set("bytes", std::move(bytes)); } else if (reader->AsFileReader()) { const net::UploadFileElementReader* file_reader = reader->AsFileReader(); auto file_path = file_reader->path().AsUTF8Unsafe(); upload_data_dict->SetStringWithoutPathExpansion("file", file_path); } upload_data_list->Append(std::move(upload_data_dict)); } } } // namespace atom
#include <windows.h> #include <tchar.h> #include <shlwapi.h> #include "resource.h" #include "server\VarController.h" #include "MyMsgProc.h" #include "server\LowDbAccess.h" HWND DateSpec; HWND SleepSpec; HWND CbYearHndl; HWND CbMonthHndl; HWND CbDayHndl; HWND CbHourHndl; HWND CbMinuteHndl; HWND CbSecondHndl; HWND EdWaitHndl; void ChangeTimerType(int Type) { if (Type == 0) { SendMessage(DateSpec, BM_SETCHECK, BST_CHECKED, 0L); SendMessage(SleepSpec, BM_SETCHECK, BST_UNCHECKED, 0L); EnableWindow(CbYearHndl, TRUE); EnableWindow(CbMonthHndl, TRUE); EnableWindow(CbDayHndl, TRUE); EnableWindow(CbHourHndl, TRUE); EnableWindow(CbMinuteHndl, TRUE); EnableWindow(CbSecondHndl, TRUE); EnableWindow(EdWaitHndl, FALSE); } else { SendMessage(DateSpec, BM_SETCHECK, BST_UNCHECKED, 0L); SendMessage(SleepSpec, BM_SETCHECK, BST_CHECKED, 0L); EnableWindow(CbYearHndl, FALSE); EnableWindow(CbMonthHndl, FALSE); EnableWindow(CbDayHndl, FALSE); EnableWindow(CbHourHndl, FALSE); EnableWindow(CbMinuteHndl, FALSE); EnableWindow(CbSecondHndl, FALSE); EnableWindow(EdWaitHndl, TRUE); } } void Timer(int CurrentId, int Type, HINSTANCE InstHndl, HWND WndHndl, UINT message, WPARAM wParam, LPARAM lParam) { RECT Rect; GetClientRect(WndHndl, &Rect); static int SelectedType = 0; if (message == WM_CREATE) { DateSpec = CreateWindow(_T("BUTTON"), MyMsgProc::GetMsg(MyMsgProc::PROP_TIMER_PAST), WS_CHILD | WS_VISIBLE | BS_RADIOBUTTON, Rect.left + 20, 110, Rect.right - 40, 20, WndHndl, (HMENU)IDC_TIMER_CHKTIME, InstHndl, NULL); CbYearHndl = CreateWindowEx(WS_EX_CLIENTEDGE, _T("COMBOBOX"), _T(""), WS_CHILD | WS_VISIBLE | CBS_DROPDOWNLIST | WS_VSCROLL, 100, 140, 60, 200, WndHndl, (HMENU)IDC_TIMER_YEAR, InstHndl, NULL); CbMonthHndl = CreateWindowEx(WS_EX_CLIENTEDGE, _T("COMBOBOX"), _T(""), WS_CHILD | WS_VISIBLE | CBS_DROPDOWNLIST | WS_VSCROLL, 170, 140, 40, 200, WndHndl, (HMENU)IDC_TIMER_MONTH, InstHndl, NULL); CbDayHndl = CreateWindowEx(WS_EX_CLIENTEDGE, _T("COMBOBOX"), _T(""), WS_CHILD | WS_VISIBLE | CBS_DROPDOWNLIST | WS_VSCROLL, 220, 140, 40, 200, WndHndl, (HMENU)IDC_TIMER_DAY, InstHndl, NULL); CbHourHndl = CreateWindowEx(WS_EX_CLIENTEDGE, _T("COMBOBOX"), _T(""), WS_CHILD | WS_VISIBLE | CBS_DROPDOWNLIST | WS_VSCROLL, 300, 140, 40, 200, WndHndl, (HMENU)IDC_TIMER_HOUR, InstHndl, NULL); CbMinuteHndl = CreateWindowEx(WS_EX_CLIENTEDGE, _T("COMBOBOX"), _T(""), WS_CHILD | WS_VISIBLE | CBS_DROPDOWNLIST | WS_VSCROLL, 350, 140, 40, 200, WndHndl, (HMENU)IDC_TIMER_MINUTE, InstHndl, NULL); CbSecondHndl = CreateWindowEx(WS_EX_CLIENTEDGE, _T("COMBOBOX"), _T(""), WS_CHILD | WS_VISIBLE | CBS_DROPDOWNLIST | WS_VSCROLL, 400, 140, 40, 200, WndHndl, (HMENU)IDC_TIMER_SECOND, InstHndl, NULL); SleepSpec = CreateWindow(_T("BUTTON"), MyMsgProc::GetMsg(MyMsgProc::PROP_TIMER_WAIT), WS_CHILD | WS_VISIBLE | BS_RADIOBUTTON, Rect.left + 20, 200, 260, 20, WndHndl, (HMENU)IDC_TIMER_CHKWAIT, InstHndl, NULL); CreateWindow(_T("STATIC"), MyMsgProc::GetMsg(MyMsgProc::PROP_TIMER_SEC), WS_CHILD | WS_VISIBLE, 360, 202, 80, 20, WndHndl, NULL, InstHndl, NULL); EdWaitHndl = CreateWindowEx(WS_EX_CLIENTEDGE, _T("EDIT"), _T(""), WS_CHILD | WS_VISIBLE | ES_AUTOHSCROLL, 300, 200, 50, 24, WndHndl, NULL, InstHndl, NULL); SendMessage(EdWaitHndl, EM_SETLIMITTEXT, (WPARAM)4, (LPARAM)0); for (int Loop = 2009; Loop <= 2029; Loop++) { TCHAR TmpBuf[10]; wsprintf(TmpBuf, _T("%d"), Loop); SendMessage(CbYearHndl, CB_ADDSTRING, 0, (LPARAM)TmpBuf); } for (int Loop = 1; Loop <= 12; Loop++) { TCHAR TmpBuf[10]; wsprintf(TmpBuf, _T("%d"), Loop); SendMessage(CbMonthHndl, CB_ADDSTRING, 0, (LPARAM)TmpBuf); } for (int Loop = 1; Loop <= 31; Loop++) { TCHAR TmpBuf[10]; wsprintf(TmpBuf, _T("%d"), Loop); SendMessage(CbDayHndl, CB_ADDSTRING, 0, (LPARAM)TmpBuf); } for (int Loop = 0; Loop <= 23; Loop++) { TCHAR TmpBuf[10]; wsprintf(TmpBuf, _T("%d"), Loop); SendMessage(CbHourHndl, CB_ADDSTRING, 0, (LPARAM)TmpBuf); } for (int Loop = 0; Loop <= 59; Loop++) { TCHAR TmpBuf[10]; wsprintf(TmpBuf, _T("%d"), Loop); SendMessage(CbMinuteHndl, CB_ADDSTRING, 0, (LPARAM)TmpBuf); } for (int Loop = 0; Loop <= 59; Loop++) { TCHAR TmpBuf[10]; wsprintf(TmpBuf, _T("%d"), Loop); SendMessage(CbSecondHndl, CB_ADDSTRING, 0, (LPARAM)TmpBuf); } // 年月日時分秒の初期化 SYSTEMTIME SysTm; DWORD HighTm = LowDbAccess::GetInstance()->GetElementInfoParamInt(CurrentId, 1); DWORD LowTm = LowDbAccess::GetInstance()->GetElementInfoParamInt(CurrentId, 2); if (HighTm == 0 && LowTm == 0) { GetLocalTime(&SysTm); } else { FILETIME FileTm; FileTm.dwHighDateTime = HighTm; FileTm.dwLowDateTime = LowTm; FileTimeToSystemTime(&FileTm, &SysTm); } SendMessage(CbYearHndl, CB_SETCURSEL, SysTm.wYear - 2009, 0); SendMessage(CbMonthHndl, CB_SETCURSEL, SysTm.wMonth - 1, 0); SendMessage(CbDayHndl, CB_SETCURSEL, SysTm.wDay - 1, 0); SendMessage(CbHourHndl, CB_SETCURSEL, SysTm.wHour, 0); SendMessage(CbMinuteHndl, CB_SETCURSEL, SysTm.wMinute, 0); SendMessage(CbSecondHndl, CB_SETCURSEL, SysTm.wSecond, 0); // 待ち時間の初期化 int WaitTm = LowDbAccess::GetInstance()->GetElementInfoParamInt(CurrentId, 3); TCHAR WaitTmBuf[20]; wsprintf(WaitTmBuf, _T("%d"), WaitTm); SendMessage(EdWaitHndl, WM_SETTEXT, (WPARAM)0, (LPARAM)WaitTmBuf); // ラジオボタン初期化 SelectedType = LowDbAccess::GetInstance()->GetElementInfoParamInt(CurrentId, 4); ChangeTimerType(SelectedType); } if (message == WM_COMMAND) { if (HIWORD(wParam) == BN_CLICKED) { if (LOWORD(wParam) == IDC_BTNOK) { SYSTEMTIME SysTm; SysTm.wYear = (int)SendMessage(CbYearHndl, CB_GETCURSEL, 0, 0) + 2009; SysTm.wMonth = (int)SendMessage(CbMonthHndl, CB_GETCURSEL, 0, 0) + 1; SysTm.wDay = (int)SendMessage(CbDayHndl, CB_GETCURSEL, 0, 0) + 1; SysTm.wHour = (int)SendMessage(CbHourHndl, CB_GETCURSEL, 0, 0); SysTm.wMinute = (int)SendMessage(CbMinuteHndl, CB_GETCURSEL, 0, 0); SysTm.wSecond = (int)SendMessage(CbSecondHndl, CB_GETCURSEL, 0, 0); SysTm.wMilliseconds = 0; SysTm.wDayOfWeek = 0; FILETIME FileTm; SystemTimeToFileTime(&SysTm, &FileTm); int *HighTm = (int*)&FileTm.dwHighDateTime; int *LowTm = (int*)&FileTm.dwLowDateTime; LowDbAccess::GetInstance()->SetElementInfoParamInt(CurrentId, *HighTm, 1); LowDbAccess::GetInstance()->SetElementInfoParamInt(CurrentId, *LowTm, 2); TCHAR Buf[10]; SendMessage(EdWaitHndl, WM_GETTEXT, (WPARAM)10, (LPARAM)Buf); int WaitTime = StrToInt(Buf); if (WaitTime < 0) { WaitTime = 0; } if (WaitTime > 3600) { WaitTime = 3600; } LowDbAccess::GetInstance()->SetElementInfoParamInt(CurrentId, WaitTime, 3); LowDbAccess::GetInstance()->SetElementInfoParamInt(CurrentId, SelectedType, 4); } if (LOWORD(wParam) == IDC_TIMER_CHKTIME) { ChangeTimerType(0); SelectedType = 0; } if (LOWORD(wParam) == IDC_TIMER_CHKWAIT) { ChangeTimerType(1); SelectedType = 1; } } } }
// Copyright (C) 2012-2013 Vicente Botet // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #include <boost/config.hpp> #ifndef BOOST_NO_CXX11_DECLTYPE_N3276 #define BOOST_THREAD_NO_CXX11_DECLTYPE_N3276 #endif #if ! defined BOOST_NO_CXX11_DECLTYPE #define BOOST_RESULT_OF_USE_DECLTYPE #endif #define BOOST_THREAD_VERSION 4 //#define BOOST_THREAD_USES_LOG #define BOOST_THREAD_USES_LOG_THREAD_ID #include <boost/thread/detail/log.hpp> #include <boost/thread/future.hpp> #include <boost/assert.hpp> #include <string> #include <iostream> #if defined BOOST_THREAD_PROVIDES_FUTURE_UNWRAP int p1() { BOOST_THREAD_LOG << "P1" << BOOST_THREAD_END_LOG; return 123; } boost::future<int> p2() { BOOST_THREAD_LOG << "<P2" << BOOST_THREAD_END_LOG; boost::future<int> f1 = boost::async(boost::launch::async, &p1); BOOST_THREAD_LOG << "P2>" << BOOST_THREAD_END_LOG; return boost::move(f1); } int main() { const int number_of_tests = 100; BOOST_THREAD_LOG << "<MAIN" << BOOST_THREAD_END_LOG; for (int i=0; i< number_of_tests; i++) try { boost::future<boost::future<int> > outer_future = boost::async(boost::launch::async, &p2); boost::future<int> inner_future = outer_future.unwrap(); int ii = inner_future.get(); BOOST_THREAD_LOG << "ii= "<< ii << "" << BOOST_THREAD_END_LOG; } catch (std::exception& ex) { std::cout << "ERRORRRRR "<<ex.what() << "" << std::endl; BOOST_THREAD_LOG << "ERRORRRRR "<<ex.what() << "" << BOOST_THREAD_END_LOG; return 1; } catch (...) { std::cout << " ERRORRRRR exception thrown" << std::endl; BOOST_THREAD_LOG << " ERRORRRRR exception thrown" << BOOST_THREAD_END_LOG; return 2; } BOOST_THREAD_LOG << "MAIN>" << BOOST_THREAD_END_LOG; return 0; } #else int main() { return 0; } #endif
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Copyright (c) GeoWorks 1991 -- All Rights Reserved PROJECT: PC GEOS MODULE: Video driver FILE: clr4EscTab.asm AUTHOR: Jim DeFrisco REVISION HISTORY: Name Date Description ---- ---- ----------- jad 4/88 initial version DESCRIPTION: This file contains the table of escape functions provided by the driver $Id: clr4EscTab.asm,v 1.1 97/04/18 11:42:50 newdeal Exp $ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ;---------------------------------------------------------------------------- ; Escape Function Table ;---------------------------------------------------------------------------- DefEscapeTable 1 DefEscape VidQEscape, DRV_ESC_QUERY_ESC ; query esc capability
$include 'maxr$' $def $level 0,1,0 . This element contains whatever general code that I may want . available in almost every MASM source element that I write. . Include in other MASM programs via: . . $include 'tgpdef' . . NOTE: Any literals generated will go under $(3), so they . can live in a write-protected ibank. . General rules that all code will follow are: . . 1. Register X4 is the stack pointer, and no code should directly . reference X4. There are stack manipulation procs that handle . all of that. . 2. The main program can do whatever he wants with any register, . except the stack pointer. It is responsible for allocating . the stack, at assembly time, and loading the stack pointer . 3. All subroutines are called via 'LMJ X11'. Subroutines may . destroy any minor set register, but MUST restore any other . register to its original contents before it returns. . Here are the stack manipulation procs: . . stackgen . This proc reserves an area at assembly time of whatever size you . need. The label on the stackgen call is the address . of a 'RES' area of the proper size, followed by one word . containing $CFS('ENDSTK'). There is also . one word BEFORE the label that contains the number of . words in the stack. Those two extra words can be used . to determine whether the stack has overflowed. (There . is a proc to do that.) stackp $equ x4 . To use 'stackgen', do this: . mystack stackgen 50 p $proc stackgen* $name stacksz* $equ p(1,1) + stacksz * $res stacksz $cfs('ENDSTK') $end . The 'stackchk' proc has no parameters, and can be called at any time . after the stack pointer has been loaded. It checks that the . end-of-stack sentinel is intact, and does an ERR$ if it isn't. . (You might call this before the main program exits, to see if you . need to debug more. Or you can call it as often as you wish.) p $proc 1,5 stackchk* $name la a0,p(1,1)-1 aa,u a0,p(1,1) la a0,0,a0 te a0,($cfs('ENDSTK')) er err$ $end . The 'push' and 'pop' procs do the obvious things with ONE register. . If you have multiple registers to save, you can call them multiple . times, or use the 'pushregs' and 'popregs' below. p $proc 1,1 push* $name s p(1,1),0,*stackp $end p $proc 1,2 pop* $name anx,u stackp,1 l p(1,1),0,stackp $end . 'pushregs' and 'popregs' push and pop as many registers as you . wish. These might be used at the top and bottom of a subroutine, . for example. Specify the registers you want to save on the . 'pushregs' call, and don't specify any on 'popregs'. Popregs will . automatically pop everything pushed by the last 'pushregs', and . it will pop them in the reverse order so everything comes out okay. . (I can never manually keep my pushes and pops in sync, and in the . right order, so I'm having the procs do it for me.) . . WARNING: These procs assume that 'popregs' call follows the 'pushregs' . call in the source code. If you jump around in your code so that . pushregs executes first, but follows popregs in the source code, . Bad Things Will Happen. So don't get cute. . . Also: You may NOT next pushregs/popregs calls. The code isn't . smart enough to handle that. p $proc 1 pushregs* $name stacked* $equ $node stacked(0)* $equ p(1) i $repeat 1,p(1) stacked(i)* $equ p(1,i) push p(1,i) $endr $end p $proc 0 popregs* $name i $repeat stacked(0),1,-1 pop stacked(i) $endr $end . Function to generate those bit settings that correspond . to option letters on processor calls. It's the caller's job to know . that options 'A' to 'H' must be in a literal, and the others can . be immediate values. . Examples: . top,u a15,option('M') . tep a15,(option('G')) f $func option* $name $end 1*/($cfs('Z')-$cfs(f(1))) . Proc to print an ASCII string: . aprint 'any string' . A0 is destroyed p $proc 1 aprint* $name $(3) str $gen p(1,1)L len $equ $sl(p(1,1))//4 pcw + (0100+len, str) $($ilcn) la a0,pcw er aprint$ $end . Procs to call and return from subroutines p $proc 1,1 call* $name lmj x11,p(1,1) $end p $proc 0,1 ret* $name j 0,x11 $end . I can't consistently remember to save X11 in a subroutine, when . it is calling another one via X11. Let's automate that. p $proc 0,1 beginsub* $name push x11 $end p $proc 0,3 endsub* $name pop x11 j 0,x11 $end . Proc to generate a debug halt instruction for the PS/2200 debugger p $proc 0,1 halt* $name + 001111,0111111 $end $end
; A158658: a(n) = 56*n^2 - 1. ; 55,223,503,895,1399,2015,2743,3583,4535,5599,6775,8063,9463,10975,12599,14335,16183,18143,20215,22399,24695,27103,29623,32255,34999,37855,40823,43903,47095,50399,53815,57343,60983,64735,68599,72575,76663,80863,85175,89599,94135,98783,103543,108415,113399,118495,123703,129023,134455,139999,145655,151423,157303,163295,169399,175615,181943,188383,194935,201599,208375,215263,222263,229375,236599,243935,251383,258943,266615,274399,282295,290303,298423,306655,314999,323455,332023,340703,349495,358399,367415,376543,385783,395135,404599,414175,423863,433663,443575,453599,463735,473983,484343,494815,505399,516095,526903,537823,548855,559999 mov $1,2 add $1,$0 mul $1,$0 mul $1,56 add $1,55 mov $0,$1
// ImGui GLFW binding with OpenGL3 + shaders // In this binding, ImTextureID is used to store an OpenGL 'GLuint' texture identifier. Read the FAQ about ImTextureID in imgui.cpp. // You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this. // If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown(). // If you are new to ImGui, see examples/README.txt and documentation at the top of imgui.cpp. // https://github.com/ocornut/imgui #include <imgui.h> #include "imgui_impl_glfw_gl3.h" // GL3W/GLFW #include <GL/gl3w.h> // This example is using gl3w to access OpenGL functions (because it is small). You may use glew/glad/glLoadGen/etc. whatever already works for you. #include <GLFW/glfw3.h> #ifdef _WIN32 #undef APIENTRY #define GLFW_EXPOSE_NATIVE_WIN32 #define GLFW_EXPOSE_NATIVE_WGL #include <GLFW/glfw3native.h> #endif // Data static GLFWwindow* g_Window = NULL; static double g_Time = 0.0f; static bool g_MousePressed[3] = { false, false, false }; static float g_MouseWheel = 0.0f; static GLuint g_FontTexture = 0; static int g_ShaderHandle = 0, g_VertHandle = 0, g_FragHandle = 0; static int g_AttribLocationTex = 0, g_AttribLocationProjMtx = 0; static int g_AttribLocationPosition = 0, g_AttribLocationUV = 0, g_AttribLocationColor = 0; static unsigned int g_VboHandle = 0, g_VaoHandle = 0, g_ElementsHandle = 0; // This is the main rendering function that you have to implement and provide to ImGui (via setting up 'RenderDrawListsFn' in the ImGuiIO structure) // If text or lines are blurry when integrating ImGui in your engine: // - in your Render function, try translating your projection matrix by (0.5f,0.5f) or (0.375f,0.375f) void ImGui_ImplGlfwGL3_RenderDrawLists(ImDrawData* draw_data) { // Avoid rendering when minimized, scale coordinates for retina displays (screen coordinates != framebuffer coordinates) ImGuiIO& io = ImGui::GetIO(); int fb_width = (int)(io.DisplaySize.x * io.DisplayFramebufferScale.x); int fb_height = (int)(io.DisplaySize.y * io.DisplayFramebufferScale.y); if (fb_width == 0 || fb_height == 0) return; draw_data->ScaleClipRects(io.DisplayFramebufferScale); // Backup GL state GLenum last_active_texture; glGetIntegerv(GL_ACTIVE_TEXTURE, (GLint*)&last_active_texture); glActiveTexture(GL_TEXTURE0); GLint last_program; glGetIntegerv(GL_CURRENT_PROGRAM, &last_program); GLint last_texture; glGetIntegerv(GL_TEXTURE_BINDING_2D, &last_texture); GLint last_array_buffer; glGetIntegerv(GL_ARRAY_BUFFER_BINDING, &last_array_buffer); GLint last_element_array_buffer; glGetIntegerv(GL_ELEMENT_ARRAY_BUFFER_BINDING, &last_element_array_buffer); GLint last_vertex_array; glGetIntegerv(GL_VERTEX_ARRAY_BINDING, &last_vertex_array); GLint last_viewport[4]; glGetIntegerv(GL_VIEWPORT, last_viewport); GLint last_scissor_box[4]; glGetIntegerv(GL_SCISSOR_BOX, last_scissor_box); GLenum last_blend_src_rgb; glGetIntegerv(GL_BLEND_SRC_RGB, (GLint*)&last_blend_src_rgb); GLenum last_blend_dst_rgb; glGetIntegerv(GL_BLEND_DST_RGB, (GLint*)&last_blend_dst_rgb); GLenum last_blend_src_alpha; glGetIntegerv(GL_BLEND_SRC_ALPHA, (GLint*)&last_blend_src_alpha); GLenum last_blend_dst_alpha; glGetIntegerv(GL_BLEND_DST_ALPHA, (GLint*)&last_blend_dst_alpha); GLenum last_blend_equation_rgb; glGetIntegerv(GL_BLEND_EQUATION_RGB, (GLint*)&last_blend_equation_rgb); GLenum last_blend_equation_alpha; glGetIntegerv(GL_BLEND_EQUATION_ALPHA, (GLint*)&last_blend_equation_alpha); GLboolean last_enable_blend = glIsEnabled(GL_BLEND); GLboolean last_enable_cull_face = glIsEnabled(GL_CULL_FACE); GLboolean last_enable_depth_test = glIsEnabled(GL_DEPTH_TEST); GLboolean last_enable_scissor_test = glIsEnabled(GL_SCISSOR_TEST); // Setup render state: alpha-blending enabled, no face culling, no depth testing, scissor enabled glEnable(GL_BLEND); glBlendEquation(GL_FUNC_ADD); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glDisable(GL_CULL_FACE); glDisable(GL_DEPTH_TEST); glEnable(GL_SCISSOR_TEST); // Setup viewport, orthographic projection matrix glViewport(0, 0, (GLsizei)fb_width, (GLsizei)fb_height); const float ortho_projection[4][4] = { { 2.0f/io.DisplaySize.x, 0.0f, 0.0f, 0.0f }, { 0.0f, 2.0f/-io.DisplaySize.y, 0.0f, 0.0f }, { 0.0f, 0.0f, -1.0f, 0.0f }, {-1.0f, 1.0f, 0.0f, 1.0f }, }; glUseProgram(g_ShaderHandle); glUniform1i(g_AttribLocationTex, 0); glUniformMatrix4fv(g_AttribLocationProjMtx, 1, GL_FALSE, &ortho_projection[0][0]); glBindVertexArray(g_VaoHandle); for (int n = 0; n < draw_data->CmdListsCount; n++) { const ImDrawList* cmd_list = draw_data->CmdLists[n]; const ImDrawIdx* idx_buffer_offset = 0; glBindBuffer(GL_ARRAY_BUFFER, g_VboHandle); glBufferData(GL_ARRAY_BUFFER, (GLsizeiptr)cmd_list->VtxBuffer.Size * sizeof(ImDrawVert), (const GLvoid*)cmd_list->VtxBuffer.Data, GL_STREAM_DRAW); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, g_ElementsHandle); glBufferData(GL_ELEMENT_ARRAY_BUFFER, (GLsizeiptr)cmd_list->IdxBuffer.Size * sizeof(ImDrawIdx), (const GLvoid*)cmd_list->IdxBuffer.Data, GL_STREAM_DRAW); for (int cmd_i = 0; cmd_i < cmd_list->CmdBuffer.Size; cmd_i++) { const ImDrawCmd* pcmd = &cmd_list->CmdBuffer[cmd_i]; if (pcmd->UserCallback) { pcmd->UserCallback(cmd_list, pcmd); } else { glBindTexture(GL_TEXTURE_2D, (GLuint)(intptr_t)pcmd->TextureId); glScissor((int)pcmd->ClipRect.x, (int)(fb_height - pcmd->ClipRect.w), (int)(pcmd->ClipRect.z - pcmd->ClipRect.x), (int)(pcmd->ClipRect.w - pcmd->ClipRect.y)); glDrawElements(GL_TRIANGLES, (GLsizei)pcmd->ElemCount, sizeof(ImDrawIdx) == 2 ? GL_UNSIGNED_SHORT : GL_UNSIGNED_INT, idx_buffer_offset); } idx_buffer_offset += pcmd->ElemCount; } } // Restore modified GL state glUseProgram(last_program); glBindTexture(GL_TEXTURE_2D, last_texture); glActiveTexture(last_active_texture); glBindVertexArray(last_vertex_array); glBindBuffer(GL_ARRAY_BUFFER, last_array_buffer); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, last_element_array_buffer); glBlendEquationSeparate(last_blend_equation_rgb, last_blend_equation_alpha); glBlendFuncSeparate(last_blend_src_rgb, last_blend_dst_rgb, last_blend_src_alpha, last_blend_dst_alpha); if (last_enable_blend) glEnable(GL_BLEND); else glDisable(GL_BLEND); if (last_enable_cull_face) glEnable(GL_CULL_FACE); else glDisable(GL_CULL_FACE); if (last_enable_depth_test) glEnable(GL_DEPTH_TEST); else glDisable(GL_DEPTH_TEST); if (last_enable_scissor_test) glEnable(GL_SCISSOR_TEST); else glDisable(GL_SCISSOR_TEST); glViewport(last_viewport[0], last_viewport[1], (GLsizei)last_viewport[2], (GLsizei)last_viewport[3]); glScissor(last_scissor_box[0], last_scissor_box[1], (GLsizei)last_scissor_box[2], (GLsizei)last_scissor_box[3]); } static const char* ImGui_ImplGlfwGL3_GetClipboardText(void* user_data) { return glfwGetClipboardString((GLFWwindow*)user_data); } static void ImGui_ImplGlfwGL3_SetClipboardText(void* user_data, const char* text) { glfwSetClipboardString((GLFWwindow*)user_data, text); } void ImGui_ImplGlfwGL3_MouseButtonCallback(GLFWwindow*, int button, int action, int /*mods*/) { if (action == GLFW_PRESS && button >= 0 && button < 3) g_MousePressed[button] = true; } void ImGui_ImplGlfwGL3_ScrollCallback(GLFWwindow*, double /*xoffset*/, double yoffset) { g_MouseWheel += (float)yoffset; // Use fractional mouse wheel, 1.0 unit 5 lines. } void ImGui_ImplGlfwGL3_KeyCallback(GLFWwindow*, int key, int, int action, int mods) { ImGuiIO& io = ImGui::GetIO(); if (action == GLFW_PRESS) io.KeysDown[key] = true; if (action == GLFW_RELEASE) io.KeysDown[key] = false; (void)mods; // Modifiers are not reliable across systems io.KeyCtrl = io.KeysDown[GLFW_KEY_LEFT_CONTROL] || io.KeysDown[GLFW_KEY_RIGHT_CONTROL]; io.KeyShift = io.KeysDown[GLFW_KEY_LEFT_SHIFT] || io.KeysDown[GLFW_KEY_RIGHT_SHIFT]; io.KeyAlt = io.KeysDown[GLFW_KEY_LEFT_ALT] || io.KeysDown[GLFW_KEY_RIGHT_ALT]; io.KeySuper = io.KeysDown[GLFW_KEY_LEFT_SUPER] || io.KeysDown[GLFW_KEY_RIGHT_SUPER]; } void ImGui_ImplGlfwGL3_CharCallback(GLFWwindow*, unsigned int c) { ImGuiIO& io = ImGui::GetIO(); if (c > 0 && c < 0x10000) io.AddInputCharacter((unsigned short)c); } bool ImGui_ImplGlfwGL3_CreateFontsTexture() { // Build texture atlas ImGuiIO& io = ImGui::GetIO(); unsigned char* pixels; int width, height; io.Fonts->GetTexDataAsRGBA32(&pixels, &width, &height); // Load as RGBA 32-bits (75% of the memory is wasted, but default font is so small) because it is more likely to be compatible with user's existing shaders. If your ImTextureId represent a higher-level concept than just a GL texture id, consider calling GetTexDataAsAlpha8() instead to save on GPU memory. // Upload texture to graphics system GLint last_texture; glGetIntegerv(GL_TEXTURE_BINDING_2D, &last_texture); glGenTextures(1, &g_FontTexture); glBindTexture(GL_TEXTURE_2D, g_FontTexture); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels); // Store our identifier io.Fonts->TexID = (void *)(intptr_t)g_FontTexture; // Restore state glBindTexture(GL_TEXTURE_2D, last_texture); return true; } bool ImGui_ImplGlfwGL3_CreateDeviceObjects() { // Backup GL state GLint last_texture, last_array_buffer, last_vertex_array; glGetIntegerv(GL_TEXTURE_BINDING_2D, &last_texture); glGetIntegerv(GL_ARRAY_BUFFER_BINDING, &last_array_buffer); glGetIntegerv(GL_VERTEX_ARRAY_BINDING, &last_vertex_array); const GLchar *vertex_shader = "#version 330\n" "uniform mat4 ProjMtx;\n" "in vec2 Position;\n" "in vec2 UV;\n" "in vec4 Color;\n" "out vec2 Frag_UV;\n" "out vec4 Frag_Color;\n" "void main()\n" "{\n" " Frag_UV = UV;\n" " Frag_Color = Color;\n" " gl_Position = ProjMtx * vec4(Position.xy,0,1);\n" "}\n"; const GLchar* fragment_shader = "#version 330\n" "uniform sampler2D Texture;\n" "in vec2 Frag_UV;\n" "in vec4 Frag_Color;\n" "out vec4 Out_Color;\n" "void main()\n" "{\n" " Out_Color = Frag_Color * texture( Texture, Frag_UV.st);\n" "}\n"; g_ShaderHandle = glCreateProgram(); g_VertHandle = glCreateShader(GL_VERTEX_SHADER); g_FragHandle = glCreateShader(GL_FRAGMENT_SHADER); glShaderSource(g_VertHandle, 1, &vertex_shader, 0); glShaderSource(g_FragHandle, 1, &fragment_shader, 0); glCompileShader(g_VertHandle); glCompileShader(g_FragHandle); glAttachShader(g_ShaderHandle, g_VertHandle); glAttachShader(g_ShaderHandle, g_FragHandle); glLinkProgram(g_ShaderHandle); g_AttribLocationTex = glGetUniformLocation(g_ShaderHandle, "Texture"); g_AttribLocationProjMtx = glGetUniformLocation(g_ShaderHandle, "ProjMtx"); g_AttribLocationPosition = glGetAttribLocation(g_ShaderHandle, "Position"); g_AttribLocationUV = glGetAttribLocation(g_ShaderHandle, "UV"); g_AttribLocationColor = glGetAttribLocation(g_ShaderHandle, "Color"); glGenBuffers(1, &g_VboHandle); glGenBuffers(1, &g_ElementsHandle); glGenVertexArrays(1, &g_VaoHandle); glBindVertexArray(g_VaoHandle); glBindBuffer(GL_ARRAY_BUFFER, g_VboHandle); glEnableVertexAttribArray(g_AttribLocationPosition); glEnableVertexAttribArray(g_AttribLocationUV); glEnableVertexAttribArray(g_AttribLocationColor); #define OFFSETOF(TYPE, ELEMENT) ((size_t)&(((TYPE *)0)->ELEMENT)) glVertexAttribPointer(g_AttribLocationPosition, 2, GL_FLOAT, GL_FALSE, sizeof(ImDrawVert), (GLvoid*)OFFSETOF(ImDrawVert, pos)); glVertexAttribPointer(g_AttribLocationUV, 2, GL_FLOAT, GL_FALSE, sizeof(ImDrawVert), (GLvoid*)OFFSETOF(ImDrawVert, uv)); glVertexAttribPointer(g_AttribLocationColor, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(ImDrawVert), (GLvoid*)OFFSETOF(ImDrawVert, col)); #undef OFFSETOF ImGui_ImplGlfwGL3_CreateFontsTexture(); // Restore modified GL state glBindTexture(GL_TEXTURE_2D, last_texture); glBindBuffer(GL_ARRAY_BUFFER, last_array_buffer); glBindVertexArray(last_vertex_array); return true; } void ImGui_ImplGlfwGL3_InvalidateDeviceObjects() { if (g_VaoHandle) glDeleteVertexArrays(1, &g_VaoHandle); if (g_VboHandle) glDeleteBuffers(1, &g_VboHandle); if (g_ElementsHandle) glDeleteBuffers(1, &g_ElementsHandle); g_VaoHandle = g_VboHandle = g_ElementsHandle = 0; if (g_ShaderHandle && g_VertHandle) glDetachShader(g_ShaderHandle, g_VertHandle); if (g_VertHandle) glDeleteShader(g_VertHandle); g_VertHandle = 0; if (g_ShaderHandle && g_FragHandle) glDetachShader(g_ShaderHandle, g_FragHandle); if (g_FragHandle) glDeleteShader(g_FragHandle); g_FragHandle = 0; if (g_ShaderHandle) glDeleteProgram(g_ShaderHandle); g_ShaderHandle = 0; if (g_FontTexture) { glDeleteTextures(1, &g_FontTexture); ImGui::GetIO().Fonts->TexID = 0; g_FontTexture = 0; } } bool ImGui_ImplGlfwGL3_Init(GLFWwindow* window, bool install_callbacks) { g_Window = window; ImGuiIO& io = ImGui::GetIO(); io.KeyMap[ImGuiKey_Tab] = GLFW_KEY_TAB; // Keyboard mapping. ImGui will use those indices to peek into the io.KeyDown[] array. io.KeyMap[ImGuiKey_LeftArrow] = GLFW_KEY_LEFT; io.KeyMap[ImGuiKey_RightArrow] = GLFW_KEY_RIGHT; io.KeyMap[ImGuiKey_UpArrow] = GLFW_KEY_UP; io.KeyMap[ImGuiKey_DownArrow] = GLFW_KEY_DOWN; io.KeyMap[ImGuiKey_PageUp] = GLFW_KEY_PAGE_UP; io.KeyMap[ImGuiKey_PageDown] = GLFW_KEY_PAGE_DOWN; io.KeyMap[ImGuiKey_Home] = GLFW_KEY_HOME; io.KeyMap[ImGuiKey_End] = GLFW_KEY_END; io.KeyMap[ImGuiKey_Delete] = GLFW_KEY_DELETE; io.KeyMap[ImGuiKey_Backspace] = GLFW_KEY_BACKSPACE; io.KeyMap[ImGuiKey_Enter] = GLFW_KEY_ENTER; io.KeyMap[ImGuiKey_Escape] = GLFW_KEY_ESCAPE; io.KeyMap[ImGuiKey_A] = GLFW_KEY_A; io.KeyMap[ImGuiKey_C] = GLFW_KEY_C; io.KeyMap[ImGuiKey_V] = GLFW_KEY_V; io.KeyMap[ImGuiKey_X] = GLFW_KEY_X; io.KeyMap[ImGuiKey_Y] = GLFW_KEY_Y; io.KeyMap[ImGuiKey_Z] = GLFW_KEY_Z; io.RenderDrawListsFn = ImGui_ImplGlfwGL3_RenderDrawLists; // Alternatively you can set this to NULL and call ImGui::GetDrawData() after ImGui::Render() to get the same ImDrawData pointer. io.SetClipboardTextFn = ImGui_ImplGlfwGL3_SetClipboardText; io.GetClipboardTextFn = ImGui_ImplGlfwGL3_GetClipboardText; io.ClipboardUserData = g_Window; #ifdef _WIN32 io.ImeWindowHandle = glfwGetWin32Window(g_Window); #endif if (install_callbacks) { glfwSetMouseButtonCallback(window, ImGui_ImplGlfwGL3_MouseButtonCallback); glfwSetScrollCallback(window, ImGui_ImplGlfwGL3_ScrollCallback); glfwSetKeyCallback(window, ImGui_ImplGlfwGL3_KeyCallback); glfwSetCharCallback(window, ImGui_ImplGlfwGL3_CharCallback); } return true; } void ImGui_ImplGlfwGL3_Shutdown() { ImGui_ImplGlfwGL3_InvalidateDeviceObjects(); ImGui::Shutdown(); } void ImGui_ImplGlfwGL3_NewFrame() { if (!g_FontTexture) ImGui_ImplGlfwGL3_CreateDeviceObjects(); ImGuiIO& io = ImGui::GetIO(); // Setup display size (every frame to accommodate for window resizing) int w, h; int display_w, display_h; glfwGetWindowSize(g_Window, &w, &h); glfwGetFramebufferSize(g_Window, &display_w, &display_h); io.DisplaySize = ImVec2((float)w, (float)h); io.DisplayFramebufferScale = ImVec2(w > 0 ? ((float)display_w / w) : 0, h > 0 ? ((float)display_h / h) : 0); // Setup time step double current_time = glfwGetTime(); io.DeltaTime = g_Time > 0.0 ? (float)(current_time - g_Time) : (float)(1.0f/60.0f); g_Time = current_time; // Setup inputs // (we already got mouse wheel, keyboard keys & characters from glfw callbacks polled in glfwPollEvents()) if (glfwGetWindowAttrib(g_Window, GLFW_FOCUSED)) { double mouse_x, mouse_y; glfwGetCursorPos(g_Window, &mouse_x, &mouse_y); io.MousePos = ImVec2((float)mouse_x, (float)mouse_y); // Mouse position in screen coordinates (set to -1,-1 if no mouse / on another screen, etc.) } else { io.MousePos = ImVec2(-FLT_MAX,-FLT_MAX); } for (int i = 0; i < 3; i++) { io.MouseDown[i] = g_MousePressed[i] || glfwGetMouseButton(g_Window, i) != 0; // If a mouse press event came, always pass it as "mouse held this frame", so we don't miss click-release events that are shorter than 1 frame. g_MousePressed[i] = false; } io.MouseWheel = g_MouseWheel; g_MouseWheel = 0.0f; // Hide OS mouse cursor if ImGui is drawing it glfwSetInputMode(g_Window, GLFW_CURSOR, io.MouseDrawCursor ? GLFW_CURSOR_HIDDEN : GLFW_CURSOR_NORMAL); // Start the frame ImGui::NewFrame(); }
.model small .data .code .STARTUP main proc MOV AX,1000H ; MOV DS,AX ;set data segment register MOV [1206H],30 ;set memory related data MOV [1204H],30 ;set memory related data MOV [1202H],29 ;set memory related data MOV [1200H],28 ;set memory related data mov cx,30 ;set up the counter mov di,1200H ;set up the pointer again: mov ax,[di] ;pointed at by di inc di ;increment the pointer inc di ;increment the pointer cmp ax,30 ;compare the 30 with mem location loopne again ;continue the process until cx=0 or ;zf=1. in other words exit if one ;location does have 30 endp end main .EXIT END
// Copyright (c) 2013-2020 Vittorio Romeo // License: Academic Free License ("AFL") v. 3.0 // AFL License page: https://opensource.org/licenses/AFL-3.0 #include "SSVOpenHexagon/Data/StyleData.hpp" #include "SSVOpenHexagon/Utils/Utils.hpp" #include "SSVOpenHexagon/Utils/Match.hpp" #include "SSVOpenHexagon/Utils/Color.hpp" #include "SSVOpenHexagon/Global/Config.hpp" #include "SSVOpenHexagon/Utils/FastVertexVector.hpp" #include <SSVUtils/Core/Utils/Math.hpp> #include <SSVStart/Utils/Vector2.hpp> #include <SSVStart/Utils/SFML.hpp> namespace hg { sf::Color StyleData::calculateColor(const ColorData& mColorData) const { sf::Color color{mColorData.color}; if(mColorData.dynamic) { const auto hue = std::fmod(currentHue + mColorData.hueShift, 360.f) / 360.f; const auto& dynamicColor( ssvs::getColorFromHSV(ssvu::getClamped(hue, 0.f, 1.f), 1.f, 1.f)); if(!mColorData.main) { if(mColorData.dynamicOffset) { SSVU_ASSERT(mColorData.offset != 0); color.r += dynamicColor.r / mColorData.offset; color.g += dynamicColor.g / mColorData.offset; color.b += dynamicColor.b / mColorData.offset; color.a += dynamicColor.a; } else { color = Utils::getColorDarkened( dynamicColor, mColorData.dynamicDarkness); } } else { color = dynamicColor; } } const auto& pulse(mColorData.pulse); return sf::Color(ssvu::toNum<sf::Uint8>(ssvu::getClamped( color.r + pulse.r * pulseFactor, 0.f, 255.f)), ssvu::toNum<sf::Uint8>( ssvu::getClamped(color.g + pulse.g * pulseFactor, 0.f, 255.f)), ssvu::toNum<sf::Uint8>( ssvu::getClamped(color.b + pulse.b * pulseFactor, 0.f, 255.f)), ssvu::toNum<sf::Uint8>( ssvu::getClamped(color.a + pulse.a * pulseFactor, 0.f, 255.f))); } void StyleData::update(ssvu::FT mFT, float mMult) { currentSwapTime += mFT * mMult; if(currentSwapTime > maxSwapTime) { currentSwapTime = 0; } currentHue += hueIncrement * mFT * mMult; if(currentHue < hueMin) { if(huePingPong) { currentHue = hueMin; hueIncrement *= -1.f; } else { currentHue = hueMax; } } if(currentHue > hueMax) { if(huePingPong) { currentHue = hueMax; hueIncrement *= -1.f; } else { currentHue = hueMin; } } pulseFactor += pulseIncrement * mFT; if(pulseFactor < pulseMin) { pulseIncrement *= -1.f; pulseFactor = pulseMin; } if(pulseFactor > pulseMax) { pulseIncrement *= -1.f; pulseFactor = pulseMax; } } void StyleData::computeColors(const LevelStatus& levelStatus) { (void)levelStatus; currentMainColor = calculateColor(mainColorData); currentPlayerColor = calculateColor(playerColor); currentTextColor = calculateColor(textColor); current3DOverrideColor = _3dOverrideColor.a != 0 ? _3dOverrideColor : getMainColor(); currentColors.clear(); for(const auto& cd : colorDatas) { currentColors.emplace_back(calculateColor(cd)); } if(currentColors.size() > 1) { const unsigned int rotation = currentSwapTime / (maxSwapTime / 2.f); ssvu::rotate(currentColors, std::begin(currentColors) + ssvu::getMod(rotation + BGColorOffset, currentColors.size())); } } void StyleData::drawBackground(sf::RenderTarget& mRenderTarget, const sf::Vector2f& mCenterPos, const LevelStatus& levelStatus) const { const auto sides = levelStatus.sides; const float div{ssvu::tau / sides * 1.0001f}, halfDiv{div / 2.f}, distance{bgTileRadius}; static Utils::FastVertexVector<sf::PrimitiveType::Triangles> vertices; static Utils::FastVertexVector<sf::PrimitiveType::Triangles> hexagon; vertices.clear(); hexagon.clear(); vertices.reserve(sides * 3); hexagon.reserve(sides * 6); const auto& colors(getColors()); const sf::Color colorMain{getMainColor()}; const sf::Color colorCap{getCapColorResult()}; for(auto i(0u); i < sides; ++i) { const float angle{ssvu::toRad(BGRotOff) + div * i}; sf::Color currentColor{ssvu::getByModIdx(colors, i)}; const bool darkenUnevenBackgroundChunk = (i % 2 == 0 && i == sides - 1) && Config::getDarkenUnevenBackgroundChunk() && levelStatus.darkenUnevenBackgroundChunk; if(Config::getBlackAndWhite()) { currentColor = sf::Color::Black; } else if(darkenUnevenBackgroundChunk) { currentColor = Utils::getColorDarkened(currentColor, 1.4f); } vertices.batch_unsafe_emplace_back(currentColor, mCenterPos, ssvs::getOrbitRad(mCenterPos, angle + halfDiv, distance), ssvs::getOrbitRad(mCenterPos, angle - halfDiv, distance)); } mRenderTarget.draw(vertices); mRenderTarget.draw(hexagon); } void StyleData::drawBackgroundMenu(sf::RenderTarget& mRenderTarget, const sf::Vector2f& mCenterPos, const LevelStatus& levelStatus, const bool fourByThree) const { const auto sides = levelStatus.sides; const float div{ssvu::tau / sides * 1.0001f}, halfDiv{div / 2.f}, distance{bgTileRadius}, hexagonRadius{fourByThree ? 75.f : 100.f}; static Utils::FastVertexVector<sf::PrimitiveType::Triangles> vertices; static Utils::FastVertexVector<sf::PrimitiveType::Triangles> hexagon; vertices.clear(); hexagon.clear(); vertices.reserve(sides * 3); hexagon.reserve(sides * 6); const auto& colors(getColors()); const sf::Color colorMain{getMainColor()}; const sf::Color colorCap{getCapColorResult()}; for(auto i(0u); i < sides; ++i) { const float angle{ssvu::toRad(BGRotOff) + div * i}; sf::Color currentColor{ssvu::getByModIdx(colors, i)}; const bool darkenUnevenBackgroundChunk = (i % 2 == 0 && i == sides - 1) && Config::getDarkenUnevenBackgroundChunk() && levelStatus.darkenUnevenBackgroundChunk; if(Config::getBlackAndWhite()) { currentColor = sf::Color::Black; } else if(darkenUnevenBackgroundChunk) { currentColor = Utils::getColorDarkened(currentColor, 1.4f); } vertices.batch_unsafe_emplace_back(currentColor, mCenterPos, ssvs::getOrbitRad(mCenterPos, angle + halfDiv, distance), ssvs::getOrbitRad(mCenterPos, angle - halfDiv, distance)); hexagon.batch_unsafe_emplace_back(colorMain, mCenterPos, ssvs::getOrbitRad( mCenterPos, angle + halfDiv, hexagonRadius + 10.f), ssvs::getOrbitRad( mCenterPos, angle - halfDiv, hexagonRadius + 10.f)); hexagon.batch_unsafe_emplace_back(colorCap, mCenterPos, ssvs::getOrbitRad(mCenterPos, angle + halfDiv, hexagonRadius), ssvs::getOrbitRad(mCenterPos, angle - halfDiv, hexagonRadius)); } mRenderTarget.draw(vertices); mRenderTarget.draw(hexagon); } sf::Color StyleData::getCapColorResult() const noexcept { return Utils::match( capColor, // [this](CapColorMode::Main) { return getMainColor(); }, // [this](CapColorMode::MainDarkened) { return Utils::getColorDarkened(getMainColor(), 1.4f); }, // [this](CapColorMode::ByIndex x) { return getColor(x.index); }, // [this](ColorData data) { return calculateColor(data); }); } } // namespace hg
// seed 3 lbi r0, 89 // icount 0 slbi r0, 160 // icount 1 lbi r1, 36 // icount 2 slbi r1, 181 // icount 3 lbi r2, 102 // icount 4 slbi r2, 57 // icount 5 lbi r3, 239 // icount 6 slbi r3, 161 // icount 7 lbi r4, 14 // icount 8 slbi r4, 80 // icount 9 lbi r5, 209 // icount 10 slbi r5, 247 // icount 11 lbi r6, 84 // icount 12 slbi r6, 186 // icount 13 lbi r7, 177 // icount 14 slbi r7, 152 // icount 15 srl r6, r2, r5 // icount 16 srl r7, r6, r1 // icount 17 srl r5, r0, r7 // icount 18 srl r7, r2, r7 // icount 19 srl r6, r6, r2 // icount 20 srl r3, r3, r6 // icount 21 srl r3, r7, r4 // icount 22 srl r5, r2, r2 // icount 23 srl r6, r6, r5 // icount 24 srl r7, r0, r1 // icount 25 srl r3, r3, r3 // icount 26 srl r4, r1, r2 // icount 27 srl r2, r1, r3 // icount 28 srl r2, r3, r5 // icount 29 srl r1, r3, r7 // icount 30 srl r6, r3, r7 // icount 31 halt // icount 32
; A133143: Maximal number of mutually nonattacking Super Queens on an n X n board. (a Super Queen is a queen with both queen and knight powers). ; 1,1,1,2,4,4,5,6,8,10,11,12,13,14,15,16,17,18,19,20 mov $1,$0 sub $1,1 mov $3,$0 mov $0,$1 sub $0,2 mov $1,2 mov $2,3 add $2,$3 lpb $0,1 sub $0,1 mul $0,2 add $2,1 lpe trn $0,4 trn $1,$0 mov $0,$2 sub $0,$1 mov $1,$0 trn $1,3 add $1,1
; A051128: Table T(n,k) = n^k read by upwards antidiagonals (n >= 1, k >= 1). ; Submitted by Jamie Morken(s1) ; 1,2,1,3,4,1,4,9,8,1,5,16,27,16,1,6,25,64,81,32,1,7,36,125,256,243,64,1,8,49,216,625,1024,729,128,1,9,64,343,1296,3125,4096,2187,256,1,10,81,512,2401,7776,15625,16384,6561,512,1,11,100,729,4096,16807,46656,78125,65536,19683,1024,1,12,121,1000,6561,32768,117649,279936,390625,262144,59049,2048,1,13,144,1331,10000,59049,262144,823543,1679616,1953125,1048576,177147,4096,1,14,169,1728,14641,100000,531441,2097152,5764801,10077696 mov $2,$0 lpb $0 add $3,1 lpb $2 sub $2,$3 add $3,1 lpe mov $0,0 sub $3,$2 add $2,1 lpe pow $3,$2 mov $0,$3
//========================================================================= // Copyright (C) 2012 The Elastos Open Source Project // // 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 "LocaleData.h" #include "CLocaleData.h" #include "CLocale.h" #include "ICUUtil.h" #include "StringUtils.h" #include "AutoLock.h" #include "Logger.h" #include <elastos/core/AutoLock.h> using Elastos::Core::AutoLock; using Elastos::Core::StringUtils; using Elastos::Utility::CLocale; using Elastos::Utility::Logging::Logger; namespace Libcore { namespace ICU { static const String TAG("LocaleData"); LocaleData::StaticInitializer::StaticInitializer() { LocaleData::Get(CLocale::ROOT); LocaleData::Get(CLocale::US); LocaleData::Get(CLocale::GetDefault()); } INIT_PROI_4 HashMap< String, AutoPtr<ILocaleData> > LocaleData::sLocaleDataCache; INIT_PROI_4 Object LocaleData::sLocaleDataCacheLock; INIT_PROI_4 LocaleData::StaticInitializer LocaleData::sInitializer; CAR_INTERFACE_IMPL(LocaleData, Object, ILocaleData) LocaleData::LocaleData() { } AutoPtr<ILocale> LocaleData::MapInvalidAndNullLocales( /* [in] */ ILocale* locale) { AutoPtr<ILocale> rev = locale; if (NULL == rev) { rev = CLocale::GetDefault(); return rev; } String s; rev->ToLanguageTag(&s); if (s.Equals("und")) rev = CLocale::ROOT; return rev; } LocaleData::~LocaleData() { } AutoPtr<ILocaleData> LocaleData::Get( /* [in] */ ILocale* _locale) { AutoPtr<ILocale> locale = _locale; String tmp; locale->ToLanguageTag(&tmp); const String languageTag = tmp; { AutoLock syncLock(sLocaleDataCacheLock); HashMap< String, AutoPtr<ILocaleData> >::Iterator it = sLocaleDataCache.Find(languageTag); if (it != sLocaleDataCache.End()) { return it->mSecond; } } AutoPtr<ILocaleData> newLocaleData = InitLocaleData(locale); { AutoLock syncLock(sLocaleDataCacheLock); HashMap< String, AutoPtr<ILocaleData> >::Iterator it = sLocaleDataCache.Find(languageTag); if (it != sLocaleDataCache.End()) { return it->mSecond; } sLocaleDataCache[languageTag] = newLocaleData; } return newLocaleData; } ECode LocaleData::ToString( /* [out] */ String* str) { VALIDATE_NOT_NULL(str) *str = "LocaleData"; return NOERROR; } ECode LocaleData::GetDateFormat( /* [in] */ DateFormat style, /* [out] */ String* format) { VALIDATE_NOT_NULL(format); switch (style) { case DateFormat_SHORT: *format = mShortDateFormat; return NOERROR; case DateFormat_MEDIUM: *format = mMediumDateFormat; return NOERROR; case DateFormat_LONG: *format = mLongDateFormat; return NOERROR; case DateFormat_FULL: *format = mFullDateFormat; return NOERROR; } // throw new AssertionError(); return E_ASSERTION_ERROR; } ECode LocaleData::GetTimeFormat( /* [in] */ DateFormat style, /* [out] */ String* format) { VALIDATE_NOT_NULL(format); switch (style) { case DateFormat_SHORT: *format = mShortTimeFormat; return NOERROR; case DateFormat_MEDIUM: *format = mMediumTimeFormat; return NOERROR; case DateFormat_LONG: *format = mLongTimeFormat; return NOERROR; case DateFormat_FULL: *format = mFullTimeFormat; return NOERROR; } // throw new AssertionError(); return E_ASSERTION_ERROR; } ECode LocaleData::GetFirstDayOfWeek( /* [out] */ IInteger32** day) { VALIDATE_NOT_NULL(day); *day = mFirstDayOfWeek; REFCOUNT_ADD(*day); return NOERROR; } ECode LocaleData::GetMinimalDaysInFirstWeek( /* [out] */ IInteger32** days) { VALIDATE_NOT_NULL(days); *days = mMinimalDaysInFirstWeek; REFCOUNT_ADD(*days); return NOERROR; } ECode LocaleData::GetAmPm( /* [out] */ ArrayOf<String>** amPm) { VALIDATE_NOT_NULL(amPm); *amPm = mAmPm; REFCOUNT_ADD(*amPm) return NOERROR; } ECode LocaleData::GetEras( /* [out] */ ArrayOf<String>** eras) { VALIDATE_NOT_NULL(eras); *eras = mEras; REFCOUNT_ADD(*eras) return NOERROR; } ECode LocaleData::GetLongMonthNames( /* [out] */ ArrayOf<String>** names) { VALIDATE_NOT_NULL(names); *names = mLongMonthNames; REFCOUNT_ADD(*names) return NOERROR; } ECode LocaleData::GetShortMonthNames( /* [out] */ ArrayOf<String>** names) { VALIDATE_NOT_NULL(names); *names = mShortMonthNames; REFCOUNT_ADD(*names) return NOERROR; } ECode LocaleData::GetLongStandAloneMonthNames( /* [out] */ ArrayOf<String>** names) { VALIDATE_NOT_NULL(names); *names = mLongStandAloneMonthNames; REFCOUNT_ADD(*names) return NOERROR; } ECode LocaleData::GetTinyMonthNames( /* [out] */ ArrayOf<String>** names) { VALIDATE_NOT_NULL(names); *names = mTinyMonthNames; REFCOUNT_ADD(*names) return NOERROR; } ECode LocaleData::GetShortStandAloneMonthNames( /* [out] */ ArrayOf<String>** names) { VALIDATE_NOT_NULL(names); *names = mShortStandAloneMonthNames; REFCOUNT_ADD(*names) return NOERROR; } ECode LocaleData::GetTinyStandAloneMonthNames( /* [out] */ ArrayOf<String>** names) { VALIDATE_NOT_NULL(names); *names = mTinyStandAloneMonthNames; REFCOUNT_ADD(*names) return NOERROR; } ECode LocaleData::GetLongWeekdayNames( /* [out] */ ArrayOf<String>** names) { VALIDATE_NOT_NULL(names); *names = mLongWeekdayNames; REFCOUNT_ADD(*names) return NOERROR; } ECode LocaleData::GetShortWeekdayNames( /* [out] */ ArrayOf<String>** names) { VALIDATE_NOT_NULL(names); *names = mShortWeekdayNames; REFCOUNT_ADD(*names) return NOERROR; } ECode LocaleData::GetTinyWeekdayNames( /* [out] */ ArrayOf<String>** names) { VALIDATE_NOT_NULL(names); *names = mTinyWeekdayNames; REFCOUNT_ADD(*names) return NOERROR; } ECode LocaleData::GetLongStandAloneWeekdayNames( /* [out] */ ArrayOf<String>** names) { VALIDATE_NOT_NULL(names); *names = mLongStandAloneWeekdayNames; REFCOUNT_ADD(*names) return NOERROR; } ECode LocaleData::GetShortStandAloneWeekdayNames( /* [out] */ ArrayOf<String>** names) { VALIDATE_NOT_NULL(names); *names = mShortStandAloneWeekdayNames; REFCOUNT_ADD(*names) return NOERROR; } ECode LocaleData::GetTinyStandAloneWeekdayNames( /* [out] */ ArrayOf<String>** names) { VALIDATE_NOT_NULL(names); *names = mTinyStandAloneWeekdayNames; REFCOUNT_ADD(*names) return NOERROR; } ECode LocaleData::GetYesterday( /* [out] */ String* yesterday) { VALIDATE_NOT_NULL(yesterday); *yesterday = mYesterday; return NOERROR; } ECode LocaleData::GetToday( /* [out] */ String* today) { VALIDATE_NOT_NULL(today); *today = mToday; return NOERROR; } ECode LocaleData::GetTomorrow( /* [out] */ String* tomorrow) { VALIDATE_NOT_NULL(tomorrow); *tomorrow = mTomorrow; return NOERROR; } ECode LocaleData::GetFullTimeFormat( /* [out] */ String* fullTimeFormat) { VALIDATE_NOT_NULL(fullTimeFormat) *fullTimeFormat = mFullTimeFormat; return NOERROR; } ECode LocaleData::GetLongTimeFormat( /* [out] */ String* longTimeFormat) { VALIDATE_NOT_NULL(longTimeFormat) *longTimeFormat = mLongTimeFormat; return NOERROR; } ECode LocaleData::GetMediumTimeFormat( /* [out] */ String* mediumTimeFormat) { VALIDATE_NOT_NULL(mediumTimeFormat) *mediumTimeFormat = mMediumTimeFormat; return NOERROR; } ECode LocaleData::GetShortTimeFormat( /* [out] */ String* shortTimeFormat) { VALIDATE_NOT_NULL(shortTimeFormat) *shortTimeFormat = mShortTimeFormat; return NOERROR; } ECode LocaleData::GetFullDateFormat( /* [out] */ String* fullDateFormat) { VALIDATE_NOT_NULL(fullDateFormat) *fullDateFormat = mFullDateFormat; return NOERROR; } ECode LocaleData::GetLongDateFormat( /* [out] */ String* longDateFormat) { VALIDATE_NOT_NULL(longDateFormat) *longDateFormat = mLongDateFormat; return NOERROR; } ECode LocaleData::GetMediumDateFormat( /* [out] */ String* mediumDateFormat) { VALIDATE_NOT_NULL(mediumDateFormat) *mediumDateFormat = mMediumDateFormat; return NOERROR; } ECode LocaleData::GetShortDateFormat( /* [out] */ String* shortDateFormat) { VALIDATE_NOT_NULL(shortDateFormat) *shortDateFormat = mShortDateFormat; return NOERROR; } ECode LocaleData::GetNarrowAm( /* [out] */ String* narrowAm) { VALIDATE_NOT_NULL(narrowAm) *narrowAm = mNarrowAm; return NOERROR; } ECode LocaleData::GetNarrowPm( /* [out] */ String* narrowPm) { VALIDATE_NOT_NULL(narrowPm) *narrowPm = mNarrowPm; return NOERROR; } ECode LocaleData::GetShortDateFormat4( /* [out] */ String* shortDateFormat4) { VALIDATE_NOT_NULL(shortDateFormat4) *shortDateFormat4 = mShortDateFormat4; return NOERROR; } ECode LocaleData::GetZeroDigit( /* [out] */ Char32* zeroDigit) { VALIDATE_NOT_NULL(zeroDigit); *zeroDigit = mZeroDigit; return NOERROR; } ECode LocaleData::GetDecimalSeparator( /* [out] */ Char32* decimalSeparator) { VALIDATE_NOT_NULL(decimalSeparator); *decimalSeparator = mDecimalSeparator; return NOERROR; } ECode LocaleData::GetGroupingSeparator( /* [out] */ Char32* groupingSeparator) { VALIDATE_NOT_NULL(groupingSeparator); *groupingSeparator = mGroupingSeparator; return NOERROR; } ECode LocaleData::GetPatternSeparator( /* [out] */ Char32* patternSeparator) { VALIDATE_NOT_NULL(patternSeparator); *patternSeparator = mPatternSeparator; return NOERROR; } ECode LocaleData::GetPercent( /* [out] */ Char32* percent) { VALIDATE_NOT_NULL(percent); *percent = mPercent; return NOERROR; } ECode LocaleData::GetPerMill( /* [out] */ Char32* perMill) { VALIDATE_NOT_NULL(perMill); *perMill = mPerMill; return NOERROR; } ECode LocaleData::GetMonetarySeparator( /* [out] */ Char32* monetarySeparator) { VALIDATE_NOT_NULL(monetarySeparator); *monetarySeparator = mMonetarySeparator; return NOERROR; } ECode LocaleData::GetMinusSign( /* [out] */ String* minusSign) { VALIDATE_NOT_NULL(minusSign); *minusSign = mMinusSign; return NOERROR; } ECode LocaleData::GetExponentSeparator( /* [out] */ String* exponentSeparator) { VALIDATE_NOT_NULL(exponentSeparator); *exponentSeparator = mExponentSeparator; return NOERROR; } ECode LocaleData::GetInfinity( /* [out] */ String* infinity) { VALIDATE_NOT_NULL(infinity); *infinity = mInfinity; return NOERROR; } ECode LocaleData::GetNaN( /* [out] */ String* naN) { VALIDATE_NOT_NULL(naN); *naN = mNaN; return NOERROR; } ECode LocaleData::GetCurrencySymbol( /* [out] */ String* currencySymbol) { VALIDATE_NOT_NULL(currencySymbol); *currencySymbol = mCurrencySymbol; return NOERROR; } ECode LocaleData::GetInternationalCurrencySymbol( /* [out] */ String* internationalCurrencySymbol) { VALIDATE_NOT_NULL(internationalCurrencySymbol); *internationalCurrencySymbol = mInternationalCurrencySymbol; return NOERROR; } ECode LocaleData::GetTimeFormat12( /* [out] */ String* format) { VALIDATE_NOT_NULL(format); *format = mTimeFormat12; return NOERROR; } ECode LocaleData::GetTimeFormat24( /* [out] */ String* format) { VALIDATE_NOT_NULL(format); *format = mTimeFormat24; return NOERROR; } ECode LocaleData::GetNumberPattern( /* [out] */ String* numberPattern) { VALIDATE_NOT_NULL(numberPattern); *numberPattern = mNumberPattern; return NOERROR; } ECode LocaleData::GetIntegerPattern( /* [out] */ String* integerPattern) { VALIDATE_NOT_NULL(integerPattern); *integerPattern = mIntegerPattern; return NOERROR; } ECode LocaleData::GetCurrencyPattern( /* [out] */ String* currencyPattern) { VALIDATE_NOT_NULL(currencyPattern); *currencyPattern = mCurrencyPattern; return NOERROR; } ECode LocaleData::GetPercentPattern( /* [out] */ String* percentPattern) { VALIDATE_NOT_NULL(percentPattern); *percentPattern = mPercentPattern; return NOERROR; } AutoPtr<ILocaleData> LocaleData::InitLocaleData( /* [in] */ ILocale* locale) { AutoPtr<CLocaleData> localeObj; CLocaleData::NewByFriend((CLocaleData**)&localeObj); LocaleData* localeData = (LocaleData*)localeObj.Get(); String localeLanguageTag; locale->ToLanguageTag(&localeLanguageTag); Logger::I(TAG, " InitLocaleData for %s, localeLanguageTag: %s", TO_CSTR(locale), localeLanguageTag.string()); if (!ICUUtil::InitLocaleDataNative(localeLanguageTag, localeData)) { return NULL; } // Get the "h:mm a" and "HH:mm" 12- and 24-hour time format strings. ICUUtil::GetBestDateTimePattern(String("hm"), locale, &localeData->mTimeFormat12); ICUUtil::GetBestDateTimePattern(String("Hm"), locale, &localeData->mTimeFormat24); // Fix up a couple of patterns. if (!localeData->mFullTimeFormat.IsNull()) { // There are some full time format patterns in ICU that use the pattern character 'v'. // Java doesn't accept this, so we replace it with 'z' which has about the same result // as 'v', the timezone name. // 'v' -> "PT", 'z' -> "PST", v is the generic timezone and z the standard tz // "vvvv" -> "Pacific Time", "zzzz" -> "Pacific Standard Time" localeData->mFullTimeFormat = (localeData->mFullTimeFormat).Replace('v', 'z'); } if (!localeData->mNumberPattern.IsNull()) { // The number pattern might contain positive and negative subpatterns. Arabic, for // example, might look like "#,##0.###;#,##0.###-" because the minus sign should be // written last. Macedonian supposedly looks something like "#,##0.###;(#,##0.###)". // (The negative subpattern is optional, though, and not present in most locales.) // By only swallowing '#'es and ','s after the '.', we ensure that we don't // accidentally eat too much. // localeData.integerPattern = localeData.numberPattern.replaceAll("\\.[#,]*", ""); StringUtils::ReplaceAll(localeData->mNumberPattern, String("\\.[#,]*"), String("") , &localeData->mIntegerPattern); } Logger::I(TAG, " numberPattern %s, mIntegerPattern %s", localeData->mNumberPattern.string(), localeData->mIntegerPattern.string()); StringUtils::ReplaceAll(localeData->mShortDateFormat, String("\\byy\\b"), String("y"), &localeData->mShortDateFormat4); return (ILocaleData*)localeObj.Get(); } } // namespace ICU } // namespace Libcore
; A097723: One fourth of sum of divisors of 4n+3. ; Submitted by Jamie Morken(w2) ; 1,2,3,6,5,6,10,8,12,14,11,12,18,18,15,26,17,18,31,20,21,30,28,30,39,26,27,38,36,36,42,32,33,60,35,42,57,38,48,54,41,42,65,62,45,62,54,48,84,50,60,78,53,66,74,56,57,96,72,60,91,70,63,108,76,66,90,68,93,104,71,84,98,90,84,102,77,78,156,90,90,110,83,102,114,100,87,140,108,90,133,92,108,156,95,96,143,108,120,160 mul $0,4 add $0,3 seq $0,39653 ; a(0) = 0; for n > 0, a(n) = sigma(n)-1. div $0,4 add $0,1
; loop using cpx (compare x) and bne (branch is not equal) ; prints a-z ; 10 SYS (49152) *=$0801 BYTE $0E, $08, $0A, $00, $9E, $20, $28, $34, $39, $31, $35, $32, $29, $00, $00, $00 *=$c000 jsr $e544 ldx #65 ; initialize x with 65 - ASCII a loop txa ; transfer x to accumulator jsr $e716 ; print it to the screen inx ; increment x cpx #91 ; compare x with 91 bne loop ; if x <> 91 then branch back to loop rts
//===-- SBModule.cpp ------------------------------------------------------===// // // 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 // //===----------------------------------------------------------------------===// #include "lldb/API/SBModule.h" #include "SBReproducerPrivate.h" #include "lldb/API/SBAddress.h" #include "lldb/API/SBFileSpec.h" #include "lldb/API/SBModuleSpec.h" #include "lldb/API/SBProcess.h" #include "lldb/API/SBStream.h" #include "lldb/API/SBSymbolContextList.h" #include "lldb/Core/Module.h" #include "lldb/Core/Section.h" #include "lldb/Core/ValueObjectList.h" #include "lldb/Core/ValueObjectVariable.h" #include "lldb/Symbol/ObjectFile.h" #include "lldb/Symbol/SymbolFile.h" #include "lldb/Symbol/Symtab.h" #include "lldb/Symbol/TypeSystem.h" #include "lldb/Symbol/VariableList.h" #include "lldb/Target/Target.h" #include "lldb/Utility/StreamString.h" using namespace lldb; using namespace lldb_private; SBModule::SBModule() : m_opaque_sp() { LLDB_RECORD_CONSTRUCTOR_NO_ARGS(SBModule); } SBModule::SBModule(const lldb::ModuleSP &module_sp) : m_opaque_sp(module_sp) {} SBModule::SBModule(const SBModuleSpec &module_spec) : m_opaque_sp() { LLDB_RECORD_CONSTRUCTOR(SBModule, (const lldb::SBModuleSpec &), module_spec); ModuleSP module_sp; Status error = ModuleList::GetSharedModule( *module_spec.m_opaque_up, module_sp, nullptr, nullptr, nullptr); if (module_sp) SetSP(module_sp); } SBModule::SBModule(const SBModule &rhs) : m_opaque_sp(rhs.m_opaque_sp) { LLDB_RECORD_CONSTRUCTOR(SBModule, (const lldb::SBModule &), rhs); } SBModule::SBModule(lldb::SBProcess &process, lldb::addr_t header_addr) : m_opaque_sp() { LLDB_RECORD_CONSTRUCTOR(SBModule, (lldb::SBProcess &, lldb::addr_t), process, header_addr); ProcessSP process_sp(process.GetSP()); if (process_sp) { m_opaque_sp = process_sp->ReadModuleFromMemory(FileSpec(), header_addr); if (m_opaque_sp) { Target &target = process_sp->GetTarget(); bool changed = false; m_opaque_sp->SetLoadAddress(target, 0, true, changed); target.GetImages().Append(m_opaque_sp); } } } const SBModule &SBModule::operator=(const SBModule &rhs) { LLDB_RECORD_METHOD(const lldb::SBModule &, SBModule, operator=,(const lldb::SBModule &), rhs); if (this != &rhs) m_opaque_sp = rhs.m_opaque_sp; return LLDB_RECORD_RESULT(*this); } SBModule::~SBModule() = default; bool SBModule::IsValid() const { LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBModule, IsValid); return this->operator bool(); } SBModule::operator bool() const { LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBModule, operator bool); return m_opaque_sp.get() != nullptr; } void SBModule::Clear() { LLDB_RECORD_METHOD_NO_ARGS(void, SBModule, Clear); m_opaque_sp.reset(); } SBFileSpec SBModule::GetFileSpec() const { LLDB_RECORD_METHOD_CONST_NO_ARGS(lldb::SBFileSpec, SBModule, GetFileSpec); SBFileSpec file_spec; ModuleSP module_sp(GetSP()); if (module_sp) file_spec.SetFileSpec(module_sp->GetFileSpec()); return LLDB_RECORD_RESULT(file_spec); } lldb::SBFileSpec SBModule::GetPlatformFileSpec() const { LLDB_RECORD_METHOD_CONST_NO_ARGS(lldb::SBFileSpec, SBModule, GetPlatformFileSpec); SBFileSpec file_spec; ModuleSP module_sp(GetSP()); if (module_sp) file_spec.SetFileSpec(module_sp->GetPlatformFileSpec()); return LLDB_RECORD_RESULT(file_spec); } bool SBModule::SetPlatformFileSpec(const lldb::SBFileSpec &platform_file) { LLDB_RECORD_METHOD(bool, SBModule, SetPlatformFileSpec, (const lldb::SBFileSpec &), platform_file); bool result = false; ModuleSP module_sp(GetSP()); if (module_sp) { module_sp->SetPlatformFileSpec(*platform_file); result = true; } return result; } lldb::SBFileSpec SBModule::GetRemoteInstallFileSpec() { LLDB_RECORD_METHOD_NO_ARGS(lldb::SBFileSpec, SBModule, GetRemoteInstallFileSpec); SBFileSpec sb_file_spec; ModuleSP module_sp(GetSP()); if (module_sp) sb_file_spec.SetFileSpec(module_sp->GetRemoteInstallFileSpec()); return LLDB_RECORD_RESULT(sb_file_spec); } bool SBModule::SetRemoteInstallFileSpec(lldb::SBFileSpec &file) { LLDB_RECORD_METHOD(bool, SBModule, SetRemoteInstallFileSpec, (lldb::SBFileSpec &), file); ModuleSP module_sp(GetSP()); if (module_sp) { module_sp->SetRemoteInstallFileSpec(file.ref()); return true; } return false; } const uint8_t *SBModule::GetUUIDBytes() const { LLDB_RECORD_METHOD_CONST_NO_ARGS(const uint8_t *, SBModule, GetUUIDBytes); const uint8_t *uuid_bytes = nullptr; ModuleSP module_sp(GetSP()); if (module_sp) uuid_bytes = module_sp->GetUUID().GetBytes().data(); return uuid_bytes; } const char *SBModule::GetUUIDString() const { LLDB_RECORD_METHOD_CONST_NO_ARGS(const char *, SBModule, GetUUIDString); const char *uuid_cstr = nullptr; ModuleSP module_sp(GetSP()); if (module_sp) { // We are going to return a "const char *" value through the public API, so // we need to constify it so it gets added permanently the string pool and // then we don't need to worry about the lifetime of the string as it will // never go away once it has been put into the ConstString string pool uuid_cstr = ConstString(module_sp->GetUUID().GetAsString()).GetCString(); } if (uuid_cstr && uuid_cstr[0]) { return uuid_cstr; } return nullptr; } bool SBModule::operator==(const SBModule &rhs) const { LLDB_RECORD_METHOD_CONST(bool, SBModule, operator==,(const lldb::SBModule &), rhs); if (m_opaque_sp) return m_opaque_sp.get() == rhs.m_opaque_sp.get(); return false; } bool SBModule::operator!=(const SBModule &rhs) const { LLDB_RECORD_METHOD_CONST(bool, SBModule, operator!=,(const lldb::SBModule &), rhs); if (m_opaque_sp) return m_opaque_sp.get() != rhs.m_opaque_sp.get(); return false; } ModuleSP SBModule::GetSP() const { return m_opaque_sp; } void SBModule::SetSP(const ModuleSP &module_sp) { m_opaque_sp = module_sp; } SBAddress SBModule::ResolveFileAddress(lldb::addr_t vm_addr) { LLDB_RECORD_METHOD(lldb::SBAddress, SBModule, ResolveFileAddress, (lldb::addr_t), vm_addr); lldb::SBAddress sb_addr; ModuleSP module_sp(GetSP()); if (module_sp) { Address addr; if (module_sp->ResolveFileAddress(vm_addr, addr)) sb_addr.ref() = addr; } return LLDB_RECORD_RESULT(sb_addr); } SBSymbolContext SBModule::ResolveSymbolContextForAddress(const SBAddress &addr, uint32_t resolve_scope) { LLDB_RECORD_METHOD(lldb::SBSymbolContext, SBModule, ResolveSymbolContextForAddress, (const lldb::SBAddress &, uint32_t), addr, resolve_scope); SBSymbolContext sb_sc; ModuleSP module_sp(GetSP()); SymbolContextItem scope = static_cast<SymbolContextItem>(resolve_scope); if (module_sp && addr.IsValid()) module_sp->ResolveSymbolContextForAddress(addr.ref(), scope, *sb_sc); return LLDB_RECORD_RESULT(sb_sc); } bool SBModule::GetDescription(SBStream &description) { LLDB_RECORD_METHOD(bool, SBModule, GetDescription, (lldb::SBStream &), description); Stream &strm = description.ref(); ModuleSP module_sp(GetSP()); if (module_sp) { module_sp->GetDescription(strm.AsRawOstream()); } else strm.PutCString("No value"); return true; } uint32_t SBModule::GetNumCompileUnits() { LLDB_RECORD_METHOD_NO_ARGS(uint32_t, SBModule, GetNumCompileUnits); ModuleSP module_sp(GetSP()); if (module_sp) { return module_sp->GetNumCompileUnits(); } return 0; } SBCompileUnit SBModule::GetCompileUnitAtIndex(uint32_t index) { LLDB_RECORD_METHOD(lldb::SBCompileUnit, SBModule, GetCompileUnitAtIndex, (uint32_t), index); SBCompileUnit sb_cu; ModuleSP module_sp(GetSP()); if (module_sp) { CompUnitSP cu_sp = module_sp->GetCompileUnitAtIndex(index); sb_cu.reset(cu_sp.get()); } return LLDB_RECORD_RESULT(sb_cu); } SBSymbolContextList SBModule::FindCompileUnits(const SBFileSpec &sb_file_spec) { LLDB_RECORD_METHOD(lldb::SBSymbolContextList, SBModule, FindCompileUnits, (const lldb::SBFileSpec &), sb_file_spec); SBSymbolContextList sb_sc_list; const ModuleSP module_sp(GetSP()); if (sb_file_spec.IsValid() && module_sp) { module_sp->FindCompileUnits(*sb_file_spec, *sb_sc_list); } return LLDB_RECORD_RESULT(sb_sc_list); } static Symtab *GetUnifiedSymbolTable(const lldb::ModuleSP &module_sp) { if (module_sp) return module_sp->GetSymtab(); return nullptr; } size_t SBModule::GetNumSymbols() { LLDB_RECORD_METHOD_NO_ARGS(size_t, SBModule, GetNumSymbols); ModuleSP module_sp(GetSP()); if (Symtab *symtab = GetUnifiedSymbolTable(module_sp)) return symtab->GetNumSymbols(); return 0; } SBSymbol SBModule::GetSymbolAtIndex(size_t idx) { LLDB_RECORD_METHOD(lldb::SBSymbol, SBModule, GetSymbolAtIndex, (size_t), idx); SBSymbol sb_symbol; ModuleSP module_sp(GetSP()); Symtab *symtab = GetUnifiedSymbolTable(module_sp); if (symtab) sb_symbol.SetSymbol(symtab->SymbolAtIndex(idx)); return LLDB_RECORD_RESULT(sb_symbol); } lldb::SBSymbol SBModule::FindSymbol(const char *name, lldb::SymbolType symbol_type) { LLDB_RECORD_METHOD(lldb::SBSymbol, SBModule, FindSymbol, (const char *, lldb::SymbolType), name, symbol_type); SBSymbol sb_symbol; if (name && name[0]) { ModuleSP module_sp(GetSP()); Symtab *symtab = GetUnifiedSymbolTable(module_sp); if (symtab) sb_symbol.SetSymbol(symtab->FindFirstSymbolWithNameAndType( ConstString(name), symbol_type, Symtab::eDebugAny, Symtab::eVisibilityAny)); } return LLDB_RECORD_RESULT(sb_symbol); } lldb::SBSymbolContextList SBModule::FindSymbols(const char *name, lldb::SymbolType symbol_type) { LLDB_RECORD_METHOD(lldb::SBSymbolContextList, SBModule, FindSymbols, (const char *, lldb::SymbolType), name, symbol_type); SBSymbolContextList sb_sc_list; if (name && name[0]) { ModuleSP module_sp(GetSP()); Symtab *symtab = GetUnifiedSymbolTable(module_sp); if (symtab) { std::vector<uint32_t> matching_symbol_indexes; symtab->FindAllSymbolsWithNameAndType(ConstString(name), symbol_type, matching_symbol_indexes); const size_t num_matches = matching_symbol_indexes.size(); if (num_matches) { SymbolContext sc; sc.module_sp = module_sp; SymbolContextList &sc_list = *sb_sc_list; for (size_t i = 0; i < num_matches; ++i) { sc.symbol = symtab->SymbolAtIndex(matching_symbol_indexes[i]); if (sc.symbol) sc_list.Append(sc); } } } } return LLDB_RECORD_RESULT(sb_sc_list); } size_t SBModule::GetNumSections() { LLDB_RECORD_METHOD_NO_ARGS(size_t, SBModule, GetNumSections); ModuleSP module_sp(GetSP()); if (module_sp) { // Give the symbol vendor a chance to add to the unified section list. module_sp->GetSymbolFile(); SectionList *section_list = module_sp->GetSectionList(); if (section_list) return section_list->GetSize(); } return 0; } SBSection SBModule::GetSectionAtIndex(size_t idx) { LLDB_RECORD_METHOD(lldb::SBSection, SBModule, GetSectionAtIndex, (size_t), idx); SBSection sb_section; ModuleSP module_sp(GetSP()); if (module_sp) { // Give the symbol vendor a chance to add to the unified section list. module_sp->GetSymbolFile(); SectionList *section_list = module_sp->GetSectionList(); if (section_list) sb_section.SetSP(section_list->GetSectionAtIndex(idx)); } return LLDB_RECORD_RESULT(sb_section); } lldb::SBSymbolContextList SBModule::FindFunctions(const char *name, uint32_t name_type_mask) { LLDB_RECORD_METHOD(lldb::SBSymbolContextList, SBModule, FindFunctions, (const char *, uint32_t), name, name_type_mask); lldb::SBSymbolContextList sb_sc_list; ModuleSP module_sp(GetSP()); if (name && module_sp) { const bool symbols_ok = true; const bool inlines_ok = true; FunctionNameType type = static_cast<FunctionNameType>(name_type_mask); module_sp->FindFunctions(ConstString(name), CompilerDeclContext(), type, symbols_ok, inlines_ok, *sb_sc_list); } return LLDB_RECORD_RESULT(sb_sc_list); } SBValueList SBModule::FindGlobalVariables(SBTarget &target, const char *name, uint32_t max_matches) { LLDB_RECORD_METHOD(lldb::SBValueList, SBModule, FindGlobalVariables, (lldb::SBTarget &, const char *, uint32_t), target, name, max_matches); SBValueList sb_value_list; ModuleSP module_sp(GetSP()); if (name && module_sp) { VariableList variable_list; module_sp->FindGlobalVariables(ConstString(name), CompilerDeclContext(), max_matches, variable_list); for (const VariableSP &var_sp : variable_list) { lldb::ValueObjectSP valobj_sp; TargetSP target_sp(target.GetSP()); valobj_sp = ValueObjectVariable::Create(target_sp.get(), var_sp); if (valobj_sp) sb_value_list.Append(SBValue(valobj_sp)); } } return LLDB_RECORD_RESULT(sb_value_list); } lldb::SBValue SBModule::FindFirstGlobalVariable(lldb::SBTarget &target, const char *name) { LLDB_RECORD_METHOD(lldb::SBValue, SBModule, FindFirstGlobalVariable, (lldb::SBTarget &, const char *), target, name); SBValueList sb_value_list(FindGlobalVariables(target, name, 1)); if (sb_value_list.IsValid() && sb_value_list.GetSize() > 0) return LLDB_RECORD_RESULT(sb_value_list.GetValueAtIndex(0)); return LLDB_RECORD_RESULT(SBValue()); } lldb::SBType SBModule::FindFirstType(const char *name_cstr) { LLDB_RECORD_METHOD(lldb::SBType, SBModule, FindFirstType, (const char *), name_cstr); SBType sb_type; ModuleSP module_sp(GetSP()); if (name_cstr && module_sp) { SymbolContext sc; const bool exact_match = false; ConstString name(name_cstr); sb_type = SBType(module_sp->FindFirstType(sc, name, exact_match)); if (!sb_type.IsValid()) { auto type_system_or_err = module_sp->GetTypeSystemForLanguage(eLanguageTypeC); if (auto err = type_system_or_err.takeError()) { llvm::consumeError(std::move(err)); return LLDB_RECORD_RESULT(SBType()); } sb_type = SBType(type_system_or_err->GetBuiltinTypeByName(name)); } } return LLDB_RECORD_RESULT(sb_type); } lldb::SBType SBModule::GetBasicType(lldb::BasicType type) { LLDB_RECORD_METHOD(lldb::SBType, SBModule, GetBasicType, (lldb::BasicType), type); ModuleSP module_sp(GetSP()); if (module_sp) { auto type_system_or_err = module_sp->GetTypeSystemForLanguage(eLanguageTypeC); if (auto err = type_system_or_err.takeError()) { llvm::consumeError(std::move(err)); } else { return LLDB_RECORD_RESULT( SBType(type_system_or_err->GetBasicTypeFromAST(type))); } } return LLDB_RECORD_RESULT(SBType()); } lldb::SBTypeList SBModule::FindTypes(const char *type) { LLDB_RECORD_METHOD(lldb::SBTypeList, SBModule, FindTypes, (const char *), type); SBTypeList retval; ModuleSP module_sp(GetSP()); if (type && module_sp) { TypeList type_list; const bool exact_match = false; ConstString name(type); llvm::DenseSet<SymbolFile *> searched_symbol_files; module_sp->FindTypes(name, exact_match, UINT32_MAX, searched_symbol_files, type_list); if (type_list.Empty()) { auto type_system_or_err = module_sp->GetTypeSystemForLanguage(eLanguageTypeC); if (auto err = type_system_or_err.takeError()) { llvm::consumeError(std::move(err)); } else { CompilerType compiler_type = type_system_or_err->GetBuiltinTypeByName(name); if (compiler_type) retval.Append(SBType(compiler_type)); } } else { for (size_t idx = 0; idx < type_list.GetSize(); idx++) { TypeSP type_sp(type_list.GetTypeAtIndex(idx)); if (type_sp) retval.Append(SBType(type_sp)); } } } return LLDB_RECORD_RESULT(retval); } lldb::SBType SBModule::GetTypeByID(lldb::user_id_t uid) { LLDB_RECORD_METHOD(lldb::SBType, SBModule, GetTypeByID, (lldb::user_id_t), uid); ModuleSP module_sp(GetSP()); if (module_sp) { if (SymbolFile *symfile = module_sp->GetSymbolFile()) { Type *type_ptr = symfile->ResolveTypeUID(uid); if (type_ptr) return LLDB_RECORD_RESULT(SBType(type_ptr->shared_from_this())); } } return LLDB_RECORD_RESULT(SBType()); } lldb::SBTypeList SBModule::GetTypes(uint32_t type_mask) { LLDB_RECORD_METHOD(lldb::SBTypeList, SBModule, GetTypes, (uint32_t), type_mask); SBTypeList sb_type_list; ModuleSP module_sp(GetSP()); if (!module_sp) return LLDB_RECORD_RESULT(sb_type_list); SymbolFile *symfile = module_sp->GetSymbolFile(); if (!symfile) return LLDB_RECORD_RESULT(sb_type_list); TypeClass type_class = static_cast<TypeClass>(type_mask); TypeList type_list; symfile->GetTypes(nullptr, type_class, type_list); sb_type_list.m_opaque_up->Append(type_list); return LLDB_RECORD_RESULT(sb_type_list); } SBSection SBModule::FindSection(const char *sect_name) { LLDB_RECORD_METHOD(lldb::SBSection, SBModule, FindSection, (const char *), sect_name); SBSection sb_section; ModuleSP module_sp(GetSP()); if (sect_name && module_sp) { // Give the symbol vendor a chance to add to the unified section list. module_sp->GetSymbolFile(); SectionList *section_list = module_sp->GetSectionList(); if (section_list) { ConstString const_sect_name(sect_name); SectionSP section_sp(section_list->FindSectionByName(const_sect_name)); if (section_sp) { sb_section.SetSP(section_sp); } } } return LLDB_RECORD_RESULT(sb_section); } lldb::ByteOrder SBModule::GetByteOrder() { LLDB_RECORD_METHOD_NO_ARGS(lldb::ByteOrder, SBModule, GetByteOrder); ModuleSP module_sp(GetSP()); if (module_sp) return module_sp->GetArchitecture().GetByteOrder(); return eByteOrderInvalid; } const char *SBModule::GetTriple() { LLDB_RECORD_METHOD_NO_ARGS(const char *, SBModule, GetTriple); ModuleSP module_sp(GetSP()); if (module_sp) { std::string triple(module_sp->GetArchitecture().GetTriple().str()); // Unique the string so we don't run into ownership issues since the const // strings put the string into the string pool once and the strings never // comes out ConstString const_triple(triple.c_str()); return const_triple.GetCString(); } return nullptr; } uint32_t SBModule::GetAddressByteSize() { LLDB_RECORD_METHOD_NO_ARGS(uint32_t, SBModule, GetAddressByteSize); ModuleSP module_sp(GetSP()); if (module_sp) return module_sp->GetArchitecture().GetAddressByteSize(); return sizeof(void *); } uint32_t SBModule::GetVersion(uint32_t *versions, uint32_t num_versions) { LLDB_RECORD_METHOD(uint32_t, SBModule, GetVersion, (uint32_t *, uint32_t), versions, num_versions); llvm::VersionTuple version; if (ModuleSP module_sp = GetSP()) version = module_sp->GetVersion(); uint32_t result = 0; if (!version.empty()) ++result; if (version.getMinor()) ++result; if(version.getSubminor()) ++result; if (!versions) return result; if (num_versions > 0) versions[0] = version.empty() ? UINT32_MAX : version.getMajor(); if (num_versions > 1) versions[1] = version.getMinor().getValueOr(UINT32_MAX); if (num_versions > 2) versions[2] = version.getSubminor().getValueOr(UINT32_MAX); for (uint32_t i = 3; i < num_versions; ++i) versions[i] = UINT32_MAX; return result; } lldb::SBFileSpec SBModule::GetSymbolFileSpec() const { LLDB_RECORD_METHOD_CONST_NO_ARGS(lldb::SBFileSpec, SBModule, GetSymbolFileSpec); lldb::SBFileSpec sb_file_spec; ModuleSP module_sp(GetSP()); if (module_sp) { if (SymbolFile *symfile = module_sp->GetSymbolFile()) sb_file_spec.SetFileSpec(symfile->GetObjectFile()->GetFileSpec()); } return LLDB_RECORD_RESULT(sb_file_spec); } lldb::SBAddress SBModule::GetObjectFileHeaderAddress() const { LLDB_RECORD_METHOD_CONST_NO_ARGS(lldb::SBAddress, SBModule, GetObjectFileHeaderAddress); lldb::SBAddress sb_addr; ModuleSP module_sp(GetSP()); if (module_sp) { ObjectFile *objfile_ptr = module_sp->GetObjectFile(); if (objfile_ptr) sb_addr.ref() = objfile_ptr->GetBaseAddress(); } return LLDB_RECORD_RESULT(sb_addr); } lldb::SBAddress SBModule::GetObjectFileEntryPointAddress() const { LLDB_RECORD_METHOD_CONST_NO_ARGS(lldb::SBAddress, SBModule, GetObjectFileEntryPointAddress); lldb::SBAddress sb_addr; ModuleSP module_sp(GetSP()); if (module_sp) { ObjectFile *objfile_ptr = module_sp->GetObjectFile(); if (objfile_ptr) sb_addr.ref() = objfile_ptr->GetEntryPointAddress(); } return LLDB_RECORD_RESULT(sb_addr); } namespace lldb_private { namespace repro { template <> void RegisterMethods<SBModule>(Registry &R) { LLDB_REGISTER_CONSTRUCTOR(SBModule, ()); LLDB_REGISTER_CONSTRUCTOR(SBModule, (const lldb::SBModuleSpec &)); LLDB_REGISTER_CONSTRUCTOR(SBModule, (const lldb::SBModule &)); LLDB_REGISTER_CONSTRUCTOR(SBModule, (lldb::SBProcess &, lldb::addr_t)); LLDB_REGISTER_METHOD(const lldb::SBModule &, SBModule, operator=,(const lldb::SBModule &)); LLDB_REGISTER_METHOD_CONST(bool, SBModule, IsValid, ()); LLDB_REGISTER_METHOD_CONST(bool, SBModule, operator bool, ()); LLDB_REGISTER_METHOD(void, SBModule, Clear, ()); LLDB_REGISTER_METHOD_CONST(lldb::SBFileSpec, SBModule, GetFileSpec, ()); LLDB_REGISTER_METHOD_CONST(lldb::SBFileSpec, SBModule, GetPlatformFileSpec, ()); LLDB_REGISTER_METHOD(bool, SBModule, SetPlatformFileSpec, (const lldb::SBFileSpec &)); LLDB_REGISTER_METHOD(lldb::SBFileSpec, SBModule, GetRemoteInstallFileSpec, ()); LLDB_REGISTER_METHOD(bool, SBModule, SetRemoteInstallFileSpec, (lldb::SBFileSpec &)); LLDB_REGISTER_METHOD_CONST(const char *, SBModule, GetUUIDString, ()); LLDB_REGISTER_METHOD_CONST(bool, SBModule, operator==,(const lldb::SBModule &)); LLDB_REGISTER_METHOD_CONST(bool, SBModule, operator!=,(const lldb::SBModule &)); LLDB_REGISTER_METHOD(lldb::SBAddress, SBModule, ResolveFileAddress, (lldb::addr_t)); LLDB_REGISTER_METHOD(lldb::SBSymbolContext, SBModule, ResolveSymbolContextForAddress, (const lldb::SBAddress &, uint32_t)); LLDB_REGISTER_METHOD(bool, SBModule, GetDescription, (lldb::SBStream &)); LLDB_REGISTER_METHOD(uint32_t, SBModule, GetNumCompileUnits, ()); LLDB_REGISTER_METHOD(lldb::SBCompileUnit, SBModule, GetCompileUnitAtIndex, (uint32_t)); LLDB_REGISTER_METHOD(lldb::SBSymbolContextList, SBModule, FindCompileUnits, (const lldb::SBFileSpec &)); LLDB_REGISTER_METHOD(size_t, SBModule, GetNumSymbols, ()); LLDB_REGISTER_METHOD(lldb::SBSymbol, SBModule, GetSymbolAtIndex, (size_t)); LLDB_REGISTER_METHOD(lldb::SBSymbol, SBModule, FindSymbol, (const char *, lldb::SymbolType)); LLDB_REGISTER_METHOD(lldb::SBSymbolContextList, SBModule, FindSymbols, (const char *, lldb::SymbolType)); LLDB_REGISTER_METHOD(size_t, SBModule, GetNumSections, ()); LLDB_REGISTER_METHOD(lldb::SBSection, SBModule, GetSectionAtIndex, (size_t)); LLDB_REGISTER_METHOD(lldb::SBSymbolContextList, SBModule, FindFunctions, (const char *, uint32_t)); LLDB_REGISTER_METHOD(lldb::SBValueList, SBModule, FindGlobalVariables, (lldb::SBTarget &, const char *, uint32_t)); LLDB_REGISTER_METHOD(lldb::SBValue, SBModule, FindFirstGlobalVariable, (lldb::SBTarget &, const char *)); LLDB_REGISTER_METHOD(lldb::SBType, SBModule, FindFirstType, (const char *)); LLDB_REGISTER_METHOD(lldb::SBType, SBModule, GetBasicType, (lldb::BasicType)); LLDB_REGISTER_METHOD(lldb::SBTypeList, SBModule, FindTypes, (const char *)); LLDB_REGISTER_METHOD(lldb::SBType, SBModule, GetTypeByID, (lldb::user_id_t)); LLDB_REGISTER_METHOD(lldb::SBTypeList, SBModule, GetTypes, (uint32_t)); LLDB_REGISTER_METHOD(lldb::SBSection, SBModule, FindSection, (const char *)); LLDB_REGISTER_METHOD(lldb::ByteOrder, SBModule, GetByteOrder, ()); LLDB_REGISTER_METHOD(const char *, SBModule, GetTriple, ()); LLDB_REGISTER_METHOD(uint32_t, SBModule, GetAddressByteSize, ()); LLDB_REGISTER_METHOD(uint32_t, SBModule, GetVersion, (uint32_t *, uint32_t)); LLDB_REGISTER_METHOD_CONST(lldb::SBFileSpec, SBModule, GetSymbolFileSpec, ()); LLDB_REGISTER_METHOD_CONST(lldb::SBAddress, SBModule, GetObjectFileHeaderAddress, ()); LLDB_REGISTER_METHOD_CONST(lldb::SBAddress, SBModule, GetObjectFileEntryPointAddress, ()); } } }
// Autogenerated from CppHeaderCreator // Created by Sc2ad // ========================================================================= #pragma once // Begin includes #include "extern/beatsaber-hook/shared/utils/typedefs.h" // Including type: UnityEngine.MonoBehaviour #include "UnityEngine/MonoBehaviour.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils-methods.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils-properties.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils-fields.hpp" #include "extern/beatsaber-hook/shared/utils/utils.h" // Completed includes // Begin forward declares // Forward declaring namespace: GlobalNamespace namespace GlobalNamespace { // Forward declaring type: FlyingTextSpawner class FlyingTextSpawner; // Forward declaring type: BeatmapObjectManager class BeatmapObjectManager; // Forward declaring type: NoteController class NoteController; // Forward declaring type: NoteCutInfo struct NoteCutInfo; } // Completed forward declares // Type namespace: namespace GlobalNamespace { // Size: 0x28 #pragma pack(push, 1) // Autogenerated type: TutorialNoteCutEffectSpawner class TutorialNoteCutEffectSpawner : public UnityEngine::MonoBehaviour { public: // private FlyingTextSpawner _failFlyingTextSpawner // Size: 0x8 // Offset: 0x18 GlobalNamespace::FlyingTextSpawner* failFlyingTextSpawner; // Field size check static_assert(sizeof(GlobalNamespace::FlyingTextSpawner*) == 0x8); // [InjectAttribute] Offset: 0xE1FDC0 // private readonly BeatmapObjectManager _beatmapObjectManager // Size: 0x8 // Offset: 0x20 GlobalNamespace::BeatmapObjectManager* beatmapObjectManager; // Field size check static_assert(sizeof(GlobalNamespace::BeatmapObjectManager*) == 0x8); // Creating value type constructor for type: TutorialNoteCutEffectSpawner TutorialNoteCutEffectSpawner(GlobalNamespace::FlyingTextSpawner* failFlyingTextSpawner_ = {}, GlobalNamespace::BeatmapObjectManager* beatmapObjectManager_ = {}) noexcept : failFlyingTextSpawner{failFlyingTextSpawner_}, beatmapObjectManager{beatmapObjectManager_} {} // Deleting conversion operator: operator System::IntPtr constexpr operator System::IntPtr() const noexcept = delete; // protected System.Void Start() // Offset: 0x10FC4D4 void Start(); // protected System.Void OnDestroy() // Offset: 0x10FC560 void OnDestroy(); // private System.Void HandleNoteWasCut(NoteController noteController, in NoteCutInfo noteCutInfo) // Offset: 0x10FC5F8 void HandleNoteWasCut(GlobalNamespace::NoteController* noteController, GlobalNamespace::NoteCutInfo& noteCutInfo); // public System.Void .ctor() // Offset: 0x10FC830 // Implemented from: UnityEngine.MonoBehaviour // Base method: System.Void MonoBehaviour::.ctor() // Base method: System.Void Behaviour::.ctor() // Base method: System.Void Component::.ctor() // Base method: System.Void Object::.ctor() // Base method: System.Void Object::.ctor() template<::il2cpp_utils::CreationType creationType = ::il2cpp_utils::CreationType::Temporary> static TutorialNoteCutEffectSpawner* New_ctor() { static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::TutorialNoteCutEffectSpawner::.ctor"); return THROW_UNLESS((::il2cpp_utils::New<TutorialNoteCutEffectSpawner*, creationType>())); } }; // TutorialNoteCutEffectSpawner #pragma pack(pop) static check_size<sizeof(TutorialNoteCutEffectSpawner), 32 + sizeof(GlobalNamespace::BeatmapObjectManager*)> __GlobalNamespace_TutorialNoteCutEffectSpawnerSizeCheck; static_assert(sizeof(TutorialNoteCutEffectSpawner) == 0x28); } DEFINE_IL2CPP_ARG_TYPE(GlobalNamespace::TutorialNoteCutEffectSpawner*, "", "TutorialNoteCutEffectSpawner");
; A003232: Expansion of (x-1)*(x^2-4*x-1)/(1-2*x)^2. ; 1,7,19,49,120,284,656,1488,3328,7360,16128,35072,75776,162816,348160,741376,1572864,3325952,7012352,14745600,30932992,64749568,135266304,282066944,587202560,1220542464 mov $1,1 mov $2,1 lpb $0,1 sub $0,1 add $2,5 add $3,$1 add $1,5 sub $1,$4 add $1,$3 sub $2,5 add $2,$4 sub $4,$4 add $4,$2 mov $2,$3 lpe
; Must be linked after other code .asm files ORG $2000 ; Default Standard Formatting (16 sectors per track, 256 bytes per sector) TRACKINFO FCB 16 ; 16 sectors FCB 1,1,0 ; Sector 1 SizeShift=1 FCB 2,1,0 ; Sector 1 SizeShift=1 FCB 3,1,0 ; Sector 1 SizeShift=1 FCB 4,1,0 ; Sector 1 SizeShift=1 FCB 5,1,0 ; Sector 1 SizeShift=1 FCB 6,1,0 ; Sector 1 SizeShift=1 FCB 7,1,0 ; Sector 1 SizeShift=1 FCB 8,1,0 ; Sector 1 SizeShift=1 FCB 9,1,0 ; Sector 1 SizeShift=1 FCB 10,1,0 ; Sector 1 SizeShift=1 FCB 11,1,0 ; Sector 1 SizeShift=1 FCB 12,1,0 ; Sector 1 SizeShift=1 FCB 13,1,0 ; Sector 1 SizeShift=1 FCB 14,1,0 ; Sector 1 SizeShift=1 FCB 15,1,0 ; Sector 1 SizeShift=1 FCB 16,1,0 ; Sector 1 SizeShift=1 FCB 0 ; Same format til the last track ORG $4000 TRACKIMAGE
/* * MRustC - Rust Compiler * - By John Hodge (Mutabah/thePowersGang) * * hir_expand/annotate_value_usage.cpp * - Marks _Variable, _Index, _Deref, and _Field nodes with how the result is used */ #include <hir/visitor.hpp> #include <hir/expr.hpp> #include <hir_typeck/static.hpp> #include <algorithm> #include "main_bindings.hpp" #include <hir/expr_state.hpp> namespace { class ExprVisitor_Mark: public ::HIR::ExprVisitor//Def { const StaticTraitResolve& m_resolve; ::std::vector< ::HIR::ValueUsage> m_usage; struct UsageGuard { ExprVisitor_Mark& m_parent; bool m_pop; UsageGuard(ExprVisitor_Mark& parent, bool pop): m_parent(parent), m_pop(pop) { } ~UsageGuard() { if(m_pop) { m_parent.m_usage.pop_back(); } } }; ::HIR::ValueUsage get_usage() const { return (m_usage.empty() ? ::HIR::ValueUsage::Move : m_usage.back()); } UsageGuard push_usage(::HIR::ValueUsage u) { if( get_usage() == u ) { return UsageGuard(*this, false); } else { m_usage.push_back( u ); return UsageGuard(*this, true); } } public: ExprVisitor_Mark(const StaticTraitResolve& resolve): m_resolve(resolve) {} void visit_root(::HIR::ExprPtr& root_ptr) { assert(root_ptr); root_ptr->m_usage = this->get_usage(); auto expected_size = m_usage.size(); root_ptr->visit( *this ); assert( m_usage.size() == expected_size ); } void visit_node_ptr(::HIR::ExprNodeP& node_ptr) override { assert(node_ptr); const auto& node_ref = *node_ptr; const char* node_tyname = typeid(node_ref).name(); TRACE_FUNCTION_FR(&*node_ptr << " " << node_tyname << ": " << this->get_usage(), node_ptr->m_usage); node_ptr->m_usage = this->get_usage(); auto expected_size = m_usage.size(); node_ptr->visit( *this ); assert( m_usage.size() == expected_size ); } void visit(::HIR::ExprNode_Block& node) override { auto _ = this->push_usage( ::HIR::ValueUsage::Move ); for( auto& subnode : node.m_nodes ) { this->visit_node_ptr(subnode); } if( node.m_value_node ) this->visit_node_ptr(node.m_value_node); } void visit(::HIR::ExprNode_Asm& node) override { auto _ = this->push_usage( ::HIR::ValueUsage::Move ); for(auto& v : node.m_outputs) { this->visit_node_ptr(v.value); } for(auto& v : node.m_inputs) { this->visit_node_ptr(v.value); } } void visit(::HIR::ExprNode_Asm2& node) override { auto _ = this->push_usage( ::HIR::ValueUsage::Move ); for(auto& v : node.m_params) { TU_MATCH_HDRA( (v), { ) TU_ARMA(Const, e) { visit_node_ptr(e); } TU_ARMA(Sym, e) { } TU_ARMA(RegSingle, e) { visit_node_ptr(e.val); } TU_ARMA(Reg, e) { if(e.val_in) visit_node_ptr(e.val_in); if(e.val_out) visit_node_ptr(e.val_out); } } } } void visit(::HIR::ExprNode_Return& node) override { auto _ = this->push_usage( ::HIR::ValueUsage::Move ); this->visit_node_ptr( node.m_value ); } void visit(::HIR::ExprNode_Yield& node) override { auto _ = this->push_usage( ::HIR::ValueUsage::Move ); this->visit_node_ptr( node.m_value ); } void visit(::HIR::ExprNode_Let& node) override { if( node.m_value ) { auto _ = this->push_usage( this->get_usage_for_pattern(node.span(), node.m_pattern, node.m_type) ); this->visit_node_ptr( node.m_value ); } } void visit(::HIR::ExprNode_Loop& node) override { auto _ = this->push_usage( ::HIR::ValueUsage::Move ); this->visit_node_ptr( node.m_code ); } void visit(::HIR::ExprNode_LoopControl& node) override { // NOTE: Leaf if( node.m_value ) { this->visit_node_ptr(node.m_value); } } void visit(::HIR::ExprNode_Match& node) override { { const auto& val_ty = node.m_value->m_res_type; ::HIR::ValueUsage vu = ::HIR::ValueUsage::Unknown; for( const auto& arm : node.m_arms ) { for( const auto& pat : arm.m_patterns ) vu = ::std::max( vu, this->get_usage_for_pattern(node.span(), pat, val_ty) ); } auto _ = this->push_usage( vu ); this->visit_node_ptr( node.m_value ); } auto _ = this->push_usage( ::HIR::ValueUsage::Move ); for(auto& arm : node.m_arms) { if( arm.m_cond ) { this->visit_node_ptr( arm.m_cond ); } this->visit_node_ptr( arm.m_code ); } } void visit(::HIR::ExprNode_If& node) override { auto _ = this->push_usage( ::HIR::ValueUsage::Move ); this->visit_node_ptr( node.m_cond ); this->visit_node_ptr( node.m_true ); if( node.m_false ) { this->visit_node_ptr( node.m_false ); } } void visit(::HIR::ExprNode_Assign& node) override { { auto _ = this->push_usage( ::HIR::ValueUsage::Mutate ); this->visit_node_ptr(node.m_slot); } { auto _ = this->push_usage( ::HIR::ValueUsage::Move ); this->visit_node_ptr(node.m_value); } } void visit(::HIR::ExprNode_UniOp& node) override { m_usage.push_back( ::HIR::ValueUsage::Move ); this->visit_node_ptr(node.m_value); m_usage.pop_back(); } void visit(::HIR::ExprNode_Borrow& node) override { switch(node.m_type) { case ::HIR::BorrowType::Shared: m_usage.push_back( ::HIR::ValueUsage::Borrow ); break; case ::HIR::BorrowType::Unique: m_usage.push_back( ::HIR::ValueUsage::Mutate ); break; case ::HIR::BorrowType::Owned: m_usage.push_back( ::HIR::ValueUsage::Move ); break; } this->visit_node_ptr(node.m_value); m_usage.pop_back(); } void visit(::HIR::ExprNode_RawBorrow& node) override { switch(node.m_type) { case ::HIR::BorrowType::Shared: m_usage.push_back( ::HIR::ValueUsage::Borrow ); break; case ::HIR::BorrowType::Unique: m_usage.push_back( ::HIR::ValueUsage::Mutate ); break; case ::HIR::BorrowType::Owned: m_usage.push_back( ::HIR::ValueUsage::Move ); break; } this->visit_node_ptr(node.m_value); m_usage.pop_back(); } void visit(::HIR::ExprNode_BinOp& node) override { switch(node.m_op) { case ::HIR::ExprNode_BinOp::Op::CmpEqu: case ::HIR::ExprNode_BinOp::Op::CmpNEqu: case ::HIR::ExprNode_BinOp::Op::CmpLt: case ::HIR::ExprNode_BinOp::Op::CmpLtE: case ::HIR::ExprNode_BinOp::Op::CmpGt: case ::HIR::ExprNode_BinOp::Op::CmpGtE: m_usage.push_back( ::HIR::ValueUsage::Borrow ); break; default: m_usage.push_back( ::HIR::ValueUsage::Move ); break; } this->visit_node_ptr(node.m_left); this->visit_node_ptr(node.m_right); m_usage.pop_back(); } void visit(::HIR::ExprNode_Cast& node) override { auto _ = push_usage( ::HIR::ValueUsage::Move ); this->visit_node_ptr(node.m_value); } void visit(::HIR::ExprNode_Unsize& node) override { // TODO: Why does Unsize have a usage of Move? //auto _ = push_usage( ::HIR::ValueUsage::Move ); this->visit_node_ptr(node.m_value); } void visit(::HIR::ExprNode_Index& node) override { // TODO: Override to ::Borrow if Res: Copy and moving if( this->get_usage() == ::HIR::ValueUsage::Move && m_resolve.type_is_copy(node.span(), node.m_res_type) ) { auto _ = push_usage( ::HIR::ValueUsage::Borrow ); this->visit_node_ptr(node.m_value); } else { this->visit_node_ptr(node.m_value); } auto _ = push_usage( ::HIR::ValueUsage::Move ); this->visit_node_ptr(node.m_index); } void visit(::HIR::ExprNode_Deref& node) override { if( this->get_usage() == ::HIR::ValueUsage::Move && m_resolve.type_is_copy(node.span(), node.m_res_type) ) { auto _ = push_usage( ::HIR::ValueUsage::Borrow ); this->visit_node_ptr(node.m_value); } // Pointers only need a borrow to be derefernced. else if( node.m_value->m_res_type.data().is_Pointer() ) { auto _ = push_usage( ::HIR::ValueUsage::Borrow ); this->visit_node_ptr(node.m_value); } else { this->visit_node_ptr(node.m_value); } } void visit(::HIR::ExprNode_Emplace& node) override { if( node.m_type == ::HIR::ExprNode_Emplace::Type::Noop ) { if( node.m_place ) this->visit_node_ptr(node.m_place); this->visit_node_ptr(node.m_value); } else { auto _ = push_usage( ::HIR::ValueUsage::Move ); if( node.m_place ) this->visit_node_ptr(node.m_place); this->visit_node_ptr(node.m_value); } } void visit(::HIR::ExprNode_Field& node) override { bool is_copy = m_resolve.type_is_copy(node.span(), node.m_res_type); DEBUG("ty = " << node.m_res_type << ", is_copy=" << is_copy); // If taking this field by value, but the type is Copy - pretend it's a borrow. if( this->get_usage() == ::HIR::ValueUsage::Move && is_copy ) { auto _ = push_usage( ::HIR::ValueUsage::Borrow ); this->visit_node_ptr(node.m_value); } else { this->visit_node_ptr(node.m_value); } } void visit(::HIR::ExprNode_TupleVariant& node) override { auto _ = push_usage( ::HIR::ValueUsage::Move ); for( auto& val : node.m_args ) this->visit_node_ptr(val); } void visit(::HIR::ExprNode_CallPath& node) override { auto _ = push_usage( ::HIR::ValueUsage::Move ); for( auto& val : node.m_args ) this->visit_node_ptr(val); } void visit(::HIR::ExprNode_CallValue& node) override { // TODO: Different usage based on trait. ::HIR::ValueUsage vu = ::HIR::ValueUsage::Borrow; switch( node.m_trait_used ) { case ::HIR::ExprNode_CallValue::TraitUsed::Unknown: //TODO(node.span(), "Annotate usage when CallValue trait is unknown"); // - Can only happen when the callee is a closure, could do detectection of closure class in this pass? // - Assume Move for now. vu = ::HIR::ValueUsage::Move; break; case ::HIR::ExprNode_CallValue::TraitUsed::Fn: vu = ::HIR::ValueUsage::Borrow; break; case ::HIR::ExprNode_CallValue::TraitUsed::FnMut: vu = ::HIR::ValueUsage::Mutate; break; case ::HIR::ExprNode_CallValue::TraitUsed::FnOnce: vu = ::HIR::ValueUsage::Move; break; } { auto _ = push_usage( vu ); this->visit_node_ptr(node.m_value); } auto _ = push_usage( ::HIR::ValueUsage::Move ); for( auto& val : node.m_args ) this->visit_node_ptr(val); } void visit(::HIR::ExprNode_CallMethod& node) override { { assert(node.m_cache.m_fcn); ::HIR::ValueUsage vu = ::HIR::ValueUsage::Borrow; switch(node.m_cache.m_fcn->m_receiver) { case ::HIR::Function::Receiver::Free: BUG(node.span(), "_CallMethod resolved to free function"); case ::HIR::Function::Receiver::Value: case ::HIR::Function::Receiver::Box: case ::HIR::Function::Receiver::Custom: case ::HIR::Function::Receiver::BorrowOwned: vu = ::HIR::ValueUsage::Move; break; case ::HIR::Function::Receiver::BorrowUnique: vu = ::HIR::ValueUsage::Mutate; break; case ::HIR::Function::Receiver::BorrowShared: vu = ::HIR::ValueUsage::Borrow; break; //case ::HIR::Function::Receiver::PointerMut: //case ::HIR::Function::Receiver::PointerConst: } auto _ = push_usage( vu ); this->visit_node_ptr(node.m_value); } auto _ = push_usage( ::HIR::ValueUsage::Move ); for( auto& val : node.m_args ) this->visit_node_ptr(val); } void visit(::HIR::ExprNode_Literal& node) override { } void visit(::HIR::ExprNode_UnitVariant& node) override { } void visit(::HIR::ExprNode_PathValue& node) override { } void visit(::HIR::ExprNode_Variable& node) override { } void visit(::HIR::ExprNode_ConstParam& node) override { } void visit(::HIR::ExprNode_StructLiteral& node) override { const auto& sp = node.span(); const auto& ty_path = node.m_real_path; if( node.m_base_value ) { bool is_moved = false; const auto& tpb = node.m_base_value->m_res_type.data().as_Path().binding; const ::HIR::t_struct_fields* fields_ptr; if( tpb.is_Enum() ) { const auto& enm = *tpb.as_Enum(); auto idx = enm.find_variant(ty_path.m_path.m_components.back()); ASSERT_BUG(sp, idx != SIZE_MAX, ""); const auto& var_ty = enm.m_data.as_Data()[idx].type; const auto& str = *var_ty.data().as_Path().binding.as_Struct(); ASSERT_BUG(sp, str.m_data.is_Named(), ""); fields_ptr = &str.m_data.as_Named(); } else if( tpb.is_Union() ) { fields_ptr = &tpb.as_Union()->m_variants; } else { const auto& str = *tpb.as_Struct(); ASSERT_BUG(sp, str.m_data.is_Named(), ""); fields_ptr = &str.m_data.as_Named(); } const auto& fields = *fields_ptr; ::std::vector<bool> provided_mask( fields.size() ); for( const auto& fld : node.m_values ) { unsigned idx = ::std::find_if( fields.begin(), fields.end(), [&](const auto& x){ return x.first == fld.first; }) - fields.begin(); provided_mask[idx] = true; } const auto monomorph_cb = MonomorphStatePtr(nullptr, &ty_path.m_params, nullptr); for( unsigned int i = 0; i < fields.size(); i ++ ) { if( ! provided_mask[i] ) { const auto& ty_o = fields[i].second.ent; ::HIR::TypeRef tmp; const auto& ty_m = monomorphise_type_with_opt(node.span(), tmp, ty_o, monomorph_cb); bool is_copy = m_resolve.type_is_copy(node.span(), ty_m); if( !is_copy ) { DEBUG("- Field " << i << " " << fields[i].first << ": " << ty_m << " moved"); is_moved = true; } } } // If only Copy fields will be used, set usage to Borrow auto _ = push_usage( is_moved ? ::HIR::ValueUsage::Move : ::HIR::ValueUsage::Borrow ); this->visit_node_ptr(node.m_base_value); } auto _ = push_usage( ::HIR::ValueUsage::Move ); for( auto& fld_val : node.m_values ) { this->visit_node_ptr(fld_val.second); } } void visit(::HIR::ExprNode_Tuple& node) override { auto _ = push_usage( ::HIR::ValueUsage::Move ); for( auto& val : node.m_vals ) { this->visit_node_ptr(val); } } void visit(::HIR::ExprNode_ArrayList& node) override { auto _ = push_usage( ::HIR::ValueUsage::Move ); for( auto& val : node.m_vals ) { this->visit_node_ptr(val); } } void visit(::HIR::ExprNode_ArraySized& node) override { auto _ = push_usage( ::HIR::ValueUsage::Move ); this->visit_node_ptr(node.m_val); } void visit(::HIR::ExprNode_Closure& node) override { auto _ = push_usage( ::HIR::ValueUsage::Move ); this->visit_node_ptr(node.m_code); } void visit(::HIR::ExprNode_Generator& node) override { auto _ = push_usage( ::HIR::ValueUsage::Move ); this->visit_node_ptr(node.m_code); } void visit(::HIR::ExprNode_GeneratorWrapper& node) override { BUG(node.span(), ""); } private: ::HIR::ValueUsage get_usage_for_pattern_binding(const Span& sp, const ::HIR::PatternBinding& pb, const ::HIR::TypeRef& ty) const { switch( pb.m_type ) { case ::HIR::PatternBinding::Type::Move: if( m_resolve.type_is_copy(sp, ty) ) return ::HIR::ValueUsage::Borrow; else return ::HIR::ValueUsage::Move; case ::HIR::PatternBinding::Type::MutRef: return ::HIR::ValueUsage::Mutate; case ::HIR::PatternBinding::Type::Ref: return ::HIR::ValueUsage::Borrow; } throw ""; } ::HIR::ValueUsage get_usage_for_pattern(const Span& sp, const ::HIR::Pattern& pat, const ::HIR::TypeRef& outer_ty) const { if( pat.m_binding.is_valid() ) { return get_usage_for_pattern_binding(sp, pat.m_binding, outer_ty); } // Implicit derefs const ::HIR::TypeRef* typ = &outer_ty; for(size_t i = 0; i < pat.m_implicit_deref_count; i ++) { typ = &typ->data().as_Borrow().inner; } const ::HIR::TypeRef& ty = *typ; TU_MATCH_HDRA( (pat.m_data), {) TU_ARMA(Any, pe) { return ::HIR::ValueUsage::Borrow; } TU_ARMA(Box, pe) { // NOTE: Specific to `owned_box` const auto& sty = ty.data().as_Path().path.m_data.as_Generic().m_params.m_types.at(0); return get_usage_for_pattern(sp, *pe.sub, sty); } TU_ARMA(Ref, pe) { return get_usage_for_pattern(sp, *pe.sub, ty.data().as_Borrow().inner); } TU_ARMA(Tuple, pe) { ASSERT_BUG(sp, ty.data().is_Tuple(), "Tuple pattern with non-tuple type - " << ty); const auto& subtys = ty.data().as_Tuple(); assert(pe.sub_patterns.size() == subtys.size()); auto rv = ::HIR::ValueUsage::Borrow; for(unsigned int i = 0; i < subtys.size(); i ++) rv = ::std::max(rv, get_usage_for_pattern(sp, pe.sub_patterns[i], subtys[i])); return rv; } TU_ARMA(SplitTuple, pe) { ASSERT_BUG(sp, ty.data().is_Tuple(), "SplitTuple pattern with non-tuple type - " << ty); const auto& subtys = ty.data().as_Tuple(); assert(pe.leading.size() + pe.trailing.size() <= subtys.size()); auto rv = ::HIR::ValueUsage::Borrow; for(unsigned int i = 0; i < pe.leading.size(); i ++) rv = ::std::max(rv, get_usage_for_pattern(sp, pe.leading[i], subtys[i])); for(unsigned int i = 0; i < pe.trailing.size(); i ++) rv = ::std::max(rv, get_usage_for_pattern(sp, pe.trailing[i], subtys[subtys.size() - pe.trailing.size() + i])); return rv; } TU_ARMA(PathValue, pe) { return ::HIR::ValueUsage::Borrow; } TU_ARMA(PathTuple, pe) { assert(!pe.binding.is_Unbound()); const auto& flds = ::HIR::pattern_get_tuple(sp, pe.path, pe.binding); if(pe.is_split) { assert(pe.leading.size() + pe.trailing.size() <= flds.size()); } else { assert(pe.leading.size() == flds.size()); assert(pe.trailing.size() == 0); } // TODO: Is it possible to avoid monomorphising here? assert(pe.path.m_data.is_Generic()); auto monomorph_state = MonomorphStatePtr(nullptr, &pe.path.m_data.as_Generic().m_params, nullptr); auto rv = ::HIR::ValueUsage::Borrow; for(unsigned int i = 0; i < pe.leading.size(); i ++) { auto sty = monomorph_state.monomorph_type(sp, flds[i].ent); rv = ::std::max(rv, get_usage_for_pattern(sp, pe.leading[i], sty)); } for(unsigned int i = 0; i < pe.trailing.size(); i ++) { auto sty = monomorph_state.monomorph_type(sp, flds[flds.size() - pe.trailing.size() + i].ent); rv = ::std::max(rv, get_usage_for_pattern(sp, pe.trailing[i], sty)); } return rv; } TU_ARMA(PathNamed, pe) { assert(!pe.binding.is_Unbound()); if( pe.is_wildcard() ) return ::HIR::ValueUsage::Borrow; if( pe.sub_patterns.empty() ) return ::HIR::ValueUsage::Borrow; const auto& flds = ::HIR::pattern_get_named(sp, pe.path, pe.binding); auto monomorph_state = MonomorphStatePtr(nullptr, &pe.path.m_data.as_Generic().m_params, nullptr); auto rv = ::HIR::ValueUsage::Borrow; for(const auto& fld_pat : pe.sub_patterns) { auto fld_it = ::std::find_if(flds.begin(), flds.end(), [&](const auto& x){return x.first == fld_pat.first;}); ASSERT_BUG(sp, fld_it != flds.end(), "Unable to find field " << fld_pat.first); auto sty = monomorph_state.monomorph_type(sp, fld_it->second.ent); rv = ::std::max(rv, get_usage_for_pattern(sp, fld_pat.second, sty)); } return rv; } TU_ARMA(Value, pe) { return ::HIR::ValueUsage::Borrow; } TU_ARMA(Range, pe) { return ::HIR::ValueUsage::Borrow; } TU_ARMA(Slice, pe) { const auto& inner_ty = (ty.data().is_Array() ? ty.data().as_Array().inner : ty.data().as_Slice().inner); auto rv = ::HIR::ValueUsage::Borrow; for(const auto& pat : pe.sub_patterns) rv = ::std::max(rv, get_usage_for_pattern(sp, pat, inner_ty)); return rv; } TU_ARMA(SplitSlice, pe) { const auto& inner_ty = (ty.data().is_Array() ? ty.data().as_Array().inner : ty.data().as_Slice().inner); auto rv = ::HIR::ValueUsage::Borrow; for(const auto& pat : pe.leading) rv = ::std::max(rv, get_usage_for_pattern(sp, pat, inner_ty)); for(const auto& pat : pe.trailing) rv = ::std::max(rv, get_usage_for_pattern(sp, pat, inner_ty)); if( pe.extra_bind.is_valid() ) rv = ::std::max(rv, get_usage_for_pattern_binding(sp, pe.extra_bind, inner_ty)); return rv; } TU_ARMA(Or, pe) { auto rv = ::HIR::ValueUsage::Borrow; for(const auto& pat : pe) rv = ::std::max(rv, get_usage_for_pattern(sp, pat, ty)); return rv; } } throw ""; } }; class OuterVisitor: public ::HIR::Visitor { StaticTraitResolve m_resolve; public: OuterVisitor(const ::HIR::Crate& crate): m_resolve(crate) {} void visit_expr(::HIR::ExprPtr& exp) override { if( exp ) { ExprVisitor_Mark ev { m_resolve }; ev.visit_root( exp ); } } // ------ // Code-containing items // ------ void visit_function(::HIR::ItemPath p, ::HIR::Function& item) override { auto _ = this->m_resolve.set_item_generics(item.m_params); DEBUG("Function " << p); ::HIR::Visitor::visit_function(p, item); } void visit_static(::HIR::ItemPath p, ::HIR::Static& item) override { // NOTE: No generics ::HIR::Visitor::visit_static(p, item); } void visit_constant(::HIR::ItemPath p, ::HIR::Constant& item) override { // NOTE: No generics ::HIR::Visitor::visit_constant(p, item); } void visit_enum(::HIR::ItemPath p, ::HIR::Enum& item) override { auto _ = this->m_resolve.set_item_generics(item.m_params); ::HIR::Visitor::visit_enum(p, item); } void visit_trait(::HIR::ItemPath p, ::HIR::Trait& item) override { auto _ = this->m_resolve.set_impl_generics(item.m_params); ::HIR::Visitor::visit_trait(p, item); } void visit_type_impl(::HIR::TypeImpl& impl) override { TRACE_FUNCTION_F("impl " << impl.m_type); auto _ = this->m_resolve.set_impl_generics(impl.m_params); ::HIR::Visitor::visit_type_impl(impl); } void visit_trait_impl(const ::HIR::SimplePath& trait_path, ::HIR::TraitImpl& impl) override { TRACE_FUNCTION_F("impl " << trait_path << " for " << impl.m_type); auto _ = this->m_resolve.set_impl_generics(impl.m_params); ::HIR::Visitor::visit_trait_impl(trait_path, impl); } }; } void HIR_Expand_AnnotateUsage_Expr(const ::HIR::Crate& crate, ::HIR::ExprPtr& exp) { assert(exp); StaticTraitResolve resolve { crate }; if(exp.m_state->m_impl_generics) resolve.set_impl_generics(*exp.m_state->m_impl_generics); if(exp.m_state->m_item_generics) resolve.set_item_generics(*exp.m_state->m_item_generics); ExprVisitor_Mark ev { resolve }; ev.visit_root(exp); } void HIR_Expand_AnnotateUsage(::HIR::Crate& crate) { OuterVisitor ov(crate); ov.visit_crate( crate ); }
; Copyright © 2018, VideoLAN and dav1d authors ; Copyright © 2018, Two Orioles, LLC ; Copyright © 2018, VideoLabs ; All rights reserved. ; ; Redistribution and use in source and binary forms, with or without ; modification, are permitted provided that the following conditions are met: ; ; 1. Redistributions of source code must retain the above copyright notice, this ; list of conditions and the following disclaimer. ; ; 2. Redistributions in binary form must reproduce the above copyright notice, ; this list of conditions and the following disclaimer in the documentation ; and/or other materials provided with the distribution. ; ; 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 "config.asm" %include "ext/x86/x86inc.asm" SECTION_RODATA 16 ; dav1d_obmc_masks[] with 64-x interleaved obmc_masks: db 0, 0, 0, 0 ; 2 @4 db 45, 19, 64, 0 ; 4 @8 db 39, 25, 50, 14, 59, 5, 64, 0 ; 8 @16 db 36, 28, 42, 22, 48, 16, 53, 11, 57, 7, 61, 3, 64, 0, 64, 0 ; 16 @32 db 34, 30, 37, 27, 40, 24, 43, 21, 46, 18, 49, 15, 52, 12, 54, 10 db 56, 8, 58, 6, 60, 4, 61, 3, 64, 0, 64, 0, 64, 0, 64, 0 ; 32 @64 db 33, 31, 35, 29, 36, 28, 38, 26, 40, 24, 41, 23, 43, 21, 44, 20 db 45, 19, 47, 17, 48, 16, 50, 14, 51, 13, 52, 12, 53, 11, 55, 9 db 56, 8, 57, 7, 58, 6, 59, 5, 60, 4, 60, 4, 61, 3, 62, 2 db 64, 0, 64, 0, 64, 0, 64, 0, 64, 0, 64, 0, 64, 0, 64, 0 subpel_h_shuf4: db 0, 1, 2, 3, 1, 2, 3, 4, 8, 9, 10, 11, 9, 10, 11, 12 db 2, 3, 4, 5, 3, 4, 5, 6, 10, 11, 12, 13, 11, 12, 13, 14 subpel_h_shufA: db 0, 1, 2, 3, 1, 2, 3, 4, 2, 3, 4, 5, 3, 4, 5, 6 subpel_h_shufB: db 4, 5, 6, 7, 5, 6, 7, 8, 6, 7, 8, 9, 7, 8, 9, 10 subpel_h_shufC: db 8, 9, 10, 11, 9, 10, 11, 12, 10, 11, 12, 13, 11, 12, 13, 14 bilin_h_shuf4: db 1, 0, 2, 1, 3, 2, 4, 3, 9, 8, 10, 9, 11, 10, 12, 11 bilin_h_shuf8: db 1, 0, 2, 1, 3, 2, 4, 3, 5, 4, 6, 5, 7, 6, 8, 7 blend_shuf: db 0, 1, 0, 1, 0, 1, 0, 1, 2, 3, 2, 3, 2, 3, 2, 3 pb_64: times 16 db 64 pw_8: times 8 dw 8 pw_26: times 8 dw 26 pw_34: times 8 dw 34 pw_512: times 8 dw 512 pw_1024: times 8 dw 1024 pw_2048: times 8 dw 2048 pw_6903: times 8 dw 6903 pw_8192: times 8 dw 8192 pd_32: times 4 dd 32 pd_512: times 4 dd 512 pw_258: times 2 dw 258 cextern mc_subpel_filters %define subpel_filters (mangle(private_prefix %+ _mc_subpel_filters)-8) %macro BIDIR_JMP_TABLE 1-* ;evaluated at definition time (in loop below) %xdefine %1_table (%%table - 2*%2) %xdefine %%base %1_table %xdefine %%prefix mangle(private_prefix %+ _%1) ; dynamically generated label %%table: %rep %0 - 1 ; repeat for num args dd %%prefix %+ .w%2 - %%base %rotate 1 %endrep %endmacro BIDIR_JMP_TABLE avg_ssse3, 4, 8, 16, 32, 64, 128 BIDIR_JMP_TABLE w_avg_ssse3, 4, 8, 16, 32, 64, 128 BIDIR_JMP_TABLE mask_ssse3, 4, 8, 16, 32, 64, 128 BIDIR_JMP_TABLE w_mask_420_ssse3, 4, 8, 16, 16, 16, 16 BIDIR_JMP_TABLE blend_ssse3, 4, 8, 16, 32 BIDIR_JMP_TABLE blend_v_ssse3, 2, 4, 8, 16, 32 BIDIR_JMP_TABLE blend_h_ssse3, 2, 4, 8, 16, 16, 16, 16 %macro BASE_JMP_TABLE 3-* %xdefine %1_%2_table (%%table - %3) %xdefine %%base %1_%2 %%table: %rep %0 - 2 dw %%base %+ _w%3 - %%base %rotate 1 %endrep %endmacro %xdefine put_ssse3 mangle(private_prefix %+ _put_bilin_ssse3.put) %xdefine prep_ssse3 mangle(private_prefix %+ _prep_bilin_ssse3.prep) BASE_JMP_TABLE put, ssse3, 2, 4, 8, 16, 32, 64, 128 BASE_JMP_TABLE prep, ssse3, 4, 8, 16, 32, 64, 128 %macro HV_JMP_TABLE 5-* %xdefine %%prefix mangle(private_prefix %+ _%1_%2_%3) %xdefine %%base %1_%3 %assign %%types %4 %if %%types & 1 %xdefine %1_%2_h_%3_table (%%h - %5) %%h: %rep %0 - 4 dw %%prefix %+ .h_w%5 - %%base %rotate 1 %endrep %rotate 4 %endif %if %%types & 2 %xdefine %1_%2_v_%3_table (%%v - %5) %%v: %rep %0 - 4 dw %%prefix %+ .v_w%5 - %%base %rotate 1 %endrep %rotate 4 %endif %if %%types & 4 %xdefine %1_%2_hv_%3_table (%%hv - %5) %%hv: %rep %0 - 4 dw %%prefix %+ .hv_w%5 - %%base %rotate 1 %endrep %endif %endmacro HV_JMP_TABLE put, 8tap, ssse3, 3, 2, 4, 8, 16, 32, 64, 128 HV_JMP_TABLE prep, 8tap, ssse3, 1, 4, 8, 16, 32, 64, 128 HV_JMP_TABLE put, bilin, ssse3, 7, 2, 4, 8, 16, 32, 64, 128 HV_JMP_TABLE prep, bilin, ssse3, 7, 4, 8, 16, 32, 64, 128 %define table_offset(type, fn) type %+ fn %+ SUFFIX %+ _table - type %+ SUFFIX SECTION .text INIT_XMM ssse3 %if ARCH_X86_32 DECLARE_REG_TMP 1 %define base t0-put_ssse3 %else DECLARE_REG_TMP 7 %define base 0 %endif ; %macro RESTORE_DSQ_32 1 %if ARCH_X86_32 mov %1, dsm ; restore dsq %endif %endmacro ; cglobal put_bilin, 4, 8, 0, dst, ds, src, ss, w, h, mxy, bak movifnidn mxyd, r6m ; mx LEA t0, put_ssse3 tzcnt wd, wm mov hd, hm test mxyd, mxyd jnz .h mov mxyd, r7m ; my test mxyd, mxyd jnz .v .put: movzx wd, word [t0+wq*2+table_offset(put,)] add wq, t0 lea r6, [ssq*3] RESTORE_DSQ_32 t0 jmp wq .put_w2: movzx r4d, word [srcq+ssq*0] movzx r6d, word [srcq+ssq*1] lea srcq, [srcq+ssq*2] mov [dstq+dsq*0], r4w mov [dstq+dsq*1], r6w lea dstq, [dstq+dsq*2] sub hd, 2 jg .put_w2 RET .put_w4: mov r4d, [srcq+ssq*0] mov r6d, [srcq+ssq*1] lea srcq, [srcq+ssq*2] mov [dstq+dsq*0], r4d mov [dstq+dsq*1], r6d lea dstq, [dstq+dsq*2] sub hd, 2 jg .put_w4 RET .put_w8: movq m0, [srcq+ssq*0] movq m1, [srcq+ssq*1] lea srcq, [srcq+ssq*2] movq [dstq+dsq*0], m0 movq [dstq+dsq*1], m1 lea dstq, [dstq+dsq*2] sub hd, 2 jg .put_w8 RET .put_w16: lea r4, [dsq*3] .put_w16_in: movu m0, [srcq+ssq*0] movu m1, [srcq+ssq*1] movu m2, [srcq+ssq*2] movu m3, [srcq+r6 ] lea srcq, [srcq+ssq*4] mova [dstq+dsq*0], m0 mova [dstq+dsq*1], m1 mova [dstq+dsq*2], m2 mova [dstq+r4 ], m3 lea dstq, [dstq+dsq*4] sub hd, 4 jg .put_w16_in RET .put_w32: movu m0, [srcq+ssq*0+16*0] movu m1, [srcq+ssq*0+16*1] movu m2, [srcq+ssq*1+16*0] movu m3, [srcq+ssq*1+16*1] lea srcq, [srcq+ssq*2] mova [dstq+dsq*0+16*0], m0 mova [dstq+dsq*0+16*1], m1 mova [dstq+dsq*1+16*0], m2 mova [dstq+dsq*1+16*1], m3 lea dstq, [dstq+dsq*2] sub hd, 2 jg .put_w32 RET .put_w64: movu m0, [srcq+16*0] movu m1, [srcq+16*1] movu m2, [srcq+16*2] movu m3, [srcq+16*3] add srcq, ssq mova [dstq+16*0], m0 mova [dstq+16*1], m1 mova [dstq+16*2], m2 mova [dstq+16*3], m3 add dstq, dsq dec hd jg .put_w64 RET .put_w128: movu m0, [srcq+16*0] movu m1, [srcq+16*1] movu m2, [srcq+16*2] movu m3, [srcq+16*3] mova [dstq+16*0], m0 mova [dstq+16*1], m1 mova [dstq+16*2], m2 mova [dstq+16*3], m3 movu m0, [srcq+16*4] movu m1, [srcq+16*5] movu m2, [srcq+16*6] movu m3, [srcq+16*7] mova [dstq+16*4], m0 mova [dstq+16*5], m1 mova [dstq+16*6], m2 mova [dstq+16*7], m3 add srcq, ssq add dstq, dsq dec hd jg .put_w128 RET .h: ; (16 * src[x] + (mx * (src[x + 1] - src[x])) + 8) >> 4 ; = ((16 - mx) * src[x] + mx * src[x + 1] + 8) >> 4 imul mxyd, 0xff01 mova m4, [base+bilin_h_shuf8] mova m0, [base+bilin_h_shuf4] add mxyd, 16 << 8 movd m5, mxyd mov mxyd, r7m ; my pshuflw m5, m5, q0000 punpcklqdq m5, m5 test mxyd, mxyd jnz .hv movzx wd, word [t0+wq*2+table_offset(put, _bilin_h)] mova m3, [base+pw_2048] add wq, t0 RESTORE_DSQ_32 t0 jmp wq .h_w2: pshufd m4, m4, q3120 ; m4 = {1, 0, 2, 1, 5, 4, 6, 5} .h_w2_loop: movd m0, [srcq+ssq*0] movd m1, [srcq+ssq*1] lea srcq, [srcq+ssq*2] punpckldq m0, m1 pshufb m0, m4 pmaddubsw m0, m5 pmulhrsw m0, m3 packuswb m0, m0 movd r6d, m0 mov [dstq+dsq*0], r6w shr r6d, 16 mov [dstq+dsq*1], r6w lea dstq, [dstq+dsq*2] sub hd, 2 jg .h_w2_loop RET .h_w4: movq m4, [srcq+ssq*0] movhps m4, [srcq+ssq*1] lea srcq, [srcq+ssq*2] pshufb m4, m0 pmaddubsw m4, m5 pmulhrsw m4, m3 packuswb m4, m4 movd [dstq+dsq*0], m4 psrlq m4, 32 movd [dstq+dsq*1], m4 lea dstq, [dstq+dsq*2] sub hd, 2 jg .h_w4 RET .h_w8: movu m0, [srcq+ssq*0] movu m1, [srcq+ssq*1] lea srcq, [srcq+ssq*2] pshufb m0, m4 pshufb m1, m4 pmaddubsw m0, m5 pmaddubsw m1, m5 pmulhrsw m0, m3 pmulhrsw m1, m3 packuswb m0, m1 movq [dstq+dsq*0], m0 movhps [dstq+dsq*1], m0 lea dstq, [dstq+dsq*2] sub hd, 2 jg .h_w8 RET .h_w16: movu m0, [srcq+8*0] movu m1, [srcq+8*1] add srcq, ssq pshufb m0, m4 pshufb m1, m4 pmaddubsw m0, m5 pmaddubsw m1, m5 pmulhrsw m0, m3 pmulhrsw m1, m3 packuswb m0, m1 mova [dstq], m0 add dstq, dsq dec hd jg .h_w16 RET .h_w32: movu m0, [srcq+mmsize*0+8*0] movu m1, [srcq+mmsize*0+8*1] pshufb m0, m4 pshufb m1, m4 pmaddubsw m0, m5 pmaddubsw m1, m5 pmulhrsw m0, m3 pmulhrsw m1, m3 packuswb m0, m1 movu m1, [srcq+mmsize*1+8*0] movu m2, [srcq+mmsize*1+8*1] add srcq, ssq pshufb m1, m4 pshufb m2, m4 pmaddubsw m1, m5 pmaddubsw m2, m5 pmulhrsw m1, m3 pmulhrsw m2, m3 packuswb m1, m2 mova [dstq+16*0], m0 mova [dstq+16*1], m1 add dstq, dsq dec hd jg .h_w32 RET .h_w64: mov r6, -16*3 .h_w64_loop: movu m0, [srcq+r6+16*3+8*0] movu m1, [srcq+r6+16*3+8*1] pshufb m0, m4 pshufb m1, m4 pmaddubsw m0, m5 pmaddubsw m1, m5 pmulhrsw m0, m3 pmulhrsw m1, m3 packuswb m0, m1 mova [dstq+r6+16*3], m0 add r6, 16 jle .h_w64_loop add srcq, ssq add dstq, dsq dec hd jg .h_w64 RET .h_w128: mov r6, -16*7 .h_w128_loop: movu m0, [srcq+r6+16*7+8*0] movu m1, [srcq+r6+16*7+8*1] pshufb m0, m4 pshufb m1, m4 pmaddubsw m0, m5 pmaddubsw m1, m5 pmulhrsw m0, m3 pmulhrsw m1, m3 packuswb m0, m1 mova [dstq+r6+16*7], m0 add r6, 16 jle .h_w128_loop add srcq, ssq add dstq, dsq dec hd jg .h_w128 RET .v: movzx wd, word [t0+wq*2+table_offset(put, _bilin_v)] imul mxyd, 0xff01 mova m5, [base+pw_2048] add mxyd, 16 << 8 add wq, t0 movd m4, mxyd pshuflw m4, m4, q0000 punpcklqdq m4, m4 RESTORE_DSQ_32 t0 jmp wq .v_w2: movd m0, [srcq+ssq*0] .v_w2_loop: pinsrw m0, [srcq+ssq*1], 1 ; 0 1 lea srcq, [srcq+ssq*2] pshuflw m2, m0, q2301 pinsrw m0, [srcq+ssq*0], 0 ; 2 1 punpcklbw m1, m0, m2 pmaddubsw m1, m4 pmulhrsw m1, m5 packuswb m1, m1 movd r6d, m1 mov [dstq+dsq*1], r6w shr r6d, 16 mov [dstq+dsq*0], r6w lea dstq, [dstq+dsq*2] sub hd, 2 jg .v_w2_loop RET .v_w4: movd m0, [srcq+ssq*0] .v_w4_loop: movd m1, [srcq+ssq*1] lea srcq, [srcq+ssq*2] punpckldq m2, m0, m1 ; 0 1 movd m0, [srcq+ssq*0] punpckldq m1, m0 ; 1 2 punpcklbw m1, m2 pmaddubsw m1, m4 pmulhrsw m1, m5 packuswb m1, m1 movd [dstq+dsq*0], m1 psrlq m1, 32 movd [dstq+dsq*1], m1 ; lea dstq, [dstq+dsq*2] sub hd, 2 jg .v_w4_loop RET .v_w8: movq m0, [srcq+ssq*0] .v_w8_loop: movq m3, [srcq+ssq*1] lea srcq, [srcq+ssq*2] punpcklbw m1, m3, m0 movq m0, [srcq+ssq*0] punpcklbw m2, m0, m3 pmaddubsw m1, m4 pmaddubsw m2, m4 pmulhrsw m1, m5 pmulhrsw m2, m5 packuswb m1, m2 movq [dstq+dsq*0], m1 movhps [dstq+dsq*1], m1 lea dstq, [dstq+dsq*2] sub hd, 2 jg .v_w8_loop RET ; %macro PUT_BILIN_V_W16 0 movu m0, [srcq+ssq*0] %%loop: movu m3, [srcq+ssq*1] lea srcq, [srcq+ssq*2] punpcklbw m1, m3, m0 punpckhbw m2, m3, m0 movu m0, [srcq+ssq*0] pmaddubsw m1, m4 pmaddubsw m2, m4 pmulhrsw m1, m5 pmulhrsw m2, m5 packuswb m1, m2 mova [dstq+dsq*0], m1 punpcklbw m1, m0, m3 punpckhbw m2, m0, m3 pmaddubsw m1, m4 pmaddubsw m2, m4 pmulhrsw m1, m5 pmulhrsw m2, m5 packuswb m1, m2 mova [dstq+dsq*1], m1 lea dstq, [dstq+dsq*2] sub hd, 2 jg %%loop %endmacro ; .v_w16: PUT_BILIN_V_W16 RET .v_w16gt: mov r4, dstq mov r6, srcq .v_w16gt_loop: %if ARCH_X86_32 mov bakm, t0q RESTORE_DSQ_32 t0 PUT_BILIN_V_W16 mov t0q, bakm %else PUT_BILIN_V_W16 %endif mov hw, t0w add r4, mmsize add r6, mmsize mov dstq, r4 mov srcq, r6 sub t0d, 1<<16 jg .v_w16gt RET .v_w32: lea t0d, [hq+(1<<16)] jmp .v_w16gt .v_w64: lea t0d, [hq+(3<<16)] jmp .v_w16gt .v_w128: lea t0d, [hq+(7<<16)] jmp .v_w16gt .hv: ; (16 * src[x] + (my * (src[x + src_stride] - src[x])) + 128) >> 8 ; = (src[x] + ((my * (src[x + src_stride] - src[x])) >> 4) + 8) >> 4 movzx wd, word [t0+wq*2+table_offset(put, _bilin_hv)] WIN64_SPILL_XMM 8 shl mxyd, 11 ; can't shift by 12 due to signed overflow mova m7, [base+pw_2048] movd m6, mxyd add wq, t0 pshuflw m6, m6, q0000 punpcklqdq m6, m6 jmp wq .hv_w2: RESTORE_DSQ_32 t0 movd m0, [srcq+ssq*0] pshufd m0, m0, q0000 ; src[x - src_stride] pshufb m0, m4 pmaddubsw m0, m5 .hv_w2_loop: movd m1, [srcq+ssq*1] ; src[x] lea srcq, [srcq+ssq*2] movhps m1, [srcq+ssq*0] ; src[x + src_stride] pshufd m1, m1, q3120 pshufb m1, m4 pmaddubsw m1, m5 ; 1 _ 2 _ shufps m2, m0, m1, q1032 ; 0 _ 1 _ mova m0, m1 psubw m1, m2 ; src[x + src_stride] - src[x] paddw m1, m1 pmulhw m1, m6 ; (my * (src[x + src_stride] - src[x]) paddw m1, m2 ; src[x] + (my * (src[x + src_stride] - src[x]) pmulhrsw m1, m7 packuswb m1, m1 %if ARCH_X86_64 movq r6, m1 %else pshuflw m1, m1, q2020 movd r6d, m1 %endif mov [dstq+dsq*0], r6w shr r6, gprsize*4 mov [dstq+dsq*1], r6w lea dstq, [dstq+dsq*2] sub hd, 2 jg .hv_w2_loop RET .hv_w4: mova m4, [base+bilin_h_shuf4] RESTORE_DSQ_32 t0 movddup xm0, [srcq+ssq*0] pshufb m0, m4 pmaddubsw m0, m5 .hv_w4_loop: movq m1, [srcq+ssq*1] lea srcq, [srcq+ssq*2] movhps m1, [srcq+ssq*0] pshufb m1, m4 pmaddubsw m1, m5 ; 1 2 shufps m2, m0, m1, q1032 ; 0 1 mova m0, m1 psubw m1, m2 paddw m1, m1 pmulhw m1, m6 paddw m1, m2 pmulhrsw m1, m7 packuswb m1, m1 movd [dstq+dsq*0], m1 psrlq m1, 32 movd [dstq+dsq*1], m1 lea dstq, [dstq+dsq*2] sub hd, 2 jg .hv_w4_loop RET .hv_w8: RESTORE_DSQ_32 t0 movu m0, [srcq+ssq*0+8*0] pshufb m0, m4 pmaddubsw m0, m5 .hv_w8_loop: movu m2, [srcq+ssq*1+8*0] lea srcq, [srcq+ssq*2] pshufb m2, m4 pmaddubsw m2, m5 psubw m1, m2, m0 paddw m1, m1 pmulhw m1, m6 paddw m1, m0 movu m0, [srcq+ssq*0+8*0] pshufb m0, m4 pmaddubsw m0, m5 psubw m3, m0, m2 paddw m3, m3 pmulhw m3, m6 paddw m3, m2 pmulhrsw m1, m7 pmulhrsw m3, m7 packuswb m1, m3 movq [dstq+dsq*0], m1 movhps [dstq+dsq*1], m1 lea dstq, [dstq+dsq*2] sub hd, 2 jg .hv_w8_loop RET .hv_w16: xor t0d, t0d .hv_w16gt: mov r4, dstq mov r6, srcq %if WIN64 movaps r4m, xmm8 %endif .hv_w16_loop0: movu m0, [srcq+8*0] movu m1, [srcq+8*1] pshufb m0, m4 pshufb m1, m4 pmaddubsw m0, m5 pmaddubsw m1, m5 .hv_w16_loop: %if ARCH_X86_32 %define m0tmp [dstq] %else %define m0tmp m8 %endif add srcq, ssq movu m2, [srcq+8*0] movu m3, [srcq+8*1] pshufb m2, m4 pshufb m3, m4 pmaddubsw m2, m5 pmaddubsw m3, m5 mova m0tmp, m2 psubw m2, m0 paddw m2, m2 pmulhw m2, m6 paddw m2, m0 mova m0, m3 psubw m3, m1 paddw m3, m3 pmulhw m3, m6 paddw m3, m1 mova m1, m0 mova m0, m0tmp pmulhrsw m2, m7 pmulhrsw m3, m7 packuswb m2, m3 mova [dstq], m2 add dstq, dsmp dec hd jg .hv_w16_loop movzx hd, t0w add r4, mmsize add r6, mmsize mov dstq, r4 mov srcq, r6 sub t0d, 1<<16 jg .hv_w16_loop0 %if WIN64 movaps xmm8, r4m %endif RET .hv_w32: lea t0d, [hq+(1<<16)] jmp .hv_w16gt .hv_w64: lea t0d, [hq+(3<<16)] jmp .hv_w16gt .hv_w128: lea t0d, [hq+(7<<16)] jmp .hv_w16gt DECLARE_REG_TMP 3, 5, 6 %if ARCH_X86_32 %define base t2-prep_ssse3 %else %define base 0 %endif cglobal prep_bilin, 3, 7, 0, tmp, src, stride, w, h, mxy, stride3 movifnidn mxyd, r5m ; mx LEA t2, prep_ssse3 tzcnt wd, wm movifnidn hd, hm test mxyd, mxyd jnz .h mov mxyd, r6m ; my test mxyd, mxyd jnz .v .prep: movzx wd, word [t2+wq*2+table_offset(prep,)] add wq, t2 lea stride3q, [strideq*3] jmp wq .prep_w4: movd m0, [srcq+strideq*0] movd m1, [srcq+strideq*1] movd m2, [srcq+strideq*2] movd m3, [srcq+stride3q ] punpckldq m0, m1 punpckldq m2, m3 lea srcq, [srcq+strideq*4] pxor m1, m1 punpcklbw m0, m1 punpcklbw m2, m1 psllw m0, 4 psllw m2, 4 mova [tmpq+mmsize*0], m0 mova [tmpq+mmsize*1], m2 add tmpq, 32 sub hd, 4 jg .prep_w4 RET .prep_w8: movq m0, [srcq+strideq*0] movq m1, [srcq+strideq*1] movq m2, [srcq+strideq*2] movq m3, [srcq+stride3q ] lea srcq, [srcq+strideq*4] pxor m4, m4 punpcklbw m0, m4 punpcklbw m1, m4 punpcklbw m2, m4 punpcklbw m3, m4 psllw m0, 4 psllw m1, 4 psllw m2, 4 psllw m3, 4 mova [tmpq+16*0], m0 mova [tmpq+16*1], m1 mova [tmpq+16*2], m2 mova [tmpq+16*3], m3 add tmpq, 16*4 sub hd, 4 jg .prep_w8 RET .prep_w16: movq m0, [srcq+strideq*0+8*0] movq m1, [srcq+strideq*0+8*1] movq m2, [srcq+strideq*1+8*0] movq m3, [srcq+strideq*1+8*1] lea srcq, [srcq+strideq*2] pxor m4, m4 punpcklbw m0, m4 punpcklbw m1, m4 punpcklbw m2, m4 punpcklbw m3, m4 psllw m0, 4 psllw m1, 4 psllw m2, 4 psllw m3, 4 mova [tmpq+16*0], m0 mova [tmpq+16*1], m1 mova [tmpq+16*2], m2 mova [tmpq+16*3], m3 add tmpq, 16*4 sub hd, 2 jg .prep_w16 RET .prep_w16gt: mov t1q, srcq mov r3q, t2q .prep_w16gt_hloop: movq m0, [t1q+8*0] movq m1, [t1q+8*1] movq m2, [t1q+8*2] movq m3, [t1q+8*3] pxor m4, m4 punpcklbw m0, m4 punpcklbw m1, m4 punpcklbw m2, m4 punpcklbw m3, m4 psllw m0, 4 psllw m1, 4 psllw m2, 4 psllw m3, 4 mova [tmpq+16*0], m0 mova [tmpq+16*1], m1 mova [tmpq+16*2], m2 mova [tmpq+16*3], m3 add tmpq, 16*4 add t1q, 32 sub r3q, 1 jg .prep_w16gt_hloop lea srcq, [srcq+strideq] sub hd, 1 jg .prep_w16gt RET .prep_w32: mov t2q, 1 jmp .prep_w16gt .prep_w64: mov t2q, 2 jmp .prep_w16gt .prep_w128: mov t2q, 4 jmp .prep_w16gt .h: ; 16 * src[x] + (mx * (src[x + 1] - src[x])) ; = (16 - mx) * src[x] + mx * src[x + 1] imul mxyd, 0xff01 mova m4, [base+bilin_h_shuf8] add mxyd, 16 << 8 movd xm5, mxyd mov mxyd, r6m ; my pshuflw m5, m5, q0000 punpcklqdq m5, m5 test mxyd, mxyd jnz .hv %if ARCH_X86_32 mov t1, t2 ; save base reg for w4 %endif movzx wd, word [t2+wq*2+table_offset(prep, _bilin_h)] add wq, t2 lea stride3q, [strideq*3] jmp wq .h_w4: %if ARCH_X86_32 mova m4, [t1-prep_ssse3+bilin_h_shuf4] %else mova m4, [bilin_h_shuf4] %endif .h_w4_loop: movq m0, [srcq+strideq*0] movhps m0, [srcq+strideq*1] movq m1, [srcq+strideq*2] movhps m1, [srcq+stride3q ] lea srcq, [srcq+strideq*4] pshufb m0, m4 pmaddubsw m0, m5 pshufb m1, m4 pmaddubsw m1, m5 mova [tmpq+0 ], m0 mova [tmpq+16], m1 add tmpq, 32 sub hd, 4 jg .h_w4_loop RET .h_w8: movu m0, [srcq+strideq*0] movu m1, [srcq+strideq*1] movu m2, [srcq+strideq*2] movu m3, [srcq+stride3q ] lea srcq, [srcq+strideq*4] pshufb m0, m4 pshufb m1, m4 pshufb m2, m4 pshufb m3, m4 pmaddubsw m0, m5 pmaddubsw m1, m5 pmaddubsw m2, m5 pmaddubsw m3, m5 mova [tmpq+16*0], m0 mova [tmpq+16*1], m1 mova [tmpq+16*2], m2 mova [tmpq+16*3], m3 add tmpq, 16*4 sub hd, 4 jg .h_w8 RET .h_w16: movu m0, [srcq+strideq*0+8*0] movu m1, [srcq+strideq*0+8*1] movu m2, [srcq+strideq*1+8*0] movu m3, [srcq+strideq*1+8*1] lea srcq, [srcq+strideq*2] pshufb m0, m4 pshufb m1, m4 pshufb m2, m4 pshufb m3, m4 pmaddubsw m0, m5 pmaddubsw m1, m5 pmaddubsw m2, m5 pmaddubsw m3, m5 mova [tmpq+16*0], m0 mova [tmpq+16*1], m1 mova [tmpq+16*2], m2 mova [tmpq+16*3], m3 add tmpq, 16*4 sub hd, 2 jg .h_w16 RET .h_w16gt: mov t1q, srcq mov r3q, t2q .h_w16gt_hloop: movu m0, [t1q+8*0] movu m1, [t1q+8*1] movu m2, [t1q+8*2] movu m3, [t1q+8*3] pshufb m0, m4 pshufb m1, m4 pshufb m2, m4 pshufb m3, m4 pmaddubsw m0, m5 pmaddubsw m1, m5 pmaddubsw m2, m5 pmaddubsw m3, m5 mova [tmpq+16*0], m0 mova [tmpq+16*1], m1 mova [tmpq+16*2], m2 mova [tmpq+16*3], m3 add tmpq, 16*4 add t1q, 32 sub r3q, 1 jg .h_w16gt_hloop lea srcq, [srcq+strideq] sub hd, 1 jg .h_w16gt RET .h_w32: mov t2q, 1 jmp .h_w16gt .h_w64: mov t2q, 2 jmp .h_w16gt .h_w128: mov t2q, 4 jmp .h_w16gt .v: movzx wd, word [t2+wq*2+table_offset(prep, _bilin_v)] imul mxyd, 0xff01 add mxyd, 16 << 8 add wq, t2 lea stride3q, [strideq*3] movd m5, mxyd pshuflw m5, m5, q0000 punpcklqdq m5, m5 jmp wq .v_w4: movd m0, [srcq+strideq*0] .v_w4_loop: movd m1, [srcq+strideq*1] movd m2, [srcq+strideq*2] movd m3, [srcq+stride3q ] lea srcq, [srcq+strideq*4] punpcklwd m0, m1 ; 0 1 _ _ punpcklwd m1, m2 ; 1 2 _ _ punpcklbw m1, m0 pmaddubsw m1, m5 pshufd m1, m1, q3120 mova [tmpq+16*0], m1 movd m0, [srcq+strideq*0] punpcklwd m2, m3 ; 2 3 _ _ punpcklwd m3, m0 ; 3 4 _ _ punpcklbw m3, m2 pmaddubsw m3, m5 pshufd m3, m3, q3120 mova [tmpq+16*1], m3 add tmpq, 32 sub hd, 4 jg .v_w4_loop RET .v_w8: movq m0, [srcq+strideq*0] .v_w8_loop: movq m1, [srcq+strideq*2] movq m2, [srcq+strideq*1] movq m3, [srcq+stride3q ] lea srcq, [srcq+strideq*4] shufpd m4, m0, m1, 0x0c ; 0 2 movq m0, [srcq+strideq*0] shufpd m2, m3, 0x0c ; 1 3 shufpd m1, m0, 0x0c ; 2 4 punpcklbw m3, m2, m4 pmaddubsw m3, m5 mova [tmpq+16*0], m3 punpckhbw m3, m2, m4 pmaddubsw m3, m5 mova [tmpq+16*2], m3 punpcklbw m3, m1, m2 punpckhbw m1, m2 pmaddubsw m3, m5 pmaddubsw m1, m5 mova [tmpq+16*1], m3 mova [tmpq+16*3], m1 add tmpq, 16*4 sub hd, 4 jg .v_w8_loop RET .v_w16: movu m0, [srcq+strideq*0] .v_w16_loop: movu m1, [srcq+strideq*1] movu m2, [srcq+strideq*2] punpcklbw m3, m1, m0 punpckhbw m4, m1, m0 pmaddubsw m3, m5 pmaddubsw m4, m5 mova [tmpq+16*0], m3 mova [tmpq+16*1], m4 punpcklbw m3, m2, m1 punpckhbw m4, m2, m1 pmaddubsw m3, m5 pmaddubsw m4, m5 mova [tmpq+16*2], m3 mova [tmpq+16*3], m4 movu m3, [srcq+stride3q ] lea srcq, [srcq+strideq*4] movu m0, [srcq+strideq*0] add tmpq, 16*8 punpcklbw m1, m3, m2 punpckhbw m4, m3, m2 pmaddubsw m1, m5 pmaddubsw m4, m5 mova [tmpq-16*4], m1 mova [tmpq-16*3], m4 punpcklbw m1, m0, m3 punpckhbw m2, m0, m3 pmaddubsw m1, m5 pmaddubsw m2, m5 mova [tmpq-16*2], m1 mova [tmpq-16*1], m2 sub hd, 4 jg .v_w16_loop RET .v_w32: lea t2d, [hq+(0<<16)] mov t0d, 64 .v_w32_start: %if ARCH_X86_64 %if WIN64 PUSH r7 %endif mov r7, tmpq %endif mov t1, srcq .v_w32_loop_h: movu m0, [srcq+strideq*0+16*0] ; 0L movu m1, [srcq+strideq*0+16*1] ; 0U .v_w32_loop_v: movu m2, [srcq+strideq*1+16*0] ; 1L movu m3, [srcq+strideq*1+16*1] ; 1U lea srcq, [srcq+strideq*2] punpcklbw m4, m2, m0 pmaddubsw m4, m5 mova [tmpq+16*0], m4 punpckhbw m4, m2, m0 pmaddubsw m4, m5 mova [tmpq+16*1], m4 punpcklbw m4, m3, m1 pmaddubsw m4, m5 mova [tmpq+16*2], m4 punpckhbw m4, m3, m1 pmaddubsw m4, m5 mova [tmpq+16*3], m4 add tmpq, t0q movu m0, [srcq+strideq*0+16*0] ; 2L movu m1, [srcq+strideq*0+16*1] ; 2U punpcklbw m4, m0, m2 pmaddubsw m4, m5 mova [tmpq+16*0], m4 punpckhbw m4, m0, m2 pmaddubsw m4, m5 mova [tmpq+16*1], m4 punpcklbw m4, m1, m3 pmaddubsw m4, m5 mova [tmpq+16*2], m4 punpckhbw m4, m1, m3 pmaddubsw m4, m5 mova [tmpq+16*3], m4 add tmpq, t0q sub hd, 2 jg .v_w32_loop_v movzx hd, t2w add t1, 32 mov srcq, t1 %if ARCH_X86_64 add r7, 2*16*2 mov tmpq, r7 %else mov tmpq, tmpmp add tmpq, 2*16*2 mov tmpmp, tmpq %endif sub t2d, 1<<16 jg .v_w32_loop_h %if WIN64 POP r7 %endif RET .v_w64: lea t2d, [hq+(1<<16)] mov t0d, 128 jmp .v_w32_start .v_w128: lea t2d, [hq+(3<<16)] mov t0d, 256 jmp .v_w32_start .hv: ; (16 * src[x] + (my * (src[x + src_stride] - src[x])) + 8) >> 4 ; = src[x] + (((my * (src[x + src_stride] - src[x])) + 8) >> 4) %assign stack_offset stack_offset - stack_size_padded WIN64_SPILL_XMM 8 movzx wd, word [t2+wq*2+table_offset(prep, _bilin_hv)] shl mxyd, 11 movd xm6, mxyd add wq, t2 pshuflw m6, m6, q0000 punpcklqdq m6, m6 %if ARCH_X86_32 mov t1, t2 ; save base reg for w4 %endif lea stride3q, [strideq*3] jmp wq .hv_w4: %if ARCH_X86_32 mova m4, [t1-prep_ssse3+bilin_h_shuf4] %else mova m4, [bilin_h_shuf4] %endif movq m0, [srcq+strideq*0] ; 0 _ punpcklqdq m0, m0 pshufb m0, m4 pmaddubsw m0, m5 .hv_w4_loop: movq m1, [srcq+strideq*1] movhps m1, [srcq+strideq*2] ; 1 _ 2 _ movq m2, [srcq+stride3q ] lea srcq, [srcq+strideq*4] movhps m2, [srcq+strideq*0] ; 3 _ 4 _ pshufb m1, m4 pshufb m2, m4 pmaddubsw m1, m5 ; 1 + 2 + shufpd m3, m0, m1, 0x01 ; 0 + 1 + pmaddubsw m0, m2, m5 ; 3 + 4 + shufpd m2, m1, m0, 0x01 ; 2 + 3 + psubw m1, m3 pmulhrsw m1, m6 paddw m1, m3 psubw m3, m0, m2 pmulhrsw m3, m6 paddw m3, m2 mova [tmpq+16*0], m1 mova [tmpq+16*1], m3 add tmpq, 32 sub hd, 4 jg .hv_w4_loop RET .hv_w8: movu m0, [srcq+strideq*0] pshufb m0, m4 pmaddubsw m0, m5 ; 0 + .hv_w8_loop: movu m1, [srcq+strideq*1] ; 1 movu m2, [srcq+strideq*2] ; 2 pshufb m1, m4 pshufb m2, m4 pmaddubsw m1, m5 ; 1 + pmaddubsw m2, m5 ; 2 + psubw m3, m1, m0 ; 1-0 pmulhrsw m3, m6 paddw m3, m0 psubw m7, m2, m1 ; 2-1 pmulhrsw m7, m6 paddw m7, m1 mova [tmpq+16*0], m3 mova [tmpq+16*1], m7 movu m1, [srcq+stride3q ] ; 3 lea srcq, [srcq+strideq*4] movu m0, [srcq+strideq*0] ; 4 pshufb m1, m4 pshufb m0, m4 pmaddubsw m1, m5 ; 3 + pmaddubsw m0, m5 ; 4 + psubw m3, m1, m2 ; 3-2 pmulhrsw m3, m6 paddw m3, m2 psubw m7, m0, m1 ; 4-3 pmulhrsw m7, m6 paddw m7, m1 mova [tmpq+16*2], m3 mova [tmpq+16*3], m7 add tmpq, 16*4 sub hd, 4 jg .hv_w8_loop RET .hv_w16: lea t2d, [hq+(0<<16)] mov t0d, 32 .hv_w16_start: %if ARCH_X86_64 %if WIN64 PUSH r7 %endif mov r7, tmpq %endif mov t1, srcq .hv_w16_loop_h: movu m0, [srcq+strideq*0+8*0] ; 0L movu m1, [srcq+strideq*0+8*1] ; 0U pshufb m0, m4 pshufb m1, m4 pmaddubsw m0, m5 ; 0L + pmaddubsw m1, m5 ; 0U + .hv_w16_loop_v: movu m2, [srcq+strideq*1+8*0] ; 1L pshufb m2, m4 pmaddubsw m2, m5 ; 1L + psubw m3, m2, m0 ; 1L-0L pmulhrsw m3, m6 paddw m3, m0 mova [tmpq+16*0], m3 movu m3, [srcq+strideq*1+8*1] ; 1U lea srcq, [srcq+strideq*2] pshufb m3, m4 pmaddubsw m3, m5 ; 1U + psubw m0, m3, m1 ; 1U-0U pmulhrsw m0, m6 paddw m0, m1 mova [tmpq+16*1], m0 add tmpq, t0q movu m0, [srcq+strideq*0+8*0] ; 2L pshufb m0, m4 pmaddubsw m0, m5 ; 2L + psubw m1, m0, m2 ; 2L-1L pmulhrsw m1, m6 paddw m1, m2 mova [tmpq+16*0], m1 movu m1, [srcq+strideq*0+8*1] ; 2U pshufb m1, m4 pmaddubsw m1, m5 ; 2U + psubw m2, m1, m3 ; 2U-1U pmulhrsw m2, m6 paddw m2, m3 mova [tmpq+16*1], m2 add tmpq, t0q sub hd, 2 jg .hv_w16_loop_v movzx hd, t2w add t1, 16 mov srcq, t1 %if ARCH_X86_64 add r7, 2*16 mov tmpq, r7 %else mov tmpq, tmpmp add tmpq, 2*16 mov tmpmp, tmpq %endif sub t2d, 1<<16 jg .hv_w16_loop_h %if WIN64 POP r7 %endif RET .hv_w32: lea t2d, [hq+(1<<16)] mov t0d, 64 jmp .hv_w16_start .hv_w64: lea t2d, [hq+(3<<16)] mov t0d, 128 jmp .hv_w16_start .hv_w128: lea t2d, [hq+(7<<16)] mov t0d, 256 jmp .hv_w16_start ; int8_t subpel_filters[5][15][8] %assign FILTER_REGULAR (0*15 << 16) | 3*15 %assign FILTER_SMOOTH (1*15 << 16) | 4*15 %assign FILTER_SHARP (2*15 << 16) | 3*15 %if ARCH_X86_32 DECLARE_REG_TMP 1, 2 %elif WIN64 DECLARE_REG_TMP 4, 5 %else DECLARE_REG_TMP 7, 8 %endif %macro PUT_8TAP_FN 3 ; type, type_h, type_v cglobal put_8tap_%1 mov t0d, FILTER_%2 mov t1d, FILTER_%3 %ifnidn %1, sharp_smooth ; skip the jump in the last filter jmp mangle(private_prefix %+ _put_8tap %+ SUFFIX) %endif %endmacro PUT_8TAP_FN regular, REGULAR, REGULAR PUT_8TAP_FN regular_sharp, REGULAR, SHARP PUT_8TAP_FN regular_smooth, REGULAR, SMOOTH PUT_8TAP_FN smooth_regular, SMOOTH, REGULAR PUT_8TAP_FN smooth, SMOOTH, SMOOTH PUT_8TAP_FN smooth_sharp, SMOOTH, SHARP PUT_8TAP_FN sharp_regular, SHARP, REGULAR PUT_8TAP_FN sharp, SHARP, SHARP PUT_8TAP_FN sharp_smooth, SHARP, SMOOTH %if ARCH_X86_32 %define base_reg r1 %define base base_reg-put_ssse3 %define W32_RESTORE_DSQ mov dsq, dsm %define W32_RESTORE_SSQ mov ssq, ssm %else %define base_reg r8 %define base 0 %define W32_RESTORE_DSQ %define W32_RESTORE_SSQ %endif cglobal put_8tap, 1, 9, 0, dst, ds, src, ss, w, h, mx, my, ss3 %assign org_stack_offset stack_offset imul mxd, mxm, 0x010101 add mxd, t0d ; 8tap_h, mx, 4tap_h %if ARCH_X86_64 imul myd, mym, 0x010101 add myd, t1d ; 8tap_v, my, 4tap_v %else imul ssd, mym, 0x010101 add ssd, t1d ; 8tap_v, my, 4tap_v mov srcq, srcm %endif mov wd, wm movifnidn hd, hm LEA base_reg, put_ssse3 test mxd, 0xf00 jnz .h %if ARCH_X86_32 test ssd, 0xf00 %else test myd, 0xf00 %endif jnz .v tzcnt wd, wd movzx wd, word [base_reg+wq*2+table_offset(put,)] add wq, base_reg ; put_bilin mangling jump %assign stack_offset org_stack_offset %if ARCH_X86_32 mov dsq, dsm mov ssq, ssm %elif WIN64 pop r8 %endif lea r6, [ssq*3] jmp wq .h: %if ARCH_X86_32 test ssd, 0xf00 %else test myd, 0xf00 %endif jnz .hv W32_RESTORE_SSQ WIN64_SPILL_XMM 12 cmp wd, 4 jl .h_w2 je .h_w4 tzcnt wd, wd %if ARCH_X86_64 mova m10, [base+subpel_h_shufA] mova m11, [base+subpel_h_shufB] mova m9, [base+subpel_h_shufC] %endif shr mxd, 16 sub srcq, 3 movzx wd, word [base_reg+wq*2+table_offset(put, _8tap_h)] movd m5, [base_reg+mxq*8+subpel_filters-put_ssse3+0] pshufd m5, m5, q0000 movd m6, [base_reg+mxq*8+subpel_filters-put_ssse3+4] pshufd m6, m6, q0000 mova m7, [base+pw_34] ; 2 + (8 << 2) add wq, base_reg jmp wq .h_w2: %if ARCH_X86_32 and mxd, 0xff %else movzx mxd, mxb %endif dec srcq mova m4, [base+subpel_h_shuf4] movd m3, [base_reg+mxq*8+subpel_filters-put_ssse3+2] pshufd m3, m3, q0000 mova m5, [base+pw_34] ; 2 + (8 << 2) W32_RESTORE_DSQ .h_w2_loop: movq m0, [srcq+ssq*0] movhps m0, [srcq+ssq*1] lea srcq, [srcq+ssq*2] pshufb m0, m4 pmaddubsw m0, m3 phaddw m0, m0 paddw m0, m5 ; pw34 psraw m0, 6 packuswb m0, m0 movd r4d, m0 mov [dstq+dsq*0], r4w shr r4d, 16 mov [dstq+dsq*1], r4w lea dstq, [dstq+dsq*2] sub hd, 2 jg .h_w2_loop RET .h_w4: %if ARCH_X86_32 and mxd, 0xff %else movzx mxd, mxb %endif dec srcq movd m3, [base_reg+mxq*8+subpel_filters-put_ssse3+2] pshufd m3, m3, q0000 mova m5, [base+pw_34] ; 2 + (8 << 2) mova m6, [base+subpel_h_shufA] W32_RESTORE_DSQ .h_w4_loop: movq m0, [srcq+ssq*0] ; 1 movq m1, [srcq+ssq*1] ; 2 lea srcq, [srcq+ssq*2] pshufb m0, m6 ; subpel_h_shufA pshufb m1, m6 ; subpel_h_shufA pmaddubsw m0, m3 ; subpel_filters pmaddubsw m1, m3 ; subpel_filters phaddw m0, m1 paddw m0, m5 ; pw34 psraw m0, 6 packuswb m0, m0 movd [dstq+dsq*0], m0 psrlq m0, 32 movd [dstq+dsq*1], m0 lea dstq, [dstq+dsq*2] sub hd, 2 jg .h_w4_loop RET ; %macro PUT_8TAP_H 4 ; dst/src, tmp[1-3] %if ARCH_X86_32 pshufb %2, %1, [base+subpel_h_shufB] pshufb %3, %1, [base+subpel_h_shufC] pshufb %1, [base+subpel_h_shufA] %else pshufb %2, %1, m11; subpel_h_shufB pshufb %3, %1, m9 ; subpel_h_shufC pshufb %1, m10 ; subpel_h_shufA %endif pmaddubsw %4, %2, m5 ; subpel +0 B0 pmaddubsw %2, m6 ; subpel +4 B4 pmaddubsw %3, m6 ; C4 pmaddubsw %1, m5 ; A0 paddw %3, %4 ; C4+B0 paddw %1, %2 ; A0+B4 phaddw %1, %3 paddw %1, m7 ; pw34 psraw %1, 6 %endmacro ; .h_w8: movu m0, [srcq+ssq*0] movu m1, [srcq+ssq*1] PUT_8TAP_H m0, m2, m3, m4 lea srcq, [srcq+ssq*2] PUT_8TAP_H m1, m2, m3, m4 packuswb m0, m1 %if ARCH_X86_32 movq [dstq ], m0 add dstq, dsm movhps [dstq ], m0 add dstq, dsm %else movq [dstq+dsq*0], m0 movhps [dstq+dsq*1], m0 lea dstq, [dstq+dsq*2] %endif sub hd, 2 jg .h_w8 RET .h_w16: xor r6d, r6d jmp .h_start .h_w32: mov r6, -16*1 jmp .h_start .h_w64: mov r6, -16*3 jmp .h_start .h_w128: mov r6, -16*7 .h_start: sub srcq, r6 sub dstq, r6 mov r4, r6 .h_loop: movu m0, [srcq+r6+8*0] movu m1, [srcq+r6+8*1] PUT_8TAP_H m0, m2, m3, m4 PUT_8TAP_H m1, m2, m3, m4 packuswb m0, m1 mova [dstq+r6], m0 add r6, mmsize jle .h_loop add srcq, ssq %if ARCH_X86_32 add dstq, dsm %else add dstq, dsq %endif mov r6, r4 dec hd jg .h_loop RET .v: %if ARCH_X86_32 movzx mxd, ssb shr ssd, 16 cmp hd, 4 cmovle ssd, mxd lea ssq, [base_reg+ssq*8+subpel_filters-put_ssse3] %else %assign stack_offset org_stack_offset WIN64_SPILL_XMM 16 movzx mxd, myb shr myd, 16 cmp hd, 4 cmovle myd, mxd lea myq, [base_reg+myq*8+subpel_filters-put_ssse3] %endif tzcnt r6d, wd movzx r6d, word [base_reg+r6*2+table_offset(put, _8tap_v)] mova m7, [base+pw_512] psrlw m2, m7, 1 ; 0x0100 add r6, base_reg %if ARCH_X86_32 %define subpel0 [rsp+mmsize*0] %define subpel1 [rsp+mmsize*1] %define subpel2 [rsp+mmsize*2] %define subpel3 [rsp+mmsize*3] %assign regs_used 2 ; use r1 (ds) as tmp for stack alignment if needed ALLOC_STACK -mmsize*4 %assign regs_used 7 movd m0, [ssq+0] pshufb m0, m2 mova subpel0, m0 movd m0, [ssq+2] pshufb m0, m2 mova subpel1, m0 movd m0, [ssq+4] pshufb m0, m2 mova subpel2, m0 movd m0, [ssq+6] pshufb m0, m2 mova subpel3, m0 mov ssq, [rstk+stack_offset+gprsize*4] lea ssq, [ssq*3] sub srcq, ssq mov ssq, [rstk+stack_offset+gprsize*4] mov dsq, [rstk+stack_offset+gprsize*2] %else %define subpel0 m8 %define subpel1 m9 %define subpel2 m10 %define subpel3 m11 movd subpel0, [myq+0] pshufb subpel0, m2 movd subpel1, [myq+2] pshufb subpel1, m2 movd subpel2, [myq+4] pshufb subpel2, m2 movd subpel3, [myq+6] pshufb subpel3, m2 lea ss3q, [ssq*3] sub srcq, ss3q %endif jmp r6 .v_w2: movd m2, [srcq+ssq*0] ; 0 pinsrw m2, [srcq+ssq*1], 2 ; 0 1 pinsrw m2, [srcq+ssq*2], 4 ; 0 1 2 %if ARCH_X86_32 lea srcq, [srcq+ssq*2] add srcq, ssq pinsrw m2, [srcq+ssq*0], 6 ; 0 1 2 3 add srcq, ssq %else pinsrw m2, [srcq+ss3q ], 6 ; 0 1 2 3 lea srcq, [srcq+ssq*4] %endif movd m3, [srcq+ssq*0] ; 4 movd m1, [srcq+ssq*1] ; 5 movd m0, [srcq+ssq*2] ; 6 %if ARCH_X86_32 lea srcq, [srcq+ssq*2] add srcq, ssq %else add srcq, ss3q %endif punpckldq m3, m1 ; 4 5 _ _ punpckldq m1, m0 ; 5 6 _ _ palignr m4, m3, m2, 4 ; 1 2 3 4 punpcklbw m3, m1 ; 45 56 punpcklbw m1, m2, m4 ; 01 12 punpckhbw m2, m4 ; 23 34 .v_w2_loop: pmaddubsw m5, m1, subpel0 ; a0 b0 mova m1, m2 pmaddubsw m2, subpel1 ; a1 b1 paddw m5, m2 mova m2, m3 pmaddubsw m3, subpel2 ; a2 b2 paddw m5, m3 movd m4, [srcq+ssq*0] ; 7 punpckldq m3, m0, m4 ; 6 7 _ _ movd m0, [srcq+ssq*1] lea srcq, [srcq+ssq*2] punpckldq m4, m0 ; 7 8 _ _ punpcklbw m3, m4 ; 67 78 pmaddubsw m4, m3, subpel3 ; a3 b3 paddw m5, m4 pmulhrsw m5, m7 packuswb m5, m5 pshuflw m5, m5, q2020 movd r6d, m5 mov [dstq+dsq*0], r6w shr r6d, 16 mov [dstq+dsq*1], r6w lea dstq, [dstq+dsq*2] sub hd, 2 jg .v_w2_loop RET .v_w4: %if ARCH_X86_32 .v_w8: .v_w16: .v_w32: .v_w64: .v_w128: %endif ; ARCH_X86_32 lea r6d, [wq - 4] ; horizontal loop mov r4, dstq %if ARCH_X86_32 %if STACK_ALIGNMENT < mmsize %define srcm [rsp+mmsize*4+gprsize] %endif mov srcm, srcq %else mov r7, srcq %endif shl r6d, (16 - 2) ; (wq / 4) << 16 mov r6w, hw .v_w4_loop0: movd m2, [srcq+ssq*0] ; 0 movhps m2, [srcq+ssq*2] ; 0 _ 2 movd m3, [srcq+ssq*1] ; 1 %if ARCH_X86_32 lea srcq, [srcq+ssq*2] add srcq, ssq movhps m3, [srcq+ssq*0] ; 1 _ 3 lea srcq, [srcq+ssq*1] %else movhps m3, [srcq+ss3q ] ; 1 _ 3 lea srcq, [srcq+ssq*4] %endif pshufd m2, m2, q2020 ; 0 2 0 2 pshufd m3, m3, q2020 ; 1 3 1 3 punpckldq m2, m3 ; 0 1 2 3 movd m3, [srcq+ssq*0] ; 4 movd m1, [srcq+ssq*1] ; 5 movd m0, [srcq+ssq*2] ; 6 %if ARCH_X86_32 lea srcq, [srcq+ssq*2] add srcq, ssq %else add srcq, ss3q %endif punpckldq m3, m1 ; 4 5 _ _ punpckldq m1, m0 ; 5 6 _ _ palignr m4, m3, m2, 4 ; 1 2 3 4 punpcklbw m3, m1 ; 45 56 punpcklbw m1, m2, m4 ; 01 12 punpckhbw m2, m4 ; 23 34 .v_w4_loop: pmaddubsw m5, m1, subpel0 ; a0 b0 mova m1, m2 pmaddubsw m2, subpel1 ; a1 b1 paddw m5, m2 mova m2, m3 pmaddubsw m3, subpel2 ; a2 b2 paddw m5, m3 movd m4, [srcq+ssq*0] punpckldq m3, m0, m4 ; 6 7 _ _ movd m0, [srcq+ssq*1] lea srcq, [srcq+ssq*2] punpckldq m4, m0 ; 7 8 _ _ punpcklbw m3, m4 ; 67 78 pmaddubsw m4, m3, subpel3 ; a3 b3 paddw m5, m4 pmulhrsw m5, m7 packuswb m5, m5 movd [dstq+dsq*0], m5 pshufd m5, m5, q0101 movd [dstq+dsq*1], m5 lea dstq, [dstq+dsq*2] sub hd, 2 jg .v_w4_loop mov hw, r6w ; reset vertical loop add r4, 4 mov dstq, r4 %if ARCH_X86_32 mov srcq, srcm add srcq, 4 mov srcm, srcq %else add r7, 4 mov srcq, r7 %endif sub r6d, 1<<16 ; horizontal-- jg .v_w4_loop0 RET %if ARCH_X86_64 .v_w8: .v_w16: .v_w32: .v_w64: .v_w128: lea r6d, [wq - 8] ; horizontal loop mov r4, dstq mov r7, srcq shl r6d, 8 - 3; (wq / 8) << 8 mov r6b, hb .v_w8_loop0: movq m4, [srcq+ssq*0] ; 0 movq m5, [srcq+ssq*1] ; 1 lea srcq, [srcq+ssq*2] movq m6, [srcq+ssq*0] ; 2 movq m0, [srcq+ssq*1] ; 3 lea srcq, [srcq+ssq*2] movq m1, [srcq+ssq*0] ; 4 movq m2, [srcq+ssq*1] ; 5 lea srcq, [srcq+ssq*2] ; movq m3, [srcq+ssq*0] ; 6 shufpd m4, m0, 0x0c shufpd m5, m1, 0x0c punpcklbw m1, m4, m5 ; 01 punpckhbw m4, m5 ; 34 shufpd m6, m2, 0x0c punpcklbw m2, m5, m6 ; 12 punpckhbw m5, m6 ; 45 shufpd m0, m3, 0x0c punpcklbw m3, m6, m0 ; 23 punpckhbw m6, m0 ; 56 .v_w8_loop: movq m12, [srcq+ssq*1] ; 8 lea srcq, [srcq+ssq*2] movq m13, [srcq+ssq*0] ; 9 pmaddubsw m14, m1, subpel0 ; a0 pmaddubsw m15, m2, subpel0 ; b0 mova m1, m3 mova m2, m4 pmaddubsw m3, subpel1 ; a1 pmaddubsw m4, subpel1 ; b1 paddw m14, m3 paddw m15, m4 mova m3, m5 mova m4, m6 pmaddubsw m5, subpel2 ; a2 pmaddubsw m6, subpel2 ; b2 paddw m14, m5 paddw m15, m6 shufpd m6, m0, m12, 0x0d shufpd m0, m12, m13, 0x0c punpcklbw m5, m6, m0 ; 67 punpckhbw m6, m0 ; 78 pmaddubsw m12, m5, subpel3 ; a3 pmaddubsw m13, m6, subpel3 ; b3 paddw m14, m12 paddw m15, m13 pmulhrsw m14, m7 pmulhrsw m15, m7 packuswb m14, m15 movq [dstq+dsq*0], xm14 movhps [dstq+dsq*1], xm14 lea dstq, [dstq+dsq*2] sub hd, 2 jg .v_w8_loop movzx hd, r6b ; reset vertical loop add r4, 8 add r7, 8 mov dstq, r4 mov srcq, r7 sub r6d, 1<<8 ; horizontal-- jg .v_w8_loop0 RET %endif ;ARCH_X86_64 %undef subpel0 %undef subpel1 %undef subpel2 %undef subpel3 .hv: %assign stack_offset org_stack_offset cmp wd, 4 jg .hv_w8 and mxd, 0xff dec srcq movd m1, [base_reg+mxq*8+subpel_filters-put_ssse3+2] %if ARCH_X86_32 movzx mxd, ssb shr ssd, 16 cmp hd, 4 cmovle ssd, mxd movq m0, [base_reg+ssq*8+subpel_filters-put_ssse3] W32_RESTORE_SSQ lea r6, [ssq*3] sub srcq, r6 %define base_reg r6 mov r6, r1; use as new base %assign regs_used 2 ALLOC_STACK -mmsize*14 %assign regs_used 7 mov dsq, [rstk+stack_offset+gprsize*2] %define subpelv0 [rsp+mmsize*0] %define subpelv1 [rsp+mmsize*1] %define subpelv2 [rsp+mmsize*2] %define subpelv3 [rsp+mmsize*3] punpcklqdq m0, m0 punpcklbw m0, m0 psraw m0, 8 ; sign-extend pshufd m6, m0, q0000 mova subpelv0, m6 pshufd m6, m0, q1111 mova subpelv1, m6 pshufd m6, m0, q2222 mova subpelv2, m6 pshufd m6, m0, q3333 mova subpelv3, m6 %else movzx mxd, myb shr myd, 16 cmp hd, 4 cmovle myd, mxd movq m0, [base_reg+myq*8+subpel_filters-put_ssse3] ALLOC_STACK mmsize*14, 14 lea ss3q, [ssq*3] sub srcq, ss3q %define subpelv0 m10 %define subpelv1 m11 %define subpelv2 m12 %define subpelv3 m13 punpcklqdq m0, m0 punpcklbw m0, m0 psraw m0, 8 ; sign-extend mova m8, [base+pw_8192] mova m9, [base+pd_512] pshufd m10, m0, q0000 pshufd m11, m0, q1111 pshufd m12, m0, q2222 pshufd m13, m0, q3333 %endif pshufd m7, m1, q0000 cmp wd, 4 je .hv_w4 .hv_w2: mova m6, [base+subpel_h_shuf4] ; movq m2, [srcq+ssq*0] ; 0 movhps m2, [srcq+ssq*1] ; 0 _ 1 movq m0, [srcq+ssq*2] ; 2 %if ARCH_X86_32 %define w8192reg [base+pw_8192] %define d512reg [base+pd_512] lea srcq, [srcq+ssq*2] add srcq, ssq movhps m0, [srcq+ssq*0] ; 2 _ 3 lea srcq, [srcq+ssq*1] %else %define w8192reg m8 %define d512reg m9 movhps m0, [srcq+ss3q ] ; 2 _ 3 lea srcq, [srcq+ssq*4] %endif pshufb m2, m6 ; 0 ~ 1 ~ pshufb m0, m6 ; 2 ~ 3 ~ pmaddubsw m2, m7 ; subpel_filters pmaddubsw m0, m7 ; subpel_filters phaddw m2, m0 ; 0 1 2 3 pmulhrsw m2, w8192reg ; movq m3, [srcq+ssq*0] ; 4 movhps m3, [srcq+ssq*1] ; 4 _ 5 movq m0, [srcq+ssq*2] ; 6 %if ARCH_X86_32 lea srcq, [srcq+ssq*2] add srcq, ssq %else add srcq, ss3q %endif pshufb m3, m6 ; 4 ~ 5 ~ pshufb m0, m6 ; 6 ~ pmaddubsw m3, m7 ; subpel_filters pmaddubsw m0, m7 ; subpel_filters phaddw m3, m0 ; 4 5 6 _ pmulhrsw m3, w8192reg ; palignr m4, m3, m2, 4; V 1 2 3 4 punpcklwd m1, m2, m4 ; V 01 12 0 1 1 2 punpckhwd m2, m4 ; V 23 34 2 3 3 4 pshufd m0, m3, q2121; V 5 6 5 6 punpcklwd m3, m0 ; V 45 56 4 5 5 6 .hv_w2_loop: pmaddwd m5, m1, subpelv0; V a0 b0 mova m1, m2 ; V pmaddwd m2, subpelv1 ; V a1 b1 paddd m5, m2 ; V mova m2, m3 ; V pmaddwd m3, subpelv2 ; a2 b2 paddd m5, m3 ; V movq m4, [srcq+ssq*0] ; V 7 movhps m4, [srcq+ssq*1] ; V 7 8 lea srcq, [srcq+ssq*2] ; V pshufb m4, m6 pmaddubsw m4, m7 phaddw m4, m4 pmulhrsw m4, w8192reg palignr m3, m4, m0, 12 mova m0, m4 punpcklwd m3, m0 ; V 67 78 pmaddwd m4, m3, subpelv3 ; V a3 b3 paddd m5, d512reg paddd m5, m4 psrad m5, 10 packssdw m5, m5 packuswb m5, m5 movd r4d, m5 mov [dstq+dsq*0], r4w shr r4d, 16 mov [dstq+dsq*1], r4w lea dstq, [dstq+dsq*2] sub hd, 2 jg .hv_w2_loop RET %undef w8192reg %undef d512reg ; .hv_w4: %define hv4_line_0_0 4 %define hv4_line_0_1 5 %define hv4_line_0_2 6 %define hv4_line_0_3 7 %define hv4_line_0_4 8 %define hv4_line_0_5 9 %define hv4_line_1_0 10 %define hv4_line_1_1 11 %define hv4_line_1_2 12 %define hv4_line_1_3 13 ; %macro SAVELINE_W4 3 mova [rsp+mmsize*hv4_line_%3_%2], %1 %endmacro %macro RESTORELINE_W4 3 mova %1, [rsp+mmsize*hv4_line_%3_%2] %endmacro ; %if ARCH_X86_32 %define w8192reg [base+pw_8192] %define d512reg [base+pd_512] %else %define w8192reg m8 %define d512reg m9 %endif ; lower shuffle 0 1 2 3 4 mova m6, [base+subpel_h_shuf4] movq m5, [srcq+ssq*0] ; 0 _ _ _ movhps m5, [srcq+ssq*1] ; 0 _ 1 _ movq m4, [srcq+ssq*2] ; 2 _ _ _ %if ARCH_X86_32 lea srcq, [srcq+ssq*2] add srcq, ssq movhps m4, [srcq+ssq*0] ; 2 _ 3 _ add srcq, ssq %else movhps m4, [srcq+ss3q ] ; 2 _ 3 _ lea srcq, [srcq+ssq*4] %endif pshufb m2, m5, m6 ;H subpel_h_shuf4 0 ~ 1 ~ pshufb m0, m4, m6 ;H subpel_h_shuf4 2 ~ 3 ~ pmaddubsw m2, m7 ;H subpel_filters pmaddubsw m0, m7 ;H subpel_filters phaddw m2, m0 ;H 0 1 2 3 pmulhrsw m2, w8192reg ;H pw_8192 SAVELINE_W4 m2, 2, 0 ; upper shuffle 2 3 4 5 6 mova m6, [base+subpel_h_shuf4+16] pshufb m2, m5, m6 ;H subpel_h_shuf4 0 ~ 1 ~ pshufb m0, m4, m6 ;H subpel_h_shuf4 2 ~ 3 ~ pmaddubsw m2, m7 ;H subpel_filters pmaddubsw m0, m7 ;H subpel_filters phaddw m2, m0 ;H 0 1 2 3 pmulhrsw m2, w8192reg ;H pw_8192 ; ; lower shuffle mova m6, [base+subpel_h_shuf4] movq m5, [srcq+ssq*0] ; 4 _ _ _ movhps m5, [srcq+ssq*1] ; 4 _ 5 _ movq m4, [srcq+ssq*2] ; 6 _ _ _ pshufb m3, m5, m6 ;H subpel_h_shuf4 4 ~ 5 ~ pshufb m0, m4, m6 ;H subpel_h_shuf4 6 ~ 6 ~ pmaddubsw m3, m7 ;H subpel_filters pmaddubsw m0, m7 ;H subpel_filters phaddw m3, m0 ;H 4 5 6 7 pmulhrsw m3, w8192reg ;H pw_8192 SAVELINE_W4 m3, 3, 0 ; upper shuffle mova m6, [base+subpel_h_shuf4+16] pshufb m3, m5, m6 ;H subpel_h_shuf4 4 ~ 5 ~ pshufb m0, m4, m6 ;H subpel_h_shuf4 6 ~ 6 ~ pmaddubsw m3, m7 ;H subpel_filters pmaddubsw m0, m7 ;H subpel_filters phaddw m3, m0 ;H 4 5 6 7 pmulhrsw m3, w8192reg ;H pw_8192 ; %if ARCH_X86_32 lea srcq, [srcq+ssq*2] add srcq, ssq %else add srcq, ss3q %endif ;process high palignr m4, m3, m2, 4;V 1 2 3 4 punpcklwd m1, m2, m4 ; V 01 12 punpckhwd m2, m4 ; V 23 34 pshufd m0, m3, q2121;V 5 6 5 6 punpcklwd m3, m0 ; V 45 56 SAVELINE_W4 m0, 0, 1 SAVELINE_W4 m1, 1, 1 SAVELINE_W4 m2, 2, 1 SAVELINE_W4 m3, 3, 1 ;process low RESTORELINE_W4 m2, 2, 0 RESTORELINE_W4 m3, 3, 0 palignr m4, m3, m2, 4;V 1 2 3 4 punpcklwd m1, m2, m4 ; V 01 12 punpckhwd m2, m4 ; V 23 34 pshufd m0, m3, q2121;V 5 6 5 6 punpcklwd m3, m0 ; V 45 56 .hv_w4_loop: ;process low pmaddwd m5, m1, subpelv0 ; V a0 b0 mova m1, m2 pmaddwd m2, subpelv1; V a1 b1 paddd m5, m2 mova m2, m3 pmaddwd m3, subpelv2; V a2 b2 paddd m5, m3 ; mova m6, [base+subpel_h_shuf4] movq m4, [srcq+ssq*0] ; 7 movhps m4, [srcq+ssq*1] ; 7 _ 8 _ pshufb m4, m6 ;H subpel_h_shuf4 7 ~ 8 ~ pmaddubsw m4, m7 ;H subpel_filters phaddw m4, m4 ;H 7 8 7 8 pmulhrsw m4, w8192reg ;H pw_8192 palignr m3, m4, m0, 12 ; 6 7 8 7 mova m0, m4 punpcklwd m3, m4 ; 67 78 pmaddwd m4, m3, subpelv3; a3 b3 paddd m5, d512reg ; pd_512 paddd m5, m4 psrad m5, 10 SAVELINE_W4 m0, 0, 0 SAVELINE_W4 m1, 1, 0 SAVELINE_W4 m2, 2, 0 SAVELINE_W4 m3, 3, 0 SAVELINE_W4 m5, 5, 0 ;process high RESTORELINE_W4 m0, 0, 1 RESTORELINE_W4 m1, 1, 1 RESTORELINE_W4 m2, 2, 1 RESTORELINE_W4 m3, 3, 1 pmaddwd m5, m1, subpelv0; V a0 b0 mova m1, m2 pmaddwd m2, subpelv1; V a1 b1 paddd m5, m2 mova m2, m3 pmaddwd m3, subpelv2; V a2 b2 paddd m5, m3 ; mova m6, [base+subpel_h_shuf4+16] movq m4, [srcq+ssq*0] ; 7 movhps m4, [srcq+ssq*1] ; 7 _ 8 _ pshufb m4, m6 ;H subpel_h_shuf4 7 ~ 8 ~ pmaddubsw m4, m7 ;H subpel_filters phaddw m4, m4 ;H 7 8 7 8 pmulhrsw m4, w8192reg ;H pw_8192 palignr m3, m4, m0, 12 ; 6 7 8 7 mova m0, m4 punpcklwd m3, m4 ; 67 78 pmaddwd m4, m3, subpelv3; a3 b3 paddd m5, d512reg ; pd_512 paddd m5, m4 psrad m4, m5, 10 ; RESTORELINE_W4 m5, 5, 0 packssdw m5, m4 ; d -> w packuswb m5, m5 ; w -> b pshuflw m5, m5, q3120 lea srcq, [srcq+ssq*2] movd [dstq+dsq*0], m5 psrlq m5, 32 movd [dstq+dsq*1], m5 lea dstq, [dstq+dsq*2] sub hd, 2 SAVELINE_W4 m0, 0, 1 SAVELINE_W4 m1, 1, 1 SAVELINE_W4 m2, 2, 1 SAVELINE_W4 m3, 3, 1 RESTORELINE_W4 m0, 0, 0 RESTORELINE_W4 m1, 1, 0 RESTORELINE_W4 m2, 2, 0 RESTORELINE_W4 m3, 3, 0 jg .hv_w4_loop RET %undef subpelv0 %undef subpelv1 %undef subpelv2 %undef subpelv3 ; .hv_w8: %assign stack_offset org_stack_offset %define hv8_line_1 0 %define hv8_line_2 1 %define hv8_line_3 2 %define hv8_line_4 3 %define hv8_line_6 4 %macro SAVELINE_W8 2 mova [rsp+hv8_line_%1*mmsize], %2 %endmacro %macro RESTORELINE_W8 2 mova %2, [rsp+hv8_line_%1*mmsize] %endmacro shr mxd, 16 sub srcq, 3 %if ARCH_X86_32 %define base_reg r1 %define subpelh0 [rsp+mmsize*5] %define subpelh1 [rsp+mmsize*6] %define subpelv0 [rsp+mmsize*7] %define subpelv1 [rsp+mmsize*8] %define subpelv2 [rsp+mmsize*9] %define subpelv3 [rsp+mmsize*10] %define accuv0 [rsp+mmsize*11] %define accuv1 [rsp+mmsize*12] movq m1, [base_reg+mxq*8+subpel_filters-put_ssse3] movzx mxd, ssb shr ssd, 16 cmp hd, 4 cmovle ssd, mxd movq m5, [base_reg+ssq*8+subpel_filters-put_ssse3] mov ssq, ssmp ALLOC_STACK -mmsize*13 %if STACK_ALIGNMENT < 16 %define srcm [rsp+mmsize*13+gprsize*1] %define dsm [rsp+mmsize*13+gprsize*2] mov r6, [rstk+stack_offset+gprsize*2] mov dsm, r6 %endif pshufd m0, m1, q0000 pshufd m1, m1, q1111 punpcklbw m5, m5 psraw m5, 8 ; sign-extend pshufd m2, m5, q0000 pshufd m3, m5, q1111 pshufd m4, m5, q2222 pshufd m5, m5, q3333 mova subpelh0, m0 mova subpelh1, m1 mova subpelv0, m2 mova subpelv1, m3 mova subpelv2, m4 mova subpelv3, m5 lea r6, [ssq*3] sub srcq, r6 mov srcm, srcq %else ALLOC_STACK mmsize*5, 16 %define subpelh0 m10 %define subpelh1 m11 %define subpelv0 m12 %define subpelv1 m13 %define subpelv2 m14 %define subpelv3 m15 %define accuv0 m8 %define accuv1 m9 movq m0, [base_reg+mxq*8+subpel_filters-put_ssse3] movzx mxd, myb shr myd, 16 cmp hd, 4 cmovle myd, mxd movq m1, [base_reg+myq*8+subpel_filters-put_ssse3] pshufd subpelh0, m0, q0000 pshufd subpelh1, m0, q1111 punpcklqdq m1, m1 punpcklbw m1, m1 psraw m1, 8 ; sign-extend pshufd subpelv0, m1, q0000 pshufd subpelv1, m1, q1111 pshufd subpelv2, m1, q2222 pshufd subpelv3, m1, q3333 lea ss3q, [ssq*3] sub srcq, ss3q mov r7, srcq %endif lea r6d, [wq-4] mov r4, dstq shl r6d, (16 - 2) mov r6w, hw .hv_w8_loop0: movu m4, [srcq+ssq*0] ; 0 = _ _ movu m5, [srcq+ssq*1] ; 1 = _ _ lea srcq, [srcq+ssq*2] ; %macro HV_H_W8 4-7 ; src/dst, tmp[1-3], shuf[1-3] %if ARCH_X86_32 pshufb %3, %1, [base+subpel_h_shufB] pshufb %4, %1, [base+subpel_h_shufC] pshufb %1, [base+subpel_h_shufA] %else pshufb %3, %1, %6 ; subpel_h_shufB pshufb %4, %1, %7 ; subpel_h_shufC pshufb %1, %5 ; subpel_h_shufA %endif pmaddubsw %2, %3, subpelh0 ; subpel +0 C0 pmaddubsw %4, subpelh1; subpel +4 B4 pmaddubsw %3, subpelh1; C4 pmaddubsw %1, subpelh0; A0 paddw %2, %4 ; C0+B4 paddw %1, %3 ; A0+C4 phaddw %1, %2 %endmacro ; %if ARCH_X86_64 mova m7, [base+subpel_h_shufA] mova m8, [base+subpel_h_shufB] mova m9, [base+subpel_h_shufC] %endif HV_H_W8 m4, m1, m2, m3, m7, m8, m9 ; 0 ~ ~ ~ HV_H_W8 m5, m1, m2, m3, m7, m8, m9 ; 1 ~ ~ ~ movu m6, [srcq+ssq*0] ; 2 = _ _ movu m0, [srcq+ssq*1] ; 3 = _ _ lea srcq, [srcq+ssq*2] HV_H_W8 m6, m1, m2, m3, m7, m8, m9 ; 2 ~ ~ ~ HV_H_W8 m0, m1, m2, m3, m7, m8, m9 ; 3 ~ ~ ~ ; mova m7, [base+pw_8192] pmulhrsw m4, m7 ; H pw_8192 pmulhrsw m5, m7 ; H pw_8192 pmulhrsw m6, m7 ; H pw_8192 pmulhrsw m0, m7 ; H pw_8192 punpcklwd m1, m4, m5 ; 0 1 ~ punpcklwd m2, m5, m6 ; 1 2 ~ punpcklwd m3, m6, m0 ; 2 3 ~ SAVELINE_W8 1, m1 SAVELINE_W8 2, m2 SAVELINE_W8 3, m3 ; mova m7, [base+subpel_h_shufA] movu m4, [srcq+ssq*0] ; 4 = _ _ movu m5, [srcq+ssq*1] ; 5 = _ _ lea srcq, [srcq+ssq*2] movu m6, [srcq+ssq*0] ; 6 = _ _ HV_H_W8 m4, m1, m2, m3, m7, m8, m9 ; 4 ~ ~ ~ HV_H_W8 m5, m1, m2, m3, m7, m8, m9 ; 5 ~ ~ ~ HV_H_W8 m6, m1, m2, m3, m7, m8, m9 ; 6 ~ ~ ~ mova m7, [base+pw_8192] pmulhrsw m1, m4, m7 ; H pw_8192 4 ~ pmulhrsw m2, m5, m7 ; H pw_8192 5 ~ pmulhrsw m3, m6, m7 ; H pw_8192 6 ~ punpcklwd m4, m0, m1 ; 3 4 ~ punpcklwd m5, m1, m2 ; 4 5 ~ punpcklwd m6, m2, m3 ; 5 6 ~ ; SAVELINE_W8 6, m3 RESTORELINE_W8 1, m1 RESTORELINE_W8 2, m2 RESTORELINE_W8 3, m3 .hv_w8_loop: ; m8 accu for V a ; m9 accu for V b SAVELINE_W8 1, m3 SAVELINE_W8 2, m4 SAVELINE_W8 3, m5 SAVELINE_W8 4, m6 %if ARCH_X86_32 pmaddwd m0, m1, subpelv0 ; a0 pmaddwd m7, m2, subpelv0 ; b0 pmaddwd m3, subpelv1 ; a1 pmaddwd m4, subpelv1 ; b1 paddd m0, m3 paddd m7, m4 pmaddwd m5, subpelv2 ; a2 pmaddwd m6, subpelv2 ; b2 paddd m0, m5 paddd m7, m6 mova m5, [base+pd_512] paddd m0, m5 ; pd_512 paddd m7, m5 ; pd_512 mova accuv0, m0 mova accuv1, m7 %else pmaddwd m8, m1, subpelv0 ; a0 pmaddwd m9, m2, subpelv0 ; b0 pmaddwd m3, subpelv1 ; a1 pmaddwd m4, subpelv1 ; b1 paddd m8, m3 paddd m9, m4 pmaddwd m5, subpelv2 ; a2 pmaddwd m6, subpelv2 ; b2 paddd m8, m5 paddd m9, m6 mova m7, [base+pd_512] paddd m8, m7 ; pd_512 paddd m9, m7 ; pd_512 mova m7, [base+subpel_h_shufB] mova m6, [base+subpel_h_shufC] mova m5, [base+subpel_h_shufA] %endif movu m0, [srcq+ssq*1] ; 7 movu m4, [srcq+ssq*2] ; 8 lea srcq, [srcq+ssq*2] HV_H_W8 m0, m1, m2, m3, m5, m7, m6 HV_H_W8 m4, m1, m2, m3, m5, m7, m6 mova m5, [base+pw_8192] pmulhrsw m0, m5 ; H pw_8192 pmulhrsw m4, m5 ; H pw_8192 RESTORELINE_W8 6, m6 punpcklwd m5, m6, m0 ; 6 7 ~ punpcklwd m6, m0, m4 ; 7 8 ~ pmaddwd m1, m5, subpelv3 ; a3 paddd m2, m1, accuv0 pmaddwd m1, m6, subpelv3 ; b3 paddd m1, m1, accuv1 ; H + V psrad m2, 10 psrad m1, 10 packssdw m2, m1 ; d -> w packuswb m2, m1 ; w -> b movd [dstq+dsq*0], m2 psrlq m2, 32 %if ARCH_X86_32 add dstq, dsm movd [dstq+dsq*0], m2 add dstq, dsm %else movd [dstq+dsq*1], m2 lea dstq, [dstq+dsq*2] %endif sub hd, 2 jle .hv_w8_outer SAVELINE_W8 6, m4 RESTORELINE_W8 1, m1 RESTORELINE_W8 2, m2 RESTORELINE_W8 3, m3 RESTORELINE_W8 4, m4 jmp .hv_w8_loop .hv_w8_outer: movzx hd, r6w add r4, 4 mov dstq, r4 %if ARCH_X86_32 mov srcq, srcm add srcq, 4 mov srcm, srcq %else add r7, 4 mov srcq, r7 %endif sub r6d, 1<<16 jg .hv_w8_loop0 RET %if ARCH_X86_32 DECLARE_REG_TMP 1, 2 %elif WIN64 DECLARE_REG_TMP 6, 4 %else DECLARE_REG_TMP 6, 7 %endif %macro PREP_8TAP_FN 3 ; type, type_h, type_v cglobal prep_8tap_%1 mov t0d, FILTER_%2 mov t1d, FILTER_%3 %ifnidn %1, sharp_smooth ; skip the jump in the last filter jmp mangle(private_prefix %+ _prep_8tap %+ SUFFIX) %endif %endmacro PREP_8TAP_FN regular, REGULAR, REGULAR PREP_8TAP_FN regular_sharp, REGULAR, SHARP PREP_8TAP_FN regular_smooth, REGULAR, SMOOTH PREP_8TAP_FN smooth_regular, SMOOTH, REGULAR PREP_8TAP_FN smooth, SMOOTH, SMOOTH PREP_8TAP_FN smooth_sharp, SMOOTH, SHARP PREP_8TAP_FN sharp_regular, SHARP, REGULAR PREP_8TAP_FN sharp, SHARP, SHARP PREP_8TAP_FN sharp_smooth, SHARP, SMOOTH %if ARCH_X86_32 %define base_reg r2 %define base base_reg-prep_ssse3 %define W32_RESTORE_SSQ mov strideq, stridem %else %define base_reg r7 %define base 0 %define W32_RESTORE_SSQ %endif cglobal prep_8tap, 1, 9, 0, tmp, src, stride, w, h, mx, my, stride3 %assign org_stack_offset stack_offset imul mxd, mxm, 0x010101 add mxd, t0d ; 8tap_h, mx, 4tap_h imul myd, mym, 0x010101 add myd, t1d ; 8tap_v, my, 4tap_v movsxd wq, wm movifnidn srcd, srcm movifnidn hd, hm LEA base_reg, prep_ssse3 test mxd, 0xf00 jnz .h test myd, 0xf00 jnz .v tzcnt wd, wd movzx wd, word [base_reg+wq*2+table_offset(prep,)] add wq, base_reg movifnidn strided, stridem lea r6, [strideq*3] %assign stack_offset org_stack_offset %if WIN64 pop r8 pop r7 %endif jmp wq .h: test myd, 0xf00 jnz .hv WIN64_SPILL_XMM 12 cmp wd, 4 je .h_w4 tzcnt wd, wd %if ARCH_X86_64 mova m10, [base+subpel_h_shufA] mova m11, [base+subpel_h_shufB] mova m9, [base+subpel_h_shufC] %endif shr mxd, 16 sub srcq, 3 movzx wd, word [base_reg+wq*2+table_offset(prep, _8tap_h)] movd m5, [base_reg+mxq*8+subpel_filters-prep_ssse3+0] pshufd m5, m5, q0000 movd m6, [base_reg+mxq*8+subpel_filters-prep_ssse3+4] pshufd m6, m6, q0000 mova m7, [base+pw_8192] add wq, base_reg jmp wq .h_w4: %if ARCH_X86_32 and mxd, 0xff %else movzx mxd, mxb %endif dec srcq movd m4, [base_reg+mxq*8+subpel_filters-prep_ssse3+2] pshufd m4, m4, q0000 mova m6, [base+pw_8192] mova m5, [base+subpel_h_shufA] W32_RESTORE_SSQ %if ARCH_X86_64 lea stride3q, [strideq*3] %endif .h_w4_loop: movq m0, [srcq+strideq*0] ; 0 movq m1, [srcq+strideq*1] ; 1 %if ARCH_X86_32 lea srcq, [srcq+strideq*2] movq m2, [srcq+strideq*0] ; 2 movq m3, [srcq+strideq*1] ; 3 lea srcq, [srcq+strideq*2] %else movq m2, [srcq+strideq*2] ; 2 movq m3, [srcq+stride3q ] ; 3 lea srcq, [srcq+strideq*4] %endif pshufb m0, m5 ; subpel_h_shufA pshufb m1, m5 pshufb m2, m5 pshufb m3, m5 pmaddubsw m0, m4 ; subpel_filters + 2 pmaddubsw m1, m4 pmaddubsw m2, m4 pmaddubsw m3, m4 phaddw m0, m1 phaddw m2, m3 pmulhrsw m0, m6 ; pw_8192 pmulhrsw m2, m6 ; pw_8192 mova [tmpq+16*0], m0 mova [tmpq+16*1], m2 add tmpq, 32 sub hd, 4 jg .h_w4_loop RET ; %macro PREP_8TAP_H 4 ; dst/src, tmp[1-3] %if ARCH_X86_32 pshufb %2, %1, [base+subpel_h_shufB] pshufb %3, %1, [base+subpel_h_shufC] pshufb %1, [base+subpel_h_shufA] %else pshufb %2, %1, m11; subpel_h_shufB pshufb %3, %1, m9 ; subpel_h_shufC pshufb %1, m10 ; subpel_h_shufA %endif pmaddubsw %4, %2, m5 ; subpel +0 B0 pmaddubsw %2, m6 ; subpel +4 B4 pmaddubsw %3, m6 ; subpel +4 C4 pmaddubsw %1, m5 ; subpel +0 A0 paddw %3, %4 paddw %1, %2 phaddw %1, %3 pmulhrsw %1, m7 ; 8192 %endmacro ; .h_w8: %if ARCH_X86_32 mov r3, r2 %define base_reg r3 W32_RESTORE_SSQ %endif .h_w8_loop: movu m0, [srcq+strideq*0] movu m1, [srcq+strideq*1] lea srcq, [srcq+strideq*2] PREP_8TAP_H m0, m2, m3, m4 PREP_8TAP_H m1, m2, m3, m4 mova [tmpq+16*0], m0 mova [tmpq+16*1], m1 add tmpq, 32 sub hd, 2 jg .h_w8_loop RET .h_w16: xor r6d, r6d jmp .h_start .h_w32: mov r6, -16*1 jmp .h_start .h_w64: mov r6, -16*3 jmp .h_start .h_w128: mov r6, -16*7 .h_start: %if ARCH_X86_32 mov r3, r2 %define base_reg r3 %endif sub srcq, r6 mov r5, r6 W32_RESTORE_SSQ .h_loop: movu m0, [srcq+r6+8*0] movu m1, [srcq+r6+8*1] PREP_8TAP_H m0, m2, m3, m4 PREP_8TAP_H m1, m2, m3, m4 mova [tmpq+16*0], m0 mova [tmpq+16*1], m1 add tmpq, 32 add r6, 16 jle .h_loop add srcq, strideq mov r6, r5 dec hd jg .h_loop RET %if ARCH_X86_32 %define base_reg r2 %endif .v: %if ARCH_X86_32 mov mxd, myd and mxd, 0xff %else %assign stack_offset org_stack_offset WIN64_SPILL_XMM 16 movzx mxd, myb %endif shr myd, 16 cmp hd, 4 cmovle myd, mxd lea myq, [base_reg+myq*8+subpel_filters-prep_ssse3] mova m2, [base+pw_512] psrlw m2, m2, 1 ; 0x0100 mova m7, [base+pw_8192] %if ARCH_X86_32 %define subpel0 [rsp+mmsize*0] %define subpel1 [rsp+mmsize*1] %define subpel2 [rsp+mmsize*2] %define subpel3 [rsp+mmsize*3] %assign regs_used 2 ; use r1 (src) as tmp for stack alignment if needed ALLOC_STACK -mmsize*4 %assign regs_used 7 movd m0, [myq+0] pshufb m0, m2 mova subpel0, m0 movd m0, [myq+2] pshufb m0, m2 mova subpel1, m0 movd m0, [myq+4] pshufb m0, m2 mova subpel2, m0 movd m0, [myq+6] pshufb m0, m2 mova subpel3, m0 mov strideq, [rstk+stack_offset+gprsize*3] lea strideq, [strideq*3] sub [rstk+stack_offset+gprsize*2], strideq mov strideq, [rstk+stack_offset+gprsize*3] mov srcq, [rstk+stack_offset+gprsize*2] %else %define subpel0 m8 %define subpel1 m9 %define subpel2 m10 %define subpel3 m11 movd subpel0, [myq+0] pshufb subpel0, m2 movd subpel1, [myq+2] pshufb subpel1, m2 movd subpel2, [myq+4] pshufb subpel2, m2 movd subpel3, [myq+6] pshufb subpel3, m2 lea stride3q, [strideq*3] sub srcq, stride3q cmp wd, 8 jg .v_w16 je .v_w8 %endif .v_w4: %if ARCH_X86_32 %if STACK_ALIGNMENT < mmsize %define srcm [rsp+mmsize*4+gprsize*1] %define tmpm [rsp+mmsize*4+gprsize*2] %endif mov tmpm, tmpq mov srcm, srcq lea r5d, [wq - 4] ; horizontal loop shl r5d, (16 - 2) ; (wq / 4) << 16 mov r5w, hw .v_w4_loop0: %endif movd m2, [srcq+strideq*0] ; 0 movhps m2, [srcq+strideq*2] ; 0 _ 2 movd m3, [srcq+strideq*1] ; 1 %if ARCH_X86_32 lea srcq, [srcq+strideq*2] movhps m3, [srcq+strideq*1] ; 1 _ 3 lea srcq, [srcq+strideq*2] %else movhps m3, [srcq+stride3q ] ; 1 _ 3 lea srcq, [srcq+strideq*4] %endif pshufd m2, m2, q2020 ; 0 2 0 2 pshufd m3, m3, q2020 ; 1 3 1 3 punpckldq m2, m3 ; 0 1 2 3 movd m3, [srcq+strideq*0] ; 4 movd m1, [srcq+strideq*1] ; 5 movd m0, [srcq+strideq*2] ; 6 %if ARCH_X86_32 lea srcq, [srcq+strideq*2] add srcq, strideq %else add srcq, stride3q %endif punpckldq m3, m1 ; 4 5 _ _ punpckldq m1, m0 ; 5 6 _ _ palignr m4, m3, m2, 4 ; 1 2 3 4 punpcklbw m3, m1 ; 45 56 punpcklbw m1, m2, m4 ; 01 12 punpckhbw m2, m4 ; 23 34 .v_w4_loop: pmaddubsw m5, m1, subpel0 ; a0 b0 mova m1, m2 pmaddubsw m2, subpel1 ; a1 b1 paddw m5, m2 mova m2, m3 pmaddubsw m3, subpel2 ; a2 b2 paddw m5, m3 movd m4, [srcq+strideq*0] punpckldq m3, m0, m4 ; 6 7 _ _ movd m0, [srcq+strideq*1] lea srcq, [srcq+strideq*2] punpckldq m4, m0 ; 7 8 _ _ punpcklbw m3, m4 ; 67 78 pmaddubsw m4, m3, subpel3 ; a3 b3 paddw m5, m4 pmulhrsw m5, m7 movq [tmpq+wq*0], m5 movhps [tmpq+wq*2], m5 lea tmpq, [tmpq+wq*4] sub hd, 2 jg .v_w4_loop %if ARCH_X86_32 mov hw, r5w ; reset vertical loop mov tmpq, tmpm mov srcq, srcm add tmpq, 8 add srcq, 4 mov tmpm, tmpq mov srcm, srcq sub r5d, 1<<16 ; horizontal-- jg .v_w4_loop0 %endif RET %if ARCH_X86_64 .v_w8: .v_w16: lea r5d, [wq - 8] ; horizontal loop mov r8, tmpq mov r6, srcq shl r5d, 8 - 3; (wq / 8) << 8 mov r5b, hb .v_w8_loop0: movq m4, [srcq+strideq*0] ; 0 movq m5, [srcq+strideq*1] ; 1 lea srcq, [srcq+strideq*2] movq m6, [srcq+strideq*0] ; 2 movq m0, [srcq+strideq*1] ; 3 lea srcq, [srcq+strideq*2] movq m1, [srcq+strideq*0] ; 4 movq m2, [srcq+strideq*1] ; 5 lea srcq, [srcq+strideq*2] ; movq m3, [srcq+strideq*0] ; 6 shufpd m4, m0, 0x0c shufpd m5, m1, 0x0c punpcklbw m1, m4, m5 ; 01 punpckhbw m4, m5 ; 34 shufpd m6, m2, 0x0c punpcklbw m2, m5, m6 ; 12 punpckhbw m5, m6 ; 45 shufpd m0, m3, 0x0c punpcklbw m3, m6, m0 ; 23 punpckhbw m6, m0 ; 56 .v_w8_loop: movq m12, [srcq+strideq*1] ; 8 lea srcq, [srcq+strideq*2] movq m13, [srcq+strideq*0] ; 9 pmaddubsw m14, m1, subpel0 ; a0 pmaddubsw m15, m2, subpel0 ; b0 mova m1, m3 mova m2, m4 pmaddubsw m3, subpel1 ; a1 pmaddubsw m4, subpel1 ; b1 paddw m14, m3 paddw m15, m4 mova m3, m5 mova m4, m6 pmaddubsw m5, subpel2 ; a2 pmaddubsw m6, subpel2 ; b2 paddw m14, m5 paddw m15, m6 shufpd m6, m0, m12, 0x0d shufpd m0, m12, m13, 0x0c punpcklbw m5, m6, m0 ; 67 punpckhbw m6, m0 ; 78 pmaddubsw m12, m5, subpel3 ; a3 pmaddubsw m13, m6, subpel3 ; b3 paddw m14, m12 paddw m15, m13 pmulhrsw m14, m7 pmulhrsw m15, m7 movu [tmpq+wq*0], xm14 movu [tmpq+wq*2], xm15 lea tmpq, [tmpq+wq*4] sub hd, 2 jg .v_w8_loop movzx hd, r5b ; reset vertical loop add r8, 16 add r6, 8 mov tmpq, r8 mov srcq, r6 sub r5d, 1<<8 ; horizontal-- jg .v_w8_loop0 RET %endif ;ARCH_X86_64 %undef subpel0 %undef subpel1 %undef subpel2 %undef subpel3 .hv: %assign stack_offset org_stack_offset cmp wd, 4 jg .hv_w8 and mxd, 0xff movd m1, [base_reg+mxq*8+subpel_filters-prep_ssse3+2] %if ARCH_X86_32 mov mxd, myd and mxd, 0xff shr myd, 16 cmp hd, 4 cmovle myd, mxd movq m0, [base_reg+myq*8+subpel_filters-prep_ssse3] mov r5, r2; use as new base %define base_reg r5 %assign regs_used 2 ALLOC_STACK -mmsize*14 %assign regs_used 7 mov strideq, [rstk+stack_offset+gprsize*3] lea strideq, [strideq*3 + 1] sub [rstk+stack_offset+gprsize*2], strideq mov strideq, [rstk+stack_offset+gprsize*3] mov srcq, [rstk+stack_offset+gprsize*2] %define subpelv0 [rsp+mmsize*0] %define subpelv1 [rsp+mmsize*1] %define subpelv2 [rsp+mmsize*2] %define subpelv3 [rsp+mmsize*3] punpcklbw m0, m0 psraw m0, 8 ; sign-extend pshufd m6, m0, q0000 mova subpelv0, m6 pshufd m6, m0, q1111 mova subpelv1, m6 pshufd m6, m0, q2222 mova subpelv2, m6 pshufd m6, m0, q3333 mova subpelv3, m6 %else movzx mxd, myb shr myd, 16 cmp hd, 4 cmovle myd, mxd movq m0, [base_reg+myq*8+subpel_filters-prep_ssse3] ALLOC_STACK mmsize*14, 14 lea stride3q, [strideq*3] sub srcq, stride3q dec srcq %define subpelv0 m10 %define subpelv1 m11 %define subpelv2 m12 %define subpelv3 m13 punpcklbw m0, m0 psraw m0, 8 ; sign-extend mova m8, [base+pw_8192] mova m9, [base+pd_32] pshufd m10, m0, q0000 pshufd m11, m0, q1111 pshufd m12, m0, q2222 pshufd m13, m0, q3333 %endif pshufd m7, m1, q0000 .hv_w4: %define hv4_line_0_0 4 %define hv4_line_0_1 5 %define hv4_line_0_2 6 %define hv4_line_0_3 7 %define hv4_line_0_4 8 %define hv4_line_0_5 9 %define hv4_line_1_0 10 %define hv4_line_1_1 11 %define hv4_line_1_2 12 %define hv4_line_1_3 13 ; ; %if ARCH_X86_32 %define w8192reg [base+pw_8192] %define d32reg [base+pd_32] %else %define w8192reg m8 %define d32reg m9 %endif ; lower shuffle 0 1 2 3 4 mova m6, [base+subpel_h_shuf4] movq m5, [srcq+strideq*0] ; 0 _ _ _ movhps m5, [srcq+strideq*1] ; 0 _ 1 _ movq m4, [srcq+strideq*2] ; 2 _ _ _ %if ARCH_X86_32 lea srcq, [srcq+strideq*2] add srcq, strideq movhps m4, [srcq+strideq*0] ; 2 _ 3 _ add srcq, strideq %else movhps m4, [srcq+stride3q ] ; 2 _ 3 _ lea srcq, [srcq+strideq*4] %endif pshufb m2, m5, m6 ;H subpel_h_shuf4 0 ~ 1 ~ pshufb m0, m4, m6 ;H subpel_h_shuf4 2 ~ 3 ~ pmaddubsw m2, m7 ;H subpel_filters pmaddubsw m0, m7 ;H subpel_filters phaddw m2, m0 ;H 0 1 2 3 pmulhrsw m2, w8192reg ;H pw_8192 SAVELINE_W4 m2, 2, 0 ; upper shuffle 2 3 4 5 6 mova m6, [base+subpel_h_shuf4+16] pshufb m2, m5, m6 ;H subpel_h_shuf4 0 ~ 1 ~ pshufb m0, m4, m6 ;H subpel_h_shuf4 2 ~ 3 ~ pmaddubsw m2, m7 ;H subpel_filters pmaddubsw m0, m7 ;H subpel_filters phaddw m2, m0 ;H 0 1 2 3 pmulhrsw m2, w8192reg ;H pw_8192 ; ; lower shuffle mova m6, [base+subpel_h_shuf4] movq m5, [srcq+strideq*0] ; 4 _ _ _ movhps m5, [srcq+strideq*1] ; 4 _ 5 _ movq m4, [srcq+strideq*2] ; 6 _ _ _ pshufb m3, m5, m6 ;H subpel_h_shuf4 4 ~ 5 ~ pshufb m0, m4, m6 ;H subpel_h_shuf4 6 ~ 6 ~ pmaddubsw m3, m7 ;H subpel_filters pmaddubsw m0, m7 ;H subpel_filters phaddw m3, m0 ;H 4 5 6 7 pmulhrsw m3, w8192reg ;H pw_8192 SAVELINE_W4 m3, 3, 0 ; upper shuffle mova m6, [base+subpel_h_shuf4+16] pshufb m3, m5, m6 ;H subpel_h_shuf4 4 ~ 5 ~ pshufb m0, m4, m6 ;H subpel_h_shuf4 6 ~ 6 ~ pmaddubsw m3, m7 ;H subpel_filters pmaddubsw m0, m7 ;H subpel_filters phaddw m3, m0 ;H 4 5 6 7 pmulhrsw m3, w8192reg ;H pw_8192 ; %if ARCH_X86_32 lea srcq, [srcq+strideq*2] add srcq, strideq %else add srcq, stride3q %endif ;process high palignr m4, m3, m2, 4;V 1 2 3 4 punpcklwd m1, m2, m4 ; V 01 12 punpckhwd m2, m4 ; V 23 34 pshufd m0, m3, q2121;V 5 6 5 6 punpcklwd m3, m0 ; V 45 56 SAVELINE_W4 m0, 0, 1 SAVELINE_W4 m1, 1, 1 SAVELINE_W4 m2, 2, 1 SAVELINE_W4 m3, 3, 1 ;process low RESTORELINE_W4 m2, 2, 0 RESTORELINE_W4 m3, 3, 0 palignr m4, m3, m2, 4;V 1 2 3 4 punpcklwd m1, m2, m4 ; V 01 12 punpckhwd m2, m4 ; V 23 34 pshufd m0, m3, q2121;V 5 6 5 6 punpcklwd m3, m0 ; V 45 56 .hv_w4_loop: ;process low pmaddwd m5, m1, subpelv0 ; V a0 b0 mova m1, m2 pmaddwd m2, subpelv1; V a1 b1 paddd m5, m2 mova m2, m3 pmaddwd m3, subpelv2; V a2 b2 paddd m5, m3 ; mova m6, [base+subpel_h_shuf4] movq m4, [srcq+strideq*0] ; 7 movhps m4, [srcq+strideq*1] ; 7 _ 8 _ pshufb m4, m6 ;H subpel_h_shuf4 7 ~ 8 ~ pmaddubsw m4, m7 ;H subpel_filters phaddw m4, m4 ;H 7 8 7 8 pmulhrsw m4, w8192reg ;H pw_8192 palignr m3, m4, m0, 12 ; 6 7 8 7 mova m0, m4 punpcklwd m3, m4 ; 67 78 pmaddwd m4, m3, subpelv3; a3 b3 paddd m5, d32reg ; pd_32 paddd m5, m4 psrad m5, 6 SAVELINE_W4 m0, 0, 0 SAVELINE_W4 m1, 1, 0 SAVELINE_W4 m2, 2, 0 SAVELINE_W4 m3, 3, 0 SAVELINE_W4 m5, 5, 0 ;process high RESTORELINE_W4 m0, 0, 1 RESTORELINE_W4 m1, 1, 1 RESTORELINE_W4 m2, 2, 1 RESTORELINE_W4 m3, 3, 1 pmaddwd m5, m1, subpelv0; V a0 b0 mova m1, m2 pmaddwd m2, subpelv1; V a1 b1 paddd m5, m2 mova m2, m3 pmaddwd m3, subpelv2; V a2 b2 paddd m5, m3 ; mova m6, [base+subpel_h_shuf4+16] movq m4, [srcq+strideq*0] ; 7 movhps m4, [srcq+strideq*1] ; 7 _ 8 _ pshufb m4, m6 ;H subpel_h_shuf4 7 ~ 8 ~ pmaddubsw m4, m7 ;H subpel_filters phaddw m4, m4 ;H 7 8 7 8 pmulhrsw m4, w8192reg ;H pw_8192 palignr m3, m4, m0, 12 ; 6 7 8 7 mova m0, m4 punpcklwd m3, m4 ; 67 78 pmaddwd m4, m3, subpelv3; a3 b3 paddd m5, d32reg ; pd_32 paddd m5, m4 psrad m4, m5, 6 ; RESTORELINE_W4 m5, 5, 0 packssdw m5, m4 pshufd m5, m5, q3120 movu [tmpq], m5 lea srcq, [srcq+strideq*2] add tmpq, 16 sub hd, 2 SAVELINE_W4 m0, 0, 1 SAVELINE_W4 m1, 1, 1 SAVELINE_W4 m2, 2, 1 SAVELINE_W4 m3, 3, 1 RESTORELINE_W4 m0, 0, 0 RESTORELINE_W4 m1, 1, 0 RESTORELINE_W4 m2, 2, 0 RESTORELINE_W4 m3, 3, 0 jg .hv_w4_loop RET %undef subpelv0 %undef subpelv1 %undef subpelv2 %undef subpelv3 ; .hv_w8: %assign stack_offset org_stack_offset %define hv8_line_1 0 %define hv8_line_2 1 %define hv8_line_3 2 %define hv8_line_4 3 %define hv8_line_6 4 shr mxd, 16 %if ARCH_X86_32 %define base_reg r2 %define subpelh0 [rsp+mmsize*5] %define subpelh1 [rsp+mmsize*6] %define subpelv0 [rsp+mmsize*7] %define subpelv1 [rsp+mmsize*8] %define subpelv2 [rsp+mmsize*9] %define subpelv3 [rsp+mmsize*10] %define accuv0 [rsp+mmsize*11] %define accuv1 [rsp+mmsize*12] movq m1, [base_reg+mxq*8+subpel_filters-prep_ssse3] movzx mxd, myw and mxd, 0xff shr myd, 16 cmp hd, 4 cmovle myd, mxd movq m5, [base_reg+myq*8+subpel_filters-prep_ssse3] ALLOC_STACK -mmsize*13 %if STACK_ALIGNMENT < mmsize mov rstk, r2m %define tmpm [rsp+mmsize*13+gprsize*1] %define srcm [rsp+mmsize*13+gprsize*2] %define stridem [rsp+mmsize*13+gprsize*3] mov stridem, rstk %endif mov r6, r2 %define base_reg r6 pshufd m0, m1, q0000 pshufd m1, m1, q1111 punpcklbw m5, m5 psraw m5, 8 ; sign-extend pshufd m2, m5, q0000 pshufd m3, m5, q1111 pshufd m4, m5, q2222 pshufd m5, m5, q3333 mova subpelh0, m0 mova subpelh1, m1 mova subpelv0, m2 mova subpelv1, m3 mova subpelv2, m4 mova subpelv3, m5 W32_RESTORE_SSQ lea strided, [strided*3] sub srcd, strided sub srcd, 3 mov srcm, srcd W32_RESTORE_SSQ %else ALLOC_STACK mmsize*5, 16 %define subpelh0 m10 %define subpelh1 m11 %define subpelv0 m12 %define subpelv1 m13 %define subpelv2 m14 %define subpelv3 m15 %define accuv0 m8 %define accuv1 m9 movq m0, [base_reg+mxq*8+subpel_filters-prep_ssse3] movzx mxd, myb shr myd, 16 cmp hd, 4 cmovle myd, mxd movq m1, [base_reg+myq*8+subpel_filters-prep_ssse3] pshufd subpelh0, m0, q0000 pshufd subpelh1, m0, q1111 punpcklbw m1, m1 psraw m1, 8 ; sign-extend pshufd subpelv0, m1, q0000 pshufd subpelv1, m1, q1111 pshufd subpelv2, m1, q2222 pshufd subpelv3, m1, q3333 lea stride3q, [strideq*3] sub srcq, 3 sub srcq, stride3q mov r6, srcq %endif lea r5d, [wq-4] %if ARCH_X86_64 mov r8, tmpq %else mov tmpm, tmpq %endif shl r5d, (16 - 2) mov r5w, hw .hv_w8_loop0: movu m4, [srcq+strideq*0] ; 0 = _ _ movu m5, [srcq+strideq*1] ; 1 = _ _ lea srcq, [srcq+strideq*2] %if ARCH_X86_64 mova m7, [base+subpel_h_shufA] mova m8, [base+subpel_h_shufB] mova m9, [base+subpel_h_shufC] %endif HV_H_W8 m4, m1, m2, m3, m7, m8, m9 ; 0 ~ ~ ~ HV_H_W8 m5, m1, m2, m3, m7, m8, m9 ; 1 ~ ~ ~ movu m6, [srcq+strideq*0] ; 2 = _ _ movu m0, [srcq+strideq*1] ; 3 = _ _ lea srcq, [srcq+strideq*2] HV_H_W8 m6, m1, m2, m3, m7, m8, m9 ; 2 ~ ~ ~ HV_H_W8 m0, m1, m2, m3, m7, m8, m9 ; 3 ~ ~ ~ ; mova m7, [base+pw_8192] pmulhrsw m4, m7 ; H pw_8192 pmulhrsw m5, m7 ; H pw_8192 pmulhrsw m6, m7 ; H pw_8192 pmulhrsw m0, m7 ; H pw_8192 punpcklwd m1, m4, m5 ; 0 1 ~ punpcklwd m2, m5, m6 ; 1 2 ~ punpcklwd m3, m6, m0 ; 2 3 ~ SAVELINE_W8 1, m1 SAVELINE_W8 2, m2 SAVELINE_W8 3, m3 ; mova m7, [base+subpel_h_shufA] movu m4, [srcq+strideq*0] ; 4 = _ _ movu m5, [srcq+strideq*1] ; 5 = _ _ lea srcq, [srcq+strideq*2] movu m6, [srcq+strideq*0] ; 6 = _ _ HV_H_W8 m4, m1, m2, m3, m7, m8, m9 ; 4 ~ ~ ~ HV_H_W8 m5, m1, m2, m3, m7, m8, m9 ; 5 ~ ~ ~ HV_H_W8 m6, m1, m2, m3, m7, m8, m9 ; 6 ~ ~ ~ mova m7, [base+pw_8192] pmulhrsw m1, m4, m7 ; H pw_8192 4 ~ pmulhrsw m2, m5, m7 ; H pw_8192 5 ~ pmulhrsw m3, m6, m7 ; H pw_8192 6 ~ punpcklwd m4, m0, m1 ; 3 4 ~ punpcklwd m5, m1, m2 ; 4 5 ~ punpcklwd m6, m2, m3 ; 5 6 ~ ; SAVELINE_W8 6, m3 RESTORELINE_W8 1, m1 RESTORELINE_W8 2, m2 RESTORELINE_W8 3, m3 .hv_w8_loop: ; m8 accu for V a ; m9 accu for V b SAVELINE_W8 1, m3 SAVELINE_W8 2, m4 SAVELINE_W8 3, m5 SAVELINE_W8 4, m6 %if ARCH_X86_32 pmaddwd m0, m1, subpelv0 ; a0 pmaddwd m7, m2, subpelv0 ; b0 pmaddwd m3, subpelv1 ; a1 pmaddwd m4, subpelv1 ; b1 paddd m0, m3 paddd m7, m4 pmaddwd m5, subpelv2 ; a2 pmaddwd m6, subpelv2 ; b2 paddd m0, m5 paddd m7, m6 mova m5, [base+pd_32] paddd m0, m5 ; pd_512 paddd m7, m5 ; pd_512 mova accuv0, m0 mova accuv1, m7 %else pmaddwd m8, m1, subpelv0 ; a0 pmaddwd m9, m2, subpelv0 ; b0 pmaddwd m3, subpelv1 ; a1 pmaddwd m4, subpelv1 ; b1 paddd m8, m3 paddd m9, m4 pmaddwd m5, subpelv2 ; a2 pmaddwd m6, subpelv2 ; b2 paddd m8, m5 paddd m9, m6 mova m7, [base+pd_32] paddd m8, m7 ; pd_512 paddd m9, m7 ; pd_512 mova m7, [base+subpel_h_shufB] mova m6, [base+subpel_h_shufC] mova m5, [base+subpel_h_shufA] %endif movu m0, [srcq+strideq*1] ; 7 movu m4, [srcq+strideq*2] ; 8 lea srcq, [srcq+strideq*2] HV_H_W8 m0, m1, m2, m3, m5, m7, m6 HV_H_W8 m4, m1, m2, m3, m5, m7, m6 mova m5, [base+pw_8192] pmulhrsw m0, m5 ; H pw_8192 pmulhrsw m4, m5 ; H pw_8192 RESTORELINE_W8 6, m6 punpcklwd m5, m6, m0 ; 6 7 ~ punpcklwd m6, m0, m4 ; 7 8 ~ pmaddwd m1, m5, subpelv3 ; a3 paddd m2, m1, accuv0 pmaddwd m1, m6, subpelv3 ; b3 paddd m1, m1, accuv1 ; H + V psrad m2, 6 psrad m1, 6 packssdw m2, m1 ; d -> w movq [tmpq+wq*0], m2 movhps [tmpq+wq*2], m2 lea tmpq, [tmpq+wq*4] sub hd, 2 jle .hv_w8_outer SAVELINE_W8 6, m4 RESTORELINE_W8 1, m1 RESTORELINE_W8 2, m2 RESTORELINE_W8 3, m3 RESTORELINE_W8 4, m4 jmp .hv_w8_loop .hv_w8_outer: movzx hd, r5w %if ARCH_X86_32 add dword tmpm, 8 mov tmpq, tmpm mov srcq, srcm add srcq, 4 mov srcm, srcq %else add r8, 8 mov tmpq, r8 add r6, 4 mov srcq, r6 %endif sub r5d, 1<<16 jg .hv_w8_loop0 RET %if WIN64 DECLARE_REG_TMP 6, 4 %else DECLARE_REG_TMP 6, 7 %endif %macro BIDIR_FN 1 ; op %1 0 lea stride3q, [strideq*3] jmp wq .w4_loop: %1_INC_PTR 2 %1 0 lea dstq, [dstq+strideq*4] .w4: ; tile 4x movd [dstq ], m0 ; copy dw[0] pshuflw m1, m0, q1032 ; swap dw[1] and dw[0] movd [dstq+strideq*1], m1 ; copy dw[1] punpckhqdq m0, m0 ; swap dw[3,2] with dw[1,0] movd [dstq+strideq*2], m0 ; dw[2] psrlq m0, 32 ; shift right in dw[3] movd [dstq+stride3q ], m0 ; copy sub hd, 4 jg .w4_loop RET .w8_loop: %1_INC_PTR 2 %1 0 lea dstq, [dstq+strideq*2] .w8: movq [dstq ], m0 movhps [dstq+strideq*1], m0 sub hd, 2 jg .w8_loop RET .w16_loop: %1_INC_PTR 2 %1 0 lea dstq, [dstq+strideq] .w16: mova [dstq ], m0 dec hd jg .w16_loop RET .w32_loop: %1_INC_PTR 4 %1 0 lea dstq, [dstq+strideq] .w32: mova [dstq ], m0 %1 2 mova [dstq + 16 ], m0 dec hd jg .w32_loop RET .w64_loop: %1_INC_PTR 8 %1 0 add dstq, strideq .w64: %assign i 0 %rep 4 mova [dstq + i*16 ], m0 %assign i i+1 %if i < 4 %1 2*i %endif %endrep dec hd jg .w64_loop RET .w128_loop: %1_INC_PTR 16 %1 0 add dstq, strideq .w128: %assign i 0 %rep 8 mova [dstq + i*16 ], m0 %assign i i+1 %if i < 8 %1 2*i %endif %endrep dec hd jg .w128_loop RET %endmacro %macro AVG 1 ; src_offset ; writes AVG of tmp1 tmp2 uint16 coeffs into uint8 pixel mova m0, [tmp1q+(%1+0)*mmsize] ; load 8 coef(2bytes) from tmp1 paddw m0, [tmp2q+(%1+0)*mmsize] ; load/add 8 coef(2bytes) tmp2 mova m1, [tmp1q+(%1+1)*mmsize] paddw m1, [tmp2q+(%1+1)*mmsize] pmulhrsw m0, m2 pmulhrsw m1, m2 packuswb m0, m1 ; pack/trunc 16 bits from m0 & m1 to 8 bit %endmacro %macro AVG_INC_PTR 1 add tmp1q, %1*mmsize add tmp2q, %1*mmsize %endmacro cglobal avg, 4, 7, 3, dst, stride, tmp1, tmp2, w, h, stride3 LEA r6, avg_ssse3_table tzcnt wd, wm ; leading zeros movifnidn hd, hm ; move h(stack) to h(register) if not already that register movsxd wq, dword [r6+wq*4] ; push table entry matching the tile width (tzcnt) in widen reg mova m2, [pw_1024+r6-avg_ssse3_table] ; fill m2 with shift/align add wq, r6 BIDIR_FN AVG %macro W_AVG 1 ; src_offset ; (a * weight + b * (16 - weight) + 128) >> 8 ; = ((a - b) * weight + (b << 4) + 128) >> 8 ; = ((((a - b) * ((weight-16) << 12)) >> 16) + a + 8) >> 4 ; = ((((b - a) * (-weight << 12)) >> 16) + b + 8) >> 4 mova m2, [tmp1q+(%1+0)*mmsize] mova m0, m2 psubw m2, [tmp2q+(%1+0)*mmsize] mova m3, [tmp1q+(%1+1)*mmsize] mova m1, m3 psubw m3, [tmp2q+(%1+1)*mmsize] pmulhw m2, m4 pmulhw m3, m4 paddw m0, m2 paddw m1, m3 pmulhrsw m0, m5 pmulhrsw m1, m5 packuswb m0, m1 %endmacro %define W_AVG_INC_PTR AVG_INC_PTR cglobal w_avg, 4, 7, 6, dst, stride, tmp1, tmp2, w, h, stride3 LEA r6, w_avg_ssse3_table tzcnt wd, wm movd m4, r6m movifnidn hd, hm pxor m0, m0 movsxd wq, dword [r6+wq*4] mova m5, [pw_2048+r6-w_avg_ssse3_table] pshufb m4, m0 psllw m4, 12 ; (weight-16) << 12 when interpreted as signed add wq, r6 cmp dword r6m, 7 jg .weight_gt7 mov r6, tmp1q psubw m0, m4 mov tmp1q, tmp2q mova m4, m0 ; -weight mov tmp2q, r6 .weight_gt7: BIDIR_FN W_AVG %macro MASK 1 ; src_offset ; (a * m + b * (64 - m) + 512) >> 10 ; = ((a - b) * m + (b << 6) + 512) >> 10 ; = ((((b - a) * (-m << 10)) >> 16) + b + 8) >> 4 mova m3, [maskq+(%1+0)*(mmsize/2)] mova m0, [tmp2q+(%1+0)*mmsize] ; b psubw m1, m0, [tmp1q+(%1+0)*mmsize] ; b - a mova m6, m3 ; m psubb m3, m4, m6 ; -m paddw m1, m1 ; (b - a) << 1 paddb m3, m3 ; -m << 1 punpcklbw m2, m4, m3 ; -m << 9 (<< 8 when ext as uint16) pmulhw m1, m2 ; (-m * (b - a)) << 10 paddw m0, m1 ; + b mova m1, [tmp2q+(%1+1)*mmsize] ; b psubw m2, m1, [tmp1q+(%1+1)*mmsize] ; b - a paddw m2, m2 ; (b - a) << 1 mova m6, m3 ; (-m << 1) punpckhbw m3, m4, m6 ; (-m << 9) pmulhw m2, m3 ; (-m << 9) paddw m1, m2 ; (-m * (b - a)) << 10 pmulhrsw m0, m5 ; round pmulhrsw m1, m5 ; round packuswb m0, m1 ; interleave 16 -> 8 %endmacro %macro MASK_INC_PTR 1 add maskq, %1*mmsize/2 add tmp1q, %1*mmsize add tmp2q, %1*mmsize %endmacro %if ARCH_X86_64 cglobal mask, 4, 8, 7, dst, stride, tmp1, tmp2, w, h, mask, stride3 movifnidn hd, hm %else cglobal mask, 4, 7, 7, dst, stride, tmp1, tmp2, w, mask, stride3 %define hd dword r5m %endif %define base r6-mask_ssse3_table LEA r6, mask_ssse3_table tzcnt wd, wm movsxd wq, dword [r6+wq*4] pxor m4, m4 mova m5, [base+pw_2048] add wq, r6 mov maskq, r6m BIDIR_FN MASK %undef hd %macro W_MASK_420_B 2 ; src_offset in bytes, mask_out ;**** do m0 = u16.dst[7..0], m%2 = u16.m[7..0] **** mova m0, [tmp1q+(%1)] mova m1, [tmp2q+(%1)] mova m2, reg_pw_6903 psubw m1, m0 pabsw m%2, m1 ; abs(tmp1 - tmp2) mova m3, m2 psubusw m2, m%2 psrlw m2, 8 ; 64 - m mova m%2, m2 psllw m2, 10 pmulhw m1, m2 ; tmp2 * () paddw m0, m1 ; tmp1 + () ;**** do m1 = u16.dst[7..0], m%2 = u16.m[7..0] **** mova m1, [tmp1q+(%1)+mmsize] mova m2, [tmp2q+(%1)+mmsize] psubw m2, m1 pabsw m7, m2 ; abs(tmp1 - tmp2) psubusw m3, m7 psrlw m3, 8 ; 64 - m phaddw m%2, m3 ; pack both u16.m[8..0]runs as u8.m [15..0] psllw m3, 10 pmulhw m2, m3 %if ARCH_X86_32 mova reg_pw_2048, [base+pw_2048] %endif paddw m1, m2 pmulhrsw m0, reg_pw_2048 ; round/scale 2048 pmulhrsw m1, reg_pw_2048 ; round/scale 2048 packuswb m0, m1 ; concat m0 = u8.dst[15..0] %endmacro %macro W_MASK_420 2 W_MASK_420_B (%1*16), %2 %endmacro %define base r6-w_mask_420_ssse3_table %if ARCH_X86_64 %define reg_pw_6903 m8 %define reg_pw_2048 m9 ; args: dst, stride, tmp1, tmp2, w, h, mask, sign cglobal w_mask_420, 4, 8, 10, dst, stride, tmp1, tmp2, w, h, mask lea r6, [w_mask_420_ssse3_table] mov wd, wm tzcnt r7d, wd movd m0, r7m ; sign movifnidn hd, hm movsxd r7, [r6+r7*4] mova reg_pw_6903, [base+pw_6903] ; ((64 - 38) << 8) + 255 - 8 mova reg_pw_2048, [base+pw_2048] movd m6, [base+pw_258] ; 64 * 4 + 2 add r7, r6 mov maskq, maskmp psubw m6, m0 pshuflw m6, m6, q0000 punpcklqdq m6, m6 W_MASK_420 0, 4 jmp r7 %define loop_w r7d %else %define reg_pw_6903 [base+pw_6903] %define reg_pw_2048 m3 cglobal w_mask_420, 4, 7, 8, dst, stride, tmp1, tmp2, w, mask tzcnt wd, wm LEA r6, w_mask_420_ssse3_table movd m0, r7m ; sign mov maskq, r6mp mov wd, [r6+wq*4] movd m6, [base+pw_258] add wq, r6 psubw m6, m0 pshuflw m6, m6, q0000 punpcklqdq m6, m6 W_MASK_420 0, 4 jmp wd %define loop_w dword r0m %define hd dword r5m %endif .w4_loop: add tmp1q, 2*16 add tmp2q, 2*16 W_MASK_420 0, 4 lea dstq, [dstq+strideq*2] add maskq, 4 .w4: movd [dstq ], m0 ; copy m0[0] pshuflw m1, m0, q1032 movd [dstq+strideq*1], m1 ; copy m0[1] lea dstq, [dstq+strideq*2] punpckhqdq m0, m0 movd [dstq+strideq*0], m0 ; copy m0[2] psrlq m0, 32 movd [dstq+strideq*1], m0 ; copy m0[3] psubw m1, m6, m4 ; a _ c _ psrlq m4, 32 ; b _ d _ psubw m1, m4 psrlw m1, 2 packuswb m1, m1 pshuflw m1, m1, q2020 movd [maskq], m1 sub hd, 4 jg .w4_loop RET .w8_loop: add tmp1q, 2*16 add tmp2q, 2*16 W_MASK_420 0, 4 lea dstq, [dstq+strideq*2] add maskq, 4 .w8: movq [dstq ], m0 movhps [dstq+strideq*1], m0 psubw m0, m6, m4 punpckhqdq m4, m4 psubw m0, m4 psrlw m0, 2 packuswb m0, m0 movd [maskq], m0 sub hd, 2 jg .w8_loop RET .w16: ; w32/64/128 %if ARCH_X86_32 mov wd, wm ; because we altered it in 32bit setup %endif mov loop_w, wd ; use width as counter jmp .w16ge_inner_loop_first .w16ge_loop: lea tmp1q, [tmp1q+wq*2] ; skip even line pixels lea tmp2q, [tmp2q+wq*2] ; skip even line pixels sub dstq, wq mov loop_w, wd lea dstq, [dstq+strideq*2] .w16ge_inner_loop: W_MASK_420_B 0, 4 .w16ge_inner_loop_first: mova [dstq ], m0 W_MASK_420_B wq*2, 5 ; load matching even line (offset = widthpx * (16+16)) mova [dstq+strideq*1], m0 psubw m1, m6, m4 ; m9 == 64 * 4 + 2 psubw m1, m5 ; - odd line mask psrlw m1, 2 ; >> 2 packuswb m1, m1 movq [maskq], m1 add tmp1q, 2*16 add tmp2q, 2*16 add maskq, 8 add dstq, 16 sub loop_w, 16 jg .w16ge_inner_loop sub hd, 2 jg .w16ge_loop RET %undef reg_pw_6903 %undef reg_pw_2048 %undef dst_bak %undef loop_w %undef orig_w %undef hd %macro BLEND_64M 4; a, b, mask1, mask2 punpcklbw m0, %1, %2; {b;a}[7..0] punpckhbw %1, %2 ; {b;a}[15..8] pmaddubsw m0, %3 ; {b*m[0] + (64-m[0])*a}[7..0] u16 pmaddubsw %1, %4 ; {b*m[1] + (64-m[1])*a}[15..8] u16 pmulhrsw m0, m5 ; {((b*m[0] + (64-m[0])*a) + 1) / 32}[7..0] u16 pmulhrsw %1, m5 ; {((b*m[1] + (64-m[0])*a) + 1) / 32}[15..8] u16 packuswb m0, %1 ; {blendpx}[15..0] u8 %endmacro %macro BLEND 2; a, b psubb m3, m4, m0 ; m3 = (64 - m) punpcklbw m2, m3, m0 ; {m;(64-m)}[7..0] punpckhbw m3, m0 ; {m;(64-m)}[15..8] BLEND_64M %1, %2, m2, m3 %endmacro cglobal blend, 3, 7, 7, dst, ds, tmp, w, h, mask %define base r6-blend_ssse3_table LEA r6, blend_ssse3_table tzcnt wd, wm movifnidn hd, hm movifnidn maskq, maskmp movsxd wq, dword [r6+wq*4] mova m4, [base+pb_64] mova m5, [base+pw_512] add wq, r6 lea r6, [dsq*3] jmp wq .w4: movq m0, [maskq]; m movd m1, [dstq+dsq*0] ; a movd m6, [dstq+dsq*1] punpckldq m1, m6 movq m6, [tmpq] ; b psubb m3, m4, m0 ; m3 = (64 - m) punpcklbw m2, m3, m0 ; {m;(64-m)}[7..0] punpcklbw m1, m6 ; {b;a}[7..0] pmaddubsw m1, m2 ; {b*m[0] + (64-m[0])*a}[7..0] u16 pmulhrsw m1, m5 ; {((b*m[0] + (64-m[0])*a) + 1) / 32}[7..0] u16 packuswb m1, m0 ; {blendpx}[15..0] u8 movd [dstq+dsq*0], m1 psrlq m1, 32 movd [dstq+dsq*1], m1 add maskq, 8 add tmpq, 8 lea dstq, [dstq+dsq*2] ; dst_stride * 2 sub hd, 2 jg .w4 RET .w8: mova m0, [maskq]; m movq m1, [dstq+dsq*0] ; a movhps m1, [dstq+dsq*1] mova m6, [tmpq] ; b BLEND m1, m6 movq [dstq+dsq*0], m0 movhps [dstq+dsq*1], m0 add maskq, 16 add tmpq, 16 lea dstq, [dstq+dsq*2] ; dst_stride * 2 sub hd, 2 jg .w8 RET .w16: mova m0, [maskq]; m mova m1, [dstq] ; a mova m6, [tmpq] ; b BLEND m1, m6 mova [dstq], m0 add maskq, 16 add tmpq, 16 add dstq, dsq ; dst_stride dec hd jg .w16 RET .w32: %assign i 0 %rep 2 mova m0, [maskq+16*i]; m mova m1, [dstq+16*i] ; a mova m6, [tmpq+16*i] ; b BLEND m1, m6 mova [dstq+i*16], m0 %assign i i+1 %endrep add maskq, 32 add tmpq, 32 add dstq, dsq ; dst_stride dec hd jg .w32 RET cglobal blend_v, 3, 6, 8, dst, ds, tmp, w, h, mask %define base r5-blend_v_ssse3_table LEA r5, blend_v_ssse3_table tzcnt wd, wm movifnidn hd, hm movsxd wq, dword [r5+wq*4] mova m5, [base+pw_512] add wq, r5 add maskq, obmc_masks-blend_v_ssse3_table jmp wq .w2: movd m3, [maskq+4] punpckldq m3, m3 ; 2 mask blend is provided for 4 pixels / 2 lines .w2_loop: movd m1, [dstq+dsq*0] ; a {..;a;a} pinsrw m1, [dstq+dsq*1], 1 movd m2, [tmpq] ; b punpcklbw m0, m1, m2; {b;a}[7..0] pmaddubsw m0, m3 ; {b*m + (64-m)*a}[7..0] u16 pmulhrsw m0, m5 ; {((b*m + (64-m)*a) + 1) / 32}[7..0] u16 packuswb m0, m1 ; {blendpx}[8..0] u8 movd r3d, m0 mov [dstq+dsq*0], r3w shr r3d, 16 mov [dstq+dsq*1], r3w add tmpq, 2*2 lea dstq, [dstq + dsq * 2] sub hd, 2 jg .w2_loop RET .w4: movddup m3, [maskq+8] ; 4 mask blend is provided for 8 pixels / 2 lines .w4_loop: movd m1, [dstq+dsq*0] ; a movd m2, [dstq+dsq*1] ; punpckldq m1, m2 movq m2, [tmpq] ; b punpcklbw m1, m2 ; {b;a}[7..0] pmaddubsw m1, m3 ; {b*m + (64-m)*a}[7..0] u16 pmulhrsw m1, m5 ; {((b*m + (64-m)*a) + 1) / 32}[7..0] u16 packuswb m1, m1 ; {blendpx}[8..0] u8 movd [dstq], m1 psrlq m1, 32 movd [dstq+dsq*1], m1 add tmpq, 2*4 lea dstq, [dstq+dsq*2] sub hd, 2 jg .w4_loop RET .w8: mova m3, [maskq+16] ; 8 mask blend is provided for 16 pixels .w8_loop: movq m1, [dstq+dsq*0] ; a movhps m1, [dstq+dsq*1] mova m2, [tmpq]; b BLEND_64M m1, m2, m3, m3 movq [dstq+dsq*0], m0 punpckhqdq m0, m0 movq [dstq+dsq*1], m0 add tmpq, 16 lea dstq, [dstq+dsq*2] sub hd, 2 jg .w8_loop RET .w16: ; 16 mask blend is provided for 32 pixels mova m3, [maskq+32] ; obmc_masks_16[0] (64-m[0]) mova m4, [maskq+48] ; obmc_masks_16[1] (64-m[1]) .w16_loop: mova m1, [dstq] ; a mova m2, [tmpq] ; b BLEND_64M m1, m2, m3, m4 mova [dstq], m0 add tmpq, 16 add dstq, dsq dec hd jg .w16_loop RET .w32: mova m3, [maskq+64 ] ; obmc_masks_32[0] (64-m[0]) mova m4, [maskq+80 ] ; obmc_masks_32[1] (64-m[1]) mova m6, [maskq+96 ] ; obmc_masks_32[2] (64-m[2]) mova m7, [maskq+112] ; obmc_masks_32[3] (64-m[3]) ; 16 mask blend is provided for 64 pixels .w32_loop: mova m1, [dstq+16*0] ; a mova m2, [tmpq+16*0] ; b BLEND_64M m1, m2, m3, m4 mova [dstq+16*0], m0 mova m1, [dstq+16*1] ; a mova m2, [tmpq+16*1] ; b BLEND_64M m1, m2, m6, m7 mova [dstq+16*1], m0 add tmpq, 32 add dstq, dsq dec hd jg .w32_loop RET cglobal blend_h, 3, 7, 6, dst, ds, tmp, w, h, mask %define base t0-blend_h_ssse3_table %if ARCH_X86_32 ; We need to keep the PIC pointer for w4, reload wd from stack instead DECLARE_REG_TMP 6 %else DECLARE_REG_TMP 5 mov r6d, wd %endif LEA t0, blend_h_ssse3_table tzcnt wd, wm mov hd, hm movsxd wq, dword [t0+wq*4] mova m5, [base+pw_512] add wq, t0 lea maskq, [base+obmc_masks+hq*4] neg hq jmp wq .w2: movd m0, [dstq+dsq*0] pinsrw m0, [dstq+dsq*1], 1 movd m2, [maskq+hq*2] movd m1, [tmpq] punpcklwd m2, m2 punpcklbw m0, m1 pmaddubsw m0, m2 pmulhrsw m0, m5 packuswb m0, m0 movd r3d, m0 mov [dstq+dsq*0], r3w shr r3d, 16 mov [dstq+dsq*1], r3w lea dstq, [dstq+dsq*2] add tmpq, 2*2 add hq, 2 jl .w2 RET .w4: %if ARCH_X86_32 mova m3, [base+blend_shuf] %else mova m3, [blend_shuf] %endif .w4_loop: movd m0, [dstq+dsq*0] movd m2, [dstq+dsq*1] punpckldq m0, m2 ; a movq m1, [tmpq] ; b movq m2, [maskq+hq*2] ; m pshufb m2, m3 punpcklbw m0, m1 pmaddubsw m0, m2 pmulhrsw m0, m5 packuswb m0, m0 movd [dstq+dsq*0], m0 psrlq m0, 32 movd [dstq+dsq*1], m0 lea dstq, [dstq+dsq*2] add tmpq, 4*2 add hq, 2 jl .w4_loop RET .w8: movd m4, [maskq+hq*2] punpcklwd m4, m4 pshufd m3, m4, q0000 pshufd m4, m4, q1111 movq m1, [dstq+dsq*0] ; a movhps m1, [dstq+dsq*1] mova m2, [tmpq] BLEND_64M m1, m2, m3, m4 movq [dstq+dsq*0], m0 movhps [dstq+dsq*1], m0 lea dstq, [dstq+dsq*2] add tmpq, 8*2 add hq, 2 jl .w8 RET ; w16/w32/w64/w128 .w16: %if ARCH_X86_32 mov r6d, wm %endif sub dsq, r6 .w16_loop0: movd m3, [maskq+hq*2] pshuflw m3, m3, q0000 punpcklqdq m3, m3 mov wd, r6d .w16_loop: mova m1, [dstq] ; a mova m2, [tmpq] ; b BLEND_64M m1, m2, m3, m3 mova [dstq], m0 add dstq, 16 add tmpq, 16 sub wd, 16 jg .w16_loop add dstq, dsq inc hq jl .w16_loop0 RET ; emu_edge args: ; const intptr_t bw, const intptr_t bh, const intptr_t iw, const intptr_t ih, ; const intptr_t x, const intptr_t y, pixel *dst, const ptrdiff_t dst_stride, ; const pixel *ref, const ptrdiff_t ref_stride ; ; bw, bh total filled size ; iw, ih, copied block -> fill bottom, right ; x, y, offset in bw/bh -> fill top, left cglobal emu_edge, 10, 13, 2, bw, bh, iw, ih, x, \ y, dst, dstride, src, sstride, \ bottomext, rightext, blk ; we assume that the buffer (stride) is larger than width, so we can ; safely overwrite by a few bytes pxor m1, m1 %if ARCH_X86_64 %define reg_zero r12q %define reg_tmp r10 %define reg_src srcq %define reg_bottomext bottomextq %define reg_rightext rightextq %define reg_blkm r9m %else %define reg_zero r6 %define reg_tmp r0 %define reg_src r1 %define reg_bottomext r0 %define reg_rightext r1 %define reg_blkm r2m %endif ; ; ref += iclip(y, 0, ih - 1) * PXSTRIDE(ref_stride) xor reg_zero, reg_zero lea reg_tmp, [ihq-1] cmp yq, ihq cmovl reg_tmp, yq test yq, yq cmovl reg_tmp, reg_zero %if ARCH_X86_64 imul reg_tmp, sstrideq add srcq, reg_tmp %else imul reg_tmp, sstridem mov reg_src, srcm add reg_src, reg_tmp %endif ; ; ref += iclip(x, 0, iw - 1) lea reg_tmp, [iwq-1] cmp xq, iwq cmovl reg_tmp, xq test xq, xq cmovl reg_tmp, reg_zero add reg_src, reg_tmp %if ARCH_X86_32 mov srcm, reg_src %endif ; ; bottom_ext = iclip(y + bh - ih, 0, bh - 1) %if ARCH_X86_32 mov r1, r1m ; restore bh %endif lea reg_bottomext, [yq+bhq] sub reg_bottomext, ihq lea r3, [bhq-1] cmovl reg_bottomext, reg_zero ; DEFINE_ARGS bw, bh, iw, ih, x, \ topext, dst, dstride, src, sstride, \ bottomext, rightext, blk ; top_ext = iclip(-y, 0, bh - 1) neg topextq cmovl topextq, reg_zero cmp reg_bottomext, bhq cmovge reg_bottomext, r3 cmp topextq, bhq cmovg topextq, r3 %if ARCH_X86_32 mov r4m, reg_bottomext ; ; right_ext = iclip(x + bw - iw, 0, bw - 1) mov r0, r0m ; restore bw %endif lea reg_rightext, [xq+bwq] sub reg_rightext, iwq lea r2, [bwq-1] cmovl reg_rightext, reg_zero DEFINE_ARGS bw, bh, iw, ih, leftext, \ topext, dst, dstride, src, sstride, \ bottomext, rightext, blk ; left_ext = iclip(-x, 0, bw - 1) neg leftextq cmovl leftextq, reg_zero cmp reg_rightext, bwq cmovge reg_rightext, r2 %if ARCH_X86_32 mov r3m, r1 %endif cmp leftextq, bwq cmovge leftextq, r2 %undef reg_zero %undef reg_tmp %undef reg_src %undef reg_bottomext %undef reg_rightext DEFINE_ARGS bw, centerh, centerw, dummy, leftext, \ topext, dst, dstride, src, sstride, \ bottomext, rightext, blk ; center_h = bh - top_ext - bottom_ext %if ARCH_X86_64 lea r3, [bottomextq+topextq] sub centerhq, r3 %else mov r1, centerhm ; restore r1 sub centerhq, topextq sub centerhq, r4m mov r1m, centerhq %endif ; ; blk += top_ext * PXSTRIDE(dst_stride) mov r2, topextq %if ARCH_X86_64 imul r2, dstrideq %else mov r6, r6m ; restore dstq imul r2, dstridem %endif add dstq, r2 mov reg_blkm, dstq ; save pointer for ext ; ; center_w = bw - left_ext - right_ext mov centerwq, bwq %if ARCH_X86_64 lea r3, [rightextq+leftextq] sub centerwq, r3 %else sub centerwq, r3m sub centerwq, leftextq %endif ; vloop Macro %macro v_loop 3 ; need_left_ext, need_right_ext, suffix %if ARCH_X86_64 %define reg_tmp r12 %else %define reg_tmp r0 %endif .v_loop_%3: %if ARCH_X86_32 mov r0, r0m mov r1, r1m %endif %if %1 test leftextq, leftextq jz .body_%3 ; left extension %if ARCH_X86_64 movd m0, [srcq] %else mov r3, srcm movd m0, [r3] %endif pshufb m0, m1 xor r3, r3 .left_loop_%3: mova [dstq+r3], m0 add r3, mmsize cmp r3, leftextq jl .left_loop_%3 ; body .body_%3: lea reg_tmp, [dstq+leftextq] %endif xor r3, r3 .body_loop_%3: %if ARCH_X86_64 movu m0, [srcq+r3] %else mov r1, srcm movu m0, [r1+r3] %endif %if %1 movu [reg_tmp+r3], m0 %else movu [dstq+r3], m0 %endif add r3, mmsize cmp r3, centerwq jl .body_loop_%3 %if %2 ; right extension %if ARCH_X86_64 test rightextq, rightextq %else mov r1, r3m test r1, r1 %endif jz .body_loop_end_%3 %if %1 add reg_tmp, centerwq %else lea reg_tmp, [dstq+centerwq] %endif %if ARCH_X86_64 movd m0, [srcq+centerwq-1] %else mov r3, srcm movd m0, [r3+centerwq-1] %endif pshufb m0, m1 xor r3, r3 .right_loop_%3: movu [reg_tmp+r3], m0 add r3, mmsize %if ARCH_X86_64 cmp r3, rightextq %else cmp r3, r3m %endif jl .right_loop_%3 .body_loop_end_%3: %endif %if ARCH_X86_64 add dstq, dstrideq add srcq, sstrideq dec centerhq jg .v_loop_%3 %else add dstq, dstridem mov r0, sstridem add srcm, r0 sub dword centerhm, 1 jg .v_loop_%3 mov r0, r0m ; restore r0 %endif %endmacro ; vloop MACRO test leftextq, leftextq jnz .need_left_ext %if ARCH_X86_64 test rightextq, rightextq jnz .need_right_ext %else cmp leftextq, r3m ; leftextq == 0 jne .need_right_ext %endif v_loop 0, 0, 0 jmp .body_done ;left right extensions .need_left_ext: %if ARCH_X86_64 test rightextq, rightextq %else mov r3, r3m test r3, r3 %endif jnz .need_left_right_ext v_loop 1, 0, 1 jmp .body_done .need_left_right_ext: v_loop 1, 1, 2 jmp .body_done .need_right_ext: v_loop 0, 1, 3 .body_done: ; r0 ; bw ; r1 ;; x loop ; r4 ;; y loop ; r5 ; topextq ; r6 ;dstq ; r7 ;dstrideq ; r8 ; srcq %if ARCH_X86_64 %define reg_dstride dstrideq %else %define reg_dstride r2 %endif ; ; bottom edge extension %if ARCH_X86_64 test bottomextq, bottomextq jz .top %else xor r1, r1 cmp r1, r4m je .top %endif ; %if ARCH_X86_64 mov srcq, dstq sub srcq, dstrideq xor r1, r1 %else mov r3, dstq mov reg_dstride, dstridem sub r3, reg_dstride mov srcm, r3 %endif ; .bottom_x_loop: %if ARCH_X86_64 mova m0, [srcq+r1] lea r3, [dstq+r1] mov r4, bottomextq %else mov r3, srcm mova m0, [r3+r1] lea r3, [dstq+r1] mov r4, r4m %endif ; .bottom_y_loop: mova [r3], m0 add r3, reg_dstride dec r4 jg .bottom_y_loop add r1, mmsize cmp r1, bwq jl .bottom_x_loop .top: ; top edge extension test topextq, topextq jz .end %if ARCH_X86_64 mov srcq, reg_blkm %else mov r3, reg_blkm mov reg_dstride, dstridem %endif mov dstq, dstm xor r1, r1 ; .top_x_loop: %if ARCH_X86_64 mova m0, [srcq+r1] %else mov r3, reg_blkm mova m0, [r3+r1] %endif lea r3, [dstq+r1] mov r4, topextq ; .top_y_loop: mova [r3], m0 add r3, reg_dstride dec r4 jg .top_y_loop add r1, mmsize cmp r1, bwq jl .top_x_loop .end: RET %undef reg_dstride %undef reg_blkm %undef reg_tmp
ORG $0000 ; s = n1 + n2 + n3 + ... + nn / Datos: n1, nn y s S RMB 2 ; LOAD 506.S19 | PC 8000 | MEM 0 | 0,0,20,00,20,02 | MEM 2000 | 2,3,5 | RUN N1 RMB 2 ; VALOR ESPERADO EN "S" ($0000): $0A NN RMB 2 ORG $8000 CLRA ; LIMPIO A CLR S ; LIMPIO S LDX N1 ; CARGO LA POSICION DE MEMORIA N1 EN REGISTRO X LOOP ADDA 0,X ; SUMO EL CONTENIDO DE LA POSICION GUARDADA EN X AL ACUMULADOR A STAA S+1 ; ALMACENO EL CONTENIDO DEL ACUMULADOR A EN LA POSICION DE MEMORIA S (PARTE BAJA) BCS CARRY SIGO CPX NN ; ES X == NN (COMPARO POSICIONES DE MEMORIA) BEQ FIN ; SI SON IGUALES -> FIN INX 1,X ; INCREMENTO EL REGISTRO X CON UN OFFSET DE 1 BNE LOOP ; SIGO CARRY INC S ; SI HUBO CARRY INCREMENTO S (PARTE ALTA) BRA SIGO FIN BRA FIN * COP - 8000 4F - CLRA * COP - 8001 7F - CLR * OP - 8002 00 - S * COP - 8004 DE - LDX * COP - 8005 AB - ADDA (SIGO) * OP - 8006 00 - 0,X * COP - 8007 97 - STAA * OP - 8008 00 - S * COP - 8009 9C - CPX * OP - 800A 03 - NN * COP - 800B 27 - BEQ * OP - 800C 03 - FIN (Desde linea 30(inc) cuento +3 hasta la linea 33) 0000 0101 (3) -> CB -> 1111 1011 (FB) * COP - 800D 08 - INX * COP - 800E 26 - BNE * OP - 800F F5 - SIGO (Desde linea 32(inc) se cuentan -11 hasta la linea 22) 0000 1011 (11) -> CB -> 1111 0101 (F5) * COP - 8010 20 - BRA * OP - 8011 FE - FIN
; A103128: a(n) = floor(sqrt(2n-1)). ; 1,1,2,2,3,3,3,3,4,4,4,4,5,5,5,5,5,5,6,6,6,6,6,6,7,7,7,7,7,7,7,7,8,8,8,8,8,8,8,8,9,9,9,9,9,9,9,9,9,9,10,10,10,10,10,10,10,10,10,10,11,11,11,11,11,11,11,11,11,11,11,11,12,12,12,12,12,12,12,12,12,12,12,12,13,13,13,13,13,13,13,13,13,13,13,13,13,13,14,14 mul $0,2 mov $1,3 lpb $0 sub $0,$1 add $1,2 lpe div $1,2 mov $0,$1
/* * Copyright (c) [2019-2021] Huawei Technologies Co.,Ltd.All rights reserved. * * OpenArkCompiler is licensed under Mulan PSL v2. * You can use this software according to the terms and conditions of the Mulan PSL v2. * You may obtain a copy of Mulan PSL v2 at: * * http://license.coscl.org.cn/MulanPSL2 * * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR * FIT FOR A PARTICULAR PURPOSE. * See the Mulan PSL v2 for more details. */ #include "dominance.h" #include <iostream> /* ================= for Dominance ================= */ namespace maple { void Dominance::PostOrderWalk(const BB &bb, int32 &pid, std::vector<bool> &visitedMap) { ASSERT(bb.GetBBId() < visitedMap.size(), "index out of range in Dominance::PostOrderWalk"); if (visitedMap[bb.GetBBId()]) { return; } visitedMap[bb.GetBBId()] = true; for (const BB *suc : bb.GetSucc()) { PostOrderWalk(*suc, pid, visitedMap); } ASSERT(bb.GetBBId() < postOrderIDVec.size(), "index out of range in Dominance::PostOrderWalk"); postOrderIDVec[bb.GetBBId()] = pid++; } void Dominance::GenPostOrderID() { ASSERT(!bbVec.empty(), "size to be allocated is 0"); std::vector<bool> visitedMap(bbVec.size(), false); int32 postOrderID = 0; PostOrderWalk(commonEntryBB, postOrderID, visitedMap); // initialize reversePostOrder int32 maxPostOrderID = postOrderID - 1; reversePostOrder.resize(maxPostOrderID + 1); for (size_t i = 0; i < postOrderIDVec.size(); ++i) { int32 postOrderNo = postOrderIDVec[i]; if (postOrderNo == -1) { continue; } reversePostOrder[maxPostOrderID - postOrderNo] = bbVec[i]; } } BB *Dominance::Intersect(BB &bb1, const BB &bb2) const { auto *ptrBB1 = &bb1; auto *ptrBB2 = &bb2; while (ptrBB1 != ptrBB2) { while (postOrderIDVec[ptrBB1->GetBBId()] < postOrderIDVec[ptrBB2->GetBBId()]) { ptrBB1 = doms.at(ptrBB1->GetBBId()); } while (postOrderIDVec[ptrBB2->GetBBId()] < postOrderIDVec[ptrBB1->GetBBId()]) { ptrBB2 = doms.at(ptrBB2->GetBBId()); } } return ptrBB1; } bool Dominance::CommonEntryBBIsPred(const BB &bb) const { for (const BB *suc : GetCommonEntryBB().GetSucc()) { if (suc == &bb) { return true; } } return false; } // Figure 3 in "A Simple, Fast Dominance Algorithm" by Keith Cooper et al. void Dominance::ComputeDominance() { doms[commonEntryBB.GetBBId()] = &commonEntryBB; bool changed; do { changed = false; for (size_t i = 1; i < reversePostOrder.size(); ++i) { BB *bb = reversePostOrder[i]; BB *pre = nullptr; if (CommonEntryBBIsPred(*bb) || bb->GetPred().empty()) { pre = &commonEntryBB; } else { pre = bb->GetPred(0); } size_t j = 1; while ((doms[pre->GetBBId()] == nullptr || pre == bb) && j < bb->GetPred().size()) { pre = bb->GetPred(j); ++j; } BB *newIDom = pre; for (; j < bb->GetPred().size(); ++j) { pre = bb->GetPred(j); if (doms[pre->GetBBId()] != nullptr && pre != bb) { newIDom = Intersect(*pre, *newIDom); } } if (doms[bb->GetBBId()] != newIDom) { doms[bb->GetBBId()] = newIDom; changed = true; } } } while (changed); } // Figure 5 in "A Simple, Fast Dominance Algorithm" by Keith Cooper et al. void Dominance::ComputeDomFrontiers() { for (const BB *bb : bbVec) { if (bb == nullptr || bb == &commonExitBB) { continue; } if (bb->GetPred().size() < kBBVectorInitialSize) { continue; } for (BB *pre : bb->GetPred()) { BB *runner = pre; while (runner != doms[bb->GetBBId()] && runner != &commonEntryBB) { domFrontier[runner->GetBBId()].insert(bb->GetBBId()); runner = doms[runner->GetBBId()]; } } } } void Dominance::ComputeDomChildren() { for (const BB *bb : reversePostOrder) { if (bb == nullptr) { continue; } if (doms[bb->GetBBId()] == nullptr) { continue; } BB *parent = doms[bb->GetBBId()]; if (parent == bb) { continue; } domChildren[parent->GetBBId()].push_back(bb->GetBBId()); } } // bbidMarker indicates that the iterDomFrontier results for bbid < bbidMarker // have been computed void Dominance::GetIterDomFrontier(const BB *bb, MapleSet<BBId> *dfset, BBId bbidMarker, std::vector<bool> &visitedMap) { if (visitedMap[bb->GetBBId()]) { return; } visitedMap[bb->GetBBId()] = true; for (BBId frontierbbid : domFrontier[bb->GetBBId()]) { (void)dfset->insert(frontierbbid); if (frontierbbid < bbidMarker) { // union with its computed result dfset->insert(iterDomFrontier[frontierbbid].begin(), iterDomFrontier[frontierbbid].end()); } else { // recursive call BB *frontierbb = bbVec[frontierbbid]; GetIterDomFrontier(frontierbb, dfset, bbidMarker, visitedMap); } } } void Dominance::ComputeIterDomFrontiers() { for (BB *bb : bbVec) { if (bb == nullptr || bb == &commonExitBB) { continue; } std::vector<bool> visitedMap(bbVec.size(), false); GetIterDomFrontier(bb, &iterDomFrontier[bb->GetBBId()], bb->GetBBId(), visitedMap); } } void Dominance::ComputeDtPreorder(const BB &bb, size_t &num) { CHECK_FATAL(num < dtPreOrder.size(), "index out of range in Dominance::ComputeDtPreorder"); dtPreOrder[num++] = bb.GetBBId(); for (BBId k : domChildren[bb.GetBBId()]) { ComputeDtPreorder(*bbVec[k], num); } } void Dominance::ComputeDtDfn() { for (size_t i = 0; i < dtPreOrder.size(); ++i) { dtDfn[dtPreOrder[i]] = i; } } // true if b1 dominates b2 bool Dominance::Dominate(const BB &bb1, const BB &bb2) { if (&bb1 == &bb2) { return true; } if (doms[bb2.GetBBId()] == nullptr) { return false; } const BB *immediateDom = &bb2; do { if (immediateDom == nullptr) { return false; } immediateDom = doms[immediateDom->GetBBId()]; if (immediateDom == &bb1) { return true; } } while (immediateDom != &commonEntryBB); return false; } /* ================= for PostDominance ================= */ void Dominance::PdomPostOrderWalk(const BB &bb, int32 &pid, std::vector<bool> &visitedMap) { ASSERT(bb.GetBBId() < visitedMap.size(), "index out of range in Dominance::PdomPostOrderWalk"); if (bbVec[bb.GetBBId()] == nullptr) { return; } if (visitedMap[bb.GetBBId()]) { return; } visitedMap[bb.GetBBId()] = true; for (BB *pre : bb.GetPred()) { PdomPostOrderWalk(*pre, pid, visitedMap); } CHECK_FATAL(bb.GetBBId() < pdomPostOrderIDVec.size(), "index out of range in Dominance::PdomPostOrderWalk"); pdomPostOrderIDVec[bb.GetBBId()] = pid++; } void Dominance::PdomGenPostOrderID() { ASSERT(!bbVec.empty(), "call calloc failed in Dominance::PdomGenPostOrderID"); std::vector<bool> visitedMap(bbVec.size(), false); int32 postOrderID = 0; PdomPostOrderWalk(commonExitBB, postOrderID, visitedMap); // initialize pdomReversePostOrder int32 maxPostOrderID = postOrderID - 1; pdomReversePostOrder.resize(maxPostOrderID + 1); for (size_t i = 0; i < pdomPostOrderIDVec.size(); ++i) { int32 postOrderNo = pdomPostOrderIDVec[i]; if (postOrderNo == -1) { continue; } pdomReversePostOrder[maxPostOrderID - postOrderNo] = bbVec[i]; } } BB *Dominance::PdomIntersect(BB &bb1, const BB &bb2) { auto *ptrBB1 = &bb1; auto *ptrBB2 = &bb2; while (ptrBB1 != ptrBB2) { while (pdomPostOrderIDVec[ptrBB1->GetBBId()] < pdomPostOrderIDVec[ptrBB2->GetBBId()]) { ptrBB1 = pdoms[ptrBB1->GetBBId()]; } while (pdomPostOrderIDVec[ptrBB2->GetBBId()] < pdomPostOrderIDVec[ptrBB1->GetBBId()]) { ptrBB2 = pdoms[ptrBB2->GetBBId()]; } } return ptrBB1; } // Figure 3 in "A Simple, Fast Dominance Algorithm" by Keith Cooper et al. void Dominance::ComputePostDominance() { pdoms[commonExitBB.GetBBId()] = &commonExitBB; bool changed = false; do { changed = false; for (size_t i = 1; i < pdomReversePostOrder.size(); ++i) { BB *bb = pdomReversePostOrder[i]; BB *suc = nullptr; if (bb->GetAttributes(kBBAttrIsExit) || bb->GetSucc().empty()) { suc = &commonExitBB; } else { suc = bb->GetSucc(0); } size_t j = 1; while ((pdoms[suc->GetBBId()] == nullptr || suc == bb) && j < bb->GetSucc().size()) { suc = bb->GetSucc(j); ++j; } if (pdoms[suc->GetBBId()] == nullptr) { suc = &commonExitBB; } BB *newIDom = suc; for (; j < bb->GetSucc().size(); ++j) { suc = bb->GetSucc(j); if (pdoms[suc->GetBBId()] != nullptr && suc != bb) { newIDom = PdomIntersect(*suc, *newIDom); } } if (pdoms[bb->GetBBId()] != newIDom) { pdoms[bb->GetBBId()] = newIDom; ASSERT(pdoms[newIDom->GetBBId()] != nullptr, "null ptr check"); changed = true; } } } while (changed); } // Figure 5 in "A Simple, Fast Dominance Algorithm" by Keith Cooper et al. void Dominance::ComputePdomFrontiers() { for (const BB *bb : bbVec) { if (bb == nullptr || bb == &commonEntryBB) { continue; } if (bb->GetSucc().size() < kBBVectorInitialSize) { continue; } for (BB *suc : bb->GetSucc()) { BB *runner = suc; while (runner != pdoms[bb->GetBBId()] && runner != &commonEntryBB) { pdomFrontier[runner->GetBBId()].insert(bb->GetBBId()); ASSERT(pdoms[runner->GetBBId()] != nullptr, "ComputePdomFrontiers: pdoms[] is nullptr"); runner = pdoms[runner->GetBBId()]; } } } } void Dominance::ComputePdomChildren() { for (const BB *bb : bbVec) { if (bb == nullptr || pdoms[bb->GetBBId()] == nullptr) { continue; } const BB *parent = pdoms[bb->GetBBId()]; if (parent == bb) { continue; } pdomChildren[parent->GetBBId()].insert(bb->GetBBId()); } } // bbidMarker indicates that the iterPdomFrontier results for bbid < bbidMarker // have been computed void Dominance::GetIterPdomFrontier(const BB *bb, MapleSet<BBId> *dfset, BBId bbidMarker, std::vector<bool> &visitedMap) { if (visitedMap[bb->GetBBId()]) { return; } visitedMap[bb->GetBBId()] = true; for (BBId frontierbbid : pdomFrontier[bb->GetBBId()]) { (void)dfset->insert(frontierbbid); if (frontierbbid < bbidMarker) { // union with its computed result dfset->insert(iterPdomFrontier[frontierbbid].begin(), iterPdomFrontier[frontierbbid].end()); } else { // recursive call BB *frontierbb = bbVec[frontierbbid]; GetIterPdomFrontier(frontierbb, dfset, bbidMarker, visitedMap); } } } void Dominance::ComputeIterPdomFrontiers() { for (BB *bb : bbVec) { if (bb == nullptr || bb == &commonEntryBB) { continue; } std::vector<bool> visitedMap(bbVec.size(), false); GetIterPdomFrontier(bb, &iterPdomFrontier[bb->GetBBId()], bb->GetBBId(), visitedMap); } } void Dominance::ComputePdtPreorder(const BB &bb, size_t &num) { ASSERT(num < pdtPreOrder.size(), "index out of range in Dominance::ComputePdtPreOrder"); pdtPreOrder[num++] = bb.GetBBId(); for (BBId k : pdomChildren[bb.GetBBId()]) { ComputePdtPreorder(*bbVec[k], num); } } void Dominance::ComputePdtDfn() { for (size_t i = 0; i < pdtPreOrder.size(); ++i) { pdtDfn[pdtPreOrder[i]] = i; } } // true if b1 postdominates b2 bool Dominance::PostDominate(const BB &bb1, const BB &bb2) { if (&bb1 == &bb2) { return true; } if (pdoms[bb2.GetBBId()] == nullptr) { return false; } const BB *impdom = &bb2; do { if (impdom == nullptr) { return false; } impdom = pdoms[impdom->GetBBId()]; if (impdom == &bb1) { return true; } } while (impdom != &commonExitBB); return false; } void Dominance::DumpDoms() { for (BB *bb : reversePostOrder) { LogInfo::MapleLogger() << "postorder no " << postOrderIDVec[bb->GetBBId()]; LogInfo::MapleLogger() << " is bb:" << bb->GetBBId(); LogInfo::MapleLogger() << " im_dom is bb:" << doms[bb->GetBBId()]->GetBBId(); LogInfo::MapleLogger() << " domfrontier: ["; for (BBId id : domFrontier[bb->GetBBId()]) { LogInfo::MapleLogger() << id << " "; } LogInfo::MapleLogger() << "] iterDomFrontier: ["; for (BBId id : iterDomFrontier[bb->GetBBId()]) { LogInfo::MapleLogger() << id << " "; } LogInfo::MapleLogger() << "] domchildren: ["; for (BBId id : domChildren[bb->GetBBId()]) { LogInfo::MapleLogger() << id << " "; } LogInfo::MapleLogger() << "]\n"; } LogInfo::MapleLogger() << "\npreorder traversal of dominator tree:"; for (BBId id : dtPreOrder) { LogInfo::MapleLogger() << id << " "; } LogInfo::MapleLogger() << "\n\n"; } void Dominance::DumpPdoms() { for (BB *bb : pdomReversePostOrder) { LogInfo::MapleLogger() << "pdom_postorder no " << pdomPostOrderIDVec[bb->GetBBId()]; LogInfo::MapleLogger() << " is bb:" << bb->GetBBId(); LogInfo::MapleLogger() << " im_pdom is bb:" << pdoms[bb->GetBBId()]->GetBBId(); LogInfo::MapleLogger() << " pdomfrontier: ["; for (BBId id : pdomFrontier[bb->GetBBId()]) { LogInfo::MapleLogger() << id << " "; } LogInfo::MapleLogger() << "] iterPdomFrontier: ["; for (BBId id : iterPdomFrontier[bb->GetBBId()]) { LogInfo::MapleLogger() << id << " "; } LogInfo::MapleLogger() << "] pdomchildren: ["; for (BBId id : pdomChildren[bb->GetBBId()]) { LogInfo::MapleLogger() << id << " "; } LogInfo::MapleLogger() << "]\n"; } LogInfo::MapleLogger() << "\n"; LogInfo::MapleLogger() << "preorder traversal of post-dominator tree:"; for (BBId id : pdtPreOrder) { LogInfo::MapleLogger() << id << " "; } LogInfo::MapleLogger() << "\n\n"; } } // namespace maple
#include "StackPanel.hpp" #include "Panel.hpp" StackPanel::StackPanel(int x, int y, int width, int height, int format, int pad):Panel(x,y,width,height,format){ padding = pad; } StackPanel::StackPanel():Panel(0, 0, 1, 1, Panel::Static){ padding = 1; } /** * Removes an element from the stack panel. * The panel is resized and all elements after * the removed element are pushed upward. */ void StackPanel::remove(InterfaceElement* element){ int index = -1; int removeHeight = element->rect.height; for(unsigned int i = 0; i < interfaceElements.size(); i++){ if(interfaceElements.at(i) == element){ index = i; interfaceElements.erase(interfaceElements.begin() + i); elements.erase(elements.begin() + i); break; } } if(index == -1) return; for(unsigned int i = index; i < interfaceElements.size(); i++){ interfaceElements.at(i)->rect.top -= (removeHeight + padding); } rect.height -= (removeHeight + padding); } /** * Add an element to the top of the stack. * Resizes the panel and pushes all elements downward. */ void StackPanel::addTop(InterfaceElement* element){ for(unsigned int i = 0; i < interfaceElements.size(); i++){ interfaceElements.at(i)->rect.top += element->rect.height + padding; } interfaceElements.insert(interfaceElements.begin(), element); elements.insert(elements.begin(), element); element->parent = this; rect.height += element->rect.height + padding; } /** * Add an element to the bottom of the stack. * Resizes the panel. */ void StackPanel::addBottom(InterfaceElement* element){ if(interfaceElements.size() > 0) element->rect.top = interfaceElements.back()->rect.top + interfaceElements.back()->rect.height + padding; else element->rect.top = 0; add(element); rect.height += element->rect.height + padding; }
; Original address was $BC78 ; 2-4 .word $0000 ; Alternate level layout .word $0000 ; Alternate object layout .byte LEVEL1_SIZE_10 | LEVEL1_YSTART_180 .byte LEVEL2_BGPAL_01 | LEVEL2_OBJPAL_08 | LEVEL2_XSTART_18 .byte LEVEL3_TILESET_09 | LEVEL3_VSCROLL_LOCKLOW .byte LEVEL4_BGBANK_INDEX(9) | LEVEL4_INITACT_NOTHING .byte LEVEL5_BGM_OVERWORLD | LEVEL5_TIME_300 .byte $47, $0B, $84, $14, $04, $04, $90, $08, $03, $90, $0C, $02, $9D, $16, $05, $04 .byte $16, $0C, $04, $79, $05, $20, $79, $08, $20, $79, $0A, $20, $24, $0D, $80, $24 .byte $0F, $80, $24, $00, $40, $25, $00, $40, $26, $00, $40, $27, $00, $40, $28, $00 .byte $40, $29, $00, $40, $2A, $00, $40, $2B, $00, $40, $2C, $00, $40, $2D, $00, $40 .byte $2E, $00, $40, $2F, $00, $40, $30, $00, $40, $31, $00, $40, $32, $00, $40, $33 .byte $00, $40, $34, $00, $40, $35, $00, $40, $36, $00, $40, $37, $00, $40, $38, $00 .byte $40, $39, $00, $40, $24, $01, $10, $25, $01, $10, $26, $01, $10, $27, $01, $10 .byte $28, $01, $10, $29, $01, $10, $2A, $01, $10, $2B, $01, $10, $2C, $01, $10, $2D .byte $01, $10, $2E, $01, $10, $2F, $01, $10, $26, $0C, $16, $01, $04, $0A, $02, $0A .byte $0A, $11, $04, $0A, $12, $0E, $0A, $14, $08, $0A, $15, $02, $0A, $16, $1B, $04 .byte $79, $1E, $20, $26, $15, $1A, $26, $17, $0D, $24, $11, $80, $24, $13, $80, $24 .byte $15, $80, $24, $17, $80, $24, $19, $80, $24, $1B, $80, $24, $1D, $80, $7A, $16 .byte $93, $39, $17, $01, $37, $14, $40, $38, $14, $40, $39, $14, $40, $37, $1A, $40 .byte $38, $1A, $40, $39, $1A, $40, $01, $18, $0A, $02, $12, $0A, $11, $1E, $0A, $14 .byte $1A, $0A, $36, $11, $20, $29, $24, $8F, $6B, $21, $2F, $08, $22, $04, $08, $25 .byte $04, $08, $28, $04, $08, $2B, $04, $08, $2E, $04, $18, $20, $70, $33, $2A, $80 .byte $34, $28, $80, $34, $2C, $80, $36, $26, $80, $36, $2E, $80, $39, $2D, $01, $7A .byte $26, $91, $26, $20, $40, $27, $20, $40, $28, $20, $40, $29, $20, $40, $2A, $20 .byte $40, $2B, $20, $40, $02, $22, $0A, $03, $2C, $0A, $05, $26, $0A, $12, $26, $0A .byte $29, $34, $89, $6B, $31, $2F, $08, $31, $04, $08, $34, $04, $08, $37, $04, $08 .byte $3A, $04, $08, $3D, $04, $79, $31, $2F, $16, $32, $04, $16, $35, $04, $16, $38 .byte $04, $16, $3B, $04, $16, $3E, $04, $01, $3A, $0A, $04, $34, $0A, $04, $3E, $0A .byte $11, $3C, $0A, $12, $30, $0A, $14, $36, $0A, $23, $44, $81, $23, $47, $81, $23 .byte $4A, $81, $23, $4D, $81, $67, $42, $2F, $04, $42, $04, $04, $45, $04, $04, $48 .byte $04, $04, $4B, $04, $04, $4E, $04, $28, $42, $3F, $6B, $43, $20, $6B, $46, $20 .byte $6B, $49, $20, $6B, $4C, $20, $6B, $4F, $20, $33, $47, $83, $18, $42, $70, $17 .byte $4C, $80, $79, $41, $20, $7A, $47, $93, $38, $48, $41, $01, $4E, $0A, $13, $42 .byte $0A, $01, $44, $0A, $23, $50, $81, $67, $53, $20, $04, $51, $04, $28, $52, $31 .byte $6B, $52, $20, $6B, $55, $20, $6B, $58, $20, $6B, $5D, $21, $08, $5A, $04, $08 .byte $5F, $04, $79, $53, $20, $17, $5C, $80, $7A, $55, $94, $37, $5B, $01, $35, $5E .byte $A1, $03, $56, $0A, $04, $5E, $0A, $12, $50, $0A, $12, $5C, $0A, $14, $56, $0A .byte $24, $67, $80, $24, $6B, $80, $27, $65, $80, $27, $69, $80, $27, $6D, $80, $29 .byte $63, $80, $29, $67, $80, $29, $6B, $80, $29, $6F, $80, $26, $6D, $0D, $18, $63 .byte $70, $17, $68, $80, $23, $67, $10, $23, $6B, $10, $26, $65, $10, $26, $69, $10 .byte $28, $63, $10, $28, $67, $10, $28, $6B, $10, $28, $6F, $10, $2B, $65, $10, $2B .byte $69, $10, $2B, $6D, $10, $13, $6A, $0A, $36, $71, $8A, $37, $71, $8A, $38, $71 .byte $8A, $39, $71, $8A, $16, $72, $70, $18, $72, $70, $16, $77, $70, $18, $77, $70 .byte $16, $7C, $70, $18, $7C, $70, $2A, $74, $60, $2B, $77, $60, $2C, $7A, $60, $2D .byte $7D, $60, $03, $7A, $0A, $06, $74, $0A, $10, $7A, $0A, $12, $7E, $0A, $12, $72 .byte $0A, $16, $81, $70, $18, $81, $70, $16, $86, $04, $4E, $80, $02, $03, $84, $0A .byte $05, $80, $0A, $10, $86, $0A, $14, $84, $0A, $40, $89, $09, $FF
; A062558: Number of nonisomorphic cyclic subgroups of dihedral group with 2n elements. ; 2,2,3,3,3,4,3,4,4,4,3,6,3,4,5,5,3,6,3,6,5,4,3,8,4,4,5,6,3,8,3,6,5,4,5,9,3,4,5,8,3,8,3,6,7,4,3,10,4,6,5,6,3,8,5,8,5,4,3,12,3,4,7,7,5,8,3,6,5,8,3,12,3,4,7,6,5,8,3,10,6,4,3,12,5,4,5,8,3,12,5,6,5,4,5,12,3,6,7,9,3,8,3,8,9,4,3,12,3,8,5,10,3,8,5,6,7,4,5,16,4,4,5,6,5,12,3,8,5,8,3,12,5,4,9,8,3,8,3,12,5,4,5,15,5,4,7,6,3,12,3,8,7,8,5,12,3,4,5,12,5,10,3,6,9,4,3,16,4,8,7,6,3,8,7,10,5,4,3,18,3,8,5,8,5,8,5,6,9,8,3,14,3,4,9,9,3,12,3,12,5,4,5,12,5,4,7,10,5,16,3,6,5,4,5,16,5,4,5,12,5,8,3,12,10,4,3,12,3,8,9,8,3,12,5,6,5,8,3,20,3,6,7,6,7,8,5,8,5,8 mov $4,$0 mov $6,2 lpb $6,1 clr $0,4 mov $0,$4 sub $6,1 add $0,$6 sub $0,1 lpb $0,1 mov $1,$0 sub $0,3 sub $1,2 add $2,1 div $1,$2 add $3,$1 lpe add $2,$3 mov $1,$2 mov $7,$6 lpb $7,1 mov $5,$1 sub $7,1 lpe lpe lpb $4,1 mov $4,0 sub $5,$1 lpe mov $1,$5 add $1,2
Sound48_Flamethrower_Header: smpsHeaderStartSong 2 smpsHeaderVoiceNull smpsHeaderTempoSFX $01 smpsHeaderChanSFX $01 smpsHeaderSFXChannel cPSG3, Sound48_Flamethrower_PSG3, $00, $00 ; PSG3 Data Sound48_Flamethrower_PSG3: smpsPSGvoice $00 smpsPSGform $E7 dc.b nD3, $25 smpsStop
INCLUDE "constants/hardware.inc" INCLUDE "constants/engine.inc" INCLUDE "constants/actors.inc" INCLUDE "constants/sfx.inc" INCLUDE "constants/screens.inc" INCLUDE "constants/interrupts.inc" INCLUDE "constants/transition.inc" INCLUDE "constants/cues.inc" INCLUDE "constants/games/skater-dude.inc" SECTION UNION "Game Variables", HRAM ; When the game starts or ends, Skater Dude skates on or off the screen hSkaterDudeState: DS 1 ; Index into Skater Dude's jump position table hSkaterDudePosIndex: DS 1 hSkaterDudePosCountdown: DS 1 ; Number of frames left in slo-mo hSloMoCountdown:: DS 1 ; Storage for the current positions of the different sections of the ; background hBuildingMapXPos: .low DS 1 .high DS 1 hSidewalkMapXPos: .low DS 1 .high DS 1 hSidewalkSCX: DS 1 hRoadMapXPos: .low DS 1 .high DS 1 hRoadSCX: DS 1 hGrassMapXPos: .low DS 1 .high DS 1 hGrassSCX: DS 1 hSidewalkScrollTimer: DS 1 ; The current frame the building bounce effect is on hBuildingBounceIndex:: DS 1 SECTION "Skater Dude Game Setup", ROMX xGameSetupSkaterDude:: ; Set palettes ld a, SKATER_DUDE_BGP ldh [hBGP], a ASSERT SKATER_DUDE_OBP1 & ~%11 == SKATER_DUDE_BGP & ~%11 ldh [hOBP1], a ld a, SKATER_DUDE_OBP0 ldh [hOBP0], a ; Set appropriate LCDC flags ld a, LCDCF_ON | LCDCF_BG8800 | LCDCF_BG9800 | LCDCF_BGON | LCDCF_OBJ16 | LCDCF_OBJON ldh [hLCDC], a ASSERT SKATER_DUDE_STATE_IN == 0 xor a, a ldh [hSkaterDudeState], a ; Initially no slo-mo ASSERT SKATER_DUDE_NO_SLO_MO == 0 - 1 dec a ldh [hSloMoCountdown], a ; Load background tiles ASSERT BANK(xBackgroundTiles) == BANK(@) ld de, xBackgroundTiles ld hl, $9000 ld bc, xBackgroundTiles.end - xBackgroundTiles rst LCDMemcopy ; Load sprite tiles ASSERT BANK(xSpriteTiles) == BANK(@) ASSERT xSpriteTiles == xBackgroundTiles.end ld hl, $8000 ld bc, xSpriteTiles.end - xSpriteTiles rst LCDMemcopy ; Set up the background map ld hl, hMapWidth ld [hl], MAP_SKATER_DUDE_WIDTH ASSERT hMapHeight == hMapWidth + 1 inc l ld [hl], MAP_SKATER_DUDE_HEIGHT ASSERT hMapBank == hMapHeight + 1 inc l ld [hl], BANK(xMap) ASSERT hMapPointer == hMapBank + 1 inc l ld [hl], LOW(xMap) inc l ld [hl], HIGH(xMap) ; Set initial map position ASSERT hMapXPos == hMapPointer + 2 inc l xor a, a ld [hli], a ld [hli], a ASSERT hMapTileYPos == hMapXPos + 2 ld [hli], a ASSERT hMapUpdateHeight == hMapTileYPos + 1 ; Draw the entire visible map to start ld [hl], SCRN_Y_B ; Initialize section map positions ld l, LOW(hBuildingMapXPos) ld [hli], a ld [hli], a ASSERT hSidewalkMapXPos == hBuildingMapXPos + 2 ld [hli], a ld [hli], a ASSERT hSidewalkSCX == hSidewalkMapXPos + 2 ld [hli], a ASSERT hRoadMapXPos == hSidewalkSCX + 1 ld [hli], a ld [hli], a ASSERT hRoadSCX == hRoadMapXPos + 2 ld [hli], a ASSERT hGrassMapXPos == hRoadSCX + 1 ld [hli], a ld [hli], a ASSERT hGrassSCX == hGrassMapXPos + 2 ld [hli], a ASSERT hSidewalkScrollTimer == hGrassSCX + 1 ld [hli], a ASSERT hBuildingBounceIndex == hSidewalkScrollTimer + 1 ; Start with buildings not bouncing ASSERT BUILDING_NOT_BOUNCING == -1 dec a ld [hl], a ; Draw the initial visible map call MapDraw ; No tile streaming in this game xor a, a ldh [hTileStreamingEnable], a ; Create the Skater Dude actor ASSERT BANK(xActorSkaterDudeDefinition) == BANK(@) ld de, xActorSkaterDudeDefinition call ActorNew ld a, -1 ldh [hSkaterDudePosIndex], a ; Set up game data ld c, BANK(xHitTableSkaterDude) ld hl, xHitTableSkaterDude jp EngineInit xBackgroundTiles: INCBIN "res/skater-dude/background.bg.2bpp" .end xSpriteTiles: ; Remove the first 2 tiles which are blank on purpose to get rid of ; any blank objects in the image INCBIN "res/skater-dude/skater-dude.obj.2bpp", 16 * 2 INCBIN "res/skater-dude/skateboard.obj.2bpp", 16 * 2 INCBIN "res/skater-dude/danger-alert.obj.2bpp" INCBIN "res/skater-dude/car.obj.2bpp" INCBIN "res/skater-dude/log.obj.2bpp", 16 * 2 INCBIN "res/skater-dude/oil-barrel.obj.2bpp", 16 * 2 .end xActorSkaterDudeDefinition: DB ACTOR_SKATER_DUDE DB SKATER_DUDE_START_X, SKATER_DUDE_Y DB SKATER_DUDE_IN_SPEED, 0 SECTION "Skater Dude Game Background Map", ROMX xMap: INCBIN "res/skater-dude/background.bg.tilemap" SECTION "Skater Dude Game Building Bounce Table", ROM0 ; Quadratic ease-out, for scaling the buildings ; Formula from <https://gizma.com/easing> ; Resulting values to be written to SCY every other scanline ; Updated every other scanline instead of every scanline because LYC ; interrupt juggling is too slow BuildingBounceTable: ; Start stretched and end normal ("bounce") DEF START EQU (BUILDING_TOP - BUILDING_BOUNCE_HEIGHT) << 16 DEF END EQU BUILDING_TOP << 16 DEF CHANGE EQU END - START DEF DURATION = 0 FOR TIME, 1, BUILDING_BOUNCE_DURATION + 1 DEF TIME_FRACTION = DIV(TIME << 16, BUILDING_BOUNCE_DURATION << 16) DEF BOUNCE = (MUL(-CHANGE, MUL(TIME_FRACTION, TIME_FRACTION - 2.0)) + START) >> 16 IF BOUNCE != 0 REDEF DURATION = DURATION + 1 ; Generate an SCY value for each scanline between the top of ; the screen and the bottom of the buildings FOR SCANLINE, 0, BUILDING_BOTTOM, 2 ; Get the "scanline" from the original image to use on ; this scanline DEF SCALED_SCANLINE_FRACTION = DIV((SCANLINE - BOUNCE) << 16, (BUILDING_BOTTOM - BOUNCE) << 16) DEF ORIGINAL_SCANLINE = FLOOR(MUL(SCALED_SCANLINE_FRACTION, (BUILDING_BOTTOM - 0) << 16)) >> 16 ; Value for SCY, offset by -LY DB ORIGINAL_SCANLINE - SCANLINE ENDR ENDC ENDR REDEF BUILDING_BOUNCE_DURATION EQU DURATION SECTION "Skater Dude Game Building Bounce Index Lookup Table", ROM0, ALIGN[8] BuildingBouncePointerTable: FOR INDEX, BUILDING_BOUNCE_DURATION DW BuildingBounceTable + INDEX * ((BUILDING_BOTTOM - 0) / 2) ENDR .end SECTION "Skater Dude Game Extra LYC Interrupt Handler", ROM0 LYCHandlerSkaterDude:: ; If this scanline is before the parallax change, this is for ; scaling the buildings ldh a, [rLYC] cp a, MAP_SKATER_DUDE_SIDEWALK_Y * 8 - 1 jr nc, .parallax ld c, a ; If the buildings aren't currently bouncing, there's nothing to do ldh a, [hBuildingBounceIndex] ASSERT BUILDING_NOT_BOUNCING == -1 inc a ret z ; Adjust for -1 LYC offset inc c ; LYC interrupts spread out every 2 scanlines but the values in the ; tables are consecutive srl c ; Get a pointer to the SCY value to use dec a ; Undo inc add a, a ASSERT LOW(BuildingBouncePointerTable) == 0 ld l, a ASSERT HIGH(BuildingBouncePointerTable.end - 1) == HIGH(BuildingBouncePointerTable) ld h, HIGH(BuildingBouncePointerTable) ld a, [hli] ld h, [hl] ld l, a ; c = scanline index ld b, 0 add hl, bc .waitHBlankBounce ldh a, [rSTAT] ASSERT STATF_HBL == 0 and a, STAT_MODE_MASK jr nz, .waitHBlankBounce ld a, [hl] ldh [rSCY], a ret .parallax ; Set appropriate map section's X scroll value ldh a, [rLYC] cp a, MAP_SKATER_DUDE_SIDEWALK_Y * 8 - 1 ld c, LOW(hSidewalkSCX) jr z, .sidewalk cp a, MAP_SKATER_DUDE_ROAD_Y * 8 - 1 ld c, LOW(hRoadSCX) jr z, .waitHBlankParallax ld c, LOW(hGrassSCX) .waitHBlankParallax ; Set SCX at the end of the scanline ldh a, [rSTAT] ASSERT STATF_HBL == 0 and a, STAT_MODE_MASK jr nz, .waitHBlankParallax ldh a, [c] ldh [rSCX], a ret .sidewalk ; Set SCY and SCX at the end of the scanline ldh a, [rSTAT] ASSERT STATF_HBL == 0 and a, STAT_MODE_MASK jr nz, .sidewalk ; Reset SCY in case the buildings are bouncing ; SCY should always be 0 for everything but the buildings ; a = 0 ldh [rSCY], a ldh a, [c] ldh [rSCX], a ret SECTION "Skater Dude Game Loop", ROMX xGameSkaterDude:: ; Set up extra LYC interrupts ASSERT LYCTable.skaterDude - LYCTable == 0 xor a, a ldh [hLYCResetIndex], a .loop ldh a, [hTransitionState] ASSERT TRANSITION_STATE_OFF == 0 and a, a jr z, .noTransition rst WaitVBlank call TransitionUpdate call .scroll ldh a, [hTransitionState] ASSERT TRANSITION_STATE_OFF == 0 and a, a jr nz, .loop ; Start music ld c, BANK(Inst_SkaterDude) ld de, Inst_SkaterDude call Music_PrepareInst ld c, BANK(Music_SkaterDude) ld de, Music_SkaterDude call Music_Play jr .loop .noTransition ; Check if it's time to start the building bounce ld a, [wMusicSyncData] ASSERT SYNC_NONE == -1 inc a jr z, .noStartBounce ; All sync values except the obstacle cue land on a beat ; Add 1 to compensate for inc cp a, CUE_OBSTACLE + 1 jr z, .noStartBounce ; Reset the frame index to 0 xor a, a ldh [hBuildingBounceIndex], a jr .updateSCY .noStartBounce ; Update hSCY for LY 0 if the buildings are bouncing ldh a, [hBuildingBounceIndex] inc a jr z, .noBounce ; Move on to next frame (already incremented) ; If the bounce is over, set the index to BUILDING_NOT_BOUNCING cp a, BUILDING_BOUNCE_DURATION jr nc, .stopBouncing ldh [hBuildingBounceIndex], a ; Move on to next frame (already incremented) ; Get a pointer to the SCY value to use add a, a .updateSCY ASSERT LOW(BuildingBouncePointerTable) == 0 ld l, a ASSERT HIGH(BuildingBouncePointerTable.end - 1) == HIGH(BuildingBouncePointerTable) ld h, HIGH(BuildingBouncePointerTable) ld a, [hli] ld h, [hl] ld l, a ld a, [hl] ldh [hSCY], a jr .noBounce .stopBouncing ld a, BUILDING_NOT_BOUNCING ldh [hBuildingBounceIndex], a .noBounce rst WaitVBlank call EngineUpdate call ActorsUpdate ldh a, [hSloMoCountdown] ASSERT SKATER_DUDE_NO_SLO_MO == -1 inc a call z, .scroll ; If the game is over, go to the overall rating screen ldh a, [hSkaterDudeState] cp a, SKATER_DUDE_STATE_END jr z, .finished ld hl, hSloMoCountdown ld a, [hl] ASSERT SKATER_DUDE_NO_SLO_MO == -1 inc a jr z, .loop dec [hl] jr .loop .finished ld a, SCREEN_RATING call TransitionStart jr .loop .scroll ; Scroll each section of the background map ; Scroll the grass ld hl, hMapXPos ld de, hGrassMapXPos ld a, [de] ; hGrassMapXPos.low ld [hli], a ; hMapXPos.low inc e ld a, [de] ; hGrassMapXPos.high ld [hli], a ; hMapXPos.high ASSERT hMapTileYPos == hMapXPos + 2 ld [hl], MAP_SKATER_DUDE_GRASS_Y ASSERT hMapUpdateHeight == hMapTileYPos + 1 inc l ld [hl], MAP_SKATER_DUDE_GRASS_HEIGHT ASSERT hGrassSCX == hGrassMapXPos + 2 inc e ld a, [de] ASSERT hMapSCX == hMapUpdateHeight + 1 inc l ld [hli], a ASSERT hMapSCY == hMapSCX + 1 ld [hl], MAP_SKATER_DUDE_GRASS_Y * 8 ; Grass scrolls 1 pixel every other frame and 2 pixels every other frame ldh a, [hFrameCounter] and a, 1 ; a = 0 or 1 inc a ; a = 1 or 2 ld b, a call MapScrollLeft ; Save new position ldh a, [hMapXPos.low] ldh [hGrassMapXPos.low], a ldh a, [hMapXPos.high] ldh [hGrassMapXPos.high], a ldh a, [hMapSCX] ldh [hGrassSCX], a ; Scroll the road ld hl, hMapXPos ld de, hRoadMapXPos ld a, [de] ; hRoadMapXPos.low ld [hli], a ; hMapXPos.low inc e ld a, [de] ; hRoadMapXPos.high ld [hli], a ; hMapXPos.high ASSERT hMapTileYPos == hMapXPos + 2 ld [hl], MAP_SKATER_DUDE_ROAD_Y ASSERT hMapUpdateHeight == hMapTileYPos + 1 inc l ld [hl], MAP_SKATER_DUDE_ROAD_HEIGHT ASSERT hRoadSCX == hRoadMapXPos + 2 inc e ld a, [de] ASSERT hMapSCX == hMapUpdateHeight + 1 inc l ld [hli], a ASSERT hMapSCY == hMapSCX + 1 ld [hl], MAP_SKATER_DUDE_ROAD_Y * 8 ; Road scrolls 1 pixel every frame ld b, 1 call MapScrollLeft ; Save new position ldh a, [hMapXPos.low] ldh [hRoadMapXPos.low], a ldh a, [hMapXPos.high] ldh [hRoadMapXPos.high], a ldh a, [hMapSCX] ldh [hRoadSCX], a ; Scroll the sidewalk ; Sidewalk scrolls 1 pixel every 5/8 frames ldh a, [hSidewalkScrollTimer] ld c, a and a, ~7 ld b, a ld a, c add a, 5 ldh [hSidewalkScrollTimer], a and a, ~7 cp a, b jr z, .scrollBuildings ld hl, hMapXPos ld de, hSidewalkMapXPos ld a, [de] ; hSidewalkMapXPos.low ld [hli], a ; hMapXPos.low inc e ld a, [de] ; hSidewalkMapXPos.high ld [hli], a ; hMapXPos.high ASSERT hMapTileYPos == hMapXPos + 2 ld [hl], MAP_SKATER_DUDE_SIDEWALK_Y ASSERT hMapUpdateHeight == hMapTileYPos + 1 inc l ld [hl], MAP_SKATER_DUDE_SIDEWALK_HEIGHT ASSERT hSidewalkSCX == hSidewalkMapXPos + 2 inc e ld a, [de] ASSERT hMapSCX == hMapUpdateHeight + 1 inc l ld [hli], a ASSERT hMapSCY == hMapSCX + 1 ld [hl], MAP_SKATER_DUDE_SIDEWALK_Y * 8 ld b, 1 call MapScrollLeft ; Save new position ldh a, [hMapXPos.low] ldh [hSidewalkMapXPos.low], a ldh a, [hMapXPos.high] ldh [hSidewalkMapXPos.high], a ldh a, [hMapSCX] ldh [hSidewalkSCX], a .scrollBuildings ; Buildings scroll 1 pixel every other frame ldh a, [hFrameCounter] and a, 1 ret z ld hl, hMapXPos ld de, hBuildingMapXPos ld a, [de] ; hBuildingMapXPos.low ld [hli], a ; hMapXPos.low inc e ld a, [de] ; hBuildingMapXPos.high ld [hli], a ; hMapXPos.high ASSERT hMapTileYPos == hMapXPos + 2 ld [hl], MAP_SKATER_DUDE_BUILDING_Y ASSERT hMapUpdateHeight == hMapTileYPos + 1 inc l ld [hl], MAP_SKATER_DUDE_BUILDING_HEIGHT ldh a, [hSCX] ASSERT hMapSCX == hMapUpdateHeight + 1 inc l ld [hli], a ASSERT hMapSCY == hMapSCX + 1 ld [hl], MAP_SKATER_DUDE_BUILDING_Y * 8 ld b, 1 call MapScrollLeft ; Save new position ldh a, [hMapXPos.low] ldh [hBuildingMapXPos.low], a ldh a, [hMapXPos.high] ldh [hBuildingMapXPos.high], a ldh a, [hMapSCX] ldh [hSCX], a ret SECTION "Skater Dude Danger Alert Cue", ROMX xCueDangerAlert:: ; Create a Danger Alert actor ASSERT BANK(xActorDangerAlertDefinition) == BANK(@) ld de, xActorDangerAlertDefinition jp ActorNew xActorDangerAlertDefinition: DB ACTOR_DANGER_ALERT DB DANGER_ALERT_X, DANGER_ALERT_Y DB 0, 0 SECTION "Skater Dude Obstacle Cue", ROMX xCueObstacle:: ; Create a random type of obstacle call Random ASSERT OBSTACLE_COUNT == 3 and a, 3 cp a, OBSTACLE_COUNT jr c, .obstacleOk ; Cars would realistically be more common on the road, so go with ; that ASSERT ACTOR_CAR - ACTOR_OBSTACLES_START == 0 xor a, a .obstacleOk ; Get pointer to the actor definition ld b, a add a, a ; a * 2 (X, Y) add a, a ; a * 4 (X speed, Y speed) add a, b ; a * 5 (Type) ASSERT BANK(xObstacleDefinitions) == BANK(@) add a, LOW(xObstacleDefinitions) ld e, a ASSERT HIGH(xObstacleDefinitions.end - 1) == HIGH(xObstacleDefinitions) ld d, HIGH(xObstacleDefinitions) jp ActorNew xObstacleDefinitions: ; Car DB ACTOR_CAR DB OBSTACLE_X, OBSTACLE_Y DB OBSTACLE_SPEED, 0 ; Log DB ACTOR_LOG DB OBSTACLE_X, OBSTACLE_Y DB OBSTACLE_SPEED, 0 ; Oil Barrel DB ACTOR_OIL_BARREL DB OBSTACLE_X, OBSTACLE_Y DB OBSTACLE_SPEED, 0 .end SECTION "Skater Dude Slo-Mo Cue", ROMX xCueSloMo:: ; Start slo-mo ld a, SKATER_DUDE_SLO_MO_DURATION ldh [hSloMoCountdown], a ret SECTION "Skater Dude Actor", ROMX xActorSkaterDude:: ; Game hasn't started yet -> skate on-screen ldh a, [hSkaterDudeState] ASSERT SKATER_DUDE_STATE_IN == 0 and a, a jp z, .skatingOnscreen ; Currently skating off-screen ASSERT SKATER_DUDE_STATE_OUT == 1 dec a ; Nothing to do while skating out jp z, .skatingOffscreen ; Music ended -> skate off-screen ld a, [wMusicSyncData] ASSERT SYNC_SKATER_DUDE_END == 1 dec a jp z, .skateOffscreen ; If Skater Dude isn't on the ground (fallen), he should be "moving" ; The background scrolls so to "move", Skater Dude must stay in ; place ld hl, wActorCelOverrideTable add hl, bc ld a, [hl] ASSERT ANIMATION_OVERRIDE_NONE == -1 inc a ; No animation override -> skating animation jr z, .moving ; Add 1 to compensate for inc cp a, CEL_SKATER_DUDE_FALLING + 1 jr nc, .updateJump .moving ; Skater Dude is either skating or jumping -> "move" ld hl, wActorXSpeedTable add hl, bc ld [hl], 0 ; Make sure the position is correct after falling ld hl, wActorXPosTable add hl, bc ld [hl], SKATER_DUDE_X .updateJump ; If Skater Dude is currently jumping, update his Y position ldh a, [hSkaterDudePosIndex] inc a jr z, .notJumping ; If not currently in slo-mo, the countdown works a little ; differently ldh a, [hSloMoCountdown] ASSERT SKATER_DUDE_NO_SLO_MO == -1 inc a jr nz, .sloMo ; In not in slo-mo, subtract the denominator of slo-mo speed instead ; of 1 (denominator in normal speed) ldh a, [hSkaterDudePosCountdown] sub a, SKATER_DUDE_SLO_MO_DIVIDE ldh [hSkaterDudePosCountdown], a ; If less than or equal to 0, update Skater Dude's position jr z, .jumping jr nc, .notJumping jr .jumping .sloMo ; In slo-mo, simply decrement the countdown ld hl, hSkaterDudePosCountdown dec [hl] jr nz, .notJumping .jumping ; Skater Dude is jumping and it is time to change his Y position ; Update the position table index ld hl, hSkaterDudePosIndex inc [hl] ; Find the new Y position ld a, [hl] add a, a ; a * 2 (Position, Duration) add a, LOW(xJumpPositionTable) ld l, a ASSERT HIGH(xJumpPositionTable.end - 1) == HIGH(xJumpPositionTable) ld h, HIGH(xJumpPositionTable) ; Get the new Y position ld a, [hli] ; a = Y position ; 0 signals the end of the table and a, a jr z, .finishedJumping ld e, [hl] ; e = duration ; Set the new Y position ld hl, wActorYPosTable add hl, bc ld [hl], a ; Set the countdown to the new duration ld a, e ldh [hSkaterDudePosCountdown], a jr .notJumping .finishedJumping ; Set the position table index to -1 to signal not jumping ; a = 0 dec a ldh [hSkaterDudePosIndex], a .notJumping ; Check if the player pressed the jump button ldh a, [hNewKeys] bit PADB_A, a jr z, .noJump ; Player pressed the A button -> jump xor a, a ldh [hSkaterDudePosIndex], a ; Set countdown to 1 to update next frame inc a ldh [hSkaterDudePosCountdown], a ; Depending on the hit rating, play the appropriate sound effect ldh a, [hLastHitRating] ASSERT HIT_BAD < HIT_OK && HIT_PERFECT > HIT_OK sub a, HIT_OK + 1 ; If Bad or OK, play the wonky jump sound effect ld a, SFX_SKATER_DUDE_JUMP_OK jr c, .notPerfect ; If Perfect, play the normal jump sound effect ASSERT SFX_SKATER_DUDE_JUMP_PERFECT == SFX_SKATER_DUDE_JUMP_OK + 1 inc a .notPerfect ld b, a ; b = SFX ID call SFX_Play ASSERT HIGH(MAX_ACTOR_COUNT) == HIGH(0) ld b, 0 .noSFX ld a, CEL_SKATER_DUDE_JUMPING jp ActorSetAnimationOverride .noJump ; If the player missed this hit (is late enough), they get hit by ; the obstacle ldh a, [hLastHit.low] cp a, HIT_MISS_DELAY ret nz ldh a, [hLastHit.high] ASSERT HIGH(HIT_MISS_DELAY) == 0 and a, a ret nz ; It's late enough, but did the player already jump successfully (OK ; or Perfect hit)? ldh a, [hNextHitNumber] ld e, a ldh a, [hLastRatedHitNumber] inc a ; Comparing with next hit number cp a, e ; The player already made this hit -> they're not late ret nc ; The player missed the hit ld b, SFX_SKATER_DUDE_FALL call SFX_Play ASSERT HIGH(MAX_ACTOR_COUNT) == HIGH(0) ld b, 0 ; End slo-mo ld a, SKATER_DUDE_NO_SLO_MO ldh [hSloMoCountdown], a ; "Stop" moving ; The background normally scrolls with Skater Dude in place, making ; it look like he's the one moving. Since he shouldn't be moving, ; move him in the opposite direction the background is moving. ld hl, wActorXSpeedTable add hl, bc ; Background scrolls 1 pixel per frame ld [hl], 1 << 3 ; Reset Skater Dude's position for the event of consecutive misses ld hl, wActorXPosTable add hl, bc ld [hl], SKATER_DUDE_X ; Start the falling animation ld a, CEL_SKATER_DUDE_FALLING jp ActorSetAnimationOverride .skatingOnscreen ; Check if Skater Dude has reached his normal position ld hl, wActorXPosTable add hl, bc ld a, [hl] ; Speed is slow enough to simply check for the exact position ASSERT SKATER_DUDE_IN_SPEED < 0 && SKATER_DUDE_IN_SPEED >> 3 == -1 cp a, SKATER_DUDE_X jp nz, .updateJump ; Skater Dude has reached his normal position ASSERT SKATER_DUDE_X >= SKATER_DUDE_STATE_COUNT ; State = normal Skater Dude function ldh [hSkaterDudeState], a jp .updateJump .skateOffscreen ld hl, wActorXSpeedTable add hl, bc ld [hl], SKATER_DUDE_OUT_SPEED ld a, SKATER_DUDE_STATE_OUT ldh [hSkaterDudeState], a jp .updateJump .skatingOffscreen ; Check if Skater Dude is finished skating off-screen ld hl, wActorXPosTable add hl, bc ld a, [hl] ; Can check for end position with sign bit ASSERT SKATER_DUDE_END_X < 0 ; Normal position is not negative in two's complement ASSERT SKATER_DUDE_X & (1 << 7) == 0 add a, a ; Move bit 7 to carry ; Not negative (end position is) -> not there yet jp nc, .updateJump ; Add 1 to check for > instead of >=, shifted to compensate for ; double (add a, a) cp a, (SKATER_DUDE_END_X + 1) << 1 jp nc, .updateJump ; Game is over ld a, SKATER_DUDE_STATE_END ldh [hSkaterDudeState], a jp .updateJump xJumpPositionTable: DB SKATER_DUDE_Y - SKATER_DUDE_JUMP_HEIGHT * 1/3, 1 DB SKATER_DUDE_Y - SKATER_DUDE_JUMP_HEIGHT * 2/3, 1 DB SKATER_DUDE_Y - SKATER_DUDE_JUMP_HEIGHT, (MUSIC_SKATER_DUDE_SPEED * 4) - (1 + 1 + 1) * 2 DB SKATER_DUDE_Y - SKATER_DUDE_JUMP_HEIGHT * 2/3, 1 DB SKATER_DUDE_Y - SKATER_DUDE_JUMP_HEIGHT * 1/3, 1 DB SKATER_DUDE_Y, 1 DB 0 .end SECTION "Skater Dude Obstacle Actor", ROMX xActorObstacle:: ld hl, wActorXSpeedTable add hl, bc ; Check if slo-mo status has changed ldh a, [hSloMoCountdown] ASSERT SKATER_DUDE_NO_SLO_MO == -1 inc a jr z, .noSloMo ; Check if slo-mo just started ; Add 1 to compensate for the inc cp a, SKATER_DUDE_SLO_MO_DURATION + 1 jr c, .noChange ; In slo-mo -> move slowly ld [hl], OBSTACLE_SLO_MO_SPEED ; Use slower animation ld a, CEL_OBSTACLE_SLO_MO call ActorSetAnimationOverride jr .noChange .noSloMo ; No longer in slo-mo -> move at the regular speed ld [hl], OBSTACLE_SPEED ; Return to the fast animation ld hl, wActorCelOverrideTable add hl, bc ld [hl], ANIMATION_OVERRIDE_NONE .noChange ; Check if the obstacle has gone off-screen ld hl, wActorXPosTable add hl, bc ld a, [hl] ; Check if the obstacle has not yet come on-screen ASSERT LOW(OBSTACLE_X) & (1 << 7) && LOW(SCRN_X) & (1 << 7) ASSERT LOW(SCRN_X) < LOW(OBSTACLE_X) cp a, OBSTACLE_X ; Haven't come on-screen yet, nothing to do ret nc ; Check if the obstacle has gone past the right edge of the screen cp a, SCRN_X ; Still on-screen, nothing to do ret c ; Kill this obstacle jp ActorKill
SECTION code_fp_math16 PUBLIC cm16_sdcc___lt_callee EXTERN cm16_sdcc_readr_callee EXTERN asm_f16_compare_callee ; Entry: stack: half right, half left, ret .cm16_sdcc___lt_callee call cm16_sdcc_readr_callee ;Exit hl = right call asm_f16_compare_callee ret C dec hl ret
.export _ultimem_unhide .code ; Returns ID. .proc _ultimem_unhide lda $9f55 lda $9faa lda $9f01 lda $9ff3 rts .endproc
// Exercise5.14.cpp // Ad // Write a program to read strings and look for duplicated words. #include <iostream> #include <string> using std::cin; using std::cout; using std::endl; int main() { std::string str = {}, wordLast = {}, wordDup = {}; unsigned cnt = {1}, max = {0}; while (cin >> str) { if (str == wordLast) { ++cnt; } else { cnt = 1; } if (max < cnt) { max = cnt; wordDup = str; } wordLast = str; } if (max < 2) { cout << "No word was repeated." << endl; } else { cout << "The maximum number of duplicates: " << max << " and the word is " << wordDup << endl; } // pause system("pause"); return 0; }
#include "MainReportsUiState.h" #include "../Cache.h" #include "../Constants.h" #include "../UI/Reports/ReportInterface.h" #include "../UI/Reports/FactoryReport.h" #include "../UI/Reports/MineReport.h" #include "../UI/Reports/WarehouseReport.h" #include <NAS2D/Utility.h> #include <NAS2D/Renderer/Renderer.h> #include <array> using namespace NAS2D; extern Point<int> MOUSE_COORDS; static const Image* WINDOW_BACKGROUND = nullptr; const Font* BIG_FONT = nullptr; const Font* BIG_FONT_BOLD = nullptr; /** * Enumerated IDs for the navigation panels. */ enum NavigationPanel { PANEL_RESEARCH, PANEL_PRODUCTION, PANEL_WAREHOUSE, PANEL_MINING, PANEL_SATELLITES, PANEL_SPACEPORT, PANEL_EXIT, PANEL_COUNT }; /** * Represents a navigation panel. */ class Panel { public: void Selected(bool _b) { _selected = _b; if (UiPanel) { UiPanel->enabled(_b); } } bool Selected() { return _selected; } public: std::string Name; const Image* Img = nullptr; Point<int> TextPosition; Point<int> IconPosition; Rectangle<int> Rect; ReportInterface* UiPanel = nullptr; private: bool _selected = false; }; static std::array<Panel, NavigationPanel::PANEL_COUNT> Panels; /**< Array of UI navigation panels. */ /** * Computes the panel rectangles for the top nav bar. */ static void setPanelRects(int width) { Panels[NavigationPanel::PANEL_EXIT].Rect = {width - 48, 0, 48, 48}; Panels[NavigationPanel::PANEL_EXIT].IconPosition = {width - 40, 8}; int remaining_width = width - Panels[NavigationPanel::PANEL_EXIT].Rect.width; const auto panelSize = NAS2D::Vector{remaining_width / 6, 48}; auto panelPosition = NAS2D::Point{0, 0}; for (std::size_t i = 0; i < NavigationPanel::PANEL_EXIT; ++i) { auto& panel = Panels[i]; panel.Rect = NAS2D::Rectangle<int>::Create(panelPosition, panelSize); panel.TextPosition = panelPosition + (panelSize - BIG_FONT->size(panel.Name)) / 2 + NAS2D::Vector{20, 0}; panel.IconPosition = {panel.TextPosition.x - 40, 8}; panelPosition.x += panelSize.x; } } /** * Draws a UI panel. */ static void drawPanel(Renderer& renderer, Panel& panel) { if (panel.Rect.contains(MOUSE_COORDS)) { renderer.drawBoxFilled(panel.Rect, NAS2D::Color{0, 185, 185, 100}); } if (panel.Selected()) { renderer.drawBoxFilled(panel.Rect, NAS2D::Color{0, 85, 0}); if (panel.UiPanel) { panel.UiPanel->update(); } renderer.drawText(*BIG_FONT_BOLD, panel.Name, panel.TextPosition, NAS2D::Color{185, 185, 0}); renderer.drawImage(*panel.Img, panel.IconPosition, 1.0f, NAS2D::Color{185, 185, 0}); } else { renderer.drawText(*BIG_FONT_BOLD, panel.Name, panel.TextPosition, NAS2D::Color{0, 185, 0}); renderer.drawImage(*panel.Img, panel.IconPosition, 1.0f, NAS2D::Color{0, 185, 0}); } } MainReportsUiState::MainReportsUiState() { Utility<EventHandler>::get().windowResized().connect(this, &MainReportsUiState::onWindowResized); Utility<EventHandler>::get().keyDown().connect(this, &MainReportsUiState::onKeyDown); Utility<EventHandler>::get().mouseButtonDown().connect(this, &MainReportsUiState::onMouseDown); } MainReportsUiState::~MainReportsUiState() { Utility<EventHandler>::get().windowResized().disconnect(this, &MainReportsUiState::onWindowResized); Utility<EventHandler>::get().keyDown().disconnect(this, &MainReportsUiState::onKeyDown); Utility<EventHandler>::get().mouseButtonDown().disconnect(this, &MainReportsUiState::onMouseDown); for (Panel& panel : Panels) { delete panel.UiPanel; } } void MainReportsUiState::initialize() { WINDOW_BACKGROUND = &imageCache.load("ui/skin/window_middle_middle.png"); BIG_FONT = &fontCache.load(constants::FONT_PRIMARY, 16); BIG_FONT_BOLD = &fontCache.load(constants::FONT_PRIMARY_BOLD, 16); Panels[NavigationPanel::PANEL_EXIT].Img = &imageCache.load("ui/icons/exit.png"); Panels[NavigationPanel::PANEL_RESEARCH].Img = &imageCache.load("ui/icons/research.png"); Panels[NavigationPanel::PANEL_RESEARCH].Name = "Laboratories"; Panels[NavigationPanel::PANEL_PRODUCTION].Img = &imageCache.load("ui/icons/production.png"); Panels[NavigationPanel::PANEL_PRODUCTION].Name = "Factories"; Panels[NavigationPanel::PANEL_WAREHOUSE].Img = &imageCache.load("ui/icons/warehouse.png"); Panels[NavigationPanel::PANEL_WAREHOUSE].Name = "Warehouses"; Panels[NavigationPanel::PANEL_MINING].Img = &imageCache.load("ui/icons/mine.png"); Panels[NavigationPanel::PANEL_MINING].Name = "Mines"; Panels[NavigationPanel::PANEL_SATELLITES].Img = &imageCache.load("ui/icons/satellite.png"); Panels[NavigationPanel::PANEL_SATELLITES].Name = "Satellites"; Panels[NavigationPanel::PANEL_SPACEPORT].Img = &imageCache.load("ui/icons/spaceport.png"); Panels[NavigationPanel::PANEL_SPACEPORT].Name = "Space Ports"; auto& renderer = Utility<Renderer>::get(); const auto size = renderer.size().to<int>(); setPanelRects(size.x); // INIT UI REPORT PANELS ReportInterface* factory_report = new FactoryReport(); Panels[NavigationPanel::PANEL_PRODUCTION].UiPanel = factory_report; factory_report->position({0, 48}); factory_report->size({size.x, size.y - 48}); factory_report->hide(); ReportInterface* warehouse_report = new WarehouseReport(); Panels[NavigationPanel::PANEL_WAREHOUSE].UiPanel = warehouse_report; warehouse_report->position({0, 48}); warehouse_report->size({size.x, size.y - 48}); warehouse_report->hide(); ReportInterface* mining_report = new MineReport(); Panels[NavigationPanel::PANEL_MINING].UiPanel = mining_report; mining_report->position({ 0, 48 }); mining_report->size({ size.x, size.y - 48 }); mining_report->hide(); } /** * Wrapper activate handler. */ void MainReportsUiState::_activate() { Panels[NavigationPanel::PANEL_PRODUCTION].UiPanel->fillLists(); Panels[NavigationPanel::PANEL_PRODUCTION].UiPanel->refresh(); Panels[NavigationPanel::PANEL_WAREHOUSE].UiPanel->fillLists(); Panels[NavigationPanel::PANEL_WAREHOUSE].UiPanel->refresh(); Panels[NavigationPanel::PANEL_MINING].UiPanel->fillLists(); Panels[NavigationPanel::PANEL_MINING].UiPanel->refresh(); } /** * Wrapper deactivate handler. */ void MainReportsUiState::_deactivate() { for (auto& panel : Panels) { if (panel.UiPanel) { panel.UiPanel->hide(); } panel.Selected(false); } Panels[NavigationPanel::PANEL_PRODUCTION].UiPanel->clearSelected(); Panels[NavigationPanel::PANEL_WAREHOUSE].UiPanel->clearSelected(); Panels[NavigationPanel::PANEL_MINING].UiPanel->clearSelected(); } /** * Key down event handler. */ void MainReportsUiState::onKeyDown(EventHandler::KeyCode key, EventHandler::KeyModifier /*mod*/, bool /*repeat*/) { if (!active()) { return; } if (key == NAS2D::EventHandler::KeyCode::KEY_ESCAPE) { exit(); } } /** * Mouse down event handler. */ void MainReportsUiState::onMouseDown(EventHandler::MouseButton button, int x, int y) { if (!active()) { return; } if (!NAS2D::Rectangle{0, 0, Utility<Renderer>::get().size().x, 40}.contains(Point{x, y})) { return; } // ignore clicks in the UI area. if (button == EventHandler::MouseButton::Left) { for (Panel& panel : Panels) { bool selected = panel.Rect.contains(MOUSE_COORDS); panel.Selected(selected); if (panel.UiPanel) { panel.UiPanel->visible(selected); } } } if (Panels[NavigationPanel::PANEL_EXIT].Selected()) { exit(); } } void MainReportsUiState::exit() { deselectAllPanels(); for (auto& panel : Panels) { if (panel.UiPanel) { panel.UiPanel->clearSelected(); } } mReportsUiCallback(); } /** * Window resized event handler. */ void MainReportsUiState::onWindowResized(int w, int h) { setPanelRects(w); for (Panel& panel : Panels) { if (panel.UiPanel) { panel.UiPanel->size(NAS2D::Vector{w, h - 48}); } } } void MainReportsUiState::deselectAllPanels() { for (auto& panel : Panels) { panel.Selected(false); } } /** * Structure pointer is assumed to be a factory. */ void MainReportsUiState::selectFactoryPanel(Structure* structure) { deselectAllPanels(); Panels[NavigationPanel::PANEL_PRODUCTION].Selected(true); Panels[NavigationPanel::PANEL_PRODUCTION].UiPanel->visible(true); Panels[NavigationPanel::PANEL_PRODUCTION].UiPanel->refresh(); Panels[NavigationPanel::PANEL_PRODUCTION].UiPanel->selectStructure(structure); } /** * Structure pointer is assumed to be a warehouse. */ void MainReportsUiState::selectWarehousePanel(Structure* structure) { deselectAllPanels(); Panels[NavigationPanel::PANEL_WAREHOUSE].Selected(true); Panels[NavigationPanel::PANEL_WAREHOUSE].UiPanel->visible(true); Panels[NavigationPanel::PANEL_WAREHOUSE].UiPanel->refresh(); Panels[NavigationPanel::PANEL_WAREHOUSE].UiPanel->selectStructure(structure); } /** * Structure pointer is assumed to be a Mine Facility or Smelter. */ void MainReportsUiState::selectMinePanel(Structure* structure) { deselectAllPanels(); Panels[NavigationPanel::PANEL_MINING].Selected(true); Panels[NavigationPanel::PANEL_MINING].UiPanel->visible(true); Panels[NavigationPanel::PANEL_MINING].UiPanel->refresh(); Panels[NavigationPanel::PANEL_MINING].UiPanel->selectStructure(structure); } void MainReportsUiState::clearLists() { Panels[NavigationPanel::PANEL_PRODUCTION].UiPanel->fillLists(); Panels[NavigationPanel::PANEL_WAREHOUSE].UiPanel->fillLists(); Panels[NavigationPanel::PANEL_MINING].UiPanel->fillLists(); } /** * Gets a list of TakeMeThere signal pointers. * * Acts as a pass-through for GameState. */ MainReportsUiState::TakeMeThereList MainReportsUiState::takeMeThere() { TakeMeThereList takeMeThereList; for (auto& panel : Panels) { if (panel.UiPanel) { takeMeThereList.push_back(&panel.UiPanel->takeMeThereCallback()); } } return takeMeThereList; } /** * Draw */ State* MainReportsUiState::update() { auto& renderer = Utility<Renderer>::get(); renderer.clearScreen(NAS2D::Color{35, 35, 35}); renderer.drawBoxFilled(NAS2D::Rectangle{0, 0, renderer.size().x, 48}, NAS2D::Color::Black); for (Panel& panel : Panels) { drawPanel(renderer, panel); } return this; }
//********************************************************* // Copyright (c) Microsoft. All rights reserved. // // Apache 2.0 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 "pch.h" #include "PbrModelObject.h" #include "TextTexture.h" #include "Scene.h" using namespace DirectX; using namespace xr::math; using namespace std::chrono; using namespace std::chrono_literals; namespace { // // This sample displays a floating title text block following the user. // When the user moves or looks around, the text slowly ease into it's position in front of the user. // struct TitleScene : public Scene { TitleScene(SceneContext& sceneContext) : Scene(sceneContext) { XrReferenceSpaceCreateInfo createInfo{XR_TYPE_REFERENCE_SPACE_CREATE_INFO}; createInfo.referenceSpaceType = XR_REFERENCE_SPACE_TYPE_VIEW; createInfo.poseInReferenceSpace = Pose::Identity(); CHECK_XRCMD(xrCreateReferenceSpace(m_sceneContext.Session.Handle, &createInfo, m_viewSpace.Put())); constexpr float margin = 0.01f; constexpr float titleWidth = 0.5f; constexpr float titleHeight = titleWidth / 3; const auto& material = Pbr::Material::CreateFlat(m_sceneContext.PbrResources, Pbr::FromSRGB(Colors::DarkGray)); m_background = AddSceneObject(CreateQuad(m_sceneContext.PbrResources, {titleWidth, titleHeight}, material)); m_background->SetVisible(false); TextTextureInfo textInfo{256, 128}; // pixels textInfo.Foreground = Pbr::RGBA::White; textInfo.Background = Pbr::FromSRGB(Colors::DarkSlateBlue); textInfo.Margin = 5; // pixels textInfo.TextAlignment = DWRITE_TEXT_ALIGNMENT_LEADING; textInfo.ParagraphAlignment = DWRITE_PARAGRAPH_ALIGNMENT_NEAR; auto placeTextBlock = [&](TextBlock& block, float top, float blockHeight) { textInfo.Height = (uint32_t)std::floor(blockHeight * textInfo.Width / titleWidth); // Keep texture aspect ratio std::unique_ptr<TextTexture> textTexture = std::make_unique<TextTexture>(m_sceneContext, textInfo); textTexture->Draw(block.Text.c_str()); const auto& material = textTexture->CreatePbrMaterial(m_sceneContext.PbrResources); block.Object = AddSceneObject(CreateQuad(m_sceneContext.PbrResources, {titleWidth, blockHeight}, material)); block.Object->Pose() = Pose::Translation({0, (titleHeight / 2) - top - (blockHeight / 2), margin}); block.Object->SetParent(m_background); }; m_title.Text = fmt::format(L"{}, v{}", xr::utf8_to_wide(m_sceneContext.Instance.AppInfo.Name), m_sceneContext.Instance.AppInfo.Version) .c_str(); textInfo.FontSize = 16.0f; placeTextBlock(m_title, margin, titleHeight / 2 - margin * 2); m_subtitle.Text = fmt::format(L"OpenXR API version: {}.{}.{}\n{}, v{}.{}.{}", XR_VERSION_MAJOR(XR_CURRENT_API_VERSION), XR_VERSION_MINOR(XR_CURRENT_API_VERSION), XR_VERSION_PATCH(XR_CURRENT_API_VERSION), xr::utf8_to_wide(m_sceneContext.Instance.Properties.runtimeName), XR_VERSION_MAJOR(m_sceneContext.Instance.Properties.runtimeVersion), XR_VERSION_MINOR(m_sceneContext.Instance.Properties.runtimeVersion), XR_VERSION_PATCH(m_sceneContext.Instance.Properties.runtimeVersion)) .c_str(); textInfo.FontSize = 10.0f; placeTextBlock(m_subtitle, titleHeight / 2, titleHeight / 2 - margin); } void OnUpdate(const FrameTime& frameTime) override { XrSpaceLocation viewInScene = {XR_TYPE_SPACE_LOCATION}; CHECK_XRCMD(xrLocateSpace(m_viewSpace.Get(), m_sceneContext.SceneSpace, frameTime.PredictedDisplayTime, &viewInScene)); if (Pose::IsPoseValid(viewInScene)) { XrPosef titleInView = {{0, 0, 0, 1}, {0, 0, -1.f}}; // 1 meter in front XrPosef titleInScene = titleInView * viewInScene.pose; titleInScene.position.y = 0.5f; // floating in the top of user's view XrVector3f forward = titleInScene.position - viewInScene.pose.position; m_targetPose = Pose::LookAt(titleInScene.position, forward, {0, 1, 0}); if (!m_background->IsVisible()) { m_background->SetVisible(true); m_background->Pose() = m_targetPose; } else { // Ease the object to the target pose slowly. 98%^90hz~=16% m_background->Pose() = Pose::Slerp(m_background->Pose(), m_targetPose, 0.02f); } } } private: struct TextBlock { std::wstring Text; std::shared_ptr<PbrModelObject> Object; }; xr::SpaceHandle m_viewSpace; std::shared_ptr<PbrModelObject> m_background; TextBlock m_title; TextBlock m_subtitle; XrPosef m_targetPose; }; } // namespace std::unique_ptr<Scene> TryCreateTitleScene(SceneContext& sceneContext) { return std::make_unique<TitleScene>(sceneContext); }
.global s_prepare_buffers s_prepare_buffers: push %r11 push %r14 push %r9 push %rax push %rbx push %rcx push %rdi push %rsi lea addresses_WC_ht+0x6882, %r11 nop nop inc %r14 movb (%r11), %r9b nop nop xor $14243, %r9 lea addresses_D_ht+0xef02, %rsi lea addresses_UC_ht+0x63da, %rdi nop nop nop nop nop sub %r14, %r14 mov $52, %rcx rep movsl xor $10475, %rdi lea addresses_WT_ht+0x1786a, %r11 nop nop nop sub $8159, %rax mov (%r11), %rdi cmp %r14, %r14 lea addresses_WT_ht+0x7159, %rsi lea addresses_UC_ht+0xfabf, %rdi nop nop nop cmp $30294, %r11 mov $93, %rcx rep movsb nop nop dec %rsi lea addresses_WC_ht+0x9c6a, %rsi lea addresses_WC_ht+0xe38a, %rdi clflush (%rdi) nop and $59494, %rbx mov $118, %rcx rep movsl nop nop nop nop cmp $34954, %rcx lea addresses_normal_ht+0xebc2, %rax clflush (%rax) nop nop nop nop nop add %r14, %r14 movb $0x61, (%rax) xor $2134, %rcx lea addresses_WT_ht+0x18bea, %rsi lea addresses_D_ht+0xbdaa, %rdi nop nop xor %rbx, %rbx mov $35, %rcx rep movsl nop xor %rbx, %rbx lea addresses_WT_ht+0xd06a, %rax nop nop nop nop nop dec %rbx mov $0x6162636465666768, %rcx movq %rcx, %xmm1 vmovups %ymm1, (%rax) nop nop nop add %rcx, %rcx pop %rsi pop %rdi pop %rcx pop %rbx pop %rax pop %r9 pop %r14 pop %r11 ret .global s_faulty_load s_faulty_load: push %r10 push %r11 push %r13 push %r14 push %r8 push %rax push %rdi // Store lea addresses_UC+0x846a, %r11 nop nop nop and $19221, %r13 mov $0x5152535455565758, %rax movq %rax, %xmm2 vmovups %ymm2, (%r11) nop add %rax, %rax // Store lea addresses_normal+0xa0a, %r14 nop dec %r11 mov $0x5152535455565758, %r13 movq %r13, %xmm0 vmovups %ymm0, (%r14) nop nop nop nop inc %r13 // Store lea addresses_normal+0x19bee, %rdi nop nop and $20409, %rax movl $0x51525354, (%rdi) add $39911, %rax // Store lea addresses_normal+0x12a6a, %r8 nop inc %r10 movl $0x51525354, (%r8) nop nop nop nop sub $28930, %rax // Store mov $0x6a, %r8 nop nop nop nop nop xor %r13, %r13 movw $0x5152, (%r8) // Exception!!! nop nop nop mov (0), %r13 nop nop inc %rax // Store mov $0x41c0080000000084, %r13 nop and %rdi, %rdi movw $0x5152, (%r13) nop nop nop xor $60199, %r13 // Faulty Load mov $0x76c308000000006a, %r8 nop nop and $38493, %r14 mov (%r8), %rax lea oracles, %rdi and $0xff, %rax shlq $12, %rax mov (%rdi,%rax,1), %rax pop %rdi pop %rax pop %r8 pop %r14 pop %r13 pop %r11 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_NC', 'same': False, 'size': 8, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_UC', 'same': False, 'size': 32, 'congruent': 10, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'dst': {'type': 'addresses_normal', 'same': False, 'size': 32, 'congruent': 3, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'dst': {'type': 'addresses_normal', 'same': False, 'size': 4, 'congruent': 2, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'dst': {'type': 'addresses_normal', 'same': False, 'size': 4, 'congruent': 9, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'dst': {'type': 'addresses_P', 'same': False, 'size': 2, 'congruent': 10, 'NT': True, 'AVXalign': False}, 'OP': 'STOR'} {'dst': {'type': 'addresses_NC', 'same': False, 'size': 2, 'congruent': 1, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} [Faulty Load] {'src': {'type': 'addresses_NC', 'same': True, 'size': 8, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'type': 'addresses_WC_ht', 'same': False, 'size': 1, 'congruent': 3, 'NT': True, 'AVXalign': True}, 'OP': 'LOAD'} {'src': {'type': 'addresses_D_ht', 'congruent': 2, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 2, 'same': False}, 'OP': 'REPM'} {'src': {'type': 'addresses_WT_ht', 'same': False, 'size': 8, 'congruent': 10, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_WT_ht', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 0, 'same': False}, 'OP': 'REPM'} {'src': {'type': 'addresses_WC_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 4, 'same': False}, 'OP': 'REPM'} {'dst': {'type': 'addresses_normal_ht', 'same': False, 'size': 1, 'congruent': 3, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'src': {'type': 'addresses_WT_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 6, 'same': True}, 'OP': 'REPM'} {'dst': {'type': 'addresses_WT_ht', 'same': True, 'size': 32, 'congruent': 10, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'46': 1, '00': 309, '52': 21519} 00 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 00 52 52 52 52 52 52 00 52 52 52 52 52 52 52 52 52 52 52 52 52 00 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 00 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 00 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 00 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 00 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 00 52 00 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 00 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 00 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 00 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 00 52 52 52 00 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 00 52 52 52 52 52 52 52 52 52 52 52 00 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 00 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 00 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 */
processor 18F8722 config OSC=HS, WDT=OFF, LVP=OFF radix decimal ;Setting labels for toggle switches PORTH equ 0xF87 TRISH equ 0xF99 ;Setting labels for transistor Q3 TRISA equ 0xF92 LATA equ 0xF89 ;Setting labels for LEDs TRISF equ 0xF97 LATF equ 0xF8E ;Setting labels for digital IO ADCON1 equ 0xFC1 ;Setting lable for needed memory location number equ 0x10 ;Initializing digital IO MOVLW 0x0F MOVWF ADCON1 ;Making sure LEDs are off CLRF LATF ;Turnign on transistor Q3 MOVLW B'11101111' MOVWF TRISA MOVLW B'11111111' MOVWF LATA ;Setting four MSB toggle switches as inputs ;and making sure transistors Q1 and Q2 are off MOVLW B'11111111' MOVWF TRISH ;Setting all LEDs as outputs MOVLW B'00000000' MOVWF TRISF loop ;Taking value from the MSB toggle switches MOVF PORTH, W ANDLW B'11110000' MOVWF number SWAPF number ;Checkign in bit-3 is 1 or 0 MOVF number, W ADDLW -8 ;if bit-3 = 0 BN add_0s ;Checking if two's complement is = -1, ;in which case result of x/2 = 0 ADDLW -7 BZ its_0 ;Else add 1s for bits 4 to 7 ADDLW 255 ;To compensate for two's complement divisions with odd numbers ADDLW 1 ;Rotate right once (equals to dividing by 2) MOVWF number RRNCF number, W ;Making sure bit-7 is still a 1 IORLW B'10000000' ;Giving values to the LEDs MOVWF LATF BRA loop add_0s ;Adding back 8 previously subtracted ADDLW 8 ;Rotate right once (equals to dividing by 2) MOVWF number RRNCF number, W ;Making sure bit-7 is still a 0 ANDLW B'01111111' ;Giving values to the LEDs MOVWF LATF BRA loop its_0 ;Turnign all LEDs off CLRF LATF BRA loop end
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r12 push %r13 push %r14 push %rax push %rcx push %rdi push %rsi lea addresses_normal_ht+0x109a, %r13 clflush (%r13) nop and $35734, %rax movups (%r13), %xmm0 vpextrq $0, %xmm0, %r14 nop sub $20521, %r12 lea addresses_UC_ht+0x1acc8, %rsi lea addresses_normal_ht+0x19dde, %rdi nop nop and %r10, %r10 mov $59, %rcx rep movsq nop nop nop sub %rcx, %rcx lea addresses_A_ht+0x6ede, %r10 nop nop nop xor %rcx, %rcx vmovups (%r10), %ymm0 vextracti128 $0, %ymm0, %xmm0 vpextrq $0, %xmm0, %r13 nop nop nop nop nop xor %rcx, %rcx lea addresses_WC_ht+0xab2a, %rsi lea addresses_WC_ht+0xd39e, %rdi xor $37797, %rax mov $90, %rcx rep movsb xor %r12, %r12 lea addresses_WC_ht+0x11fde, %rdi nop nop nop nop nop and %rcx, %rcx mov $0x6162636465666768, %rsi movq %rsi, %xmm5 movups %xmm5, (%rdi) nop sub %r10, %r10 lea addresses_WT_ht+0x1b5de, %r12 cmp $34658, %r10 movb $0x61, (%r12) xor $50655, %r14 lea addresses_UC_ht+0x1cefe, %rdi nop nop and %r14, %r14 mov $0x6162636465666768, %rcx movq %rcx, %xmm4 vmovups %ymm4, (%rdi) dec %r14 lea addresses_WC_ht+0x7afe, %rsi lea addresses_WC_ht+0x17a2e, %rdi clflush (%rsi) nop nop nop nop cmp $47125, %r12 mov $64, %rcx rep movsb nop dec %r12 lea addresses_normal_ht+0xc45e, %rsi lea addresses_UC_ht+0x1d9de, %rdi nop nop nop nop nop add $19846, %r14 mov $83, %rcx rep movsb nop nop nop nop nop inc %rdi lea addresses_WC_ht+0x19e6, %rcx clflush (%rcx) nop and $26425, %r12 movups (%rcx), %xmm7 vpextrq $1, %xmm7, %r13 nop nop nop nop nop xor %r12, %r12 lea addresses_UC_ht+0xefde, %r10 nop nop nop nop inc %r12 movb (%r10), %r13b nop nop nop and %rdi, %rdi pop %rsi pop %rdi pop %rcx pop %rax pop %r14 pop %r13 pop %r12 pop %r10 ret .global s_faulty_load s_faulty_load: push %r12 push %r15 push %r8 push %r9 push %rax push %rbp push %rsi // Store lea addresses_A+0x71de, %r12 nop nop xor $37014, %r9 mov $0x5152535455565758, %r8 movq %r8, (%r12) nop nop nop nop and %r12, %r12 // Store lea addresses_RW+0xb55e, %rsi nop and $49046, %rbp mov $0x5152535455565758, %r8 movq %r8, %xmm0 vmovups %ymm0, (%rsi) nop nop nop nop and $34174, %rsi // Store lea addresses_A+0x1569e, %r8 nop nop nop nop nop add $54232, %rsi mov $0x5152535455565758, %r15 movq %r15, (%r8) nop nop nop nop nop add %rbp, %rbp // Store lea addresses_A+0x71de, %r12 nop nop nop nop and $56865, %r15 movl $0x51525354, (%r12) nop add $45796, %r12 // Load lea addresses_WT+0x115de, %r15 nop cmp %rax, %rax movups (%r15), %xmm1 vpextrq $0, %xmm1, %r9 add $45298, %r15 // Load lea addresses_UC+0x8bde, %rsi nop nop and %r15, %r15 mov (%rsi), %r8 nop nop nop nop cmp $40296, %r8 // Store lea addresses_A+0x71de, %r12 and %rbp, %rbp mov $0x5152535455565758, %rax movq %rax, (%r12) nop nop nop and $60098, %rsi // Faulty Load lea addresses_A+0x71de, %r15 nop cmp $37663, %r8 mov (%r15), %r12w lea oracles, %rbp and $0xff, %r12 shlq $12, %r12 mov (%rbp,%r12,1), %r12 pop %rsi pop %rbp pop %rax pop %r9 pop %r8 pop %r15 pop %r12 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_A', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 0}} {'OP': 'STOR', 'dst': {'same': True, 'type': 'addresses_A', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 0}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_RW', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 6}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_A', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 4}} {'OP': 'STOR', 'dst': {'same': True, 'type': 'addresses_A', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 0}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WT', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 10}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_UC', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 9}} {'OP': 'STOR', 'dst': {'same': True, 'type': 'addresses_A', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 0}} [Faulty Load] {'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_A', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 0}} <gen_prepare_buffer> {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_normal_ht', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 2}} {'OP': 'REPM', 'src': {'same': False, 'congruent': 1, 'type': 'addresses_UC_ht'}, 'dst': {'same': False, 'congruent': 10, 'type': 'addresses_normal_ht'}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_A_ht', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 7}} {'OP': 'REPM', 'src': {'same': False, 'congruent': 0, 'type': 'addresses_WC_ht'}, 'dst': {'same': False, 'congruent': 3, 'type': 'addresses_WC_ht'}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WC_ht', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 9}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WT_ht', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 7}} {'OP': 'STOR', 'dst': {'same': True, 'type': 'addresses_UC_ht', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 4}} {'OP': 'REPM', 'src': {'same': False, 'congruent': 5, 'type': 'addresses_WC_ht'}, 'dst': {'same': False, 'congruent': 2, 'type': 'addresses_WC_ht'}} {'OP': 'REPM', 'src': {'same': False, 'congruent': 7, 'type': 'addresses_normal_ht'}, 'dst': {'same': False, 'congruent': 10, 'type': 'addresses_UC_ht'}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WC_ht', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 2}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_UC_ht', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 3}} {'58': 21829} 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 */
; =============================================================== ; Dec 2013 ; =============================================================== ; ; char *ultoa(unsigned long num, char *buf, int radix) ; ; Write number to ascii buffer in radix indicated and zero ; terminate. Does not skip initial whitespace. ; ; =============================================================== INCLUDE "config_private.inc" SECTION code_clib SECTION code_stdlib PUBLIC asm_ultoa PUBLIC asm0_ultoa, asm1_ultoa EXTERN error_zc, l_valid_base, error_einval_zc, l0_divu_32_32x8, l_num2char asm_ultoa: ; enter : dehl = unsigned long num ; ix = char *buf ; bc = int radix ; ; exit : hl = address of terminating 0 in buf ; carry reset no errors ; ; error : (*) if buf == 0 ; carry set, hl = 0 ; ; (*) if radix is invalid ; carry set, hl = 0, errno=EINVAL ; ; uses : af, bc, de, hl, bc', de', hl' IFDEF __Z180 push ix ex (sp),hl ld a,h or l pop hl jp z, error_zc ELSE ld a,ixh ; check for NULL buf or ixl jp z, error_zc ENDIF asm0_ultoa: ; bypasses NULL check of buf call l_valid_base ; radix in [2,36]? jp nc, error_einval_zc ; there is special code for base 2, 8, 10, 16 asm1_ultoa: ; entry for ltoa() IF __CLIB_OPT_NUM2TXT & $40 cp 10 jr z, decimal ENDIF IF __CLIB_OPT_NUM2TXT & $80 cp 16 jr z, hex ENDIF IF __CLIB_OPT_NUM2TXT & $20 cp 8 jr z, octal ENDIF IF __CLIB_OPT_NUM2TXT & $10 cp 2 jr z, binary ENDIF ; use generic radix method ; generate digits onto stack in reverse order ; max stack depth is 66 bytes for base 2 xor a push af ; end of digits marked by carry reset compute_lp: ; ix = char *buf ; dehl = number ; bc = radix push bc ; save radix call l0_divu_32_32x8 ; dehl = num/radix, a = num%radix pop bc ; bc = radix call l_num2char scf push af ; digit onto stack ld a,d ; keep going until number is 0 or e or h or l jr nz, compute_lp ; write digits to string ; ix = char * ; stack = list of digits push ix pop hl write_lp: pop af ld (hl),a inc hl jr c, write_lp ; last write above was NUL and carry is reset dec hl ret IF __CLIB_OPT_NUM2TXT & $40 decimal: EXTERN l_ultoa push ix pop bc call l_ultoa ENDIF IF __CLIB_OPT_NUM2TXT & $f0 terminate: xor a ld (de),a ex de,hl ret ENDIF IF __CLIB_OPT_NUM2TXT & $80 hex: EXTERN l_ultoh push ix pop bc call l_ultoh jr terminate ENDIF IF __CLIB_OPT_NUM2TXT & $20 octal: EXTERN l_ultoo push ix pop bc call l_ultoo jr terminate ENDIF IF __CLIB_OPT_NUM2TXT & $10 binary: EXTERN l_ultob push ix pop bc call l_ultob jr terminate ENDIF
; updates the types of a party mon (pointed to in hl) to the ones of the mon specified in wd11e SetPartyMonTypes: call GetPredefRegisters ld bc, wPartyMon1Type - wPartyMon1 ; $5 add hl, bc ld a, [wd11e] ld [wd0b5], a push hl call GetMonHeader pop hl ld a, [wMonHType1] ld [hli], a ld a, [wMonHType2] ld [hl], a ret
; A344565: Triangle read by rows, for 0 <= k <= n: T(n, k) = binomial(n, k) * binomial(binomial(n + 3, 2), 2). ; Submitted by Christian Krause ; 3,15,15,45,90,45,105,315,315,105,210,840,1260,840,210,378,1890,3780,3780,1890,378,630,3780,9450,12600,9450,3780,630,990,6930,20790,34650,34650,20790,6930,990,1485,11880,41580,83160,103950,83160,41580,11880,1485 lpb $0 add $2,1 sub $0,$2 lpe mov $1,$2 bin $1,$0 add $2,4 bin $2,4 mul $1,$2 mov $0,$1 mul $0,3
#include <tinyxml2.h> #include <sys/stat.h> #include <sys/types.h> #include <dirent.h> #include <list> #include <algorithm> #include <unistd.h> #include <map> #include <unordered_map> #include <vector> #include <string> #include <cstring> #include <ctime> #include "world.h" #include "channel.h" #include "player.h" #include "socket.h" #include "command.h" #include "component.h" #include "componentMeta.hpp" #include "ComponentFactory.h" #include "utils.h" #include "zone.h" #include "log.h" #include "option.h" #include "optionManager.h" #include "objectManager.h" #include "serializer.h" #include "event.h" #include "delayedEvent.h" #include "eventManager.h" #include "calloutManager.h" #include "com_gen.h" World* World::_ptr; World* World::GetPtr() { if (!World::_ptr) { World::_ptr = new World(); } return World::_ptr; } World::World() { _running = true; _chanid=1; _server = nullptr; _motd = nullptr; _banner = nullptr; _updates = 0; _totalUpdateTime = 0; _totalSleepTime = 0; _commands = 0; _commandElapsed = 0; //events events.RegisterEvent("LivingPulse"); events.RegisterEvent("WorldPulse"); events.RegisterEvent("PlayerConnect"); events.RegisterEvent("PlayerDisconnect"); events.RegisterEvent("PlayerCreated"); events.RegisterEvent("PlayerDeleted"); events.RegisterEvent("Shutdown"); events.RegisterEvent("Copyover"); events.RegisterEvent("ObjectLoaded"); events.RegisterEvent("ObjectDestroyed"); } World::~World() { if (_motd) { delete [] _motd; } if (_banner) { delete [] _banner; } for (auto cit: _channels) { delete cit.second; } for (auto cit: _state) { delete cit.second; } for (Zone* zone: _zones) { delete zone; } delete _server; } void World::InitializeServer() { _server=new Server(); } void World::Shutdown() { _pmanager.Shutdown(); SaveState(); events.CallEvent("Shutdown", NULL, static_cast<void*>(this)); _running = false; } void World::Copyover(Player* mobile) { std::list<Player*>* _users; int ruptime = (int)GetRealUptime(); FILE* copyover = NULL; char buff[16]; copyover=fopen(COPYOVER_FILE,"wb"); if (copyover==NULL) { mobile->Message(MSG_ERROR,"couldn't open the copyover file.\nCopyover will not continue."); return; } fprintf(copyover, "%d\n", ruptime); sockaddr_in* addr=NULL; //itterate through the players and write info to their copyover file: _users = _pmanager.GetPlayers(); for (auto person: *_users) { if (person->GetSocket()->GetConnectionType() != CON_Game) { person->Write("We're sorry, but we are currently rebooting; please come back again soon.\n"); person->GetSocket()->Kill(); continue; } addr=person->GetSocket()->GetAddr(); person->Save(); fprintf(copyover,"%d %s %hu %lu %s\n", person->GetSocket()->GetControl(), person->GetName().c_str(), addr->sin_port,(long int)addr->sin_addr.s_addr, person->GetSocket()->GetHost().c_str()); person->Write("Copyover initiated by "+mobile->GetName()+".\n"); } fprintf(copyover,"-1\n"); fclose(copyover); events.CallEvent("Copyover", NULL, static_cast<void*>(this)); snprintf(buff,16,"%d",_server->GetListener()); Update(); SaveState(); execl(BIN_FILE,BIN_FILE,"-c",buff,(char*)NULL); mobile->Write("Copyover failed!\n"); } Server* World::GetServer() const { return _server; } OlcManager* World::GetOlcManager() { return &_olcs; } ComponentFactory* World::GetComponentFactory() { return &_cfactory; } PlayerManager& World::GetPlayerManager() { return _pmanager; } OptionManager* World::GetOptionManager() { return &_options; } void World::GetChannelNames(std::list <std::string>* out) { for (auto it: _channels) { out->push_back(it.second->GetName()); } } bool World::ChannelExists(Channel* chan) { for (auto it: _channels) { if (it.second == chan) { return true; } } return false; } bool World::AddChannel(Channel* chan,bool command) { OptionMeta* opt = nullptr; if (!ChannelExists(chan)) { _channels[_chanid]=chan; opt = new OptionMeta(); opt->SetName(chan->GetName()); opt->SetHelp("Toggles the channel."); opt->SetToggle(true); opt->SetSection(OptionSection::Channel); opt->SetAccess(chan->GetAccess()); if (chan->GetName() == "newbie") { opt->SetValue(Variant(1)); } else { opt->SetValue(Variant(0)); } _options.AddOption(opt); if (command) { CMDChan* com = new CMDChan(); com->SetName(chan->GetName()); com->SetAccess(chan->GetAccess()); com->SetSubcmd(_chanid); if (chan->GetAlias() != "") { com->AddAlias(chan->GetAlias()); } commands.AddCommand(com); } _chanid++; return true; } return false; } Channel* World::FindChannel(int id) { if (!_channels.count(id)) { return NULL; } return _channels[id]; } Channel* World::FindChannel(const std::string &name) { //This method is a bit slower because we have to iterate through the mapping ourselves. for (auto it: _channels) { if ((it.second)->GetName()==name) { return (it.second); } } return NULL; } bool World::InitializeFiles() { struct stat fs; //holds file stats //load our banner: //retrieve size of file so we can create the buffer: if(stat(LOGIN_FILE, &fs)) { WriteLog(SeverityLevel::Fatal, "Could not stat login file."); return false; } _banner=new char[fs.st_size+1]; _banner[fs.st_size] = '\0'; //open and load the banner: FILE* banner_fd=fopen(LOGIN_FILE,"r"); if (!banner_fd) { WriteLog(SeverityLevel::Fatal, "Could not fopen banner file."); delete []_banner; _banner = NULL; return false; } if (fread(_banner,1, static_cast<size_t>(fs.st_size), banner_fd) != static_cast<size_t>(fs.st_size)) { WriteLog("SeverityLevel::Fatal, Error loading banner."); delete []_banner; _banner = NULL; fclose(banner_fd); return false; } fclose(banner_fd); //load our motd: //retrieve size of file so we can create the buffer: if (stat(MOTD_FILE, &fs)) { WriteLog(SeverityLevel::Fatal, "Could not stat MOTD file."); delete []_banner; _banner = NULL; return false; } _motd=new char[fs.st_size+1]; _motd[fs.st_size] = '\0'; FILE* motd_fd=fopen(MOTD_FILE,"r"); if (!motd_fd) { WriteLog(SeverityLevel::Fatal, "Could not fopen MOTD."); delete [] _banner; delete [] _motd; _motd = _banner = NULL; return false; } if (fread(_motd,1,static_cast<size_t>(fs.st_size), motd_fd) != static_cast<size_t>(fs.st_size)) { WriteLog(SeverityLevel::Fatal, "Error loading MOTD."); delete [] _motd; _banner = NULL; fclose(motd_fd); return false; } fclose(motd_fd); WriteLog("Files loaded successfully"); return true; } const char* World::GetBanner() const { return _banner; } const char* World::GetMotd() const { return _motd; } void World::UpdateZones() { for (auto zone: _zones) { zone->Update(); } } void World::Update() { timeval start, end; gettimeofday(&start, NULL); //checks for incoming connections or commands _server->PollSockets(); //flushes the output buffers of all sockets. _server->FlushSockets(); //update living objects: _pmanager.Update(); UpdateZones(); _objectManager.Update(); CalloutManager* callouts = CalloutManager::GetInstance(); callouts->Update(); _updates ++; gettimeofday(&end, NULL); _totalUpdateTime += ((end.tv_sec - start.tv_sec) * 1000000); _totalUpdateTime += (end.tv_usec - start.tv_usec); //sleep so that we don't kill our cpu _totalSleepTime += _server->Sleep(PULSES_PER_SECOND); } bool World::RegisterComponent(IComponentMeta* meta) { return _cfactory.RegisterComponent(meta->GetName(), meta); } Component* World::CreateComponent(const std::string &name) { return _cfactory.Create(name); } time_t World::GetRealUptime() const { return _ruptime; } void World::SetRealUptime(time_t tm) { _ruptime=tm; } time_t World::GetCopyoverUptime() const { return _cuptime; } void World::SetCopyoverUptime(time_t tm) { _cuptime=tm; } bool World::AddProperty(const std::string &name,void* ptr) { if (!_properties.count(name)) { _properties[name]=ptr; return true; } return false; } void* World::GetProperty(const std::string &name) { if (_properties.count(name)) { return _properties[name]; } return NULL; } bool World::RemoveProperty(const std::string &name) { if (_properties.count(name)) { _properties.erase(name); return true; } return false; } void World::ParseArguments(const std::string& args, int start, std::vector<std::string>& params) { int i = start; const char* line = args.c_str(); int len = strlen(line); // parse arguments for (; i < len; i++) { if (line[i] == ' ') continue; // is it a quoated argument if ((line[i] == '\'') || (line[i] == '"')) { char match = line[i]; i++; int arg_start = i; // loop until we reach the closing character for (; i < len; i++) { if (line[i] == match) { break; } } //push the quoted string. params.push_back(args.substr(arg_start, i - arg_start)); } //no quoted string, get the entire argument until we see a space. if (isprint(line[i])) { int arg_start = i; for (; i < len; i++) { if ((line[i] == ' ')) { break; } } params.push_back(args.substr(arg_start, i - arg_start)); } } } bool World::DoCommand(Player* mobile,std::string args) { timeval start, end; //measure execution time std::vector<Command*>* cptr = commands.GetPtr(); std::string cmd = ""; // the parsed command name const char *line = args.c_str(); // the command line int len = strlen(line); // get length of string int i = 0; // counter std::vector<std::string> params; // the parameters being passed to the command //std::list<Command*>* externals; //external commands //start measuring elapsed time. gettimeofday(&start, NULL); //handle special commands. if (args[0] == '\"' || args[0] == '\'') { cmd="say"; i = 1; //the arguments are just after the quote. } else if(args[0] == ':') { cmd="emote"; i=1; } else { // parse command name for (i = 0; i < len; i++) { if (line[i] == ' ') break; } // copy the command cmd = args.substr(0, i); } // are there any arguments to parse? if (i != len) { ParseArguments(args, i, params); } //locate and execute the command: //check the built-in commands first, then contents, then location. for (auto it: *cptr) { if ((it->GetName() == cmd)||(it->HasAlias(cmd, true))) { if (!mobile->HasAccess(it->GetAccess())) { return false; } //execute command. /*todo: add script command handling here.*/ it->Execute(it->GetName(), mobile, params, it->GetSubcmd()); gettimeofday(&end, NULL); _commandElapsed += ((end.tv_sec - start.tv_sec) * 1000000); _commandElapsed += (end.tv_usec-start.tv_usec); _commands ++; return true; } } //todo: check inventory and room commands here. /* location = (Room*)mobile->GetLocation(); if (location) { cptr = location->commands.GetPtr(); for (auto it: *cptr) { if ((it->GetName() == cmd)||(it->HasAlias(cmd, true))) { if (!mobile->HasAccess(it->GetAccess())) { return false; } it->Execute(it->GetName(), mobile, params, it->GetSubcmd()); gettimeofday(&end, NULL); _commandElapsed += ((end.tv_sec - start.tv_sec) * 1000000); _commandElapsed += (float)(end.tv_usec-start.tv_usec); _commands ++; return true; } } } */ return false; } bool World::AddZone(Zone* zone) { if (_zones.size()) { for (auto it:_zones) { if (it == zone) { return false; } } } _zones.push_back(zone); return true; } bool World::RemoveZone(Zone* zone) { std::vector<Zone*>::iterator it, itEnd; itEnd = _zones.end(); for (it = _zones.begin(); it != itEnd; ++it) { if (*it ==zone) { _zones.erase(it); return true; } } return false; } Zone* World::GetZone(const std::string &name) { for (auto it: _zones) { if (name==it->GetName()) { return it; } } return NULL; } bool World::GetZones(std::vector<Zone*> *zones) { std::copy(_zones.begin(), _zones.end(), std::back_inserter(*zones)); return true; } bool World::IsRunning() const { return _running; } void World::SetRunning(bool running) { _running = running; } bool World::PromptExists(char prompt) { return (_prompts.count(prompt)==0? false:true); } bool World::RegisterPrompt(char c, PROMPTCB callback) { if (PromptExists(c)) { return false; } _prompts[c] = callback; return true; } std::string World::BuildPrompt(const std::string &prompt, Player* mobile) { std::string::const_iterator it, itEnd; std::string ret; itEnd = prompt.end(); for (it = prompt.begin(); it != itEnd; ++it) { if ((*it) == '%' && ++it != itEnd) { if (PromptExists((*it))) { ret += (_prompts[(*it)])(mobile); } else { ret += '%'; ret+=(*it); } } else { ret += (*it); } } return ret; } bool World::AddState(const std::string &name, ISerializable* s) { if (StateExists(name)) { return false; } _state[name] = s; return true; } bool World::RemoveState(const std::string &name) { if (!StateExists(name)) { return false; } _state.erase(name); return true; } bool World::StateExists(const std::string &name) { return (_state.count(name)==1?true:false); } bool World::SaveState() { tinyxml2::XMLElement* element = nullptr; for (auto sit: _state) { tinyxml2::XMLDocument doc; doc.InsertEndChild(doc.NewDeclaration()); element = doc.NewElement("state"); element->SetAttribute("name", sit.first.c_str()); sit.second->Serialize(element); doc.InsertEndChild(element); doc.SaveFile((STATE_DIR+sit.first).c_str()); element = nullptr; } return true; } bool World::LoadState() { DIR* statedir = opendir(STATE_DIR); dirent* dir = NULL; //we need to open the directory for reading. if (!statedir) { return false; } while ((dir = readdir(statedir))) { if (dir->d_name[0] == '.') { continue; } tinyxml2::XMLDocument doc; std::string name; if (doc.LoadFile((std::string(STATE_DIR)+dir->d_name).c_str()) != tinyxml2::XML_NO_ERROR) { WriteLog(SeverityLevel::Warning, "Could not load"+std::string(dir->d_name)+" state file."); closedir(statedir); return false; } tinyxml2::XMLElement* root = doc.FirstChildElement("state")->ToElement(); name = root->Attribute("name"); if (!StateExists(name)) { WriteLog(SeverityLevel::Warning, "Could not find a matching registered state for "+name+" in the state register. This state will not be deserialized."); continue; } else { _state[name]->Deserialize(root); } } closedir(statedir); return true; } unsigned long long int World::GetUpdates() const { return _updates; } unsigned long long int World::GetUpdateTime() const { return _totalUpdateTime; } unsigned long long int World::GetSleepTime() const { return _totalSleepTime; } unsigned long long int World::GetCommands() const { return _commands; } unsigned long long int World::GetCommandTime() const { return _commandElapsed; } ObjectManager* World::GetObjectManager() { return &_objectManager; }
############################################################################### # Copyright 2019 Intel Corporation # All Rights Reserved. # # If this software was obtained under the Intel Simplified Software License, # the following terms apply: # # The source code, information and material ("Material") contained herein is # owned by Intel Corporation or its suppliers or licensors, and title to such # Material remains with Intel Corporation or its suppliers or licensors. The # Material contains proprietary information of Intel or its suppliers and # licensors. The Material is protected by worldwide copyright laws and treaty # provisions. No part of the Material may be used, copied, reproduced, # modified, published, uploaded, posted, transmitted, distributed or disclosed # in any way without Intel's prior express written permission. No license under # any patent, copyright or other intellectual property rights in the Material # is granted to or conferred upon you, either expressly, by implication, # inducement, estoppel or otherwise. Any license under such intellectual # property rights must be express and approved by Intel in writing. # # Unless otherwise agreed by Intel in writing, you may not remove or alter this # notice or any other notice embedded in Materials by Intel or Intel's # suppliers or licensors in any way. # # # If this software was obtained under the Apache License, Version 2.0 (the # "License"), the following terms apply: # # You may not use this file except in compliance with the License. You may # obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 # # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # # See the License for the specific language governing permissions and # limitations under the License. ############################################################################### .text .p2align 5, 0x90 .globl _PurgeBlock _PurgeBlock: push %ebp mov %esp, %ebp push %edi movl (8)(%ebp), %edi movl (12)(%ebp), %ecx xor %eax, %eax sub $(4), %ecx jl .Ltest_purgegas_1 .Lpurge4gas_1: movl %eax, (%edi) add $(4), %edi sub $(4), %ecx jge .Lpurge4gas_1 .Ltest_purgegas_1: add $(4), %ecx jz .Lquitgas_1 .Lpurge1gas_1: movb %al, (%edi) add $(1), %edi sub $(1), %ecx jg .Lpurge1gas_1 .Lquitgas_1: pop %edi pop %ebp ret
; A024041: a(n) = 4^n - n^5. ; 1,3,-16,-179,-768,-2101,-3680,-423,32768,203095,948576,4033253,16528384,66737571,267897632,1072982449,4293918720,17178449327,68717587168,274875430845,1099508427776,4398042427003,17592180890784,70368737741321,281474968748032,1125899897076999,4503599615489120,18014398495133077,72057594020717568,288230376131200595,1152921504582546976,4611686018398758753,18446744073675997184,73786976294799071071,295147905179307390432,1180591620717358781549,4722366482869584747520,18889465931478511510827,75557863725914244183968,302231454903657203452345,1208925819614629072306176,4835703278458516582968503,19342813113834066664607584,77371252455336267034186821,309485009821345068559864832,1237940039285380274714596099,4951760157141521099390533920,19807040628566084398156642577,79228162514264337593289146368,316912650057057350373893326095,1267650600228229401496390705376,5070602400912917605986467796253,20282409603651670423946871081984,81129638414606681695788586948571,324518553658426726783155561411232,1298074214633706907132623579020649,5192296858534827628530495778488320,20769187434139310514121984715188327,83076749736557242056487940611164768,332306998946228968225951764355161845 mov $1,4 pow $1,$0 pow $0,5 add $0,1 sub $1,$0 add $1,1 mov $0,$1
.Model Small .Stack 100h .Data msg db 'Hello, World$' .Code main Proc MOV ax, @data MOV ds, ax mov al, 5 mov bl, 10 add bl, al sub bl, 1 ; print result in binary: mov cx, 8 print: mov ah, 2 mov dl, '0' test bl, 10000000b jz zero mov dl, '1' zero: int 21h shl bl, 1 loop print mov dl, 'b' int 21h Exit: MOV AH, 4ch INT 21h main ENDP END main
dnl Intel Pentium 4 mpn_mod_34lsub1 -- remainder modulo 2^24-1. dnl Copyright 2000, 2001, 2002, 2003 Free Software Foundation, Inc. dnl dnl This file is part of the GNU MP Library. dnl dnl The GNU MP Library is free software; you can redistribute it and/or dnl modify it under the terms of the GNU Lesser General Public License as dnl published by the Free Software Foundation; either version 2.1 of the dnl License, or (at your option) any later version. dnl dnl The GNU MP Library is distributed in the hope that it will be useful, dnl but WITHOUT ANY WARRANTY; without even the implied warranty of dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU dnl Lesser General Public License for more details. dnl dnl You should have received a copy of the GNU Lesser General Public dnl License along with the GNU MP Library; see the file COPYING.LIB. If dnl not, write to the Free Software Foundation, Inc., 51 Franklin Street, dnl Fifth Floor, Boston, MA 02110-1301, USA. include(`../config.m4') C Pentium4: 1.0 cycles/limb C mp_limb_t mpn_mod_34lsub1 (mp_srcptr src, mp_size_t size) C C Enhancements: C C There might a couple of cycles to save by using plain integer code for C more small sizes. 2 limbs measures about 20 cycles, but 3 limbs jumps to C about 46 (inclusive of some function call overheads). defframe(PARAM_SIZE, 8) defframe(PARAM_SRC, 4) dnl re-use parameter space define(SAVE_EBX, `PARAM_SRC') define(SAVE_ESI, `PARAM_SIZE') TEXT ALIGN(16) PROLOGUE(mpn_mod_34lsub1) deflit(`FRAME',0) movl PARAM_SIZE, %ecx movl PARAM_SRC, %edx movl (%edx), %eax subl $2, %ecx ja L(three_or_more) jne L(one) movl 4(%edx), %edx movl %eax, %ecx shrl $24, %eax C src[0] high andl $0x00FFFFFF, %ecx C src[0] low addl %ecx, %eax movl %edx, %ecx shll $8, %edx shrl $16, %ecx C src[1] low addl %ecx, %eax andl $0x00FFFF00, %edx C src[1] high addl %edx, %eax L(one): ret L(three_or_more): pxor %mm0, %mm0 pxor %mm1, %mm1 pxor %mm2, %mm2 pcmpeqd %mm7, %mm7 psrlq $32, %mm7 C 0x00000000FFFFFFFF, low 32 bits pcmpeqd %mm6, %mm6 psrlq $40, %mm6 C 0x0000000000FFFFFF, low 24 bits L(top): C eax C ebx C ecx counter, size-2 to 0, -1 or -2 C edx src, incrementing C C mm0 sum 0mod3 C mm1 sum 1mod3 C mm2 sum 2mod3 C mm3 C mm4 C mm5 C mm6 0x0000000000FFFFFF C mm7 0x00000000FFFFFFFF movd (%edx), %mm3 paddq %mm3, %mm0 movd 4(%edx), %mm3 paddq %mm3, %mm1 movd 8(%edx), %mm3 paddq %mm3, %mm2 addl $12, %edx subl $3, %ecx ja L(top) C ecx is -2, -1 or 0 representing 0, 1 or 2 more limbs, respectively addl $1, %ecx js L(combine) C 0 more movd (%edx), %mm3 paddq %mm3, %mm0 jz L(combine) C 1 more movd 4(%edx), %mm3 paddq %mm3, %mm1 L(combine): movq %mm7, %mm3 C low halves pand %mm0, %mm3 movq %mm7, %mm4 pand %mm1, %mm4 movq %mm7, %mm5 pand %mm2, %mm5 psrlq $32, %mm0 C high halves psrlq $32, %mm1 psrlq $32, %mm2 paddq %mm0, %mm4 C fold high halves to give 33 bits each paddq %mm1, %mm5 paddq %mm2, %mm3 psllq $8, %mm4 C combine at respective offsets psllq $16, %mm5 paddq %mm4, %mm3 paddq %mm5, %mm3 C 0x000cxxxxxxxxxxxx, 50 bits pand %mm3, %mm6 C fold at 24 bits psrlq $24, %mm3 paddq %mm6, %mm3 movd %mm3, %eax ASSERT(z, C nothing left in high dword `psrlq $32, %mm3 movd %mm3, %ecx orl %ecx, %ecx') emms ret EPILOGUE()
/* Copyright © 2017 Apple Inc. All rights reserved. * * Use of this source code is governed by a BSD-3-clause license that can * be found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause */ #ifndef __TC_VISUALIZATION_TABLE #define __TC_VISUALIZATION_TABLE #include <string> #include <sstream> namespace turi { class sframe_reader; class unity_sframe; namespace visualization { std::string table_spec(const std::shared_ptr<unity_sframe>& table, const std::string& title, std::string table_id = ""); std::string table_data(const std::shared_ptr<unity_sframe>& table, sframe_reader* reader, size_t start, size_t end); std::string table_accordion(const std::shared_ptr<unity_sframe>& table, const std::string& column_name, size_t row_idx); std::string image_png_data(const flex_image& image, size_t resized_height); } } #endif // __TC_VISUALIZATION_TABLE
#include "foobar2000.h" // {4B897EC8-A2F9-478d-A95E-1A2110A40078} FOOGUIDDECL const GUID hasher_md5::class_guid = { 0x4b897ec8, 0xa2f9, 0x478d, { 0xa9, 0x5e, 0x1a, 0x21, 0x10, 0xa4, 0x0, 0x78 } }; // {74497D81-6158-48ba-9657-386A5520D0FF} FOOGUIDDECL const GUID config_io_callback::class_guid = { 0x74497d81, 0x6158, 0x48ba, { 0x96, 0x57, 0x38, 0x6a, 0x55, 0x20, 0xd0, 0xff } }; // {10BB3EBD-DDF7-4975-A3CC-23084829453E} FOOGUIDDECL const GUID componentversion::class_guid = { 0x10bb3ebd, 0xddf7, 0x4975, { 0xa3, 0xcc, 0x23, 0x8, 0x48, 0x29, 0x45, 0x3e } }; // {7255E8D0-3FCF-4781-B93B-D06CB88DFAFA} FOOGUIDDECL const GUID preferences_page::class_guid = { 0x7255e8d0, 0x3fcf, 0x4781, { 0xb9, 0x3b, 0xd0, 0x6c, 0xb8, 0x8d, 0xfa, 0xfa } }; // {8146A883-F146-401b-BAF6-4FB2E306F2EB} FOOGUIDDECL const GUID preferences_branch::class_guid = { 0x8146a883, 0xf146, 0x401b, { 0xba, 0xf6, 0x4f, 0xb2, 0xe3, 0x6, 0xf2, 0xeb } }; // {90DF5270-65BB-4dba-BAF5-86BE9E59DC20} FOOGUIDDECL const GUID console_receiver::class_guid = { 0x90df5270, 0x65bb, 0x4dba, { 0xba, 0xf5, 0x86, 0xbe, 0x9e, 0x59, 0xdc, 0x20 } }; // {0C36A649-9EA0-4f48-B229-0CB2AA9AB6F4} FOOGUIDDECL const GUID core_version_info::class_guid = { 0xc36a649, 0x9ea0, 0x4f48, { 0xb2, 0x29, 0xc, 0xb2, 0xaa, 0x9a, 0xb6, 0xf4 } }; // {61C4E6E4-C31E-4c89-A759-BF0949DFC528} FOOGUIDDECL const GUID audio_postprocessor::class_guid = { 0x61c4e6e4, 0xc31e, 0x4c89, { 0xa7, 0x59, 0xbf, 0x9, 0x49, 0xdf, 0xc5, 0x28 } }; // {EE65D408-70D6-40f6-940D-D9F537F1BEF1} FOOGUIDDECL const GUID dsp_config_manager::class_guid = { 0xee65d408, 0x70d6, 0x40f6, { 0x94, 0xd, 0xd9, 0xf5, 0x37, 0xf1, 0xbe, 0xf1 } }; // {F8F03D26-C2DA-47ed-8748-1DBACBCEA508} FOOGUIDDECL const GUID dsp_config_callback::class_guid = { 0xf8f03d26, 0xc2da, 0x47ed, { 0x87, 0x48, 0x1d, 0xba, 0xcb, 0xce, 0xa5, 0x8 } }; // {0D048731-8AA8-4704-8AD6-189E24D48C88} FOOGUIDDECL const GUID dsp_entry::class_guid = { 0xd048731, 0x8aa8, 0x4704, { 0x8a, 0xd6, 0x18, 0x9e, 0x24, 0xd4, 0x8c, 0x88 } }; // {2A42AFEA-940B-455b-AEFF-CFDACAF52AFF} FOOGUIDDECL const GUID dsp::class_guid = { 0x2a42afea, 0x940b, 0x455b, { 0xae, 0xff, 0xcf, 0xda, 0xca, 0xf5, 0x2a, 0xff } }; // {113773C4-B387-4b48-8BDF-AB58BC6CE538} FOOGUIDDECL const GUID initquit::class_guid = { 0x113773c4, 0xb387, 0x4b48, { 0x8b, 0xdf, 0xab, 0x58, 0xbc, 0x6c, 0xe5, 0x38 } }; FOOGUIDDECL const GUID metadb_display_field_provider::class_guid = { 0x5923fa2a, 0x504b, 0x4022, { 0xb2, 0x86, 0x0, 0x22, 0x75, 0x38, 0x45, 0x5e } }; // {609D48C8-C6A6-4784-8BBD-FDD32BF0740E} FOOGUIDDECL const GUID metadb::class_guid = { 0x609d48c8, 0xc6a6, 0x4784, { 0x8b, 0xbd, 0xfd, 0xd3, 0x2b, 0xf0, 0x74, 0xe } }; // {D5286BB4-FDED-47ef-A623-4C3FF056DEC1} FOOGUIDDECL const GUID metadb_io_callback::class_guid = { 0xd5286bb4, 0xfded, 0x47ef, { 0xa6, 0x23, 0x4c, 0x3f, 0xf0, 0x56, 0xde, 0xc1 } }; // {1C0802F7-CF24-49ef-B914-8B9866F19779} FOOGUIDDECL const GUID contextmenu_item::class_guid = { 0x1c0802f7, 0xcf24, 0x49ef, { 0xb9, 0x14, 0x8b, 0x98, 0x66, 0xf1, 0x97, 0x79 } }; // {98B00B13-8C0E-49ff-B17C-5E537D3AE4B7} FOOGUIDDECL const GUID visualisation_manager::class_guid = { 0x98b00b13, 0x8c0e, 0x49ff, { 0xb1, 0x7c, 0x5e, 0x53, 0x7d, 0x3a, 0xe4, 0xb7 } }; // {4A4B1DD8-82FF-4071-A6E2-BD043F4C251C} FOOGUIDDECL const GUID visualisation_stream::class_guid = { 0x4a4b1dd8, 0x82ff, 0x4071, { 0xa6, 0xe2, 0xbd, 0x4, 0x3f, 0x4c, 0x25, 0x1c } }; // {015A6C0E-1571-49bd-A367-30B4BD889C34} FOOGUIDDECL const GUID packet_decoder::class_guid = { 0x15a6c0e, 0x1571, 0x49bd, { 0xa3, 0x67, 0x30, 0xb4, 0xbd, 0x88, 0x9c, 0x34 } }; // {D815032D-AFEB-46c6-8AA3-6FD530A4CE67} FOOGUIDDECL const GUID packet_decoder_streamparse::class_guid = { 0xd815032d, 0xafeb, 0x46c6, { 0x8a, 0xa3, 0x6f, 0xd5, 0x30, 0xa4, 0xce, 0x67 } }; // {53006A71-C03C-4c38-822F-9A34A5655095} FOOGUIDDECL const GUID packet_decoder_entry::class_guid = { 0x53006a71, 0xc03c, 0x4c38, { 0x82, 0x2f, 0x9a, 0x34, 0xa5, 0x65, 0x50, 0x95 } }; // {D3BD5F53-A6D6-4346-991F-CF14DFAD2B3A} FOOGUIDDECL const GUID contextmenu_manager::class_guid = { 0xd3bd5f53, 0xa6d6, 0x4346, { 0x99, 0x1f, 0xcf, 0x14, 0xdf, 0xad, 0x2b, 0x3a } }; // {640E006E-2934-4d6c-8327-4FA9F341ECF2} FOOGUIDDECL const GUID input_file_type::class_guid = { 0x640e006e, 0x2934, 0x4d6c, { 0x83, 0x27, 0x4f, 0xa9, 0xf3, 0x41, 0xec, 0xf2 } }; // {8835B30A-36A6-49bc-B96D-D0609B0EF2BA} FOOGUIDDECL const GUID input_file_type_v2::class_guid = { 0x8835b30a, 0x36a6, 0x49bc, { 0xb9, 0x6d, 0xd0, 0x60, 0x9b, 0xe, 0xf2, 0xba } }; // {2DC57FF7-476D-42f5-A05A-60499896134A} FOOGUIDDECL const GUID ui_control::class_guid = { 0x2dc57ff7, 0x476d, 0x42f5, { 0xa0, 0x5a, 0x60, 0x49, 0x98, 0x96, 0x13, 0x4a } }; // {392B88DE-50FC-43b0-9F03-2D79B071CAF6} FOOGUIDDECL const GUID ui_status_text_override::class_guid = { 0x392b88de, 0x50fc, 0x43b0, { 0x9f, 0x3, 0x2d, 0x79, 0xb0, 0x71, 0xca, 0xf6 } }; // {52BD7A17-540C-4a97-B812-72BC84EC4FF5} FOOGUIDDECL const GUID ui_drop_item_callback::class_guid = { 0x52bd7a17, 0x540c, 0x4a97, { 0xb8, 0x12, 0x72, 0xbc, 0x84, 0xec, 0x4f, 0xf5 } }; // {550B3A19-42A4-4c0f-91F2-90550189CBFF} FOOGUIDDECL const GUID commandline_handler::class_guid = { 0x550b3a19, 0x42a4, 0x4c0f, { 0x91, 0xf2, 0x90, 0x55, 0x1, 0x89, 0xcb, 0xff } }; // {C71B99BD-12C5-48fe-A9C0-469F6FEA88BF} FOOGUIDDECL const GUID modeless_dialog_manager::class_guid = { 0xc71b99bd, 0x12c5, 0x48fe, { 0xa9, 0xc0, 0x46, 0x9f, 0x6f, 0xea, 0x88, 0xbf } }; // {78BCBFA1-DFB9-487f-AB16-CD82BF90CCF7} FOOGUIDDECL const GUID play_callback_manager::class_guid = { 0x78bcbfa1, 0xdfb9, 0x487f, { 0xab, 0x16, 0xcd, 0x82, 0xbf, 0x90, 0xcc, 0xf7 } }; // {8E4EED7A-C6B8-49c7-99FE-97E04AAA63A8} FOOGUIDDECL const GUID play_callback_static::class_guid = { 0x8e4eed7a, 0xc6b8, 0x49c7, { 0x99, 0xfe, 0x97, 0xe0, 0x4a, 0xaa, 0x63, 0xa8 } }; // {BF803668-2977-4c71-B9AB-5C77C338C970} FOOGUIDDECL const GUID playback_control::class_guid = { 0xbf803668, 0x2977, 0x4c71, { 0xb9, 0xab, 0x5c, 0x77, 0xc3, 0x38, 0xc9, 0x70 } }; // {242D9341-211A-4637-A69F-F6684B52F9D6} FOOGUIDDECL const GUID playlist_callback_static::class_guid = { 0x242d9341, 0x211a, 0x4637, { 0xa6, 0x9f, 0xf6, 0x68, 0x4b, 0x52, 0xf9, 0xd6 } }; // {95E9F11B-4C99-4d0a-AB9F-367196B10925} FOOGUIDDECL const GUID playlist_callback_single_static::class_guid = { 0x95e9f11b, 0x4c99, 0x4d0a, { 0xab, 0x9f, 0x36, 0x71, 0x96, 0xb1, 0x9, 0x25 } }; // {88D7EDB1-A850-42a4-BBAB-49E955F4B81F} FOOGUIDDECL const GUID playlist_lock::class_guid = { 0x88d7edb1, 0xa850, 0x42a4, { 0xbb, 0xab, 0x49, 0xe9, 0x55, 0xf4, 0xb8, 0x1f } }; // {2FBCE1E5-902E-49e0-B9CF-CE0FBA765348} FOOGUIDDECL const GUID filesystem::class_guid = { 0x2fbce1e5, 0x902e, 0x49e0, { 0xb9, 0xcf, 0xce, 0xf, 0xba, 0x76, 0x53, 0x48 } }; // {9098AF12-61A3-4caa-8AA9-BB95C2EF8346} FOOGUIDDECL const GUID unpacker::class_guid = { 0x9098af12, 0x61a3, 0x4caa, { 0x8a, 0xa9, 0xbb, 0x95, 0xc2, 0xef, 0x83, 0x46 } }; // {EC707440-FA3E-4d12-9876-FC369F04D4A4} FOOGUIDDECL const GUID archive::class_guid = { 0xec707440, 0xfa3e, 0x4d12, { 0x98, 0x76, 0xfc, 0x36, 0x9f, 0x4, 0xd4, 0xa4 } }; // {B2F9FC40-3E55-4b23-A2C9-22BAAD8795B1} FOOGUIDDECL const GUID file::class_guid = { 0xb2f9fc40, 0x3e55, 0x4b23, { 0xa2, 0xc9, 0x22, 0xba, 0xad, 0x87, 0x95, 0xb1 } }; // {6374340F-82D4-4471-A24B-A754B1398285} FOOGUIDDECL const GUID file_dynamicinfo::class_guid = { 0x6374340f, 0x82d4, 0x4471, { 0xa2, 0x4b, 0xa7, 0x54, 0xb1, 0x39, 0x82, 0x85 } }; // {A00CB77D-ED72-4031-806B-4E45AF995241} FOOGUIDDECL const GUID replaygain_manager::class_guid = { 0xa00cb77d, 0xed72, 0x4031, { 0x80, 0x6b, 0x4e, 0x45, 0xaf, 0x99, 0x52, 0x41 } }; // {3FEED4FC-A400-4a30-8E73-F0ECD114D7E8} FOOGUIDDECL const GUID resampler_entry::class_guid = { 0x3feed4fc, 0xa400, 0x4a30, { 0x8e, 0x73, 0xf0, 0xec, 0xd1, 0x14, 0xd7, 0xe8 } }; // {3F7674AB-044C-4796-8801-6C443C244D88} FOOGUIDDECL const GUID titleformat_compiler::class_guid = { 0x3f7674ab, 0x44c, 0x4796, { 0x88, 0x1, 0x6c, 0x44, 0x3c, 0x24, 0x4d, 0x88 } }; // {1ADD4DC4-B278-4a0c-A105-2629F4B312F4} FOOGUIDDECL const GUID user_interface::class_guid = { 0x1add4dc4, 0xb278, 0x4a0c, { 0xa1, 0x5, 0x26, 0x29, 0xf4, 0xb3, 0x12, 0xf4 } }; // {994C0D0E-319E-45f3-92FC-518616E73ADC} FOOGUIDDECL const GUID contextmenu_item::caller_now_playing = { 0x994c0d0e, 0x319e, 0x45f3, { 0x92, 0xfc, 0x51, 0x86, 0x16, 0xe7, 0x3a, 0xdc } }; // {47502BA1-816D-4a3e-ADE5-A7A9860A67DB} FOOGUIDDECL const GUID contextmenu_item::caller_active_playlist_selection = { 0x47502ba1, 0x816d, 0x4a3e, { 0xad, 0xe5, 0xa7, 0xa9, 0x86, 0xa, 0x67, 0xdb } }; // Deprecated. FOOGUIDDECL const GUID contextmenu_item::caller_playlist = caller_active_playlist_selection; // {B3CC1030-EF26-45cf-A84A-7FC169BC9FFB} FOOGUIDDECL const GUID contextmenu_item::caller_active_playlist = { 0xb3cc1030, 0xef26, 0x45cf, { 0xa8, 0x4a, 0x7f, 0xc1, 0x69, 0xbc, 0x9f, 0xfb } }; // {5FDCD5E8-6EB2-4454-9EDA-527522893BED} FOOGUIDDECL const GUID contextmenu_item::caller_playlist_manager = { 0x5fdcd5e8, 0x6eb2, 0x4454, { 0x9e, 0xda, 0x52, 0x75, 0x22, 0x89, 0x3b, 0xed } }; // {00000000-0000-0000-0000-000000000000} FOOGUIDDECL const GUID contextmenu_item::caller_undefined = { 0x00000000, 0x0000, 0x0000, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }; // {FABEE3E9-8901-4df4-A2D7-B9898D86C39B} FOOGUIDDECL const GUID contextmenu_item::caller_keyboard_shortcut_list = { 0xfabee3e9, 0x8901, 0x4df4, { 0xa2, 0xd7, 0xb9, 0x89, 0x8d, 0x86, 0xc3, 0x9b } }; // {FDA07C56-05D0-4b84-9FBD-A8BE556D474D} FOOGUIDDECL const GUID contextmenu_item::caller_media_library_viewer = { 0xfda07c56, 0x5d0, 0x4b84, { 0x9f, 0xbd, 0xa8, 0xbe, 0x55, 0x6d, 0x47, 0x4d } }; // {95DE5842-30F5-4f72-B40C-191663782F80} FOOGUIDDECL const GUID keyboard_shortcut_manager::class_guid = { 0x95de5842, 0x30f5, 0x4f72, { 0xb4, 0xc, 0x19, 0x16, 0x63, 0x78, 0x2f, 0x80 } }; // {CD19C870-DA6A-4b8a-A118-732A8102D07D} FOOGUIDDECL const GUID keyboard_shortcut_manager_v2::class_guid = { 0xcd19c870, 0xda6a, 0x4b8a, { 0xa1, 0x18, 0x73, 0x2a, 0x81, 0x2, 0xd0, 0x7d } }; // {30F95BEB-FDF4-4a75-B597-60CAF93B39C4} FOOGUIDDECL const GUID packet_decoder::owner_MP4 = { 0x30f95beb, 0xfdf4, 0x4a75, { 0xb5, 0x97, 0x60, 0xca, 0xf9, 0x3b, 0x39, 0xc4 } }; // {8F450CB3-A083-4b83-8D85-ADCE5EA6D57F} FOOGUIDDECL const GUID packet_decoder::owner_MP4_ALAC = { 0x8f450cb3, 0xa083, 0x4b83, { 0x8d, 0x85, 0xad, 0xce, 0x5e, 0xa6, 0xd5, 0x7f } }; // {40017871-50A9-48b6-BF60-BD181A227F9B} FOOGUIDDECL const GUID packet_decoder::owner_MP4_AMR = { 0x40017871, 0x50a9, 0x48b6, { 0xbf, 0x60, 0xbd, 0x18, 0x1a, 0x22, 0x7f, 0x9b } }; // {2E729EA0-6BEB-4392-BF24-75C69B60166D} FOOGUIDDECL const GUID packet_decoder::owner_MP4_AMR_WB = { 0x2e729ea0, 0x6beb, 0x4392, { 0xbf, 0x24, 0x75, 0xc6, 0x9b, 0x60, 0x16, 0x6d } }; // {AF5B7CB0-A08E-404a-A3C0-5C5EA1A8A05C} FOOGUIDDECL const GUID packet_decoder::owner_ADTS = { 0xaf5b7cb0, 0xa08e, 0x404a, { 0xa3, 0xc0, 0x5c, 0x5e, 0xa1, 0xa8, 0xa0, 0x5c } }; // {F72D2EAE-835C-4dfb-97C6-624343EFAFB0} FOOGUIDDECL const GUID packet_decoder::owner_ADIF = { 0xf72d2eae, 0x835c, 0x4dfb, { 0x97, 0xc6, 0x62, 0x43, 0x43, 0xef, 0xaf, 0xb0 } }; // {5C2DE804-EAEE-4b8e-8C14-9207A2549BBE} FOOGUIDDECL const GUID packet_decoder::owner_matroska = { 0x5c2de804, 0xeaee, 0x4b8e, { 0x8c, 0x14, 0x92, 0x7, 0xa2, 0x54, 0x9b, 0xbe } }; // {7B741A69-1AC7-440d-A01D-88536DD4DE1C} FOOGUIDDECL const GUID packet_decoder::owner_MP3 = { 0x7b741a69, 0x1ac7, 0x440d, { 0xa0, 0x1d, 0x88, 0x53, 0x6d, 0xd4, 0xde, 0x1c } }; // {17B300A0-3110-4400-A434-C18FBEEABA81} FOOGUIDDECL const GUID packet_decoder::owner_MP2 = { 0x17b300a0, 0x3110, 0x4400, { 0xa4, 0x34, 0xc1, 0x8f, 0xbe, 0xea, 0xba, 0x81 } }; // {1C068E5E-DD65-4639-BF85-78B297C8FFAC} FOOGUIDDECL const GUID packet_decoder::owner_MP1 = { 0x1c068e5e, 0xdd65, 0x4639, { 0xbf, 0x85, 0x78, 0xb2, 0x97, 0xc8, 0xff, 0xac } }; // {BC73F9FC-0107-480e-BF0E-BE58AF7AF328} FOOGUIDDECL const GUID packet_decoder::property_samplerate = { 0xbc73f9fc, 0x107, 0x480e, { 0xbf, 0xe, 0xbe, 0x58, 0xaf, 0x7a, 0xf3, 0x28 } }; // {E5D19AAD-931B-48ac-AA6E-95E2C23BEC37} FOOGUIDDECL const GUID packet_decoder::property_bitspersample = { 0xe5d19aad, 0x931b, 0x48ac, { 0xaa, 0x6e, 0x95, 0xe2, 0xc2, 0x3b, 0xec, 0x37 } }; // {1AFA1145-E774-4c26-91D6-3F5DD61E260E} FOOGUIDDECL const GUID packet_decoder::property_channels = { 0x1afa1145, 0xe774, 0x4c26, { 0x91, 0xd6, 0x3f, 0x5d, 0xd6, 0x1e, 0x26, 0xe } }; // {29C556DA-065A-4d24-8A11-0F9DBC05A817} FOOGUIDDECL const GUID packet_decoder::property_byteorder = { 0x29c556da, 0x65a, 0x4d24, { 0x8a, 0x11, 0xf, 0x9d, 0xbc, 0x5, 0xa8, 0x17 } }; // {0759C32F-E78E-4479-B0C0-B653DFA014D8} FOOGUIDDECL const GUID packet_decoder::property_signed = { 0x759c32f, 0xe78e, 0x4479, { 0xb0, 0xc0, 0xb6, 0x53, 0xdf, 0xa0, 0x14, 0xd8 } }; // {BB31669E-0C30-4c5f-AAF0-20CD49D46058} FOOGUIDDECL const GUID packet_decoder::property_channelmask = { 0xbb31669e, 0xc30, 0x4c5f, { 0xaa, 0xf0, 0x20, 0xcd, 0x49, 0xd4, 0x60, 0x58 } }; // {6F441057-1D18-4a58-9AC4-8F409CDA7DFD} FOOGUIDDECL const GUID standard_commands::guid_context_file_properties = { 0x6f441057, 0x1d18, 0x4a58, { 0x9a, 0xc4, 0x8f, 0x40, 0x9c, 0xda, 0x7d, 0xfd } }; // {EFC1E9C8-EEEF-427a-8F42-E5781605846D} FOOGUIDDECL const GUID standard_commands::guid_context_file_open_directory = { 0xefc1e9c8, 0xeeef, 0x427a, { 0x8f, 0x42, 0xe5, 0x78, 0x16, 0x5, 0x84, 0x6d } }; // {FFE18008-BCA2-4b29-AB88-8816B492C434} FOOGUIDDECL const GUID standard_commands::guid_context_copy_names = { 0xffe18008, 0xbca2, 0x4b29, { 0xab, 0x88, 0x88, 0x16, 0xb4, 0x92, 0xc4, 0x34 } }; // {44B8F02B-5408-4361-8240-18DEC881B95E} FOOGUIDDECL const GUID standard_commands::guid_context_send_to_playlist = { 0x44b8f02b, 0x5408, 0x4361, { 0x82, 0x40, 0x18, 0xde, 0xc8, 0x81, 0xb9, 0x5e } }; // {8C3BA2CB-BC4D-4752-8282-C6F9AED75A78} FOOGUIDDECL const GUID standard_commands::guid_context_reload_info = { 0x8c3ba2cb, 0xbc4d, 0x4752, { 0x82, 0x82, 0xc6, 0xf9, 0xae, 0xd7, 0x5a, 0x78 } }; // {BD045EA4-E5E9-4206-8FF9-12AD9F5DCDE1} FOOGUIDDECL const GUID standard_commands::guid_context_reload_info_if_changed = { 0xbd045ea4, 0xe5e9, 0x4206, { 0x8f, 0xf9, 0x12, 0xad, 0x9f, 0x5d, 0xcd, 0xe1 } }; // {684D9FBB-4383-44a2-9789-7EE1376209C6} FOOGUIDDECL const GUID standard_commands::guid_context_rewrite_info = { 0x684d9fbb, 0x4383, 0x44a2, { 0x97, 0x89, 0x7e, 0xe1, 0x37, 0x62, 0x9, 0xc6 } }; // {860179B7-962F-4340-ACAD-0DDAF060A6B8} FOOGUIDDECL const GUID standard_commands::guid_context_remove_tags = { 0x860179b7, 0x962f, 0x4340, { 0xac, 0xad, 0xd, 0xda, 0xf0, 0x60, 0xa6, 0xb8 } }; // {A7E7ECB7-1943-4907-83B3-60E92353C7FA} FOOGUIDDECL const GUID standard_commands::guid_context_convert_run = { 0xa7e7ecb7, 0x1943, 0x4907, { 0x83, 0xb3, 0x60, 0xe9, 0x23, 0x53, 0xc7, 0xfa } }; // {BED4FB6E-C4F2-40dd-B528-1DE1450DDFE9} FOOGUIDDECL const GUID standard_commands::guid_context_convert_run_withcue = { 0xbed4fb6e, 0xc4f2, 0x40dd, { 0xb5, 0x28, 0x1d, 0xe1, 0x45, 0xd, 0xdf, 0xe9 } }; // {A58AE6EA-A34F-4879-B25C-F31F2CBC4DA9} FOOGUIDDECL const GUID standard_commands::guid_context_convert_run_singlefile = { 0xa58ae6ea, 0xa34f, 0x4879, { 0xb2, 0x5c, 0xf3, 0x1f, 0x2c, 0xbc, 0x4d, 0xa9 } }; // {A8EFA42D-76CB-42bc-8803-70516567B13D} FOOGUIDDECL const GUID standard_commands::guid_context_write_cd = { 0xa8efa42d, 0x76cb, 0x42bc, { 0x88, 0x3, 0x70, 0x51, 0x65, 0x67, 0xb1, 0x3d } }; // {487DAED1-02FB-4336-A813-5E90317AB041} FOOGUIDDECL const GUID standard_commands::guid_context_rg_scan_track = { 0x487daed1, 0x2fb, 0x4336, { 0xa8, 0x13, 0x5e, 0x90, 0x31, 0x7a, 0xb0, 0x41 } }; // {3850F34C-F619-4296-B8A0-26C617B1D16C} FOOGUIDDECL const GUID standard_commands::guid_context_rg_scan_album = { 0x3850f34c, 0xf619, 0x4296, { 0xb8, 0xa0, 0x26, 0xc6, 0x17, 0xb1, 0xd1, 0x6c } }; // {6A2DBA02-260C-436f-8F41-0190A4298266} FOOGUIDDECL const GUID standard_commands::guid_context_rg_scan_album_multi = { 0x6a2dba02, 0x260c, 0x436f, { 0x8f, 0x41, 0x1, 0x90, 0xa4, 0x29, 0x82, 0x66 } }; // {54C82A92-5824-4381-8D1B-79FBB1E2ABB8} FOOGUIDDECL const GUID standard_commands::guid_context_rg_remove = { 0x54c82a92, 0x5824, 0x4381, { 0x8d, 0x1b, 0x79, 0xfb, 0xb1, 0xe2, 0xab, 0xb8 } }; // {69EAA594-13D9-4237-9BD7-11A39FDD1454} FOOGUIDDECL const GUID standard_commands::guid_context_save_playlist = { 0x69eaa594, 0x13d9, 0x4237, { 0x9b, 0xd7, 0x11, 0xa3, 0x9f, 0xdd, 0x14, 0x54 } }; // {2BEB6836-C657-40ef-BB6E-D5B222AB89CE} FOOGUIDDECL const GUID standard_commands::guid_context_masstag_edit = { 0x2beb6836, 0xc657, 0x40ef, { 0xbb, 0x6e, 0xd5, 0xb2, 0x22, 0xab, 0x89, 0xce } }; // {A579FF07-5D0B-48ed-A071-B6FCE4385AA9} FOOGUIDDECL const GUID standard_commands::guid_context_masstag_rename = { 0xa579ff07, 0x5d0b, 0x48ed, { 0xa0, 0x71, 0xb6, 0xfc, 0xe4, 0x38, 0x5a, 0xa9 } }; // {77CFBCD0-98DC-4015-B327-D7142C664806} FOOGUIDDECL const GUID standard_commands::guid_main_always_on_top = { 0x77cfbcd0, 0x98dc, 0x4015, { 0xb3, 0x27, 0xd7, 0x14, 0x2c, 0x66, 0x48, 0x6 } }; // {11213A01-9F36-4e69-A1BB-7A72F418DE3A} FOOGUIDDECL const GUID standard_commands::guid_main_preferences = { 0x11213a01, 0x9f36, 0x4e69, { 0xa1, 0xbb, 0x7a, 0x72, 0xf4, 0x18, 0xde, 0x3a } }; // {EDA23441-5D38-4499-A22C-FE0CE0A987D9} FOOGUIDDECL const GUID standard_commands::guid_main_about = { 0xeda23441, 0x5d38, 0x4499, { 0xa2, 0x2c, 0xfe, 0xc, 0xe0, 0xa9, 0x87, 0xd9 } }; // {6D38C73A-15D8-472c-8E68-6F946B82ECB4} FOOGUIDDECL const GUID standard_commands::guid_main_exit = { 0x6d38c73a, 0x15d8, 0x472c, { 0x8e, 0x68, 0x6f, 0x94, 0x6b, 0x82, 0xec, 0xb4 } }; // {EF9B60FE-CB03-4c40-A8FD-3F1821020B37} FOOGUIDDECL const GUID standard_commands::guid_main_restart = { 0xef9b60fe, 0xcb03, 0x4c40, { 0xa8, 0xfd, 0x3f, 0x18, 0x21, 0x2, 0xb, 0x37 } }; // {90500F09-F16F-415e-A047-AC5045C95FFE} FOOGUIDDECL const GUID standard_commands::guid_main_activate = { 0x90500f09, 0xf16f, 0x415e, { 0xa0, 0x47, 0xac, 0x50, 0x45, 0xc9, 0x5f, 0xfe } }; // {13C17E8D-0D6F-41a4-B24A-59371043E925} FOOGUIDDECL const GUID standard_commands::guid_main_hide = { 0x13c17e8d, 0xd6f, 0x41a4, { 0xb2, 0x4a, 0x59, 0x37, 0x10, 0x43, 0xe9, 0x25 } }; // {D9473FB2-BF11-4be0-972F-0E43F166A118} FOOGUIDDECL const GUID standard_commands::guid_main_activate_or_hide = { 0xd9473fb2, 0xbf11, 0x4be0, { 0x97, 0x2f, 0xe, 0x43, 0xf1, 0x66, 0xa1, 0x18 } }; // {91E349DA-8800-42e5-BC8C-F3A92577AE84} FOOGUIDDECL const GUID standard_commands::guid_main_titleformat_help = { 0x91e349da, 0x8800, 0x42e5, { 0xbc, 0x8c, 0xf3, 0xa9, 0x25, 0x77, 0xae, 0x84 } }; // {FBCFE01C-6C57-4e6a-A9F1-62334640DC91} FOOGUIDDECL const GUID standard_commands::guid_main_playback_follows_cursor= { 0xfbcfe01c, 0x6c57, 0x4e6a, { 0xa9, 0xf1, 0x62, 0x33, 0x46, 0x40, 0xdc, 0x91 } }; // {0E1C730A-1EA9-41cc-9C30-25700ABDD9FA} FOOGUIDDECL const GUID standard_commands::guid_main_cursor_follows_playback= { 0xe1c730a, 0x1ea9, 0x41cc, { 0x9c, 0x30, 0x25, 0x70, 0xa, 0xbd, 0xd9, 0xfa } }; // {E58895A0-A2F0-45b6-8799-1440E4DB7284} FOOGUIDDECL const GUID standard_commands::guid_main_next = { 0xe58895a0, 0xa2f0, 0x45b6, { 0x87, 0x99, 0x14, 0x40, 0xe4, 0xdb, 0x72, 0x84 } }; // {059C4566-4708-4ebf-8139-6A8EA5A9DFC8} FOOGUIDDECL const GUID standard_commands::guid_main_previous = { 0x59c4566, 0x4708, 0x4ebf, { 0x81, 0x39, 0x6a, 0x8e, 0xa5, 0xa9, 0xdf, 0xc8 } }; // {18B1278A-F1BB-4b48-BC3D-6EC9EF80AD19} FOOGUIDDECL const GUID standard_commands::guid_main_next_or_random = { 0x18b1278a, 0xf1bb, 0x4b48, { 0xbc, 0x3d, 0x6e, 0xc9, 0xef, 0x80, 0xad, 0x19 } }; // {42BDA765-30A8-40fa-BFA4-6A4E2F2B2CE9} FOOGUIDDECL const GUID standard_commands::guid_main_random = { 0x42bda765, 0x30a8, 0x40fa, { 0xbf, 0xa4, 0x6a, 0x4e, 0x2f, 0x2b, 0x2c, 0xe9 } }; // {FCEF5262-7FA5-452e-A527-C14E0CB582DE} FOOGUIDDECL const GUID standard_commands::guid_main_pause = { 0xfcef5262, 0x7fa5, 0x452e, { 0xa5, 0x27, 0xc1, 0x4e, 0xc, 0xb5, 0x82, 0xde } }; // {D3F83B15-D4AF-4586-8BD0-4EA415E31FE1} FOOGUIDDECL const GUID standard_commands::guid_main_play = { 0xd3f83b15, 0xd4af, 0x4586, { 0x8b, 0xd0, 0x4e, 0xa4, 0x15, 0xe3, 0x1f, 0xe1 } }; // {8DEBC44E-EDA2-48d4-8696-31FC29D1F383} FOOGUIDDECL const GUID standard_commands::guid_main_play_or_pause = { 0x8debc44e, 0xeda2, 0x48d4, { 0x86, 0x96, 0x31, 0xfc, 0x29, 0xd1, 0xf3, 0x83 } }; // {2DF17F25-80B9-4a43-B21D-620458FDDE1E} FOOGUIDDECL const GUID standard_commands::guid_main_rg_set_album = { 0x2df17f25, 0x80b9, 0x4a43, { 0xb2, 0x1d, 0x62, 0x4, 0x58, 0xfd, 0xde, 0x1e } }; // {C26F1955-5753-4836-887F-84A563DD6DD9} FOOGUIDDECL const GUID standard_commands::guid_main_rg_set_track = { 0xc26f1955, 0x5753, 0x4836, { 0x88, 0x7f, 0x84, 0xa5, 0x63, 0xdd, 0x6d, 0xd9 } }; // {8D2D808E-6AA2-455b-A2F1-CDB019328140} FOOGUIDDECL const GUID standard_commands::guid_main_rg_disable = { 0x8d2d808e, 0x6aa2, 0x455b, { 0xa2, 0xf1, 0xcd, 0xb0, 0x19, 0x32, 0x81, 0x40 } }; // {C3378028-165F-4374-966C-2FA2E0FCD3A8} FOOGUIDDECL const GUID standard_commands::guid_main_stop = { 0xc3378028, 0x165f, 0x4374, { 0x96, 0x6c, 0x2f, 0xa2, 0xe0, 0xfc, 0xd3, 0xa8 } }; // {EE057982-22F9-4862-A986-859E463316FB} FOOGUIDDECL const GUID standard_commands::guid_main_stop_after_current = { 0xee057982, 0x22f9, 0x4862, { 0xa9, 0x86, 0x85, 0x9e, 0x46, 0x33, 0x16, 0xfb } }; // {11DC6526-73C4-44f0-91B1-DE5C2D26B0C7} FOOGUIDDECL const GUID standard_commands::guid_main_volume_down = { 0x11dc6526, 0x73c4, 0x44f0, { 0x91, 0xb1, 0xde, 0x5c, 0x2d, 0x26, 0xb0, 0xc7 } }; // {A313E630-A04A-4ae8-B5B4-0A944AC964FF} FOOGUIDDECL const GUID standard_commands::guid_main_volume_up = { 0xa313e630, 0xa04a, 0x4ae8, { 0xb5, 0xb4, 0xa, 0x94, 0x4a, 0xc9, 0x64, 0xff } }; // {4A36285B-B4AF-46ed-A1AA-6333057F485B} FOOGUIDDECL const GUID standard_commands::guid_main_volume_mute = { 0x4a36285b, 0xb4af, 0x46ed, { 0xa1, 0xaa, 0x63, 0x33, 0x5, 0x7f, 0x48, 0x5b } }; // {2DC43C22-CA09-4ef9-A61E-7A0C1DAAE21E} FOOGUIDDECL const GUID standard_commands::guid_main_add_directory = { 0x2dc43c22, 0xca09, 0x4ef9, { 0xa6, 0x1e, 0x7a, 0xc, 0x1d, 0xaa, 0xe2, 0x1e } }; // {FC89C278-4475-4853-96C9-F7F05E8CC837} FOOGUIDDECL const GUID standard_commands::guid_main_add_files = { 0xfc89c278, 0x4475, 0x4853, { 0x96, 0xc9, 0xf7, 0xf0, 0x5e, 0x8c, 0xc8, 0x37 } }; // {9CA39D38-AC9B-4cca-B0CE-C0F62D188114} FOOGUIDDECL const GUID standard_commands::guid_main_add_location = { 0x9ca39d38, 0xac9b, 0x4cca, { 0xb0, 0xce, 0xc0, 0xf6, 0x2d, 0x18, 0x81, 0x14 } }; // {73D6E69D-0DC9-4d5c-A7EE-FF4BE3896B08} FOOGUIDDECL const GUID standard_commands::guid_main_add_playlist = { 0x73d6e69d, 0xdc9, 0x4d5c, { 0xa7, 0xee, 0xff, 0x4b, 0xe3, 0x89, 0x6b, 0x8 } }; // {55559142-7AEA-4c20-9B72-1D48E970A274} FOOGUIDDECL const GUID standard_commands::guid_main_clear_playlist = { 0x55559142, 0x7aea, 0x4c20, { 0x9b, 0x72, 0x1d, 0x48, 0xe9, 0x70, 0xa2, 0x74 } }; // {BF72488F-36AC-46b3-A36D-193E60C79BC5} FOOGUIDDECL const GUID standard_commands::guid_main_create_playlist = { 0xbf72488f, 0x36ac, 0x46b3, { 0xa3, 0x6d, 0x19, 0x3e, 0x60, 0xc7, 0x9b, 0xc5 } }; // {59E99BEE-42A3-4526-B06D-56C0C49F0BC1} FOOGUIDDECL const GUID standard_commands::guid_main_highlight_playing = { 0x59e99bee, 0x42a3, 0x4526, { 0xb0, 0x6d, 0x56, 0xc0, 0xc4, 0x9f, 0xb, 0xc1 } }; // {D94393D4-9DBB-4e5c-BE8C-BE9CA80E214D} FOOGUIDDECL const GUID standard_commands::guid_main_load_playlist = { 0xd94393d4, 0x9dbb, 0x4e5c, { 0xbe, 0x8c, 0xbe, 0x9c, 0xa8, 0xe, 0x21, 0x4d } }; // {EE1308C5-EBD2-48f1-959D-2627069C2E0F} FOOGUIDDECL const GUID standard_commands::guid_main_next_playlist = { 0xee1308c5, 0xebd2, 0x48f1, { 0x95, 0x9d, 0x26, 0x27, 0x6, 0x9c, 0x2e, 0xf } }; // {486ECDA3-7BA2-49e9-BB44-4DB9DF9320C7} FOOGUIDDECL const GUID standard_commands::guid_main_previous_playlist = { 0x486ecda3, 0x7ba2, 0x49e9, { 0xbb, 0x44, 0x4d, 0xb9, 0xdf, 0x93, 0x20, 0xc7 } }; // {69C778AA-B836-40a0-89CD-7A2E50C102CB} FOOGUIDDECL const GUID standard_commands::guid_main_open = { 0x69c778aa, 0xb836, 0x40a0, { 0x89, 0xcd, 0x7a, 0x2e, 0x50, 0xc1, 0x2, 0xcb } }; // {EB7FB5A4-5904-4d2c-B66C-D882A3B15277} FOOGUIDDECL const GUID standard_commands::guid_main_remove_playlist = { 0xeb7fb5a4, 0x5904, 0x4d2c, { 0xb6, 0x6c, 0xd8, 0x82, 0xa3, 0xb1, 0x52, 0x77 } }; // {C297BADB-8098-45a9-A5E8-B53A0D780CE3} FOOGUIDDECL const GUID standard_commands::guid_main_remove_dead_entries = { 0xc297badb, 0x8098, 0x45a9, { 0xa5, 0xe8, 0xb5, 0x3a, 0xd, 0x78, 0xc, 0xe3 } }; // {D08C2921-7750-4979-98F9-3A513A31FF96} FOOGUIDDECL const GUID standard_commands::guid_main_remove_duplicates = { 0xd08c2921, 0x7750, 0x4979, { 0x98, 0xf9, 0x3a, 0x51, 0x3a, 0x31, 0xff, 0x96 } }; // {D3A25E47-BA98-4e6b-95AD-A7502919EB75} FOOGUIDDECL const GUID standard_commands::guid_main_rename_playlist = { 0xd3a25e47, 0xba98, 0x4e6b, { 0x95, 0xad, 0xa7, 0x50, 0x29, 0x19, 0xeb, 0x75 } }; // {0FDCFC65-9B39-445a-AA88-4D245F217480} FOOGUIDDECL const GUID standard_commands::guid_main_save_all_playlists = { 0xfdcfc65, 0x9b39, 0x445a, { 0xaa, 0x88, 0x4d, 0x24, 0x5f, 0x21, 0x74, 0x80 } }; // {370B720B-4CF7-465b-908C-2D2ADD027900} FOOGUIDDECL const GUID standard_commands::guid_main_save_playlist = { 0x370b720b, 0x4cf7, 0x465b, { 0x90, 0x8c, 0x2d, 0x2a, 0xdd, 0x2, 0x79, 0x0 } }; // {A6CFC2A8-56B3-4d12-88E7-0237961AC47E} FOOGUIDDECL const GUID standard_commands::guid_main_playlist_search = { 0xa6cfc2a8, 0x56b3, 0x4d12, { 0x88, 0xe7, 0x2, 0x37, 0x96, 0x1a, 0xc4, 0x7e } }; // {383D4E8D-7E30-4fb8-B5DD-8C975D89E58E} FOOGUIDDECL const GUID standard_commands::guid_main_playlist_sel_crop = { 0x383d4e8d, 0x7e30, 0x4fb8, { 0xb5, 0xdd, 0x8c, 0x97, 0x5d, 0x89, 0xe5, 0x8e } }; // {E0EEA319-E282-4e6c-8B82-4DFD42A1D4ED} FOOGUIDDECL const GUID standard_commands::guid_main_playlist_sel_remove = { 0xe0eea319, 0xe282, 0x4e6c, { 0x8b, 0x82, 0x4d, 0xfd, 0x42, 0xa1, 0xd4, 0xed } }; // {F0845920-7F6D-40ac-B2EB-3D00C2C8260B} FOOGUIDDECL const GUID standard_commands::guid_main_playlist_sel_invert = { 0xf0845920, 0x7f6d, 0x40ac, { 0xb2, 0xeb, 0x3d, 0x0, 0xc2, 0xc8, 0x26, 0xb } }; // {29910B33-79E9-40da-992B-5A4AA4281F78} FOOGUIDDECL const GUID standard_commands::guid_main_playlist_undo = { 0x29910b33, 0x79e9, 0x40da, { 0x99, 0x2b, 0x5a, 0x4a, 0xa4, 0x28, 0x1f, 0x78 } }; // {7A9D9450-A8BF-4a88-B44F-DCD83A49DD7A} FOOGUIDDECL const GUID standard_commands::guid_main_playlist_redo = { 0x7a9d9450, 0xa8bf, 0x4a88, { 0xb4, 0x4f, 0xdc, 0xd8, 0x3a, 0x49, 0xdd, 0x7a } }; // {02D89A8A-5F7D-41c3-A215-6731D8621036} FOOGUIDDECL const GUID standard_commands::guid_main_show_console = { 0x2d89a8a, 0x5f7d, 0x41c3, { 0xa2, 0x15, 0x67, 0x31, 0xd8, 0x62, 0x10, 0x36 } }; // {E6970E91-33BE-4288-AC01-4B02F07B5D38} FOOGUIDDECL const GUID standard_commands::guid_main_play_cd = { 0xe6970e91, 0x33be, 0x4288, { 0xac, 0x1, 0x4b, 0x2, 0xf0, 0x7b, 0x5d, 0x38 } }; // {1073AB1D-38ED-4957-8B06-38BC878C1F40} FOOGUIDDECL const GUID standard_commands::guid_main_restart_resetconfig = { 0x1073ab1d, 0x38ed, 0x4957, { 0x8b, 0x6, 0x38, 0xbc, 0x87, 0x8c, 0x1f, 0x40 } }; // {FDC8A1C2-93EF-4415-8C20-60B6517F0B5F} FOOGUIDDECL const GUID standard_commands::guid_main_record = { 0xfdc8a1c2, 0x93ef, 0x4415, { 0x8c, 0x20, 0x60, 0xb6, 0x51, 0x7f, 0xb, 0x5f } }; // {45EB37D2-3CD9-4f0a-9B20-8EAE649D7A9F} FOOGUIDDECL const GUID standard_commands::guid_main_playlist_moveback = { 0x45eb37d2, 0x3cd9, 0x4f0a, { 0x9b, 0x20, 0x8e, 0xae, 0x64, 0x9d, 0x7a, 0x9f } }; // {02298938-596A-41f7-A398-19766A06E6EB} FOOGUIDDECL const GUID standard_commands::guid_main_playlist_moveforward = { 0x2298938, 0x596a, 0x41f7, { 0xa3, 0x98, 0x19, 0x76, 0x6a, 0x6, 0xe6, 0xeb } }; // {E910ACC6-A81A-4a20-9F62-19015BCD1013} FOOGUIDDECL const GUID standard_commands::guid_main_saveconfig = { 0xe910acc6, 0xa81a, 0x4a20, { 0x9f, 0x62, 0x19, 0x1, 0x5b, 0xcd, 0x10, 0x13 } }; // {03445FCC-71D9-4e01-AE02-A557D30B4CD7} FOOGUIDDECL const GUID standard_commands::guid_main_playlist_select_all = { 0x3445fcc, 0x71d9, 0x4e01, { 0xae, 0x2, 0xa5, 0x57, 0xd3, 0xb, 0x4c, 0xd7 } }; // {919FA72B-1DF9-49ee-A8F1-D8BA1DEAA7E9} FOOGUIDDECL const GUID standard_commands::guid_main_show_now_playing = { 0x919fa72b, 0x1df9, 0x49ee, { 0xa8, 0xf1, 0xd8, 0xba, 0x1d, 0xea, 0xa7, 0xe9 } }; // {D8D51855-D79D-49b8-97A8-065785FA2426} FOOGUIDDECL const GUID playlist_manager::class_guid= { 0xd8d51855, 0xd79d, 0x49b8, { 0x97, 0xa8, 0x6, 0x57, 0x85, 0xfa, 0x24, 0x26 } }; // {C303A0F1-8E88-4539-87E5-9E455B7D548C} FOOGUIDDECL const GUID genrand_service::class_guid= { 0xc303a0f1, 0x8e88, 0x4539, { 0x87, 0xe5, 0x9e, 0x45, 0x5b, 0x7d, 0x54, 0x8c } }; // {EB8FA333-F365-46ad-8621-345671567BAA} FOOGUIDDECL const GUID playlist_incoming_item_filter::class_guid= { 0xeb8fa333, 0xf365, 0x46ad, { 0x86, 0x21, 0x34, 0x56, 0x71, 0x56, 0x7b, 0xaa } }; // {FEBD85B5-C12D-45b5-B55D-0D3F432B0C6B} FOOGUIDDECL const GUID library_manager::class_guid= { 0xfebd85b5, 0xc12d, 0x45b5, { 0xb5, 0x5d, 0xd, 0x3f, 0x43, 0x2b, 0xc, 0x6b } }; // {9A08B50F-E8C6-40c0-88C3-7530CF2C3115} FOOGUIDDECL const GUID library_callback::class_guid= { 0x9a08b50f, 0xe8c6, 0x40c0, { 0x88, 0xc3, 0x75, 0x30, 0xcf, 0x2c, 0x31, 0x15 } }; // {D5CAC75A-3023-4dce-8B0D-B502BD056A7C} FOOGUIDDECL const GUID popup_message::class_guid= { 0xd5cac75a, 0x3023, 0x4dce, { 0x8b, 0xd, 0xb5, 0x2, 0xbd, 0x5, 0x6a, 0x7c } }; // {13F9CB11-0EAE-4417-AF0C-8894DEB65E8B} FOOGUIDDECL const GUID app_close_blocker::class_guid= { 0x13f9cb11, 0xeae, 0x4417, { 0xaf, 0xc, 0x88, 0x94, 0xde, 0xb6, 0x5e, 0x8b } }; // {5570A2D2-8F9E-48a7-AFAC-DAC00A3C1636} FOOGUIDDECL const GUID file_operation_callback::class_guid= { 0x5570a2d2, 0x8f9e, 0x48a7, { 0xaf, 0xac, 0xda, 0xc0, 0xa, 0x3c, 0x16, 0x36 } }; // {340099D1-7BEC-4ac6-92A4-77FF01507891} FOOGUIDDECL const GUID config_object::class_guid= { 0x340099d1, 0x7bec, 0x4ac6, { 0x92, 0xa4, 0x77, 0xff, 0x1, 0x50, 0x78, 0x91 } }; // {1BA04122-DE9A-4a90-9FC3-A6A7EC8F9626} FOOGUIDDECL const GUID config_object_notify_manager::class_guid= { 0x1ba04122, 0xde9a, 0x4a90, { 0x9f, 0xc3, 0xa6, 0xa7, 0xec, 0x8f, 0x96, 0x26 } }; // {AD5138E6-CF8F-4482-89B2-B2EAAEDF3B4C} FOOGUIDDECL const GUID standard_config_objects::bool_show_keyboard_shortcuts_in_menus= { 0xad5138e6, 0xcf8f, 0x4482, { 0x89, 0xb2, 0xb2, 0xea, 0xae, 0xdf, 0x3b, 0x4c } }; // {E91F618C-5741-470f-A178-21272C3ECA90} FOOGUIDDECL const GUID standard_config_objects::bool_remember_window_positions= { 0xe91f618c, 0x5741, 0x470f, { 0xa1, 0x78, 0x21, 0x27, 0x2c, 0x3e, 0xca, 0x90 } }; // {5497FAA9-690C-4fb4-8BC0-678CEBCBBDC4} FOOGUIDDECL const GUID standard_config_objects::bool_playback_follows_cursor= { 0x5497faa9, 0x690c, 0x4fb4, { 0x8b, 0xc0, 0x67, 0x8c, 0xeb, 0xcb, 0xbd, 0xc4 } }; // {58D3E2D6-DD6D-48dd-98EB-4EABF0ACFEB8} FOOGUIDDECL const GUID standard_config_objects::bool_cursor_follows_playback= { 0x58d3e2d6, 0xdd6d, 0x48dd, { 0x98, 0xeb, 0x4e, 0xab, 0xf0, 0xac, 0xfe, 0xb8 } }; // {2DF7194D-86FC-4312-98DA-E820DA3E710D} FOOGUIDDECL const GUID standard_config_objects::bool_ui_always_on_top= { 0x2df7194d, 0x86fc, 0x4312, { 0x98, 0xda, 0xe8, 0x20, 0xda, 0x3e, 0x71, 0xd } }; // {B572C86F-4206-40a0-8476-C7B27E74DB2D} FOOGUIDDECL const GUID standard_config_objects::bool_playlist_stop_after_current= { 0xb572c86f, 0x4206, 0x40a0, { 0x84, 0x76, 0xc7, 0xb2, 0x7e, 0x74, 0xdb, 0x2d } }; // {FFDFDA96-699C-4617-A977-22DC2F039B00} FOOGUIDDECL const GUID standard_config_objects::string_gui_last_directory_media= { 0xffdfda96, 0x699c, 0x4617, { 0xa9, 0x77, 0x22, 0xdc, 0x2f, 0x3, 0x9b, 0x0 } }; // {915D3B21-81CB-4b96-9762-1C90FBF371DF} FOOGUIDDECL const GUID standard_config_objects::string_gui_last_directory_playlists= { 0x915d3b21, 0x81cb, 0x4b96, { 0x97, 0x62, 0x1c, 0x90, 0xfb, 0xf3, 0x71, 0xdf } }; // {338B6871-EB1F-4384-BF83-6BFACE5B66BC} FOOGUIDDECL const GUID standard_config_objects::int32_dynamic_bitrate_display_rate= { 0x338b6871, 0xeb1f, 0x4384, { 0xbf, 0x83, 0x6b, 0xfa, 0xce, 0x5b, 0x66, 0xbc } }; // {3E35D949-DCDB-44e1-8013-9D1633C09756} FOOGUIDDECL const GUID config_object_notify::class_guid= { 0x3e35d949, 0xdcdb, 0x44e1, { 0x80, 0x13, 0x9d, 0x16, 0x33, 0xc0, 0x97, 0x56 } }; // {4AC9408E-4D9C-4135-ACB5-2CAB35376FC9} FOOGUIDDECL const GUID titleformat_object::class_guid= { 0x4ac9408e, 0x4d9c, 0x4135, { 0xac, 0xb5, 0x2c, 0xab, 0x35, 0x37, 0x6f, 0xc9 } }; // {25B0D20D-9BA3-4a7b-8D0E-89FAF75F916F} FOOGUIDDECL const GUID tag_processor_id3v2::class_guid= { 0x25b0d20d, 0x9ba3, 0x4a7b, { 0x8d, 0xe, 0x89, 0xfa, 0xf7, 0x5f, 0x91, 0x6f } }; // {AD537D40-499D-4c29-81D4-C0FA496DD58C} FOOGUIDDECL const GUID tag_processor_trailing::class_guid= { 0xad537d40, 0x499d, 0x4c29, { 0x81, 0xd4, 0xc0, 0xfa, 0x49, 0x6d, 0xd5, 0x8c } }; // {160885C6-3AA3-4f60-8718-1240615E6414} FOOGUIDDECL const GUID metadb_handle::class_guid= { 0x160885c6, 0x3aa3, 0x4f60, { 0x87, 0x18, 0x12, 0x40, 0x61, 0x5e, 0x64, 0x14 } }; // {9DBC262F-4795-4292-824B-23A655011A3E} FOOGUIDDECL const GUID threaded_process::class_guid= { 0x9dbc262f, 0x4795, 0x4292, { 0x82, 0x4b, 0x23, 0xa6, 0x55, 0x1, 0x1a, 0x3e } }; // {7B69141B-4271-4070-8998-10CD39249C12} FOOGUIDDECL const GUID threaded_process_callback::class_guid= { 0x7b69141b, 0x4271, 0x4070, { 0x89, 0x98, 0x10, 0xcd, 0x39, 0x24, 0x9c, 0x12 } }; // {64D18B80-5E97-40e4-A30C-A4640C60BCE5} FOOGUIDDECL const GUID metadb_io::class_guid= { 0x64d18b80, 0x5e97, 0x40e4, { 0xa3, 0xc, 0xa4, 0x64, 0xc, 0x60, 0xbc, 0xe5 } }; FOOGUIDDECL const GUID preferences_page::guid_tagging = { 0x563107c3, 0xfc7d, 0x4022, { 0xa8, 0x72, 0xa8, 0x2a, 0x2b, 0x3f, 0xd5, 0x25 } }; // {B9218D23-F73D-4b61-A1D9-BFD420CDAC77} FOOGUIDDECL const GUID preferences_page::guid_root= { 0xb9218d23, 0xf73d, 0x4b61, { 0xa1, 0xd9, 0xbf, 0xd4, 0x20, 0xcd, 0xac, 0x77 } }; // {2F0E2232-A5FD-43e4-B6AB-3839B8D1A707} FOOGUIDDECL const GUID preferences_page::guid_hidden= { 0x2f0e2232, 0xa5fd, 0x43e4, { 0xb6, 0xab, 0x38, 0x39, 0xb8, 0xd1, 0xa7, 0x7 } }; // {627C0767-0793-44f8-8087-BE4934311282} FOOGUIDDECL const GUID preferences_page::guid_tools= { 0x627c0767, 0x793, 0x44f8, { 0x80, 0x87, 0xbe, 0x49, 0x34, 0x31, 0x12, 0x82 } }; // {6AAA67B6-732F-4967-899A-18C5F8C70017} FOOGUIDDECL const GUID preferences_page::guid_display= { 0x6aaa67b6, 0x732f, 0x4967, { 0x89, 0x9a, 0x18, 0xc5, 0xf8, 0xc7, 0x0, 0x17 } }; // {67508677-CFCC-4a1c-921C-49B39CC5B986} FOOGUIDDECL const GUID preferences_page::guid_playback= { 0x67508677, 0xcfcc, 0x4a1c, { 0x92, 0x1c, 0x49, 0xb3, 0x9c, 0xc5, 0xb9, 0x86 } }; // {494326C8-88FF-4265-B2B2-E6470BEE13B3} FOOGUIDDECL const GUID preferences_page::guid_visualisations= { 0x494326c8, 0x88ff, 0x4265, { 0xb2, 0xb2, 0xe6, 0x47, 0xb, 0xee, 0x13, 0xb3 } }; // {FC01B529-4BD7-47cd-BAF7-2FB632F0DBB6} FOOGUIDDECL const GUID preferences_page::guid_input= { 0xfc01b529, 0x4bd7, 0x47cd, { 0xba, 0xf7, 0x2f, 0xb6, 0x32, 0xf0, 0xdb, 0xb6 } }; // {2E8E9647-4174-41b2-9EC4-910BE128082E} FOOGUIDDECL const GUID preferences_page::guid_core= { 0x2e8e9647, 0x4174, 0x41b2, { 0x9e, 0xc4, 0x91, 0xb, 0xe1, 0x28, 0x8, 0x2e } }; // {7D0334E5-ADD7-4ff5-9DB8-A618B4824028} FOOGUIDDECL const GUID preferences_page::guid_tag_writing= { 0x7d0334e5, 0xadd7, 0x4ff5, { 0x9d, 0xb8, 0xa6, 0x18, 0xb4, 0x82, 0x40, 0x28 } }; // {2D269FA9-6F78-4cec-9F1F-0A176EFCE77A} FOOGUIDDECL const GUID preferences_page::guid_media_library= { 0x2d269fa9, 0x6f78, 0x4cec, { 0x9f, 0x1f, 0xa, 0x17, 0x6e, 0xfc, 0xe7, 0x7a } }; // {B8C5CEEA-A5F4-4278-AA2D-798E4403001F} FOOGUIDDECL const GUID library_viewer::class_guid= { 0xb8c5ceea, 0xa5f4, 0x4278, { 0xaa, 0x2d, 0x79, 0x8e, 0x44, 0x3, 0x0, 0x1f } }; // {5CD49B5D-D604-4c07-A8FA-FFD8512AFD2B} FOOGUIDDECL const GUID message_loop::class_guid= { 0x5cd49b5d, 0xd604, 0x4c07, { 0xa8, 0xfa, 0xff, 0xd8, 0x51, 0x2a, 0xfd, 0x2b } }; // {3F489088-6179-434e-A9DB-3A14A1B081AC} FOOGUIDDECL const GUID chapterizer::class_guid= { 0x3f489088, 0x6179, 0x434e, { 0xa9, 0xdb, 0x3a, 0x14, 0xa1, 0xb0, 0x81, 0xac } }; // {7EB442CD-FAD7-4a26-AD7E-16F6FC89207B} FOOGUIDDECL const GUID input_decoder::class_guid = { 0x7eb442cd, 0xfad7, 0x4a26, { 0xad, 0x7e, 0x16, 0xf6, 0xfc, 0x89, 0x20, 0x7b } }; // {8E9BB1D4-A52B-4df6-A929-1AAE4075388A} FOOGUIDDECL const GUID input_info_reader::class_guid = { 0x8e9bb1d4, 0xa52b, 0x4df6, { 0xa9, 0x29, 0x1a, 0xae, 0x40, 0x75, 0x38, 0x8a } }; // {FE40FF66-64C9-4234-B639-028DC8060CF7} FOOGUIDDECL const GUID input_info_writer::class_guid = { 0xfe40ff66, 0x64c9, 0x4234, { 0xb6, 0x39, 0x2, 0x8d, 0xc8, 0x6, 0xc, 0xf7 } }; // {436547FC-C4EF-4322-B59E-E696A25FAB2C} FOOGUIDDECL const GUID input_entry::class_guid = { 0x436547fc, 0xc4ef, 0x4322, { 0xb5, 0x9e, 0xe6, 0x96, 0xa2, 0x5f, 0xab, 0x2c } }; // {3296219B-EBA5-4c32-A193-C9BB174801DA} FOOGUIDDECL const GUID link_resolver::class_guid = { 0x3296219b, 0xeba5, 0x4c32, { 0xa1, 0x93, 0xc9, 0xbb, 0x17, 0x48, 0x1, 0xda } }; // {A49E087E-D064-4b2e-A08D-11264F691FFE} FOOGUIDDECL const GUID playback_queue_callback::class_guid = { 0xa49e087e, 0xd064, 0x4b2e, { 0xa0, 0x8d, 0x11, 0x26, 0x4f, 0x69, 0x1f, 0xfe } }; // {1131D64B-04CB-43ee-95EB-24D18B753248} FOOGUIDDECL const GUID main_thread_callback_manager::class_guid = { 0x1131d64b, 0x4cb, 0x43ee, { 0x95, 0xeb, 0x24, 0xd1, 0x8b, 0x75, 0x32, 0x48 } }; // {87D2C583-7AFB-4e58-B21E-FBD3E6E8F5E7} FOOGUIDDECL const GUID main_thread_callback::class_guid = { 0x87d2c583, 0x7afb, 0x4e58, { 0xb2, 0x1e, 0xfb, 0xd3, 0xe6, 0xe8, 0xf5, 0xe7 } }; // {21656AB9-0255-4f8c-8FB9-1A7748BCE93A} FOOGUIDDECL const GUID mainmenu_group::class_guid = { 0x21656ab9, 0x255, 0x4f8c, { 0x8f, 0xb9, 0x1a, 0x77, 0x48, 0xbc, 0xe9, 0x3a } }; // {2E673A2E-A4EE-419c-94C8-9C838660414C} FOOGUIDDECL const GUID mainmenu_group_popup::class_guid = { 0x2e673a2e, 0xa4ee, 0x419c, { 0x94, 0xc8, 0x9c, 0x83, 0x86, 0x60, 0x41, 0x4c } }; // {35077B8C-6E70-47ba-B9DD-D51500E12F2E} FOOGUIDDECL const GUID mainmenu_commands::class_guid = { 0x35077b8c, 0x6e70, 0x47ba, { 0xb9, 0xdd, 0xd5, 0x15, 0x0, 0xe1, 0x2f, 0x2e } }; // {350B3EA8-6B3E-4346-B6D2-799E98EFC920} FOOGUIDDECL const GUID mainmenu_manager::class_guid = { 0x350b3ea8, 0x6b3e, 0x4346, { 0xb6, 0xd2, 0x79, 0x9e, 0x98, 0xef, 0xc9, 0x20 } }; // {8F487F1F-419F-47a7-8ECF-EC44AF4449A3} FOOGUIDDECL const GUID mainmenu_groups::file = { 0x8f487f1f, 0x419f, 0x47a7, { 0x8e, 0xcf, 0xec, 0x44, 0xaf, 0x44, 0x49, 0xa3 } }; // {F8BE5604-165F-4bb9-B6A9-15E55E0E0D3A} FOOGUIDDECL const GUID mainmenu_groups::view = { 0xf8be5604, 0x165f, 0x4bb9, { 0xb6, 0xa9, 0x15, 0xe5, 0x5e, 0xe, 0xd, 0x3a } }; // {8CDA6B10-0613-4cfd-8730-3B9CBF4C6A39} FOOGUIDDECL const GUID mainmenu_groups::edit = { 0x8cda6b10, 0x613, 0x4cfd, { 0x87, 0x30, 0x3b, 0x9c, 0xbf, 0x4c, 0x6a, 0x39 } }; // {D8A4FC46-5E3D-47aa-97B7-947988228246} FOOGUIDDECL const GUID mainmenu_groups::edit_part1 = { 0xd8a4fc46, 0x5e3d, 0x47aa, { 0x97, 0xb7, 0x94, 0x79, 0x88, 0x22, 0x82, 0x46 } }; // {007682CE-2A99-4b70-8F63-DE765D1C5555} FOOGUIDDECL const GUID mainmenu_groups::edit_part2 = { 0x7682ce, 0x2a99, 0x4b70, { 0x8f, 0x63, 0xde, 0x76, 0x5d, 0x1c, 0x55, 0x55 } }; // {1F572090-D620-4940-85EC-0EFE499FAC03} FOOGUIDDECL const GUID mainmenu_groups::edit_part3 = { 0x1f572090, 0xd620, 0x4940, { 0x85, 0xec, 0xe, 0xfe, 0x49, 0x9f, 0xac, 0x3 } }; // {65FA047A-1599-4b9c-B53D-C3FEB716339D} FOOGUIDDECL const GUID mainmenu_groups::edit_part2_selection = { 0x65fa047a, 0x1599, 0x4b9c, { 0xb5, 0x3d, 0xc3, 0xfe, 0xb7, 0x16, 0x33, 0x9d } }; // {5B8AEF2C-6E1A-420d-B488-3E3A00E39E28} FOOGUIDDECL const GUID mainmenu_groups::edit_part2_sort = { 0x5b8aef2c, 0x6e1a, 0x420d, { 0xb4, 0x88, 0x3e, 0x3a, 0x0, 0xe3, 0x9e, 0x28 } }; // {EE9D6F72-7BC7-4a60-8C28-B96DED252BD3} FOOGUIDDECL const GUID mainmenu_groups::edit_part2_selection_sort = { 0xee9d6f72, 0x7bc7, 0x4a60, { 0x8c, 0x28, 0xb9, 0x6d, 0xed, 0x25, 0x2b, 0xd3 } }; // {53FA5B8A-FCBC-4296-B968-45BAE6888845} FOOGUIDDECL const GUID mainmenu_groups::playback = { 0x53fa5b8a, 0xfcbc, 0x4296, { 0xb9, 0x68, 0x45, 0xba, 0xe6, 0x88, 0x88, 0x45 } }; // {15D22753-9D30-4929-AA14-5124016F7E68} FOOGUIDDECL const GUID mainmenu_groups::library = { 0x15d22753, 0x9d30, 0x4929, { 0xaa, 0x14, 0x51, 0x24, 0x1, 0x6f, 0x7e, 0x68 } }; // {25DC3DB7-996A-4f48-AF53-712032EFA04F} FOOGUIDDECL const GUID mainmenu_groups::help = { 0x25dc3db7, 0x996a, 0x4f48, { 0xaf, 0x53, 0x71, 0x20, 0x32, 0xef, 0xa0, 0x4f } }; // {8EED252D-0A0F-4fc9-9D81-8CF7209A8BF2} FOOGUIDDECL const GUID mainmenu_groups::file_open = { 0x8eed252d, 0xa0f, 0x4fc9, { 0x9d, 0x81, 0x8c, 0xf7, 0x20, 0x9a, 0x8b, 0xf2 } }; // {9E650B8E-C3F3-4495-AF15-6B656060C3B9} FOOGUIDDECL const GUID mainmenu_groups::file_add = { 0x9e650b8e, 0xc3f3, 0x4495, { 0xaf, 0x15, 0x6b, 0x65, 0x60, 0x60, 0xc3, 0xb9 } }; // {9995FAE6-B1C4-457f-A747-5BD120930210} FOOGUIDDECL const GUID mainmenu_groups::file_playlist = { 0x9995fae6, 0xb1c4, 0x457f, { 0xa7, 0x47, 0x5b, 0xd1, 0x20, 0x93, 0x2, 0x10 } }; // {8A324F18-6173-42ec-A640-5E296AD446B3} FOOGUIDDECL const GUID mainmenu_groups::file_etc = { 0x8a324f18, 0x6173, 0x42ec, { 0xa6, 0x40, 0x5e, 0x29, 0x6a, 0xd4, 0x46, 0xb3 } }; // {12F5E247-5A81-4734-8119-8F9BC114FE74} FOOGUIDDECL const GUID mainmenu_groups::playback_controls = { 0x12f5e247, 0x5a81, 0x4734, { 0x81, 0x19, 0x8f, 0x9b, 0xc1, 0x14, 0xfe, 0x74 } }; // {1169B3EB-81B5-4199-8929-7D3EAFD4809F} FOOGUIDDECL const GUID mainmenu_groups::playback_etc = { 0x1169b3eb, 0x81b5, 0x4199, { 0x89, 0x29, 0x7d, 0x3e, 0xaf, 0xd4, 0x80, 0x9f } }; // {29272FEC-21C7-4b00-A9A7-01A8CE675EBF} FOOGUIDDECL const GUID mainmenu_groups::view_visualisations = { 0x29272fec, 0x21c7, 0x4b00, { 0xa9, 0xa7, 0x1, 0xa8, 0xce, 0x67, 0x5e, 0xbf } }; // {2DA055D4-0257-40b2-8281-7967866B485C} FOOGUIDDECL const GUID mainmenu_groups::file_etc_preferences = { 0x2da055d4, 0x257, 0x40b2, { 0x82, 0x81, 0x79, 0x67, 0x86, 0x6b, 0x48, 0x5c } }; // {517BFAE8-A148-4cb2-8CCE-1AD2179FB910} FOOGUIDDECL const GUID mainmenu_groups::file_etc_exit = { 0x517bfae8, 0xa148, 0x4cb2, { 0x8c, 0xce, 0x1a, 0xd2, 0x17, 0x9f, 0xb9, 0x10 } }; // {61190F78-3B3A-4fda-A431-2CF7DA1C96CE} FOOGUIDDECL const GUID mainmenu_groups::view_alwaysontop = { 0x61190f78, 0x3b3a, 0x4fda, { 0xa4, 0x31, 0x2c, 0xf7, 0xda, 0x1c, 0x96, 0xce } }; // {E55F8D65-AE51-47bf-99F9-BB113421CB19} FOOGUIDDECL const GUID mainmenu_groups::help_about = { 0xe55f8d65, 0xae51, 0x47bf, { 0x99, 0xf9, 0xbb, 0x11, 0x34, 0x21, 0xcb, 0x19 } }; // {696DF823-B7AE-4b73-95C8-C1E9A9410726} FOOGUIDDECL const GUID mainmenu_groups::library_refresh= { 0x696df823, 0xb7ae, 0x4b73, { 0x95, 0xc8, 0xc1, 0xe9, 0xa9, 0x41, 0x7, 0x26 } }; // {004BF6ED-2F88-464f-BDC1-278F6E610C2F} FOOGUIDDECL const GUID standard_commands::guid_seek_ahead_1s = { 0x4bf6ed, 0x2f88, 0x464f, { 0xbd, 0xc1, 0x27, 0x8f, 0x6e, 0x61, 0xc, 0x2f } }; // {5B56D124-2ECA-4b0f-9895-2A533B31D29E} FOOGUIDDECL const GUID standard_commands::guid_seek_ahead_5s = { 0x5b56d124, 0x2eca, 0x4b0f, { 0x98, 0x95, 0x2a, 0x53, 0x3b, 0x31, 0xd2, 0x9e } }; // {B582E3CA-D86D-4568-8380-68BC9C93ED0E} FOOGUIDDECL const GUID standard_commands::guid_seek_ahead_10s = { 0xb582e3ca, 0xd86d, 0x4568, { 0x83, 0x80, 0x68, 0xbc, 0x9c, 0x93, 0xed, 0xe } }; // {DE6B96B7-3074-4da9-A260-988E31CEE0F9} FOOGUIDDECL const GUID standard_commands::guid_seek_ahead_30s = { 0xde6b96b7, 0x3074, 0x4da9, { 0xa2, 0x60, 0x98, 0x8e, 0x31, 0xce, 0xe0, 0xf9 } }; // {FEED4AD7-13D2-4846-8833-D91B5F8B4E94} FOOGUIDDECL const GUID standard_commands::guid_seek_ahead_1min = { 0xfeed4ad7, 0x13d2, 0x4846, { 0x88, 0x33, 0xd9, 0x1b, 0x5f, 0x8b, 0x4e, 0x94 } }; // {ECCF4904-03CF-429a-9D99-7A87FA62FD10} FOOGUIDDECL const GUID standard_commands::guid_seek_ahead_2min = { 0xeccf4904, 0x3cf, 0x429a, { 0x9d, 0x99, 0x7a, 0x87, 0xfa, 0x62, 0xfd, 0x10 } }; // {5F0F0AF7-F519-41e6-A8DB-04DF1390E69D} FOOGUIDDECL const GUID standard_commands::guid_seek_ahead_5min = { 0x5f0f0af7, 0xf519, 0x41e6, { 0xa8, 0xdb, 0x4, 0xdf, 0x13, 0x90, 0xe6, 0x9d } }; // {9ABA4292-1B8F-42ac-93AC-34B2A74C6320} FOOGUIDDECL const GUID standard_commands::guid_seek_ahead_10min = { 0x9aba4292, 0x1b8f, 0x42ac, { 0x93, 0xac, 0x34, 0xb2, 0xa7, 0x4c, 0x63, 0x20 } }; // {2F89AB1C-5646-4997-8E3F-92BEE0322A41} FOOGUIDDECL const GUID standard_commands::guid_seek_back_1s = { 0x2f89ab1c, 0x5646, 0x4997, { 0x8e, 0x3f, 0x92, 0xbe, 0xe0, 0x32, 0x2a, 0x41 } }; // {0CE84538-2E21-4482-BFE1-BCEC471467CC} FOOGUIDDECL const GUID standard_commands::guid_seek_back_5s = { 0xce84538, 0x2e21, 0x4482, { 0xbf, 0xe1, 0xbc, 0xec, 0x47, 0x14, 0x67, 0xcc } }; // {9F504218-AF5D-41a8-BCE3-26313FAE65EE} FOOGUIDDECL const GUID standard_commands::guid_seek_back_10s = { 0x9f504218, 0xaf5d, 0x41a8, { 0xbc, 0xe3, 0x26, 0x31, 0x3f, 0xae, 0x65, 0xee } }; // {98239B89-F66E-4160-B650-D9B068C59E63} FOOGUIDDECL const GUID standard_commands::guid_seek_back_30s = { 0x98239b89, 0xf66e, 0x4160, { 0xb6, 0x50, 0xd9, 0xb0, 0x68, 0xc5, 0x9e, 0x63 } }; // {6633226B-9AA9-4810-AFDA-185A281D9FE2} FOOGUIDDECL const GUID standard_commands::guid_seek_back_1min = { 0x6633226b, 0x9aa9, 0x4810, { 0xaf, 0xda, 0x18, 0x5a, 0x28, 0x1d, 0x9f, 0xe2 } }; // {E2F8B8BB-C539-44f3-A300-13185DE52227} FOOGUIDDECL const GUID standard_commands::guid_seek_back_2min = { 0xe2f8b8bb, 0xc539, 0x44f3, { 0xa3, 0x0, 0x13, 0x18, 0x5d, 0xe5, 0x22, 0x27 } }; // {7B41A130-01D2-4a1b-9CAD-6314633C61C4} FOOGUIDDECL const GUID standard_commands::guid_seek_back_5min = { 0x7b41a130, 0x1d2, 0x4a1b, { 0x9c, 0xad, 0x63, 0x14, 0x63, 0x3c, 0x61, 0xc4 } }; // {0B012852-BAF9-4f6b-B947-FAB89AE76B79} FOOGUIDDECL const GUID standard_commands::guid_seek_back_10min = { 0xb012852, 0xbaf9, 0x4f6b, { 0xb9, 0x47, 0xfa, 0xb8, 0x9a, 0xe7, 0x6b, 0x79 } }; // {97215C5E-7228-4237-B52C-A2B5504EF726} FOOGUIDDECL const GUID playback_statistics_collector::class_guid = { 0x97215c5e, 0x7228, 0x4237, { 0xb5, 0x2c, 0xa2, 0xb5, 0x50, 0x4e, 0xf7, 0x26 } }; // {9FB1DA49-AF6F-4fd2-9C73-48A8A109003B} FOOGUIDDECL const GUID dsp_v2::class_guid = { 0x9fb1da49, 0xaf6f, 0x4fd2, { 0x9c, 0x73, 0x48, 0xa8, 0xa1, 0x9, 0x0, 0x3b } }; // {9EC5D45E-10F5-46a7-9546-F3ACEC68B149} FOOGUIDDECL const GUID dsp_entry_v2::class_guid = { 0x9ec5d45e, 0x10f5, 0x46a7, { 0x95, 0x46, 0xf3, 0xac, 0xec, 0x68, 0xb1, 0x49 } }; FOOGUIDDECL const GUID advconfig_entry::guid_root = { 0x34949f34, 0xe655, 0x4f09, { 0xba, 0x50, 0xfa, 0xeb, 0x4d, 0x9b, 0x77, 0x69 } }; FOOGUIDDECL const GUID advconfig_entry::class_guid = { 0x7e84602e, 0xdc49, 0x4047, { 0xaa, 0xee, 0x63, 0x71, 0x8b, 0xbc, 0x5a, 0x1f } }; FOOGUIDDECL const GUID advconfig_branch::class_guid = { 0x6a60b472, 0x91ac, 0x4681, { 0x9d, 0xc2, 0x76, 0xc9, 0x94, 0x0, 0x5b, 0x63 } }; FOOGUIDDECL const GUID advconfig_entry_checkbox::class_guid = { 0x5243aba4, 0x2a3d, 0x4627, { 0x88, 0xef, 0xce, 0xe3, 0x76, 0x1c, 0x7, 0x9c } }; FOOGUIDDECL const GUID advconfig_entry::guid_branch_tagging = { 0xe8fe273f, 0xdd00, 0x476e, { 0xa7, 0x90, 0xe5, 0x9d, 0xf6, 0xb8, 0xf8, 0xd4 } }; FOOGUIDDECL const GUID advconfig_entry::guid_branch_decoding = { 0x904c272b, 0x2317, 0x4c3c, { 0xb2, 0xff, 0xc5, 0xa0, 0x12, 0x5e, 0x2c, 0xc2 } }; FOOGUIDDECL const GUID advconfig_entry_string::class_guid = { 0x185d582d, 0xfbd8, 0x4db3, { 0xbe, 0x23, 0x47, 0xaa, 0xc6, 0x75, 0xfc, 0x11 } }; FOOGUIDDECL const GUID advconfig_entry::guid_branch_tools = { 0x35365484, 0xcc58, 0x4926, { 0x97, 0xe1, 0x5e, 0x63, 0xf3, 0xab, 0xb9, 0xe2 } }; FOOGUIDDECL const GUID advconfig_entry::guid_branch_playback = { 0xc48d430d, 0x112, 0x4922, { 0x97, 0x23, 0x28, 0x38, 0xc7, 0xd9, 0x7d, 0xd7 } }; FOOGUIDDECL const GUID advconfig_entry::guid_branch_display = { 0x6c4bc1c8, 0xbaf4, 0x40c3, { 0x9d, 0xb1, 0x9, 0x50, 0x7f, 0xc, 0xc, 0xb9 } }; FOOGUIDDECL const GUID playback_control_v2::class_guid = { 0x1eb67bda, 0x1345, 0x49ae, { 0x8e, 0x89, 0x50, 0x5, 0xd9, 0x1, 0x62, 0x89 } }; FOOGUIDDECL const GUID preferences_page_v2::class_guid = { 0xce4ebc9e, 0xab20, 0x46f9, { 0x92, 0x5f, 0x88, 0x3b, 0x8, 0x4f, 0x5, 0x69 } }; FOOGUIDDECL const GUID preferences_branch_v2::class_guid = { 0x167ebeb9, 0x8334, 0x4b21, { 0xaf, 0x58, 0xa7, 0x40, 0xa5, 0xd5, 0xb6, 0x66 } }; FOOGUIDDECL const GUID advconfig_entry_enum::class_guid = { 0xb1451540, 0x98ec, 0x4d36, { 0x9f, 0x19, 0xe3, 0x10, 0xfb, 0xa7, 0xab, 0x5a } }; FOOGUIDDECL const GUID info_lookup_handler::class_guid = { 0x4fcfdab7, 0x55b5, 0x47d6, { 0xb1, 0x9d, 0xa4, 0xdc, 0x9f, 0xd7, 0x69, 0x4c } }; FOOGUIDDECL const GUID completion_notify::class_guid = { 0xdf26d586, 0xf7ec, 0x40c3, { 0x9f, 0xe8, 0x2e, 0xa0, 0x72, 0x5d, 0x76, 0xc0 } }; FOOGUIDDECL const GUID metadb_io_v2::class_guid = { 0x265c4ece, 0xffb2, 0x4299, { 0x91, 0xb5, 0x6c, 0xa6, 0x60, 0x3d, 0xa1, 0x53 } }; FOOGUIDDECL const GUID file_info_filter::class_guid = { 0x45d0b800, 0xde83, 0x4a77, { 0xad, 0x34, 0x3f, 0x84, 0x2d, 0x40, 0xe7, 0x95 } }; FOOGUIDDECL const GUID metadb_hint_list::class_guid = { 0x719dc072, 0x8d4d, 0x4aa6, { 0xa6, 0xf3, 0x90, 0x73, 0x7, 0xe5, 0xbc, 0xee } }; FOOGUIDDECL const GUID playlist_incoming_item_filter_v2::class_guid = { 0xf335802b, 0xa522, 0x434d, { 0xbe, 0x89, 0xe8, 0x6d, 0x59, 0x56, 0x16, 0x48 } }; FOOGUIDDECL const GUID process_locations_notify::class_guid = { 0x7d7eddac, 0xf93e, 0x4707, { 0x96, 0x9b, 0xcf, 0x44, 0xa9, 0xe1, 0xfb, 0x78 } }; FOOGUIDDECL const GUID library_manager_v2::class_guid = { 0x900eae79, 0x68d0, 0x4900, { 0xa4, 0xd8, 0x18, 0x20, 0x5, 0xae, 0x33, 0x7e } }; FOOGUIDDECL const GUID packet_decoder::owner_Ogg = { 0x8fa27457, 0xa021, 0x43b9, { 0xad, 0x20, 0xa7, 0x96, 0xdb, 0x94, 0x7c, 0xd1 } }; FOOGUIDDECL const GUID packet_decoder::property_ogg_header = { 0xbeb22c78, 0xeb49, 0x4f9e, { 0x9e, 0x37, 0x57, 0xd8, 0x87, 0x40, 0xfb, 0x4c } }; FOOGUIDDECL const GUID packet_decoder::property_ogg_query_sample_rate = { 0x6226bf73, 0x1c37, 0x4aa1, { 0xae, 0xb1, 0x18, 0x8b, 0x4a, 0xf3, 0xae, 0xf7 } }; FOOGUIDDECL const GUID packet_decoder::property_ogg_packet = { 0xade740be, 0x8e2e, 0x4d0b, { 0xa4, 0x0, 0x3f, 0x6e, 0x8a, 0xf7, 0x71, 0xe4 } }; FOOGUIDDECL const GUID track_property_provider::class_guid = { 0xefcdd365, 0x81fc, 0x4c82, { 0x96, 0x1c, 0xa2, 0xb5, 0x76, 0x1a, 0xf8, 0xb7 } }; FOOGUIDDECL const GUID track_property_provider_v2::class_guid = { 0x78e86595, 0xcffd, 0x4d10, { 0x85, 0x66, 0xbc, 0xf6, 0x6c, 0x89, 0x11, 0x16 } }; FOOGUIDDECL const GUID library_manager_v3::class_guid = { 0x33dc0f1f, 0x16f0, 0x4e27, { 0xa7, 0x3, 0x63, 0x57, 0x72, 0x35, 0xb0, 0x1c } }; FOOGUIDDECL const GUID metadb_io_v3::class_guid = { 0x10e80560, 0xb1ef, 0x4e5e, { 0xb4, 0xc, 0x5d, 0xfc, 0x2e, 0x9a, 0xf1, 0x11 } }; FOOGUIDDECL const GUID search_filter::class_guid = { 0x4134bb34, 0xed5, 0x49f3, { 0x9c, 0xef, 0x43, 0xe3, 0xa4, 0xa3, 0xa8, 0xae } }; FOOGUIDDECL const GUID search_filter_manager::class_guid = { 0xad0baa03, 0xebd4, 0x4a72, { 0xa0, 0xa7, 0x98, 0x3, 0xa9, 0xe1, 0xe4, 0xf4 } }; FOOGUIDDECL const GUID playlist_manager_v2::class_guid = { 0x7fe9052a, 0x8ec2, 0x4054, { 0xa8, 0xcf, 0x77, 0xef, 0xb5, 0x2f, 0xe4, 0x8 } }; FOOGUIDDECL const GUID playlist_manager_v3::class_guid = { 0x3b6575c8, 0x21a, 0x4474, { 0xbb, 0x60, 0x6c, 0xfc, 0xfe, 0x33, 0xc3, 0x4f } }; FOOGUIDDECL const GUID titleformat_common_methods::class_guid = { 0x432fe059, 0xf087, 0x4785, { 0xa5, 0x18, 0xcb, 0xc1, 0x8b, 0x84, 0x9a, 0xc1 } }; FOOGUIDDECL const GUID core_version_info_v2::class_guid = { 0x273704d7, 0x99ba, 0x4b58, { 0xa0, 0x60, 0x82, 0xab, 0x1, 0xb4, 0x92, 0x25 } }; FOOGUIDDECL const GUID visualisation_stream_v2::class_guid = { 0xeb5b35b5, 0x267b, 0x443c, { 0xbe, 0x37, 0xc, 0x25, 0x73, 0x81, 0xa8, 0x6a } }; FOOGUIDDECL const GUID visualisation_stream_v3::class_guid = { 0xe1fd8e8b, 0x68f1, 0x4cea, { 0xa0, 0xe6, 0x61, 0x91, 0x1d, 0x14, 0x65, 0x42 } }; FOOGUIDDECL const GUID album_art_data::class_guid = { 0x9ddce05c, 0xaa3f, 0x4565, { 0xb3, 0x3a, 0xbd, 0x6a, 0xdc, 0xdd, 0x90, 0x37 } }; FOOGUIDDECL const GUID album_art_manager::class_guid = { 0xab90fd55, 0xb6f, 0x47b2, { 0x8c, 0xd7, 0x61, 0x1d, 0x58, 0x6c, 0x4c, 0x45 } }; FOOGUIDDECL const GUID album_art_manager_instance::class_guid = { 0x3c7b403b, 0xff99, 0x4d86, { 0x84, 0x4a, 0xd3, 0xea, 0xbb, 0xd6, 0x1f, 0x66 } }; FOOGUIDDECL const GUID album_art_extractor::class_guid = { 0xe19ca3d3, 0x6267, 0x4271, { 0xb7, 0x89, 0x6a, 0x3f, 0x87, 0xfb, 0x3e, 0xbf } }; FOOGUIDDECL const GUID album_art_extractor_instance::class_guid = { 0xf673700e, 0x3b6e, 0x4f70, { 0xa1, 0x6, 0xab, 0x74, 0x5c, 0x20, 0x20, 0x60 } }; FOOGUIDDECL const GUID album_art_editor::class_guid = { 0x36b34487, 0xd7b9, 0x4533, { 0xa7, 0x3f, 0x39, 0x6e, 0x2d, 0x9f, 0x41, 0x5e } }; FOOGUIDDECL const GUID album_art_editor_instance::class_guid = { 0x642a2ae1, 0x2259, 0x48f5, { 0xab, 0xdc, 0x63, 0xed, 0x4e, 0xb5, 0x90, 0x76 } }; FOOGUIDDECL const GUID icon_remapping::class_guid = { 0x7c6aea96, 0x4a19, 0x471b, { 0x92, 0x5a, 0xa7, 0xc8, 0xb2, 0x8a, 0x59, 0xe7 } }; FOOGUIDDECL const GUID file_operation_callback_dynamic_manager::class_guid = { 0x1cb3a4dc, 0x7d79, 0x45cf, { 0x82, 0x2e, 0xf8, 0x67, 0x7b, 0x8d, 0xde, 0x37 } }; FOOGUIDDECL const GUID ui_selection_holder::class_guid = { 0x2ec9b7a, 0x93a5, 0x434d, { 0x85, 0x46, 0xed, 0x1d, 0xbb, 0x24, 0x35, 0xd0 } }; FOOGUIDDECL const GUID ui_selection_manager::class_guid = { 0xd8ee46c7, 0x27ad, 0x4881, { 0xb1, 0x33, 0x14, 0x96, 0xc0, 0xe7, 0xee, 0x67 } }; FOOGUIDDECL const GUID ui_selection_manager_v2::class_guid = { 0x2740b6c1, 0x449d, 0x40cc, { 0x8a, 0x79, 0x38, 0xc, 0x77, 0xe8, 0xdf, 0xc2 } }; FOOGUIDDECL const GUID ole_interaction::class_guid = { 0xfbee40c9, 0xef36, 0x410b, { 0x9d, 0x52, 0x7e, 0x56, 0x39, 0x59, 0xf3, 0xd1 } }; FOOGUIDDECL const GUID tag_processor_album_art_utils::class_guid = { 0x58768713, 0xc13c, 0x4406, { 0x97, 0x98, 0x21, 0x47, 0xcb, 0x97, 0x33, 0x2a } }; FOOGUIDDECL const GUID playlist_incoming_item_filter_v3::class_guid = { 0xd3332054, 0xbccd, 0x45cb, { 0xbc, 0x2, 0x0, 0xa1, 0x3a, 0x80, 0x25, 0x9f } }; FOOGUIDDECL const GUID menu_item_resolver::class_guid = { 0xac70ecdc, 0xe1d, 0x4db2, { 0x9c, 0xd0, 0xc9, 0xb8, 0xa9, 0xcd, 0x28, 0xfa } }; FOOGUIDDECL const GUID app_close_blocking_task_manager::class_guid = { 0x213f1454, 0x8a62, 0x44b6, { 0xb0, 0xcb, 0xc1, 0xe1, 0x5d, 0xa7, 0x3b, 0xc8 } }; FOOGUIDDECL const GUID message_loop_v2::class_guid = { 0x5d438080, 0xb269, 0x406d, { 0x94, 0xaf, 0xef, 0xd9, 0x29, 0x9f, 0x32, 0x5c } }; FOOGUIDDECL const GUID autoplaylist_client::class_guid = { 0x7c90bda0, 0xf93d, 0x4a73, { 0x98, 0x51, 0xa0, 0x33, 0x6, 0x7, 0xcb, 0x28 } }; FOOGUIDDECL const GUID autoplaylist_client_factory::class_guid = { 0x764200cb, 0xe283, 0x4efd, { 0x88, 0xa5, 0x80, 0x38, 0xdd, 0xee, 0x77, 0xdb } }; FOOGUIDDECL const GUID autoplaylist_manager::class_guid = { 0x1571d0d, 0xc1e1, 0x44bf, { 0xb5, 0x29, 0x7a, 0xe, 0x4e, 0x89, 0x15, 0xbc } }; FOOGUIDDECL const GUID replaygain_result::class_guid = { 0xe7f43102, 0xbc6e, 0x400b, { 0xbb, 0x81, 0x2d, 0x9b, 0xe4, 0x30, 0x3e, 0xcc } }; FOOGUIDDECL const GUID replaygain_scanner::class_guid = { 0x2a40fcf9, 0xf1f7, 0x41da, { 0xad, 0x76, 0x29, 0xf7, 0x51, 0xed, 0xd3, 0x8a } }; FOOGUIDDECL const GUID replaygain_scanner_entry::class_guid = { 0x278380f3, 0x6fc0, 0x4176, { 0x8a, 0x98, 0x1f, 0x66, 0x3a, 0x94, 0x79, 0xc5 } }; FOOGUIDDECL const GUID search_filter_manager_v2::class_guid = { 0xac62a380, 0x7771, 0x4dc9, { 0x8a, 0x26, 0x41, 0x41, 0x39, 0xb4, 0x3e, 0xe2 } }; FOOGUIDDECL const GUID search_filter_v2::class_guid = { 0xb7ca3c8, 0xaf23, 0x4a52, { 0x82, 0x66, 0xfe, 0x5, 0x4c, 0x49, 0xeb, 0x23 } }; FOOGUIDDECL const GUID autoplaylist_client_v2::class_guid = { 0xfaa716f7, 0xebb1, 0x473c, { 0xbc, 0xf1, 0xb0, 0x1b, 0x8c, 0x9f, 0x1b, 0x95 } }; FOOGUIDDECL const GUID library_search_ui::class_guid = { 0xe5eb14fa, 0xbb08, 0x4564, { 0xaf, 0xfa, 0x6f, 0x27, 0x3f, 0x37, 0xbd, 0x3d } }; FOOGUIDDECL const GUID search_filter_v3::class_guid = { 0xdd6bc035, 0x7e33, 0x425a, { 0x89, 0x32, 0x6, 0xb5, 0xea, 0xb0, 0x39, 0xbc } }; FOOGUIDDECL const GUID input_decoder_v2::class_guid = { 0x2c5489eb, 0xd3c1, 0x4ad4, { 0xbe, 0xa3, 0xcf, 0x40, 0x8e, 0x16, 0x1b, 0x9b } }; FOOGUIDDECL const GUID event_logger::class_guid = { 0x5d336782, 0x69d6, 0x4225, { 0x9e, 0xa8, 0xcc, 0x29, 0x35, 0x7, 0xf9, 0xfe } }; FOOGUIDDECL const GUID playlist_manager_v4::class_guid = { 0xcea7b49e, 0xacf2, 0x4ea2, { 0x99, 0x86, 0x95, 0xa, 0x56, 0xa2, 0xc0, 0xef } }; FOOGUIDDECL const GUID ole_interaction_v2::class_guid = { 0x55738cab, 0x311d, 0x4dbe, { 0xa0, 0xbc, 0x51, 0xc1, 0xba, 0x27, 0xfe, 0x95 } }; FOOGUIDDECL const GUID autoplaylist_manager_v2::class_guid = { 0x67882220, 0xeea5, 0x4dbc, { 0x9a, 0xa3, 0x63, 0xde, 0x8c, 0xdd, 0x40, 0x82 } }; FOOGUIDDECL const GUID library_file_move_scope::class_guid = { 0x345fae5, 0x8093, 0x45f6, { 0x94, 0x2e, 0xd6, 0xe, 0xbf, 0x7, 0xe9, 0x52 } }; FOOGUIDDECL const GUID library_file_move_manager::class_guid = { 0xc4cd4818, 0xe3f8, 0x4061, { 0x99, 0xf1, 0x18, 0x66, 0x4e, 0x6c, 0x28, 0x57 } }; FOOGUIDDECL const GUID library_file_move_notify::class_guid = { 0xd8ae7613, 0x7577, 0x4192, { 0x8f, 0xa4, 0x2d, 0x8f, 0x7e, 0xc6, 0x6, 0x38 } }; FOOGUIDDECL const GUID library_meta_autocomplete::class_guid = { 0x4b976e34, 0xf05a, 0x4da4, { 0xad, 0x65, 0x71, 0x9c, 0xdf, 0xd, 0xed, 0xae } }; FOOGUIDDECL const GUID input_protocol_type::class_guid = { 0x6a03c4ee, 0xf87b, 0x49d7, { 0x81, 0xdb, 0x66, 0xb, 0xe8, 0xc1, 0x0, 0x7e } }; FOOGUIDDECL const GUID input_decoder_v3::class_guid = { 0x953c71ed, 0xd3a2, 0x43f4, { 0xa3, 0x3a, 0x55, 0x94, 0xd6, 0x73, 0x96, 0xe5 } }; FOOGUIDDECL const GUID metadb_hint_list_v2::class_guid = { 0x983a971a, 0x596b, 0x478f, { 0x9c, 0x38, 0x36, 0xb0, 0x2b, 0xd6, 0x39, 0xd9 } }; #if FOOBAR2000_TARGET_VERSION >= 76 FOOGUIDDECL const GUID playlist_loader::class_guid = { 0x7103cae9, 0x91c, 0x4d80, { 0xbc, 0x1d, 0x28, 0x4a, 0xc1, 0x3f, 0x1e, 0x8c } }; FOOGUIDDECL const GUID playlist_loader_callback::class_guid = { 0x924470a0, 0x1478, 0x4141, { 0xa7, 0x5a, 0xc5, 0x2f, 0x1f, 0xfa, 0xef, 0xea } }; #endif FOOGUIDDECL const GUID album_art_manager_v2::class_guid = { 0xb420664f, 0x4033, 0x465e, { 0x81, 0xb1, 0xce, 0x42, 0x43, 0x89, 0x1f, 0x59 } }; FOOGUIDDECL const GUID album_art_extractor_instance_v2::class_guid = { 0x951bbeb1, 0xa94a, 0x4d9a, { 0xa2, 0x85, 0xd6, 0x1e, 0xe4, 0x66, 0xe8, 0xcc } }; FOOGUIDDECL const GUID album_art_path_list::class_guid = { 0xbb26233f, 0x1051, 0x4b01, { 0x9f, 0xd8, 0xf0, 0xe4, 0x20, 0x7, 0xd7, 0xe6 } }; FOOGUIDDECL const GUID album_art_fallback::class_guid = { 0x45481581, 0x40b3, 0x4930, { 0xab, 0x6d, 0x4e, 0x6e, 0x56, 0x58, 0x6c, 0x82 } }; FOOGUIDDECL const GUID preferences_page_callback::class_guid = { 0x3d26e08e, 0x861c, 0x4599, { 0x9c, 0x89, 0xaa, 0xa7, 0x19, 0xaf, 0x50, 0x70 } }; FOOGUIDDECL const GUID preferences_page_instance::class_guid = { 0x6893a996, 0xa816, 0x49fe, { 0x82, 0xce, 0xc, 0xb8, 0x4, 0xa4, 0xcf, 0xec } }; FOOGUIDDECL const GUID preferences_page_v3::class_guid = { 0xd6d0f741, 0x9f17, 0x4df8, { 0x9d, 0x5c, 0x87, 0xf2, 0x8b, 0x1f, 0xe, 0x64 } }; FOOGUIDDECL const GUID advconfig_entry_string_v2::class_guid = { 0x2ec9b1fa, 0xe1e4, 0x42f0, { 0x87, 0x97, 0x4a, 0x63, 0x16, 0x94, 0x86, 0xbc } }; FOOGUIDDECL const GUID advconfig_entry_checkbox_v2::class_guid = { 0xe29b37d0, 0xa957, 0x4a85, { 0x82, 0x40, 0x1e, 0x96, 0xc7, 0x29, 0xb6, 0x69 } }; FOOGUIDDECL const GUID config_io_callback_v2::class_guid = { 0xfe784bf0, 0x9504, 0x4e35, { 0x85, 0xe4, 0x72, 0x53, 0x82, 0x62, 0xa1, 0x99 } }; FOOGUIDDECL const GUID contextmenu_item_v2::class_guid = { 0x4bd830ca, 0xe3e6, 0x404e, { 0x95, 0x44, 0xc9, 0xb7, 0xd1, 0x5a, 0x3f, 0x49 } }; FOOGUIDDECL const GUID contextmenu_group_manager::class_guid = { 0x92ba0c5, 0x5572, 0x48cd, { 0xa4, 0xca, 0x7b, 0x73, 0xde, 0xb, 0x2a, 0xec } }; FOOGUIDDECL const GUID contextmenu_group::class_guid = { 0x9dcfc219, 0x779, 0x4669, { 0x98, 0xc1, 0x83, 0x6d, 0xf6, 0x7, 0xc5, 0xd4 } }; FOOGUIDDECL const GUID contextmenu_group_popup::class_guid = { 0x97636ad5, 0x5b2d, 0x4ad6, { 0x9f, 0x79, 0xc9, 0x64, 0x63, 0x88, 0xc8, 0x29 } }; FOOGUIDDECL const GUID contextmenu_groups::root = { 0xe6e7dc71, 0x114b, 0x4848, { 0x92, 0x8c, 0x2a, 0xdc, 0x3f, 0x86, 0xbe, 0xb4 } }; FOOGUIDDECL const GUID contextmenu_groups::tagging = { 0xc24b5125, 0xad58, 0x4dfd, { 0x99, 0x76, 0xff, 0xbe, 0xba, 0xad, 0xc9, 0x79 } }; FOOGUIDDECL const GUID contextmenu_groups::utilities = { 0xfb0a55d6, 0xe693, 0x4c4a, { 0x8c, 0x62, 0xf2, 0x4e, 0xa0, 0xce, 0xf8, 0xb7 } }; FOOGUIDDECL const GUID contextmenu_groups::replaygain = { 0x9640f207, 0x9c98, 0x47b5, { 0x85, 0x7, 0x6c, 0x9c, 0x14, 0x3e, 0x64, 0x15 } }; FOOGUIDDECL const GUID contextmenu_groups::fileoperations = { 0x62a0e2a4, 0x251d, 0x4315, { 0x88, 0x9b, 0x1, 0x8f, 0x30, 0x8c, 0x7, 0x7a } }; FOOGUIDDECL const GUID contextmenu_groups::convert = { 0x70429638, 0x502b, 0x466d, { 0xbf, 0x24, 0x46, 0xd, 0xae, 0x23, 0x10, 0x91 } }; FOOGUIDDECL const GUID contextmenu_groups::playbackstatistics = { 0x12ad3123, 0xd934, 0x4241, { 0xa7, 0x1, 0x92, 0x7e, 0x87, 0x7, 0xd1, 0xdc } }; FOOGUIDDECL const GUID contextmenu_groups::properties = { 0xb38cb9f, 0xa92d, 0x4fa4, { 0xb4, 0x58, 0x70, 0xd2, 0xfd, 0x39, 0x25, 0xba } }; FOOGUIDDECL const GUID contextmenu_groups::legacy = { 0xbebb1711, 0x20e, 0x46ed, { 0xa7, 0xf8, 0xa3, 0x26, 0x27, 0x18, 0x4a, 0x88 } }; FOOGUIDDECL const GUID mainmenu_commands_v2::class_guid = { 0xe682e810, 0x41f3, 0x434d, { 0xb0, 0xc7, 0xd4, 0x96, 0x90, 0xe6, 0x5f, 0x87 } }; FOOGUIDDECL const GUID mainmenu_node::class_guid = { 0xabba6512, 0x377d, 0x414f, { 0x81, 0x3e, 0x68, 0x6, 0xc2, 0x2d, 0x4d, 0xb1 } }; FOOGUIDDECL const GUID system_time_keeper::class_guid = { 0xdc5d4938, 0x7927, 0x48ba, { 0xbf, 0x84, 0xda, 0x2f, 0xb1, 0xb, 0x36, 0xf2 } }; FOOGUIDDECL const GUID component_installation_validator::class_guid = { 0x639283e, 0x3004, 0x4e5c, { 0xb1, 0xb3, 0x6d, 0xff, 0x8, 0xa7, 0x92, 0x84 } }; FOOGUIDDECL const GUID playback_stream_capture::class_guid = { 0x9423439e, 0x8cd5, 0x45d7, { 0xaa, 0x6d, 0x4b, 0x98, 0xc, 0x22, 0x93, 0x3e } }; FOOGUIDDECL const GUID http_request::class_guid = { 0x48580056, 0x2c5f, 0x45a8, { 0xb8, 0x6e, 0x5, 0x83, 0x55, 0x3e, 0xaa, 0x4f } }; FOOGUIDDECL const GUID http_request_post::class_guid = { 0xe254b804, 0xeac5, 0x4be0, { 0x99, 0x4d, 0x53, 0x1c, 0x17, 0xea, 0xfd, 0x37 } }; FOOGUIDDECL const GUID http_client::class_guid = { 0x3b5ffe0c, 0xd75a, 0x491e, { 0xbb, 0x6f, 0x10, 0x3f, 0x73, 0x1e, 0x81, 0x84 } }; FOOGUIDDECL const GUID http_reply::class_guid = { 0x7f02bf78, 0x5c98, 0x4d6d, { 0x83, 0x6b, 0xb7, 0x77, 0xa4, 0xa3, 0x3e, 0xe5 } }; FOOGUIDDECL const GUID popup_message_v2::class_guid = { 0x18b74f55, 0x10e1, 0x4645, { 0x91, 0xf6, 0xb0, 0xe0, 0x4c, 0x28, 0x21, 0xe9 } }; FOOGUIDDECL const GUID metadb_index_client::class_guid = { 0x52637e7d, 0x7f3, 0x49bf, { 0x90, 0x19, 0x36, 0x20, 0x83, 0xcc, 0x7e, 0x59 } }; FOOGUIDDECL const GUID metadb_index_manager::class_guid = { 0xb9633863, 0x2683, 0x4163, { 0xa5, 0x8d, 0x26, 0x47, 0x5d, 0xb0, 0xe7, 0x9b } }; FOOGUIDDECL const GUID init_stage_callback::class_guid = { 0xaf51c159, 0x6326, 0x4da5, { 0x90, 0xb0, 0xf1, 0x1f, 0x99, 0x64, 0xcc, 0x2e } }; FOOGUIDDECL const GUID metadb_io_edit_callback::class_guid = { 0x2388a50f, 0x33d, 0x4b7c, { 0x91, 0xf2, 0x51, 0x53, 0x69, 0x43, 0xe9, 0xed } }; FOOGUIDDECL const GUID decode_postprocessor_entry::class_guid = { 0xb105c345, 0xf642, 0x4a26, { 0xa7, 0x80, 0xbb, 0x90, 0xe1, 0xb4, 0xac, 0xb1 } }; FOOGUIDDECL const GUID decode_postprocessor_instance::class_guid = { 0xfacabec0, 0xeeee, 0x46d1, { 0xa5, 0x39, 0xaa, 0x57, 0x5, 0xaf, 0x5d, 0x45 } }; FOOGUIDDECL const GUID progress_meter_instance::class_guid = { 0x13915b24, 0xefef, 0x42b5, { 0xae, 0x1d, 0x55, 0x24, 0x5e, 0x22, 0x22, 0xc5 } }; FOOGUIDDECL const GUID progress_meter::class_guid = { 0x5e98da34, 0xa9c7, 0x4925, { 0xb0, 0xec, 0x90, 0x9d, 0xe0, 0x16, 0xfa, 0x68 } };
/* file: prediction_result.cpp */ /******************************************************************************* * Copyright 2014-2018 Intel Corporation * All Rights Reserved. * * If this software was obtained under the Intel Simplified Software License, * the following terms apply: * * The source code, information and material ("Material") contained herein is * owned by Intel Corporation or its suppliers or licensors, and title to such * Material remains with Intel Corporation or its suppliers or licensors. The * Material contains proprietary information of Intel or its suppliers and * licensors. The Material is protected by worldwide copyright laws and treaty * provisions. No part of the Material may be used, copied, reproduced, * modified, published, uploaded, posted, transmitted, distributed or disclosed * in any way without Intel's prior express written permission. No license under * any patent, copyright or other intellectual property rights in the Material * is granted to or conferred upon you, either expressly, by implication, * inducement, estoppel or otherwise. Any license under such intellectual * property rights must be express and approved by Intel in writing. * * Unless otherwise agreed by Intel in writing, you may not remove or alter this * notice or any other notice embedded in Materials by Intel or Intel's * suppliers or licensors in any way. * * * If this software was obtained under the Apache License, Version 2.0 (the * "License"), the following terms apply: * * You may not use this file except in compliance with the License. You may * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 * * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * limitations under the License. *******************************************************************************/ #include <jni.h> #include "neural_networks/prediction/JPredictionResult.h" #include "neural_networks/prediction/JPredictionResultId.h" #include "neural_networks/prediction/JPredictionResultCollectionId.h" #include "daal.h" #include "common_helpers.h" #define predictionId com_intel_daal_algorithms_neural_networks_prediction_PredictionResultId_predictionId #define predictionCollectionId com_intel_daal_algorithms_neural_networks_prediction_PredictionResultCollectionId_predictionCollectionId USING_COMMON_NAMESPACES(); using namespace daal::algorithms::neural_networks; /* * Class: com_intel_daal_algorithms_neural_networks_prediction_PredictionResult * Method: cGetValue * Signature: (JI)J */ JNIEXPORT jlong JNICALL Java_com_intel_daal_algorithms_neural_1networks_prediction_PredictionResult_cGetValue (JNIEnv *env, jobject thisObj, jlong resAddr, jint id) { if (id == predictionId) { return jniArgument<prediction::Result>::get<prediction::ResultId, Tensor>(resAddr, id); } else if (id == predictionCollectionId) { return jniArgument<prediction::Result>::get<prediction::ResultCollectionId, KeyValueDataCollection>(resAddr, id); } return (jlong)0; } /* * Class: com_intel_daal_algorithms_neural_networks_prediction_PredictionResult * Method: cSetValue * Signature: (JIJ)V */ JNIEXPORT void JNICALL Java_com_intel_daal_algorithms_neural_1networks_prediction_PredictionResult_cSetValue (JNIEnv *env, jobject thisObj, jlong resAddr, jint id, jlong ntAddr) { if (id == predictionId) { jniArgument<prediction::Result>::set<prediction::ResultId, Tensor>(resAddr, id, ntAddr); } else if (id == predictionCollectionId) { jniArgument<prediction::Result>::set<prediction::ResultCollectionId, KeyValueDataCollection>(resAddr, id, ntAddr); } } /* * Class: com_intel_daal_algorithms_neural_networks_prediction_PredictionResult * Method: cAddTensor * Signature: (JIIJ)V */ JNIEXPORT void JNICALL Java_com_intel_daal_algorithms_neural_1networks_prediction_PredictionResult_cAddTensor (JNIEnv *env, jobject thisObj, jlong resAddr, jint id, jint key, jlong ntAddr) { if (id == predictionCollectionId) { SerializationIfacePtr *collectionShPtr = (SerializationIfacePtr *)(jniArgument<prediction::Result>::get<prediction::ResultCollectionId, KeyValueDataCollection>(resAddr, id)); SerializationIfacePtr *valueShPtr = (SerializationIfacePtr *)ntAddr; KeyValueDataCollection *collection = static_cast<KeyValueDataCollection *>(collectionShPtr->get()); (*collection)[(size_t)key] = *valueShPtr; } } /* * Class: com_intel_daal_algorithms_neural_networks_prediction_PredictionResult * Method: cGetTensor * Signature: (JII)J */ JNIEXPORT jlong JNICALL Java_com_intel_daal_algorithms_neural_1networks_prediction_PredictionResult_cGetTensor (JNIEnv *env, jobject thisObj, jlong resAddr, jint id, jint key) { if (id == predictionCollectionId) { SerializationIfacePtr *collectionShPtr = (SerializationIfacePtr *)(jniArgument<prediction::Result>::get<prediction::ResultCollectionId, KeyValueDataCollection>(resAddr, id)); KeyValueDataCollection *collection = static_cast<KeyValueDataCollection *>(collectionShPtr->get()); SerializationIfacePtr *value = new SerializationIfacePtr((*collection)[(size_t)key]); return (jlong)value; } return (jlong)0; }
.global s_prepare_buffers s_prepare_buffers: push %r12 push %r8 push %rbp push %rcx push %rdi push %rdx push %rsi lea addresses_WT_ht+0x1118c, %rsi lea addresses_WT_ht+0x1050c, %rdi nop nop nop nop and $9372, %rbp mov $45, %rcx rep movsw nop nop add %rdx, %rdx lea addresses_A_ht+0x1464, %rsi lea addresses_WC_ht+0x6f0c, %rdi cmp $45386, %r12 mov $90, %rcx rep movsq nop nop dec %r12 lea addresses_normal_ht+0x1170c, %rcx nop nop nop inc %r8 mov (%rcx), %edi nop nop nop nop nop xor $22496, %rcx lea addresses_A_ht+0xa86c, %rsi nop nop nop and $60271, %rcx mov $0x6162636465666768, %rdx movq %rdx, %xmm2 vmovups %ymm2, (%rsi) nop nop nop cmp %rcx, %rcx lea addresses_D_ht+0x1e550, %r12 sub $18273, %rbp mov $0x6162636465666768, %rsi movq %rsi, %xmm0 vmovups %ymm0, (%r12) and $33819, %rbp lea addresses_WC_ht+0x1c82e, %rsi clflush (%rsi) nop xor $39335, %rdx movl $0x61626364, (%rsi) nop nop sub %rdx, %rdx lea addresses_normal_ht+0x1cb0c, %r12 nop nop cmp %rdx, %rdx mov (%r12), %rsi nop nop nop nop cmp $57102, %r8 pop %rsi pop %rdx pop %rdi pop %rcx pop %rbp pop %r8 pop %r12 ret .global s_faulty_load s_faulty_load: push %r10 push %r12 push %r14 push %r8 push %r9 push %rbx push %rcx // Store lea addresses_WT+0x1150c, %r14 nop xor %r12, %r12 movw $0x5152, (%r14) nop nop add %r14, %r14 // Load lea addresses_UC+0x9885, %rcx nop nop nop nop xor $4460, %r8 movups (%rcx), %xmm2 vpextrq $1, %xmm2, %r9 nop nop nop nop and %rcx, %rcx // Load lea addresses_A+0xd504, %rcx nop nop nop nop sub $11331, %r12 mov (%rcx), %r14w nop nop nop nop add %r10, %r10 // Store lea addresses_RW+0x3f0c, %r14 nop nop nop nop sub %r9, %r9 mov $0x5152535455565758, %r8 movq %r8, (%r14) nop nop nop inc %rcx // Faulty Load mov $0x54c5e80000000d0c, %r14 nop nop nop nop nop cmp %r12, %r12 mov (%r14), %rbx lea oracles, %r12 and $0xff, %rbx shlq $12, %rbx mov (%r12,%rbx,1), %rbx pop %rcx pop %rbx pop %r9 pop %r8 pop %r14 pop %r12 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_NC', 'AVXalign': False, 'size': 2}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'NT': True, 'same': False, 'congruent': 10, 'type': 'addresses_WT', 'AVXalign': False, 'size': 2}} {'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_UC', 'AVXalign': False, 'size': 16}, 'OP': 'LOAD'} {'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_A', 'AVXalign': False, 'size': 2}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 9, 'type': 'addresses_RW', 'AVXalign': False, 'size': 8}} [Faulty Load] {'src': {'NT': True, 'same': True, 'congruent': 0, 'type': 'addresses_NC', 'AVXalign': False, 'size': 8}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'same': False, 'congruent': 7, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 11, 'type': 'addresses_WT_ht'}} {'src': {'same': False, 'congruent': 3, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 8, 'type': 'addresses_WC_ht'}} {'src': {'NT': False, 'same': False, 'congruent': 5, 'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 4}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'NT': False, 'same': True, 'congruent': 5, 'type': 'addresses_A_ht', 'AVXalign': False, 'size': 32}} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_D_ht', 'AVXalign': False, 'size': 32}} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 1, 'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 4}} {'src': {'NT': True, 'same': False, 'congruent': 9, 'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 8}, 'OP': 'LOAD'} {'00': 21829} 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 */
; void __FASTCALL__ adt_StackCreateS(struct adt_Stack *s) ; 11.2006 aralbrec SECTION code_clib PUBLIC adt_StackCreateS PUBLIC _adt_StackCreateS EXTERN l_setmem ; initialize an adt_Stack* .adt_StackCreateS ._adt_StackCreateS xor a jp l_setmem-7
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r11 push %r14 push %rbx push %rcx push %rdi push %rdx push %rsi lea addresses_WC_ht+0x1ee97, %r14 nop nop nop nop and $30345, %r11 movb $0x61, (%r14) nop nop nop nop sub %r10, %r10 lea addresses_WC_ht+0x8577, %rsi lea addresses_A_ht+0x1a79b, %rdi nop nop nop and %rdx, %rdx mov $44, %rcx rep movsw sub %rdi, %rdi lea addresses_normal_ht+0x167c7, %rdx clflush (%rdx) nop nop nop cmp $5928, %rsi mov (%rdx), %r11d dec %r11 lea addresses_WC_ht+0x13f17, %rdx nop nop nop nop inc %rdi mov $0x6162636465666768, %r11 movq %r11, %xmm4 vmovups %ymm4, (%rdx) inc %rbx pop %rsi pop %rdx pop %rdi pop %rcx pop %rbx pop %r14 pop %r11 pop %r10 ret .global s_faulty_load s_faulty_load: push %r10 push %r13 push %r8 push %rbx push %rcx // Faulty Load lea addresses_US+0x19c97, %r13 nop nop nop nop nop add %r8, %r8 movups (%r13), %xmm4 vpextrq $1, %xmm4, %rcx lea oracles, %rbx and $0xff, %rcx shlq $12, %rcx mov (%rbx,%rcx,1), %rcx pop %rcx pop %rbx pop %r8 pop %r13 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_US', 'same': False, 'size': 2, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} [Faulty Load] {'src': {'type': 'addresses_US', 'same': True, 'size': 16, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} <gen_prepare_buffer> {'dst': {'type': 'addresses_WC_ht', 'same': False, 'size': 1, 'congruent': 9, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'src': {'type': 'addresses_WC_ht', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 2, 'same': False}, 'OP': 'REPM'} {'src': {'type': 'addresses_normal_ht', 'same': False, 'size': 4, 'congruent': 4, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_WC_ht', 'same': False, 'size': 32, 'congruent': 5, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'00': 77} 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 */
fel: ld hl,felstr call outstr endhere: jr endhere felstr: defm "Something went wrong while flashing"&10&0 dot: push hl push de push bc push ix push iy push af ld hl,dotstr call outstr pop af pop iy pop ix pop bc pop de pop hl ret ; Temp storage for flashbytes and flashbyte start_seg: defb 0 offset: defw 0 ramptr: defw 0 numbytes: defw 0 flashbytes: ; a contains start segment ; hl contains offset ; bc contains pointer to bytes to burn (in RAM) ; de contains number of bytes to burn ld (start_seg),a ld (offset),hl ld (ramptr),bc ld (numbytes),de morebytes: ld hl,(ramptr) ld c,(hl) ld a,(start_seg) ld hl,(offset) ld de,(numbytes) call flashbyte ; bc will get destroyed ; Check if writing went well.. ld a,(start_seg) ld hl,(offset) call peekb ; result now in a... ld d,a ld bc,(ramptr) ld a,(bc) cp d jr nz,fel call dot ld hl,(offset) ld bc,(ramptr) ld de,(numbytes) inc hl inc bc dec de ld (offset),hl ld (ramptr),bc ld (numbytes),de ; This will wrap hl=4096 back to 0 and increment a ld hl,(offset) ld a,(start_seg) call checkseg ld (offset),hl ld (start_seg),a ld de,(numbytes) ld a,d or e ; Flags set here ... jr nz,morebytes ; ... should still be intact here ld a,(start_seg) ld hl,(offset) ld bc,(ramptr) ld de,(numbytes) ret checkseg: ; Here we should check so hl < 4096 ; and if so set it back to 0 and increment segment reg (a) push af ld a,h cp 16 ; b=16 => hl=4096, time to wrap... jr nz,dontwrap ld hl,0 pop af inc a ret dontwrap: pop af ret frv: defm "Done flashing! Now reset target!!!"&0 flashbyte: ; a contains the start-segment ; hl contains the offset ; c contains byte to burn ; bc returns number of cycles it took to program push af push bc push hl defb 0edh, 067h ; ld xpc,a ld a,85h ld hl,555h ld c,0aah call pokeb ld a,82h ld hl,0aaah ld c,55h call pokeb ld a,85h ld hl,555h ld c,0a0h call pokeb pop hl pop bc pop af push de push hl push af call pokeb ; xpc loaded above with 80-0e so we add e000 offset to ; get physical address 80000 ld hl,0e000h ; A special optimised togglewait here for speed and granularity ld bc,0 togglw: ld a,(hl) ld d,a ld a,(hl) cp d inc bc jr nz,togglw pop af pop hl pop de ret erase: ld a,85h ld hl,555h ld c,0aah call pokeb ld a,82h ld hl,0aaah ld c,55h call pokeb ld a,85h ld hl,555h ld c,80h call pokeb ld a,85h ld hl,555h ld c,0aah call pokeb ld a,82h ld hl,0aaah ld c,55h call pokeb ld a,85h ld hl,555h ld c,10h call pokeb ret waittoggle: ; a should contain segment of flash in memory, i.e 80h for most (all?) rabbits ; Will return number of waitloop turns in bc push hl push de ld bc,0 waittoggleloop: ld a,80h ld hl,0 call peekb ld d,a ; Store away first read ld a,80h call peekb ; a and b now contains the two values... cp d inc bc jr nz,waittoggleloop pop de pop hl ret pokeb: ; a is the segment, hl is the address and c is the data push af push bc push de push hl ; Add offset to 16-bit address and subtract from segment ld de, 0e000h; add hl,de sub a,14 defb 0edh, 067h ; ld xpc,a ld (hl),c pop hl pop de pop bc pop af ret peekb: ; a is the segment, hl is the address and data is returned in a push bc push de push hl ; Add offset to 16-bit address and subtract from segment ld de, 0e000h; add hl,de sub a,14 defb 0edh, 067h ; ld xpc,a ld a,(hl) pop hl pop de pop bc ret fin_str: defm 10&"Finnished flashing, now reset target..."&10&0 erase_str: defm "Erased flash..."&10&0 dotstr: defm "."&0 outstr: ld (_s_ostr), hl call _OUTSTR ret
_usertests: file format elf32-i386 Disassembly of section .text: 00000000 <iputtest>: int stdout = 1; // does chdir() call iput(p->cwd) in a transaction? void iputtest(void) { 0: 55 push %ebp 1: 89 e5 mov %esp,%ebp 3: 83 ec 08 sub $0x8,%esp printf(stdout, "iput test\n"); 6: a1 00 63 00 00 mov 0x6300,%eax b: 83 ec 08 sub $0x8,%esp e: 68 5a 44 00 00 push $0x445a 13: 50 push %eax 14: e8 75 40 00 00 call 408e <printf> 19: 83 c4 10 add $0x10,%esp if (mkdir("iputdir") < 0) { 1c: 83 ec 0c sub $0xc,%esp 1f: 68 65 44 00 00 push $0x4465 24: e8 0e 3f 00 00 call 3f37 <mkdir> 29: 83 c4 10 add $0x10,%esp 2c: 85 c0 test %eax,%eax 2e: 79 1b jns 4b <iputtest+0x4b> printf(stdout, "mkdir failed\n"); 30: a1 00 63 00 00 mov 0x6300,%eax 35: 83 ec 08 sub $0x8,%esp 38: 68 6d 44 00 00 push $0x446d 3d: 50 push %eax 3e: e8 4b 40 00 00 call 408e <printf> 43: 83 c4 10 add $0x10,%esp exit(); 46: e8 84 3e 00 00 call 3ecf <exit> } if (chdir("iputdir") < 0) { 4b: 83 ec 0c sub $0xc,%esp 4e: 68 65 44 00 00 push $0x4465 53: e8 e7 3e 00 00 call 3f3f <chdir> 58: 83 c4 10 add $0x10,%esp 5b: 85 c0 test %eax,%eax 5d: 79 1b jns 7a <iputtest+0x7a> printf(stdout, "chdir iputdir failed\n"); 5f: a1 00 63 00 00 mov 0x6300,%eax 64: 83 ec 08 sub $0x8,%esp 67: 68 7b 44 00 00 push $0x447b 6c: 50 push %eax 6d: e8 1c 40 00 00 call 408e <printf> 72: 83 c4 10 add $0x10,%esp exit(); 75: e8 55 3e 00 00 call 3ecf <exit> } if (unlink("../iputdir") < 0) { 7a: 83 ec 0c sub $0xc,%esp 7d: 68 91 44 00 00 push $0x4491 82: e8 98 3e 00 00 call 3f1f <unlink> 87: 83 c4 10 add $0x10,%esp 8a: 85 c0 test %eax,%eax 8c: 79 1b jns a9 <iputtest+0xa9> printf(stdout, "unlink ../iputdir failed\n"); 8e: a1 00 63 00 00 mov 0x6300,%eax 93: 83 ec 08 sub $0x8,%esp 96: 68 9c 44 00 00 push $0x449c 9b: 50 push %eax 9c: e8 ed 3f 00 00 call 408e <printf> a1: 83 c4 10 add $0x10,%esp exit(); a4: e8 26 3e 00 00 call 3ecf <exit> } if (chdir("/") < 0) { a9: 83 ec 0c sub $0xc,%esp ac: 68 b6 44 00 00 push $0x44b6 b1: e8 89 3e 00 00 call 3f3f <chdir> b6: 83 c4 10 add $0x10,%esp b9: 85 c0 test %eax,%eax bb: 79 1b jns d8 <iputtest+0xd8> printf(stdout, "chdir / failed\n"); bd: a1 00 63 00 00 mov 0x6300,%eax c2: 83 ec 08 sub $0x8,%esp c5: 68 b8 44 00 00 push $0x44b8 ca: 50 push %eax cb: e8 be 3f 00 00 call 408e <printf> d0: 83 c4 10 add $0x10,%esp exit(); d3: e8 f7 3d 00 00 call 3ecf <exit> } printf(stdout, "iput test ok\n"); d8: a1 00 63 00 00 mov 0x6300,%eax dd: 83 ec 08 sub $0x8,%esp e0: 68 c8 44 00 00 push $0x44c8 e5: 50 push %eax e6: e8 a3 3f 00 00 call 408e <printf> eb: 83 c4 10 add $0x10,%esp } ee: 90 nop ef: c9 leave f0: c3 ret 000000f1 <exitiputtest>: // does exit() call iput(p->cwd) in a transaction? void exitiputtest(void) { f1: 55 push %ebp f2: 89 e5 mov %esp,%ebp f4: 83 ec 18 sub $0x18,%esp int pid; printf(stdout, "exitiput test\n"); f7: a1 00 63 00 00 mov 0x6300,%eax fc: 83 ec 08 sub $0x8,%esp ff: 68 d6 44 00 00 push $0x44d6 104: 50 push %eax 105: e8 84 3f 00 00 call 408e <printf> 10a: 83 c4 10 add $0x10,%esp pid = fork(); 10d: e8 b5 3d 00 00 call 3ec7 <fork> 112: 89 45 f4 mov %eax,-0xc(%ebp) if (pid < 0) { 115: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 119: 79 1b jns 136 <exitiputtest+0x45> printf(stdout, "fork failed\n"); 11b: a1 00 63 00 00 mov 0x6300,%eax 120: 83 ec 08 sub $0x8,%esp 123: 68 e5 44 00 00 push $0x44e5 128: 50 push %eax 129: e8 60 3f 00 00 call 408e <printf> 12e: 83 c4 10 add $0x10,%esp exit(); 131: e8 99 3d 00 00 call 3ecf <exit> } if (pid == 0) { 136: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 13a: 0f 85 92 00 00 00 jne 1d2 <exitiputtest+0xe1> if (mkdir("iputdir") < 0) { 140: 83 ec 0c sub $0xc,%esp 143: 68 65 44 00 00 push $0x4465 148: e8 ea 3d 00 00 call 3f37 <mkdir> 14d: 83 c4 10 add $0x10,%esp 150: 85 c0 test %eax,%eax 152: 79 1b jns 16f <exitiputtest+0x7e> printf(stdout, "mkdir failed\n"); 154: a1 00 63 00 00 mov 0x6300,%eax 159: 83 ec 08 sub $0x8,%esp 15c: 68 6d 44 00 00 push $0x446d 161: 50 push %eax 162: e8 27 3f 00 00 call 408e <printf> 167: 83 c4 10 add $0x10,%esp exit(); 16a: e8 60 3d 00 00 call 3ecf <exit> } if (chdir("iputdir") < 0) { 16f: 83 ec 0c sub $0xc,%esp 172: 68 65 44 00 00 push $0x4465 177: e8 c3 3d 00 00 call 3f3f <chdir> 17c: 83 c4 10 add $0x10,%esp 17f: 85 c0 test %eax,%eax 181: 79 1b jns 19e <exitiputtest+0xad> printf(stdout, "child chdir failed\n"); 183: a1 00 63 00 00 mov 0x6300,%eax 188: 83 ec 08 sub $0x8,%esp 18b: 68 f2 44 00 00 push $0x44f2 190: 50 push %eax 191: e8 f8 3e 00 00 call 408e <printf> 196: 83 c4 10 add $0x10,%esp exit(); 199: e8 31 3d 00 00 call 3ecf <exit> } if (unlink("../iputdir") < 0) { 19e: 83 ec 0c sub $0xc,%esp 1a1: 68 91 44 00 00 push $0x4491 1a6: e8 74 3d 00 00 call 3f1f <unlink> 1ab: 83 c4 10 add $0x10,%esp 1ae: 85 c0 test %eax,%eax 1b0: 79 1b jns 1cd <exitiputtest+0xdc> printf(stdout, "unlink ../iputdir failed\n"); 1b2: a1 00 63 00 00 mov 0x6300,%eax 1b7: 83 ec 08 sub $0x8,%esp 1ba: 68 9c 44 00 00 push $0x449c 1bf: 50 push %eax 1c0: e8 c9 3e 00 00 call 408e <printf> 1c5: 83 c4 10 add $0x10,%esp exit(); 1c8: e8 02 3d 00 00 call 3ecf <exit> } exit(); 1cd: e8 fd 3c 00 00 call 3ecf <exit> } wait(); 1d2: e8 00 3d 00 00 call 3ed7 <wait> printf(stdout, "exitiput test ok\n"); 1d7: a1 00 63 00 00 mov 0x6300,%eax 1dc: 83 ec 08 sub $0x8,%esp 1df: 68 06 45 00 00 push $0x4506 1e4: 50 push %eax 1e5: e8 a4 3e 00 00 call 408e <printf> 1ea: 83 c4 10 add $0x10,%esp } 1ed: 90 nop 1ee: c9 leave 1ef: c3 ret 000001f0 <openiputtest>: // int i; // for(i = 0; i < 10000; i++) // yield(); // } void openiputtest(void) { 1f0: 55 push %ebp 1f1: 89 e5 mov %esp,%ebp 1f3: 83 ec 18 sub $0x18,%esp int pid; printf(stdout, "openiput test\n"); 1f6: a1 00 63 00 00 mov 0x6300,%eax 1fb: 83 ec 08 sub $0x8,%esp 1fe: 68 18 45 00 00 push $0x4518 203: 50 push %eax 204: e8 85 3e 00 00 call 408e <printf> 209: 83 c4 10 add $0x10,%esp if (mkdir("oidir") < 0) { 20c: 83 ec 0c sub $0xc,%esp 20f: 68 27 45 00 00 push $0x4527 214: e8 1e 3d 00 00 call 3f37 <mkdir> 219: 83 c4 10 add $0x10,%esp 21c: 85 c0 test %eax,%eax 21e: 79 1b jns 23b <openiputtest+0x4b> printf(stdout, "mkdir oidir failed\n"); 220: a1 00 63 00 00 mov 0x6300,%eax 225: 83 ec 08 sub $0x8,%esp 228: 68 2d 45 00 00 push $0x452d 22d: 50 push %eax 22e: e8 5b 3e 00 00 call 408e <printf> 233: 83 c4 10 add $0x10,%esp exit(); 236: e8 94 3c 00 00 call 3ecf <exit> } pid = fork(); 23b: e8 87 3c 00 00 call 3ec7 <fork> 240: 89 45 f4 mov %eax,-0xc(%ebp) if (pid < 0) { 243: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 247: 79 1b jns 264 <openiputtest+0x74> printf(stdout, "fork failed\n"); 249: a1 00 63 00 00 mov 0x6300,%eax 24e: 83 ec 08 sub $0x8,%esp 251: 68 e5 44 00 00 push $0x44e5 256: 50 push %eax 257: e8 32 3e 00 00 call 408e <printf> 25c: 83 c4 10 add $0x10,%esp exit(); 25f: e8 6b 3c 00 00 call 3ecf <exit> } if (pid == 0) { 264: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 268: 75 3b jne 2a5 <openiputtest+0xb5> int fd = open("oidir", O_RDWR); 26a: 83 ec 08 sub $0x8,%esp 26d: 6a 02 push $0x2 26f: 68 27 45 00 00 push $0x4527 274: e8 96 3c 00 00 call 3f0f <open> 279: 83 c4 10 add $0x10,%esp 27c: 89 45 f0 mov %eax,-0x10(%ebp) if (fd >= 0) { 27f: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 283: 78 1b js 2a0 <openiputtest+0xb0> printf(stdout, "open directory for write succeeded\n"); 285: a1 00 63 00 00 mov 0x6300,%eax 28a: 83 ec 08 sub $0x8,%esp 28d: 68 44 45 00 00 push $0x4544 292: 50 push %eax 293: e8 f6 3d 00 00 call 408e <printf> 298: 83 c4 10 add $0x10,%esp exit(); 29b: e8 2f 3c 00 00 call 3ecf <exit> } exit(); 2a0: e8 2a 3c 00 00 call 3ecf <exit> } sleep(1); 2a5: 83 ec 0c sub $0xc,%esp 2a8: 6a 01 push $0x1 2aa: e8 b0 3c 00 00 call 3f5f <sleep> 2af: 83 c4 10 add $0x10,%esp if (unlink("oidir") != 0) { 2b2: 83 ec 0c sub $0xc,%esp 2b5: 68 27 45 00 00 push $0x4527 2ba: e8 60 3c 00 00 call 3f1f <unlink> 2bf: 83 c4 10 add $0x10,%esp 2c2: 85 c0 test %eax,%eax 2c4: 74 1b je 2e1 <openiputtest+0xf1> printf(stdout, "unlink failed\n"); 2c6: a1 00 63 00 00 mov 0x6300,%eax 2cb: 83 ec 08 sub $0x8,%esp 2ce: 68 68 45 00 00 push $0x4568 2d3: 50 push %eax 2d4: e8 b5 3d 00 00 call 408e <printf> 2d9: 83 c4 10 add $0x10,%esp exit(); 2dc: e8 ee 3b 00 00 call 3ecf <exit> } wait(); 2e1: e8 f1 3b 00 00 call 3ed7 <wait> printf(stdout, "openiput test ok\n"); 2e6: a1 00 63 00 00 mov 0x6300,%eax 2eb: 83 ec 08 sub $0x8,%esp 2ee: 68 77 45 00 00 push $0x4577 2f3: 50 push %eax 2f4: e8 95 3d 00 00 call 408e <printf> 2f9: 83 c4 10 add $0x10,%esp } 2fc: 90 nop 2fd: c9 leave 2fe: c3 ret 000002ff <opentest>: // simple file system tests void opentest(void) { 2ff: 55 push %ebp 300: 89 e5 mov %esp,%ebp 302: 83 ec 18 sub $0x18,%esp int fd; printf(stdout, "open test\n"); 305: a1 00 63 00 00 mov 0x6300,%eax 30a: 83 ec 08 sub $0x8,%esp 30d: 68 89 45 00 00 push $0x4589 312: 50 push %eax 313: e8 76 3d 00 00 call 408e <printf> 318: 83 c4 10 add $0x10,%esp fd = open("echo", 0); 31b: 83 ec 08 sub $0x8,%esp 31e: 6a 00 push $0x0 320: 68 44 44 00 00 push $0x4444 325: e8 e5 3b 00 00 call 3f0f <open> 32a: 83 c4 10 add $0x10,%esp 32d: 89 45 f4 mov %eax,-0xc(%ebp) if (fd < 0) { 330: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 334: 79 1b jns 351 <opentest+0x52> printf(stdout, "open echo failed!\n"); 336: a1 00 63 00 00 mov 0x6300,%eax 33b: 83 ec 08 sub $0x8,%esp 33e: 68 94 45 00 00 push $0x4594 343: 50 push %eax 344: e8 45 3d 00 00 call 408e <printf> 349: 83 c4 10 add $0x10,%esp exit(); 34c: e8 7e 3b 00 00 call 3ecf <exit> } close(fd); 351: 83 ec 0c sub $0xc,%esp 354: ff 75 f4 pushl -0xc(%ebp) 357: e8 9b 3b 00 00 call 3ef7 <close> 35c: 83 c4 10 add $0x10,%esp fd = open("doesnotexist", 0); 35f: 83 ec 08 sub $0x8,%esp 362: 6a 00 push $0x0 364: 68 a7 45 00 00 push $0x45a7 369: e8 a1 3b 00 00 call 3f0f <open> 36e: 83 c4 10 add $0x10,%esp 371: 89 45 f4 mov %eax,-0xc(%ebp) if (fd >= 0) { 374: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 378: 78 1b js 395 <opentest+0x96> printf(stdout, "open doesnotexist succeeded!\n"); 37a: a1 00 63 00 00 mov 0x6300,%eax 37f: 83 ec 08 sub $0x8,%esp 382: 68 b4 45 00 00 push $0x45b4 387: 50 push %eax 388: e8 01 3d 00 00 call 408e <printf> 38d: 83 c4 10 add $0x10,%esp exit(); 390: e8 3a 3b 00 00 call 3ecf <exit> } printf(stdout, "open test ok\n"); 395: a1 00 63 00 00 mov 0x6300,%eax 39a: 83 ec 08 sub $0x8,%esp 39d: 68 d2 45 00 00 push $0x45d2 3a2: 50 push %eax 3a3: e8 e6 3c 00 00 call 408e <printf> 3a8: 83 c4 10 add $0x10,%esp } 3ab: 90 nop 3ac: c9 leave 3ad: c3 ret 000003ae <writetest>: void writetest(void) { 3ae: 55 push %ebp 3af: 89 e5 mov %esp,%ebp 3b1: 83 ec 18 sub $0x18,%esp int fd; int i; printf(stdout, "small file test\n"); 3b4: a1 00 63 00 00 mov 0x6300,%eax 3b9: 83 ec 08 sub $0x8,%esp 3bc: 68 e0 45 00 00 push $0x45e0 3c1: 50 push %eax 3c2: e8 c7 3c 00 00 call 408e <printf> 3c7: 83 c4 10 add $0x10,%esp fd = open("small", O_CREATE | O_RDWR); 3ca: 83 ec 08 sub $0x8,%esp 3cd: 68 02 02 00 00 push $0x202 3d2: 68 f1 45 00 00 push $0x45f1 3d7: e8 33 3b 00 00 call 3f0f <open> 3dc: 83 c4 10 add $0x10,%esp 3df: 89 45 f0 mov %eax,-0x10(%ebp) if (fd >= 0) { 3e2: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 3e6: 78 22 js 40a <writetest+0x5c> printf(stdout, "creat small succeeded; ok\n"); 3e8: a1 00 63 00 00 mov 0x6300,%eax 3ed: 83 ec 08 sub $0x8,%esp 3f0: 68 f7 45 00 00 push $0x45f7 3f5: 50 push %eax 3f6: e8 93 3c 00 00 call 408e <printf> 3fb: 83 c4 10 add $0x10,%esp } else { printf(stdout, "error: creat small failed!\n"); exit(); } for (i = 0; i < 100; i++) { 3fe: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 405: e9 8f 00 00 00 jmp 499 <writetest+0xeb> printf(stdout, "small file test\n"); fd = open("small", O_CREATE | O_RDWR); if (fd >= 0) { printf(stdout, "creat small succeeded; ok\n"); } else { printf(stdout, "error: creat small failed!\n"); 40a: a1 00 63 00 00 mov 0x6300,%eax 40f: 83 ec 08 sub $0x8,%esp 412: 68 12 46 00 00 push $0x4612 417: 50 push %eax 418: e8 71 3c 00 00 call 408e <printf> 41d: 83 c4 10 add $0x10,%esp exit(); 420: e8 aa 3a 00 00 call 3ecf <exit> } for (i = 0; i < 100; i++) { if (write(fd, "aaaaaaaaaa", 10) != 10) { 425: 83 ec 04 sub $0x4,%esp 428: 6a 0a push $0xa 42a: 68 2e 46 00 00 push $0x462e 42f: ff 75 f0 pushl -0x10(%ebp) 432: e8 b8 3a 00 00 call 3eef <write> 437: 83 c4 10 add $0x10,%esp 43a: 83 f8 0a cmp $0xa,%eax 43d: 74 1e je 45d <writetest+0xaf> printf(stdout, "error: write aa %d new file failed\n", 43f: a1 00 63 00 00 mov 0x6300,%eax 444: 83 ec 04 sub $0x4,%esp 447: ff 75 f4 pushl -0xc(%ebp) 44a: 68 3c 46 00 00 push $0x463c 44f: 50 push %eax 450: e8 39 3c 00 00 call 408e <printf> 455: 83 c4 10 add $0x10,%esp i); exit(); 458: e8 72 3a 00 00 call 3ecf <exit> } if (write(fd, "bbbbbbbbbb", 10) != 10) { 45d: 83 ec 04 sub $0x4,%esp 460: 6a 0a push $0xa 462: 68 60 46 00 00 push $0x4660 467: ff 75 f0 pushl -0x10(%ebp) 46a: e8 80 3a 00 00 call 3eef <write> 46f: 83 c4 10 add $0x10,%esp 472: 83 f8 0a cmp $0xa,%eax 475: 74 1e je 495 <writetest+0xe7> printf(stdout, "error: write bb %d new file failed\n", 477: a1 00 63 00 00 mov 0x6300,%eax 47c: 83 ec 04 sub $0x4,%esp 47f: ff 75 f4 pushl -0xc(%ebp) 482: 68 6c 46 00 00 push $0x466c 487: 50 push %eax 488: e8 01 3c 00 00 call 408e <printf> 48d: 83 c4 10 add $0x10,%esp i); exit(); 490: e8 3a 3a 00 00 call 3ecf <exit> printf(stdout, "creat small succeeded; ok\n"); } else { printf(stdout, "error: creat small failed!\n"); exit(); } for (i = 0; i < 100; i++) { 495: 83 45 f4 01 addl $0x1,-0xc(%ebp) 499: 83 7d f4 63 cmpl $0x63,-0xc(%ebp) 49d: 7e 86 jle 425 <writetest+0x77> printf(stdout, "error: write bb %d new file failed\n", i); exit(); } } printf(stdout, "writes ok\n"); 49f: a1 00 63 00 00 mov 0x6300,%eax 4a4: 83 ec 08 sub $0x8,%esp 4a7: 68 90 46 00 00 push $0x4690 4ac: 50 push %eax 4ad: e8 dc 3b 00 00 call 408e <printf> 4b2: 83 c4 10 add $0x10,%esp close(fd); 4b5: 83 ec 0c sub $0xc,%esp 4b8: ff 75 f0 pushl -0x10(%ebp) 4bb: e8 37 3a 00 00 call 3ef7 <close> 4c0: 83 c4 10 add $0x10,%esp fd = open("small", O_RDONLY); 4c3: 83 ec 08 sub $0x8,%esp 4c6: 6a 00 push $0x0 4c8: 68 f1 45 00 00 push $0x45f1 4cd: e8 3d 3a 00 00 call 3f0f <open> 4d2: 83 c4 10 add $0x10,%esp 4d5: 89 45 f0 mov %eax,-0x10(%ebp) if (fd >= 0) { 4d8: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 4dc: 78 3c js 51a <writetest+0x16c> printf(stdout, "open small succeeded ok\n"); 4de: a1 00 63 00 00 mov 0x6300,%eax 4e3: 83 ec 08 sub $0x8,%esp 4e6: 68 9b 46 00 00 push $0x469b 4eb: 50 push %eax 4ec: e8 9d 3b 00 00 call 408e <printf> 4f1: 83 c4 10 add $0x10,%esp } else { printf(stdout, "error: open small failed!\n"); exit(); } i = read(fd, buf, 2000); 4f4: 83 ec 04 sub $0x4,%esp 4f7: 68 d0 07 00 00 push $0x7d0 4fc: 68 e0 8a 00 00 push $0x8ae0 501: ff 75 f0 pushl -0x10(%ebp) 504: e8 de 39 00 00 call 3ee7 <read> 509: 83 c4 10 add $0x10,%esp 50c: 89 45 f4 mov %eax,-0xc(%ebp) if (i == 2000) { 50f: 81 7d f4 d0 07 00 00 cmpl $0x7d0,-0xc(%ebp) 516: 75 57 jne 56f <writetest+0x1c1> 518: eb 1b jmp 535 <writetest+0x187> close(fd); fd = open("small", O_RDONLY); if (fd >= 0) { printf(stdout, "open small succeeded ok\n"); } else { printf(stdout, "error: open small failed!\n"); 51a: a1 00 63 00 00 mov 0x6300,%eax 51f: 83 ec 08 sub $0x8,%esp 522: 68 b4 46 00 00 push $0x46b4 527: 50 push %eax 528: e8 61 3b 00 00 call 408e <printf> 52d: 83 c4 10 add $0x10,%esp exit(); 530: e8 9a 39 00 00 call 3ecf <exit> } i = read(fd, buf, 2000); if (i == 2000) { printf(stdout, "read succeeded ok\n"); 535: a1 00 63 00 00 mov 0x6300,%eax 53a: 83 ec 08 sub $0x8,%esp 53d: 68 cf 46 00 00 push $0x46cf 542: 50 push %eax 543: e8 46 3b 00 00 call 408e <printf> 548: 83 c4 10 add $0x10,%esp } else { printf(stdout, "read failed\n"); exit(); } close(fd); 54b: 83 ec 0c sub $0xc,%esp 54e: ff 75 f0 pushl -0x10(%ebp) 551: e8 a1 39 00 00 call 3ef7 <close> 556: 83 c4 10 add $0x10,%esp if (unlink("small") < 0) { 559: 83 ec 0c sub $0xc,%esp 55c: 68 f1 45 00 00 push $0x45f1 561: e8 b9 39 00 00 call 3f1f <unlink> 566: 83 c4 10 add $0x10,%esp 569: 85 c0 test %eax,%eax 56b: 79 38 jns 5a5 <writetest+0x1f7> 56d: eb 1b jmp 58a <writetest+0x1dc> } i = read(fd, buf, 2000); if (i == 2000) { printf(stdout, "read succeeded ok\n"); } else { printf(stdout, "read failed\n"); 56f: a1 00 63 00 00 mov 0x6300,%eax 574: 83 ec 08 sub $0x8,%esp 577: 68 e2 46 00 00 push $0x46e2 57c: 50 push %eax 57d: e8 0c 3b 00 00 call 408e <printf> 582: 83 c4 10 add $0x10,%esp exit(); 585: e8 45 39 00 00 call 3ecf <exit> } close(fd); if (unlink("small") < 0) { printf(stdout, "unlink small failed\n"); 58a: a1 00 63 00 00 mov 0x6300,%eax 58f: 83 ec 08 sub $0x8,%esp 592: 68 ef 46 00 00 push $0x46ef 597: 50 push %eax 598: e8 f1 3a 00 00 call 408e <printf> 59d: 83 c4 10 add $0x10,%esp exit(); 5a0: e8 2a 39 00 00 call 3ecf <exit> } printf(stdout, "small file test ok\n"); 5a5: a1 00 63 00 00 mov 0x6300,%eax 5aa: 83 ec 08 sub $0x8,%esp 5ad: 68 04 47 00 00 push $0x4704 5b2: 50 push %eax 5b3: e8 d6 3a 00 00 call 408e <printf> 5b8: 83 c4 10 add $0x10,%esp } 5bb: 90 nop 5bc: c9 leave 5bd: c3 ret 000005be <writetest1>: void writetest1(void) { 5be: 55 push %ebp 5bf: 89 e5 mov %esp,%ebp 5c1: 83 ec 18 sub $0x18,%esp int i, fd, n; printf(stdout, "big files test\n"); 5c4: a1 00 63 00 00 mov 0x6300,%eax 5c9: 83 ec 08 sub $0x8,%esp 5cc: 68 18 47 00 00 push $0x4718 5d1: 50 push %eax 5d2: e8 b7 3a 00 00 call 408e <printf> 5d7: 83 c4 10 add $0x10,%esp fd = open("big", O_CREATE | O_RDWR); 5da: 83 ec 08 sub $0x8,%esp 5dd: 68 02 02 00 00 push $0x202 5e2: 68 28 47 00 00 push $0x4728 5e7: e8 23 39 00 00 call 3f0f <open> 5ec: 83 c4 10 add $0x10,%esp 5ef: 89 45 ec mov %eax,-0x14(%ebp) if (fd < 0) { 5f2: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 5f6: 79 1b jns 613 <writetest1+0x55> printf(stdout, "error: creat big failed!\n"); 5f8: a1 00 63 00 00 mov 0x6300,%eax 5fd: 83 ec 08 sub $0x8,%esp 600: 68 2c 47 00 00 push $0x472c 605: 50 push %eax 606: e8 83 3a 00 00 call 408e <printf> 60b: 83 c4 10 add $0x10,%esp exit(); 60e: e8 bc 38 00 00 call 3ecf <exit> } for (i = 0; i < MAXFILE; i++) { 613: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 61a: eb 4b jmp 667 <writetest1+0xa9> ((int *)buf)[0] = i; 61c: ba e0 8a 00 00 mov $0x8ae0,%edx 621: 8b 45 f4 mov -0xc(%ebp),%eax 624: 89 02 mov %eax,(%edx) if (write(fd, buf, 512) != 512) { 626: 83 ec 04 sub $0x4,%esp 629: 68 00 02 00 00 push $0x200 62e: 68 e0 8a 00 00 push $0x8ae0 633: ff 75 ec pushl -0x14(%ebp) 636: e8 b4 38 00 00 call 3eef <write> 63b: 83 c4 10 add $0x10,%esp 63e: 3d 00 02 00 00 cmp $0x200,%eax 643: 74 1e je 663 <writetest1+0xa5> printf(stdout, "error: write big file failed\n", i); 645: a1 00 63 00 00 mov 0x6300,%eax 64a: 83 ec 04 sub $0x4,%esp 64d: ff 75 f4 pushl -0xc(%ebp) 650: 68 46 47 00 00 push $0x4746 655: 50 push %eax 656: e8 33 3a 00 00 call 408e <printf> 65b: 83 c4 10 add $0x10,%esp exit(); 65e: e8 6c 38 00 00 call 3ecf <exit> if (fd < 0) { printf(stdout, "error: creat big failed!\n"); exit(); } for (i = 0; i < MAXFILE; i++) { 663: 83 45 f4 01 addl $0x1,-0xc(%ebp) 667: 8b 45 f4 mov -0xc(%ebp),%eax 66a: 3d 8b 00 00 00 cmp $0x8b,%eax 66f: 76 ab jbe 61c <writetest1+0x5e> printf(stdout, "error: write big file failed\n", i); exit(); } } close(fd); 671: 83 ec 0c sub $0xc,%esp 674: ff 75 ec pushl -0x14(%ebp) 677: e8 7b 38 00 00 call 3ef7 <close> 67c: 83 c4 10 add $0x10,%esp fd = open("big", O_RDONLY); 67f: 83 ec 08 sub $0x8,%esp 682: 6a 00 push $0x0 684: 68 28 47 00 00 push $0x4728 689: e8 81 38 00 00 call 3f0f <open> 68e: 83 c4 10 add $0x10,%esp 691: 89 45 ec mov %eax,-0x14(%ebp) if (fd < 0) { 694: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 698: 79 1b jns 6b5 <writetest1+0xf7> printf(stdout, "error: open big failed!\n"); 69a: a1 00 63 00 00 mov 0x6300,%eax 69f: 83 ec 08 sub $0x8,%esp 6a2: 68 64 47 00 00 push $0x4764 6a7: 50 push %eax 6a8: e8 e1 39 00 00 call 408e <printf> 6ad: 83 c4 10 add $0x10,%esp exit(); 6b0: e8 1a 38 00 00 call 3ecf <exit> } n = 0; 6b5: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp) for (;;) { i = read(fd, buf, 512); 6bc: 83 ec 04 sub $0x4,%esp 6bf: 68 00 02 00 00 push $0x200 6c4: 68 e0 8a 00 00 push $0x8ae0 6c9: ff 75 ec pushl -0x14(%ebp) 6cc: e8 16 38 00 00 call 3ee7 <read> 6d1: 83 c4 10 add $0x10,%esp 6d4: 89 45 f4 mov %eax,-0xc(%ebp) if (i == 0) { 6d7: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 6db: 75 27 jne 704 <writetest1+0x146> if (n == MAXFILE - 1) { 6dd: 81 7d f0 8b 00 00 00 cmpl $0x8b,-0x10(%ebp) 6e4: 75 7d jne 763 <writetest1+0x1a5> printf(stdout, "read only %d blocks from big", 6e6: a1 00 63 00 00 mov 0x6300,%eax 6eb: 83 ec 04 sub $0x4,%esp 6ee: ff 75 f0 pushl -0x10(%ebp) 6f1: 68 7d 47 00 00 push $0x477d 6f6: 50 push %eax 6f7: e8 92 39 00 00 call 408e <printf> 6fc: 83 c4 10 add $0x10,%esp n); exit(); 6ff: e8 cb 37 00 00 call 3ecf <exit> } break; } else if (i != 512) { 704: 81 7d f4 00 02 00 00 cmpl $0x200,-0xc(%ebp) 70b: 74 1e je 72b <writetest1+0x16d> printf(stdout, "read failed %d\n", i); 70d: a1 00 63 00 00 mov 0x6300,%eax 712: 83 ec 04 sub $0x4,%esp 715: ff 75 f4 pushl -0xc(%ebp) 718: 68 9a 47 00 00 push $0x479a 71d: 50 push %eax 71e: e8 6b 39 00 00 call 408e <printf> 723: 83 c4 10 add $0x10,%esp exit(); 726: e8 a4 37 00 00 call 3ecf <exit> } if (((int *)buf)[0] != n) { 72b: b8 e0 8a 00 00 mov $0x8ae0,%eax 730: 8b 00 mov (%eax),%eax 732: 3b 45 f0 cmp -0x10(%ebp),%eax 735: 74 23 je 75a <writetest1+0x19c> printf(stdout, "read content of block %d is %d\n", n, ((int *)buf)[0]); 737: b8 e0 8a 00 00 mov $0x8ae0,%eax } else if (i != 512) { printf(stdout, "read failed %d\n", i); exit(); } if (((int *)buf)[0] != n) { printf(stdout, "read content of block %d is %d\n", 73c: 8b 10 mov (%eax),%edx 73e: a1 00 63 00 00 mov 0x6300,%eax 743: 52 push %edx 744: ff 75 f0 pushl -0x10(%ebp) 747: 68 ac 47 00 00 push $0x47ac 74c: 50 push %eax 74d: e8 3c 39 00 00 call 408e <printf> 752: 83 c4 10 add $0x10,%esp n, ((int *)buf)[0]); exit(); 755: e8 75 37 00 00 call 3ecf <exit> } n++; 75a: 83 45 f0 01 addl $0x1,-0x10(%ebp) } 75e: e9 59 ff ff ff jmp 6bc <writetest1+0xfe> if (n == MAXFILE - 1) { printf(stdout, "read only %d blocks from big", n); exit(); } break; 763: 90 nop n, ((int *)buf)[0]); exit(); } n++; } close(fd); 764: 83 ec 0c sub $0xc,%esp 767: ff 75 ec pushl -0x14(%ebp) 76a: e8 88 37 00 00 call 3ef7 <close> 76f: 83 c4 10 add $0x10,%esp if (unlink("big") < 0) { 772: 83 ec 0c sub $0xc,%esp 775: 68 28 47 00 00 push $0x4728 77a: e8 a0 37 00 00 call 3f1f <unlink> 77f: 83 c4 10 add $0x10,%esp 782: 85 c0 test %eax,%eax 784: 79 1b jns 7a1 <writetest1+0x1e3> printf(stdout, "unlink big failed\n"); 786: a1 00 63 00 00 mov 0x6300,%eax 78b: 83 ec 08 sub $0x8,%esp 78e: 68 cc 47 00 00 push $0x47cc 793: 50 push %eax 794: e8 f5 38 00 00 call 408e <printf> 799: 83 c4 10 add $0x10,%esp exit(); 79c: e8 2e 37 00 00 call 3ecf <exit> } printf(stdout, "big files ok\n"); 7a1: a1 00 63 00 00 mov 0x6300,%eax 7a6: 83 ec 08 sub $0x8,%esp 7a9: 68 df 47 00 00 push $0x47df 7ae: 50 push %eax 7af: e8 da 38 00 00 call 408e <printf> 7b4: 83 c4 10 add $0x10,%esp } 7b7: 90 nop 7b8: c9 leave 7b9: c3 ret 000007ba <createtest>: void createtest(void) { 7ba: 55 push %ebp 7bb: 89 e5 mov %esp,%ebp 7bd: 83 ec 18 sub $0x18,%esp int i, fd; printf(stdout, "many creates, followed by unlink test\n"); 7c0: a1 00 63 00 00 mov 0x6300,%eax 7c5: 83 ec 08 sub $0x8,%esp 7c8: 68 f0 47 00 00 push $0x47f0 7cd: 50 push %eax 7ce: e8 bb 38 00 00 call 408e <printf> 7d3: 83 c4 10 add $0x10,%esp name[0] = 'a'; 7d6: c6 05 e0 aa 00 00 61 movb $0x61,0xaae0 name[2] = '\0'; 7dd: c6 05 e2 aa 00 00 00 movb $0x0,0xaae2 for (i = 0; i < 52; i++) { 7e4: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 7eb: eb 35 jmp 822 <createtest+0x68> name[1] = '0' + i; 7ed: 8b 45 f4 mov -0xc(%ebp),%eax 7f0: 83 c0 30 add $0x30,%eax 7f3: a2 e1 aa 00 00 mov %al,0xaae1 fd = open(name, O_CREATE | O_RDWR); 7f8: 83 ec 08 sub $0x8,%esp 7fb: 68 02 02 00 00 push $0x202 800: 68 e0 aa 00 00 push $0xaae0 805: e8 05 37 00 00 call 3f0f <open> 80a: 83 c4 10 add $0x10,%esp 80d: 89 45 f0 mov %eax,-0x10(%ebp) close(fd); 810: 83 ec 0c sub $0xc,%esp 813: ff 75 f0 pushl -0x10(%ebp) 816: e8 dc 36 00 00 call 3ef7 <close> 81b: 83 c4 10 add $0x10,%esp printf(stdout, "many creates, followed by unlink test\n"); name[0] = 'a'; name[2] = '\0'; for (i = 0; i < 52; i++) { 81e: 83 45 f4 01 addl $0x1,-0xc(%ebp) 822: 83 7d f4 33 cmpl $0x33,-0xc(%ebp) 826: 7e c5 jle 7ed <createtest+0x33> name[1] = '0' + i; fd = open(name, O_CREATE | O_RDWR); close(fd); } name[0] = 'a'; 828: c6 05 e0 aa 00 00 61 movb $0x61,0xaae0 name[2] = '\0'; 82f: c6 05 e2 aa 00 00 00 movb $0x0,0xaae2 for (i = 0; i < 52; i++) { 836: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 83d: eb 1f jmp 85e <createtest+0xa4> name[1] = '0' + i; 83f: 8b 45 f4 mov -0xc(%ebp),%eax 842: 83 c0 30 add $0x30,%eax 845: a2 e1 aa 00 00 mov %al,0xaae1 unlink(name); 84a: 83 ec 0c sub $0xc,%esp 84d: 68 e0 aa 00 00 push $0xaae0 852: e8 c8 36 00 00 call 3f1f <unlink> 857: 83 c4 10 add $0x10,%esp fd = open(name, O_CREATE | O_RDWR); close(fd); } name[0] = 'a'; name[2] = '\0'; for (i = 0; i < 52; i++) { 85a: 83 45 f4 01 addl $0x1,-0xc(%ebp) 85e: 83 7d f4 33 cmpl $0x33,-0xc(%ebp) 862: 7e db jle 83f <createtest+0x85> name[1] = '0' + i; unlink(name); } printf(stdout, "many creates, followed by unlink; ok\n"); 864: a1 00 63 00 00 mov 0x6300,%eax 869: 83 ec 08 sub $0x8,%esp 86c: 68 18 48 00 00 push $0x4818 871: 50 push %eax 872: e8 17 38 00 00 call 408e <printf> 877: 83 c4 10 add $0x10,%esp } 87a: 90 nop 87b: c9 leave 87c: c3 ret 0000087d <dirtest>: void dirtest(void) { 87d: 55 push %ebp 87e: 89 e5 mov %esp,%ebp 880: 83 ec 08 sub $0x8,%esp printf(stdout, "mkdir test\n"); 883: a1 00 63 00 00 mov 0x6300,%eax 888: 83 ec 08 sub $0x8,%esp 88b: 68 3e 48 00 00 push $0x483e 890: 50 push %eax 891: e8 f8 37 00 00 call 408e <printf> 896: 83 c4 10 add $0x10,%esp if (mkdir("dir0") < 0) { 899: 83 ec 0c sub $0xc,%esp 89c: 68 4a 48 00 00 push $0x484a 8a1: e8 91 36 00 00 call 3f37 <mkdir> 8a6: 83 c4 10 add $0x10,%esp 8a9: 85 c0 test %eax,%eax 8ab: 79 1b jns 8c8 <dirtest+0x4b> printf(stdout, "mkdir failed\n"); 8ad: a1 00 63 00 00 mov 0x6300,%eax 8b2: 83 ec 08 sub $0x8,%esp 8b5: 68 6d 44 00 00 push $0x446d 8ba: 50 push %eax 8bb: e8 ce 37 00 00 call 408e <printf> 8c0: 83 c4 10 add $0x10,%esp exit(); 8c3: e8 07 36 00 00 call 3ecf <exit> } if (chdir("dir0") < 0) { 8c8: 83 ec 0c sub $0xc,%esp 8cb: 68 4a 48 00 00 push $0x484a 8d0: e8 6a 36 00 00 call 3f3f <chdir> 8d5: 83 c4 10 add $0x10,%esp 8d8: 85 c0 test %eax,%eax 8da: 79 1b jns 8f7 <dirtest+0x7a> printf(stdout, "chdir dir0 failed\n"); 8dc: a1 00 63 00 00 mov 0x6300,%eax 8e1: 83 ec 08 sub $0x8,%esp 8e4: 68 4f 48 00 00 push $0x484f 8e9: 50 push %eax 8ea: e8 9f 37 00 00 call 408e <printf> 8ef: 83 c4 10 add $0x10,%esp exit(); 8f2: e8 d8 35 00 00 call 3ecf <exit> } if (chdir("..") < 0) { 8f7: 83 ec 0c sub $0xc,%esp 8fa: 68 62 48 00 00 push $0x4862 8ff: e8 3b 36 00 00 call 3f3f <chdir> 904: 83 c4 10 add $0x10,%esp 907: 85 c0 test %eax,%eax 909: 79 1b jns 926 <dirtest+0xa9> printf(stdout, "chdir .. failed\n"); 90b: a1 00 63 00 00 mov 0x6300,%eax 910: 83 ec 08 sub $0x8,%esp 913: 68 65 48 00 00 push $0x4865 918: 50 push %eax 919: e8 70 37 00 00 call 408e <printf> 91e: 83 c4 10 add $0x10,%esp exit(); 921: e8 a9 35 00 00 call 3ecf <exit> } if (unlink("dir0") < 0) { 926: 83 ec 0c sub $0xc,%esp 929: 68 4a 48 00 00 push $0x484a 92e: e8 ec 35 00 00 call 3f1f <unlink> 933: 83 c4 10 add $0x10,%esp 936: 85 c0 test %eax,%eax 938: 79 1b jns 955 <dirtest+0xd8> printf(stdout, "unlink dir0 failed\n"); 93a: a1 00 63 00 00 mov 0x6300,%eax 93f: 83 ec 08 sub $0x8,%esp 942: 68 76 48 00 00 push $0x4876 947: 50 push %eax 948: e8 41 37 00 00 call 408e <printf> 94d: 83 c4 10 add $0x10,%esp exit(); 950: e8 7a 35 00 00 call 3ecf <exit> } printf(stdout, "mkdir test ok\n"); 955: a1 00 63 00 00 mov 0x6300,%eax 95a: 83 ec 08 sub $0x8,%esp 95d: 68 8a 48 00 00 push $0x488a 962: 50 push %eax 963: e8 26 37 00 00 call 408e <printf> 968: 83 c4 10 add $0x10,%esp } 96b: 90 nop 96c: c9 leave 96d: c3 ret 0000096e <exectest>: void exectest(void) { 96e: 55 push %ebp 96f: 89 e5 mov %esp,%ebp 971: 83 ec 08 sub $0x8,%esp printf(stdout, "exec test\n"); 974: a1 00 63 00 00 mov 0x6300,%eax 979: 83 ec 08 sub $0x8,%esp 97c: 68 99 48 00 00 push $0x4899 981: 50 push %eax 982: e8 07 37 00 00 call 408e <printf> 987: 83 c4 10 add $0x10,%esp if (exec("echo", echoargv) < 0) { 98a: 83 ec 08 sub $0x8,%esp 98d: 68 ec 62 00 00 push $0x62ec 992: 68 44 44 00 00 push $0x4444 997: e8 6b 35 00 00 call 3f07 <exec> 99c: 83 c4 10 add $0x10,%esp 99f: 85 c0 test %eax,%eax 9a1: 79 1b jns 9be <exectest+0x50> printf(stdout, "exec echo failed\n"); 9a3: a1 00 63 00 00 mov 0x6300,%eax 9a8: 83 ec 08 sub $0x8,%esp 9ab: 68 a4 48 00 00 push $0x48a4 9b0: 50 push %eax 9b1: e8 d8 36 00 00 call 408e <printf> 9b6: 83 c4 10 add $0x10,%esp exit(); 9b9: e8 11 35 00 00 call 3ecf <exit> } } 9be: 90 nop 9bf: c9 leave 9c0: c3 ret 000009c1 <pipe1>: // simple fork and pipe read/write void pipe1(void) { 9c1: 55 push %ebp 9c2: 89 e5 mov %esp,%ebp 9c4: 83 ec 28 sub $0x28,%esp int fds[2], pid; int seq, i, n, cc, total; if (pipe(fds) != 0) { 9c7: 83 ec 0c sub $0xc,%esp 9ca: 8d 45 d8 lea -0x28(%ebp),%eax 9cd: 50 push %eax 9ce: e8 0c 35 00 00 call 3edf <pipe> 9d3: 83 c4 10 add $0x10,%esp 9d6: 85 c0 test %eax,%eax 9d8: 74 17 je 9f1 <pipe1+0x30> printf(1, "pipe() failed\n"); 9da: 83 ec 08 sub $0x8,%esp 9dd: 68 b6 48 00 00 push $0x48b6 9e2: 6a 01 push $0x1 9e4: e8 a5 36 00 00 call 408e <printf> 9e9: 83 c4 10 add $0x10,%esp exit(); 9ec: e8 de 34 00 00 call 3ecf <exit> } pid = fork(); 9f1: e8 d1 34 00 00 call 3ec7 <fork> 9f6: 89 45 e0 mov %eax,-0x20(%ebp) seq = 0; 9f9: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) if (pid == 0) { a00: 83 7d e0 00 cmpl $0x0,-0x20(%ebp) a04: 0f 85 89 00 00 00 jne a93 <pipe1+0xd2> close(fds[0]); a0a: 8b 45 d8 mov -0x28(%ebp),%eax a0d: 83 ec 0c sub $0xc,%esp a10: 50 push %eax a11: e8 e1 34 00 00 call 3ef7 <close> a16: 83 c4 10 add $0x10,%esp for (n = 0; n < 5; n++) { a19: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp) a20: eb 66 jmp a88 <pipe1+0xc7> for (i = 0; i < 1033; i++) a22: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp) a29: eb 19 jmp a44 <pipe1+0x83> buf[i] = seq++; a2b: 8b 45 f4 mov -0xc(%ebp),%eax a2e: 8d 50 01 lea 0x1(%eax),%edx a31: 89 55 f4 mov %edx,-0xc(%ebp) a34: 89 c2 mov %eax,%edx a36: 8b 45 f0 mov -0x10(%ebp),%eax a39: 05 e0 8a 00 00 add $0x8ae0,%eax a3e: 88 10 mov %dl,(%eax) pid = fork(); seq = 0; if (pid == 0) { close(fds[0]); for (n = 0; n < 5; n++) { for (i = 0; i < 1033; i++) a40: 83 45 f0 01 addl $0x1,-0x10(%ebp) a44: 81 7d f0 08 04 00 00 cmpl $0x408,-0x10(%ebp) a4b: 7e de jle a2b <pipe1+0x6a> buf[i] = seq++; if (write(fds[1], buf, 1033) != 1033) { a4d: 8b 45 dc mov -0x24(%ebp),%eax a50: 83 ec 04 sub $0x4,%esp a53: 68 09 04 00 00 push $0x409 a58: 68 e0 8a 00 00 push $0x8ae0 a5d: 50 push %eax a5e: e8 8c 34 00 00 call 3eef <write> a63: 83 c4 10 add $0x10,%esp a66: 3d 09 04 00 00 cmp $0x409,%eax a6b: 74 17 je a84 <pipe1+0xc3> printf(1, "pipe1 oops 1\n"); a6d: 83 ec 08 sub $0x8,%esp a70: 68 c5 48 00 00 push $0x48c5 a75: 6a 01 push $0x1 a77: e8 12 36 00 00 call 408e <printf> a7c: 83 c4 10 add $0x10,%esp exit(); a7f: e8 4b 34 00 00 call 3ecf <exit> } pid = fork(); seq = 0; if (pid == 0) { close(fds[0]); for (n = 0; n < 5; n++) { a84: 83 45 ec 01 addl $0x1,-0x14(%ebp) a88: 83 7d ec 04 cmpl $0x4,-0x14(%ebp) a8c: 7e 94 jle a22 <pipe1+0x61> if (write(fds[1], buf, 1033) != 1033) { printf(1, "pipe1 oops 1\n"); exit(); } } exit(); a8e: e8 3c 34 00 00 call 3ecf <exit> } else if (pid > 0) { a93: 83 7d e0 00 cmpl $0x0,-0x20(%ebp) a97: 0f 8e f4 00 00 00 jle b91 <pipe1+0x1d0> close(fds[1]); a9d: 8b 45 dc mov -0x24(%ebp),%eax aa0: 83 ec 0c sub $0xc,%esp aa3: 50 push %eax aa4: e8 4e 34 00 00 call 3ef7 <close> aa9: 83 c4 10 add $0x10,%esp total = 0; aac: c7 45 e4 00 00 00 00 movl $0x0,-0x1c(%ebp) cc = 1; ab3: c7 45 e8 01 00 00 00 movl $0x1,-0x18(%ebp) while ((n = read(fds[0], buf, cc)) > 0) { aba: eb 66 jmp b22 <pipe1+0x161> for (i = 0; i < n; i++) { abc: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp) ac3: eb 3b jmp b00 <pipe1+0x13f> if ((buf[i] & 0xff) != (seq++ & 0xff)) { ac5: 8b 45 f0 mov -0x10(%ebp),%eax ac8: 05 e0 8a 00 00 add $0x8ae0,%eax acd: 0f b6 00 movzbl (%eax),%eax ad0: 0f be c8 movsbl %al,%ecx ad3: 8b 45 f4 mov -0xc(%ebp),%eax ad6: 8d 50 01 lea 0x1(%eax),%edx ad9: 89 55 f4 mov %edx,-0xc(%ebp) adc: 31 c8 xor %ecx,%eax ade: 0f b6 c0 movzbl %al,%eax ae1: 85 c0 test %eax,%eax ae3: 74 17 je afc <pipe1+0x13b> printf(1, "pipe1 oops 2\n"); ae5: 83 ec 08 sub $0x8,%esp ae8: 68 d3 48 00 00 push $0x48d3 aed: 6a 01 push $0x1 aef: e8 9a 35 00 00 call 408e <printf> af4: 83 c4 10 add $0x10,%esp af7: e9 ac 00 00 00 jmp ba8 <pipe1+0x1e7> } else if (pid > 0) { close(fds[1]); total = 0; cc = 1; while ((n = read(fds[0], buf, cc)) > 0) { for (i = 0; i < n; i++) { afc: 83 45 f0 01 addl $0x1,-0x10(%ebp) b00: 8b 45 f0 mov -0x10(%ebp),%eax b03: 3b 45 ec cmp -0x14(%ebp),%eax b06: 7c bd jl ac5 <pipe1+0x104> if ((buf[i] & 0xff) != (seq++ & 0xff)) { printf(1, "pipe1 oops 2\n"); return; } } total += n; b08: 8b 45 ec mov -0x14(%ebp),%eax b0b: 01 45 e4 add %eax,-0x1c(%ebp) cc = cc * 2; b0e: d1 65 e8 shll -0x18(%ebp) if (cc > sizeof(buf)) b11: 8b 45 e8 mov -0x18(%ebp),%eax b14: 3d 00 20 00 00 cmp $0x2000,%eax b19: 76 07 jbe b22 <pipe1+0x161> cc = sizeof(buf); b1b: c7 45 e8 00 20 00 00 movl $0x2000,-0x18(%ebp) exit(); } else if (pid > 0) { close(fds[1]); total = 0; cc = 1; while ((n = read(fds[0], buf, cc)) > 0) { b22: 8b 45 d8 mov -0x28(%ebp),%eax b25: 83 ec 04 sub $0x4,%esp b28: ff 75 e8 pushl -0x18(%ebp) b2b: 68 e0 8a 00 00 push $0x8ae0 b30: 50 push %eax b31: e8 b1 33 00 00 call 3ee7 <read> b36: 83 c4 10 add $0x10,%esp b39: 89 45 ec mov %eax,-0x14(%ebp) b3c: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) b40: 0f 8f 76 ff ff ff jg abc <pipe1+0xfb> total += n; cc = cc * 2; if (cc > sizeof(buf)) cc = sizeof(buf); } if (total != 5 * 1033) { b46: 81 7d e4 2d 14 00 00 cmpl $0x142d,-0x1c(%ebp) b4d: 74 1a je b69 <pipe1+0x1a8> printf(1, "pipe1 oops 3 total %d\n", total); b4f: 83 ec 04 sub $0x4,%esp b52: ff 75 e4 pushl -0x1c(%ebp) b55: 68 e1 48 00 00 push $0x48e1 b5a: 6a 01 push $0x1 b5c: e8 2d 35 00 00 call 408e <printf> b61: 83 c4 10 add $0x10,%esp exit(); b64: e8 66 33 00 00 call 3ecf <exit> } close(fds[0]); b69: 8b 45 d8 mov -0x28(%ebp),%eax b6c: 83 ec 0c sub $0xc,%esp b6f: 50 push %eax b70: e8 82 33 00 00 call 3ef7 <close> b75: 83 c4 10 add $0x10,%esp wait(); b78: e8 5a 33 00 00 call 3ed7 <wait> } else { printf(1, "fork() failed\n"); exit(); } printf(1, "pipe1 ok\n"); b7d: 83 ec 08 sub $0x8,%esp b80: 68 07 49 00 00 push $0x4907 b85: 6a 01 push $0x1 b87: e8 02 35 00 00 call 408e <printf> b8c: 83 c4 10 add $0x10,%esp b8f: eb 17 jmp ba8 <pipe1+0x1e7> exit(); } close(fds[0]); wait(); } else { printf(1, "fork() failed\n"); b91: 83 ec 08 sub $0x8,%esp b94: 68 f8 48 00 00 push $0x48f8 b99: 6a 01 push $0x1 b9b: e8 ee 34 00 00 call 408e <printf> ba0: 83 c4 10 add $0x10,%esp exit(); ba3: e8 27 33 00 00 call 3ecf <exit> } printf(1, "pipe1 ok\n"); } ba8: c9 leave ba9: c3 ret 00000baa <preempt>: // meant to be run w/ at most two CPUs void preempt(void) { baa: 55 push %ebp bab: 89 e5 mov %esp,%ebp bad: 83 ec 28 sub $0x28,%esp int pid1, pid2, pid3; int pfds[2]; printf(1, "preempt: "); bb0: 83 ec 08 sub $0x8,%esp bb3: 68 11 49 00 00 push $0x4911 bb8: 6a 01 push $0x1 bba: e8 cf 34 00 00 call 408e <printf> bbf: 83 c4 10 add $0x10,%esp pid1 = fork(); bc2: e8 00 33 00 00 call 3ec7 <fork> bc7: 89 45 f4 mov %eax,-0xc(%ebp) if (pid1 == 0) bca: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) bce: 75 02 jne bd2 <preempt+0x28> for (;;) ; bd0: eb fe jmp bd0 <preempt+0x26> pid2 = fork(); bd2: e8 f0 32 00 00 call 3ec7 <fork> bd7: 89 45 f0 mov %eax,-0x10(%ebp) if (pid2 == 0) bda: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) bde: 75 02 jne be2 <preempt+0x38> for (;;) ; be0: eb fe jmp be0 <preempt+0x36> pipe(pfds); be2: 83 ec 0c sub $0xc,%esp be5: 8d 45 e4 lea -0x1c(%ebp),%eax be8: 50 push %eax be9: e8 f1 32 00 00 call 3edf <pipe> bee: 83 c4 10 add $0x10,%esp pid3 = fork(); bf1: e8 d1 32 00 00 call 3ec7 <fork> bf6: 89 45 ec mov %eax,-0x14(%ebp) if (pid3 == 0) { bf9: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) bfd: 75 4d jne c4c <preempt+0xa2> close(pfds[0]); bff: 8b 45 e4 mov -0x1c(%ebp),%eax c02: 83 ec 0c sub $0xc,%esp c05: 50 push %eax c06: e8 ec 32 00 00 call 3ef7 <close> c0b: 83 c4 10 add $0x10,%esp if (write(pfds[1], "x", 1) != 1) c0e: 8b 45 e8 mov -0x18(%ebp),%eax c11: 83 ec 04 sub $0x4,%esp c14: 6a 01 push $0x1 c16: 68 1b 49 00 00 push $0x491b c1b: 50 push %eax c1c: e8 ce 32 00 00 call 3eef <write> c21: 83 c4 10 add $0x10,%esp c24: 83 f8 01 cmp $0x1,%eax c27: 74 12 je c3b <preempt+0x91> printf(1, "preempt write error"); c29: 83 ec 08 sub $0x8,%esp c2c: 68 1d 49 00 00 push $0x491d c31: 6a 01 push $0x1 c33: e8 56 34 00 00 call 408e <printf> c38: 83 c4 10 add $0x10,%esp close(pfds[1]); c3b: 8b 45 e8 mov -0x18(%ebp),%eax c3e: 83 ec 0c sub $0xc,%esp c41: 50 push %eax c42: e8 b0 32 00 00 call 3ef7 <close> c47: 83 c4 10 add $0x10,%esp for (;;) ; c4a: eb fe jmp c4a <preempt+0xa0> } close(pfds[1]); c4c: 8b 45 e8 mov -0x18(%ebp),%eax c4f: 83 ec 0c sub $0xc,%esp c52: 50 push %eax c53: e8 9f 32 00 00 call 3ef7 <close> c58: 83 c4 10 add $0x10,%esp if (read(pfds[0], buf, sizeof(buf)) != 1) { c5b: 8b 45 e4 mov -0x1c(%ebp),%eax c5e: 83 ec 04 sub $0x4,%esp c61: 68 00 20 00 00 push $0x2000 c66: 68 e0 8a 00 00 push $0x8ae0 c6b: 50 push %eax c6c: e8 76 32 00 00 call 3ee7 <read> c71: 83 c4 10 add $0x10,%esp c74: 83 f8 01 cmp $0x1,%eax c77: 74 14 je c8d <preempt+0xe3> printf(1, "preempt read error"); c79: 83 ec 08 sub $0x8,%esp c7c: 68 31 49 00 00 push $0x4931 c81: 6a 01 push $0x1 c83: e8 06 34 00 00 call 408e <printf> c88: 83 c4 10 add $0x10,%esp c8b: eb 7e jmp d0b <preempt+0x161> return; } close(pfds[0]); c8d: 8b 45 e4 mov -0x1c(%ebp),%eax c90: 83 ec 0c sub $0xc,%esp c93: 50 push %eax c94: e8 5e 32 00 00 call 3ef7 <close> c99: 83 c4 10 add $0x10,%esp printf(1, "kill... "); c9c: 83 ec 08 sub $0x8,%esp c9f: 68 44 49 00 00 push $0x4944 ca4: 6a 01 push $0x1 ca6: e8 e3 33 00 00 call 408e <printf> cab: 83 c4 10 add $0x10,%esp kill(pid1); cae: 83 ec 0c sub $0xc,%esp cb1: ff 75 f4 pushl -0xc(%ebp) cb4: e8 46 32 00 00 call 3eff <kill> cb9: 83 c4 10 add $0x10,%esp kill(pid2); cbc: 83 ec 0c sub $0xc,%esp cbf: ff 75 f0 pushl -0x10(%ebp) cc2: e8 38 32 00 00 call 3eff <kill> cc7: 83 c4 10 add $0x10,%esp kill(pid3); cca: 83 ec 0c sub $0xc,%esp ccd: ff 75 ec pushl -0x14(%ebp) cd0: e8 2a 32 00 00 call 3eff <kill> cd5: 83 c4 10 add $0x10,%esp printf(1, "wait... "); cd8: 83 ec 08 sub $0x8,%esp cdb: 68 4d 49 00 00 push $0x494d ce0: 6a 01 push $0x1 ce2: e8 a7 33 00 00 call 408e <printf> ce7: 83 c4 10 add $0x10,%esp wait(); cea: e8 e8 31 00 00 call 3ed7 <wait> wait(); cef: e8 e3 31 00 00 call 3ed7 <wait> wait(); cf4: e8 de 31 00 00 call 3ed7 <wait> printf(1, "preempt ok\n"); cf9: 83 ec 08 sub $0x8,%esp cfc: 68 56 49 00 00 push $0x4956 d01: 6a 01 push $0x1 d03: e8 86 33 00 00 call 408e <printf> d08: 83 c4 10 add $0x10,%esp } d0b: c9 leave d0c: c3 ret 00000d0d <exitwait>: // try to find any races between exit and wait void exitwait(void) { d0d: 55 push %ebp d0e: 89 e5 mov %esp,%ebp d10: 83 ec 18 sub $0x18,%esp int i, pid; for (i = 0; i < 100; i++) { d13: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) d1a: eb 4f jmp d6b <exitwait+0x5e> pid = fork(); d1c: e8 a6 31 00 00 call 3ec7 <fork> d21: 89 45 f0 mov %eax,-0x10(%ebp) if (pid < 0) { d24: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) d28: 79 14 jns d3e <exitwait+0x31> printf(1, "fork failed\n"); d2a: 83 ec 08 sub $0x8,%esp d2d: 68 e5 44 00 00 push $0x44e5 d32: 6a 01 push $0x1 d34: e8 55 33 00 00 call 408e <printf> d39: 83 c4 10 add $0x10,%esp return; d3c: eb 45 jmp d83 <exitwait+0x76> } if (pid) { d3e: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) d42: 74 1e je d62 <exitwait+0x55> if (wait() != pid) { d44: e8 8e 31 00 00 call 3ed7 <wait> d49: 3b 45 f0 cmp -0x10(%ebp),%eax d4c: 74 19 je d67 <exitwait+0x5a> printf(1, "wait wrong pid\n"); d4e: 83 ec 08 sub $0x8,%esp d51: 68 62 49 00 00 push $0x4962 d56: 6a 01 push $0x1 d58: e8 31 33 00 00 call 408e <printf> d5d: 83 c4 10 add $0x10,%esp return; d60: eb 21 jmp d83 <exitwait+0x76> } } else { exit(); d62: e8 68 31 00 00 call 3ecf <exit> // try to find any races between exit and wait void exitwait(void) { int i, pid; for (i = 0; i < 100; i++) { d67: 83 45 f4 01 addl $0x1,-0xc(%ebp) d6b: 83 7d f4 63 cmpl $0x63,-0xc(%ebp) d6f: 7e ab jle d1c <exitwait+0xf> } } else { exit(); } } printf(1, "exitwait ok\n"); d71: 83 ec 08 sub $0x8,%esp d74: 68 72 49 00 00 push $0x4972 d79: 6a 01 push $0x1 d7b: e8 0e 33 00 00 call 408e <printf> d80: 83 c4 10 add $0x10,%esp } d83: c9 leave d84: c3 ret 00000d85 <mem>: void mem(void) { d85: 55 push %ebp d86: 89 e5 mov %esp,%ebp d88: 83 ec 18 sub $0x18,%esp void *m1, *m2; int pid, ppid; printf(1, "mem test\n"); d8b: 83 ec 08 sub $0x8,%esp d8e: 68 7f 49 00 00 push $0x497f d93: 6a 01 push $0x1 d95: e8 f4 32 00 00 call 408e <printf> d9a: 83 c4 10 add $0x10,%esp ppid = getpid(); d9d: e8 ad 31 00 00 call 3f4f <getpid> da2: 89 45 f0 mov %eax,-0x10(%ebp) if ((pid = fork()) == 0) { da5: e8 1d 31 00 00 call 3ec7 <fork> daa: 89 45 ec mov %eax,-0x14(%ebp) dad: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) db1: 0f 85 b7 00 00 00 jne e6e <mem+0xe9> m1 = 0; db7: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) while ((m2 = malloc(10001)) != 0) { dbe: eb 0e jmp dce <mem+0x49> *(char **)m2 = m1; dc0: 8b 45 e8 mov -0x18(%ebp),%eax dc3: 8b 55 f4 mov -0xc(%ebp),%edx dc6: 89 10 mov %edx,(%eax) m1 = m2; dc8: 8b 45 e8 mov -0x18(%ebp),%eax dcb: 89 45 f4 mov %eax,-0xc(%ebp) printf(1, "mem test\n"); ppid = getpid(); if ((pid = fork()) == 0) { m1 = 0; while ((m2 = malloc(10001)) != 0) { dce: 83 ec 0c sub $0xc,%esp dd1: 68 11 27 00 00 push $0x2711 dd6: e8 86 35 00 00 call 4361 <malloc> ddb: 83 c4 10 add $0x10,%esp dde: 89 45 e8 mov %eax,-0x18(%ebp) de1: 83 7d e8 00 cmpl $0x0,-0x18(%ebp) de5: 75 d9 jne dc0 <mem+0x3b> *(char **)m2 = m1; m1 = m2; } while (m1) { de7: eb 1c jmp e05 <mem+0x80> m2 = *(char **)m1; de9: 8b 45 f4 mov -0xc(%ebp),%eax dec: 8b 00 mov (%eax),%eax dee: 89 45 e8 mov %eax,-0x18(%ebp) free(m1); df1: 83 ec 0c sub $0xc,%esp df4: ff 75 f4 pushl -0xc(%ebp) df7: e8 23 34 00 00 call 421f <free> dfc: 83 c4 10 add $0x10,%esp m1 = m2; dff: 8b 45 e8 mov -0x18(%ebp),%eax e02: 89 45 f4 mov %eax,-0xc(%ebp) m1 = 0; while ((m2 = malloc(10001)) != 0) { *(char **)m2 = m1; m1 = m2; } while (m1) { e05: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) e09: 75 de jne de9 <mem+0x64> m2 = *(char **)m1; free(m1); m1 = m2; } m1 = malloc(1024 * 20); e0b: 83 ec 0c sub $0xc,%esp e0e: 68 00 50 00 00 push $0x5000 e13: e8 49 35 00 00 call 4361 <malloc> e18: 83 c4 10 add $0x10,%esp e1b: 89 45 f4 mov %eax,-0xc(%ebp) if (m1 == 0) { e1e: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) e22: 75 25 jne e49 <mem+0xc4> printf(1, "couldn't allocate mem?!!\n"); e24: 83 ec 08 sub $0x8,%esp e27: 68 89 49 00 00 push $0x4989 e2c: 6a 01 push $0x1 e2e: e8 5b 32 00 00 call 408e <printf> e33: 83 c4 10 add $0x10,%esp kill(ppid); e36: 83 ec 0c sub $0xc,%esp e39: ff 75 f0 pushl -0x10(%ebp) e3c: e8 be 30 00 00 call 3eff <kill> e41: 83 c4 10 add $0x10,%esp exit(); e44: e8 86 30 00 00 call 3ecf <exit> } free(m1); e49: 83 ec 0c sub $0xc,%esp e4c: ff 75 f4 pushl -0xc(%ebp) e4f: e8 cb 33 00 00 call 421f <free> e54: 83 c4 10 add $0x10,%esp printf(1, "mem ok\n"); e57: 83 ec 08 sub $0x8,%esp e5a: 68 a3 49 00 00 push $0x49a3 e5f: 6a 01 push $0x1 e61: e8 28 32 00 00 call 408e <printf> e66: 83 c4 10 add $0x10,%esp exit(); e69: e8 61 30 00 00 call 3ecf <exit> } else { wait(); e6e: e8 64 30 00 00 call 3ed7 <wait> } } e73: 90 nop e74: c9 leave e75: c3 ret 00000e76 <sharedfd>: // More file system tests // two processes write to the same file descriptor // is the offset shared? does inode locking work? void sharedfd(void) { e76: 55 push %ebp e77: 89 e5 mov %esp,%ebp e79: 83 ec 38 sub $0x38,%esp int fd, pid, i, n, nc, np; char buf[10]; printf(1, "sharedfd test\n"); e7c: 83 ec 08 sub $0x8,%esp e7f: 68 ab 49 00 00 push $0x49ab e84: 6a 01 push $0x1 e86: e8 03 32 00 00 call 408e <printf> e8b: 83 c4 10 add $0x10,%esp unlink("sharedfd"); e8e: 83 ec 0c sub $0xc,%esp e91: 68 ba 49 00 00 push $0x49ba e96: e8 84 30 00 00 call 3f1f <unlink> e9b: 83 c4 10 add $0x10,%esp fd = open("sharedfd", O_CREATE | O_RDWR); e9e: 83 ec 08 sub $0x8,%esp ea1: 68 02 02 00 00 push $0x202 ea6: 68 ba 49 00 00 push $0x49ba eab: e8 5f 30 00 00 call 3f0f <open> eb0: 83 c4 10 add $0x10,%esp eb3: 89 45 e8 mov %eax,-0x18(%ebp) if (fd < 0) { eb6: 83 7d e8 00 cmpl $0x0,-0x18(%ebp) eba: 79 17 jns ed3 <sharedfd+0x5d> printf(1, "fstests: cannot open sharedfd for writing"); ebc: 83 ec 08 sub $0x8,%esp ebf: 68 c4 49 00 00 push $0x49c4 ec4: 6a 01 push $0x1 ec6: e8 c3 31 00 00 call 408e <printf> ecb: 83 c4 10 add $0x10,%esp return; ece: e9 84 01 00 00 jmp 1057 <sharedfd+0x1e1> } pid = fork(); ed3: e8 ef 2f 00 00 call 3ec7 <fork> ed8: 89 45 e4 mov %eax,-0x1c(%ebp) memset(buf, pid == 0 ? 'c' : 'p', sizeof(buf)); edb: 83 7d e4 00 cmpl $0x0,-0x1c(%ebp) edf: 75 07 jne ee8 <sharedfd+0x72> ee1: b8 63 00 00 00 mov $0x63,%eax ee6: eb 05 jmp eed <sharedfd+0x77> ee8: b8 70 00 00 00 mov $0x70,%eax eed: 83 ec 04 sub $0x4,%esp ef0: 6a 0a push $0xa ef2: 50 push %eax ef3: 8d 45 d6 lea -0x2a(%ebp),%eax ef6: 50 push %eax ef7: e8 38 2e 00 00 call 3d34 <memset> efc: 83 c4 10 add $0x10,%esp for (i = 0; i < 1000; i++) { eff: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) f06: eb 31 jmp f39 <sharedfd+0xc3> if (write(fd, buf, sizeof(buf)) != sizeof(buf)) { f08: 83 ec 04 sub $0x4,%esp f0b: 6a 0a push $0xa f0d: 8d 45 d6 lea -0x2a(%ebp),%eax f10: 50 push %eax f11: ff 75 e8 pushl -0x18(%ebp) f14: e8 d6 2f 00 00 call 3eef <write> f19: 83 c4 10 add $0x10,%esp f1c: 83 f8 0a cmp $0xa,%eax f1f: 74 14 je f35 <sharedfd+0xbf> printf(1, "fstests: write sharedfd failed\n"); f21: 83 ec 08 sub $0x8,%esp f24: 68 f0 49 00 00 push $0x49f0 f29: 6a 01 push $0x1 f2b: e8 5e 31 00 00 call 408e <printf> f30: 83 c4 10 add $0x10,%esp break; f33: eb 0d jmp f42 <sharedfd+0xcc> printf(1, "fstests: cannot open sharedfd for writing"); return; } pid = fork(); memset(buf, pid == 0 ? 'c' : 'p', sizeof(buf)); for (i = 0; i < 1000; i++) { f35: 83 45 f4 01 addl $0x1,-0xc(%ebp) f39: 81 7d f4 e7 03 00 00 cmpl $0x3e7,-0xc(%ebp) f40: 7e c6 jle f08 <sharedfd+0x92> if (write(fd, buf, sizeof(buf)) != sizeof(buf)) { printf(1, "fstests: write sharedfd failed\n"); break; } } if (pid == 0) f42: 83 7d e4 00 cmpl $0x0,-0x1c(%ebp) f46: 75 05 jne f4d <sharedfd+0xd7> exit(); f48: e8 82 2f 00 00 call 3ecf <exit> else wait(); f4d: e8 85 2f 00 00 call 3ed7 <wait> close(fd); f52: 83 ec 0c sub $0xc,%esp f55: ff 75 e8 pushl -0x18(%ebp) f58: e8 9a 2f 00 00 call 3ef7 <close> f5d: 83 c4 10 add $0x10,%esp fd = open("sharedfd", 0); f60: 83 ec 08 sub $0x8,%esp f63: 6a 00 push $0x0 f65: 68 ba 49 00 00 push $0x49ba f6a: e8 a0 2f 00 00 call 3f0f <open> f6f: 83 c4 10 add $0x10,%esp f72: 89 45 e8 mov %eax,-0x18(%ebp) if (fd < 0) { f75: 83 7d e8 00 cmpl $0x0,-0x18(%ebp) f79: 79 17 jns f92 <sharedfd+0x11c> printf(1, "fstests: cannot open sharedfd for reading\n"); f7b: 83 ec 08 sub $0x8,%esp f7e: 68 10 4a 00 00 push $0x4a10 f83: 6a 01 push $0x1 f85: e8 04 31 00 00 call 408e <printf> f8a: 83 c4 10 add $0x10,%esp return; f8d: e9 c5 00 00 00 jmp 1057 <sharedfd+0x1e1> } nc = np = 0; f92: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp) f99: 8b 45 ec mov -0x14(%ebp),%eax f9c: 89 45 f0 mov %eax,-0x10(%ebp) while ((n = read(fd, buf, sizeof(buf))) > 0) { f9f: eb 3b jmp fdc <sharedfd+0x166> for (i = 0; i < sizeof(buf); i++) { fa1: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) fa8: eb 2a jmp fd4 <sharedfd+0x15e> if (buf[i] == 'c') faa: 8d 55 d6 lea -0x2a(%ebp),%edx fad: 8b 45 f4 mov -0xc(%ebp),%eax fb0: 01 d0 add %edx,%eax fb2: 0f b6 00 movzbl (%eax),%eax fb5: 3c 63 cmp $0x63,%al fb7: 75 04 jne fbd <sharedfd+0x147> nc++; fb9: 83 45 f0 01 addl $0x1,-0x10(%ebp) if (buf[i] == 'p') fbd: 8d 55 d6 lea -0x2a(%ebp),%edx fc0: 8b 45 f4 mov -0xc(%ebp),%eax fc3: 01 d0 add %edx,%eax fc5: 0f b6 00 movzbl (%eax),%eax fc8: 3c 70 cmp $0x70,%al fca: 75 04 jne fd0 <sharedfd+0x15a> np++; fcc: 83 45 ec 01 addl $0x1,-0x14(%ebp) printf(1, "fstests: cannot open sharedfd for reading\n"); return; } nc = np = 0; while ((n = read(fd, buf, sizeof(buf))) > 0) { for (i = 0; i < sizeof(buf); i++) { fd0: 83 45 f4 01 addl $0x1,-0xc(%ebp) fd4: 8b 45 f4 mov -0xc(%ebp),%eax fd7: 83 f8 09 cmp $0x9,%eax fda: 76 ce jbe faa <sharedfd+0x134> if (fd < 0) { printf(1, "fstests: cannot open sharedfd for reading\n"); return; } nc = np = 0; while ((n = read(fd, buf, sizeof(buf))) > 0) { fdc: 83 ec 04 sub $0x4,%esp fdf: 6a 0a push $0xa fe1: 8d 45 d6 lea -0x2a(%ebp),%eax fe4: 50 push %eax fe5: ff 75 e8 pushl -0x18(%ebp) fe8: e8 fa 2e 00 00 call 3ee7 <read> fed: 83 c4 10 add $0x10,%esp ff0: 89 45 e0 mov %eax,-0x20(%ebp) ff3: 83 7d e0 00 cmpl $0x0,-0x20(%ebp) ff7: 7f a8 jg fa1 <sharedfd+0x12b> nc++; if (buf[i] == 'p') np++; } } close(fd); ff9: 83 ec 0c sub $0xc,%esp ffc: ff 75 e8 pushl -0x18(%ebp) fff: e8 f3 2e 00 00 call 3ef7 <close> 1004: 83 c4 10 add $0x10,%esp unlink("sharedfd"); 1007: 83 ec 0c sub $0xc,%esp 100a: 68 ba 49 00 00 push $0x49ba 100f: e8 0b 2f 00 00 call 3f1f <unlink> 1014: 83 c4 10 add $0x10,%esp if (nc == 10000 && np == 10000) { 1017: 81 7d f0 10 27 00 00 cmpl $0x2710,-0x10(%ebp) 101e: 75 1d jne 103d <sharedfd+0x1c7> 1020: 81 7d ec 10 27 00 00 cmpl $0x2710,-0x14(%ebp) 1027: 75 14 jne 103d <sharedfd+0x1c7> printf(1, "sharedfd ok\n"); 1029: 83 ec 08 sub $0x8,%esp 102c: 68 3b 4a 00 00 push $0x4a3b 1031: 6a 01 push $0x1 1033: e8 56 30 00 00 call 408e <printf> 1038: 83 c4 10 add $0x10,%esp 103b: eb 1a jmp 1057 <sharedfd+0x1e1> } else { printf(1, "sharedfd oops %d %d\n", nc, np); 103d: ff 75 ec pushl -0x14(%ebp) 1040: ff 75 f0 pushl -0x10(%ebp) 1043: 68 48 4a 00 00 push $0x4a48 1048: 6a 01 push $0x1 104a: e8 3f 30 00 00 call 408e <printf> 104f: 83 c4 10 add $0x10,%esp exit(); 1052: e8 78 2e 00 00 call 3ecf <exit> } } 1057: c9 leave 1058: c3 ret 00001059 <fourfiles>: // four processes write different files at the same // time, to test block allocation. void fourfiles(void) { 1059: 55 push %ebp 105a: 89 e5 mov %esp,%ebp 105c: 83 ec 38 sub $0x38,%esp int fd, pid, i, j, n, total, pi; char *names[] = { "f0", "f1", "f2", "f3" }; 105f: c7 45 c8 5d 4a 00 00 movl $0x4a5d,-0x38(%ebp) 1066: c7 45 cc 60 4a 00 00 movl $0x4a60,-0x34(%ebp) 106d: c7 45 d0 63 4a 00 00 movl $0x4a63,-0x30(%ebp) 1074: c7 45 d4 66 4a 00 00 movl $0x4a66,-0x2c(%ebp) char *fname; printf(1, "fourfiles test\n"); 107b: 83 ec 08 sub $0x8,%esp 107e: 68 69 4a 00 00 push $0x4a69 1083: 6a 01 push $0x1 1085: e8 04 30 00 00 call 408e <printf> 108a: 83 c4 10 add $0x10,%esp for (pi = 0; pi < 4; pi++) { 108d: c7 45 e8 00 00 00 00 movl $0x0,-0x18(%ebp) 1094: e9 f0 00 00 00 jmp 1189 <fourfiles+0x130> fname = names[pi]; 1099: 8b 45 e8 mov -0x18(%ebp),%eax 109c: 8b 44 85 c8 mov -0x38(%ebp,%eax,4),%eax 10a0: 89 45 e4 mov %eax,-0x1c(%ebp) unlink(fname); 10a3: 83 ec 0c sub $0xc,%esp 10a6: ff 75 e4 pushl -0x1c(%ebp) 10a9: e8 71 2e 00 00 call 3f1f <unlink> 10ae: 83 c4 10 add $0x10,%esp pid = fork(); 10b1: e8 11 2e 00 00 call 3ec7 <fork> 10b6: 89 45 e0 mov %eax,-0x20(%ebp) if (pid < 0) { 10b9: 83 7d e0 00 cmpl $0x0,-0x20(%ebp) 10bd: 79 17 jns 10d6 <fourfiles+0x7d> printf(1, "fork failed\n"); 10bf: 83 ec 08 sub $0x8,%esp 10c2: 68 e5 44 00 00 push $0x44e5 10c7: 6a 01 push $0x1 10c9: e8 c0 2f 00 00 call 408e <printf> 10ce: 83 c4 10 add $0x10,%esp exit(); 10d1: e8 f9 2d 00 00 call 3ecf <exit> } if (pid == 0) { 10d6: 83 7d e0 00 cmpl $0x0,-0x20(%ebp) 10da: 0f 85 a5 00 00 00 jne 1185 <fourfiles+0x12c> fd = open(fname, O_CREATE | O_RDWR); 10e0: 83 ec 08 sub $0x8,%esp 10e3: 68 02 02 00 00 push $0x202 10e8: ff 75 e4 pushl -0x1c(%ebp) 10eb: e8 1f 2e 00 00 call 3f0f <open> 10f0: 83 c4 10 add $0x10,%esp 10f3: 89 45 dc mov %eax,-0x24(%ebp) if (fd < 0) { 10f6: 83 7d dc 00 cmpl $0x0,-0x24(%ebp) 10fa: 79 17 jns 1113 <fourfiles+0xba> printf(1, "create failed\n"); 10fc: 83 ec 08 sub $0x8,%esp 10ff: 68 79 4a 00 00 push $0x4a79 1104: 6a 01 push $0x1 1106: e8 83 2f 00 00 call 408e <printf> 110b: 83 c4 10 add $0x10,%esp exit(); 110e: e8 bc 2d 00 00 call 3ecf <exit> } memset(buf, '0' + pi, 512); 1113: 8b 45 e8 mov -0x18(%ebp),%eax 1116: 83 c0 30 add $0x30,%eax 1119: 83 ec 04 sub $0x4,%esp 111c: 68 00 02 00 00 push $0x200 1121: 50 push %eax 1122: 68 e0 8a 00 00 push $0x8ae0 1127: e8 08 2c 00 00 call 3d34 <memset> 112c: 83 c4 10 add $0x10,%esp for (i = 0; i < 12; i++) { 112f: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 1136: eb 42 jmp 117a <fourfiles+0x121> if ((n = write(fd, buf, 500)) != 500) { 1138: 83 ec 04 sub $0x4,%esp 113b: 68 f4 01 00 00 push $0x1f4 1140: 68 e0 8a 00 00 push $0x8ae0 1145: ff 75 dc pushl -0x24(%ebp) 1148: e8 a2 2d 00 00 call 3eef <write> 114d: 83 c4 10 add $0x10,%esp 1150: 89 45 d8 mov %eax,-0x28(%ebp) 1153: 81 7d d8 f4 01 00 00 cmpl $0x1f4,-0x28(%ebp) 115a: 74 1a je 1176 <fourfiles+0x11d> printf(1, "write failed %d\n", n); 115c: 83 ec 04 sub $0x4,%esp 115f: ff 75 d8 pushl -0x28(%ebp) 1162: 68 88 4a 00 00 push $0x4a88 1167: 6a 01 push $0x1 1169: e8 20 2f 00 00 call 408e <printf> 116e: 83 c4 10 add $0x10,%esp exit(); 1171: e8 59 2d 00 00 call 3ecf <exit> printf(1, "create failed\n"); exit(); } memset(buf, '0' + pi, 512); for (i = 0; i < 12; i++) { 1176: 83 45 f4 01 addl $0x1,-0xc(%ebp) 117a: 83 7d f4 0b cmpl $0xb,-0xc(%ebp) 117e: 7e b8 jle 1138 <fourfiles+0xdf> if ((n = write(fd, buf, 500)) != 500) { printf(1, "write failed %d\n", n); exit(); } } exit(); 1180: e8 4a 2d 00 00 call 3ecf <exit> char *names[] = { "f0", "f1", "f2", "f3" }; char *fname; printf(1, "fourfiles test\n"); for (pi = 0; pi < 4; pi++) { 1185: 83 45 e8 01 addl $0x1,-0x18(%ebp) 1189: 83 7d e8 03 cmpl $0x3,-0x18(%ebp) 118d: 0f 8e 06 ff ff ff jle 1099 <fourfiles+0x40> } exit(); } } for (pi = 0; pi < 4; pi++) { 1193: c7 45 e8 00 00 00 00 movl $0x0,-0x18(%ebp) 119a: eb 09 jmp 11a5 <fourfiles+0x14c> wait(); 119c: e8 36 2d 00 00 call 3ed7 <wait> } exit(); } } for (pi = 0; pi < 4; pi++) { 11a1: 83 45 e8 01 addl $0x1,-0x18(%ebp) 11a5: 83 7d e8 03 cmpl $0x3,-0x18(%ebp) 11a9: 7e f1 jle 119c <fourfiles+0x143> wait(); } for (i = 0; i < 2; i++) { 11ab: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 11b2: e9 d4 00 00 00 jmp 128b <fourfiles+0x232> fname = names[i]; 11b7: 8b 45 f4 mov -0xc(%ebp),%eax 11ba: 8b 44 85 c8 mov -0x38(%ebp,%eax,4),%eax 11be: 89 45 e4 mov %eax,-0x1c(%ebp) fd = open(fname, 0); 11c1: 83 ec 08 sub $0x8,%esp 11c4: 6a 00 push $0x0 11c6: ff 75 e4 pushl -0x1c(%ebp) 11c9: e8 41 2d 00 00 call 3f0f <open> 11ce: 83 c4 10 add $0x10,%esp 11d1: 89 45 dc mov %eax,-0x24(%ebp) total = 0; 11d4: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp) while ((n = read(fd, buf, sizeof(buf))) > 0) { 11db: eb 4a jmp 1227 <fourfiles+0x1ce> for (j = 0; j < n; j++) { 11dd: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp) 11e4: eb 33 jmp 1219 <fourfiles+0x1c0> if (buf[j] != '0' + i) { 11e6: 8b 45 f0 mov -0x10(%ebp),%eax 11e9: 05 e0 8a 00 00 add $0x8ae0,%eax 11ee: 0f b6 00 movzbl (%eax),%eax 11f1: 0f be c0 movsbl %al,%eax 11f4: 8b 55 f4 mov -0xc(%ebp),%edx 11f7: 83 c2 30 add $0x30,%edx 11fa: 39 d0 cmp %edx,%eax 11fc: 74 17 je 1215 <fourfiles+0x1bc> printf(1, "wrong char\n"); 11fe: 83 ec 08 sub $0x8,%esp 1201: 68 99 4a 00 00 push $0x4a99 1206: 6a 01 push $0x1 1208: e8 81 2e 00 00 call 408e <printf> 120d: 83 c4 10 add $0x10,%esp exit(); 1210: e8 ba 2c 00 00 call 3ecf <exit> for (i = 0; i < 2; i++) { fname = names[i]; fd = open(fname, 0); total = 0; while ((n = read(fd, buf, sizeof(buf))) > 0) { for (j = 0; j < n; j++) { 1215: 83 45 f0 01 addl $0x1,-0x10(%ebp) 1219: 8b 45 f0 mov -0x10(%ebp),%eax 121c: 3b 45 d8 cmp -0x28(%ebp),%eax 121f: 7c c5 jl 11e6 <fourfiles+0x18d> if (buf[j] != '0' + i) { printf(1, "wrong char\n"); exit(); } } total += n; 1221: 8b 45 d8 mov -0x28(%ebp),%eax 1224: 01 45 ec add %eax,-0x14(%ebp) for (i = 0; i < 2; i++) { fname = names[i]; fd = open(fname, 0); total = 0; while ((n = read(fd, buf, sizeof(buf))) > 0) { 1227: 83 ec 04 sub $0x4,%esp 122a: 68 00 20 00 00 push $0x2000 122f: 68 e0 8a 00 00 push $0x8ae0 1234: ff 75 dc pushl -0x24(%ebp) 1237: e8 ab 2c 00 00 call 3ee7 <read> 123c: 83 c4 10 add $0x10,%esp 123f: 89 45 d8 mov %eax,-0x28(%ebp) 1242: 83 7d d8 00 cmpl $0x0,-0x28(%ebp) 1246: 7f 95 jg 11dd <fourfiles+0x184> exit(); } } total += n; } close(fd); 1248: 83 ec 0c sub $0xc,%esp 124b: ff 75 dc pushl -0x24(%ebp) 124e: e8 a4 2c 00 00 call 3ef7 <close> 1253: 83 c4 10 add $0x10,%esp if (total != 12 * 500) { 1256: 81 7d ec 70 17 00 00 cmpl $0x1770,-0x14(%ebp) 125d: 74 1a je 1279 <fourfiles+0x220> printf(1, "wrong length %d\n", total); 125f: 83 ec 04 sub $0x4,%esp 1262: ff 75 ec pushl -0x14(%ebp) 1265: 68 a5 4a 00 00 push $0x4aa5 126a: 6a 01 push $0x1 126c: e8 1d 2e 00 00 call 408e <printf> 1271: 83 c4 10 add $0x10,%esp exit(); 1274: e8 56 2c 00 00 call 3ecf <exit> } unlink(fname); 1279: 83 ec 0c sub $0xc,%esp 127c: ff 75 e4 pushl -0x1c(%ebp) 127f: e8 9b 2c 00 00 call 3f1f <unlink> 1284: 83 c4 10 add $0x10,%esp for (pi = 0; pi < 4; pi++) { wait(); } for (i = 0; i < 2; i++) { 1287: 83 45 f4 01 addl $0x1,-0xc(%ebp) 128b: 83 7d f4 01 cmpl $0x1,-0xc(%ebp) 128f: 0f 8e 22 ff ff ff jle 11b7 <fourfiles+0x15e> exit(); } unlink(fname); } printf(1, "fourfiles ok\n"); 1295: 83 ec 08 sub $0x8,%esp 1298: 68 b6 4a 00 00 push $0x4ab6 129d: 6a 01 push $0x1 129f: e8 ea 2d 00 00 call 408e <printf> 12a4: 83 c4 10 add $0x10,%esp } 12a7: 90 nop 12a8: c9 leave 12a9: c3 ret 000012aa <createdelete>: // four processes create and delete different files in same directory void createdelete(void) { 12aa: 55 push %ebp 12ab: 89 e5 mov %esp,%ebp 12ad: 83 ec 38 sub $0x38,%esp enum { N = 20 }; int pid, i, fd, pi; char name[32]; printf(1, "createdelete test\n"); 12b0: 83 ec 08 sub $0x8,%esp 12b3: 68 c4 4a 00 00 push $0x4ac4 12b8: 6a 01 push $0x1 12ba: e8 cf 2d 00 00 call 408e <printf> 12bf: 83 c4 10 add $0x10,%esp for (pi = 0; pi < 4; pi++) { 12c2: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp) 12c9: e9 f6 00 00 00 jmp 13c4 <createdelete+0x11a> pid = fork(); 12ce: e8 f4 2b 00 00 call 3ec7 <fork> 12d3: 89 45 ec mov %eax,-0x14(%ebp) if (pid < 0) { 12d6: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 12da: 79 17 jns 12f3 <createdelete+0x49> printf(1, "fork failed\n"); 12dc: 83 ec 08 sub $0x8,%esp 12df: 68 e5 44 00 00 push $0x44e5 12e4: 6a 01 push $0x1 12e6: e8 a3 2d 00 00 call 408e <printf> 12eb: 83 c4 10 add $0x10,%esp exit(); 12ee: e8 dc 2b 00 00 call 3ecf <exit> } if (pid == 0) { 12f3: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 12f7: 0f 85 c3 00 00 00 jne 13c0 <createdelete+0x116> name[0] = 'p' + pi; 12fd: 8b 45 f0 mov -0x10(%ebp),%eax 1300: 83 c0 70 add $0x70,%eax 1303: 88 45 c8 mov %al,-0x38(%ebp) name[2] = '\0'; 1306: c6 45 ca 00 movb $0x0,-0x36(%ebp) for (i = 0; i < N; i++) { 130a: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 1311: e9 9b 00 00 00 jmp 13b1 <createdelete+0x107> name[1] = '0' + i; 1316: 8b 45 f4 mov -0xc(%ebp),%eax 1319: 83 c0 30 add $0x30,%eax 131c: 88 45 c9 mov %al,-0x37(%ebp) fd = open(name, O_CREATE | O_RDWR); 131f: 83 ec 08 sub $0x8,%esp 1322: 68 02 02 00 00 push $0x202 1327: 8d 45 c8 lea -0x38(%ebp),%eax 132a: 50 push %eax 132b: e8 df 2b 00 00 call 3f0f <open> 1330: 83 c4 10 add $0x10,%esp 1333: 89 45 e8 mov %eax,-0x18(%ebp) if (fd < 0) { 1336: 83 7d e8 00 cmpl $0x0,-0x18(%ebp) 133a: 79 17 jns 1353 <createdelete+0xa9> printf(1, "create failed\n"); 133c: 83 ec 08 sub $0x8,%esp 133f: 68 79 4a 00 00 push $0x4a79 1344: 6a 01 push $0x1 1346: e8 43 2d 00 00 call 408e <printf> 134b: 83 c4 10 add $0x10,%esp exit(); 134e: e8 7c 2b 00 00 call 3ecf <exit> } close(fd); 1353: 83 ec 0c sub $0xc,%esp 1356: ff 75 e8 pushl -0x18(%ebp) 1359: e8 99 2b 00 00 call 3ef7 <close> 135e: 83 c4 10 add $0x10,%esp if (i > 0 && (i % 2) == 0) { 1361: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 1365: 7e 46 jle 13ad <createdelete+0x103> 1367: 8b 45 f4 mov -0xc(%ebp),%eax 136a: 83 e0 01 and $0x1,%eax 136d: 85 c0 test %eax,%eax 136f: 75 3c jne 13ad <createdelete+0x103> name[1] = '0' + (i / 2); 1371: 8b 45 f4 mov -0xc(%ebp),%eax 1374: 89 c2 mov %eax,%edx 1376: c1 ea 1f shr $0x1f,%edx 1379: 01 d0 add %edx,%eax 137b: d1 f8 sar %eax 137d: 83 c0 30 add $0x30,%eax 1380: 88 45 c9 mov %al,-0x37(%ebp) if (unlink(name) < 0) { 1383: 83 ec 0c sub $0xc,%esp 1386: 8d 45 c8 lea -0x38(%ebp),%eax 1389: 50 push %eax 138a: e8 90 2b 00 00 call 3f1f <unlink> 138f: 83 c4 10 add $0x10,%esp 1392: 85 c0 test %eax,%eax 1394: 79 17 jns 13ad <createdelete+0x103> printf(1, "unlink failed\n"); 1396: 83 ec 08 sub $0x8,%esp 1399: 68 68 45 00 00 push $0x4568 139e: 6a 01 push $0x1 13a0: e8 e9 2c 00 00 call 408e <printf> 13a5: 83 c4 10 add $0x10,%esp exit(); 13a8: e8 22 2b 00 00 call 3ecf <exit> } if (pid == 0) { name[0] = 'p' + pi; name[2] = '\0'; for (i = 0; i < N; i++) { 13ad: 83 45 f4 01 addl $0x1,-0xc(%ebp) 13b1: 83 7d f4 13 cmpl $0x13,-0xc(%ebp) 13b5: 0f 8e 5b ff ff ff jle 1316 <createdelete+0x6c> printf(1, "unlink failed\n"); exit(); } } } exit(); 13bb: e8 0f 2b 00 00 call 3ecf <exit> int pid, i, fd, pi; char name[32]; printf(1, "createdelete test\n"); for (pi = 0; pi < 4; pi++) { 13c0: 83 45 f0 01 addl $0x1,-0x10(%ebp) 13c4: 83 7d f0 03 cmpl $0x3,-0x10(%ebp) 13c8: 0f 8e 00 ff ff ff jle 12ce <createdelete+0x24> } exit(); } } for (pi = 0; pi < 4; pi++) { 13ce: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp) 13d5: eb 09 jmp 13e0 <createdelete+0x136> wait(); 13d7: e8 fb 2a 00 00 call 3ed7 <wait> } exit(); } } for (pi = 0; pi < 4; pi++) { 13dc: 83 45 f0 01 addl $0x1,-0x10(%ebp) 13e0: 83 7d f0 03 cmpl $0x3,-0x10(%ebp) 13e4: 7e f1 jle 13d7 <createdelete+0x12d> wait(); } name[0] = name[1] = name[2] = 0; 13e6: c6 45 ca 00 movb $0x0,-0x36(%ebp) 13ea: 0f b6 45 ca movzbl -0x36(%ebp),%eax 13ee: 88 45 c9 mov %al,-0x37(%ebp) 13f1: 0f b6 45 c9 movzbl -0x37(%ebp),%eax 13f5: 88 45 c8 mov %al,-0x38(%ebp) for (i = 0; i < N; i++) { 13f8: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 13ff: e9 b2 00 00 00 jmp 14b6 <createdelete+0x20c> for (pi = 0; pi < 4; pi++) { 1404: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp) 140b: e9 98 00 00 00 jmp 14a8 <createdelete+0x1fe> name[0] = 'p' + pi; 1410: 8b 45 f0 mov -0x10(%ebp),%eax 1413: 83 c0 70 add $0x70,%eax 1416: 88 45 c8 mov %al,-0x38(%ebp) name[1] = '0' + i; 1419: 8b 45 f4 mov -0xc(%ebp),%eax 141c: 83 c0 30 add $0x30,%eax 141f: 88 45 c9 mov %al,-0x37(%ebp) fd = open(name, 0); 1422: 83 ec 08 sub $0x8,%esp 1425: 6a 00 push $0x0 1427: 8d 45 c8 lea -0x38(%ebp),%eax 142a: 50 push %eax 142b: e8 df 2a 00 00 call 3f0f <open> 1430: 83 c4 10 add $0x10,%esp 1433: 89 45 e8 mov %eax,-0x18(%ebp) if ((i == 0 || i >= N / 2) && fd < 0) { 1436: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 143a: 74 06 je 1442 <createdelete+0x198> 143c: 83 7d f4 09 cmpl $0x9,-0xc(%ebp) 1440: 7e 21 jle 1463 <createdelete+0x1b9> 1442: 83 7d e8 00 cmpl $0x0,-0x18(%ebp) 1446: 79 1b jns 1463 <createdelete+0x1b9> printf(1, "oops createdelete %s didn't exist\n", 1448: 83 ec 04 sub $0x4,%esp 144b: 8d 45 c8 lea -0x38(%ebp),%eax 144e: 50 push %eax 144f: 68 d8 4a 00 00 push $0x4ad8 1454: 6a 01 push $0x1 1456: e8 33 2c 00 00 call 408e <printf> 145b: 83 c4 10 add $0x10,%esp name); exit(); 145e: e8 6c 2a 00 00 call 3ecf <exit> } else if ((i >= 1 && i < N / 2) && fd >= 0) { 1463: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 1467: 7e 27 jle 1490 <createdelete+0x1e6> 1469: 83 7d f4 09 cmpl $0x9,-0xc(%ebp) 146d: 7f 21 jg 1490 <createdelete+0x1e6> 146f: 83 7d e8 00 cmpl $0x0,-0x18(%ebp) 1473: 78 1b js 1490 <createdelete+0x1e6> printf(1, "oops createdelete %s did exist\n", 1475: 83 ec 04 sub $0x4,%esp 1478: 8d 45 c8 lea -0x38(%ebp),%eax 147b: 50 push %eax 147c: 68 fc 4a 00 00 push $0x4afc 1481: 6a 01 push $0x1 1483: e8 06 2c 00 00 call 408e <printf> 1488: 83 c4 10 add $0x10,%esp name); exit(); 148b: e8 3f 2a 00 00 call 3ecf <exit> } if (fd >= 0) 1490: 83 7d e8 00 cmpl $0x0,-0x18(%ebp) 1494: 78 0e js 14a4 <createdelete+0x1fa> close(fd); 1496: 83 ec 0c sub $0xc,%esp 1499: ff 75 e8 pushl -0x18(%ebp) 149c: e8 56 2a 00 00 call 3ef7 <close> 14a1: 83 c4 10 add $0x10,%esp wait(); } name[0] = name[1] = name[2] = 0; for (i = 0; i < N; i++) { for (pi = 0; pi < 4; pi++) { 14a4: 83 45 f0 01 addl $0x1,-0x10(%ebp) 14a8: 83 7d f0 03 cmpl $0x3,-0x10(%ebp) 14ac: 0f 8e 5e ff ff ff jle 1410 <createdelete+0x166> for (pi = 0; pi < 4; pi++) { wait(); } name[0] = name[1] = name[2] = 0; for (i = 0; i < N; i++) { 14b2: 83 45 f4 01 addl $0x1,-0xc(%ebp) 14b6: 83 7d f4 13 cmpl $0x13,-0xc(%ebp) 14ba: 0f 8e 44 ff ff ff jle 1404 <createdelete+0x15a> if (fd >= 0) close(fd); } } for (i = 0; i < N; i++) { 14c0: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 14c7: eb 38 jmp 1501 <createdelete+0x257> for (pi = 0; pi < 4; pi++) { 14c9: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp) 14d0: eb 25 jmp 14f7 <createdelete+0x24d> name[0] = 'p' + i; 14d2: 8b 45 f4 mov -0xc(%ebp),%eax 14d5: 83 c0 70 add $0x70,%eax 14d8: 88 45 c8 mov %al,-0x38(%ebp) name[1] = '0' + i; 14db: 8b 45 f4 mov -0xc(%ebp),%eax 14de: 83 c0 30 add $0x30,%eax 14e1: 88 45 c9 mov %al,-0x37(%ebp) unlink(name); 14e4: 83 ec 0c sub $0xc,%esp 14e7: 8d 45 c8 lea -0x38(%ebp),%eax 14ea: 50 push %eax 14eb: e8 2f 2a 00 00 call 3f1f <unlink> 14f0: 83 c4 10 add $0x10,%esp close(fd); } } for (i = 0; i < N; i++) { for (pi = 0; pi < 4; pi++) { 14f3: 83 45 f0 01 addl $0x1,-0x10(%ebp) 14f7: 83 7d f0 03 cmpl $0x3,-0x10(%ebp) 14fb: 7e d5 jle 14d2 <createdelete+0x228> if (fd >= 0) close(fd); } } for (i = 0; i < N; i++) { 14fd: 83 45 f4 01 addl $0x1,-0xc(%ebp) 1501: 83 7d f4 13 cmpl $0x13,-0xc(%ebp) 1505: 7e c2 jle 14c9 <createdelete+0x21f> name[1] = '0' + i; unlink(name); } } printf(1, "createdelete ok\n"); 1507: 83 ec 08 sub $0x8,%esp 150a: 68 1c 4b 00 00 push $0x4b1c 150f: 6a 01 push $0x1 1511: e8 78 2b 00 00 call 408e <printf> 1516: 83 c4 10 add $0x10,%esp } 1519: 90 nop 151a: c9 leave 151b: c3 ret 0000151c <unlinkread>: // can I unlink a file and still read it? void unlinkread(void) { 151c: 55 push %ebp 151d: 89 e5 mov %esp,%ebp 151f: 83 ec 18 sub $0x18,%esp int fd, fd1; printf(1, "unlinkread test\n"); 1522: 83 ec 08 sub $0x8,%esp 1525: 68 2d 4b 00 00 push $0x4b2d 152a: 6a 01 push $0x1 152c: e8 5d 2b 00 00 call 408e <printf> 1531: 83 c4 10 add $0x10,%esp fd = open("unlinkread", O_CREATE | O_RDWR); 1534: 83 ec 08 sub $0x8,%esp 1537: 68 02 02 00 00 push $0x202 153c: 68 3e 4b 00 00 push $0x4b3e 1541: e8 c9 29 00 00 call 3f0f <open> 1546: 83 c4 10 add $0x10,%esp 1549: 89 45 f4 mov %eax,-0xc(%ebp) if (fd < 0) { 154c: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 1550: 79 17 jns 1569 <unlinkread+0x4d> printf(1, "create unlinkread failed\n"); 1552: 83 ec 08 sub $0x8,%esp 1555: 68 49 4b 00 00 push $0x4b49 155a: 6a 01 push $0x1 155c: e8 2d 2b 00 00 call 408e <printf> 1561: 83 c4 10 add $0x10,%esp exit(); 1564: e8 66 29 00 00 call 3ecf <exit> } write(fd, "hello", 5); 1569: 83 ec 04 sub $0x4,%esp 156c: 6a 05 push $0x5 156e: 68 63 4b 00 00 push $0x4b63 1573: ff 75 f4 pushl -0xc(%ebp) 1576: e8 74 29 00 00 call 3eef <write> 157b: 83 c4 10 add $0x10,%esp close(fd); 157e: 83 ec 0c sub $0xc,%esp 1581: ff 75 f4 pushl -0xc(%ebp) 1584: e8 6e 29 00 00 call 3ef7 <close> 1589: 83 c4 10 add $0x10,%esp fd = open("unlinkread", O_RDWR); 158c: 83 ec 08 sub $0x8,%esp 158f: 6a 02 push $0x2 1591: 68 3e 4b 00 00 push $0x4b3e 1596: e8 74 29 00 00 call 3f0f <open> 159b: 83 c4 10 add $0x10,%esp 159e: 89 45 f4 mov %eax,-0xc(%ebp) if (fd < 0) { 15a1: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 15a5: 79 17 jns 15be <unlinkread+0xa2> printf(1, "open unlinkread failed\n"); 15a7: 83 ec 08 sub $0x8,%esp 15aa: 68 69 4b 00 00 push $0x4b69 15af: 6a 01 push $0x1 15b1: e8 d8 2a 00 00 call 408e <printf> 15b6: 83 c4 10 add $0x10,%esp exit(); 15b9: e8 11 29 00 00 call 3ecf <exit> } if (unlink("unlinkread") != 0) { 15be: 83 ec 0c sub $0xc,%esp 15c1: 68 3e 4b 00 00 push $0x4b3e 15c6: e8 54 29 00 00 call 3f1f <unlink> 15cb: 83 c4 10 add $0x10,%esp 15ce: 85 c0 test %eax,%eax 15d0: 74 17 je 15e9 <unlinkread+0xcd> printf(1, "unlink unlinkread failed\n"); 15d2: 83 ec 08 sub $0x8,%esp 15d5: 68 81 4b 00 00 push $0x4b81 15da: 6a 01 push $0x1 15dc: e8 ad 2a 00 00 call 408e <printf> 15e1: 83 c4 10 add $0x10,%esp exit(); 15e4: e8 e6 28 00 00 call 3ecf <exit> } fd1 = open("unlinkread", O_CREATE | O_RDWR); 15e9: 83 ec 08 sub $0x8,%esp 15ec: 68 02 02 00 00 push $0x202 15f1: 68 3e 4b 00 00 push $0x4b3e 15f6: e8 14 29 00 00 call 3f0f <open> 15fb: 83 c4 10 add $0x10,%esp 15fe: 89 45 f0 mov %eax,-0x10(%ebp) write(fd1, "yyy", 3); 1601: 83 ec 04 sub $0x4,%esp 1604: 6a 03 push $0x3 1606: 68 9b 4b 00 00 push $0x4b9b 160b: ff 75 f0 pushl -0x10(%ebp) 160e: e8 dc 28 00 00 call 3eef <write> 1613: 83 c4 10 add $0x10,%esp close(fd1); 1616: 83 ec 0c sub $0xc,%esp 1619: ff 75 f0 pushl -0x10(%ebp) 161c: e8 d6 28 00 00 call 3ef7 <close> 1621: 83 c4 10 add $0x10,%esp if (read(fd, buf, sizeof(buf)) != 5) { 1624: 83 ec 04 sub $0x4,%esp 1627: 68 00 20 00 00 push $0x2000 162c: 68 e0 8a 00 00 push $0x8ae0 1631: ff 75 f4 pushl -0xc(%ebp) 1634: e8 ae 28 00 00 call 3ee7 <read> 1639: 83 c4 10 add $0x10,%esp 163c: 83 f8 05 cmp $0x5,%eax 163f: 74 17 je 1658 <unlinkread+0x13c> printf(1, "unlinkread read failed"); 1641: 83 ec 08 sub $0x8,%esp 1644: 68 9f 4b 00 00 push $0x4b9f 1649: 6a 01 push $0x1 164b: e8 3e 2a 00 00 call 408e <printf> 1650: 83 c4 10 add $0x10,%esp exit(); 1653: e8 77 28 00 00 call 3ecf <exit> } if (buf[0] != 'h') { 1658: 0f b6 05 e0 8a 00 00 movzbl 0x8ae0,%eax 165f: 3c 68 cmp $0x68,%al 1661: 74 17 je 167a <unlinkread+0x15e> printf(1, "unlinkread wrong data\n"); 1663: 83 ec 08 sub $0x8,%esp 1666: 68 b6 4b 00 00 push $0x4bb6 166b: 6a 01 push $0x1 166d: e8 1c 2a 00 00 call 408e <printf> 1672: 83 c4 10 add $0x10,%esp exit(); 1675: e8 55 28 00 00 call 3ecf <exit> } if (write(fd, buf, 10) != 10) { 167a: 83 ec 04 sub $0x4,%esp 167d: 6a 0a push $0xa 167f: 68 e0 8a 00 00 push $0x8ae0 1684: ff 75 f4 pushl -0xc(%ebp) 1687: e8 63 28 00 00 call 3eef <write> 168c: 83 c4 10 add $0x10,%esp 168f: 83 f8 0a cmp $0xa,%eax 1692: 74 17 je 16ab <unlinkread+0x18f> printf(1, "unlinkread write failed\n"); 1694: 83 ec 08 sub $0x8,%esp 1697: 68 cd 4b 00 00 push $0x4bcd 169c: 6a 01 push $0x1 169e: e8 eb 29 00 00 call 408e <printf> 16a3: 83 c4 10 add $0x10,%esp exit(); 16a6: e8 24 28 00 00 call 3ecf <exit> } close(fd); 16ab: 83 ec 0c sub $0xc,%esp 16ae: ff 75 f4 pushl -0xc(%ebp) 16b1: e8 41 28 00 00 call 3ef7 <close> 16b6: 83 c4 10 add $0x10,%esp unlink("unlinkread"); 16b9: 83 ec 0c sub $0xc,%esp 16bc: 68 3e 4b 00 00 push $0x4b3e 16c1: e8 59 28 00 00 call 3f1f <unlink> 16c6: 83 c4 10 add $0x10,%esp printf(1, "unlinkread ok\n"); 16c9: 83 ec 08 sub $0x8,%esp 16cc: 68 e6 4b 00 00 push $0x4be6 16d1: 6a 01 push $0x1 16d3: e8 b6 29 00 00 call 408e <printf> 16d8: 83 c4 10 add $0x10,%esp } 16db: 90 nop 16dc: c9 leave 16dd: c3 ret 000016de <linktest>: void linktest(void) { 16de: 55 push %ebp 16df: 89 e5 mov %esp,%ebp 16e1: 83 ec 18 sub $0x18,%esp int fd; printf(1, "linktest\n"); 16e4: 83 ec 08 sub $0x8,%esp 16e7: 68 f5 4b 00 00 push $0x4bf5 16ec: 6a 01 push $0x1 16ee: e8 9b 29 00 00 call 408e <printf> 16f3: 83 c4 10 add $0x10,%esp unlink("lf1"); 16f6: 83 ec 0c sub $0xc,%esp 16f9: 68 ff 4b 00 00 push $0x4bff 16fe: e8 1c 28 00 00 call 3f1f <unlink> 1703: 83 c4 10 add $0x10,%esp unlink("lf2"); 1706: 83 ec 0c sub $0xc,%esp 1709: 68 03 4c 00 00 push $0x4c03 170e: e8 0c 28 00 00 call 3f1f <unlink> 1713: 83 c4 10 add $0x10,%esp fd = open("lf1", O_CREATE | O_RDWR); 1716: 83 ec 08 sub $0x8,%esp 1719: 68 02 02 00 00 push $0x202 171e: 68 ff 4b 00 00 push $0x4bff 1723: e8 e7 27 00 00 call 3f0f <open> 1728: 83 c4 10 add $0x10,%esp 172b: 89 45 f4 mov %eax,-0xc(%ebp) if (fd < 0) { 172e: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 1732: 79 17 jns 174b <linktest+0x6d> printf(1, "create lf1 failed\n"); 1734: 83 ec 08 sub $0x8,%esp 1737: 68 07 4c 00 00 push $0x4c07 173c: 6a 01 push $0x1 173e: e8 4b 29 00 00 call 408e <printf> 1743: 83 c4 10 add $0x10,%esp exit(); 1746: e8 84 27 00 00 call 3ecf <exit> } if (write(fd, "hello", 5) != 5) { 174b: 83 ec 04 sub $0x4,%esp 174e: 6a 05 push $0x5 1750: 68 63 4b 00 00 push $0x4b63 1755: ff 75 f4 pushl -0xc(%ebp) 1758: e8 92 27 00 00 call 3eef <write> 175d: 83 c4 10 add $0x10,%esp 1760: 83 f8 05 cmp $0x5,%eax 1763: 74 17 je 177c <linktest+0x9e> printf(1, "write lf1 failed\n"); 1765: 83 ec 08 sub $0x8,%esp 1768: 68 1a 4c 00 00 push $0x4c1a 176d: 6a 01 push $0x1 176f: e8 1a 29 00 00 call 408e <printf> 1774: 83 c4 10 add $0x10,%esp exit(); 1777: e8 53 27 00 00 call 3ecf <exit> } close(fd); 177c: 83 ec 0c sub $0xc,%esp 177f: ff 75 f4 pushl -0xc(%ebp) 1782: e8 70 27 00 00 call 3ef7 <close> 1787: 83 c4 10 add $0x10,%esp if (link("lf1", "lf2") < 0) { 178a: 83 ec 08 sub $0x8,%esp 178d: 68 03 4c 00 00 push $0x4c03 1792: 68 ff 4b 00 00 push $0x4bff 1797: e8 93 27 00 00 call 3f2f <link> 179c: 83 c4 10 add $0x10,%esp 179f: 85 c0 test %eax,%eax 17a1: 79 17 jns 17ba <linktest+0xdc> printf(1, "link lf1 lf2 failed\n"); 17a3: 83 ec 08 sub $0x8,%esp 17a6: 68 2c 4c 00 00 push $0x4c2c 17ab: 6a 01 push $0x1 17ad: e8 dc 28 00 00 call 408e <printf> 17b2: 83 c4 10 add $0x10,%esp exit(); 17b5: e8 15 27 00 00 call 3ecf <exit> } unlink("lf1"); 17ba: 83 ec 0c sub $0xc,%esp 17bd: 68 ff 4b 00 00 push $0x4bff 17c2: e8 58 27 00 00 call 3f1f <unlink> 17c7: 83 c4 10 add $0x10,%esp if (open("lf1", 0) >= 0) { 17ca: 83 ec 08 sub $0x8,%esp 17cd: 6a 00 push $0x0 17cf: 68 ff 4b 00 00 push $0x4bff 17d4: e8 36 27 00 00 call 3f0f <open> 17d9: 83 c4 10 add $0x10,%esp 17dc: 85 c0 test %eax,%eax 17de: 78 17 js 17f7 <linktest+0x119> printf(1, "unlinked lf1 but it is still there!\n"); 17e0: 83 ec 08 sub $0x8,%esp 17e3: 68 44 4c 00 00 push $0x4c44 17e8: 6a 01 push $0x1 17ea: e8 9f 28 00 00 call 408e <printf> 17ef: 83 c4 10 add $0x10,%esp exit(); 17f2: e8 d8 26 00 00 call 3ecf <exit> } fd = open("lf2", 0); 17f7: 83 ec 08 sub $0x8,%esp 17fa: 6a 00 push $0x0 17fc: 68 03 4c 00 00 push $0x4c03 1801: e8 09 27 00 00 call 3f0f <open> 1806: 83 c4 10 add $0x10,%esp 1809: 89 45 f4 mov %eax,-0xc(%ebp) if (fd < 0) { 180c: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 1810: 79 17 jns 1829 <linktest+0x14b> printf(1, "open lf2 failed\n"); 1812: 83 ec 08 sub $0x8,%esp 1815: 68 69 4c 00 00 push $0x4c69 181a: 6a 01 push $0x1 181c: e8 6d 28 00 00 call 408e <printf> 1821: 83 c4 10 add $0x10,%esp exit(); 1824: e8 a6 26 00 00 call 3ecf <exit> } if (read(fd, buf, sizeof(buf)) != 5) { 1829: 83 ec 04 sub $0x4,%esp 182c: 68 00 20 00 00 push $0x2000 1831: 68 e0 8a 00 00 push $0x8ae0 1836: ff 75 f4 pushl -0xc(%ebp) 1839: e8 a9 26 00 00 call 3ee7 <read> 183e: 83 c4 10 add $0x10,%esp 1841: 83 f8 05 cmp $0x5,%eax 1844: 74 17 je 185d <linktest+0x17f> printf(1, "read lf2 failed\n"); 1846: 83 ec 08 sub $0x8,%esp 1849: 68 7a 4c 00 00 push $0x4c7a 184e: 6a 01 push $0x1 1850: e8 39 28 00 00 call 408e <printf> 1855: 83 c4 10 add $0x10,%esp exit(); 1858: e8 72 26 00 00 call 3ecf <exit> } close(fd); 185d: 83 ec 0c sub $0xc,%esp 1860: ff 75 f4 pushl -0xc(%ebp) 1863: e8 8f 26 00 00 call 3ef7 <close> 1868: 83 c4 10 add $0x10,%esp if (link("lf2", "lf2") >= 0) { 186b: 83 ec 08 sub $0x8,%esp 186e: 68 03 4c 00 00 push $0x4c03 1873: 68 03 4c 00 00 push $0x4c03 1878: e8 b2 26 00 00 call 3f2f <link> 187d: 83 c4 10 add $0x10,%esp 1880: 85 c0 test %eax,%eax 1882: 78 17 js 189b <linktest+0x1bd> printf(1, "link lf2 lf2 succeeded! oops\n"); 1884: 83 ec 08 sub $0x8,%esp 1887: 68 8b 4c 00 00 push $0x4c8b 188c: 6a 01 push $0x1 188e: e8 fb 27 00 00 call 408e <printf> 1893: 83 c4 10 add $0x10,%esp exit(); 1896: e8 34 26 00 00 call 3ecf <exit> } unlink("lf2"); 189b: 83 ec 0c sub $0xc,%esp 189e: 68 03 4c 00 00 push $0x4c03 18a3: e8 77 26 00 00 call 3f1f <unlink> 18a8: 83 c4 10 add $0x10,%esp if (link("lf2", "lf1") >= 0) { 18ab: 83 ec 08 sub $0x8,%esp 18ae: 68 ff 4b 00 00 push $0x4bff 18b3: 68 03 4c 00 00 push $0x4c03 18b8: e8 72 26 00 00 call 3f2f <link> 18bd: 83 c4 10 add $0x10,%esp 18c0: 85 c0 test %eax,%eax 18c2: 78 17 js 18db <linktest+0x1fd> printf(1, "link non-existant succeeded! oops\n"); 18c4: 83 ec 08 sub $0x8,%esp 18c7: 68 ac 4c 00 00 push $0x4cac 18cc: 6a 01 push $0x1 18ce: e8 bb 27 00 00 call 408e <printf> 18d3: 83 c4 10 add $0x10,%esp exit(); 18d6: e8 f4 25 00 00 call 3ecf <exit> } if (link(".", "lf1") >= 0) { 18db: 83 ec 08 sub $0x8,%esp 18de: 68 ff 4b 00 00 push $0x4bff 18e3: 68 cf 4c 00 00 push $0x4ccf 18e8: e8 42 26 00 00 call 3f2f <link> 18ed: 83 c4 10 add $0x10,%esp 18f0: 85 c0 test %eax,%eax 18f2: 78 17 js 190b <linktest+0x22d> printf(1, "link . lf1 succeeded! oops\n"); 18f4: 83 ec 08 sub $0x8,%esp 18f7: 68 d1 4c 00 00 push $0x4cd1 18fc: 6a 01 push $0x1 18fe: e8 8b 27 00 00 call 408e <printf> 1903: 83 c4 10 add $0x10,%esp exit(); 1906: e8 c4 25 00 00 call 3ecf <exit> } printf(1, "linktest ok\n"); 190b: 83 ec 08 sub $0x8,%esp 190e: 68 ed 4c 00 00 push $0x4ced 1913: 6a 01 push $0x1 1915: e8 74 27 00 00 call 408e <printf> 191a: 83 c4 10 add $0x10,%esp } 191d: 90 nop 191e: c9 leave 191f: c3 ret 00001920 <concreate>: // test concurrent create/link/unlink of the same file void concreate(void) { 1920: 55 push %ebp 1921: 89 e5 mov %esp,%ebp 1923: 83 ec 58 sub $0x58,%esp struct { ushort inum; char name[14]; } de; printf(1, "concreate test\n"); 1926: 83 ec 08 sub $0x8,%esp 1929: 68 fa 4c 00 00 push $0x4cfa 192e: 6a 01 push $0x1 1930: e8 59 27 00 00 call 408e <printf> 1935: 83 c4 10 add $0x10,%esp file[0] = 'C'; 1938: c6 45 e5 43 movb $0x43,-0x1b(%ebp) file[2] = '\0'; 193c: c6 45 e7 00 movb $0x0,-0x19(%ebp) for (i = 0; i < 40; i++) { 1940: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 1947: e9 fc 00 00 00 jmp 1a48 <concreate+0x128> file[1] = '0' + i; 194c: 8b 45 f4 mov -0xc(%ebp),%eax 194f: 83 c0 30 add $0x30,%eax 1952: 88 45 e6 mov %al,-0x1a(%ebp) unlink(file); 1955: 83 ec 0c sub $0xc,%esp 1958: 8d 45 e5 lea -0x1b(%ebp),%eax 195b: 50 push %eax 195c: e8 be 25 00 00 call 3f1f <unlink> 1961: 83 c4 10 add $0x10,%esp pid = fork(); 1964: e8 5e 25 00 00 call 3ec7 <fork> 1969: 89 45 ec mov %eax,-0x14(%ebp) if (pid && (i % 3) == 1) { 196c: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 1970: 74 3b je 19ad <concreate+0x8d> 1972: 8b 4d f4 mov -0xc(%ebp),%ecx 1975: ba 56 55 55 55 mov $0x55555556,%edx 197a: 89 c8 mov %ecx,%eax 197c: f7 ea imul %edx 197e: 89 c8 mov %ecx,%eax 1980: c1 f8 1f sar $0x1f,%eax 1983: 29 c2 sub %eax,%edx 1985: 89 d0 mov %edx,%eax 1987: 01 c0 add %eax,%eax 1989: 01 d0 add %edx,%eax 198b: 29 c1 sub %eax,%ecx 198d: 89 ca mov %ecx,%edx 198f: 83 fa 01 cmp $0x1,%edx 1992: 75 19 jne 19ad <concreate+0x8d> link("C0", file); 1994: 83 ec 08 sub $0x8,%esp 1997: 8d 45 e5 lea -0x1b(%ebp),%eax 199a: 50 push %eax 199b: 68 0a 4d 00 00 push $0x4d0a 19a0: e8 8a 25 00 00 call 3f2f <link> 19a5: 83 c4 10 add $0x10,%esp 19a8: e9 87 00 00 00 jmp 1a34 <concreate+0x114> } else if (pid == 0 && (i % 5) == 1) { 19ad: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 19b1: 75 3b jne 19ee <concreate+0xce> 19b3: 8b 4d f4 mov -0xc(%ebp),%ecx 19b6: ba 67 66 66 66 mov $0x66666667,%edx 19bb: 89 c8 mov %ecx,%eax 19bd: f7 ea imul %edx 19bf: d1 fa sar %edx 19c1: 89 c8 mov %ecx,%eax 19c3: c1 f8 1f sar $0x1f,%eax 19c6: 29 c2 sub %eax,%edx 19c8: 89 d0 mov %edx,%eax 19ca: c1 e0 02 shl $0x2,%eax 19cd: 01 d0 add %edx,%eax 19cf: 29 c1 sub %eax,%ecx 19d1: 89 ca mov %ecx,%edx 19d3: 83 fa 01 cmp $0x1,%edx 19d6: 75 16 jne 19ee <concreate+0xce> link("C0", file); 19d8: 83 ec 08 sub $0x8,%esp 19db: 8d 45 e5 lea -0x1b(%ebp),%eax 19de: 50 push %eax 19df: 68 0a 4d 00 00 push $0x4d0a 19e4: e8 46 25 00 00 call 3f2f <link> 19e9: 83 c4 10 add $0x10,%esp 19ec: eb 46 jmp 1a34 <concreate+0x114> } else { fd = open(file, O_CREATE | O_RDWR); 19ee: 83 ec 08 sub $0x8,%esp 19f1: 68 02 02 00 00 push $0x202 19f6: 8d 45 e5 lea -0x1b(%ebp),%eax 19f9: 50 push %eax 19fa: e8 10 25 00 00 call 3f0f <open> 19ff: 83 c4 10 add $0x10,%esp 1a02: 89 45 e8 mov %eax,-0x18(%ebp) if (fd < 0) { 1a05: 83 7d e8 00 cmpl $0x0,-0x18(%ebp) 1a09: 79 1b jns 1a26 <concreate+0x106> printf(1, "concreate create %s failed\n", file); 1a0b: 83 ec 04 sub $0x4,%esp 1a0e: 8d 45 e5 lea -0x1b(%ebp),%eax 1a11: 50 push %eax 1a12: 68 0d 4d 00 00 push $0x4d0d 1a17: 6a 01 push $0x1 1a19: e8 70 26 00 00 call 408e <printf> 1a1e: 83 c4 10 add $0x10,%esp exit(); 1a21: e8 a9 24 00 00 call 3ecf <exit> } close(fd); 1a26: 83 ec 0c sub $0xc,%esp 1a29: ff 75 e8 pushl -0x18(%ebp) 1a2c: e8 c6 24 00 00 call 3ef7 <close> 1a31: 83 c4 10 add $0x10,%esp } if (pid == 0) 1a34: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 1a38: 75 05 jne 1a3f <concreate+0x11f> exit(); 1a3a: e8 90 24 00 00 call 3ecf <exit> else wait(); 1a3f: e8 93 24 00 00 call 3ed7 <wait> } de; printf(1, "concreate test\n"); file[0] = 'C'; file[2] = '\0'; for (i = 0; i < 40; i++) { 1a44: 83 45 f4 01 addl $0x1,-0xc(%ebp) 1a48: 83 7d f4 27 cmpl $0x27,-0xc(%ebp) 1a4c: 0f 8e fa fe ff ff jle 194c <concreate+0x2c> exit(); else wait(); } memset(fa, 0, sizeof(fa)); 1a52: 83 ec 04 sub $0x4,%esp 1a55: 6a 28 push $0x28 1a57: 6a 00 push $0x0 1a59: 8d 45 bd lea -0x43(%ebp),%eax 1a5c: 50 push %eax 1a5d: e8 d2 22 00 00 call 3d34 <memset> 1a62: 83 c4 10 add $0x10,%esp fd = open(".", 0); 1a65: 83 ec 08 sub $0x8,%esp 1a68: 6a 00 push $0x0 1a6a: 68 cf 4c 00 00 push $0x4ccf 1a6f: e8 9b 24 00 00 call 3f0f <open> 1a74: 83 c4 10 add $0x10,%esp 1a77: 89 45 e8 mov %eax,-0x18(%ebp) n = 0; 1a7a: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp) while (read(fd, &de, sizeof(de)) > 0) { 1a81: e9 93 00 00 00 jmp 1b19 <concreate+0x1f9> if (de.inum == 0) 1a86: 0f b7 45 ac movzwl -0x54(%ebp),%eax 1a8a: 66 85 c0 test %ax,%ax 1a8d: 75 05 jne 1a94 <concreate+0x174> continue; 1a8f: e9 85 00 00 00 jmp 1b19 <concreate+0x1f9> if (de.name[0] == 'C' && de.name[2] == '\0') { 1a94: 0f b6 45 ae movzbl -0x52(%ebp),%eax 1a98: 3c 43 cmp $0x43,%al 1a9a: 75 7d jne 1b19 <concreate+0x1f9> 1a9c: 0f b6 45 b0 movzbl -0x50(%ebp),%eax 1aa0: 84 c0 test %al,%al 1aa2: 75 75 jne 1b19 <concreate+0x1f9> i = de.name[1] - '0'; 1aa4: 0f b6 45 af movzbl -0x51(%ebp),%eax 1aa8: 0f be c0 movsbl %al,%eax 1aab: 83 e8 30 sub $0x30,%eax 1aae: 89 45 f4 mov %eax,-0xc(%ebp) if (i < 0 || i >= sizeof(fa)) { 1ab1: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 1ab5: 78 08 js 1abf <concreate+0x19f> 1ab7: 8b 45 f4 mov -0xc(%ebp),%eax 1aba: 83 f8 27 cmp $0x27,%eax 1abd: 76 1e jbe 1add <concreate+0x1bd> printf(1, "concreate weird file %s\n", de.name); 1abf: 83 ec 04 sub $0x4,%esp 1ac2: 8d 45 ac lea -0x54(%ebp),%eax 1ac5: 83 c0 02 add $0x2,%eax 1ac8: 50 push %eax 1ac9: 68 29 4d 00 00 push $0x4d29 1ace: 6a 01 push $0x1 1ad0: e8 b9 25 00 00 call 408e <printf> 1ad5: 83 c4 10 add $0x10,%esp exit(); 1ad8: e8 f2 23 00 00 call 3ecf <exit> } if (fa[i]) { 1add: 8d 55 bd lea -0x43(%ebp),%edx 1ae0: 8b 45 f4 mov -0xc(%ebp),%eax 1ae3: 01 d0 add %edx,%eax 1ae5: 0f b6 00 movzbl (%eax),%eax 1ae8: 84 c0 test %al,%al 1aea: 74 1e je 1b0a <concreate+0x1ea> printf(1, "concreate duplicate file %s\n", 1aec: 83 ec 04 sub $0x4,%esp 1aef: 8d 45 ac lea -0x54(%ebp),%eax 1af2: 83 c0 02 add $0x2,%eax 1af5: 50 push %eax 1af6: 68 42 4d 00 00 push $0x4d42 1afb: 6a 01 push $0x1 1afd: e8 8c 25 00 00 call 408e <printf> 1b02: 83 c4 10 add $0x10,%esp de.name); exit(); 1b05: e8 c5 23 00 00 call 3ecf <exit> } fa[i] = 1; 1b0a: 8d 55 bd lea -0x43(%ebp),%edx 1b0d: 8b 45 f4 mov -0xc(%ebp),%eax 1b10: 01 d0 add %edx,%eax 1b12: c6 00 01 movb $0x1,(%eax) n++; 1b15: 83 45 f0 01 addl $0x1,-0x10(%ebp) } memset(fa, 0, sizeof(fa)); fd = open(".", 0); n = 0; while (read(fd, &de, sizeof(de)) > 0) { 1b19: 83 ec 04 sub $0x4,%esp 1b1c: 6a 10 push $0x10 1b1e: 8d 45 ac lea -0x54(%ebp),%eax 1b21: 50 push %eax 1b22: ff 75 e8 pushl -0x18(%ebp) 1b25: e8 bd 23 00 00 call 3ee7 <read> 1b2a: 83 c4 10 add $0x10,%esp 1b2d: 85 c0 test %eax,%eax 1b2f: 0f 8f 51 ff ff ff jg 1a86 <concreate+0x166> } fa[i] = 1; n++; } } close(fd); 1b35: 83 ec 0c sub $0xc,%esp 1b38: ff 75 e8 pushl -0x18(%ebp) 1b3b: e8 b7 23 00 00 call 3ef7 <close> 1b40: 83 c4 10 add $0x10,%esp if (n != 40) { 1b43: 83 7d f0 28 cmpl $0x28,-0x10(%ebp) 1b47: 74 17 je 1b60 <concreate+0x240> printf(1, "concreate not enough files in directory listing\n"); 1b49: 83 ec 08 sub $0x8,%esp 1b4c: 68 60 4d 00 00 push $0x4d60 1b51: 6a 01 push $0x1 1b53: e8 36 25 00 00 call 408e <printf> 1b58: 83 c4 10 add $0x10,%esp exit(); 1b5b: e8 6f 23 00 00 call 3ecf <exit> } for (i = 0; i < 40; i++) { 1b60: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 1b67: e9 45 01 00 00 jmp 1cb1 <concreate+0x391> file[1] = '0' + i; 1b6c: 8b 45 f4 mov -0xc(%ebp),%eax 1b6f: 83 c0 30 add $0x30,%eax 1b72: 88 45 e6 mov %al,-0x1a(%ebp) pid = fork(); 1b75: e8 4d 23 00 00 call 3ec7 <fork> 1b7a: 89 45 ec mov %eax,-0x14(%ebp) if (pid < 0) { 1b7d: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 1b81: 79 17 jns 1b9a <concreate+0x27a> printf(1, "fork failed\n"); 1b83: 83 ec 08 sub $0x8,%esp 1b86: 68 e5 44 00 00 push $0x44e5 1b8b: 6a 01 push $0x1 1b8d: e8 fc 24 00 00 call 408e <printf> 1b92: 83 c4 10 add $0x10,%esp exit(); 1b95: e8 35 23 00 00 call 3ecf <exit> } if (((i % 3) == 0 && pid == 0) || ((i % 3) == 1 && pid != 0)) { 1b9a: 8b 4d f4 mov -0xc(%ebp),%ecx 1b9d: ba 56 55 55 55 mov $0x55555556,%edx 1ba2: 89 c8 mov %ecx,%eax 1ba4: f7 ea imul %edx 1ba6: 89 c8 mov %ecx,%eax 1ba8: c1 f8 1f sar $0x1f,%eax 1bab: 29 c2 sub %eax,%edx 1bad: 89 d0 mov %edx,%eax 1baf: 89 c2 mov %eax,%edx 1bb1: 01 d2 add %edx,%edx 1bb3: 01 c2 add %eax,%edx 1bb5: 89 c8 mov %ecx,%eax 1bb7: 29 d0 sub %edx,%eax 1bb9: 85 c0 test %eax,%eax 1bbb: 75 06 jne 1bc3 <concreate+0x2a3> 1bbd: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 1bc1: 74 28 je 1beb <concreate+0x2cb> 1bc3: 8b 4d f4 mov -0xc(%ebp),%ecx 1bc6: ba 56 55 55 55 mov $0x55555556,%edx 1bcb: 89 c8 mov %ecx,%eax 1bcd: f7 ea imul %edx 1bcf: 89 c8 mov %ecx,%eax 1bd1: c1 f8 1f sar $0x1f,%eax 1bd4: 29 c2 sub %eax,%edx 1bd6: 89 d0 mov %edx,%eax 1bd8: 01 c0 add %eax,%eax 1bda: 01 d0 add %edx,%eax 1bdc: 29 c1 sub %eax,%ecx 1bde: 89 ca mov %ecx,%edx 1be0: 83 fa 01 cmp $0x1,%edx 1be3: 75 7c jne 1c61 <concreate+0x341> 1be5: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 1be9: 74 76 je 1c61 <concreate+0x341> close(open(file, 0)); 1beb: 83 ec 08 sub $0x8,%esp 1bee: 6a 00 push $0x0 1bf0: 8d 45 e5 lea -0x1b(%ebp),%eax 1bf3: 50 push %eax 1bf4: e8 16 23 00 00 call 3f0f <open> 1bf9: 83 c4 10 add $0x10,%esp 1bfc: 83 ec 0c sub $0xc,%esp 1bff: 50 push %eax 1c00: e8 f2 22 00 00 call 3ef7 <close> 1c05: 83 c4 10 add $0x10,%esp close(open(file, 0)); 1c08: 83 ec 08 sub $0x8,%esp 1c0b: 6a 00 push $0x0 1c0d: 8d 45 e5 lea -0x1b(%ebp),%eax 1c10: 50 push %eax 1c11: e8 f9 22 00 00 call 3f0f <open> 1c16: 83 c4 10 add $0x10,%esp 1c19: 83 ec 0c sub $0xc,%esp 1c1c: 50 push %eax 1c1d: e8 d5 22 00 00 call 3ef7 <close> 1c22: 83 c4 10 add $0x10,%esp close(open(file, 0)); 1c25: 83 ec 08 sub $0x8,%esp 1c28: 6a 00 push $0x0 1c2a: 8d 45 e5 lea -0x1b(%ebp),%eax 1c2d: 50 push %eax 1c2e: e8 dc 22 00 00 call 3f0f <open> 1c33: 83 c4 10 add $0x10,%esp 1c36: 83 ec 0c sub $0xc,%esp 1c39: 50 push %eax 1c3a: e8 b8 22 00 00 call 3ef7 <close> 1c3f: 83 c4 10 add $0x10,%esp close(open(file, 0)); 1c42: 83 ec 08 sub $0x8,%esp 1c45: 6a 00 push $0x0 1c47: 8d 45 e5 lea -0x1b(%ebp),%eax 1c4a: 50 push %eax 1c4b: e8 bf 22 00 00 call 3f0f <open> 1c50: 83 c4 10 add $0x10,%esp 1c53: 83 ec 0c sub $0xc,%esp 1c56: 50 push %eax 1c57: e8 9b 22 00 00 call 3ef7 <close> 1c5c: 83 c4 10 add $0x10,%esp 1c5f: eb 3c jmp 1c9d <concreate+0x37d> } else { unlink(file); 1c61: 83 ec 0c sub $0xc,%esp 1c64: 8d 45 e5 lea -0x1b(%ebp),%eax 1c67: 50 push %eax 1c68: e8 b2 22 00 00 call 3f1f <unlink> 1c6d: 83 c4 10 add $0x10,%esp unlink(file); 1c70: 83 ec 0c sub $0xc,%esp 1c73: 8d 45 e5 lea -0x1b(%ebp),%eax 1c76: 50 push %eax 1c77: e8 a3 22 00 00 call 3f1f <unlink> 1c7c: 83 c4 10 add $0x10,%esp unlink(file); 1c7f: 83 ec 0c sub $0xc,%esp 1c82: 8d 45 e5 lea -0x1b(%ebp),%eax 1c85: 50 push %eax 1c86: e8 94 22 00 00 call 3f1f <unlink> 1c8b: 83 c4 10 add $0x10,%esp unlink(file); 1c8e: 83 ec 0c sub $0xc,%esp 1c91: 8d 45 e5 lea -0x1b(%ebp),%eax 1c94: 50 push %eax 1c95: e8 85 22 00 00 call 3f1f <unlink> 1c9a: 83 c4 10 add $0x10,%esp } if (pid == 0) 1c9d: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 1ca1: 75 05 jne 1ca8 <concreate+0x388> exit(); 1ca3: e8 27 22 00 00 call 3ecf <exit> else wait(); 1ca8: e8 2a 22 00 00 call 3ed7 <wait> if (n != 40) { printf(1, "concreate not enough files in directory listing\n"); exit(); } for (i = 0; i < 40; i++) { 1cad: 83 45 f4 01 addl $0x1,-0xc(%ebp) 1cb1: 83 7d f4 27 cmpl $0x27,-0xc(%ebp) 1cb5: 0f 8e b1 fe ff ff jle 1b6c <concreate+0x24c> exit(); else wait(); } printf(1, "concreate ok\n"); 1cbb: 83 ec 08 sub $0x8,%esp 1cbe: 68 91 4d 00 00 push $0x4d91 1cc3: 6a 01 push $0x1 1cc5: e8 c4 23 00 00 call 408e <printf> 1cca: 83 c4 10 add $0x10,%esp } 1ccd: 90 nop 1cce: c9 leave 1ccf: c3 ret 00001cd0 <linkunlink>: // another concurrent link/unlink/create test, // to look for deadlocks. void linkunlink() { 1cd0: 55 push %ebp 1cd1: 89 e5 mov %esp,%ebp 1cd3: 83 ec 18 sub $0x18,%esp int pid, i; printf(1, "linkunlink test\n"); 1cd6: 83 ec 08 sub $0x8,%esp 1cd9: 68 9f 4d 00 00 push $0x4d9f 1cde: 6a 01 push $0x1 1ce0: e8 a9 23 00 00 call 408e <printf> 1ce5: 83 c4 10 add $0x10,%esp unlink("x"); 1ce8: 83 ec 0c sub $0xc,%esp 1ceb: 68 1b 49 00 00 push $0x491b 1cf0: e8 2a 22 00 00 call 3f1f <unlink> 1cf5: 83 c4 10 add $0x10,%esp pid = fork(); 1cf8: e8 ca 21 00 00 call 3ec7 <fork> 1cfd: 89 45 ec mov %eax,-0x14(%ebp) if (pid < 0) { 1d00: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 1d04: 79 17 jns 1d1d <linkunlink+0x4d> printf(1, "fork failed\n"); 1d06: 83 ec 08 sub $0x8,%esp 1d09: 68 e5 44 00 00 push $0x44e5 1d0e: 6a 01 push $0x1 1d10: e8 79 23 00 00 call 408e <printf> 1d15: 83 c4 10 add $0x10,%esp exit(); 1d18: e8 b2 21 00 00 call 3ecf <exit> } unsigned int x = (pid ? 1 : 97); 1d1d: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 1d21: 74 07 je 1d2a <linkunlink+0x5a> 1d23: b8 01 00 00 00 mov $0x1,%eax 1d28: eb 05 jmp 1d2f <linkunlink+0x5f> 1d2a: b8 61 00 00 00 mov $0x61,%eax 1d2f: 89 45 f0 mov %eax,-0x10(%ebp) for (i = 0; i < 100; i++) { 1d32: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 1d39: e9 9a 00 00 00 jmp 1dd8 <linkunlink+0x108> x = x * 1103515245 + 12345; 1d3e: 8b 45 f0 mov -0x10(%ebp),%eax 1d41: 69 c0 6d 4e c6 41 imul $0x41c64e6d,%eax,%eax 1d47: 05 39 30 00 00 add $0x3039,%eax 1d4c: 89 45 f0 mov %eax,-0x10(%ebp) if ((x % 3) == 0) { 1d4f: 8b 4d f0 mov -0x10(%ebp),%ecx 1d52: ba ab aa aa aa mov $0xaaaaaaab,%edx 1d57: 89 c8 mov %ecx,%eax 1d59: f7 e2 mul %edx 1d5b: 89 d0 mov %edx,%eax 1d5d: d1 e8 shr %eax 1d5f: 89 c2 mov %eax,%edx 1d61: 01 d2 add %edx,%edx 1d63: 01 c2 add %eax,%edx 1d65: 89 c8 mov %ecx,%eax 1d67: 29 d0 sub %edx,%eax 1d69: 85 c0 test %eax,%eax 1d6b: 75 23 jne 1d90 <linkunlink+0xc0> close(open("x", O_RDWR | O_CREATE)); 1d6d: 83 ec 08 sub $0x8,%esp 1d70: 68 02 02 00 00 push $0x202 1d75: 68 1b 49 00 00 push $0x491b 1d7a: e8 90 21 00 00 call 3f0f <open> 1d7f: 83 c4 10 add $0x10,%esp 1d82: 83 ec 0c sub $0xc,%esp 1d85: 50 push %eax 1d86: e8 6c 21 00 00 call 3ef7 <close> 1d8b: 83 c4 10 add $0x10,%esp 1d8e: eb 44 jmp 1dd4 <linkunlink+0x104> } else if ((x % 3) == 1) { 1d90: 8b 4d f0 mov -0x10(%ebp),%ecx 1d93: ba ab aa aa aa mov $0xaaaaaaab,%edx 1d98: 89 c8 mov %ecx,%eax 1d9a: f7 e2 mul %edx 1d9c: d1 ea shr %edx 1d9e: 89 d0 mov %edx,%eax 1da0: 01 c0 add %eax,%eax 1da2: 01 d0 add %edx,%eax 1da4: 29 c1 sub %eax,%ecx 1da6: 89 ca mov %ecx,%edx 1da8: 83 fa 01 cmp $0x1,%edx 1dab: 75 17 jne 1dc4 <linkunlink+0xf4> link("cat", "x"); 1dad: 83 ec 08 sub $0x8,%esp 1db0: 68 1b 49 00 00 push $0x491b 1db5: 68 b0 4d 00 00 push $0x4db0 1dba: e8 70 21 00 00 call 3f2f <link> 1dbf: 83 c4 10 add $0x10,%esp 1dc2: eb 10 jmp 1dd4 <linkunlink+0x104> } else { unlink("x"); 1dc4: 83 ec 0c sub $0xc,%esp 1dc7: 68 1b 49 00 00 push $0x491b 1dcc: e8 4e 21 00 00 call 3f1f <unlink> 1dd1: 83 c4 10 add $0x10,%esp printf(1, "fork failed\n"); exit(); } unsigned int x = (pid ? 1 : 97); for (i = 0; i < 100; i++) { 1dd4: 83 45 f4 01 addl $0x1,-0xc(%ebp) 1dd8: 83 7d f4 63 cmpl $0x63,-0xc(%ebp) 1ddc: 0f 8e 5c ff ff ff jle 1d3e <linkunlink+0x6e> } else { unlink("x"); } } if (pid) 1de2: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 1de6: 74 07 je 1def <linkunlink+0x11f> wait(); 1de8: e8 ea 20 00 00 call 3ed7 <wait> 1ded: eb 05 jmp 1df4 <linkunlink+0x124> else exit(); 1def: e8 db 20 00 00 call 3ecf <exit> printf(1, "linkunlink ok\n"); 1df4: 83 ec 08 sub $0x8,%esp 1df7: 68 b4 4d 00 00 push $0x4db4 1dfc: 6a 01 push $0x1 1dfe: e8 8b 22 00 00 call 408e <printf> 1e03: 83 c4 10 add $0x10,%esp } 1e06: 90 nop 1e07: c9 leave 1e08: c3 ret 00001e09 <bigdir>: // directory that uses indirect blocks void bigdir(void) { 1e09: 55 push %ebp 1e0a: 89 e5 mov %esp,%ebp 1e0c: 83 ec 28 sub $0x28,%esp int i, fd; char name[10]; printf(1, "bigdir test\n"); 1e0f: 83 ec 08 sub $0x8,%esp 1e12: 68 c3 4d 00 00 push $0x4dc3 1e17: 6a 01 push $0x1 1e19: e8 70 22 00 00 call 408e <printf> 1e1e: 83 c4 10 add $0x10,%esp unlink("bd"); 1e21: 83 ec 0c sub $0xc,%esp 1e24: 68 d0 4d 00 00 push $0x4dd0 1e29: e8 f1 20 00 00 call 3f1f <unlink> 1e2e: 83 c4 10 add $0x10,%esp fd = open("bd", O_CREATE); 1e31: 83 ec 08 sub $0x8,%esp 1e34: 68 00 02 00 00 push $0x200 1e39: 68 d0 4d 00 00 push $0x4dd0 1e3e: e8 cc 20 00 00 call 3f0f <open> 1e43: 83 c4 10 add $0x10,%esp 1e46: 89 45 f0 mov %eax,-0x10(%ebp) if (fd < 0) { 1e49: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 1e4d: 79 17 jns 1e66 <bigdir+0x5d> printf(1, "bigdir create failed\n"); 1e4f: 83 ec 08 sub $0x8,%esp 1e52: 68 d3 4d 00 00 push $0x4dd3 1e57: 6a 01 push $0x1 1e59: e8 30 22 00 00 call 408e <printf> 1e5e: 83 c4 10 add $0x10,%esp exit(); 1e61: e8 69 20 00 00 call 3ecf <exit> } close(fd); 1e66: 83 ec 0c sub $0xc,%esp 1e69: ff 75 f0 pushl -0x10(%ebp) 1e6c: e8 86 20 00 00 call 3ef7 <close> 1e71: 83 c4 10 add $0x10,%esp for (i = 0; i < 500; i++) { 1e74: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 1e7b: eb 63 jmp 1ee0 <bigdir+0xd7> name[0] = 'x'; 1e7d: c6 45 e6 78 movb $0x78,-0x1a(%ebp) name[1] = '0' + (i / 64); 1e81: 8b 45 f4 mov -0xc(%ebp),%eax 1e84: 8d 50 3f lea 0x3f(%eax),%edx 1e87: 85 c0 test %eax,%eax 1e89: 0f 48 c2 cmovs %edx,%eax 1e8c: c1 f8 06 sar $0x6,%eax 1e8f: 83 c0 30 add $0x30,%eax 1e92: 88 45 e7 mov %al,-0x19(%ebp) name[2] = '0' + (i % 64); 1e95: 8b 45 f4 mov -0xc(%ebp),%eax 1e98: 99 cltd 1e99: c1 ea 1a shr $0x1a,%edx 1e9c: 01 d0 add %edx,%eax 1e9e: 83 e0 3f and $0x3f,%eax 1ea1: 29 d0 sub %edx,%eax 1ea3: 83 c0 30 add $0x30,%eax 1ea6: 88 45 e8 mov %al,-0x18(%ebp) name[3] = '\0'; 1ea9: c6 45 e9 00 movb $0x0,-0x17(%ebp) if (link("bd", name) != 0) { 1ead: 83 ec 08 sub $0x8,%esp 1eb0: 8d 45 e6 lea -0x1a(%ebp),%eax 1eb3: 50 push %eax 1eb4: 68 d0 4d 00 00 push $0x4dd0 1eb9: e8 71 20 00 00 call 3f2f <link> 1ebe: 83 c4 10 add $0x10,%esp 1ec1: 85 c0 test %eax,%eax 1ec3: 74 17 je 1edc <bigdir+0xd3> printf(1, "bigdir link failed\n"); 1ec5: 83 ec 08 sub $0x8,%esp 1ec8: 68 e9 4d 00 00 push $0x4de9 1ecd: 6a 01 push $0x1 1ecf: e8 ba 21 00 00 call 408e <printf> 1ed4: 83 c4 10 add $0x10,%esp exit(); 1ed7: e8 f3 1f 00 00 call 3ecf <exit> printf(1, "bigdir create failed\n"); exit(); } close(fd); for (i = 0; i < 500; i++) { 1edc: 83 45 f4 01 addl $0x1,-0xc(%ebp) 1ee0: 81 7d f4 f3 01 00 00 cmpl $0x1f3,-0xc(%ebp) 1ee7: 7e 94 jle 1e7d <bigdir+0x74> printf(1, "bigdir link failed\n"); exit(); } } unlink("bd"); 1ee9: 83 ec 0c sub $0xc,%esp 1eec: 68 d0 4d 00 00 push $0x4dd0 1ef1: e8 29 20 00 00 call 3f1f <unlink> 1ef6: 83 c4 10 add $0x10,%esp for (i = 0; i < 500; i++) { 1ef9: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 1f00: eb 5e jmp 1f60 <bigdir+0x157> name[0] = 'x'; 1f02: c6 45 e6 78 movb $0x78,-0x1a(%ebp) name[1] = '0' + (i / 64); 1f06: 8b 45 f4 mov -0xc(%ebp),%eax 1f09: 8d 50 3f lea 0x3f(%eax),%edx 1f0c: 85 c0 test %eax,%eax 1f0e: 0f 48 c2 cmovs %edx,%eax 1f11: c1 f8 06 sar $0x6,%eax 1f14: 83 c0 30 add $0x30,%eax 1f17: 88 45 e7 mov %al,-0x19(%ebp) name[2] = '0' + (i % 64); 1f1a: 8b 45 f4 mov -0xc(%ebp),%eax 1f1d: 99 cltd 1f1e: c1 ea 1a shr $0x1a,%edx 1f21: 01 d0 add %edx,%eax 1f23: 83 e0 3f and $0x3f,%eax 1f26: 29 d0 sub %edx,%eax 1f28: 83 c0 30 add $0x30,%eax 1f2b: 88 45 e8 mov %al,-0x18(%ebp) name[3] = '\0'; 1f2e: c6 45 e9 00 movb $0x0,-0x17(%ebp) if (unlink(name) != 0) { 1f32: 83 ec 0c sub $0xc,%esp 1f35: 8d 45 e6 lea -0x1a(%ebp),%eax 1f38: 50 push %eax 1f39: e8 e1 1f 00 00 call 3f1f <unlink> 1f3e: 83 c4 10 add $0x10,%esp 1f41: 85 c0 test %eax,%eax 1f43: 74 17 je 1f5c <bigdir+0x153> printf(1, "bigdir unlink failed"); 1f45: 83 ec 08 sub $0x8,%esp 1f48: 68 fd 4d 00 00 push $0x4dfd 1f4d: 6a 01 push $0x1 1f4f: e8 3a 21 00 00 call 408e <printf> 1f54: 83 c4 10 add $0x10,%esp exit(); 1f57: e8 73 1f 00 00 call 3ecf <exit> exit(); } } unlink("bd"); for (i = 0; i < 500; i++) { 1f5c: 83 45 f4 01 addl $0x1,-0xc(%ebp) 1f60: 81 7d f4 f3 01 00 00 cmpl $0x1f3,-0xc(%ebp) 1f67: 7e 99 jle 1f02 <bigdir+0xf9> printf(1, "bigdir unlink failed"); exit(); } } printf(1, "bigdir ok\n"); 1f69: 83 ec 08 sub $0x8,%esp 1f6c: 68 12 4e 00 00 push $0x4e12 1f71: 6a 01 push $0x1 1f73: e8 16 21 00 00 call 408e <printf> 1f78: 83 c4 10 add $0x10,%esp } 1f7b: 90 nop 1f7c: c9 leave 1f7d: c3 ret 00001f7e <subdir>: void subdir(void) { 1f7e: 55 push %ebp 1f7f: 89 e5 mov %esp,%ebp 1f81: 83 ec 18 sub $0x18,%esp int fd, cc; printf(1, "subdir test\n"); 1f84: 83 ec 08 sub $0x8,%esp 1f87: 68 1d 4e 00 00 push $0x4e1d 1f8c: 6a 01 push $0x1 1f8e: e8 fb 20 00 00 call 408e <printf> 1f93: 83 c4 10 add $0x10,%esp unlink("ff"); 1f96: 83 ec 0c sub $0xc,%esp 1f99: 68 2a 4e 00 00 push $0x4e2a 1f9e: e8 7c 1f 00 00 call 3f1f <unlink> 1fa3: 83 c4 10 add $0x10,%esp if (mkdir("dd") != 0) { 1fa6: 83 ec 0c sub $0xc,%esp 1fa9: 68 2d 4e 00 00 push $0x4e2d 1fae: e8 84 1f 00 00 call 3f37 <mkdir> 1fb3: 83 c4 10 add $0x10,%esp 1fb6: 85 c0 test %eax,%eax 1fb8: 74 17 je 1fd1 <subdir+0x53> printf(1, "subdir mkdir dd failed\n"); 1fba: 83 ec 08 sub $0x8,%esp 1fbd: 68 30 4e 00 00 push $0x4e30 1fc2: 6a 01 push $0x1 1fc4: e8 c5 20 00 00 call 408e <printf> 1fc9: 83 c4 10 add $0x10,%esp exit(); 1fcc: e8 fe 1e 00 00 call 3ecf <exit> } fd = open("dd/ff", O_CREATE | O_RDWR); 1fd1: 83 ec 08 sub $0x8,%esp 1fd4: 68 02 02 00 00 push $0x202 1fd9: 68 48 4e 00 00 push $0x4e48 1fde: e8 2c 1f 00 00 call 3f0f <open> 1fe3: 83 c4 10 add $0x10,%esp 1fe6: 89 45 f4 mov %eax,-0xc(%ebp) if (fd < 0) { 1fe9: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 1fed: 79 17 jns 2006 <subdir+0x88> printf(1, "create dd/ff failed\n"); 1fef: 83 ec 08 sub $0x8,%esp 1ff2: 68 4e 4e 00 00 push $0x4e4e 1ff7: 6a 01 push $0x1 1ff9: e8 90 20 00 00 call 408e <printf> 1ffe: 83 c4 10 add $0x10,%esp exit(); 2001: e8 c9 1e 00 00 call 3ecf <exit> } write(fd, "ff", 2); 2006: 83 ec 04 sub $0x4,%esp 2009: 6a 02 push $0x2 200b: 68 2a 4e 00 00 push $0x4e2a 2010: ff 75 f4 pushl -0xc(%ebp) 2013: e8 d7 1e 00 00 call 3eef <write> 2018: 83 c4 10 add $0x10,%esp close(fd); 201b: 83 ec 0c sub $0xc,%esp 201e: ff 75 f4 pushl -0xc(%ebp) 2021: e8 d1 1e 00 00 call 3ef7 <close> 2026: 83 c4 10 add $0x10,%esp if (unlink("dd") >= 0) { 2029: 83 ec 0c sub $0xc,%esp 202c: 68 2d 4e 00 00 push $0x4e2d 2031: e8 e9 1e 00 00 call 3f1f <unlink> 2036: 83 c4 10 add $0x10,%esp 2039: 85 c0 test %eax,%eax 203b: 78 17 js 2054 <subdir+0xd6> printf(1, "unlink dd (non-empty dir) succeeded!\n"); 203d: 83 ec 08 sub $0x8,%esp 2040: 68 64 4e 00 00 push $0x4e64 2045: 6a 01 push $0x1 2047: e8 42 20 00 00 call 408e <printf> 204c: 83 c4 10 add $0x10,%esp exit(); 204f: e8 7b 1e 00 00 call 3ecf <exit> } if (mkdir("/dd/dd") != 0) { 2054: 83 ec 0c sub $0xc,%esp 2057: 68 8a 4e 00 00 push $0x4e8a 205c: e8 d6 1e 00 00 call 3f37 <mkdir> 2061: 83 c4 10 add $0x10,%esp 2064: 85 c0 test %eax,%eax 2066: 74 17 je 207f <subdir+0x101> printf(1, "subdir mkdir dd/dd failed\n"); 2068: 83 ec 08 sub $0x8,%esp 206b: 68 91 4e 00 00 push $0x4e91 2070: 6a 01 push $0x1 2072: e8 17 20 00 00 call 408e <printf> 2077: 83 c4 10 add $0x10,%esp exit(); 207a: e8 50 1e 00 00 call 3ecf <exit> } fd = open("dd/dd/ff", O_CREATE | O_RDWR); 207f: 83 ec 08 sub $0x8,%esp 2082: 68 02 02 00 00 push $0x202 2087: 68 ac 4e 00 00 push $0x4eac 208c: e8 7e 1e 00 00 call 3f0f <open> 2091: 83 c4 10 add $0x10,%esp 2094: 89 45 f4 mov %eax,-0xc(%ebp) if (fd < 0) { 2097: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 209b: 79 17 jns 20b4 <subdir+0x136> printf(1, "create dd/dd/ff failed\n"); 209d: 83 ec 08 sub $0x8,%esp 20a0: 68 b5 4e 00 00 push $0x4eb5 20a5: 6a 01 push $0x1 20a7: e8 e2 1f 00 00 call 408e <printf> 20ac: 83 c4 10 add $0x10,%esp exit(); 20af: e8 1b 1e 00 00 call 3ecf <exit> } write(fd, "FF", 2); 20b4: 83 ec 04 sub $0x4,%esp 20b7: 6a 02 push $0x2 20b9: 68 cd 4e 00 00 push $0x4ecd 20be: ff 75 f4 pushl -0xc(%ebp) 20c1: e8 29 1e 00 00 call 3eef <write> 20c6: 83 c4 10 add $0x10,%esp close(fd); 20c9: 83 ec 0c sub $0xc,%esp 20cc: ff 75 f4 pushl -0xc(%ebp) 20cf: e8 23 1e 00 00 call 3ef7 <close> 20d4: 83 c4 10 add $0x10,%esp fd = open("dd/dd/../ff", 0); 20d7: 83 ec 08 sub $0x8,%esp 20da: 6a 00 push $0x0 20dc: 68 d0 4e 00 00 push $0x4ed0 20e1: e8 29 1e 00 00 call 3f0f <open> 20e6: 83 c4 10 add $0x10,%esp 20e9: 89 45 f4 mov %eax,-0xc(%ebp) if (fd < 0) { 20ec: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 20f0: 79 17 jns 2109 <subdir+0x18b> printf(1, "open dd/dd/../ff failed\n"); 20f2: 83 ec 08 sub $0x8,%esp 20f5: 68 dc 4e 00 00 push $0x4edc 20fa: 6a 01 push $0x1 20fc: e8 8d 1f 00 00 call 408e <printf> 2101: 83 c4 10 add $0x10,%esp exit(); 2104: e8 c6 1d 00 00 call 3ecf <exit> } cc = read(fd, buf, sizeof(buf)); 2109: 83 ec 04 sub $0x4,%esp 210c: 68 00 20 00 00 push $0x2000 2111: 68 e0 8a 00 00 push $0x8ae0 2116: ff 75 f4 pushl -0xc(%ebp) 2119: e8 c9 1d 00 00 call 3ee7 <read> 211e: 83 c4 10 add $0x10,%esp 2121: 89 45 f0 mov %eax,-0x10(%ebp) if (cc != 2 || buf[0] != 'f') { 2124: 83 7d f0 02 cmpl $0x2,-0x10(%ebp) 2128: 75 0b jne 2135 <subdir+0x1b7> 212a: 0f b6 05 e0 8a 00 00 movzbl 0x8ae0,%eax 2131: 3c 66 cmp $0x66,%al 2133: 74 17 je 214c <subdir+0x1ce> printf(1, "dd/dd/../ff wrong content\n"); 2135: 83 ec 08 sub $0x8,%esp 2138: 68 f5 4e 00 00 push $0x4ef5 213d: 6a 01 push $0x1 213f: e8 4a 1f 00 00 call 408e <printf> 2144: 83 c4 10 add $0x10,%esp exit(); 2147: e8 83 1d 00 00 call 3ecf <exit> } close(fd); 214c: 83 ec 0c sub $0xc,%esp 214f: ff 75 f4 pushl -0xc(%ebp) 2152: e8 a0 1d 00 00 call 3ef7 <close> 2157: 83 c4 10 add $0x10,%esp if (link("dd/dd/ff", "dd/dd/ffff") != 0) { 215a: 83 ec 08 sub $0x8,%esp 215d: 68 10 4f 00 00 push $0x4f10 2162: 68 ac 4e 00 00 push $0x4eac 2167: e8 c3 1d 00 00 call 3f2f <link> 216c: 83 c4 10 add $0x10,%esp 216f: 85 c0 test %eax,%eax 2171: 74 17 je 218a <subdir+0x20c> printf(1, "link dd/dd/ff dd/dd/ffff failed\n"); 2173: 83 ec 08 sub $0x8,%esp 2176: 68 1c 4f 00 00 push $0x4f1c 217b: 6a 01 push $0x1 217d: e8 0c 1f 00 00 call 408e <printf> 2182: 83 c4 10 add $0x10,%esp exit(); 2185: e8 45 1d 00 00 call 3ecf <exit> } if (unlink("dd/dd/ff") != 0) { 218a: 83 ec 0c sub $0xc,%esp 218d: 68 ac 4e 00 00 push $0x4eac 2192: e8 88 1d 00 00 call 3f1f <unlink> 2197: 83 c4 10 add $0x10,%esp 219a: 85 c0 test %eax,%eax 219c: 74 17 je 21b5 <subdir+0x237> printf(1, "unlink dd/dd/ff failed\n"); 219e: 83 ec 08 sub $0x8,%esp 21a1: 68 3d 4f 00 00 push $0x4f3d 21a6: 6a 01 push $0x1 21a8: e8 e1 1e 00 00 call 408e <printf> 21ad: 83 c4 10 add $0x10,%esp exit(); 21b0: e8 1a 1d 00 00 call 3ecf <exit> } if (open("dd/dd/ff", O_RDONLY) >= 0) { 21b5: 83 ec 08 sub $0x8,%esp 21b8: 6a 00 push $0x0 21ba: 68 ac 4e 00 00 push $0x4eac 21bf: e8 4b 1d 00 00 call 3f0f <open> 21c4: 83 c4 10 add $0x10,%esp 21c7: 85 c0 test %eax,%eax 21c9: 78 17 js 21e2 <subdir+0x264> printf(1, "open (unlinked) dd/dd/ff succeeded\n"); 21cb: 83 ec 08 sub $0x8,%esp 21ce: 68 58 4f 00 00 push $0x4f58 21d3: 6a 01 push $0x1 21d5: e8 b4 1e 00 00 call 408e <printf> 21da: 83 c4 10 add $0x10,%esp exit(); 21dd: e8 ed 1c 00 00 call 3ecf <exit> } if (chdir("dd") != 0) { 21e2: 83 ec 0c sub $0xc,%esp 21e5: 68 2d 4e 00 00 push $0x4e2d 21ea: e8 50 1d 00 00 call 3f3f <chdir> 21ef: 83 c4 10 add $0x10,%esp 21f2: 85 c0 test %eax,%eax 21f4: 74 17 je 220d <subdir+0x28f> printf(1, "chdir dd failed\n"); 21f6: 83 ec 08 sub $0x8,%esp 21f9: 68 7c 4f 00 00 push $0x4f7c 21fe: 6a 01 push $0x1 2200: e8 89 1e 00 00 call 408e <printf> 2205: 83 c4 10 add $0x10,%esp exit(); 2208: e8 c2 1c 00 00 call 3ecf <exit> } if (chdir("dd/../../dd") != 0) { 220d: 83 ec 0c sub $0xc,%esp 2210: 68 8d 4f 00 00 push $0x4f8d 2215: e8 25 1d 00 00 call 3f3f <chdir> 221a: 83 c4 10 add $0x10,%esp 221d: 85 c0 test %eax,%eax 221f: 74 17 je 2238 <subdir+0x2ba> printf(1, "chdir dd/../../dd failed\n"); 2221: 83 ec 08 sub $0x8,%esp 2224: 68 99 4f 00 00 push $0x4f99 2229: 6a 01 push $0x1 222b: e8 5e 1e 00 00 call 408e <printf> 2230: 83 c4 10 add $0x10,%esp exit(); 2233: e8 97 1c 00 00 call 3ecf <exit> } if (chdir("dd/../../../dd") != 0) { 2238: 83 ec 0c sub $0xc,%esp 223b: 68 b3 4f 00 00 push $0x4fb3 2240: e8 fa 1c 00 00 call 3f3f <chdir> 2245: 83 c4 10 add $0x10,%esp 2248: 85 c0 test %eax,%eax 224a: 74 17 je 2263 <subdir+0x2e5> printf(1, "chdir dd/../../dd failed\n"); 224c: 83 ec 08 sub $0x8,%esp 224f: 68 99 4f 00 00 push $0x4f99 2254: 6a 01 push $0x1 2256: e8 33 1e 00 00 call 408e <printf> 225b: 83 c4 10 add $0x10,%esp exit(); 225e: e8 6c 1c 00 00 call 3ecf <exit> } if (chdir("./..") != 0) { 2263: 83 ec 0c sub $0xc,%esp 2266: 68 c2 4f 00 00 push $0x4fc2 226b: e8 cf 1c 00 00 call 3f3f <chdir> 2270: 83 c4 10 add $0x10,%esp 2273: 85 c0 test %eax,%eax 2275: 74 17 je 228e <subdir+0x310> printf(1, "chdir ./.. failed\n"); 2277: 83 ec 08 sub $0x8,%esp 227a: 68 c7 4f 00 00 push $0x4fc7 227f: 6a 01 push $0x1 2281: e8 08 1e 00 00 call 408e <printf> 2286: 83 c4 10 add $0x10,%esp exit(); 2289: e8 41 1c 00 00 call 3ecf <exit> } fd = open("dd/dd/ffff", 0); 228e: 83 ec 08 sub $0x8,%esp 2291: 6a 00 push $0x0 2293: 68 10 4f 00 00 push $0x4f10 2298: e8 72 1c 00 00 call 3f0f <open> 229d: 83 c4 10 add $0x10,%esp 22a0: 89 45 f4 mov %eax,-0xc(%ebp) if (fd < 0) { 22a3: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 22a7: 79 17 jns 22c0 <subdir+0x342> printf(1, "open dd/dd/ffff failed\n"); 22a9: 83 ec 08 sub $0x8,%esp 22ac: 68 da 4f 00 00 push $0x4fda 22b1: 6a 01 push $0x1 22b3: e8 d6 1d 00 00 call 408e <printf> 22b8: 83 c4 10 add $0x10,%esp exit(); 22bb: e8 0f 1c 00 00 call 3ecf <exit> } if (read(fd, buf, sizeof(buf)) != 2) { 22c0: 83 ec 04 sub $0x4,%esp 22c3: 68 00 20 00 00 push $0x2000 22c8: 68 e0 8a 00 00 push $0x8ae0 22cd: ff 75 f4 pushl -0xc(%ebp) 22d0: e8 12 1c 00 00 call 3ee7 <read> 22d5: 83 c4 10 add $0x10,%esp 22d8: 83 f8 02 cmp $0x2,%eax 22db: 74 17 je 22f4 <subdir+0x376> printf(1, "read dd/dd/ffff wrong len\n"); 22dd: 83 ec 08 sub $0x8,%esp 22e0: 68 f2 4f 00 00 push $0x4ff2 22e5: 6a 01 push $0x1 22e7: e8 a2 1d 00 00 call 408e <printf> 22ec: 83 c4 10 add $0x10,%esp exit(); 22ef: e8 db 1b 00 00 call 3ecf <exit> } close(fd); 22f4: 83 ec 0c sub $0xc,%esp 22f7: ff 75 f4 pushl -0xc(%ebp) 22fa: e8 f8 1b 00 00 call 3ef7 <close> 22ff: 83 c4 10 add $0x10,%esp if (open("dd/dd/ff", O_RDONLY) >= 0) { 2302: 83 ec 08 sub $0x8,%esp 2305: 6a 00 push $0x0 2307: 68 ac 4e 00 00 push $0x4eac 230c: e8 fe 1b 00 00 call 3f0f <open> 2311: 83 c4 10 add $0x10,%esp 2314: 85 c0 test %eax,%eax 2316: 78 17 js 232f <subdir+0x3b1> printf(1, "open (unlinked) dd/dd/ff succeeded!\n"); 2318: 83 ec 08 sub $0x8,%esp 231b: 68 10 50 00 00 push $0x5010 2320: 6a 01 push $0x1 2322: e8 67 1d 00 00 call 408e <printf> 2327: 83 c4 10 add $0x10,%esp exit(); 232a: e8 a0 1b 00 00 call 3ecf <exit> } if (open("dd/ff/ff", O_CREATE | O_RDWR) >= 0) { 232f: 83 ec 08 sub $0x8,%esp 2332: 68 02 02 00 00 push $0x202 2337: 68 35 50 00 00 push $0x5035 233c: e8 ce 1b 00 00 call 3f0f <open> 2341: 83 c4 10 add $0x10,%esp 2344: 85 c0 test %eax,%eax 2346: 78 17 js 235f <subdir+0x3e1> printf(1, "create dd/ff/ff succeeded!\n"); 2348: 83 ec 08 sub $0x8,%esp 234b: 68 3e 50 00 00 push $0x503e 2350: 6a 01 push $0x1 2352: e8 37 1d 00 00 call 408e <printf> 2357: 83 c4 10 add $0x10,%esp exit(); 235a: e8 70 1b 00 00 call 3ecf <exit> } if (open("dd/xx/ff", O_CREATE | O_RDWR) >= 0) { 235f: 83 ec 08 sub $0x8,%esp 2362: 68 02 02 00 00 push $0x202 2367: 68 5a 50 00 00 push $0x505a 236c: e8 9e 1b 00 00 call 3f0f <open> 2371: 83 c4 10 add $0x10,%esp 2374: 85 c0 test %eax,%eax 2376: 78 17 js 238f <subdir+0x411> printf(1, "create dd/xx/ff succeeded!\n"); 2378: 83 ec 08 sub $0x8,%esp 237b: 68 63 50 00 00 push $0x5063 2380: 6a 01 push $0x1 2382: e8 07 1d 00 00 call 408e <printf> 2387: 83 c4 10 add $0x10,%esp exit(); 238a: e8 40 1b 00 00 call 3ecf <exit> } if (open("dd", O_CREATE) >= 0) { 238f: 83 ec 08 sub $0x8,%esp 2392: 68 00 02 00 00 push $0x200 2397: 68 2d 4e 00 00 push $0x4e2d 239c: e8 6e 1b 00 00 call 3f0f <open> 23a1: 83 c4 10 add $0x10,%esp 23a4: 85 c0 test %eax,%eax 23a6: 78 17 js 23bf <subdir+0x441> printf(1, "create dd succeeded!\n"); 23a8: 83 ec 08 sub $0x8,%esp 23ab: 68 7f 50 00 00 push $0x507f 23b0: 6a 01 push $0x1 23b2: e8 d7 1c 00 00 call 408e <printf> 23b7: 83 c4 10 add $0x10,%esp exit(); 23ba: e8 10 1b 00 00 call 3ecf <exit> } if (open("dd", O_RDWR) >= 0) { 23bf: 83 ec 08 sub $0x8,%esp 23c2: 6a 02 push $0x2 23c4: 68 2d 4e 00 00 push $0x4e2d 23c9: e8 41 1b 00 00 call 3f0f <open> 23ce: 83 c4 10 add $0x10,%esp 23d1: 85 c0 test %eax,%eax 23d3: 78 17 js 23ec <subdir+0x46e> printf(1, "open dd rdwr succeeded!\n"); 23d5: 83 ec 08 sub $0x8,%esp 23d8: 68 95 50 00 00 push $0x5095 23dd: 6a 01 push $0x1 23df: e8 aa 1c 00 00 call 408e <printf> 23e4: 83 c4 10 add $0x10,%esp exit(); 23e7: e8 e3 1a 00 00 call 3ecf <exit> } if (open("dd", O_WRONLY) >= 0) { 23ec: 83 ec 08 sub $0x8,%esp 23ef: 6a 01 push $0x1 23f1: 68 2d 4e 00 00 push $0x4e2d 23f6: e8 14 1b 00 00 call 3f0f <open> 23fb: 83 c4 10 add $0x10,%esp 23fe: 85 c0 test %eax,%eax 2400: 78 17 js 2419 <subdir+0x49b> printf(1, "open dd wronly succeeded!\n"); 2402: 83 ec 08 sub $0x8,%esp 2405: 68 ae 50 00 00 push $0x50ae 240a: 6a 01 push $0x1 240c: e8 7d 1c 00 00 call 408e <printf> 2411: 83 c4 10 add $0x10,%esp exit(); 2414: e8 b6 1a 00 00 call 3ecf <exit> } if (link("dd/ff/ff", "dd/dd/xx") == 0) { 2419: 83 ec 08 sub $0x8,%esp 241c: 68 c9 50 00 00 push $0x50c9 2421: 68 35 50 00 00 push $0x5035 2426: e8 04 1b 00 00 call 3f2f <link> 242b: 83 c4 10 add $0x10,%esp 242e: 85 c0 test %eax,%eax 2430: 75 17 jne 2449 <subdir+0x4cb> printf(1, "link dd/ff/ff dd/dd/xx succeeded!\n"); 2432: 83 ec 08 sub $0x8,%esp 2435: 68 d4 50 00 00 push $0x50d4 243a: 6a 01 push $0x1 243c: e8 4d 1c 00 00 call 408e <printf> 2441: 83 c4 10 add $0x10,%esp exit(); 2444: e8 86 1a 00 00 call 3ecf <exit> } if (link("dd/xx/ff", "dd/dd/xx") == 0) { 2449: 83 ec 08 sub $0x8,%esp 244c: 68 c9 50 00 00 push $0x50c9 2451: 68 5a 50 00 00 push $0x505a 2456: e8 d4 1a 00 00 call 3f2f <link> 245b: 83 c4 10 add $0x10,%esp 245e: 85 c0 test %eax,%eax 2460: 75 17 jne 2479 <subdir+0x4fb> printf(1, "link dd/xx/ff dd/dd/xx succeeded!\n"); 2462: 83 ec 08 sub $0x8,%esp 2465: 68 f8 50 00 00 push $0x50f8 246a: 6a 01 push $0x1 246c: e8 1d 1c 00 00 call 408e <printf> 2471: 83 c4 10 add $0x10,%esp exit(); 2474: e8 56 1a 00 00 call 3ecf <exit> } if (link("dd/ff", "dd/dd/ffff") == 0) { 2479: 83 ec 08 sub $0x8,%esp 247c: 68 10 4f 00 00 push $0x4f10 2481: 68 48 4e 00 00 push $0x4e48 2486: e8 a4 1a 00 00 call 3f2f <link> 248b: 83 c4 10 add $0x10,%esp 248e: 85 c0 test %eax,%eax 2490: 75 17 jne 24a9 <subdir+0x52b> printf(1, "link dd/ff dd/dd/ffff succeeded!\n"); 2492: 83 ec 08 sub $0x8,%esp 2495: 68 1c 51 00 00 push $0x511c 249a: 6a 01 push $0x1 249c: e8 ed 1b 00 00 call 408e <printf> 24a1: 83 c4 10 add $0x10,%esp exit(); 24a4: e8 26 1a 00 00 call 3ecf <exit> } if (mkdir("dd/ff/ff") == 0) { 24a9: 83 ec 0c sub $0xc,%esp 24ac: 68 35 50 00 00 push $0x5035 24b1: e8 81 1a 00 00 call 3f37 <mkdir> 24b6: 83 c4 10 add $0x10,%esp 24b9: 85 c0 test %eax,%eax 24bb: 75 17 jne 24d4 <subdir+0x556> printf(1, "mkdir dd/ff/ff succeeded!\n"); 24bd: 83 ec 08 sub $0x8,%esp 24c0: 68 3e 51 00 00 push $0x513e 24c5: 6a 01 push $0x1 24c7: e8 c2 1b 00 00 call 408e <printf> 24cc: 83 c4 10 add $0x10,%esp exit(); 24cf: e8 fb 19 00 00 call 3ecf <exit> } if (mkdir("dd/xx/ff") == 0) { 24d4: 83 ec 0c sub $0xc,%esp 24d7: 68 5a 50 00 00 push $0x505a 24dc: e8 56 1a 00 00 call 3f37 <mkdir> 24e1: 83 c4 10 add $0x10,%esp 24e4: 85 c0 test %eax,%eax 24e6: 75 17 jne 24ff <subdir+0x581> printf(1, "mkdir dd/xx/ff succeeded!\n"); 24e8: 83 ec 08 sub $0x8,%esp 24eb: 68 59 51 00 00 push $0x5159 24f0: 6a 01 push $0x1 24f2: e8 97 1b 00 00 call 408e <printf> 24f7: 83 c4 10 add $0x10,%esp exit(); 24fa: e8 d0 19 00 00 call 3ecf <exit> } if (mkdir("dd/dd/ffff") == 0) { 24ff: 83 ec 0c sub $0xc,%esp 2502: 68 10 4f 00 00 push $0x4f10 2507: e8 2b 1a 00 00 call 3f37 <mkdir> 250c: 83 c4 10 add $0x10,%esp 250f: 85 c0 test %eax,%eax 2511: 75 17 jne 252a <subdir+0x5ac> printf(1, "mkdir dd/dd/ffff succeeded!\n"); 2513: 83 ec 08 sub $0x8,%esp 2516: 68 74 51 00 00 push $0x5174 251b: 6a 01 push $0x1 251d: e8 6c 1b 00 00 call 408e <printf> 2522: 83 c4 10 add $0x10,%esp exit(); 2525: e8 a5 19 00 00 call 3ecf <exit> } if (unlink("dd/xx/ff") == 0) { 252a: 83 ec 0c sub $0xc,%esp 252d: 68 5a 50 00 00 push $0x505a 2532: e8 e8 19 00 00 call 3f1f <unlink> 2537: 83 c4 10 add $0x10,%esp 253a: 85 c0 test %eax,%eax 253c: 75 17 jne 2555 <subdir+0x5d7> printf(1, "unlink dd/xx/ff succeeded!\n"); 253e: 83 ec 08 sub $0x8,%esp 2541: 68 91 51 00 00 push $0x5191 2546: 6a 01 push $0x1 2548: e8 41 1b 00 00 call 408e <printf> 254d: 83 c4 10 add $0x10,%esp exit(); 2550: e8 7a 19 00 00 call 3ecf <exit> } if (unlink("dd/ff/ff") == 0) { 2555: 83 ec 0c sub $0xc,%esp 2558: 68 35 50 00 00 push $0x5035 255d: e8 bd 19 00 00 call 3f1f <unlink> 2562: 83 c4 10 add $0x10,%esp 2565: 85 c0 test %eax,%eax 2567: 75 17 jne 2580 <subdir+0x602> printf(1, "unlink dd/ff/ff succeeded!\n"); 2569: 83 ec 08 sub $0x8,%esp 256c: 68 ad 51 00 00 push $0x51ad 2571: 6a 01 push $0x1 2573: e8 16 1b 00 00 call 408e <printf> 2578: 83 c4 10 add $0x10,%esp exit(); 257b: e8 4f 19 00 00 call 3ecf <exit> } if (chdir("dd/ff") == 0) { 2580: 83 ec 0c sub $0xc,%esp 2583: 68 48 4e 00 00 push $0x4e48 2588: e8 b2 19 00 00 call 3f3f <chdir> 258d: 83 c4 10 add $0x10,%esp 2590: 85 c0 test %eax,%eax 2592: 75 17 jne 25ab <subdir+0x62d> printf(1, "chdir dd/ff succeeded!\n"); 2594: 83 ec 08 sub $0x8,%esp 2597: 68 c9 51 00 00 push $0x51c9 259c: 6a 01 push $0x1 259e: e8 eb 1a 00 00 call 408e <printf> 25a3: 83 c4 10 add $0x10,%esp exit(); 25a6: e8 24 19 00 00 call 3ecf <exit> } if (chdir("dd/xx") == 0) { 25ab: 83 ec 0c sub $0xc,%esp 25ae: 68 e1 51 00 00 push $0x51e1 25b3: e8 87 19 00 00 call 3f3f <chdir> 25b8: 83 c4 10 add $0x10,%esp 25bb: 85 c0 test %eax,%eax 25bd: 75 17 jne 25d6 <subdir+0x658> printf(1, "chdir dd/xx succeeded!\n"); 25bf: 83 ec 08 sub $0x8,%esp 25c2: 68 e7 51 00 00 push $0x51e7 25c7: 6a 01 push $0x1 25c9: e8 c0 1a 00 00 call 408e <printf> 25ce: 83 c4 10 add $0x10,%esp exit(); 25d1: e8 f9 18 00 00 call 3ecf <exit> } if (unlink("dd/dd/ffff") != 0) { 25d6: 83 ec 0c sub $0xc,%esp 25d9: 68 10 4f 00 00 push $0x4f10 25de: e8 3c 19 00 00 call 3f1f <unlink> 25e3: 83 c4 10 add $0x10,%esp 25e6: 85 c0 test %eax,%eax 25e8: 74 17 je 2601 <subdir+0x683> printf(1, "unlink dd/dd/ff failed\n"); 25ea: 83 ec 08 sub $0x8,%esp 25ed: 68 3d 4f 00 00 push $0x4f3d 25f2: 6a 01 push $0x1 25f4: e8 95 1a 00 00 call 408e <printf> 25f9: 83 c4 10 add $0x10,%esp exit(); 25fc: e8 ce 18 00 00 call 3ecf <exit> } if (unlink("dd/ff") != 0) { 2601: 83 ec 0c sub $0xc,%esp 2604: 68 48 4e 00 00 push $0x4e48 2609: e8 11 19 00 00 call 3f1f <unlink> 260e: 83 c4 10 add $0x10,%esp 2611: 85 c0 test %eax,%eax 2613: 74 17 je 262c <subdir+0x6ae> printf(1, "unlink dd/ff failed\n"); 2615: 83 ec 08 sub $0x8,%esp 2618: 68 ff 51 00 00 push $0x51ff 261d: 6a 01 push $0x1 261f: e8 6a 1a 00 00 call 408e <printf> 2624: 83 c4 10 add $0x10,%esp exit(); 2627: e8 a3 18 00 00 call 3ecf <exit> } if (unlink("dd") == 0) { 262c: 83 ec 0c sub $0xc,%esp 262f: 68 2d 4e 00 00 push $0x4e2d 2634: e8 e6 18 00 00 call 3f1f <unlink> 2639: 83 c4 10 add $0x10,%esp 263c: 85 c0 test %eax,%eax 263e: 75 17 jne 2657 <subdir+0x6d9> printf(1, "unlink non-empty dd succeeded!\n"); 2640: 83 ec 08 sub $0x8,%esp 2643: 68 14 52 00 00 push $0x5214 2648: 6a 01 push $0x1 264a: e8 3f 1a 00 00 call 408e <printf> 264f: 83 c4 10 add $0x10,%esp exit(); 2652: e8 78 18 00 00 call 3ecf <exit> } if (unlink("dd/dd") < 0) { 2657: 83 ec 0c sub $0xc,%esp 265a: 68 34 52 00 00 push $0x5234 265f: e8 bb 18 00 00 call 3f1f <unlink> 2664: 83 c4 10 add $0x10,%esp 2667: 85 c0 test %eax,%eax 2669: 79 17 jns 2682 <subdir+0x704> printf(1, "unlink dd/dd failed\n"); 266b: 83 ec 08 sub $0x8,%esp 266e: 68 3a 52 00 00 push $0x523a 2673: 6a 01 push $0x1 2675: e8 14 1a 00 00 call 408e <printf> 267a: 83 c4 10 add $0x10,%esp exit(); 267d: e8 4d 18 00 00 call 3ecf <exit> } if (unlink("dd") < 0) { 2682: 83 ec 0c sub $0xc,%esp 2685: 68 2d 4e 00 00 push $0x4e2d 268a: e8 90 18 00 00 call 3f1f <unlink> 268f: 83 c4 10 add $0x10,%esp 2692: 85 c0 test %eax,%eax 2694: 79 17 jns 26ad <subdir+0x72f> printf(1, "unlink dd failed\n"); 2696: 83 ec 08 sub $0x8,%esp 2699: 68 4f 52 00 00 push $0x524f 269e: 6a 01 push $0x1 26a0: e8 e9 19 00 00 call 408e <printf> 26a5: 83 c4 10 add $0x10,%esp exit(); 26a8: e8 22 18 00 00 call 3ecf <exit> } printf(1, "subdir ok\n"); 26ad: 83 ec 08 sub $0x8,%esp 26b0: 68 61 52 00 00 push $0x5261 26b5: 6a 01 push $0x1 26b7: e8 d2 19 00 00 call 408e <printf> 26bc: 83 c4 10 add $0x10,%esp } 26bf: 90 nop 26c0: c9 leave 26c1: c3 ret 000026c2 <bigwrite>: // test writes that are larger than the log. void bigwrite(void) { 26c2: 55 push %ebp 26c3: 89 e5 mov %esp,%ebp 26c5: 83 ec 18 sub $0x18,%esp int fd, sz; printf(1, "bigwrite test\n"); 26c8: 83 ec 08 sub $0x8,%esp 26cb: 68 6c 52 00 00 push $0x526c 26d0: 6a 01 push $0x1 26d2: e8 b7 19 00 00 call 408e <printf> 26d7: 83 c4 10 add $0x10,%esp unlink("bigwrite"); 26da: 83 ec 0c sub $0xc,%esp 26dd: 68 7b 52 00 00 push $0x527b 26e2: e8 38 18 00 00 call 3f1f <unlink> 26e7: 83 c4 10 add $0x10,%esp for (sz = 499; sz < 12 * 512; sz += 471) { 26ea: c7 45 f4 f3 01 00 00 movl $0x1f3,-0xc(%ebp) 26f1: e9 a8 00 00 00 jmp 279e <bigwrite+0xdc> fd = open("bigwrite", O_CREATE | O_RDWR); 26f6: 83 ec 08 sub $0x8,%esp 26f9: 68 02 02 00 00 push $0x202 26fe: 68 7b 52 00 00 push $0x527b 2703: e8 07 18 00 00 call 3f0f <open> 2708: 83 c4 10 add $0x10,%esp 270b: 89 45 ec mov %eax,-0x14(%ebp) if (fd < 0) { 270e: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 2712: 79 17 jns 272b <bigwrite+0x69> printf(1, "cannot create bigwrite\n"); 2714: 83 ec 08 sub $0x8,%esp 2717: 68 84 52 00 00 push $0x5284 271c: 6a 01 push $0x1 271e: e8 6b 19 00 00 call 408e <printf> 2723: 83 c4 10 add $0x10,%esp exit(); 2726: e8 a4 17 00 00 call 3ecf <exit> } int i; for (i = 0; i < 2; i++) { 272b: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp) 2732: eb 3f jmp 2773 <bigwrite+0xb1> int cc = write(fd, buf, sz); 2734: 83 ec 04 sub $0x4,%esp 2737: ff 75 f4 pushl -0xc(%ebp) 273a: 68 e0 8a 00 00 push $0x8ae0 273f: ff 75 ec pushl -0x14(%ebp) 2742: e8 a8 17 00 00 call 3eef <write> 2747: 83 c4 10 add $0x10,%esp 274a: 89 45 e8 mov %eax,-0x18(%ebp) if (cc != sz) { 274d: 8b 45 e8 mov -0x18(%ebp),%eax 2750: 3b 45 f4 cmp -0xc(%ebp),%eax 2753: 74 1a je 276f <bigwrite+0xad> printf(1, "write(%d) ret %d\n", sz, cc); 2755: ff 75 e8 pushl -0x18(%ebp) 2758: ff 75 f4 pushl -0xc(%ebp) 275b: 68 9c 52 00 00 push $0x529c 2760: 6a 01 push $0x1 2762: e8 27 19 00 00 call 408e <printf> 2767: 83 c4 10 add $0x10,%esp exit(); 276a: e8 60 17 00 00 call 3ecf <exit> if (fd < 0) { printf(1, "cannot create bigwrite\n"); exit(); } int i; for (i = 0; i < 2; i++) { 276f: 83 45 f0 01 addl $0x1,-0x10(%ebp) 2773: 83 7d f0 01 cmpl $0x1,-0x10(%ebp) 2777: 7e bb jle 2734 <bigwrite+0x72> if (cc != sz) { printf(1, "write(%d) ret %d\n", sz, cc); exit(); } } close(fd); 2779: 83 ec 0c sub $0xc,%esp 277c: ff 75 ec pushl -0x14(%ebp) 277f: e8 73 17 00 00 call 3ef7 <close> 2784: 83 c4 10 add $0x10,%esp unlink("bigwrite"); 2787: 83 ec 0c sub $0xc,%esp 278a: 68 7b 52 00 00 push $0x527b 278f: e8 8b 17 00 00 call 3f1f <unlink> 2794: 83 c4 10 add $0x10,%esp int fd, sz; printf(1, "bigwrite test\n"); unlink("bigwrite"); for (sz = 499; sz < 12 * 512; sz += 471) { 2797: 81 45 f4 d7 01 00 00 addl $0x1d7,-0xc(%ebp) 279e: 81 7d f4 ff 17 00 00 cmpl $0x17ff,-0xc(%ebp) 27a5: 0f 8e 4b ff ff ff jle 26f6 <bigwrite+0x34> } close(fd); unlink("bigwrite"); } printf(1, "bigwrite ok\n"); 27ab: 83 ec 08 sub $0x8,%esp 27ae: 68 ae 52 00 00 push $0x52ae 27b3: 6a 01 push $0x1 27b5: e8 d4 18 00 00 call 408e <printf> 27ba: 83 c4 10 add $0x10,%esp } 27bd: 90 nop 27be: c9 leave 27bf: c3 ret 000027c0 <bigfile>: void bigfile(void) { 27c0: 55 push %ebp 27c1: 89 e5 mov %esp,%ebp 27c3: 83 ec 18 sub $0x18,%esp int fd, i, total, cc; printf(1, "bigfile test\n"); 27c6: 83 ec 08 sub $0x8,%esp 27c9: 68 bb 52 00 00 push $0x52bb 27ce: 6a 01 push $0x1 27d0: e8 b9 18 00 00 call 408e <printf> 27d5: 83 c4 10 add $0x10,%esp unlink("bigfile"); 27d8: 83 ec 0c sub $0xc,%esp 27db: 68 c9 52 00 00 push $0x52c9 27e0: e8 3a 17 00 00 call 3f1f <unlink> 27e5: 83 c4 10 add $0x10,%esp fd = open("bigfile", O_CREATE | O_RDWR); 27e8: 83 ec 08 sub $0x8,%esp 27eb: 68 02 02 00 00 push $0x202 27f0: 68 c9 52 00 00 push $0x52c9 27f5: e8 15 17 00 00 call 3f0f <open> 27fa: 83 c4 10 add $0x10,%esp 27fd: 89 45 ec mov %eax,-0x14(%ebp) if (fd < 0) { 2800: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 2804: 79 17 jns 281d <bigfile+0x5d> printf(1, "cannot create bigfile"); 2806: 83 ec 08 sub $0x8,%esp 2809: 68 d1 52 00 00 push $0x52d1 280e: 6a 01 push $0x1 2810: e8 79 18 00 00 call 408e <printf> 2815: 83 c4 10 add $0x10,%esp exit(); 2818: e8 b2 16 00 00 call 3ecf <exit> } for (i = 0; i < 20; i++) { 281d: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 2824: eb 52 jmp 2878 <bigfile+0xb8> memset(buf, i, 600); 2826: 83 ec 04 sub $0x4,%esp 2829: 68 58 02 00 00 push $0x258 282e: ff 75 f4 pushl -0xc(%ebp) 2831: 68 e0 8a 00 00 push $0x8ae0 2836: e8 f9 14 00 00 call 3d34 <memset> 283b: 83 c4 10 add $0x10,%esp if (write(fd, buf, 600) != 600) { 283e: 83 ec 04 sub $0x4,%esp 2841: 68 58 02 00 00 push $0x258 2846: 68 e0 8a 00 00 push $0x8ae0 284b: ff 75 ec pushl -0x14(%ebp) 284e: e8 9c 16 00 00 call 3eef <write> 2853: 83 c4 10 add $0x10,%esp 2856: 3d 58 02 00 00 cmp $0x258,%eax 285b: 74 17 je 2874 <bigfile+0xb4> printf(1, "write bigfile failed\n"); 285d: 83 ec 08 sub $0x8,%esp 2860: 68 e7 52 00 00 push $0x52e7 2865: 6a 01 push $0x1 2867: e8 22 18 00 00 call 408e <printf> 286c: 83 c4 10 add $0x10,%esp exit(); 286f: e8 5b 16 00 00 call 3ecf <exit> fd = open("bigfile", O_CREATE | O_RDWR); if (fd < 0) { printf(1, "cannot create bigfile"); exit(); } for (i = 0; i < 20; i++) { 2874: 83 45 f4 01 addl $0x1,-0xc(%ebp) 2878: 83 7d f4 13 cmpl $0x13,-0xc(%ebp) 287c: 7e a8 jle 2826 <bigfile+0x66> if (write(fd, buf, 600) != 600) { printf(1, "write bigfile failed\n"); exit(); } } close(fd); 287e: 83 ec 0c sub $0xc,%esp 2881: ff 75 ec pushl -0x14(%ebp) 2884: e8 6e 16 00 00 call 3ef7 <close> 2889: 83 c4 10 add $0x10,%esp fd = open("bigfile", 0); 288c: 83 ec 08 sub $0x8,%esp 288f: 6a 00 push $0x0 2891: 68 c9 52 00 00 push $0x52c9 2896: e8 74 16 00 00 call 3f0f <open> 289b: 83 c4 10 add $0x10,%esp 289e: 89 45 ec mov %eax,-0x14(%ebp) if (fd < 0) { 28a1: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 28a5: 79 17 jns 28be <bigfile+0xfe> printf(1, "cannot open bigfile\n"); 28a7: 83 ec 08 sub $0x8,%esp 28aa: 68 fd 52 00 00 push $0x52fd 28af: 6a 01 push $0x1 28b1: e8 d8 17 00 00 call 408e <printf> 28b6: 83 c4 10 add $0x10,%esp exit(); 28b9: e8 11 16 00 00 call 3ecf <exit> } total = 0; 28be: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp) for (i = 0;; i++) { 28c5: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) cc = read(fd, buf, 300); 28cc: 83 ec 04 sub $0x4,%esp 28cf: 68 2c 01 00 00 push $0x12c 28d4: 68 e0 8a 00 00 push $0x8ae0 28d9: ff 75 ec pushl -0x14(%ebp) 28dc: e8 06 16 00 00 call 3ee7 <read> 28e1: 83 c4 10 add $0x10,%esp 28e4: 89 45 e8 mov %eax,-0x18(%ebp) if (cc < 0) { 28e7: 83 7d e8 00 cmpl $0x0,-0x18(%ebp) 28eb: 79 17 jns 2904 <bigfile+0x144> printf(1, "read bigfile failed\n"); 28ed: 83 ec 08 sub $0x8,%esp 28f0: 68 12 53 00 00 push $0x5312 28f5: 6a 01 push $0x1 28f7: e8 92 17 00 00 call 408e <printf> 28fc: 83 c4 10 add $0x10,%esp exit(); 28ff: e8 cb 15 00 00 call 3ecf <exit> } if (cc == 0) 2904: 83 7d e8 00 cmpl $0x0,-0x18(%ebp) 2908: 74 7a je 2984 <bigfile+0x1c4> break; if (cc != 300) { 290a: 81 7d e8 2c 01 00 00 cmpl $0x12c,-0x18(%ebp) 2911: 74 17 je 292a <bigfile+0x16a> printf(1, "short read bigfile\n"); 2913: 83 ec 08 sub $0x8,%esp 2916: 68 27 53 00 00 push $0x5327 291b: 6a 01 push $0x1 291d: e8 6c 17 00 00 call 408e <printf> 2922: 83 c4 10 add $0x10,%esp exit(); 2925: e8 a5 15 00 00 call 3ecf <exit> } if (buf[0] != i / 2 || buf[299] != i / 2) { 292a: 0f b6 05 e0 8a 00 00 movzbl 0x8ae0,%eax 2931: 0f be d0 movsbl %al,%edx 2934: 8b 45 f4 mov -0xc(%ebp),%eax 2937: 89 c1 mov %eax,%ecx 2939: c1 e9 1f shr $0x1f,%ecx 293c: 01 c8 add %ecx,%eax 293e: d1 f8 sar %eax 2940: 39 c2 cmp %eax,%edx 2942: 75 1a jne 295e <bigfile+0x19e> 2944: 0f b6 05 0b 8c 00 00 movzbl 0x8c0b,%eax 294b: 0f be d0 movsbl %al,%edx 294e: 8b 45 f4 mov -0xc(%ebp),%eax 2951: 89 c1 mov %eax,%ecx 2953: c1 e9 1f shr $0x1f,%ecx 2956: 01 c8 add %ecx,%eax 2958: d1 f8 sar %eax 295a: 39 c2 cmp %eax,%edx 295c: 74 17 je 2975 <bigfile+0x1b5> printf(1, "read bigfile wrong data\n"); 295e: 83 ec 08 sub $0x8,%esp 2961: 68 3b 53 00 00 push $0x533b 2966: 6a 01 push $0x1 2968: e8 21 17 00 00 call 408e <printf> 296d: 83 c4 10 add $0x10,%esp exit(); 2970: e8 5a 15 00 00 call 3ecf <exit> } total += cc; 2975: 8b 45 e8 mov -0x18(%ebp),%eax 2978: 01 45 f0 add %eax,-0x10(%ebp) if (fd < 0) { printf(1, "cannot open bigfile\n"); exit(); } total = 0; for (i = 0;; i++) { 297b: 83 45 f4 01 addl $0x1,-0xc(%ebp) if (buf[0] != i / 2 || buf[299] != i / 2) { printf(1, "read bigfile wrong data\n"); exit(); } total += cc; } 297f: e9 48 ff ff ff jmp 28cc <bigfile+0x10c> if (cc < 0) { printf(1, "read bigfile failed\n"); exit(); } if (cc == 0) break; 2984: 90 nop printf(1, "read bigfile wrong data\n"); exit(); } total += cc; } close(fd); 2985: 83 ec 0c sub $0xc,%esp 2988: ff 75 ec pushl -0x14(%ebp) 298b: e8 67 15 00 00 call 3ef7 <close> 2990: 83 c4 10 add $0x10,%esp if (total != 20 * 600) { 2993: 81 7d f0 e0 2e 00 00 cmpl $0x2ee0,-0x10(%ebp) 299a: 74 17 je 29b3 <bigfile+0x1f3> printf(1, "read bigfile wrong total\n"); 299c: 83 ec 08 sub $0x8,%esp 299f: 68 54 53 00 00 push $0x5354 29a4: 6a 01 push $0x1 29a6: e8 e3 16 00 00 call 408e <printf> 29ab: 83 c4 10 add $0x10,%esp exit(); 29ae: e8 1c 15 00 00 call 3ecf <exit> } unlink("bigfile"); 29b3: 83 ec 0c sub $0xc,%esp 29b6: 68 c9 52 00 00 push $0x52c9 29bb: e8 5f 15 00 00 call 3f1f <unlink> 29c0: 83 c4 10 add $0x10,%esp printf(1, "bigfile test ok\n"); 29c3: 83 ec 08 sub $0x8,%esp 29c6: 68 6e 53 00 00 push $0x536e 29cb: 6a 01 push $0x1 29cd: e8 bc 16 00 00 call 408e <printf> 29d2: 83 c4 10 add $0x10,%esp } 29d5: 90 nop 29d6: c9 leave 29d7: c3 ret 000029d8 <fourteen>: void fourteen(void) { 29d8: 55 push %ebp 29d9: 89 e5 mov %esp,%ebp 29db: 83 ec 18 sub $0x18,%esp int fd; // DIRSIZ is 14. printf(1, "fourteen test\n"); 29de: 83 ec 08 sub $0x8,%esp 29e1: 68 7f 53 00 00 push $0x537f 29e6: 6a 01 push $0x1 29e8: e8 a1 16 00 00 call 408e <printf> 29ed: 83 c4 10 add $0x10,%esp if (mkdir("12345678901234") != 0) { 29f0: 83 ec 0c sub $0xc,%esp 29f3: 68 8e 53 00 00 push $0x538e 29f8: e8 3a 15 00 00 call 3f37 <mkdir> 29fd: 83 c4 10 add $0x10,%esp 2a00: 85 c0 test %eax,%eax 2a02: 74 17 je 2a1b <fourteen+0x43> printf(1, "mkdir 12345678901234 failed\n"); 2a04: 83 ec 08 sub $0x8,%esp 2a07: 68 9d 53 00 00 push $0x539d 2a0c: 6a 01 push $0x1 2a0e: e8 7b 16 00 00 call 408e <printf> 2a13: 83 c4 10 add $0x10,%esp exit(); 2a16: e8 b4 14 00 00 call 3ecf <exit> } if (mkdir("12345678901234/123456789012345") != 0) { 2a1b: 83 ec 0c sub $0xc,%esp 2a1e: 68 bc 53 00 00 push $0x53bc 2a23: e8 0f 15 00 00 call 3f37 <mkdir> 2a28: 83 c4 10 add $0x10,%esp 2a2b: 85 c0 test %eax,%eax 2a2d: 74 17 je 2a46 <fourteen+0x6e> printf(1, "mkdir 12345678901234/123456789012345 failed\n"); 2a2f: 83 ec 08 sub $0x8,%esp 2a32: 68 dc 53 00 00 push $0x53dc 2a37: 6a 01 push $0x1 2a39: e8 50 16 00 00 call 408e <printf> 2a3e: 83 c4 10 add $0x10,%esp exit(); 2a41: e8 89 14 00 00 call 3ecf <exit> } fd = open("123456789012345/123456789012345/123456789012345", O_CREATE); 2a46: 83 ec 08 sub $0x8,%esp 2a49: 68 00 02 00 00 push $0x200 2a4e: 68 0c 54 00 00 push $0x540c 2a53: e8 b7 14 00 00 call 3f0f <open> 2a58: 83 c4 10 add $0x10,%esp 2a5b: 89 45 f4 mov %eax,-0xc(%ebp) if (fd < 0) { 2a5e: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 2a62: 79 17 jns 2a7b <fourteen+0xa3> printf(1, 2a64: 83 ec 08 sub $0x8,%esp 2a67: 68 3c 54 00 00 push $0x543c 2a6c: 6a 01 push $0x1 2a6e: e8 1b 16 00 00 call 408e <printf> 2a73: 83 c4 10 add $0x10,%esp "create 123456789012345/123456789012345/123456789012345 failed\n"); exit(); 2a76: e8 54 14 00 00 call 3ecf <exit> } close(fd); 2a7b: 83 ec 0c sub $0xc,%esp 2a7e: ff 75 f4 pushl -0xc(%ebp) 2a81: e8 71 14 00 00 call 3ef7 <close> 2a86: 83 c4 10 add $0x10,%esp fd = open("12345678901234/12345678901234/12345678901234", 0); 2a89: 83 ec 08 sub $0x8,%esp 2a8c: 6a 00 push $0x0 2a8e: 68 7c 54 00 00 push $0x547c 2a93: e8 77 14 00 00 call 3f0f <open> 2a98: 83 c4 10 add $0x10,%esp 2a9b: 89 45 f4 mov %eax,-0xc(%ebp) if (fd < 0) { 2a9e: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 2aa2: 79 17 jns 2abb <fourteen+0xe3> printf(1, 2aa4: 83 ec 08 sub $0x8,%esp 2aa7: 68 ac 54 00 00 push $0x54ac 2aac: 6a 01 push $0x1 2aae: e8 db 15 00 00 call 408e <printf> 2ab3: 83 c4 10 add $0x10,%esp "open 12345678901234/12345678901234/12345678901234 failed\n"); exit(); 2ab6: e8 14 14 00 00 call 3ecf <exit> } close(fd); 2abb: 83 ec 0c sub $0xc,%esp 2abe: ff 75 f4 pushl -0xc(%ebp) 2ac1: e8 31 14 00 00 call 3ef7 <close> 2ac6: 83 c4 10 add $0x10,%esp if (mkdir("12345678901234/12345678901234") == 0) { 2ac9: 83 ec 0c sub $0xc,%esp 2acc: 68 e6 54 00 00 push $0x54e6 2ad1: e8 61 14 00 00 call 3f37 <mkdir> 2ad6: 83 c4 10 add $0x10,%esp 2ad9: 85 c0 test %eax,%eax 2adb: 75 17 jne 2af4 <fourteen+0x11c> printf(1, "mkdir 12345678901234/12345678901234 succeeded!\n"); 2add: 83 ec 08 sub $0x8,%esp 2ae0: 68 04 55 00 00 push $0x5504 2ae5: 6a 01 push $0x1 2ae7: e8 a2 15 00 00 call 408e <printf> 2aec: 83 c4 10 add $0x10,%esp exit(); 2aef: e8 db 13 00 00 call 3ecf <exit> } if (mkdir("123456789012345/12345678901234") == 0) { 2af4: 83 ec 0c sub $0xc,%esp 2af7: 68 34 55 00 00 push $0x5534 2afc: e8 36 14 00 00 call 3f37 <mkdir> 2b01: 83 c4 10 add $0x10,%esp 2b04: 85 c0 test %eax,%eax 2b06: 75 17 jne 2b1f <fourteen+0x147> printf(1, "mkdir 12345678901234/123456789012345 succeeded!\n"); 2b08: 83 ec 08 sub $0x8,%esp 2b0b: 68 54 55 00 00 push $0x5554 2b10: 6a 01 push $0x1 2b12: e8 77 15 00 00 call 408e <printf> 2b17: 83 c4 10 add $0x10,%esp exit(); 2b1a: e8 b0 13 00 00 call 3ecf <exit> } printf(1, "fourteen ok\n"); 2b1f: 83 ec 08 sub $0x8,%esp 2b22: 68 85 55 00 00 push $0x5585 2b27: 6a 01 push $0x1 2b29: e8 60 15 00 00 call 408e <printf> 2b2e: 83 c4 10 add $0x10,%esp } 2b31: 90 nop 2b32: c9 leave 2b33: c3 ret 00002b34 <rmdot>: void rmdot(void) { 2b34: 55 push %ebp 2b35: 89 e5 mov %esp,%ebp 2b37: 83 ec 08 sub $0x8,%esp printf(1, "rmdot test\n"); 2b3a: 83 ec 08 sub $0x8,%esp 2b3d: 68 92 55 00 00 push $0x5592 2b42: 6a 01 push $0x1 2b44: e8 45 15 00 00 call 408e <printf> 2b49: 83 c4 10 add $0x10,%esp if (mkdir("dots") != 0) { 2b4c: 83 ec 0c sub $0xc,%esp 2b4f: 68 9e 55 00 00 push $0x559e 2b54: e8 de 13 00 00 call 3f37 <mkdir> 2b59: 83 c4 10 add $0x10,%esp 2b5c: 85 c0 test %eax,%eax 2b5e: 74 17 je 2b77 <rmdot+0x43> printf(1, "mkdir dots failed\n"); 2b60: 83 ec 08 sub $0x8,%esp 2b63: 68 a3 55 00 00 push $0x55a3 2b68: 6a 01 push $0x1 2b6a: e8 1f 15 00 00 call 408e <printf> 2b6f: 83 c4 10 add $0x10,%esp exit(); 2b72: e8 58 13 00 00 call 3ecf <exit> } if (chdir("dots") != 0) { 2b77: 83 ec 0c sub $0xc,%esp 2b7a: 68 9e 55 00 00 push $0x559e 2b7f: e8 bb 13 00 00 call 3f3f <chdir> 2b84: 83 c4 10 add $0x10,%esp 2b87: 85 c0 test %eax,%eax 2b89: 74 17 je 2ba2 <rmdot+0x6e> printf(1, "chdir dots failed\n"); 2b8b: 83 ec 08 sub $0x8,%esp 2b8e: 68 b6 55 00 00 push $0x55b6 2b93: 6a 01 push $0x1 2b95: e8 f4 14 00 00 call 408e <printf> 2b9a: 83 c4 10 add $0x10,%esp exit(); 2b9d: e8 2d 13 00 00 call 3ecf <exit> } if (unlink(".") == 0) { 2ba2: 83 ec 0c sub $0xc,%esp 2ba5: 68 cf 4c 00 00 push $0x4ccf 2baa: e8 70 13 00 00 call 3f1f <unlink> 2baf: 83 c4 10 add $0x10,%esp 2bb2: 85 c0 test %eax,%eax 2bb4: 75 17 jne 2bcd <rmdot+0x99> printf(1, "rm . worked!\n"); 2bb6: 83 ec 08 sub $0x8,%esp 2bb9: 68 c9 55 00 00 push $0x55c9 2bbe: 6a 01 push $0x1 2bc0: e8 c9 14 00 00 call 408e <printf> 2bc5: 83 c4 10 add $0x10,%esp exit(); 2bc8: e8 02 13 00 00 call 3ecf <exit> } if (unlink("..") == 0) { 2bcd: 83 ec 0c sub $0xc,%esp 2bd0: 68 62 48 00 00 push $0x4862 2bd5: e8 45 13 00 00 call 3f1f <unlink> 2bda: 83 c4 10 add $0x10,%esp 2bdd: 85 c0 test %eax,%eax 2bdf: 75 17 jne 2bf8 <rmdot+0xc4> printf(1, "rm .. worked!\n"); 2be1: 83 ec 08 sub $0x8,%esp 2be4: 68 d7 55 00 00 push $0x55d7 2be9: 6a 01 push $0x1 2beb: e8 9e 14 00 00 call 408e <printf> 2bf0: 83 c4 10 add $0x10,%esp exit(); 2bf3: e8 d7 12 00 00 call 3ecf <exit> } if (chdir("/") != 0) { 2bf8: 83 ec 0c sub $0xc,%esp 2bfb: 68 b6 44 00 00 push $0x44b6 2c00: e8 3a 13 00 00 call 3f3f <chdir> 2c05: 83 c4 10 add $0x10,%esp 2c08: 85 c0 test %eax,%eax 2c0a: 74 17 je 2c23 <rmdot+0xef> printf(1, "chdir / failed\n"); 2c0c: 83 ec 08 sub $0x8,%esp 2c0f: 68 b8 44 00 00 push $0x44b8 2c14: 6a 01 push $0x1 2c16: e8 73 14 00 00 call 408e <printf> 2c1b: 83 c4 10 add $0x10,%esp exit(); 2c1e: e8 ac 12 00 00 call 3ecf <exit> } if (unlink("dots/.") == 0) { 2c23: 83 ec 0c sub $0xc,%esp 2c26: 68 e6 55 00 00 push $0x55e6 2c2b: e8 ef 12 00 00 call 3f1f <unlink> 2c30: 83 c4 10 add $0x10,%esp 2c33: 85 c0 test %eax,%eax 2c35: 75 17 jne 2c4e <rmdot+0x11a> printf(1, "unlink dots/. worked!\n"); 2c37: 83 ec 08 sub $0x8,%esp 2c3a: 68 ed 55 00 00 push $0x55ed 2c3f: 6a 01 push $0x1 2c41: e8 48 14 00 00 call 408e <printf> 2c46: 83 c4 10 add $0x10,%esp exit(); 2c49: e8 81 12 00 00 call 3ecf <exit> } if (unlink("dots/..") == 0) { 2c4e: 83 ec 0c sub $0xc,%esp 2c51: 68 04 56 00 00 push $0x5604 2c56: e8 c4 12 00 00 call 3f1f <unlink> 2c5b: 83 c4 10 add $0x10,%esp 2c5e: 85 c0 test %eax,%eax 2c60: 75 17 jne 2c79 <rmdot+0x145> printf(1, "unlink dots/.. worked!\n"); 2c62: 83 ec 08 sub $0x8,%esp 2c65: 68 0c 56 00 00 push $0x560c 2c6a: 6a 01 push $0x1 2c6c: e8 1d 14 00 00 call 408e <printf> 2c71: 83 c4 10 add $0x10,%esp exit(); 2c74: e8 56 12 00 00 call 3ecf <exit> } if (unlink("dots") != 0) { 2c79: 83 ec 0c sub $0xc,%esp 2c7c: 68 9e 55 00 00 push $0x559e 2c81: e8 99 12 00 00 call 3f1f <unlink> 2c86: 83 c4 10 add $0x10,%esp 2c89: 85 c0 test %eax,%eax 2c8b: 74 17 je 2ca4 <rmdot+0x170> printf(1, "unlink dots failed!\n"); 2c8d: 83 ec 08 sub $0x8,%esp 2c90: 68 24 56 00 00 push $0x5624 2c95: 6a 01 push $0x1 2c97: e8 f2 13 00 00 call 408e <printf> 2c9c: 83 c4 10 add $0x10,%esp exit(); 2c9f: e8 2b 12 00 00 call 3ecf <exit> } printf(1, "rmdot ok\n"); 2ca4: 83 ec 08 sub $0x8,%esp 2ca7: 68 39 56 00 00 push $0x5639 2cac: 6a 01 push $0x1 2cae: e8 db 13 00 00 call 408e <printf> 2cb3: 83 c4 10 add $0x10,%esp } 2cb6: 90 nop 2cb7: c9 leave 2cb8: c3 ret 00002cb9 <dirfile>: void dirfile(void) { 2cb9: 55 push %ebp 2cba: 89 e5 mov %esp,%ebp 2cbc: 83 ec 18 sub $0x18,%esp int fd; printf(1, "dir vs file\n"); 2cbf: 83 ec 08 sub $0x8,%esp 2cc2: 68 43 56 00 00 push $0x5643 2cc7: 6a 01 push $0x1 2cc9: e8 c0 13 00 00 call 408e <printf> 2cce: 83 c4 10 add $0x10,%esp fd = open("dirfile", O_CREATE); 2cd1: 83 ec 08 sub $0x8,%esp 2cd4: 68 00 02 00 00 push $0x200 2cd9: 68 50 56 00 00 push $0x5650 2cde: e8 2c 12 00 00 call 3f0f <open> 2ce3: 83 c4 10 add $0x10,%esp 2ce6: 89 45 f4 mov %eax,-0xc(%ebp) if (fd < 0) { 2ce9: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 2ced: 79 17 jns 2d06 <dirfile+0x4d> printf(1, "create dirfile failed\n"); 2cef: 83 ec 08 sub $0x8,%esp 2cf2: 68 58 56 00 00 push $0x5658 2cf7: 6a 01 push $0x1 2cf9: e8 90 13 00 00 call 408e <printf> 2cfe: 83 c4 10 add $0x10,%esp exit(); 2d01: e8 c9 11 00 00 call 3ecf <exit> } close(fd); 2d06: 83 ec 0c sub $0xc,%esp 2d09: ff 75 f4 pushl -0xc(%ebp) 2d0c: e8 e6 11 00 00 call 3ef7 <close> 2d11: 83 c4 10 add $0x10,%esp if (chdir("dirfile") == 0) { 2d14: 83 ec 0c sub $0xc,%esp 2d17: 68 50 56 00 00 push $0x5650 2d1c: e8 1e 12 00 00 call 3f3f <chdir> 2d21: 83 c4 10 add $0x10,%esp 2d24: 85 c0 test %eax,%eax 2d26: 75 17 jne 2d3f <dirfile+0x86> printf(1, "chdir dirfile succeeded!\n"); 2d28: 83 ec 08 sub $0x8,%esp 2d2b: 68 6f 56 00 00 push $0x566f 2d30: 6a 01 push $0x1 2d32: e8 57 13 00 00 call 408e <printf> 2d37: 83 c4 10 add $0x10,%esp exit(); 2d3a: e8 90 11 00 00 call 3ecf <exit> } fd = open("dirfile/xx", 0); 2d3f: 83 ec 08 sub $0x8,%esp 2d42: 6a 00 push $0x0 2d44: 68 89 56 00 00 push $0x5689 2d49: e8 c1 11 00 00 call 3f0f <open> 2d4e: 83 c4 10 add $0x10,%esp 2d51: 89 45 f4 mov %eax,-0xc(%ebp) if (fd >= 0) { 2d54: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 2d58: 78 17 js 2d71 <dirfile+0xb8> printf(1, "create dirfile/xx succeeded!\n"); 2d5a: 83 ec 08 sub $0x8,%esp 2d5d: 68 94 56 00 00 push $0x5694 2d62: 6a 01 push $0x1 2d64: e8 25 13 00 00 call 408e <printf> 2d69: 83 c4 10 add $0x10,%esp exit(); 2d6c: e8 5e 11 00 00 call 3ecf <exit> } fd = open("dirfile/xx", O_CREATE); 2d71: 83 ec 08 sub $0x8,%esp 2d74: 68 00 02 00 00 push $0x200 2d79: 68 89 56 00 00 push $0x5689 2d7e: e8 8c 11 00 00 call 3f0f <open> 2d83: 83 c4 10 add $0x10,%esp 2d86: 89 45 f4 mov %eax,-0xc(%ebp) if (fd >= 0) { 2d89: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 2d8d: 78 17 js 2da6 <dirfile+0xed> printf(1, "create dirfile/xx succeeded!\n"); 2d8f: 83 ec 08 sub $0x8,%esp 2d92: 68 94 56 00 00 push $0x5694 2d97: 6a 01 push $0x1 2d99: e8 f0 12 00 00 call 408e <printf> 2d9e: 83 c4 10 add $0x10,%esp exit(); 2da1: e8 29 11 00 00 call 3ecf <exit> } if (mkdir("dirfile/xx") == 0) { 2da6: 83 ec 0c sub $0xc,%esp 2da9: 68 89 56 00 00 push $0x5689 2dae: e8 84 11 00 00 call 3f37 <mkdir> 2db3: 83 c4 10 add $0x10,%esp 2db6: 85 c0 test %eax,%eax 2db8: 75 17 jne 2dd1 <dirfile+0x118> printf(1, "mkdir dirfile/xx succeeded!\n"); 2dba: 83 ec 08 sub $0x8,%esp 2dbd: 68 b2 56 00 00 push $0x56b2 2dc2: 6a 01 push $0x1 2dc4: e8 c5 12 00 00 call 408e <printf> 2dc9: 83 c4 10 add $0x10,%esp exit(); 2dcc: e8 fe 10 00 00 call 3ecf <exit> } if (unlink("dirfile/xx") == 0) { 2dd1: 83 ec 0c sub $0xc,%esp 2dd4: 68 89 56 00 00 push $0x5689 2dd9: e8 41 11 00 00 call 3f1f <unlink> 2dde: 83 c4 10 add $0x10,%esp 2de1: 85 c0 test %eax,%eax 2de3: 75 17 jne 2dfc <dirfile+0x143> printf(1, "unlink dirfile/xx succeeded!\n"); 2de5: 83 ec 08 sub $0x8,%esp 2de8: 68 cf 56 00 00 push $0x56cf 2ded: 6a 01 push $0x1 2def: e8 9a 12 00 00 call 408e <printf> 2df4: 83 c4 10 add $0x10,%esp exit(); 2df7: e8 d3 10 00 00 call 3ecf <exit> } if (link("README", "dirfile/xx") == 0) { 2dfc: 83 ec 08 sub $0x8,%esp 2dff: 68 89 56 00 00 push $0x5689 2e04: 68 ed 56 00 00 push $0x56ed 2e09: e8 21 11 00 00 call 3f2f <link> 2e0e: 83 c4 10 add $0x10,%esp 2e11: 85 c0 test %eax,%eax 2e13: 75 17 jne 2e2c <dirfile+0x173> printf(1, "link to dirfile/xx succeeded!\n"); 2e15: 83 ec 08 sub $0x8,%esp 2e18: 68 f4 56 00 00 push $0x56f4 2e1d: 6a 01 push $0x1 2e1f: e8 6a 12 00 00 call 408e <printf> 2e24: 83 c4 10 add $0x10,%esp exit(); 2e27: e8 a3 10 00 00 call 3ecf <exit> } if (unlink("dirfile") != 0) { 2e2c: 83 ec 0c sub $0xc,%esp 2e2f: 68 50 56 00 00 push $0x5650 2e34: e8 e6 10 00 00 call 3f1f <unlink> 2e39: 83 c4 10 add $0x10,%esp 2e3c: 85 c0 test %eax,%eax 2e3e: 74 17 je 2e57 <dirfile+0x19e> printf(1, "unlink dirfile failed!\n"); 2e40: 83 ec 08 sub $0x8,%esp 2e43: 68 13 57 00 00 push $0x5713 2e48: 6a 01 push $0x1 2e4a: e8 3f 12 00 00 call 408e <printf> 2e4f: 83 c4 10 add $0x10,%esp exit(); 2e52: e8 78 10 00 00 call 3ecf <exit> } fd = open(".", O_RDWR); 2e57: 83 ec 08 sub $0x8,%esp 2e5a: 6a 02 push $0x2 2e5c: 68 cf 4c 00 00 push $0x4ccf 2e61: e8 a9 10 00 00 call 3f0f <open> 2e66: 83 c4 10 add $0x10,%esp 2e69: 89 45 f4 mov %eax,-0xc(%ebp) if (fd >= 0) { 2e6c: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 2e70: 78 17 js 2e89 <dirfile+0x1d0> printf(1, "open . for writing succeeded!\n"); 2e72: 83 ec 08 sub $0x8,%esp 2e75: 68 2c 57 00 00 push $0x572c 2e7a: 6a 01 push $0x1 2e7c: e8 0d 12 00 00 call 408e <printf> 2e81: 83 c4 10 add $0x10,%esp exit(); 2e84: e8 46 10 00 00 call 3ecf <exit> } fd = open(".", 0); 2e89: 83 ec 08 sub $0x8,%esp 2e8c: 6a 00 push $0x0 2e8e: 68 cf 4c 00 00 push $0x4ccf 2e93: e8 77 10 00 00 call 3f0f <open> 2e98: 83 c4 10 add $0x10,%esp 2e9b: 89 45 f4 mov %eax,-0xc(%ebp) if (write(fd, "x", 1) > 0) { 2e9e: 83 ec 04 sub $0x4,%esp 2ea1: 6a 01 push $0x1 2ea3: 68 1b 49 00 00 push $0x491b 2ea8: ff 75 f4 pushl -0xc(%ebp) 2eab: e8 3f 10 00 00 call 3eef <write> 2eb0: 83 c4 10 add $0x10,%esp 2eb3: 85 c0 test %eax,%eax 2eb5: 7e 17 jle 2ece <dirfile+0x215> printf(1, "write . succeeded!\n"); 2eb7: 83 ec 08 sub $0x8,%esp 2eba: 68 4b 57 00 00 push $0x574b 2ebf: 6a 01 push $0x1 2ec1: e8 c8 11 00 00 call 408e <printf> 2ec6: 83 c4 10 add $0x10,%esp exit(); 2ec9: e8 01 10 00 00 call 3ecf <exit> } close(fd); 2ece: 83 ec 0c sub $0xc,%esp 2ed1: ff 75 f4 pushl -0xc(%ebp) 2ed4: e8 1e 10 00 00 call 3ef7 <close> 2ed9: 83 c4 10 add $0x10,%esp printf(1, "dir vs file OK\n"); 2edc: 83 ec 08 sub $0x8,%esp 2edf: 68 5f 57 00 00 push $0x575f 2ee4: 6a 01 push $0x1 2ee6: e8 a3 11 00 00 call 408e <printf> 2eeb: 83 c4 10 add $0x10,%esp } 2eee: 90 nop 2eef: c9 leave 2ef0: c3 ret 00002ef1 <iref>: // test that iput() is called at the end of _namei() void iref(void) { 2ef1: 55 push %ebp 2ef2: 89 e5 mov %esp,%ebp 2ef4: 83 ec 18 sub $0x18,%esp int i, fd; printf(1, "empty file name\n"); 2ef7: 83 ec 08 sub $0x8,%esp 2efa: 68 6f 57 00 00 push $0x576f 2eff: 6a 01 push $0x1 2f01: e8 88 11 00 00 call 408e <printf> 2f06: 83 c4 10 add $0x10,%esp // the 50 is NINODE for (i = 0; i < 50 + 1; i++) { 2f09: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 2f10: e9 e7 00 00 00 jmp 2ffc <iref+0x10b> if (mkdir("irefd") != 0) { 2f15: 83 ec 0c sub $0xc,%esp 2f18: 68 80 57 00 00 push $0x5780 2f1d: e8 15 10 00 00 call 3f37 <mkdir> 2f22: 83 c4 10 add $0x10,%esp 2f25: 85 c0 test %eax,%eax 2f27: 74 17 je 2f40 <iref+0x4f> printf(1, "mkdir irefd failed\n"); 2f29: 83 ec 08 sub $0x8,%esp 2f2c: 68 86 57 00 00 push $0x5786 2f31: 6a 01 push $0x1 2f33: e8 56 11 00 00 call 408e <printf> 2f38: 83 c4 10 add $0x10,%esp exit(); 2f3b: e8 8f 0f 00 00 call 3ecf <exit> } if (chdir("irefd") != 0) { 2f40: 83 ec 0c sub $0xc,%esp 2f43: 68 80 57 00 00 push $0x5780 2f48: e8 f2 0f 00 00 call 3f3f <chdir> 2f4d: 83 c4 10 add $0x10,%esp 2f50: 85 c0 test %eax,%eax 2f52: 74 17 je 2f6b <iref+0x7a> printf(1, "chdir irefd failed\n"); 2f54: 83 ec 08 sub $0x8,%esp 2f57: 68 9a 57 00 00 push $0x579a 2f5c: 6a 01 push $0x1 2f5e: e8 2b 11 00 00 call 408e <printf> 2f63: 83 c4 10 add $0x10,%esp exit(); 2f66: e8 64 0f 00 00 call 3ecf <exit> } mkdir(""); 2f6b: 83 ec 0c sub $0xc,%esp 2f6e: 68 ae 57 00 00 push $0x57ae 2f73: e8 bf 0f 00 00 call 3f37 <mkdir> 2f78: 83 c4 10 add $0x10,%esp link("README", ""); 2f7b: 83 ec 08 sub $0x8,%esp 2f7e: 68 ae 57 00 00 push $0x57ae 2f83: 68 ed 56 00 00 push $0x56ed 2f88: e8 a2 0f 00 00 call 3f2f <link> 2f8d: 83 c4 10 add $0x10,%esp fd = open("", O_CREATE); 2f90: 83 ec 08 sub $0x8,%esp 2f93: 68 00 02 00 00 push $0x200 2f98: 68 ae 57 00 00 push $0x57ae 2f9d: e8 6d 0f 00 00 call 3f0f <open> 2fa2: 83 c4 10 add $0x10,%esp 2fa5: 89 45 f0 mov %eax,-0x10(%ebp) if (fd >= 0) 2fa8: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 2fac: 78 0e js 2fbc <iref+0xcb> close(fd); 2fae: 83 ec 0c sub $0xc,%esp 2fb1: ff 75 f0 pushl -0x10(%ebp) 2fb4: e8 3e 0f 00 00 call 3ef7 <close> 2fb9: 83 c4 10 add $0x10,%esp fd = open("xx", O_CREATE); 2fbc: 83 ec 08 sub $0x8,%esp 2fbf: 68 00 02 00 00 push $0x200 2fc4: 68 af 57 00 00 push $0x57af 2fc9: e8 41 0f 00 00 call 3f0f <open> 2fce: 83 c4 10 add $0x10,%esp 2fd1: 89 45 f0 mov %eax,-0x10(%ebp) if (fd >= 0) 2fd4: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 2fd8: 78 0e js 2fe8 <iref+0xf7> close(fd); 2fda: 83 ec 0c sub $0xc,%esp 2fdd: ff 75 f0 pushl -0x10(%ebp) 2fe0: e8 12 0f 00 00 call 3ef7 <close> 2fe5: 83 c4 10 add $0x10,%esp unlink("xx"); 2fe8: 83 ec 0c sub $0xc,%esp 2feb: 68 af 57 00 00 push $0x57af 2ff0: e8 2a 0f 00 00 call 3f1f <unlink> 2ff5: 83 c4 10 add $0x10,%esp int i, fd; printf(1, "empty file name\n"); // the 50 is NINODE for (i = 0; i < 50 + 1; i++) { 2ff8: 83 45 f4 01 addl $0x1,-0xc(%ebp) 2ffc: 83 7d f4 32 cmpl $0x32,-0xc(%ebp) 3000: 0f 8e 0f ff ff ff jle 2f15 <iref+0x24> if (fd >= 0) close(fd); unlink("xx"); } chdir("/"); 3006: 83 ec 0c sub $0xc,%esp 3009: 68 b6 44 00 00 push $0x44b6 300e: e8 2c 0f 00 00 call 3f3f <chdir> 3013: 83 c4 10 add $0x10,%esp printf(1, "empty file name OK\n"); 3016: 83 ec 08 sub $0x8,%esp 3019: 68 b2 57 00 00 push $0x57b2 301e: 6a 01 push $0x1 3020: e8 69 10 00 00 call 408e <printf> 3025: 83 c4 10 add $0x10,%esp } 3028: 90 nop 3029: c9 leave 302a: c3 ret 0000302b <forktest>: // test that fork fails gracefully // the forktest binary also does this, but it runs out of proc entries first. // inside the bigger usertests binary, we run out of memory first. void forktest(void) { 302b: 55 push %ebp 302c: 89 e5 mov %esp,%ebp 302e: 83 ec 18 sub $0x18,%esp int n, pid; printf(1, "fork test\n"); 3031: 83 ec 08 sub $0x8,%esp 3034: 68 c6 57 00 00 push $0x57c6 3039: 6a 01 push $0x1 303b: e8 4e 10 00 00 call 408e <printf> 3040: 83 c4 10 add $0x10,%esp for (n = 0; n < 1000; n++) { 3043: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 304a: eb 1d jmp 3069 <forktest+0x3e> pid = fork(); 304c: e8 76 0e 00 00 call 3ec7 <fork> 3051: 89 45 f0 mov %eax,-0x10(%ebp) if (pid < 0) 3054: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 3058: 78 1a js 3074 <forktest+0x49> break; if (pid == 0) 305a: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 305e: 75 05 jne 3065 <forktest+0x3a> exit(); 3060: e8 6a 0e 00 00 call 3ecf <exit> { int n, pid; printf(1, "fork test\n"); for (n = 0; n < 1000; n++) { 3065: 83 45 f4 01 addl $0x1,-0xc(%ebp) 3069: 81 7d f4 e7 03 00 00 cmpl $0x3e7,-0xc(%ebp) 3070: 7e da jle 304c <forktest+0x21> 3072: eb 01 jmp 3075 <forktest+0x4a> pid = fork(); if (pid < 0) break; 3074: 90 nop if (pid == 0) exit(); } if (n == 1000) { 3075: 81 7d f4 e8 03 00 00 cmpl $0x3e8,-0xc(%ebp) 307c: 75 3b jne 30b9 <forktest+0x8e> printf(1, "fork claimed to work 1000 times!\n"); 307e: 83 ec 08 sub $0x8,%esp 3081: 68 d4 57 00 00 push $0x57d4 3086: 6a 01 push $0x1 3088: e8 01 10 00 00 call 408e <printf> 308d: 83 c4 10 add $0x10,%esp exit(); 3090: e8 3a 0e 00 00 call 3ecf <exit> } for (; n > 0; n--) { if (wait() < 0) { 3095: e8 3d 0e 00 00 call 3ed7 <wait> 309a: 85 c0 test %eax,%eax 309c: 79 17 jns 30b5 <forktest+0x8a> printf(1, "wait stopped early\n"); 309e: 83 ec 08 sub $0x8,%esp 30a1: 68 f6 57 00 00 push $0x57f6 30a6: 6a 01 push $0x1 30a8: e8 e1 0f 00 00 call 408e <printf> 30ad: 83 c4 10 add $0x10,%esp exit(); 30b0: e8 1a 0e 00 00 call 3ecf <exit> if (n == 1000) { printf(1, "fork claimed to work 1000 times!\n"); exit(); } for (; n > 0; n--) { 30b5: 83 6d f4 01 subl $0x1,-0xc(%ebp) 30b9: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 30bd: 7f d6 jg 3095 <forktest+0x6a> printf(1, "wait stopped early\n"); exit(); } } if (wait() != -1) { 30bf: e8 13 0e 00 00 call 3ed7 <wait> 30c4: 83 f8 ff cmp $0xffffffff,%eax 30c7: 74 17 je 30e0 <forktest+0xb5> printf(1, "wait got too many\n"); 30c9: 83 ec 08 sub $0x8,%esp 30cc: 68 0a 58 00 00 push $0x580a 30d1: 6a 01 push $0x1 30d3: e8 b6 0f 00 00 call 408e <printf> 30d8: 83 c4 10 add $0x10,%esp exit(); 30db: e8 ef 0d 00 00 call 3ecf <exit> } printf(1, "fork test OK\n"); 30e0: 83 ec 08 sub $0x8,%esp 30e3: 68 1d 58 00 00 push $0x581d 30e8: 6a 01 push $0x1 30ea: e8 9f 0f 00 00 call 408e <printf> 30ef: 83 c4 10 add $0x10,%esp } 30f2: 90 nop 30f3: c9 leave 30f4: c3 ret 000030f5 <sbrktest>: void sbrktest(void) { 30f5: 55 push %ebp 30f6: 89 e5 mov %esp,%ebp 30f8: 53 push %ebx 30f9: 83 ec 64 sub $0x64,%esp int fds[2], pid, pids[10], ppid; char *a, *b, *c, *lastaddr, *oldbrk, *p, scratch; uint amt; printf(stdout, "sbrk test\n"); 30fc: a1 00 63 00 00 mov 0x6300,%eax 3101: 83 ec 08 sub $0x8,%esp 3104: 68 2b 58 00 00 push $0x582b 3109: 50 push %eax 310a: e8 7f 0f 00 00 call 408e <printf> 310f: 83 c4 10 add $0x10,%esp oldbrk = sbrk(0); 3112: 83 ec 0c sub $0xc,%esp 3115: 6a 00 push $0x0 3117: e8 3b 0e 00 00 call 3f57 <sbrk> 311c: 83 c4 10 add $0x10,%esp 311f: 89 45 ec mov %eax,-0x14(%ebp) // can one sbrk() less than a page? a = sbrk(0); 3122: 83 ec 0c sub $0xc,%esp 3125: 6a 00 push $0x0 3127: e8 2b 0e 00 00 call 3f57 <sbrk> 312c: 83 c4 10 add $0x10,%esp 312f: 89 45 f4 mov %eax,-0xc(%ebp) int i; for (i = 0; i < 5000; i++) { 3132: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp) 3139: eb 4f jmp 318a <sbrktest+0x95> b = sbrk(1); 313b: 83 ec 0c sub $0xc,%esp 313e: 6a 01 push $0x1 3140: e8 12 0e 00 00 call 3f57 <sbrk> 3145: 83 c4 10 add $0x10,%esp 3148: 89 45 e8 mov %eax,-0x18(%ebp) if (b != a) { 314b: 8b 45 e8 mov -0x18(%ebp),%eax 314e: 3b 45 f4 cmp -0xc(%ebp),%eax 3151: 74 24 je 3177 <sbrktest+0x82> printf(stdout, "sbrk test failed %d %x %x\n", i, a, b); 3153: a1 00 63 00 00 mov 0x6300,%eax 3158: 83 ec 0c sub $0xc,%esp 315b: ff 75 e8 pushl -0x18(%ebp) 315e: ff 75 f4 pushl -0xc(%ebp) 3161: ff 75 f0 pushl -0x10(%ebp) 3164: 68 36 58 00 00 push $0x5836 3169: 50 push %eax 316a: e8 1f 0f 00 00 call 408e <printf> 316f: 83 c4 20 add $0x20,%esp exit(); 3172: e8 58 0d 00 00 call 3ecf <exit> } *b = 1; 3177: 8b 45 e8 mov -0x18(%ebp),%eax 317a: c6 00 01 movb $0x1,(%eax) a = b + 1; 317d: 8b 45 e8 mov -0x18(%ebp),%eax 3180: 83 c0 01 add $0x1,%eax 3183: 89 45 f4 mov %eax,-0xc(%ebp) oldbrk = sbrk(0); // can one sbrk() less than a page? a = sbrk(0); int i; for (i = 0; i < 5000; i++) { 3186: 83 45 f0 01 addl $0x1,-0x10(%ebp) 318a: 81 7d f0 87 13 00 00 cmpl $0x1387,-0x10(%ebp) 3191: 7e a8 jle 313b <sbrktest+0x46> exit(); } *b = 1; a = b + 1; } pid = fork(); 3193: e8 2f 0d 00 00 call 3ec7 <fork> 3198: 89 45 e4 mov %eax,-0x1c(%ebp) if (pid < 0) { 319b: 83 7d e4 00 cmpl $0x0,-0x1c(%ebp) 319f: 79 1b jns 31bc <sbrktest+0xc7> printf(stdout, "sbrk test fork failed\n"); 31a1: a1 00 63 00 00 mov 0x6300,%eax 31a6: 83 ec 08 sub $0x8,%esp 31a9: 68 51 58 00 00 push $0x5851 31ae: 50 push %eax 31af: e8 da 0e 00 00 call 408e <printf> 31b4: 83 c4 10 add $0x10,%esp exit(); 31b7: e8 13 0d 00 00 call 3ecf <exit> } c = sbrk(1); 31bc: 83 ec 0c sub $0xc,%esp 31bf: 6a 01 push $0x1 31c1: e8 91 0d 00 00 call 3f57 <sbrk> 31c6: 83 c4 10 add $0x10,%esp 31c9: 89 45 e0 mov %eax,-0x20(%ebp) c = sbrk(1); 31cc: 83 ec 0c sub $0xc,%esp 31cf: 6a 01 push $0x1 31d1: e8 81 0d 00 00 call 3f57 <sbrk> 31d6: 83 c4 10 add $0x10,%esp 31d9: 89 45 e0 mov %eax,-0x20(%ebp) if (c != a + 1) { 31dc: 8b 45 f4 mov -0xc(%ebp),%eax 31df: 83 c0 01 add $0x1,%eax 31e2: 3b 45 e0 cmp -0x20(%ebp),%eax 31e5: 74 1b je 3202 <sbrktest+0x10d> printf(stdout, "sbrk test failed post-fork\n"); 31e7: a1 00 63 00 00 mov 0x6300,%eax 31ec: 83 ec 08 sub $0x8,%esp 31ef: 68 68 58 00 00 push $0x5868 31f4: 50 push %eax 31f5: e8 94 0e 00 00 call 408e <printf> 31fa: 83 c4 10 add $0x10,%esp exit(); 31fd: e8 cd 0c 00 00 call 3ecf <exit> } if (pid == 0) 3202: 83 7d e4 00 cmpl $0x0,-0x1c(%ebp) 3206: 75 05 jne 320d <sbrktest+0x118> exit(); 3208: e8 c2 0c 00 00 call 3ecf <exit> wait(); 320d: e8 c5 0c 00 00 call 3ed7 <wait> // can one grow address space to something big? #define BIG (100*1024*1024) a = sbrk(0); 3212: 83 ec 0c sub $0xc,%esp 3215: 6a 00 push $0x0 3217: e8 3b 0d 00 00 call 3f57 <sbrk> 321c: 83 c4 10 add $0x10,%esp 321f: 89 45 f4 mov %eax,-0xc(%ebp) amt = (BIG) - (uint) a; 3222: 8b 45 f4 mov -0xc(%ebp),%eax 3225: ba 00 00 40 06 mov $0x6400000,%edx 322a: 29 c2 sub %eax,%edx 322c: 89 d0 mov %edx,%eax 322e: 89 45 dc mov %eax,-0x24(%ebp) p = sbrk(amt); 3231: 8b 45 dc mov -0x24(%ebp),%eax 3234: 83 ec 0c sub $0xc,%esp 3237: 50 push %eax 3238: e8 1a 0d 00 00 call 3f57 <sbrk> 323d: 83 c4 10 add $0x10,%esp 3240: 89 45 d8 mov %eax,-0x28(%ebp) if (p != a) { 3243: 8b 45 d8 mov -0x28(%ebp),%eax 3246: 3b 45 f4 cmp -0xc(%ebp),%eax 3249: 74 1b je 3266 <sbrktest+0x171> printf(stdout, 324b: a1 00 63 00 00 mov 0x6300,%eax 3250: 83 ec 08 sub $0x8,%esp 3253: 68 84 58 00 00 push $0x5884 3258: 50 push %eax 3259: e8 30 0e 00 00 call 408e <printf> 325e: 83 c4 10 add $0x10,%esp "sbrk test failed to grow big address space; enough phys mem?\n"); exit(); 3261: e8 69 0c 00 00 call 3ecf <exit> } lastaddr = (char *)(BIG - 1); 3266: c7 45 d4 ff ff 3f 06 movl $0x63fffff,-0x2c(%ebp) *lastaddr = 99; 326d: 8b 45 d4 mov -0x2c(%ebp),%eax 3270: c6 00 63 movb $0x63,(%eax) // can one de-allocate? a = sbrk(0); 3273: 83 ec 0c sub $0xc,%esp 3276: 6a 00 push $0x0 3278: e8 da 0c 00 00 call 3f57 <sbrk> 327d: 83 c4 10 add $0x10,%esp 3280: 89 45 f4 mov %eax,-0xc(%ebp) c = sbrk(-4096); 3283: 83 ec 0c sub $0xc,%esp 3286: 68 00 f0 ff ff push $0xfffff000 328b: e8 c7 0c 00 00 call 3f57 <sbrk> 3290: 83 c4 10 add $0x10,%esp 3293: 89 45 e0 mov %eax,-0x20(%ebp) if (c == (char *)0xffffffff) { 3296: 83 7d e0 ff cmpl $0xffffffff,-0x20(%ebp) 329a: 75 1b jne 32b7 <sbrktest+0x1c2> printf(stdout, "sbrk could not deallocate\n"); 329c: a1 00 63 00 00 mov 0x6300,%eax 32a1: 83 ec 08 sub $0x8,%esp 32a4: 68 c2 58 00 00 push $0x58c2 32a9: 50 push %eax 32aa: e8 df 0d 00 00 call 408e <printf> 32af: 83 c4 10 add $0x10,%esp exit(); 32b2: e8 18 0c 00 00 call 3ecf <exit> } c = sbrk(0); 32b7: 83 ec 0c sub $0xc,%esp 32ba: 6a 00 push $0x0 32bc: e8 96 0c 00 00 call 3f57 <sbrk> 32c1: 83 c4 10 add $0x10,%esp 32c4: 89 45 e0 mov %eax,-0x20(%ebp) if (c != a - 4096) { 32c7: 8b 45 f4 mov -0xc(%ebp),%eax 32ca: 2d 00 10 00 00 sub $0x1000,%eax 32cf: 3b 45 e0 cmp -0x20(%ebp),%eax 32d2: 74 1e je 32f2 <sbrktest+0x1fd> printf(stdout, 32d4: a1 00 63 00 00 mov 0x6300,%eax 32d9: ff 75 e0 pushl -0x20(%ebp) 32dc: ff 75 f4 pushl -0xc(%ebp) 32df: 68 e0 58 00 00 push $0x58e0 32e4: 50 push %eax 32e5: e8 a4 0d 00 00 call 408e <printf> 32ea: 83 c4 10 add $0x10,%esp "sbrk deallocation produced wrong address, a %x c %x\n", a, c); exit(); 32ed: e8 dd 0b 00 00 call 3ecf <exit> } // can one re-allocate that page? a = sbrk(0); 32f2: 83 ec 0c sub $0xc,%esp 32f5: 6a 00 push $0x0 32f7: e8 5b 0c 00 00 call 3f57 <sbrk> 32fc: 83 c4 10 add $0x10,%esp 32ff: 89 45 f4 mov %eax,-0xc(%ebp) c = sbrk(4096); 3302: 83 ec 0c sub $0xc,%esp 3305: 68 00 10 00 00 push $0x1000 330a: e8 48 0c 00 00 call 3f57 <sbrk> 330f: 83 c4 10 add $0x10,%esp 3312: 89 45 e0 mov %eax,-0x20(%ebp) if (c != a || sbrk(0) != a + 4096) { 3315: 8b 45 e0 mov -0x20(%ebp),%eax 3318: 3b 45 f4 cmp -0xc(%ebp),%eax 331b: 75 1b jne 3338 <sbrktest+0x243> 331d: 83 ec 0c sub $0xc,%esp 3320: 6a 00 push $0x0 3322: e8 30 0c 00 00 call 3f57 <sbrk> 3327: 83 c4 10 add $0x10,%esp 332a: 89 c2 mov %eax,%edx 332c: 8b 45 f4 mov -0xc(%ebp),%eax 332f: 05 00 10 00 00 add $0x1000,%eax 3334: 39 c2 cmp %eax,%edx 3336: 74 1e je 3356 <sbrktest+0x261> printf(stdout, "sbrk re-allocation failed, a %x c %x\n", a, c); 3338: a1 00 63 00 00 mov 0x6300,%eax 333d: ff 75 e0 pushl -0x20(%ebp) 3340: ff 75 f4 pushl -0xc(%ebp) 3343: 68 18 59 00 00 push $0x5918 3348: 50 push %eax 3349: e8 40 0d 00 00 call 408e <printf> 334e: 83 c4 10 add $0x10,%esp exit(); 3351: e8 79 0b 00 00 call 3ecf <exit> } if (*lastaddr == 99) { 3356: 8b 45 d4 mov -0x2c(%ebp),%eax 3359: 0f b6 00 movzbl (%eax),%eax 335c: 3c 63 cmp $0x63,%al 335e: 75 1b jne 337b <sbrktest+0x286> // should be zero printf(stdout, "sbrk de-allocation didn't really deallocate\n"); 3360: a1 00 63 00 00 mov 0x6300,%eax 3365: 83 ec 08 sub $0x8,%esp 3368: 68 40 59 00 00 push $0x5940 336d: 50 push %eax 336e: e8 1b 0d 00 00 call 408e <printf> 3373: 83 c4 10 add $0x10,%esp exit(); 3376: e8 54 0b 00 00 call 3ecf <exit> } a = sbrk(0); 337b: 83 ec 0c sub $0xc,%esp 337e: 6a 00 push $0x0 3380: e8 d2 0b 00 00 call 3f57 <sbrk> 3385: 83 c4 10 add $0x10,%esp 3388: 89 45 f4 mov %eax,-0xc(%ebp) c = sbrk(-(sbrk(0) - oldbrk)); 338b: 8b 5d ec mov -0x14(%ebp),%ebx 338e: 83 ec 0c sub $0xc,%esp 3391: 6a 00 push $0x0 3393: e8 bf 0b 00 00 call 3f57 <sbrk> 3398: 83 c4 10 add $0x10,%esp 339b: 29 c3 sub %eax,%ebx 339d: 89 d8 mov %ebx,%eax 339f: 83 ec 0c sub $0xc,%esp 33a2: 50 push %eax 33a3: e8 af 0b 00 00 call 3f57 <sbrk> 33a8: 83 c4 10 add $0x10,%esp 33ab: 89 45 e0 mov %eax,-0x20(%ebp) if (c != a) { 33ae: 8b 45 e0 mov -0x20(%ebp),%eax 33b1: 3b 45 f4 cmp -0xc(%ebp),%eax 33b4: 74 1e je 33d4 <sbrktest+0x2df> printf(stdout, "sbrk downsize failed, a %x c %x\n", a, c); 33b6: a1 00 63 00 00 mov 0x6300,%eax 33bb: ff 75 e0 pushl -0x20(%ebp) 33be: ff 75 f4 pushl -0xc(%ebp) 33c1: 68 70 59 00 00 push $0x5970 33c6: 50 push %eax 33c7: e8 c2 0c 00 00 call 408e <printf> 33cc: 83 c4 10 add $0x10,%esp exit(); 33cf: e8 fb 0a 00 00 call 3ecf <exit> } // can we read the kernel's memory? for (a = (char *)(KERNBASE); a < (char *)(KERNBASE + 2000000); 33d4: c7 45 f4 00 00 00 80 movl $0x80000000,-0xc(%ebp) 33db: eb 76 jmp 3453 <sbrktest+0x35e> a += 50000) { ppid = getpid(); 33dd: e8 6d 0b 00 00 call 3f4f <getpid> 33e2: 89 45 d0 mov %eax,-0x30(%ebp) pid = fork(); 33e5: e8 dd 0a 00 00 call 3ec7 <fork> 33ea: 89 45 e4 mov %eax,-0x1c(%ebp) if (pid < 0) { 33ed: 83 7d e4 00 cmpl $0x0,-0x1c(%ebp) 33f1: 79 1b jns 340e <sbrktest+0x319> printf(stdout, "fork failed\n"); 33f3: a1 00 63 00 00 mov 0x6300,%eax 33f8: 83 ec 08 sub $0x8,%esp 33fb: 68 e5 44 00 00 push $0x44e5 3400: 50 push %eax 3401: e8 88 0c 00 00 call 408e <printf> 3406: 83 c4 10 add $0x10,%esp exit(); 3409: e8 c1 0a 00 00 call 3ecf <exit> } if (pid == 0) { 340e: 83 7d e4 00 cmpl $0x0,-0x1c(%ebp) 3412: 75 33 jne 3447 <sbrktest+0x352> printf(stdout, "oops could read %x = %x\n", a, *a); 3414: 8b 45 f4 mov -0xc(%ebp),%eax 3417: 0f b6 00 movzbl (%eax),%eax 341a: 0f be d0 movsbl %al,%edx 341d: a1 00 63 00 00 mov 0x6300,%eax 3422: 52 push %edx 3423: ff 75 f4 pushl -0xc(%ebp) 3426: 68 91 59 00 00 push $0x5991 342b: 50 push %eax 342c: e8 5d 0c 00 00 call 408e <printf> 3431: 83 c4 10 add $0x10,%esp kill(ppid); 3434: 83 ec 0c sub $0xc,%esp 3437: ff 75 d0 pushl -0x30(%ebp) 343a: e8 c0 0a 00 00 call 3eff <kill> 343f: 83 c4 10 add $0x10,%esp exit(); 3442: e8 88 0a 00 00 call 3ecf <exit> } wait(); 3447: e8 8b 0a 00 00 call 3ed7 <wait> printf(stdout, "sbrk downsize failed, a %x c %x\n", a, c); exit(); } // can we read the kernel's memory? for (a = (char *)(KERNBASE); a < (char *)(KERNBASE + 2000000); a += 50000) { 344c: 81 45 f4 50 c3 00 00 addl $0xc350,-0xc(%ebp) if (c != a) { printf(stdout, "sbrk downsize failed, a %x c %x\n", a, c); exit(); } // can we read the kernel's memory? for (a = (char *)(KERNBASE); a < (char *)(KERNBASE + 2000000); 3453: 81 7d f4 7f 84 1e 80 cmpl $0x801e847f,-0xc(%ebp) 345a: 76 81 jbe 33dd <sbrktest+0x2e8> wait(); } // if we run the system out of memory, does it clean up the last // failed allocation? if (pipe(fds) != 0) { 345c: 83 ec 0c sub $0xc,%esp 345f: 8d 45 c8 lea -0x38(%ebp),%eax 3462: 50 push %eax 3463: e8 77 0a 00 00 call 3edf <pipe> 3468: 83 c4 10 add $0x10,%esp 346b: 85 c0 test %eax,%eax 346d: 74 17 je 3486 <sbrktest+0x391> printf(1, "pipe() failed\n"); 346f: 83 ec 08 sub $0x8,%esp 3472: 68 b6 48 00 00 push $0x48b6 3477: 6a 01 push $0x1 3479: e8 10 0c 00 00 call 408e <printf> 347e: 83 c4 10 add $0x10,%esp exit(); 3481: e8 49 0a 00 00 call 3ecf <exit> } for (i = 0; i < sizeof(pids) / sizeof(pids[0]); i++) { 3486: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp) 348d: e9 88 00 00 00 jmp 351a <sbrktest+0x425> if ((pids[i] = fork()) == 0) { 3492: e8 30 0a 00 00 call 3ec7 <fork> 3497: 89 c2 mov %eax,%edx 3499: 8b 45 f0 mov -0x10(%ebp),%eax 349c: 89 54 85 a0 mov %edx,-0x60(%ebp,%eax,4) 34a0: 8b 45 f0 mov -0x10(%ebp),%eax 34a3: 8b 44 85 a0 mov -0x60(%ebp,%eax,4),%eax 34a7: 85 c0 test %eax,%eax 34a9: 75 4a jne 34f5 <sbrktest+0x400> // allocate a lot of memory sbrk(BIG - (uint) sbrk(0)); 34ab: 83 ec 0c sub $0xc,%esp 34ae: 6a 00 push $0x0 34b0: e8 a2 0a 00 00 call 3f57 <sbrk> 34b5: 83 c4 10 add $0x10,%esp 34b8: ba 00 00 40 06 mov $0x6400000,%edx 34bd: 29 c2 sub %eax,%edx 34bf: 89 d0 mov %edx,%eax 34c1: 83 ec 0c sub $0xc,%esp 34c4: 50 push %eax 34c5: e8 8d 0a 00 00 call 3f57 <sbrk> 34ca: 83 c4 10 add $0x10,%esp write(fds[1], "x", 1); 34cd: 8b 45 cc mov -0x34(%ebp),%eax 34d0: 83 ec 04 sub $0x4,%esp 34d3: 6a 01 push $0x1 34d5: 68 1b 49 00 00 push $0x491b 34da: 50 push %eax 34db: e8 0f 0a 00 00 call 3eef <write> 34e0: 83 c4 10 add $0x10,%esp // sit around until killed for (;;) sleep(1000); 34e3: 83 ec 0c sub $0xc,%esp 34e6: 68 e8 03 00 00 push $0x3e8 34eb: e8 6f 0a 00 00 call 3f5f <sleep> 34f0: 83 c4 10 add $0x10,%esp 34f3: eb ee jmp 34e3 <sbrktest+0x3ee> } if (pids[i] != -1) 34f5: 8b 45 f0 mov -0x10(%ebp),%eax 34f8: 8b 44 85 a0 mov -0x60(%ebp,%eax,4),%eax 34fc: 83 f8 ff cmp $0xffffffff,%eax 34ff: 74 15 je 3516 <sbrktest+0x421> read(fds[0], &scratch, 1); 3501: 8b 45 c8 mov -0x38(%ebp),%eax 3504: 83 ec 04 sub $0x4,%esp 3507: 6a 01 push $0x1 3509: 8d 55 9f lea -0x61(%ebp),%edx 350c: 52 push %edx 350d: 50 push %eax 350e: e8 d4 09 00 00 call 3ee7 <read> 3513: 83 c4 10 add $0x10,%esp // failed allocation? if (pipe(fds) != 0) { printf(1, "pipe() failed\n"); exit(); } for (i = 0; i < sizeof(pids) / sizeof(pids[0]); i++) { 3516: 83 45 f0 01 addl $0x1,-0x10(%ebp) 351a: 8b 45 f0 mov -0x10(%ebp),%eax 351d: 83 f8 09 cmp $0x9,%eax 3520: 0f 86 6c ff ff ff jbe 3492 <sbrktest+0x39d> if (pids[i] != -1) read(fds[0], &scratch, 1); } // if those failed allocations freed up the pages they did allocate, // we'll be able to allocate here c = sbrk(4096); 3526: 83 ec 0c sub $0xc,%esp 3529: 68 00 10 00 00 push $0x1000 352e: e8 24 0a 00 00 call 3f57 <sbrk> 3533: 83 c4 10 add $0x10,%esp 3536: 89 45 e0 mov %eax,-0x20(%ebp) for (i = 0; i < sizeof(pids) / sizeof(pids[0]); i++) { 3539: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp) 3540: eb 2b jmp 356d <sbrktest+0x478> if (pids[i] == -1) 3542: 8b 45 f0 mov -0x10(%ebp),%eax 3545: 8b 44 85 a0 mov -0x60(%ebp,%eax,4),%eax 3549: 83 f8 ff cmp $0xffffffff,%eax 354c: 74 1a je 3568 <sbrktest+0x473> continue; kill(pids[i]); 354e: 8b 45 f0 mov -0x10(%ebp),%eax 3551: 8b 44 85 a0 mov -0x60(%ebp,%eax,4),%eax 3555: 83 ec 0c sub $0xc,%esp 3558: 50 push %eax 3559: e8 a1 09 00 00 call 3eff <kill> 355e: 83 c4 10 add $0x10,%esp wait(); 3561: e8 71 09 00 00 call 3ed7 <wait> 3566: eb 01 jmp 3569 <sbrktest+0x474> // if those failed allocations freed up the pages they did allocate, // we'll be able to allocate here c = sbrk(4096); for (i = 0; i < sizeof(pids) / sizeof(pids[0]); i++) { if (pids[i] == -1) continue; 3568: 90 nop read(fds[0], &scratch, 1); } // if those failed allocations freed up the pages they did allocate, // we'll be able to allocate here c = sbrk(4096); for (i = 0; i < sizeof(pids) / sizeof(pids[0]); i++) { 3569: 83 45 f0 01 addl $0x1,-0x10(%ebp) 356d: 8b 45 f0 mov -0x10(%ebp),%eax 3570: 83 f8 09 cmp $0x9,%eax 3573: 76 cd jbe 3542 <sbrktest+0x44d> if (pids[i] == -1) continue; kill(pids[i]); wait(); } if (c == (char *)0xffffffff) { 3575: 83 7d e0 ff cmpl $0xffffffff,-0x20(%ebp) 3579: 75 1b jne 3596 <sbrktest+0x4a1> printf(stdout, "failed sbrk leaked memory\n"); 357b: a1 00 63 00 00 mov 0x6300,%eax 3580: 83 ec 08 sub $0x8,%esp 3583: 68 aa 59 00 00 push $0x59aa 3588: 50 push %eax 3589: e8 00 0b 00 00 call 408e <printf> 358e: 83 c4 10 add $0x10,%esp exit(); 3591: e8 39 09 00 00 call 3ecf <exit> } if (sbrk(0) > oldbrk) 3596: 83 ec 0c sub $0xc,%esp 3599: 6a 00 push $0x0 359b: e8 b7 09 00 00 call 3f57 <sbrk> 35a0: 83 c4 10 add $0x10,%esp 35a3: 3b 45 ec cmp -0x14(%ebp),%eax 35a6: 76 20 jbe 35c8 <sbrktest+0x4d3> sbrk(-(sbrk(0) - oldbrk)); 35a8: 8b 5d ec mov -0x14(%ebp),%ebx 35ab: 83 ec 0c sub $0xc,%esp 35ae: 6a 00 push $0x0 35b0: e8 a2 09 00 00 call 3f57 <sbrk> 35b5: 83 c4 10 add $0x10,%esp 35b8: 29 c3 sub %eax,%ebx 35ba: 89 d8 mov %ebx,%eax 35bc: 83 ec 0c sub $0xc,%esp 35bf: 50 push %eax 35c0: e8 92 09 00 00 call 3f57 <sbrk> 35c5: 83 c4 10 add $0x10,%esp printf(stdout, "sbrk test OK\n"); 35c8: a1 00 63 00 00 mov 0x6300,%eax 35cd: 83 ec 08 sub $0x8,%esp 35d0: 68 c5 59 00 00 push $0x59c5 35d5: 50 push %eax 35d6: e8 b3 0a 00 00 call 408e <printf> 35db: 83 c4 10 add $0x10,%esp } 35de: 90 nop 35df: 8b 5d fc mov -0x4(%ebp),%ebx 35e2: c9 leave 35e3: c3 ret 000035e4 <validateint>: void validateint(int *p) { 35e4: 55 push %ebp 35e5: 89 e5 mov %esp,%ebp 35e7: 53 push %ebx 35e8: 83 ec 10 sub $0x10,%esp int res; asm("mov %%esp, %%ebx\n\t" "mov %3, %%esp\n\t" "int %2\n\t" "mov %%ebx, %%esp": 35eb: b8 0d 00 00 00 mov $0xd,%eax 35f0: 8b 55 08 mov 0x8(%ebp),%edx 35f3: 89 d1 mov %edx,%ecx 35f5: 89 e3 mov %esp,%ebx 35f7: 89 cc mov %ecx,%esp 35f9: cd 40 int $0x40 35fb: 89 dc mov %ebx,%esp 35fd: 89 45 f8 mov %eax,-0x8(%ebp) "=a"(res): "a"(SYS_sleep), "n"(T_SYSCALL), "c"(p): "ebx"); } 3600: 90 nop 3601: 83 c4 10 add $0x10,%esp 3604: 5b pop %ebx 3605: 5d pop %ebp 3606: c3 ret 00003607 <validatetest>: void validatetest(void) { 3607: 55 push %ebp 3608: 89 e5 mov %esp,%ebp 360a: 83 ec 18 sub $0x18,%esp int hi, pid; uint p; printf(stdout, "validate test\n"); 360d: a1 00 63 00 00 mov 0x6300,%eax 3612: 83 ec 08 sub $0x8,%esp 3615: 68 d3 59 00 00 push $0x59d3 361a: 50 push %eax 361b: e8 6e 0a 00 00 call 408e <printf> 3620: 83 c4 10 add $0x10,%esp hi = 1100 * 1024; 3623: c7 45 f0 00 30 11 00 movl $0x113000,-0x10(%ebp) for (p = 0; p <= (uint) hi; p += 4096) { 362a: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 3631: e9 8a 00 00 00 jmp 36c0 <validatetest+0xb9> if ((pid = fork()) == 0) { 3636: e8 8c 08 00 00 call 3ec7 <fork> 363b: 89 45 ec mov %eax,-0x14(%ebp) 363e: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 3642: 75 14 jne 3658 <validatetest+0x51> // try to crash the kernel by passing in a badly placed integer validateint((int *)p); 3644: 8b 45 f4 mov -0xc(%ebp),%eax 3647: 83 ec 0c sub $0xc,%esp 364a: 50 push %eax 364b: e8 94 ff ff ff call 35e4 <validateint> 3650: 83 c4 10 add $0x10,%esp exit(); 3653: e8 77 08 00 00 call 3ecf <exit> } sleep(0); 3658: 83 ec 0c sub $0xc,%esp 365b: 6a 00 push $0x0 365d: e8 fd 08 00 00 call 3f5f <sleep> 3662: 83 c4 10 add $0x10,%esp sleep(0); 3665: 83 ec 0c sub $0xc,%esp 3668: 6a 00 push $0x0 366a: e8 f0 08 00 00 call 3f5f <sleep> 366f: 83 c4 10 add $0x10,%esp kill(pid); 3672: 83 ec 0c sub $0xc,%esp 3675: ff 75 ec pushl -0x14(%ebp) 3678: e8 82 08 00 00 call 3eff <kill> 367d: 83 c4 10 add $0x10,%esp wait(); 3680: e8 52 08 00 00 call 3ed7 <wait> // try to crash the kernel by passing in a bad string pointer if (link("nosuchfile", (char *)p) != -1) { 3685: 8b 45 f4 mov -0xc(%ebp),%eax 3688: 83 ec 08 sub $0x8,%esp 368b: 50 push %eax 368c: 68 e2 59 00 00 push $0x59e2 3691: e8 99 08 00 00 call 3f2f <link> 3696: 83 c4 10 add $0x10,%esp 3699: 83 f8 ff cmp $0xffffffff,%eax 369c: 74 1b je 36b9 <validatetest+0xb2> printf(stdout, "link should not succeed\n"); 369e: a1 00 63 00 00 mov 0x6300,%eax 36a3: 83 ec 08 sub $0x8,%esp 36a6: 68 ed 59 00 00 push $0x59ed 36ab: 50 push %eax 36ac: e8 dd 09 00 00 call 408e <printf> 36b1: 83 c4 10 add $0x10,%esp exit(); 36b4: e8 16 08 00 00 call 3ecf <exit> uint p; printf(stdout, "validate test\n"); hi = 1100 * 1024; for (p = 0; p <= (uint) hi; p += 4096) { 36b9: 81 45 f4 00 10 00 00 addl $0x1000,-0xc(%ebp) 36c0: 8b 45 f0 mov -0x10(%ebp),%eax 36c3: 39 45 f4 cmp %eax,-0xc(%ebp) 36c6: 0f 86 6a ff ff ff jbe 3636 <validatetest+0x2f> printf(stdout, "link should not succeed\n"); exit(); } } printf(stdout, "validate ok\n"); 36cc: a1 00 63 00 00 mov 0x6300,%eax 36d1: 83 ec 08 sub $0x8,%esp 36d4: 68 06 5a 00 00 push $0x5a06 36d9: 50 push %eax 36da: e8 af 09 00 00 call 408e <printf> 36df: 83 c4 10 add $0x10,%esp } 36e2: 90 nop 36e3: c9 leave 36e4: c3 ret 000036e5 <bsstest>: // does unintialized data start out zero? char uninit[10000]; void bsstest(void) { 36e5: 55 push %ebp 36e6: 89 e5 mov %esp,%ebp 36e8: 83 ec 18 sub $0x18,%esp int i; printf(stdout, "bss test\n"); 36eb: a1 00 63 00 00 mov 0x6300,%eax 36f0: 83 ec 08 sub $0x8,%esp 36f3: 68 13 5a 00 00 push $0x5a13 36f8: 50 push %eax 36f9: e8 90 09 00 00 call 408e <printf> 36fe: 83 c4 10 add $0x10,%esp for (i = 0; i < sizeof(uninit); i++) { 3701: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 3708: eb 2e jmp 3738 <bsstest+0x53> if (uninit[i] != '\0') { 370a: 8b 45 f4 mov -0xc(%ebp),%eax 370d: 05 c0 63 00 00 add $0x63c0,%eax 3712: 0f b6 00 movzbl (%eax),%eax 3715: 84 c0 test %al,%al 3717: 74 1b je 3734 <bsstest+0x4f> printf(stdout, "bss test failed\n"); 3719: a1 00 63 00 00 mov 0x6300,%eax 371e: 83 ec 08 sub $0x8,%esp 3721: 68 1d 5a 00 00 push $0x5a1d 3726: 50 push %eax 3727: e8 62 09 00 00 call 408e <printf> 372c: 83 c4 10 add $0x10,%esp exit(); 372f: e8 9b 07 00 00 call 3ecf <exit> void bsstest(void) { int i; printf(stdout, "bss test\n"); for (i = 0; i < sizeof(uninit); i++) { 3734: 83 45 f4 01 addl $0x1,-0xc(%ebp) 3738: 8b 45 f4 mov -0xc(%ebp),%eax 373b: 3d 0f 27 00 00 cmp $0x270f,%eax 3740: 76 c8 jbe 370a <bsstest+0x25> if (uninit[i] != '\0') { printf(stdout, "bss test failed\n"); exit(); } } printf(stdout, "bss test ok\n"); 3742: a1 00 63 00 00 mov 0x6300,%eax 3747: 83 ec 08 sub $0x8,%esp 374a: 68 2e 5a 00 00 push $0x5a2e 374f: 50 push %eax 3750: e8 39 09 00 00 call 408e <printf> 3755: 83 c4 10 add $0x10,%esp } 3758: 90 nop 3759: c9 leave 375a: c3 ret 0000375b <bigargtest>: // does exec return an error if the arguments // are larger than a page? or does it write // below the stack and wreck the instructions/data? void bigargtest(void) { 375b: 55 push %ebp 375c: 89 e5 mov %esp,%ebp 375e: 83 ec 18 sub $0x18,%esp int pid, fd; unlink("bigarg-ok"); 3761: 83 ec 0c sub $0xc,%esp 3764: 68 3b 5a 00 00 push $0x5a3b 3769: e8 b1 07 00 00 call 3f1f <unlink> 376e: 83 c4 10 add $0x10,%esp pid = fork(); 3771: e8 51 07 00 00 call 3ec7 <fork> 3776: 89 45 f0 mov %eax,-0x10(%ebp) if (pid == 0) { 3779: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 377d: 0f 85 97 00 00 00 jne 381a <bigargtest+0xbf> static char *args[MAXARG]; int i; for (i = 0; i < MAXARG - 1; i++) 3783: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 378a: eb 12 jmp 379e <bigargtest+0x43> args[i] = 378c: 8b 45 f4 mov -0xc(%ebp),%eax 378f: c7 04 85 20 63 00 00 movl $0x5a48,0x6320(,%eax,4) 3796: 48 5a 00 00 unlink("bigarg-ok"); pid = fork(); if (pid == 0) { static char *args[MAXARG]; int i; for (i = 0; i < MAXARG - 1; i++) 379a: 83 45 f4 01 addl $0x1,-0xc(%ebp) 379e: 83 7d f4 1e cmpl $0x1e,-0xc(%ebp) 37a2: 7e e8 jle 378c <bigargtest+0x31> args[i] = "bigargs test: failed\n "; args[MAXARG - 1] = 0; 37a4: c7 05 9c 63 00 00 00 movl $0x0,0x639c 37ab: 00 00 00 printf(stdout, "bigarg test\n"); 37ae: a1 00 63 00 00 mov 0x6300,%eax 37b3: 83 ec 08 sub $0x8,%esp 37b6: 68 25 5b 00 00 push $0x5b25 37bb: 50 push %eax 37bc: e8 cd 08 00 00 call 408e <printf> 37c1: 83 c4 10 add $0x10,%esp exec("echo", args); 37c4: 83 ec 08 sub $0x8,%esp 37c7: 68 20 63 00 00 push $0x6320 37cc: 68 44 44 00 00 push $0x4444 37d1: e8 31 07 00 00 call 3f07 <exec> 37d6: 83 c4 10 add $0x10,%esp printf(stdout, "bigarg test ok\n"); 37d9: a1 00 63 00 00 mov 0x6300,%eax 37de: 83 ec 08 sub $0x8,%esp 37e1: 68 32 5b 00 00 push $0x5b32 37e6: 50 push %eax 37e7: e8 a2 08 00 00 call 408e <printf> 37ec: 83 c4 10 add $0x10,%esp fd = open("bigarg-ok", O_CREATE); 37ef: 83 ec 08 sub $0x8,%esp 37f2: 68 00 02 00 00 push $0x200 37f7: 68 3b 5a 00 00 push $0x5a3b 37fc: e8 0e 07 00 00 call 3f0f <open> 3801: 83 c4 10 add $0x10,%esp 3804: 89 45 ec mov %eax,-0x14(%ebp) close(fd); 3807: 83 ec 0c sub $0xc,%esp 380a: ff 75 ec pushl -0x14(%ebp) 380d: e8 e5 06 00 00 call 3ef7 <close> 3812: 83 c4 10 add $0x10,%esp exit(); 3815: e8 b5 06 00 00 call 3ecf <exit> } else if (pid < 0) { 381a: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 381e: 79 1b jns 383b <bigargtest+0xe0> printf(stdout, "bigargtest: fork failed\n"); 3820: a1 00 63 00 00 mov 0x6300,%eax 3825: 83 ec 08 sub $0x8,%esp 3828: 68 42 5b 00 00 push $0x5b42 382d: 50 push %eax 382e: e8 5b 08 00 00 call 408e <printf> 3833: 83 c4 10 add $0x10,%esp exit(); 3836: e8 94 06 00 00 call 3ecf <exit> } wait(); 383b: e8 97 06 00 00 call 3ed7 <wait> fd = open("bigarg-ok", 0); 3840: 83 ec 08 sub $0x8,%esp 3843: 6a 00 push $0x0 3845: 68 3b 5a 00 00 push $0x5a3b 384a: e8 c0 06 00 00 call 3f0f <open> 384f: 83 c4 10 add $0x10,%esp 3852: 89 45 ec mov %eax,-0x14(%ebp) if (fd < 0) { 3855: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 3859: 79 1b jns 3876 <bigargtest+0x11b> printf(stdout, "bigarg test failed!\n"); 385b: a1 00 63 00 00 mov 0x6300,%eax 3860: 83 ec 08 sub $0x8,%esp 3863: 68 5b 5b 00 00 push $0x5b5b 3868: 50 push %eax 3869: e8 20 08 00 00 call 408e <printf> 386e: 83 c4 10 add $0x10,%esp exit(); 3871: e8 59 06 00 00 call 3ecf <exit> } close(fd); 3876: 83 ec 0c sub $0xc,%esp 3879: ff 75 ec pushl -0x14(%ebp) 387c: e8 76 06 00 00 call 3ef7 <close> 3881: 83 c4 10 add $0x10,%esp unlink("bigarg-ok"); 3884: 83 ec 0c sub $0xc,%esp 3887: 68 3b 5a 00 00 push $0x5a3b 388c: e8 8e 06 00 00 call 3f1f <unlink> 3891: 83 c4 10 add $0x10,%esp } 3894: 90 nop 3895: c9 leave 3896: c3 ret 00003897 <fsfull>: // what happens when the file system runs out of blocks? // answer: balloc panics, so this test is not useful. void fsfull() { 3897: 55 push %ebp 3898: 89 e5 mov %esp,%ebp 389a: 53 push %ebx 389b: 83 ec 64 sub $0x64,%esp int nfiles; int fsblocks = 0; 389e: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp) printf(1, "fsfull test\n"); 38a5: 83 ec 08 sub $0x8,%esp 38a8: 68 70 5b 00 00 push $0x5b70 38ad: 6a 01 push $0x1 38af: e8 da 07 00 00 call 408e <printf> 38b4: 83 c4 10 add $0x10,%esp for (nfiles = 0;; nfiles++) { 38b7: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) char name[64]; name[0] = 'f'; 38be: c6 45 a4 66 movb $0x66,-0x5c(%ebp) name[1] = '0' + nfiles / 1000; 38c2: 8b 4d f4 mov -0xc(%ebp),%ecx 38c5: ba d3 4d 62 10 mov $0x10624dd3,%edx 38ca: 89 c8 mov %ecx,%eax 38cc: f7 ea imul %edx 38ce: c1 fa 06 sar $0x6,%edx 38d1: 89 c8 mov %ecx,%eax 38d3: c1 f8 1f sar $0x1f,%eax 38d6: 29 c2 sub %eax,%edx 38d8: 89 d0 mov %edx,%eax 38da: 83 c0 30 add $0x30,%eax 38dd: 88 45 a5 mov %al,-0x5b(%ebp) name[2] = '0' + (nfiles % 1000) / 100; 38e0: 8b 5d f4 mov -0xc(%ebp),%ebx 38e3: ba d3 4d 62 10 mov $0x10624dd3,%edx 38e8: 89 d8 mov %ebx,%eax 38ea: f7 ea imul %edx 38ec: c1 fa 06 sar $0x6,%edx 38ef: 89 d8 mov %ebx,%eax 38f1: c1 f8 1f sar $0x1f,%eax 38f4: 89 d1 mov %edx,%ecx 38f6: 29 c1 sub %eax,%ecx 38f8: 69 c1 e8 03 00 00 imul $0x3e8,%ecx,%eax 38fe: 29 c3 sub %eax,%ebx 3900: 89 d9 mov %ebx,%ecx 3902: ba 1f 85 eb 51 mov $0x51eb851f,%edx 3907: 89 c8 mov %ecx,%eax 3909: f7 ea imul %edx 390b: c1 fa 05 sar $0x5,%edx 390e: 89 c8 mov %ecx,%eax 3910: c1 f8 1f sar $0x1f,%eax 3913: 29 c2 sub %eax,%edx 3915: 89 d0 mov %edx,%eax 3917: 83 c0 30 add $0x30,%eax 391a: 88 45 a6 mov %al,-0x5a(%ebp) name[3] = '0' + (nfiles % 100) / 10; 391d: 8b 5d f4 mov -0xc(%ebp),%ebx 3920: ba 1f 85 eb 51 mov $0x51eb851f,%edx 3925: 89 d8 mov %ebx,%eax 3927: f7 ea imul %edx 3929: c1 fa 05 sar $0x5,%edx 392c: 89 d8 mov %ebx,%eax 392e: c1 f8 1f sar $0x1f,%eax 3931: 89 d1 mov %edx,%ecx 3933: 29 c1 sub %eax,%ecx 3935: 6b c1 64 imul $0x64,%ecx,%eax 3938: 29 c3 sub %eax,%ebx 393a: 89 d9 mov %ebx,%ecx 393c: ba 67 66 66 66 mov $0x66666667,%edx 3941: 89 c8 mov %ecx,%eax 3943: f7 ea imul %edx 3945: c1 fa 02 sar $0x2,%edx 3948: 89 c8 mov %ecx,%eax 394a: c1 f8 1f sar $0x1f,%eax 394d: 29 c2 sub %eax,%edx 394f: 89 d0 mov %edx,%eax 3951: 83 c0 30 add $0x30,%eax 3954: 88 45 a7 mov %al,-0x59(%ebp) name[4] = '0' + (nfiles % 10); 3957: 8b 4d f4 mov -0xc(%ebp),%ecx 395a: ba 67 66 66 66 mov $0x66666667,%edx 395f: 89 c8 mov %ecx,%eax 3961: f7 ea imul %edx 3963: c1 fa 02 sar $0x2,%edx 3966: 89 c8 mov %ecx,%eax 3968: c1 f8 1f sar $0x1f,%eax 396b: 29 c2 sub %eax,%edx 396d: 89 d0 mov %edx,%eax 396f: c1 e0 02 shl $0x2,%eax 3972: 01 d0 add %edx,%eax 3974: 01 c0 add %eax,%eax 3976: 29 c1 sub %eax,%ecx 3978: 89 ca mov %ecx,%edx 397a: 89 d0 mov %edx,%eax 397c: 83 c0 30 add $0x30,%eax 397f: 88 45 a8 mov %al,-0x58(%ebp) name[5] = '\0'; 3982: c6 45 a9 00 movb $0x0,-0x57(%ebp) printf(1, "writing %s\n", name); 3986: 83 ec 04 sub $0x4,%esp 3989: 8d 45 a4 lea -0x5c(%ebp),%eax 398c: 50 push %eax 398d: 68 7d 5b 00 00 push $0x5b7d 3992: 6a 01 push $0x1 3994: e8 f5 06 00 00 call 408e <printf> 3999: 83 c4 10 add $0x10,%esp int fd = open(name, O_CREATE | O_RDWR); 399c: 83 ec 08 sub $0x8,%esp 399f: 68 02 02 00 00 push $0x202 39a4: 8d 45 a4 lea -0x5c(%ebp),%eax 39a7: 50 push %eax 39a8: e8 62 05 00 00 call 3f0f <open> 39ad: 83 c4 10 add $0x10,%esp 39b0: 89 45 e8 mov %eax,-0x18(%ebp) if (fd < 0) { 39b3: 83 7d e8 00 cmpl $0x0,-0x18(%ebp) 39b7: 79 18 jns 39d1 <fsfull+0x13a> printf(1, "open %s failed\n", name); 39b9: 83 ec 04 sub $0x4,%esp 39bc: 8d 45 a4 lea -0x5c(%ebp),%eax 39bf: 50 push %eax 39c0: 68 89 5b 00 00 push $0x5b89 39c5: 6a 01 push $0x1 39c7: e8 c2 06 00 00 call 408e <printf> 39cc: 83 c4 10 add $0x10,%esp break; 39cf: eb 6b jmp 3a3c <fsfull+0x1a5> } int total = 0; 39d1: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp) while (1) { int cc = write(fd, buf, 512); 39d8: 83 ec 04 sub $0x4,%esp 39db: 68 00 02 00 00 push $0x200 39e0: 68 e0 8a 00 00 push $0x8ae0 39e5: ff 75 e8 pushl -0x18(%ebp) 39e8: e8 02 05 00 00 call 3eef <write> 39ed: 83 c4 10 add $0x10,%esp 39f0: 89 45 e4 mov %eax,-0x1c(%ebp) if (cc < 512) 39f3: 81 7d e4 ff 01 00 00 cmpl $0x1ff,-0x1c(%ebp) 39fa: 7e 0c jle 3a08 <fsfull+0x171> break; total += cc; 39fc: 8b 45 e4 mov -0x1c(%ebp),%eax 39ff: 01 45 ec add %eax,-0x14(%ebp) fsblocks++; 3a02: 83 45 f0 01 addl $0x1,-0x10(%ebp) } 3a06: eb d0 jmp 39d8 <fsfull+0x141> } int total = 0; while (1) { int cc = write(fd, buf, 512); if (cc < 512) break; 3a08: 90 nop total += cc; fsblocks++; } printf(1, "wrote %d bytes\n", total); 3a09: 83 ec 04 sub $0x4,%esp 3a0c: ff 75 ec pushl -0x14(%ebp) 3a0f: 68 99 5b 00 00 push $0x5b99 3a14: 6a 01 push $0x1 3a16: e8 73 06 00 00 call 408e <printf> 3a1b: 83 c4 10 add $0x10,%esp close(fd); 3a1e: 83 ec 0c sub $0xc,%esp 3a21: ff 75 e8 pushl -0x18(%ebp) 3a24: e8 ce 04 00 00 call 3ef7 <close> 3a29: 83 c4 10 add $0x10,%esp if (total == 0) 3a2c: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 3a30: 74 09 je 3a3b <fsfull+0x1a4> int nfiles; int fsblocks = 0; printf(1, "fsfull test\n"); for (nfiles = 0;; nfiles++) { 3a32: 83 45 f4 01 addl $0x1,-0xc(%ebp) } printf(1, "wrote %d bytes\n", total); close(fd); if (total == 0) break; } 3a36: e9 83 fe ff ff jmp 38be <fsfull+0x27> fsblocks++; } printf(1, "wrote %d bytes\n", total); close(fd); if (total == 0) break; 3a3b: 90 nop } while (nfiles >= 0) { 3a3c: e9 db 00 00 00 jmp 3b1c <fsfull+0x285> char name[64]; name[0] = 'f'; 3a41: c6 45 a4 66 movb $0x66,-0x5c(%ebp) name[1] = '0' + nfiles / 1000; 3a45: 8b 4d f4 mov -0xc(%ebp),%ecx 3a48: ba d3 4d 62 10 mov $0x10624dd3,%edx 3a4d: 89 c8 mov %ecx,%eax 3a4f: f7 ea imul %edx 3a51: c1 fa 06 sar $0x6,%edx 3a54: 89 c8 mov %ecx,%eax 3a56: c1 f8 1f sar $0x1f,%eax 3a59: 29 c2 sub %eax,%edx 3a5b: 89 d0 mov %edx,%eax 3a5d: 83 c0 30 add $0x30,%eax 3a60: 88 45 a5 mov %al,-0x5b(%ebp) name[2] = '0' + (nfiles % 1000) / 100; 3a63: 8b 5d f4 mov -0xc(%ebp),%ebx 3a66: ba d3 4d 62 10 mov $0x10624dd3,%edx 3a6b: 89 d8 mov %ebx,%eax 3a6d: f7 ea imul %edx 3a6f: c1 fa 06 sar $0x6,%edx 3a72: 89 d8 mov %ebx,%eax 3a74: c1 f8 1f sar $0x1f,%eax 3a77: 89 d1 mov %edx,%ecx 3a79: 29 c1 sub %eax,%ecx 3a7b: 69 c1 e8 03 00 00 imul $0x3e8,%ecx,%eax 3a81: 29 c3 sub %eax,%ebx 3a83: 89 d9 mov %ebx,%ecx 3a85: ba 1f 85 eb 51 mov $0x51eb851f,%edx 3a8a: 89 c8 mov %ecx,%eax 3a8c: f7 ea imul %edx 3a8e: c1 fa 05 sar $0x5,%edx 3a91: 89 c8 mov %ecx,%eax 3a93: c1 f8 1f sar $0x1f,%eax 3a96: 29 c2 sub %eax,%edx 3a98: 89 d0 mov %edx,%eax 3a9a: 83 c0 30 add $0x30,%eax 3a9d: 88 45 a6 mov %al,-0x5a(%ebp) name[3] = '0' + (nfiles % 100) / 10; 3aa0: 8b 5d f4 mov -0xc(%ebp),%ebx 3aa3: ba 1f 85 eb 51 mov $0x51eb851f,%edx 3aa8: 89 d8 mov %ebx,%eax 3aaa: f7 ea imul %edx 3aac: c1 fa 05 sar $0x5,%edx 3aaf: 89 d8 mov %ebx,%eax 3ab1: c1 f8 1f sar $0x1f,%eax 3ab4: 89 d1 mov %edx,%ecx 3ab6: 29 c1 sub %eax,%ecx 3ab8: 6b c1 64 imul $0x64,%ecx,%eax 3abb: 29 c3 sub %eax,%ebx 3abd: 89 d9 mov %ebx,%ecx 3abf: ba 67 66 66 66 mov $0x66666667,%edx 3ac4: 89 c8 mov %ecx,%eax 3ac6: f7 ea imul %edx 3ac8: c1 fa 02 sar $0x2,%edx 3acb: 89 c8 mov %ecx,%eax 3acd: c1 f8 1f sar $0x1f,%eax 3ad0: 29 c2 sub %eax,%edx 3ad2: 89 d0 mov %edx,%eax 3ad4: 83 c0 30 add $0x30,%eax 3ad7: 88 45 a7 mov %al,-0x59(%ebp) name[4] = '0' + (nfiles % 10); 3ada: 8b 4d f4 mov -0xc(%ebp),%ecx 3add: ba 67 66 66 66 mov $0x66666667,%edx 3ae2: 89 c8 mov %ecx,%eax 3ae4: f7 ea imul %edx 3ae6: c1 fa 02 sar $0x2,%edx 3ae9: 89 c8 mov %ecx,%eax 3aeb: c1 f8 1f sar $0x1f,%eax 3aee: 29 c2 sub %eax,%edx 3af0: 89 d0 mov %edx,%eax 3af2: c1 e0 02 shl $0x2,%eax 3af5: 01 d0 add %edx,%eax 3af7: 01 c0 add %eax,%eax 3af9: 29 c1 sub %eax,%ecx 3afb: 89 ca mov %ecx,%edx 3afd: 89 d0 mov %edx,%eax 3aff: 83 c0 30 add $0x30,%eax 3b02: 88 45 a8 mov %al,-0x58(%ebp) name[5] = '\0'; 3b05: c6 45 a9 00 movb $0x0,-0x57(%ebp) unlink(name); 3b09: 83 ec 0c sub $0xc,%esp 3b0c: 8d 45 a4 lea -0x5c(%ebp),%eax 3b0f: 50 push %eax 3b10: e8 0a 04 00 00 call 3f1f <unlink> 3b15: 83 c4 10 add $0x10,%esp nfiles--; 3b18: 83 6d f4 01 subl $0x1,-0xc(%ebp) close(fd); if (total == 0) break; } while (nfiles >= 0) { 3b1c: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 3b20: 0f 89 1b ff ff ff jns 3a41 <fsfull+0x1aa> name[5] = '\0'; unlink(name); nfiles--; } printf(1, "fsfull test finished\n"); 3b26: 83 ec 08 sub $0x8,%esp 3b29: 68 a9 5b 00 00 push $0x5ba9 3b2e: 6a 01 push $0x1 3b30: e8 59 05 00 00 call 408e <printf> 3b35: 83 c4 10 add $0x10,%esp } 3b38: 90 nop 3b39: 8b 5d fc mov -0x4(%ebp),%ebx 3b3c: c9 leave 3b3d: c3 ret 00003b3e <rand>: unsigned long randstate = 1; unsigned int rand() { 3b3e: 55 push %ebp 3b3f: 89 e5 mov %esp,%ebp randstate = randstate * 1664525 + 1013904223; 3b41: a1 04 63 00 00 mov 0x6304,%eax 3b46: 69 c0 0d 66 19 00 imul $0x19660d,%eax,%eax 3b4c: 05 5f f3 6e 3c add $0x3c6ef35f,%eax 3b51: a3 04 63 00 00 mov %eax,0x6304 return randstate; 3b56: a1 04 63 00 00 mov 0x6304,%eax } 3b5b: 5d pop %ebp 3b5c: c3 ret 00003b5d <main>: int main(int argc, char *argv[]) { 3b5d: 8d 4c 24 04 lea 0x4(%esp),%ecx 3b61: 83 e4 f0 and $0xfffffff0,%esp 3b64: ff 71 fc pushl -0x4(%ecx) 3b67: 55 push %ebp 3b68: 89 e5 mov %esp,%ebp 3b6a: 51 push %ecx 3b6b: 83 ec 04 sub $0x4,%esp printf(1, "usertests starting\n"); 3b6e: 83 ec 08 sub $0x8,%esp 3b71: 68 bf 5b 00 00 push $0x5bbf 3b76: 6a 01 push $0x1 3b78: e8 11 05 00 00 call 408e <printf> 3b7d: 83 c4 10 add $0x10,%esp if (open("usertests.ran", 0) >= 0) { 3b80: 83 ec 08 sub $0x8,%esp 3b83: 6a 00 push $0x0 3b85: 68 d3 5b 00 00 push $0x5bd3 3b8a: e8 80 03 00 00 call 3f0f <open> 3b8f: 83 c4 10 add $0x10,%esp 3b92: 85 c0 test %eax,%eax 3b94: 78 17 js 3bad <main+0x50> printf(1, "already ran user tests -- rebuild fs.img\n"); 3b96: 83 ec 08 sub $0x8,%esp 3b99: 68 e4 5b 00 00 push $0x5be4 3b9e: 6a 01 push $0x1 3ba0: e8 e9 04 00 00 call 408e <printf> 3ba5: 83 c4 10 add $0x10,%esp exit(); 3ba8: e8 22 03 00 00 call 3ecf <exit> } close(open("usertests.ran", O_CREATE)); 3bad: 83 ec 08 sub $0x8,%esp 3bb0: 68 00 02 00 00 push $0x200 3bb5: 68 d3 5b 00 00 push $0x5bd3 3bba: e8 50 03 00 00 call 3f0f <open> 3bbf: 83 c4 10 add $0x10,%esp 3bc2: 83 ec 0c sub $0xc,%esp 3bc5: 50 push %eax 3bc6: e8 2c 03 00 00 call 3ef7 <close> 3bcb: 83 c4 10 add $0x10,%esp createdelete(); 3bce: e8 d7 d6 ff ff call 12aa <createdelete> linkunlink(); 3bd3: e8 f8 e0 ff ff call 1cd0 <linkunlink> concreate(); 3bd8: e8 43 dd ff ff call 1920 <concreate> fourfiles(); 3bdd: e8 77 d4 ff ff call 1059 <fourfiles> sharedfd(); 3be2: e8 8f d2 ff ff call e76 <sharedfd> bigargtest(); 3be7: e8 6f fb ff ff call 375b <bigargtest> bigwrite(); 3bec: e8 d1 ea ff ff call 26c2 <bigwrite> bigargtest(); 3bf1: e8 65 fb ff ff call 375b <bigargtest> bsstest(); 3bf6: e8 ea fa ff ff call 36e5 <bsstest> sbrktest(); 3bfb: e8 f5 f4 ff ff call 30f5 <sbrktest> validatetest(); 3c00: e8 02 fa ff ff call 3607 <validatetest> opentest(); 3c05: e8 f5 c6 ff ff call 2ff <opentest> writetest(); 3c0a: e8 9f c7 ff ff call 3ae <writetest> writetest1(); 3c0f: e8 aa c9 ff ff call 5be <writetest1> createtest(); 3c14: e8 a1 cb ff ff call 7ba <createtest> openiputtest(); 3c19: e8 d2 c5 ff ff call 1f0 <openiputtest> exitiputtest(); 3c1e: e8 ce c4 ff ff call f1 <exitiputtest> iputtest(); 3c23: e8 d8 c3 ff ff call 0 <iputtest> mem(); 3c28: e8 58 d1 ff ff call d85 <mem> pipe1(); 3c2d: e8 8f cd ff ff call 9c1 <pipe1> preempt(); 3c32: e8 73 cf ff ff call baa <preempt> exitwait(); 3c37: e8 d1 d0 ff ff call d0d <exitwait> rmdot(); 3c3c: e8 f3 ee ff ff call 2b34 <rmdot> fourteen(); 3c41: e8 92 ed ff ff call 29d8 <fourteen> bigfile(); 3c46: e8 75 eb ff ff call 27c0 <bigfile> subdir(); 3c4b: e8 2e e3 ff ff call 1f7e <subdir> linktest(); 3c50: e8 89 da ff ff call 16de <linktest> unlinkread(); 3c55: e8 c2 d8 ff ff call 151c <unlinkread> dirfile(); 3c5a: e8 5a f0 ff ff call 2cb9 <dirfile> iref(); 3c5f: e8 8d f2 ff ff call 2ef1 <iref> forktest(); 3c64: e8 c2 f3 ff ff call 302b <forktest> bigdir(); // slow 3c69: e8 9b e1 ff ff call 1e09 <bigdir> exectest(); 3c6e: e8 fb cc ff ff call 96e <exectest> exit(); 3c73: e8 57 02 00 00 call 3ecf <exit> 00003c78 <stosb>: "cc"); } static inline void stosb(void *addr, int data, int cnt) { 3c78: 55 push %ebp 3c79: 89 e5 mov %esp,%ebp 3c7b: 57 push %edi 3c7c: 53 push %ebx asm volatile("cld; rep stosb" : 3c7d: 8b 4d 08 mov 0x8(%ebp),%ecx 3c80: 8b 55 10 mov 0x10(%ebp),%edx 3c83: 8b 45 0c mov 0xc(%ebp),%eax 3c86: 89 cb mov %ecx,%ebx 3c88: 89 df mov %ebx,%edi 3c8a: 89 d1 mov %edx,%ecx 3c8c: fc cld 3c8d: f3 aa rep stos %al,%es:(%edi) 3c8f: 89 ca mov %ecx,%edx 3c91: 89 fb mov %edi,%ebx 3c93: 89 5d 08 mov %ebx,0x8(%ebp) 3c96: 89 55 10 mov %edx,0x10(%ebp) "=D" (addr), "=c" (cnt) : "0" (addr), "1" (cnt), "a" (data) : "memory", "cc"); } 3c99: 90 nop 3c9a: 5b pop %ebx 3c9b: 5f pop %edi 3c9c: 5d pop %ebp 3c9d: c3 ret 00003c9e <strcpy>: #include "fcntl.h" #include "user.h" #include "x86.h" char *strcpy(char *s, char *t) { 3c9e: 55 push %ebp 3c9f: 89 e5 mov %esp,%ebp 3ca1: 83 ec 10 sub $0x10,%esp char *os; os = s; 3ca4: 8b 45 08 mov 0x8(%ebp),%eax 3ca7: 89 45 fc mov %eax,-0x4(%ebp) while ((*s++ = *t++) != 0) ; 3caa: 90 nop 3cab: 8b 45 08 mov 0x8(%ebp),%eax 3cae: 8d 50 01 lea 0x1(%eax),%edx 3cb1: 89 55 08 mov %edx,0x8(%ebp) 3cb4: 8b 55 0c mov 0xc(%ebp),%edx 3cb7: 8d 4a 01 lea 0x1(%edx),%ecx 3cba: 89 4d 0c mov %ecx,0xc(%ebp) 3cbd: 0f b6 12 movzbl (%edx),%edx 3cc0: 88 10 mov %dl,(%eax) 3cc2: 0f b6 00 movzbl (%eax),%eax 3cc5: 84 c0 test %al,%al 3cc7: 75 e2 jne 3cab <strcpy+0xd> return os; 3cc9: 8b 45 fc mov -0x4(%ebp),%eax } 3ccc: c9 leave 3ccd: c3 ret 00003cce <strcmp>: int strcmp(const char *p, const char *q) { 3cce: 55 push %ebp 3ccf: 89 e5 mov %esp,%ebp while (*p && *p == *q) 3cd1: eb 08 jmp 3cdb <strcmp+0xd> p++, q++; 3cd3: 83 45 08 01 addl $0x1,0x8(%ebp) 3cd7: 83 45 0c 01 addl $0x1,0xc(%ebp) return os; } int strcmp(const char *p, const char *q) { while (*p && *p == *q) 3cdb: 8b 45 08 mov 0x8(%ebp),%eax 3cde: 0f b6 00 movzbl (%eax),%eax 3ce1: 84 c0 test %al,%al 3ce3: 74 10 je 3cf5 <strcmp+0x27> 3ce5: 8b 45 08 mov 0x8(%ebp),%eax 3ce8: 0f b6 10 movzbl (%eax),%edx 3ceb: 8b 45 0c mov 0xc(%ebp),%eax 3cee: 0f b6 00 movzbl (%eax),%eax 3cf1: 38 c2 cmp %al,%dl 3cf3: 74 de je 3cd3 <strcmp+0x5> p++, q++; return (uchar) * p - (uchar) * q; 3cf5: 8b 45 08 mov 0x8(%ebp),%eax 3cf8: 0f b6 00 movzbl (%eax),%eax 3cfb: 0f b6 d0 movzbl %al,%edx 3cfe: 8b 45 0c mov 0xc(%ebp),%eax 3d01: 0f b6 00 movzbl (%eax),%eax 3d04: 0f b6 c0 movzbl %al,%eax 3d07: 29 c2 sub %eax,%edx 3d09: 89 d0 mov %edx,%eax } 3d0b: 5d pop %ebp 3d0c: c3 ret 00003d0d <strlen>: uint strlen(char *s) { 3d0d: 55 push %ebp 3d0e: 89 e5 mov %esp,%ebp 3d10: 83 ec 10 sub $0x10,%esp int n; for (n = 0; s[n]; n++) ; 3d13: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp) 3d1a: eb 04 jmp 3d20 <strlen+0x13> 3d1c: 83 45 fc 01 addl $0x1,-0x4(%ebp) 3d20: 8b 55 fc mov -0x4(%ebp),%edx 3d23: 8b 45 08 mov 0x8(%ebp),%eax 3d26: 01 d0 add %edx,%eax 3d28: 0f b6 00 movzbl (%eax),%eax 3d2b: 84 c0 test %al,%al 3d2d: 75 ed jne 3d1c <strlen+0xf> return n; 3d2f: 8b 45 fc mov -0x4(%ebp),%eax } 3d32: c9 leave 3d33: c3 ret 00003d34 <memset>: void *memset(void *dst, int c, uint n) { 3d34: 55 push %ebp 3d35: 89 e5 mov %esp,%ebp stosb(dst, c, n); 3d37: 8b 45 10 mov 0x10(%ebp),%eax 3d3a: 50 push %eax 3d3b: ff 75 0c pushl 0xc(%ebp) 3d3e: ff 75 08 pushl 0x8(%ebp) 3d41: e8 32 ff ff ff call 3c78 <stosb> 3d46: 83 c4 0c add $0xc,%esp return dst; 3d49: 8b 45 08 mov 0x8(%ebp),%eax } 3d4c: c9 leave 3d4d: c3 ret 00003d4e <strchr>: char *strchr(const char *s, char c) { 3d4e: 55 push %ebp 3d4f: 89 e5 mov %esp,%ebp 3d51: 83 ec 04 sub $0x4,%esp 3d54: 8b 45 0c mov 0xc(%ebp),%eax 3d57: 88 45 fc mov %al,-0x4(%ebp) for (; *s; s++) 3d5a: eb 14 jmp 3d70 <strchr+0x22> if (*s == c) 3d5c: 8b 45 08 mov 0x8(%ebp),%eax 3d5f: 0f b6 00 movzbl (%eax),%eax 3d62: 3a 45 fc cmp -0x4(%ebp),%al 3d65: 75 05 jne 3d6c <strchr+0x1e> return (char *)s; 3d67: 8b 45 08 mov 0x8(%ebp),%eax 3d6a: eb 13 jmp 3d7f <strchr+0x31> return dst; } char *strchr(const char *s, char c) { for (; *s; s++) 3d6c: 83 45 08 01 addl $0x1,0x8(%ebp) 3d70: 8b 45 08 mov 0x8(%ebp),%eax 3d73: 0f b6 00 movzbl (%eax),%eax 3d76: 84 c0 test %al,%al 3d78: 75 e2 jne 3d5c <strchr+0xe> if (*s == c) return (char *)s; return 0; 3d7a: b8 00 00 00 00 mov $0x0,%eax } 3d7f: c9 leave 3d80: c3 ret 00003d81 <gets>: char *gets(char *buf, int max) { 3d81: 55 push %ebp 3d82: 89 e5 mov %esp,%ebp 3d84: 83 ec 18 sub $0x18,%esp int i, cc; char c; for (i = 0; i + 1 < max;) { 3d87: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 3d8e: eb 42 jmp 3dd2 <gets+0x51> cc = read(0, &c, 1); 3d90: 83 ec 04 sub $0x4,%esp 3d93: 6a 01 push $0x1 3d95: 8d 45 ef lea -0x11(%ebp),%eax 3d98: 50 push %eax 3d99: 6a 00 push $0x0 3d9b: e8 47 01 00 00 call 3ee7 <read> 3da0: 83 c4 10 add $0x10,%esp 3da3: 89 45 f0 mov %eax,-0x10(%ebp) if (cc < 1) 3da6: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 3daa: 7e 33 jle 3ddf <gets+0x5e> break; buf[i++] = c; 3dac: 8b 45 f4 mov -0xc(%ebp),%eax 3daf: 8d 50 01 lea 0x1(%eax),%edx 3db2: 89 55 f4 mov %edx,-0xc(%ebp) 3db5: 89 c2 mov %eax,%edx 3db7: 8b 45 08 mov 0x8(%ebp),%eax 3dba: 01 c2 add %eax,%edx 3dbc: 0f b6 45 ef movzbl -0x11(%ebp),%eax 3dc0: 88 02 mov %al,(%edx) if (c == '\n' || c == '\r') 3dc2: 0f b6 45 ef movzbl -0x11(%ebp),%eax 3dc6: 3c 0a cmp $0xa,%al 3dc8: 74 16 je 3de0 <gets+0x5f> 3dca: 0f b6 45 ef movzbl -0x11(%ebp),%eax 3dce: 3c 0d cmp $0xd,%al 3dd0: 74 0e je 3de0 <gets+0x5f> char *gets(char *buf, int max) { int i, cc; char c; for (i = 0; i + 1 < max;) { 3dd2: 8b 45 f4 mov -0xc(%ebp),%eax 3dd5: 83 c0 01 add $0x1,%eax 3dd8: 3b 45 0c cmp 0xc(%ebp),%eax 3ddb: 7c b3 jl 3d90 <gets+0xf> 3ddd: eb 01 jmp 3de0 <gets+0x5f> cc = read(0, &c, 1); if (cc < 1) break; 3ddf: 90 nop buf[i++] = c; if (c == '\n' || c == '\r') break; } buf[i] = '\0'; 3de0: 8b 55 f4 mov -0xc(%ebp),%edx 3de3: 8b 45 08 mov 0x8(%ebp),%eax 3de6: 01 d0 add %edx,%eax 3de8: c6 00 00 movb $0x0,(%eax) return buf; 3deb: 8b 45 08 mov 0x8(%ebp),%eax } 3dee: c9 leave 3def: c3 ret 00003df0 <stat>: int stat(char *n, struct stat *st) { 3df0: 55 push %ebp 3df1: 89 e5 mov %esp,%ebp 3df3: 83 ec 18 sub $0x18,%esp int fd; int r; fd = open(n, O_RDONLY); 3df6: 83 ec 08 sub $0x8,%esp 3df9: 6a 00 push $0x0 3dfb: ff 75 08 pushl 0x8(%ebp) 3dfe: e8 0c 01 00 00 call 3f0f <open> 3e03: 83 c4 10 add $0x10,%esp 3e06: 89 45 f4 mov %eax,-0xc(%ebp) if (fd < 0) 3e09: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 3e0d: 79 07 jns 3e16 <stat+0x26> return -1; 3e0f: b8 ff ff ff ff mov $0xffffffff,%eax 3e14: eb 25 jmp 3e3b <stat+0x4b> r = fstat(fd, st); 3e16: 83 ec 08 sub $0x8,%esp 3e19: ff 75 0c pushl 0xc(%ebp) 3e1c: ff 75 f4 pushl -0xc(%ebp) 3e1f: e8 03 01 00 00 call 3f27 <fstat> 3e24: 83 c4 10 add $0x10,%esp 3e27: 89 45 f0 mov %eax,-0x10(%ebp) close(fd); 3e2a: 83 ec 0c sub $0xc,%esp 3e2d: ff 75 f4 pushl -0xc(%ebp) 3e30: e8 c2 00 00 00 call 3ef7 <close> 3e35: 83 c4 10 add $0x10,%esp return r; 3e38: 8b 45 f0 mov -0x10(%ebp),%eax } 3e3b: c9 leave 3e3c: c3 ret 00003e3d <atoi>: int atoi(const char *s) { 3e3d: 55 push %ebp 3e3e: 89 e5 mov %esp,%ebp 3e40: 83 ec 10 sub $0x10,%esp int n; n = 0; 3e43: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp) while ('0' <= *s && *s <= '9') 3e4a: eb 25 jmp 3e71 <atoi+0x34> n = n * 10 + *s++ - '0'; 3e4c: 8b 55 fc mov -0x4(%ebp),%edx 3e4f: 89 d0 mov %edx,%eax 3e51: c1 e0 02 shl $0x2,%eax 3e54: 01 d0 add %edx,%eax 3e56: 01 c0 add %eax,%eax 3e58: 89 c1 mov %eax,%ecx 3e5a: 8b 45 08 mov 0x8(%ebp),%eax 3e5d: 8d 50 01 lea 0x1(%eax),%edx 3e60: 89 55 08 mov %edx,0x8(%ebp) 3e63: 0f b6 00 movzbl (%eax),%eax 3e66: 0f be c0 movsbl %al,%eax 3e69: 01 c8 add %ecx,%eax 3e6b: 83 e8 30 sub $0x30,%eax 3e6e: 89 45 fc mov %eax,-0x4(%ebp) int atoi(const char *s) { int n; n = 0; while ('0' <= *s && *s <= '9') 3e71: 8b 45 08 mov 0x8(%ebp),%eax 3e74: 0f b6 00 movzbl (%eax),%eax 3e77: 3c 2f cmp $0x2f,%al 3e79: 7e 0a jle 3e85 <atoi+0x48> 3e7b: 8b 45 08 mov 0x8(%ebp),%eax 3e7e: 0f b6 00 movzbl (%eax),%eax 3e81: 3c 39 cmp $0x39,%al 3e83: 7e c7 jle 3e4c <atoi+0xf> n = n * 10 + *s++ - '0'; return n; 3e85: 8b 45 fc mov -0x4(%ebp),%eax } 3e88: c9 leave 3e89: c3 ret 00003e8a <memmove>: void *memmove(void *vdst, void *vsrc, int n) { 3e8a: 55 push %ebp 3e8b: 89 e5 mov %esp,%ebp 3e8d: 83 ec 10 sub $0x10,%esp char *dst, *src; dst = vdst; 3e90: 8b 45 08 mov 0x8(%ebp),%eax 3e93: 89 45 fc mov %eax,-0x4(%ebp) src = vsrc; 3e96: 8b 45 0c mov 0xc(%ebp),%eax 3e99: 89 45 f8 mov %eax,-0x8(%ebp) while (n-- > 0) 3e9c: eb 17 jmp 3eb5 <memmove+0x2b> *dst++ = *src++; 3e9e: 8b 45 fc mov -0x4(%ebp),%eax 3ea1: 8d 50 01 lea 0x1(%eax),%edx 3ea4: 89 55 fc mov %edx,-0x4(%ebp) 3ea7: 8b 55 f8 mov -0x8(%ebp),%edx 3eaa: 8d 4a 01 lea 0x1(%edx),%ecx 3ead: 89 4d f8 mov %ecx,-0x8(%ebp) 3eb0: 0f b6 12 movzbl (%edx),%edx 3eb3: 88 10 mov %dl,(%eax) { char *dst, *src; dst = vdst; src = vsrc; while (n-- > 0) 3eb5: 8b 45 10 mov 0x10(%ebp),%eax 3eb8: 8d 50 ff lea -0x1(%eax),%edx 3ebb: 89 55 10 mov %edx,0x10(%ebp) 3ebe: 85 c0 test %eax,%eax 3ec0: 7f dc jg 3e9e <memmove+0x14> *dst++ = *src++; return vdst; 3ec2: 8b 45 08 mov 0x8(%ebp),%eax } 3ec5: c9 leave 3ec6: c3 ret 00003ec7 <fork>: name: \ movl $SYS_ ## name, %eax; \ int $T_SYSCALL; \ ret SYSCALL(fork) 3ec7: b8 01 00 00 00 mov $0x1,%eax 3ecc: cd 40 int $0x40 3ece: c3 ret 00003ecf <exit>: SYSCALL(exit) 3ecf: b8 02 00 00 00 mov $0x2,%eax 3ed4: cd 40 int $0x40 3ed6: c3 ret 00003ed7 <wait>: SYSCALL(wait) 3ed7: b8 03 00 00 00 mov $0x3,%eax 3edc: cd 40 int $0x40 3ede: c3 ret 00003edf <pipe>: SYSCALL(pipe) 3edf: b8 04 00 00 00 mov $0x4,%eax 3ee4: cd 40 int $0x40 3ee6: c3 ret 00003ee7 <read>: SYSCALL(read) 3ee7: b8 05 00 00 00 mov $0x5,%eax 3eec: cd 40 int $0x40 3eee: c3 ret 00003eef <write>: SYSCALL(write) 3eef: b8 10 00 00 00 mov $0x10,%eax 3ef4: cd 40 int $0x40 3ef6: c3 ret 00003ef7 <close>: SYSCALL(close) 3ef7: b8 15 00 00 00 mov $0x15,%eax 3efc: cd 40 int $0x40 3efe: c3 ret 00003eff <kill>: SYSCALL(kill) 3eff: b8 06 00 00 00 mov $0x6,%eax 3f04: cd 40 int $0x40 3f06: c3 ret 00003f07 <exec>: SYSCALL(exec) 3f07: b8 07 00 00 00 mov $0x7,%eax 3f0c: cd 40 int $0x40 3f0e: c3 ret 00003f0f <open>: SYSCALL(open) 3f0f: b8 0f 00 00 00 mov $0xf,%eax 3f14: cd 40 int $0x40 3f16: c3 ret 00003f17 <mknod>: SYSCALL(mknod) 3f17: b8 11 00 00 00 mov $0x11,%eax 3f1c: cd 40 int $0x40 3f1e: c3 ret 00003f1f <unlink>: SYSCALL(unlink) 3f1f: b8 12 00 00 00 mov $0x12,%eax 3f24: cd 40 int $0x40 3f26: c3 ret 00003f27 <fstat>: SYSCALL(fstat) 3f27: b8 08 00 00 00 mov $0x8,%eax 3f2c: cd 40 int $0x40 3f2e: c3 ret 00003f2f <link>: SYSCALL(link) 3f2f: b8 13 00 00 00 mov $0x13,%eax 3f34: cd 40 int $0x40 3f36: c3 ret 00003f37 <mkdir>: SYSCALL(mkdir) 3f37: b8 14 00 00 00 mov $0x14,%eax 3f3c: cd 40 int $0x40 3f3e: c3 ret 00003f3f <chdir>: SYSCALL(chdir) 3f3f: b8 09 00 00 00 mov $0x9,%eax 3f44: cd 40 int $0x40 3f46: c3 ret 00003f47 <dup>: SYSCALL(dup) 3f47: b8 0a 00 00 00 mov $0xa,%eax 3f4c: cd 40 int $0x40 3f4e: c3 ret 00003f4f <getpid>: SYSCALL(getpid) 3f4f: b8 0b 00 00 00 mov $0xb,%eax 3f54: cd 40 int $0x40 3f56: c3 ret 00003f57 <sbrk>: SYSCALL(sbrk) 3f57: b8 0c 00 00 00 mov $0xc,%eax 3f5c: cd 40 int $0x40 3f5e: c3 ret 00003f5f <sleep>: SYSCALL(sleep) 3f5f: b8 0d 00 00 00 mov $0xd,%eax 3f64: cd 40 int $0x40 3f66: c3 ret 00003f67 <uptime>: SYSCALL(uptime) 3f67: b8 0e 00 00 00 mov $0xe,%eax 3f6c: cd 40 int $0x40 3f6e: c3 ret 00003f6f <shm_get>: SYSCALL(shm_get) //mod2 3f6f: b8 1c 00 00 00 mov $0x1c,%eax 3f74: cd 40 int $0x40 3f76: c3 ret 00003f77 <shm_rem>: SYSCALL(shm_rem) //mod2 3f77: b8 1d 00 00 00 mov $0x1d,%eax 3f7c: cd 40 int $0x40 3f7e: c3 ret 00003f7f <setHighPrio>: SYSCALL(setHighPrio) //scheduler 3f7f: b8 1e 00 00 00 mov $0x1e,%eax 3f84: cd 40 int $0x40 3f86: c3 ret 00003f87 <mutex_create>: SYSCALL(mutex_create)//mod3 3f87: b8 16 00 00 00 mov $0x16,%eax 3f8c: cd 40 int $0x40 3f8e: c3 ret 00003f8f <mutex_delete>: SYSCALL(mutex_delete) 3f8f: b8 17 00 00 00 mov $0x17,%eax 3f94: cd 40 int $0x40 3f96: c3 ret 00003f97 <mutex_lock>: SYSCALL(mutex_lock) 3f97: b8 18 00 00 00 mov $0x18,%eax 3f9c: cd 40 int $0x40 3f9e: c3 ret 00003f9f <mutex_unlock>: SYSCALL(mutex_unlock) 3f9f: b8 19 00 00 00 mov $0x19,%eax 3fa4: cd 40 int $0x40 3fa6: c3 ret 00003fa7 <cv_wait>: SYSCALL(cv_wait) 3fa7: b8 1a 00 00 00 mov $0x1a,%eax 3fac: cd 40 int $0x40 3fae: c3 ret 00003faf <cv_signal>: SYSCALL(cv_signal) 3faf: b8 1b 00 00 00 mov $0x1b,%eax 3fb4: cd 40 int $0x40 3fb6: c3 ret 00003fb7 <putc>: #include "types.h" #include "stat.h" #include "user.h" static void putc(int fd, char c) { 3fb7: 55 push %ebp 3fb8: 89 e5 mov %esp,%ebp 3fba: 83 ec 18 sub $0x18,%esp 3fbd: 8b 45 0c mov 0xc(%ebp),%eax 3fc0: 88 45 f4 mov %al,-0xc(%ebp) write(fd, &c, 1); 3fc3: 83 ec 04 sub $0x4,%esp 3fc6: 6a 01 push $0x1 3fc8: 8d 45 f4 lea -0xc(%ebp),%eax 3fcb: 50 push %eax 3fcc: ff 75 08 pushl 0x8(%ebp) 3fcf: e8 1b ff ff ff call 3eef <write> 3fd4: 83 c4 10 add $0x10,%esp } 3fd7: 90 nop 3fd8: c9 leave 3fd9: c3 ret 00003fda <printint>: static void printint(int fd, int xx, int base, int sgn) { 3fda: 55 push %ebp 3fdb: 89 e5 mov %esp,%ebp 3fdd: 53 push %ebx 3fde: 83 ec 24 sub $0x24,%esp static char digits[] = "0123456789ABCDEF"; char buf[16]; int i, neg; uint x; neg = 0; 3fe1: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp) if (sgn && xx < 0) { 3fe8: 83 7d 14 00 cmpl $0x0,0x14(%ebp) 3fec: 74 17 je 4005 <printint+0x2b> 3fee: 83 7d 0c 00 cmpl $0x0,0xc(%ebp) 3ff2: 79 11 jns 4005 <printint+0x2b> neg = 1; 3ff4: c7 45 f0 01 00 00 00 movl $0x1,-0x10(%ebp) x = -xx; 3ffb: 8b 45 0c mov 0xc(%ebp),%eax 3ffe: f7 d8 neg %eax 4000: 89 45 ec mov %eax,-0x14(%ebp) 4003: eb 06 jmp 400b <printint+0x31> } else { x = xx; 4005: 8b 45 0c mov 0xc(%ebp),%eax 4008: 89 45 ec mov %eax,-0x14(%ebp) } i = 0; 400b: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) do { buf[i++] = digits[x % base]; 4012: 8b 4d f4 mov -0xc(%ebp),%ecx 4015: 8d 41 01 lea 0x1(%ecx),%eax 4018: 89 45 f4 mov %eax,-0xc(%ebp) 401b: 8b 5d 10 mov 0x10(%ebp),%ebx 401e: 8b 45 ec mov -0x14(%ebp),%eax 4021: ba 00 00 00 00 mov $0x0,%edx 4026: f7 f3 div %ebx 4028: 89 d0 mov %edx,%eax 402a: 0f b6 80 08 63 00 00 movzbl 0x6308(%eax),%eax 4031: 88 44 0d dc mov %al,-0x24(%ebp,%ecx,1) } while ((x /= base) != 0); 4035: 8b 5d 10 mov 0x10(%ebp),%ebx 4038: 8b 45 ec mov -0x14(%ebp),%eax 403b: ba 00 00 00 00 mov $0x0,%edx 4040: f7 f3 div %ebx 4042: 89 45 ec mov %eax,-0x14(%ebp) 4045: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 4049: 75 c7 jne 4012 <printint+0x38> if (neg) 404b: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 404f: 74 2d je 407e <printint+0xa4> buf[i++] = '-'; 4051: 8b 45 f4 mov -0xc(%ebp),%eax 4054: 8d 50 01 lea 0x1(%eax),%edx 4057: 89 55 f4 mov %edx,-0xc(%ebp) 405a: c6 44 05 dc 2d movb $0x2d,-0x24(%ebp,%eax,1) while (--i >= 0) 405f: eb 1d jmp 407e <printint+0xa4> putc(fd, buf[i]); 4061: 8d 55 dc lea -0x24(%ebp),%edx 4064: 8b 45 f4 mov -0xc(%ebp),%eax 4067: 01 d0 add %edx,%eax 4069: 0f b6 00 movzbl (%eax),%eax 406c: 0f be c0 movsbl %al,%eax 406f: 83 ec 08 sub $0x8,%esp 4072: 50 push %eax 4073: ff 75 08 pushl 0x8(%ebp) 4076: e8 3c ff ff ff call 3fb7 <putc> 407b: 83 c4 10 add $0x10,%esp buf[i++] = digits[x % base]; } while ((x /= base) != 0); if (neg) buf[i++] = '-'; while (--i >= 0) 407e: 83 6d f4 01 subl $0x1,-0xc(%ebp) 4082: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 4086: 79 d9 jns 4061 <printint+0x87> putc(fd, buf[i]); } 4088: 90 nop 4089: 8b 5d fc mov -0x4(%ebp),%ebx 408c: c9 leave 408d: c3 ret 0000408e <printf>: // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, char *fmt, ...) { 408e: 55 push %ebp 408f: 89 e5 mov %esp,%ebp 4091: 83 ec 28 sub $0x28,%esp char *s; int c, i, state; uint *ap; state = 0; 4094: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp) ap = (uint *) (void *)&fmt + 1; 409b: 8d 45 0c lea 0xc(%ebp),%eax 409e: 83 c0 04 add $0x4,%eax 40a1: 89 45 e8 mov %eax,-0x18(%ebp) for (i = 0; fmt[i]; i++) { 40a4: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp) 40ab: e9 59 01 00 00 jmp 4209 <printf+0x17b> c = fmt[i] & 0xff; 40b0: 8b 55 0c mov 0xc(%ebp),%edx 40b3: 8b 45 f0 mov -0x10(%ebp),%eax 40b6: 01 d0 add %edx,%eax 40b8: 0f b6 00 movzbl (%eax),%eax 40bb: 0f be c0 movsbl %al,%eax 40be: 25 ff 00 00 00 and $0xff,%eax 40c3: 89 45 e4 mov %eax,-0x1c(%ebp) if (state == 0) { 40c6: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 40ca: 75 2c jne 40f8 <printf+0x6a> if (c == '%') { 40cc: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp) 40d0: 75 0c jne 40de <printf+0x50> state = '%'; 40d2: c7 45 ec 25 00 00 00 movl $0x25,-0x14(%ebp) 40d9: e9 27 01 00 00 jmp 4205 <printf+0x177> } else { putc(fd, c); 40de: 8b 45 e4 mov -0x1c(%ebp),%eax 40e1: 0f be c0 movsbl %al,%eax 40e4: 83 ec 08 sub $0x8,%esp 40e7: 50 push %eax 40e8: ff 75 08 pushl 0x8(%ebp) 40eb: e8 c7 fe ff ff call 3fb7 <putc> 40f0: 83 c4 10 add $0x10,%esp 40f3: e9 0d 01 00 00 jmp 4205 <printf+0x177> } } else if (state == '%') { 40f8: 83 7d ec 25 cmpl $0x25,-0x14(%ebp) 40fc: 0f 85 03 01 00 00 jne 4205 <printf+0x177> if (c == 'd') { 4102: 83 7d e4 64 cmpl $0x64,-0x1c(%ebp) 4106: 75 1e jne 4126 <printf+0x98> printint(fd, *ap, 10, 1); 4108: 8b 45 e8 mov -0x18(%ebp),%eax 410b: 8b 00 mov (%eax),%eax 410d: 6a 01 push $0x1 410f: 6a 0a push $0xa 4111: 50 push %eax 4112: ff 75 08 pushl 0x8(%ebp) 4115: e8 c0 fe ff ff call 3fda <printint> 411a: 83 c4 10 add $0x10,%esp ap++; 411d: 83 45 e8 04 addl $0x4,-0x18(%ebp) 4121: e9 d8 00 00 00 jmp 41fe <printf+0x170> } else if (c == 'x' || c == 'p') { 4126: 83 7d e4 78 cmpl $0x78,-0x1c(%ebp) 412a: 74 06 je 4132 <printf+0xa4> 412c: 83 7d e4 70 cmpl $0x70,-0x1c(%ebp) 4130: 75 1e jne 4150 <printf+0xc2> printint(fd, *ap, 16, 0); 4132: 8b 45 e8 mov -0x18(%ebp),%eax 4135: 8b 00 mov (%eax),%eax 4137: 6a 00 push $0x0 4139: 6a 10 push $0x10 413b: 50 push %eax 413c: ff 75 08 pushl 0x8(%ebp) 413f: e8 96 fe ff ff call 3fda <printint> 4144: 83 c4 10 add $0x10,%esp ap++; 4147: 83 45 e8 04 addl $0x4,-0x18(%ebp) 414b: e9 ae 00 00 00 jmp 41fe <printf+0x170> } else if (c == 's') { 4150: 83 7d e4 73 cmpl $0x73,-0x1c(%ebp) 4154: 75 43 jne 4199 <printf+0x10b> s = (char *)*ap; 4156: 8b 45 e8 mov -0x18(%ebp),%eax 4159: 8b 00 mov (%eax),%eax 415b: 89 45 f4 mov %eax,-0xc(%ebp) ap++; 415e: 83 45 e8 04 addl $0x4,-0x18(%ebp) if (s == 0) 4162: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 4166: 75 25 jne 418d <printf+0xff> s = "(null)"; 4168: c7 45 f4 0e 5c 00 00 movl $0x5c0e,-0xc(%ebp) while (*s != 0) { 416f: eb 1c jmp 418d <printf+0xff> putc(fd, *s); 4171: 8b 45 f4 mov -0xc(%ebp),%eax 4174: 0f b6 00 movzbl (%eax),%eax 4177: 0f be c0 movsbl %al,%eax 417a: 83 ec 08 sub $0x8,%esp 417d: 50 push %eax 417e: ff 75 08 pushl 0x8(%ebp) 4181: e8 31 fe ff ff call 3fb7 <putc> 4186: 83 c4 10 add $0x10,%esp s++; 4189: 83 45 f4 01 addl $0x1,-0xc(%ebp) } else if (c == 's') { s = (char *)*ap; ap++; if (s == 0) s = "(null)"; while (*s != 0) { 418d: 8b 45 f4 mov -0xc(%ebp),%eax 4190: 0f b6 00 movzbl (%eax),%eax 4193: 84 c0 test %al,%al 4195: 75 da jne 4171 <printf+0xe3> 4197: eb 65 jmp 41fe <printf+0x170> putc(fd, *s); s++; } } else if (c == 'c') { 4199: 83 7d e4 63 cmpl $0x63,-0x1c(%ebp) 419d: 75 1d jne 41bc <printf+0x12e> putc(fd, *ap); 419f: 8b 45 e8 mov -0x18(%ebp),%eax 41a2: 8b 00 mov (%eax),%eax 41a4: 0f be c0 movsbl %al,%eax 41a7: 83 ec 08 sub $0x8,%esp 41aa: 50 push %eax 41ab: ff 75 08 pushl 0x8(%ebp) 41ae: e8 04 fe ff ff call 3fb7 <putc> 41b3: 83 c4 10 add $0x10,%esp ap++; 41b6: 83 45 e8 04 addl $0x4,-0x18(%ebp) 41ba: eb 42 jmp 41fe <printf+0x170> } else if (c == '%') { 41bc: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp) 41c0: 75 17 jne 41d9 <printf+0x14b> putc(fd, c); 41c2: 8b 45 e4 mov -0x1c(%ebp),%eax 41c5: 0f be c0 movsbl %al,%eax 41c8: 83 ec 08 sub $0x8,%esp 41cb: 50 push %eax 41cc: ff 75 08 pushl 0x8(%ebp) 41cf: e8 e3 fd ff ff call 3fb7 <putc> 41d4: 83 c4 10 add $0x10,%esp 41d7: eb 25 jmp 41fe <printf+0x170> } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); 41d9: 83 ec 08 sub $0x8,%esp 41dc: 6a 25 push $0x25 41de: ff 75 08 pushl 0x8(%ebp) 41e1: e8 d1 fd ff ff call 3fb7 <putc> 41e6: 83 c4 10 add $0x10,%esp putc(fd, c); 41e9: 8b 45 e4 mov -0x1c(%ebp),%eax 41ec: 0f be c0 movsbl %al,%eax 41ef: 83 ec 08 sub $0x8,%esp 41f2: 50 push %eax 41f3: ff 75 08 pushl 0x8(%ebp) 41f6: e8 bc fd ff ff call 3fb7 <putc> 41fb: 83 c4 10 add $0x10,%esp } state = 0; 41fe: 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++) { 4205: 83 45 f0 01 addl $0x1,-0x10(%ebp) 4209: 8b 55 0c mov 0xc(%ebp),%edx 420c: 8b 45 f0 mov -0x10(%ebp),%eax 420f: 01 d0 add %edx,%eax 4211: 0f b6 00 movzbl (%eax),%eax 4214: 84 c0 test %al,%al 4216: 0f 85 94 fe ff ff jne 40b0 <printf+0x22> putc(fd, c); } state = 0; } } } 421c: 90 nop 421d: c9 leave 421e: c3 ret 0000421f <free>: static Header base; static Header *freep; void free(void *ap) { 421f: 55 push %ebp 4220: 89 e5 mov %esp,%ebp 4222: 83 ec 10 sub $0x10,%esp Header *bp, *p; bp = (Header *) ap - 1; //take address of memory -> subtract one size of p to get to header to memeory 4225: 8b 45 08 mov 0x8(%ebp),%eax 4228: 83 e8 08 sub $0x8,%eax 422b: 89 45 f8 mov %eax,-0x8(%ebp) for (p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) //comparing pointers to headers...maybe ordering spatially... 422e: a1 a8 63 00 00 mov 0x63a8,%eax 4233: 89 45 fc mov %eax,-0x4(%ebp) 4236: eb 24 jmp 425c <free+0x3d> if (p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 4238: 8b 45 fc mov -0x4(%ebp),%eax 423b: 8b 00 mov (%eax),%eax 423d: 3b 45 fc cmp -0x4(%ebp),%eax 4240: 77 12 ja 4254 <free+0x35> 4242: 8b 45 f8 mov -0x8(%ebp),%eax 4245: 3b 45 fc cmp -0x4(%ebp),%eax 4248: 77 24 ja 426e <free+0x4f> 424a: 8b 45 fc mov -0x4(%ebp),%eax 424d: 8b 00 mov (%eax),%eax 424f: 3b 45 f8 cmp -0x8(%ebp),%eax 4252: 77 1a ja 426e <free+0x4f> void free(void *ap) { Header *bp, *p; bp = (Header *) ap - 1; //take address of memory -> subtract one size of p to get to header to memeory for (p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) //comparing pointers to headers...maybe ordering spatially... 4254: 8b 45 fc mov -0x4(%ebp),%eax 4257: 8b 00 mov (%eax),%eax 4259: 89 45 fc mov %eax,-0x4(%ebp) 425c: 8b 45 f8 mov -0x8(%ebp),%eax 425f: 3b 45 fc cmp -0x4(%ebp),%eax 4262: 76 d4 jbe 4238 <free+0x19> 4264: 8b 45 fc mov -0x4(%ebp),%eax 4267: 8b 00 mov (%eax),%eax 4269: 3b 45 f8 cmp -0x8(%ebp),%eax 426c: 76 ca jbe 4238 <free+0x19> if (p >= p->s.ptr && (bp > p || bp < p->s.ptr)) break; if (bp + bp->s.size == p->s.ptr) { //checks sizes to merge contiguous freed regions 426e: 8b 45 f8 mov -0x8(%ebp),%eax 4271: 8b 40 04 mov 0x4(%eax),%eax 4274: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx 427b: 8b 45 f8 mov -0x8(%ebp),%eax 427e: 01 c2 add %eax,%edx 4280: 8b 45 fc mov -0x4(%ebp),%eax 4283: 8b 00 mov (%eax),%eax 4285: 39 c2 cmp %eax,%edx 4287: 75 24 jne 42ad <free+0x8e> bp->s.size += p->s.ptr->s.size; 4289: 8b 45 f8 mov -0x8(%ebp),%eax 428c: 8b 50 04 mov 0x4(%eax),%edx 428f: 8b 45 fc mov -0x4(%ebp),%eax 4292: 8b 00 mov (%eax),%eax 4294: 8b 40 04 mov 0x4(%eax),%eax 4297: 01 c2 add %eax,%edx 4299: 8b 45 f8 mov -0x8(%ebp),%eax 429c: 89 50 04 mov %edx,0x4(%eax) bp->s.ptr = p->s.ptr->s.ptr; 429f: 8b 45 fc mov -0x4(%ebp),%eax 42a2: 8b 00 mov (%eax),%eax 42a4: 8b 10 mov (%eax),%edx 42a6: 8b 45 f8 mov -0x8(%ebp),%eax 42a9: 89 10 mov %edx,(%eax) 42ab: eb 0a jmp 42b7 <free+0x98> } else bp->s.ptr = p->s.ptr; 42ad: 8b 45 fc mov -0x4(%ebp),%eax 42b0: 8b 10 mov (%eax),%edx 42b2: 8b 45 f8 mov -0x8(%ebp),%eax 42b5: 89 10 mov %edx,(%eax) if (p + p->s.size == bp) { 42b7: 8b 45 fc mov -0x4(%ebp),%eax 42ba: 8b 40 04 mov 0x4(%eax),%eax 42bd: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx 42c4: 8b 45 fc mov -0x4(%ebp),%eax 42c7: 01 d0 add %edx,%eax 42c9: 3b 45 f8 cmp -0x8(%ebp),%eax 42cc: 75 20 jne 42ee <free+0xcf> p->s.size += bp->s.size; 42ce: 8b 45 fc mov -0x4(%ebp),%eax 42d1: 8b 50 04 mov 0x4(%eax),%edx 42d4: 8b 45 f8 mov -0x8(%ebp),%eax 42d7: 8b 40 04 mov 0x4(%eax),%eax 42da: 01 c2 add %eax,%edx 42dc: 8b 45 fc mov -0x4(%ebp),%eax 42df: 89 50 04 mov %edx,0x4(%eax) p->s.ptr = bp->s.ptr; 42e2: 8b 45 f8 mov -0x8(%ebp),%eax 42e5: 8b 10 mov (%eax),%edx 42e7: 8b 45 fc mov -0x4(%ebp),%eax 42ea: 89 10 mov %edx,(%eax) 42ec: eb 08 jmp 42f6 <free+0xd7> } else p->s.ptr = bp; 42ee: 8b 45 fc mov -0x4(%ebp),%eax 42f1: 8b 55 f8 mov -0x8(%ebp),%edx 42f4: 89 10 mov %edx,(%eax) freep = p; 42f6: 8b 45 fc mov -0x4(%ebp),%eax 42f9: a3 a8 63 00 00 mov %eax,0x63a8 } 42fe: 90 nop 42ff: c9 leave 4300: c3 ret 00004301 <morecore>: static Header *morecore(uint nu) { 4301: 55 push %ebp 4302: 89 e5 mov %esp,%ebp 4304: 83 ec 18 sub $0x18,%esp char *p; Header *hp; if (nu < 4096) 4307: 81 7d 08 ff 0f 00 00 cmpl $0xfff,0x8(%ebp) 430e: 77 07 ja 4317 <morecore+0x16> nu = 4096; 4310: c7 45 08 00 10 00 00 movl $0x1000,0x8(%ebp) p = sbrk(nu * sizeof(Header)); 4317: 8b 45 08 mov 0x8(%ebp),%eax 431a: c1 e0 03 shl $0x3,%eax 431d: 83 ec 0c sub $0xc,%esp 4320: 50 push %eax 4321: e8 31 fc ff ff call 3f57 <sbrk> 4326: 83 c4 10 add $0x10,%esp 4329: 89 45 f4 mov %eax,-0xc(%ebp) if (p == (char *)-1) 432c: 83 7d f4 ff cmpl $0xffffffff,-0xc(%ebp) 4330: 75 07 jne 4339 <morecore+0x38> return 0; 4332: b8 00 00 00 00 mov $0x0,%eax 4337: eb 26 jmp 435f <morecore+0x5e> hp = (Header *) p; 4339: 8b 45 f4 mov -0xc(%ebp),%eax 433c: 89 45 f0 mov %eax,-0x10(%ebp) hp->s.size = nu; 433f: 8b 45 f0 mov -0x10(%ebp),%eax 4342: 8b 55 08 mov 0x8(%ebp),%edx 4345: 89 50 04 mov %edx,0x4(%eax) free((void *)(hp + 1)); 4348: 8b 45 f0 mov -0x10(%ebp),%eax 434b: 83 c0 08 add $0x8,%eax 434e: 83 ec 0c sub $0xc,%esp 4351: 50 push %eax 4352: e8 c8 fe ff ff call 421f <free> 4357: 83 c4 10 add $0x10,%esp return freep; 435a: a1 a8 63 00 00 mov 0x63a8,%eax } 435f: c9 leave 4360: c3 ret 00004361 <malloc>: void *malloc(uint nbytes) { 4361: 55 push %ebp 4362: 89 e5 mov %esp,%ebp 4364: 83 ec 18 sub $0x18,%esp Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1) / sizeof(Header) + 1; 4367: 8b 45 08 mov 0x8(%ebp),%eax 436a: 83 c0 07 add $0x7,%eax 436d: c1 e8 03 shr $0x3,%eax 4370: 83 c0 01 add $0x1,%eax 4373: 89 45 ec mov %eax,-0x14(%ebp) if ((prevp = freep) == 0) { 4376: a1 a8 63 00 00 mov 0x63a8,%eax 437b: 89 45 f0 mov %eax,-0x10(%ebp) 437e: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 4382: 75 23 jne 43a7 <malloc+0x46> base.s.ptr = freep = prevp = &base; 4384: c7 45 f0 a0 63 00 00 movl $0x63a0,-0x10(%ebp) 438b: 8b 45 f0 mov -0x10(%ebp),%eax 438e: a3 a8 63 00 00 mov %eax,0x63a8 4393: a1 a8 63 00 00 mov 0x63a8,%eax 4398: a3 a0 63 00 00 mov %eax,0x63a0 base.s.size = 0; 439d: c7 05 a4 63 00 00 00 movl $0x0,0x63a4 43a4: 00 00 00 } for (p = prevp->s.ptr;; prevp = p, p = p->s.ptr) { 43a7: 8b 45 f0 mov -0x10(%ebp),%eax 43aa: 8b 00 mov (%eax),%eax 43ac: 89 45 f4 mov %eax,-0xc(%ebp) if (p->s.size >= nunits) { 43af: 8b 45 f4 mov -0xc(%ebp),%eax 43b2: 8b 40 04 mov 0x4(%eax),%eax 43b5: 3b 45 ec cmp -0x14(%ebp),%eax 43b8: 72 4d jb 4407 <malloc+0xa6> if (p->s.size == nunits) 43ba: 8b 45 f4 mov -0xc(%ebp),%eax 43bd: 8b 40 04 mov 0x4(%eax),%eax 43c0: 3b 45 ec cmp -0x14(%ebp),%eax 43c3: 75 0c jne 43d1 <malloc+0x70> prevp->s.ptr = p->s.ptr; 43c5: 8b 45 f4 mov -0xc(%ebp),%eax 43c8: 8b 10 mov (%eax),%edx 43ca: 8b 45 f0 mov -0x10(%ebp),%eax 43cd: 89 10 mov %edx,(%eax) 43cf: eb 26 jmp 43f7 <malloc+0x96> else { p->s.size -= nunits; 43d1: 8b 45 f4 mov -0xc(%ebp),%eax 43d4: 8b 40 04 mov 0x4(%eax),%eax 43d7: 2b 45 ec sub -0x14(%ebp),%eax 43da: 89 c2 mov %eax,%edx 43dc: 8b 45 f4 mov -0xc(%ebp),%eax 43df: 89 50 04 mov %edx,0x4(%eax) p += p->s.size; 43e2: 8b 45 f4 mov -0xc(%ebp),%eax 43e5: 8b 40 04 mov 0x4(%eax),%eax 43e8: c1 e0 03 shl $0x3,%eax 43eb: 01 45 f4 add %eax,-0xc(%ebp) p->s.size = nunits; 43ee: 8b 45 f4 mov -0xc(%ebp),%eax 43f1: 8b 55 ec mov -0x14(%ebp),%edx 43f4: 89 50 04 mov %edx,0x4(%eax) } freep = prevp; 43f7: 8b 45 f0 mov -0x10(%ebp),%eax 43fa: a3 a8 63 00 00 mov %eax,0x63a8 //printf(0, "\nMalloc Pointer Value = %p\n", p+1); return (void *)(p + 1); 43ff: 8b 45 f4 mov -0xc(%ebp),%eax 4402: 83 c0 08 add $0x8,%eax 4405: eb 3b jmp 4442 <malloc+0xe1> } if (p == freep) 4407: a1 a8 63 00 00 mov 0x63a8,%eax 440c: 39 45 f4 cmp %eax,-0xc(%ebp) 440f: 75 1e jne 442f <malloc+0xce> if ((p = morecore(nunits)) == 0) 4411: 83 ec 0c sub $0xc,%esp 4414: ff 75 ec pushl -0x14(%ebp) 4417: e8 e5 fe ff ff call 4301 <morecore> 441c: 83 c4 10 add $0x10,%esp 441f: 89 45 f4 mov %eax,-0xc(%ebp) 4422: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 4426: 75 07 jne 442f <malloc+0xce> return 0; 4428: b8 00 00 00 00 mov $0x0,%eax 442d: eb 13 jmp 4442 <malloc+0xe1> 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) { 442f: 8b 45 f4 mov -0xc(%ebp),%eax 4432: 89 45 f0 mov %eax,-0x10(%ebp) 4435: 8b 45 f4 mov -0xc(%ebp),%eax 4438: 8b 00 mov (%eax),%eax 443a: 89 45 f4 mov %eax,-0xc(%ebp) return (void *)(p + 1); } if (p == freep) if ((p = morecore(nunits)) == 0) return 0; } 443d: e9 6d ff ff ff jmp 43af <malloc+0x4e> } 4442: c9 leave 4443: c3 ret
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r12 push %r13 push %r14 push %r15 push %rbx push %rcx push %rdi push %rsi lea addresses_UC_ht+0x93ac, %r12 nop nop cmp $35515, %rbx mov (%r12), %r13 nop sub $59120, %r10 lea addresses_WT_ht+0x919c, %r14 nop nop add $12159, %r13 mov (%r14), %r15w nop xor %r15, %r15 lea addresses_WT_ht+0xe27c, %r14 clflush (%r14) nop nop nop nop sub %r10, %r10 mov $0x6162636465666768, %r13 movq %r13, %xmm0 and $0xffffffffffffffc0, %r14 vmovntdq %ymm0, (%r14) and $1478, %r12 lea addresses_A_ht+0x1c7bc, %rsi lea addresses_D_ht+0xb02c, %rdi nop add %rbx, %rbx mov $39, %rcx rep movsl nop nop nop nop nop add $31769, %r12 lea addresses_D_ht+0x15a7a, %rsi lea addresses_WT_ht+0x14e54, %rdi cmp %r12, %r12 mov $55, %rcx rep movsb nop nop cmp %r10, %r10 lea addresses_WT_ht+0x1383c, %rbx sub $45703, %r14 mov (%rbx), %esi nop nop nop nop nop and $28615, %rbx lea addresses_A_ht+0xabbc, %rsi lea addresses_normal_ht+0x1483c, %rdi sub %r14, %r14 mov $19, %rcx rep movsw nop nop nop nop nop cmp $10499, %rcx lea addresses_D_ht+0x803c, %rsi lea addresses_D_ht+0x1e03c, %rdi nop nop inc %r15 mov $39, %rcx rep movsq cmp %rsi, %rsi lea addresses_D_ht+0xc0bc, %r15 nop nop nop nop nop add $39126, %rbx and $0xffffffffffffffc0, %r15 vmovaps (%r15), %ymm0 vextracti128 $0, %ymm0, %xmm0 vpextrq $1, %xmm0, %rcx nop nop nop nop and $25729, %rdi lea addresses_normal_ht+0x1197c, %rsi lea addresses_UC_ht+0x743c, %rdi add %r15, %r15 mov $82, %rcx rep movsl nop nop nop add $29886, %rcx lea addresses_UC_ht+0x65c, %r12 sub %rsi, %rsi movl $0x61626364, (%r12) nop nop xor $45366, %rdi lea addresses_UC_ht+0xb53c, %r13 nop xor $48515, %rdi mov $0x6162636465666768, %rcx movq %rcx, %xmm7 movups %xmm7, (%r13) dec %rdi pop %rsi pop %rdi pop %rcx pop %rbx pop %r15 pop %r14 pop %r13 pop %r12 pop %r10 ret .global s_faulty_load s_faulty_load: push %r10 push %r11 push %r15 push %r9 push %rbp push %rdi push %rdx // Store lea addresses_normal+0x1571c, %rdx nop nop nop nop xor $23358, %rbp movw $0x5152, (%rdx) nop nop nop nop nop and %r15, %r15 // Store lea addresses_RW+0x1883c, %r11 xor %r10, %r10 mov $0x5152535455565758, %r9 movq %r9, (%r11) nop nop nop nop sub %r10, %r10 // Faulty Load lea addresses_RW+0x1883c, %rbp add $26432, %rdx movb (%rbp), %r11b lea oracles, %rbp and $0xff, %r11 shlq $12, %r11 mov (%rbp,%r11,1), %r11 pop %rdx pop %rdi pop %rbp pop %r9 pop %r15 pop %r11 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_RW', 'NT': False, 'AVXalign': True, 'size': 2, 'congruent': 0}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_normal', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 3}} {'OP': 'STOR', 'dst': {'same': True, 'type': 'addresses_RW', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 0}} [Faulty Load] {'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_RW', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 0}} <gen_prepare_buffer> {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_UC_ht', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 3}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WT_ht', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 5}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WT_ht', 'NT': True, 'AVXalign': False, 'size': 32, 'congruent': 5}} {'OP': 'REPM', 'src': {'same': False, 'congruent': 7, 'type': 'addresses_A_ht'}, 'dst': {'same': False, 'congruent': 4, 'type': 'addresses_D_ht'}} {'OP': 'REPM', 'src': {'same': False, 'congruent': 1, 'type': 'addresses_D_ht'}, 'dst': {'same': False, 'congruent': 3, 'type': 'addresses_WT_ht'}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WT_ht', 'NT': True, 'AVXalign': False, 'size': 4, 'congruent': 11}} {'OP': 'REPM', 'src': {'same': False, 'congruent': 7, 'type': 'addresses_A_ht'}, 'dst': {'same': False, 'congruent': 10, 'type': 'addresses_normal_ht'}} {'OP': 'REPM', 'src': {'same': False, 'congruent': 11, 'type': 'addresses_D_ht'}, 'dst': {'same': False, 'congruent': 9, 'type': 'addresses_D_ht'}} {'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_D_ht', 'NT': False, 'AVXalign': True, 'size': 32, 'congruent': 6}} {'OP': 'REPM', 'src': {'same': False, 'congruent': 6, 'type': 'addresses_normal_ht'}, 'dst': {'same': False, 'congruent': 10, 'type': 'addresses_UC_ht'}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_UC_ht', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 4}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_UC_ht', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 5}} {'58': 7067} 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 */
!ifdef SYSTEM_VARS_ASM !eof SYSTEM_VARS_ASM=1 Sys_rand_mem: !byte $00, $00, $00 Sys_mem_end:
; A195048: Concentric 19-gonal numbers. ; 0,1,19,39,76,115,171,229,304,381,475,571,684,799,931,1065,1216,1369,1539,1711,1900,2091,2299,2509,2736,2965,3211,3459,3724,3991,4275,4561,4864,5169,5491,5815,6156,6499,6859,7221,7600,7981,8379,8779,9196,9615,10051,10489,10944,11401,11875,12351,12844,13339,13851,14365,14896,15429,15979,16531,17100,17671,18259,18849,19456,20065,20691,21319,21964,22611,23275,23941,24624,25309,26011,26715,27436,28159,28899,29641,30400,31161,31939,32719,33516,34315,35131,35949,36784,37621,38475,39331,40204,41079 pow $0,2 mov $1,$0 div $0,4 mul $0,15 add $0,$1
// Copyright 2019 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 "chromeos/services/device_sync/cryptauth_feature_type.h" #include "base/base64url.h" #include "base/containers/flat_map.h" #include "base/no_destructor.h" #include "base/stl_util.h" #include "chromeos/constants/chromeos_features.h" #include "crypto/sha2.h" namespace chromeos { namespace device_sync { namespace { const char kBetterTogetherHostSupportedString[] = "BETTER_TOGETHER_HOST_SUPPORTED"; const char kBetterTogetherClientSupportedString[] = "BETTER_TOGETHER_CLIENT_SUPPORTED"; const char kEasyUnlockHostSupportedString[] = "EASY_UNLOCK_HOST_SUPPORTED"; const char kEasyUnlockClientSupportedString[] = "EASY_UNLOCK_CLIENT_SUPPORTED"; const char kMagicTetherHostSupportedString[] = "MAGIC_TETHER_HOST_SUPPORTED"; const char kMagicTetherClientSupportedString[] = "MAGIC_TETHER_CLIENT_SUPPORTED"; const char kSmsConnectHostSupportedString[] = "SMS_CONNECT_HOST_SUPPORTED"; const char kSmsConnectClientSupportedString[] = "SMS_CONNECT_CLIENT_SUPPORTED"; const char kPhoneHubHostSupportedString[] = "PHONE_HUB_HOST_SUPPORTED"; const char kPhoneHubClientSupportedString[] = "PHONE_HUB_CLIENT_SUPPORTED"; const char kBetterTogetherHostEnabledString[] = "BETTER_TOGETHER_HOST"; const char kBetterTogetherClientEnabledString[] = "BETTER_TOGETHER_CLIENT"; const char kEasyUnlockHostEnabledString[] = "EASY_UNLOCK_HOST"; const char kEasyUnlockClientEnabledString[] = "EASY_UNLOCK_CLIENT"; const char kMagicTetherHostEnabledString[] = "MAGIC_TETHER_HOST"; const char kMagicTetherClientEnabledString[] = "MAGIC_TETHER_CLIENT"; const char kSmsConnectHostEnabledString[] = "SMS_CONNECT_HOST"; const char kSmsConnectClientEnabledString[] = "SMS_CONNECT_CLIENT"; const char kPhoneHubHostEnabledString[] = "PHONE_HUB_HOST"; const char kPhoneHubClientEnabledString[] = "PHONE_HUB_CLIENT"; } // namespace const base::flat_set<CryptAuthFeatureType>& GetAllCryptAuthFeatureTypes() { static const base::NoDestructor<base::flat_set<CryptAuthFeatureType>> feature_set([] { base::flat_set<CryptAuthFeatureType> feature_set{ CryptAuthFeatureType::kBetterTogetherHostSupported, CryptAuthFeatureType::kBetterTogetherClientSupported, CryptAuthFeatureType::kEasyUnlockHostSupported, CryptAuthFeatureType::kEasyUnlockClientSupported, CryptAuthFeatureType::kMagicTetherHostSupported, CryptAuthFeatureType::kMagicTetherClientSupported, CryptAuthFeatureType::kSmsConnectHostSupported, CryptAuthFeatureType::kSmsConnectClientSupported, CryptAuthFeatureType::kBetterTogetherHostEnabled, CryptAuthFeatureType::kBetterTogetherClientEnabled, CryptAuthFeatureType::kEasyUnlockHostEnabled, CryptAuthFeatureType::kEasyUnlockClientEnabled, CryptAuthFeatureType::kMagicTetherHostEnabled, CryptAuthFeatureType::kMagicTetherClientEnabled, CryptAuthFeatureType::kSmsConnectHostEnabled, CryptAuthFeatureType::kSmsConnectClientEnabled}; if (features::IsPhoneHubEnabled()) { feature_set.insert(CryptAuthFeatureType::kPhoneHubClientSupported); feature_set.insert(CryptAuthFeatureType::kPhoneHubClientEnabled); feature_set.insert(CryptAuthFeatureType::kPhoneHubHostEnabled); feature_set.insert(CryptAuthFeatureType::kPhoneHubClientEnabled); } return feature_set; }()); return *feature_set; } const base::flat_set<CryptAuthFeatureType>& GetSupportedCryptAuthFeatureTypes() { static const base::NoDestructor<base::flat_set<CryptAuthFeatureType>> supported_set([] { base::flat_set<CryptAuthFeatureType> supported_set{ CryptAuthFeatureType::kBetterTogetherHostSupported, CryptAuthFeatureType::kBetterTogetherClientSupported, CryptAuthFeatureType::kEasyUnlockHostSupported, CryptAuthFeatureType::kEasyUnlockClientSupported, CryptAuthFeatureType::kMagicTetherHostSupported, CryptAuthFeatureType::kMagicTetherClientSupported, CryptAuthFeatureType::kSmsConnectHostSupported, CryptAuthFeatureType::kSmsConnectClientSupported}; if (features::IsPhoneHubEnabled()) { supported_set.insert(CryptAuthFeatureType::kPhoneHubHostSupported); supported_set.insert(CryptAuthFeatureType::kPhoneHubClientSupported); } return supported_set; }()); return *supported_set; } const base::flat_set<CryptAuthFeatureType>& GetEnabledCryptAuthFeatureTypes() { static const base::NoDestructor<base::flat_set<CryptAuthFeatureType>> enabled_set([] { base::flat_set<CryptAuthFeatureType> enabled_set{ CryptAuthFeatureType::kBetterTogetherHostEnabled, CryptAuthFeatureType::kBetterTogetherClientEnabled, CryptAuthFeatureType::kEasyUnlockHostEnabled, CryptAuthFeatureType::kEasyUnlockClientEnabled, CryptAuthFeatureType::kMagicTetherHostEnabled, CryptAuthFeatureType::kMagicTetherClientEnabled, CryptAuthFeatureType::kSmsConnectHostEnabled, CryptAuthFeatureType::kSmsConnectClientEnabled}; if (features::IsPhoneHubEnabled()) { enabled_set.insert(CryptAuthFeatureType::kPhoneHubHostEnabled); enabled_set.insert(CryptAuthFeatureType::kPhoneHubClientEnabled); } return enabled_set; }()); return *enabled_set; } const base::flat_set<std::string>& GetAllCryptAuthFeatureTypeStrings() { static const base::NoDestructor<base::flat_set<std::string>> feature_string_set([] { base::flat_set<std::string> feature_string_set; for (CryptAuthFeatureType feature_type : GetAllCryptAuthFeatureTypes()) feature_string_set.insert(CryptAuthFeatureTypeToString(feature_type)); return feature_string_set; }()); return *feature_string_set; } const char* CryptAuthFeatureTypeToString(CryptAuthFeatureType feature_type) { switch (feature_type) { case CryptAuthFeatureType::kBetterTogetherHostSupported: return kBetterTogetherHostSupportedString; case CryptAuthFeatureType::kBetterTogetherHostEnabled: return kBetterTogetherHostEnabledString; case CryptAuthFeatureType::kBetterTogetherClientSupported: return kBetterTogetherClientSupportedString; case CryptAuthFeatureType::kBetterTogetherClientEnabled: return kBetterTogetherClientEnabledString; case CryptAuthFeatureType::kEasyUnlockHostSupported: return kEasyUnlockHostSupportedString; case CryptAuthFeatureType::kEasyUnlockHostEnabled: return kEasyUnlockHostEnabledString; case CryptAuthFeatureType::kEasyUnlockClientSupported: return kEasyUnlockClientSupportedString; case CryptAuthFeatureType::kEasyUnlockClientEnabled: return kEasyUnlockClientEnabledString; case CryptAuthFeatureType::kMagicTetherHostSupported: return kMagicTetherHostSupportedString; case CryptAuthFeatureType::kMagicTetherHostEnabled: return kMagicTetherHostEnabledString; case CryptAuthFeatureType::kMagicTetherClientSupported: return kMagicTetherClientSupportedString; case CryptAuthFeatureType::kMagicTetherClientEnabled: return kMagicTetherClientEnabledString; case CryptAuthFeatureType::kSmsConnectHostSupported: return kSmsConnectHostSupportedString; case CryptAuthFeatureType::kSmsConnectHostEnabled: return kSmsConnectHostEnabledString; case CryptAuthFeatureType::kSmsConnectClientSupported: return kSmsConnectClientSupportedString; case CryptAuthFeatureType::kSmsConnectClientEnabled: return kSmsConnectClientEnabledString; case CryptAuthFeatureType::kPhoneHubHostSupported: return kPhoneHubHostSupportedString; case CryptAuthFeatureType::kPhoneHubHostEnabled: return kPhoneHubHostEnabledString; case CryptAuthFeatureType::kPhoneHubClientSupported: return kPhoneHubClientSupportedString; case CryptAuthFeatureType::kPhoneHubClientEnabled: return kPhoneHubClientEnabledString; } } base::Optional<CryptAuthFeatureType> CryptAuthFeatureTypeFromString( const std::string& feature_type_string) { if (feature_type_string == kBetterTogetherHostSupportedString) return CryptAuthFeatureType::kBetterTogetherHostSupported; if (feature_type_string == kBetterTogetherHostEnabledString) return CryptAuthFeatureType::kBetterTogetherHostEnabled; if (feature_type_string == kBetterTogetherClientSupportedString) return CryptAuthFeatureType::kBetterTogetherClientSupported; if (feature_type_string == kBetterTogetherClientEnabledString) return CryptAuthFeatureType::kBetterTogetherClientEnabled; if (feature_type_string == kEasyUnlockHostSupportedString) return CryptAuthFeatureType::kEasyUnlockHostSupported; if (feature_type_string == kEasyUnlockHostEnabledString) return CryptAuthFeatureType::kEasyUnlockHostEnabled; if (feature_type_string == kEasyUnlockClientSupportedString) return CryptAuthFeatureType::kEasyUnlockClientSupported; if (feature_type_string == kEasyUnlockClientEnabledString) return CryptAuthFeatureType::kEasyUnlockClientEnabled; if (feature_type_string == kMagicTetherHostSupportedString) return CryptAuthFeatureType::kMagicTetherHostSupported; if (feature_type_string == kMagicTetherHostEnabledString) return CryptAuthFeatureType::kMagicTetherHostEnabled; if (feature_type_string == kMagicTetherClientSupportedString) return CryptAuthFeatureType::kMagicTetherClientSupported; if (feature_type_string == kMagicTetherClientEnabledString) return CryptAuthFeatureType::kMagicTetherClientEnabled; if (feature_type_string == kSmsConnectHostSupportedString) return CryptAuthFeatureType::kSmsConnectHostSupported; if (feature_type_string == kSmsConnectHostEnabledString) return CryptAuthFeatureType::kSmsConnectHostEnabled; if (feature_type_string == kSmsConnectClientSupportedString) return CryptAuthFeatureType::kSmsConnectClientSupported; if (feature_type_string == kSmsConnectClientEnabledString) return CryptAuthFeatureType::kSmsConnectClientEnabled; if (feature_type_string == kPhoneHubHostSupportedString) return CryptAuthFeatureType::kPhoneHubHostSupported; if (feature_type_string == kPhoneHubHostEnabledString) return CryptAuthFeatureType::kPhoneHubHostEnabled; if (feature_type_string == kPhoneHubClientSupportedString) return CryptAuthFeatureType::kPhoneHubClientSupported; if (feature_type_string == kPhoneHubClientEnabledString) return CryptAuthFeatureType::kPhoneHubClientEnabled; return base::nullopt; } // Computes the base64url-encoded, SHA-256 8-byte hash of the // CryptAuthFeatureType string. std::string CryptAuthFeatureTypeToGcmHash(CryptAuthFeatureType feature_type) { std::string hash_8_bytes(8, 0); crypto::SHA256HashString(CryptAuthFeatureTypeToString(feature_type), base::data(hash_8_bytes), 8u); std::string hash_base64url; base::Base64UrlEncode(hash_8_bytes, base::Base64UrlEncodePolicy::OMIT_PADDING, &hash_base64url); return hash_base64url; } base::Optional<CryptAuthFeatureType> CryptAuthFeatureTypeFromGcmHash( const std::string& feature_type_hash) { // The map from the feature type hash value that CryptAuth sends in GCM // messages to the CryptAuthFeatureType enum. static const base::NoDestructor< base::flat_map<std::string, CryptAuthFeatureType>> hash_to_feature_map([] { base::flat_map<std::string, CryptAuthFeatureType> hash_to_feature_map; for (const CryptAuthFeatureType& feature_type : GetAllCryptAuthFeatureTypes()) { hash_to_feature_map.insert_or_assign( CryptAuthFeatureTypeToGcmHash(feature_type), feature_type); } return hash_to_feature_map; }()); auto it = hash_to_feature_map->find(feature_type_hash); if (it == hash_to_feature_map->end()) return base::nullopt; return it->second; } multidevice::SoftwareFeature CryptAuthFeatureTypeToSoftwareFeature( CryptAuthFeatureType feature_type) { switch (feature_type) { case CryptAuthFeatureType::kBetterTogetherHostSupported: FALLTHROUGH; case CryptAuthFeatureType::kBetterTogetherHostEnabled: return multidevice::SoftwareFeature::kBetterTogetherHost; case CryptAuthFeatureType::kBetterTogetherClientSupported: FALLTHROUGH; case CryptAuthFeatureType::kBetterTogetherClientEnabled: return multidevice::SoftwareFeature::kBetterTogetherClient; case CryptAuthFeatureType::kEasyUnlockHostSupported: FALLTHROUGH; case CryptAuthFeatureType::kEasyUnlockHostEnabled: return multidevice::SoftwareFeature::kSmartLockHost; case CryptAuthFeatureType::kEasyUnlockClientSupported: FALLTHROUGH; case CryptAuthFeatureType::kEasyUnlockClientEnabled: return multidevice::SoftwareFeature::kSmartLockClient; case CryptAuthFeatureType::kMagicTetherHostSupported: FALLTHROUGH; case CryptAuthFeatureType::kMagicTetherHostEnabled: return multidevice::SoftwareFeature::kInstantTetheringHost; case CryptAuthFeatureType::kMagicTetherClientSupported: FALLTHROUGH; case CryptAuthFeatureType::kMagicTetherClientEnabled: return multidevice::SoftwareFeature::kInstantTetheringClient; case CryptAuthFeatureType::kSmsConnectHostSupported: FALLTHROUGH; case CryptAuthFeatureType::kSmsConnectHostEnabled: return multidevice::SoftwareFeature::kMessagesForWebHost; case CryptAuthFeatureType::kSmsConnectClientSupported: FALLTHROUGH; case CryptAuthFeatureType::kSmsConnectClientEnabled: return multidevice::SoftwareFeature::kMessagesForWebClient; case CryptAuthFeatureType::kPhoneHubHostSupported: FALLTHROUGH; case CryptAuthFeatureType::kPhoneHubHostEnabled: return multidevice::SoftwareFeature::kPhoneHubHost; case CryptAuthFeatureType::kPhoneHubClientSupported: FALLTHROUGH; case CryptAuthFeatureType::kPhoneHubClientEnabled: return multidevice::SoftwareFeature::kPhoneHubClient; } } CryptAuthFeatureType CryptAuthFeatureTypeFromSoftwareFeature( multidevice::SoftwareFeature software_feature) { switch (software_feature) { case multidevice::SoftwareFeature::kBetterTogetherHost: return CryptAuthFeatureType::kBetterTogetherHostEnabled; case multidevice::SoftwareFeature::kBetterTogetherClient: return CryptAuthFeatureType::kBetterTogetherClientEnabled; case multidevice::SoftwareFeature::kSmartLockHost: return CryptAuthFeatureType::kEasyUnlockHostEnabled; case multidevice::SoftwareFeature::kSmartLockClient: return CryptAuthFeatureType::kEasyUnlockClientEnabled; case multidevice::SoftwareFeature::kInstantTetheringHost: return CryptAuthFeatureType::kMagicTetherHostEnabled; case multidevice::SoftwareFeature::kInstantTetheringClient: return CryptAuthFeatureType::kMagicTetherClientEnabled; case multidevice::SoftwareFeature::kMessagesForWebHost: return CryptAuthFeatureType::kSmsConnectHostEnabled; case multidevice::SoftwareFeature::kMessagesForWebClient: return CryptAuthFeatureType::kSmsConnectClientEnabled; case multidevice::SoftwareFeature::kPhoneHubHost: return CryptAuthFeatureType::kPhoneHubHostEnabled; case multidevice::SoftwareFeature::kPhoneHubClient: return CryptAuthFeatureType::kPhoneHubClientEnabled; } } std::ostream& operator<<(std::ostream& stream, CryptAuthFeatureType feature_type) { stream << CryptAuthFeatureTypeToString(feature_type); return stream; } } // namespace device_sync } // namespace chromeos
Route16GateObject: db $a ; border block db $9 ; warps db $8, $0, $0, $ff db $9, $0, $1, $ff db $8, $7, $2, $ff db $9, $7, $3, $ff db $2, $0, $4, $ff db $3, $0, $5, $ff db $2, $7, $6, $ff db $3, $7, $7, $ff db $c, $6, $0, ROUTE_16_GATE_2F db $0 ; signs db $2 ; objects object SPRITE_GUARD, $4, $5, STAY, DOWN, $1 ; person object SPRITE_GAMBLER, $4, $3, STAY, NONE, $2 ; person ; warp-to EVENT_DISP ROUTE_16_GATE_1F_WIDTH, $8, $0 EVENT_DISP ROUTE_16_GATE_1F_WIDTH, $9, $0 EVENT_DISP ROUTE_16_GATE_1F_WIDTH, $8, $7 EVENT_DISP ROUTE_16_GATE_1F_WIDTH, $9, $7 EVENT_DISP ROUTE_16_GATE_1F_WIDTH, $2, $0 EVENT_DISP ROUTE_16_GATE_1F_WIDTH, $3, $0 EVENT_DISP ROUTE_16_GATE_1F_WIDTH, $2, $7 EVENT_DISP ROUTE_16_GATE_1F_WIDTH, $3, $7 EVENT_DISP ROUTE_16_GATE_1F_WIDTH, $c, $6 ; ROUTE_16_GATE_2F
COMMENT }%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Copyright (c) GeoWorks 1993 -- All Rights Reserved PROJECT: PC GEOS MODULE: common buffer routines FILE: bufferCreateRedwood.asm AUTHOR: Dave Durran ROUTINES: Name Description ---- ----------- REVISION HISTORY: Name Date Description ---- ---- ----------- Dave 7/93 initial version DESCRIPTION: $Id: bufferCreateRedwood.asm,v 1.1 97/04/18 11:50:21 newdeal Exp $ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%} COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PrCreatePrintBuffers %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Looks at the PSTATE to find out what graphics resolution this document is printing at. The routine then allocates a chunk of memory for a output buffer for the graphic print routines. CALLED BY: PrintSwath PASS: es - pointer to locked PState RETURN: PSTATE loaded with handle and segment of buffers DESTROYED: nothing PSEUDO CODE/STRATEGY: create the buffer space used by the print drivers in this mode. BandBuffer is created to hold a complete band of print data extracted from the HugeArray blocks. It is BM_width x BYTES_COLUMN long. For REDWOOD, the output buffer is in fixed memory, and separate from this block. KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Dave 2/28/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ PrCreatePrintBuffers proc near uses ax,bx,cx,dx .enter mov ax,es:[PS_bandBWidth] ;get the x dimension of the bitmap. mov cx, PRINTHEAD_HEIGHT ;get # for buff height mul cx ; ax = buffer size needed mov cx,ALLOC_DYNAMIC_NO_ERR_LOCK or mask HF_SHARABLE ;mem flags call MemAlloc ;allocate a buffer in memory. mov es:[PS_bufHan],bx ;store handle in PSTATE. mov es:[PS_bufSeg],ax ;store the segment in PSTATE. .leave ret PrCreatePrintBuffers endp
Name: title-e.asm Type: file Size: 58345 Last-Modified: '1992-06-28T15:00:00Z' SHA-1: A91E569FBB9B6C0265EC7E152A3D4124AECDAF47 Description: null
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Copyright (c) GeoWorks 1992 -- All Rights Reserved PROJECT: PC GEOS MODULE: FILE: cellFlags.asm AUTHOR: Gene Anderson, Aug 24, 1992 ROUTINES: Name Description ---- ----------- GBL RowGetFlags Get flags for given row GBL RowSetFlags Set flags for given row RangeEnumRowFlags version of RangeEnum() for matching row flags REVISION HISTORY: Name Date Description ---- ---- ----------- Gene 8/24/92 Initial revision DESCRIPTION: Code for dealing with the infamous ColumnFlags $Id: cellFlags.asm,v 1.1 97/04/04 17:44:48 newdeal Exp $ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ CellCode segment resource COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% RowGetFlags %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Get flags for specified row CALLED BY: GLOBAL PASS: ds:si - ptr to CellFunctionParameters ax - row # RETURN: carry - set if row exists dx - flags for row (0 if row doesn't exist) DESTROYED: none PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- gene 1/21/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ RowGetFlags proc far uses ds, si .enter EC < call ECCheckCellParams > clr dx ;dx <- assume row doesn't exist call LockRowBlock jnc done ;branch if row doesn't exist call GetRowPointer ;*ds:si <- ptr to row jnc doneUnlock ;branch if row doesn't exist mov si, ds:[si] ;ds:si <- ColumnArrayHeader EC < call ECCheckBounds ;> mov dx, ds:[si].CAH_rowFlags ;dx <- flags for row doneUnlock: call UnlockRowBlock done: .leave ret RowGetFlags endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% RowSetFlags %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Set flags for a given row CALLED BY: GLOBAL PASS: ds:si - ptr to CellFunctionParameters ax - row # dx - flags for row RETURN: carry - set if row exists DESTROYED: none PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- gene 1/21/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ RowSetFlags proc far uses ds, si .enter EC < call ECCheckCellParams ;> call LockRowBlock jnc done ;branch if row doesn't exist call GetRowPointer ;*ds:si <- ptr to row EC < ERROR_NC ROW_BLOCK_MUST_EXIST ;> mov si, ds:[si] ;ds:si <- ColumnArrayHeader EC < call ECCheckBounds ;> push bp mov bp, ds:LMBH_handle ;bp <- handle of row block cmp ds:[si].CAH_rowFlags, dx ;flags changing? je noChange ;branch if no change mov ds:[si].CAH_rowFlags, dx ;store new flags call VMDirty ;dirty me jesus noChange: call VMUnlock ;unlock me jesus pop bp stc ;carry <- row exists done: .leave ret RowSetFlags endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% RangeEnumRowFlags %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Do a RangeEnum() for cells with certain flags CALLED BY: GLOBAL PASS: ds:si = Pointer to CellFunctionParameters ss:bp = ptr to callback local variables ss:bx = ptr to RangeEnumParams RECFP_params - RangeEnumParams RECFP_flags - flags to check dl = RangeEnumFlags RETURN: carry set if callback aborted DESTROYED: none PSEUDO CODE/STRATEGY: This routine is optimized under the following assumptions: - a lot of rows tend to be entirely empty - therefore a lot of row blocks tend to be entirely empty KNOWN BUGS/SIDE EFFECTS/IDEAS: See RangeEnum() for more information. REVISION HISTORY: Name Date Description ---- ---- ----------- gene 8/24/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ RangeEnumRowFlags proc near uses ax, cx, ds, di, dx .enter EC < call ECCheckCellParams ;> mov ax, ss:[bx].REP_bounds.R_top ;ax <- current row rowLoop: cmp ax, ss:[bx].REP_bounds.R_bottom ;past bottom? ja quitNoAbort ;branch if done mov cx, ss:[bx].REP_bounds.R_left ;cx <- current column columnLoop: cmp cx, ss:[bx].REP_bounds.R_right ;past right edge? ja nextRow ;branch if done ; ; See if the row block exists -- if not, we can skip 32 rows ; push ds call LockRowBlock jnc nextRowBlock ;branch if block doesn't exist ; ; See if the row exists -- if not, we can skip 1 row ; push si push ax ;save row # call GetRowPointer jnc nextRowUnlockPop ;branch if row doesn't exist ; ; Get the flags for the current row ; push si mov si, ds:[si] ;ds:si <- ptr to row header mov ax, ds:[si].CAH_rowFlags ;ax <- flags for row pop si ; ; Correct flags set for row? ; test ax, ss:[bx].REP_matchFlags ;right bits set? jnz doCell ;branch if right bit(s) set tst ss:[bx].REP_matchFlags ;special case? jnz nextRowUnlockPop ;branch if not special case ; ; Special case -- match flags are zero. See if the column ; flags are zero, too ; tst ax ;column flags zero? jnz nextRowUnlockPop ;branch if not to do next col ; ; We've finally gotten to a row where the flags match -- ; do the usual RangeEnum things on it. ; doCell: call UnlockRowBlock pop ax ;ax <- row # pop si ;ds:si <- ptr to CFP pop ds ; ; Lock the cell if requested ; call RangeEnumLockCell pushf if FULL_EXECUTE_IN_PLACE push bx, ax mov ss:[TPD_dataBX], bx mov ss:[TPD_dataAX], ax mov ax, ss:[bx].REP_callback.offset mov bx, ss:[bx].REP_callback.segment call ProcCallFixedOrMovable pop bx, ax else call ss:[bx].REP_callback ;call me jesus endif jc abort popf ;restore 'cell exists' flag ; ; Unlock the cell if necessary ; call RangeEnumUnlockCell ; ; Go to do the next column ; inc cx ;cx <- next column jmp columnLoop nextRowUnlockPop: call UnlockRowBlock pop ax ;ax <- row # pop si pop ds ;ds:si <- ptr to CFP nextRow: inc ax jmp rowLoop nextRowBlock: pop ds ;get rid of redundant ds. ComputeNextRowBlockStart ax jmp rowLoop quitNoAbort: clc ;signal: didn't abort quit: .leave ret abort: ; ; The callback aborted. ; On stack: ; flags, carry set if cell existed. ; popf ;restore 'cell exists' flag call RangeEnumUnlockCell ;release the cell stc ;signal: aborted jmp quit RangeEnumRowFlags endp CellCode ends
; 实现系统调用必须的汇编部分 ; 系统调用的中断号 SYS_CALL_VECTOR equ 0x90 global asm_syscall global enable_int global disable_int global pause ;========================= ; 系统调用通用函数,用于触发中断 ; 最多传递五个参数,其中第一个为系统调用号 ; asm_syscall(int sys_vector, u32 para0,u32 para1,u32 para2, u32 para3); ;========================= asm_syscall: mov eax, [esp + 4] mov ebx, [esp + 8] mov ecx, [esp + 12] mov edx, [esp + 16] mov edi, [esp + 20] int SYS_CALL_VECTOR ret ;======================== ; 控制中断 ;======================== enable_int: sti ret disable_int: cli ret ;======================== ; 调试断点 ;======================== pause: xchg bx,bx ret
#include "MipiRffeAnalyzerSettings.h" #include <AnalyzerHelpers.h> #include <sstream> #include <cstring> MipiRffeAnalyzerSettings::MipiRffeAnalyzerSettings(): mSclkChannel(UNDEFINED_CHANNEL), mSdatChannel(UNDEFINED_CHANNEL), mShowMarker(BIT_HIGH) { mSdatChannelInterface.reset(new AnalyzerSettingInterfaceChannel()); mSdatChannelInterface->SetTitleAndTooltip("SDATA", "SDATA"); mSdatChannelInterface->SetChannel(mSdatChannel); mSdatChannelInterface->SetSelectionOfNoneIsAllowed(false); mSclkChannelInterface.reset(new AnalyzerSettingInterfaceChannel()); mSclkChannelInterface->SetTitleAndTooltip("SCLK", "SCLK"); mSclkChannelInterface->SetChannel(mSclkChannel); mUseShowMarkerInterface.reset(new AnalyzerSettingInterfaceBool()); mUseShowMarkerInterface->SetTitleAndTooltip("", "Show decode marker or not"); mUseShowMarkerInterface->SetCheckBoxText("Show Decode Marker"); mUseShowMarkerInterface->SetValue(mShowMarker); AddInterface(mSdatChannelInterface.get()); AddInterface(mSclkChannelInterface.get()); AddInterface(mUseShowMarkerInterface.get()); AddExportOption(0, "Export as text/csv file"); AddExportExtension(0, "Text file", "txt"); AddExportExtension(0, "CSV file", "csv"); ClearChannels(); AddChannel(mSclkChannel, "SCLK", false); AddChannel(mSdatChannel, "SDAT", false); } MipiRffeAnalyzerSettings::~MipiRffeAnalyzerSettings() { } bool MipiRffeAnalyzerSettings::SetSettingsFromInterfaces() { Channel sclk = mSclkChannelInterface->GetChannel(); Channel sdat = mSdatChannelInterface->GetChannel(); std::vector<Channel> channels; channels.push_back(sclk); channels.push_back(sdat); if (AnalyzerHelpers::DoChannelsOverlap(&channels[0], channels.size()) == true) { SetErrorText("Please select different channels for each input."); return false; } mSclkChannel = mSclkChannelInterface->GetChannel(); mSdatChannel = mSdatChannelInterface->GetChannel(); mShowMarker = mUseShowMarkerInterface->GetValue(); ClearChannels(); AddChannel(mSclkChannel, "SCLK", mSclkChannel != UNDEFINED_CHANNEL); AddChannel(mSdatChannel, "SDAT", mSdatChannel != UNDEFINED_CHANNEL); return true; } void MipiRffeAnalyzerSettings::LoadSettings(const char *settings) { SimpleArchive text_archive; text_archive.SetString(settings); const char *name_string; //the first thing in the archive is the name of the protocol analyzer that the data belongs to. text_archive >> &name_string; if (strcmp(name_string, "QyMipiRffeAnalyzer") != 0) { AnalyzerHelpers::Assert("Kingst: Provided with a settings string that doesn't belong to us;"); } text_archive >> mSclkChannel; text_archive >> mSdatChannel; bool show_marker; if (text_archive >> show_marker) { mShowMarker = show_marker; } ClearChannels(); AddChannel(mSclkChannel, "SCLK", mSclkChannel != UNDEFINED_CHANNEL); AddChannel(mSdatChannel, "SDAT", mSdatChannel != UNDEFINED_CHANNEL); UpdateInterfacesFromSettings(); } const char *MipiRffeAnalyzerSettings::SaveSettings() { SimpleArchive text_archive; text_archive << "QyMipiRffeAnalyzer"; text_archive << mSclkChannel; text_archive << mSdatChannel; text_archive << mShowMarker; return SetReturnString(text_archive.GetString()); } void MipiRffeAnalyzerSettings::UpdateInterfacesFromSettings() { mSclkChannelInterface->SetChannel(mSclkChannel); mSdatChannelInterface->SetChannel(mSdatChannel); mUseShowMarkerInterface->SetValue(mShowMarker); }
<% from pwnlib.shellcraft.aarch64.linux import syscall %> <%page args="buf, size"/> <%docstring> Invokes the syscall getcwd. See 'man 2 getcwd' for more information. Arguments: buf(char): buf size(size_t): size </%docstring> ${syscall('SYS_getcwd', buf, size)}
.global s_prepare_buffers s_prepare_buffers: push %r14 push %r15 push %r9 push %rbp push %rbx push %rcx push %rdi push %rsi lea addresses_WT_ht+0x9f7d, %rdi nop nop cmp $10220, %rbx movb $0x61, (%rdi) nop nop xor %rcx, %rcx lea addresses_WC_ht+0x1963d, %r15 nop nop nop and $22500, %r9 movl $0x61626364, (%r15) nop nop add $758, %rbx lea addresses_D_ht+0x143db, %r14 nop nop nop add $47607, %rbp mov $0x6162636465666768, %r15 movq %r15, (%r14) nop nop nop nop nop sub $27827, %r15 lea addresses_WC_ht+0xe3bd, %rdi nop sub %r9, %r9 movl $0x61626364, (%rdi) nop nop nop sub $29290, %rbx lea addresses_A_ht+0x1063d, %r14 nop and $59665, %r9 vmovups (%r14), %ymm3 vextracti128 $1, %ymm3, %xmm3 vpextrq $1, %xmm3, %rbx add %r15, %r15 lea addresses_A_ht+0x4891, %rsi lea addresses_WT_ht+0x17cbd, %rdi clflush (%rsi) nop nop nop nop nop cmp %rbx, %rbx mov $77, %rcx rep movsb nop nop nop add $6278, %rcx pop %rsi pop %rdi pop %rcx pop %rbx pop %rbp pop %r9 pop %r15 pop %r14 ret .global s_faulty_load s_faulty_load: push %r14 push %r15 push %r8 push %rcx push %rdi push %rdx // Faulty Load lea addresses_D+0x1fcbd, %rcx nop nop nop nop nop sub $44153, %r8 movups (%rcx), %xmm4 vpextrq $0, %xmm4, %rdx lea oracles, %r15 and $0xff, %rdx shlq $12, %rdx mov (%r15,%rdx,1), %rdx pop %rdx pop %rdi pop %rcx pop %r8 pop %r15 pop %r14 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_D', 'same': True, 'size': 8, 'congruent': 0, 'NT': False, 'AVXalign': True}, 'OP': 'LOAD'} [Faulty Load] {'src': {'type': 'addresses_D', 'same': True, 'size': 16, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} <gen_prepare_buffer> {'dst': {'type': 'addresses_WT_ht', 'same': False, 'size': 1, 'congruent': 5, 'NT': True, 'AVXalign': False}, 'OP': 'STOR'} {'dst': {'type': 'addresses_WC_ht', 'same': False, 'size': 4, 'congruent': 5, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'dst': {'type': 'addresses_D_ht', 'same': False, 'size': 8, 'congruent': 1, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'dst': {'type': 'addresses_WC_ht', 'same': False, 'size': 4, 'congruent': 5, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'src': {'type': 'addresses_A_ht', 'same': False, 'size': 32, 'congruent': 7, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_A_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 11, 'same': False}, 'OP': 'REPM'} {'36': 21829} 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 */
; boot.asm ; The label start is our entry point. We have to make it ; public so that the linker can use it. global start ; we are still in 32-bit protected mode so we have to use ; 32-bit wide instructions bits 32 ; PTE_PRESENT equ 1 << 7 ; Flags for _large_ p2 aka. PDE page table entries PDE_PRESENT equ 1 << 0 PDE_WRITABLE equ 1 << 1 PDE_LARGE equ 1 << 7 ; GDT Flags start: ; Switching to long mode ; ; Step 1: Disable paging ; ; to disable paging set `CR0.PG` to `0`. mov eax, cr0 and eax, ~(1 << 31) mov cr0, eax ; Step 2: Enable Physical Address Extension mov eax, cr4 or eax, (1 << 5) mov cr4, eax ; Step 3: Set `cr3` register mov eax, p4_table mov cr3, eax ; Step 4: Set the p2[1] entry to point to the _second_ 2 MiB frame mov eax, (0x20_0000 | PDE_PRESENT | PDE_WRITABLE | PDE_LARGE) mov [p2_table + 8], eax ; point the 0th entry to the first frame ; TODO: explain mov eax, (0x00_0000 | PDE_PRESENT | PDE_WRITABLE | PDE_LARGE) mov [p2_table], eax ; Step 5: Set the 0th entry of p3 to point to our p2 table mov eax, p2_table ; load the address of the p2 table or eax, (PDE_PRESENT | PDE_WRITABLE) mov [p3_table], eax ; Step 6: Set the 0th entry of p4 to point to our p3 table mov eax, p3_table or eax, (PDE_PRESENT | PDE_WRITABLE) mov [p4_table], eax ; Step 7: Set EFER.LME to 1 to enable the long mode mov ecx, 0xC0000080 rdmsr or eax, 1 << 8 wrmsr ; Step 8: enable paging mov eax, cr0 or eax, 1 << 31 mov cr0, eax ; is paging enabled now? ; -> No, this instruction still works ;mov eax, [0xFF_FFFF] ; Step 9: Disable Interrupts ; Step 11: Enable Interrupts lgdt [gdt64.pointer] jmp gdt64.code:longstart section .text bits 64 longstart: mov word [0xb8000], 0x0e4f ; 'O', yellow on black mov word [0xb8002], 0x0e4b ; 'K', yellow on black ; uncomment the next line and you will have a page fault ;mov eax, [0xFF_FFFF] hlt section .bss ; must be page aligned align 4096 p4_table: resb 4096 p3_table: resb 4096 p2_table: resb 4096 stack_bottom: resb 64 stack_top: section .rodata gdt64: dq 0 .code: equ $ - gdt64 dq (1 << 43) | (1 << 44) | (1 << 47) | (1 << 53) .pointer: dw $ - gdt64 - 1 ; length of the gdt64 table dq gdt64 ; addess of the gdt64 table section .text
rot1: ld a, 0 rot2: ld b, 0 rot1: ld c, 0
; A164581: a(n) = 5*a(n - 1) + a(n - 2), with a(0)=1, a(1)=2. ; Submitted by Jamie Morken(s2) ; 1,2,11,57,296,1537,7981,41442,215191,1117397,5802176,30128277,156443561,812346082,4218173971,21903215937,113734253656,590574484217,3066606674741,15923607857922,82684645964351,429346837679677,2229418834362736,11576441009493357,60111623881829521,312134560418640962,1620784425975034331,8416056690293812617,43701067877444097416,226921396077514299697,1178308048265015595901,6118461637402592279202,31770616235277976991911,164971542813792477238757,856628330304240363185696,4448113194334994293167237 mov $1,2 mov $3,3 lpb $0 sub $0,1 mul $2,5 add $2,$3 mov $3,$1 mov $1,$2 sub $2,1 lpe mov $0,$1 sub $0,1
SECTION code_clib SECTION code_nirvanap PUBLIC asm_NIRVANAP_drawT_di EXTERN asm_NIRVANAP_drawT asm_NIRVANAP_drawT_di: di call asm_NIRVANAP_drawT ei ret
#include <flutter/dart_project.h> #include <flutter/flutter_view_controller.h> #include <windows.h> #include "flutter_window.h" #include "utils.h" int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev, _In_ wchar_t *command_line, _In_ int show_command) { // Attach to console when present (e.g., 'flutter run') or create a // new console when running with a debugger. if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) { CreateAndAttachConsole(); } // Initialize COM, so that it is available for use in the library and/or // plugins. ::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED); flutter::DartProject project(L"data"); std::vector<std::string> command_line_arguments = GetCommandLineArguments(); project.set_dart_entrypoint_arguments(std::move(command_line_arguments)); FlutterWindow window(project); Win32Window::Point origin(10, 10); Win32Window::Size size(1280, 720); if (!window.CreateAndShow(L"test_flutter", origin, size)) { return EXIT_FAILURE; } window.SetQuitOnClose(true); ::MSG msg; while (::GetMessage(&msg, nullptr, 0, 0)) { ::TranslateMessage(&msg); ::DispatchMessage(&msg); } ::CoUninitialize(); return EXIT_SUCCESS; }
;//////////////////////////////////////////////////////////////////////////////////////////////////////// ;// Part of Injectable Generic Camera System ;// Copyright(c) 2019, Frans Bouma ;// All rights reserved. ;// https://github.com/FransBouma/InjectableGenericCameraSystem ;// ;// 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. ;// ;// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" ;// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ;// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ;// DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE ;// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL ;// DAMAGES(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR ;// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER ;// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, ;// OR TORT(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ;// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ;//////////////////////////////////////////////////////////////////////////////////////////////////////// ;--------------------------------------------------------------- ; Game specific asm file to intercept execution flow to obtain addresses, prevent writes etc. ;--------------------------------------------------------------- ;--------------------------------------------------------------- ; Public definitions so the linker knows which names are present in this file PUBLIC cameraStructInterceptor PUBLIC cameraFOVInterceptor PUBLIC timescaleInterceptor ;--------------------------------------------------------------- ;--------------------------------------------------------------- ; Externs which are used and set by the system. Read / write these ; values in asm to communicate with the system EXTERN g_cameraEnabled: byte EXTERN g_cameraStructAddress: qword EXTERN g_fovStructAddress: qword EXTERN g_timescaleAddress: qword ;--------------------------------------------------------------- ;--------------------------------------------------------------- ; Own externs, defined in InterceptorHelper.cpp EXTERN _cameraStructInterceptionContinue: qword EXTERN _fovStructInterceptionContinue: qword EXTERN _timescaleInterceptionContinue: qword .data .code cameraStructInterceptor PROC ;NinoKuni_WotWW_Remastered.exe+5B5CD6 - 0F58 E0 - addps xmm4,xmm0 ;NinoKuni_WotWW_Remastered.exe+5B5CD9 - 0F58 E1 - addps xmm4,xmm1 ;NinoKuni_WotWW_Remastered.exe+5B5CDC - 66 0F6F CF - movdqa xmm1,xmm7 ;NinoKuni_WotWW_Remastered.exe+5B5CE0 - 66 0FDF FE - pandn xmm7,xmm6 ;NinoKuni_WotWW_Remastered.exe+5B5CE4 - 66 0FDF CD - pandn xmm1,xmm5 ;NinoKuni_WotWW_Remastered.exe+5B5CE8 - 0F28 74 24 30 - movaps xmm6,[rsp+30] ;NinoKuni_WotWW_Remastered.exe+5B5CED - 0F28 C4 - movaps xmm0,xmm4 ;NinoKuni_WotWW_Remastered.exe+5B5CF0 - 0FC6 05 D84B7B00 FA - shufps xmm0,[NinoKuni_WotWW_Remastered.exe+D6A8D0],-06 { 250,(1.00) } ;NinoKuni_WotWW_Remastered.exe+5B5CF8 - 66 0F7F 12 - movdqa [rdx],xmm2 <<intercept here ;NinoKuni_WotWW_Remastered.exe+5B5CFC - 66 0F7F 4A 10 - movdqa [rdx+10],xmm1 ;NinoKuni_WotWW_Remastered.exe+5B5D01 - 66 0F7F 7A 20 - movdqa [rdx+20],xmm7 ;NinoKuni_WotWW_Remastered.exe+5B5D06 - 0F28 7C 24 20 - movaps xmm7,[rsp+20] ;NinoKuni_WotWW_Remastered.exe+5B5D0B - 0FC6 E0 C4 - shufps xmm4,xmm0,-3C { 196 } ;NinoKuni_WotWW_Remastered.exe+5B5D0F - 66 0F7F 62 30 - movdqa [rdx+30],xmm4 ;NinoKuni_WotWW_Remastered.exe+5B5D14 - 48 83 C4 48 - add rsp,48 { 72 } <<<return here mov [g_cameraStructAddress],rdx cmp byte ptr [g_cameraEnabled],1 je skipwrites movdqa [rdx],xmm2 movdqa [rdx+10h],xmm1 movdqa [rdx+20h],xmm7 movaps xmm7,[rsp+20h] shufps xmm4,xmm0,-3Ch movdqa [rdx+30h],xmm4 jmp exit skipwrites: ;movdqa [rdx],xmm2 ;movdqa [rdx+10h],xmm1 ;movdqa [rdx+20h],xmm7 movaps xmm7, [rsp+20h] shufps xmm4,xmm0,-3Ch ;movdqa [rdx+30h],xmm4 exit: jmp qword ptr [_cameraStructInterceptionContinue] ; jmp back into the original game code, which is the location after the original statements above. cameraStructInterceptor ENDP cameraFOVInterceptor PROC ;NinoKuni_WotWW_Remastered.exe+5B5A5F - 0F28 00 - movaps xmm0,[rax] ;NinoKuni_WotWW_Remastered.exe+5B5A62 - 66 0F7F 43 50 - movdqa [rbx+50],xmm0 <<<intercept here ;NinoKuni_WotWW_Remastered.exe+5B5A67 - 0F28 48 10 - movaps xmm1,[rax+10] ;NinoKuni_WotWW_Remastered.exe+5B5A6B - 66 0F7F 4B 60 - movdqa [rbx+60],xmm1 ;NinoKuni_WotWW_Remastered.exe+5B5A70 - 0F28 40 20 - movaps xmm0,[rax+20] <<<return here ;NinoKuni_WotWW_Remastered.exe+5B5A74 - 66 0F7F 43 70 - movdqa [rbx+70],xmm0 ;NinoKuni_WotWW_Remastered.exe+5B5A79 - 0F28 48 30 - movaps xmm1,[rax+30] ;NinoKuni_WotWW_Remastered.exe+5B5A7D - 48 8D 43 50 - lea rax,[rbx+50] ;NinoKuni_WotWW_Remastered.exe+5B5A81 - 66 0F7F 8B 80000000 - movdqa [rbx+00000080],xmm1 ;NinoKuni_WotWW_Remastered.exe+5B5A89 - 48 83 C4 70 - add rsp,70 { 112 } mov [g_fovStructAddress],rbx cmp byte ptr [g_cameraEnabled],1 je camenabled movdqa [rbx+50h],xmm0 movaps xmm1,[rax+10h] movdqa [rbx+60h],xmm1 jmp exit camenabled: ;movdqa [rbx+50h],xmm0 movaps xmm1,[rax+10h] ;movdqa [rbx+60h],xmm1 exit: jmp qword ptr [_fovStructInterceptionContinue] ; jmp back into the original game code, which is the location after the original statements above. cameraFOVInterceptor ENDP timescaleInterceptor PROC ;NinoKuni_WotWW_Remastered.exe+ABFEE5 - 48 8B 05 ECF65D00 - mov rax,[NinoKuni_WotWW_Remastered.exe+109F5D8] { (27420A8C080) } ;NinoKuni_WotWW_Remastered.exe+ABFEEC - F3 44 0F10 48 18 - movss xmm9,[rax+18] <<<intercept here ;NinoKuni_WotWW_Remastered.exe+ABFEF2 - F3 44 0F5C 48 14 - subss xmm9,[rax+14] ;NinoKuni_WotWW_Remastered.exe+ABFEF8 - F3 44 0F59 48 24 - mulss xmm9,[rax+24] ;NinoKuni_WotWW_Remastered.exe+ABFEFE - F3 44 0F58 48 14 - addss xmm9,[rax+14] <<<return here ;NinoKuni_WotWW_Remastered.exe+ABFF04 - 66 44 3B B7 704A0000 - cmp r14w,[rdi+00004A70] ;NinoKuni_WotWW_Remastered.exe+ABFF0C - 0F83 6A010000 - jae NinoKuni_WotWW_Remastered.exe+AC007C mov [g_timescaleAddress],rax movss xmm9, dword ptr [rax+18h] subss xmm9, dword ptr [rax+14h] mulss xmm9, dword ptr [rax+24h] jmp qword ptr [_timescaleInterceptionContinue] ; jmp back into the original game code, which is the location after the original statements above. timescaleInterceptor ENDP END
LXI H,4000 MOV C,M INX H MOV A,M DCR C ZONE: INX H CMP M JC TYPE MOV A,M TYPE: DCR C JNZ ZONE STA 5000 RST 1
// Copyright 2017 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 "cc/paint/paint_op_buffer.h" #include <algorithm> #include "base/bind.h" #include "base/cxx17_backports.h" #include "base/memory/raw_ptr.h" #include "base/memory/scoped_refptr.h" #include "base/strings/stringprintf.h" #include "base/test/bind.h" #include "cc/paint/decoded_draw_image.h" #include "cc/paint/display_item_list.h" #include "cc/paint/image_provider.h" #include "cc/paint/image_transfer_cache_entry.h" #include "cc/paint/paint_flags.h" #include "cc/paint/paint_image_builder.h" #include "cc/paint/paint_op_buffer_serializer.h" #include "cc/paint/paint_op_reader.h" #include "cc/paint/paint_op_writer.h" #include "cc/paint/shader_transfer_cache_entry.h" #include "cc/paint/skottie_resource_metadata.h" #include "cc/paint/skottie_wrapper.h" #include "cc/paint/transfer_cache_entry.h" #include "cc/test/lottie_test_data.h" #include "cc/test/paint_op_helper.h" #include "cc/test/skia_common.h" #include "cc/test/test_options_provider.h" #include "cc/test/test_paint_worklet_input.h" #include "cc/test/test_skcanvas.h" #include "cc/test/transfer_cache_test_helper.h" #include "skia/buildflags.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/skia/include/core/SkMaskFilter.h" #include "third_party/skia/include/effects/SkColorMatrixFilter.h" #include "third_party/skia/include/effects/SkDashPathEffect.h" #include "third_party/skia/include/effects/SkLayerDrawLooper.h" #include "third_party/skia/include/private/chromium/SkChromeRemoteGlyphCache.h" #include "ui/gfx/geometry/test/geometry_util.h" using testing::_; using testing::AtLeast; using testing::Contains; using testing::Key; using testing::Mock; using testing::NiceMock; using testing::NotNull; namespace cc { namespace { // An arbitrary size guaranteed to fit the size of any serialized op in this // unit test. This can also be used for deserialized op size safely in this // unit test suite as generally deserialized ops are smaller. static constexpr size_t kBufferBytesPerOp = 1000 + sizeof(LargestPaintOp); template <typename T> void ValidateOps(PaintOpBuffer* buffer) { // Make sure all test data is valid before serializing it. for (auto* op : PaintOpBuffer::Iterator(buffer)) EXPECT_TRUE(static_cast<T*>(op)->IsValid()); } } // namespace class PaintOpSerializationTestUtils { public: static void FillArbitraryShaderValues(PaintShader* shader, bool use_matrix) { shader->shader_type_ = PaintShader::Type::kTwoPointConicalGradient; shader->flags_ = 12345; shader->end_radius_ = 12.3f; shader->start_radius_ = 13.4f; shader->tx_ = SkTileMode::kRepeat; shader->ty_ = SkTileMode::kMirror; shader->fallback_color_ = SkColorSetARGB(254, 252, 250, 248); shader->scaling_behavior_ = PaintShader::ScalingBehavior::kRasterAtScale; if (use_matrix) { shader->local_matrix_.emplace(SkMatrix::I()); shader->local_matrix_->setSkewX(10); shader->local_matrix_->setSkewY(20); } shader->center_ = SkPoint::Make(50, 40); shader->tile_ = SkRect::MakeXYWH(7, 77, 777, 7777); shader->start_point_ = SkPoint::Make(-1, -5); shader->end_point_ = SkPoint::Make(13, -13); shader->start_degrees_ = 123; shader->end_degrees_ = 456; // TODO(vmpstr): Add PaintImage/PaintRecord. shader->colors_ = {SkColorSetARGB(1, 2, 3, 4), SkColorSetARGB(5, 6, 7, 8), SkColorSetARGB(9, 0, 1, 2)}; shader->positions_ = {0.f, 0.4f, 1.f}; } }; TEST(PaintOpBufferTest, Empty) { PaintOpBuffer buffer; EXPECT_EQ(buffer.size(), 0u); EXPECT_EQ(buffer.bytes_used(), sizeof(PaintOpBuffer)); EXPECT_EQ(PaintOpBuffer::Iterator(&buffer), false); buffer.Reset(); EXPECT_EQ(buffer.size(), 0u); EXPECT_EQ(buffer.bytes_used(), sizeof(PaintOpBuffer)); EXPECT_EQ(PaintOpBuffer::Iterator(&buffer), false); PaintOpBuffer buffer2(std::move(buffer)); EXPECT_EQ(buffer.size(), 0u); EXPECT_EQ(buffer.bytes_used(), sizeof(PaintOpBuffer)); EXPECT_EQ(PaintOpBuffer::Iterator(&buffer), false); EXPECT_EQ(buffer2.size(), 0u); EXPECT_EQ(buffer2.bytes_used(), sizeof(PaintOpBuffer)); EXPECT_EQ(PaintOpBuffer::Iterator(&buffer2), false); } class PaintOpAppendTest : public ::testing::Test { public: PaintOpAppendTest() { rect_ = SkRect::MakeXYWH(2, 3, 4, 5); flags_.setColor(SK_ColorMAGENTA); flags_.setAlpha(100); } void PushOps(PaintOpBuffer* buffer) { buffer->push<SaveLayerOp>(&rect_, &flags_); buffer->push<SaveOp>(); buffer->push<DrawColorOp>(draw_color_, blend_); buffer->push<RestoreOp>(); EXPECT_EQ(buffer->size(), 4u); } void VerifyOps(PaintOpBuffer* buffer) { EXPECT_EQ(buffer->size(), 4u); PaintOpBuffer::Iterator iter(buffer); ASSERT_EQ(iter->GetType(), PaintOpType::SaveLayer); SaveLayerOp* save_op = static_cast<SaveLayerOp*>(*iter); EXPECT_EQ(save_op->bounds, rect_); EXPECT_EQ(save_op->flags, flags_); ++iter; ASSERT_EQ(iter->GetType(), PaintOpType::Save); ++iter; ASSERT_EQ(iter->GetType(), PaintOpType::DrawColor); DrawColorOp* op = static_cast<DrawColorOp*>(*iter); EXPECT_EQ(op->color, draw_color_); EXPECT_EQ(op->mode, blend_); ++iter; ASSERT_EQ(iter->GetType(), PaintOpType::Restore); ++iter; EXPECT_FALSE(iter); } private: SkRect rect_; PaintFlags flags_; SkColor draw_color_ = SK_ColorRED; SkBlendMode blend_ = SkBlendMode::kSrc; }; TEST_F(PaintOpAppendTest, SimpleAppend) { PaintOpBuffer buffer; PushOps(&buffer); VerifyOps(&buffer); buffer.Reset(); PushOps(&buffer); VerifyOps(&buffer); } TEST_F(PaintOpAppendTest, MoveThenDestruct) { PaintOpBuffer original; PushOps(&original); VerifyOps(&original); PaintOpBuffer destination(std::move(original)); VerifyOps(&destination); // Original should be empty, and safe to destruct. EXPECT_EQ(original.size(), 0u); EXPECT_EQ(original.bytes_used(), sizeof(PaintOpBuffer)); } TEST_F(PaintOpAppendTest, MoveThenDestructOperatorEq) { PaintOpBuffer original; PushOps(&original); VerifyOps(&original); PaintOpBuffer destination; destination = std::move(original); VerifyOps(&destination); // Original should be empty, and safe to destruct. EXPECT_EQ(original.size(), 0u); EXPECT_EQ(original.bytes_used(), sizeof(PaintOpBuffer)); EXPECT_EQ(PaintOpBuffer::Iterator(&original), false); } TEST_F(PaintOpAppendTest, MoveThenReappend) { PaintOpBuffer original; PushOps(&original); PaintOpBuffer destination(std::move(original)); // Should be possible to reappend to the original and get the same result. PushOps(&original); VerifyOps(&original); EXPECT_EQ(original, destination); } TEST_F(PaintOpAppendTest, MoveThenReappendOperatorEq) { PaintOpBuffer original; PushOps(&original); PaintOpBuffer destination; destination = std::move(original); // Should be possible to reappend to the original and get the same result. PushOps(&original); VerifyOps(&original); EXPECT_EQ(original, destination); } // Verify that a SaveLayerAlpha / Draw / Restore can be optimized to just // a draw with opacity. TEST(PaintOpBufferTest, SaveDrawRestore) { PaintOpBuffer buffer; uint8_t alpha = 100; buffer.push<SaveLayerAlphaOp>(nullptr, alpha); PaintFlags draw_flags; draw_flags.setColor(SK_ColorMAGENTA); draw_flags.setAlpha(50); EXPECT_TRUE(draw_flags.SupportsFoldingAlpha()); SkRect rect = SkRect::MakeXYWH(1, 2, 3, 4); buffer.push<DrawRectOp>(rect, draw_flags); buffer.push<RestoreOp>(); SaveCountingCanvas canvas; buffer.Playback(&canvas); EXPECT_EQ(0, canvas.save_count_); EXPECT_EQ(0, canvas.restore_count_); EXPECT_EQ(rect, canvas.draw_rect_); // Expect the alpha from the draw and the save layer to be folded together. // Since alpha is stored in a uint8_t and gets rounded, so use tolerance. float expected_alpha = alpha * 50 / 255.f; EXPECT_LE(std::abs(expected_alpha - canvas.paint_.getAlpha()), 1.f); } // Verify that we don't optimize SaveLayerAlpha / DrawTextBlob / Restore. TEST(PaintOpBufferTest, SaveDrawTextBlobRestore) { PaintOpBuffer buffer; uint8_t alpha = 100; buffer.push<SaveLayerAlphaOp>(nullptr, alpha); PaintFlags paint_flags; EXPECT_TRUE(paint_flags.SupportsFoldingAlpha()); buffer.push<DrawTextBlobOp>(SkTextBlob::MakeFromString("abc", SkFont()), 0.0f, 0.0f, paint_flags); buffer.push<RestoreOp>(); SaveCountingCanvas canvas; buffer.Playback(&canvas); EXPECT_EQ(1, canvas.save_count_); EXPECT_EQ(1, canvas.restore_count_); } // The same as SaveDrawRestore, but test that the optimization doesn't apply // when the drawing op's flags are not compatible with being folded into the // save layer with opacity. TEST(PaintOpBufferTest, SaveDrawRestoreFail_BadFlags) { PaintOpBuffer buffer; uint8_t alpha = 100; buffer.push<SaveLayerAlphaOp>(nullptr, alpha); PaintFlags draw_flags; draw_flags.setColor(SK_ColorMAGENTA); draw_flags.setAlpha(50); draw_flags.setBlendMode(SkBlendMode::kSrc); EXPECT_FALSE(draw_flags.SupportsFoldingAlpha()); SkRect rect = SkRect::MakeXYWH(1, 2, 3, 4); buffer.push<DrawRectOp>(rect, draw_flags); buffer.push<RestoreOp>(); SaveCountingCanvas canvas; buffer.Playback(&canvas); EXPECT_EQ(1, canvas.save_count_); EXPECT_EQ(1, canvas.restore_count_); EXPECT_EQ(rect, canvas.draw_rect_); EXPECT_EQ(draw_flags.getAlpha(), canvas.paint_.getAlpha()); } // Same as above, but the save layer itself appears to be a noop. // See: http://crbug.com/748485. If the inner draw op itself // doesn't support folding, then the external save can't be skipped. TEST(PaintOpBufferTest, SaveDrawRestore_BadFlags255Alpha) { PaintOpBuffer buffer; uint8_t alpha = 255; buffer.push<SaveLayerAlphaOp>(nullptr, alpha); PaintFlags draw_flags; draw_flags.setColor(SK_ColorMAGENTA); draw_flags.setAlpha(50); draw_flags.setBlendMode(SkBlendMode::kColorBurn); EXPECT_FALSE(draw_flags.SupportsFoldingAlpha()); SkRect rect = SkRect::MakeXYWH(1, 2, 3, 4); buffer.push<DrawRectOp>(rect, draw_flags); buffer.push<RestoreOp>(); SaveCountingCanvas canvas; buffer.Playback(&canvas); EXPECT_EQ(1, canvas.save_count_); EXPECT_EQ(1, canvas.restore_count_); EXPECT_EQ(rect, canvas.draw_rect_); } // The same as SaveDrawRestore, but test that the optimization doesn't apply // when there are more than one ops between the save and restore. TEST(PaintOpBufferTest, SaveDrawRestoreFail_TooManyOps) { PaintOpBuffer buffer; uint8_t alpha = 100; buffer.push<SaveLayerAlphaOp>(nullptr, alpha); PaintFlags draw_flags; draw_flags.setColor(SK_ColorMAGENTA); draw_flags.setAlpha(50); draw_flags.setBlendMode(SkBlendMode::kSrcOver); EXPECT_TRUE(draw_flags.SupportsFoldingAlpha()); SkRect rect = SkRect::MakeXYWH(1, 2, 3, 4); buffer.push<DrawRectOp>(rect, draw_flags); buffer.push<NoopOp>(); buffer.push<RestoreOp>(); SaveCountingCanvas canvas; buffer.Playback(&canvas); EXPECT_EQ(1, canvas.save_count_); EXPECT_EQ(1, canvas.restore_count_); EXPECT_EQ(rect, canvas.draw_rect_); EXPECT_EQ(draw_flags.getAlpha(), canvas.paint_.getAlpha()); } // Verify that the save draw restore code works with a single op // that's not a draw op, and the optimization does not kick in. TEST(PaintOpBufferTest, SaveDrawRestore_SingleOpNotADrawOp) { PaintOpBuffer buffer; uint8_t alpha = 100; buffer.push<SaveLayerAlphaOp>(nullptr, alpha); buffer.push<NoopOp>(); buffer.push<RestoreOp>(); SaveCountingCanvas canvas; buffer.Playback(&canvas); EXPECT_EQ(1, canvas.save_count_); EXPECT_EQ(1, canvas.restore_count_); } // Test that the save/draw/restore optimization applies if the single op // is a DrawRecord that itself has a single draw op. TEST(PaintOpBufferTest, SaveDrawRestore_SingleOpRecordWithSingleOp) { sk_sp<PaintRecord> record = sk_make_sp<PaintRecord>(); PaintFlags draw_flags; draw_flags.setColor(SK_ColorMAGENTA); draw_flags.setAlpha(50); EXPECT_TRUE(draw_flags.SupportsFoldingAlpha()); SkRect rect = SkRect::MakeXYWH(1, 2, 3, 4); record->push<DrawRectOp>(rect, draw_flags); EXPECT_EQ(record->size(), 1u); PaintOpBuffer buffer; uint8_t alpha = 100; buffer.push<SaveLayerAlphaOp>(nullptr, alpha); buffer.push<DrawRecordOp>(std::move(record)); buffer.push<RestoreOp>(); SaveCountingCanvas canvas; buffer.Playback(&canvas); EXPECT_EQ(0, canvas.save_count_); EXPECT_EQ(0, canvas.restore_count_); EXPECT_EQ(rect, canvas.draw_rect_); float expected_alpha = alpha * 50 / 255.f; EXPECT_LE(std::abs(expected_alpha - canvas.paint_.getAlpha()), 1.f); } // The same as the above SingleOpRecord test, but the single op is not // a draw op. So, there's no way to fold in the save layer optimization. // Verify that the optimization doesn't apply and that this doesn't crash. // See: http://crbug.com/712093. TEST(PaintOpBufferTest, SaveDrawRestore_SingleOpRecordWithSingleNonDrawOp) { sk_sp<PaintRecord> record = sk_make_sp<PaintRecord>(); record->push<NoopOp>(); EXPECT_EQ(record->size(), 1u); EXPECT_FALSE(record->GetFirstOp()->IsDrawOp()); PaintOpBuffer buffer; uint8_t alpha = 100; buffer.push<SaveLayerAlphaOp>(nullptr, alpha); buffer.push<DrawRecordOp>(std::move(record)); buffer.push<RestoreOp>(); SaveCountingCanvas canvas; buffer.Playback(&canvas); EXPECT_EQ(1, canvas.save_count_); EXPECT_EQ(1, canvas.restore_count_); } TEST(PaintOpBufferTest, SaveLayerRestore_DrawColor) { PaintOpBuffer buffer; uint8_t alpha = 100; SkColor original = SkColorSetA(50, SK_ColorRED); buffer.push<SaveLayerAlphaOp>(nullptr, alpha); buffer.push<DrawColorOp>(original, SkBlendMode::kSrcOver); buffer.push<RestoreOp>(); SaveCountingCanvas canvas; buffer.Playback(&canvas); EXPECT_EQ(canvas.save_count_, 0); EXPECT_EQ(canvas.restore_count_, 0); uint8_t expected_alpha = SkMulDiv255Round(alpha, SkColorGetA(original)); EXPECT_EQ(canvas.paint_.getColor(), SkColorSetA(original, expected_alpha)); } TEST(PaintOpBufferTest, DiscardableImagesTracking_EmptyBuffer) { PaintOpBuffer buffer; EXPECT_FALSE(buffer.HasDiscardableImages()); } TEST(PaintOpBufferTest, DiscardableImagesTracking_NoImageOp) { PaintOpBuffer buffer; PaintFlags flags; buffer.push<DrawRectOp>(SkRect::MakeWH(100, 100), flags); EXPECT_FALSE(buffer.HasDiscardableImages()); } TEST(PaintOpBufferTest, DiscardableImagesTracking_DrawImage) { PaintOpBuffer buffer; PaintImage image = CreateDiscardablePaintImage(gfx::Size(100, 100)); buffer.push<DrawImageOp>(image, SkIntToScalar(0), SkIntToScalar(0)); EXPECT_TRUE(buffer.HasDiscardableImages()); } TEST(PaintOpBufferTest, DiscardableImagesTracking_PaintWorkletImage) { scoped_refptr<TestPaintWorkletInput> input = base::MakeRefCounted<TestPaintWorkletInput>(gfx::SizeF(32.0f, 32.0f)); PaintOpBuffer buffer; PaintImage image = CreatePaintWorkletPaintImage(input); buffer.push<DrawImageOp>(image, SkIntToScalar(0), SkIntToScalar(0)); EXPECT_TRUE(buffer.HasDiscardableImages()); } TEST(PaintOpBufferTest, DiscardableImagesTracking_PaintWorkletImageRect) { scoped_refptr<TestPaintWorkletInput> input = base::MakeRefCounted<TestPaintWorkletInput>(gfx::SizeF(32.0f, 32.0f)); PaintOpBuffer buffer; PaintImage image = CreatePaintWorkletPaintImage(input); SkRect src = SkRect::MakeEmpty(); SkRect dst = SkRect::MakeEmpty(); buffer.push<DrawImageRectOp>(image, src, dst, SkCanvas::kStrict_SrcRectConstraint); EXPECT_TRUE(buffer.HasDiscardableImages()); } TEST(PaintOpBufferTest, DiscardableImagesTracking_DrawImageRect) { PaintOpBuffer buffer; PaintImage image = CreateDiscardablePaintImage(gfx::Size(100, 100)); buffer.push<DrawImageRectOp>(image, SkRect::MakeWH(100, 100), SkRect::MakeWH(100, 100), SkCanvas::kFast_SrcRectConstraint); EXPECT_TRUE(buffer.HasDiscardableImages()); } TEST(PaintOpBufferTest, DiscardableImagesTracking_OpWithFlags) { PaintOpBuffer buffer; PaintFlags flags; auto image = CreateDiscardablePaintImage(gfx::Size(100, 100)); flags.setShader(PaintShader::MakeImage(std::move(image), SkTileMode::kClamp, SkTileMode::kClamp, nullptr)); buffer.push<DrawRectOp>(SkRect::MakeWH(100, 100), flags); EXPECT_TRUE(buffer.HasDiscardableImages()); } TEST(PaintOpBufferTest, SlowPaths) { auto buffer = sk_make_sp<PaintOpBuffer>(); EXPECT_EQ(buffer->numSlowPaths(), 0); // Op without slow paths PaintFlags noop_flags; SkRect rect = SkRect::MakeXYWH(2, 3, 4, 5); buffer->push<SaveLayerOp>(&rect, &noop_flags); // Line op with a slow path PaintFlags line_effect_slow; line_effect_slow.setStrokeWidth(1.f); line_effect_slow.setStyle(PaintFlags::kStroke_Style); line_effect_slow.setStrokeCap(PaintFlags::kRound_Cap); SkScalar intervals[] = {1.f, 1.f}; line_effect_slow.setPathEffect(SkDashPathEffect::Make(intervals, 2, 0)); buffer->push<DrawLineOp>(1.f, 2.f, 3.f, 4.f, line_effect_slow); EXPECT_EQ(buffer->numSlowPaths(), 1); // Line effect special case that Skia handles specially. PaintFlags line_effect = line_effect_slow; line_effect.setStrokeCap(PaintFlags::kButt_Cap); buffer->push<DrawLineOp>(1.f, 2.f, 3.f, 4.f, line_effect); EXPECT_EQ(buffer->numSlowPaths(), 1); // Antialiased convex path is not slow. SkPath path; path.addCircle(2, 2, 5); EXPECT_TRUE(path.isConvex()); buffer->push<ClipPathOp>(path, SkClipOp::kIntersect, /*antialias=*/true, UsePaintCache::kDisabled); EXPECT_EQ(buffer->numSlowPaths(), 1); // Concave paths are slow only when antialiased. SkPath concave = path; concave.addCircle(3, 4, 2); EXPECT_FALSE(concave.isConvex()); buffer->push<ClipPathOp>(concave, SkClipOp::kIntersect, /*antialias=*/true, UsePaintCache::kDisabled); EXPECT_EQ(buffer->numSlowPaths(), 2); buffer->push<ClipPathOp>(concave, SkClipOp::kIntersect, /*antialias=*/false, UsePaintCache::kDisabled); EXPECT_EQ(buffer->numSlowPaths(), 2); // Drawing a record with slow paths into another adds the same // number of slow paths as the record. auto buffer2 = sk_make_sp<PaintOpBuffer>(); EXPECT_EQ(0, buffer2->numSlowPaths()); buffer2->push<DrawRecordOp>(buffer); EXPECT_EQ(2, buffer2->numSlowPaths()); buffer2->push<DrawRecordOp>(buffer); EXPECT_EQ(4, buffer2->numSlowPaths()); } TEST(PaintOpBufferTest, NonAAPaint) { // PaintOpWithFlags { auto buffer = sk_make_sp<PaintOpBuffer>(); EXPECT_FALSE(buffer->HasNonAAPaint()); // Add a PaintOpWithFlags (in this case a line) with AA. PaintFlags line_effect; line_effect.setAntiAlias(true); buffer->push<DrawLineOp>(1.f, 2.f, 3.f, 4.f, line_effect); EXPECT_FALSE(buffer->HasNonAAPaint()); // Add a PaintOpWithFlags (in this case a line) without AA. PaintFlags line_effect_no_aa; line_effect_no_aa.setAntiAlias(false); buffer->push<DrawLineOp>(1.f, 2.f, 3.f, 4.f, line_effect_no_aa); EXPECT_TRUE(buffer->HasNonAAPaint()); } // ClipPathOp { auto buffer = sk_make_sp<PaintOpBuffer>(); EXPECT_FALSE(buffer->HasNonAAPaint()); SkPath path; path.addCircle(2, 2, 5); // ClipPathOp with AA buffer->push<ClipPathOp>(path, SkClipOp::kIntersect, /*antialias=*/true, UsePaintCache::kDisabled); EXPECT_FALSE(buffer->HasNonAAPaint()); // ClipPathOp without AA buffer->push<ClipPathOp>(path, SkClipOp::kIntersect, /*antialias=*/false, UsePaintCache::kDisabled); EXPECT_TRUE(buffer->HasNonAAPaint()); } // ClipRRectOp { auto buffer = sk_make_sp<PaintOpBuffer>(); EXPECT_FALSE(buffer->HasNonAAPaint()); // ClipRRectOp with AA buffer->push<ClipRRectOp>(SkRRect::MakeEmpty(), SkClipOp::kIntersect, true /* antialias */); EXPECT_FALSE(buffer->HasNonAAPaint()); // ClipRRectOp without AA buffer->push<ClipRRectOp>(SkRRect::MakeEmpty(), SkClipOp::kIntersect, false /* antialias */); EXPECT_TRUE(buffer->HasNonAAPaint()); } // Drawing a record with non-aa paths into another propogates the value. { auto buffer = sk_make_sp<PaintOpBuffer>(); EXPECT_FALSE(buffer->HasNonAAPaint()); auto sub_buffer = sk_make_sp<PaintOpBuffer>(); SkPath path; path.addCircle(2, 2, 5); sub_buffer->push<ClipPathOp>(path, SkClipOp::kIntersect, /*antialias=*/false, UsePaintCache::kDisabled); EXPECT_TRUE(sub_buffer->HasNonAAPaint()); buffer->push<DrawRecordOp>(sub_buffer); EXPECT_TRUE(buffer->HasNonAAPaint()); } // The following PaintOpWithFlags types are overridden to *not* ever have // non-AA paint. AA is hard to notice, and these kick us out of MSAA in too // many cases. // DrawImageOp { auto buffer = sk_make_sp<PaintOpBuffer>(); EXPECT_FALSE(buffer->HasNonAAPaint()); PaintImage image = CreateDiscardablePaintImage(gfx::Size(100, 100)); PaintFlags non_aa_flags; non_aa_flags.setAntiAlias(true); buffer->push<DrawImageOp>(image, SkIntToScalar(0), SkIntToScalar(0), SkSamplingOptions(), &non_aa_flags); EXPECT_FALSE(buffer->HasNonAAPaint()); } // DrawIRectOp { auto buffer = sk_make_sp<PaintOpBuffer>(); EXPECT_FALSE(buffer->HasNonAAPaint()); PaintFlags non_aa_flags; non_aa_flags.setAntiAlias(true); buffer->push<DrawIRectOp>(SkIRect::MakeWH(1, 1), non_aa_flags); EXPECT_FALSE(buffer->HasNonAAPaint()); } // SaveLayerOp { auto buffer = sk_make_sp<PaintOpBuffer>(); EXPECT_FALSE(buffer->HasNonAAPaint()); PaintFlags non_aa_flags; non_aa_flags.setAntiAlias(true); auto bounds = SkRect::MakeWH(1, 1); buffer->push<SaveLayerOp>(&bounds, &non_aa_flags); EXPECT_FALSE(buffer->HasNonAAPaint()); } } class PaintOpBufferOffsetsTest : public ::testing::Test { public: void SetUp() override {} void TearDown() override { offsets_.clear(); buffer_.Reset(); } template <typename T, typename... Args> void push_op(Args&&... args) { offsets_.push_back(buffer_.next_op_offset()); buffer_.push<T>(std::forward<Args>(args)...); } // Returns a subset of offsets_ by selecting only the specified indices. std::vector<size_t> Select(const std::vector<size_t>& indices) { std::vector<size_t> result; for (size_t i : indices) result.push_back(offsets_[i]); return result; } void Playback(SkCanvas* canvas, const std::vector<size_t>& offsets) { buffer_.Playback(canvas, PlaybackParams(nullptr), &offsets); } protected: std::vector<size_t> offsets_; PaintOpBuffer buffer_; }; TEST_F(PaintOpBufferOffsetsTest, EmptyClipRectShouldRejectAnOp) { SkCanvas device(0, 0); SkCanvas* canvas = &device; canvas->translate(-254, 0); SkIRect bounds = canvas->getDeviceClipBounds(); EXPECT_TRUE(bounds.isEmpty()); SkMatrix ctm = canvas->getTotalMatrix(); EXPECT_EQ(ctm[2], -254); scoped_refptr<TestPaintWorkletInput> input = base::MakeRefCounted<TestPaintWorkletInput>(gfx::SizeF(32.0f, 32.0f)); PaintImage image = CreatePaintWorkletPaintImage(input); SkRect src = SkRect::MakeLTRB(0, 0, 100, 100); SkRect dst = SkRect::MakeLTRB(168, -23, 268, 77); push_op<DrawImageRectOp>(image, src, dst, SkCanvas::kStrict_SrcRectConstraint); std::vector<size_t> offsets = Select({0}); for (PaintOpBuffer::PlaybackFoldingIterator iter(&buffer_, &offsets); iter; ++iter) { const PaintOp* op = *iter; EXPECT_EQ(op->GetType(), PaintOpType::DrawImageRect); EXPECT_TRUE(PaintOp::QuickRejectDraw(op, canvas)); } } TEST_F(PaintOpBufferOffsetsTest, ContiguousIndices) { testing::StrictMock<MockCanvas> canvas; push_op<DrawColorOp>(0u, SkBlendMode::kClear); push_op<DrawColorOp>(1u, SkBlendMode::kClear); push_op<DrawColorOp>(2u, SkBlendMode::kClear); push_op<DrawColorOp>(3u, SkBlendMode::kClear); push_op<DrawColorOp>(4u, SkBlendMode::kClear); // Plays all items. testing::Sequence s; EXPECT_CALL(canvas, OnDrawPaintWithColor(0u)).InSequence(s); EXPECT_CALL(canvas, OnDrawPaintWithColor(1u)).InSequence(s); EXPECT_CALL(canvas, OnDrawPaintWithColor(2u)).InSequence(s); EXPECT_CALL(canvas, OnDrawPaintWithColor(3u)).InSequence(s); EXPECT_CALL(canvas, OnDrawPaintWithColor(4u)).InSequence(s); Playback(&canvas, Select({0, 1, 2, 3, 4})); } TEST_F(PaintOpBufferOffsetsTest, NonContiguousIndices) { testing::StrictMock<MockCanvas> canvas; push_op<DrawColorOp>(0u, SkBlendMode::kClear); push_op<DrawColorOp>(1u, SkBlendMode::kClear); push_op<DrawColorOp>(2u, SkBlendMode::kClear); push_op<DrawColorOp>(3u, SkBlendMode::kClear); push_op<DrawColorOp>(4u, SkBlendMode::kClear); // Plays 0, 1, 3, 4 indices. testing::Sequence s; EXPECT_CALL(canvas, OnDrawPaintWithColor(0u)).InSequence(s); EXPECT_CALL(canvas, OnDrawPaintWithColor(1u)).InSequence(s); EXPECT_CALL(canvas, OnDrawPaintWithColor(3u)).InSequence(s); EXPECT_CALL(canvas, OnDrawPaintWithColor(4u)).InSequence(s); Playback(&canvas, Select({0, 1, 3, 4})); } TEST_F(PaintOpBufferOffsetsTest, FirstTwoIndices) { testing::StrictMock<MockCanvas> canvas; push_op<DrawColorOp>(0u, SkBlendMode::kClear); push_op<DrawColorOp>(1u, SkBlendMode::kClear); push_op<DrawColorOp>(2u, SkBlendMode::kClear); push_op<DrawColorOp>(3u, SkBlendMode::kClear); push_op<DrawColorOp>(4u, SkBlendMode::kClear); // Plays first two indices. testing::Sequence s; EXPECT_CALL(canvas, OnDrawPaintWithColor(0u)).InSequence(s); EXPECT_CALL(canvas, OnDrawPaintWithColor(1u)).InSequence(s); Playback(&canvas, Select({0, 1})); } TEST_F(PaintOpBufferOffsetsTest, MiddleIndex) { testing::StrictMock<MockCanvas> canvas; push_op<DrawColorOp>(0u, SkBlendMode::kClear); push_op<DrawColorOp>(1u, SkBlendMode::kClear); push_op<DrawColorOp>(2u, SkBlendMode::kClear); push_op<DrawColorOp>(3u, SkBlendMode::kClear); push_op<DrawColorOp>(4u, SkBlendMode::kClear); // Plays index 2. testing::Sequence s; EXPECT_CALL(canvas, OnDrawPaintWithColor(2u)).InSequence(s); Playback(&canvas, Select({2})); } TEST_F(PaintOpBufferOffsetsTest, LastTwoElements) { testing::StrictMock<MockCanvas> canvas; push_op<DrawColorOp>(0u, SkBlendMode::kClear); push_op<DrawColorOp>(1u, SkBlendMode::kClear); push_op<DrawColorOp>(2u, SkBlendMode::kClear); push_op<DrawColorOp>(3u, SkBlendMode::kClear); push_op<DrawColorOp>(4u, SkBlendMode::kClear); // Plays last two elements. testing::Sequence s; EXPECT_CALL(canvas, OnDrawPaintWithColor(3u)).InSequence(s); EXPECT_CALL(canvas, OnDrawPaintWithColor(4u)).InSequence(s); Playback(&canvas, Select({3, 4})); } TEST_F(PaintOpBufferOffsetsTest, ContiguousIndicesWithSaveLayerAlphaRestore) { testing::StrictMock<MockCanvas> canvas; push_op<DrawColorOp>(0u, SkBlendMode::kClear); push_op<DrawColorOp>(1u, SkBlendMode::kClear); uint8_t alpha = 100; push_op<SaveLayerAlphaOp>(nullptr, alpha); push_op<RestoreOp>(); push_op<DrawColorOp>(2u, SkBlendMode::kClear); push_op<DrawColorOp>(3u, SkBlendMode::kClear); push_op<DrawColorOp>(4u, SkBlendMode::kClear); // Items are {0, 1, save, restore, 2, 3, 4}. testing::Sequence s; EXPECT_CALL(canvas, OnDrawPaintWithColor(0u)).InSequence(s); EXPECT_CALL(canvas, OnDrawPaintWithColor(1u)).InSequence(s); // The empty SaveLayerAlpha/Restore is dropped. EXPECT_CALL(canvas, OnDrawPaintWithColor(2u)).InSequence(s); EXPECT_CALL(canvas, OnDrawPaintWithColor(3u)).InSequence(s); EXPECT_CALL(canvas, OnDrawPaintWithColor(4u)).InSequence(s); Playback(&canvas, Select({0, 1, 2, 3, 4, 5, 6})); Mock::VerifyAndClearExpectations(&canvas); } TEST_F(PaintOpBufferOffsetsTest, NonContiguousIndicesWithSaveLayerAlphaRestore) { testing::StrictMock<MockCanvas> canvas; push_op<DrawColorOp>(0u, SkBlendMode::kClear); push_op<DrawColorOp>(1u, SkBlendMode::kClear); uint8_t alpha = 100; push_op<SaveLayerAlphaOp>(nullptr, alpha); push_op<DrawColorOp>(2u, SkBlendMode::kClear); push_op<DrawColorOp>(3u, SkBlendMode::kClear); push_op<RestoreOp>(); push_op<DrawColorOp>(4u, SkBlendMode::kClear); // Items are {0, 1, save, 2, 3, restore, 4}. // Plays back all indices. { testing::Sequence s; EXPECT_CALL(canvas, OnDrawPaintWithColor(0u)).InSequence(s); EXPECT_CALL(canvas, OnDrawPaintWithColor(1u)).InSequence(s); // The SaveLayerAlpha/Restore is not dropped if we draw the middle // range, as we need them to represent the two draws inside the layer // correctly. EXPECT_CALL(canvas, OnSaveLayer()).InSequence(s); EXPECT_CALL(canvas, OnDrawPaintWithColor(2u)).InSequence(s); EXPECT_CALL(canvas, OnDrawPaintWithColor(3u)).InSequence(s); EXPECT_CALL(canvas, willRestore()).InSequence(s); EXPECT_CALL(canvas, OnDrawPaintWithColor(4u)).InSequence(s); Playback(&canvas, Select({0, 1, 2, 3, 4, 5, 6})); } Mock::VerifyAndClearExpectations(&canvas); // Skips the middle indices. { testing::Sequence s; EXPECT_CALL(canvas, OnDrawPaintWithColor(0u)).InSequence(s); EXPECT_CALL(canvas, OnDrawPaintWithColor(1u)).InSequence(s); // The now-empty SaveLayerAlpha/Restore is dropped EXPECT_CALL(canvas, OnDrawPaintWithColor(4u)).InSequence(s); Playback(&canvas, Select({0, 1, 2, 5, 6})); } Mock::VerifyAndClearExpectations(&canvas); } TEST_F(PaintOpBufferOffsetsTest, ContiguousIndicesWithSaveLayerAlphaDrawRestore) { testing::StrictMock<MockCanvas> canvas; auto add_draw_rect = [this](SkColor c) { PaintFlags flags; flags.setColor(c); push_op<DrawRectOp>(SkRect::MakeWH(1, 1), flags); }; add_draw_rect(0u); add_draw_rect(1u); uint8_t alpha = 100; push_op<SaveLayerAlphaOp>(nullptr, alpha); add_draw_rect(2u); push_op<RestoreOp>(); add_draw_rect(3u); add_draw_rect(4u); // Items are {0, 1, save, 2, restore, 3, 4}. testing::Sequence s; EXPECT_CALL(canvas, OnDrawRectWithColor(0u)).InSequence(s); EXPECT_CALL(canvas, OnDrawRectWithColor(1u)).InSequence(s); // The empty SaveLayerAlpha/Restore is dropped, the containing // operation can be drawn with alpha. EXPECT_CALL(canvas, OnDrawRectWithColor(2u)).InSequence(s); EXPECT_CALL(canvas, OnDrawRectWithColor(3u)).InSequence(s); EXPECT_CALL(canvas, OnDrawRectWithColor(4u)).InSequence(s); Playback(&canvas, Select({0, 1, 2, 3, 4, 5, 6})); Mock::VerifyAndClearExpectations(&canvas); } TEST_F(PaintOpBufferOffsetsTest, NonContiguousIndicesWithSaveLayerAlphaDrawRestore) { testing::StrictMock<MockCanvas> canvas; auto add_draw_rect = [this](SkColor c) { PaintFlags flags; flags.setColor(c); push_op<DrawRectOp>(SkRect::MakeWH(1, 1), flags); }; add_draw_rect(0u); add_draw_rect(1u); uint8_t alpha = 100; push_op<SaveLayerAlphaOp>(nullptr, alpha); add_draw_rect(2u); add_draw_rect(3u); add_draw_rect(4u); push_op<RestoreOp>(); // Items are are {0, 1, save, 2, 3, 4, restore}. // If the middle range is played, then the SaveLayerAlpha/Restore // can't be dropped. { testing::Sequence s; EXPECT_CALL(canvas, OnDrawRectWithColor(0u)).InSequence(s); EXPECT_CALL(canvas, OnDrawRectWithColor(1u)).InSequence(s); EXPECT_CALL(canvas, OnSaveLayer()).InSequence(s); EXPECT_CALL(canvas, OnDrawRectWithColor(2u)).InSequence(s); EXPECT_CALL(canvas, OnDrawRectWithColor(3u)).InSequence(s); EXPECT_CALL(canvas, OnDrawRectWithColor(4u)).InSequence(s); EXPECT_CALL(canvas, willRestore()).InSequence(s); Playback(&canvas, Select({0, 1, 2, 3, 4, 5, 6})); } Mock::VerifyAndClearExpectations(&canvas); // If the middle range is not played, then the SaveLayerAlpha/Restore // can be dropped. { testing::Sequence s; EXPECT_CALL(canvas, OnDrawRectWithColor(0u)).InSequence(s); EXPECT_CALL(canvas, OnDrawRectWithColor(1u)).InSequence(s); EXPECT_CALL(canvas, OnDrawRectWithColor(4u)).InSequence(s); Playback(&canvas, Select({0, 1, 2, 5, 6})); } Mock::VerifyAndClearExpectations(&canvas); // If the middle range is not played, then the SaveLayerAlpha/Restore // can be dropped. { testing::Sequence s; EXPECT_CALL(canvas, OnDrawRectWithColor(0u)).InSequence(s); EXPECT_CALL(canvas, OnDrawRectWithColor(1u)).InSequence(s); EXPECT_CALL(canvas, OnDrawRectWithColor(2u)).InSequence(s); Playback(&canvas, Select({0, 1, 2, 3, 6})); } } TEST(PaintOpBufferTest, SaveLayerAlphaDrawRestoreWithBadBlendMode) { PaintOpBuffer buffer; testing::StrictMock<MockCanvas> canvas; auto add_draw_rect = [](PaintOpBuffer* buffer, SkColor c) { PaintFlags flags; flags.setColor(c); // This blend mode prevents the optimization. flags.setBlendMode(SkBlendMode::kSrc); buffer->push<DrawRectOp>(SkRect::MakeWH(1, 1), flags); }; add_draw_rect(&buffer, 0u); uint8_t alpha = 100; buffer.push<SaveLayerAlphaOp>(nullptr, alpha); add_draw_rect(&buffer, 1u); buffer.push<RestoreOp>(); add_draw_rect(&buffer, 2u); { testing::Sequence s; EXPECT_CALL(canvas, OnDrawRectWithColor(0u)).InSequence(s); EXPECT_CALL(canvas, OnSaveLayer()).InSequence(s); EXPECT_CALL(canvas, OnDrawRectWithColor(1u)).InSequence(s); EXPECT_CALL(canvas, willRestore()).InSequence(s); EXPECT_CALL(canvas, OnDrawRectWithColor(2u)).InSequence(s); buffer.Playback(&canvas); } } TEST(PaintOpBufferTest, UnmatchedSaveRestoreNoSideEffects) { PaintOpBuffer buffer; testing::StrictMock<MockCanvas> canvas; auto add_draw_rect = [](PaintOpBuffer* buffer, SkColor c) { PaintFlags flags; flags.setColor(c); buffer->push<DrawRectOp>(SkRect::MakeWH(1, 1), flags); }; // Push 2 saves. uint8_t alpha = 100; buffer.push<SaveLayerAlphaOp>(nullptr, alpha); add_draw_rect(&buffer, 0u); buffer.push<SaveLayerAlphaOp>(nullptr, alpha); add_draw_rect(&buffer, 1u); add_draw_rect(&buffer, 2u); // But only 1 restore. buffer.push<RestoreOp>(); testing::Sequence s; EXPECT_CALL(canvas, OnSaveLayer()).InSequence(s); EXPECT_CALL(canvas, OnDrawRectWithColor(0u)).InSequence(s); EXPECT_CALL(canvas, OnSaveLayer()).InSequence(s); EXPECT_CALL(canvas, OnDrawRectWithColor(1u)).InSequence(s); EXPECT_CALL(canvas, OnDrawRectWithColor(2u)).InSequence(s); EXPECT_CALL(canvas, willRestore()).InSequence(s); // We will restore back to the original save count regardless with 2 restores. EXPECT_CALL(canvas, willRestore()).InSequence(s); buffer.Playback(&canvas); } std::vector<float> test_floats = {0.f, 1.f, -1.f, 2384.981971f, 0.0001f, std::numeric_limits<float>::min(), std::numeric_limits<float>::max(), std::numeric_limits<float>::infinity()}; std::vector<uint8_t> test_uint8s = { 0, 255, 128, 10, 45, }; static SkRect make_largest_skrect() { const float limit = std::numeric_limits<float>::max(); return {-limit, -limit, limit, limit}; } static SkIRect make_largest_skirect() { // we use half the limit, so that the resulting width/height will not // overflow. const int32_t limit = std::numeric_limits<int32_t>::max() >> 1; return {-limit, -limit, limit, limit}; } std::vector<SkRect> test_rects = { SkRect::MakeXYWH(1, 2.5, 3, 4), SkRect::MakeXYWH(0, 0, 0, 0), make_largest_skrect(), SkRect::MakeXYWH(0.5f, 0.5f, 8.2f, 8.2f), SkRect::MakeXYWH(-1, -1, 0, 0), SkRect::MakeXYWH(-100, -101, -102, -103), SkRect::MakeXYWH(0, 0, 0, 0), SkRect::MakeXYWH(0, 0, 0, 0), SkRect::MakeXYWH(0, 0, 0, 0), SkRect::MakeXYWH(0, 0, 0, 0), SkRect::MakeXYWH(0, 0, 0, 0), SkRect::MakeXYWH(0, 0, 0, 0), }; std::vector<SkRRect> test_rrects = { SkRRect::MakeEmpty(), SkRRect::MakeOval(SkRect::MakeXYWH(1, 2, 3, 4)), SkRRect::MakeRect(SkRect::MakeXYWH(-10, 100, 5, 4)), [] { SkRRect rrect = SkRRect::MakeEmpty(); rrect.setNinePatch(SkRect::MakeXYWH(10, 20, 30, 40), 1, 2, 3, 4); return rrect; }(), }; std::vector<SkIRect> test_irects = { SkIRect::MakeXYWH(1, 2, 3, 4), SkIRect::MakeXYWH(0, 0, 0, 0), make_largest_skirect(), SkIRect::MakeXYWH(0, 0, 10, 10), SkIRect::MakeXYWH(-1, -1, 0, 0), SkIRect::MakeXYWH(-100, -101, -102, -103)}; std::vector<uint32_t> test_ids = {0, 1, 56, 0xFFFFFFFF, 0xFFFFFFFE, 0x10001}; std::vector<SkM44> test_matrices = { SkM44(), SkM44::Scale(3.91f, 4.31f, 1.0f), SkM44::Translate(-5.2f, 8.7f, 0.0f), SkM44(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), SkM44(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16), }; std::vector<SkPath> test_paths = { [] { SkPath path; path.moveTo(SkIntToScalar(20), SkIntToScalar(20)); path.lineTo(SkIntToScalar(80), SkIntToScalar(20)); path.lineTo(SkIntToScalar(30), SkIntToScalar(30)); path.lineTo(SkIntToScalar(20), SkIntToScalar(80)); return path; }(), [] { SkPath path; path.addCircle(2, 2, 5); path.addCircle(3, 4, 2); path.addArc(SkRect::MakeXYWH(1, 2, 3, 4), 5, 6); return path; }(), SkPath(), }; std::vector<PaintFlags> test_flags = { PaintFlags(), [] { PaintFlags flags; flags.setColor(SK_ColorMAGENTA); flags.setStrokeWidth(4.2f); flags.setStrokeMiter(5.91f); flags.setBlendMode(SkBlendMode::kDst); flags.setStrokeCap(PaintFlags::kSquare_Cap); flags.setStrokeJoin(PaintFlags::kBevel_Join); flags.setStyle(PaintFlags::kStroke_Style); flags.setFilterQuality(PaintFlags::FilterQuality::kMedium); flags.setShader(PaintShader::MakeColor(SkColorSetARGB(1, 2, 3, 4))); return flags; }(), [] { PaintFlags flags; flags.setColor(SK_ColorCYAN); flags.setAlpha(103); flags.setStrokeWidth(0.32f); flags.setStrokeMiter(7.98f); flags.setBlendMode(SkBlendMode::kSrcOut); flags.setStrokeCap(PaintFlags::kRound_Cap); flags.setStrokeJoin(PaintFlags::kRound_Join); flags.setStyle(PaintFlags::kFill_Style); flags.setFilterQuality(PaintFlags::FilterQuality::kHigh); SkScalar intervals[] = {1.f, 1.f}; flags.setPathEffect(SkDashPathEffect::Make(intervals, 2, 0)); flags.setMaskFilter(SkMaskFilter::MakeBlur( SkBlurStyle::kOuter_SkBlurStyle, 4.3f)); flags.setColorFilter(SkColorMatrixFilter::MakeLightingFilter( SK_ColorYELLOW, SK_ColorGREEN)); SkLayerDrawLooper::Builder looper_builder; looper_builder.addLayer(); looper_builder.addLayer(2.3f, 4.5f); SkLayerDrawLooper::LayerInfo layer_info; layer_info.fPaintBits |= SkLayerDrawLooper::kMaskFilter_Bit; layer_info.fColorMode = SkBlendMode::kDst; layer_info.fOffset.set(-1.f, 5.2f); looper_builder.addLayer(layer_info); flags.setLooper(looper_builder.detach()); sk_sp<PaintShader> shader = PaintShader::MakeColor(SK_ColorTRANSPARENT); PaintOpSerializationTestUtils::FillArbitraryShaderValues(shader.get(), true); flags.setShader(std::move(shader)); return flags; }(), [] { PaintFlags flags; flags.setShader(PaintShader::MakeColor(SkColorSetARGB(12, 34, 56, 78))); return flags; }(), [] { PaintFlags flags; sk_sp<PaintShader> shader = PaintShader::MakeColor(SK_ColorTRANSPARENT); PaintOpSerializationTestUtils::FillArbitraryShaderValues(shader.get(), false); flags.setShader(std::move(shader)); return flags; }(), [] { PaintFlags flags; SkPoint points[2] = {SkPoint::Make(1, 2), SkPoint::Make(3, 4)}; SkColor colors[3] = {SkColorSetARGB(1, 2, 3, 4), SkColorSetARGB(4, 3, 2, 1), SkColorSetARGB(0, 10, 20, 30)}; SkScalar positions[3] = {0.f, 0.3f, 1.f}; flags.setShader(PaintShader::MakeLinearGradient(points, colors, positions, 3, SkTileMode::kMirror)); return flags; }(), [] { PaintFlags flags; SkColor colors[3] = {SkColorSetARGB(1, 2, 3, 4), SkColorSetARGB(4, 3, 2, 1), SkColorSetARGB(0, 10, 20, 30)}; flags.setShader(PaintShader::MakeSweepGradient( 0.2f, -0.8f, colors, nullptr, 3, SkTileMode::kMirror, 10, 20)); return flags; }(), PaintFlags(), PaintFlags(), }; std::vector<SkColor> test_colors = { SkColorSetARGB(0, 0, 0, 0), SkColorSetARGB(255, 255, 255, 255), SkColorSetARGB(0, 255, 10, 255), SkColorSetARGB(255, 0, 20, 255), SkColorSetARGB(30, 255, 0, 255), SkColorSetARGB(255, 40, 0, 0), }; std::vector<std::string> test_strings = { "", "foobar", "blarbideeblarasdfaiousydfp234poiausdofiuapsodfjknla;sdfkjasd;f", }; std::vector<std::vector<SkPoint>> test_point_arrays = { std::vector<SkPoint>(), {SkPoint::Make(1, 2)}, {SkPoint::Make(1, 2), SkPoint::Make(-5.4f, -3.8f)}, {SkPoint::Make(0, 0), SkPoint::Make(5, 6), SkPoint::Make(-1, -1), SkPoint::Make(9, 9), SkPoint::Make(50, 50), SkPoint::Make(100, 100)}, }; // TODO(enne): In practice, probably all paint images need to be uploaded // ahead of time and not be bitmaps. These paint images should be fake // gpu resource paint images. std::vector<PaintImage> test_images = { CreateDiscardablePaintImage(gfx::Size(5, 10)), CreateDiscardablePaintImage(gfx::Size(1, 1)), CreateDiscardablePaintImage(gfx::Size(50, 50)), }; #if BUILDFLAG(SKIA_SUPPORT_SKOTTIE) bool kIsSkottieSupported = true; std::vector<scoped_refptr<SkottieWrapper>> test_skotties = { CreateSkottie(gfx::Size(10, 20), 4), CreateSkottie(gfx::Size(100, 40), 5), CreateSkottie(gfx::Size(80, 70), 6), CreateSkottieFromString(kLottieDataWith2Assets)}; std::vector<float> test_skottie_floats = {0, 0.1f, 1.f, 0.2f}; std::vector<SkRect> test_skottie_rects = { SkRect::MakeXYWH(10, 20, 30, 40), SkRect::MakeXYWH(0, 5, 10, 20), SkRect::MakeXYWH(6, 0, 3, 50), SkRect::MakeXYWH(10, 10, 100, 100)}; #else bool kIsSkottieSupported = false; std::vector<scoped_refptr<SkottieWrapper>> test_skotties; std::vector<float> test_skottie_floats; std::vector<SkRect> test_skottie_rects; #endif // Writes as many ops in |buffer| as can fit in |output_size| to |output|. // Records the numbers of bytes written for each op. class SimpleSerializer { public: SimpleSerializer(void* output, size_t output_size) : current_(static_cast<char*>(output)), output_size_(output_size), remaining_(output_size) {} void Serialize(const PaintOpBuffer& buffer) { bytes_written_.resize(buffer.size()); for (size_t i = 0; i < buffer.size(); ++i) bytes_written_[i] = 0; size_t op_idx = 0; for (const auto* op : PaintOpBuffer::Iterator(&buffer)) { size_t bytes_written = op->Serialize( current_, remaining_, options_provider_.serialize_options(), nullptr, SkM44(), SkM44()); if (!bytes_written) return; PaintOp* written = reinterpret_cast<PaintOp*>(current_.get()); EXPECT_EQ(op->GetType(), written->GetType()); EXPECT_EQ(bytes_written, written->skip); bytes_written_[op_idx] = bytes_written; op_idx++; current_ += bytes_written; remaining_ -= bytes_written; // Number of bytes bytes_written must be a multiple of PaintOpAlign // unless the buffer is filled entirely. if (remaining_ != 0u) DCHECK_EQ(0u, bytes_written % PaintOpBuffer::PaintOpAlign); } } const std::vector<size_t>& bytes_written() const { return bytes_written_; } size_t TotalBytesWritten() const { return output_size_ - remaining_; } TestOptionsProvider* options_provider() { return &options_provider_; } private: raw_ptr<char> current_ = nullptr; size_t output_size_ = 0u; size_t remaining_ = 0u; std::vector<size_t> bytes_written_; TestOptionsProvider options_provider_; }; class DeserializerIterator { public: DeserializerIterator(const void* input, size_t input_size, const PaintOp::DeserializeOptions& options) : DeserializerIterator(input, static_cast<const char*>(input), input_size, input_size, options) {} DeserializerIterator(DeserializerIterator&&) = default; DeserializerIterator& operator=(DeserializerIterator&&) = default; ~DeserializerIterator() { DestroyDeserializedOp(); } DeserializerIterator begin() { return DeserializerIterator(input_, static_cast<const char*>(input_), input_size_, input_size_, options_); } DeserializerIterator end() { return DeserializerIterator(input_, static_cast<const char*>(input_) + input_size_, input_size_, 0, options_); } bool operator!=(const DeserializerIterator& other) { return input_ != other.input_ || current_ != other.current_ || input_size_ != other.input_size_ || remaining_ != other.remaining_; } DeserializerIterator& operator++() { CHECK_GE(remaining_, last_bytes_read_); current_ += last_bytes_read_; remaining_ -= last_bytes_read_; if (remaining_ > 0) CHECK_GE(remaining_, 4u); DeserializeCurrentOp(); return *this; } operator bool() const { return remaining_ == 0u; } const PaintOp* operator->() const { return deserialized_op_; } const PaintOp* operator*() const { return deserialized_op_; } private: DeserializerIterator(const void* input, const char* current, size_t input_size, size_t remaining, const PaintOp::DeserializeOptions& options) : input_(input), current_(current), input_size_(input_size), remaining_(remaining), options_(options) { data_.reset(static_cast<char*>(base::AlignedAlloc( sizeof(LargestPaintOp), PaintOpBuffer::PaintOpAlign))); DeserializeCurrentOp(); } void DestroyDeserializedOp() { if (!deserialized_op_) return; deserialized_op_->DestroyThis(); deserialized_op_ = nullptr; } void DeserializeCurrentOp() { DestroyDeserializedOp(); if (!remaining_) return; deserialized_op_ = PaintOp::Deserialize(current_, remaining_, data_.get(), sizeof(LargestPaintOp), &last_bytes_read_, options_); } raw_ptr<const void> input_ = nullptr; const char* current_ = nullptr; size_t input_size_ = 0u; size_t remaining_ = 0u; size_t last_bytes_read_ = 0u; PaintOp::DeserializeOptions options_; std::unique_ptr<char, base::AlignedFreeDeleter> data_; raw_ptr<PaintOp> deserialized_op_ = nullptr; }; void PushAnnotateOps(PaintOpBuffer* buffer) { buffer->push<AnnotateOp>(PaintCanvas::AnnotationType::URL, test_rects[0], SkData::MakeWithCString("thingerdoowhatchamagig")); // Deliberately test both null and empty SkData. buffer->push<AnnotateOp>(PaintCanvas::AnnotationType::LINK_TO_DESTINATION, test_rects[1], nullptr); buffer->push<AnnotateOp>(PaintCanvas::AnnotationType::NAMED_DESTINATION, test_rects[2], SkData::MakeEmpty()); ValidateOps<AnnotateOp>(buffer); } void PushClipPathOps(PaintOpBuffer* buffer) { for (size_t i = 0; i < test_paths.size(); ++i) { SkClipOp op = i % 3 ? SkClipOp::kDifference : SkClipOp::kIntersect; buffer->push<ClipPathOp>(test_paths[i], op, /*antialias=*/!!(i % 2), UsePaintCache::kDisabled); } ValidateOps<ClipPathOp>(buffer); } void PushClipRectOps(PaintOpBuffer* buffer) { for (size_t i = 0; i < test_rects.size(); ++i) { SkClipOp op = i % 2 ? SkClipOp::kIntersect : SkClipOp::kDifference; bool antialias = !!(i % 3); buffer->push<ClipRectOp>(test_rects[i], op, antialias); } ValidateOps<ClipRectOp>(buffer); } void PushClipRRectOps(PaintOpBuffer* buffer) { for (size_t i = 0; i < test_rrects.size(); ++i) { SkClipOp op = i % 2 ? SkClipOp::kIntersect : SkClipOp::kDifference; bool antialias = !!(i % 3); buffer->push<ClipRRectOp>(test_rrects[i], op, antialias); } ValidateOps<ClipRRectOp>(buffer); } void PushConcatOps(PaintOpBuffer* buffer) { for (auto& test_matrix : test_matrices) buffer->push<ConcatOp>(test_matrix); ValidateOps<ConcatOp>(buffer); } void PushCustomDataOps(PaintOpBuffer* buffer) { for (size_t i = 0; i < test_ids.size(); ++i) buffer->push<CustomDataOp>(test_ids[i]); ValidateOps<CustomDataOp>(buffer); } void PushDrawColorOps(PaintOpBuffer* buffer) { for (size_t i = 0; i < test_colors.size(); ++i) { buffer->push<DrawColorOp>(test_colors[i], static_cast<SkBlendMode>(i)); } ValidateOps<DrawColorOp>(buffer); } void PushDrawDRRectOps(PaintOpBuffer* buffer) { size_t len = std::min(test_rrects.size() - 1, test_flags.size()); for (size_t i = 0; i < len; ++i) { buffer->push<DrawDRRectOp>(test_rrects[i], test_rrects[i + 1], test_flags[i]); } ValidateOps<DrawDRRectOp>(buffer); } void PushDrawImageOps(PaintOpBuffer* buffer) { size_t len = std::min({test_images.size(), test_flags.size(), test_floats.size() - 1}); for (size_t i = 0; i < len; ++i) { buffer->push<DrawImageOp>(test_images[i], test_floats[i], test_floats[i + 1], PaintFlags::FilterQualityToSkSamplingOptions( test_flags[i].getFilterQuality()), &test_flags[i]); } // Test optional flags // TODO(enne): maybe all these optional ops should not be optional. buffer->push<DrawImageOp>(test_images[0], test_floats[0], test_floats[1]); ValidateOps<DrawImageOp>(buffer); } void PushDrawImageRectOps(PaintOpBuffer* buffer) { size_t len = std::min({test_images.size(), test_flags.size(), test_rects.size() - 1}); for (size_t i = 0; i < len; ++i) { SkCanvas::SrcRectConstraint constraint = i % 2 ? SkCanvas::kStrict_SrcRectConstraint : SkCanvas::kFast_SrcRectConstraint; buffer->push<DrawImageRectOp>(test_images[i], test_rects[i], test_rects[i + 1], PaintFlags::FilterQualityToSkSamplingOptions( test_flags[i].getFilterQuality()), &test_flags[i], constraint); } // Test optional flags. buffer->push<DrawImageRectOp>(test_images[0], test_rects[0], test_rects[1], SkCanvas::kStrict_SrcRectConstraint); ValidateOps<DrawImageRectOp>(buffer); } void PushDrawIRectOps(PaintOpBuffer* buffer) { size_t len = std::min(test_irects.size(), test_flags.size()); for (size_t i = 0; i < len; ++i) buffer->push<DrawIRectOp>(test_irects[i], test_flags[i]); ValidateOps<DrawIRectOp>(buffer); } void PushDrawLineOps(PaintOpBuffer* buffer) { size_t len = std::min(test_floats.size() - 3, test_flags.size()); for (size_t i = 0; i < len; ++i) { buffer->push<DrawLineOp>(test_floats[i], test_floats[i + 1], test_floats[i + 2], test_floats[i + 3], test_flags[i]); } ValidateOps<DrawLineOp>(buffer); } void PushDrawOvalOps(PaintOpBuffer* buffer) { size_t len = std::min(test_paths.size(), test_flags.size()); for (size_t i = 0; i < len; ++i) buffer->push<DrawOvalOp>(test_rects[i], test_flags[i]); ValidateOps<DrawOvalOp>(buffer); } void PushDrawPathOps(PaintOpBuffer* buffer) { size_t len = std::min(test_paths.size(), test_flags.size()); for (size_t i = 0; i < len; ++i) buffer->push<DrawPathOp>(test_paths[i], test_flags[i], UsePaintCache::kDisabled); ValidateOps<DrawPathOp>(buffer); } void PushDrawRectOps(PaintOpBuffer* buffer) { size_t len = std::min(test_rects.size(), test_flags.size()); for (size_t i = 0; i < len; ++i) buffer->push<DrawRectOp>(test_rects[i], test_flags[i]); ValidateOps<DrawRectOp>(buffer); } void PushDrawRRectOps(PaintOpBuffer* buffer) { size_t len = std::min(test_rrects.size(), test_flags.size()); for (size_t i = 0; i < len; ++i) buffer->push<DrawRRectOp>(test_rrects[i], test_flags[i]); ValidateOps<DrawRRectOp>(buffer); } SkottieFrameDataMap GetTestImagesForSkottie(SkottieWrapper& skottie, const SkRect& skottie_rect, PaintFlags::FilterQuality quality, float t) { SkottieFrameDataMap images; skottie.Seek( t, base::BindLambdaForTesting([&](SkottieResourceIdHash asset_id, float t_frame, sk_sp<SkImage>& image_out, SkSamplingOptions& sampling_out) { SkottieFrameData frame_data; frame_data.image = CreateBitmapImage( gfx::Size(skottie_rect.width() / 2, skottie_rect.height() / 2)); frame_data.quality = quality; images[asset_id] = std::move(frame_data); return SkottieWrapper::FrameDataFetchResult::NO_UPDATE; })); return images; } void PushDrawSkottieOps(PaintOpBuffer* buffer) { size_t len = std::min(test_skotties.size(), test_flags.size()); for (size_t i = 0; i < len; i++) { buffer->push<DrawSkottieOp>( test_skotties[i], test_skottie_rects[i], test_skottie_floats[i], GetTestImagesForSkottie(*test_skotties[i], test_skottie_rects[i], PaintFlags::FilterQuality::kHigh, /*t=*/0)); } ValidateOps<DrawSkottieOp>(buffer); } void PushDrawTextBlobOps(PaintOpBuffer* buffer) { static std::vector<std::vector<sk_sp<SkTypeface>>> test_typefaces = { [] { return std::vector<sk_sp<SkTypeface>>{SkTypeface::MakeDefault()}; }(), [] { return std::vector<sk_sp<SkTypeface>>{SkTypeface::MakeDefault(), SkTypeface::MakeDefault()}; }(), }; static std::vector<sk_sp<SkTextBlob>> test_paint_blobs = { [] { SkFont font; font.setTypeface(test_typefaces[0][0]); SkTextBlobBuilder builder; int glyph_count = 5; const auto& run = builder.allocRun(font, glyph_count, 1.2f, 2.3f); // allocRun() allocates only the glyph buffer. std::fill(run.glyphs, run.glyphs + glyph_count, 0); return builder.make(); }(), [] { SkFont font; font.setTypeface(test_typefaces[1][0]); SkTextBlobBuilder builder; int glyph_count = 5; const auto& run1 = builder.allocRun(font, glyph_count, 1.2f, 2.3f); // allocRun() allocates only the glyph buffer. std::fill(run1.glyphs, run1.glyphs + glyph_count, 0); glyph_count = 16; const auto& run2 = builder.allocRunPos(font, glyph_count); // allocRun() allocates the glyph buffer, and 2 scalars per glyph for // the pos buffer. std::fill(run2.glyphs, run2.glyphs + glyph_count, 0); std::fill(run2.pos, run2.pos + glyph_count * 2, 0); font.setTypeface(test_typefaces[1][1]); glyph_count = 8; const auto& run3 = builder.allocRunPosH(font, glyph_count, 0); // allocRun() allocates the glyph buffer, and 1 scalar per glyph for the // pos buffer. std::fill(run3.glyphs, run3.glyphs + glyph_count, 0); std::fill(run3.pos, run3.pos + glyph_count, 0); return builder.make(); }(), }; size_t len = std::min( {test_paint_blobs.size(), test_flags.size(), test_floats.size() - 1}); for (size_t i = 0; i < len; ++i) { buffer->push<DrawTextBlobOp>(test_paint_blobs[i], test_floats[i], test_floats[i + 1], test_flags[i]); } ValidateOps<DrawTextBlobOp>(buffer); } void PushNoopOps(PaintOpBuffer* buffer) { buffer->push<NoopOp>(); buffer->push<NoopOp>(); buffer->push<NoopOp>(); buffer->push<NoopOp>(); ValidateOps<NoopOp>(buffer); } void PushRestoreOps(PaintOpBuffer* buffer) { buffer->push<RestoreOp>(); buffer->push<RestoreOp>(); buffer->push<RestoreOp>(); buffer->push<RestoreOp>(); ValidateOps<RestoreOp>(buffer); } void PushRotateOps(PaintOpBuffer* buffer) { for (size_t i = 0; i < test_floats.size(); ++i) buffer->push<RotateOp>(test_floats[i]); ValidateOps<RotateOp>(buffer); } void PushSaveOps(PaintOpBuffer* buffer) { buffer->push<SaveOp>(); buffer->push<SaveOp>(); buffer->push<SaveOp>(); buffer->push<SaveOp>(); ValidateOps<SaveOp>(buffer); } void PushSaveLayerOps(PaintOpBuffer* buffer) { size_t len = std::min(test_flags.size(), test_rects.size()); for (size_t i = 0; i < len; ++i) buffer->push<SaveLayerOp>(&test_rects[i], &test_flags[i]); // Test combinations of optional args. buffer->push<SaveLayerOp>(nullptr, &test_flags[0]); buffer->push<SaveLayerOp>(&test_rects[0], nullptr); buffer->push<SaveLayerOp>(nullptr, nullptr); ValidateOps<SaveLayerOp>(buffer); } void PushSaveLayerAlphaOps(PaintOpBuffer* buffer) { size_t len = std::min(test_uint8s.size(), test_rects.size()); for (size_t i = 0; i < len; ++i) buffer->push<SaveLayerAlphaOp>(&test_rects[i], test_uint8s[i]); // Test optional args. buffer->push<SaveLayerAlphaOp>(nullptr, test_uint8s[0]); ValidateOps<SaveLayerAlphaOp>(buffer); } void PushScaleOps(PaintOpBuffer* buffer) { for (size_t i = 0; i < test_floats.size() - 1; i += 2) buffer->push<ScaleOp>(test_floats[i], test_floats[i + 1]); ValidateOps<ScaleOp>(buffer); } void PushSetMatrixOps(PaintOpBuffer* buffer) { for (auto& test_matrix : test_matrices) buffer->push<SetMatrixOp>(test_matrix); ValidateOps<SetMatrixOp>(buffer); } void PushTranslateOps(PaintOpBuffer* buffer) { for (size_t i = 0; i < test_floats.size() - 1; i += 2) buffer->push<TranslateOp>(test_floats[i], test_floats[i + 1]); ValidateOps<TranslateOp>(buffer); } void PushSetNodeIdOps(PaintOpBuffer* buffer) { for (size_t i = 0; i < test_ids.size(); i++) buffer->push<SetNodeIdOp>(static_cast<int>(test_ids[i])); ValidateOps<SetNodeIdOp>(buffer); } class PaintOpSerializationTest : public ::testing::TestWithParam<uint8_t> { public: PaintOpType GetParamType() const { return static_cast<PaintOpType>(GetParam()); } void PushTestOps(PaintOpType type) { switch (type) { case PaintOpType::Annotate: PushAnnotateOps(&buffer_); break; case PaintOpType::ClipPath: PushClipPathOps(&buffer_); break; case PaintOpType::ClipRect: PushClipRectOps(&buffer_); break; case PaintOpType::ClipRRect: PushClipRRectOps(&buffer_); break; case PaintOpType::Concat: PushConcatOps(&buffer_); break; case PaintOpType::CustomData: PushCustomDataOps(&buffer_); break; case PaintOpType::DrawColor: PushDrawColorOps(&buffer_); break; case PaintOpType::DrawDRRect: PushDrawDRRectOps(&buffer_); break; case PaintOpType::DrawImage: PushDrawImageOps(&buffer_); break; case PaintOpType::DrawImageRect: PushDrawImageRectOps(&buffer_); break; case PaintOpType::DrawIRect: PushDrawIRectOps(&buffer_); break; case PaintOpType::DrawLine: PushDrawLineOps(&buffer_); break; case PaintOpType::DrawOval: PushDrawOvalOps(&buffer_); break; case PaintOpType::DrawPath: PushDrawPathOps(&buffer_); break; case PaintOpType::DrawRecord: // Not supported. break; case PaintOpType::DrawRect: PushDrawRectOps(&buffer_); break; case PaintOpType::DrawRRect: PushDrawRRectOps(&buffer_); break; case PaintOpType::DrawSkottie: PushDrawSkottieOps(&buffer_); break; case PaintOpType::DrawTextBlob: PushDrawTextBlobOps(&buffer_); break; case PaintOpType::Noop: PushNoopOps(&buffer_); break; case PaintOpType::Restore: PushRestoreOps(&buffer_); break; case PaintOpType::Rotate: PushRotateOps(&buffer_); break; case PaintOpType::Save: PushSaveOps(&buffer_); break; case PaintOpType::SaveLayer: PushSaveLayerOps(&buffer_); break; case PaintOpType::SaveLayerAlpha: PushSaveLayerAlphaOps(&buffer_); break; case PaintOpType::Scale: PushScaleOps(&buffer_); break; case PaintOpType::SetMatrix: PushSetMatrixOps(&buffer_); break; case PaintOpType::Translate: PushTranslateOps(&buffer_); break; case PaintOpType::SetNodeId: PushSetNodeIdOps(&buffer_); break; } } void ResizeOutputBuffer() { // An arbitrary deserialization buffer size that should fit all the ops // in the buffer_. output_size_ = kBufferBytesPerOp * buffer_.size(); output_.reset(static_cast<char*>( base::AlignedAlloc(output_size_, PaintOpBuffer::PaintOpAlign))); } bool IsTypeSupported() { // DrawRecordOps must be flattened and are not currently serialized. All // other types must push non-zero amounts of ops in PushTestOps. return GetParamType() != PaintOpType::DrawRecord && (GetParamType() != PaintOpType::DrawSkottie || kIsSkottieSupported); } protected: std::unique_ptr<char, base::AlignedFreeDeleter> output_; size_t output_size_ = 0u; PaintOpBuffer buffer_; }; INSTANTIATE_TEST_SUITE_P( P, PaintOpSerializationTest, ::testing::Range(static_cast<uint8_t>(0), static_cast<uint8_t>(PaintOpType::LastPaintOpType))); // Test serializing and then deserializing all test ops. They should all // write successfully and be identical to the original ops in the buffer. TEST_P(PaintOpSerializationTest, SmokeTest) { if (!IsTypeSupported()) return; PushTestOps(GetParamType()); ResizeOutputBuffer(); SimpleSerializer serializer(output_.get(), output_size_); serializer.Serialize(buffer_); // Expect all ops to write more than 0 bytes. for (size_t i = 0; i < buffer_.size(); ++i) { SCOPED_TRACE(base::StringPrintf( "%s #%zd", PaintOpTypeToString(GetParamType()).c_str(), i)); EXPECT_GT(serializer.bytes_written()[i], 0u); } PaintOpBuffer::Iterator iter(&buffer_); size_t i = 0; for (auto* base_written : DeserializerIterator( output_.get(), serializer.TotalBytesWritten(), serializer.options_provider()->deserialize_options())) { SCOPED_TRACE(base::StringPrintf( "%s #%zu", PaintOpTypeToString(GetParamType()).c_str(), i)); ASSERT_EQ(!*iter, !base_written); EXPECT_EQ(**iter, *base_written); ++iter; ++i; } EXPECT_EQ(buffer_.size(), i); } // Verify for all test ops that serializing into a smaller size aborts // correctly and doesn't write anything. TEST_P(PaintOpSerializationTest, SerializationFailures) { if (!IsTypeSupported()) return; PushTestOps(GetParamType()); ResizeOutputBuffer(); SimpleSerializer serializer(output_.get(), output_size_); serializer.Serialize(buffer_); std::vector<size_t> bytes_written = serializer.bytes_written(); TestOptionsProvider options_provider; size_t op_idx = 0; for (PaintOpBuffer::Iterator iter(&buffer_); iter; ++iter, ++op_idx) { SCOPED_TRACE(base::StringPrintf( "%s #%zu", PaintOpTypeToString(GetParamType()).c_str(), op_idx)); size_t expected_bytes = bytes_written[op_idx]; EXPECT_GT(expected_bytes, 0u); // Attempt to write op into a buffer of size |i|, and only expect // it to succeed if the buffer is large enough. for (size_t i = 0; i < bytes_written[op_idx] + 2; ++i) { options_provider.ClearPaintCache(); size_t written_bytes = iter->Serialize( output_.get(), i, options_provider.serialize_options(), nullptr, SkM44(), SkM44()); if (i >= expected_bytes) { EXPECT_EQ(expected_bytes, written_bytes) << "i: " << i; } else { EXPECT_EQ(0u, written_bytes) << "i: " << i; } } } } // Verify that deserializing test ops from too small buffers aborts // correctly, in case the deserialized data is lying about how big it is. TEST_P(PaintOpSerializationTest, DeserializationFailures) { if (!IsTypeSupported()) return; PushTestOps(GetParamType()); ResizeOutputBuffer(); SimpleSerializer serializer(output_.get(), output_size_); serializer.Serialize(buffer_); TestOptionsProvider* options_provider = serializer.options_provider(); char* first = static_cast<char*>(output_.get()); char* current = first; static constexpr size_t kAlign = PaintOpBuffer::PaintOpAlign; static constexpr size_t kOutputOpSize = kBufferBytesPerOp; std::unique_ptr<char, base::AlignedFreeDeleter> deserialize_buffer_( static_cast<char*>(base::AlignedAlloc(kOutputOpSize, kAlign))); size_t op_idx = 0; size_t total_read = 0; for (PaintOpBuffer::Iterator iter(&buffer_); iter; ++iter, ++op_idx) { PaintOp* serialized = reinterpret_cast<PaintOp*>(current); uint32_t skip = serialized->skip; // Read from buffers of various sizes to make sure that having a serialized // op size that is larger than the input buffer provided causes a // deserialization failure to return nullptr. Also test a few valid sizes // larger than read size. for (size_t read_size = 0; read_size < skip + kAlign * 2 + 2; ++read_size) { SCOPED_TRACE( base::StringPrintf("%s #%zd, read_size: %zu, align: %zu, skip: %u", PaintOpTypeToString(GetParamType()).c_str(), op_idx, read_size, kAlign, skip)); // Because PaintOp::Deserialize early outs when the input size is < skip // deliberately lie about the skip. This op tooooootally fits. // This will verify that individual op deserializing code behaves // properly when presented with invalid offsets. serialized->skip = read_size; size_t bytes_read = 0; PaintOp* written = PaintOp::Deserialize( current, read_size, deserialize_buffer_.get(), kOutputOpSize, &bytes_read, options_provider->deserialize_options()); // Deserialize buffers with valid ops until the last op. This verifies // that the complete buffer is invalidated on encountering the first // corrupted op. auto deserialized_buffer = PaintOpBuffer::MakeFromMemory( first, total_read + read_size, options_provider->deserialize_options()); // Skips are only valid if they are aligned. if (read_size >= skip && read_size % kAlign == 0) { ASSERT_NE(nullptr, written); ASSERT_LE(written->skip, kOutputOpSize); EXPECT_EQ(GetParamType(), written->GetType()); EXPECT_EQ(serialized->skip, bytes_read); ASSERT_NE(nullptr, deserialized_buffer); EXPECT_EQ(deserialized_buffer->size(), op_idx + 1); } else if (read_size == 0 && op_idx != 0) { // If no data was read for a subsequent op while some ops were // deserialized, we still have a valid buffer with the deserialized ops. ASSERT_NE(nullptr, deserialized_buffer); EXPECT_EQ(deserialized_buffer->size(), op_idx); } else { // If a subsequent op was corrupted or no ops could be serialized, we // have an invalid buffer. EXPECT_EQ(nullptr, written); // If the buffer is exactly 0 bytes, then MakeFromMemory treats it as a // valid empty buffer. if (deserialized_buffer) { EXPECT_EQ(0u, read_size); EXPECT_EQ(0u, deserialized_buffer->size()); // Verify that we can create an iterator from this buffer, but it's // empty. PaintOpBuffer::Iterator it(deserialized_buffer.get()); EXPECT_FALSE(it); } else { EXPECT_NE(0u, read_size); EXPECT_EQ(nullptr, deserialized_buffer.get()); } } if (written) written->DestroyThis(); } serialized->skip = skip; current += skip; total_read += skip; } } TEST_P(PaintOpSerializationTest, UsesOverridenFlags) { if (!PaintOp::TypeHasFlags(GetParamType())) return; PushTestOps(GetParamType()); ResizeOutputBuffer(); TestOptionsProvider options_provider; size_t deserialized_size = sizeof(LargestPaintOp) + PaintOp::kMaxSkip; std::unique_ptr<char, base::AlignedFreeDeleter> deserialized( static_cast<char*>( base::AlignedAlloc(deserialized_size, PaintOpBuffer::PaintOpAlign))); for (const auto* op : PaintOpBuffer::Iterator(&buffer_)) { size_t bytes_written = op->Serialize(output_.get(), output_size_, options_provider.serialize_options(), nullptr, SkM44(), SkM44()); size_t bytes_read = 0u; PaintOp* written = PaintOp::Deserialize( output_.get(), bytes_written, deserialized.get(), deserialized_size, &bytes_read, options_provider.deserialize_options()); ASSERT_TRUE(written) << PaintOpTypeToString(GetParamType()); EXPECT_EQ(*op, *written); written->DestroyThis(); written = nullptr; PaintFlags override_flags = static_cast<const PaintOpWithFlags*>(op)->flags; override_flags.setAlpha(override_flags.getAlpha() * 0.5); bytes_written = op->Serialize(output_.get(), output_size_, options_provider.serialize_options(), &override_flags, SkM44(), SkM44()); written = PaintOp::Deserialize( output_.get(), bytes_written, deserialized.get(), deserialized_size, &bytes_read, options_provider.deserialize_options()); ASSERT_TRUE(written); ASSERT_TRUE(written->IsPaintOpWithFlags()); EXPECT_EQ(static_cast<const PaintOpWithFlags*>(written)->flags.getAlpha(), override_flags.getAlpha()); written->DestroyThis(); written = nullptr; } } TEST(PaintOpSerializationTest, CompleteBufferSerialization) { PaintOpBuffer buffer; PushDrawIRectOps(&buffer); PaintOpBufferSerializer::Preamble preamble; preamble.content_size = gfx::Size(1000, 1000); preamble.playback_rect = gfx::Rect(preamble.content_size); preamble.full_raster_rect = preamble.playback_rect; preamble.requires_clear = true; std::unique_ptr<char, base::AlignedFreeDeleter> memory( static_cast<char*>(base::AlignedAlloc(PaintOpBuffer::kInitialBufferSize, PaintOpBuffer::PaintOpAlign))); TestOptionsProvider options_provider; SimpleBufferSerializer serializer(memory.get(), PaintOpBuffer::kInitialBufferSize, options_provider.serialize_options()); serializer.Serialize(&buffer, nullptr, preamble); ASSERT_NE(serializer.written(), 0u); auto deserialized_buffer = PaintOpBuffer::MakeFromMemory(memory.get(), serializer.written(), options_provider.deserialize_options()); ASSERT_TRUE(deserialized_buffer); // The deserialized buffer has an extra pair of save/restores and a clear, for // the preamble and root buffer. ASSERT_EQ(deserialized_buffer->size(), buffer.size() + 4u); size_t i = 0; auto serialized_iter = PaintOpBuffer::Iterator(&buffer); for (const auto* op : PaintOpBuffer::Iterator(deserialized_buffer.get())) { SCOPED_TRACE(i); i++; if (i == 1) { // Save. ASSERT_EQ(op->GetType(), PaintOpType::Save) << PaintOpTypeToString(op->GetType()); continue; } if (i == 2) { // Preamble partial raster clear. ASSERT_EQ(op->GetType(), PaintOpType::DrawColor) << PaintOpTypeToString(op->GetType()); continue; } if (i == 3) { // Preamble playback rect clip. ASSERT_EQ(op->GetType(), PaintOpType::ClipRect) << PaintOpTypeToString(op->GetType()); EXPECT_EQ(static_cast<const ClipRectOp*>(op)->rect, gfx::RectToSkRect(preamble.playback_rect)); continue; } if (serialized_iter) { // Root buffer. ASSERT_EQ(op->GetType(), (*serialized_iter)->GetType()) << PaintOpTypeToString(op->GetType()); EXPECT_EQ(*op, **serialized_iter); ++serialized_iter; continue; } // End restore. ASSERT_EQ(op->GetType(), PaintOpType::Restore) << PaintOpTypeToString(op->GetType()); } } TEST(PaintOpSerializationTest, DoNotPreservePaintOps) { PaintOpBuffer buffer; PushDrawIRectOps(&buffer); PaintOpBufferSerializer::Preamble preamble; preamble.content_size = gfx::Size(1000, 1000); preamble.playback_rect = gfx::Rect(preamble.content_size); preamble.full_raster_rect = preamble.playback_rect; preamble.requires_clear = true; std::unique_ptr<char, base::AlignedFreeDeleter> memory( static_cast<char*>(base::AlignedAlloc(PaintOpBuffer::kInitialBufferSize, PaintOpBuffer::PaintOpAlign))); TestOptionsProvider options_provider; SimpleBufferSerializer serializer(memory.get(), PaintOpBuffer::kInitialBufferSize, options_provider.serialize_options()); serializer.SerializeAndDestroy(&buffer, nullptr, preamble); ASSERT_NE(serializer.written(), 0u); EXPECT_TRUE(buffer.are_ops_destroyed()); } TEST(PaintOpSerializationTest, Preamble) { PaintOpBufferSerializer::Preamble preamble; preamble.content_size = gfx::Size(30, 40); preamble.full_raster_rect = gfx::Rect(10, 20, 8, 7); preamble.playback_rect = gfx::Rect(12, 25, 1, 2); preamble.post_translation = gfx::Vector2dF(4.3f, 7.f); preamble.post_scale = gfx::Vector2dF(0.5f, 0.5f); preamble.requires_clear = true; PaintOpBuffer buffer; buffer.push<DrawColorOp>(SK_ColorBLUE, SkBlendMode::kSrc); std::unique_ptr<char, base::AlignedFreeDeleter> memory( static_cast<char*>(base::AlignedAlloc(PaintOpBuffer::kInitialBufferSize, PaintOpBuffer::PaintOpAlign))); TestOptionsProvider options_provider; SimpleBufferSerializer serializer(memory.get(), PaintOpBuffer::kInitialBufferSize, options_provider.serialize_options()); serializer.SerializeAndDestroy(&buffer, nullptr, preamble); ASSERT_NE(serializer.written(), 0u); auto deserialized_buffer = PaintOpBuffer::MakeFromMemory(memory.get(), serializer.written(), options_provider.deserialize_options()); ASSERT_TRUE(deserialized_buffer); // 5 ops for the preamble and 2 for save/restore. ASSERT_EQ(deserialized_buffer->size(), buffer.size() + 7u); size_t i = 0; for (const auto* op : PaintOpBuffer::Iterator(deserialized_buffer.get())) { i++; if (i == 1) { // Save. ASSERT_EQ(op->GetType(), PaintOpType::Save) << PaintOpTypeToString(op->GetType()); continue; } if (i == 2) { // Translate. ASSERT_EQ(op->GetType(), PaintOpType::Translate) << PaintOpTypeToString(op->GetType()); const auto* translate_op = static_cast<const TranslateOp*>(op); EXPECT_EQ(translate_op->dx, -preamble.full_raster_rect.x()); EXPECT_EQ(translate_op->dy, -preamble.full_raster_rect.y()); continue; } if (i == 3) { // Clip. ASSERT_EQ(op->GetType(), PaintOpType::ClipRect) << PaintOpTypeToString(op->GetType()); const auto* clip_op = static_cast<const ClipRectOp*>(op); EXPECT_RECTF_EQ(gfx::SkRectToRectF(clip_op->rect), gfx::RectF(preamble.playback_rect)); continue; } if (i == 4) { // Post translate. ASSERT_EQ(op->GetType(), PaintOpType::Translate) << PaintOpTypeToString(op->GetType()); const auto* translate_op = static_cast<const TranslateOp*>(op); EXPECT_EQ(translate_op->dx, preamble.post_translation.x()); EXPECT_EQ(translate_op->dy, preamble.post_translation.y()); continue; } if (i == 5) { // Scale. ASSERT_EQ(op->GetType(), PaintOpType::Scale) << PaintOpTypeToString(op->GetType()); const auto* scale_op = static_cast<const ScaleOp*>(op); EXPECT_EQ(scale_op->sx, preamble.post_scale.x()); EXPECT_EQ(scale_op->sy, preamble.post_scale.y()); continue; } if (i == 6) { // Partial raster clear goes last. ASSERT_EQ(op->GetType(), PaintOpType::DrawColor) << PaintOpTypeToString(op->GetType()); const auto* draw_color_op = static_cast<const DrawColorOp*>(op); EXPECT_EQ(draw_color_op->color, SK_ColorTRANSPARENT); EXPECT_EQ(draw_color_op->mode, SkBlendMode::kSrc); continue; } if (i == 7) { // Buffer. EXPECT_EQ(*op, *buffer.GetFirstOp()); continue; } // End restore. ASSERT_EQ(op->GetType(), PaintOpType::Restore) << PaintOpTypeToString(op->GetType()); } } TEST(PaintOpSerializationTest, SerializesNestedRecords) { auto record = sk_make_sp<PaintOpBuffer>(); record->push<ScaleOp>(0.5f, 0.75f); record->push<DrawRectOp>(SkRect::MakeWH(10.f, 20.f), PaintFlags()); PaintOpBuffer buffer; buffer.push<DrawRecordOp>(record); std::unique_ptr<char, base::AlignedFreeDeleter> memory( static_cast<char*>(base::AlignedAlloc(PaintOpBuffer::kInitialBufferSize, PaintOpBuffer::PaintOpAlign))); TestOptionsProvider options_provider; SimpleBufferSerializer serializer(memory.get(), PaintOpBuffer::kInitialBufferSize, options_provider.serialize_options()); PaintOpBufferSerializer::Preamble preamble; serializer.Serialize(&buffer, nullptr, preamble); ASSERT_NE(serializer.written(), 0u); auto deserialized_buffer = PaintOpBuffer::MakeFromMemory(memory.get(), serializer.written(), options_provider.deserialize_options()); ASSERT_TRUE(deserialized_buffer); ASSERT_EQ(deserialized_buffer->size(), record->size() + 5u); size_t i = 0; auto serialized_iter = PaintOpBuffer::Iterator(record.get()); for (const auto* op : PaintOpBuffer::Iterator(deserialized_buffer.get())) { i++; if (i == 1 || i == 3) { // First 2 saves. ASSERT_EQ(op->GetType(), PaintOpType::Save) << PaintOpTypeToString(op->GetType()); continue; } // Clear. if (i == 2) { ASSERT_EQ(op->GetType(), PaintOpType::DrawColor) << PaintOpTypeToString(op->GetType()); continue; } if (serialized_iter) { // Nested buffer. ASSERT_EQ(op->GetType(), (*serialized_iter)->GetType()) << PaintOpTypeToString(op->GetType()); EXPECT_EQ(*op, **serialized_iter); ++serialized_iter; continue; } // End restores. ASSERT_EQ(op->GetType(), PaintOpType::Restore) << PaintOpTypeToString(op->GetType()); } } TEST(PaintOpBufferTest, ClipsImagesDuringSerialization) { struct { gfx::Rect clip_rect; gfx::Rect image_rect; bool should_draw; } test_cases[] = { {gfx::Rect(0, 0, 100, 100), gfx::Rect(50, 50, 100, 100), true}, {gfx::Rect(0, 0, 100, 100), gfx::Rect(105, 105, 100, 100), false}, {gfx::Rect(0, 0, 500, 500), gfx::Rect(450, 450, 100, 100), true}, {gfx::Rect(0, 0, 500, 500), gfx::Rect(750, 750, 100, 100), false}, {gfx::Rect(250, 250, 250, 250), gfx::Rect(450, 450, 100, 100), true}, {gfx::Rect(250, 250, 250, 250), gfx::Rect(50, 50, 100, 100), false}, {gfx::Rect(0, 0, 100, 500), gfx::Rect(250, 250, 100, 100), false}, {gfx::Rect(0, 0, 200, 500), gfx::Rect(100, 250, 100, 100), true}}; for (const auto& test_case : test_cases) { PaintOpBuffer buffer; buffer.push<DrawImageOp>( CreateDiscardablePaintImage(test_case.image_rect.size()), static_cast<SkScalar>(test_case.image_rect.x()), static_cast<SkScalar>(test_case.image_rect.y())); std::unique_ptr<char, base::AlignedFreeDeleter> memory( static_cast<char*>(base::AlignedAlloc(PaintOpBuffer::kInitialBufferSize, PaintOpBuffer::PaintOpAlign))); TestOptionsProvider options_provider; SimpleBufferSerializer serializer(memory.get(), PaintOpBuffer::kInitialBufferSize, options_provider.serialize_options()); PaintOpBufferSerializer::Preamble preamble; preamble.playback_rect = test_case.clip_rect; preamble.full_raster_rect = gfx::Rect(0, 0, test_case.clip_rect.right(), test_case.clip_rect.bottom()); // Avoid clearing. preamble.content_size = gfx::Size(1000, 1000); preamble.requires_clear = false; serializer.SerializeAndDestroy(&buffer, nullptr, preamble); ASSERT_NE(serializer.written(), 0u); auto deserialized_buffer = PaintOpBuffer::MakeFromMemory(memory.get(), serializer.written(), options_provider.deserialize_options()); ASSERT_TRUE(deserialized_buffer); auto deserialized_iter = PaintOpBuffer::Iterator(deserialized_buffer.get()); ASSERT_EQ((*deserialized_iter)->GetType(), PaintOpType::Save) << PaintOpTypeToString((*deserialized_iter)->GetType()); ++deserialized_iter; ASSERT_EQ((*deserialized_iter)->GetType(), PaintOpType::ClipRect) << PaintOpTypeToString((*deserialized_iter)->GetType()); ++deserialized_iter; if (test_case.should_draw) { ASSERT_EQ((*deserialized_iter)->GetType(), PaintOpType::DrawImage) << PaintOpTypeToString((*deserialized_iter)->GetType()); ++deserialized_iter; } ASSERT_EQ((*deserialized_iter)->GetType(), PaintOpType::Restore) << PaintOpTypeToString((*deserialized_iter)->GetType()); ++deserialized_iter; ASSERT_EQ(deserialized_iter.end(), deserialized_iter); } } TEST(PaintOpBufferSerializationTest, AlphaFoldingDuringSerialization) { PaintOpBuffer buffer; uint8_t alpha = 100; buffer.push<SaveLayerAlphaOp>(nullptr, alpha); PaintFlags draw_flags; draw_flags.setColor(SK_ColorMAGENTA); draw_flags.setAlpha(50); SkRect rect = SkRect::MakeXYWH(1, 2, 3, 4); buffer.push<DrawRectOp>(rect, draw_flags); buffer.push<RestoreOp>(); PaintOpBufferSerializer::Preamble preamble; preamble.content_size = gfx::Size(1000, 1000); preamble.playback_rect = gfx::Rect(gfx::Size(100, 100)); preamble.full_raster_rect = preamble.playback_rect; preamble.requires_clear = false; std::unique_ptr<char, base::AlignedFreeDeleter> memory( static_cast<char*>(base::AlignedAlloc(PaintOpBuffer::kInitialBufferSize, PaintOpBuffer::PaintOpAlign))); TestOptionsProvider options_provider; SimpleBufferSerializer serializer(memory.get(), PaintOpBuffer::kInitialBufferSize, options_provider.serialize_options()); serializer.SerializeAndDestroy(&buffer, nullptr, preamble); ASSERT_NE(serializer.written(), 0u); auto deserialized_buffer = PaintOpBuffer::MakeFromMemory(memory.get(), serializer.written(), options_provider.deserialize_options()); ASSERT_TRUE(deserialized_buffer); // 4 additional ops for save, clip, clear, and restore. ASSERT_EQ(deserialized_buffer->size(), 4u); size_t i = 0; for (const auto* op : PaintOpBuffer::Iterator(deserialized_buffer.get())) { ++i; if (i == 1) { EXPECT_EQ(op->GetType(), PaintOpType::Save); continue; } if (i == 2) { EXPECT_EQ(op->GetType(), PaintOpType::ClipRect); continue; } if (i == 4) { EXPECT_EQ(op->GetType(), PaintOpType::Restore); continue; } ASSERT_EQ(op->GetType(), PaintOpType::DrawRect); // Expect the alpha from the draw and the save layer to be folded together. // Since alpha is stored in a uint8_t and gets rounded, so use tolerance. float expected_alpha = alpha * 50 / 255.f; EXPECT_LE(std::abs(expected_alpha - static_cast<const DrawRectOp*>(op)->flags.getAlpha()), 1.f); } } // Test generic PaintOp deserializing failure cases. TEST(PaintOpBufferTest, PaintOpDeserialize) { static constexpr size_t kSize = sizeof(LargestPaintOp) + 100; static constexpr size_t kAlign = PaintOpBuffer::PaintOpAlign; std::unique_ptr<char, base::AlignedFreeDeleter> input_( static_cast<char*>(base::AlignedAlloc(kSize, kAlign))); std::unique_ptr<char, base::AlignedFreeDeleter> output_( static_cast<char*>(base::AlignedAlloc(kSize, kAlign))); PaintOpBuffer buffer; buffer.push<DrawColorOp>(SK_ColorMAGENTA, SkBlendMode::kSrc); PaintOpBuffer::Iterator iter(&buffer); PaintOp* op = *iter; ASSERT_TRUE(op); TestOptionsProvider options_provider; size_t bytes_written = op->Serialize(input_.get(), kSize, options_provider.serialize_options(), nullptr, SkM44(), SkM44()); ASSERT_GT(bytes_written, 0u); // can deserialize from exactly the right size size_t bytes_read = 0; PaintOp* success = PaintOp::Deserialize(input_.get(), bytes_written, output_.get(), kSize, &bytes_read, options_provider.deserialize_options()); ASSERT_TRUE(success); EXPECT_EQ(bytes_written, bytes_read); success->DestroyThis(); // fail to deserialize if skip goes past input size // (the DeserializationFailures test above tests if the skip is lying) for (size_t i = 0; i < bytes_written - 1; ++i) EXPECT_FALSE(PaintOp::Deserialize(input_.get(), i, output_.get(), kSize, &bytes_read, options_provider.deserialize_options())); // unaligned skips fail to deserialize PaintOp* serialized = reinterpret_cast<PaintOp*>(input_.get()); EXPECT_EQ(0u, serialized->skip % kAlign); serialized->skip -= 1; EXPECT_FALSE(PaintOp::Deserialize(input_.get(), bytes_written, output_.get(), kSize, &bytes_read, options_provider.deserialize_options())); serialized->skip += 1; // bogus types fail to deserialize serialized->type = static_cast<uint8_t>(PaintOpType::LastPaintOpType) + 1; EXPECT_FALSE(PaintOp::Deserialize(input_.get(), bytes_written, output_.get(), kSize, &bytes_read, options_provider.deserialize_options())); } // Test that deserializing invalid SkClipOp enums fails silently. // Skia release asserts on this in several places so these are not safe // to pass through to the SkCanvas API. TEST(PaintOpBufferTest, ValidateSkClip) { size_t buffer_size = kBufferBytesPerOp; std::unique_ptr<char, base::AlignedFreeDeleter> serialized(static_cast<char*>( base::AlignedAlloc(buffer_size, PaintOpBuffer::PaintOpAlign))); std::unique_ptr<char, base::AlignedFreeDeleter> deserialized( static_cast<char*>( base::AlignedAlloc(buffer_size, PaintOpBuffer::PaintOpAlign))); PaintOpBuffer buffer; // Successful first op. SkPath path; buffer.push<ClipPathOp>(path, SkClipOp::kMax_EnumValue, /*antialias=*/true, UsePaintCache::kDisabled); // Bad other ops. SkClipOp bad_clip = static_cast<SkClipOp>( static_cast<uint32_t>(SkClipOp::kMax_EnumValue) + 1); buffer.push<ClipPathOp>(path, bad_clip, /*antialias=*/true, UsePaintCache::kDisabled); buffer.push<ClipRectOp>(test_rects[0], bad_clip, true); buffer.push<ClipRRectOp>(test_rrects[0], bad_clip, false); // SkClipOp is serialized to uint8_t (see WriteEnum). Values outside uint8_t // would crash the serialization, so this is the max value that passes checked // cast but will still fail validation during deserialization. SkClipOp bad_clip_max = static_cast<SkClipOp>(static_cast<uint8_t>(~0)); buffer.push<ClipRectOp>(test_rects[1], bad_clip_max, false); TestOptionsProvider options_provider; int op_idx = 0; for (PaintOpBuffer::Iterator iter(&buffer); iter; ++iter) { const PaintOp* op = *iter; size_t bytes_written = op->Serialize(serialized.get(), buffer_size, options_provider.serialize_options(), nullptr, SkM44(), SkM44()); ASSERT_GT(bytes_written, 0u); size_t bytes_read = 0; PaintOp* written = PaintOp::Deserialize( serialized.get(), bytes_written, deserialized.get(), buffer_size, &bytes_read, options_provider.deserialize_options()); // First op should succeed. Other ops with bad enums should // serialize correctly but fail to deserialize due to the bad // SkClipOp enum. if (!op_idx) { EXPECT_TRUE(written) << "op: " << op_idx; EXPECT_EQ(bytes_written, bytes_read); written->DestroyThis(); } else { EXPECT_FALSE(written) << "op: " << op_idx; } ++op_idx; } } TEST(PaintOpBufferTest, ValidateSkBlendMode) { size_t buffer_size = kBufferBytesPerOp; std::unique_ptr<char, base::AlignedFreeDeleter> serialized(static_cast<char*>( base::AlignedAlloc(buffer_size, PaintOpBuffer::PaintOpAlign))); std::unique_ptr<char, base::AlignedFreeDeleter> deserialized( static_cast<char*>( base::AlignedAlloc(buffer_size, PaintOpBuffer::PaintOpAlign))); PaintOpBuffer buffer; // Successful first two ops. buffer.push<DrawColorOp>(SK_ColorMAGENTA, SkBlendMode::kDstIn); PaintFlags good_flags = test_flags[0]; good_flags.setBlendMode(SkBlendMode::kColorBurn); buffer.push<DrawRectOp>(test_rects[0], good_flags); // Modes that are not supported by drawColor or SkPaint. SkBlendMode bad_modes_for_draw_color[] = { SkBlendMode::kOverlay, SkBlendMode::kDarken, SkBlendMode::kLighten, SkBlendMode::kColorDodge, SkBlendMode::kColorBurn, SkBlendMode::kHardLight, SkBlendMode::kSoftLight, SkBlendMode::kDifference, SkBlendMode::kExclusion, SkBlendMode::kMultiply, SkBlendMode::kHue, SkBlendMode::kSaturation, SkBlendMode::kColor, SkBlendMode::kLuminosity, static_cast<SkBlendMode>(static_cast<uint8_t>(SkBlendMode::kLastMode) + 1), static_cast<SkBlendMode>(static_cast<uint8_t>(~0)), }; SkBlendMode bad_modes_for_flags[] = { static_cast<SkBlendMode>(static_cast<uint8_t>(SkBlendMode::kLastMode) + 1), static_cast<SkBlendMode>(static_cast<uint8_t>(~0)), }; for (size_t i = 0; i < base::size(bad_modes_for_draw_color); ++i) { buffer.push<DrawColorOp>(SK_ColorMAGENTA, bad_modes_for_draw_color[i]); } for (size_t i = 0; i < base::size(bad_modes_for_flags); ++i) { PaintFlags flags = test_flags[i % test_flags.size()]; flags.setBlendMode(bad_modes_for_flags[i]); buffer.push<DrawRectOp>(test_rects[i % test_rects.size()], flags); } TestOptionsProvider options_provider; int op_idx = 0; for (PaintOpBuffer::Iterator iter(&buffer); iter; ++iter) { const PaintOp* op = *iter; size_t bytes_written = op->Serialize(serialized.get(), buffer_size, options_provider.serialize_options(), nullptr, SkM44(), SkM44()); ASSERT_GT(bytes_written, 0u); size_t bytes_read = 0; PaintOp* written = PaintOp::Deserialize( serialized.get(), bytes_written, deserialized.get(), buffer_size, &bytes_read, options_provider.deserialize_options()); // First two ops should succeed. Other ops with bad enums should // serialize correctly but fail to deserialize due to the bad // SkBlendMode enum. if (op_idx < 2) { EXPECT_TRUE(written) << "op: " << op_idx; EXPECT_EQ(bytes_written, bytes_read); written->DestroyThis(); } else { EXPECT_FALSE(written) << "op: " << op_idx; } ++op_idx; } } TEST(PaintOpBufferTest, ValidateRects) { size_t buffer_size = kBufferBytesPerOp; std::unique_ptr<char, base::AlignedFreeDeleter> serialized(static_cast<char*>( base::AlignedAlloc(buffer_size, PaintOpBuffer::PaintOpAlign))); std::unique_ptr<char, base::AlignedFreeDeleter> deserialized( static_cast<char*>( base::AlignedAlloc(buffer_size, PaintOpBuffer::PaintOpAlign))); // Used for QuickRejectDraw SkCanvas device(256, 256); SkCanvas* canvas = &device; SkRect bad_rect = SkRect::MakeEmpty(); bad_rect.fBottom = std::numeric_limits<float>::quiet_NaN(); EXPECT_FALSE(bad_rect.isFinite()); // Push all op variations that take rects. PaintOpBuffer buffer; buffer.push<AnnotateOp>(PaintCanvas::AnnotationType::URL, bad_rect, SkData::MakeWithCString("test1")); buffer.push<ClipRectOp>(bad_rect, SkClipOp::kDifference, true); buffer.push<DrawImageRectOp>(test_images[0], bad_rect, test_rects[1], SkCanvas::kStrict_SrcRectConstraint); buffer.push<DrawImageRectOp>(test_images[0], test_rects[0], bad_rect, SkCanvas::kStrict_SrcRectConstraint); buffer.push<DrawOvalOp>(bad_rect, test_flags[0]); buffer.push<DrawRectOp>(bad_rect, test_flags[0]); buffer.push<SaveLayerOp>(&bad_rect, nullptr); buffer.push<SaveLayerOp>(&bad_rect, &test_flags[0]); buffer.push<SaveLayerAlphaOp>(&bad_rect, test_uint8s[0]); TestOptionsProvider options_provider; // Every op should serialize but fail to deserialize due to the bad rect. int op_idx = 0; for (PaintOpBuffer::Iterator iter(&buffer); iter; ++iter) { const PaintOp* op = *iter; size_t bytes_written = op->Serialize(serialized.get(), buffer_size, options_provider.serialize_options(), nullptr, SkM44(), SkM44()); ASSERT_GT(bytes_written, 0u); size_t bytes_read = 0; PaintOp* written = PaintOp::Deserialize( serialized.get(), bytes_written, deserialized.get(), buffer_size, &bytes_read, options_provider.deserialize_options()); EXPECT_FALSE(written) << "op: " << op_idx; // Additionally, every draw op should be rejected by QuickRejectDraw if // the paint op buffer were played back directly without going through // deserialization (e.g. canvas2D, crbug.com/1186392) if (op->IsDrawOp()) { EXPECT_TRUE(PaintOp::QuickRejectDraw(op, canvas)); } ++op_idx; } } TEST(PaintOpBufferTest, BoundingRect_DrawImageOp) { PaintOpBuffer buffer; PushDrawImageOps(&buffer); SkRect rect; for (auto* base_op : PaintOpBuffer::Iterator(&buffer)) { auto* op = static_cast<DrawImageOp*>(base_op); SkRect image_rect = SkRect::MakeXYWH(op->left, op->top, op->image.width(), op->image.height()); ASSERT_TRUE(PaintOp::GetBounds(op, &rect)); EXPECT_EQ(rect, image_rect.makeSorted()); } } TEST(PaintOpBufferTest, BoundingRect_DrawImageRectOp) { PaintOpBuffer buffer; PushDrawImageRectOps(&buffer); SkRect rect; for (auto* base_op : PaintOpBuffer::Iterator(&buffer)) { auto* op = static_cast<DrawImageRectOp*>(base_op); ASSERT_TRUE(PaintOp::GetBounds(op, &rect)); EXPECT_EQ(rect, op->dst.makeSorted()); } } TEST(PaintOpBufferTest, BoundingRect_DrawIRectOp) { PaintOpBuffer buffer; PushDrawIRectOps(&buffer); SkRect rect; for (auto* base_op : PaintOpBuffer::Iterator(&buffer)) { auto* op = static_cast<DrawIRectOp*>(base_op); ASSERT_TRUE(PaintOp::GetBounds(op, &rect)); EXPECT_EQ(rect, SkRect::Make(op->rect).makeSorted()); } } TEST(PaintOpBufferTest, BoundingRect_DrawOvalOp) { PaintOpBuffer buffer; PushDrawOvalOps(&buffer); SkRect rect; for (auto* base_op : PaintOpBuffer::Iterator(&buffer)) { auto* op = static_cast<DrawOvalOp*>(base_op); ASSERT_TRUE(PaintOp::GetBounds(op, &rect)); EXPECT_EQ(rect, op->oval.makeSorted()); } } TEST(PaintOpBufferTest, BoundingRect_DrawPathOp) { PaintOpBuffer buffer; PushDrawPathOps(&buffer); SkRect rect; for (auto* base_op : PaintOpBuffer::Iterator(&buffer)) { auto* op = static_cast<DrawPathOp*>(base_op); ASSERT_TRUE(PaintOp::GetBounds(op, &rect)); EXPECT_EQ(rect, op->path.getBounds().makeSorted()); } } TEST(PaintOpBufferTest, BoundingRect_DrawRectOp) { PaintOpBuffer buffer; PushDrawRectOps(&buffer); SkRect rect; for (auto* base_op : PaintOpBuffer::Iterator(&buffer)) { auto* op = static_cast<DrawRectOp*>(base_op); ASSERT_TRUE(PaintOp::GetBounds(op, &rect)); EXPECT_EQ(rect, op->rect.makeSorted()); } } TEST(PaintOpBufferTest, BoundingRect_DrawRRectOp) { PaintOpBuffer buffer; PushDrawRRectOps(&buffer); SkRect rect; for (auto* base_op : PaintOpBuffer::Iterator(&buffer)) { auto* op = static_cast<DrawRRectOp*>(base_op); ASSERT_TRUE(PaintOp::GetBounds(op, &rect)); EXPECT_EQ(rect, op->rrect.rect().makeSorted()); } } TEST(PaintOpBufferTest, BoundingRect_DrawLineOp) { PaintOpBuffer buffer; PushDrawLineOps(&buffer); SkRect rect; for (auto* base_op : PaintOpBuffer::Iterator(&buffer)) { auto* op = static_cast<DrawLineOp*>(base_op); SkRect line_rect; line_rect.fLeft = op->x0; line_rect.fTop = op->y0; line_rect.fRight = op->x1; line_rect.fBottom = op->y1; ASSERT_TRUE(PaintOp::GetBounds(op, &rect)); EXPECT_EQ(rect, line_rect.makeSorted()); } } TEST(PaintOpBufferTest, BoundingRect_DrawDRRectOp) { PaintOpBuffer buffer; PushDrawDRRectOps(&buffer); SkRect rect; for (auto* base_op : PaintOpBuffer::Iterator(&buffer)) { auto* op = static_cast<DrawDRRectOp*>(base_op); ASSERT_TRUE(PaintOp::GetBounds(op, &rect)); EXPECT_EQ(rect, op->outer.getBounds().makeSorted()); } } TEST(PaintOpBufferTest, BoundingRect_DrawTextBlobOp) { PaintOpBuffer buffer; PushDrawTextBlobOps(&buffer); SkRect rect; for (auto* base_op : PaintOpBuffer::Iterator(&buffer)) { auto* op = static_cast<DrawTextBlobOp*>(base_op); ASSERT_TRUE(PaintOp::GetBounds(op, &rect)); EXPECT_EQ(rect, op->blob->bounds().makeOffset(op->x, op->y).makeSorted()); } } class MockImageProvider : public ImageProvider { public: MockImageProvider() = default; explicit MockImageProvider(bool fail_all_decodes) : fail_all_decodes_(fail_all_decodes) {} MockImageProvider(std::vector<SkSize> src_rect_offset, std::vector<SkSize> scale, std::vector<PaintFlags::FilterQuality> quality) : src_rect_offset_(src_rect_offset), scale_(scale), quality_(quality) {} ~MockImageProvider() override = default; ImageProvider::ScopedResult GetRasterContent( const DrawImage& draw_image) override { decoded_images_.push_back(draw_image); if (draw_image.paint_image().IsPaintWorklet()) return ScopedResult(record_); if (fail_all_decodes_) return ImageProvider::ScopedResult(); SkBitmap bitmap; bitmap.allocPixelsFlags(SkImageInfo::MakeN32Premul(10, 10), SkBitmap::kZeroPixels_AllocFlag); sk_sp<SkImage> image = SkImage::MakeFromBitmap(bitmap); size_t i = index_++; return ScopedResult(DecodedDrawImage(image, nullptr, src_rect_offset_[i], scale_[i], quality_[i], true)); } void SetRecord(sk_sp<PaintRecord> record) { record_ = std::move(record); } const std::vector<DrawImage>& decoded_images() const { return decoded_images_; } private: std::vector<SkSize> src_rect_offset_; std::vector<SkSize> scale_; std::vector<PaintFlags::FilterQuality> quality_; size_t index_ = 0; bool fail_all_decodes_ = false; sk_sp<PaintRecord> record_; std::vector<DrawImage> decoded_images_; }; TEST(PaintOpBufferTest, SkipsOpsOutsideClip) { // All ops with images draw outside the clip and should be skipped. If any // call is made to the ImageProvider, it should crash. MockImageProvider image_provider; PaintOpBuffer buffer; // Apply a clip outside the region for images. buffer.push<ClipRectOp>(SkRect::MakeXYWH(0, 0, 100, 100), SkClipOp::kIntersect, false); PaintImage paint_image = CreateDiscardablePaintImage(gfx::Size(10, 10)); buffer.push<DrawImageOp>(paint_image, 105.0f, 105.0f); PaintFlags image_flags; image_flags.setShader(PaintShader::MakeImage(paint_image, SkTileMode::kRepeat, SkTileMode::kRepeat, nullptr)); buffer.push<DrawRectOp>(SkRect::MakeXYWH(110, 110, 100, 100), image_flags); SkRect rect = SkRect::MakeXYWH(0, 0, 100, 100); buffer.push<DrawRectOp>(rect, PaintFlags()); // The single save/restore call is from the PaintOpBuffer's use of // SkAutoRestoreCanvas. testing::StrictMock<MockCanvas> canvas; testing::Sequence s; EXPECT_CALL(canvas, willSave()).InSequence(s); EXPECT_CALL(canvas, OnDrawRectWithColor(_)).InSequence(s); EXPECT_CALL(canvas, willRestore()).InSequence(s); buffer.Playback(&canvas, PlaybackParams(&image_provider)); } TEST(PaintOpBufferTest, SkipsOpsWithFailedDecodes) { MockImageProvider image_provider(true); PaintOpBuffer buffer; PaintImage paint_image = CreateDiscardablePaintImage(gfx::Size(10, 10)); buffer.push<DrawImageOp>(paint_image, 105.0f, 105.0f); PaintFlags image_flags; image_flags.setShader(PaintShader::MakeImage(paint_image, SkTileMode::kRepeat, SkTileMode::kRepeat, nullptr)); buffer.push<DrawRectOp>(SkRect::MakeXYWH(110, 110, 100, 100), image_flags); buffer.push<DrawColorOp>(SK_ColorRED, SkBlendMode::kSrcOver); testing::StrictMock<MockCanvas> canvas; testing::Sequence s; EXPECT_CALL(canvas, OnDrawPaintWithColor(_)).InSequence(s); buffer.Playback(&canvas, PlaybackParams(&image_provider)); } MATCHER(NonLazyImage, "") { return !arg->isLazyGenerated(); } MATCHER_P(MatchesPaintImage, paint_image, "") { return arg.paint_image() == paint_image; } MATCHER_P2(MatchesRect, rect, scale, "") { EXPECT_EQ(arg.x(), rect.x() * scale.width()); EXPECT_EQ(arg.y(), rect.y() * scale.height()); EXPECT_EQ(arg.width(), rect.width() * scale.width()); EXPECT_EQ(arg.height(), rect.height() * scale.height()); return true; } MATCHER_P(MatchesQuality, quality, "") { return quality == arg->getFilterQuality(); } MATCHER_P2(MatchesShader, flags, scale, "") { SkMatrix matrix; SkTileMode xy[2]; SkImage* image = arg.getShader()->isAImage(&matrix, xy); EXPECT_FALSE(image->isLazyGenerated()); SkSize local_scale; matrix.decomposeScale(&local_scale, nullptr); EXPECT_EQ(local_scale.width(), 1.0f / scale.width()); EXPECT_EQ(local_scale.height(), 1.0f / scale.height()); EXPECT_EQ(flags.getShader()->tx(), xy[0]); EXPECT_EQ(flags.getShader()->ty(), xy[1]); return true; } TEST(PaintOpBufferTest, RasterPaintWorkletImageRectBasicCase) { sk_sp<PaintOpBuffer> paint_worklet_buffer = sk_make_sp<PaintOpBuffer>(); PaintFlags noop_flags; SkRect savelayer_rect = SkRect::MakeXYWH(0, 0, 100, 100); paint_worklet_buffer->push<TranslateOp>(8.0f, 8.0f); paint_worklet_buffer->push<SaveLayerOp>(&savelayer_rect, &noop_flags); PaintFlags draw_flags; draw_flags.setColor(0u); SkRect rect = SkRect::MakeXYWH(0, 0, 100, 100); paint_worklet_buffer->push<DrawRectOp>(rect, draw_flags); MockImageProvider provider; provider.SetRecord(paint_worklet_buffer); PaintOpBuffer blink_buffer; scoped_refptr<TestPaintWorkletInput> input = base::MakeRefCounted<TestPaintWorkletInput>(gfx::SizeF(100, 100)); PaintImage image = CreatePaintWorkletPaintImage(input); SkRect src = SkRect::MakeXYWH(0, 0, 100, 100); SkRect dst = SkRect::MakeXYWH(0, 0, 100, 100); blink_buffer.push<DrawImageRectOp>(image, src, dst, SkCanvas::kStrict_SrcRectConstraint); testing::StrictMock<MockCanvas> canvas; testing::Sequence s; EXPECT_CALL(canvas, willSave()).InSequence(s); EXPECT_CALL(canvas, OnSaveLayer()).InSequence(s); EXPECT_CALL(canvas, willSave()).InSequence(s); EXPECT_CALL(canvas, didTranslate(8.0f, 8.0f)); EXPECT_CALL(canvas, OnSaveLayer()).InSequence(s); EXPECT_CALL(canvas, OnDrawRectWithColor(0u)); EXPECT_CALL(canvas, willRestore()).InSequence(s); EXPECT_CALL(canvas, willRestore()).InSequence(s); EXPECT_CALL(canvas, willRestore()).InSequence(s); EXPECT_CALL(canvas, willRestore()).InSequence(s); blink_buffer.Playback(&canvas, PlaybackParams(&provider)); } TEST(PaintOpBufferTest, RasterPaintWorkletImageRectTranslated) { sk_sp<PaintOpBuffer> paint_worklet_buffer = sk_make_sp<PaintOpBuffer>(); PaintFlags noop_flags; SkRect savelayer_rect = SkRect::MakeXYWH(0, 0, 10, 10); paint_worklet_buffer->push<SaveLayerOp>(&savelayer_rect, &noop_flags); PaintImage paint_image = CreateDiscardablePaintImage(gfx::Size(10, 10)); paint_worklet_buffer->push<DrawImageOp>( paint_image, 0.0f, 0.0f, SkSamplingOptions(SkFilterMode::kLinear), nullptr); std::vector<SkSize> src_rect_offset = {SkSize::MakeEmpty()}; std::vector<SkSize> scale_adjustment = {SkSize::Make(0.2f, 0.2f)}; std::vector<PaintFlags::FilterQuality> quality = { PaintFlags::FilterQuality::kHigh}; MockImageProvider provider(src_rect_offset, scale_adjustment, quality); provider.SetRecord(paint_worklet_buffer); PaintOpBuffer blink_buffer; scoped_refptr<TestPaintWorkletInput> input = base::MakeRefCounted<TestPaintWorkletInput>(gfx::SizeF(100, 100)); PaintImage image = CreatePaintWorkletPaintImage(input); SkRect src = SkRect::MakeXYWH(0, 0, 100, 100); SkRect dst = SkRect::MakeXYWH(5, 7, 100, 100); blink_buffer.push<DrawImageRectOp>(image, src, dst, SkCanvas::kStrict_SrcRectConstraint); testing::StrictMock<MockCanvas> canvas; testing::Sequence s; SkSamplingOptions sampling({0, 1.0f / 2}); EXPECT_CALL(canvas, willSave()).InSequence(s); EXPECT_CALL(canvas, OnSaveLayer()).InSequence(s); EXPECT_CALL(canvas, OnSaveLayer()).InSequence(s); EXPECT_CALL(canvas, didConcat44(SkM44::Translate(5.0f, 7.0f))); EXPECT_CALL(canvas, willSave()).InSequence(s); EXPECT_CALL(canvas, didScale(1.0f / scale_adjustment[0].width(), 1.0f / scale_adjustment[0].height())); EXPECT_CALL(canvas, onDrawImage2(NonLazyImage(), 0.0f, 0.0f, sampling, _)); EXPECT_CALL(canvas, willRestore()).InSequence(s); EXPECT_CALL(canvas, willRestore()).InSequence(s); EXPECT_CALL(canvas, willRestore()).InSequence(s); EXPECT_CALL(canvas, willRestore()).InSequence(s); blink_buffer.Playback(&canvas, PlaybackParams(&provider)); } TEST(PaintOpBufferTest, RasterPaintWorkletImageRectScaled) { sk_sp<PaintOpBuffer> paint_worklet_buffer = sk_make_sp<PaintOpBuffer>(); PaintFlags noop_flags; SkRect savelayer_rect = SkRect::MakeXYWH(0, 0, 10, 10); paint_worklet_buffer->push<SaveLayerOp>(&savelayer_rect, &noop_flags); PaintImage paint_image = CreateDiscardablePaintImage(gfx::Size(10, 10)); paint_worklet_buffer->push<DrawImageOp>( paint_image, 0.0f, 0.0f, SkSamplingOptions(SkFilterMode::kLinear), nullptr); std::vector<SkSize> src_rect_offset = {SkSize::MakeEmpty()}; std::vector<SkSize> scale_adjustment = {SkSize::Make(0.2f, 0.2f)}; std::vector<PaintFlags::FilterQuality> quality = { PaintFlags::FilterQuality::kHigh}; MockImageProvider provider(src_rect_offset, scale_adjustment, quality); provider.SetRecord(paint_worklet_buffer); PaintOpBuffer blink_buffer; scoped_refptr<TestPaintWorkletInput> input = base::MakeRefCounted<TestPaintWorkletInput>(gfx::SizeF(100, 100)); PaintImage image = CreatePaintWorkletPaintImage(input); SkRect src = SkRect::MakeXYWH(0, 0, 100, 100); SkRect dst = SkRect::MakeXYWH(0, 0, 200, 150); blink_buffer.push<DrawImageRectOp>(image, src, dst, SkCanvas::kStrict_SrcRectConstraint); testing::StrictMock<MockCanvas> canvas; testing::Sequence s; SkSamplingOptions sampling({0, 1.0f / 2}); EXPECT_CALL(canvas, willSave()).InSequence(s); EXPECT_CALL(canvas, OnSaveLayer()).InSequence(s); EXPECT_CALL(canvas, OnSaveLayer()).InSequence(s); EXPECT_CALL(canvas, didConcat44(SkM44::Scale(2.f, 1.5f))); EXPECT_CALL(canvas, willSave()).InSequence(s); EXPECT_CALL(canvas, didScale(1.0f / scale_adjustment[0].width(), 1.0f / scale_adjustment[0].height())); EXPECT_CALL(canvas, onDrawImage2(NonLazyImage(), 0.0f, 0.0f, sampling, _)); EXPECT_CALL(canvas, willRestore()).InSequence(s); EXPECT_CALL(canvas, willRestore()).InSequence(s); EXPECT_CALL(canvas, willRestore()).InSequence(s); EXPECT_CALL(canvas, willRestore()).InSequence(s); blink_buffer.Playback(&canvas, PlaybackParams(&provider)); } TEST(PaintOpBufferTest, RasterPaintWorkletImageRectClipped) { sk_sp<PaintOpBuffer> paint_worklet_buffer = sk_make_sp<PaintOpBuffer>(); PaintFlags noop_flags; SkRect savelayer_rect = SkRect::MakeXYWH(0, 0, 60, 60); paint_worklet_buffer->push<SaveLayerOp>(&savelayer_rect, &noop_flags); SkSamplingOptions linear(SkFilterMode::kLinear); PaintImage paint_image = CreateDiscardablePaintImage(gfx::Size(10, 10)); // One rect inside the src-rect, one outside. paint_worklet_buffer->push<DrawImageOp>(paint_image, 0.0f, 0.0f, linear, nullptr); paint_worklet_buffer->push<DrawImageOp>(paint_image, 50.0f, 50.0f, linear, nullptr); std::vector<SkSize> src_rect_offset = {SkSize::MakeEmpty()}; std::vector<SkSize> scale_adjustment = {SkSize::Make(0.2f, 0.2f)}; std::vector<PaintFlags::FilterQuality> quality = { PaintFlags::FilterQuality::kHigh}; MockImageProvider provider(src_rect_offset, scale_adjustment, quality); provider.SetRecord(paint_worklet_buffer); PaintOpBuffer blink_buffer; scoped_refptr<TestPaintWorkletInput> input = base::MakeRefCounted<TestPaintWorkletInput>(gfx::SizeF(100, 100)); PaintImage image = CreatePaintWorkletPaintImage(input); SkRect src = SkRect::MakeXYWH(0, 0, 20, 20); SkRect dst = SkRect::MakeXYWH(0, 0, 20, 20); blink_buffer.push<DrawImageRectOp>(image, src, dst, SkCanvas::kStrict_SrcRectConstraint); testing::StrictMock<MockCanvas> canvas; testing::Sequence s; SkSamplingOptions sampling({0, 1.0f / 2}); EXPECT_CALL(canvas, willSave()).InSequence(s); EXPECT_CALL(canvas, OnSaveLayer()).InSequence(s); EXPECT_CALL(canvas, OnSaveLayer()).InSequence(s); EXPECT_CALL(canvas, willSave()).InSequence(s); EXPECT_CALL(canvas, didScale(1.0f / scale_adjustment[0].width(), 1.0f / scale_adjustment[0].height())); EXPECT_CALL(canvas, onDrawImage2(NonLazyImage(), 0.0f, 0.0f, sampling, _)); EXPECT_CALL(canvas, willRestore()).InSequence(s); EXPECT_CALL(canvas, willRestore()).InSequence(s); EXPECT_CALL(canvas, willRestore()).InSequence(s); EXPECT_CALL(canvas, willRestore()).InSequence(s); blink_buffer.Playback(&canvas, PlaybackParams(&provider)); } TEST(PaintOpBufferTest, ReplacesImagesFromProvider) { std::vector<SkSize> src_rect_offset = { SkSize::MakeEmpty(), SkSize::Make(2.0f, 2.0f), SkSize::Make(3.0f, 3.0f)}; std::vector<SkSize> scale_adjustment = {SkSize::Make(0.2f, 0.2f), SkSize::Make(0.3f, 0.3f), SkSize::Make(0.4f, 0.4f)}; std::vector<PaintFlags::FilterQuality> quality = { PaintFlags::FilterQuality::kHigh, PaintFlags::FilterQuality::kMedium, PaintFlags::FilterQuality::kHigh}; MockImageProvider image_provider(src_rect_offset, scale_adjustment, quality); PaintOpBuffer buffer; SkRect rect = SkRect::MakeWH(10, 10); SkSamplingOptions sampling(SkFilterMode::kLinear); PaintImage paint_image = CreateDiscardablePaintImage(gfx::Size(10, 10)); buffer.push<DrawImageOp>(paint_image, 0.0f, 0.0f, sampling, nullptr); buffer.push<DrawImageRectOp>(paint_image, rect, rect, sampling, nullptr, SkCanvas::kFast_SrcRectConstraint); PaintFlags flags; flags.setShader(PaintShader::MakeImage(paint_image, SkTileMode::kRepeat, SkTileMode::kRepeat, nullptr)); buffer.push<DrawOvalOp>(SkRect::MakeWH(10, 10), flags); testing::StrictMock<MockCanvas> canvas; testing::Sequence s; SkSamplingOptions sampling0({0, 1.0f / 2}); SkSamplingOptions sampling1(SkFilterMode::kLinear, SkMipmapMode::kLinear); // Save/scale/image/restore from DrawImageop. EXPECT_CALL(canvas, willSave()).InSequence(s); EXPECT_CALL(canvas, didScale(1.0f / scale_adjustment[0].width(), 1.0f / scale_adjustment[0].height())); EXPECT_CALL(canvas, onDrawImage2(NonLazyImage(), 0.0f, 0.0f, sampling0, _)); EXPECT_CALL(canvas, willRestore()).InSequence(s); // DrawImageRectop. SkRect src_rect = rect.makeOffset(src_rect_offset[1].width(), src_rect_offset[1].height()); EXPECT_CALL(canvas, onDrawImageRect2(NonLazyImage(), MatchesRect(src_rect, scale_adjustment[1]), SkRect::MakeWH(10, 10), sampling1, _, SkCanvas::kFast_SrcRectConstraint)); // DrawOvalop. EXPECT_CALL(canvas, onDrawOval(SkRect::MakeWH(10, 10), MatchesShader(flags, scale_adjustment[2]))); buffer.Playback(&canvas, PlaybackParams(&image_provider)); } TEST(PaintOpBufferTest, DrawImageRectOpWithLooperNoImageProvider) { PaintOpBuffer buffer; PaintImage image = CreateDiscardablePaintImage(gfx::Size(100, 100)); SkLayerDrawLooper::Builder sk_draw_looper_builder; sk_draw_looper_builder.addLayer(20.0, 20.0); SkLayerDrawLooper::LayerInfo info_unmodified; sk_draw_looper_builder.addLayerOnTop(info_unmodified); PaintFlags paint_flags; paint_flags.setLooper(sk_draw_looper_builder.detach()); buffer.push<DrawImageRectOp>(image, SkRect::MakeWH(100, 100), SkRect::MakeWH(100, 100), SkSamplingOptions(), &paint_flags, SkCanvas::kFast_SrcRectConstraint); testing::StrictMock<MockCanvas> canvas; EXPECT_CALL(canvas, willSave); EXPECT_CALL(canvas, didTranslate); EXPECT_CALL(canvas, willRestore); EXPECT_CALL(canvas, onDrawImageRect2).Times(2); buffer.Playback(&canvas, PlaybackParams(nullptr)); } TEST(PaintOpBufferTest, DrawImageRectOpWithLooperWithImageProvider) { PaintOpBuffer buffer; PaintImage image = CreateDiscardablePaintImage(gfx::Size(100, 100)); SkLayerDrawLooper::Builder sk_draw_looper_builder; sk_draw_looper_builder.addLayer(20.0, 20.0); SkLayerDrawLooper::LayerInfo info_unmodified; sk_draw_looper_builder.addLayerOnTop(info_unmodified); PaintFlags paint_flags; paint_flags.setLooper(sk_draw_looper_builder.detach()); buffer.push<DrawImageRectOp>(image, SkRect::MakeWH(100, 100), SkRect::MakeWH(100, 100), SkSamplingOptions(), &paint_flags, SkCanvas::kFast_SrcRectConstraint); testing::StrictMock<MockCanvas> canvas; EXPECT_CALL(canvas, willSave); EXPECT_CALL(canvas, didTranslate); EXPECT_CALL(canvas, willRestore); EXPECT_CALL(canvas, onDrawImageRect2).Times(2); std::vector<SkSize> src_rect_offset = {SkSize::MakeEmpty()}; std::vector<SkSize> scale_adjustment = {SkSize::Make(1.0f, 1.0f)}; std::vector<PaintFlags::FilterQuality> quality = { PaintFlags::FilterQuality::kHigh}; MockImageProvider image_provider(src_rect_offset, scale_adjustment, quality); buffer.Playback(&canvas, PlaybackParams(&image_provider)); } TEST(PaintOpBufferTest, ReplacesImagesFromProviderOOP) { PaintOpBuffer buffer; SkSize expected_scale = SkSize::Make(0.2f, 0.5f); SkRect rect = SkRect::MakeWH(10, 10); PaintFlags flags; SkSamplingOptions sampling(SkFilterMode::kLinear); PaintImage paint_image = CreateDiscardablePaintImage(gfx::Size(10, 10)); buffer.push<ScaleOp>(expected_scale.width(), expected_scale.height()); buffer.push<DrawImageOp>(paint_image, 0.0f, 0.0f, sampling, nullptr); buffer.push<DrawImageRectOp>(paint_image, rect, rect, sampling, nullptr, SkCanvas::kFast_SrcRectConstraint); flags.setShader(PaintShader::MakeImage(paint_image, SkTileMode::kRepeat, SkTileMode::kRepeat, nullptr)); buffer.push<DrawOvalOp>(SkRect::MakeWH(10, 10), flags); std::unique_ptr<char, base::AlignedFreeDeleter> memory( static_cast<char*>(base::AlignedAlloc(PaintOpBuffer::kInitialBufferSize, PaintOpBuffer::PaintOpAlign))); TestOptionsProvider options_provider; SimpleBufferSerializer serializer(memory.get(), PaintOpBuffer::kInitialBufferSize, options_provider.serialize_options()); serializer.Serialize(&buffer); ASSERT_NE(serializer.written(), 0u); auto deserialized_buffer = PaintOpBuffer::MakeFromMemory(memory.get(), serializer.written(), options_provider.deserialize_options()); ASSERT_TRUE(deserialized_buffer); for (auto* op : PaintOpBuffer::Iterator(deserialized_buffer.get())) { testing::NiceMock<MockCanvas> canvas; PlaybackParams params(nullptr); testing::Sequence s; if (op->GetType() == PaintOpType::DrawImage) { // Save/scale/image/restore from DrawImageop. EXPECT_CALL(canvas, willSave()).InSequence(s); EXPECT_CALL(canvas, didScale(1.0f / expected_scale.width(), 1.0f / expected_scale.height())); EXPECT_CALL(canvas, onDrawImage2(NonLazyImage(), 0.0f, 0.0f, _, _)); EXPECT_CALL(canvas, willRestore()).InSequence(s); op->Raster(&canvas, params); } else if (op->GetType() == PaintOpType::DrawImageRect) { EXPECT_CALL(canvas, onDrawImageRect2(NonLazyImage(), MatchesRect(rect, expected_scale), SkRect::MakeWH(10, 10), _, _, SkCanvas::kFast_SrcRectConstraint)); op->Raster(&canvas, params); } else if (op->GetType() == PaintOpType::DrawOval) { EXPECT_CALL(canvas, onDrawOval(SkRect::MakeWH(10, 10), MatchesShader(flags, expected_scale))); op->Raster(&canvas, params); } } } class PaintFilterSerializationTest : public ::testing::TestWithParam<bool> {}; INSTANTIATE_TEST_SUITE_P(PaintFilterSerializationTests, PaintFilterSerializationTest, ::testing::Values(true, false)); TEST_P(PaintFilterSerializationTest, Basic) { SkScalar scalars[9] = {1.f, 2.f, 3.f, 4.f, 5.f, 6.f, 7.f, 8.f, 9.f}; std::vector<sk_sp<PaintFilter>> filters = { sk_sp<PaintFilter>{new ColorFilterPaintFilter( SkColorFilters::LinearToSRGBGamma(), nullptr)}, sk_sp<PaintFilter>{ new BlurPaintFilter(0.5f, 0.3f, SkTileMode::kRepeat, nullptr)}, sk_sp<PaintFilter>{new DropShadowPaintFilter( 5.f, 10.f, 0.1f, 0.3f, SK_ColorBLUE, DropShadowPaintFilter::ShadowMode::kDrawShadowOnly, nullptr)}, sk_sp<PaintFilter>{new MagnifierPaintFilter(SkRect::MakeXYWH(5, 6, 7, 8), 10.5f, nullptr)}, sk_sp<PaintFilter>{new AlphaThresholdPaintFilter( SkRegion(SkIRect::MakeXYWH(0, 0, 100, 200)), 10.f, 20.f, nullptr)}, sk_sp<PaintFilter>{new MatrixConvolutionPaintFilter( SkISize::Make(3, 3), scalars, 30.f, 123.f, SkIPoint::Make(0, 0), SkTileMode::kDecal, true, nullptr)}, sk_sp<PaintFilter>{new MorphologyPaintFilter( MorphologyPaintFilter::MorphType::kErode, 15.5f, 30.2f, nullptr)}, sk_sp<PaintFilter>{new OffsetPaintFilter(-1.f, -2.f, nullptr)}, sk_sp<PaintFilter>{new TilePaintFilter( SkRect::MakeXYWH(1, 2, 3, 4), SkRect::MakeXYWH(4, 3, 2, 1), nullptr)}, sk_sp<PaintFilter>{new TurbulencePaintFilter( TurbulencePaintFilter::TurbulenceType::kFractalNoise, 3.3f, 4.4f, 2, 123, nullptr)}, sk_sp<PaintFilter>{new MatrixPaintFilter( SkMatrix::I(), PaintFlags::FilterQuality::kHigh, nullptr)}, sk_sp<PaintFilter>{new LightingDistantPaintFilter( PaintFilter::LightingType::kSpecular, SkPoint3::Make(1, 2, 3), SK_ColorCYAN, 1.1f, 2.2f, 3.3f, nullptr)}, sk_sp<PaintFilter>{new LightingPointPaintFilter( PaintFilter::LightingType::kDiffuse, SkPoint3::Make(2, 3, 4), SK_ColorRED, 1.2f, 3.4f, 5.6f, nullptr)}, sk_sp<PaintFilter>{new LightingSpotPaintFilter( PaintFilter::LightingType::kSpecular, SkPoint3::Make(100, 200, 300), SkPoint3::Make(400, 500, 600), 1, 2, SK_ColorMAGENTA, 3, 4, 5, nullptr)}, sk_sp<PaintFilter>{ new ImagePaintFilter(CreateDiscardablePaintImage(gfx::Size(100, 100)), SkRect::MakeWH(50, 50), SkRect::MakeWH(70, 70), PaintFlags::FilterQuality::kMedium)}}; filters.emplace_back(new ComposePaintFilter(filters[0], filters[1])); filters.emplace_back( new XfermodePaintFilter(SkBlendMode::kDst, filters[2], filters[3])); filters.emplace_back(new ArithmeticPaintFilter(1.1f, 2.2f, 3.3f, 4.4f, false, filters[4], filters[5])); filters.emplace_back(new DisplacementMapEffectPaintFilter( SkColorChannel::kR, SkColorChannel::kG, 10, filters[6], filters[7])); filters.emplace_back(new MergePaintFilter(filters.data(), filters.size())); filters.emplace_back(new RecordPaintFilter( sk_sp<PaintRecord>{new PaintRecord}, SkRect::MakeXYWH(10, 15, 20, 25))); // Use a non-identity ctm to confirm that RecordPaintFilters are converted // from raster-at-scale to fixed scale properly. float scale_x = 2.f; float scale_y = 3.f; SkM44 ctm = SkM44::Scale(scale_x, scale_y); TestOptionsProvider options_provider; for (size_t i = 0; i < filters.size(); ++i) { SCOPED_TRACE(i); auto& filter = filters[i]; std::vector<uint8_t> memory; size_t buffer_size = filter->type() == PaintFilter::Type::kPaintRecord ? PaintOpBuffer::kInitialBufferSize : PaintFilter::GetFilterSize(filter.get()); buffer_size += PaintOpWriter::HeaderBytes(); memory.resize(buffer_size); PaintOpWriter writer(memory.data(), memory.size(), options_provider.serialize_options(), GetParam()); writer.Write(filter.get(), ctm); ASSERT_GT(writer.size(), 0u) << PaintFilter::TypeToString(filter->type()); sk_sp<PaintFilter> deserialized_filter; PaintOpReader reader(memory.data(), writer.size(), options_provider.deserialize_options(), GetParam()); reader.Read(&deserialized_filter); ASSERT_TRUE(deserialized_filter); if (filter->type() == PaintFilter::Type::kPaintRecord) { // The filter's scaling behavior should be converted to kFixedScale so // they are no longer equal. ASSERT_EQ(deserialized_filter->type(), PaintFilter::Type::kPaintRecord); const RecordPaintFilter& expected = static_cast<const RecordPaintFilter&>(*filter); const RecordPaintFilter& actual = static_cast<const RecordPaintFilter&>(*deserialized_filter); EXPECT_EQ(actual.scaling_behavior(), RecordPaintFilter::ScalingBehavior::kFixedScale); SkRect expected_bounds = SkRect::MakeXYWH(scale_x * expected.record_bounds().x(), scale_y * expected.record_bounds().y(), scale_x * expected.record_bounds().width(), scale_y * expected.record_bounds().height()); EXPECT_EQ(actual.record_bounds(), expected_bounds); EXPECT_EQ(actual.raster_scale().width(), scale_x); EXPECT_EQ(actual.raster_scale().height(), scale_y); // And the first op in the deserialized filter's record should be a // ScaleOp containing the extracted scale factors (if there's no // security constraints that disable record serialization) if (!GetParam()) { const ScaleOp* scale = actual.record()->GetOpAtForTesting<ScaleOp>(0); ASSERT_TRUE(scale); EXPECT_EQ(scale->sx, scale_x); EXPECT_EQ(scale->sy, scale_y); } } else { EXPECT_TRUE(*filter == *deserialized_filter); } } } TEST(PaintOpBufferTest, PaintRecordShaderSerialization) { std::unique_ptr<char, base::AlignedFreeDeleter> memory( static_cast<char*>(base::AlignedAlloc(PaintOpBuffer::kInitialBufferSize, PaintOpBuffer::PaintOpAlign))); sk_sp<PaintOpBuffer> record_buffer(new PaintOpBuffer); record_buffer->push<DrawRectOp>(SkRect::MakeXYWH(0, 0, 1, 1), PaintFlags()); TestOptionsProvider options_provider; PaintFlags flags; flags.setShader(PaintShader::MakePaintRecord( record_buffer, SkRect::MakeWH(10, 10), SkTileMode::kClamp, SkTileMode::kRepeat, nullptr)); PaintOpBuffer buffer; buffer.push<DrawRectOp>(SkRect::MakeXYWH(1, 2, 3, 4), flags); SimpleBufferSerializer serializer(memory.get(), PaintOpBuffer::kInitialBufferSize, options_provider.serialize_options()); serializer.Serialize(&buffer); ASSERT_TRUE(serializer.valid()); ASSERT_GT(serializer.written(), 0u); auto deserialized_buffer = PaintOpBuffer::MakeFromMemory(memory.get(), serializer.written(), options_provider.deserialize_options()); ASSERT_TRUE(deserialized_buffer); PaintOpBuffer::Iterator it(deserialized_buffer.get()); ASSERT_TRUE(it); auto* op = *it; ASSERT_TRUE(op->GetType() == PaintOpType::DrawRect); auto* rect_op = static_cast<DrawRectOp*>(op); EXPECT_SKRECT_EQ(rect_op->rect, SkRect::MakeXYWH(1, 2, 3, 4)); EXPECT_TRUE(rect_op->flags == flags); EXPECT_TRUE(*rect_op->flags.getShader() == *flags.getShader()); } #if BUILDFLAG(SKIA_SUPPORT_SKOTTIE) TEST(PaintOpBufferTest, BoundingRect_DrawSkottieOp) { PaintOpBuffer buffer; PushDrawSkottieOps(&buffer); SkRect rect; for (auto* base_op : PaintOpBuffer::Iterator(&buffer)) { auto* op = static_cast<DrawSkottieOp*>(base_op); ASSERT_TRUE(PaintOp::GetBounds(op, &rect)); EXPECT_EQ(rect, op->dst.makeSorted()); } } // Skottie-specific deserialization failure case. TEST(PaintOpBufferTest, DrawSkottieOpSerializationFailureFromUnPrivilegedProcess) { std::unique_ptr<char, base::AlignedFreeDeleter> memory( static_cast<char*>(base::AlignedAlloc(PaintOpBuffer::kInitialBufferSize, PaintOpBuffer::PaintOpAlign))); scoped_refptr<SkottieWrapper> skottie = CreateSkottie(gfx::Size(100, 100), /*duration_secs=*/1); ASSERT_TRUE(skottie->is_valid()); const SkRect input_rect = SkRect::MakeIWH(400, 300); const float input_t = 0.4f; PaintOpBuffer buffer; buffer.push<DrawSkottieOp>( skottie, input_rect, input_t, GetTestImagesForSkottie(*skottie, input_rect, PaintFlags::FilterQuality::kHigh, input_t)); // Serialize TestOptionsProvider options_provider; SimpleBufferSerializer serializer(memory.get(), PaintOpBuffer::kInitialBufferSize, options_provider.serialize_options()); serializer.Serialize(&buffer); ASSERT_TRUE(serializer.valid()); ASSERT_GT(serializer.written(), 0u); // De-Serialize PaintOp::DeserializeOptions d_options(options_provider.deserialize_options()); // Deserialization should fail on a non privileged process. d_options.is_privileged = false; auto deserialized_buffer = PaintOpBuffer::MakeFromMemory( memory.get(), serializer.written(), d_options); ASSERT_FALSE(deserialized_buffer); } TEST(PaintOpBufferTest, DrawSkottieOpRasterWithoutImageAssets) { scoped_refptr<SkottieWrapper> skottie = CreateSkottie(gfx::Size(100, 100), /*duration_secs=*/5); SkRect skottie_rect = SkRect::MakeWH(100, 100); DrawSkottieOp skottie_op(skottie, skottie_rect, /*t=*/0.1, /*images=*/SkottieFrameDataMap()); PlaybackParams playback_params(/*image_provider=*/nullptr); { NiceMock<MockCanvas> canvas; EXPECT_CALL(canvas, onDrawImage2(_, _, _, _, _)).Times(0); DrawSkottieOp::Raster(&skottie_op, &canvas, playback_params); } } TEST(PaintOpBufferTest, DrawSkottieOpRasterWithoutImageProvider) { scoped_refptr<SkottieWrapper> skottie = CreateSkottieFromString(kLottieDataWith2Assets); SkRect skottie_rect = SkRect::MakeWH(100, 100); SkottieFrameDataMap images_in = GetTestImagesForSkottie( *skottie, skottie_rect, PaintFlags::FilterQuality::kHigh, /*t=*/0.1f); ASSERT_FALSE(images_in.empty()); DrawSkottieOp skottie_op(skottie, skottie_rect, /*t=*/0.1, images_in); PlaybackParams playback_params(/*image_provider=*/nullptr); { NiceMock<MockCanvas> canvas; // Do not over-assert. Ultimately it is up to Skottie's implementation how // many "draw image" calls are made, and what the arguments are. But it's // fair to say that it has to make at least one "draw image" call for a // frame in the animation that renders one of the assets. EXPECT_CALL(canvas, onDrawImage2(NotNull(), _, _, _, _)).Times(AtLeast(1)); DrawSkottieOp::Raster(&skottie_op, &canvas, playback_params); } } TEST(PaintOpBufferTest, DrawSkottieOpRasterWithImageProvider) { scoped_refptr<SkottieWrapper> skottie = CreateSkottieFromString(kLottieDataWith2Assets); SkRect skottie_rect = SkRect::MakeWH(100, 100); std::vector<SkSize> src_rect_offset = {SkSize::Make(2.0f, 2.0f), SkSize::Make(3.0f, 3.0f)}; std::vector<SkSize> scale_adjustment = {SkSize::Make(0.2f, 0.2f), SkSize::Make(0.3f, 0.3f)}; std::vector<PaintFlags::FilterQuality> quality = { PaintFlags::FilterQuality::kHigh, PaintFlags::FilterQuality::kMedium}; MockImageProvider image_provider(src_rect_offset, scale_adjustment, quality); PlaybackParams playback_params(&image_provider); ASSERT_TRUE(image_provider.decoded_images().empty()); { SkottieFrameDataMap images_in = GetTestImagesForSkottie( *skottie, skottie_rect, PaintFlags::FilterQuality::kHigh, /*t=*/0.25f); ASSERT_THAT(images_in, Contains(Key(HashSkottieResourceId("image_0")))); DrawSkottieOp skottie_op(skottie, skottie_rect, /*t=*/0.25, images_in); NiceMock<MockCanvas> canvas; EXPECT_CALL(canvas, onDrawImage2(NotNull(), _, _, _, _)).Times(AtLeast(1)); DrawSkottieOp::Raster(&skottie_op, &canvas, playback_params); ASSERT_EQ(image_provider.decoded_images().size(), 1u); EXPECT_THAT(image_provider.decoded_images(), Contains(MatchesPaintImage( images_in.at(HashSkottieResourceId("image_0")).image))); } { SkottieFrameDataMap images_in = GetTestImagesForSkottie( *skottie, skottie_rect, PaintFlags::FilterQuality::kHigh, /*t=*/0.75f); ASSERT_THAT(images_in, Contains(Key(HashSkottieResourceId("image_1")))); DrawSkottieOp skottie_op(skottie, skottie_rect, /*t=*/0.75, images_in); NiceMock<MockCanvas> canvas; EXPECT_CALL(canvas, onDrawImage2(NotNull(), _, _, _, _)).Times(AtLeast(1)); DrawSkottieOp::Raster(&skottie_op, &canvas, playback_params); ASSERT_EQ(image_provider.decoded_images().size(), 2u); EXPECT_THAT(image_provider.decoded_images(), Contains(MatchesPaintImage( images_in.at(HashSkottieResourceId("image_1")).image))); } } TEST(PaintOpBufferTest, DiscardableImagesTrackingSkottieOpNoImages) { PaintOpBuffer buffer; buffer.push<DrawSkottieOp>( CreateSkottie(gfx::Size(100, 100), /*duration_secs=*/1), /*dst=*/SkRect::MakeWH(100, 100), /*t=*/0.1f, SkottieFrameDataMap()); EXPECT_FALSE(buffer.HasDiscardableImages()); } TEST(PaintOpBufferTest, DiscardableImagesTrackingSkottieOpWithImages) { PaintOpBuffer buffer; scoped_refptr<SkottieWrapper> skottie = CreateSkottieFromString(kLottieDataWith2Assets); SkRect skottie_rect = SkRect::MakeWH(100, 100); SkottieFrameDataMap images_in = GetTestImagesForSkottie( *skottie, skottie_rect, PaintFlags::FilterQuality::kHigh, /*t=*/0.1f); ASSERT_FALSE(images_in.empty()); buffer.push<DrawSkottieOp>(skottie, skottie_rect, /*t=*/0.1f, images_in); EXPECT_TRUE(buffer.HasDiscardableImages()); } TEST(PaintOpBufferTest, OpHasDiscardableImagesSkottieOpNoImages) { DrawSkottieOp op(CreateSkottie(gfx::Size(100, 100), /*duration_secs=*/1), /*dst=*/SkRect::MakeWH(100, 100), /*t=*/0.1f, SkottieFrameDataMap()); EXPECT_FALSE(PaintOp::OpHasDiscardableImages(&op)); } TEST(PaintOpBufferTest, OpHasDiscardableImagesSkottieOpWithImages) { scoped_refptr<SkottieWrapper> skottie = CreateSkottieFromString(kLottieDataWith2Assets); SkRect skottie_rect = SkRect::MakeWH(100, 100); SkottieFrameDataMap images_in = GetTestImagesForSkottie( *skottie, skottie_rect, PaintFlags::FilterQuality::kHigh, /*t=*/0.1f); ASSERT_FALSE(images_in.empty()); DrawSkottieOp op(skottie, skottie_rect, /*t=*/0.1f, images_in); EXPECT_TRUE(PaintOp::OpHasDiscardableImages(&op)); } #endif // BUILDFLAG(SKIA_SUPPORT_SKOTTIE) TEST(PaintOpBufferTest, CustomData) { // Basic tests: size, move, comparison. { PaintOpBuffer buffer; EXPECT_EQ(buffer.size(), 0u); EXPECT_EQ(buffer.bytes_used(), sizeof(PaintOpBuffer)); buffer.push<CustomDataOp>(1234u); EXPECT_EQ(buffer.size(), 1u); EXPECT_GT(buffer.bytes_used(), sizeof(PaintOpBuffer) + sizeof(CustomDataOp)); PaintOpBuffer new_buffer = std::move(buffer); EXPECT_EQ(buffer.size(), 0u); EXPECT_EQ(new_buffer.size(), 1u); EXPECT_EQ(new_buffer.GetFirstOp()->GetType(), PaintOpType::CustomData); PaintOpBuffer buffer2; buffer2.push<CustomDataOp>(1234u); EXPECT_TRUE(*new_buffer.GetFirstOp() == *buffer2.GetFirstOp()); } // Push and verify. { PaintOpBuffer buffer; buffer.push<SaveOp>(); buffer.push<CustomDataOp>(0xFFFFFFFF); buffer.push<RestoreOp>(); EXPECT_EQ(buffer.size(), 3u); PaintOpBuffer::Iterator iter(&buffer); ASSERT_EQ(iter->GetType(), PaintOpType::Save); ++iter; ASSERT_EQ(iter->GetType(), PaintOpType::CustomData); ++iter; ASSERT_EQ(iter->GetType(), PaintOpType::Restore); ++iter; } // Playback. { PaintOpBuffer buffer; buffer.push<CustomDataOp>(9999u); testing::StrictMock<MockCanvas> canvas; EXPECT_CALL(canvas, onCustomCallback(&canvas, 9999)).Times(1); buffer.Playback(&canvas, PlaybackParams(nullptr, SkM44(), base::BindRepeating( &MockCanvas::onCustomCallback, base::Unretained(&canvas)))); } } TEST(PaintOpBufferTest, SecurityConstrainedImageSerialization) { auto image = CreateDiscardablePaintImage(gfx::Size(10, 10)); sk_sp<PaintFilter> filter = sk_make_sp<ImagePaintFilter>( image, SkRect::MakeWH(10, 10), SkRect::MakeWH(10, 10), PaintFlags::FilterQuality::kLow); const bool enable_security_constraints = true; std::unique_ptr<char, base::AlignedFreeDeleter> memory( static_cast<char*>(base::AlignedAlloc(PaintOpBuffer::kInitialBufferSize, PaintOpBuffer::PaintOpAlign))); TestOptionsProvider options_provider; PaintOpWriter writer(memory.get(), PaintOpBuffer::kInitialBufferSize, options_provider.serialize_options(), enable_security_constraints); writer.Write(filter.get(), SkM44()); sk_sp<PaintFilter> out_filter; PaintOpReader reader(memory.get(), writer.size(), options_provider.deserialize_options(), enable_security_constraints); reader.Read(&out_filter); EXPECT_TRUE(*filter == *out_filter); } TEST(PaintOpBufferTest, DrawImageRectSerializeScaledImages) { auto buffer = sk_make_sp<PaintOpBuffer>(); // scales: x dimension = x0.25, y dimension = x5 // translations here are arbitrary SkRect src = SkRect::MakeXYWH(3, 4, 20, 6); SkRect dst = SkRect::MakeXYWH(20, 38, 5, 30); // Adjust transform matrix so that order of operations for src->dst is // confirmed to be applied before the canvas's transform. buffer->push<TranslateOp>(.5f * dst.centerX(), 2.f * dst.centerY()); buffer->push<RotateOp>(90.f); buffer->push<TranslateOp>(-.5f * dst.centerX(), -2.f * dst.centerY()); buffer->push<ScaleOp>(0.5f, 2.0f); buffer->push<DrawImageRectOp>(CreateDiscardablePaintImage(gfx::Size(32, 16)), src, dst, SkCanvas::kStrict_SrcRectConstraint); std::unique_ptr<char, base::AlignedFreeDeleter> memory( static_cast<char*>(base::AlignedAlloc(PaintOpBuffer::kInitialBufferSize, PaintOpBuffer::PaintOpAlign))); TestOptionsProvider options_provider; SimpleBufferSerializer serializer(memory.get(), PaintOpBuffer::kInitialBufferSize, options_provider.serialize_options()); serializer.Serialize(buffer.get()); ASSERT_EQ(options_provider.decoded_images().size(), 1u); auto scale = options_provider.decoded_images().at(0).scale(); EXPECT_EQ(scale.width(), 0.5f * 0.25f); EXPECT_EQ(scale.height(), 2.0f * 5.0f); } TEST(PaintOpBufferTest, RecordShadersSerializeScaledImages) { auto record_buffer = sk_make_sp<PaintOpBuffer>(); record_buffer->push<DrawImageOp>( CreateDiscardablePaintImage(gfx::Size(10, 10)), 0.f, 0.f); auto shader = PaintShader::MakePaintRecord( record_buffer, SkRect::MakeWH(10.f, 10.f), SkTileMode::kRepeat, SkTileMode::kRepeat, nullptr); shader->set_has_animated_images(true); auto buffer = sk_make_sp<PaintOpBuffer>(); buffer->push<ScaleOp>(0.5f, 0.8f); PaintFlags flags; flags.setShader(shader); buffer->push<DrawRectOp>(SkRect::MakeWH(10.f, 10.f), flags); std::unique_ptr<char, base::AlignedFreeDeleter> memory( static_cast<char*>(base::AlignedAlloc(PaintOpBuffer::kInitialBufferSize, PaintOpBuffer::PaintOpAlign))); TestOptionsProvider options_provider; SimpleBufferSerializer serializer(memory.get(), PaintOpBuffer::kInitialBufferSize, options_provider.serialize_options()); serializer.Serialize(buffer.get()); ASSERT_EQ(options_provider.decoded_images().size(), 1u); auto scale = options_provider.decoded_images().at(0).scale(); EXPECT_EQ(scale.width(), 0.5f); EXPECT_EQ(scale.height(), 0.8f); } TEST(PaintOpBufferTest, RecordShadersCached) { auto record_buffer = sk_make_sp<PaintOpBuffer>(); record_buffer->push<DrawImageOp>( CreateDiscardablePaintImage(gfx::Size(10, 10)), 0.f, 0.f); auto shader = PaintShader::MakePaintRecord( record_buffer, SkRect::MakeWH(10.f, 10.f), SkTileMode::kRepeat, SkTileMode::kRepeat, nullptr); shader->set_has_animated_images(false); auto shader_id = shader->paint_record_shader_id(); TestOptionsProvider options_provider; auto* transfer_cache = options_provider.transfer_cache_helper(); // Generate serialized |memory|. std::unique_ptr<char, base::AlignedFreeDeleter> memory( static_cast<char*>(base::AlignedAlloc(PaintOpBuffer::kInitialBufferSize, PaintOpBuffer::PaintOpAlign))); size_t memory_written = 0; { auto buffer = sk_make_sp<PaintOpBuffer>(); PaintFlags flags; flags.setShader(shader); buffer->push<DrawRectOp>(SkRect::MakeWH(10.f, 10.f), flags); SimpleBufferSerializer serializer(memory.get(), PaintOpBuffer::kInitialBufferSize, options_provider.serialize_options()); serializer.Serialize(buffer.get()); memory_written = serializer.written(); } // Generate serialized |memory_scaled|, which is the same pob, but with // a scale factor. std::unique_ptr<char, base::AlignedFreeDeleter> memory_scaled( static_cast<char*>(base::AlignedAlloc(PaintOpBuffer::kInitialBufferSize, PaintOpBuffer::PaintOpAlign))); size_t memory_scaled_written = 0; { auto buffer = sk_make_sp<PaintOpBuffer>(); PaintFlags flags; flags.setShader(shader); // This buffer has an additional scale op. buffer->push<ScaleOp>(2.0f, 3.7f); buffer->push<DrawRectOp>(SkRect::MakeWH(10.f, 10.f), flags); SimpleBufferSerializer serializer(memory_scaled.get(), PaintOpBuffer::kInitialBufferSize, options_provider.serialize_options()); serializer.Serialize(buffer.get()); memory_scaled_written = serializer.written(); } // Hold onto records so PaintShader pointer comparisons are valid. sk_sp<PaintRecord> records[5]; SkPicture* last_shader = nullptr; std::vector<uint8_t> scratch_buffer; PaintOp::DeserializeOptions deserialize_options( transfer_cache, options_provider.service_paint_cache(), options_provider.strike_client(), &scratch_buffer, true, nullptr); // Several deserialization test cases: // (0) deserialize once, verify cached is the same as deserialized version // (1) deserialize again, verify shader gets reused // (2) change scale, verify shader is new // (3) sanity check, same new scale + same new colorspace, shader is reused. for (size_t i = 0; i < 4; ++i) { if (i < 2) { records[i] = PaintOpBuffer::MakeFromMemory(memory.get(), memory_written, deserialize_options); } else { records[i] = PaintOpBuffer::MakeFromMemory( memory_scaled.get(), memory_scaled_written, deserialize_options); } auto* entry = transfer_cache->GetEntryAs<ServiceShaderTransferCacheEntry>(shader_id); ASSERT_TRUE(entry); if (i < 2) EXPECT_EQ(records[i]->size(), 1u); else EXPECT_EQ(records[i]->size(), 2u); for (auto* base_op : PaintOpBuffer::Iterator(records[i].get())) { if (base_op->GetType() != PaintOpType::DrawRect) continue; auto* op = static_cast<const DrawRectOp*>(base_op); // In every case, the shader in the op should get cached for future // use. auto* op_skshader = op->flags.getShader()->sk_cached_picture_.get(); EXPECT_EQ(op_skshader, entry->shader()->sk_cached_picture_.get()); switch (i) { case 0: // Nothing to check. break; case 1: EXPECT_EQ(op_skshader, last_shader); break; case 2: EXPECT_NE(op_skshader, last_shader); break; case 3: EXPECT_EQ(op_skshader, last_shader); break; } last_shader = op_skshader; } } } TEST(PaintOpBufferTest, RecordShadersCachedSize) { auto record_buffer = sk_make_sp<PaintOpBuffer>(); size_t estimated_image_size = 30 * 30 * 4; auto image = CreateBitmapImage(gfx::Size(30, 30)); record_buffer->push<DrawImageOp>(image, 0.f, 0.f); auto shader = PaintShader::MakePaintRecord( record_buffer, SkRect::MakeWH(10.f, 10.f), SkTileMode::kRepeat, SkTileMode::kRepeat, nullptr); shader->set_has_animated_images(false); auto shader_id = shader->paint_record_shader_id(); TestOptionsProvider options_provider; auto* transfer_cache = options_provider.transfer_cache_helper(); // Generate serialized |memory|. std::unique_ptr<char, base::AlignedFreeDeleter> memory( static_cast<char*>(base::AlignedAlloc(PaintOpBuffer::kInitialBufferSize, PaintOpBuffer::PaintOpAlign))); auto buffer = sk_make_sp<PaintOpBuffer>(); PaintFlags flags; flags.setShader(shader); buffer->push<DrawRectOp>(SkRect::MakeWH(10.f, 10.f), flags); SimpleBufferSerializer serializer(memory.get(), PaintOpBuffer::kInitialBufferSize, options_provider.serialize_options()); options_provider.context_supports_distance_field_text(); serializer.Serialize(buffer.get()); std::vector<uint8_t> scratch_buffer; PaintOp::DeserializeOptions deserialize_options( transfer_cache, options_provider.service_paint_cache(), options_provider.strike_client(), &scratch_buffer, true, nullptr); auto record = PaintOpBuffer::MakeFromMemory( memory.get(), serializer.written(), deserialize_options); auto* shader_entry = transfer_cache->GetEntryAs<ServiceShaderTransferCacheEntry>(shader_id); ASSERT_TRUE(shader_entry); // The size of the shader in the cache should be bigger than both the record // and the image. Exact numbers not used here to not overfit this test. size_t shader_size = shader_entry->CachedSize(); EXPECT_GT(estimated_image_size, serializer.written()); EXPECT_GT(shader_size, estimated_image_size); } TEST(PaintOpBufferTest, RecordFilterSerializeScaledImages) { auto record_buffer = sk_make_sp<PaintOpBuffer>(); record_buffer->push<DrawImageOp>( CreateDiscardablePaintImage(gfx::Size(10, 10)), 0.f, 0.f); auto filter = sk_make_sp<RecordPaintFilter>(record_buffer, SkRect::MakeWH(10.f, 10.f)); auto buffer = sk_make_sp<PaintOpBuffer>(); buffer->push<ScaleOp>(0.5f, 0.8f); PaintFlags flags; flags.setImageFilter(filter); buffer->push<DrawRectOp>(SkRect::MakeWH(10.f, 10.f), flags); std::unique_ptr<char, base::AlignedFreeDeleter> memory( static_cast<char*>(base::AlignedAlloc(PaintOpBuffer::kInitialBufferSize, PaintOpBuffer::PaintOpAlign))); TestOptionsProvider options_provider; SimpleBufferSerializer serializer(memory.get(), PaintOpBuffer::kInitialBufferSize, options_provider.serialize_options()); serializer.Serialize(buffer.get()); ASSERT_EQ(options_provider.decoded_images().size(), 1u); auto scale = options_provider.decoded_images().at(0).scale(); EXPECT_EQ(scale.width(), 0.5f); EXPECT_EQ(scale.height(), 0.8f); } TEST(PaintOpBufferTest, TotalOpCount) { auto record_buffer = sk_make_sp<PaintOpBuffer>(); auto sub_record_buffer = sk_make_sp<PaintOpBuffer>(); auto sub_sub_record_buffer = sk_make_sp<PaintOpBuffer>(); PushDrawRectOps(sub_sub_record_buffer.get()); PushDrawRectOps(sub_record_buffer.get()); PushDrawRectOps(record_buffer.get()); sub_record_buffer->push<DrawRecordOp>(sub_sub_record_buffer); record_buffer->push<DrawRecordOp>(sub_record_buffer); size_t len = std::min(test_rects.size(), test_flags.size()); EXPECT_EQ(len, sub_sub_record_buffer->total_op_count()); EXPECT_EQ(2 * len + 1, sub_record_buffer->total_op_count()); EXPECT_EQ(3 * len + 2, record_buffer->total_op_count()); } TEST(PaintOpBufferTest, NullImages) { PaintOpBuffer buffer; buffer.push<DrawImageOp>(PaintImage(), 0.f, 0.f); std::unique_ptr<char, base::AlignedFreeDeleter> memory( static_cast<char*>(base::AlignedAlloc(PaintOpBuffer::kInitialBufferSize, PaintOpBuffer::PaintOpAlign))); TestOptionsProvider options_provider; SimpleBufferSerializer serializer(memory.get(), PaintOpBuffer::kInitialBufferSize, options_provider.serialize_options()); serializer.Serialize(&buffer); ASSERT_TRUE(serializer.valid()); ASSERT_GT(serializer.written(), 0u); auto deserialized_buffer = PaintOpBuffer::MakeFromMemory(memory.get(), serializer.written(), options_provider.deserialize_options()); ASSERT_TRUE(deserialized_buffer); ASSERT_EQ(deserialized_buffer->size(), 1u); ASSERT_EQ(deserialized_buffer->GetFirstOp()->GetType(), PaintOpType::DrawImage); } TEST(PaintOpBufferTest, HasDrawOpsAndHasDrawTextOps) { auto buffer1 = sk_make_sp<PaintOpBuffer>(); EXPECT_FALSE(buffer1->has_draw_ops()); EXPECT_FALSE(buffer1->has_draw_text_ops()); buffer1->push<DrawRectOp>(SkRect::MakeWH(3, 4), PaintFlags()); PushDrawRectOps(buffer1.get()); EXPECT_TRUE(buffer1->has_draw_ops()); EXPECT_FALSE(buffer1->has_draw_text_ops()); auto buffer2 = sk_make_sp<PaintOpBuffer>(); EXPECT_FALSE(buffer2->has_draw_ops()); EXPECT_FALSE(buffer2->has_draw_text_ops()); buffer2->push<DrawRecordOp>(std::move(buffer1)); EXPECT_TRUE(buffer2->has_draw_ops()); EXPECT_FALSE(buffer2->has_draw_text_ops()); buffer2->push<DrawTextBlobOp>(SkTextBlob::MakeFromString("abc", SkFont()), 0.0f, 0.0f, PaintFlags()); EXPECT_TRUE(buffer2->has_draw_ops()); EXPECT_TRUE(buffer2->has_draw_text_ops()); buffer2->push<DrawRectOp>(SkRect::MakeWH(4, 5), PaintFlags()); EXPECT_TRUE(buffer2->has_draw_ops()); EXPECT_TRUE(buffer2->has_draw_text_ops()); auto buffer3 = sk_make_sp<PaintOpBuffer>(); EXPECT_FALSE(buffer3->has_draw_text_ops()); EXPECT_FALSE(buffer3->has_draw_ops()); buffer3->push<DrawRecordOp>(std::move(buffer2)); EXPECT_TRUE(buffer3->has_draw_ops()); EXPECT_TRUE(buffer3->has_draw_text_ops()); } TEST(PaintOpBufferTest, HasEffectsPreventingLCDTextForSaveLayerAlpha) { auto buffer1 = sk_make_sp<PaintOpBuffer>(); EXPECT_FALSE(buffer1->has_effects_preventing_lcd_text_for_save_layer_alpha()); buffer1->push<DrawRectOp>(SkRect::MakeWH(3, 4), PaintFlags()); EXPECT_FALSE(buffer1->has_effects_preventing_lcd_text_for_save_layer_alpha()); auto buffer2 = sk_make_sp<PaintOpBuffer>(); EXPECT_FALSE(buffer2->has_effects_preventing_lcd_text_for_save_layer_alpha()); buffer2->push<DrawRecordOp>(std::move(buffer1)); EXPECT_FALSE(buffer2->has_effects_preventing_lcd_text_for_save_layer_alpha()); buffer2->push<SaveLayerOp>(nullptr, nullptr); EXPECT_TRUE(buffer2->has_effects_preventing_lcd_text_for_save_layer_alpha()); buffer2->push<DrawRectOp>(SkRect::MakeWH(4, 5), PaintFlags()); EXPECT_TRUE(buffer2->has_effects_preventing_lcd_text_for_save_layer_alpha()); auto buffer3 = sk_make_sp<PaintOpBuffer>(); EXPECT_FALSE(buffer3->has_effects_preventing_lcd_text_for_save_layer_alpha()); buffer3->push<DrawRecordOp>(std::move(buffer2)); EXPECT_TRUE(buffer3->has_effects_preventing_lcd_text_for_save_layer_alpha()); } TEST(PaintOpBufferTest, NeedsAdditionalInvalidationForLCDText) { auto buffer1 = sk_make_sp<PaintOpBuffer>(); buffer1->push<SaveLayerAlphaOp>(nullptr, uint8_t{100}); EXPECT_FALSE(buffer1->has_draw_text_ops()); EXPECT_TRUE(buffer1->has_save_layer_alpha_ops()); EXPECT_FALSE(buffer1->has_effects_preventing_lcd_text_for_save_layer_alpha()); auto buffer2 = sk_make_sp<PaintOpBuffer>(); buffer2->push<DrawTextBlobOp>(SkTextBlob::MakeFromString("abc", SkFont()), 0.0f, 0.0f, PaintFlags()); buffer2->push<SaveLayerOp>(nullptr, nullptr); EXPECT_TRUE(buffer2->has_draw_ops()); EXPECT_FALSE(buffer2->has_save_layer_alpha_ops()); EXPECT_TRUE(buffer2->has_effects_preventing_lcd_text_for_save_layer_alpha()); // Neither buffer has effects preventing lcd text for SaveLayerAlpha. EXPECT_FALSE(buffer1->NeedsAdditionalInvalidationForLCDText(*buffer2)); EXPECT_FALSE(buffer2->NeedsAdditionalInvalidationForLCDText(*buffer1)); { auto buffer3 = sk_make_sp<PaintOpBuffer>(); buffer3->push<DrawRecordOp>(buffer2); EXPECT_TRUE( buffer3->has_effects_preventing_lcd_text_for_save_layer_alpha()); // Neither buffer has both DrawText and SaveLayerAlpha. EXPECT_FALSE(buffer1->NeedsAdditionalInvalidationForLCDText(*buffer3)); EXPECT_FALSE(buffer3->NeedsAdditionalInvalidationForLCDText(*buffer1)); EXPECT_FALSE(buffer2->NeedsAdditionalInvalidationForLCDText(*buffer3)); EXPECT_FALSE(buffer3->NeedsAdditionalInvalidationForLCDText(*buffer2)); } { buffer1->push<DrawTextBlobOp>(SkTextBlob::MakeFromString("abc", SkFont()), 0.0f, 0.0f, PaintFlags()); EXPECT_TRUE(buffer1->has_draw_text_ops()); EXPECT_TRUE(buffer1->has_save_layer_alpha_ops()); EXPECT_FALSE( buffer1->has_effects_preventing_lcd_text_for_save_layer_alpha()); auto buffer3 = sk_make_sp<PaintOpBuffer>(); buffer3->push<DrawRecordOp>(buffer1); buffer3->push<DrawRecordOp>(buffer2); EXPECT_TRUE(buffer3->has_draw_text_ops()); EXPECT_TRUE(buffer3->has_save_layer_alpha_ops()); EXPECT_TRUE( buffer3->has_effects_preventing_lcd_text_for_save_layer_alpha()); // Both have DrawText and SaveLayerAlpha, and have different // has_effects_preventing_lcd_text_for_save_layer_alpha(). EXPECT_TRUE(buffer1->NeedsAdditionalInvalidationForLCDText(*buffer3)); EXPECT_TRUE(buffer3->NeedsAdditionalInvalidationForLCDText(*buffer1)); EXPECT_FALSE(buffer3->NeedsAdditionalInvalidationForLCDText(*buffer3)); } } // A regression test for crbug.com/1195276. Ensure that PlaybackParams works // with SetMatrix operations. TEST(PaintOpBufferTest, SetMatrixOpWithNonIdentityPlaybackParams) { for (const auto& original_ctm : test_matrices) { for (const auto& matrix : test_matrices) { SkCanvas device(0, 0); SkCanvas* canvas = &device; PlaybackParams params(nullptr, original_ctm); SetMatrixOp op(matrix); SetMatrixOp::Raster(&op, canvas, params); EXPECT_TRUE(AnnotateOp::AreSkM44sEqual(canvas->getLocalToDevice(), SkM44(original_ctm, matrix))); } } } TEST(PaintOpBufferTest, PathCaching) { SkPath path; PaintFlags flags; // Grow path large enough to trigger caching path.moveTo(0, 0); for (int x = 1; x < 100; ++x) path.lineTo(x, x % 1); TestOptionsProvider options_provider; std::unique_ptr<char, base::AlignedFreeDeleter> memory( static_cast<char*>(base::AlignedAlloc(PaintOpBuffer::kInitialBufferSize, PaintOpBuffer::PaintOpAlign))); auto buffer = sk_make_sp<PaintOpBuffer>(); buffer->push<DrawPathOp>(path, flags, UsePaintCache::kEnabled); SimpleBufferSerializer serializer(memory.get(), PaintOpBuffer::kInitialBufferSize, options_provider.serialize_options()); serializer.Serialize(buffer.get()); EXPECT_TRUE(options_provider.client_paint_cache()->Get( PaintCacheDataType::kPath, path.getGenerationID())); auto deserialized_buffer = PaintOpBuffer::MakeFromMemory(memory.get(), serializer.written(), options_provider.deserialize_options()); ASSERT_TRUE(deserialized_buffer); ASSERT_EQ(deserialized_buffer->size(), 1u); ASSERT_EQ(deserialized_buffer->GetFirstOp()->GetType(), PaintOpType::DrawPath); SkPath cached_path; EXPECT_TRUE(options_provider.service_paint_cache()->GetPath( path.getGenerationID(), &cached_path)); } } // namespace cc
//////////////////////////////////////////////////////////////////////////// // SOFTWARE COPYRIGHT NOTICE AGREEMENT // // This software and its documentation are copyright (2009) by the // // Broad Institute. All rights are reserved. This software is supplied // // without any warranty or guaranteed support whatsoever. The Broad // // Institute is not responsible for its use, misuse, or functionality. // //////////////////////////////////////////////////////////////////////////// /* * \file QualNibbleVec.cc * \author tsharpe * \date Oct 21, 2009 * * \brief */ #include "feudal/QualNibbleVec.h" QualNibbleVec& QualNibbleVec::squash( unsigned radius ) { size_t nnn = size(); value_type* vals = new value_type[nnn]; value_type* end = vals + nnn; value_type* ppp = vals; for ( size_t idx = 0; idx < nnn; ++idx ) *ppp++ = operator[](idx); using std::max; using std::min; using std::min_element; ppp = vals; for ( size_t idx = 0; idx < nnn; ++idx, ++ppp ) set(idx,*min_element(max(vals,ppp-radius),min(ppp+radius+1,end))); delete [] vals; return *this; } void WriteAll(QualNibbleVecVec const& quals, String const& fn) { IncrementalWriter<QualVec> writer(fn.c_str()); for (size_t i = 0; i < quals.size(); ++i) writer.add(quals[i].GetQualvector()); writer.close(); } void LoadQualNibbleVec(const String & fn, QualNibbleVecVec * quals) { typedef VirtualMasterVec<QualVec> VVQV; typedef VVQV::const_iterator Itr; VVQV vvqv(fn.c_str()); quals->clear().reserve(vvqv.size()); for (Itr itr(vvqv.begin()), end(vvqv.end()); itr != end; ++itr ) quals->push_back(QualNibbleVec(*itr)); } #include "feudal/OuterVecDefs.h" template class OuterVec<QualNibbleVec>;
/* * Copyright 2012 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 <math.h> #include <locale.h> #include <boost/algorithm/string.hpp> #include "sdf/Param.hh" using namespace sdf; class string_set : public boost::static_visitor<> { public: explicit string_set(const std::string &_value) : value(_value) {} public: template <typename T> void operator()(T & _operand) const { _operand = boost::lexical_cast<T>(this->value); } public: std::string value; }; class any_set : public boost::static_visitor<> { public: explicit any_set(const boost::any &_value) {this->value = _value;} public: template <typename T> void operator()(T & _operand) const { _operand = boost::any_cast<T>(this->value); } public: boost::any value; }; ////////////////////////////////////////////////// Param::Param(const std::string &_key, const std::string &_typeName, const std::string &_default, bool _required, const std::string &_description) : dataPtr(new ParamPrivate) { this->dataPtr->key = _key; this->dataPtr->required = _required; this->dataPtr->typeName = _typeName; this->dataPtr->description = _description; this->dataPtr->set = false; if (this->dataPtr->typeName == "bool") { this->Init<bool>(_default); } else if (this->dataPtr->typeName == "int") { this->Init<int>(_default); } else if (this->dataPtr->typeName == "unsigned int") { this->Init<unsigned int>(_default); } else if (this->dataPtr->typeName == "uint64_t") { this->Init<uint64_t>(_default); } else if (this->dataPtr->typeName == "double") { this->Init<double>(_default); } else if (this->dataPtr->typeName == "float") { this->Init<float>(_default); } else if (this->dataPtr->typeName == "char") { this->Init<char>(_default); } else if (this->dataPtr->typeName == "std::string" || this->dataPtr->typeName == "string") { this->Init<std::string>(_default); } else if (this->dataPtr->typeName == "sdf::Time" || this->dataPtr->typeName == "time") { this->Init<sdf::Time>(_default); } else if (this->dataPtr->typeName == "sdf::Color" || this->dataPtr->typeName == "color") { this->Init<sdf::Color>(_default); } else if (this->dataPtr->typeName == "ignition::math::Vector2i" || this->dataPtr->typeName == "vector2i") { this->Init<ignition::math::Vector2i>(_default); } else if (this->dataPtr->typeName == "ignition::math::Vector2d" || this->dataPtr->typeName == "vector2d") { this->Init<ignition::math::Vector2d>(_default); } else if (this->dataPtr->typeName == "ignition::math::Vector3d" || this->dataPtr->typeName == "vector3") { this->Init<ignition::math::Vector3d>(_default); } else if (this->dataPtr->typeName == "ignition::math::Pose3d" || this->dataPtr->typeName == "pose" || this->dataPtr->typeName == "Pose") { this->Init<ignition::math::Pose3d>(_default); } else if (this->dataPtr->typeName == "ignition::math::Quaterniond" || this->dataPtr->typeName == "quaternion") { this->Init<ignition::math::Quaterniond>(_default); } else { sdferr << "Unknown parameter type[" << this->dataPtr->typeName << "]\n"; } } ////////////////////////////////////////////////// Param::~Param() { delete this->dataPtr; this->dataPtr = nullptr; } ////////////////////////////////////////////////// bool Param::GetAny(boost::any &_anyVal) const { if (this->IsType<int>()) { int ret = 0; if (!this->Get<int>(ret)) { return false; } _anyVal = ret; } else if (this->IsType<uint64_t>()) { uint64_t ret = 0; if (!this->Get<uint64_t>(ret)) { return false; } _anyVal = ret; } else if (this->IsType<double>()) { double ret = 0; if (!this->Get<double>(ret)) { return false; } _anyVal = ret; } else if (this->IsType<float>()) { float ret = 0; if (!this->Get<float>(ret)) { return false; } _anyVal = ret; } else if (this->IsType<bool>()) { bool ret = false; if (!this->Get<bool>(ret)) { return false; } _anyVal = ret; } else if (this->IsType<std::string>()) { std::string ret; if (!this->Get<std::string>(ret)) { return false; } _anyVal = ret; } else if (this->IsType<unsigned int>()) { unsigned int ret = 0; if (!this->Get<unsigned int>(ret)) { return false; } _anyVal = ret; } else if (this->IsType<char>()) { char ret = 0; if (!this->Get<char>(ret)) { return false; } _anyVal = ret; } else if (this->IsType<sdf::Time>()) { sdf::Time ret; if (!this->Get<sdf::Time>(ret)) { return false; } _anyVal = ret; } else if (this->IsType<sdf::Color>()) { sdf::Color ret; if (!this->Get<sdf::Color>(ret)) { return false; } _anyVal = ret; } else if (this->IsType<ignition::math::Vector3d>()) { ignition::math::Vector3d ret; if (!this->Get<ignition::math::Vector3d>(ret)) { return false; } _anyVal = ret; } else if (this->IsType<ignition::math::Vector2i>()) { ignition::math::Vector2i ret; if (!this->Get<ignition::math::Vector2i>(ret)) { return false; } _anyVal = ret; } else if (this->IsType<ignition::math::Vector2d>()) { ignition::math::Vector2d ret; if (!this->Get<ignition::math::Vector2d>(ret)) { return false; } _anyVal = ret; } else if (this->IsType<ignition::math::Pose3d>()) { ignition::math::Pose3d ret; if (!this->Get<ignition::math::Pose3d>(ret)) { return false; } _anyVal = ret; } else if (this->IsType<ignition::math::Quaterniond>()) { ignition::math::Quaterniond ret; if (!this->Get<ignition::math::Quaterniond>(ret)) { return false; } _anyVal = ret; } else { sdferr << "Type of parameter not known: [" << this->GetTypeName() << "]\n"; return false; } return true; } ////////////////////////////////////////////////// void Param::Update() { if (this->dataPtr->updateFunc) { try { boost::apply_visitor(any_set(this->dataPtr->updateFunc()), this->dataPtr->value); } catch(boost::bad_lexical_cast &/*e*/) { sdferr << "Unable to set value using Update for key[" << this->dataPtr->key << "]\n"; } } } ////////////////////////////////////////////////// std::string Param::GetAsString() const { return boost::lexical_cast<std::string>(this->dataPtr->value); } ////////////////////////////////////////////////// std::string Param::GetDefaultAsString() const { return boost::lexical_cast<std::string>(this->dataPtr->defaultValue); } ////////////////////////////////////////////////// bool Param::SetFromString(const std::string &_value) { // Under some circumstances, latin locales (es_ES or pt_BR) will return a // comma for decimal position instead of a dot, making the conversion // to fail. See bug #60 for more information. Force to use always C setlocale(LC_NUMERIC, "C"); std::string str = sdf::trim(_value.c_str()); if (str.empty() && this->dataPtr->required) { sdferr << "Empty string used when setting a required parameter. Key[" << this->GetKey() << "]\n"; return false; } else if (str.empty()) { this->dataPtr->value = this->dataPtr->defaultValue; return true; } std::string tmp(str); std::string lowerTmp(str); std::transform(lowerTmp.begin(), lowerTmp.end(), lowerTmp.begin(), ::tolower); // "true" and "false" doesn't work properly if (lowerTmp == "true") { tmp = "1"; } else if (lowerTmp == "false") { tmp = "0"; } bool isHex = tmp.compare(0, 2, "0x") == 0; try { // Try to use stoi and stoul for integers, and // stof and stod for floating point values. // Use boost lexical cast as a last resort. int numericBase = 10; if (isHex) { numericBase = 16; } if (this->dataPtr->typeName == "int") { this->dataPtr->value = std::stoi(tmp, nullptr, numericBase); } else if (this->dataPtr->typeName == "unsigned int") { this->dataPtr->value = static_cast<unsigned int>( std::stoul(tmp, nullptr, numericBase)); } else if (this->dataPtr->typeName == "double") { this->dataPtr->value = std::stod(tmp); } else if (this->dataPtr->typeName == "float") { this->dataPtr->value = std::stof(tmp); } else { boost::apply_visitor(string_set(tmp), this->dataPtr->value); } } // Catch invalid argument exception from std::stoi/stoul/stod/stof catch(std::invalid_argument &) { sdferr << "Invalid argument. Unable to set value [" << str << " ] for key[" << this->dataPtr->key << "].\n"; return false; } // Catch out of range exception from std::stoi/stoul/stod/stof catch(std::out_of_range &) { sdferr << "Out of range. Unable to set value [" << str << " ] for key[" << this->dataPtr->key << "].\n"; return false; } // Catch boost lexical cast exceptions catch(boost::bad_lexical_cast &) { if (str == "inf" || str == "-inf") { // in this case, the parser complains, but seems to assign the // right values sdfmsg << "INFO [sdf::Param]: boost throws when lexical casting " << "inf's, but the values are usually passed through correctly\n"; } else { sdferr << "Unable to set value [" << str << "] for key[" << this->dataPtr->key << "]\n"; return false; } } this->dataPtr->set = true; return this->dataPtr->set; } ////////////////////////////////////////////////// void Param::Reset() { this->dataPtr->value = this->dataPtr->defaultValue; this->dataPtr->set = false; } ////////////////////////////////////////////////// ParamPtr Param::Clone() const { return ParamPtr(new Param(this->dataPtr->key, this->dataPtr->typeName, this->GetAsString(), this->dataPtr->required, this->dataPtr->description)); } ////////////////////////////////////////////////// const std::string &Param::GetTypeName() const { return this->dataPtr->typeName; } ///////////////////////////////////////////////// void Param::SetDescription(const std::string &_desc) { this->dataPtr->description = _desc; } ///////////////////////////////////////////////// std::string Param::GetDescription() const { return this->dataPtr->description; } ///////////////////////////////////////////////// const std::string &Param::GetKey() const { return this->dataPtr->key; } ///////////////////////////////////////////////// bool Param::GetRequired() const { return this->dataPtr->required; } ///////////////////////////////////////////////// Param &Param::operator=(const Param &_param) { this->dataPtr->value = _param.dataPtr->value; this->dataPtr->defaultValue = _param.dataPtr->defaultValue; return *this; } ///////////////////////////////////////////////// bool Param::GetSet() const { return this->dataPtr->set; }
############################################################################### # Copyright 2019 Intel Corporation # All Rights Reserved. # # If this software was obtained under the Intel Simplified Software License, # the following terms apply: # # The source code, information and material ("Material") contained herein is # owned by Intel Corporation or its suppliers or licensors, and title to such # Material remains with Intel Corporation or its suppliers or licensors. The # Material contains proprietary information of Intel or its suppliers and # licensors. The Material is protected by worldwide copyright laws and treaty # provisions. No part of the Material may be used, copied, reproduced, # modified, published, uploaded, posted, transmitted, distributed or disclosed # in any way without Intel's prior express written permission. No license under # any patent, copyright or other intellectual property rights in the Material # is granted to or conferred upon you, either expressly, by implication, # inducement, estoppel or otherwise. Any license under such intellectual # property rights must be express and approved by Intel in writing. # # Unless otherwise agreed by Intel in writing, you may not remove or alter this # notice or any other notice embedded in Materials by Intel or Intel's # suppliers or licensors in any way. # # # If this software was obtained under the Apache License, Version 2.0 (the # "License"), the following terms apply: # # You may not use this file except in compliance with the License. You may # obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 # # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # # See the License for the specific language governing permissions and # limitations under the License. ############################################################################### .section .note.GNU-stack,"",%progbits .text .p2align 5, 0x90 .type mla_1x1, @function mla_1x1: movq (%rcx), %rdx mulx (%rsi), %rax, %rbx add %r8, %rax adc $(0), %rbx mov %rax, (%rdi) mov %rbx, %r8 ret .Lfe1: .size mla_1x1, .Lfe1-(mla_1x1) .p2align 5, 0x90 .type mul_1x1, @function mul_1x1: movq (%rcx), %rdx mulxq (%rsi), %rax, %rdx movq %rax, (%rdi) movq %rdx, (8)(%rdi) ret .Lfe2: .size mul_1x1, .Lfe2-(mul_1x1) .p2align 5, 0x90 .type mla_2x2, @function mla_2x2: movq (%rcx), %rdx mulx (%rsi), %rax, %rbx add %r8, %rax adc $(0), %rbx mov %rax, (%rdi) mulx (8)(%rsi), %r8, %rbp add %r9, %r8 adc $(0), %rbp add %rbx, %r8 adc $(0), %rbp mov %rbp, %r9 movq (8)(%rcx), %rdx mulx (%rsi), %rax, %rbx add %r8, %rax adc $(0), %rbx mov %rax, (8)(%rdi) mulx (8)(%rsi), %r8, %rbp add %r9, %r8 adc $(0), %rbp add %rbx, %r8 adc $(0), %rbp mov %rbp, %r9 ret .Lfe3: .size mla_2x2, .Lfe3-(mla_2x2) .p2align 5, 0x90 .type mul_2x2, @function mul_2x2: call mla_2x2 movq %r8, (16)(%rdi) movq %r9, (24)(%rdi) ret .Lfe4: .size mul_2x2, .Lfe4-(mul_2x2) .p2align 5, 0x90 .type mla_3x3, @function mla_3x3: movq (%rcx), %rdx mulx (%rsi), %rax, %rbx add %r8, %rax adc $(0), %rbx mov %rax, (%rdi) mulx (8)(%rsi), %r8, %rbp add %r9, %r8 adc $(0), %rbp add %rbx, %r8 adc $(0), %rbp mulx (16)(%rsi), %r9, %rbx add %r10, %r9 adc $(0), %rbx add %rbp, %r9 adc $(0), %rbx mov %rbx, %r10 movq (8)(%rcx), %rdx mulx (%rsi), %rax, %rbx add %r8, %rax adc $(0), %rbx mov %rax, (8)(%rdi) mulx (8)(%rsi), %r8, %rbp add %r9, %r8 adc $(0), %rbp add %rbx, %r8 adc $(0), %rbp mulx (16)(%rsi), %r9, %rbx add %r10, %r9 adc $(0), %rbx add %rbp, %r9 adc $(0), %rbx mov %rbx, %r10 movq (16)(%rcx), %rdx mulx (%rsi), %rax, %rbx add %r8, %rax adc $(0), %rbx mov %rax, (16)(%rdi) mulx (8)(%rsi), %r8, %rbp add %r9, %r8 adc $(0), %rbp add %rbx, %r8 adc $(0), %rbp mulx (16)(%rsi), %r9, %rbx add %r10, %r9 adc $(0), %rbx add %rbp, %r9 adc $(0), %rbx mov %rbx, %r10 ret .Lfe5: .size mla_3x3, .Lfe5-(mla_3x3) .p2align 5, 0x90 .type mul_3x3, @function mul_3x3: call mla_3x3 movq %r8, (24)(%rdi) movq %r9, (32)(%rdi) movq %r10, (40)(%rdi) ret .Lfe6: .size mul_3x3, .Lfe6-(mul_3x3) .p2align 5, 0x90 .type mla_4x2, @function mla_4x2: movq (%rcx), %rdx mulx (%rsi), %rax, %rbx add %r8, %rax adc $(0), %rbx mov %rax, (%rdi) mulx (8)(%rsi), %r8, %rbp add %r9, %r8 adc $(0), %rbp add %rbx, %r8 adc $(0), %rbp mulx (16)(%rsi), %r9, %rbx add %r10, %r9 adc $(0), %rbx add %rbp, %r9 adc $(0), %rbx mulx (24)(%rsi), %r10, %rbp add %r11, %r10 adc $(0), %rbp add %rbx, %r10 adc $(0), %rbp mov %rbp, %r11 movq (8)(%rcx), %rdx mulx (%rsi), %rax, %rbx add %r8, %rax adc $(0), %rbx mov %rax, (8)(%rdi) mulx (8)(%rsi), %r8, %rbp add %r9, %r8 adc $(0), %rbp add %rbx, %r8 adc $(0), %rbp mulx (16)(%rsi), %r9, %rbx add %r10, %r9 adc $(0), %rbx add %rbp, %r9 adc $(0), %rbx mulx (24)(%rsi), %r10, %rbp add %r11, %r10 adc $(0), %rbp add %rbx, %r10 adc $(0), %rbp mov %rbp, %r11 ret .Lfe7: .size mla_4x2, .Lfe7-(mla_4x2) .p2align 5, 0x90 .type mla_4x4, @function mla_4x4: call mla_4x2 add $(16), %rdi add $(16), %rcx call mla_4x2 sub $(16), %rdi sub $(16), %rcx ret .Lfe8: .size mla_4x4, .Lfe8-(mla_4x4) .p2align 5, 0x90 .type mul_4x4, @function mul_4x4: call mla_4x4 movq %r8, (32)(%rdi) movq %r9, (40)(%rdi) movq %r10, (48)(%rdi) movq %r11, (56)(%rdi) ret .Lfe9: .size mul_4x4, .Lfe9-(mul_4x4) .p2align 5, 0x90 .type mla_5x2, @function mla_5x2: mov (%rcx), %rdx mulx (%rsi), %rax, %rbx add %r8, %rax adc $(0), %rbx mov %rax, (%rdi) mulx (8)(%rsi), %r8, %rbp add %r9, %r8 adc $(0), %rbp add %rbx, %r8 adc $(0), %rbp mulx (16)(%rsi), %r9, %rbx add %r10, %r9 adc $(0), %rbx add %rbp, %r9 adc $(0), %rbx mulx (24)(%rsi), %r10, %rbp add %r11, %r10 adc $(0), %rbp add %rbx, %r10 adc $(0), %rbp mulx (32)(%rsi), %r11, %rbx add %r12, %r11 adc $(0), %rbx add %rbp, %r11 adc $(0), %rbx mov %rbx, %r12 mov (8)(%rcx), %rdx mulx (%rsi), %rax, %rbx add %r8, %rax adc $(0), %rbx mov %rax, (8)(%rdi) mulx (8)(%rsi), %r8, %rbp add %r9, %r8 adc $(0), %rbp add %rbx, %r8 adc $(0), %rbp mulx (16)(%rsi), %r9, %rbx add %r10, %r9 adc $(0), %rbx add %rbp, %r9 adc $(0), %rbx mulx (24)(%rsi), %r10, %rbp add %r11, %r10 adc $(0), %rbp add %rbx, %r10 adc $(0), %rbp mulx (32)(%rsi), %r11, %rbx add %r12, %r11 adc $(0), %rbx add %rbp, %r11 adc $(0), %rbx mov %rbx, %r12 ret .Lfe10: .size mla_5x2, .Lfe10-(mla_5x2) .p2align 5, 0x90 .type mla_5x5, @function mla_5x5: mov (%rcx), %rdx mulx (%rsi), %rax, %rbx add %r8, %rax adc $(0), %rbx mov %rax, (%rdi) mulx (8)(%rsi), %r8, %rbp add %r9, %r8 adc $(0), %rbp add %rbx, %r8 adc $(0), %rbp mulx (16)(%rsi), %r9, %rbx add %r10, %r9 adc $(0), %rbx add %rbp, %r9 adc $(0), %rbx mulx (24)(%rsi), %r10, %rbp add %r11, %r10 adc $(0), %rbp add %rbx, %r10 adc $(0), %rbp mulx (32)(%rsi), %r11, %rbx add %r12, %r11 adc $(0), %rbx add %rbp, %r11 adc $(0), %rbx mov %rbx, %r12 add $(8), %rdi add $(8), %rcx call mla_5x2 add $(16), %rdi add $(16), %rcx call mla_5x2 sub $(24), %rdi sub $(24), %rcx ret .Lfe11: .size mla_5x5, .Lfe11-(mla_5x5) .p2align 5, 0x90 .type mul_5x5, @function mul_5x5: call mla_5x5 movq %r8, (40)(%rdi) movq %r9, (48)(%rdi) movq %r10, (56)(%rdi) movq %r11, (64)(%rdi) movq %r12, (72)(%rdi) ret .Lfe12: .size mul_5x5, .Lfe12-(mul_5x5) .p2align 5, 0x90 .type mla_6x2, @function mla_6x2: mov (%rcx), %rdx mulx (%rsi), %rax, %rbx add %r8, %rax adc $(0), %rbx mov %rax, (%rdi) mulx (8)(%rsi), %r8, %rbp add %r9, %r8 adc $(0), %rbp add %rbx, %r8 adc $(0), %rbp mulx (16)(%rsi), %r9, %rbx add %r10, %r9 adc $(0), %rbx add %rbp, %r9 adc $(0), %rbx mulx (24)(%rsi), %r10, %rbp add %r11, %r10 adc $(0), %rbp add %rbx, %r10 adc $(0), %rbp mulx (32)(%rsi), %r11, %rbx add %r12, %r11 adc $(0), %rbx add %rbp, %r11 adc $(0), %rbx mulx (40)(%rsi), %r12, %rbp add %r13, %r12 adc $(0), %rbp add %rbx, %r12 adc $(0), %rbp mov %rbp, %r13 mov (8)(%rcx), %rdx mulx (%rsi), %rax, %rbx add %r8, %rax adc $(0), %rbx mov %rax, (8)(%rdi) mulx (8)(%rsi), %r8, %rbp add %r9, %r8 adc $(0), %rbp add %rbx, %r8 adc $(0), %rbp mulx (16)(%rsi), %r9, %rbx add %r10, %r9 adc $(0), %rbx add %rbp, %r9 adc $(0), %rbx mulx (24)(%rsi), %r10, %rbp add %r11, %r10 adc $(0), %rbp add %rbx, %r10 adc $(0), %rbp mulx (32)(%rsi), %r11, %rbx add %r12, %r11 adc $(0), %rbx add %rbp, %r11 adc $(0), %rbx mulx (40)(%rsi), %r12, %rbp add %r13, %r12 adc $(0), %rbp add %rbx, %r12 adc $(0), %rbp mov %rbp, %r13 ret .Lfe13: .size mla_6x2, .Lfe13-(mla_6x2) .p2align 5, 0x90 .type mla_6x6, @function mla_6x6: call mla_6x2 add $(16), %rdi add $(16), %rcx call mla_6x2 add $(16), %rdi add $(16), %rcx call mla_6x2 sub $(32), %rdi sub $(32), %rcx ret .Lfe14: .size mla_6x6, .Lfe14-(mla_6x6) .p2align 5, 0x90 .type mul_6x6, @function mul_6x6: call mla_6x6 movq %r8, (48)(%rdi) movq %r9, (56)(%rdi) movq %r10, (64)(%rdi) movq %r11, (72)(%rdi) movq %r12, (80)(%rdi) movq %r13, (88)(%rdi) ret .Lfe15: .size mul_6x6, .Lfe15-(mul_6x6) .p2align 5, 0x90 .type mla_7x2, @function mla_7x2: mov (%rcx), %rdx mulx (%rsi), %rax, %rbx add %r8, %rax adc $(0), %rbx mov %rax, (%rdi) mulx (8)(%rsi), %r8, %rbp add %r9, %r8 adc $(0), %rbp add %rbx, %r8 adc $(0), %rbp mulx (16)(%rsi), %r9, %rbx add %r10, %r9 adc $(0), %rbx add %rbp, %r9 adc $(0), %rbx mulx (24)(%rsi), %r10, %rbp add %r11, %r10 adc $(0), %rbp add %rbx, %r10 adc $(0), %rbp mulx (32)(%rsi), %r11, %rbx add %r12, %r11 adc $(0), %rbx add %rbp, %r11 adc $(0), %rbx mulx (40)(%rsi), %r12, %rbp add %r13, %r12 adc $(0), %rbp add %rbx, %r12 adc $(0), %rbp mulx (48)(%rsi), %r13, %rbx add %r14, %r13 adc $(0), %rbx add %rbp, %r13 adc $(0), %rbx mov %rbx, %r14 mov (8)(%rcx), %rdx mulx (%rsi), %rax, %rbx add %r8, %rax adc $(0), %rbx mov %rax, (8)(%rdi) mulx (8)(%rsi), %r8, %rbp add %r9, %r8 adc $(0), %rbp add %rbx, %r8 adc $(0), %rbp mulx (16)(%rsi), %r9, %rbx add %r10, %r9 adc $(0), %rbx add %rbp, %r9 adc $(0), %rbx mulx (24)(%rsi), %r10, %rbp add %r11, %r10 adc $(0), %rbp add %rbx, %r10 adc $(0), %rbp mulx (32)(%rsi), %r11, %rbx add %r12, %r11 adc $(0), %rbx add %rbp, %r11 adc $(0), %rbx mulx (40)(%rsi), %r12, %rbp add %r13, %r12 adc $(0), %rbp add %rbx, %r12 adc $(0), %rbp mulx (48)(%rsi), %r13, %rbx add %r14, %r13 adc $(0), %rbx add %rbp, %r13 adc $(0), %rbx mov %rbx, %r14 ret .Lfe16: .size mla_7x2, .Lfe16-(mla_7x2) .p2align 5, 0x90 .type mla_7x7, @function mla_7x7: mov (%rcx), %rdx mulx (%rsi), %rax, %rbx add %r8, %rax adc $(0), %rbx mov %rax, (%rdi) mulx (8)(%rsi), %r8, %rbp add %r9, %r8 adc $(0), %rbp add %rbx, %r8 adc $(0), %rbp mulx (16)(%rsi), %r9, %rbx add %r10, %r9 adc $(0), %rbx add %rbp, %r9 adc $(0), %rbx mulx (24)(%rsi), %r10, %rbp add %r11, %r10 adc $(0), %rbp add %rbx, %r10 adc $(0), %rbp mulx (32)(%rsi), %r11, %rbx add %r12, %r11 adc $(0), %rbx add %rbp, %r11 adc $(0), %rbx mulx (40)(%rsi), %r12, %rbp add %r13, %r12 adc $(0), %rbp add %rbx, %r12 adc $(0), %rbp mulx (48)(%rsi), %r13, %rbx add %r14, %r13 adc $(0), %rbx add %rbp, %r13 adc $(0), %rbx mov %rbx, %r14 add $(8), %rdi add $(8), %rcx call mla_7x2 add $(16), %rdi add $(16), %rcx call mla_7x2 add $(16), %rdi add $(16), %rcx call mla_7x2 sub $(40), %rdi sub $(40), %rcx ret .Lfe17: .size mla_7x7, .Lfe17-(mla_7x7) .p2align 5, 0x90 .type mul_7x7, @function mul_7x7: call mla_7x7 movq %r8, (56)(%rdi) movq %r9, (64)(%rdi) movq %r10, (72)(%rdi) movq %r11, (80)(%rdi) movq %r12, (88)(%rdi) movq %r13, (96)(%rdi) movq %r14, (104)(%rdi) ret .Lfe18: .size mul_7x7, .Lfe18-(mul_7x7) .p2align 5, 0x90 .type mla_8x1, @function mla_8x1: mov (%rcx), %rdx mulx (%rsi), %rax, %rbx add %r8, %rax adc $(0), %rbx mov %rax, (%rdi) mulx (8)(%rsi), %r8, %rbp add %r9, %r8 adc $(0), %rbp add %rbx, %r8 adc $(0), %rbp mulx (16)(%rsi), %r9, %rbx add %r10, %r9 adc $(0), %rbx add %rbp, %r9 adc $(0), %rbx mulx (24)(%rsi), %r10, %rbp add %r11, %r10 adc $(0), %rbp add %rbx, %r10 adc $(0), %rbp mulx (32)(%rsi), %r11, %rbx add %r12, %r11 adc $(0), %rbx add %rbp, %r11 adc $(0), %rbx mulx (40)(%rsi), %r12, %rbp add %r13, %r12 adc $(0), %rbp add %rbx, %r12 adc $(0), %rbp mulx (48)(%rsi), %r13, %rbx add %r14, %r13 adc $(0), %rbx add %rbp, %r13 adc $(0), %rbx mulx (56)(%rsi), %r14, %rbp add %r15, %r14 adc $(0), %rbp add %rbx, %r14 adc $(0), %rbp mov %rbp, %r15 ret .Lfe19: .size mla_8x1, .Lfe19-(mla_8x1) .p2align 5, 0x90 .type mla_8x2, @function mla_8x2: mov (%rcx), %rdx mulx (%rsi), %rax, %rbx add %r8, %rax adc $(0), %rbx mov %rax, (%rdi) mulx (8)(%rsi), %r8, %rbp add %r9, %r8 adc $(0), %rbp add %rbx, %r8 adc $(0), %rbp mulx (16)(%rsi), %r9, %rbx add %r10, %r9 adc $(0), %rbx add %rbp, %r9 adc $(0), %rbx mulx (24)(%rsi), %r10, %rbp add %r11, %r10 adc $(0), %rbp add %rbx, %r10 adc $(0), %rbp mulx (32)(%rsi), %r11, %rbx add %r12, %r11 adc $(0), %rbx add %rbp, %r11 adc $(0), %rbx mulx (40)(%rsi), %r12, %rbp add %r13, %r12 adc $(0), %rbp add %rbx, %r12 adc $(0), %rbp mulx (48)(%rsi), %r13, %rbx add %r14, %r13 adc $(0), %rbx add %rbp, %r13 adc $(0), %rbx mulx (56)(%rsi), %r14, %rbp add %r15, %r14 adc $(0), %rbp add %rbx, %r14 adc $(0), %rbp mov %rbp, %r15 mov (8)(%rcx), %rdx mulx (%rsi), %rax, %rbx add %r8, %rax adc $(0), %rbx mov %rax, (8)(%rdi) mulx (8)(%rsi), %r8, %rbp add %r9, %r8 adc $(0), %rbp add %rbx, %r8 adc $(0), %rbp mulx (16)(%rsi), %r9, %rbx add %r10, %r9 adc $(0), %rbx add %rbp, %r9 adc $(0), %rbx mulx (24)(%rsi), %r10, %rbp add %r11, %r10 adc $(0), %rbp add %rbx, %r10 adc $(0), %rbp mulx (32)(%rsi), %r11, %rbx add %r12, %r11 adc $(0), %rbx add %rbp, %r11 adc $(0), %rbx mulx (40)(%rsi), %r12, %rbp add %r13, %r12 adc $(0), %rbp add %rbx, %r12 adc $(0), %rbp mulx (48)(%rsi), %r13, %rbx add %r14, %r13 adc $(0), %rbx add %rbp, %r13 adc $(0), %rbx mulx (56)(%rsi), %r14, %rbp add %r15, %r14 adc $(0), %rbp add %rbx, %r14 adc $(0), %rbp mov %rbp, %r15 ret .Lfe20: .size mla_8x2, .Lfe20-(mla_8x2) .p2align 5, 0x90 .type mla_8x3, @function mla_8x3: call mla_8x1 add $(8), %rdi add $(8), %rcx call mla_8x2 sub $(8), %rdi sub $(8), %rcx ret .Lfe21: .size mla_8x3, .Lfe21-(mla_8x3) .p2align 5, 0x90 .type mla_8x4, @function mla_8x4: call mla_8x2 add $(16), %rdi add $(16), %rcx call mla_8x2 sub $(16), %rdi sub $(16), %rcx ret .Lfe22: .size mla_8x4, .Lfe22-(mla_8x4) .p2align 5, 0x90 .type mla_8x5, @function mla_8x5: call mla_8x1 add $(8), %rdi add $(8), %rcx call mla_8x4 sub $(8), %rdi sub $(8), %rcx ret .Lfe23: .size mla_8x5, .Lfe23-(mla_8x5) .p2align 5, 0x90 .type mla_8x6, @function mla_8x6: call mla_8x2 add $(16), %rdi add $(16), %rcx call mla_8x4 sub $(16), %rdi sub $(16), %rcx ret .Lfe24: .size mla_8x6, .Lfe24-(mla_8x6) .p2align 5, 0x90 .type mla_8x7, @function mla_8x7: call mla_8x1 add $(8), %rdi add $(8), %rcx call mla_8x6 sub $(8), %rdi sub $(8), %rcx ret .Lfe25: .size mla_8x7, .Lfe25-(mla_8x7) .p2align 5, 0x90 .type mla_8x8, @function mla_8x8: call mla_8x2 add $(16), %rdi add $(16), %rcx call mla_8x2 add $(16), %rdi add $(16), %rcx call mla_8x2 add $(16), %rdi add $(16), %rcx call mla_8x2 sub $(48), %rdi sub $(48), %rcx ret .Lfe26: .size mla_8x8, .Lfe26-(mla_8x8) .p2align 5, 0x90 .type mul_8x8, @function mul_8x8: call mla_8x8 movq %r8, (64)(%rdi) movq %r9, (72)(%rdi) movq %r10, (80)(%rdi) movq %r11, (88)(%rdi) movq %r12, (96)(%rdi) movq %r13, (104)(%rdi) movq %r14, (112)(%rdi) movq %r15, (120)(%rdi) ret .Lfe27: .size mul_8x8, .Lfe27-(mul_8x8) .p2align 5, 0x90 .type mul_9x9, @function mul_9x9: call mla_8x8 mov (64)(%rcx), %rdx mulx (%rsi), %rax, %rbx add %r8, %rax adc $(0), %rbx mov %rax, (64)(%rdi) mulx (8)(%rsi), %r8, %rbp add %r9, %r8 adc $(0), %rbp add %rbx, %r8 adc $(0), %rbp mulx (16)(%rsi), %r9, %rbx add %r10, %r9 adc $(0), %rbx add %rbp, %r9 adc $(0), %rbx mulx (24)(%rsi), %r10, %rbp add %r11, %r10 adc $(0), %rbp add %rbx, %r10 adc $(0), %rbp mulx (32)(%rsi), %r11, %rbx add %r12, %r11 adc $(0), %rbx add %rbp, %r11 adc $(0), %rbx mulx (40)(%rsi), %r12, %rbp add %r13, %r12 adc $(0), %rbp add %rbx, %r12 adc $(0), %rbp mulx (48)(%rsi), %r13, %rbx add %r14, %r13 adc $(0), %rbx add %rbp, %r13 adc $(0), %rbx mulx (56)(%rsi), %r14, %rbp add %r15, %r14 adc $(0), %rbp add %rbx, %r14 adc $(0), %rbp mov %rbp, %r15 push %r15 mov (64)(%rsi), %rdx mov (64)(%rdi), %r15 mulx (%rcx), %rax, %rbx add %r15, %rax adc $(0), %rbx mov %rax, (64)(%rdi) mulx (8)(%rcx), %r15, %rbp add %r8, %r15 adc $(0), %rbp add %rbx, %r15 adc $(0), %rbp mulx (16)(%rcx), %r8, %rbx add %r9, %r8 adc $(0), %rbx add %rbp, %r8 adc $(0), %rbx mulx (24)(%rcx), %r9, %rbp add %r10, %r9 adc $(0), %rbp add %rbx, %r9 adc $(0), %rbp mulx (32)(%rcx), %r10, %rbx add %r11, %r10 adc $(0), %rbx add %rbp, %r10 adc $(0), %rbx mulx (40)(%rcx), %r11, %rbp add %r12, %r11 adc $(0), %rbp add %rbx, %r11 adc $(0), %rbp mulx (48)(%rcx), %r12, %rbx add %r13, %r12 adc $(0), %rbx add %rbp, %r12 adc $(0), %rbx mulx (56)(%rcx), %r13, %rbp add %r14, %r13 adc $(0), %rbp add %rbx, %r13 adc $(0), %rbp mov %rbp, %r14 movq %r15, (72)(%rdi) mulx (64)(%rcx), %rbp, %r15 pop %rax add %rax, %r14 adc $(0), %r15 add %rbp, %r14 adc $(0), %r15 movq %r8, (80)(%rdi) movq %r9, (88)(%rdi) movq %r10, (96)(%rdi) movq %r11, (104)(%rdi) movq %r12, (112)(%rdi) movq %r13, (120)(%rdi) movq %r14, (128)(%rdi) movq %r15, (136)(%rdi) ret .Lfe28: .size mul_9x9, .Lfe28-(mul_9x9) .p2align 5, 0x90 .type mul_10x10, @function mul_10x10: call mla_8x8 add $(64), %rdi add $(64), %rcx call mla_8x2 push %r15 push %r14 add $(64), %rsi sub $(64), %rcx xor %rsi, %rcx xor %rcx, %rsi xor %rsi, %rcx mov %r13, %r15 mov %r12, %r14 mov %r11, %r13 mov %r10, %r12 mov %r9, %r11 mov %r8, %r10 movq (8)(%rdi), %r9 movq (%rdi), %r8 call mla_8x2 movq %r8, (16)(%rdi) movq %r9, (24)(%rdi) movq %r10, (32)(%rdi) movq %r11, (40)(%rdi) movq %r12, (48)(%rdi) movq %r13, (56)(%rdi) add $(64), %rdi xor %r10, %r10 pop %r8 pop %r9 add %r14, %r8 adc %r15, %r9 adc $(0), %r10 xor %rsi, %rcx xor %rcx, %rsi xor %rsi, %rcx add $(64), %rcx call mla_2x2 add $(16), %rdi add %r10, %r8 adc $(0), %r9 movq %r8, (%rdi) movq %r9, (8)(%rdi) ret .Lfe29: .size mul_10x10, .Lfe29-(mul_10x10) .p2align 5, 0x90 .type mul_11x11, @function mul_11x11: call mla_8x8 add $(64), %rdi add $(64), %rcx call mla_8x3 push %r15 push %r14 push %r13 add $(64), %rsi sub $(64), %rcx xor %rsi, %rcx xor %rcx, %rsi xor %rsi, %rcx mov %r12, %r15 mov %r11, %r14 mov %r10, %r13 mov %r9, %r12 mov %r8, %r11 movq (16)(%rdi), %r10 movq (8)(%rdi), %r9 movq (%rdi), %r8 call mla_8x3 movq %r8, (24)(%rdi) movq %r9, (32)(%rdi) movq %r10, (40)(%rdi) movq %r11, (48)(%rdi) movq %r12, (56)(%rdi) add $(64), %rdi xor %r11, %r11 pop %r8 pop %r9 pop %r10 add %r13, %r8 adc %r14, %r9 adc %r15, %r10 adc $(0), %r11 xor %rsi, %rcx xor %rcx, %rsi xor %rsi, %rcx add $(64), %rcx call mla_3x3 add $(24), %rdi add %r11, %r8 adc $(0), %r9 adc $(0), %r10 movq %r8, (%rdi) movq %r9, (8)(%rdi) movq %r10, (16)(%rdi) ret .Lfe30: .size mul_11x11, .Lfe30-(mul_11x11) .p2align 5, 0x90 .type mul_12x12, @function mul_12x12: call mla_8x8 add $(64), %rdi add $(64), %rcx call mla_8x4 push %r15 push %r14 push %r13 push %r12 add $(64), %rsi sub $(64), %rcx xor %rsi, %rcx xor %rcx, %rsi xor %rsi, %rcx mov %r11, %r15 mov %r10, %r14 mov %r9, %r13 mov %r8, %r12 movq (24)(%rdi), %r11 movq (16)(%rdi), %r10 movq (8)(%rdi), %r9 movq (%rdi), %r8 call mla_8x4 movq %r8, (32)(%rdi) movq %r9, (40)(%rdi) movq %r10, (48)(%rdi) movq %r11, (56)(%rdi) add $(64), %rdi xor %rax, %rax pop %r8 pop %r9 pop %r10 pop %r11 add %r12, %r8 adc %r13, %r9 adc %r14, %r10 adc %r15, %r11 adc $(0), %rax push %rax xor %rsi, %rcx xor %rcx, %rsi xor %rsi, %rcx add $(64), %rcx call mla_4x4 add $(32), %rdi pop %rax add %rax, %r8 adc $(0), %r9 adc $(0), %r10 adc $(0), %r11 movq %r8, (%rdi) movq %r9, (8)(%rdi) movq %r10, (16)(%rdi) movq %r11, (24)(%rdi) ret .Lfe31: .size mul_12x12, .Lfe31-(mul_12x12) .p2align 5, 0x90 .type mul_13x13, @function mul_13x13: call mla_8x8 add $(64), %rdi add $(64), %rcx call mla_8x5 push %r15 push %r14 push %r13 push %r12 push %r11 add $(64), %rsi sub $(64), %rcx xor %rsi, %rcx xor %rcx, %rsi xor %rsi, %rcx mov %r10, %r15 mov %r9, %r14 mov %r8, %r13 movq (32)(%rdi), %r12 movq (24)(%rdi), %r11 movq (16)(%rdi), %r10 movq (8)(%rdi), %r9 movq (%rdi), %r8 call mla_8x5 movq %r8, (40)(%rdi) movq %r9, (48)(%rdi) movq %r10, (56)(%rdi) add $(64), %rdi xor %rax, %rax pop %r8 pop %r9 pop %r10 pop %rbx pop %rbp add %r11, %r8 adc %r12, %r9 adc %r13, %r10 adc %r14, %rbx adc %r15, %rbp adc $(0), %rax push %rax mov %rbx, %r11 mov %rbp, %r12 xor %rsi, %rcx xor %rcx, %rsi xor %rsi, %rcx add $(64), %rcx call mla_5x5 add $(40), %rdi pop %rax add %rax, %r8 adc $(0), %r9 adc $(0), %r10 adc $(0), %r11 adc $(0), %r12 movq %r8, (%rdi) movq %r9, (8)(%rdi) movq %r10, (16)(%rdi) movq %r11, (24)(%rdi) movq %r12, (32)(%rdi) ret .Lfe32: .size mul_13x13, .Lfe32-(mul_13x13) .p2align 5, 0x90 .type mul_14x14, @function mul_14x14: call mla_7x7 add $(56), %rdi add $(56), %rsi call mla_7x7 movq %r8, (56)(%rdi) movq %r9, (64)(%rdi) movq %r10, (72)(%rdi) movq %r11, (80)(%rdi) movq %r12, (88)(%rdi) movq %r13, (96)(%rdi) movq %r14, (104)(%rdi) movq (%rdi), %r8 movq (8)(%rdi), %r9 movq (16)(%rdi), %r10 movq (24)(%rdi), %r11 movq (32)(%rdi), %r12 movq (40)(%rdi), %r13 movq (48)(%rdi), %r14 add $(56), %rcx sub $(56), %rsi call mla_7x7 xor %rdx, %rdx movq (56)(%rdi), %rax add %rax, %r8 movq (64)(%rdi), %rax adc %rax, %r9 movq (72)(%rdi), %rax adc %rax, %r10 movq (80)(%rdi), %rax adc %rax, %r11 movq (88)(%rdi), %rax adc %rax, %r12 movq (96)(%rdi), %rax adc %rax, %r13 movq (104)(%rdi), %rax adc %rax, %r14 adc $(0), %rdx push %rdx add $(56), %rdi add $(56), %rsi call mla_7x7 sub $(112), %rdi sub $(56), %rsi sub $(56), %rcx pop %rdx add %rdx, %r8 adc $(0), %r9 adc $(0), %r10 adc $(0), %r11 adc $(0), %r12 adc $(0), %r13 adc $(0), %r14 movq %r8, (168)(%rdi) movq %r9, (176)(%rdi) movq %r10, (184)(%rdi) movq %r11, (192)(%rdi) movq %r12, (200)(%rdi) movq %r13, (208)(%rdi) movq %r14, (216)(%rdi) ret .Lfe33: .size mul_14x14, .Lfe33-(mul_14x14) .p2align 5, 0x90 .type mul_15x15, @function mul_15x15: call mla_8x8 add $(64), %rdi add $(64), %rcx call mla_8x7 movq %r8, (56)(%rdi) movq %r9, (64)(%rdi) movq %r10, (72)(%rdi) movq %r11, (80)(%rdi) movq %r12, (88)(%rdi) movq %r13, (96)(%rdi) movq %r14, (104)(%rdi) movq %r15, (112)(%rdi) add $(64), %rsi sub $(64), %rcx xor %rsi, %rcx xor %rcx, %rsi xor %rsi, %rcx movq (%rdi), %r8 movq (8)(%rdi), %r9 movq (16)(%rdi), %r10 movq (24)(%rdi), %r11 movq (32)(%rdi), %r12 movq (40)(%rdi), %r13 movq (48)(%rdi), %r14 movq (56)(%rdi), %r15 call mla_8x7 movq %r8, (56)(%rdi) add $(64), %rdi xor %rsi, %rcx xor %rcx, %rsi xor %rsi, %rcx add $(64), %rcx mov %r9, %r8 mov %r10, %r9 mov %r11, %r10 mov %r12, %r11 mov %r13, %r12 mov %r14, %r13 mov %r15, %r14 xor %rdx, %rdx movq (%rdi), %rax add %rax, %r8 movq (8)(%rdi), %rax adc %rax, %r9 movq (16)(%rdi), %rax adc %rax, %r10 movq (24)(%rdi), %rax adc %rax, %r11 movq (32)(%rdi), %rax adc %rax, %r12 movq (40)(%rdi), %rax adc %rax, %r13 movq (48)(%rdi), %rax adc %rax, %r14 adc $(0), %rdx push %rdx call mla_7x7 add $(56), %rdi pop %rax add %rax, %r8 adc $(0), %r9 adc $(0), %r10 adc $(0), %r11 adc $(0), %r12 adc $(0), %r13 adc $(0), %r14 movq %r8, (%rdi) movq %r9, (8)(%rdi) movq %r10, (16)(%rdi) movq %r11, (24)(%rdi) movq %r12, (32)(%rdi) movq %r13, (40)(%rdi) movq %r14, (48)(%rdi) ret .Lfe34: .size mul_15x15, .Lfe34-(mul_15x15) .p2align 5, 0x90 .type mul_16x16, @function mul_16x16: call mla_8x8 add $(64), %rdi add $(64), %rsi call mla_8x8 movq %r8, (64)(%rdi) movq %r9, (72)(%rdi) movq %r10, (80)(%rdi) movq %r11, (88)(%rdi) movq %r12, (96)(%rdi) movq %r13, (104)(%rdi) movq %r14, (112)(%rdi) movq %r15, (120)(%rdi) movq (%rdi), %r8 movq (8)(%rdi), %r9 movq (16)(%rdi), %r10 movq (24)(%rdi), %r11 movq (32)(%rdi), %r12 movq (40)(%rdi), %r13 movq (48)(%rdi), %r14 movq (56)(%rdi), %r15 add $(64), %rcx sub $(64), %rsi call mla_8x8 xor %rdx, %rdx movq (64)(%rdi), %rax add %rax, %r8 movq (72)(%rdi), %rax adc %rax, %r9 movq (80)(%rdi), %rax adc %rax, %r10 movq (88)(%rdi), %rax adc %rax, %r11 movq (96)(%rdi), %rax adc %rax, %r12 movq (104)(%rdi), %rax adc %rax, %r13 movq (112)(%rdi), %rax adc %rax, %r14 movq (120)(%rdi), %rax adc %rax, %r15 adc $(0), %rdx push %rdx add $(64), %rdi add $(64), %rsi call mla_8x8 sub $(128), %rdi sub $(64), %rsi sub $(64), %rcx pop %rdx add %rdx, %r8 adc $(0), %r9 adc $(0), %r10 adc $(0), %r11 adc $(0), %r12 adc $(0), %r13 adc $(0), %r14 adc $(0), %r15 movq %r8, (192)(%rdi) movq %r9, (200)(%rdi) movq %r10, (208)(%rdi) movq %r11, (216)(%rdi) movq %r12, (224)(%rdi) movq %r13, (232)(%rdi) movq %r14, (240)(%rdi) movq %r15, (248)(%rdi) ret .Lfe35: .size mul_16x16, .Lfe35-(mul_16x16) mul_lxl_basic: .quad mul_1x1 - mul_lxl_basic .quad mul_2x2 - mul_lxl_basic .quad mul_3x3 - mul_lxl_basic .quad mul_4x4 - mul_lxl_basic .quad mul_5x5 - mul_lxl_basic .quad mul_6x6 - mul_lxl_basic .quad mul_7x7 - mul_lxl_basic .quad mul_8x8 - mul_lxl_basic .quad mul_9x9 - mul_lxl_basic .quad mul_10x10-mul_lxl_basic .quad mul_11x11-mul_lxl_basic .quad mul_12x12-mul_lxl_basic .quad mul_13x13-mul_lxl_basic .quad mul_14x14-mul_lxl_basic .quad mul_15x15-mul_lxl_basic .quad mul_16x16-mul_lxl_basic mla_lxl_short: .quad mla_1x1 - mla_lxl_short .quad mla_2x2 - mla_lxl_short .quad mla_3x3 - mla_lxl_short .quad mla_4x4 - mla_lxl_short .quad mla_5x5 - mla_lxl_short .quad mla_6x6 - mla_lxl_short .quad mla_7x7 - mla_lxl_short mla_8xl_tail: .quad mla_8x1 - mla_8xl_tail .quad mla_8x2 - mla_8xl_tail .quad mla_8x3 - mla_8xl_tail .quad mla_8x4 - mla_8xl_tail .quad mla_8x5 - mla_8xl_tail .quad mla_8x6 - mla_8xl_tail .quad mla_8x7 - mla_8xl_tail .p2align 5, 0x90 .type mul_8Nx8M, @function mul_8Nx8M: push %rbx push %rdi push %rsi push %rdx .Lmul_loopAgas_36: push %rdx call mla_8x8 add $(64), %rdi add $(64), %rsi pop %rdx sub $(8), %rdx jnz .Lmul_loopAgas_36 movq %r8, (%rdi) movq %r9, (8)(%rdi) movq %r10, (16)(%rdi) movq %r11, (24)(%rdi) movq %r12, (32)(%rdi) movq %r13, (40)(%rdi) movq %r14, (48)(%rdi) movq %r15, (56)(%rdi) jmp .Lmla_enrtygas_36 .Lmla_loopBgas_36: push %rbx push %rdi push %rsi push %rdx xor %rax, %rax push %rax movq (%rdi), %r8 movq (8)(%rdi), %r9 movq (16)(%rdi), %r10 movq (24)(%rdi), %r11 movq (32)(%rdi), %r12 movq (40)(%rdi), %r13 movq (48)(%rdi), %r14 movq (56)(%rdi), %r15 .LloopAgas_36: push %rdx call mla_8x8 add $(64), %rdi add $(64), %rsi pop %rdx sub $(8), %rdx jz .Lexit_loopAgas_36 pop %rax neg %rax movq (%rdi), %rax adc %rax, %r8 movq (8)(%rdi), %rax adc %rax, %r9 movq (16)(%rdi), %rax adc %rax, %r10 movq (24)(%rdi), %rax adc %rax, %r11 movq (32)(%rdi), %rax adc %rax, %r12 movq (40)(%rdi), %rax adc %rax, %r13 movq (48)(%rdi), %rax adc %rax, %r14 movq (56)(%rdi), %rax adc %rax, %r15 sbb %rax, %rax push %rax jmp .LloopAgas_36 .Lexit_loopAgas_36: pop %rax neg %rax adc $(0), %r8 movq %r8, (%rdi) adc $(0), %r9 movq %r9, (8)(%rdi) adc $(0), %r10 movq %r10, (16)(%rdi) adc $(0), %r11 movq %r11, (24)(%rdi) adc $(0), %r12 movq %r12, (32)(%rdi) adc $(0), %r13 movq %r13, (40)(%rdi) adc $(0), %r14 movq %r14, (48)(%rdi) adc $(0), %r15 movq %r15, (56)(%rdi) .Lmla_enrtygas_36: pop %rdx pop %rsi pop %rdi add $(64), %rdi add $(64), %rcx pop %rbx sub $(8), %rbx jnz .Lmla_loopBgas_36 ret .Lfe36: .size mul_8Nx8M, .Lfe36-(mul_8Nx8M) .p2align 5, 0x90 .type mla_simple, @function mla_simple: xor %rax, %rax mov %rdx, %r11 cmp %rbx, %r11 jge .Lms_mla_entrygas_37 xor %rbx, %r11 xor %r11, %rbx xor %rbx, %r11 xor %rcx, %rsi xor %rsi, %rcx xor %rcx, %rsi jmp .Lms_mla_entrygas_37 .Lms_loopBgas_37: push %rbx push %rdi push %rsi push %r11 push %rax movq (%rcx), %rdx xor %r10, %r10 .Lms_loopAgas_37: mulxq (%rsi), %r8, %r9 add $(8), %rdi add $(8), %rsi add %r10, %r8 adc $(0), %r9 addq (-8)(%rdi), %r8 adc $(0), %r9 movq %r8, (-8)(%rdi) mov %r9, %r10 sub $(1), %r11 jnz .Lms_loopAgas_37 pop %rax shr $(1), %rax adcq (%rdi), %r10 movq %r10, (%rdi) adc $(0), %rax pop %r11 pop %rsi pop %rdi pop %rbx add $(8), %rdi add $(8), %rcx .Lms_mla_entrygas_37: sub $(1), %rbx jnc .Lms_loopBgas_37 ret .Lfe37: .size mla_simple, .Lfe37-(mla_simple) .p2align 5, 0x90 .type mul_NxM, @function mul_NxM: sub $(56), %rsp cmp $(8), %rbx jge .Lregular_entrygas_38 cmp $(8), %rdx jge .Lirregular_entrygas_38 mov %rdx, %r8 add %rbx, %r8 mov %rdi, %rbp xor %rax, %rax .L__0000gas_38: movq %rax, (%rbp) add $(8), %rbp sub $(1), %r8 jnz .L__0000gas_38 call mla_simple jmp .Lquitgas_38 .Lirregular_entrygas_38: mov %rbx, (%rsp) mov %rdx, (24)(%rsp) mov %rdx, (32)(%rsp) lea mla_8xl_tail(%rip), %rax mov (-8)(%rax,%rbx,8), %rbp add %rbp, %rax mov %rax, (48)(%rsp) jmp .Lirr_init_entrygas_38 .Lirr_init_loopgas_38: mov %rdx, (32)(%rsp) call *%rax mov (%rsp), %rbx movq %r8, (%rdi,%rbx,8) movq %r9, (8)(%rdi,%rbx,8) movq %r10, (16)(%rdi,%rbx,8) movq %r11, (24)(%rdi,%rbx,8) movq %r12, (32)(%rdi,%rbx,8) movq %r13, (40)(%rdi,%rbx,8) movq %r14, (48)(%rdi,%rbx,8) movq %r15, (56)(%rdi,%rbx,8) add $(64), %rsi add $(64), %rdi xor %r8, %r8 xor %r9, %r9 xor %r10, %r10 xor %r11, %r11 xor %r12, %r12 xor %r13, %r13 xor %r14, %r14 xor %r15, %r15 movq (%rdi), %r8 cmp $(1), %rbx jz .Lcontinuegas_38 movq (8)(%rdi), %r9 cmp $(2), %rbx jz .Lcontinuegas_38 movq (16)(%rdi), %r10 cmp $(3), %rbx jz .Lcontinuegas_38 movq (24)(%rdi), %r11 cmp $(4), %rbx jz .Lcontinuegas_38 movq (32)(%rdi), %r12 cmp $(5), %rbx jz .Lcontinuegas_38 movq (40)(%rdi), %r13 cmp $(6), %rbx jz .Lcontinuegas_38 movq (48)(%rdi), %r14 .Lcontinuegas_38: mov (32)(%rsp), %rdx .Lirr_init_entrygas_38: sub $(8), %rdx mov (48)(%rsp), %rax jnc .Lirr_init_loopgas_38 add $(8), %rdx jz .Lquitgas_38 lea (%rdi,%rbx,8), %rbp xor %rax, %rax .L__0001gas_38: movq %rax, (%rbp) add $(8), %rbp sub $(1), %rdx jnz .L__0001gas_38 mov (32)(%rsp), %rdx call mla_simple jmp .Lquitgas_38 .Lregular_entrygas_38: sub $(8), %rbx xor %rax, %rax mov %rbx, (%rsp) mov %rdi, (8)(%rsp) mov %rsi, (16)(%rsp) mov %rdx, (24)(%rsp) mov %rdx, (32)(%rsp) mov %rax, (40)(%rsp) mov %rdx, %rbp and $(7), %rbp lea mla_8xl_tail(%rip), %rax mov (-8)(%rax,%rbp,8), %rbp add %rbp, %rax mov %rax, (48)(%rsp) sub $(8), %rdx .Linit_loopAgas_38: mov %rdx, (32)(%rsp) call mla_8x8 mov (32)(%rsp), %rdx add $(64), %rdi add $(64), %rsi sub $(8), %rdx jnc .Linit_loopAgas_38 add $(8), %rdx jz .Linit_completegas_38 mov %rdx, (32)(%rsp) mov (48)(%rsp), %rax xor %rsi, %rcx xor %rcx, %rsi xor %rsi, %rcx call *%rax xor %rsi, %rcx xor %rcx, %rsi xor %rsi, %rcx mov (32)(%rsp), %rdx lea (%rdi,%rdx,8), %rdi .Linit_completegas_38: movq %r8, (%rdi) movq %r9, (8)(%rdi) movq %r10, (16)(%rdi) movq %r11, (24)(%rdi) movq %r12, (32)(%rdi) movq %r13, (40)(%rdi) movq %r14, (48)(%rdi) movq %r15, (56)(%rdi) jmp .Lmla_enrtygas_38 .Lmla_loopBgas_38: mov %rbx, (%rsp) mov %rdi, (8)(%rsp) xor %rax, %rax mov %rax, (40)(%rsp) movq (%rdi), %r8 movq (8)(%rdi), %r9 movq (16)(%rdi), %r10 movq (24)(%rdi), %r11 movq (32)(%rdi), %r12 movq (40)(%rdi), %r13 movq (48)(%rdi), %r14 movq (56)(%rdi), %r15 sub $(8), %rdx .LloopAgas_38: mov %rdx, (32)(%rsp) call mla_8x8 mov (32)(%rsp), %rdx add $(64), %rdi add $(64), %rsi sub $(8), %rdx jc .Lexit_loopAgas_38 mov (40)(%rsp), %rax shr $(1), %rax movq (%rdi), %rbx adc %rbx, %r8 movq (8)(%rdi), %rbx adc %rbx, %r9 movq (16)(%rdi), %rbx adc %rbx, %r10 movq (24)(%rdi), %rbx adc %rbx, %r11 movq (32)(%rdi), %rbx adc %rbx, %r12 movq (40)(%rdi), %rbx adc %rbx, %r13 movq (48)(%rdi), %rbx adc %rbx, %r14 movq (56)(%rdi), %rbx adc %rbx, %r15 adc $(0), %rax mov %rax, (40)(%rsp) jmp .LloopAgas_38 .Lexit_loopAgas_38: add $(8), %rdx jz .Lcomplete_reg_loopBgas_38 mov %rdx, (32)(%rsp) xor %rax, %rax .Lput_zerogas_38: movq %rax, (%rdi,%rdx,8) add $(1), %rdx cmp $(8), %rdx jl .Lput_zerogas_38 mov (40)(%rsp), %rax shr $(1), %rax mov (%rdi), %rbx adc %rbx, %r8 mov (8)(%rdi), %rbx adc %rbx, %r9 mov (16)(%rdi), %rbx adc %rbx, %r10 mov (24)(%rdi), %rbx adc %rbx, %r11 mov (32)(%rdi), %rbx adc %rbx, %r12 mov (40)(%rdi), %rbx adc %rbx, %r13 mov (48)(%rdi), %rbx adc %rbx, %r14 mov (56)(%rdi), %rbx adc %rbx, %r15 adc $(0), %rax mov %rax, (40)(%rsp) mov (48)(%rsp), %rax xor %rsi, %rcx xor %rcx, %rsi xor %rsi, %rcx call *%rax xor %rsi, %rcx xor %rcx, %rsi xor %rsi, %rcx mov (32)(%rsp), %rdx lea (%rdi,%rdx,8), %rdi mov (40)(%rsp), %rax shr $(1), %rax dec %rdx jz .Lmt_1gas_38 dec %rdx jz .Lmt_2gas_38 dec %rdx jz .Lmt_3gas_38 dec %rdx jz .Lmt_4gas_38 dec %rdx jz .Lmt_5gas_38 dec %rdx jz .Lmt_6gas_38 .Lmt_7gas_38: adc $(0), %r9 .Lmt_6gas_38: adc $(0), %r10 .Lmt_5gas_38: adc $(0), %r11 .Lmt_4gas_38: adc $(0), %r12 .Lmt_3gas_38: adc $(0), %r13 .Lmt_2gas_38: adc $(0), %r14 .Lmt_1gas_38: adc $(0), %r15 movq %r8, (%rdi) movq %r9, (8)(%rdi) movq %r10, (16)(%rdi) movq %r11, (24)(%rdi) movq %r12, (32)(%rdi) movq %r13, (40)(%rdi) movq %r14, (48)(%rdi) movq %r15, (56)(%rdi) jmp .Lmla_enrtygas_38 .Lcomplete_reg_loopBgas_38: mov (40)(%rsp), %rax add %rax, %r8 adc $(0), %r9 adc $(0), %r10 adc $(0), %r11 adc $(0), %r12 adc $(0), %r13 adc $(0), %r14 adc $(0), %r15 movq %r8, (%rdi) movq %r9, (8)(%rdi) movq %r10, (16)(%rdi) movq %r11, (24)(%rdi) movq %r12, (32)(%rdi) movq %r13, (40)(%rdi) movq %r14, (48)(%rdi) movq %r15, (56)(%rdi) .Lmla_enrtygas_38: mov (%rsp), %rbx mov (8)(%rsp), %rdi mov (24)(%rsp), %rdx mov (16)(%rsp), %rsi add $(64), %rcx add $(64), %rdi sub $(8), %rbx jnc .Lmla_loopBgas_38 add $(8), %rbx jz .Lquitgas_38 mov %rbx, (%rsp) lea mla_8xl_tail(%rip), %rax mov (-8)(%rax,%rbx,8), %rbp add %rbp, %rax mov %rax, (48)(%rsp) lea (%rdi,%rdx,8), %rbp xor %rax, %rax .L__0002gas_38: movq %rax, (%rbp) add $(8), %rbp sub $(1), %rbx jnz .L__0002gas_38 xor %rax, %rax mov %rax, (40)(%rsp) sub $(8), %rdx .Ltail_loopAgas_38: movq (%rdi), %r8 movq (8)(%rdi), %r9 movq (16)(%rdi), %r10 movq (24)(%rdi), %r11 movq (32)(%rdi), %r12 movq (40)(%rdi), %r13 movq (48)(%rdi), %r14 movq (56)(%rdi), %r15 mov %rdx, (32)(%rsp) mov (48)(%rsp), %rax call *%rax .Lenrty_tail_loopAgas_38: mov (40)(%rsp), %rax shr $(1), %rax adc $(0), %r8 adc $(0), %r9 adc $(0), %r10 adc $(0), %r11 adc $(0), %r12 adc $(0), %r13 adc $(0), %r14 adc $(0), %r15 adc $(0), %rax mov (%rsp), %rbx mov %rbx, %rbp dec %rbp jz .Ltt_1gas_38 dec %rbp jz .Ltt_2gas_38 dec %rbp jz .Ltt_3gas_38 dec %rbp jz .Ltt_4gas_38 dec %rbp jz .Ltt_5gas_38 dec %rbp jz .Ltt_6gas_38 .Ltt_7gas_38: mov (8)(%rdi,%rbx,8), %rbp adc %rbp, %r9 .Ltt_6gas_38: mov (16)(%rdi,%rbx,8), %rbp adc %rbp, %r10 .Ltt_5gas_38: mov (24)(%rdi,%rbx,8), %rbp adc %rbp, %r11 .Ltt_4gas_38: mov (32)(%rdi,%rbx,8), %rbp adc %rbp, %r12 .Ltt_3gas_38: mov (40)(%rdi,%rbx,8), %rbp adc %rbp, %r13 .Ltt_2gas_38: mov (48)(%rdi,%rbx,8), %rbp adc %rbp, %r14 .Ltt_1gas_38: mov (56)(%rdi,%rbx,8), %rbp adc %rbp, %r15 adc $(0), %rax mov %rax, (40)(%rsp) movq %r8, (%rdi,%rbx,8) movq %r9, (8)(%rdi,%rbx,8) movq %r10, (16)(%rdi,%rbx,8) movq %r11, (24)(%rdi,%rbx,8) movq %r12, (32)(%rdi,%rbx,8) movq %r13, (40)(%rdi,%rbx,8) movq %r14, (48)(%rdi,%rbx,8) movq %r15, (56)(%rdi,%rbx,8) mov (32)(%rsp), %rdx add $(64), %rsi add $(64), %rdi sub $(8), %rdx jnc .Ltail_loopAgas_38 add $(8), %rdx jz .Lquitgas_38 mov (40)(%rsp), %rax mov %rbx, %rbp dec %rbp movq (%rdi,%rbx,8), %r8 add %rax, %r8 movq %r8, (%rdi,%rbx,8) jz .Lsimplegas_38 dec %rbp movq (8)(%rdi,%rbx,8), %r9 adc $(0), %r9 movq %r9, (8)(%rdi,%rbx,8) jz .Lsimplegas_38 dec %rbp movq (16)(%rdi,%rbx,8), %r10 adc $(0), %r10 movq %r10, (16)(%rdi,%rbx,8) jz .Lsimplegas_38 dec %rbp movq (24)(%rdi,%rbx,8), %r11 adc $(0), %r11 movq %r11, (24)(%rdi,%rbx,8) jz .Lsimplegas_38 dec %rbp movq (32)(%rdi,%rbx,8), %r12 adc $(0), %r12 movq %r12, (32)(%rdi,%rbx,8) jz .Lsimplegas_38 dec %rbp movq (40)(%rdi,%rbx,8), %r13 adc $(0), %r13 movq %r13, (40)(%rdi,%rbx,8) jz .Lsimplegas_38 dec %rbp movq (48)(%rdi,%rbx,8), %r14 adc $(0), %r14 movq %r14, (48)(%rdi,%rbx,8) .Lsimplegas_38: call mla_simple .Lquitgas_38: add $(56), %rsp ret .Lfe38: .size mul_NxM, .Lfe38-(mul_NxM) .p2align 5, 0x90 .type sqr_1, @function sqr_1: movq (%rsi), %rdx mulx %rdx, %rax, %rdx movq %rax, (%rdi) movq %rdx, (8)(%rdi) ret .Lfe39: .size sqr_1, .Lfe39-(sqr_1) .p2align 5, 0x90 .type sqr_2, @function sqr_2: movq (%rsi), %rdx mulxq (8)(%rsi), %r8, %r9 mulx %rdx, %r10, %r11 movq (8)(%rsi), %rdx mulx %rdx, %rax, %rdx xor %rcx, %rcx add %r8, %r8 adc %r9, %r9 adc $(0), %rcx movq %r10, (%rdi) add %r8, %r11 movq %r11, (8)(%rdi) adc %r9, %rax movq %rax, (16)(%rdi) adc %rcx, %rdx movq %rdx, (24)(%rdi) ret .Lfe40: .size sqr_2, .Lfe40-(sqr_2) .p2align 5, 0x90 .type sqr_3, @function sqr_3: mov (%rsi), %rdx mulx (8)(%rsi), %r8, %r9 mulx (16)(%rsi), %rax, %r10 add %rax, %r9 adc $(0), %r10 movq (8)(%rsi), %rdx mulxq (16)(%rsi), %rax, %r11 add %rax, %r10 adc $(0), %r11 movq (%rsi), %rdx xor %rcx, %rcx add %r8, %r8 adc %r9, %r9 adc %r10, %r10 adc %r11, %r11 adc %rcx, %rcx mulx %rdx, %rdx, %rax mov %rdx, (%rdi) mov (8)(%rsi), %rdx add %rax, %r8 mov %r8, (8)(%rdi) mulx %rdx, %rdx, %rax adc %rdx, %r9 mov %r9, (16)(%rdi) mov (16)(%rsi), %rdx adc %rax, %r10 mov %r10, (24)(%rdi) mulx %rdx, %rdx, %rax adc %rdx, %r11 mov %r11, (32)(%rdi) adc %rax, %rcx mov %rcx, (40)(%rdi) ret .Lfe41: .size sqr_3, .Lfe41-(sqr_3) .p2align 5, 0x90 .type sqr_4, @function sqr_4: mov (%rsi), %rdx mulx (8)(%rsi), %r8, %r9 mulx (16)(%rsi), %rax, %r10 add %rax, %r9 adc $(0), %r10 mulx (24)(%rsi), %rax, %r11 add %rax, %r10 adc $(0), %r11 movq (8)(%rsi), %rdx mulxq (16)(%rsi), %rax, %rcx xor %r12, %r12 add %rax, %r10 adc %rcx, %r11 adc $(0), %r12 mulxq (24)(%rsi), %rax, %rcx add %rax, %r11 adc %rcx, %r12 movq (16)(%rsi), %rdx mulxq (24)(%rsi), %rax, %r13 add %rax, %r12 adc $(0), %r13 mov (%rsi), %rdx xor %rcx, %rcx add %r8, %r8 adc %r9, %r9 adc %r10, %r10 adc %r11, %r11 adc %r12, %r12 adc %r13, %r13 adc $(0), %rcx mulx %rdx, %rdx, %rax mov %rdx, (%rdi) mov (8)(%rsi), %rdx add %rax, %r8 mov %r8, (8)(%rdi) mulx %rdx, %rdx, %rax adc %rdx, %r9 mov %r9, (16)(%rdi) mov (16)(%rsi), %rdx adc %rax, %r10 mov %r10, (24)(%rdi) mulx %rdx, %rdx, %rax adc %rdx, %r11 mov %r11, (32)(%rdi) mov (24)(%rsi), %rdx adc %rax, %r12 mov %r12, (40)(%rdi) mulx %rdx, %rdx, %rax adc %rdx, %r13 mov %r13, (48)(%rdi) adc %rax, %rcx mov %rcx, (56)(%rdi) ret .Lfe42: .size sqr_4, .Lfe42-(sqr_4) .p2align 5, 0x90 .type sqr_5, @function sqr_5: mov (%rsi), %rdx mulx (8)(%rsi), %r8, %r9 mulx (16)(%rsi), %rax, %r10 add %rax, %r9 adc $(0), %r10 mulx (24)(%rsi), %rax, %r11 add %rax, %r10 adc $(0), %r11 mulx (32)(%rsi), %rax, %r12 add %rax, %r11 adc $(0), %r12 mov (8)(%rsi), %rdx mulx (16)(%rsi), %rax, %rbp add %rax, %r10 adc $(0), %rbp mulx (24)(%rsi), %rax, %rcx add %rax, %r11 adc $(0), %rcx add %rbp, %r11 adc $(0), %rcx mov %rcx, %rbp mulx (32)(%rsi), %rax, %rcx add %rax, %r12 adc $(0), %rcx add %rbp, %r12 adc $(0), %rcx mov %rcx, %rbp mov %rbp, %r13 movq (16)(%rsi), %rdx mulxq (24)(%rsi), %rax, %rcx xor %r14, %r14 add %rax, %r12 adc %rcx, %r13 adc $(0), %r14 mulxq (32)(%rsi), %rax, %rcx add %rax, %r13 adc %rcx, %r14 movq (24)(%rsi), %rdx mulxq (32)(%rsi), %rax, %r15 add %rax, %r14 adc $(0), %r15 mov (%rsi), %rdx xor %rcx, %rcx add %r8, %r8 adc %r9, %r9 adc %r10, %r10 adc %r11, %r11 adc %r12, %r12 adc %r13, %r13 adc %r14, %r14 adc %r15, %r15 adc $(0), %rcx mulx %rdx, %rdx, %rax mov %rdx, (%rdi) mov (8)(%rsi), %rdx add %rax, %r8 mov %r8, (8)(%rdi) mulx %rdx, %rdx, %rax adc %rdx, %r9 mov %r9, (16)(%rdi) mov (16)(%rsi), %rdx adc %rax, %r10 mov %r10, (24)(%rdi) mulx %rdx, %rdx, %rax adc %rdx, %r11 mov %r11, (32)(%rdi) mov (24)(%rsi), %rdx adc %rax, %r12 mov %r12, (40)(%rdi) mulx %rdx, %rdx, %rax adc %rdx, %r13 mov %r13, (48)(%rdi) mov (32)(%rsi), %rdx adc %rax, %r14 mov %r14, (56)(%rdi) mulx %rdx, %rdx, %rax adc %rdx, %r15 mov %r15, (64)(%rdi) mov (40)(%rsi), %rdx adc %rax, %rcx mov %rcx, (72)(%rdi) ret .Lfe43: .size sqr_5, .Lfe43-(sqr_5) .p2align 5, 0x90 .type sqr_6, @function sqr_6: mov (%rsi), %rdx mulx (8)(%rsi), %r8, %r9 mulx (16)(%rsi), %rax, %r10 add %rax, %r9 adc $(0), %r10 mulx (24)(%rsi), %rax, %r11 add %rax, %r10 adc $(0), %r11 mulx (32)(%rsi), %rax, %r12 add %rax, %r11 adc $(0), %r12 mulx (40)(%rsi), %rax, %r13 add %rax, %r12 adc $(0), %r13 mov (8)(%rsi), %rdx mulx (16)(%rsi), %rax, %rbp add %rax, %r10 adc $(0), %rbp mulx (24)(%rsi), %rax, %rcx add %rax, %r11 adc $(0), %rcx add %rbp, %r11 adc $(0), %rcx mov %rcx, %rbp mulx (32)(%rsi), %rax, %rcx add %rax, %r12 adc $(0), %rcx add %rbp, %r12 adc $(0), %rcx mov %rcx, %rbp mulx (40)(%rsi), %rax, %rcx add %rax, %r13 adc $(0), %rcx add %rbp, %r13 adc $(0), %rcx mov %rcx, %rbp mov %rbp, %r14 mov (16)(%rsi), %rdx mulx (24)(%rsi), %rax, %rbp add %rax, %r12 adc $(0), %rbp mulx (32)(%rsi), %rax, %rcx add %rax, %r13 adc $(0), %rcx add %rbp, %r13 adc $(0), %rcx mov %rcx, %rbp mulx (40)(%rsi), %rax, %rcx add %rax, %r14 adc $(0), %rcx add %rbp, %r14 adc $(0), %rcx mov %rcx, %rbp mov %rbp, %r15 movq (24)(%rsi), %rdx mulxq (32)(%rsi), %rax, %rcx xor %rbx, %rbx add %rax, %r14 adc %rcx, %r15 adc $(0), %rbx mulxq (40)(%rsi), %rax, %rcx add %rax, %r15 adc %rcx, %rbx movq (32)(%rsi), %rdx mulxq (40)(%rsi), %rax, %rbp add %rax, %rbx adc $(0), %rbp mov (%rsi), %rdx xor %rcx, %rcx add %r8, %r8 adc %r9, %r9 adc %r10, %r10 adc %r11, %r11 adc %r12, %r12 adc %r13, %r13 adc %r14, %r14 adc %r15, %r15 adc %rbx, %rbx adc %rbp, %rbp adc $(0), %rcx mulx %rdx, %rdx, %rax mov %rdx, (%rdi) mov (8)(%rsi), %rdx add %rax, %r8 mov %r8, (8)(%rdi) mulx %rdx, %rdx, %rax adc %rdx, %r9 mov %r9, (16)(%rdi) mov (16)(%rsi), %rdx adc %rax, %r10 mov %r10, (24)(%rdi) mulx %rdx, %rdx, %rax adc %rdx, %r11 mov %r11, (32)(%rdi) mov (24)(%rsi), %rdx adc %rax, %r12 mov %r12, (40)(%rdi) mulx %rdx, %rdx, %rax adc %rdx, %r13 mov %r13, (48)(%rdi) mov (32)(%rsi), %rdx adc %rax, %r14 mov %r14, (56)(%rdi) mulx %rdx, %rdx, %rax adc %rdx, %r15 mov %r15, (64)(%rdi) mov (40)(%rsi), %rdx adc %rax, %rbx mov %rbx, (72)(%rdi) mulx %rdx, %rdx, %rax adc %rdx, %rbp mov %rbp, (80)(%rdi) adc %rax, %rcx mov %rcx, (88)(%rdi) ret .Lfe44: .size sqr_6, .Lfe44-(sqr_6) .p2align 5, 0x90 .type sqr_7, @function sqr_7: mov (%rsi), %rdx mulx (8)(%rsi), %r8, %r9 mulx (16)(%rsi), %rax, %r10 add %rax, %r9 adc $(0), %r10 mulx (24)(%rsi), %rax, %r11 add %rax, %r10 adc $(0), %r11 mulx (32)(%rsi), %rax, %r12 add %rax, %r11 adc $(0), %r12 mulx (40)(%rsi), %rax, %r13 add %rax, %r12 adc $(0), %r13 mulx (48)(%rsi), %rax, %r14 add %rax, %r13 adc $(0), %r14 mov (8)(%rsi), %rdx mulx (16)(%rsi), %rax, %rbp add %rax, %r10 adc $(0), %rbp mulx (24)(%rsi), %rax, %rcx add %rax, %r11 adc $(0), %rcx add %rbp, %r11 adc $(0), %rcx mov %rcx, %rbp mulx (32)(%rsi), %rax, %rcx add %rax, %r12 adc $(0), %rcx add %rbp, %r12 adc $(0), %rcx mov %rcx, %rbp mulx (40)(%rsi), %rax, %rcx add %rax, %r13 adc $(0), %rcx add %rbp, %r13 adc $(0), %rcx mov %rcx, %rbp mulx (48)(%rsi), %rax, %rcx add %rax, %r14 adc $(0), %rcx add %rbp, %r14 adc $(0), %rcx mov %rcx, %rbp mov %rbp, %r15 mov (16)(%rsi), %rdx mulx (24)(%rsi), %rax, %rbp add %rax, %r12 adc $(0), %rbp xor %rbx, %rbx mulx (32)(%rsi), %rax, %rcx add %rax, %r13 adc $(0), %rcx add %rbp, %r13 adc $(0), %rcx mov %rcx, %rbp mulx (40)(%rsi), %rax, %rcx add %rax, %r14 adc $(0), %rcx add %rbp, %r14 adc $(0), %rcx mov %rcx, %rbp add %rbp, %r15 adc $(0), %rbx mov (24)(%rsi), %rax mulq (32)(%rsi) add %rax, %r14 adc $(0), %rdx add %rdx, %r15 adc $(0), %rbx mov (%rsi), %rdx xor %rcx, %rcx add %r8, %r8 adc %r9, %r9 adc %r10, %r10 adc %r11, %r11 adc %r12, %r12 adc %r13, %r13 adc %r14, %r14 adc $(0), %rcx mulx %rdx, %rdx, %rax mov %rdx, (%rdi) mov (8)(%rsi), %rdx add %rax, %r8 mov %r8, (8)(%rdi) mulx %rdx, %rdx, %rax adc %rdx, %r9 mov %r9, (16)(%rdi) mov (16)(%rsi), %rdx adc %rax, %r10 mov %r10, (24)(%rdi) mulx %rdx, %rdx, %rax adc %rdx, %r11 mov %r11, (32)(%rdi) mov (24)(%rsi), %rdx adc %rax, %r12 mov %r12, (40)(%rdi) mulx %rdx, %rdx, %rax adc %rdx, %r13 mov %r13, (48)(%rdi) adc %rax, %r14 mov %r14, (56)(%rdi) adc $(0), %rcx mov (16)(%rsi), %rax xor %r8, %r8 mulq (48)(%rsi) add %rax, %r15 adc $(0), %rdx add %rdx, %rbx adc $(0), %r8 mov (24)(%rsi), %rdx mulx (40)(%rsi), %rax, %r14 add %rax, %r15 adc %r14, %rbx adc $(0), %r8 mulx (48)(%rsi), %rax, %r14 add %rax, %rbx adc %r14, %r8 mov (32)(%rsi), %rdx mulx (40)(%rsi), %rax, %r14 xor %r9, %r9 add %rax, %rbx adc %r14, %r8 adc $(0), %r9 mulx (48)(%rsi), %rax, %r14 add %rax, %r8 adc %r14, %r9 mov (40)(%rsi), %rax xor %r10, %r10 mulq (48)(%rsi) add %rax, %r9 adc %rdx, %r10 mov (32)(%rsi), %rdx xor %r11, %r11 add %r15, %r15 adc %rbx, %rbx adc %r8, %r8 adc %r9, %r9 adc %r10, %r10 adc $(0), %r11 mulx %rdx, %rdx, %rax add %rcx, %rdx adc $(0), %rax add %rdx, %r15 mov (40)(%rsi), %rdx mov %r15, (64)(%rdi) adc %rax, %rbx mov %rbx, (72)(%rdi) mulx %rdx, %rdx, %rax adc %rdx, %r8 mov %r8, (80)(%rdi) mov (48)(%rsi), %rdx adc %rax, %r9 mov %r9, (88)(%rdi) mulx %rdx, %rdx, %rax adc %rdx, %r10 mov %r10, (96)(%rdi) adc %rax, %r11 mov %r11, (104)(%rdi) ret .Lfe45: .size sqr_7, .Lfe45-(sqr_7) .p2align 5, 0x90 .type sqr_8, @function sqr_8: mov (%rsi), %rdx mulx (8)(%rsi), %r8, %r9 mulx (16)(%rsi), %rax, %r10 add %rax, %r9 adc $(0), %r10 mulx (24)(%rsi), %rax, %r11 add %rax, %r10 adc $(0), %r11 mulx (32)(%rsi), %rax, %r12 add %rax, %r11 adc $(0), %r12 mulx (40)(%rsi), %rax, %r13 add %rax, %r12 adc $(0), %r13 mulx (48)(%rsi), %rax, %r14 add %rax, %r13 adc $(0), %r14 mulx (56)(%rsi), %rax, %r15 add %rax, %r14 adc $(0), %r15 mov (8)(%rsi), %rdx mulx (16)(%rsi), %rax, %rbp add %rax, %r10 adc $(0), %rbp xor %rbx, %rbx mulx (24)(%rsi), %rax, %rcx add %rax, %r11 adc $(0), %rcx add %rbp, %r11 adc $(0), %rcx mov %rcx, %rbp mulx (32)(%rsi), %rax, %rcx add %rax, %r12 adc $(0), %rcx add %rbp, %r12 adc $(0), %rcx mov %rcx, %rbp mulx (40)(%rsi), %rax, %rcx add %rax, %r13 adc $(0), %rcx add %rbp, %r13 adc $(0), %rcx mov %rcx, %rbp mulx (48)(%rsi), %rax, %rcx add %rax, %r14 adc $(0), %rcx add %rbp, %r14 adc $(0), %rcx mov %rcx, %rbp add %rbp, %r15 adc $(0), %rbx mov (16)(%rsi), %rdx mulx (24)(%rsi), %rax, %rbp add %rax, %r12 adc $(0), %rbp mulx (32)(%rsi), %rax, %rcx add %rax, %r13 adc $(0), %rcx add %rbp, %r13 adc $(0), %rcx mov %rcx, %rbp mulx (40)(%rsi), %rax, %rcx add %rax, %r14 adc $(0), %rcx add %rbp, %r14 adc $(0), %rcx mov %rcx, %rbp add %rbp, %r15 adc $(0), %rbx mov (24)(%rsi), %rax mulq (32)(%rsi) add %rax, %r14 adc $(0), %rdx add %rdx, %r15 adc $(0), %rbx mov (%rsi), %rdx xor %rcx, %rcx add %r8, %r8 adc %r9, %r9 adc %r10, %r10 adc %r11, %r11 adc %r12, %r12 adc %r13, %r13 adc %r14, %r14 adc $(0), %rcx mulx %rdx, %rdx, %rax mov %rdx, (%rdi) mov (8)(%rsi), %rdx add %rax, %r8 mov %r8, (8)(%rdi) mulx %rdx, %rdx, %rax adc %rdx, %r9 mov %r9, (16)(%rdi) mov (16)(%rsi), %rdx adc %rax, %r10 mov %r10, (24)(%rdi) mulx %rdx, %rdx, %rax adc %rdx, %r11 mov %r11, (32)(%rdi) mov (24)(%rsi), %rdx adc %rax, %r12 mov %r12, (40)(%rdi) mulx %rdx, %rdx, %rax adc %rdx, %r13 mov %r13, (48)(%rdi) adc %rax, %r14 mov %r14, (56)(%rdi) adc $(0), %rcx mov (8)(%rsi), %rax xor %r8, %r8 mulq (56)(%rsi) add %rax, %r15 adc $(0), %rdx add %rdx, %rbx adc $(0), %r8 mov (16)(%rsi), %rdx mulx (48)(%rsi), %rax, %r14 add %rax, %r15 adc %r14, %rbx adc $(0), %r8 mulx (56)(%rsi), %rax, %r14 xor %r9, %r9 add %rax, %rbx adc %r14, %r8 adc $(0), %r9 mov (24)(%rsi), %rdx mulx (40)(%rsi), %rax, %r14 add %rax, %r15 adc $(0), %r14 add %r14, %rbx adc $(0), %r8 adc $(0), %r9 mulx (48)(%rsi), %rax, %r14 add %rax, %rbx adc $(0), %r14 add %r14, %r8 adc $(0), %r9 mulx (56)(%rsi), %rax, %r14 add %rax, %r8 adc $(0), %r14 add %r14, %r9 mov (32)(%rsi), %rdx mulx (40)(%rsi), %rax, %r10 add %rax, %rbx adc $(0), %r10 mulx (48)(%rsi), %rax, %r14 add %rax, %r8 adc $(0), %r14 add %r10, %r8 adc $(0), %r14 mov %r14, %r10 mulx (56)(%rsi), %rax, %r14 add %rax, %r9 adc $(0), %r14 add %r10, %r9 adc $(0), %r14 mov %r14, %r10 mov (40)(%rsi), %rdx mulx (48)(%rsi), %rax, %r11 add %rax, %r9 adc $(0), %r11 mulx (56)(%rsi), %rax, %r14 add %rax, %r10 adc $(0), %r14 add %r11, %r10 adc $(0), %r14 mov %r14, %r11 mov (48)(%rsi), %rax mulq (56)(%rsi) add %rax, %r11 adc $(0), %rdx mov %rdx, %r12 mov (32)(%rsi), %rdx xor %r13, %r13 add %r15, %r15 adc %rbx, %rbx adc %r8, %r8 adc %r9, %r9 adc %r10, %r10 adc %r11, %r11 adc %r12, %r12 adc $(0), %r13 mulx %rdx, %rdx, %rax add %rcx, %rdx adc $(0), %rax add %rdx, %r15 mov (40)(%rsi), %rdx mov %r15, (64)(%rdi) adc %rax, %rbx mov %rbx, (72)(%rdi) mulx %rdx, %rdx, %rax adc %rdx, %r8 mov %r8, (80)(%rdi) mov (48)(%rsi), %rdx adc %rax, %r9 mov %r9, (88)(%rdi) mulx %rdx, %rdx, %rax adc %rdx, %r10 mov %r10, (96)(%rdi) mov (56)(%rsi), %rdx adc %rax, %r11 mov %r11, (104)(%rdi) mulx %rdx, %rdx, %rax adc %rdx, %r12 mov %r12, (112)(%rdi) adc %rax, %r13 mov %r13, (120)(%rdi) ret .Lfe46: .size sqr_8, .Lfe46-(sqr_8) .p2align 5, 0x90 .type add_diag_4, @function add_diag_4: movq (%rdi), %r8 movq (8)(%rdi), %r9 movq (16)(%rdi), %r10 movq (24)(%rdi), %r11 movq (32)(%rdi), %r12 movq (40)(%rdi), %r13 movq (48)(%rdi), %r14 movq (56)(%rdi), %r15 xor %rbp, %rbp add %r8, %r8 adc %r9, %r9 adc %r10, %r10 adc %r11, %r11 adc %r12, %r12 adc %r13, %r13 adc %r14, %r14 adc %r15, %r15 adc $(0), %rbp mov (%rsi), %rdx mulx %rdx, %rax, %rdx add %rbx, %rax adc $(0), %rdx add %rax, %r8 mov %rbp, %rbx adc %rdx, %r9 mov (8)(%rsi), %rdx mulx %rdx, %rax, %rdx adc %rax, %r10 adc %rdx, %r11 mov (16)(%rsi), %rdx mulx %rdx, %rax, %rdx adc %rax, %r12 adc %rdx, %r13 mov (24)(%rsi), %rdx mulx %rdx, %rax, %rdx adc %rax, %r14 adc %rdx, %r15 adc $(0), %rbx movq %r8, (%rdi) movq %r9, (8)(%rdi) movq %r10, (16)(%rdi) movq %r11, (24)(%rdi) movq %r12, (32)(%rdi) movq %r13, (40)(%rdi) movq %r14, (48)(%rdi) movq %r15, (56)(%rdi) ret .Lfe47: .size add_diag_4, .Lfe47-(add_diag_4) .p2align 5, 0x90 .type sqr8_triangle, @function sqr8_triangle: mov (%rsi), %rdx mov %r8, (%rdi) mulx (8)(%rsi), %rax, %rbp add %rax, %r9 adc $(0), %rbp mulx (16)(%rsi), %rax, %rbx add %rax, %r10 adc $(0), %rbx add %rbp, %r10 adc $(0), %rbx mulx (24)(%rsi), %rax, %rbp add %rax, %r11 adc $(0), %rbp add %rbx, %r11 adc $(0), %rbp mulx (32)(%rsi), %rax, %rbx add %rax, %r12 adc $(0), %rbx add %rbp, %r12 adc $(0), %rbx mulx (40)(%rsi), %rax, %rbp add %rax, %r13 adc $(0), %rbp add %rbx, %r13 adc $(0), %rbp mulx (48)(%rsi), %rax, %rbx add %rax, %r14 adc $(0), %rbx add %rbp, %r14 adc $(0), %rbx mulx (56)(%rsi), %rax, %r8 add %rax, %r15 adc $(0), %r8 add %rbx, %r15 adc $(0), %r8 mov (8)(%rsi), %rdx mov %r9, (8)(%rdi) mulx (16)(%rsi), %rax, %rbx add %rax, %r11 adc $(0), %rbx mulx (24)(%rsi), %rax, %rbp add %rax, %r12 adc $(0), %rbp add %rbx, %r12 adc $(0), %rbp mulx (32)(%rsi), %rax, %rbx add %rax, %r13 adc $(0), %rbx add %rbp, %r13 adc $(0), %rbx mulx (40)(%rsi), %rax, %rbp add %rax, %r14 adc $(0), %rbp add %rbx, %r14 adc $(0), %rbp mulx (48)(%rsi), %rax, %rbx add %rax, %r15 adc $(0), %rbx add %rbp, %r15 adc $(0), %rbx mulx (56)(%rsi), %rax, %r9 add %rax, %r8 adc $(0), %r9 add %rbx, %r8 adc $(0), %r9 mov (16)(%rsi), %rdx mov %r10, (16)(%rdi) mulx (24)(%rsi), %rax, %rbp add %rax, %r13 adc $(0), %rbp mulx (32)(%rsi), %rax, %rbx add %rax, %r14 adc $(0), %rbx add %rbp, %r14 adc $(0), %rbx mulx (40)(%rsi), %rax, %rbp add %rax, %r15 adc $(0), %rbp add %rbx, %r15 adc $(0), %rbp mulx (48)(%rsi), %rax, %rbx add %rax, %r8 adc $(0), %rbx add %rbp, %r8 adc $(0), %rbx mulx (56)(%rsi), %rax, %r10 add %rax, %r9 adc $(0), %r10 add %rbx, %r9 adc $(0), %r10 mov (24)(%rsi), %rdx mov %r11, (24)(%rdi) mulx (32)(%rsi), %rax, %rbx add %rax, %r15 adc $(0), %rbx mulx (40)(%rsi), %rax, %rbp add %rax, %r8 adc $(0), %rbp add %rbx, %r8 adc $(0), %rbp mulx (48)(%rsi), %rax, %rbx add %rax, %r9 adc $(0), %rbx add %rbp, %r9 adc $(0), %rbx mulx (56)(%rsi), %rax, %r11 add %rax, %r10 adc $(0), %r11 add %rbx, %r10 adc $(0), %r11 mov (32)(%rsi), %rdx mov %r12, (32)(%rdi) mulx (40)(%rsi), %rax, %rbp add %rax, %r9 adc $(0), %rbp mulx (48)(%rsi), %rax, %rbx add %rax, %r10 adc $(0), %rbx add %rbp, %r10 adc $(0), %rbx mulx (56)(%rsi), %rax, %r12 add %rax, %r11 adc $(0), %r12 add %rbx, %r11 adc $(0), %r12 mov (40)(%rsi), %rdx mov %r13, (40)(%rdi) mulx (48)(%rsi), %rax, %rbx add %rax, %r11 adc $(0), %rbx mulx (56)(%rsi), %rax, %r13 add %rax, %r12 adc $(0), %r13 add %rbx, %r12 adc $(0), %r13 mov (48)(%rsi), %rdx mov %r14, (48)(%rdi) mulx (56)(%rsi), %rax, %r14 add %rax, %r13 adc $(0), %r14 ret .Lfe48: .size sqr8_triangle, .Lfe48-(sqr8_triangle) .p2align 5, 0x90 .type sqr_9, @function sqr_9: call sqr8_triangle movq %r15, (56)(%rdi) lea (64)(%rsi), %rcx add $(64), %rdi xor %r15, %r15 call mla_8x1 movq %r8, (8)(%rdi) movq %r9, (16)(%rdi) movq %r10, (24)(%rdi) movq %r11, (32)(%rdi) movq %r12, (40)(%rdi) movq %r13, (48)(%rdi) movq %r14, (56)(%rdi) movq %r15, (64)(%rdi) xor %rbx, %rbx movq %rbx, (72)(%rdi) sub $(64), %rdi call add_diag_4 add $(64), %rdi add $(32), %rsi call add_diag_4 add $(64), %rdi add $(32), %rsi movq (%rdi), %r8 movq (8)(%rdi), %r9 xor %rbp, %rbp add %r8, %r8 adc %r9, %r9 adc $(0), %rbp mov (%rsi), %rdx mulx %rdx, %rax, %rdx add %rbx, %rax adc $(0), %rdx add %rax, %r8 mov %rbp, %rbx adc %rdx, %r9 adc $(0), %rbx movq %r8, (%rdi) movq %r9, (8)(%rdi) sub $(64), %rsi sub $(128), %rdi ret .Lfe49: .size sqr_9, .Lfe49-(sqr_9) .p2align 5, 0x90 .type sqr_10, @function sqr_10: call sqr8_triangle movq %r15, (56)(%rdi) lea (64)(%rsi), %rcx add $(64), %rdi xor %r15, %r15 call mla_8x2 movq %r8, (16)(%rdi) movq %r9, (24)(%rdi) movq %r10, (32)(%rdi) movq %r11, (40)(%rdi) movq %r12, (48)(%rdi) movq %r13, (56)(%rdi) movq %r14, (64)(%rdi) movq (64)(%rsi), %rdx mulx (72)(%rsi), %rax, %r8 add %rax, %r15 adc $(0), %r8 xor %rbx, %rbx movq %r15, (72)(%rdi) movq %r8, (80)(%rdi) movq %rbx, (88)(%rdi) sub $(64), %rdi call add_diag_4 add $(64), %rdi add $(32), %rsi call add_diag_4 add $(64), %rdi add $(32), %rsi movq (%rdi), %r8 movq (8)(%rdi), %r9 movq (16)(%rdi), %r10 movq (24)(%rdi), %r11 xor %rbp, %rbp add %r8, %r8 adc %r9, %r9 adc %r10, %r10 adc %r11, %r11 adc $(0), %rbp mov (%rsi), %rdx mulx %rdx, %rax, %rdx add %rbx, %rax adc $(0), %rdx add %rax, %r8 mov %rbp, %rbx adc %rdx, %r9 mov (8)(%rsi), %rdx mulx %rdx, %rax, %rdx adc %rax, %r10 adc %rdx, %r11 adc $(0), %rbx movq %r8, (%rdi) movq %r9, (8)(%rdi) movq %r10, (16)(%rdi) movq %r11, (24)(%rdi) sub $(64), %rsi sub $(128), %rdi ret .Lfe50: .size sqr_10, .Lfe50-(sqr_10) .p2align 5, 0x90 .type sqr_11, @function sqr_11: call sqr8_triangle movq %r15, (56)(%rdi) lea (64)(%rsi), %rcx add $(64), %rdi xor %r15, %r15 call mla_8x1 add $(8), %rdi add $(8), %rcx call mla_8x2 sub $(8), %rdi sub $(8), %rcx movq %r8, (24)(%rdi) movq %r9, (32)(%rdi) movq %r10, (40)(%rdi) movq %r11, (48)(%rdi) movq %r12, (56)(%rdi) movq (64)(%rsi), %rdx mov %r13, (64)(%rdi) mulx (72)(%rsi), %rax, %rbx add %rax, %r14 adc $(0), %rbx mulx (80)(%rsi), %rax, %r8 add %rax, %r15 adc $(0), %r8 add %rbx, %r15 adc $(0), %r8 movq (72)(%rsi), %rdx mov %r14, (72)(%rdi) mulx (80)(%rsi), %rax, %r9 add %rax, %r8 adc $(0), %r9 xor %rbx, %rbx movq %r15, (80)(%rdi) movq %r8, (88)(%rdi) movq %r9, (96)(%rdi) movq %rbx, (104)(%rdi) sub $(64), %rdi call add_diag_4 add $(64), %rdi add $(32), %rsi call add_diag_4 add $(64), %rdi add $(32), %rsi movq (%rdi), %r8 movq (8)(%rdi), %r9 movq (16)(%rdi), %r10 movq (24)(%rdi), %r11 movq (32)(%rdi), %r12 movq (40)(%rdi), %r13 xor %rbp, %rbp add %r8, %r8 adc %r9, %r9 adc %r10, %r10 adc %r11, %r11 adc %r12, %r12 adc %r13, %r13 adc $(0), %rbp mov (%rsi), %rdx mulx %rdx, %rax, %rdx add %rbx, %rax adc $(0), %rdx add %rax, %r8 mov %rbp, %rbx adc %rdx, %r9 mov (8)(%rsi), %rdx mulx %rdx, %rax, %rdx adc %rax, %r10 adc %rdx, %r11 mov (16)(%rsi), %rdx mulx %rdx, %rax, %rdx adc %rax, %r12 adc %rdx, %r13 adc $(0), %rbx movq %r8, (%rdi) movq %r9, (8)(%rdi) movq %r10, (16)(%rdi) movq %r11, (24)(%rdi) movq %r12, (32)(%rdi) movq %r13, (40)(%rdi) sub $(64), %rsi sub $(128), %rdi ret .Lfe51: .size sqr_11, .Lfe51-(sqr_11) .p2align 5, 0x90 .type sqr_12, @function sqr_12: call sqr8_triangle movq %r15, (56)(%rdi) lea (64)(%rsi), %rcx add $(64), %rdi xor %r15, %r15 call mla_8x2 add $(16), %rdi add $(16), %rcx call mla_8x2 sub $(16), %rdi sub $(16), %rcx movq %r8, (32)(%rdi) movq %r9, (40)(%rdi) movq %r10, (48)(%rdi) movq %r11, (56)(%rdi) movq (64)(%rsi), %rdx mov %r12, (64)(%rdi) mulx (72)(%rsi), %rax, %rbp add %rax, %r13 adc $(0), %rbp mulx (80)(%rsi), %rax, %rbx add %rax, %r14 adc $(0), %rbx add %rbp, %r14 adc $(0), %rbx mulx (88)(%rsi), %rax, %r8 add %rax, %r15 adc $(0), %r8 add %rbx, %r15 adc $(0), %r8 movq (72)(%rsi), %rdx mov %r13, (72)(%rdi) mulx (80)(%rsi), %rax, %rbx add %rax, %r15 adc $(0), %rbx mulx (88)(%rsi), %rax, %r9 add %rax, %r8 adc $(0), %r9 add %rbx, %r8 adc $(0), %r9 movq (80)(%rsi), %rdx mov %r14, (80)(%rdi) mulx (88)(%rsi), %rax, %r10 add %rax, %r9 adc $(0), %r10 xor %rbx, %rbx movq %r15, (88)(%rdi) movq %r8, (96)(%rdi) movq %r9, (104)(%rdi) movq %r10, (112)(%rdi) movq %rbx, (120)(%rdi) sub $(64), %rdi call add_diag_4 add $(64), %rdi add $(32), %rsi call add_diag_4 add $(64), %rdi add $(32), %rsi call add_diag_4 sub $(64), %rsi sub $(128), %rdi ret .Lfe52: .size sqr_12, .Lfe52-(sqr_12) .p2align 5, 0x90 .type sqr_13, @function sqr_13: call sqr8_triangle movq %r15, (56)(%rdi) lea (64)(%rsi), %rcx add $(64), %rdi xor %r15, %r15 call mla_8x1 add $(8), %rdi add $(8), %rcx call mla_8x2 add $(16), %rdi add $(16), %rcx call mla_8x2 sub $(24), %rdi sub $(24), %rcx movq %r8, (40)(%rdi) movq %r9, (48)(%rdi) movq %r10, (56)(%rdi) movq (64)(%rsi), %rdx mov %r11, (64)(%rdi) mulx (72)(%rsi), %rax, %rbx add %rax, %r12 adc $(0), %rbx mulx (80)(%rsi), %rax, %rbp add %rax, %r13 adc $(0), %rbp add %rbx, %r13 adc $(0), %rbp mulx (88)(%rsi), %rax, %rbx add %rax, %r14 adc $(0), %rbx add %rbp, %r14 adc $(0), %rbx mulx (96)(%rsi), %rax, %r8 add %rax, %r15 adc $(0), %r8 add %rbx, %r15 adc $(0), %r8 movq (72)(%rsi), %rdx mov %r12, (72)(%rdi) mulx (80)(%rsi), %rax, %rbp add %rax, %r14 adc $(0), %rbp mulx (88)(%rsi), %rax, %rbx add %rax, %r15 adc $(0), %rbx add %rbp, %r15 adc $(0), %rbx mulx (96)(%rsi), %rax, %r9 add %rax, %r8 adc $(0), %r9 add %rbx, %r8 adc $(0), %r9 movq (80)(%rsi), %rdx mov %r13, (80)(%rdi) mulx (88)(%rsi), %rax, %rbx add %rax, %r8 adc $(0), %rbx mulx (96)(%rsi), %rax, %r10 add %rax, %r9 adc $(0), %r10 add %rbx, %r9 adc $(0), %r10 movq (88)(%rsi), %rdx mov %r14, (88)(%rdi) mulx (96)(%rsi), %rax, %r11 add %rax, %r10 adc $(0), %r11 xor %rbx, %rbx movq %r15, (96)(%rdi) movq %r8, (104)(%rdi) movq %r9, (112)(%rdi) movq %r10, (120)(%rdi) movq %r11, (128)(%rdi) movq %rbx, (136)(%rdi) sub $(64), %rdi call add_diag_4 add $(64), %rdi add $(32), %rsi call add_diag_4 add $(64), %rdi add $(32), %rsi call add_diag_4 add $(64), %rdi add $(32), %rsi movq (%rdi), %r8 movq (8)(%rdi), %r9 xor %rbp, %rbp add %r8, %r8 adc %r9, %r9 adc $(0), %rbp mov (%rsi), %rdx mulx %rdx, %rax, %rdx add %rbx, %rax adc $(0), %rdx add %rax, %r8 mov %rbp, %rbx adc %rdx, %r9 adc $(0), %rbx movq %r8, (%rdi) movq %r9, (8)(%rdi) sub $(96), %rsi sub $(192), %rdi ret .Lfe53: .size sqr_13, .Lfe53-(sqr_13) .p2align 5, 0x90 .type sqr_14, @function sqr_14: call sqr8_triangle movq %r15, (56)(%rdi) lea (64)(%rsi), %rcx add $(64), %rdi xor %r15, %r15 call mla_8x2 add $(16), %rdi add $(16), %rcx call mla_8x2 add $(16), %rdi add $(16), %rcx call mla_8x2 sub $(32), %rdi sub $(32), %rcx movq %r8, (48)(%rdi) movq %r9, (56)(%rdi) movq (64)(%rsi), %rdx mov %r10, (64)(%rdi) mulx (72)(%rsi), %rax, %rbp add %rax, %r11 adc $(0), %rbp mulx (80)(%rsi), %rax, %rbx add %rax, %r12 adc $(0), %rbx add %rbp, %r12 adc $(0), %rbx mulx (88)(%rsi), %rax, %rbp add %rax, %r13 adc $(0), %rbp add %rbx, %r13 adc $(0), %rbp mulx (96)(%rsi), %rax, %rbx add %rax, %r14 adc $(0), %rbx add %rbp, %r14 adc $(0), %rbx mulx (104)(%rsi), %rax, %r8 add %rax, %r15 adc $(0), %r8 add %rbx, %r15 adc $(0), %r8 movq (72)(%rsi), %rdx mov %r11, (72)(%rdi) mulx (80)(%rsi), %rax, %rbx add %rax, %r13 adc $(0), %rbx mulx (88)(%rsi), %rax, %rbp add %rax, %r14 adc $(0), %rbp add %rbx, %r14 adc $(0), %rbp mulx (96)(%rsi), %rax, %rbx add %rax, %r15 adc $(0), %rbx add %rbp, %r15 adc $(0), %rbx mulx (104)(%rsi), %rax, %r9 add %rax, %r8 adc $(0), %r9 add %rbx, %r8 adc $(0), %r9 movq (80)(%rsi), %rdx mov %r12, (80)(%rdi) mulx (88)(%rsi), %rax, %rbp add %rax, %r15 adc $(0), %rbp mulx (96)(%rsi), %rax, %rbx add %rax, %r8 adc $(0), %rbx add %rbp, %r8 adc $(0), %rbx mulx (104)(%rsi), %rax, %r10 add %rax, %r9 adc $(0), %r10 add %rbx, %r9 adc $(0), %r10 movq (88)(%rsi), %rdx mov %r13, (88)(%rdi) mulx (96)(%rsi), %rax, %rbx add %rax, %r9 adc $(0), %rbx mulx (104)(%rsi), %rax, %r11 add %rax, %r10 adc $(0), %r11 add %rbx, %r10 adc $(0), %r11 movq (96)(%rsi), %rdx mov %r14, (96)(%rdi) mulx (104)(%rsi), %rax, %r12 add %rax, %r11 adc $(0), %r12 xor %rbx, %rbx movq %r15, (104)(%rdi) movq %r8, (112)(%rdi) movq %r9, (120)(%rdi) movq %r10, (128)(%rdi) movq %r11, (136)(%rdi) movq %r12, (144)(%rdi) movq %rbx, (152)(%rdi) sub $(64), %rdi call add_diag_4 add $(64), %rdi add $(32), %rsi call add_diag_4 add $(64), %rdi add $(32), %rsi call add_diag_4 add $(64), %rdi add $(32), %rsi movq (%rdi), %r8 movq (8)(%rdi), %r9 movq (16)(%rdi), %r10 movq (24)(%rdi), %r11 xor %rbp, %rbp add %r8, %r8 adc %r9, %r9 adc %r10, %r10 adc %r11, %r11 adc $(0), %rbp mov (%rsi), %rdx mulx %rdx, %rax, %rdx add %rbx, %rax adc $(0), %rdx add %rax, %r8 mov %rbp, %rbx adc %rdx, %r9 mov (8)(%rsi), %rdx mulx %rdx, %rax, %rdx adc %rax, %r10 adc %rdx, %r11 adc $(0), %rbx movq %r8, (%rdi) movq %r9, (8)(%rdi) movq %r10, (16)(%rdi) movq %r11, (24)(%rdi) sub $(96), %rsi sub $(192), %rdi ret .Lfe54: .size sqr_14, .Lfe54-(sqr_14) .p2align 5, 0x90 .type sqr_15, @function sqr_15: call sqr8_triangle movq %r15, (56)(%rdi) lea (64)(%rsi), %rcx add $(64), %rdi xor %r15, %r15 call mla_8x1 add $(8), %rdi add $(8), %rcx call mla_8x2 add $(16), %rdi add $(16), %rcx call mla_8x2 add $(16), %rdi add $(16), %rcx call mla_8x2 sub $(40), %rdi sub $(40), %rcx movq %r8, (56)(%rdi) movq (64)(%rsi), %rdx mov %r9, (64)(%rdi) mulx (72)(%rsi), %rax, %rbx add %rax, %r10 adc $(0), %rbx mulx (80)(%rsi), %rax, %rbp add %rax, %r11 adc $(0), %rbp add %rbx, %r11 adc $(0), %rbp mulx (88)(%rsi), %rax, %rbx add %rax, %r12 adc $(0), %rbx add %rbp, %r12 adc $(0), %rbx mulx (96)(%rsi), %rax, %rbp add %rax, %r13 adc $(0), %rbp add %rbx, %r13 adc $(0), %rbp mulx (104)(%rsi), %rax, %rbx add %rax, %r14 adc $(0), %rbx add %rbp, %r14 adc $(0), %rbx mulx (112)(%rsi), %rax, %r8 add %rax, %r15 adc $(0), %r8 add %rbx, %r15 adc $(0), %r8 movq (72)(%rsi), %rdx mov %r10, (72)(%rdi) mulx (80)(%rsi), %rax, %rbp add %rax, %r12 adc $(0), %rbp mulx (88)(%rsi), %rax, %rbx add %rax, %r13 adc $(0), %rbx add %rbp, %r13 adc $(0), %rbx mulx (96)(%rsi), %rax, %rbp add %rax, %r14 adc $(0), %rbp add %rbx, %r14 adc $(0), %rbp mulx (104)(%rsi), %rax, %rbx add %rax, %r15 adc $(0), %rbx add %rbp, %r15 adc $(0), %rbx mulx (112)(%rsi), %rax, %r9 add %rax, %r8 adc $(0), %r9 add %rbx, %r8 adc $(0), %r9 movq (80)(%rsi), %rdx mov %r11, (80)(%rdi) mulx (88)(%rsi), %rax, %rbx add %rax, %r14 adc $(0), %rbx mulx (96)(%rsi), %rax, %rbp add %rax, %r15 adc $(0), %rbp add %rbx, %r15 adc $(0), %rbp mulx (104)(%rsi), %rax, %rbx add %rax, %r8 adc $(0), %rbx add %rbp, %r8 adc $(0), %rbx mulx (112)(%rsi), %rax, %r10 add %rax, %r9 adc $(0), %r10 add %rbx, %r9 adc $(0), %r10 movq (88)(%rsi), %rdx mov %r12, (88)(%rdi) mulx (96)(%rsi), %rax, %rbp add %rax, %r8 adc $(0), %rbp mulx (104)(%rsi), %rax, %rbx add %rax, %r9 adc $(0), %rbx add %rbp, %r9 adc $(0), %rbx mulx (112)(%rsi), %rax, %r11 add %rax, %r10 adc $(0), %r11 add %rbx, %r10 adc $(0), %r11 movq (96)(%rsi), %rdx mov %r13, (96)(%rdi) mulx (104)(%rsi), %rax, %rbx add %rax, %r10 adc $(0), %rbx mulx (112)(%rsi), %rax, %r12 add %rax, %r11 adc $(0), %r12 add %rbx, %r11 adc $(0), %r12 movq (104)(%rsi), %rdx mov %r14, (104)(%rdi) mulx (112)(%rsi), %rax, %r13 add %rax, %r12 adc $(0), %r13 xor %rbx, %rbx movq %r15, (112)(%rdi) movq %r8, (120)(%rdi) movq %r9, (128)(%rdi) movq %r10, (136)(%rdi) movq %r11, (144)(%rdi) movq %r12, (152)(%rdi) movq %r13, (160)(%rdi) movq %rbx, (168)(%rdi) sub $(64), %rdi call add_diag_4 add $(64), %rdi add $(32), %rsi call add_diag_4 add $(64), %rdi add $(32), %rsi call add_diag_4 add $(64), %rdi add $(32), %rsi movq (%rdi), %r8 movq (8)(%rdi), %r9 movq (16)(%rdi), %r10 movq (24)(%rdi), %r11 movq (32)(%rdi), %r12 movq (40)(%rdi), %r13 xor %rbp, %rbp add %r8, %r8 adc %r9, %r9 adc %r10, %r10 adc %r11, %r11 adc %r12, %r12 adc %r13, %r13 adc $(0), %rbp mov (%rsi), %rdx mulx %rdx, %rax, %rdx add %rbx, %rax adc $(0), %rdx add %rax, %r8 mov %rbp, %rbx adc %rdx, %r9 mov (8)(%rsi), %rdx mulx %rdx, %rax, %rdx adc %rax, %r10 adc %rdx, %r11 mov (16)(%rsi), %rdx mulx %rdx, %rax, %rdx adc %rax, %r12 adc %rdx, %r13 adc $(0), %rbx movq %r8, (%rdi) movq %r9, (8)(%rdi) movq %r10, (16)(%rdi) movq %r11, (24)(%rdi) movq %r12, (32)(%rdi) movq %r13, (40)(%rdi) sub $(96), %rsi sub $(192), %rdi ret .Lfe55: .size sqr_15, .Lfe55-(sqr_15) .p2align 5, 0x90 .type sqr_16, @function sqr_16: call sqr8_triangle movq %r15, (56)(%rdi) mov %rsi, %rcx add $(64), %rsi add $(64), %rdi xor %r15, %r15 call mla_8x2 add $(16), %rdi add $(16), %rcx call mla_8x2 add $(16), %rdi add $(16), %rcx call mla_8x2 add $(16), %rdi add $(16), %rcx call mla_8x2 sub $(48), %rdi sub $(48), %rcx add $(64), %rdi call sqr8_triangle xor %rbx, %rbx movq %r15, (56)(%rdi) movq %r8, (64)(%rdi) movq %r9, (72)(%rdi) movq %r10, (80)(%rdi) movq %r11, (88)(%rdi) movq %r12, (96)(%rdi) movq %r13, (104)(%rdi) movq %r14, (112)(%rdi) movq %rbx, (120)(%rdi) sub $(64), %rsi sub $(128), %rdi call add_diag_4 add $(64), %rdi add $(32), %rsi call add_diag_4 add $(64), %rdi add $(32), %rsi call add_diag_4 add $(64), %rdi add $(32), %rsi call add_diag_4 sub $(96), %rsi sub $(192), %rdi ret .Lfe56: .size sqr_16, .Lfe56-(sqr_16) .p2align 5, 0x90 .type sqr9_triangle, @function sqr9_triangle: call sqr8_triangle movq %r15, (56)(%rdi) xor %r15, %r15 lea (64)(%rsi), %rcx add $(64), %rdi call mla_8x1 xor %rax, %rax movq %r8, (8)(%rdi) movq %r9, (16)(%rdi) movq %r10, (24)(%rdi) movq %r11, (32)(%rdi) movq %r12, (40)(%rdi) movq %r13, (48)(%rdi) movq %r14, (56)(%rdi) movq %r15, (64)(%rdi) movq %rax, (72)(%rdi) sub $(64), %rdi ret .Lfe57: .size sqr9_triangle, .Lfe57-(sqr9_triangle) .p2align 5, 0x90 .type sqr10_triangle, @function sqr10_triangle: call sqr8_triangle movq %r15, (56)(%rdi) xor %r15, %r15 lea (64)(%rsi), %rcx add $(64), %rdi call mla_8x2 movq %r8, (16)(%rdi) movq %r9, (24)(%rdi) movq %r10, (32)(%rdi) movq %r11, (40)(%rdi) movq %r12, (48)(%rdi) movq %r13, (56)(%rdi) movq %r14, (64)(%rdi) movq (64)(%rsi), %rdx mulx (72)(%rsi), %rax, %r8 add %rax, %r15 adc $(0), %r8 xor %rax, %rax movq %r15, (72)(%rdi) movq %r8, (80)(%rdi) movq %rax, (88)(%rdi) sub $(64), %rdi ret .Lfe58: .size sqr10_triangle, .Lfe58-(sqr10_triangle) .p2align 5, 0x90 .type sqr11_triangle, @function sqr11_triangle: call sqr8_triangle movq %r15, (56)(%rdi) xor %r15, %r15 lea (64)(%rsi), %rcx add $(64), %rdi call mla_8x3 movq %r8, (24)(%rdi) movq %r9, (32)(%rdi) movq %r10, (40)(%rdi) movq %r11, (48)(%rdi) movq %r12, (56)(%rdi) movq (64)(%rsi), %rdx mov %r13, (64)(%rdi) mulx (72)(%rsi), %rax, %rbx add %rax, %r14 adc $(0), %rbx mulx (80)(%rsi), %rax, %r8 add %rax, %r15 adc $(0), %r8 add %rbx, %r15 adc $(0), %r8 movq (72)(%rsi), %rdx mov %r14, (72)(%rdi) mulx (80)(%rsi), %rax, %r9 add %rax, %r8 adc $(0), %r9 xor %rax, %rax movq %r15, (80)(%rdi) movq %r8, (88)(%rdi) movq %r9, (96)(%rdi) movq %rax, (104)(%rdi) sub $(64), %rdi ret .Lfe59: .size sqr11_triangle, .Lfe59-(sqr11_triangle) .p2align 5, 0x90 .type sqr12_triangle, @function sqr12_triangle: call sqr8_triangle movq %r15, (56)(%rdi) xor %r15, %r15 lea (64)(%rsi), %rcx add $(64), %rdi call mla_8x4 movq %r8, (32)(%rdi) movq %r9, (40)(%rdi) movq %r10, (48)(%rdi) movq %r11, (56)(%rdi) movq (64)(%rsi), %rdx mov %r12, (64)(%rdi) mulx (72)(%rsi), %rax, %rbp add %rax, %r13 adc $(0), %rbp mulx (80)(%rsi), %rax, %rbx add %rax, %r14 adc $(0), %rbx add %rbp, %r14 adc $(0), %rbx mulx (88)(%rsi), %rax, %r8 add %rax, %r15 adc $(0), %r8 add %rbx, %r15 adc $(0), %r8 movq (72)(%rsi), %rdx mov %r13, (72)(%rdi) mulx (80)(%rsi), %rax, %rbx add %rax, %r15 adc $(0), %rbx mulx (88)(%rsi), %rax, %r9 add %rax, %r8 adc $(0), %r9 add %rbx, %r8 adc $(0), %r9 movq (80)(%rsi), %rdx mov %r14, (80)(%rdi) mulx (88)(%rsi), %rax, %r10 add %rax, %r9 adc $(0), %r10 xor %rax, %rax movq %r15, (88)(%rdi) movq %r8, (96)(%rdi) movq %r9, (104)(%rdi) movq %r10, (112)(%rdi) movq %rax, (120)(%rdi) sub $(64), %rdi ret .Lfe60: .size sqr12_triangle, .Lfe60-(sqr12_triangle) .p2align 5, 0x90 .type sqr13_triangle, @function sqr13_triangle: call sqr8_triangle movq %r15, (56)(%rdi) xor %r15, %r15 lea (64)(%rsi), %rcx add $(64), %rdi call mla_8x5 movq %r8, (40)(%rdi) movq %r9, (48)(%rdi) movq %r10, (56)(%rdi) movq (64)(%rsi), %rdx mov %r11, (64)(%rdi) mulx (72)(%rsi), %rax, %rbx add %rax, %r12 adc $(0), %rbx mulx (80)(%rsi), %rax, %rbp add %rax, %r13 adc $(0), %rbp add %rbx, %r13 adc $(0), %rbp mulx (88)(%rsi), %rax, %rbx add %rax, %r14 adc $(0), %rbx add %rbp, %r14 adc $(0), %rbx mulx (96)(%rsi), %rax, %r8 add %rax, %r15 adc $(0), %r8 add %rbx, %r15 adc $(0), %r8 movq (72)(%rsi), %rdx mov %r12, (72)(%rdi) mulx (80)(%rsi), %rax, %rbp add %rax, %r14 adc $(0), %rbp mulx (88)(%rsi), %rax, %rbx add %rax, %r15 adc $(0), %rbx add %rbp, %r15 adc $(0), %rbx mulx (96)(%rsi), %rax, %r9 add %rax, %r8 adc $(0), %r9 add %rbx, %r8 adc $(0), %r9 movq (80)(%rsi), %rdx mov %r13, (80)(%rdi) mulx (88)(%rsi), %rax, %rbx add %rax, %r8 adc $(0), %rbx mulx (96)(%rsi), %rax, %r10 add %rax, %r9 adc $(0), %r10 add %rbx, %r9 adc $(0), %r10 movq (88)(%rsi), %rdx mov %r14, (88)(%rdi) mulx (96)(%rsi), %rax, %r11 add %rax, %r10 adc $(0), %r11 xor %rax, %rax movq %r15, (96)(%rdi) movq %r8, (104)(%rdi) movq %r9, (112)(%rdi) movq %r10, (120)(%rdi) movq %r11, (128)(%rdi) movq %rax, (136)(%rdi) sub $(64), %rdi ret .Lfe61: .size sqr13_triangle, .Lfe61-(sqr13_triangle) .p2align 5, 0x90 .type sqr14_triangle, @function sqr14_triangle: call sqr8_triangle movq %r15, (56)(%rdi) xor %r15, %r15 lea (64)(%rsi), %rcx add $(64), %rdi call mla_8x6 movq %r8, (48)(%rdi) movq %r9, (56)(%rdi) movq (64)(%rsi), %rdx mov %r10, (64)(%rdi) mulx (72)(%rsi), %rax, %rbp add %rax, %r11 adc $(0), %rbp mulx (80)(%rsi), %rax, %rbx add %rax, %r12 adc $(0), %rbx add %rbp, %r12 adc $(0), %rbx mulx (88)(%rsi), %rax, %rbp add %rax, %r13 adc $(0), %rbp add %rbx, %r13 adc $(0), %rbp mulx (96)(%rsi), %rax, %rbx add %rax, %r14 adc $(0), %rbx add %rbp, %r14 adc $(0), %rbx mulx (104)(%rsi), %rax, %r8 add %rax, %r15 adc $(0), %r8 add %rbx, %r15 adc $(0), %r8 movq (72)(%rsi), %rdx mov %r11, (72)(%rdi) mulx (80)(%rsi), %rax, %rbx add %rax, %r13 adc $(0), %rbx mulx (88)(%rsi), %rax, %rbp add %rax, %r14 adc $(0), %rbp add %rbx, %r14 adc $(0), %rbp mulx (96)(%rsi), %rax, %rbx add %rax, %r15 adc $(0), %rbx add %rbp, %r15 adc $(0), %rbx mulx (104)(%rsi), %rax, %r9 add %rax, %r8 adc $(0), %r9 add %rbx, %r8 adc $(0), %r9 movq (80)(%rsi), %rdx mov %r12, (80)(%rdi) mulx (88)(%rsi), %rax, %rbp add %rax, %r15 adc $(0), %rbp mulx (96)(%rsi), %rax, %rbx add %rax, %r8 adc $(0), %rbx add %rbp, %r8 adc $(0), %rbx mulx (104)(%rsi), %rax, %r10 add %rax, %r9 adc $(0), %r10 add %rbx, %r9 adc $(0), %r10 movq (88)(%rsi), %rdx mov %r13, (88)(%rdi) mulx (96)(%rsi), %rax, %rbx add %rax, %r9 adc $(0), %rbx mulx (104)(%rsi), %rax, %r11 add %rax, %r10 adc $(0), %r11 add %rbx, %r10 adc $(0), %r11 movq (96)(%rsi), %rdx mov %r14, (96)(%rdi) mulx (104)(%rsi), %rax, %r12 add %rax, %r11 adc $(0), %r12 xor %rax, %rax movq %r15, (104)(%rdi) movq %r8, (112)(%rdi) movq %r9, (120)(%rdi) movq %r10, (128)(%rdi) movq %r11, (136)(%rdi) movq %r12, (144)(%rdi) movq %rax, (152)(%rdi) sub $(64), %rdi ret .Lfe62: .size sqr14_triangle, .Lfe62-(sqr14_triangle) .p2align 5, 0x90 .type sqr15_triangle, @function sqr15_triangle: call sqr8_triangle movq %r15, (56)(%rdi) xor %r15, %r15 lea (64)(%rsi), %rcx add $(64), %rdi call mla_8x7 movq %r8, (56)(%rdi) movq (64)(%rsi), %rdx mov %r9, (64)(%rdi) mulx (72)(%rsi), %rax, %rbx add %rax, %r10 adc $(0), %rbx mulx (80)(%rsi), %rax, %rbp add %rax, %r11 adc $(0), %rbp add %rbx, %r11 adc $(0), %rbp mulx (88)(%rsi), %rax, %rbx add %rax, %r12 adc $(0), %rbx add %rbp, %r12 adc $(0), %rbx mulx (96)(%rsi), %rax, %rbp add %rax, %r13 adc $(0), %rbp add %rbx, %r13 adc $(0), %rbp mulx (104)(%rsi), %rax, %rbx add %rax, %r14 adc $(0), %rbx add %rbp, %r14 adc $(0), %rbx mulx (112)(%rsi), %rax, %r8 add %rax, %r15 adc $(0), %r8 add %rbx, %r15 adc $(0), %r8 movq (72)(%rsi), %rdx mov %r10, (72)(%rdi) mulx (80)(%rsi), %rax, %rbp add %rax, %r12 adc $(0), %rbp mulx (88)(%rsi), %rax, %rbx add %rax, %r13 adc $(0), %rbx add %rbp, %r13 adc $(0), %rbx mulx (96)(%rsi), %rax, %rbp add %rax, %r14 adc $(0), %rbp add %rbx, %r14 adc $(0), %rbp mulx (104)(%rsi), %rax, %rbx add %rax, %r15 adc $(0), %rbx add %rbp, %r15 adc $(0), %rbx mulx (112)(%rsi), %rax, %r9 add %rax, %r8 adc $(0), %r9 add %rbx, %r8 adc $(0), %r9 movq (80)(%rsi), %rdx mov %r11, (80)(%rdi) mulx (88)(%rsi), %rax, %rbx add %rax, %r14 adc $(0), %rbx mulx (96)(%rsi), %rax, %rbp add %rax, %r15 adc $(0), %rbp add %rbx, %r15 adc $(0), %rbp mulx (104)(%rsi), %rax, %rbx add %rax, %r8 adc $(0), %rbx add %rbp, %r8 adc $(0), %rbx mulx (112)(%rsi), %rax, %r10 add %rax, %r9 adc $(0), %r10 add %rbx, %r9 adc $(0), %r10 movq (88)(%rsi), %rdx mov %r12, (88)(%rdi) mulx (96)(%rsi), %rax, %rbp add %rax, %r8 adc $(0), %rbp mulx (104)(%rsi), %rax, %rbx add %rax, %r9 adc $(0), %rbx add %rbp, %r9 adc $(0), %rbx mulx (112)(%rsi), %rax, %r11 add %rax, %r10 adc $(0), %r11 add %rbx, %r10 adc $(0), %r11 movq (96)(%rsi), %rdx mov %r13, (96)(%rdi) mulx (104)(%rsi), %rax, %rbx add %rax, %r10 adc $(0), %rbx mulx (112)(%rsi), %rax, %r12 add %rax, %r11 adc $(0), %r12 add %rbx, %r11 adc $(0), %r12 movq (104)(%rsi), %rdx mov %r14, (104)(%rdi) mulx (112)(%rsi), %rax, %r13 add %rax, %r12 adc $(0), %r13 xor %rax, %rax movq %r15, (112)(%rdi) movq %r8, (120)(%rdi) movq %r9, (128)(%rdi) movq %r10, (136)(%rdi) movq %r11, (144)(%rdi) movq %r12, (152)(%rdi) movq %r13, (160)(%rdi) movq %rax, (168)(%rdi) sub $(64), %rdi ret .Lfe63: .size sqr15_triangle, .Lfe63-(sqr15_triangle) .p2align 5, 0x90 .type sqr16_triangle, @function sqr16_triangle: call sqr8_triangle movq %r15, (56)(%rdi) xor %r15, %r15 mov %rsi, %rcx add $(64), %rsi add $(64), %rdi call mla_8x8 add $(64), %rdi call sqr8_triangle xor %rax, %rax movq %r15, (56)(%rdi) movq %r8, (64)(%rdi) movq %r9, (72)(%rdi) movq %r10, (80)(%rdi) movq %r11, (88)(%rdi) movq %r12, (96)(%rdi) movq %r13, (104)(%rdi) movq %r14, (112)(%rdi) movq %rax, (120)(%rdi) sub $(64), %rsi sub $(128), %rdi ret .Lfe64: .size sqr16_triangle, .Lfe64-(sqr16_triangle) sqr_l_basic: .quad sqr_1 - sqr_l_basic .quad sqr_2 - sqr_l_basic .quad sqr_3 - sqr_l_basic .quad sqr_4 - sqr_l_basic .quad sqr_5 - sqr_l_basic .quad sqr_6 - sqr_l_basic .quad sqr_7 - sqr_l_basic .quad sqr_8 - sqr_l_basic .quad sqr_9 - sqr_l_basic .quad sqr_10- sqr_l_basic .quad sqr_11- sqr_l_basic .quad sqr_12- sqr_l_basic .quad sqr_13- sqr_l_basic .quad sqr_14- sqr_l_basic .quad sqr_15- sqr_l_basic .quad sqr_16- sqr_l_basic sqrN_triangle: .quad sqr9_triangle - sqrN_triangle .quad sqr10_triangle - sqrN_triangle .quad sqr11_triangle - sqrN_triangle .quad sqr12_triangle - sqrN_triangle .quad sqr13_triangle - sqrN_triangle .quad sqr14_triangle - sqrN_triangle .quad sqr15_triangle - sqrN_triangle .quad sqr16_triangle - sqrN_triangle .p2align 5, 0x90 .type sqr_8N, @function sqr_8N: push %rdi push %rsi push %rdx push %rdi push %rsi push %rdx push %rdx call sqr8_triangle pop %rdx movq %r15, (56)(%rdi) xor %r15, %r15 add $(64), %rdi sub $(8), %rdx mov %rsi, %rcx add $(64), %rsi .LinitLoopgas_65: push %rdx call mla_8x8 pop %rdx add $(64), %rsi add $(64), %rdi sub $(8), %rdx jnz .LinitLoopgas_65 movq %r8, (%rdi) movq %r9, (8)(%rdi) movq %r10, (16)(%rdi) movq %r11, (24)(%rdi) movq %r12, (32)(%rdi) movq %r13, (40)(%rdi) movq %r14, (48)(%rdi) movq %r15, (56)(%rdi) jmp .Lupdate_Trianglegas_65 .LouterLoopgas_65: push %rdi push %rsi push %rdx xor %rax, %rax push %rax movq (%rdi), %r8 movq (8)(%rdi), %r9 movq (16)(%rdi), %r10 movq (24)(%rdi), %r11 movq (32)(%rdi), %r12 movq (40)(%rdi), %r13 movq (48)(%rdi), %r14 movq (56)(%rdi), %r15 .LinnerLoop_entrygas_65: push %rdx call sqr8_triangle pop %rdx movq %r15, (56)(%rdi) xor %r15, %r15 add $(64), %rdi sub $(8), %rdx jz .LskipInnerLoopgas_65 mov %rsi, %rcx add $(64), %rsi .LinnerLoopgas_65: pop %rax neg %rax movq (%rdi), %rax adc %rax, %r8 movq (8)(%rdi), %rax adc %rax, %r9 movq (16)(%rdi), %rax adc %rax, %r10 movq (24)(%rdi), %rax adc %rax, %r11 movq (32)(%rdi), %rax adc %rax, %r12 movq (40)(%rdi), %rax adc %rax, %r13 movq (48)(%rdi), %rax adc %rax, %r14 movq (56)(%rdi), %rax adc %rax, %r15 sbb %rax, %rax push %rax push %rdx call mla_8x8 pop %rdx add $(64), %rsi add $(64), %rdi sub $(8), %rdx jnz .LinnerLoopgas_65 .LskipInnerLoopgas_65: pop %rax neg %rax adc $(0), %r8 movq %r8, (%rdi) adc $(0), %r9 movq %r9, (8)(%rdi) adc $(0), %r10 movq %r10, (16)(%rdi) adc $(0), %r11 movq %r11, (24)(%rdi) adc $(0), %r12 movq %r12, (32)(%rdi) adc $(0), %r13 movq %r13, (40)(%rdi) adc $(0), %r14 movq %r14, (48)(%rdi) adc $(0), %r15 movq %r15, (56)(%rdi) .Lupdate_Trianglegas_65: pop %rdx pop %rsi pop %rdi add $(64), %rsi add $(128), %rdi sub $(8), %rdx jnz .LouterLoopgas_65 pop %rcx pop %rsi pop %rdi xor %rbx, %rbx .Lupdate_loopgas_65: call add_diag_4 add $(64), %rdi add $(32), %rsi sub $(4), %rcx jnz .Lupdate_loopgas_65 ret .Lfe65: .size sqr_8N, .Lfe65-(sqr_8N) .p2align 5, 0x90 .type sqr_N, @function sqr_N: push %rdi push %rsi push %rdx push %rdi push %rsi push %rdx mov %rdx, %rbp and $(7), %rbp lea mla_8xl_tail(%rip), %rax mov (-8)(%rax,%rbp,8), %rbp add %rbp, %rax push %rax sub $(8), %rdx push %rdx call sqr8_triangle pop %rdx movq %r15, (56)(%rdi) add $(64), %rdi xor %r15, %r15 mov %rsi, %rcx add $(64), %rsi sub $(8), %rdx .LinitLoopgas_66: push %rdx call mla_8x8 pop %rdx add $(64), %rsi add $(64), %rdi sub $(8), %rdx jnc .LinitLoopgas_66 add $(8), %rdx xor %rcx, %rsi xor %rsi, %rcx xor %rcx, %rsi mov (%rsp), %rax push %rdx call *%rax pop %rdx lea (%rdi,%rdx,8), %rdi movq %r8, (%rdi) movq %r9, (8)(%rdi) movq %r10, (16)(%rdi) movq %r11, (24)(%rdi) movq %r12, (32)(%rdi) movq %r13, (40)(%rdi) movq %r14, (48)(%rdi) movq %r15, (56)(%rdi) jmp .Lupdate_Trianglegas_66 .LouterLoopgas_66: push %rdi push %rsi push %rdx push %rax xor %rax, %rax push %rax movq (%rdi), %r8 movq (8)(%rdi), %r9 movq (16)(%rdi), %r10 movq (24)(%rdi), %r11 movq (32)(%rdi), %r12 movq (40)(%rdi), %r13 movq (48)(%rdi), %r14 movq (56)(%rdi), %r15 sub $(8), %rdx push %rdx call sqr8_triangle pop %rdx movq %r15, (56)(%rdi) add $(64), %rdi xor %r15, %r15 mov %rsi, %rcx add $(64), %rsi sub $(8), %rdx .LinnerLoopgas_66: pop %rax neg %rax movq (%rdi), %rax adc %rax, %r8 movq (8)(%rdi), %rax adc %rax, %r9 movq (16)(%rdi), %rax adc %rax, %r10 movq (24)(%rdi), %rax adc %rax, %r11 movq (32)(%rdi), %rax adc %rax, %r12 movq (40)(%rdi), %rax adc %rax, %r13 movq (48)(%rdi), %rax adc %rax, %r14 movq (56)(%rdi), %rax adc %rax, %r15 sbb %rax, %rax push %rax push %rdx call mla_8x8 pop %rdx add $(64), %rsi add $(64), %rdi sub $(8), %rdx jnc .LinnerLoopgas_66 add $(8), %rdx pxor %xmm0, %xmm0 movdqu %xmm0, (%rdi,%rdx,8) movdqu %xmm0, (16)(%rdi,%rdx,8) movdqu %xmm0, (32)(%rdi,%rdx,8) movdqu %xmm0, (48)(%rdi,%rdx,8) pop %rax neg %rax movq (%rdi), %rax adc %rax, %r8 movq (8)(%rdi), %rax adc %rax, %r9 movq (16)(%rdi), %rax adc %rax, %r10 movq (24)(%rdi), %rax adc %rax, %r11 movq (32)(%rdi), %rax adc %rax, %r12 movq (40)(%rdi), %rax adc %rax, %r13 movq (48)(%rdi), %rax adc %rax, %r14 movq (56)(%rdi), %rax adc %rax, %r15 sbb %rax, %rax neg %rax movq %rax, (64)(%rdi) xor %rcx, %rsi xor %rsi, %rcx xor %rcx, %rsi mov (%rsp), %rax push %rdx call *%rax pop %rdx lea (%rdi,%rdx,8), %rdi xor %rax, %rax movq (%rdi), %rax add %rax, %r8 movq %r8, (%rdi) movq (8)(%rdi), %rax adc %rax, %r9 movq %r9, (8)(%rdi) movq (16)(%rdi), %rax adc %rax, %r10 movq %r10, (16)(%rdi) movq (24)(%rdi), %rax adc %rax, %r11 movq %r11, (24)(%rdi) movq (32)(%rdi), %rax adc %rax, %r12 movq %r12, (32)(%rdi) movq (40)(%rdi), %rax adc %rax, %r13 movq %r13, (40)(%rdi) movq (48)(%rdi), %rax adc %rax, %r14 movq %r14, (48)(%rdi) movq (56)(%rdi), %rax adc %rax, %r15 movq %r15, (56)(%rdi) .Lupdate_Trianglegas_66: pop %rax pop %rdx pop %rsi pop %rdi add $(64), %rsi add $(128), %rdi sub $(8), %rdx cmp $(16), %rdx jg .LouterLoopgas_66 mov %rdx, %rbp sub $(8), %rbp lea sqrN_triangle(%rip), %rax mov (-8)(%rax,%rbp,8), %rbp add %rbp, %rax sub $(256), %rsp push %rdi push %rdx movq (%rdi), %r8 movq (8)(%rdi), %r9 movq (16)(%rdi), %r10 movq (24)(%rdi), %r11 movq (32)(%rdi), %r12 movq (40)(%rdi), %r13 movq (48)(%rdi), %r14 movq (56)(%rdi), %r15 lea (16)(%rsp), %rdi call *%rax mov %rdi, %rsi pop %rdx pop %rdi movdqu (%rsi), %xmm0 movdqu (16)(%rsi), %xmm1 movdqu (32)(%rsi), %xmm2 movdqu (48)(%rsi), %xmm3 add $(64), %rsi movdqu %xmm0, (%rdi) movdqu %xmm1, (16)(%rdi) movdqu %xmm2, (32)(%rdi) movdqu %xmm3, (48)(%rdi) add $(64), %rdi lea (-8)(%rdx), %rax xor %rbx, %rbx .Lupdate1gas_66: movq (%rsi), %r8 movq (%rdi), %r9 add $(8), %rsi neg %rbx adc %r9, %r8 sbb %rbx, %rbx movq %r8, (%rdi) add $(8), %rdi sub $(1), %rax jg .Lupdate1gas_66 .Lupdate2gas_66: movq (%rsi), %r8 add $(8), %rsi neg %rbx adc $(0), %r8 sbb %rbx, %rbx movq %r8, (%rdi) add $(8), %rdi sub $(1), %rdx jg .Lupdate2gas_66 add $(256), %rsp .Ladd_diagonalsgas_66: pop %rcx pop %rsi pop %rdi sub $(4), %rcx xor %rbx, %rbx .Ladd_diagonal_loopgas_66: call add_diag_4 add $(64), %rdi add $(32), %rsi sub $(4), %rcx jnc .Ladd_diagonal_loopgas_66 add $(4), %rcx jz .Lquitgas_66 .Ladd_diagonal_restgas_66: movq (%rdi), %r8 movq (8)(%rdi), %r9 xor %rbp, %rbp add %r8, %r8 adc %r9, %r9 adc $(0), %rbp mov (%rsi), %rdx mulx %rdx, %rax, %rdx add %rbx, %rax adc $(0), %rdx add %rax, %r8 mov %rbp, %rbx adc %rdx, %r9 adc $(0), %rbx movq %r8, (%rdi) movq %r9, (8)(%rdi) add $(16), %rdi add $(8), %rsi sub $(1), %rcx jnz .Ladd_diagonal_restgas_66 .Lquitgas_66: ret .Lfe66: .size sqr_N, .Lfe66-(sqr_N) .p2align 5, 0x90 .type sub_N, @function sub_N: xor %rax, %rax .Lsub_nextgas_67: lea (8)(%rdi), %rdi movq (%rsi), %r8 movq (%rcx), %r9 lea (8)(%rsi), %rsi lea (8)(%rcx), %rcx sbb %r9, %r8 movq %r8, (-8)(%rdi) dec %rdx jnz .Lsub_nextgas_67 adc $(0), %rax ret .Lfe67: .size sub_N, .Lfe67-(sub_N) .p2align 5, 0x90 .type copy_ae_N, @function copy_ae_N: lea (8)(%rdi), %rdi movq (%rsi), %r8 movq (%rcx), %r9 lea (8)(%rsi), %rsi lea (8)(%rcx), %rcx cmovae %r9, %r8 movq %r8, (-8)(%rdi) dec %rdx jnz copy_ae_N ret .Lfe68: .size copy_ae_N, .Lfe68-(copy_ae_N) .p2align 5, 0x90 .type mred1_start, @function mred1_start: mulx (%rsi), %rax, %rbx add %r8, %rax adc $(0), %rbx mov %rbx, %r8 ret .Lfe69: .size mred1_start, .Lfe69-(mred1_start) .p2align 5, 0x90 .type mred2_start, @function mred2_start: mulx (%rsi), %rax, %rbx add %r8, %rax adc $(0), %rbx mulx (8)(%rsi), %r8, %rbp add %r9, %r8 adc $(0), %rbp add %rbx, %r8 adc $(0), %rbp mov %rbp, %r9 ret .Lfe70: .size mred2_start, .Lfe70-(mred2_start) .p2align 5, 0x90 .type mred3_start, @function mred3_start: mulx (%rsi), %rax, %rbx add %r8, %rax adc $(0), %rbx mulx (8)(%rsi), %r8, %rbp add %r9, %r8 adc $(0), %rbp add %rbx, %r8 adc $(0), %rbp mulx (16)(%rsi), %r9, %rbx add %r10, %r9 adc $(0), %rbx add %rbp, %r9 adc $(0), %rbx mov %rbx, %r10 ret .Lfe71: .size mred3_start, .Lfe71-(mred3_start) .p2align 5, 0x90 .type mred4_start, @function mred4_start: mulx (%rsi), %rax, %rbx add %r8, %rax adc $(0), %rbx mulx (8)(%rsi), %r8, %rbp add %r9, %r8 adc $(0), %rbp add %rbx, %r8 adc $(0), %rbp mulx (16)(%rsi), %r9, %rbx add %r10, %r9 adc $(0), %rbx add %rbp, %r9 adc $(0), %rbx mulx (24)(%rsi), %r10, %rbp add %r11, %r10 adc $(0), %rbp add %rbx, %r10 adc $(0), %rbp mov %rbp, %r11 ret .Lfe72: .size mred4_start, .Lfe72-(mred4_start) .p2align 5, 0x90 .type mred5_start, @function mred5_start: mulx (%rsi), %rax, %rbx add %r8, %rax adc $(0), %rbx mulx (8)(%rsi), %r8, %rbp add %r9, %r8 adc $(0), %rbp add %rbx, %r8 adc $(0), %rbp mulx (16)(%rsi), %r9, %rbx add %r10, %r9 adc $(0), %rbx add %rbp, %r9 adc $(0), %rbx mulx (24)(%rsi), %r10, %rbp add %r11, %r10 adc $(0), %rbp add %rbx, %r10 adc $(0), %rbp mulx (32)(%rsi), %r11, %rbx add %r12, %r11 adc $(0), %rbx add %rbp, %r11 adc $(0), %rbx mov %rbx, %r12 ret .Lfe73: .size mred5_start, .Lfe73-(mred5_start) .p2align 5, 0x90 .type mred6_start, @function mred6_start: mulx (%rsi), %rax, %rbx add %r8, %rax adc $(0), %rbx mulx (8)(%rsi), %r8, %rbp add %r9, %r8 adc $(0), %rbp add %rbx, %r8 adc $(0), %rbp mulx (16)(%rsi), %r9, %rbx add %r10, %r9 adc $(0), %rbx add %rbp, %r9 adc $(0), %rbx mulx (24)(%rsi), %r10, %rbp add %r11, %r10 adc $(0), %rbp add %rbx, %r10 adc $(0), %rbp mulx (32)(%rsi), %r11, %rbx add %r12, %r11 adc $(0), %rbx add %rbp, %r11 adc $(0), %rbx mulx (40)(%rsi), %r12, %rbp add %r13, %r12 adc $(0), %rbp add %rbx, %r12 adc $(0), %rbp mov %rbp, %r13 ret .Lfe74: .size mred6_start, .Lfe74-(mred6_start) .p2align 5, 0x90 .type mred7_start, @function mred7_start: mulx (%rsi), %rax, %rbx add %r8, %rax adc $(0), %rbx mulx (8)(%rsi), %r8, %rbp add %r9, %r8 adc $(0), %rbp add %rbx, %r8 adc $(0), %rbp mulx (16)(%rsi), %r9, %rbx add %r10, %r9 adc $(0), %rbx add %rbp, %r9 adc $(0), %rbx mulx (24)(%rsi), %r10, %rbp add %r11, %r10 adc $(0), %rbp add %rbx, %r10 adc $(0), %rbp mulx (32)(%rsi), %r11, %rbx add %r12, %r11 adc $(0), %rbx add %rbp, %r11 adc $(0), %rbx mulx (40)(%rsi), %r12, %rbp add %r13, %r12 adc $(0), %rbp add %rbx, %r12 adc $(0), %rbp mulx (48)(%rsi), %r13, %rbx add %r14, %r13 adc $(0), %rbx add %rbp, %r13 adc $(0), %rbx mov %rbx, %r14 ret .Lfe75: .size mred7_start, .Lfe75-(mred7_start) .p2align 5, 0x90 .type mred8_start, @function mred8_start: mulx (%rsi), %rax, %rbx add %r8, %rax adc $(0), %rbx mulx (8)(%rsi), %r8, %rbp add %r9, %r8 adc $(0), %rbp add %rbx, %r8 adc $(0), %rbp mulx (16)(%rsi), %r9, %rbx add %r10, %r9 adc $(0), %rbx add %rbp, %r9 adc $(0), %rbx mulx (24)(%rsi), %r10, %rbp add %r11, %r10 adc $(0), %rbp add %rbx, %r10 adc $(0), %rbp mulx (32)(%rsi), %r11, %rbx add %r12, %r11 adc $(0), %rbx add %rbp, %r11 adc $(0), %rbx mulx (40)(%rsi), %r12, %rbp add %r13, %r12 adc $(0), %rbp add %rbx, %r12 adc $(0), %rbp mulx (48)(%rsi), %r13, %rbx add %r14, %r13 adc $(0), %rbx add %rbp, %r13 adc $(0), %rbx mulx (56)(%rsi), %r14, %rbp add %r15, %r14 adc $(0), %rbp add %rbx, %r14 adc $(0), %rbp mov %rbp, %r15 ret .Lfe76: .size mred8_start, .Lfe76-(mred8_start) .p2align 5, 0x90 .type mred8x1_start, @function mred8x1_start: push %rdx mulx %r8, %rdx, %rbx movq %rdx, (%rcx) call mred8_start mov %rax, (%rdi) pop %rdx ret .Lfe77: .size mred8x1_start, .Lfe77-(mred8x1_start) .p2align 5, 0x90 .type mred8x2_start, @function mred8x2_start: push %rdx mulx %r8, %rdx, %rbx movq %rdx, (%rcx) call mred8_start mov %rax, (%rdi) mov (%rsp), %rdx mulx %r8, %rdx, %rbx movq %rdx, (8)(%rcx) call mred8_start mov %rax, (8)(%rdi) pop %rdx ret .Lfe78: .size mred8x2_start, .Lfe78-(mred8x2_start) .p2align 5, 0x90 .type mred8x3_start, @function mred8x3_start: push %rdx mulx %r8, %rdx, %rbx movq %rdx, (%rcx) call mred8_start mov %rax, (%rdi) mov (%rsp), %rdx mulx %r8, %rdx, %rbx movq %rdx, (8)(%rcx) call mred8_start mov %rax, (8)(%rdi) mov (%rsp), %rdx mulx %r8, %rdx, %rbx movq %rdx, (16)(%rcx) call mred8_start mov %rax, (16)(%rdi) pop %rdx ret .Lfe79: .size mred8x3_start, .Lfe79-(mred8x3_start) .p2align 5, 0x90 .type mred8x4_start, @function mred8x4_start: push %rdx mulx %r8, %rdx, %rbx movq %rdx, (%rcx) call mred8_start mov %rax, (%rdi) mov (%rsp), %rdx mulx %r8, %rdx, %rbx movq %rdx, (8)(%rcx) call mred8_start mov %rax, (8)(%rdi) mov (%rsp), %rdx mulx %r8, %rdx, %rbx movq %rdx, (16)(%rcx) call mred8_start mov %rax, (16)(%rdi) mov (%rsp), %rdx mulx %r8, %rdx, %rbx movq %rdx, (24)(%rcx) call mred8_start mov %rax, (24)(%rdi) pop %rdx ret .Lfe80: .size mred8x4_start, .Lfe80-(mred8x4_start) .p2align 5, 0x90 .type mred8x5_start, @function mred8x5_start: push %rdx mulx %r8, %rdx, %rbx movq %rdx, (%rcx) call mred8_start mov %rax, (%rdi) mov (%rsp), %rdx mulx %r8, %rdx, %rbx movq %rdx, (8)(%rcx) call mred8_start mov %rax, (8)(%rdi) mov (%rsp), %rdx mulx %r8, %rdx, %rbx movq %rdx, (16)(%rcx) call mred8_start mov %rax, (16)(%rdi) mov (%rsp), %rdx mulx %r8, %rdx, %rbx movq %rdx, (24)(%rcx) call mred8_start mov %rax, (24)(%rdi) mov (%rsp), %rdx mulx %r8, %rdx, %rbx movq %rdx, (32)(%rcx) call mred8_start mov %rax, (32)(%rdi) pop %rdx ret .Lfe81: .size mred8x5_start, .Lfe81-(mred8x5_start) .p2align 5, 0x90 .type mred8x6_start, @function mred8x6_start: push %rdx mulx %r8, %rdx, %rbx movq %rdx, (%rcx) call mred8_start mov %rax, (%rdi) mov (%rsp), %rdx mulx %r8, %rdx, %rbx movq %rdx, (8)(%rcx) call mred8_start mov %rax, (8)(%rdi) mov (%rsp), %rdx mulx %r8, %rdx, %rbx movq %rdx, (16)(%rcx) call mred8_start mov %rax, (16)(%rdi) mov (%rsp), %rdx mulx %r8, %rdx, %rbx movq %rdx, (24)(%rcx) call mred8_start mov %rax, (24)(%rdi) mov (%rsp), %rdx mulx %r8, %rdx, %rbx movq %rdx, (32)(%rcx) call mred8_start mov %rax, (32)(%rdi) mov (%rsp), %rdx mulx %r8, %rdx, %rbx movq %rdx, (40)(%rcx) call mred8_start mov %rax, (40)(%rdi) pop %rdx ret .Lfe82: .size mred8x6_start, .Lfe82-(mred8x6_start) .p2align 5, 0x90 .type mred8x7_start, @function mred8x7_start: push %rdx mulx %r8, %rdx, %rbx movq %rdx, (%rcx) call mred8_start mov %rax, (%rdi) mov (%rsp), %rdx mulx %r8, %rdx, %rbx movq %rdx, (8)(%rcx) call mred8_start mov %rax, (8)(%rdi) mov (%rsp), %rdx mulx %r8, %rdx, %rbx movq %rdx, (16)(%rcx) call mred8_start mov %rax, (16)(%rdi) mov (%rsp), %rdx mulx %r8, %rdx, %rbx movq %rdx, (24)(%rcx) call mred8_start mov %rax, (24)(%rdi) mov (%rsp), %rdx mulx %r8, %rdx, %rbx movq %rdx, (32)(%rcx) call mred8_start mov %rax, (32)(%rdi) mov (%rsp), %rdx mulx %r8, %rdx, %rbx movq %rdx, (40)(%rcx) call mred8_start mov %rax, (40)(%rdi) mov (%rsp), %rdx mulx %r8, %rdx, %rbx movq %rdx, (48)(%rcx) call mred8_start mov %rax, (48)(%rdi) pop %rdx ret .Lfe83: .size mred8x7_start, .Lfe83-(mred8x7_start) .p2align 5, 0x90 .type mred8x8_start, @function mred8x8_start: push %rdx mulx %r8, %rdx, %rbx movq %rdx, (%rcx) call mred8_start mov %rax, (%rdi) mov (%rsp), %rdx mulx %r8, %rdx, %rbx movq %rdx, (8)(%rcx) call mred8_start mov %rax, (8)(%rdi) mov (%rsp), %rdx mulx %r8, %rdx, %rbx movq %rdx, (16)(%rcx) call mred8_start mov %rax, (16)(%rdi) mov (%rsp), %rdx mulx %r8, %rdx, %rbx movq %rdx, (24)(%rcx) call mred8_start mov %rax, (24)(%rdi) mov (%rsp), %rdx mulx %r8, %rdx, %rbx movq %rdx, (32)(%rcx) call mred8_start mov %rax, (32)(%rdi) mov (%rsp), %rdx mulx %r8, %rdx, %rbx movq %rdx, (40)(%rcx) call mred8_start mov %rax, (40)(%rdi) mov (%rsp), %rdx mulx %r8, %rdx, %rbx movq %rdx, (48)(%rcx) call mred8_start mov %rax, (48)(%rdi) mov (%rsp), %rdx mulx %r8, %rdx, %rbx movq %rdx, (56)(%rcx) call mred8_start mov %rax, (56)(%rdi) pop %rdx ret .Lfe84: .size mred8x8_start, .Lfe84-(mred8x8_start) .p2align 5, 0x90 .type mred_5, @function mred_5: push %r8 movq (%rdi), %r8 movq (8)(%rdi), %r9 movq (16)(%rdi), %r10 movq (24)(%rdi), %r11 movq (32)(%rdi), %r12 mov (%rsp), %rdx mulx %r8, %rdx, %rbx call mred5_start mov (%rsp), %rdx mulx %r8, %rdx, %rbx call mred5_start mov (%rsp), %rdx mulx %r8, %rdx, %rbx call mred5_start mov (%rsp), %rdx mulx %r8, %rdx, %rbx call mred5_start mov (%rsp), %rdx mulx %r8, %rdx, %rbx call mred5_start pop %rax xor %rax, %rax mov (40)(%rdi), %rbx add %rbx, %r8 movq %r8, (40)(%rdi) mov (48)(%rdi), %rbx adc %rbx, %r9 movq %r9, (48)(%rdi) mov (56)(%rdi), %rbx adc %rbx, %r10 movq %r10, (56)(%rdi) mov (64)(%rdi), %rbx adc %rbx, %r11 movq %r11, (64)(%rdi) mov (72)(%rdi), %rbx adc %rbx, %r12 movq %r12, (72)(%rdi) adc $(0), %rax mov (%rsi), %rbx sub %rbx, %r8 mov (8)(%rsi), %rbx sbb %rbx, %r9 mov (16)(%rsi), %rbx sbb %rbx, %r10 mov (24)(%rsi), %rbx sbb %rbx, %r11 mov (32)(%rsi), %rbx sbb %rbx, %r12 sbb $(0), %rax movq (40)(%rdi), %rax movq (48)(%rdi), %rbx movq (56)(%rdi), %rcx movq (64)(%rdi), %rdx movq (72)(%rdi), %rbp cmovae %r8, %rax cmovae %r9, %rbx cmovae %r10, %rcx cmovae %r11, %rdx cmovae %r12, %rbp movq %rax, (%r15) movq %rbx, (8)(%r15) movq %rcx, (16)(%r15) movq %rdx, (24)(%r15) movq %rbp, (32)(%r15) ret .Lfe85: .size mred_5, .Lfe85-(mred_5) .p2align 5, 0x90 .type mred_6, @function mred_6: push %r8 movq (%rdi), %r8 movq (8)(%rdi), %r9 movq (16)(%rdi), %r10 movq (24)(%rdi), %r11 movq (32)(%rdi), %r12 movq (40)(%rdi), %r13 mov (%rsp), %rdx mulx %r8, %rdx, %rbx call mred6_start mov (%rsp), %rdx mulx %r8, %rdx, %rbx call mred6_start mov (%rsp), %rdx mulx %r8, %rdx, %rbx call mred6_start mov (%rsp), %rdx mulx %r8, %rdx, %rbx call mred6_start mov (%rsp), %rdx mulx %r8, %rdx, %rbx call mred6_start mov (%rsp), %rdx mulx %r8, %rdx, %rbx call mred6_start pop %rax xor %rax, %rax mov (48)(%rdi), %rbx add %rbx, %r8 movq %r8, (48)(%rdi) mov (56)(%rdi), %rbx adc %rbx, %r9 movq %r9, (56)(%rdi) mov (64)(%rdi), %rbx adc %rbx, %r10 movq %r10, (64)(%rdi) mov (72)(%rdi), %rbx adc %rbx, %r11 movq %r11, (72)(%rdi) mov (80)(%rdi), %rbx adc %rbx, %r12 movq %r12, (80)(%rdi) mov (88)(%rdi), %rbx adc %rbx, %r13 movq %r13, (88)(%rdi) adc $(0), %rax mov (%rsi), %rbx sub %rbx, %r8 mov (8)(%rsi), %rbx sbb %rbx, %r9 mov (16)(%rsi), %rbx sbb %rbx, %r10 mov (24)(%rsi), %rbx sbb %rbx, %r11 mov (32)(%rsi), %rbx sbb %rbx, %r12 mov (40)(%rsi), %rbx sbb %rbx, %r13 sbb $(0), %rax movq (48)(%rdi), %rax movq (56)(%rdi), %rbx movq (64)(%rdi), %rcx movq (72)(%rdi), %rdx movq (80)(%rdi), %rbp movq (88)(%rdi), %rsi cmovae %r8, %rax cmovae %r9, %rbx cmovae %r10, %rcx cmovae %r11, %rdx cmovae %r12, %rbp cmovae %r13, %rsi movq %rax, (%r15) movq %rbx, (8)(%r15) movq %rcx, (16)(%r15) movq %rdx, (24)(%r15) movq %rbp, (32)(%r15) movq %rsi, (40)(%r15) ret .Lfe86: .size mred_6, .Lfe86-(mred_6) .p2align 5, 0x90 .type mred_7, @function mred_7: push %r8 movq (%rdi), %r8 movq (8)(%rdi), %r9 movq (16)(%rdi), %r10 movq (24)(%rdi), %r11 movq (32)(%rdi), %r12 movq (40)(%rdi), %r13 movq (48)(%rdi), %r14 mov (%rsp), %rdx mulx %r8, %rdx, %rbx call mred7_start mov (%rsp), %rdx mulx %r8, %rdx, %rbx call mred7_start mov (%rsp), %rdx mulx %r8, %rdx, %rbx call mred7_start mov (%rsp), %rdx mulx %r8, %rdx, %rbx call mred7_start mov (%rsp), %rdx mulx %r8, %rdx, %rbx call mred7_start mov (%rsp), %rdx mulx %r8, %rdx, %rbx call mred7_start mov (%rsp), %rdx mulx %r8, %rdx, %rbx call mred7_start pop %rax xor %rax, %rax mov (56)(%rdi), %rbx add %rbx, %r8 movq %r8, (56)(%rdi) mov (64)(%rdi), %rbx adc %rbx, %r9 movq %r9, (64)(%rdi) mov (72)(%rdi), %rbx adc %rbx, %r10 movq %r10, (72)(%rdi) mov (80)(%rdi), %rbx adc %rbx, %r11 movq %r11, (80)(%rdi) mov (88)(%rdi), %rbx adc %rbx, %r12 movq %r12, (88)(%rdi) mov (96)(%rdi), %rbx adc %rbx, %r13 movq %r13, (96)(%rdi) mov (104)(%rdi), %rbx adc %rbx, %r14 movq %r14, (104)(%rdi) adc $(0), %rax mov (%rsi), %rbx sub %rbx, %r8 mov (8)(%rsi), %rbx sbb %rbx, %r9 mov (16)(%rsi), %rbx sbb %rbx, %r10 mov (24)(%rsi), %rbx sbb %rbx, %r11 mov (32)(%rsi), %rbx sbb %rbx, %r12 mov (40)(%rsi), %rbx sbb %rbx, %r13 mov (48)(%rsi), %rbx sbb %rbx, %r14 sbb $(0), %rax movq (56)(%rdi), %rax movq (64)(%rdi), %rbx movq (72)(%rdi), %rcx movq (80)(%rdi), %rdx movq (88)(%rdi), %rbp movq (96)(%rdi), %rsi movq (104)(%rdi), %rdi cmovae %r8, %rax cmovae %r9, %rbx cmovae %r10, %rcx cmovae %r11, %rdx cmovae %r12, %rbp cmovae %r13, %rsi cmovae %r14, %rdi movq %rax, (%r15) movq %rbx, (8)(%r15) movq %rcx, (16)(%r15) movq %rdx, (24)(%r15) movq %rbp, (32)(%r15) movq %rsi, (40)(%r15) movq %rdi, (48)(%r15) ret .Lfe87: .size mred_7, .Lfe87-(mred_7) .p2align 5, 0x90 .type mred_8, @function mred_8: push %r15 push %r8 movq (%rdi), %r8 movq (8)(%rdi), %r9 movq (16)(%rdi), %r10 movq (24)(%rdi), %r11 movq (32)(%rdi), %r12 movq (40)(%rdi), %r13 movq (48)(%rdi), %r14 movq (56)(%rdi), %r15 mov (%rsp), %rdx mulx %r8, %rdx, %rbx call mred8_start mov (%rsp), %rdx mulx %r8, %rdx, %rbx call mred8_start mov (%rsp), %rdx mulx %r8, %rdx, %rbx call mred8_start mov (%rsp), %rdx mulx %r8, %rdx, %rbx call mred8_start mov (%rsp), %rdx mulx %r8, %rdx, %rbx call mred8_start mov (%rsp), %rdx mulx %r8, %rdx, %rbx call mred8_start mov (%rsp), %rdx mulx %r8, %rdx, %rbx call mred8_start mov (%rsp), %rdx mulx %r8, %rdx, %rbx call mred8_start pop %rax xor %rax, %rax mov (64)(%rdi), %rbx add %rbx, %r8 movq %r8, (64)(%rdi) mov (72)(%rdi), %rbx adc %rbx, %r9 movq %r9, (72)(%rdi) mov (80)(%rdi), %rbx adc %rbx, %r10 movq %r10, (80)(%rdi) mov (88)(%rdi), %rbx adc %rbx, %r11 movq %r11, (88)(%rdi) mov (96)(%rdi), %rbx adc %rbx, %r12 movq %r12, (96)(%rdi) mov (104)(%rdi), %rbx adc %rbx, %r13 movq %r13, (104)(%rdi) mov (112)(%rdi), %rbx adc %rbx, %r14 movq %r14, (112)(%rdi) mov (120)(%rdi), %rbx adc %rbx, %r15 movq %r15, (120)(%rdi) adc $(0), %rax mov (%rsi), %rbx sub %rbx, %r8 mov (8)(%rsi), %rbx sbb %rbx, %r9 mov (16)(%rsi), %rbx sbb %rbx, %r10 mov (24)(%rsi), %rbx sbb %rbx, %r11 mov (32)(%rsi), %rbx sbb %rbx, %r12 mov (40)(%rsi), %rbx sbb %rbx, %r13 mov (48)(%rsi), %rbx sbb %rbx, %r14 mov (56)(%rsi), %rbx sbb %rbx, %r15 sbb $(0), %rax pop %rsi movq (64)(%rdi), %rax movq (72)(%rdi), %rbx movq (80)(%rdi), %rcx movq (88)(%rdi), %rdx cmovae %r8, %rax cmovae %r9, %rbx cmovae %r10, %rcx cmovae %r11, %rdx movq %rax, (%rsi) movq %rbx, (8)(%rsi) movq %rcx, (16)(%rsi) movq %rdx, (24)(%rsi) movq (96)(%rdi), %rax movq (104)(%rdi), %rbx movq (112)(%rdi), %rcx movq (120)(%rdi), %rdx cmovae %r12, %rax cmovae %r13, %rbx cmovae %r14, %rcx cmovae %r15, %rdx movq %rax, (32)(%rsi) movq %rbx, (40)(%rsi) movq %rcx, (48)(%rsi) movq %rdx, (56)(%rsi) ret .Lfe88: .size mred_8, .Lfe88-(mred_8) .p2align 5, 0x90 .type mred_9, @function mred_9: push %r15 sub $(64), %rsp mov %rsp, %rcx push %r8 mov %r8, %rdx movq (%rdi), %r8 movq (8)(%rdi), %r9 movq (16)(%rdi), %r10 movq (24)(%rdi), %r11 movq (32)(%rdi), %r12 movq (40)(%rdi), %r13 movq (48)(%rdi), %r14 movq (56)(%rdi), %r15 call mred8x8_start xor %rax, %rax mov (64)(%rdi), %rbx add %rbx, %r8 mov (72)(%rdi), %rbx adc %rbx, %r9 mov (80)(%rdi), %rbx adc %rbx, %r10 mov (88)(%rdi), %rbx adc %rbx, %r11 mov (96)(%rdi), %rbx adc %rbx, %r12 mov (104)(%rdi), %rbx adc %rbx, %r13 mov (112)(%rdi), %rbx adc %rbx, %r14 mov (120)(%rdi), %rbx adc %rbx, %r15 adc $(0), %rax push %rax add $(64), %rdi add $(64), %rsi xor %rsi, %rcx xor %rcx, %rsi xor %rsi, %rcx call mla_8x1 xor %rsi, %rcx xor %rcx, %rsi xor %rsi, %rcx pop %rax shr $(1), %rax movq %r8, (8)(%rdi) movq %r9, (16)(%rdi) movq %r10, (24)(%rdi) movq %r11, (32)(%rdi) movq %r12, (40)(%rdi) movq %r13, (48)(%rdi) movq %r14, (56)(%rdi) mov (64)(%rdi), %rbx adc %rbx, %r15 mov %r15, (64)(%rdi) adc $(0), %rax push %rax sub $(64), %rsi movq (%rdi), %r8 movq (8)(%rdi), %r9 movq (16)(%rdi), %r10 movq (24)(%rdi), %r11 movq (32)(%rdi), %r12 movq (40)(%rdi), %r13 movq (48)(%rdi), %r14 movq (56)(%rdi), %r15 mov (8)(%rsp), %rdx call mred8x1_start xor %rax, %rax movq %r8, (8)(%rdi) movq %r9, (16)(%rdi) movq %r10, (24)(%rdi) movq %r11, (32)(%rdi) movq %r12, (40)(%rdi) movq %r13, (48)(%rdi) movq %r14, (56)(%rdi) mov %r15, %r8 addq (64)(%rdi), %r8 adc $(0), %rax push %rax add $(64), %rdi add $(64), %rsi call mla_1x1 pop %rax shr $(1), %rax mov (8)(%rdi), %rbx adc %rbx, %r8 adc $(0), %rax pop %rbx add %rbx, %r8 movq %r8, (8)(%rdi) adc $(0), %rax pop %rcx add $(64), %rsp lea (-64)(%rsi), %rcx lea (-56)(%rdi), %rsi pop %rdi mov %rax, %rbx mov $(9), %rdx call sub_N sub %rax, %rbx sub $(72), %rdi sub $(72), %rsi mov %rdi, %rcx mov $(9), %rdx shr $(1), %rbx call copy_ae_N ret .Lfe89: .size mred_9, .Lfe89-(mred_9) .p2align 5, 0x90 .type mred_10, @function mred_10: push %r15 sub $(64), %rsp mov %rsp, %rcx push %r8 mov %r8, %rdx movq (%rdi), %r8 movq (8)(%rdi), %r9 movq (16)(%rdi), %r10 movq (24)(%rdi), %r11 movq (32)(%rdi), %r12 movq (40)(%rdi), %r13 movq (48)(%rdi), %r14 movq (56)(%rdi), %r15 call mred8x8_start xor %rax, %rax mov (64)(%rdi), %rbx add %rbx, %r8 mov (72)(%rdi), %rbx adc %rbx, %r9 mov (80)(%rdi), %rbx adc %rbx, %r10 mov (88)(%rdi), %rbx adc %rbx, %r11 mov (96)(%rdi), %rbx adc %rbx, %r12 mov (104)(%rdi), %rbx adc %rbx, %r13 mov (112)(%rdi), %rbx adc %rbx, %r14 mov (120)(%rdi), %rbx adc %rbx, %r15 adc $(0), %rax push %rax add $(64), %rdi add $(64), %rsi xor %rsi, %rcx xor %rcx, %rsi xor %rsi, %rcx call mla_8x2 xor %rsi, %rcx xor %rcx, %rsi xor %rsi, %rcx pop %rax shr $(1), %rax movq %r8, (16)(%rdi) movq %r9, (24)(%rdi) movq %r10, (32)(%rdi) movq %r11, (40)(%rdi) movq %r12, (48)(%rdi) movq %r13, (56)(%rdi) mov (64)(%rdi), %rbx adc %rbx, %r14 mov %r14, (64)(%rdi) mov (72)(%rdi), %rbx adc %rbx, %r15 mov %r15, (72)(%rdi) adc $(0), %rax push %rax sub $(64), %rsi movq (%rdi), %r8 movq (8)(%rdi), %r9 movq (16)(%rdi), %r10 movq (24)(%rdi), %r11 movq (32)(%rdi), %r12 movq (40)(%rdi), %r13 movq (48)(%rdi), %r14 movq (56)(%rdi), %r15 mov (8)(%rsp), %rdx call mred8x2_start xor %rax, %rax movq %r8, (16)(%rdi) movq %r9, (24)(%rdi) movq %r10, (32)(%rdi) movq %r11, (40)(%rdi) movq %r12, (48)(%rdi) movq %r13, (56)(%rdi) mov %r14, %r8 mov %r15, %r9 addq (64)(%rdi), %r8 adcq (72)(%rdi), %r9 adc $(0), %rax push %rax add $(64), %rdi add $(64), %rsi call mla_2x2 pop %rax shr $(1), %rax mov (16)(%rdi), %rbx adc %rbx, %r8 mov (24)(%rdi), %rbx adc %rbx, %r9 adc $(0), %rax pop %rbx add %rbx, %r8 adc $(0), %r9 movq %r8, (16)(%rdi) movq %r9, (24)(%rdi) adc $(0), %rax pop %rcx add $(64), %rsp lea (-64)(%rsi), %rcx lea (-48)(%rdi), %rsi pop %rdi mov %rax, %rbx mov $(10), %rdx call sub_N sub %rax, %rbx sub $(80), %rdi sub $(80), %rsi mov %rdi, %rcx mov $(10), %rdx shr $(1), %rbx call copy_ae_N ret .Lfe90: .size mred_10, .Lfe90-(mred_10) .p2align 5, 0x90 .type mred_11, @function mred_11: push %r15 sub $(64), %rsp mov %rsp, %rcx push %r8 mov %r8, %rdx movq (%rdi), %r8 movq (8)(%rdi), %r9 movq (16)(%rdi), %r10 movq (24)(%rdi), %r11 movq (32)(%rdi), %r12 movq (40)(%rdi), %r13 movq (48)(%rdi), %r14 movq (56)(%rdi), %r15 call mred8x8_start xor %rax, %rax mov (64)(%rdi), %rbx add %rbx, %r8 mov (72)(%rdi), %rbx adc %rbx, %r9 mov (80)(%rdi), %rbx adc %rbx, %r10 mov (88)(%rdi), %rbx adc %rbx, %r11 mov (96)(%rdi), %rbx adc %rbx, %r12 mov (104)(%rdi), %rbx adc %rbx, %r13 mov (112)(%rdi), %rbx adc %rbx, %r14 mov (120)(%rdi), %rbx adc %rbx, %r15 adc $(0), %rax push %rax add $(64), %rdi add $(64), %rsi xor %rsi, %rcx xor %rcx, %rsi xor %rsi, %rcx call mla_8x3 xor %rsi, %rcx xor %rcx, %rsi xor %rsi, %rcx pop %rax shr $(1), %rax movq %r8, (24)(%rdi) movq %r9, (32)(%rdi) movq %r10, (40)(%rdi) movq %r11, (48)(%rdi) movq %r12, (56)(%rdi) mov (64)(%rdi), %rbx adc %rbx, %r13 mov %r13, (64)(%rdi) mov (72)(%rdi), %rbx adc %rbx, %r14 mov %r14, (72)(%rdi) mov (80)(%rdi), %rbx adc %rbx, %r15 mov %r15, (80)(%rdi) adc $(0), %rax push %rax sub $(64), %rsi movq (%rdi), %r8 movq (8)(%rdi), %r9 movq (16)(%rdi), %r10 movq (24)(%rdi), %r11 movq (32)(%rdi), %r12 movq (40)(%rdi), %r13 movq (48)(%rdi), %r14 movq (56)(%rdi), %r15 mov (8)(%rsp), %rdx call mred8x3_start xor %rax, %rax movq %r8, (24)(%rdi) movq %r9, (32)(%rdi) movq %r10, (40)(%rdi) movq %r11, (48)(%rdi) movq %r12, (56)(%rdi) mov %r13, %r8 mov %r14, %r9 mov %r15, %r10 addq (64)(%rdi), %r8 adcq (72)(%rdi), %r9 adcq (80)(%rdi), %r10 adc $(0), %rax push %rax add $(64), %rdi add $(64), %rsi call mla_3x3 pop %rax shr $(1), %rax mov (24)(%rdi), %rbx adc %rbx, %r8 mov (32)(%rdi), %rbx adc %rbx, %r9 mov (40)(%rdi), %rbx adc %rbx, %r10 adc $(0), %rax pop %rbx add %rbx, %r8 adc $(0), %r9 adc $(0), %r10 movq %r8, (24)(%rdi) movq %r9, (32)(%rdi) movq %r10, (40)(%rdi) adc $(0), %rax pop %rcx add $(64), %rsp lea (-64)(%rsi), %rcx lea (-40)(%rdi), %rsi pop %rdi mov %rax, %rbx mov $(11), %rdx call sub_N sub %rax, %rbx sub $(88), %rdi sub $(88), %rsi mov %rdi, %rcx mov $(11), %rdx shr $(1), %rbx call copy_ae_N ret .Lfe91: .size mred_11, .Lfe91-(mred_11) .p2align 5, 0x90 .type mred_12, @function mred_12: push %r15 sub $(64), %rsp mov %rsp, %rcx push %r8 mov %r8, %rdx movq (%rdi), %r8 movq (8)(%rdi), %r9 movq (16)(%rdi), %r10 movq (24)(%rdi), %r11 movq (32)(%rdi), %r12 movq (40)(%rdi), %r13 movq (48)(%rdi), %r14 movq (56)(%rdi), %r15 call mred8x8_start xor %rax, %rax mov (64)(%rdi), %rbx add %rbx, %r8 mov (72)(%rdi), %rbx adc %rbx, %r9 mov (80)(%rdi), %rbx adc %rbx, %r10 mov (88)(%rdi), %rbx adc %rbx, %r11 mov (96)(%rdi), %rbx adc %rbx, %r12 mov (104)(%rdi), %rbx adc %rbx, %r13 mov (112)(%rdi), %rbx adc %rbx, %r14 mov (120)(%rdi), %rbx adc %rbx, %r15 adc $(0), %rax push %rax add $(64), %rdi add $(64), %rsi xor %rsi, %rcx xor %rcx, %rsi xor %rsi, %rcx call mla_8x4 xor %rsi, %rcx xor %rcx, %rsi xor %rsi, %rcx pop %rax shr $(1), %rax movq %r8, (32)(%rdi) movq %r9, (40)(%rdi) movq %r10, (48)(%rdi) movq %r11, (56)(%rdi) mov (64)(%rdi), %rbx adc %rbx, %r12 mov %r12, (64)(%rdi) mov (72)(%rdi), %rbx adc %rbx, %r13 mov %r13, (72)(%rdi) mov (80)(%rdi), %rbx adc %rbx, %r14 mov %r14, (80)(%rdi) mov (88)(%rdi), %rbx adc %rbx, %r15 mov %r15, (88)(%rdi) adc $(0), %rax push %rax sub $(64), %rsi movq (%rdi), %r8 movq (8)(%rdi), %r9 movq (16)(%rdi), %r10 movq (24)(%rdi), %r11 movq (32)(%rdi), %r12 movq (40)(%rdi), %r13 movq (48)(%rdi), %r14 movq (56)(%rdi), %r15 mov (8)(%rsp), %rdx call mred8x4_start xor %rax, %rax movq %r8, (32)(%rdi) movq %r9, (40)(%rdi) movq %r10, (48)(%rdi) movq %r11, (56)(%rdi) mov %r12, %r8 mov %r13, %r9 mov %r14, %r10 mov %r15, %r11 addq (64)(%rdi), %r8 adcq (72)(%rdi), %r9 adcq (80)(%rdi), %r10 adcq (88)(%rdi), %r11 adc $(0), %rax push %rax add $(64), %rdi add $(64), %rsi call mla_4x4 pop %rax shr $(1), %rax mov (32)(%rdi), %rbx adc %rbx, %r8 mov (40)(%rdi), %rbx adc %rbx, %r9 mov (48)(%rdi), %rbx adc %rbx, %r10 mov (56)(%rdi), %rbx adc %rbx, %r11 adc $(0), %rax pop %rbx add %rbx, %r8 adc $(0), %r9 adc $(0), %r10 adc $(0), %r11 movq %r8, (32)(%rdi) movq %r9, (40)(%rdi) movq %r10, (48)(%rdi) movq %r11, (56)(%rdi) adc $(0), %rax pop %rcx add $(64), %rsp lea (-64)(%rsi), %rcx lea (-32)(%rdi), %rsi pop %rdi mov %rax, %rbx mov $(12), %rdx call sub_N sub %rax, %rbx sub $(96), %rdi sub $(96), %rsi mov %rdi, %rcx mov $(12), %rdx shr $(1), %rbx call copy_ae_N ret .Lfe92: .size mred_12, .Lfe92-(mred_12) .p2align 5, 0x90 .type mred_13, @function mred_13: push %r15 sub $(64), %rsp mov %rsp, %rcx push %r8 mov %r8, %rdx movq (%rdi), %r8 movq (8)(%rdi), %r9 movq (16)(%rdi), %r10 movq (24)(%rdi), %r11 movq (32)(%rdi), %r12 movq (40)(%rdi), %r13 movq (48)(%rdi), %r14 movq (56)(%rdi), %r15 call mred8x8_start xor %rax, %rax mov (64)(%rdi), %rbx add %rbx, %r8 mov (72)(%rdi), %rbx adc %rbx, %r9 mov (80)(%rdi), %rbx adc %rbx, %r10 mov (88)(%rdi), %rbx adc %rbx, %r11 mov (96)(%rdi), %rbx adc %rbx, %r12 mov (104)(%rdi), %rbx adc %rbx, %r13 mov (112)(%rdi), %rbx adc %rbx, %r14 mov (120)(%rdi), %rbx adc %rbx, %r15 adc $(0), %rax push %rax add $(64), %rdi add $(64), %rsi xor %rsi, %rcx xor %rcx, %rsi xor %rsi, %rcx call mla_8x5 xor %rsi, %rcx xor %rcx, %rsi xor %rsi, %rcx pop %rax shr $(1), %rax movq %r8, (40)(%rdi) movq %r9, (48)(%rdi) movq %r10, (56)(%rdi) mov (64)(%rdi), %rbx adc %rbx, %r11 mov %r11, (64)(%rdi) mov (72)(%rdi), %rbx adc %rbx, %r12 mov %r12, (72)(%rdi) mov (80)(%rdi), %rbx adc %rbx, %r13 mov %r13, (80)(%rdi) mov (88)(%rdi), %rbx adc %rbx, %r14 mov %r14, (88)(%rdi) mov (96)(%rdi), %rbx adc %rbx, %r15 mov %r15, (96)(%rdi) adc $(0), %rax push %rax sub $(64), %rsi movq (%rdi), %r8 movq (8)(%rdi), %r9 movq (16)(%rdi), %r10 movq (24)(%rdi), %r11 movq (32)(%rdi), %r12 movq (40)(%rdi), %r13 movq (48)(%rdi), %r14 movq (56)(%rdi), %r15 mov (8)(%rsp), %rdx call mred8x5_start xor %rax, %rax movq %r8, (40)(%rdi) movq %r9, (48)(%rdi) movq %r10, (56)(%rdi) mov %r11, %r8 mov %r12, %r9 mov %r13, %r10 mov %r14, %r11 mov %r15, %r12 addq (64)(%rdi), %r8 adcq (72)(%rdi), %r9 adcq (80)(%rdi), %r10 adcq (88)(%rdi), %r11 adcq (96)(%rdi), %r12 adc $(0), %rax push %rax add $(64), %rdi add $(64), %rsi call mla_5x5 pop %rax shr $(1), %rax mov (40)(%rdi), %rbx adc %rbx, %r8 mov (48)(%rdi), %rbx adc %rbx, %r9 mov (56)(%rdi), %rbx adc %rbx, %r10 mov (64)(%rdi), %rbx adc %rbx, %r11 mov (72)(%rdi), %rbx adc %rbx, %r12 adc $(0), %rax pop %rbx add %rbx, %r8 adc $(0), %r9 adc $(0), %r10 adc $(0), %r11 adc $(0), %r12 movq %r8, (40)(%rdi) movq %r9, (48)(%rdi) movq %r10, (56)(%rdi) movq %r11, (64)(%rdi) movq %r12, (72)(%rdi) adc $(0), %rax pop %rcx add $(64), %rsp lea (-64)(%rsi), %rcx lea (-24)(%rdi), %rsi pop %rdi mov %rax, %rbx mov $(13), %rdx call sub_N sub %rax, %rbx sub $(104), %rdi sub $(104), %rsi mov %rdi, %rcx mov $(13), %rdx shr $(1), %rbx call copy_ae_N ret .Lfe93: .size mred_13, .Lfe93-(mred_13) .p2align 5, 0x90 .type mred_14, @function mred_14: push %r15 sub $(64), %rsp mov %rsp, %rcx push %r8 mov %r8, %rdx movq (%rdi), %r8 movq (8)(%rdi), %r9 movq (16)(%rdi), %r10 movq (24)(%rdi), %r11 movq (32)(%rdi), %r12 movq (40)(%rdi), %r13 movq (48)(%rdi), %r14 movq (56)(%rdi), %r15 call mred8x8_start xor %rax, %rax mov (64)(%rdi), %rbx add %rbx, %r8 mov (72)(%rdi), %rbx adc %rbx, %r9 mov (80)(%rdi), %rbx adc %rbx, %r10 mov (88)(%rdi), %rbx adc %rbx, %r11 mov (96)(%rdi), %rbx adc %rbx, %r12 mov (104)(%rdi), %rbx adc %rbx, %r13 mov (112)(%rdi), %rbx adc %rbx, %r14 mov (120)(%rdi), %rbx adc %rbx, %r15 adc $(0), %rax push %rax add $(64), %rdi add $(64), %rsi xor %rsi, %rcx xor %rcx, %rsi xor %rsi, %rcx call mla_8x6 xor %rsi, %rcx xor %rcx, %rsi xor %rsi, %rcx pop %rax shr $(1), %rax movq %r8, (48)(%rdi) movq %r9, (56)(%rdi) mov (64)(%rdi), %rbx adc %rbx, %r10 mov %r10, (64)(%rdi) mov (72)(%rdi), %rbx adc %rbx, %r11 mov %r11, (72)(%rdi) mov (80)(%rdi), %rbx adc %rbx, %r12 mov %r12, (80)(%rdi) mov (88)(%rdi), %rbx adc %rbx, %r13 mov %r13, (88)(%rdi) mov (96)(%rdi), %rbx adc %rbx, %r14 mov %r14, (96)(%rdi) mov (104)(%rdi), %rbx adc %rbx, %r15 mov %r15, (104)(%rdi) adc $(0), %rax push %rax sub $(64), %rsi movq (%rdi), %r8 movq (8)(%rdi), %r9 movq (16)(%rdi), %r10 movq (24)(%rdi), %r11 movq (32)(%rdi), %r12 movq (40)(%rdi), %r13 movq (48)(%rdi), %r14 movq (56)(%rdi), %r15 mov (8)(%rsp), %rdx call mred8x6_start xor %rax, %rax movq %r8, (48)(%rdi) movq %r9, (56)(%rdi) mov %r10, %r8 mov %r11, %r9 mov %r12, %r10 mov %r13, %r11 mov %r14, %r12 mov %r15, %r13 addq (64)(%rdi), %r8 adcq (72)(%rdi), %r9 adcq (80)(%rdi), %r10 adcq (88)(%rdi), %r11 adcq (96)(%rdi), %r12 adcq (104)(%rdi), %r13 adc $(0), %rax push %rax add $(64), %rdi add $(64), %rsi call mla_6x6 pop %rax shr $(1), %rax mov (48)(%rdi), %rbx adc %rbx, %r8 mov (56)(%rdi), %rbx adc %rbx, %r9 mov (64)(%rdi), %rbx adc %rbx, %r10 mov (72)(%rdi), %rbx adc %rbx, %r11 mov (80)(%rdi), %rbx adc %rbx, %r12 mov (88)(%rdi), %rbx adc %rbx, %r13 adc $(0), %rax pop %rbx add %rbx, %r8 adc $(0), %r9 adc $(0), %r10 adc $(0), %r11 adc $(0), %r12 adc $(0), %r13 movq %r8, (48)(%rdi) movq %r9, (56)(%rdi) movq %r10, (64)(%rdi) movq %r11, (72)(%rdi) movq %r12, (80)(%rdi) movq %r13, (88)(%rdi) adc $(0), %rax pop %rcx add $(64), %rsp lea (-64)(%rsi), %rcx lea (-16)(%rdi), %rsi pop %rdi mov %rax, %rbx mov $(14), %rdx call sub_N sub %rax, %rbx sub $(112), %rdi sub $(112), %rsi mov %rdi, %rcx mov $(14), %rdx shr $(1), %rbx call copy_ae_N ret .Lfe94: .size mred_14, .Lfe94-(mred_14) .p2align 5, 0x90 .type mred_15, @function mred_15: push %r15 sub $(64), %rsp mov %rsp, %rcx push %r8 mov %r8, %rdx movq (%rdi), %r8 movq (8)(%rdi), %r9 movq (16)(%rdi), %r10 movq (24)(%rdi), %r11 movq (32)(%rdi), %r12 movq (40)(%rdi), %r13 movq (48)(%rdi), %r14 movq (56)(%rdi), %r15 call mred8x8_start xor %rax, %rax mov (64)(%rdi), %rbx add %rbx, %r8 mov (72)(%rdi), %rbx adc %rbx, %r9 mov (80)(%rdi), %rbx adc %rbx, %r10 mov (88)(%rdi), %rbx adc %rbx, %r11 mov (96)(%rdi), %rbx adc %rbx, %r12 mov (104)(%rdi), %rbx adc %rbx, %r13 mov (112)(%rdi), %rbx adc %rbx, %r14 mov (120)(%rdi), %rbx adc %rbx, %r15 adc $(0), %rax push %rax add $(64), %rdi add $(64), %rsi xor %rsi, %rcx xor %rcx, %rsi xor %rsi, %rcx call mla_8x7 xor %rsi, %rcx xor %rcx, %rsi xor %rsi, %rcx pop %rax shr $(1), %rax movq %r8, (56)(%rdi) mov (64)(%rdi), %rbx adc %rbx, %r9 mov %r9, (64)(%rdi) mov (72)(%rdi), %rbx adc %rbx, %r10 mov %r10, (72)(%rdi) mov (80)(%rdi), %rbx adc %rbx, %r11 mov %r11, (80)(%rdi) mov (88)(%rdi), %rbx adc %rbx, %r12 mov %r12, (88)(%rdi) mov (96)(%rdi), %rbx adc %rbx, %r13 mov %r13, (96)(%rdi) mov (104)(%rdi), %rbx adc %rbx, %r14 mov %r14, (104)(%rdi) mov (112)(%rdi), %rbx adc %rbx, %r15 mov %r15, (112)(%rdi) adc $(0), %rax push %rax sub $(64), %rsi movq (%rdi), %r8 movq (8)(%rdi), %r9 movq (16)(%rdi), %r10 movq (24)(%rdi), %r11 movq (32)(%rdi), %r12 movq (40)(%rdi), %r13 movq (48)(%rdi), %r14 movq (56)(%rdi), %r15 mov (8)(%rsp), %rdx call mred8x7_start xor %rax, %rax movq %r8, (56)(%rdi) mov %r9, %r8 mov %r10, %r9 mov %r11, %r10 mov %r12, %r11 mov %r13, %r12 mov %r14, %r13 mov %r15, %r14 addq (64)(%rdi), %r8 adcq (72)(%rdi), %r9 adcq (80)(%rdi), %r10 adcq (88)(%rdi), %r11 adcq (96)(%rdi), %r12 adcq (104)(%rdi), %r13 adcq (112)(%rdi), %r14 adc $(0), %rax push %rax add $(64), %rdi add $(64), %rsi call mla_7x7 pop %rax shr $(1), %rax mov (56)(%rdi), %rbx adc %rbx, %r8 mov (64)(%rdi), %rbx adc %rbx, %r9 mov (72)(%rdi), %rbx adc %rbx, %r10 mov (80)(%rdi), %rbx adc %rbx, %r11 mov (88)(%rdi), %rbx adc %rbx, %r12 mov (96)(%rdi), %rbx adc %rbx, %r13 mov (104)(%rdi), %rbx adc %rbx, %r14 adc $(0), %rax pop %rbx add %rbx, %r8 adc $(0), %r9 adc $(0), %r10 adc $(0), %r11 adc $(0), %r12 adc $(0), %r13 adc $(0), %r14 movq %r8, (56)(%rdi) movq %r9, (64)(%rdi) movq %r10, (72)(%rdi) movq %r11, (80)(%rdi) movq %r12, (88)(%rdi) movq %r13, (96)(%rdi) movq %r14, (104)(%rdi) adc $(0), %rax pop %rcx add $(64), %rsp lea (-64)(%rsi), %rcx lea (-8)(%rdi), %rsi pop %rdi mov %rax, %rbx mov $(15), %rdx call sub_N sub %rax, %rbx sub $(120), %rdi sub $(120), %rsi mov %rdi, %rcx mov $(15), %rdx shr $(1), %rbx call copy_ae_N ret .Lfe95: .size mred_15, .Lfe95-(mred_15) .p2align 5, 0x90 .type mred_16, @function mred_16: push %r15 sub $(64), %rsp mov %rsp, %rcx mov %r8, %rdx movq (%rdi), %r8 movq (8)(%rdi), %r9 movq (16)(%rdi), %r10 movq (24)(%rdi), %r11 movq (32)(%rdi), %r12 movq (40)(%rdi), %r13 movq (48)(%rdi), %r14 movq (56)(%rdi), %r15 call mred8x8_start xor %rax, %rax mov (64)(%rdi), %rbx add %rbx, %r8 mov (72)(%rdi), %rbx adc %rbx, %r9 mov (80)(%rdi), %rbx adc %rbx, %r10 mov (88)(%rdi), %rbx adc %rbx, %r11 mov (96)(%rdi), %rbx adc %rbx, %r12 mov (104)(%rdi), %rbx adc %rbx, %r13 mov (112)(%rdi), %rbx adc %rbx, %r14 mov (120)(%rdi), %rbx adc %rbx, %r15 adc $(0), %rax push %rax add $(64), %rsi add $(64), %rdi push %rdx call mla_8x8 pop %rdx pop %rax shr $(1), %rax mov (64)(%rdi), %rbx adc %rbx, %r8 mov %r8, (64)(%rdi) mov (72)(%rdi), %rbx adc %rbx, %r9 mov %r9, (72)(%rdi) mov (80)(%rdi), %rbx adc %rbx, %r10 mov %r10, (80)(%rdi) mov (88)(%rdi), %rbx adc %rbx, %r11 mov %r11, (88)(%rdi) mov (96)(%rdi), %rbx adc %rbx, %r12 mov %r12, (96)(%rdi) mov (104)(%rdi), %rbx adc %rbx, %r13 mov %r13, (104)(%rdi) mov (112)(%rdi), %rbx adc %rbx, %r14 mov %r14, (112)(%rdi) mov (120)(%rdi), %rbx adc %rbx, %r15 mov %r15, (120)(%rdi) adc $(0), %rax push %rax sub $(64), %rsi movq (%rdi), %r8 movq (8)(%rdi), %r9 movq (16)(%rdi), %r10 movq (24)(%rdi), %r11 movq (32)(%rdi), %r12 movq (40)(%rdi), %r13 movq (48)(%rdi), %r14 movq (56)(%rdi), %r15 call mred8x8_start xor %rax, %rax mov (64)(%rdi), %rbx add %rbx, %r8 mov (72)(%rdi), %rbx adc %rbx, %r9 mov (80)(%rdi), %rbx adc %rbx, %r10 mov (88)(%rdi), %rbx adc %rbx, %r11 mov (96)(%rdi), %rbx adc %rbx, %r12 mov (104)(%rdi), %rbx adc %rbx, %r13 mov (112)(%rdi), %rbx adc %rbx, %r14 mov (120)(%rdi), %rbx adc %rbx, %r15 adc $(0), %rax push %rax add $(64), %rdi add $(64), %rsi call mla_8x8 sub $(64), %rsi pop %rax shr $(1), %rax mov (64)(%rdi), %rbx adc %rbx, %r8 mov (72)(%rdi), %rbx adc %rbx, %r9 mov (80)(%rdi), %rbx adc %rbx, %r10 mov (88)(%rdi), %rbx adc %rbx, %r11 mov (96)(%rdi), %rbx adc %rbx, %r12 mov (104)(%rdi), %rbx adc %rbx, %r13 mov (112)(%rdi), %rbx adc %rbx, %r14 mov (120)(%rdi), %rbx adc %rbx, %r15 adc $(0), %rax pop %rbx add %rbx, %r8 adc $(0), %r9 adc $(0), %r10 adc $(0), %r11 adc $(0), %r12 adc $(0), %r13 adc $(0), %r14 adc $(0), %r15 adc $(0), %rax movq %r8, (64)(%rdi) movq %r9, (72)(%rdi) movq %r10, (80)(%rdi) movq %r11, (88)(%rdi) movq %r12, (96)(%rdi) movq %r13, (104)(%rdi) movq %r14, (112)(%rdi) movq %r15, (120)(%rdi) add $(64), %rsp pop %rbp mov (%rdi), %rbx sub (%rsi), %rbx mov %rbx, (%rbp) mov (8)(%rdi), %rbx sbb (8)(%rsi), %rbx mov %rbx, (8)(%rbp) mov (16)(%rdi), %rbx sbb (16)(%rsi), %rbx mov %rbx, (16)(%rbp) mov (24)(%rdi), %rbx sbb (24)(%rsi), %rbx mov %rbx, (24)(%rbp) mov (32)(%rdi), %rbx sbb (32)(%rsi), %rbx mov %rbx, (32)(%rbp) mov (40)(%rdi), %rbx sbb (40)(%rsi), %rbx mov %rbx, (40)(%rbp) mov (48)(%rdi), %rbx sbb (48)(%rsi), %rbx mov %rbx, (48)(%rbp) mov (56)(%rdi), %rbx sbb (56)(%rsi), %rbx mov %rbx, (56)(%rbp) mov (64)(%rsi), %rbx sbb %rbx, %r8 mov (72)(%rsi), %rbx sbb %rbx, %r9 mov (80)(%rsi), %rbx sbb %rbx, %r10 mov (88)(%rsi), %rbx sbb %rbx, %r11 mov (96)(%rsi), %rbx sbb %rbx, %r12 mov (104)(%rsi), %rbx sbb %rbx, %r13 mov (112)(%rsi), %rbx sbb %rbx, %r14 mov (120)(%rsi), %rbx sbb %rbx, %r15 sbb $(0), %rax movq (64)(%rdi), %rax movq (72)(%rdi), %rbx movq (80)(%rdi), %rcx movq (88)(%rdi), %rdx cmovae %r8, %rax cmovae %r9, %rbx cmovae %r10, %rcx cmovae %r11, %rdx movq %rax, (64)(%rbp) movq %rbx, (72)(%rbp) movq %rcx, (80)(%rbp) movq %rdx, (88)(%rbp) movq (96)(%rdi), %rax movq (104)(%rdi), %rbx movq (112)(%rdi), %rcx movq (120)(%rdi), %rdx cmovae %r12, %rax cmovae %r13, %rbx cmovae %r14, %rcx cmovae %r15, %rdx movq %rax, (96)(%rbp) movq %rbx, (104)(%rbp) movq %rcx, (112)(%rbp) movq %rdx, (120)(%rbp) movq (%rbp), %r8 movq (8)(%rbp), %r9 movq (16)(%rbp), %r10 movq (24)(%rbp), %r11 movq (32)(%rbp), %r12 movq (40)(%rbp), %r13 movq (48)(%rbp), %r14 movq (56)(%rbp), %r15 movq (%rdi), %rax movq (8)(%rdi), %rbx movq (16)(%rdi), %rcx movq (24)(%rdi), %rdx cmovae %r8, %rax cmovae %r9, %rbx cmovae %r10, %rcx cmovae %r11, %rdx movq %rax, (%rbp) movq %rbx, (8)(%rbp) movq %rcx, (16)(%rbp) movq %rdx, (24)(%rbp) movq (32)(%rdi), %rax movq (40)(%rdi), %rbx movq (48)(%rdi), %rcx movq (56)(%rdi), %rdx cmovae %r12, %rax cmovae %r13, %rbx cmovae %r14, %rcx cmovae %r15, %rdx movq %rax, (32)(%rbp) movq %rbx, (40)(%rbp) movq %rcx, (48)(%rbp) movq %rdx, (56)(%rbp) ret .Lfe96: .size mred_16, .Lfe96-(mred_16) mred_short: .quad mred_5 - mred_short .quad mred_6 - mred_short .quad mred_7 - mred_short .quad mred_8 - mred_short .quad mred_9 - mred_short .quad mred_10 - mred_short .quad mred_11 - mred_short .quad mred_12 - mred_short .quad mred_13 - mred_short .quad mred_14 - mred_short .quad mred_15 - mred_short .quad mred_16 - mred_short mred8x_start: .quad mred8x1_start - mred8x_start .quad mred8x2_start - mred8x_start .quad mred8x3_start - mred8x_start .quad mred8x4_start - mred8x_start .quad mred8x5_start - mred8x_start .quad mred8x6_start - mred8x_start .quad mred8x7_start - mred8x_start .p2align 5, 0x90 .type mred_8N, @function mred_8N: push %r15 sub $(64), %rsp mov %rsp, %rcx mov %rdx, %rbx xor %rax, %rax .LpassLoopgas_97: push %rdi push %rsi push %rdx push %r8 push %rbx push %rax push %rdx mov %r8, %rdx movq (%rdi), %r8 movq (8)(%rdi), %r9 movq (16)(%rdi), %r10 movq (24)(%rdi), %r11 movq (32)(%rdi), %r12 movq (40)(%rdi), %r13 movq (48)(%rdi), %r14 movq (56)(%rdi), %r15 call mred8x8_start pop %rdx xor %rax, %rax mov (64)(%rdi), %rbx add %rbx, %r8 mov (72)(%rdi), %rbx adc %rbx, %r9 mov (80)(%rdi), %rbx adc %rbx, %r10 mov (88)(%rdi), %rbx adc %rbx, %r11 mov (96)(%rdi), %rbx adc %rbx, %r12 mov (104)(%rdi), %rbx adc %rbx, %r13 mov (112)(%rdi), %rbx adc %rbx, %r14 mov (120)(%rdi), %rbx adc %rbx, %r15 adc $(0), %rax push %rax jmp .LentryInnerLoopgas_97 .LinnerLoopgas_97: push %rdx call mla_8x8 pop %rdx pop %rax shr $(1), %rax mov (64)(%rdi), %rbx adc %rbx, %r8 mov %r8, (64)(%rdi) mov (72)(%rdi), %rbx adc %rbx, %r9 mov %r9, (72)(%rdi) mov (80)(%rdi), %rbx adc %rbx, %r10 mov %r10, (80)(%rdi) mov (88)(%rdi), %rbx adc %rbx, %r11 mov %r11, (88)(%rdi) mov (96)(%rdi), %rbx adc %rbx, %r12 mov %r12, (96)(%rdi) mov (104)(%rdi), %rbx adc %rbx, %r13 mov %r13, (104)(%rdi) mov (112)(%rdi), %rbx adc %rbx, %r14 mov %r14, (112)(%rdi) mov (120)(%rdi), %rbx adc %rbx, %r15 mov %r15, (120)(%rdi) adc $(0), %rax push %rax .LentryInnerLoopgas_97: add $(64), %rdi add $(64), %rsi sub $(8), %rdx jg .LinnerLoopgas_97 pop %rax pop %rbx add %rbx, %r8 adc $(0), %r9 adc $(0), %r10 adc $(0), %r11 adc $(0), %r12 adc $(0), %r13 adc $(0), %r14 adc $(0), %r15 adc $(0), %rax movq %r8, (%rdi) movq %r9, (8)(%rdi) movq %r10, (16)(%rdi) movq %r11, (24)(%rdi) movq %r12, (32)(%rdi) movq %r13, (40)(%rdi) movq %r14, (48)(%rdi) movq %r15, (56)(%rdi) pop %rbx pop %r8 pop %rdx pop %rsi pop %rdi add $(64), %rdi sub $(8), %rbx jg .LpassLoopgas_97 add $(64), %rsp mov %rdx, %r14 lea (,%rdx,8), %r15 mov %rax, %rbx mov %rsi, %rcx mov %rdi, %rsi pop %rdi call sub_N sub %rax, %rbx mov %r14, %rdx sub %r15, %rdi sub %r15, %rsi mov %rdi, %rcx shr $(1), %rbx call copy_ae_N ret .Lfe97: .size mred_8N, .Lfe97-(mred_8N) .p2align 5, 0x90 .type mred_N, @function mred_N: push %r15 sub $(64), %rsp mov %rsp, %rcx mov %rdx, %rbx sub $(8), %rbx xor %rax, %rax mov $(7), %r15 and %rdx, %r15 lea mla_8xl_tail(%rip), %rbp mov (-8)(%rbp,%r15,8), %r15 add %r15, %rbp .LpassLoopgas_98: push %rdi push %rsi push %rdx push %r8 push %rbx push %rax push %rbp sub $(8), %rdx push %rdx mov %r8, %rdx movq (%rdi), %r8 movq (8)(%rdi), %r9 movq (16)(%rdi), %r10 movq (24)(%rdi), %r11 movq (32)(%rdi), %r12 movq (40)(%rdi), %r13 movq (48)(%rdi), %r14 movq (56)(%rdi), %r15 call mred8x8_start pop %rdx xor %rax, %rax push %rax jmp .LentryInnerLoopgas_98 .LinnerLoopgas_98: push %rdx call mla_8x8 pop %rdx .LentryInnerLoopgas_98: pop %rax shr $(1), %rax mov (64)(%rdi), %rbx adc %rbx, %r8 mov %r8, (64)(%rdi) mov (72)(%rdi), %rbx adc %rbx, %r9 mov %r9, (72)(%rdi) mov (80)(%rdi), %rbx adc %rbx, %r10 mov %r10, (80)(%rdi) mov (88)(%rdi), %rbx adc %rbx, %r11 mov %r11, (88)(%rdi) mov (96)(%rdi), %rbx adc %rbx, %r12 mov %r12, (96)(%rdi) mov (104)(%rdi), %rbx adc %rbx, %r13 mov %r13, (104)(%rdi) mov (112)(%rdi), %rbx adc %rbx, %r14 mov %r14, (112)(%rdi) mov (120)(%rdi), %rbx adc %rbx, %r15 mov %r15, (120)(%rdi) adc $(0), %rax push %rax add $(64), %rdi add $(64), %rsi sub $(8), %rdx jnc .LinnerLoopgas_98 add $(8), %rdx jz .Lcomplete_regular_passgas_98 mov (8)(%rsp), %rax xor %rsi, %rcx xor %rcx, %rsi xor %rsi, %rcx push %rdx call *%rax pop %rdx xor %rsi, %rcx xor %rcx, %rsi xor %rsi, %rcx lea (%rdi,%rdx,8), %rdi pop %rax shr $(1), %rax mov %rdx, %rbx dec %rbx jz .Lmt_1gas_98 dec %rbx jz .Lmt_2gas_98 dec %rbx jz .Lmt_3gas_98 dec %rbx jz .Lmt_4gas_98 dec %rbx jz .Lmt_5gas_98 dec %rbx jz .Lmt_6gas_98 .Lmt_7gas_98: mov (8)(%rdi), %rbx adc %rbx, %r9 .Lmt_6gas_98: mov (16)(%rdi), %rbx adc %rbx, %r10 .Lmt_5gas_98: mov (24)(%rdi), %rbx adc %rbx, %r11 .Lmt_4gas_98: mov (32)(%rdi), %rbx adc %rbx, %r12 .Lmt_3gas_98: mov (40)(%rdi), %rbx adc %rbx, %r13 .Lmt_2gas_98: mov (48)(%rdi), %rbx adc %rbx, %r14 .Lmt_1gas_98: mov (56)(%rdi), %rbx adc %rbx, %r15 adc $(0), %rax push %rax .Lcomplete_regular_passgas_98: pop %rax pop %rbp pop %rbx add %rbx, %r8 adc $(0), %r9 adc $(0), %r10 adc $(0), %r11 adc $(0), %r12 adc $(0), %r13 adc $(0), %r14 adc $(0), %r15 adc $(0), %rax movq %r8, (%rdi) movq %r9, (8)(%rdi) movq %r10, (16)(%rdi) movq %r11, (24)(%rdi) movq %r12, (32)(%rdi) movq %r13, (40)(%rdi) movq %r14, (48)(%rdi) movq %r15, (56)(%rdi) pop %rbx pop %r8 pop %rdx pop %rsi pop %rdi add $(64), %rdi sub $(8), %rbx jnc .LpassLoopgas_98 add $(8), %rbx jz .Lcomplete_reductiongas_98 push %rdi push %rsi push %rdx push %r8 push %rbx push %rax push %rbp sub $(8), %rdx push %rdx mov %r8, %rdx movq (%rdi), %r8 movq (8)(%rdi), %r9 movq (16)(%rdi), %r10 movq (24)(%rdi), %r11 movq (32)(%rdi), %r12 movq (40)(%rdi), %r13 movq (48)(%rdi), %r14 movq (56)(%rdi), %r15 lea mred8x_start(%rip), %rax mov (-8)(%rax,%rbx,8), %rbp add %rbp, %rax call *%rax pop %rdx xor %rax, %rax push %rax jmp .LentryTailLoopgas_98 .LtailLoopgas_98: movq (%rdi), %r8 movq (8)(%rdi), %r9 movq (16)(%rdi), %r10 movq (24)(%rdi), %r11 movq (32)(%rdi), %r12 movq (40)(%rdi), %r13 movq (48)(%rdi), %r14 movq (56)(%rdi), %r15 mov (8)(%rsp), %rax push %rdx call *%rax pop %rdx .LentryTailLoopgas_98: pop %rax shr $(1), %rax adc $(0), %r8 adc $(0), %r9 adc $(0), %r10 adc $(0), %r11 adc $(0), %r12 adc $(0), %r13 adc $(0), %r14 adc $(0), %r15 adc $(0), %rax mov (16)(%rsp), %rbx cmp $(1), %rbx jz .Ltt_1gas_98 cmp $(2), %rbx jz .Ltt_2gas_98 cmp $(3), %rbx jz .Ltt_3gas_98 cmp $(4), %rbx jz .Ltt_4gas_98 cmp $(5), %rbx jz .Ltt_5gas_98 cmp $(6), %rbx jz .Ltt_6gas_98 .Ltt_7gas_98: mov (8)(%rdi,%rbx,8), %rbp adc %rbp, %r9 .Ltt_6gas_98: mov (16)(%rdi,%rbx,8), %rbp adc %rbp, %r10 .Ltt_5gas_98: mov (24)(%rdi,%rbx,8), %rbp adc %rbp, %r11 .Ltt_4gas_98: mov (32)(%rdi,%rbx,8), %rbp adc %rbp, %r12 .Ltt_3gas_98: mov (40)(%rdi,%rbx,8), %rbp adc %rbp, %r13 .Ltt_2gas_98: mov (48)(%rdi,%rbx,8), %rbp adc %rbp, %r14 .Ltt_1gas_98: mov (56)(%rdi,%rbx,8), %rbp adc %rbp, %r15 adc $(0), %rax push %rax movq %r8, (%rdi,%rbx,8) movq %r9, (8)(%rdi,%rbx,8) movq %r10, (16)(%rdi,%rbx,8) movq %r11, (24)(%rdi,%rbx,8) movq %r12, (32)(%rdi,%rbx,8) movq %r13, (40)(%rdi,%rbx,8) movq %r14, (48)(%rdi,%rbx,8) movq %r15, (56)(%rdi,%rbx,8) add $(64), %rsi add $(64), %rdi sub $(8), %rdx jnc .LtailLoopgas_98 add $(8), %rdx mov %rdx, %rbx movq (%rdi), %r8 dec %rbx jz .Lget_tail_procgas_98 movq (8)(%rdi), %r9 dec %rbx jz .Lget_tail_procgas_98 movq (16)(%rdi), %r10 dec %rbx jz .Lget_tail_procgas_98 movq (24)(%rdi), %r11 dec %rbx jz .Lget_tail_procgas_98 movq (32)(%rdi), %r12 dec %rbx jz .Lget_tail_procgas_98 movq (40)(%rdi), %r13 dec %rbx jz .Lget_tail_procgas_98 movq (48)(%rdi), %r14 .Lget_tail_procgas_98: lea mla_lxl_short(%rip), %rax mov (-8)(%rax,%rdx,8), %rbp add %rbp, %rax push %rdx call *%rax pop %rdx lea (%rdi,%rdx,8), %rdi pop %rax shr $(1), %rax mov %rdx, %rbx mov (%rdi), %rbp adc %rbp, %r8 dec %rbx jz .Ladd_carry1gas_98 mov (8)(%rdi), %rbp adc %rbp, %r9 dec %rbx jz .Ladd_carry1gas_98 mov (16)(%rdi), %rbp adc %rbp, %r10 dec %rbx jz .Ladd_carry1gas_98 mov (24)(%rdi), %rbp adc %rbp, %r11 dec %rbx jz .Ladd_carry1gas_98 mov (32)(%rdi), %rbp adc %rbp, %r12 dec %rbx jz .Ladd_carry1gas_98 mov (40)(%rdi), %rbp adc %rbp, %r13 dec %rbx jz .Ladd_carry1gas_98 mov (48)(%rdi), %rbp adc %rbp, %r14 .Ladd_carry1gas_98: adc $(0), %rax pop %rbp pop %rbx add %rbx, %r8 movq %r8, (%rdi) dec %rdx jz .Ladd_carry2gas_98 adc $(0), %r9 movq %r9, (8)(%rdi) dec %rdx jz .Ladd_carry2gas_98 adc $(0), %r10 movq %r10, (16)(%rdi) dec %rdx jz .Ladd_carry2gas_98 adc $(0), %r11 movq %r11, (24)(%rdi) dec %rdx jz .Ladd_carry2gas_98 adc $(0), %r12 movq %r12, (32)(%rdi) dec %rdx jz .Ladd_carry2gas_98 adc $(0), %r13 movq %r13, (40)(%rdi) dec %rdx jz .Ladd_carry2gas_98 adc $(0), %r14 movq %r14, (48)(%rdi) .Ladd_carry2gas_98: adc $(0), %rax pop %rbx pop %r8 pop %rdx pop %rsi pop %rdi lea (%rdi,%rbx,8), %rdi .Lcomplete_reductiongas_98: add $(64), %rsp mov %rdx, %r14 lea (,%rdx,8), %r15 mov %rax, %rbx mov %rsi, %rcx mov %rdi, %rsi pop %rdi call sub_N sub %rax, %rbx mov %r14, %rdx sub %r15, %rdi sub %r15, %rsi mov %rdi, %rcx shr $(1), %rbx call copy_ae_N ret .Lfe98: .size mred_N, .Lfe98-(mred_N) .p2align 5, 0x90 .globl l9_cpMulAdc_BNU_school .type l9_cpMulAdc_BNU_school, @function l9_cpMulAdc_BNU_school: push %rbx push %rbp push %r12 push %r13 push %r14 push %r15 movslq %edx, %rdx movslq %r8d, %rbx xor %r8, %r8 xor %r9, %r9 xor %r10, %r10 xor %r11, %r11 xor %r12, %r12 xor %r13, %r13 xor %r14, %r14 xor %r15, %r15 cmp %rbx, %rdx jl .Lswap_operansgas_99 jg .Ltest_8N_casegas_99 cmp $(16), %rdx jg .Ltest_8N_casegas_99 cmp $(4), %rdx jg .Lmore_then_4gas_99 cmp $(3), %edx ja .Lmul_4_4gas_99 jz .Lmul_3_3gas_99 jp .Lmul_2_2gas_99 .Lmul_1_1gas_99: mov (%rcx), %rdx mulx (%rsi), %rbp, %r8 mov %rbp, (%rdi) movq %r8, (8)(%rdi) jmp .Lquitgas_99 .Lmul_2_2gas_99: mov (%rcx), %rdx mulx (%rsi), %rbp, %r8 mov %rbp, (%rdi) mulx (8)(%rsi), %rbx, %r9 add %rbx, %r8 adc $(0), %r9 mov (8)(%rcx), %rdx mulx (%rsi), %rax, %rbx add %r8, %rax adc $(0), %rbx mov %rax, (8)(%rdi) mulx (8)(%rsi), %r8, %rbp add %r9, %r8 adc $(0), %rbp add %rbx, %r8 adc $(0), %rbp mov %rbp, %r9 movq %r8, (16)(%rdi) movq %r9, (24)(%rdi) jmp .Lquitgas_99 .Lmul_3_3gas_99: mov (%rcx), %rdx mulx (%rsi), %rbp, %r8 mov %rbp, (%rdi) mulx (8)(%rsi), %rbx, %r9 add %rbx, %r8 mulx (16)(%rsi), %rbp, %r10 adc %rbp, %r9 adc $(0), %r10 mov (8)(%rcx), %rdx mulx (%rsi), %rax, %rbx add %r8, %rax adc $(0), %rbx mov %rax, (8)(%rdi) mulx (8)(%rsi), %r8, %rbp add %r9, %r8 adc $(0), %rbp add %rbx, %r8 adc $(0), %rbp mulx (16)(%rsi), %r9, %rbx add %r10, %r9 adc $(0), %rbx add %rbp, %r9 adc $(0), %rbx mov %rbx, %r10 mov (16)(%rcx), %rdx mulx (%rsi), %rax, %rbx add %r8, %rax adc $(0), %rbx mov %rax, (16)(%rdi) mulx (8)(%rsi), %r8, %rbp add %r9, %r8 adc $(0), %rbp add %rbx, %r8 adc $(0), %rbp mulx (16)(%rsi), %r9, %rbx add %r10, %r9 adc $(0), %rbx add %rbp, %r9 adc $(0), %rbx mov %rbx, %r10 movq %r8, (24)(%rdi) movq %r9, (32)(%rdi) movq %r10, (40)(%rdi) jmp .Lquitgas_99 .Lmul_4_4gas_99: mov (%rcx), %rdx mulx (%rsi), %rbp, %r8 mov %rbp, (%rdi) mulx (8)(%rsi), %rbx, %r9 add %rbx, %r8 mulx (16)(%rsi), %rbp, %r10 adc %rbp, %r9 mulx (24)(%rsi), %rbx, %r11 adc %rbx, %r10 adc $(0), %r11 mov (8)(%rcx), %rdx mulx (%rsi), %rax, %rbx add %r8, %rax adc $(0), %rbx mov %rax, (8)(%rdi) mulx (8)(%rsi), %r8, %rbp add %r9, %r8 adc $(0), %rbp add %rbx, %r8 adc $(0), %rbp mulx (16)(%rsi), %r9, %rbx add %r10, %r9 adc $(0), %rbx add %rbp, %r9 adc $(0), %rbx mulx (24)(%rsi), %r10, %rbp add %r11, %r10 adc $(0), %rbp add %rbx, %r10 adc $(0), %rbp mov %rbp, %r11 mov (16)(%rcx), %rdx mulx (%rsi), %rax, %rbx add %r8, %rax adc $(0), %rbx mov %rax, (16)(%rdi) mulx (8)(%rsi), %r8, %rbp add %r9, %r8 adc $(0), %rbp add %rbx, %r8 adc $(0), %rbp mulx (16)(%rsi), %r9, %rbx add %r10, %r9 adc $(0), %rbx add %rbp, %r9 adc $(0), %rbx mulx (24)(%rsi), %r10, %rbp add %r11, %r10 adc $(0), %rbp add %rbx, %r10 adc $(0), %rbp mov %rbp, %r11 mov (24)(%rcx), %rdx mulx (%rsi), %rax, %rbx add %r8, %rax adc $(0), %rbx mov %rax, (24)(%rdi) mulx (8)(%rsi), %r8, %rbp add %r9, %r8 adc $(0), %rbp add %rbx, %r8 adc $(0), %rbp mulx (16)(%rsi), %r9, %rbx add %r10, %r9 adc $(0), %rbx add %rbp, %r9 adc $(0), %rbx mulx (24)(%rsi), %r10, %rbp add %r11, %r10 adc $(0), %rbp add %rbx, %r10 adc $(0), %rbp mov %rbp, %r11 movq %r8, (32)(%rdi) movq %r9, (40)(%rdi) movq %r10, (48)(%rdi) movq %r11, (56)(%rdi) jmp .Lquitgas_99 .Lmore_then_4gas_99: lea mul_lxl_basic(%rip), %rax mov (-8)(%rax,%rdx,8), %rbp add %rbp, %rax call *%rax jmp .Lquitgas_99 .Lswap_operansgas_99: xor %rcx, %rsi xor %rsi, %rcx xor %rcx, %rsi xor %rbx, %rdx xor %rdx, %rbx xor %rbx, %rdx .Ltest_8N_casegas_99: mov %rdx, %rax or %rbx, %rax and $(7), %rax jnz .Lgeneral_mulgas_99 call mul_8Nx8M jmp .Lquitgas_99 .Lgeneral_mulgas_99: call mul_NxM jmp .Lquitgas_99 .Lquitgas_99: vzeroupper pop %r15 pop %r14 pop %r13 pop %r12 pop %rbp pop %rbx ret .Lfe99: .size l9_cpMulAdc_BNU_school, .Lfe99-(l9_cpMulAdc_BNU_school) .p2align 5, 0x90 .globl l9_cpSqrAdc_BNU_school .type l9_cpSqrAdc_BNU_school, @function l9_cpSqrAdc_BNU_school: push %rbx push %rbp push %r12 push %r13 push %r14 push %r15 movslq %edx, %rdx xor %r8, %r8 xor %r9, %r9 xor %r10, %r10 xor %r11, %r11 xor %r12, %r12 xor %r13, %r13 xor %r14, %r14 xor %r15, %r15 cmp $(16), %rdx jg .Ltest_8N_casegas_100 lea sqr_l_basic(%rip), %rax mov (-8)(%rax,%rdx,8), %rbp add %rbp, %rax call *%rax jmp .Lquitgas_100 .Ltest_8N_casegas_100: test $(7), %rdx jnz .Lgeneral_sqrgas_100 call sqr_8N jmp .Lquitgas_100 .Lgeneral_sqrgas_100: call sqr_N .Lquitgas_100: vzeroupper pop %r15 pop %r14 pop %r13 pop %r12 pop %rbp pop %rbx ret .Lfe100: .size l9_cpSqrAdc_BNU_school, .Lfe100-(l9_cpSqrAdc_BNU_school) .p2align 5, 0x90 .globl l9_cpMontRedAdc_BNU .type l9_cpMontRedAdc_BNU, @function l9_cpMontRedAdc_BNU: push %rbx push %rbp push %r12 push %r13 push %r14 push %r15 mov %rdi, %r15 mov %rsi, %rdi mov %rdx, %rsi movslq %ecx, %rdx cmp $(16), %rdx ja .Ltest_8N_casegas_101 cmp $(4), %rdx ja .Labove4gas_101 cmp $(3), %rdx ja .Lred_4gas_101 jz .Lred_3gas_101 jp .Lred_2gas_101 .Lred_1gas_101: movq (%rdi), %r9 mov %r8, %rdx imul %r9, %rdx mulx (%rsi), %rax, %rbp add %r9, %rax adc $(0), %rbp mov %rbp, %r9 xor %rbx, %rbx addq (8)(%rdi), %r9 movq %r9, (8)(%rdi) adc $(0), %rbx subq (%rsi), %r9 sbb $(0), %rbx movq (8)(%rdi), %rax cmovae %r9, %rax movq %rax, (%r15) jmp .Lquitgas_101 .Lred_2gas_101: movq (%rdi), %r9 movq (8)(%rdi), %r10 mov %r8, %rdx imul %r9, %rdx mulx (%rsi), %rax, %rbp add %r9, %rax adc $(0), %rbp mulx (8)(%rsi), %r9, %rbx add %r10, %r9 adc $(0), %rbx add %rbp, %r9 adc $(0), %rbx mov %rbx, %r10 mov %r8, %rdx imul %r9, %rdx mulx (%rsi), %rax, %rbp add %r9, %rax adc $(0), %rbp mulx (8)(%rsi), %r9, %rbx add %r10, %r9 adc $(0), %rbx add %rbp, %r9 adc $(0), %rbx mov %rbx, %r10 xor %rbx, %rbx addq (16)(%rdi), %r9 movq %r9, (16)(%rdi) adcq (24)(%rdi), %r10 movq %r10, (24)(%rdi) adc $(0), %rbx subq (%rsi), %r9 sbbq (8)(%rsi), %r10 sbb $(0), %rbx movq (16)(%rdi), %rax cmovae %r9, %rax movq %rax, (%r15) movq (24)(%rdi), %rax cmovae %r10, %rax movq %rax, (8)(%r15) jmp .Lquitgas_101 .Lred_3gas_101: movq (%rdi), %r9 movq (8)(%rdi), %r10 movq (16)(%rdi), %r11 mov %r8, %rdx imul %r9, %rdx mulx (%rsi), %rax, %rbp add %r9, %rax adc $(0), %rbp mulx (8)(%rsi), %r9, %rbx add %r10, %r9 adc $(0), %rbx add %rbp, %r9 adc $(0), %rbx mulx (16)(%rsi), %r10, %rbp add %r11, %r10 adc $(0), %rbp add %rbx, %r10 adc $(0), %rbp mov %rbp, %r11 mov %r8, %rdx imul %r9, %rdx mulx (%rsi), %rax, %rbp add %r9, %rax adc $(0), %rbp mulx (8)(%rsi), %r9, %rbx add %r10, %r9 adc $(0), %rbx add %rbp, %r9 adc $(0), %rbx mulx (16)(%rsi), %r10, %rbp add %r11, %r10 adc $(0), %rbp add %rbx, %r10 adc $(0), %rbp mov %rbp, %r11 mov %r8, %rdx imul %r9, %rdx mulx (%rsi), %rax, %rbp add %r9, %rax adc $(0), %rbp mulx (8)(%rsi), %r9, %rbx add %r10, %r9 adc $(0), %rbx add %rbp, %r9 adc $(0), %rbx mulx (16)(%rsi), %r10, %rbp add %r11, %r10 adc $(0), %rbp add %rbx, %r10 adc $(0), %rbp mov %rbp, %r11 xor %rbx, %rbx addq (24)(%rdi), %r9 movq %r9, (24)(%rdi) adcq (32)(%rdi), %r10 movq %r10, (32)(%rdi) adcq (40)(%rdi), %r11 movq %r11, (40)(%rdi) adc $(0), %rbx subq (%rsi), %r9 sbbq (8)(%rsi), %r10 sbbq (16)(%rsi), %r11 sbb $(0), %rbx movq (24)(%rdi), %rax cmovae %r9, %rax movq %rax, (%r15) movq (32)(%rdi), %rax cmovae %r10, %rax movq %rax, (8)(%r15) movq (40)(%rdi), %rax cmovae %r11, %rax movq %rax, (16)(%r15) jmp .Lquitgas_101 .Lred_4gas_101: movq (%rdi), %r9 movq (8)(%rdi), %r10 movq (16)(%rdi), %r11 movq (24)(%rdi), %r12 mov %r8, %rdx imul %r9, %rdx mulx (%rsi), %rax, %rbp add %r9, %rax adc $(0), %rbp mulx (8)(%rsi), %r9, %rbx add %r10, %r9 adc $(0), %rbx add %rbp, %r9 adc $(0), %rbx mulx (16)(%rsi), %r10, %rbp add %r11, %r10 adc $(0), %rbp add %rbx, %r10 adc $(0), %rbp mulx (24)(%rsi), %r11, %rbx add %r12, %r11 adc $(0), %rbx add %rbp, %r11 adc $(0), %rbx mov %rbx, %r12 mov %r8, %rdx imul %r9, %rdx mulx (%rsi), %rax, %rbp add %r9, %rax adc $(0), %rbp mulx (8)(%rsi), %r9, %rbx add %r10, %r9 adc $(0), %rbx add %rbp, %r9 adc $(0), %rbx mulx (16)(%rsi), %r10, %rbp add %r11, %r10 adc $(0), %rbp add %rbx, %r10 adc $(0), %rbp mulx (24)(%rsi), %r11, %rbx add %r12, %r11 adc $(0), %rbx add %rbp, %r11 adc $(0), %rbx mov %rbx, %r12 mov %r8, %rdx imul %r9, %rdx mulx (%rsi), %rax, %rbp add %r9, %rax adc $(0), %rbp mulx (8)(%rsi), %r9, %rbx add %r10, %r9 adc $(0), %rbx add %rbp, %r9 adc $(0), %rbx mulx (16)(%rsi), %r10, %rbp add %r11, %r10 adc $(0), %rbp add %rbx, %r10 adc $(0), %rbp mulx (24)(%rsi), %r11, %rbx add %r12, %r11 adc $(0), %rbx add %rbp, %r11 adc $(0), %rbx mov %rbx, %r12 mov %r8, %rdx imul %r9, %rdx mulx (%rsi), %rax, %rbp add %r9, %rax adc $(0), %rbp mulx (8)(%rsi), %r9, %rbx add %r10, %r9 adc $(0), %rbx add %rbp, %r9 adc $(0), %rbx mulx (16)(%rsi), %r10, %rbp add %r11, %r10 adc $(0), %rbp add %rbx, %r10 adc $(0), %rbp mulx (24)(%rsi), %r11, %rbx add %r12, %r11 adc $(0), %rbx add %rbp, %r11 adc $(0), %rbx mov %rbx, %r12 xor %rbx, %rbx addq (32)(%rdi), %r9 movq %r9, (32)(%rdi) adcq (40)(%rdi), %r10 movq %r10, (40)(%rdi) adcq (48)(%rdi), %r11 movq %r11, (48)(%rdi) adcq (56)(%rdi), %r12 movq %r12, (56)(%rdi) adc $(0), %rbx subq (%rsi), %r9 sbbq (8)(%rsi), %r10 sbbq (16)(%rsi), %r11 sbbq (24)(%rsi), %r12 sbb $(0), %rbx movq (32)(%rdi), %rax cmovae %r9, %rax movq %rax, (%r15) movq (40)(%rdi), %rax cmovae %r10, %rax movq %rax, (8)(%r15) movq (48)(%rdi), %rax cmovae %r11, %rax movq %rax, (16)(%r15) movq (56)(%rdi), %rax cmovae %r12, %rax movq %rax, (24)(%r15) jmp .Lquitgas_101 .Labove4gas_101: mov %rdx, %rbp sub $(4), %rbp lea mred_short(%rip), %rax mov (-8)(%rax,%rbp,8), %rbp add %rbp, %rax call *%rax jmp .Lquitgas_101 .Ltest_8N_casegas_101: test $(7), %rdx jnz .Lgeneral_casegas_101 call mred_8N jmp .Lquitgas_101 .Lgeneral_casegas_101: call mred_N .Lquitgas_101: vzeroupper pop %r15 pop %r14 pop %r13 pop %r12 pop %rbp pop %rbx ret .Lfe101: .size l9_cpMontRedAdc_BNU, .Lfe101-(l9_cpMontRedAdc_BNU)
; A021472: Decimal expansion of 1/468. ; 0,0,2,1,3,6,7,5,2,1,3,6,7,5,2,1,3,6,7,5,2,1,3,6,7,5,2,1,3,6,7,5,2,1,3,6,7,5,2,1,3,6,7,5,2,1,3,6,7,5,2,1,3,6,7,5,2,1,3,6,7,5,2,1,3,6,7,5,2,1,3,6,7,5,2,1,3,6,7,5,2,1,3,6,7,5,2,1,3,6,7,5,2,1,3,6,7,5,2 mov $2,4 mov $4,1 lpb $0,1 sub $0,1 sub $1,5 add $2,$4 mov $5,$3 add $5,1 sub $5,$4 trn $1,$5 add $1,$5 sub $2,4 add $4,3 mov $3,$4 sub $4,$2 lpe
// Copyright (c) 2013 The LevelDB Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. See the AUTHORS file for names of contributors. // Test for issue 178: a manual compaction causes deleted data to reappear. #include <iostream> #include <sstream> #include <cstdlib> #include "hyperleveldb/db.h" #include "hyperleveldb/write_batch.h" #include "util/testharness.h" namespace { const int kNumKeys = 1100000; std::string Key1(int i) { char buf[100]; snprintf(buf, sizeof(buf), "my_key_%d", i); return buf; } std::string Key2(int i) { return Key1(i) + "_xxx"; } class Issue178 { }; TEST(Issue178, Test) { // Get rid of any state from an old run. std::string dbpath = leveldb::test::TmpDir() + "/leveldb_cbug_test"; DestroyDB(dbpath, leveldb::Options()); // Open database. Disable compression since it affects the creation // of layers and the code below is trying to test against a very // specific scenario. leveldb::DB* db; leveldb::Options db_options; db_options.create_if_missing = true; db_options.compression = leveldb::kNoCompression; ASSERT_OK(leveldb::DB::Open(db_options, dbpath, &db)); // create first key range leveldb::WriteBatch batch; for (size_t i = 0; i < kNumKeys; i++) { batch.Put(Key1(i), "value for range 1 key"); } ASSERT_OK(db->Write(leveldb::WriteOptions(), &batch)); // create second key range batch.Clear(); for (size_t i = 0; i < kNumKeys; i++) { batch.Put(Key2(i), "value for range 2 key"); } ASSERT_OK(db->Write(leveldb::WriteOptions(), &batch)); // delete second key range batch.Clear(); for (size_t i = 0; i < kNumKeys; i++) { batch.Delete(Key2(i)); } ASSERT_OK(db->Write(leveldb::WriteOptions(), &batch)); // compact database std::string start_key = Key1(0); std::string end_key = Key1(kNumKeys - 1); leveldb::Slice least(start_key.data(), start_key.size()); leveldb::Slice greatest(end_key.data(), end_key.size()); // commenting out the line below causes the example to work correctly db->CompactRange(&least, &greatest); // count the keys leveldb::Iterator* iter = db->NewIterator(leveldb::ReadOptions()); size_t num_keys = 0; for (iter->SeekToFirst(); iter->Valid(); iter->Next()) { num_keys++; } delete iter; ASSERT_EQ(kNumKeys, num_keys) << "Bad number of keys"; // close database delete db; DestroyDB(dbpath, leveldb::Options()); } } // anonymous namespace int main(int argc, char** argv) { return leveldb::test::RunAllTests(); }
; A280154: a(n) = 5*Lucas(n). ; 10,5,15,20,35,55,90,145,235,380,615,995,1610,2605,4215,6820,11035,17855,28890,46745,75635,122380,198015,320395,518410,838805,1357215,2196020,3553235,5749255,9302490,15051745,24354235,39405980,63760215,103166195,166926410,270092605,437019015,707111620,1144130635,1851242255,2995372890,4846615145,7841988035,12688603180,20530591215,33219194395,53749785610,86968980005,140718765615,227687745620,368406511235,596094256855,964500768090,1560595024945,2525095793035,4085690817980,6610786611015,10696477428995,17307264040010,28003741469005,45311005509015,73314746978020,118625752487035,191940499465055,310566251952090,502506751417145,813073003369235,1315579754786380,2128652758155615,3444232512941995,5572885271097610,9017117784039605,14590003055137215,23607120839176820,38197123894314035,61804244733490855,100001368627804890,161805613361295745,261806981989100635,423612595350396380,685419577339497015,1109032172689893395,1794451750029390410,2903483922719283805,4697935672748674215,7601419595467958020,12299355268216632235,19900774863684590255,32200130131901222490,52100904995585812745,84301035127487035235,136401940123072847980,220702975250559883215,357104915373632731195,577807890624192614410,934912805997825345605,1512720696622017960015,2447633502619843305620 seq $0,156279 ; 4 times the Lucas number A000032(n). div $0,4 mul $0,5
/******************************************************************************* * Copyright 2018 Intel Corporation * * 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. *******************************************************************************/ /* General architecture for diff states, we have n_states + 1 as we have n_states diff to propagate to the previous iteration and 1 states to propagate to the previous layer index 0 is dh for cell(t-1, l) to consume index 1 is dc for cell(t-1, l) to consume index 2 is dh for cell(t, l-1) to consume this indexing enables to have the same indexing for states in elemwise function only the cell execution function should be impacted */ #include "math_utils.hpp" #include "mkldnn_thread.hpp" #include "ref_rnn.hpp" #include "../gemm/gemm.hpp" #include "../simple_q10n.hpp" namespace mkldnn { namespace impl { namespace cpu { using namespace mkldnn::impl::utils; using namespace mkldnn::impl::memory_tracking::names; using namespace rnn_utils; #define AOC array_offset_calculator template <prop_kind_t aprop, data_type_t src_type, data_type_t weights_type> void _ref_rnn_common_t<aprop, src_type, weights_type>::gates_reduction( const rnn_conf_t &rnn, const acc_data_t *ws_gates_, float *diff_bias_) const { auto body = [&](int i, int k) { for (int j = 0; j < rnn.mb; j++) diff_bias_[i * rnn.dic + k] += ws_gates_[j * rnn.gates_ws_ld + i * rnn.dic + k]; }; // @todo block k on simd-width #if MKLDNN_THR == MKLDNN_THR_OMP && _OPENMP >= 201307 \ /* icc 17.0 has a problem with simd collapse */ \ && !((defined __INTEL_COMPILER) && (__INTEL_COMPILER == 1700)) #pragma omp parallel for simd collapse(2) for (int i = 0; i < rnn.n_gates; i++) for (int k = 0; k < rnn.dic; k++) body(i, k); #else parallel_nd(rnn.n_gates, rnn.dic, body); #endif } template <prop_kind_t aprop, data_type_t src_type, data_type_t weights_type> gemm_sig((_ref_rnn_common_t<aprop, src_type, weights_type>::gemm)) { assert(ldA * ldB * ldC != 0); extended_sgemm(&transA, &transB, &m, &n, &k, &alpha, a_, &ldA, b_, &ldB, &beta, c_, &ldC, nullptr, pd()->rnn_.use_jit_gemm); } template <> gemm_sig((ref_rnn_fwd_u8s8_t::gemm)) { assert(!"non packed gemm is disabled for int8"); } template <prop_kind_t aprop, data_type_t src_type, data_type_t weights_type> gemm_sig((_ref_rnn_common_t<aprop, src_type, weights_type>::packed_gemm)) { #if (USE_MKL_PACKED_GEMM) assert(transA == 'N'); cblas_sgemm_compute(CblasColMajor, CblasPacked, (transB == 'T') ? CblasTrans : CblasNoTrans, m, n, k, a_, ldA, b_, ldB, beta, c_, ldC); #else UNUSED(transA); UNUSED(transB); UNUSED(m); UNUSED(n); UNUSED(k); UNUSED(alpha); UNUSED(ldA); UNUSED(b_); UNUSED(ldB); UNUSED(beta); UNUSED(c_); UNUSED(ldC); assert(!"packed gemm is disabled"); #endif } template <> gemm_sig((ref_rnn_fwd_u8s8_t::packed_gemm)) { #if (USE_MKL_PACKED_GEMM) int8_t offseta = 0, offsetb = 0; int32_t offsetc = 0; cblas_gemm_s8u8s32_compute(CblasColMajor, (CBLAS_TRANSPOSE)CblasPacked, CblasNoTrans, CblasFixOffset, m, n, k, alpha, a_, ldA, offseta, b_, ldB, offsetb, beta, c_, ldC, &offsetc); #else UNUSED(transA); UNUSED(transB); UNUSED(m); UNUSED(n); UNUSED(k); UNUSED(alpha); UNUSED(ldA); UNUSED(b_); UNUSED(ldB); UNUSED(beta); UNUSED(c_); UNUSED(ldC); assert(!"packed gemm is disabled"); #endif } //*************** Grid computations strategy: linear ***************// template <prop_kind_t aprop, data_type_t src_type, data_type_t weights_type> grid_execution_sig( (_ref_rnn_common_t<aprop, src_type, weights_type>::linear_execution)) { AOC<src_data_t, 4> ws_states(ws_states_, rnn.n_layer + 1, rnn.n_dir, rnn.n_iter + 1, rnn.states_nld * rnn.states_ws_ld); AOC<float, 4> ws_c_states(ws_c_states_, rnn.n_layer + 1, rnn.n_dir, rnn.n_iter + 1, rnn.states_nld * rnn.states_ws_ld); AOC<float, 5> ws_diff_states(ws_diff_states_, rnn.n_layer + 1, rnn.n_dir, (rnn.n_states + 1), rnn.n_iter + 1, rnn.states_nld * rnn.states_ws_ld); AOC<acc_data_t, 4> ws_gates(ws_gates_, rnn.n_layer, rnn.n_dir, rnn.n_iter, rnn.gates_nld * rnn.gates_ws_ld); AOC<weights_data_t *, 3> weights_input( weights_layer_, rnn.n_layer, rnn.n_dir, rnn.n_parts_weights_layer); AOC<weights_data_t *, 3> weights_states( weights_states_, rnn.n_layer, rnn.n_dir, rnn.n_parts_weights_iter); AOC<float*, 3> bias( bias_, rnn.n_layer, rnn.n_dir, rnn.n_parts_bias); AOC<float, 3> diff_weights_layer(diff_weights_layer_, rnn.n_layer, rnn.n_dir, rnn.diff_weights_layer_nld * rnn.diff_weights_layer_ld); AOC<float, 3> diff_weights_iter(diff_weights_iter_, rnn.n_layer, rnn.n_dir, rnn.diff_weights_iter_nld * rnn.diff_weights_iter_ld); AOC<float, 3> diff_bias( diff_bias_, rnn.n_layer, rnn.n_dir, rnn.n_bias * rnn.dic); AOC<float, 4> ws_grid( ws_grid_, rnn.n_layer, rnn.n_dir, rnn.n_iter, (int)rnn.ws_per_cell); // We run the grid of computation for (int dir = 0; dir < rnn.n_dir; dir++) { for (int j = 0; j < rnn.n_layer; j++) { int lay = (aprop == prop_kind::forward) ? j : rnn.n_layer - j - 1; if ((aprop == prop_kind::forward) && rnn.merge_gemm_layer) { (this->*gemm_layer_func)('N', 'N', rnn.n_gates * rnn.dic, rnn.mb * rnn.n_iter, rnn.slc, 1.0, weights_input(lay, dir, 0), rnn.weights_iter_ld, &(ws_states(lay, dir, 1, 0)), rnn.states_ws_ld, 0.0, &(ws_gates(lay, dir, 0, 0)), rnn.gates_ws_ld); } for (int i = 0; i < rnn.n_iter; i++) { int iter = (aprop == prop_kind::forward) ? i : rnn.n_iter - i - 1; (this->*cell_func)(rnn, &(ws_states(lay + 1, dir, iter + 1, 0)), &(ws_c_states(lay + 1, dir, iter + 1, 0)), &(ws_diff_states(lay, dir, 0, iter, 0)), &(weights_input(lay, dir, 0)), &(weights_states(lay, dir, 0)), &(bias(lay, dir, 0)), &(ws_states(lay, dir, iter + 1, 0)), &(ws_states(lay + 1, dir, iter, 0)), &(ws_c_states(lay + 1, dir, iter, 0)), &(ws_diff_states(lay + 1, dir, 0, iter, 0)), &(ws_diff_states(lay, dir, 0, iter + 1, 0)), &(diff_weights_layer(lay, dir, 0)), &(diff_weights_iter(lay, dir, 0)), &(diff_bias(lay, dir, 0)), &(ws_gates(lay, dir, iter, 0)), &(ws_grid(lay, dir, iter, 0)), ws_cell_); } if ((aprop == prop_kind::backward) && rnn.merge_gemm_layer) { (this->*gemm_layer_func)('N', 'N', rnn.slc, rnn.mb * rnn.n_iter, rnn.n_gates * rnn.dic, 1.0, weights_input(lay, dir, 0), rnn.weights_layer_ld, (src_data_t *)(&(ws_gates(lay, dir, 0, 0))), rnn.gates_ws_ld, 0.0, (acc_data_t *)(&(ws_diff_states( lay, dir, rnn.n_states, 0, 0))), rnn.states_ws_ld); gemm('N', 'T', rnn.n_gates * rnn.dic, rnn.slc, rnn.mb * rnn.n_iter, 1.0, (weights_data_t *)(&(ws_gates(lay, dir, 0, 0))), rnn.gates_ws_ld, (src_data_t *)(&(ws_states(lay, dir, 1, 0))), rnn.states_ws_ld, 1.0, (acc_data_t *)(&(diff_weights_layer(lay, dir, 0))), rnn.diff_weights_layer_ld); } if ((aprop == prop_kind::backward) && rnn.merge_gemm_iter) { gemm('N', 'T', rnn.n_gates * rnn.dic, rnn.sic, rnn.mb * rnn.n_iter, 1.0, (weights_data_t *)(&(ws_gates(lay, dir, 0, 0))), rnn.gates_ws_ld, (src_data_t *)(&(ws_states(lay + 1, dir, 0, 0))), rnn.states_ws_ld, 1.0, (acc_data_t *)(&(diff_weights_iter(lay, dir, 0))), rnn.diff_weights_iter_ld); } } } } //********* GRID computations strategy: utility functions **********// template <prop_kind_t aprop, data_type_t src_type, data_type_t weights_type> void _ref_rnn_common_t<aprop, src_type, weights_type>::copy_init_layer( const rnn_conf_t &rnn, src_data_t *__restrict ws_states_, float *__restrict ws_diff_states_, const src_data_t *__restrict xt_, const float *__restrict diff_dst_layer_) const { AOC<src_data_t, 4> ws_states( ws_states_, rnn.n_dir, rnn.n_iter + 1, rnn.mb, rnn.states_ws_ld); auto xt_d = memory_desc_wrapper(pd()->src_pd(0)); parallel_nd(rnn.n_iter, rnn.mb, [&](int it, int b) { auto xxt = xt_ + xt_d.blk_off(it, b); src_data_t *ws_l2r_ptr = &(ws_states(0, it + 1, b, 0)); src_data_t *ws_r2l_ptr = &(ws_states(rnn.n_dir - 1, rnn.n_iter - it, b, 0)); if (rnn.exec_dir != r2l) for (int c = 0; c < rnn.slc; c++) ws_l2r_ptr[c] = xxt[c]; if (rnn.exec_dir != l2r) for (int c = 0; c < rnn.slc; c++) ws_r2l_ptr[c] = xxt[c]; }); } template <> void ref_rnn_bwd_f32_t::copy_init_layer(const rnn_conf_t &rnn, src_data_t *ws_states_, float *ws_diff_states_, const src_data_t *xt_, const float *diff_dst_layer_) const { AOC<float, 6> ws_diff_states(ws_diff_states_, rnn.n_layer + 1, rnn.n_dir, (rnn.n_states + 1), rnn.n_iter + 1, rnn.mb, rnn.states_ws_ld); auto diff_dst_layer_d = memory_desc_wrapper(pd()->diff_dst_pd(0)); switch (rnn.exec_dir) { case bi_concat: parallel_nd(rnn.n_iter, rnn.mb, [&](int it, int b) { auto diff_dst_layer_x = diff_dst_layer_ + diff_dst_layer_d.blk_off(it, b); for (int s = 0; s < rnn.dic; s++) { ws_diff_states(rnn.n_layer, 0, rnn.n_states, it, b, s) = diff_dst_layer_x[s]; ws_diff_states( rnn.n_layer, 1, rnn.n_states, rnn.n_iter - it - 1, b, s) = diff_dst_layer_x[rnn.dic + s]; } }); break; case bi_sum: parallel_nd(rnn.n_iter, rnn.mb, [&](int it, int b) { auto diff_dst_layer_x = diff_dst_layer_ + diff_dst_layer_d.blk_off(it, b); for (int s = 0; s < rnn.dic; s++) { ws_diff_states(rnn.n_layer, 0, rnn.n_states, it, b, s) = diff_dst_layer_x[s]; ws_diff_states( rnn.n_layer, 1, rnn.n_states, rnn.n_iter - it - 1, b, s) = diff_dst_layer_x[s]; } }); break; case l2r: parallel_nd(rnn.n_iter, rnn.mb, [&](int it, int b) { auto diff_dst_layer_x = diff_dst_layer_ + diff_dst_layer_d.blk_off(it, b); for (int s = 0; s < rnn.dic; s++) { ws_diff_states(rnn.n_layer, 0, rnn.n_states, it, b, s) = diff_dst_layer_x[s]; } }); break; case r2l: parallel_nd(rnn.n_iter, rnn.mb, [&](int it, int b) { auto diff_dst_layer_x = diff_dst_layer_ + diff_dst_layer_d.blk_off(rnn.n_iter - it - 1, b); for (int s = 0; s < rnn.dic; s++) { ws_diff_states(rnn.n_layer, 0, rnn.n_states, it, b, s) = diff_dst_layer_x[s]; } }); break; default: assert(!"Unsupported direction"); break; } } /* For int8 configuration, input iteration states may be of types f32 or u8 * Internally h_state is always stored in u8 and c_state is always stored in f32 * If input states are of type u8 then h state is copied and c state is dequantized * If input states are of type f32 then h state is quantized and c_state is copied * */ template <prop_kind_t aprop, data_type_t src_type, data_type_t weights_type> template <typename input_data_t> void _ref_rnn_common_t<aprop, src_type, weights_type>::copy_init_iter( const rnn_conf_t &rnn, src_data_t *__restrict ws_states_, float *__restrict ws_c_states_, float *__restrict ws_diff_states_, const input_data_t *__restrict firstit_states_, const float *__restrict diff_dst_iter_) const { AOC<src_data_t, 5> ws_states(ws_states_, rnn.n_layer + 1, rnn.n_dir, rnn.n_iter + 1, rnn.mb, rnn.states_ws_ld); AOC<float, 5> ws_c_states(ws_c_states_, rnn.n_layer + 1, rnn.n_dir, rnn.n_iter + 1, rnn.mb, rnn.states_ws_ld); float data_shift = pd()->attr()->rnn_data_qparams_.shift_; float data_scale = pd()->attr()->rnn_data_qparams_.scale_; round_mode_t rmode = pd()->attr()->round_mode_; const bool quantize = pd()->desc()->src_iter_desc.data_type == data_type::f32 && rnn.dt_conf != all_f32; auto maybe_q = [&](input_data_t f) { if (quantize) { float qf = f * data_scale + data_shift; return qz_a1b0<float, src_data_t>()(qf, rmode); } else return (src_data_t)f; }; const bool dequantize = pd()->desc()->src_iter_desc.data_type == data_type::u8; auto maybe_deq = [&](input_data_t s) { if (dequantize) return (((float)s - data_shift) / data_scale); else return (float)s; }; auto firstit_states_d = memory_desc_wrapper(pd()->src_pd(1)); if (firstit_states_) { parallel_nd( rnn.n_layer, rnn.n_dir, rnn.mb, [&](int lay, int dir, int b) { for (int s = 0; s < rnn.sic; s++) ws_states(lay + 1, dir, 0, b, s) = maybe_q( firstit_states_[firstit_states_d.blk_off( lay, dir, 0, b, s)]); if (pd()->cell_kind() == alg_kind::vanilla_lstm) for (int s = 0; s < rnn.sic; s++) ws_c_states(lay + 1, dir, 0, b, s) = maybe_deq( firstit_states_[firstit_states_d.blk_off( lay, dir, 1, b, s)]); }); } else { parallel_nd( rnn.n_layer, rnn.n_dir, rnn.mb, [&](int lay, int dir, int b) { for (int j = 0; j < rnn.sic; j++) { ws_states(lay + 1, dir, 0, b, j) = (src_data_t)0; ws_c_states(lay + 1, dir, 0, b, j) = 0.0f; } }); } } template <> template <typename input_data_t> void ref_rnn_bwd_f32_t::copy_init_iter(const rnn_conf_t &rnn, src_data_t *ws_states_, float *ws_c_states_, float *ws_diff_states_, const input_data_t *firstit_states_, const float *diff_dst_iter_) const { AOC<float, 6> ws_diff_states(ws_diff_states_, rnn.n_layer + 1, rnn.n_dir, rnn.n_states + 1, rnn.n_iter + 1, rnn.mb, rnn.states_ws_ld); auto diff_dst_iter_d = memory_desc_wrapper(pd()->diff_dst_pd(1)); if (diff_dst_iter_) { parallel_nd(rnn.n_layer, rnn.n_dir, rnn.n_states, rnn.mb, [&](int lay, int dir, int state, int b) { array_copy(&(ws_diff_states( lay, dir, state, rnn.n_iter, b, 0)), diff_dst_iter_ + diff_dst_iter_d.blk_off( lay, dir, state, b), rnn.dic); }); } else { parallel_nd(rnn.n_layer, rnn.n_dir, rnn.n_states, rnn.mb, [&](int lay, int dir, int state, int i) { for (int j = 0; j < rnn.dic; j++) ws_diff_states(lay, dir, state, rnn.n_iter, i, j) = 0.0f; }); } } template <prop_kind_t aprop, data_type_t src_type, data_type_t weights_type> template <typename dst_data_t> void _ref_rnn_common_t<aprop, src_type, weights_type>::copy_res_layer( const rnn_conf_t &rnn, dst_data_t *dst_layer_, float *diff_src_layer, const src_data_t *ws_states_, const float *ws_diff_states_) const { auto dst_layer_d = memory_desc_wrapper(pd()->dst_pd(0)); AOC<const src_data_t, 5> ws_states(ws_states_, rnn.n_layer + 1, rnn.n_dir, rnn.n_iter + 1, rnn.mb, rnn.states_ws_ld); float shift = (pd()->attr()->rnn_data_qparams_.shift_); float scale = (pd()->attr()->rnn_data_qparams_.scale_); const bool dequantize = pd()->desc()->dst_layer_desc.data_type == data_type::f32 && rnn.dt_conf != all_f32; auto maybe_deq = [&](src_data_t s) { if (dequantize) return (dst_data_t)(((float)s - shift) / scale); else return (dst_data_t)s; }; parallel_nd(rnn.n_iter, rnn.mb, [&](int it, int b) { int dir = 0; if (rnn.exec_dir != r2l) { for (int s = 0; s < rnn.dic; s++) { dst_layer_[dst_layer_d.blk_off(it, b, dir * rnn.dic + s)] = maybe_deq(ws_states(rnn.n_layer, dir, it + 1, b, s)); } dir = 1; } if (rnn.exec_dir != l2r) { for (int s = 0; s < rnn.dic; s++) switch (rnn.exec_dir) { case bi_sum: dst_layer_[dst_layer_d.blk_off(it, b, s)] += maybe_deq(ws_states( rnn.n_layer, dir, rnn.n_iter - it, b, s)); break; default: dst_layer_[dst_layer_d.blk_off(it, b, dir * rnn.dic + s)] = maybe_deq(ws_states( rnn.n_layer, dir, rnn.n_iter - it, b, s)); } } }); } template <> template <typename dst_data_t> void ref_rnn_bwd_f32_t::copy_res_layer( const rnn_conf_t &rnn, dst_data_t *dst_layer_, float *diff_src_layer_, const src_data_t *ws_states_, const float *ws_diff_states_) const { auto diff_src_layer_d = memory_desc_wrapper(pd()->diff_src_pd(0)); AOC<const float, 6> ws_diff_states(ws_diff_states_, rnn.n_layer + 1, rnn.n_dir, rnn.n_states + 1, rnn.n_iter + 1, rnn.mb, rnn.states_ws_ld); parallel_nd(rnn.n_iter, rnn.mb, [&](int it, int b) { int dir = 0; for (int s = 0; s < rnn.slc; s++) { float *dst_addr = diff_src_layer_ + diff_src_layer_d.blk_off( (rnn.exec_dir == r2l) ? rnn.n_iter - 1 - it : it, b, dir * rnn.slc + s); float res = ws_diff_states(0, 0, rnn.n_states, it, b, s); if (rnn.n_dir - 1) res += ws_diff_states( 0, 1, rnn.n_states, rnn.n_iter - 1 - it, b, s); dst_addr[0] = res; } }); } template <prop_kind_t aprop, data_type_t src_type, data_type_t weights_type> template <typename output_data_t> void _ref_rnn_common_t<aprop, src_type, weights_type>::copy_res_iter( const rnn_conf_t &rnn, output_data_t *dst_iter_, float *diff_src_iter_, const src_data_t *ws_states_, float *ws_c_states_, const float *ws_diff_states_) const { auto dst_iter_d = memory_desc_wrapper(pd()->dst_pd(1)); AOC<const src_data_t, 5> ws_states(ws_states_, rnn.n_layer + 1, rnn.n_dir, rnn.n_iter + 1, rnn.mb, rnn.states_ws_ld); AOC<const float, 5> ws_c_states(ws_c_states_, rnn.n_layer + 1, rnn.n_dir, rnn.n_iter + 1, rnn.mb, rnn.states_ws_ld); float data_shift = pd()->attr()->rnn_data_qparams_.shift_; float data_scale = pd()->attr()->rnn_data_qparams_.scale_; round_mode_t rmode = pd()->attr()->round_mode_; const bool quantize = pd()->desc()->dst_iter_desc.data_type == data_type::u8 && rnn.dt_conf != all_f32; auto maybe_q = [&](float f) { if (quantize) { float qf = f * data_scale + data_shift; return qz_a1b0<float, output_data_t>()(qf, rmode); } else return (output_data_t)f; }; const bool dequantize = pd()->desc()->dst_iter_desc.data_type == data_type::f32 && rnn.dt_conf != all_f32; auto maybe_deq = [&](src_data_t s) { if (dequantize) return (output_data_t)(((float)s - data_shift) / data_scale); else return (output_data_t)s; }; if (dst_iter_) { parallel_nd(rnn.n_layer, rnn.n_dir, rnn.mb, [&](int lay, int dir, int b) { for (int s = 0; s < rnn.dic; s++) { dst_iter_[dst_iter_d.blk_off(lay, dir, 0, b, s)] = maybe_deq(ws_states(lay + 1, dir, rnn.n_iter, b, s)); } if (pd()->cell_kind() == alg_kind::vanilla_lstm) for (int s = 0; s < rnn.dic; s++) { dst_iter_[dst_iter_d.blk_off(lay, dir, 1, b, s)] = maybe_q(ws_c_states( lay + 1, dir, rnn.n_iter, b, s)); } }); } } template <> template <typename output_data_t> void ref_rnn_bwd_f32_t::copy_res_iter( const rnn_conf_t &rnn, output_data_t *dst_iter_, float *diff_src_iter_, const src_data_t *ws_states_, float *ws_c_states_, const float *ws_diff_states_) const { auto diff_src_iter_d = memory_desc_wrapper(pd()->diff_src_pd(1)); AOC<const float, 6> ws_diff_states(ws_diff_states_, rnn.n_layer + 1, rnn.n_dir, rnn.n_states + 1, rnn.n_iter + 1, rnn.mb, rnn.states_ws_ld); if (diff_src_iter_) { parallel_nd(rnn.n_layer, rnn.n_dir, rnn.n_states, rnn.mb, [&](int lay, int dir, int state, int b) { for (int s = 0; s < rnn.sic; s++) { diff_src_iter_[diff_src_iter_d.blk_off( lay, dir, state, b, s)] = ws_diff_states(lay, dir, state, 0, b, s); } }); } } template <prop_kind_t aprop, data_type_t src_type, data_type_t weights_type> bias_prepare_sig((_ref_rnn_common_t<aprop, src_type, weights_type>::bias_prepare)) { /* Original set of bias provided by the user */ AOC<const float, 5> b( b_, rnn.n_layer, rnn.n_dir, rnn.n_bias * rnn.dic); /* Array of pointers initialized in packing */ AOC<float *, 3> bias(bias_, rnn.n_layer, rnn.n_dir, rnn.n_parts_bias); AOC<float, 3> scratch_bias( scratch_bias_, rnn.n_layer, rnn.n_dir, rnn.n_bias * rnn.dic); if (rnn.copy_bias) { parallel_nd(rnn.n_layer * rnn.n_dir * rnn.n_bias * rnn.dic, [&](size_t i) { scratch_bias_[i] = b_[i]; }); } for (int i = 0; i < rnn.n_layer; i++) { for (int d = 0; d < rnn.n_dir; d++) { int offset_bias = 0; for (int p = 0; p < rnn.n_parts_bias; p++) { bias(i, d, p) = rnn.copy_bias ? (float *) &scratch_bias(i, d, offset_bias) : (float *) &b(i, d, offset_bias); offset_bias += rnn.parts_bias[p] * rnn.dic; } } } } template <prop_kind_t aprop, data_type_t src_type, data_type_t weights_type> bias_finalize_sig( (_ref_rnn_common_t<aprop, src_type, weights_type>::bias_finalize)) { if (rnn.dt_conf != all_f32) { float data_shift = pd()->attr()->rnn_data_qparams_.shift_; float data_scale = pd()->attr()->rnn_data_qparams_.scale_; float *weights_scales = pd()->attr()->rnn_weights_qparams_.scales_; bool scale_per_oc = pd()->attr()->rnn_weights_qparams_.mask_ != 0; for (int i = 0; i < rnn.n_layer * rnn.n_dir; i++) for (int j = 0; j < rnn.n_bias * rnn.dic; j++) { size_t off = i * rnn.n_bias * rnn.dic + j; float weights_scale = scale_per_oc ? weights_scales[j] : weights_scales[0]; scratch_bias_[off] -= (w_iter_comp[off] + w_layer_comp[off]) * data_shift / (weights_scale * data_scale); } } } template <prop_kind_t aprop, data_type_t src_type, data_type_t weights_type> weights_assign_sig((_ref_rnn_common_t<aprop, src_type, weights_type>::assign_packed_weights)) { AOC<weights_data_t *, 3> weights(weights_, rnn.n_layer, rnn.n_dir, n_parts); size_t offset_packed = 0; for (int l = 0; l < rnn.n_layer; l++) for (int d = 0; d < rnn.n_dir; d++) { for (int p = 0; p < n_parts; p++) { weights(l, d, p) = (weights_data_t *)&w_[offset_packed]; offset_packed += part_weights_pack_size[p] / sizeof(weights_data_t); } } } template <prop_kind_t aprop, data_type_t src_type, data_type_t weights_type> weights_assign_sig( (_ref_rnn_common_t<aprop, src_type, weights_type>::assign_weights)) { assert(nld * ld != 0); /* Original set of weights provided by the user */ AOC<const weights_data_t, 3> w(w_, rnn.n_layer, rnn.n_dir, nld * ld); /* Array of pointers for each part of weights */ AOC<weights_data_t *, 3> weights(weights_, rnn.n_layer, rnn.n_dir, n_parts); for (int i = 0; i < rnn.n_layer; i++) for (int d = 0; d < rnn.n_dir; d++) { size_t offset_weights = 0; for (int p = 0; p < n_parts; p++) { weights(i, d, p) = (weights_data_t *)&w(i, d, offset_weights); offset_weights += fmt == memory_format::ldigo ? gates_per_part[p] * OC_size : gates_per_part[p] * OC_size * ld; } } } //********************* Execution function *********************// template <prop_kind_t aprop, data_type_t src_type, data_type_t weights_type> void _ref_rnn_common_t<aprop, src_type, weights_type>::execute_() const { const rnn_conf_t &rnn = this->pd()->rnn_; int input_idx = 0; int output_idx = 0; auto input = reinterpret_cast<const src_data_t *>( this->input_memory(input_idx++)); auto states = pd()->with_src_iter() ? (this->input_memory(input_idx++)) : nullptr; const char *layer_weights_n_comp = this->input_memory(input_idx++); auto w_layer = reinterpret_cast<const weights_data_t *>(layer_weights_n_comp); auto w_layer_comp = reinterpret_cast<const float *>(layer_weights_n_comp + rnn.weights_layer_comp_offset); const char *iter_weights_n_comp = this->input_memory(input_idx++); auto w_iter = reinterpret_cast<const weights_data_t *>(iter_weights_n_comp); auto w_iter_comp = reinterpret_cast<const float *>(iter_weights_n_comp + rnn.weights_iter_comp_offset); auto bias = pd()->with_bias() ? reinterpret_cast<const float *>(this->input_memory(input_idx++)) : nullptr; auto dst_last_layer = rnn.is_fwd ? this->memory(output_idx++) : this->input_memory(input_idx++); auto dst_last_iter = pd()->with_dst_iter() ? (rnn.is_fwd ? this->memory(output_idx++) : this->input_memory(input_idx++)) : nullptr; auto diff_dst_layer = rnn.is_fwd ? nullptr : reinterpret_cast<const float *>(this->input_memory(input_idx++)); auto diff_dst_iter = rnn.is_fwd || !pd()->with_dst_iter() ? nullptr : reinterpret_cast<const float *>(this->input_memory(input_idx++)); auto scratchpad = this->scratchpad(); auto ptr_wei_layer = scratchpad.template get<weights_data_t *>(key_rnn_ptrs_wei_layer); auto ptr_wei_iter = scratchpad.template get<weights_data_t *>(key_rnn_ptrs_wei_iter); auto ptr_bias = scratchpad.template get<float *>(key_rnn_ptrs_bia); // fetchihg buffers from the workspace // if no workspace was provided we use the scratchpad char *scratch_ptr = scratchpad.template get<char>(key_rnn_space); char *ws_ptr = nullptr; if (rnn.use_workspace) ws_ptr = rnn.is_fwd ? this->memory(output_idx++) : const_cast<char *>(this->input_memory(input_idx++)); char *base_ptr = rnn.use_workspace ? ws_ptr : scratch_ptr; acc_data_t *ws_gates = (acc_data_t *)(base_ptr + ws_gates_offset_); src_data_t *ws_states = (src_data_t *)(base_ptr + ws_states_offset_); float *ws_c_states = (float *)(base_ptr + ws_c_states_offset_); float *ws_diff_states = (float *)(base_ptr + ws_diff_states_offset_); float *ws_grid = (float *)(base_ptr + ws_grid_comp_offset_); float *ws_cell = (float *)(base_ptr + ws_cell_comp_offset_); auto diff_src_layer = rnn.is_fwd ? nullptr : reinterpret_cast<float *>(this->memory(output_idx++)); auto diff_src_iter = rnn.is_fwd || !pd()->with_src_iter() ? nullptr : reinterpret_cast<float *>(this->memory(output_idx++)); auto diff_weights_layer = rnn.is_fwd ? nullptr : reinterpret_cast<float *>(this->memory(output_idx++)); auto diff_weights_iter = rnn.is_fwd ? nullptr : reinterpret_cast<float *>(this->memory(output_idx++)); auto diff_bias = rnn.is_fwd || !pd()->with_bias() ? nullptr : reinterpret_cast<float *>(this->memory(output_idx++)); // Fetching extra buffers from scratchpad float *ws_bias = (float *)(scratch_ptr + ws_bias_offset_); // initialize diff_states to 0 if (aprop == prop_kind::backward) array_set(ws_diff_states, 0.0f, rnn.ws_diff_states_size / sizeof(float)); /* Pack(if using packed gemm API) or copy(if input arrays have bad leading * dimension */ (this->*bias_preparation_func)(rnn, ptr_bias, bias, ws_bias); (this->*weights_iter_assign_func)(rnn, rnn.weights_iter_fmt, rnn.weights_iter_nld, rnn.weights_iter_ld, rnn.dic, rnn.sic, rnn.n_parts_weights_iter, rnn.parts_weights_iter, rnn.part_weights_iter_pack_size, ptr_wei_iter, w_iter, ptr_bias, bias, ws_bias); (this->*weights_layer_assign_func)(rnn, rnn.weights_layer_fmt, rnn.weights_layer_nld, rnn.weights_layer_ld, rnn.dic, rnn.slc, rnn.n_parts_weights_layer, rnn.parts_weights_layer, rnn.part_weights_layer_pack_size, ptr_wei_layer, w_layer, ptr_bias, bias, ws_bias); (this->*bias_finalization_func)(rnn, ws_bias, w_iter_comp, w_layer_comp); // we first need to copy the initial states and input into ws copy_init_layer(rnn, ws_states, ws_diff_states, input, diff_dst_layer); if (rnn.dt_conf == f32u8f32u8 || rnn.dt_conf == f32u8f32f32 || rnn.dt_conf == all_f32) copy_init_iter(rnn, ws_states, ws_c_states, ws_diff_states, (const float *)states, diff_dst_iter); else if (rnn.dt_conf == u8u8u8u8 || rnn.dt_conf == u8u8u8f32) copy_init_iter(rnn, ws_states, ws_c_states, ws_diff_states, (const uint8_t *)states, diff_dst_iter); else assert(!"unimplemented"); // run the execution on the grid (this->*grid_computation)(rnn, ptr_wei_layer, ptr_wei_iter, ptr_bias, ws_states, ws_c_states, ws_diff_states, ws_gates, ws_cell, ws_grid, diff_weights_layer, diff_weights_iter, diff_bias); // Finally we copy the results to the result buffers if (rnn.dt_conf == u8u8u8f32 || rnn.dt_conf == f32u8f32f32 || rnn.dt_conf == all_f32) copy_res_layer(rnn, (float *)dst_last_layer, diff_src_layer, ws_states, ws_diff_states); else if (rnn.dt_conf == u8u8u8u8 || rnn.dt_conf == f32u8f32u8) copy_res_layer(rnn, (uint8_t *)dst_last_layer, diff_src_layer, ws_states, ws_diff_states); else assert(!"unimplemented"); if (rnn.dt_conf == f32u8f32u8 || rnn.dt_conf == f32u8f32f32 || rnn.dt_conf == all_f32) copy_res_iter(rnn, (float *)dst_last_iter, diff_src_iter, ws_states, ws_c_states, ws_diff_states); else if (rnn.dt_conf == u8u8u8u8 || rnn.dt_conf == u8u8u8f32) copy_res_iter(rnn, (uint8_t *)dst_last_iter, diff_src_iter, ws_states, ws_c_states, ws_diff_states); else assert(!"unimplemented"); }; /* Fix for MSVS warning C4661 */ template<> cell_execution_sig(ref_rnn_fwd_f32_t::cell_execution); template<> cell_execution_sig(ref_rnn_fwd_u8s8_t::cell_execution); template<> cell_execution_sig(ref_rnn_bwd_f32_t::cell_execution); template<> cell_execution_sig(ref_rnn_fwd_f32_t::cell_execution_gru); template<> cell_execution_sig(ref_rnn_fwd_u8s8_t::cell_execution_gru); template<> cell_execution_sig(ref_rnn_bwd_f32_t::cell_execution_gru); template<> cell_execution_sig(ref_rnn_fwd_f32_t::cell_execution_gru_lbr); template<> cell_execution_sig(ref_rnn_fwd_u8s8_t::cell_execution_gru_lbr); template<> cell_execution_sig(ref_rnn_bwd_f32_t::cell_execution_gru_lbr); template<> elemwise_sig(ref_rnn_fwd_f32_t::rnn_elemwise); template<> elemwise_sig(ref_rnn_fwd_u8s8_t::rnn_elemwise); template<> elemwise_sig(ref_rnn_bwd_f32_t::rnn_elemwise); template<> elemwise_sig(ref_rnn_fwd_f32_t::lstm_elemwise); template<> elemwise_sig(ref_rnn_fwd_u8s8_t::lstm_elemwise); template<> elemwise_sig(ref_rnn_bwd_f32_t::lstm_elemwise); template<> elemwise_sig(ref_rnn_fwd_f32_t::gru_lbr_elemwise); template<> elemwise_sig(ref_rnn_fwd_u8s8_t::gru_lbr_elemwise); template<> elemwise_sig(ref_rnn_bwd_f32_t::gru_lbr_elemwise); template struct _ref_rnn_common_t<prop_kind::forward, data_type::f32, data_type::f32>; template struct _ref_rnn_common_t<prop_kind::forward, data_type::u8, data_type::s8>; template struct _ref_rnn_common_t<prop_kind::backward, data_type::f32, data_type::f32>; #undef AOC } } }
#!/usr/bin/sisa16_asm -run .ZERO_STACK_POINTER: astp;popa; .POP_FARPTR_VARIABLE: blpop;apop;ca; .PUSH_FARPTR_VARIABLE: ac;apush;blpush; //global variables. .ld_iteration_count: farllda %&0x30000%; .st_iteration_count: farstla %&0x30000%; .ld_line_count: farllda %&0x30002%; .st_line_count: farstla %&0x30002%; .ld_page_count: farllda %&0x30004%; .st_page_count: farstla %&0x30004%; section 0x40000; :ascii_greyscale: ..asciz: .:-=+*#%@%#*+=-:. .ascii_greyscale_len:18 .ITER_REGION:3 ..(ITER_REGION): bytes 0,0,0,0; ..include"libc.hasm" .line_length: 90 .line_length_plus_1: 91 .num_lines: 20 .wait_time: 16 ..main: asm_begin_region_restriction; la line_length; alpush; asm_print @& st_iteration_count; st_page_count; st_line_count; nop; nop; lla %0xE000%; interrupt; asciifun_looptop: //Comment. //increment the counter. alpop; aincr; llb %line_length_plus_1%; mod; alpush; sc %iter_is_endval%;llb %line_length%;cmp;jmpifeq; sc %iter_is_not_endval%;jmp; iter_is_endval: la '\n';putchar; la '\r';putchar; ld_iteration_count; adecr; st_iteration_count; ld_line_count;aincr;st_line_count; lb num_lines;cmp;lb2;cmp;sc %reached_num_lines%; jmpifeq; sc %asciifun_looptop%;jmp; reached_num_lines: la '\n' interrupt; clear_terminal; la 0; st_line_count; ld_page_count; adecr; st_page_count; st_iteration_count; la %~wait_time%; alpush; proc_wait; alpop; sc %asciifun_looptop%;jmp; iter_is_not_endval: ld_iteration_count; blpop;blpush; add; lb %~ascii_greyscale_len%; mod; //we now have the offset calculated in register a. sc %0x4%; lb %~ascii_greyscale%; add; ba; farilda; putchar; sc %asciifun_looptop%;jmp; asciifun_loopout: la 7; putchar; halt; asm_end_restriction;
// Copyright (c) 2011 The LevelDB Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. See the AUTHORS file for names of contributors. #include <dirent.h> #include <fcntl.h> #include <sys/mman.h> #ifndef __Fuchsia__ #include <sys/resource.h> #endif #include <sys/stat.h> #include <sys/time.h> #include <sys/types.h> #include <unistd.h> #include <atomic> #include <cerrno> #include <cstddef> #include <cstdint> #include <cstdio> #include <cstdlib> #include <cstring> #include <limits> #include <queue> #include <set> #include <string> #include <thread> #include <type_traits> #include <utility> #include "leveldb/env.h" #include "leveldb/slice.h" #include "leveldb/status.h" #include "port/port.h" #include "port/thread_annotations.h" #include "util/env_posix_test_helper.h" #include "util/posix_logger.h" namespace leveldb { namespace { // Set by EnvPosixTestHelper::SetReadOnlyMMapLimit() and MaxOpenFiles(). int g_open_read_only_file_limit = -1; // Up to 1000 mmap regions for 64-bit binaries; none for 32-bit. constexpr const int kDefaultMmapLimit = (sizeof(void*) >= 8) ? 1000 : 0; // Can be set using EnvPosixTestHelper::SetReadOnlyMMapLimit(). int g_mmap_limit = kDefaultMmapLimit; // Common flags defined for all posix open operations #if defined(HAVE_O_CLOEXEC) constexpr const int kOpenBaseFlags = O_CLOEXEC; #else constexpr const int kOpenBaseFlags = 0; #endif // defined(HAVE_O_CLOEXEC) constexpr const size_t kWritableFileBufferSize = 65536; Status PosixError(const std::string& context, int error_number) { if (error_number == ENOENT) { return Status::NotFound(context, std::strerror(error_number)); } else { return Status::IOError(context, std::strerror(error_number)); } } // Helper class to limit resource usage to avoid exhaustion. // Currently used to limit read-only file descriptors and mmap file usage // so that we do not run out of file descriptors or virtual memory, or run into // kernel performance problems for very large databases. class Limiter { public: // Limit maximum number of resources to |max_acquires|. Limiter(int max_acquires) : #if !defined(NDEBUG) max_acquires_(max_acquires), #endif // !defined(NDEBUG) acquires_allowed_(max_acquires) { assert(max_acquires >= 0); } Limiter(const Limiter&) = delete; Limiter operator=(const Limiter&) = delete; // If another resource is available, acquire it and return true. // Else return false. bool Acquire() { int old_acquires_allowed = acquires_allowed_.fetch_sub(1, std::memory_order_relaxed); if (old_acquires_allowed > 0) return true; int pre_increment_acquires_allowed = acquires_allowed_.fetch_add(1, std::memory_order_relaxed); // Silence compiler warnings about unused arguments when NDEBUG is defined. (void)pre_increment_acquires_allowed; // If the check below fails, Release() was called more times than acquire. assert(pre_increment_acquires_allowed < max_acquires_); return false; } // Release a resource acquired by a previous call to Acquire() that returned // true. void Release() { int old_acquires_allowed = acquires_allowed_.fetch_add(1, std::memory_order_relaxed); // Silence compiler warnings about unused arguments when NDEBUG is defined. (void)old_acquires_allowed; // If the check below fails, Release() was called more times than acquire. assert(old_acquires_allowed < max_acquires_); } private: #if !defined(NDEBUG) // Catches an excessive number of Release() calls. const int max_acquires_; #endif // !defined(NDEBUG) // The number of available resources. // // This is a counter and is not tied to the invariants of any other class, so // it can be operated on safely using std::memory_order_relaxed. std::atomic<int> acquires_allowed_; }; // Implements sequential read access in a file using read(). // // Instances of this class are thread-friendly but not thread-safe, as required // by the SequentialFile API. class PosixSequentialFile final : public SequentialFile { public: PosixSequentialFile(std::string filename, int fd) : fd_(fd), filename_(std::move(filename)) {} ~PosixSequentialFile() override { close(fd_); } Status Read(size_t n, Slice* result, char* scratch) override { Status status; while (true) { ::ssize_t read_size = ::read(fd_, scratch, n); if (read_size < 0) { // Read error. if (errno == EINTR) { continue; // Retry } status = PosixError(filename_, errno); break; } *result = Slice(scratch, read_size); break; } return status; } Status Skip(uint64_t n) override { if (::lseek(fd_, n, SEEK_CUR) == static_cast<off_t>(-1)) { return PosixError(filename_, errno); } return Status::OK(); } private: const int fd_; const std::string filename_; }; // Implements random read access in a file using pread(). // // Instances of this class are thread-safe, as required by the RandomAccessFile // API. Instances are immutable and Read() only calls thread-safe library // functions. class PosixRandomAccessFile final : public RandomAccessFile { public: // The new instance takes ownership of |fd|. |fd_limiter| must outlive this // instance, and will be used to determine if . PosixRandomAccessFile(std::string filename, int fd, Limiter* fd_limiter) : has_permanent_fd_(fd_limiter->Acquire()), fd_(has_permanent_fd_ ? fd : -1), fd_limiter_(fd_limiter), filename_(std::move(filename)) { if (!has_permanent_fd_) { assert(fd_ == -1); ::close(fd); // The file will be opened on every read. } } ~PosixRandomAccessFile() override { if (has_permanent_fd_) { assert(fd_ != -1); ::close(fd_); fd_limiter_->Release(); } } Status Read(uint64_t offset, size_t n, Slice* result, char* scratch) const override { int fd = fd_; if (!has_permanent_fd_) { fd = ::open(filename_.c_str(), O_RDONLY | kOpenBaseFlags); if (fd < 0) { return PosixError(filename_, errno); } } assert(fd != -1); Status status; ssize_t read_size = ::pread(fd, scratch, n, static_cast<off_t>(offset)); *result = Slice(scratch, (read_size < 0) ? 0 : read_size); if (read_size < 0) { // An error: return a non-ok status. status = PosixError(filename_, errno); } if (!has_permanent_fd_) { // Close the temporary file descriptor opened earlier. assert(fd != fd_); ::close(fd); } return status; } private: const bool has_permanent_fd_; // If false, the file is opened on every read. const int fd_; // -1 if has_permanent_fd_ is false. Limiter* const fd_limiter_; const std::string filename_; }; // Implements random read access in a file using mmap(). // // Instances of this class are thread-safe, as required by the RandomAccessFile // API. Instances are immutable and Read() only calls thread-safe library // functions. class PosixMmapReadableFile final : public RandomAccessFile { public: // mmap_base[0, length-1] points to the memory-mapped contents of the file. It // must be the result of a successful call to mmap(). This instances takes // over the ownership of the region. // // |mmap_limiter| must outlive this instance. The caller must have already // acquired the right to use one mmap region, which will be released when this // instance is destroyed. PosixMmapReadableFile(std::string filename, char* mmap_base, size_t length, Limiter* mmap_limiter) : mmap_base_(mmap_base), length_(length), mmap_limiter_(mmap_limiter), filename_(std::move(filename)) {} ~PosixMmapReadableFile() override { ::munmap(static_cast<void*>(mmap_base_), length_); mmap_limiter_->Release(); } Status Read(uint64_t offset, size_t n, Slice* result, char* scratch) const override { if (offset + n > length_) { *result = Slice(); return PosixError(filename_, EINVAL); } *result = Slice(mmap_base_ + offset, n); return Status::OK(); } private: char* const mmap_base_; const size_t length_; Limiter* const mmap_limiter_; const std::string filename_; }; class PosixWritableFile final : public WritableFile { public: PosixWritableFile(std::string filename, int fd) : pos_(0), fd_(fd), is_manifest_(IsManifest(filename)), filename_(std::move(filename)), dirname_(Dirname(filename_)) {} ~PosixWritableFile() override { if (fd_ >= 0) { // Ignoring any potential errors Close(); } } Status Append(const Slice& data) override { size_t write_size = data.size(); const char* write_data = data.data(); // Fit as much as possible into buffer. size_t copy_size = std::min(write_size, kWritableFileBufferSize - pos_); std::memcpy(buf_ + pos_, write_data, copy_size); write_data += copy_size; write_size -= copy_size; pos_ += copy_size; if (write_size == 0) { return Status::OK(); } // Can't fit in buffer, so need to do at least one write. Status status = FlushBuffer(); if (!status.ok()) { return status; } // Small writes go to buffer, large writes are written directly. if (write_size < kWritableFileBufferSize) { std::memcpy(buf_, write_data, write_size); pos_ = write_size; return Status::OK(); } return WriteUnbuffered(write_data, write_size); } Status Close() override { Status status = FlushBuffer(); const int close_result = ::close(fd_); if (close_result < 0 && status.ok()) { status = PosixError(filename_, errno); } fd_ = -1; return status; } Status Flush() override { return FlushBuffer(); } Status Sync() override { // Ensure new files referred to by the manifest are in the filesystem. // // This needs to happen before the manifest file is flushed to disk, to // avoid crashing in a state where the manifest refers to files that are not // yet on disk. Status status = SyncDirIfManifest(); if (!status.ok()) { return status; } status = FlushBuffer(); if (!status.ok()) { return status; } return SyncFd(fd_, filename_); } private: Status FlushBuffer() { Status status = WriteUnbuffered(buf_, pos_); pos_ = 0; return status; } Status WriteUnbuffered(const char* data, size_t size) { while (size > 0) { ssize_t write_result = ::write(fd_, data, size); if (write_result < 0) { if (errno == EINTR) { continue; // Retry } return PosixError(filename_, errno); } data += write_result; size -= write_result; } return Status::OK(); } Status SyncDirIfManifest() { Status status; if (!is_manifest_) { return status; } int fd = ::open(dirname_.c_str(), O_RDONLY | kOpenBaseFlags); if (fd < 0) { status = PosixError(dirname_, errno); } else { status = SyncFd(fd, dirname_); ::close(fd); } return status; } // Ensures that all the caches associated with the given file descriptor's // data are flushed all the way to durable media, and can withstand power // failures. // // The path argument is only used to populate the description string in the // returned Status if an error occurs. static Status SyncFd(int fd, const std::string& fd_path) { #if HAVE_FULLFSYNC // On macOS and iOS, fsync() doesn't guarantee durability past power // failures. fcntl(F_FULLFSYNC) is required for that purpose. Some // filesystems don't support fcntl(F_FULLFSYNC), and require a fallback to // fsync(). if (::fcntl(fd, F_FULLFSYNC) == 0) { return Status::OK(); } #endif // HAVE_FULLFSYNC #if HAVE_FDATASYNC bool sync_success = ::fdatasync(fd) == 0; #else bool sync_success = ::fsync(fd) == 0; #endif // HAVE_FDATASYNC if (sync_success) { return Status::OK(); } return PosixError(fd_path, errno); } // Returns the directory name in a path pointing to a file. // // Returns "." if the path does not contain any directory separator. static std::string Dirname(const std::string& filename) { std::string::size_type separator_pos = filename.rfind('/'); if (separator_pos == std::string::npos) { return std::string("."); } // The filename component should not contain a path separator. If it does, // the splitting was done incorrectly. assert(filename.find('/', separator_pos + 1) == std::string::npos); return filename.substr(0, separator_pos); } // Extracts the file name from a path pointing to a file. // // The returned Slice points to |filename|'s data buffer, so it is only valid // while |filename| is alive and unchanged. static Slice Basename(const std::string& filename) { std::string::size_type separator_pos = filename.rfind('/'); if (separator_pos == std::string::npos) { return Slice(filename); } // The filename component should not contain a path separator. If it does, // the splitting was done incorrectly. assert(filename.find('/', separator_pos + 1) == std::string::npos); return Slice(filename.data() + separator_pos + 1, filename.length() - separator_pos - 1); } // True if the given file is a manifest file. static bool IsManifest(const std::string& filename) { return Basename(filename).starts_with("MANIFEST"); } // buf_[0, pos_ - 1] contains data to be written to fd_. char buf_[kWritableFileBufferSize]; size_t pos_; int fd_; const bool is_manifest_; // True if the file's name starts with MANIFEST. const std::string filename_; const std::string dirname_; // The directory of filename_. }; int LockOrUnlock(int fd, bool lock) { errno = 0; struct ::flock file_lock_info; std::memset(&file_lock_info, 0, sizeof(file_lock_info)); file_lock_info.l_type = (lock ? F_WRLCK : F_UNLCK); file_lock_info.l_whence = SEEK_SET; file_lock_info.l_start = 0; file_lock_info.l_len = 0; // Lock/unlock entire file. return ::fcntl(fd, F_SETLK, &file_lock_info); } // Instances are thread-safe because they are immutable. class PosixFileLock : public FileLock { public: PosixFileLock(int fd, std::string filename) : fd_(fd), filename_(std::move(filename)) {} int fd() const { return fd_; } const std::string& filename() const { return filename_; } private: const int fd_; const std::string filename_; }; // Tracks the files locked by PosixEnv::LockFile(). // // We maintain a separate set instead of relying on fcntl(F_SETLK) because // fcntl(F_SETLK) does not provide any protection against multiple uses from the // same process. // // Instances are thread-safe because all member data is guarded by a mutex. class PosixLockTable { public: bool Insert(const std::string& fname) LOCKS_EXCLUDED(mu_) { mu_.Lock(); bool succeeded = locked_files_.insert(fname).second; mu_.Unlock(); return succeeded; } void Remove(const std::string& fname) LOCKS_EXCLUDED(mu_) { mu_.Lock(); locked_files_.erase(fname); mu_.Unlock(); } private: port::Mutex mu_; std::set<std::string> locked_files_ GUARDED_BY(mu_); }; class PosixEnv : public Env { public: PosixEnv(); ~PosixEnv() override { static const char msg[] = "PosixEnv singleton destroyed. Unsupported behavior!\n"; std::fwrite(msg, 1, sizeof(msg), stderr); std::abort(); } Status NewSequentialFile(const std::string& filename, SequentialFile** result) override { int fd = ::open(filename.c_str(), O_RDONLY | kOpenBaseFlags); if (fd < 0) { *result = nullptr; return PosixError(filename, errno); } *result = new PosixSequentialFile(filename, fd); return Status::OK(); } Status NewRandomAccessFile(const std::string& filename, RandomAccessFile** result) override { *result = nullptr; int fd = ::open(filename.c_str(), O_RDONLY | kOpenBaseFlags); if (fd < 0) { return PosixError(filename, errno); } if (!mmap_limiter_.Acquire()) { *result = new PosixRandomAccessFile(filename, fd, &fd_limiter_); return Status::OK(); } uint64_t file_size; Status status = GetFileSize(filename, &file_size); if (status.ok()) { void* mmap_base = ::mmap(/*addr=*/nullptr, file_size, PROT_READ, MAP_SHARED, fd, 0); if (mmap_base != MAP_FAILED) { *result = new PosixMmapReadableFile(filename, reinterpret_cast<char*>(mmap_base), file_size, &mmap_limiter_); } else { status = PosixError(filename, errno); } } ::close(fd); if (!status.ok()) { mmap_limiter_.Release(); } return status; } Status NewWritableFile(const std::string& filename, WritableFile** result) override { int fd = ::open(filename.c_str(), O_TRUNC | O_WRONLY | O_CREAT | kOpenBaseFlags, 0644); if (fd < 0) { *result = nullptr; return PosixError(filename, errno); } *result = new PosixWritableFile(filename, fd); return Status::OK(); } Status NewAppendableFile(const std::string& filename, WritableFile** result) override { int fd = ::open(filename.c_str(), O_APPEND | O_WRONLY | O_CREAT | kOpenBaseFlags, 0644); if (fd < 0) { *result = nullptr; return PosixError(filename, errno); } *result = new PosixWritableFile(filename, fd); return Status::OK(); } bool FileExists(const std::string& filename) override { return ::access(filename.c_str(), F_OK) == 0; } Status GetChildren(const std::string& directory_path, std::vector<std::string>* result) override { result->clear(); ::DIR* dir = ::opendir(directory_path.c_str()); if (dir == nullptr) { return PosixError(directory_path, errno); } struct ::dirent* entry; while ((entry = ::readdir(dir)) != nullptr) { result->emplace_back(entry->d_name); } ::closedir(dir); return Status::OK(); } Status RemoveFile(const std::string& filename) override { if (::unlink(filename.c_str()) != 0) { return PosixError(filename, errno); } return Status::OK(); } Status CreateDir(const std::string& dirname) override { if (::mkdir(dirname.c_str(), 0755) != 0) { return PosixError(dirname, errno); } return Status::OK(); } Status RemoveDir(const std::string& dirname) override { if (::rmdir(dirname.c_str()) != 0) { return PosixError(dirname, errno); } return Status::OK(); } Status GetFileSize(const std::string& filename, uint64_t* size) override { struct ::stat file_stat; if (::stat(filename.c_str(), &file_stat) != 0) { *size = 0; return PosixError(filename, errno); } *size = file_stat.st_size; return Status::OK(); } Status RenameFile(const std::string& from, const std::string& to) override { if (std::rename(from.c_str(), to.c_str()) != 0) { return PosixError(from, errno); } return Status::OK(); } Status LockFile(const std::string& filename, FileLock** lock) override { *lock = nullptr; int fd = ::open(filename.c_str(), O_RDWR | O_CREAT | kOpenBaseFlags, 0644); if (fd < 0) { return PosixError(filename, errno); } if (!locks_.Insert(filename)) { ::close(fd); return Status::IOError("lock " + filename, "already held by process"); } if (LockOrUnlock(fd, true) == -1) { int lock_errno = errno; ::close(fd); locks_.Remove(filename); return PosixError("lock " + filename, lock_errno); } *lock = new PosixFileLock(fd, filename); return Status::OK(); } Status UnlockFile(FileLock* lock) override { PosixFileLock* posix_file_lock = static_cast<PosixFileLock*>(lock); if (LockOrUnlock(posix_file_lock->fd(), false) == -1) { return PosixError("unlock " + posix_file_lock->filename(), errno); } locks_.Remove(posix_file_lock->filename()); ::close(posix_file_lock->fd()); delete posix_file_lock; return Status::OK(); } void Schedule(void (*background_work_function)(void* background_work_arg), void* background_work_arg) override; void StartThread(void (*thread_main)(void* thread_main_arg), void* thread_main_arg) override { std::thread new_thread(thread_main, thread_main_arg); new_thread.detach(); } Status GetTestDirectory(std::string* result) override { const char* env = std::getenv("TEST_TMPDIR"); if (env && env[0] != '\0') { *result = env; } else { char buf[100]; std::snprintf(buf, sizeof(buf), "/tmp/leveldbtest-%d", static_cast<int>(::geteuid())); *result = buf; } // The CreateDir status is ignored because the directory may already exist. CreateDir(*result); return Status::OK(); } Status NewLogger(const std::string& filename, Logger** result) override { int fd = ::open(filename.c_str(), O_APPEND | O_WRONLY | O_CREAT | kOpenBaseFlags, 0644); if (fd < 0) { *result = nullptr; return PosixError(filename, errno); } std::FILE* fp = ::fdopen(fd, "w"); if (fp == nullptr) { ::close(fd); *result = nullptr; return PosixError(filename, errno); } else { *result = new PosixLogger(fp); return Status::OK(); } } uint64_t NowMicros() override { static constexpr uint64_t kUsecondsPerSecond = 1000000; struct ::timeval tv; ::gettimeofday(&tv, nullptr); return static_cast<uint64_t>(tv.tv_sec) * kUsecondsPerSecond + tv.tv_usec; } void SleepForMicroseconds(int micros) override { std::this_thread::sleep_for(std::chrono::microseconds(micros)); } private: void BackgroundThreadMain(); static void BackgroundThreadEntryPoint(PosixEnv* env) { env->BackgroundThreadMain(); } // Stores the work item data in a Schedule() call. // // Instances are constructed on the thread calling Schedule() and used on the // background thread. // // This structure is thread-safe because it is immutable. struct BackgroundWorkItem { explicit BackgroundWorkItem(void (*function)(void* arg), void* arg) : function(function), arg(arg) {} void (*const function)(void*); void* const arg; }; port::Mutex background_work_mutex_; port::CondVar background_work_cv_ GUARDED_BY(background_work_mutex_); bool started_background_thread_ GUARDED_BY(background_work_mutex_); std::queue<BackgroundWorkItem> background_work_queue_ GUARDED_BY(background_work_mutex_); PosixLockTable locks_; // Thread-safe. Limiter mmap_limiter_; // Thread-safe. Limiter fd_limiter_; // Thread-safe. }; // Return the maximum number of concurrent mmaps. int MaxMmaps() { return g_mmap_limit; } // Return the maximum number of read-only files to keep open. int MaxOpenFiles() { if (g_open_read_only_file_limit >= 0) { return g_open_read_only_file_limit; } #ifdef __Fuchsia__ // Fuchsia doesn't implement getrlimit. g_open_read_only_file_limit = 50; #else struct ::rlimit rlim; if (::getrlimit(RLIMIT_NOFILE, &rlim)) { // getrlimit failed, fallback to hard-coded default. g_open_read_only_file_limit = 50; } else if (rlim.rlim_cur == RLIM_INFINITY) { g_open_read_only_file_limit = std::numeric_limits<int>::max(); } else { // Allow use of 20% of available file descriptors for read-only files. g_open_read_only_file_limit = rlim.rlim_cur / 5; } #endif return g_open_read_only_file_limit; } } // namespace PosixEnv::PosixEnv() : background_work_cv_(&background_work_mutex_), started_background_thread_(false), mmap_limiter_(MaxMmaps()), fd_limiter_(MaxOpenFiles()) {} void PosixEnv::Schedule( void (*background_work_function)(void* background_work_arg), void* background_work_arg) { background_work_mutex_.Lock(); // Start the background thread, if we haven't done so already. if (!started_background_thread_) { started_background_thread_ = true; std::thread background_thread(PosixEnv::BackgroundThreadEntryPoint, this); background_thread.detach(); } // If the queue is empty, the background thread may be waiting for work. if (background_work_queue_.empty()) { background_work_cv_.Signal(); } background_work_queue_.emplace(background_work_function, background_work_arg); background_work_mutex_.Unlock(); } void PosixEnv::BackgroundThreadMain() { while (true) { background_work_mutex_.Lock(); // Wait until there is work to be done. while (background_work_queue_.empty()) { background_work_cv_.Wait(); } assert(!background_work_queue_.empty()); auto background_work_function = background_work_queue_.front().function; void* background_work_arg = background_work_queue_.front().arg; background_work_queue_.pop(); background_work_mutex_.Unlock(); background_work_function(background_work_arg); } } namespace { // Wraps an Env instance whose destructor is never created. // // Intended usage: // using PlatformSingletonEnv = SingletonEnv<PlatformEnv>; // void ConfigurePosixEnv(int param) { // PlatformSingletonEnv::AssertEnvNotInitialized(); // // set global configuration flags. // } // Env* Env::Default() { // static PlatformSingletonEnv default_env; // return default_env.env(); // } template <typename EnvType> class SingletonEnv { public: SingletonEnv() { #if !defined(NDEBUG) env_initialized_.store(true, std::memory_order_relaxed); #endif // !defined(NDEBUG) static_assert(sizeof(env_storage_) >= sizeof(EnvType), "env_storage_ will not fit the Env"); static_assert(alignof(decltype(env_storage_)) >= alignof(EnvType), "env_storage_ does not meet the Env's alignment needs"); new (&env_storage_) EnvType(); } ~SingletonEnv() = default; SingletonEnv(const SingletonEnv&) = delete; SingletonEnv& operator=(const SingletonEnv&) = delete; Env* env() { return reinterpret_cast<Env*>(&env_storage_); } static void AssertEnvNotInitialized() { #if !defined(NDEBUG) assert(!env_initialized_.load(std::memory_order_relaxed)); #endif // !defined(NDEBUG) } private: typename std::aligned_storage<sizeof(EnvType), alignof(EnvType)>::type env_storage_; #if !defined(NDEBUG) static std::atomic<bool> env_initialized_; #endif // !defined(NDEBUG) }; #if !defined(NDEBUG) template <typename EnvType> std::atomic<bool> SingletonEnv<EnvType>::env_initialized_; #endif // !defined(NDEBUG) using PosixDefaultEnv = SingletonEnv<PosixEnv>; } // namespace void EnvPosixTestHelper::SetReadOnlyFDLimit(int limit) { PosixDefaultEnv::AssertEnvNotInitialized(); g_open_read_only_file_limit = limit; } void EnvPosixTestHelper::SetReadOnlyMMapLimit(int limit) { PosixDefaultEnv::AssertEnvNotInitialized(); g_mmap_limit = limit; } Env* Env::Default() { static PosixDefaultEnv env_container; return env_container.env(); } } // namespace leveldb
; A212343: a(n) = (n+1)*(n-2)*(n-3)/2. ; 0,0,5,18,42,80,135,210,308,432,585,770,990,1248,1547,1890,2280,2720,3213,3762,4370,5040,5775,6578,7452,8400,9425,10530,11718,12992,14355,15810,17360,19008,20757,22610,24570,26640,28823,31122,33540,36080,38745,41538,44462,47520,50715,54050,57528,61152,64925,68850,72930,77168,81567,86130,90860,95760,100833,106082,111510,117120,122915,128898,135072,141440,148005,154770,161738,168912,176295,183890,191700,199728,207977,216450,225150,234080,243243,252642,262280,272160,282285,292658,303282,314160,325295,336690,348348,360272,372465,384930,397670,410688,423987,437570,451440,465600,480053,494802,509850,525200,540855,556818,573092,589680,606585,623810,641358,659232,677435,695970,714840,734048,753597,773490,793730,814320,835263,856562,878220,900240,922625,945378,968502,992000,1015875,1040130,1064768,1089792,1115205,1141010,1167210,1193808,1220807,1248210,1276020,1304240,1332873,1361922,1391390,1421280,1451595,1482338,1513512,1545120,1577165,1609650,1642578,1675952,1709775,1744050,1778780,1813968,1849617,1885730,1922310,1959360,1996883,2034882,2073360,2112320,2151765,2191698,2232122,2273040,2314455,2356370,2398788,2441712,2485145,2529090,2573550,2618528,2664027,2710050,2756600,2803680,2851293,2899442,2948130,2997360,3047135,3097458,3148332,3199760,3251745,3304290,3357398,3411072,3465315,3520130,3575520,3631488,3688037,3745170,3802890,3861200,3920103,3979602,4039700,4100400,4161705,4223618,4286142,4349280,4413035,4477410,4542408,4608032,4674285,4741170,4808690,4876848,4945647,5015090,5085180,5155920,5227313,5299362,5372070,5445440,5519475,5594178,5669552,5745600,5822325,5899730,5977818,6056592,6136055,6216210,6297060,6378608,6460857,6543810,6627470,6711840,6796923,6882722,6969240,7056480,7144445,7233138,7322562,7412720,7503615,7595250,7687628,7780752 mov $1,$0 add $0,3 bin $1,2 mul $1,$0
.global s_prepare_buffers s_prepare_buffers: push %r11 push %r12 push %r14 push %r8 push %rax push %rcx push %rdi push %rsi lea addresses_WT_ht+0xe370, %r14 add %rax, %rax movw $0x6162, (%r14) nop nop xor $62202, %r8 lea addresses_UC_ht+0x10c70, %rsi lea addresses_WT_ht+0xbe10, %rdi nop nop nop add %r11, %r11 mov $97, %rcx rep movsw add $24904, %rax lea addresses_normal_ht+0x16c38, %rdi nop nop add %rax, %rax movb $0x61, (%rdi) nop nop nop nop and %r12, %r12 lea addresses_WC_ht+0x4af0, %rcx clflush (%rcx) add %r14, %r14 movb $0x61, (%rcx) nop nop add %rdi, %rdi lea addresses_D_ht+0xeaf0, %r11 nop nop nop nop cmp $62491, %r12 vmovups (%r11), %ymm5 vextracti128 $1, %ymm5, %xmm5 vpextrq $0, %xmm5, %rdi xor $4648, %r11 lea addresses_A_ht+0x4970, %rsi lea addresses_normal_ht+0x1b630, %rdi nop cmp $11154, %rax mov $95, %rcx rep movsq nop nop nop nop cmp %rcx, %rcx pop %rsi pop %rdi pop %rcx pop %rax pop %r8 pop %r14 pop %r12 pop %r11 ret .global s_faulty_load s_faulty_load: push %r11 push %r15 push %r8 push %r9 push %rbx push %rcx push %rsi // Store lea addresses_A+0x1b70, %r9 nop nop nop nop nop add %rcx, %rcx mov $0x5152535455565758, %rbx movq %rbx, %xmm3 vmovups %ymm3, (%r9) nop nop add $31991, %rcx // Faulty Load lea addresses_A+0x1b70, %rsi nop nop cmp $18616, %r8 vmovups (%rsi), %ymm7 vextracti128 $1, %ymm7, %xmm7 vpextrq $0, %xmm7, %rbx lea oracles, %r11 and $0xff, %rbx shlq $12, %rbx mov (%r11,%rbx,1), %rbx pop %rsi pop %rcx pop %rbx pop %r9 pop %r8 pop %r15 pop %r11 ret /* <gen_faulty_load> [REF] {'src': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_A', 'size': 16, 'AVXalign': False}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_A', 'size': 32, 'AVXalign': False}} [Faulty Load] {'src': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_A', 'size': 32, 'AVXalign': False}, 'OP': 'LOAD'} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'same': False, 'congruent': 9, 'NT': False, 'type': 'addresses_WT_ht', 'size': 2, 'AVXalign': False}} {'src': {'type': 'addresses_UC_ht', 'congruent': 5, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WT_ht', 'congruent': 2, 'same': False}} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 3, 'NT': False, 'type': 'addresses_normal_ht', 'size': 1, 'AVXalign': True}} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 7, 'NT': False, 'type': 'addresses_WC_ht', 'size': 1, 'AVXalign': False}} {'src': {'same': False, 'congruent': 6, 'NT': False, 'type': 'addresses_D_ht', 'size': 32, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_A_ht', 'congruent': 6, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_normal_ht', 'congruent': 6, '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 */
#ifdef _WIN32 #define _CRT_SECURE_NO_DEPRECATE #endif #include "OpenCLInfo.h" #include <iostream> #include <fstream> #include <string.h> #include "OpenCLUtils.h" using namespace std; static void print_data_type(cl_channel_type type, ostream& log) { switch(type) { case CL_SNORM_INT8: log << "CL_SNORM_INT8"; break; case CL_SNORM_INT16: log << "CL_SNORM_INT16"; break; case CL_UNORM_INT8: log << "CL_UNORM_INT8"; break; case CL_UNORM_INT16: log << "CL_UNORM_INT16"; break; case CL_UNORM_SHORT_565: log << "CL_UNORM_SHORT_565"; break; case CL_UNORM_SHORT_555: log << "CL_UNORM_SHORT_555"; break; case CL_UNORM_INT_101010: log << "CL_UNORM_INT_101010"; break; case CL_SIGNED_INT8: log << "CL_SIGNED_INT8"; break; case CL_SIGNED_INT16: log << "CL_SIGNED_INT16"; break; case CL_SIGNED_INT32: log << "CL_SIGNED_INT32"; break; case CL_UNSIGNED_INT8: log << "CL_UNSIGNED_INT8"; break; case CL_UNSIGNED_INT16: log << "CL_UNSIGNED_INT16"; break; case CL_UNSIGNED_INT32: log << "CL_UNSIGNED_INT32"; break; case CL_HALF_FLOAT: log << "CL_HALF_FLOAT"; break; case CL_FLOAT: log << "CL_FLOAT"; break; case CL_UNORM_INT24: log << "CL_UNORM_INT24"; break; default: log << "unknown"; break; } } static void print_channel_order(cl_channel_order order, ostream& log) { switch(order) { case CL_R: log << "CL_R"; break; case CL_A: log << "CL_A"; break; case CL_RG: log << "CL_RG"; break; case CL_RA: log << "CL_RA"; break; case CL_RGB: log << "CL_RGB"; break; case CL_RGBA: log << "CL_RGBA"; break; case CL_BGRA: log << "CL_BGRA"; break; case CL_ARGB: log << "CL_ARGB"; break; case CL_INTENSITY: log << "CL_INTENSITY"; break; case CL_LUMINANCE: log << "CL_LUMINANCE"; break; case CL_Rx: log << "CL_Rx"; break; case CL_RGx: log << "CL_RGx"; break; case CL_RGBx: log << "CL_RGBx"; break; case CL_DEPTH: log << "CL_DEPTH"; break; case CL_DEPTH_STENCIL: log << "CL_DEPTH_STENCIL"; break; default: log << "unknown"; break; } } void OpenCLInfo::printInfo(cl_context context, cl_device_id device) { streambuf *buf; ofstream of; of.open("OpenCL-log.txt"); bool log_to_file = false; if(of.is_open()) { buf = of.rdbuf(); log_to_file = true; } else { buf = cout.rdbuf(); } ostream log(buf); char valueString[1024]; memset(valueString, 0, 1024); cl_bool valueBool; cl_ulong valueULong; cl_uint valueUInt; size_t valueSize; size_t size_ret; cl_int err; err = clGetDeviceInfo(device, CL_DEVICE_AVAILABLE, sizeof(valueBool), &valueBool, &size_ret); if(err != CL_SUCCESS) log << "Unable to query CL_DEVICE_AVAILABLE" << endl; else log << "CL_DEVICE_AVAILABLE: " << valueBool << endl; if(valueBool == CL_FALSE) clwarning("\nNo OpenCL enabled GPU device available (CL_DEVICE_AVAILABLE = CL_FALSE)\nPlease make sure the newest graphics drivers are installed.\n"); err = clGetDeviceInfo(device, CL_DEVICE_COMPILER_AVAILABLE, sizeof(valueBool), &valueBool, &size_ret); if(err != CL_SUCCESS) log << "Unable to query CL_DEVICE_COMPILER_AVAILABLE" << endl; else log << "CL_DEVICE_COMPILER_AVAILABLE: " << valueBool << endl; if(valueBool == CL_FALSE) clwarning("\nOpenCL does not support compilation (CL_DEVICE_COMPILER_AVAILABLE = CL_FALSE)\nPlease make sure the newest graphics drivers are installed.\n"); err = clGetDeviceInfo(device, CL_DEVICE_ENDIAN_LITTLE, sizeof(valueBool), &valueBool, &size_ret); if(err != CL_SUCCESS) log << "Unable to query CL_DEVICE_ENDIAN_LITTLE" << endl; else log << "CL_DEVICE_ENDIAN_LITTLE: " << valueBool << endl; err = clGetDeviceInfo(device, CL_DEVICE_EXTENSIONS, sizeof(valueString), &valueString, &size_ret); if(err != CL_SUCCESS) log << "Unable to query CL_DEVICE_EXTENSIONS" << endl; else log << "CL_DEVICE_EXTENSIONS: " << valueString << endl; err = clGetDeviceInfo(device, CL_DEVICE_GLOBAL_MEM_SIZE, sizeof(valueULong), &valueULong, &size_ret); if(err != CL_SUCCESS) log << "Unable to query CL_DEVICE_GLOBAL_MEM_SIZE err = " << err << endl; else log << "CL_DEVICE_GLOBAL_MEM_SIZE: " << valueULong << endl; err = clGetDeviceInfo(device, CL_DEVICE_IMAGE_SUPPORT, sizeof(valueBool), &valueBool, &size_ret); if(err != CL_SUCCESS) log << "Unable to query CL_DEVICE_IMAGE_SUPPORT" << endl; else log << "CL_DEVICE_IMAGE_SUPPORT: " << valueBool << endl; if(valueBool == CL_FALSE) clwarning("\nOpenCL does not support images (CL_DEVICE_IMAGE_SUPPORT = CL_FALSE)\nPlease make sure the newest graphics drivers are installed.\n"); err = clGetDeviceInfo(device, CL_DEVICE_IMAGE2D_MAX_HEIGHT, sizeof(valueSize), &valueSize, &size_ret); if(err != CL_SUCCESS) log << "Unable to query CL_DEVICE_IMAGE2D_MAX_HEIGHT" << endl; else log << "CL_DEVICE_IMAGE2D_MAX_HEIGHT: " << valueSize << endl; err = clGetDeviceInfo(device, CL_DEVICE_IMAGE2D_MAX_WIDTH, sizeof(valueSize), &valueSize, &size_ret); if(err != CL_SUCCESS) log << "Unable to query CL_DEVICE_IMAGE2D_MAX_WIDTH" << endl; else log << "CL_DEVICE_IMAGE2D_MAX_WIDTH: " << valueSize << endl; err = clGetDeviceInfo(device, CL_DEVICE_IMAGE3D_MAX_DEPTH, sizeof(valueSize), &valueSize, &size_ret); if(err != CL_SUCCESS) log << "Unable to query CL_DEVICE_IMAGE3D_MAX_DEPTH" << endl; else log << "CL_DEVICE_IMAGE3D_MAX_DEPTH: " << valueSize << endl; err = clGetDeviceInfo(device, CL_DEVICE_IMAGE3D_MAX_HEIGHT, sizeof(valueSize), &valueSize, &size_ret); if(err != CL_SUCCESS) log << "Unable to query CL_DEVICE_IMAGE3D_MAX_HEIGHT" << endl; else log << "CL_DEVICE_IMAGE3D_MAX_HEIGHT: " << valueSize << endl; err = clGetDeviceInfo(device, CL_DEVICE_IMAGE3D_MAX_WIDTH, sizeof(valueSize), &valueSize, &size_ret); if(err != CL_SUCCESS) log << "Unable to query CL_DEVICE_IMAGE3D_MAX_WIDTH" << endl; else log << "CL_DEVICE_IMAGE3D_MAX_WIDTH: " << valueSize << endl; err = clGetDeviceInfo(device, CL_DEVICE_LOCAL_MEM_SIZE, sizeof(valueULong), &valueULong, &size_ret); if(err != CL_SUCCESS) log << "Unable to query CL_DEVICE_LOCAL_MEM_SIZE" << endl; else log << "CL_DEVICE_LOCAL_MEM_SIZE: " << valueULong << endl; err = clGetDeviceInfo(device, CL_DEVICE_MAX_COMPUTE_UNITS, sizeof(valueUInt), &valueUInt, &size_ret); if(err != CL_SUCCESS) log << "Unable to query CL_DEVICE_MAX_COMPUTE_UNITS" << endl; else log << "CL_DEVICE_MAX_COMPUTE_UNITS: " << valueUInt << endl; err = clGetDeviceInfo(device, CL_DEVICE_MAX_MEM_ALLOC_SIZE, sizeof(valueULong), &valueULong, &size_ret); if(err != CL_SUCCESS) log << "Unable to query CL_DEVICE_MAX_MEM_ALLOC_SIZE" << endl; else log << "CL_DEVICE_MAX_MEM_ALLOC_SIZE: " << valueULong << endl; err = clGetDeviceInfo(device, CL_DEVICE_MAX_SAMPLERS, sizeof(valueUInt), &valueUInt, &size_ret); if(err != CL_SUCCESS) log << "Unable to query CL_DEVICE_MAX_SAMPLERS" << endl; else log << "CL_DEVICE_MAX_SAMPLERS: " << valueUInt << endl; err = clGetDeviceInfo(device, CL_DEVICE_MAX_WORK_GROUP_SIZE, sizeof(valueSize), &valueSize, &size_ret); if(err != CL_SUCCESS) log << "Unable to query CL_DEVICE_MAX_WORK_GROUP_SIZE" << endl; else log << "CL_DEVICE_MAX_WORK_GROUP_SIZE: " << valueSize << endl; err = clGetDeviceInfo(device, CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS, sizeof(valueUInt), &valueUInt, &size_ret); if(err != CL_SUCCESS) log << "Unable to query CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS" << endl; else log << "CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS: " << valueUInt << endl; size_t *wis = new size_t[valueUInt]; err = clGetDeviceInfo(device, CL_DEVICE_MAX_WORK_ITEM_SIZES, valueUInt * sizeof(size_t), wis, &size_ret); if(err != CL_SUCCESS) log << "Unable to query CL_DEVICE_MAX_WORK_ITEM_SIZES" << endl; else { for(unsigned int i = 0; i < valueUInt; i++) log << "CL_DEVICE_MAX_WORK_ITEM_SIZES[" << i << "]: " << wis[i] << endl; } delete[] wis; memset(valueString, 0, 1024); err = clGetDeviceInfo(device, CL_DEVICE_NAME, sizeof(valueString), &valueString, &size_ret); if(err != CL_SUCCESS) log << "Unable to query CL_DEVICE_NAME" << endl; else log << "CL_DEVICE_NAME:" << valueString << endl; memset(valueString, 0, 1024); err = clGetDeviceInfo(device, CL_DEVICE_PROFILE, sizeof(valueString), &valueString, &size_ret); if(err != CL_SUCCESS) log << "Unable to query CL_DEVICE_PROFILE" << endl; else log << "CL_DEVICE_PROFILE:" << valueString << endl; cl_device_type type; err = clGetDeviceInfo(device, CL_DEVICE_TYPE, sizeof(type), &type, &size_ret); if(err != CL_SUCCESS) log << "Unable to query CL_DEVICE_TYPE" << endl; else { if(type == CL_DEVICE_TYPE_GPU) log << "CL_DEVICE_TYPE: " << valueString << endl; else { log << "CL_DEVICE_TYPE is NOT GPU" << endl; clwarning("\nNo GPU device (CL_DEVICE_TYPE != CL_DEVICE_TYPE_GPU)\nPlease make sure the newest graphics drivers are installed.\n"); } } memset(valueString, 0, 1024); err = clGetDeviceInfo(device, CL_DEVICE_VENDOR, sizeof(valueString), &valueString, &size_ret); if(err != CL_SUCCESS) log << "Unable to query CL_DEVICE_VENDOR" << endl; else log << "CL_DEVICE_VENDOR: " << valueString << endl; memset(valueString, 0, 1024); err = clGetDeviceInfo(device, CL_DEVICE_VERSION, sizeof(valueString), &valueString, &size_ret); if(err != CL_SUCCESS) log << "Unable to query CL_DEVICE_VERSION" << endl; else { log << "CL_DEVICE_VERSION: " << valueString << endl; char majorstr[2]; char minorstr[2]; majorstr[0] = valueString[7]; majorstr[1] = '\0'; minorstr[0] = valueString[9]; minorstr[1] = '\0'; int major = atoi(majorstr); int minor = atoi(minorstr); if(major < 1 || (major < 2 && minor < 2)) { clwarning("\nAt least OpenCL 1.2 is required.\nPlease make sure the newest graphics drivers are installed.\n"); } } memset(valueString, 0, 1024); err = clGetDeviceInfo(device, CL_DRIVER_VERSION, sizeof(valueString), &valueString, &size_ret); if(err != CL_SUCCESS) log << "Unable to query CL_DRIVER_VERSION" << endl; else log << "CL_DRIVER_VERSION: " << valueString << endl; cl_image_format supported_formats[100]; cl_uint n_formats; /* This is for the input volume */ cl_mem_object_type image_type = CL_MEM_OBJECT_IMAGE3D; cl_mem_flags flags = CL_MEM_READ_WRITE; err = clGetSupportedImageFormats (context, flags, image_type, 100, supported_formats, &n_formats); bool found8 = false; bool found16 = false; bool found = false; log << "Supported formats: " << endl; for(unsigned int i = 0; i < n_formats; i++) { cl_image_format f = supported_formats[i]; print_channel_order(f.image_channel_order, log); log << ", "; print_data_type(f.image_channel_data_type, log); log << endl; if(f.image_channel_order == CL_R && f.image_channel_data_type == CL_UNORM_INT8) found8 = true; if(f.image_channel_order == CL_R && f.image_channel_data_type == CL_UNORM_INT16) found16 = true; if(f.image_channel_order == CL_RGBA && f.image_channel_data_type == CL_SIGNED_INT8) found = true; } if(!found8) { log << "8-bit image format not supported by your OpenCL implementation" << endl; clwarning("\n8-bit image format is not supported by your OpenCL implementation.\nPlease make sure the newest graphics drivers are installed.\n"); } else log << "8-bit image format supported by your OpenCL implementation" << endl; if(!found16) { log << "16-bit image format not supported by your OpenCL implementation" << endl; clwarning("\n16-bit image format is not supported by your OpenCL implementation.\nPlease make sure the newest graphics drivers are installed.\n"); } else log << "16-bit image format supported by your OpenCL implementation" << endl; if(!found) { log << "Signed int8 RGBA image format not supported by your OpenCL implementation" << endl; clwarning("\nSigned int8 RGBA image format is not supported by your OpenCL implementation.\nPlease make sure the newest graphics drivers are installed.\n"); } else log << "Signed int8 RGBA image format supported by your OpenCL implementation" << endl; if(log_to_file) of.close(); }
SSAnne3_h: db SHIP ; tileset db SS_ANNE_3_HEIGHT, SS_ANNE_3_WIDTH ; dimensions (y, x) dw SSAnne3Blocks, SSAnne3TextPointers, SSAnne3Script ; blocks, texts, scripts db $00 ; connections dw SSAnne3Object ; objects
; A130759: Partial sums of A130707. ; 1,3,5,7,11,21,43,87,173,343,683,1365,2731,5463,10925,21847,43691,87381,174763,349527,699053,1398103,2796203,5592405,11184811,22369623,44739245,89478487,178956971,357913941,715827883,1431655767,2863311533 mov $2,1 mov $3,2 lpb $0 sub $0,1 add $1,$3 mul $2,2 add $3,$2 sub $3,$1 lpe add $1,1 mov $0,$1
//===================================================================== // Copyright 2019 (c), Advanced Micro Devices, Inc. All rights reserved. // // 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 "cmp_math_common.h" #include "cmp_math_cpuid.h" #ifndef ASPM_GPU void cpuid(int cpuInfo[4], int function_id) { // subfunction_id = 0 #ifdef _WIN32 __cpuidex(cpuInfo, function_id, 0); #else // To Do //__cpuid_count(0, function_id, cpuInfo[0], cpuInfo[1], cpuInfo[2], cpuInfo[3]); #endif } cmp_cpufeatures cmp_get_cpufeatures() { unsigned int maxInfoType; cmp_cpufeatures cpu; int cpuInfo[4], i; // Clear the feature list for (i = 0; i<SSP_SSE_COUNT; ++i) { cpu.feature[i] = 0; } #ifndef _LINUX cpuid(cpuInfo,0); int nIds = cpuInfo[0]; if (nIds >= 0x00000001) { cpuid(cpuInfo, 0x00000001); cpu.feature[SSP_SSE3] = (cpuInfo[2] & CMP_CPU_SSE3); cpu.feature[SSP_SSSE3] = (cpuInfo[2] & CMP_CPU_SSSE3); cpu.feature[SSP_SSE4_1] = (cpuInfo[2] & CMP_CPU_SSE41); cpu.feature[SSP_SSE4_2] = (cpuInfo[2] & CMP_CPU_SSE42); // (cpuInfo[2] & CMP_CPU_AES ); // (cpuInfo[2] & CMP_CPU_AVX ); // also check for fma4 features cpu.feature[SSP_FMA3] = (cpuInfo[2] & CMP_CPU_FMA3); // (cpuInfo[2] & CMP_CPU_RDRAND); cpu.feature[SSP_SSE] = (cpuInfo[3] & CMP_CPU_SSE); cpu.feature[SSP_SSE2] = (cpuInfo[3] & CMP_CPU_SSE2); // (cpuInfo[3] & CMP_CPU_MMX ); } //if (nIds >= 0x00000007) //{ // cpuid(cpuInfo,0x00000007); // (cpuInfo[1] & CMP_CPU_AVX2 ); // (cpuInfo[1] & CMP_CPU_BMI1 ); // (cpuInfo[1] & CMP_CPU_BMI2 ); // (cpuInfo[1] & CMP_CPU_ADX ); // (cpuInfo[1] & CMP_CPU_MPX ); // (cpuInfo[1] & CMP_CPU_SHA ); // (cpuInfo[1] & CMP_CPU_AVX512_F ); // (cpuInfo[1] & CMP_CPU_AVX512_CD ); // (cpuInfo[1] & CMP_CPU_AVX512_PF ); // (cpuInfo[1] & CMP_CPU_AVX512_ER ); // (cpuInfo[1] & CMP_CPU_AVX512_VL ); // (cpuInfo[1] & CMP_CPU_AVX512_BW ); // (cpuInfo[1] & CMP_CPU_AVX512_DQ ); // (cpuInfo[1] & CMP_CPU_AVX512_IFMA); // (cpuInfo[2] & CMP_CPU_AVX512_VBMI); // (cpuInfo[2] & CMP_CPU_PREFETCHWT1); // //} cpuid(cpuInfo,0x80000000); maxInfoType = cpuInfo[0]; if (maxInfoType >= 0x80000001) { cpuid(cpuInfo, 0x80000001); cpu.feature[SSP_SSE4a] = (cpuInfo[2] & CMP_CPU_SSE4a); cpu.feature[SSP_SSE5] = (cpuInfo[2] & CMP_CPU_XOP); // (cpuInfo[3] & CMP_CPU_x64); // (cpuInfo[2] & CMP_CPU_ABM); // (cpuInfo[2] & CMP_CPU_FMA4); cpu.x64 = (cpuInfo[3] & CMP_CPU_x64) > 0; } #endif return cpu; } void cmp_autodected_cpufeatures(CMP_MATH_BYTE set) { // Determine which features are available cmp_cpufeatures cpu = cmp_get_cpufeatures(); // Default: features always set to CPU cmp_set_cpu_features(); // User requested to use only CPU if ((set & CMP_MATH_USE_CPU) > 0) return; #ifndef _LINUX // Auto detect CPU features to enable for (int i = 0; i<SSP_SSE_COUNT; i++) { if (cpu.feature[i] > 0) { switch (i) { // Enable SSE features case SSP_SSE2: case SSP_SSE: { if ((set == CMP_MATH_USE_AUTO) || (set == CMP_MATH_USE_HPC)) cmp_set_sse2_features(); break; } case SSP_FMA3: { if ((set == CMP_MATH_USE_AUTO) || (set == CMP_MATH_USE_HPC)) cmp_set_fma3_features(); break; } } } } #endif } //} #else // ToDO: OpenCL supported code here #endif // not def OpenCL
.global s_prepare_buffers s_prepare_buffers: push %r13 push %r14 push %r15 push %r8 push %rbx push %rcx push %rdi push %rsi lea addresses_D_ht+0x31be, %rcx nop nop nop nop and %rdi, %rdi movw $0x6162, (%rcx) nop nop nop add $56683, %r15 lea addresses_D_ht+0x1e1e6, %rbx nop nop nop nop xor $3838, %r13 movw $0x6162, (%rbx) nop nop nop and %r15, %r15 lea addresses_A_ht+0x181e6, %rsi lea addresses_WC_ht+0x1d476, %rdi clflush (%rsi) nop nop xor $13206, %r8 mov $20, %rcx rep movsq nop nop sub $62473, %rsi lea addresses_D_ht+0x62e6, %rdi clflush (%rdi) nop nop nop nop add $25834, %rsi mov (%rdi), %r13 nop nop nop nop nop xor $13091, %rdi lea addresses_A_ht+0x142d6, %rsi lea addresses_A_ht+0x38b2, %rdi nop nop nop nop sub $16442, %r13 mov $99, %rcx rep movsb nop nop nop nop nop cmp $17428, %rcx lea addresses_WC_ht+0x1db27, %rsi lea addresses_UC_ht+0x98f2, %rdi inc %r15 mov $1, %rcx rep movsb dec %rdi lea addresses_UC_ht+0xc248, %r15 nop cmp $59741, %rdi movw $0x6162, (%r15) nop nop nop nop inc %r8 lea addresses_A_ht+0xaee6, %rsi lea addresses_WT_ht+0xbc26, %rdi nop nop add $14579, %r15 mov $41, %rcx rep movsl nop nop nop nop nop xor $52864, %r15 lea addresses_normal_ht+0x15f66, %rsi lea addresses_D_ht+0x1d766, %rdi nop nop nop xor $18129, %r13 mov $27, %rcx rep movsl nop nop nop nop sub $62750, %rsi lea addresses_A_ht+0x142e6, %rsi lea addresses_normal_ht+0x198e6, %rdi clflush (%rsi) nop nop xor $37983, %r15 mov $106, %rcx rep movsl nop nop add $30488, %r8 lea addresses_normal_ht+0x16ae6, %rsi lea addresses_UC_ht+0xaaa2, %rdi clflush (%rdi) add %r15, %r15 mov $89, %rcx rep movsl nop nop nop nop cmp $3866, %rdi lea addresses_D_ht+0x10ae6, %rsi lea addresses_A_ht+0x10166, %rdi xor $47020, %r8 mov $71, %rcx rep movsq nop nop add %rsi, %rsi lea addresses_normal_ht+0xee6, %rsi lea addresses_WT_ht+0xa5e6, %rdi nop nop nop nop sub $24868, %r8 mov $2, %rcx rep movsl nop nop nop dec %rbx pop %rsi pop %rdi pop %rcx pop %rbx pop %r8 pop %r15 pop %r14 pop %r13 ret .global s_faulty_load s_faulty_load: push %r10 push %r12 push %r15 push %rax push %rcx push %rdi // Faulty Load lea addresses_A+0xeae6, %rcx nop cmp %rax, %rax movb (%rcx), %r15b lea oracles, %rax and $0xff, %r15 shlq $12, %r15 mov (%rax,%r15,1), %r15 pop %rdi pop %rcx pop %rax pop %r15 pop %r12 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_A', 'same': False, 'size': 16, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} [Faulty Load] {'src': {'type': 'addresses_A', 'same': True, 'size': 1, 'congruent': 0, 'NT': False, 'AVXalign': True}, 'OP': 'LOAD'} <gen_prepare_buffer> {'dst': {'type': 'addresses_D_ht', 'same': True, 'size': 2, 'congruent': 2, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'dst': {'type': 'addresses_D_ht', 'same': False, 'size': 2, 'congruent': 8, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'src': {'type': 'addresses_A_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 4, 'same': False}, 'OP': 'REPM'} {'src': {'type': 'addresses_D_ht', 'same': False, 'size': 8, 'congruent': 11, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_A_ht', 'congruent': 2, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 1, 'same': False}, 'OP': 'REPM'} {'src': {'type': 'addresses_WC_ht', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 2, 'same': True}, 'OP': 'REPM'} {'dst': {'type': 'addresses_UC_ht', 'same': False, 'size': 2, 'congruent': 1, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'src': {'type': 'addresses_A_ht', 'congruent': 9, 'same': True}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 3, 'same': False}, 'OP': 'REPM'} {'src': {'type': 'addresses_normal_ht', 'congruent': 2, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 3, 'same': False}, 'OP': 'REPM'} {'src': {'type': 'addresses_A_ht', 'congruent': 11, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 8, 'same': False}, 'OP': 'REPM'} {'src': {'type': 'addresses_normal_ht', 'congruent': 11, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 1, 'same': False}, 'OP': 'REPM'} {'src': {'type': 'addresses_D_ht', 'congruent': 11, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 6, 'same': False}, 'OP': 'REPM'} {'src': {'type': 'addresses_normal_ht', 'congruent': 10, 'same': True}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 8, 'same': False}, 'OP': 'REPM'} {'35': 21829} 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 */
// // Serializer.cpp // // $Id: //poco/1.4/JS/Bridge/src/Serializer.cpp#6 $ // // Library: JSBridge // Package: Bridge // Module: Serializer // // Copyright (c) 2013-2014, Applied Informatics Software Engineering GmbH. // All rights reserved. // // SPDX-License-Identifier: Apache-2.0 // #include "Poco/JS/Bridge/Serializer.h" #include "Poco/JS/Core/BufferWrapper.h" namespace Poco { namespace JS { namespace Bridge { Serializer::Serializer(v8::Isolate* pIsolate): _pIsolate(pIsolate), _pException(0), _totalSerialized(0) { } Serializer::~Serializer() { delete _pException; } void Serializer::serializeMessageBegin(const std::string& name, SerializerBase::MessageType /*type*/) { _messageName = name; _jsObjectStack.push_back(v8::Object::New(_pIsolate)); _jsIndexStack.push_back(-1); } void Serializer::serializeMessageEnd(const std::string& /*name*/, SerializerBase::MessageType /*type*/) { } void Serializer::serializeFaultMessage(const std::string& name, Poco::Exception& exc) { _pException = exc.clone(); } void Serializer::serializeStructBegin(const std::string& name) { v8::Local<v8::Object> object = v8::Object::New(_pIsolate); _jsObjectStack.push_back(object); _jsIndexStack.push_back(-1); } void Serializer::serializeStructEnd(const std::string& name) { v8::Local<v8::Object> object = _jsObjectStack.back(); _jsObjectStack.pop_back(); _jsIndexStack.pop_back(); serializeValue(name, object); } void Serializer::serializeSequenceBegin(const std::string& name, Poco::UInt32 length) { v8::Local<v8::Object> object = v8::Array::New(_pIsolate, length); _jsObjectStack.push_back(object); _jsIndexStack.push_back(0); } void Serializer::serializeSequenceEnd(const std::string& name) { v8::Local<v8::Object> object = _jsObjectStack.back(); _jsObjectStack.pop_back(); _jsIndexStack.pop_back(); serializeValue(name, object); } void Serializer::serializeNullableBegin(const std::string& name, bool isNull) { if (isNull) { serializeValue(name, v8::Null(_pIsolate)); } } void Serializer::serializeNullableEnd(const std::string& name) { } void Serializer::serializeOptionalBegin(const std::string& name, bool isSpecified) { } void Serializer::serializeOptionalEnd(const std::string& name) { } void Serializer::serialize(const std::string& name, Poco::Int8 value) { serializeValue(name, v8::Integer::New(_pIsolate, static_cast<Poco::Int32>(value))); } void Serializer::serialize(const std::string& name, Poco::UInt8 value) { serializeValue(name, v8::Integer::NewFromUnsigned(_pIsolate, static_cast<Poco::UInt32>(value))); } void Serializer::serialize(const std::string& name, Poco::Int16 value) { serializeValue(name, v8::Integer::New(_pIsolate, static_cast<Poco::Int32>(value))); } void Serializer::serialize(const std::string& name, Poco::UInt16 value) { serializeValue(name, v8::Integer::NewFromUnsigned(_pIsolate, static_cast<Poco::UInt32>(value))); } void Serializer::serialize(const std::string& name, Poco::Int32 value) { serializeValue(name, v8::Integer::New(_pIsolate, value)); } void Serializer::serialize(const std::string& name, Poco::UInt32 value) { serializeValue(name, v8::Integer::NewFromUnsigned(_pIsolate, value)); } void Serializer::serialize(const std::string& name, long value) { serializeValue(name, v8::Number::New(_pIsolate, value)); } void Serializer::serialize(const std::string& name, unsigned long value) { serializeValue(name, v8::Number::New(_pIsolate, value)); } #ifndef POCO_LONG_IS_64_BIT void Serializer::serialize(const std::string& name, Poco::Int64 value) { serializeValue(name, v8::Number::New(_pIsolate, value)); } void Serializer::serialize(const std::string& name, Poco::UInt64 value) { serializeValue(name, v8::Number::New(_pIsolate, value)); } #endif void Serializer::serialize(const std::string& name, float value) { serializeValue(name, v8::Number::New(_pIsolate, value)); } void Serializer::serialize(const std::string& name, double value) { serializeValue(name, v8::Number::New(_pIsolate, value)); } void Serializer::serialize(const std::string& name, bool value) { serializeValue(name, v8::Boolean::New(_pIsolate, value)); } void Serializer::serialize(const std::string& name, char value) { serializeValue(name, v8::String::NewFromUtf8(_pIsolate, &value, v8::String::kNormalString, 1)); } void Serializer::serialize(const std::string& name, const std::string& value) { serializeValue(name, v8::String::NewFromUtf8(_pIsolate, value.c_str(), v8::String::kNormalString, static_cast<int>(value.size()))); } void Serializer::serialize(const std::string& name, const std::vector<char>& value) { Poco::JS::Core::BufferWrapper::Buffer* pBuffer = new Poco::JS::Core::BufferWrapper::Buffer(&value[0], value.size()); Poco::JS::Core::BufferWrapper wrapper; v8::Persistent<v8::Object>& bufferObject(wrapper.wrapNativePersistent(_pIsolate, pBuffer)); v8::Local<v8::Object> localBufferObject = v8::Local<v8::Object>::New(_pIsolate, bufferObject); serializeValue(name, localBufferObject); } void Serializer::serializeValue(const std::string& name, v8::Local<v8::Value> value) { if (_jsIndexStack.back() == -1) { _jsObjectStack.back()->Set(v8::String::NewFromUtf8(_pIsolate, name.c_str(), v8::String::kNormalString, static_cast<int>(name.size())), value); } else { _jsObjectStack.back()->Set(_jsIndexStack.back()++, value); } if (_jsObjectStack.size() == 1) _totalSerialized++; } void Serializer::resetImpl() { _jsObjectStack.clear(); _jsIndexStack.clear(); delete _pException; _pException = 0; } void Serializer::setupImpl(std::ostream&) { } } } } // namespace Poco::JS::Bridge
; A198974: 2*11^n-1. ; 1,21,241,2661,29281,322101,3543121,38974341,428717761,4715895381,51874849201,570623341221,6276856753441,69045424287861,759499667166481,8354496338831301,91899459727144321,1010894056998587541,11119834626984462961,122318180896829092581,1345499989865120018401,14800499888516320202421,162805498773679522226641,1790860486510474744493061,19699465351615222189423681,216694118867767444083660501,2383635307545441884920265521,26219988382999860734122920741,288419872212998468075352128161 mov $1,11 pow $1,$0 sub $1,1 mul $1,2 add $1,1 mov $0,$1
; A338075: Diagonal terms in the expansion of (1+x*y*z)/(1-x-y-z). ; Submitted by Jon Maiga ; 1,7,96,1770,36330,791406,17909892,416226096,9864584730,237338943270,5778870222840,142077992254380,3521258757984240,87862829835387600,2205050763983594400,55615552451285359680,1408840444191389714010,35825204161237194511830,914089586182634239686000,23393986159532396624716500,600345580910522417396325900,15444209807387289196159191300,398197793550557554873660013400,10287629675148845336662419984000,266281185516182066792820482406000,6904127023048931738074888446554256 mov $3,$0 mov $5,2 lpb $5 sub $5,1 sub $0,$5 mov $1,$0 add $1,$0 mov $2,$0 add $2,$1 bin $1,$0 bin $2,$0 mov $0,$3 mul $1,$2 add $4,$1 lpe mov $0,$4
;------------------------------------------------------------------------------ ; ; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR> ; SPDX-License-Identifier: BSD-2-Clause-Patent ; ; Module Name: ; ; WriteDr3.Asm ; ; Abstract: ; ; AsmWriteDr3 function ; ; Notes: ; ;------------------------------------------------------------------------------ DEFAULT REL SECTION .text ;------------------------------------------------------------------------------ ; UINTN ; EFIAPI ; AsmWriteDr3 ( ; IN UINTN Value ; ); ;------------------------------------------------------------------------------ global ASM_PFX(AsmWriteDr3) ASM_PFX(AsmWriteDr3): mov dr3, rcx mov rax, rcx ret
#include <vtkNew.h> #include <vtkTestUtilities.h> #include "vtkF3DRenderPass.h" int TestF3DRenderPass(int argc, char* argv[]) { vtkNew<vtkF3DRenderPass> pass; return EXIT_SUCCESS; }
; A016842: (4n+3)^6. ; 729,117649,1771561,11390625,47045881,148035889,387420489,887503681,1838265625,3518743761,6321363049,10779215329,17596287801,27680640625,42180533641,62523502209,90458382169 mul $0,4 add $0,3 pow $0,6
extern m7_ippsRSA_SetPublicKey:function extern n8_ippsRSA_SetPublicKey:function extern y8_ippsRSA_SetPublicKey:function extern e9_ippsRSA_SetPublicKey:function extern l9_ippsRSA_SetPublicKey:function extern n0_ippsRSA_SetPublicKey:function extern k0_ippsRSA_SetPublicKey:function extern ippcpJumpIndexForMergedLibs extern ippcpSafeInit:function segment .data align 8 dq .Lin_ippsRSA_SetPublicKey .Larraddr_ippsRSA_SetPublicKey: dq m7_ippsRSA_SetPublicKey dq n8_ippsRSA_SetPublicKey dq y8_ippsRSA_SetPublicKey dq e9_ippsRSA_SetPublicKey dq l9_ippsRSA_SetPublicKey dq n0_ippsRSA_SetPublicKey dq k0_ippsRSA_SetPublicKey segment .text global ippsRSA_SetPublicKey:function (ippsRSA_SetPublicKey.LEndippsRSA_SetPublicKey - ippsRSA_SetPublicKey) .Lin_ippsRSA_SetPublicKey: db 0xf3, 0x0f, 0x1e, 0xfa call ippcpSafeInit wrt ..plt align 16 ippsRSA_SetPublicKey: db 0xf3, 0x0f, 0x1e, 0xfa mov rax, qword [rel ippcpJumpIndexForMergedLibs wrt ..gotpc] movsxd rax, dword [rax] lea r11, [rel .Larraddr_ippsRSA_SetPublicKey] mov r11, qword [r11+rax*8] jmp r11 .LEndippsRSA_SetPublicKey: