text stringlengths 1 1.05M |
|---|
; A266304: Total number of OFF (white) cells after n iterations of the "Rule 15" elementary cellular automaton starting with a single ON (black) cell.
; 0,1,5,6,14,15,27,28,44,45,65,66,90,91,119,120,152,153,189,190,230,231,275,276,324,325,377,378,434,435,495,496,560,561,629,630,702,703,779,780,860,861,945,946,1034,1035,1127,1128,1224,1225,1325,1326,1430,1431,1539,1540,1652,1653,1769,1770,1890,1891,2015,2016,2144,2145,2277,2278,2414,2415,2555,2556,2700,2701,2849,2850,3002,3003,3159,3160,3320,3321,3485,3486,3654,3655,3827,3828,4004,4005,4185,4186,4370,4371,4559,4560,4752,4753,4949,4950
mov $1,$0
div $1,2
add $0,$1
pow $1,2
add $0,$1
add $0,$1
|
; A288937: Positions of 0 in A288936; complement of A288938.
; 1,2,4,5,8,11,15,20,26,33,41,50,60,71,83,96,110,125,141,158,176,195,215,236,258,281,305,330,356,383,411,440,470,501,533,566,600,635,671,708,746,785,825,866,908,951,995,1040,1086,1133,1181,1230,1280,1331,1383,1436,1490,1545,1601,1658,1716,1775,1835,1896,1958,2021,2085,2150,2216,2283,2351,2420,2490,2561,2633,2706,2780,2855,2931,3008,3086,3165,3245,3326,3408,3491,3575,3660,3746,3833,3921,4010,4100,4191,4283,4376,4470,4565,4661,4758,4856,4955,5055,5156,5258,5361,5465,5570,5676,5783,5891,6000,6110,6221,6333,6446,6560,6675,6791,6908,7026,7145,7265,7386,7508,7631,7755,7880,8006,8133,8261,8390,8520,8651,8783,8916,9050,9185,9321,9458,9596,9735,9875,10016,10158,10301,10445,10590,10736,10883,11031,11180,11330,11481,11633,11786,11940,12095,12251,12408,12566,12725,12885,13046,13208,13371,13535,13700,13866,14033,14201,14370,14540,14711,14883,15056,15230,15405,15581,15758,15936,16115,16295,16476,16658,16841,17025,17210,17396,17583,17771,17960,18150,18341,18533,18726,18920,19115,19311,19508,19706,19905,20105,20306,20508,20711,20915,21120,21326,21533,21741,21950,22160,22371,22583,22796,23010,23225,23441,23658,23876,24095,24315,24536,24758,24981,25205,25430,25656,25883,26111,26340,26570,26801,27033,27266,27500,27735,27971,28208,28446,28685,28925,29166,29408,29651,29895,30140,30386,30633
mov $2,$0
lpb $2
add $2,1
lpb $4
trn $2,1
add $1,$2
sub $4,$3
lpe
add $1,1
trn $2,2
mov $3,1
mov $4,$1
lpe
add $1,1
|
; requires --dirbol on command line (for testing purposes of last OPT pop restoring it)
OPT pop ; warn about no previous syntax in stack
ld hl,bc,de,bc
mirror a ; error (Z80N instruction)
; try all possible options
OPT push reset --nofakes --syntax=a --zxnext=cspect --reversepop --dirbol
ld hl,bc,,de,bc ; error because --nofakes (!)
sub a,b,,c
mirror a : break ; next enabled, including CSpect emulator extras
pop hl,,bc ; pop bc : pop hl (--reversepop)
pop bc ; validation
OPT push reset --syntax=aBfl ; this one can be at beggining of line (--dirbol)
OPT = 1 : nop : OPT --dirbol ; first is label, instruction, adding --dirbol back (no push/reset)
ld hl,bc,,de,bc ; 2x warning about fAkEs (suppression is case sensitive)
ld hl,bc ; fake with suppressed warning
mirror a ; error (Z80N instruction)
pop hl,,bc ; pop hl : pop bc
pop hl ; validation
OPT pop : OPT pop ; pop syntax two times (and verify --dirbol works)
ld hl,bc,de,bc
OPT pop : OPT reset ; warn about no previous syntax in stack, then reset (but no options)
OPT = 2 : nop ; this one is no more dirbol, but just a label
OPT --nologo 1 2 3 4 5 6 7 8 9 A B C D E F G ; invalid option(s) and many of them
OPT unknown ; error about invalid command
OPT reset push ; warn about pushing default syntax
; verify if -Wfake/Wno-fake works similarly to --syntax=f
ld bc,hl ; no warning in default syntax
OPT push -Wfake
ld bc,hl ; warning
ld bc,hl ; warning suppressed by fake-ok
OPT push -Wno-fake
ld bc,hl ; no warning
OPT pop
ld bc,hl ; warning from previous state
OPT pop
ld bc,hl ; no warning in default
|
; A212755: Number of (w,x,y,z) with all terms in {0,...,n} and |w-x|=max{w,x,y,z}-min{w,x,y,z}.
; 1,10,37,96,205,386,665,1072,1641,2410,3421,4720,6357,8386,10865,13856,17425,21642,26581,32320,38941,46530,55177,64976,76025,88426,102285,117712,134821,153730,174561,197440,222497,249866,279685
add $0,1
mov $4,$0
lpb $0,1
sub $0,1
add $3,$4
add $2,$3
add $1,$2
add $2,1
add $3,1
lpe
|
/// @ref core
/// @file glm/detail/func_integer.inl
#include "../ext/vec1.hpp"
#include "type_vec2.hpp"
#include "type_vec3.hpp"
#include "type_vec4.hpp"
#include "type_int.hpp"
#include "_vectorize.hpp"
#if(GLM_ARCH & GLM_ARCH_X86 && GLM_COMPILER & GLM_COMPILER_VC)
# include <intrin.h>
# pragma intrinsic(_BitScanReverse)
#endif//(GLM_ARCH & GLM_ARCH_X86 && GLM_COMPILER & GLM_COMPILER_VC)
#include <limits>
#if !GLM_HAS_EXTENDED_INTEGER_TYPE
# if GLM_COMPILER & GLM_COMPILER_GCC
# pragma GCC diagnostic ignored "-Wlong-long"
# endif
# if (GLM_COMPILER & GLM_COMPILER_CLANG)
# pragma clang diagnostic ignored "-Wc++11-long-long"
# endif
#endif
namespace glm{
namespace detail
{
template<typename T>
GLM_FUNC_QUALIFIER T mask(T Bits)
{
return Bits >= static_cast<T>(sizeof(T) * 8) ? ~static_cast<T>(0) : (static_cast<T>(1) << Bits) - static_cast<T>(1);
}
template<length_t L, typename T, qualifier Q, bool Aligned, bool EXEC>
struct compute_bitfieldReverseStep
{
GLM_FUNC_QUALIFIER static vec<L, T, Q> call(vec<L, T, Q> const& v, T, T)
{
return v;
}
};
template<length_t L, typename T, qualifier Q, bool Aligned>
struct compute_bitfieldReverseStep<L, T, Q, Aligned, true>
{
GLM_FUNC_QUALIFIER static vec<L, T, Q> call(vec<L, T, Q> const& v, T Mask, T Shift)
{
return (v & Mask) << Shift | (v & (~Mask)) >> Shift;
}
};
template<length_t L, typename T, qualifier Q, bool Aligned, bool EXEC>
struct compute_bitfieldBitCountStep
{
GLM_FUNC_QUALIFIER static vec<L, T, Q> call(vec<L, T, Q> const& v, T, T)
{
return v;
}
};
template<length_t L, typename T, qualifier Q, bool Aligned>
struct compute_bitfieldBitCountStep<L, T, Q, Aligned, true>
{
GLM_FUNC_QUALIFIER static vec<L, T, Q> call(vec<L, T, Q> const& v, T Mask, T Shift)
{
return (v & Mask) + ((v >> Shift) & Mask);
}
};
template<typename genIUType, size_t Bits>
struct compute_findLSB
{
GLM_FUNC_QUALIFIER static int call(genIUType Value)
{
if(Value == 0)
return -1;
return glm::bitCount(~Value & (Value - static_cast<genIUType>(1)));
}
};
# if GLM_HAS_BITSCAN_WINDOWS
template<typename genIUType>
struct compute_findLSB<genIUType, 32>
{
GLM_FUNC_QUALIFIER static int call(genIUType Value)
{
unsigned long Result(0);
unsigned char IsNotNull = _BitScanForward(&Result, *reinterpret_cast<unsigned long*>(&Value));
return IsNotNull ? int(Result) : -1;
}
};
# if !((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_MODEL == GLM_MODEL_32))
template<typename genIUType>
struct compute_findLSB<genIUType, 64>
{
GLM_FUNC_QUALIFIER static int call(genIUType Value)
{
unsigned long Result(0);
unsigned char IsNotNull = _BitScanForward64(&Result, *reinterpret_cast<unsigned __int64*>(&Value));
return IsNotNull ? int(Result) : -1;
}
};
# endif
# endif//GLM_HAS_BITSCAN_WINDOWS
template<length_t L, typename T, qualifier Q, bool EXEC = true>
struct compute_findMSB_step_vec
{
GLM_FUNC_QUALIFIER static vec<L, T, Q> call(vec<L, T, Q> const& x, T Shift)
{
return x | (x >> Shift);
}
};
template<length_t L, typename T, qualifier Q>
struct compute_findMSB_step_vec<L, T, Q, false>
{
GLM_FUNC_QUALIFIER static vec<L, T, Q> call(vec<L, T, Q> const& x, T)
{
return x;
}
};
template<length_t L, typename T, qualifier Q, int>
struct compute_findMSB_vec
{
GLM_FUNC_QUALIFIER static vec<L, int, Q> call(vec<L, T, Q> const& v)
{
vec<L, T, Q> x(v);
x = compute_findMSB_step_vec<L, T, Q, sizeof(T) * 8 >= 8>::call(x, static_cast<T>( 1));
x = compute_findMSB_step_vec<L, T, Q, sizeof(T) * 8 >= 8>::call(x, static_cast<T>( 2));
x = compute_findMSB_step_vec<L, T, Q, sizeof(T) * 8 >= 8>::call(x, static_cast<T>( 4));
x = compute_findMSB_step_vec<L, T, Q, sizeof(T) * 8 >= 16>::call(x, static_cast<T>( 8));
x = compute_findMSB_step_vec<L, T, Q, sizeof(T) * 8 >= 32>::call(x, static_cast<T>(16));
x = compute_findMSB_step_vec<L, T, Q, sizeof(T) * 8 >= 64>::call(x, static_cast<T>(32));
return vec<L, int, Q>(sizeof(T) * 8 - 1) - glm::bitCount(~x);
}
};
# if GLM_HAS_BITSCAN_WINDOWS
template<typename genIUType>
GLM_FUNC_QUALIFIER int compute_findMSB_32(genIUType Value)
{
unsigned long Result(0);
unsigned char IsNotNull = _BitScanReverse(&Result, *reinterpret_cast<unsigned long*>(&Value));
return IsNotNull ? int(Result) : -1;
}
template<length_t L, typename T, qualifier Q>
struct compute_findMSB_vec<L, T, Q, 32>
{
GLM_FUNC_QUALIFIER static vec<L, int, Q> call(vec<L, T, Q> const& x)
{
return detail::functor1<vec, L, int, T, Q>::call(compute_findMSB_32, x);
}
};
# if !((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_MODEL == GLM_MODEL_32))
template<typename genIUType>
GLM_FUNC_QUALIFIER int compute_findMSB_64(genIUType Value)
{
unsigned long Result(0);
unsigned char IsNotNull = _BitScanReverse64(&Result, *reinterpret_cast<unsigned __int64*>(&Value));
return IsNotNull ? int(Result) : -1;
}
template<length_t L, typename T, qualifier Q>
struct compute_findMSB_vec<L, T, Q, 64>
{
GLM_FUNC_QUALIFIER static vec<L, int, Q> call(vec<L, T, Q> const& x)
{
return detail::functor1<vec, L, int, T, Q>::call(compute_findMSB_64, x);
}
};
# endif
# endif//GLM_HAS_BITSCAN_WINDOWS
}//namespace detail
// uaddCarry
GLM_FUNC_QUALIFIER uint uaddCarry(uint const& x, uint const& y, uint & Carry)
{
uint64 const Value64(static_cast<uint64>(x) + static_cast<uint64>(y));
uint64 const Max32((static_cast<uint64>(1) << static_cast<uint64>(32)) - static_cast<uint64>(1));
Carry = Value64 > Max32 ? 1u : 0u;
return static_cast<uint32>(Value64 % (Max32 + static_cast<uint64>(1)));
}
template<length_t L, qualifier Q>
GLM_FUNC_QUALIFIER vec<L, uint, Q> uaddCarry(vec<L, uint, Q> const& x, vec<L, uint, Q> const& y, vec<L, uint, Q>& Carry)
{
vec<L, uint64, Q> Value64(vec<L, uint64, Q>(x) + vec<L, uint64, Q>(y));
vec<L, uint64, Q> Max32((static_cast<uint64>(1) << static_cast<uint64>(32)) - static_cast<uint64>(1));
Carry = mix(vec<L, uint32, Q>(0), vec<L, uint32, Q>(1), greaterThan(Value64, Max32));
return vec<L, uint32, Q>(Value64 % (Max32 + static_cast<uint64>(1)));
}
// usubBorrow
GLM_FUNC_QUALIFIER uint usubBorrow(uint const& x, uint const& y, uint & Borrow)
{
GLM_STATIC_ASSERT(sizeof(uint) == sizeof(uint32), "uint and uint32 size mismatch");
Borrow = x >= y ? static_cast<uint32>(0) : static_cast<uint32>(1);
if(y >= x)
return y - x;
else
return static_cast<uint32>((static_cast<int64>(1) << static_cast<int64>(32)) + (static_cast<int64>(y) - static_cast<int64>(x)));
}
template<length_t L, qualifier Q>
GLM_FUNC_QUALIFIER vec<L, uint, Q> usubBorrow(vec<L, uint, Q> const& x, vec<L, uint, Q> const& y, vec<L, uint, Q>& Borrow)
{
Borrow = mix(vec<L, uint, Q>(1), vec<L, uint, Q>(0), greaterThanEqual(x, y));
vec<L, uint, Q> const YgeX(y - x);
vec<L, uint, Q> const XgeY(vec<L, uint32, Q>((static_cast<int64>(1) << static_cast<int64>(32)) + (vec<L, int64, Q>(y) - vec<L, int64, Q>(x))));
return mix(XgeY, YgeX, greaterThanEqual(y, x));
}
// umulExtended
GLM_FUNC_QUALIFIER void umulExtended(uint const& x, uint const& y, uint & msb, uint & lsb)
{
GLM_STATIC_ASSERT(sizeof(uint) == sizeof(uint32), "uint and uint32 size mismatch");
uint64 Value64 = static_cast<uint64>(x) * static_cast<uint64>(y);
msb = static_cast<uint>(Value64 >> static_cast<uint64>(32));
lsb = static_cast<uint>(Value64);
}
template<length_t L, qualifier Q>
GLM_FUNC_QUALIFIER void umulExtended(vec<L, uint, Q> const& x, vec<L, uint, Q> const& y, vec<L, uint, Q>& msb, vec<L, uint, Q>& lsb)
{
GLM_STATIC_ASSERT(sizeof(uint) == sizeof(uint32), "uint and uint32 size mismatch");
vec<L, uint64, Q> Value64(vec<L, uint64, Q>(x) * vec<L, uint64, Q>(y));
msb = vec<L, uint32, Q>(Value64 >> static_cast<uint64>(32));
lsb = vec<L, uint32, Q>(Value64);
}
// imulExtended
GLM_FUNC_QUALIFIER void imulExtended(int x, int y, int& msb, int& lsb)
{
GLM_STATIC_ASSERT(sizeof(int) == sizeof(int32), "int and int32 size mismatch");
int64 Value64 = static_cast<int64>(x) * static_cast<int64>(y);
msb = static_cast<int>(Value64 >> static_cast<int64>(32));
lsb = static_cast<int>(Value64);
}
template<length_t L, qualifier Q>
GLM_FUNC_QUALIFIER void imulExtended(vec<L, int, Q> const& x, vec<L, int, Q> const& y, vec<L, int, Q>& msb, vec<L, int, Q>& lsb)
{
GLM_STATIC_ASSERT(sizeof(int) == sizeof(int32), "int and int32 size mismatch");
vec<L, int64, Q> Value64(vec<L, int64, Q>(x) * vec<L, int64, Q>(y));
lsb = vec<L, int32, Q>(Value64 & static_cast<int64>(0xFFFFFFFF));
msb = vec<L, int32, Q>((Value64 >> static_cast<int64>(32)) & static_cast<int64>(0xFFFFFFFF));
}
// bitfieldExtract
template<typename genIUType>
GLM_FUNC_QUALIFIER genIUType bitfieldExtract(genIUType Value, int Offset, int Bits)
{
return bitfieldExtract(vec<1, genIUType>(Value), Offset, Bits).x;
}
template<length_t L, typename T, qualifier Q>
GLM_FUNC_QUALIFIER vec<L, T, Q> bitfieldExtract(vec<L, T, Q> const& Value, int Offset, int Bits)
{
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_integer, "'bitfieldExtract' only accept integer inputs");
return (Value >> static_cast<T>(Offset)) & static_cast<T>(detail::mask(Bits));
}
// bitfieldInsert
template<typename genIUType>
GLM_FUNC_QUALIFIER genIUType bitfieldInsert(genIUType const& Base, genIUType const& Insert, int Offset, int Bits)
{
return bitfieldInsert(vec<1, genIUType>(Base), vec<1, genIUType>(Insert), Offset, Bits).x;
}
template<length_t L, typename T, qualifier Q>
GLM_FUNC_QUALIFIER vec<L, T, Q> bitfieldInsert(vec<L, T, Q> const& Base, vec<L, T, Q> const& Insert, int Offset, int Bits)
{
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_integer, "'bitfieldInsert' only accept integer values");
T const Mask = static_cast<T>(detail::mask(Bits) << Offset);
return (Base & ~Mask) | (Insert & Mask);
}
// bitfieldReverse
template<typename genType>
GLM_FUNC_QUALIFIER genType bitfieldReverse(genType x)
{
return bitfieldReverse(glm::vec<1, genType, glm::defaultp>(x)).x;
}
template<length_t L, typename T, qualifier Q>
GLM_FUNC_QUALIFIER vec<L, T, Q> bitfieldReverse(vec<L, T, Q> const& v)
{
vec<L, T, Q> x(v);
x = detail::compute_bitfieldReverseStep<L, T, Q, detail::is_aligned<Q>::value, sizeof(T) * 8>= 2>::call(x, static_cast<T>(0x5555555555555555ull), static_cast<T>( 1));
x = detail::compute_bitfieldReverseStep<L, T, Q, detail::is_aligned<Q>::value, sizeof(T) * 8>= 4>::call(x, static_cast<T>(0x3333333333333333ull), static_cast<T>( 2));
x = detail::compute_bitfieldReverseStep<L, T, Q, detail::is_aligned<Q>::value, sizeof(T) * 8>= 8>::call(x, static_cast<T>(0x0F0F0F0F0F0F0F0Full), static_cast<T>( 4));
x = detail::compute_bitfieldReverseStep<L, T, Q, detail::is_aligned<Q>::value, sizeof(T) * 8>= 16>::call(x, static_cast<T>(0x00FF00FF00FF00FFull), static_cast<T>( 8));
x = detail::compute_bitfieldReverseStep<L, T, Q, detail::is_aligned<Q>::value, sizeof(T) * 8>= 32>::call(x, static_cast<T>(0x0000FFFF0000FFFFull), static_cast<T>(16));
x = detail::compute_bitfieldReverseStep<L, T, Q, detail::is_aligned<Q>::value, sizeof(T) * 8>= 64>::call(x, static_cast<T>(0x00000000FFFFFFFFull), static_cast<T>(32));
return x;
}
// bitCount
template<typename genType>
GLM_FUNC_QUALIFIER int bitCount(genType x)
{
return bitCount(glm::vec<1, genType, glm::defaultp>(x)).x;
}
template<length_t L, typename T, qualifier Q>
GLM_FUNC_QUALIFIER vec<L, int, Q> bitCount(vec<L, T, Q> const& v)
{
# if GLM_COMPILER & GLM_COMPILER_VC
# pragma warning(push)
# pragma warning(disable : 4310) //cast truncates constant value
# endif
vec<L, typename detail::make_unsigned<T>::type, Q> x(*reinterpret_cast<vec<L, typename detail::make_unsigned<T>::type, Q> const *>(&v));
x = detail::compute_bitfieldBitCountStep<L, typename detail::make_unsigned<T>::type, Q, detail::is_aligned<Q>::value, sizeof(T) * 8>= 2>::call(x, typename detail::make_unsigned<T>::type(0x5555555555555555ull), typename detail::make_unsigned<T>::type( 1));
x = detail::compute_bitfieldBitCountStep<L, typename detail::make_unsigned<T>::type, Q, detail::is_aligned<Q>::value, sizeof(T) * 8>= 4>::call(x, typename detail::make_unsigned<T>::type(0x3333333333333333ull), typename detail::make_unsigned<T>::type( 2));
x = detail::compute_bitfieldBitCountStep<L, typename detail::make_unsigned<T>::type, Q, detail::is_aligned<Q>::value, sizeof(T) * 8>= 8>::call(x, typename detail::make_unsigned<T>::type(0x0F0F0F0F0F0F0F0Full), typename detail::make_unsigned<T>::type( 4));
x = detail::compute_bitfieldBitCountStep<L, typename detail::make_unsigned<T>::type, Q, detail::is_aligned<Q>::value, sizeof(T) * 8>= 16>::call(x, typename detail::make_unsigned<T>::type(0x00FF00FF00FF00FFull), typename detail::make_unsigned<T>::type( 8));
x = detail::compute_bitfieldBitCountStep<L, typename detail::make_unsigned<T>::type, Q, detail::is_aligned<Q>::value, sizeof(T) * 8>= 32>::call(x, typename detail::make_unsigned<T>::type(0x0000FFFF0000FFFFull), typename detail::make_unsigned<T>::type(16));
x = detail::compute_bitfieldBitCountStep<L, typename detail::make_unsigned<T>::type, Q, detail::is_aligned<Q>::value, sizeof(T) * 8>= 64>::call(x, typename detail::make_unsigned<T>::type(0x00000000FFFFFFFFull), typename detail::make_unsigned<T>::type(32));
return vec<L, int, Q>(x);
# if GLM_COMPILER & GLM_COMPILER_VC
# pragma warning(pop)
# endif
}
// findLSB
template<typename genIUType>
GLM_FUNC_QUALIFIER int findLSB(genIUType Value)
{
GLM_STATIC_ASSERT(std::numeric_limits<genIUType>::is_integer, "'findLSB' only accept integer values");
return detail::compute_findLSB<genIUType, sizeof(genIUType) * 8>::call(Value);
}
template<length_t L, typename T, qualifier Q>
GLM_FUNC_QUALIFIER vec<L, int, Q> findLSB(vec<L, T, Q> const& x)
{
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_integer, "'findLSB' only accept integer values");
return detail::functor1<vec, L, int, T, Q>::call(findLSB, x);
}
// findMSB
template<typename genIUType>
GLM_FUNC_QUALIFIER int findMSB(genIUType v)
{
GLM_STATIC_ASSERT(std::numeric_limits<genIUType>::is_integer, "'findMSB' only accept integer values");
return findMSB(vec<1, genIUType>(v)).x;
}
template<length_t L, typename T, qualifier Q>
GLM_FUNC_QUALIFIER vec<L, int, Q> findMSB(vec<L, T, Q> const& v)
{
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_integer, "'findMSB' only accept integer values");
return detail::compute_findMSB_vec<L, T, Q, sizeof(T) * 8>::call(v);
}
}//namespace glm
#if GLM_CONFIG_SIMD == GLM_ENABLE
# include "func_integer_simd.inl"
#endif
|
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include <stdlib.h>
#include <stdarg.h>
#include "prmem.h"
#include "prprf.h"
#include "nsIServiceManager.h"
#include "nsIConsoleService.h"
#include "nsIDOMCanvasRenderingContext2D.h"
#include "nsICanvasRenderingContextInternal.h"
#include "nsHTMLCanvasElement.h"
#include "nsIPrincipal.h"
#include "nsGfxCIID.h"
#include "nsTArray.h"
#include "CanvasUtils.h"
#include "mozilla/gfx/Matrix.h"
namespace mozilla {
namespace CanvasUtils {
void
DoDrawImageSecurityCheck(nsHTMLCanvasElement *aCanvasElement,
nsIPrincipal *aPrincipal,
bool forceWriteOnly,
bool CORSUsed)
{
NS_PRECONDITION(aPrincipal, "Must have a principal here");
// Callers should ensure that mCanvasElement is non-null before calling this
if (!aCanvasElement) {
NS_WARNING("DoDrawImageSecurityCheck called without canvas element!");
return;
}
if (aCanvasElement->IsWriteOnly())
return;
// If we explicitly set WriteOnly just do it and get out
if (forceWriteOnly) {
aCanvasElement->SetWriteOnly();
return;
}
// No need to do a security check if the image used CORS for the load
if (CORSUsed)
return;
// Ignore document.domain in this check.
bool subsumes;
nsresult rv =
aCanvasElement->NodePrincipal()->SubsumesIgnoringDomain(aPrincipal,
&subsumes);
if (NS_SUCCEEDED(rv) && subsumes) {
// This canvas has access to that image anyway
return;
}
aCanvasElement->SetWriteOnly();
}
bool
CoerceDouble(jsval v, double* d)
{
if (JSVAL_IS_DOUBLE(v)) {
*d = JSVAL_TO_DOUBLE(v);
} else if (JSVAL_IS_INT(v)) {
*d = double(JSVAL_TO_INT(v));
} else if (JSVAL_IS_VOID(v)) {
*d = 0.0;
} else {
return false;
}
return true;
}
template<size_t N>
static bool
JSValToMatrixElts(JSContext* cx, const jsval& val,
double* (&elts)[N], nsresult* rv)
{
JSObject* obj;
uint32_t length;
if (JSVAL_IS_PRIMITIVE(val) ||
!(obj = JSVAL_TO_OBJECT(val)) ||
!JS_GetArrayLength(cx, obj, &length) ||
N != length) {
// Not an array-like thing or wrong size
*rv = NS_ERROR_INVALID_ARG;
return false;
}
for (uint32_t i = 0; i < N; ++i) {
jsval elt;
double d;
if (!JS_GetElement(cx, obj, i, &elt)) {
*rv = NS_ERROR_FAILURE;
return false;
}
if (!CoerceDouble(elt, &d)) {
*rv = NS_ERROR_INVALID_ARG;
return false;
}
if (!FloatValidate(d)) {
// This is weird, but it's the behavior of SetTransform()
*rv = NS_OK;
return false;
}
*elts[i] = d;
}
*rv = NS_OK;
return true;
}
bool
JSValToMatrix(JSContext* cx, const jsval& val, gfxMatrix* matrix, nsresult* rv)
{
double* elts[] = { &matrix->xx, &matrix->yx, &matrix->xy, &matrix->yy,
&matrix->x0, &matrix->y0 };
return JSValToMatrixElts(cx, val, elts, rv);
}
bool
JSValToMatrix(JSContext* cx, const jsval& val, Matrix* matrix, nsresult* rv)
{
gfxMatrix m;
if (!JSValToMatrix(cx, val, &m, rv))
return false;
*matrix = Matrix(Float(m.xx), Float(m.yx), Float(m.xy), Float(m.yy),
Float(m.x0), Float(m.y0));
return true;
}
template<size_t N>
static nsresult
MatrixEltsToJSVal(/*const*/ jsval (&elts)[N], JSContext* cx, jsval* val)
{
JSObject* obj = JS_NewArrayObject(cx, N, elts);
if (!obj) {
return NS_ERROR_OUT_OF_MEMORY;
}
*val = OBJECT_TO_JSVAL(obj);
return NS_OK;
}
nsresult
MatrixToJSVal(const gfxMatrix& matrix, JSContext* cx, jsval* val)
{
jsval elts[] = {
DOUBLE_TO_JSVAL(matrix.xx), DOUBLE_TO_JSVAL(matrix.yx),
DOUBLE_TO_JSVAL(matrix.xy), DOUBLE_TO_JSVAL(matrix.yy),
DOUBLE_TO_JSVAL(matrix.x0), DOUBLE_TO_JSVAL(matrix.y0)
};
return MatrixEltsToJSVal(elts, cx, val);
}
nsresult
MatrixToJSVal(const Matrix& matrix, JSContext* cx, jsval* val)
{
jsval elts[] = {
DOUBLE_TO_JSVAL(matrix._11), DOUBLE_TO_JSVAL(matrix._12),
DOUBLE_TO_JSVAL(matrix._21), DOUBLE_TO_JSVAL(matrix._22),
DOUBLE_TO_JSVAL(matrix._31), DOUBLE_TO_JSVAL(matrix._32)
};
return MatrixEltsToJSVal(elts, cx, val);
}
} // namespace CanvasUtils
} // namespace mozilla
|
/*
*
* Copyright (c) 1998-2002
* John Maddock
*
* Use, modification and distribution are subject to 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)
*
*/
/*
* LOCATION: see http://www.boost.org for most recent version.
* FILE: fileiter.cpp
* VERSION: see <boost/version.hpp>
* DESCRIPTION: Implements file io primitives + directory searching for class boost::RegEx.
*/
#define BOOST_REGEX_SOURCE
#include <climits>
#include <stdexcept>
#include <string>
#include <boost/throw_exception.hpp>
#include <boost/regex/v4/fileiter.hpp>
#include <boost/regex/v4/regex_workaround.hpp>
#include <boost/regex/pattern_except.hpp>
#include <cstdio>
#if defined(BOOST_NO_STDC_NAMESPACE)
namespace std{
using ::sprintf;
using ::fseek;
using ::fread;
using ::ftell;
using ::fopen;
using ::fclose;
using ::FILE;
using ::strcpy;
using ::strcpy;
using ::strcat;
using ::strcmp;
using ::strlen;
}
#endif
#ifndef BOOST_REGEX_NO_FILEITER
#if defined(__CYGWIN__) || defined(__CYGWIN32__)
#include <sys/cygwin.h>
#endif
#ifdef BOOST_MSVC
# pragma warning(disable: 4800)
#endif
namespace boost{
namespace re_detail{
// start with the operating system specific stuff:
#if (defined(__BORLANDC__) || defined(BOOST_REGEX_FI_WIN32_DIR) || defined(BOOST_MSVC)) && !defined(BOOST_RE_NO_WIN32)
// platform is DOS or Windows
// directories are separated with '\\'
// and names are insensitive of case
BOOST_REGEX_DECL const char* _fi_sep = "\\";
const char* _fi_sep_alt = "/";
#define BOOST_REGEX_FI_TRANSLATE(c) std::tolower(c)
#else
// platform is not DOS or Windows
// directories are separated with '/'
// and names are sensitive of case
BOOST_REGEX_DECL const char* _fi_sep = "/";
const char* _fi_sep_alt = _fi_sep;
#define BOOST_REGEX_FI_TRANSLATE(c) c
#endif
#ifdef BOOST_REGEX_FI_WIN32_MAP
void mapfile::open(const char* file)
{
#if defined(BOOST_NO_ANSI_APIS)
int filename_size = strlen(file);
LPWSTR wide_file = (LPWSTR)_alloca( (filename_size + 1) * sizeof(WCHAR) );
if(::MultiByteToWideChar(CP_ACP, 0, file, filename_size, wide_file, filename_size + 1) == 0)
hfile = INVALID_HANDLE_VALUE;
else
hfile = CreateFileW(wide_file, GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
#elif defined(__CYGWIN__)||defined(__CYGWIN32__)
char win32file[ MAX_PATH ];
cygwin_conv_to_win32_path( file, win32file );
hfile = CreateFileA(win32file, GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
#else
hfile = CreateFileA(file, GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
#endif
if(hfile != INVALID_HANDLE_VALUE)
{
hmap = CreateFileMapping(hfile, 0, PAGE_READONLY, 0, 0, 0);
if((hmap == INVALID_HANDLE_VALUE) || (hmap == NULL))
{
CloseHandle(hfile);
hmap = 0;
hfile = 0;
std::runtime_error err("Unable to create file mapping.");
boost::re_detail::raise_runtime_error(err);
}
_first = static_cast<const char*>(MapViewOfFile(hmap, FILE_MAP_READ, 0, 0, 0));
if(_first == 0)
{
CloseHandle(hmap);
CloseHandle(hfile);
hmap = 0;
hfile = 0;
std::runtime_error err("Unable to create file mapping.");
}
_last = _first + GetFileSize(hfile, 0);
}
else
{
hfile = 0;
#ifndef BOOST_NO_EXCEPTIONS
throw std::runtime_error("Unable to open file.");
#else
BOOST_REGEX_NOEH_ASSERT(hfile != INVALID_HANDLE_VALUE);
#endif
}
}
void mapfile::close()
{
if(hfile != INVALID_HANDLE_VALUE)
{
UnmapViewOfFile((void*)_first);
CloseHandle(hmap);
CloseHandle(hfile);
hmap = hfile = 0;
_first = _last = 0;
}
}
#elif !defined(BOOST_RE_NO_STL)
mapfile_iterator& mapfile_iterator::operator = (const mapfile_iterator& i)
{
if(file && node)
file->unlock(node);
file = i.file;
node = i.node;
offset = i.offset;
if(file)
file->lock(node);
return *this;
}
mapfile_iterator& mapfile_iterator::operator++ ()
{
if((++offset == mapfile::buf_size) && file)
{
++node;
offset = 0;
file->lock(node);
file->unlock(node-1);
}
return *this;
}
mapfile_iterator mapfile_iterator::operator++ (int)
{
mapfile_iterator temp(*this);
if((++offset == mapfile::buf_size) && file)
{
++node;
offset = 0;
file->lock(node);
file->unlock(node-1);
}
return temp;
}
mapfile_iterator& mapfile_iterator::operator-- ()
{
if((offset == 0) && file)
{
--node;
offset = mapfile::buf_size - 1;
file->lock(node);
file->unlock(node + 1);
}
else
--offset;
return *this;
}
mapfile_iterator mapfile_iterator::operator-- (int)
{
mapfile_iterator temp(*this);
if((offset == 0) && file)
{
--node;
offset = mapfile::buf_size - 1;
file->lock(node);
file->unlock(node + 1);
}
else
--offset;
return temp;
}
mapfile_iterator operator + (const mapfile_iterator& i, long off)
{
mapfile_iterator temp(i);
temp += off;
return temp;
}
mapfile_iterator operator - (const mapfile_iterator& i, long off)
{
mapfile_iterator temp(i);
temp -= off;
return temp;
}
mapfile::iterator mapfile::begin()const
{
return mapfile_iterator(this, 0);
}
mapfile::iterator mapfile::end()const
{
return mapfile_iterator(this, _size);
}
void mapfile::lock(pointer* node)const
{
BOOST_ASSERT(node >= _first);
BOOST_ASSERT(node <= _last);
if(node < _last)
{
if(*node == 0)
{
if(condemed.empty())
{
*node = new char[sizeof(int) + buf_size];
*(reinterpret_cast<int*>(*node)) = 1;
}
else
{
pointer* p = condemed.front();
condemed.pop_front();
*node = *p;
*p = 0;
*(reinterpret_cast<int*>(*node)) = 1;
}
std::size_t read_size = 0;
int read_pos = std::fseek(hfile, (node - _first) * buf_size, SEEK_SET);
if(0 == read_pos && node == _last - 1)
read_size = std::fread(*node + sizeof(int), _size % buf_size, 1, hfile);
else
read_size = std::fread(*node + sizeof(int), buf_size, 1, hfile);
#ifndef BOOST_NO_EXCEPTIONS
if((read_size == 0) || (std::ferror(hfile)))
{
throw std::runtime_error("Unable to read file.");
}
#else
BOOST_REGEX_NOEH_ASSERT((0 == std::ferror(hfile)) && (read_size != 0));
#endif
}
else
{
if(*reinterpret_cast<int*>(*node) == 0)
{
*reinterpret_cast<int*>(*node) = 1;
condemed.remove(node);
}
else
++(*reinterpret_cast<int*>(*node));
}
}
}
void mapfile::unlock(pointer* node)const
{
BOOST_ASSERT(node >= _first);
BOOST_ASSERT(node <= _last);
if(node < _last)
{
if(--(*reinterpret_cast<int*>(*node)) == 0)
{
condemed.push_back(node);
}
}
}
long int get_file_length(std::FILE* hfile)
{
long int result;
std::fseek(hfile, 0, SEEK_END);
result = std::ftell(hfile);
std::fseek(hfile, 0, SEEK_SET);
return result;
}
void mapfile::open(const char* file)
{
hfile = std::fopen(file, "rb");
#ifndef BOOST_NO_EXCEPTIONS
try{
#endif
if(hfile != 0)
{
_size = get_file_length(hfile);
long cnodes = (_size + buf_size - 1) / buf_size;
// check that number of nodes is not too high:
if(cnodes > (long)((INT_MAX) / sizeof(pointer*)))
{
std::fclose(hfile);
hfile = 0;
_size = 0;
return;
}
_first = new pointer[(int)cnodes];
_last = _first + cnodes;
std::memset(_first, 0, cnodes*sizeof(pointer));
}
else
{
std::runtime_error err("Unable to open file.");
}
#ifndef BOOST_NO_EXCEPTIONS
}catch(...)
{ close(); throw; }
#endif
}
void mapfile::close()
{
if(hfile != 0)
{
pointer* p = _first;
while(p != _last)
{
if(*p)
delete[] *p;
++p;
}
delete[] _first;
_size = 0;
_first = _last = 0;
std::fclose(hfile);
hfile = 0;
condemed.erase(condemed.begin(), condemed.end());
}
}
#endif
inline _fi_find_handle find_first_file(const char* wild, _fi_find_data& data)
{
#ifdef BOOST_NO_ANSI_APIS
std::size_t wild_size = std::strlen(wild);
LPWSTR wide_wild = (LPWSTR)_alloca( (wild_size + 1) * sizeof(WCHAR) );
if (::MultiByteToWideChar(CP_ACP, 0, wild, wild_size, wide_wild, wild_size + 1) == 0)
return _fi_invalid_handle;
return FindFirstFileW(wide_wild, &data);
#else
return FindFirstFileA(wild, &data);
#endif
}
inline bool find_next_file(_fi_find_handle hf, _fi_find_data& data)
{
#ifdef BOOST_NO_ANSI_APIS
return FindNextFileW(hf, &data);
#else
return FindNextFileA(hf, &data);
#endif
}
inline void copy_find_file_result_with_overflow_check(const _fi_find_data& data, char* path, size_t max_size)
{
#ifdef BOOST_NO_ANSI_APIS
if (::WideCharToMultiByte(CP_ACP, 0, data.cFileName, -1, path, max_size, NULL, NULL) == 0)
re_detail::overflow_error_if_not_zero(1);
#else
re_detail::overflow_error_if_not_zero(re_detail::strcpy_s(path, max_size, data.cFileName));
#endif
}
inline bool is_not_current_or_parent_path_string(const _fi_find_data& data)
{
#ifdef BOOST_NO_ANSI_APIS
return (std::wcscmp(data.cFileName, L".") && std::wcscmp(data.cFileName, L".."));
#else
return (std::strcmp(data.cFileName, ".") && std::strcmp(data.cFileName, ".."));
#endif
}
file_iterator::file_iterator()
{
_root = _path = 0;
ref = 0;
#ifndef BOOST_NO_EXCEPTIONS
try{
#endif
_root = new char[MAX_PATH];
BOOST_REGEX_NOEH_ASSERT(_root)
_path = new char[MAX_PATH];
BOOST_REGEX_NOEH_ASSERT(_path)
ptr = _path;
*_path = 0;
*_root = 0;
ref = new file_iterator_ref();
BOOST_REGEX_NOEH_ASSERT(ref)
ref->hf = _fi_invalid_handle;
ref->count = 1;
#ifndef BOOST_NO_EXCEPTIONS
}
catch(...)
{
delete[] _root;
delete[] _path;
delete ref;
throw;
}
#endif
}
file_iterator::file_iterator(const char* wild)
{
_root = _path = 0;
ref = 0;
#ifndef BOOST_NO_EXCEPTIONS
try{
#endif
_root = new char[MAX_PATH];
BOOST_REGEX_NOEH_ASSERT(_root)
_path = new char[MAX_PATH];
BOOST_REGEX_NOEH_ASSERT(_path)
re_detail::overflow_error_if_not_zero(re_detail::strcpy_s(_root, MAX_PATH, wild));
ptr = _root;
while(*ptr)++ptr;
while((ptr > _root) && (*ptr != *_fi_sep) && (*ptr != *_fi_sep_alt))--ptr;
if((ptr == _root) && ( (*ptr== *_fi_sep) || (*ptr==*_fi_sep_alt) ) )
{
_root[1]='\0';
re_detail::overflow_error_if_not_zero(re_detail::strcpy_s(_path, MAX_PATH, _root));
}
else
{
*ptr = 0;
re_detail::overflow_error_if_not_zero(re_detail::strcpy_s(_path, MAX_PATH, _root));
if(*_path == 0)
re_detail::overflow_error_if_not_zero(re_detail::strcpy_s(_path, MAX_PATH, "."));
re_detail::overflow_error_if_not_zero(re_detail::strcat_s(_path, MAX_PATH, _fi_sep));
}
ptr = _path + std::strlen(_path);
ref = new file_iterator_ref();
BOOST_REGEX_NOEH_ASSERT(ref)
ref->hf = find_first_file(wild, ref->_data);
ref->count = 1;
if(ref->hf == _fi_invalid_handle)
{
*_path = 0;
ptr = _path;
}
else
{
copy_find_file_result_with_overflow_check(ref->_data, ptr, (MAX_PATH - (ptr - _path)));
if(ref->_data.dwFileAttributes & _fi_dir)
next();
}
#ifndef BOOST_NO_EXCEPTIONS
}
catch(...)
{
delete[] _root;
delete[] _path;
delete ref;
throw;
}
#endif
}
file_iterator::file_iterator(const file_iterator& other)
{
_root = _path = 0;
ref = 0;
#ifndef BOOST_NO_EXCEPTIONS
try{
#endif
_root = new char[MAX_PATH];
BOOST_REGEX_NOEH_ASSERT(_root)
_path = new char[MAX_PATH];
BOOST_REGEX_NOEH_ASSERT(_path)
re_detail::overflow_error_if_not_zero(re_detail::strcpy_s(_root, MAX_PATH, other._root));
re_detail::overflow_error_if_not_zero(re_detail::strcpy_s(_path, MAX_PATH, other._path));
ptr = _path + (other.ptr - other._path);
ref = other.ref;
#ifndef BOOST_NO_EXCEPTIONS
}
catch(...)
{
delete[] _root;
delete[] _path;
throw;
}
#endif
++(ref->count);
}
file_iterator& file_iterator::operator=(const file_iterator& other)
{
re_detail::overflow_error_if_not_zero(re_detail::strcpy_s(_root, MAX_PATH, other._root));
re_detail::overflow_error_if_not_zero(re_detail::strcpy_s(_path, MAX_PATH, other._path));
ptr = _path + (other.ptr - other._path);
if(--(ref->count) == 0)
{
if(ref->hf != _fi_invalid_handle)
FindClose(ref->hf);
delete ref;
}
ref = other.ref;
++(ref->count);
return *this;
}
file_iterator::~file_iterator()
{
delete[] _root;
delete[] _path;
if(--(ref->count) == 0)
{
if(ref->hf != _fi_invalid_handle)
FindClose(ref->hf);
delete ref;
}
}
file_iterator file_iterator::operator++(int)
{
file_iterator temp(*this);
next();
return temp;
}
void file_iterator::next()
{
if(ref->hf != _fi_invalid_handle)
{
bool cont = true;
while(cont)
{
cont = find_next_file(ref->hf, ref->_data);
if(cont && ((ref->_data.dwFileAttributes & _fi_dir) == 0))
break;
}
if(!cont)
{
// end of sequence
FindClose(ref->hf);
ref->hf = _fi_invalid_handle;
*_path = 0;
ptr = _path;
}
else
copy_find_file_result_with_overflow_check(ref->_data, ptr, MAX_PATH - (ptr - _path));
}
}
directory_iterator::directory_iterator()
{
_root = _path = 0;
ref = 0;
#ifndef BOOST_NO_EXCEPTIONS
try{
#endif
_root = new char[MAX_PATH];
BOOST_REGEX_NOEH_ASSERT(_root)
_path = new char[MAX_PATH];
BOOST_REGEX_NOEH_ASSERT(_path)
ptr = _path;
*_path = 0;
*_root = 0;
ref = new file_iterator_ref();
BOOST_REGEX_NOEH_ASSERT(ref)
ref->hf = _fi_invalid_handle;
ref->count = 1;
#ifndef BOOST_NO_EXCEPTIONS
}
catch(...)
{
delete[] _root;
delete[] _path;
delete ref;
throw;
}
#endif
}
directory_iterator::directory_iterator(const char* wild)
{
_root = _path = 0;
ref = 0;
#ifndef BOOST_NO_EXCEPTIONS
try{
#endif
_root = new char[MAX_PATH];
BOOST_REGEX_NOEH_ASSERT(_root)
_path = new char[MAX_PATH];
BOOST_REGEX_NOEH_ASSERT(_path)
re_detail::overflow_error_if_not_zero(re_detail::strcpy_s(_root, MAX_PATH, wild));
ptr = _root;
while(*ptr)++ptr;
while((ptr > _root) && (*ptr != *_fi_sep) && (*ptr != *_fi_sep_alt))--ptr;
if((ptr == _root) && ( (*ptr== *_fi_sep) || (*ptr==*_fi_sep_alt) ) )
{
_root[1]='\0';
re_detail::overflow_error_if_not_zero(re_detail::strcpy_s(_path, MAX_PATH, _root));
}
else
{
*ptr = 0;
re_detail::overflow_error_if_not_zero(re_detail::strcpy_s(_path, MAX_PATH, _root));
if(*_path == 0)
re_detail::overflow_error_if_not_zero(re_detail::strcpy_s(_path, MAX_PATH, "."));
re_detail::overflow_error_if_not_zero(re_detail::strcat_s(_path, MAX_PATH, _fi_sep));
}
ptr = _path + std::strlen(_path);
ref = new file_iterator_ref();
BOOST_REGEX_NOEH_ASSERT(ref)
ref->count = 1;
ref->hf = find_first_file(wild, ref->_data);
if(ref->hf == _fi_invalid_handle)
{
*_path = 0;
ptr = _path;
}
else
{
copy_find_file_result_with_overflow_check(ref->_data, ptr, MAX_PATH - (ptr - _path));
if(((ref->_data.dwFileAttributes & _fi_dir) == 0) || (std::strcmp(ptr, ".") == 0) || (std::strcmp(ptr, "..") == 0))
next();
}
#ifndef BOOST_NO_EXCEPTIONS
}
catch(...)
{
delete[] _root;
delete[] _path;
delete ref;
throw;
}
#endif
}
directory_iterator::~directory_iterator()
{
delete[] _root;
delete[] _path;
if(--(ref->count) == 0)
{
if(ref->hf != _fi_invalid_handle)
FindClose(ref->hf);
delete ref;
}
}
directory_iterator::directory_iterator(const directory_iterator& other)
{
_root = _path = 0;
ref = 0;
#ifndef BOOST_NO_EXCEPTIONS
try{
#endif
_root = new char[MAX_PATH];
BOOST_REGEX_NOEH_ASSERT(_root)
_path = new char[MAX_PATH];
BOOST_REGEX_NOEH_ASSERT(_path)
re_detail::overflow_error_if_not_zero(re_detail::strcpy_s(_root, MAX_PATH, other._root));
re_detail::overflow_error_if_not_zero(re_detail::strcpy_s(_path, MAX_PATH, other._path));
ptr = _path + (other.ptr - other._path);
ref = other.ref;
#ifndef BOOST_NO_EXCEPTIONS
}
catch(...)
{
delete[] _root;
delete[] _path;
throw;
}
#endif
++(ref->count);
}
directory_iterator& directory_iterator::operator=(const directory_iterator& other)
{
re_detail::overflow_error_if_not_zero(re_detail::strcpy_s(_root, MAX_PATH, other._root));
re_detail::overflow_error_if_not_zero(re_detail::strcpy_s(_path, MAX_PATH, other._path));
ptr = _path + (other.ptr - other._path);
if(--(ref->count) == 0)
{
if(ref->hf != _fi_invalid_handle)
FindClose(ref->hf);
delete ref;
}
ref = other.ref;
++(ref->count);
return *this;
}
directory_iterator directory_iterator::operator++(int)
{
directory_iterator temp(*this);
next();
return temp;
}
void directory_iterator::next()
{
if(ref->hf != _fi_invalid_handle)
{
bool cont = true;
while(cont)
{
cont = find_next_file(ref->hf, ref->_data);
if(cont && (ref->_data.dwFileAttributes & _fi_dir))
{
if(is_not_current_or_parent_path_string(ref->_data))
break;
}
}
if(!cont)
{
// end of sequence
FindClose(ref->hf);
ref->hf = _fi_invalid_handle;
*_path = 0;
ptr = _path;
}
else
copy_find_file_result_with_overflow_check(ref->_data, ptr, MAX_PATH - (ptr - _path));
}
}
#ifdef BOOST_REGEX_FI_POSIX_DIR
struct _fi_priv_data
{
char root[MAX_PATH];
char* mask;
DIR* d;
_fi_priv_data(const char* p);
};
_fi_priv_data::_fi_priv_data(const char* p)
{
std::strcpy(root, p);
mask = root;
while(*mask) ++mask;
while((mask > root) && (*mask != *_fi_sep) && (*mask != *_fi_sep_alt)) --mask;
if(mask == root && ((*mask== *_fi_sep) || (*mask == *_fi_sep_alt)) )
{
root[1] = '\0';
std::strcpy(root+2, p+1);
mask = root+2;
}
else if(mask == root)
{
root[0] = '.';
root[1] = '\0';
std::strcpy(root+2, p);
mask = root+2;
}
else
{
*mask = 0;
++mask;
}
}
bool iswild(const char* mask, const char* name)
{
while(*mask && *name)
{
switch(*mask)
{
case '?':
++name;
++mask;
continue;
case '*':
++mask;
if(*mask == 0)
return true;
while(*name)
{
if(iswild(mask, name))
return true;
++name;
}
return false;
case '.':
if(0 == *name)
{
++mask;
continue;
}
// fall through:
default:
if(BOOST_REGEX_FI_TRANSLATE(*mask) != BOOST_REGEX_FI_TRANSLATE(*name))
return false;
++mask;
++name;
continue;
}
}
if(*mask != *name)
return false;
return true;
}
unsigned _fi_attributes(const char* root, const char* name)
{
char buf[MAX_PATH];
// verify that we can not overflow:
if(std::strlen(root) + std::strlen(_fi_sep) + std::strlen(name) >= MAX_PATH)
return 0;
int r;
if( ( (root[0] == *_fi_sep) || (root[0] == *_fi_sep_alt) ) && (root[1] == '\0') )
r = (std::sprintf)(buf, "%s%s", root, name);
else
r = (std::sprintf)(buf, "%s%s%s", root, _fi_sep, name);
if(r < 0)
return 0; // sprintf failed
DIR* d = opendir(buf);
if(d)
{
closedir(d);
return _fi_dir;
}
return 0;
}
_fi_find_handle _fi_FindFirstFile(const char* lpFileName, _fi_find_data* lpFindFileData)
{
_fi_find_handle dat = new _fi_priv_data(lpFileName);
DIR* h = opendir(dat->root);
dat->d = h;
if(h != 0)
{
if(_fi_FindNextFile(dat, lpFindFileData))
return dat;
}
delete dat;
return 0;
}
bool _fi_FindNextFile(_fi_find_handle dat, _fi_find_data* lpFindFileData)
{
dirent* d;
do
{
d = readdir(dat->d);
} while(d && !iswild(dat->mask, d->d_name));
if(d)
{
std::strcpy(lpFindFileData->cFileName, d->d_name);
lpFindFileData->dwFileAttributes = _fi_attributes(dat->root, d->d_name);
return true;
}
return false;
}
bool _fi_FindClose(_fi_find_handle dat)
{
closedir(dat->d);
delete dat;
return true;
}
#endif
} // namespace re_detail
} // namspace boost
#endif // BOOST_REGEX_NO_FILEITER
|
; A175456: (Digit sum of 5^n) mod n.
; Submitted by Jon Maiga
; 0,1,2,1,1,1,2,1,8,0,5,4,10,6,14,10,5,10,2,1,20,1,5,10,2,1,8,1,25,1,11,10,23,1,22,1,30,10,17,10,14,19,20,19,26,20,34,1,11,1,50,26,13,19,2,28,44,37,14,19,11,1,44,38,34,49,51,60,59,53,58,1,2,19,44,19,14,70,63,10,71,1,41,28,2,10,17,10,5,46,38,10,17,37,32,37,2,72,71,83
add $0,1
mov $1,$0
seq $0,66001 ; Sum of digits of 5^n.
mod $0,$1
|
; A152746: Six times hexagonal numbers: 6*n*(2*n-1).
; 0,6,36,90,168,270,396,546,720,918,1140,1386,1656,1950,2268,2610,2976,3366,3780,4218,4680,5166,5676,6210,6768,7350,7956,8586,9240,9918,10620,11346,12096,12870,13668,14490,15336,16206,17100,18018,18960,19926,20916,21930,22968,24030,25116,26226,27360,28518,29700,30906,32136,33390,34668,35970,37296,38646,40020,41418,42840,44286,45756,47250,48768,50310,51876,53466,55080,56718,58380,60066,61776,63510,65268,67050,68856,70686,72540,74418,76320,78246,80196,82170,84168,86190,88236,90306,92400,94518,96660,98826,101016,103230,105468,107730,110016,112326,114660,117018
mul $0,2
bin $0,2
mul $0,6
|
#include "mixer.h"
Mixer::Mixer(Project *poj):poj(poj)
{
}
inline double Mixer::Beat2Second(double beat)
{
return beat / (poj->BPM) * 60.0;
}
inline int Mixer::Second2Index(double second)
{
return second * (poj->sampleRate);
}
inline int Mixer::Beat2Index(double beat)
{
return Second2Index(Beat2Second(beat));
}
void Mixer::Mix(stk::StkFrames &origin, const stk::StkFrames &deta, int delayIndex)
{
for (int i = 0; i < deta.size(); i++)
{
int index = i+delayIndex;
if(index>=0&&index<origin.size())
origin[index] += deta[i];
}
}
void Mixer::Gain(stk::StkFrames &origin, double gain, int fromIndex, int endIndex)
{
if(endIndex == -1) endIndex = origin.size();
for(int i = fromIndex; i < endIndex; i++)
{
if(i>=0&&i<origin.size())
origin[i] *= gain;
}
}
void Mixer::GetWave(stk::StkFrames &frame, const MIDIEvent &midiEvent, stk::Instrmnt *instrmnt)
{
frame.resize(Beat2Index(midiEvent.maintainBeat));
instrmnt->noteOn(440 * pow(2,midiEvent.tune/12.0),1);
instrmnt->tick(frame);
Gain(frame,midiEvent.intensity/128.0);
}
void Mixer::GetWave(stk::StkFrames &frame, const MIDIClip &midiClip, stk::Instrmnt *instrmnt)
{
frame.resize(Beat2Index(midiClip.maintainBeat));
for(int i = 0; i < midiClip.midiEvents.size(); i++)
{
const MIDIEvent &event = midiClip.midiEvents.at(i);
stk::StkFrames eventFrame;
GetWave(eventFrame,event,instrmnt);
int beginIndex = Beat2Index(event.beginBeat);
Mix(frame,eventFrame,beginIndex);
}
}
void Mixer::GetWave(stk::StkFrames &frame, const MIDITrack &midiTrack)
{
frame.resize(Beat2Index(poj->beatLength));
for(int i = 0; i < midiTrack.midiClips.size(); i++)
{
const MIDIClip &clip = midiTrack.midiClips.at(i);
stk::StkFrames clipFrame;
GetWave(clipFrame,clip,midiTrack.instrmnt);
int beginIndex = Beat2Index(clip.beginBeat);
Mix(frame,clipFrame,beginIndex);
}
Gain(frame,midiTrack.volume);
}
void Mixer::GetWave(stk::StkFrames &frame)
{
frame.resize(Beat2Index(poj->beatLength));
for(int i = 0; i < poj->tracks.size(); i++)
{
const MIDITrack &track = poj->tracks.at(i);
stk::StkFrames trackFrame;
GetWave(trackFrame,track);
stk::FileWvOut fileOut("track " + to_string(i) + ".wav");
fileOut.tick(frame);
Mix(frame,trackFrame);
}
}
|
#include <bits/stdc++.h>
using namespace std;
int main()
{
int testCases;
cin >> testCases;
while (testCases--)
{
long long int N,M,K;
cin>>N>>M>>K;
long long int lowerlimit = K+1+1;
long long int upperlimit = K+N+M;
long long int midlimit = (lowerlimit+upperlimit)/2;
long long int sum=lowerlimit;
long long int count=2;
for(long long int i=lowerlimit+1;i<=midlimit;i++)
{
long long int j=0,temp=0;
while(j<count)
{
temp^=i;
j++;
}
sum^=temp;
if( count < min(N,M))
count++;
else
break;
}
cout<<count<<endl;
count--;
for(long long int i=midlimit+1;i<upperlimit;i++)
{
if(count==1)
break;
long long int j=0,temp=0;
while(j<count)
{
temp^=i;
j++;
}
sum^=temp;
count--;
}
cout<<count<<endl;
sum=sum^upperlimit;
cout<<sum<<endl;
}
return 0;
}
|
; A073361: Nested floor product of n and fractions (k+1)/k for all k>0 (mod 4), divided by 4.
; 1,5,15,31,65,105,151,275,420,631,695,1050,1411,1685,2385,2941,3425,4410,5326,6995,7350,9316,10880
add $0,1
seq $0,112561 ; Sieve performed by successive iterations of steps where step m is: keep m terms, remove the next 3 and repeat; as m = 1,2,3,.. the remaining terms form this sequence.
div $0,4
|
; A140090: a(n) = n*(3*n + 7)/2.
; 0,5,13,24,38,55,75,98,124,153,185,220,258,299,343,390,440,493,549,608,670,735,803,874,948,1025,1105,1188,1274,1363,1455,1550,1648,1749,1853,1960,2070,2183,2299,2418,2540,2665,2793,2924,3058,3195,3335,3478,3624,3773,3925,4080,4238,4399,4563,4730,4900,5073,5249,5428,5610,5795,5983,6174,6368,6565,6765,6968,7174,7383,7595,7810,8028,8249,8473,8700,8930,9163,9399,9638,9880,10125,10373,10624,10878,11135,11395,11658,11924,12193,12465,12740,13018,13299,13583,13870,14160,14453,14749,15048
mov $1,3
mul $1,$0
add $1,7
mul $1,$0
div $1,2
mov $0,$1
|
; A314752: Coordination sequence Gal.6.258.4 where G.u.t.v denotes the coordination sequence for a vertex of type v in tiling number t in the Galebach list of u-uniform tilings.
; 1,5,9,13,19,23,27,31,37,41,45,50,55,59,63,69,73,77,81,87,91,95,100,105,109,113,119,123,127,131,137,141,145,150,155,159,163,169,173,177,181,187,191,195,200,205,209,213,219,223
mov $5,$0
mul $0,3
mov $4,$0
sub $0,1
div $0,11
add $0,1
mov $2,$4
mul $2,2
div $2,22
add $2,$0
mov $1,$2
mov $3,$5
mul $3,4
add $1,$3
mov $0,$1
|
; Keen Dreams Source Code
; Copyright (C) 2014 Javier M. Chavez
;
; This program is free software; you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 2 of the License, or
; (at your option) any later version.
;
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License along
; with this program; if not, write to the Free Software Foundation, Inc.,
; 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
;=================================
;
; CGA view manager routines
;
;=================================
;============================================================================
;
; All of these routines draw into a floating virtual screen segment in main
; memory. bufferofs points to the origin of the drawing page in screenseg.
; The routines that write out words must take into account buffer wrapping
; and not write a word at 0xffff (which causes an exception on 386s).
;
; The direction flag should be clear
;
;============================================================================
DATASEG
plotpixels db 0c0h,030h,0ch,03h
colorbyte db 000000b,01010101b,10101010b,11111111b
colorword dw 0,5555h,0aaaah,0ffffh
CODESEG
;============================================================================
;
; VW_Plot (int x,y,color)
;
;============================================================================
PROC VW_Plot x:WORD, y:WORD, color:WORD
PUBLIC VW_Plot
USES SI,DI
mov es,[screenseg]
mov di,[bufferofs]
mov bx,[y]
shl bx,1
add di,[ylookup+bx]
mov bx,[x]
mov ax,bx
shr ax,1
shr ax,1
add di,ax ; di = byte on screen
and bx,3
mov ah,[plotpixels+bx]
mov bx,[color]
mov cl,[colorbyte+bx]
and cl,ah
not ah
mov al,[es:di]
and al,ah ; mask off other pixels
or al,cl
stosb
ret
ENDP
;============================================================================
;
; VW_Vlin (int yl,yh,x,color)
;
;============================================================================
PROC VW_Vlin yl:WORD, yh:WORD, x:WORD, color:WORD
PUBLIC VW_Vlin
USES SI,DI
mov es,[screenseg]
mov di,[bufferofs]
mov bx,[yl]
shl bx,1
add di,[ylookup+bx]
mov bx,[x]
mov ax,bx
shr ax,1
shr ax,1
add di,ax ; di = byte on screen
and bx,3
mov ah,[plotpixels+bx]
mov bx,[color]
mov bl,[colorbyte+bx]
and bl,ah
not ah
mov cx,[yh]
sub cx,[yl]
inc cx ;number of pixels to plot
mov dx,[linewidth]
@@plot:
mov al,[es:di]
and al,ah ; mask off other pixels
or al,bl
mov [es:di],al
add di,dx
loop @@plot
ret
ret
ENDP
;============================================================================
;===================
;
; VW_DrawTile8
;
; xcoord in bytes (8 pixels), ycoord in pixels
; All Tile8s are in one grseg, so an offset is calculated inside it
;
; DONE
;
;===================
PROC VW_DrawTile8 xcoord:WORD, ycoord:WORD, tile:WORD
PUBLIC VW_DrawTile8
USES SI,DI
mov es,[screenseg]
mov di,[bufferofs]
add di,[xcoord]
mov bx,[ycoord]
shl bx,1
add di,[ylookup+bx]
mov bx,[linewidth]
sub bx,2
mov si,[tile]
shl si,1
shl si,1
shl si,1
shl si,1
mov ds,[grsegs+STARTTILE8*2] ; segment for all tile8s
;
; start drawing
;
REPT 7
movsb ;no word moves because of segment wrapping
movsb
add di,bx
ENDM
movsb
movsb
mov ax,ss
mov ds,ax ;restore turbo's data segment
ret
ENDP
;============================================================================
;
; VW_MaskBlock
;
; Draws a masked block shape to the screen. bufferofs is NOT accounted for.
; The mask comes first, then the data. Seperate unwound routines are used
; to speed drawing.
;
; Mask blocks will allways be an even width because of the way IGRAB works
;
; DONE
;
;============================================================================
DATASEG
UNWOUNDMASKS = 18
maskroutines dw mask0,mask0,mask2E,mask2O,mask4E,mask4O
dw mask6E,mask6O,mask8E,mask8O,mask10E,mask10O
dw mask12E,mask12O,mask14E,mask14O,mask16E,mask16O
dw mask18E,mask18O
routinetouse dw ?
CODESEG
PROC VW_MaskBlock segm:WORD, ofs:WORD, dest:WORD, wide:WORD, height:WORD, planesize:WORD
PUBLIC VW_MaskBlock
USES SI,DI
mov es,[screenseg]
mov di,[wide]
mov dx,[linewidth]
sub dx,di ;dx = delta to start of next line
mov bx,[planesize] ; si+bx = data location
cmp di,UNWOUNDMASKS
jbe @@unwoundroutine
;==============
;
; General purpose masked block drawing. This could be optimised into
; four routines to use words, but few play loop sprites should be this big!
;
;==============
mov [ss:linedelta],dx
mov ds,[segm]
mov si,[ofs]
mov di,[dest]
mov dx,[height] ;scan lines to draw
@@lineloopgen:
mov cx,[wide]
@@byteloop:
mov al,[es:di]
and al,[si]
or al,[bx+si]
inc si
stosb
loop @@byteloop
add di,[ss:linedelta]
dec dx
jnz @@lineloopgen
mask0:
mov ax,ss
mov ds,ax
ret ;width of 0 = no drawing
;=================
;
; use the unwound routines
;
;=================
@@unwoundroutine:
shr di,1 ;we only have even width unwound routines
mov cx,[dest]
shr cx,1
rcl di,1 ;shift a 1 in if destination is odd
shl di,1
mov ax,[maskroutines+di] ;call the right routine
mov ds,[segm]
mov si,[ofs]
mov di,[dest]
mov cx,[height] ;scan lines to draw
jmp ax ;draw it
;=================
;
; Horizontally unwound routines to draw certain masked blocks faster
;
;=================
MACRO MASKBYTE
mov al,[es:di]
and al,[si]
or al,[bx+si]
inc si
stosb
ENDM
MACRO MASKWORD
mov ax,[es:di]
and ax,[si]
or ax,[bx+si]
inc si
inc si
stosw
ENDM
MACRO SPRITELOOP addr
add di,dx
loop addr
mov ax,ss
mov ds,ax
ret
ENDM
EVEN
mask2E:
MASKWORD
SPRITELOOP mask2E
EVEN
mask2O:
MASKBYTE
MASKBYTE
SPRITELOOP mask2O
EVEN
mask4E:
MASKWORD
MASKWORD
SPRITELOOP mask4E
EVEN
mask4O:
MASKBYTE
MASKWORD
MASKBYTE
SPRITELOOP mask4O
EVEN
mask6E:
MASKWORD
MASKWORD
MASKWORD
SPRITELOOP mask6E
EVEN
mask6O:
MASKBYTE
MASKWORD
MASKWORD
MASKBYTE
SPRITELOOP mask6O
EVEN
mask8E:
MASKWORD
MASKWORD
MASKWORD
MASKWORD
SPRITELOOP mask8E
EVEN
mask8O:
MASKBYTE
MASKWORD
MASKWORD
MASKWORD
MASKBYTE
SPRITELOOP mask8O
EVEN
mask10E:
MASKWORD
MASKWORD
MASKWORD
MASKWORD
MASKWORD
SPRITELOOP mask10E
EVEN
mask10O:
MASKBYTE
MASKWORD
MASKWORD
MASKWORD
MASKWORD
MASKBYTE
SPRITELOOP mask10O
EVEN
mask12E:
MASKWORD
MASKWORD
MASKWORD
MASKWORD
MASKWORD
MASKWORD
SPRITELOOP mask12E
EVEN
mask12O:
MASKBYTE
MASKWORD
MASKWORD
MASKWORD
MASKWORD
MASKWORD
MASKBYTE
SPRITELOOP mask12O
EVEN
mask14E:
MASKWORD
MASKWORD
MASKWORD
MASKWORD
MASKWORD
MASKWORD
MASKWORD
SPRITELOOP mask14E
EVEN
mask14O:
MASKBYTE
MASKWORD
MASKWORD
MASKWORD
MASKWORD
MASKWORD
MASKWORD
MASKBYTE
SPRITELOOP mask14O
EVEN
mask16E:
MASKWORD
MASKWORD
MASKWORD
MASKWORD
MASKWORD
MASKWORD
MASKWORD
MASKWORD
SPRITELOOP mask16E
EVEN
mask16O:
MASKBYTE
MASKWORD
MASKWORD
MASKWORD
MASKWORD
MASKWORD
MASKWORD
MASKWORD
MASKBYTE
SPRITELOOP mask16O
EVEN
mask18E:
MASKWORD
MASKWORD
MASKWORD
MASKWORD
MASKWORD
MASKWORD
MASKWORD
MASKWORD
MASKWORD
SPRITELOOP mask18E
EVEN
mask18O:
MASKBYTE
MASKWORD
MASKWORD
MASKWORD
MASKWORD
MASKWORD
MASKWORD
MASKWORD
MASKWORD
MASKBYTE
SPRITELOOP mask18O
ENDP
;============================================================================
;
; VW_ScreenToScreen
;
; Basic block copy routine. Copies one block of screen memory to another,
; bufferofs is NOT accounted for.
;
; DONE
;
;============================================================================
PROC VW_ScreenToScreen source:WORD, dest:WORD, wide:WORD, height:WORD
PUBLIC VW_ScreenToScreen
USES SI,DI
mov bx,[linewidth]
sub bx,[wide]
mov ax,[screenseg]
mov es,ax
mov ds,ax
mov si,[source]
mov di,[dest] ;start at same place in all planes
mov dx,[height] ;scan lines to draw
mov ax,[wide]
;
; if the width, source, and dest are all even, use word moves
; This is allways the case in the CGA refresh
;
test ax,1
jnz @@bytelineloop
test si,1
jnz @@bytelineloop
test di,1
jnz @@bytelineloop
shr ax,1
@@wordlineloop:
mov cx,ax
rep movsw
add si,bx
add di,bx
dec dx
jnz @@wordlineloop
mov ax,ss
mov ds,ax ;restore turbo's data segment
ret
@@bytelineloop:
mov cx,ax
rep movsb
add si,bx
add di,bx
dec dx
jnz @@bytelineloop
mov ax,ss
mov ds,ax ;restore turbo's data segment
ret
ENDP
;============================================================================
;
; VW_MemToScreen
;
; Basic block drawing routine. Takes a block shape at segment pointer source
; of width by height data, and draws it to dest in the virtual screen,
; based on linewidth. bufferofs is NOT accounted for.
; There are four drawing routines to provide the best optimized code while
; accounting for odd segment wrappings due to the floating screens.
;
; DONE
;
;============================================================================
DATASEG
memtoscreentable dw eventoeven,eventoodd,oddtoeven,oddtoodd
CODESEG
PROC VW_MemToScreen source:WORD, dest:WORD, wide:WORD, height:WORD
PUBLIC VW_MemToScreen
USES SI,DI
mov es,[screenseg]
mov bx,[linewidth]
sub bx,[wide]
mov ds,[source]
xor si,si ;block is segment aligned
xor di,di
shr [wide],1 ;change wide to words, and see if carry is set
rcl di,1 ;1 if wide is odd
mov ax,[dest]
shr ax,1
rcl di,1 ;shift a 1 in if destination is odd
shl di,1 ;to index into a word width table
mov dx,[height] ;scan lines to draw
mov ax,[wide]
jmp [ss:memtoscreentable+di] ;call the right routine
;==============
;
; Copy an even width block to an even destination address
;
;==============
eventoeven:
mov di,[dest] ;start at same place in all planes
EVEN
@@lineloopEE:
mov cx,ax
rep movsw
add di,bx
dec dx
jnz @@lineloopEE
mov ax,ss
mov ds,ax ;restore turbo's data segment
ret
;==============
;
; Copy an odd width block to an even video address
;
;==============
oddtoeven:
mov di,[dest] ;start at same place in all planes
EVEN
@@lineloopOE:
mov cx,ax
rep movsw
movsb ;copy the last byte
add di,bx
dec dx
jnz @@lineloopOE
mov ax,ss
mov ds,ax ;restore turbo's data segment
ret
;==============
;
; Copy an even width block to an odd video address
;
;==============
eventoodd:
mov di,[dest] ;start at same place in all planes
dec ax ;one word has to be handled seperately
EVEN
@@lineloopEO:
movsb
mov cx,ax
rep movsw
movsb
add di,bx
dec dx
jnz @@lineloopEO
mov ax,ss
mov ds,ax ;restore turbo's data segment
ret
;==============
;
; Copy an odd width block to an odd video address
;
;==============
oddtoodd:
mov di,[dest] ;start at same place in all planes
EVEN
@@lineloopOO:
movsb
mov cx,ax
rep movsw
add di,bx
dec dx
jnz @@lineloopOO
mov ax,ss
mov ds,ax ;restore turbo's data segment
ret
ENDP
;===========================================================================
;
; VW_ScreenToMem
;
; Copies a block of video memory to main memory, in order from planes 0-3.
; This could be optimized along the lines of VW_MemToScreen to take advantage
; of word copies, but this is an infrequently called routine.
;
; DONE
;
;===========================================================================
PROC VW_ScreenToMem source:WORD, dest:WORD, wide:WORD, height:WORD
PUBLIC VW_ScreenToMem
USES SI,DI
mov es,[dest]
mov bx,[linewidth]
sub bx,[wide]
mov ds,[screenseg]
xor di,di
mov si,[source]
mov dx,[height] ;scan lines to draw
@@lineloop:
mov cx,[wide]
rep movsb
add si,bx
dec dx
jnz @@lineloop
mov ax,ss
mov ds,ax ;restore turbo's data segment
ret
ENDP
;===========================================================================
;
; MISC CGA ROUTINES
;
;===========================================================================
;==============
;
; VW_SetScreen
;
; DONE
;
;==============
PROC VW_SetScreen crtc:WORD
PUBLIC VW_SetScreen
;
; for some reason, my XT's EGA card doesn't like word outs to the CRTC
; index...
;
cli
mov cx,[crtc]
mov dx,CRTC_INDEX
mov al,0ch ;start address high register
out dx,al
inc dx
mov al,ch
out dx,al
dec dx
mov al,0dh ;start address low register
out dx,al
mov al,cl
inc dx
out dx,al
sti
ret
ENDP
if NUMFONT+NUMFONTM
;===========================================================================
;
; GENERAL FONT DRAWING ROUTINES
;
;===========================================================================
DATASEG
px dw ? ; proportional character drawing coordinates
py dw ?
pdrawmode db 11000b ; 8 = OR, 24 = XOR, put in GC_DATAROTATE
fontcolor db 15 ;0-15 mapmask value
PUBLIC px,py,pdrawmode,fontcolor
;
; offsets in font structure
;
pcharheight = 0 ;lines high
charloc = 2 ;pointers to every character
charwidth = 514 ;every character's width in pixels
propchar dw ? ; the character number to shift
stringptr dw ?,?
fontcolormask dw ? ; font color expands into this
BUFFWIDTH = 100
BUFFHEIGHT = 32 ; must be twice as high as font for masked fonts
databuffer db BUFFWIDTH*BUFFHEIGHT dup (?)
bufferwidth dw ? ; bytes with valid info / line
bufferheight dw ? ; number of lines currently used
bufferbyte dw ?
bufferbit dw ?
PUBLIC bufferwidth,bufferheight,bufferbyte,bufferbit
screenspot dw ? ; where the buffer is going
bufferextra dw ? ; add at end of a line copy
screenextra dw ?
CODESEG
;======================
;
; Macros to table shift a byte of font
;
;======================
MACRO SHIFTNOXOR
mov al,[es:bx] ; source
xor ah,ah
shl ax,1
mov si,ax
mov ax,[bp+si] ; table shift into two bytes
or [di],al ; or with first byte
inc di
mov [di],ah ; replace next byte
inc bx ; next source byte
ENDM
MACRO SHIFTWITHXOR
mov al,[es:bx] ; source
xor ah,ah
shl ax,1
mov si,ax
mov ax,[bp+si] ; table shift into two bytes
not ax
and [di],al ; and with first byte
inc di
mov [di],ah ; replace next byte
inc bx ; next source byte
ENDM
;=======================
;
; VWL_XORBuffer
;
; Pass buffer start in SI (somewhere in databuffer)
; Draws the buffer to the screen buffer
;
;========================
PROC VWL_XORBuffer NEAR
USES BP
mov bl,[fontcolor]
xor bh,bh
shl bx,1
mov ax,[colorword+bx]
mov [fontcolormask],ax
mov es,[screenseg]
mov di,[screenspot]
mov bx,[bufferwidth] ;calculate offsets for end of each line
mov [bufferwidth],bx
or bx,bx
jnz @@isthere
ret ;nothing to draw
@@isthere:
test bx,1
jnz @@odd
jmp @@even
;
; clear the last byte so word draws can be used
;
@@odd:
mov al,0
line = 0
REPT BUFFHEIGHT
mov [BYTE databuffer+BUFFWIDTH*line+bx],al
line = line+1
ENDM
inc bx
@@even:
mov ax,[linewidth]
sub ax,bx
mov [screenextra],ax
mov ax,BUFFWIDTH
sub ax,bx
mov [bufferextra],ax
mov dx,bx
shr dx,1 ;word to copy
mov bx,[bufferheight] ;lines to copy
mov bp,[fontcolormask]
@@lineloop:
mov cx,dx
@@wordloop:
lodsw ;get a word from the buffer
and ax,bp
xor [es:di],ax ;draw it
add di,2
loop @@wordloop
add si,[bufferextra]
add di,[screenextra]
dec bx
jnz @@lineloop
ret
ENDP
DATASEG
;============================================================================
;
; NON MASKED FONT DRAWING ROUTINES
;
;============================================================================
if numfont
DATASEG
shiftdrawtable dw 0,shift1wide,shift2wide,shift3wide,shift4wide
dw shift5wide,shift6wide
CODESEG
;==================
;
; ShiftPropChar
;
; Call with BX = character number (0-255)
; Draws one character to the buffer at bufferbyte/bufferbit, and adjusts
; them to the new position
;
;==================
PROC ShiftPropChar NEAR
mov es,[grsegs+STARTFONT*2] ;segment of font to use
;
; find character location, width, and height
;
mov si,[es:charwidth+bx]
and si,0ffh ;SI hold width in pixels
shl bx,1
mov bx,[es:charloc+bx] ;BX holds pointer to character data
;
; look up which shift table to use, based on bufferbit
;
mov di,[bufferbit]
shl di,1
mov bp,[shifttabletable+di] ;BP holds pointer to shift table
mov di,OFFSET databuffer
add di,[bufferbyte] ;DI holds pointer to buffer
mov cx,[bufferbit]
add cx,si ;add twice because pixel == two bits
add cx,si ;new bit position
mov ax,cx
and ax,7
mov [bufferbit],ax ;new bit position
mov ax,cx
shr ax,1
shr ax,1
shr ax,1
add [bufferbyte],ax ;new byte position
add si,3
shr si,1
shr si,1 ;bytes the character is wide
shl si,1 ;*2 to look up in shiftdrawtable
mov cx,[es:pcharheight]
mov dx,BUFFWIDTH
jmp [ss:shiftdrawtable+si] ;procedure to draw this width
;
; one byte character
;
shift1wide:
dec dx
EVEN
@@loop1:
SHIFTNOXOR
add di,dx ; next line in buffer
loop @@loop1
ret
;
; two byte character
;
shift2wide:
dec dx
dec dx
EVEN
@@loop2:
SHIFTNOXOR
SHIFTNOXOR
add di,dx ; next line in buffer
loop @@loop2
ret
;
; three byte character
;
shift3wide:
sub dx,3
EVEN
@@loop3:
SHIFTNOXOR
SHIFTNOXOR
SHIFTNOXOR
add di,dx ; next line in buffer
loop @@loop3
ret
;
; four byte character
;
shift4wide:
sub dx,4
EVEN
@@loop4:
SHIFTNOXOR
SHIFTNOXOR
SHIFTNOXOR
SHIFTNOXOR
add di,dx ; next line in buffer
loop @@loop4
ret
;
; five byte character
;
shift5wide:
sub dx,5
EVEN
@@loop5:
SHIFTNOXOR
SHIFTNOXOR
SHIFTNOXOR
SHIFTNOXOR
SHIFTNOXOR
add di,dx ; next line in buffer
loop @@loop5
ret
;
; six byte character
;
shift6wide:
sub dx,6
EVEN
@@loop6:
SHIFTNOXOR
SHIFTNOXOR
SHIFTNOXOR
SHIFTNOXOR
SHIFTNOXOR
SHIFTNOXOR
add di,dx ; next line in buffer
loop @@loop6
ret
ENDP
;============================================================================
;==================
;
; VW_DrawPropString
;
; Draws a C string of characters at px/py and advances px
;
;==================
CODESEG
PROC VW_DrawPropString string:DWORD
PUBLIC VW_DrawPropString
USES SI,DI
;
; proportional spaceing, which clears the buffer ahead of it, so only
; clear the first collumn
;
mov al,0
line = 0
REPT BUFFHEIGHT
mov [BYTE databuffer+BUFFWIDTH*line],al
line = line+1
ENDM
;
; shift the characters into the buffer
;
@@shiftchars:
mov ax,[px]
and ax,3
shl ax,1 ;one pixel == two bits
mov [bufferbit],ax
mov [bufferbyte],0
mov ax,[WORD string]
mov [stringptr],ax
mov ax,[WORD string+2]
mov [stringptr+2],ax
@@shiftone:
mov es,[stringptr+2]
mov bx,[stringptr]
inc [stringptr]
mov bx,[es:bx]
xor bh,bh
or bl,bl
jz @@allshifted
call ShiftPropChar
jmp @@shiftone
@@allshifted:
;
; calculate position to draw buffer on screen
;
mov bx,[py]
shl bx,1
mov di,[ylookup+bx]
add di,[bufferofs]
add di,[panadjust]
mov ax,[px]
shr ax,1
shr ax,1 ;x location in bytes
add di,ax
mov [screenspot],di
;
; advance px
;
mov ax,[bufferbyte]
shl ax,1
shl ax,1
mov bx,[bufferbit]
shr bx,1 ;two bits == one pixel
or ax,bx
add [px],ax
;
; draw it
;
mov ax,[bufferbyte]
test [bufferbit],7
jz @@go
inc ax ;so the partial byte also gets drawn
@@go:
mov [bufferwidth],ax
mov es,[grsegs+STARTFONT*2]
mov ax,[es:pcharheight]
mov [bufferheight],ax
mov si,OFFSET databuffer
call VWL_XORBuffer
ret
ENDP
endif ;numfont
;============================================================================
;
; MASKED FONT DRAWING ROUTINES
;
;============================================================================
if numfontm
DATASEG
mshiftdrawtable dw 0,mshift1wide,mshift2wide,mshift3wide
CODESEG
;==================
;
; ShiftMPropChar
;
; Call with BX = character number (0-255)
; Draws one character to the buffer at bufferbyte/bufferbit, and adjusts
; them to the new position
;
;==================
PROC ShiftMPropChar NEAR
mov es,[grsegs+STARTFONTM*2] ;segment of font to use
;
; find character location, width, and height
;
mov si,[es:charwidth+bx]
and si,0ffh ;SI hold width in pixels
shl bx,1
mov bx,[es:charloc+bx] ;BX holds pointer to character data
;
; look up which shift table to use, based on bufferbit
;
mov di,[bufferbit]
shl di,1
mov bp,[shifttabletable+di] ;BP holds pointer to shift table
mov di,OFFSET databuffer
add di,[bufferbyte] ;DI holds pointer to buffer
;
; advance position by character width
;
mov cx,[bufferbit]
add cx,si ;new bit position
mov ax,cx
and ax,7
mov [bufferbit],ax ;new bit position
mov ax,cx
shr ax,1
shr ax,1
shr ax,1
add [bufferbyte],ax ;new byte position
add si,7
shr si,1
shr si,1
shr si,1 ;bytes the character is wide
shl si,1 ;*2 to look up in shiftdrawtable
mov cx,[es:pcharheight]
mov dx,BUFFWIDTH
jmp [ss:mshiftdrawtable+si] ;procedure to draw this width
;
; one byte character
;
mshift1wide:
dec dx
EVEN
@@loop1m:
SHIFTWITHXOR
add di,dx ; next line in buffer
loop @@loop1m
mov cx,[es:pcharheight]
EVEN
@@loop1:
SHIFTNOXOR
add di,dx ; next line in buffer
loop @@loop1
ret
;
; two byte character
;
mshift2wide:
dec dx
dec dx
EVEN
@@loop2m:
SHIFTWITHXOR
SHIFTWITHXOR
add di,dx ; next line in buffer
loop @@loop2m
mov cx,[es:pcharheight]
EVEN
@@loop2:
SHIFTNOXOR
SHIFTNOXOR
add di,dx ; next line in buffer
loop @@loop2
ret
;
; three byte character
;
mshift3wide:
sub dx,3
EVEN
@@loop3m:
SHIFTWITHXOR
SHIFTWITHXOR
SHIFTWITHXOR
add di,dx ; next line in buffer
loop @@loop3m
mov cx,[es:pcharheight]
EVEN
@@loop3:
SHIFTNOXOR
SHIFTNOXOR
SHIFTNOXOR
add di,dx ; next line in buffer
loop @@loop3
ret
ENDP
;============================================================================
;==================
;
; VW_DrawMPropString
;
; Draws a C string of characters at px/py and advances px
;
;==================
PROC VW_DrawMPropString string:DWORD
PUBLIC VW_DrawMPropString
USES SI,DI
;
; clear out the first byte of the buffer, the rest will automatically be
; cleared as characters are drawn into it
;
mov es,[grsegs+STARTFONTM*2]
mov dx,[es:pcharheight]
mov di,OFFSET databuffer
mov ax,ds
mov es,ax
mov bx,BUFFWIDTH-1
mov cx,dx
mov al,0ffh
@@maskfill:
stosb ; fill the mask part with $ff
add di,bx
loop @@maskfill
mov cx,dx
xor al,al
@@datafill:
stosb ; fill the data part with $0
add di,bx
loop @@datafill
;
; shift the characters into the buffer
;
mov ax,[px]
and ax,7
mov [bufferbit],ax
mov [bufferbyte],0
mov ax,[WORD string]
mov [stringptr],ax
mov ax,[WORD string+2]
mov [stringptr+2],ax
@@shiftone:
mov es,[stringptr+2]
mov bx,[stringptr]
inc [stringptr]
mov bx,[es:bx]
xor bh,bh
or bl,bl
jz @@allshifted
call ShiftMPropChar
jmp @@shiftone
@@allshifted:
;
; calculate position to draw buffer on screen
;
mov bx,[py]
shl bx,1
mov di,[ylookup+bx]
add di,[bufferofs]
mov ax,[px]
shr ax,1
shr ax,1
shr ax,1 ;x location in bytes
add di,ax
mov [screenspot],di
;
; advance px
;
mov ax,[bufferbyte]
shl ax,1
shl ax,1
shl ax,1
or ax,[bufferbit]
add [px],ax
;
; draw it
;
mov ax,[bufferbyte]
test [bufferbit],7
jz @@go
inc ax ;so the partial byte also gets drawn
@@go:
mov [bufferwidth],ax
mov es,[grsegs+STARTFONTM*2]
mov ax,[es:pcharheight]
mov [bufferheight],ax
mov si,OFFSET databuffer
call BufferToScreen ; cut out mask
; or in data
call BufferToScreen ; SI is still in the right position in buffer
ret
ENDP
endif ; if numfontm
endif ; if fonts
|
; A095662: Seventh column (m=6) of (1,3)-Pascal triangle A095660.
; 3,19,70,196,462,966,1848,3300,5577,9009,14014,21112,30940,44268,62016,85272,115311,153615,201894,262108,336490,427570,538200,671580,831285,1021293,1246014,1510320,1819576,2179672,2597056,3078768,3632475
add $0,5
mov $1,13
add $1,$0
bin $0,5
mul $0,$1
mov $1,$0
div $1,6
|
; A130719: a(n) = n-th digit after the decimal point of the decimal representation of the n-th harmonic number.
; Submitted by Jamie Morken(w2)
; 0,0,3,3,3,0,1,4,3,9,7,0,7,2,3,2,3,0,4,8,1,8,4,3,6,1,1,6,9,4,4,0,9,1,3,7,1,4,2,6,0,6,0,2,3,5,2,9,4,5,3,6,7,8,4,3,5,3,3,5,0,5,2,1,0,2,0,8,8,7,0,0,1,7,9,9,8,5,1,0
add $0,1
mov $2,1
mov $3,$0
mov $0,1
lpb $3
mul $0,10
mul $1,$3
mov $4,$3
add $4,1
mul $2,$4
add $1,$2
sub $3,1
lpe
mul $1,$0
div $1,$2
mov $0,$1
mod $0,10
|
// MIT License
//
// Copyright (c) 2020, The Regents of the University of California,
// through Lawrence Berkeley National Laboratory (subject to receipt of any
// required approvals from the U.S. Dept. of Energy). 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.
/**
* \file timemory/operations/types/finalize/mpi_get.hpp
* \brief Definition for various functions for finalizing MPI data
*/
#pragma once
#include "timemory/operations/declaration.hpp"
#include "timemory/operations/macros.hpp"
#include "timemory/operations/types.hpp"
#include "timemory/operations/types/finalize/get.hpp"
#include "timemory/settings/declaration.hpp"
namespace tim
{
namespace operation
{
namespace finalize
{
//
//--------------------------------------------------------------------------------------//
//
template <typename Type>
struct mpi_get<Type, true>
{
static constexpr bool value = true;
using this_type = mpi_get<Type, value>;
using storage_type = impl::storage<Type, value>;
using result_type = typename storage_type::result_array_t;
using distrib_type = typename storage_type::dmp_result_t;
using result_node = typename storage_type::result_node;
using graph_type = typename storage_type::graph_t;
using graph_node = typename storage_type::graph_node;
using hierarchy_type = typename storage_type::uintvector_t;
using get_type = get<Type, value>;
using metadata_t = typename get_type::metadata;
using basic_tree_type = typename get_type::basic_tree_vector_type;
using basic_tree_vector_type = std::vector<basic_tree_type>;
static auto& plus(Type& lhs, const Type& rhs) { return (lhs += rhs); }
explicit TIMEMORY_COLD mpi_get(storage_type& _storage)
: m_storage(&_storage)
{}
TIMEMORY_COLD distrib_type& operator()(distrib_type&);
TIMEMORY_COLD basic_tree_vector_type& operator()(basic_tree_vector_type&);
template <typename Archive>
TIMEMORY_COLD enable_if_t<concepts::is_output_archive<Archive>::value, Archive&>
operator()(Archive&);
// this serializes a type (src) and adds it to dst, if !collapse_processes
// then it uses the adder to combine the data
TIMEMORY_COLD
mpi_get(std::vector<Type>& dst, const Type& src,
std::function<Type&(Type& lhs, const Type& rhs)>&& adder = this_type::plus);
private:
storage_type* m_storage = nullptr;
};
//
//--------------------------------------------------------------------------------------//
//
template <typename Type>
struct mpi_get<Type, false>
{
static constexpr bool value = false;
using storage_type = impl::storage<Type, value>;
mpi_get(storage_type&) {}
template <typename Tp>
Tp& operator()(Tp&)
{}
};
//
//--------------------------------------------------------------------------------------//
//
template <typename Type>
typename mpi_get<Type, true>::distrib_type&
mpi_get<Type, true>::operator()(distrib_type& results)
{
if(!m_storage)
return results;
auto& data = *m_storage;
#if !defined(TIMEMORY_USE_MPI)
if(settings::debug())
PRINT_HERE("%s", "timemory not using MPI");
results = distrib_type{};
results.emplace_back(std::move(data.get()));
#else
if(settings::debug())
PRINT_HERE("%s", "timemory using MPI");
// not yet implemented
// auto comm =
// (settings::mpi_output_per_node()) ? mpi::get_node_comm() : mpi::comm_world_v;
auto comm = mpi::comm_world_v;
mpi::barrier(comm);
int comm_rank = mpi::rank(comm);
int comm_size = mpi::size(comm);
//------------------------------------------------------------------------------//
// Used to convert a result to a serialization
//
auto send_serialize = [&](const result_type& src) {
std::stringstream ss;
{
auto oa = policy::output_archive<cereal::MinimalJSONOutputArchive,
TIMEMORY_API>::get(ss);
(*oa)(cereal::make_nvp("data", src));
}
return ss.str();
};
//------------------------------------------------------------------------------//
// Used to convert the serialization to a result
//
auto recv_serialize = [&](const std::string& src) {
result_type ret;
std::stringstream ss;
ss << src;
{
auto ia =
policy::input_archive<cereal::JSONInputArchive, TIMEMORY_API>::get(ss);
(*ia)(cereal::make_nvp("data", ret));
if(settings::debug())
{
printf("[RECV: %i]> data size: %lli\n", comm_rank,
(long long int) ret.size());
}
}
return ret;
};
//------------------------------------------------------------------------------//
// Calculate the total number of measurement records
//
auto get_num_records = [&](const auto& _inp) {
int _sz = 0;
for(const auto& itr : _inp)
_sz += itr.size();
return _sz;
};
results = distrib_type(comm_size);
auto ret = data.get();
auto str_ret = send_serialize(ret);
if(comm_rank == 0)
{
//
// The root rank receives data from all non-root ranks and reports all data
//
for(int i = 1; i < comm_size; ++i)
{
std::string str;
if(settings::debug())
printf("[RECV: %i]> starting %i\n", comm_rank, i);
mpi::recv(str, i, 0, comm);
if(settings::debug())
printf("[RECV: %i]> completed %i\n", comm_rank, i);
results[i] = recv_serialize(str);
}
results[comm_rank] = std::move(ret);
}
else
{
//
// The non-root rank sends its data to the root rank and only reports own data
//
if(settings::debug())
printf("[SEND: %i]> starting\n", comm_rank);
mpi::send(str_ret, 0, 0, comm);
if(settings::debug())
printf("[SEND: %i]> completed\n", comm_rank);
results = distrib_type{};
results.emplace_back(std::move(ret));
}
// collapse into a single result
if(comm_rank == 0 && settings::collapse_processes() && settings::node_count() <= 1)
{
auto init_size = get_num_records(results);
if(settings::debug() || settings::verbose() > 3)
{
PRINT_HERE("[%s][pid=%i][rank=%i]> collapsing %i records from %i ranks",
demangle<mpi_get<Type, true>>().c_str(), (int) process::get_id(),
comm_rank, init_size, comm_size);
}
auto _collapsed = distrib_type{};
// so we can pop off back
std::reverse(results.begin(), results.end());
while(!results.empty())
{
if(_collapsed.empty())
{
_collapsed.emplace_back(std::move(results.back()));
}
else
{
operation::finalize::merge<Type, true>(_collapsed.front(),
results.back());
}
results.pop_back();
}
// assign results to collapsed entry
results = std::move(_collapsed);
if(settings::debug() || settings::verbose() > 3)
{
auto fini_size = get_num_records(results);
PRINT_HERE("[%s][pid=%i][rank=%i]> collapsed %i records into %i records "
"from %i ranks",
demangle<mpi_get<Type, true>>().c_str(), (int) process::get_id(),
comm_rank, init_size, fini_size, comm_size);
}
}
else if(comm_rank == 0 && settings::collapse_processes() &&
settings::node_count() > 1)
{
// calculate some size parameters
int32_t nmod = comm_size % settings::node_count();
int32_t bsize = comm_size / settings::node_count() + ((nmod == 0) ? 0 : 1);
int32_t bins = comm_size / bsize;
if(settings::debug() || settings::verbose() > 3)
{
PRINT_HERE("[%s][pid=%i][rank=%i]> node_count = %i, comm_size = %i, bins = "
"%i, bin size = %i",
demangle<mpi_get<Type, true>>().c_str(), (int) process::get_id(),
comm_rank, settings::node_count(), comm_size, bins, bsize);
}
// generate a map of the ranks to the node ids
int32_t ncnt = 0; // current count
int32_t midx = 0; // current bin map index
std::map<int32_t, std::set<int32_t>> binmap;
for(int32_t i = 0; i < comm_size; ++i)
{
if(settings::debug())
{
PRINT_HERE("[%s][pid=%i][rank=%i]> adding rank %i to bin %i",
demangle<mpi_get<Type, true>>().c_str(),
(int) process::get_id(), comm_rank, i, midx);
}
binmap[midx].insert(i);
// check to see if we reached the bin size
if(++ncnt == bsize)
{
// set counter to zero and advance the node
ncnt = 0;
++midx;
}
}
auto init_size = get_num_records(results);
if(settings::debug() || settings::verbose() > 3)
{
PRINT_HERE("[%s][pid=%i][rank=%i]> collapsing %i records from %i ranks into "
"%i bins",
demangle<mpi_get<Type, true>>().c_str(), (int) process::get_id(),
comm_rank, init_size, comm_size, (int) binmap.size());
}
assert((int32_t) binmap.size() <= (int32_t) settings::node_count());
// the collapsed data
auto _collapsed = distrib_type(binmap.size());
// loop over the node indexes
for(const auto& itr : binmap)
{
// target the node index
auto& _dst = _collapsed.at(itr.first);
for(const auto& bitr : itr.second)
{
// combine the node index entry with all of the ranks in that node
auto& _src = results.at(bitr);
operation::finalize::merge<Type, true>(_dst, _src);
}
}
// assign results to collapsed entry
results = std::move(_collapsed);
if(settings::debug() || settings::verbose() > 3)
{
auto fini_size = get_num_records(results);
PRINT_HERE("[%s][pid=%i][rank=%i]> collapsed %i records into %i records "
"and %i bins",
demangle<mpi_get<Type, true>>().c_str(), (int) process::get_id(),
comm_rank, init_size, fini_size, (int) results.size());
}
}
if(settings::debug() || settings::verbose() > 1)
{
auto ret_size = get_num_records(results);
PRINT_HERE("[%s][pid=%i]> %i total records on rank %i of %i",
demangle<mpi_get<Type, true>>().c_str(), (int) process::get_id(),
ret_size, comm_rank, comm_size);
}
#endif
return results;
}
//
//--------------------------------------------------------------------------------------//
//
template <typename Type>
typename mpi_get<Type, true>::basic_tree_vector_type&
mpi_get<Type, true>::operator()(basic_tree_vector_type& bt)
{
if(!m_storage)
return bt;
auto& data = *m_storage;
using serialization_t = serialization<Type>;
using mpi_data_t = typename serialization_t::mpi_data;
basic_tree_type _entry{};
bt = serialization_t{}(mpi_data_t{}, mpi::comm_world_v, data.get(_entry));
return bt;
}
//
//--------------------------------------------------------------------------------------//
//
template <typename Type>
template <typename Archive>
enable_if_t<concepts::is_output_archive<Archive>::value, Archive&>
mpi_get<Type, true>::operator()(Archive& ar)
{
if(!m_storage)
return ar;
if(!mpi::is_initialized())
{
get_type{ m_storage }(ar);
}
else
{
auto bt = basic_tree_vector_type{};
(*this)(bt);
serialization<Type>{}(ar, bt);
}
return ar;
}
//
//--------------------------------------------------------------------------------------//
//
template <typename Type>
mpi_get<Type, true>::mpi_get(std::vector<Type>& dst, const Type& inp,
std::function<Type&(Type& lhs, const Type& rhs)>&& functor)
{
#if !defined(TIMEMORY_USE_MPI)
if(settings::debug())
PRINT_HERE("%s", "timemory not using MPI");
consume_parameters(dst, inp, functor);
#else
CONDITIONAL_PRINT_HERE(settings::debug(), "%s", "timemory using MPI");
auto comm = mpi::comm_world_v;
mpi::barrier(comm);
int comm_rank = mpi::rank(comm);
int comm_size = mpi::size(comm);
CONDITIONAL_PRINT_HERE(settings::debug(), "timemory using MPI [rank: %i, size: %i]",
comm_rank, comm_size);
//------------------------------------------------------------------------------//
// Used to convert a result to a serialization
//
auto send_serialize = [&](const Type& src) {
std::stringstream ss;
{
auto oa = policy::output_archive<cereal::MinimalJSONOutputArchive,
TIMEMORY_API>::get(ss);
(*oa)(cereal::make_nvp("data", src));
}
CONDITIONAL_PRINT_HERE(settings::debug(), "sent data [rank: %i] :: %lu",
comm_rank, ss.str().length());
return ss.str();
};
//------------------------------------------------------------------------------//
// Used to convert the serialization to a result
//
auto recv_serialize = [&](const std::string& src) {
CONDITIONAL_PRINT_HERE(settings::debug(), "recv data [rank: %i] :: %lu",
comm_rank, src.length());
Type ret;
std::stringstream ss;
ss << src;
{
auto ia =
policy::input_archive<cereal::JSONInputArchive, TIMEMORY_API>::get(ss);
(*ia)(cereal::make_nvp("data", ret));
}
return ret;
};
//------------------------------------------------------------------------------//
// Calculate the total number of measurement records
//
auto get_num_records = [&](const auto& _inp) { return _inp.size(); };
dst.resize(comm_size);
auto str_ret = send_serialize(inp);
mpi::barrier(comm);
if(comm_rank == 0)
{
//
// The root rank receives data from all non-root ranks and reports all data
//
for(int i = 1; i < comm_size; ++i)
{
std::string str;
CONDITIONAL_PRINT_HERE(settings::debug(), "[RECV: %i]> starting %i",
comm_rank, i);
mpi::recv(str, i, 0, comm);
CONDITIONAL_PRINT_HERE(settings::debug(), "[RECV: %i]> completed %i",
comm_rank, i);
dst.at(i) = recv_serialize(str);
}
dst.at(0) = inp;
}
else
{
//
// The non-root rank sends its data to the root rank
//
CONDITIONAL_PRINT_HERE(settings::debug(), "[SEND: %i]> starting", comm_rank);
mpi::send(str_ret, 0, 0, comm);
CONDITIONAL_PRINT_HERE(settings::debug(), "[SEND: %i]> completed", comm_rank);
dst.clear();
}
mpi::barrier(comm);
// collapse into a single result
if(settings::collapse_processes() && comm_rank == 0)
{
auto init_size = get_num_records(dst);
CONDITIONAL_PRINT_HERE(
settings::debug() || settings::verbose() > 3,
"[%s][pid=%i][rank=%i]> collapsing %i records from %i ranks",
demangle<mpi_get<Type, true>>().c_str(), (int) process::get_id(),
(int) comm_rank, (int) init_size, (int) comm_size);
auto _dst = std::vector<Type>{};
for(auto& itr : dst)
{
if(_dst.empty())
{
_dst.emplace_back(std::move(itr));
}
else
{
_dst.front() = functor(_dst.front(), itr);
}
}
// assign dst to collapsed entry
dst = _dst;
CONDITIONAL_PRINT_HERE(
settings::debug() || settings::verbose() > 3,
"[%s][pid=%i][rank=%i]> collapsed %i records into %i records "
"from %i ranks",
demangle<mpi_get<Type, true>>().c_str(), (int) process::get_id(),
(int) comm_rank, (int) init_size, (int) get_num_records(dst),
(int) comm_size);
}
else if(settings::node_count() > 0 && comm_rank == 0)
{
// calculate some size parameters
int32_t nmod = comm_size % settings::node_count();
int32_t bsize = comm_size / settings::node_count() + ((nmod == 0) ? 0 : 1);
int32_t bins = comm_size / bsize;
CONDITIONAL_PRINT_HERE(
settings::debug() || settings::verbose() > 3,
"[%s][pid=%i][rank=%i]> node_count = %i, comm_size = %i, bins = "
"%i, bin size = %i",
demangle<mpi_get<Type, true>>().c_str(), (int) process::get_id(), comm_rank,
settings::node_count(), comm_size, bins, bsize);
// generate a map of the ranks to the node ids
int32_t ncnt = 0; // current count
int32_t midx = 0; // current bin map index
std::map<int32_t, std::set<int32_t>> binmap;
for(int32_t i = 0; i < comm_size; ++i)
{
CONDITIONAL_PRINT_HERE(settings::debug(),
"[%s][pid=%i][rank=%i]> adding rank %i to bin %i",
demangle<mpi_get<Type, true>>().c_str(),
(int) process::get_id(), comm_rank, i, midx);
binmap[midx].insert(i);
// check to see if we reached the bin size
if(++ncnt == bsize)
{
// set counter to zero and advance the node
ncnt = 0;
++midx;
}
}
auto init_size = get_num_records(dst);
CONDITIONAL_PRINT_HERE(
settings::debug() || settings::verbose() > 3,
"[%s][pid=%i][rank=%i]> collapsing %i records from %i ranks into %i bins",
demangle<mpi_get<Type, true>>().c_str(), (int) process::get_id(),
(int) comm_rank, (int) init_size, (int) comm_size, (int) binmap.size());
assert((int32_t) binmap.size() <= (int32_t) settings::node_count());
// the collapsed data
auto _dst = std::vector<Type>(binmap.size());
// loop over the node indexes
for(const auto& itr : binmap)
{
// target the node index
auto& _targ = _dst.at(itr.first);
for(const auto& bitr : itr.second)
{
// combine the node index entry with all of the ranks in that node
auto& _src = dst.at(bitr);
_targ = functor(_targ, _src);
}
}
// assign dst to collapsed entry
dst = _dst;
CONDITIONAL_PRINT_HERE(
settings::debug() || settings::verbose() > 3,
"[%s][pid=%i][rank=%i]> collapsed %i records into %i records "
"and %i bins",
demangle<mpi_get<Type, true>>().c_str(), (int) process::get_id(),
(int) comm_rank, (int) init_size, (int) get_num_records(dst),
(int) dst.size());
}
CONDITIONAL_PRINT_HERE(settings::debug() || settings::verbose() > 1,
"[%s][pid=%i]> %i total records on rank %i of %i",
demangle<mpi_get<Type, true>>().c_str(),
(int) process::get_id(), (int) get_num_records(dst),
(int) comm_rank, (int) comm_size);
#endif
}
//
//--------------------------------------------------------------------------------------//
//
} // namespace finalize
} // namespace operation
} // namespace tim
|
include "player_symbols.asm"
kp_triggerC SUBROUTINE
; x = instrument
; y = volume
lda #$04
sta kp_pat_wait_2
lda kp_insmap_lo,x
sta kp_osc_adr_0_2
sta kp_osc_adr_1_2
lda kp_insmap_hi,x
sta kp_osc_adr_0_2+1
sta kp_osc_adr_1_2+1
lda kp_volmap_lo,x
sta kp_vol_adr_0_2
lda kp_volmap_hi,x
sta kp_vol_adr_0_2+1
lda #$00
sta kp_osc_wait_2
sta kp_osc_pos_2
sta kp_vol_wait_2
sta kp_vol_pos_2
sty kp_vol_mod0_2
rts
; ----------------------------------------------
;kp_triggerB SUBROUTINE
; x = instrument
; y = volume
; lda #$04
; sta kp_pat_wait_1
; lda kp_insmap_lo,x
; sta kp_osc_adr_0_1
; sta kp_osc_adr_1_1
; lda kp_insmap_hi,x
; sta kp_osc_adr_0_1+1
; sta kp_osc_adr_1_1+1
; lda kp_volmap_lo,x
; sta kp_vol_adr_0_1
; lda kp_volmap_hi,x
; sta kp_vol_adr_0_1+1
; lda #$00
; sta kp_osc_wait_1
; sta kp_osc_pos_1
; sta kp_vol_wait_1
; sta kp_vol_pos_1
; sty kp_vol_mod0_1
; rts
|
; DO NOT MODIFY THIS FILE DIRECTLY!
; author: @TinySecEx
; ssdt asm stub for 6.1.7601-sp1-windows-7 i386
.686
.mmx
.xmm
.model flat,stdcall
option casemap:none
option prologue:none
option epilogue:none
.code
; ULONG __stdcall NtAcceptConnectPort( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 );
_6_1_7601_sp1_windows_7_NtAcceptConnectPort PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD
mov eax , 0
mov edx , 7FFE0300h
call dword ptr [edx]
ret 24
_6_1_7601_sp1_windows_7_NtAcceptConnectPort ENDP
; ULONG __stdcall NtAccessCheck( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 , ULONG arg_08 );
_6_1_7601_sp1_windows_7_NtAccessCheck PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD , arg_08:DWORD
mov eax , 1
mov edx , 7FFE0300h
call dword ptr [edx]
ret 32
_6_1_7601_sp1_windows_7_NtAccessCheck ENDP
; ULONG __stdcall NtAccessCheckAndAuditAlarm( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 , ULONG arg_08 , ULONG arg_09 , ULONG arg_10 , ULONG arg_11 );
_6_1_7601_sp1_windows_7_NtAccessCheckAndAuditAlarm PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD , arg_08:DWORD , arg_09:DWORD , arg_10:DWORD , arg_11:DWORD
mov eax , 2
mov edx , 7FFE0300h
call dword ptr [edx]
ret 44
_6_1_7601_sp1_windows_7_NtAccessCheckAndAuditAlarm ENDP
; ULONG __stdcall NtAccessCheckByType( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 , ULONG arg_08 , ULONG arg_09 , ULONG arg_10 , ULONG arg_11 );
_6_1_7601_sp1_windows_7_NtAccessCheckByType PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD , arg_08:DWORD , arg_09:DWORD , arg_10:DWORD , arg_11:DWORD
mov eax , 3
mov edx , 7FFE0300h
call dword ptr [edx]
ret 44
_6_1_7601_sp1_windows_7_NtAccessCheckByType ENDP
; ULONG __stdcall NtAccessCheckByTypeAndAuditAlarm( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 , ULONG arg_08 , ULONG arg_09 , ULONG arg_10 , ULONG arg_11 , ULONG arg_12 , ULONG arg_13 , ULONG arg_14 , ULONG arg_15 , ULONG arg_16 );
_6_1_7601_sp1_windows_7_NtAccessCheckByTypeAndAuditAlarm PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD , arg_08:DWORD , arg_09:DWORD , arg_10:DWORD , arg_11:DWORD , arg_12:DWORD , arg_13:DWORD , arg_14:DWORD , arg_15:DWORD , arg_16:DWORD
mov eax , 4
mov edx , 7FFE0300h
call dword ptr [edx]
ret 64
_6_1_7601_sp1_windows_7_NtAccessCheckByTypeAndAuditAlarm ENDP
; ULONG __stdcall NtAccessCheckByTypeResultList( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 , ULONG arg_08 , ULONG arg_09 , ULONG arg_10 , ULONG arg_11 );
_6_1_7601_sp1_windows_7_NtAccessCheckByTypeResultList PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD , arg_08:DWORD , arg_09:DWORD , arg_10:DWORD , arg_11:DWORD
mov eax , 5
mov edx , 7FFE0300h
call dword ptr [edx]
ret 44
_6_1_7601_sp1_windows_7_NtAccessCheckByTypeResultList ENDP
; ULONG __stdcall NtAccessCheckByTypeResultListAndAuditAlarm( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 , ULONG arg_08 , ULONG arg_09 , ULONG arg_10 , ULONG arg_11 , ULONG arg_12 , ULONG arg_13 , ULONG arg_14 , ULONG arg_15 , ULONG arg_16 );
_6_1_7601_sp1_windows_7_NtAccessCheckByTypeResultListAndAuditAlarm PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD , arg_08:DWORD , arg_09:DWORD , arg_10:DWORD , arg_11:DWORD , arg_12:DWORD , arg_13:DWORD , arg_14:DWORD , arg_15:DWORD , arg_16:DWORD
mov eax , 6
mov edx , 7FFE0300h
call dword ptr [edx]
ret 64
_6_1_7601_sp1_windows_7_NtAccessCheckByTypeResultListAndAuditAlarm ENDP
; ULONG __stdcall NtAccessCheckByTypeResultListAndAuditAlarmByHandle( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 , ULONG arg_08 , ULONG arg_09 , ULONG arg_10 , ULONG arg_11 , ULONG arg_12 , ULONG arg_13 , ULONG arg_14 , ULONG arg_15 , ULONG arg_16 , ULONG arg_17 );
_6_1_7601_sp1_windows_7_NtAccessCheckByTypeResultListAndAuditAlarmByHandle PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD , arg_08:DWORD , arg_09:DWORD , arg_10:DWORD , arg_11:DWORD , arg_12:DWORD , arg_13:DWORD , arg_14:DWORD , arg_15:DWORD , arg_16:DWORD , arg_17:DWORD
mov eax , 7
mov edx , 7FFE0300h
call dword ptr [edx]
ret 68
_6_1_7601_sp1_windows_7_NtAccessCheckByTypeResultListAndAuditAlarmByHandle ENDP
; ULONG __stdcall NtAddAtom( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
_6_1_7601_sp1_windows_7_NtAddAtom PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 8
mov edx , 7FFE0300h
call dword ptr [edx]
ret 12
_6_1_7601_sp1_windows_7_NtAddAtom ENDP
; ULONG __stdcall NtAddBootEntry( ULONG arg_01 , ULONG arg_02 );
_6_1_7601_sp1_windows_7_NtAddBootEntry PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 9
mov edx , 7FFE0300h
call dword ptr [edx]
ret 8
_6_1_7601_sp1_windows_7_NtAddBootEntry ENDP
; ULONG __stdcall NtAddDriverEntry( ULONG arg_01 , ULONG arg_02 );
_6_1_7601_sp1_windows_7_NtAddDriverEntry PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 10
mov edx , 7FFE0300h
call dword ptr [edx]
ret 8
_6_1_7601_sp1_windows_7_NtAddDriverEntry ENDP
; ULONG __stdcall NtAdjustGroupsToken( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 );
_6_1_7601_sp1_windows_7_NtAdjustGroupsToken PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD
mov eax , 11
mov edx , 7FFE0300h
call dword ptr [edx]
ret 24
_6_1_7601_sp1_windows_7_NtAdjustGroupsToken ENDP
; ULONG __stdcall NtAdjustPrivilegesToken( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 );
_6_1_7601_sp1_windows_7_NtAdjustPrivilegesToken PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD
mov eax , 12
mov edx , 7FFE0300h
call dword ptr [edx]
ret 24
_6_1_7601_sp1_windows_7_NtAdjustPrivilegesToken ENDP
; ULONG __stdcall NtAlertResumeThread( ULONG arg_01 , ULONG arg_02 );
_6_1_7601_sp1_windows_7_NtAlertResumeThread PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 13
mov edx , 7FFE0300h
call dword ptr [edx]
ret 8
_6_1_7601_sp1_windows_7_NtAlertResumeThread ENDP
; ULONG __stdcall NtAlertThread( ULONG arg_01 );
_6_1_7601_sp1_windows_7_NtAlertThread PROC STDCALL arg_01:DWORD
mov eax , 14
mov edx , 7FFE0300h
call dword ptr [edx]
ret 4
_6_1_7601_sp1_windows_7_NtAlertThread ENDP
; ULONG __stdcall NtAllocateLocallyUniqueId( ULONG arg_01 );
_6_1_7601_sp1_windows_7_NtAllocateLocallyUniqueId PROC STDCALL arg_01:DWORD
mov eax , 15
mov edx , 7FFE0300h
call dword ptr [edx]
ret 4
_6_1_7601_sp1_windows_7_NtAllocateLocallyUniqueId ENDP
; ULONG __stdcall NtAllocateReserveObject( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
_6_1_7601_sp1_windows_7_NtAllocateReserveObject PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 16
mov edx , 7FFE0300h
call dword ptr [edx]
ret 12
_6_1_7601_sp1_windows_7_NtAllocateReserveObject ENDP
; ULONG __stdcall NtAllocateUserPhysicalPages( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
_6_1_7601_sp1_windows_7_NtAllocateUserPhysicalPages PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 17
mov edx , 7FFE0300h
call dword ptr [edx]
ret 12
_6_1_7601_sp1_windows_7_NtAllocateUserPhysicalPages ENDP
; ULONG __stdcall NtAllocateUuids( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
_6_1_7601_sp1_windows_7_NtAllocateUuids PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 18
mov edx , 7FFE0300h
call dword ptr [edx]
ret 16
_6_1_7601_sp1_windows_7_NtAllocateUuids ENDP
; ULONG __stdcall NtAllocateVirtualMemory( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 );
_6_1_7601_sp1_windows_7_NtAllocateVirtualMemory PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD
mov eax , 19
mov edx , 7FFE0300h
call dword ptr [edx]
ret 24
_6_1_7601_sp1_windows_7_NtAllocateVirtualMemory ENDP
; ULONG __stdcall NtAlpcAcceptConnectPort( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 , ULONG arg_08 , ULONG arg_09 );
_6_1_7601_sp1_windows_7_NtAlpcAcceptConnectPort PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD , arg_08:DWORD , arg_09:DWORD
mov eax , 20
mov edx , 7FFE0300h
call dword ptr [edx]
ret 36
_6_1_7601_sp1_windows_7_NtAlpcAcceptConnectPort ENDP
; ULONG __stdcall NtAlpcCancelMessage( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
_6_1_7601_sp1_windows_7_NtAlpcCancelMessage PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 21
mov edx , 7FFE0300h
call dword ptr [edx]
ret 12
_6_1_7601_sp1_windows_7_NtAlpcCancelMessage ENDP
; ULONG __stdcall NtAlpcConnectPort( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 , ULONG arg_08 , ULONG arg_09 , ULONG arg_10 , ULONG arg_11 );
_6_1_7601_sp1_windows_7_NtAlpcConnectPort PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD , arg_08:DWORD , arg_09:DWORD , arg_10:DWORD , arg_11:DWORD
mov eax , 22
mov edx , 7FFE0300h
call dword ptr [edx]
ret 44
_6_1_7601_sp1_windows_7_NtAlpcConnectPort ENDP
; ULONG __stdcall NtAlpcCreatePort( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
_6_1_7601_sp1_windows_7_NtAlpcCreatePort PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 23
mov edx , 7FFE0300h
call dword ptr [edx]
ret 12
_6_1_7601_sp1_windows_7_NtAlpcCreatePort ENDP
; ULONG __stdcall NtAlpcCreatePortSection( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 );
_6_1_7601_sp1_windows_7_NtAlpcCreatePortSection PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD
mov eax , 24
mov edx , 7FFE0300h
call dword ptr [edx]
ret 24
_6_1_7601_sp1_windows_7_NtAlpcCreatePortSection ENDP
; ULONG __stdcall NtAlpcCreateResourceReserve( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
_6_1_7601_sp1_windows_7_NtAlpcCreateResourceReserve PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 25
mov edx , 7FFE0300h
call dword ptr [edx]
ret 16
_6_1_7601_sp1_windows_7_NtAlpcCreateResourceReserve ENDP
; ULONG __stdcall NtAlpcCreateSectionView( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
_6_1_7601_sp1_windows_7_NtAlpcCreateSectionView PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 26
mov edx , 7FFE0300h
call dword ptr [edx]
ret 12
_6_1_7601_sp1_windows_7_NtAlpcCreateSectionView ENDP
; ULONG __stdcall NtAlpcCreateSecurityContext( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
_6_1_7601_sp1_windows_7_NtAlpcCreateSecurityContext PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 27
mov edx , 7FFE0300h
call dword ptr [edx]
ret 12
_6_1_7601_sp1_windows_7_NtAlpcCreateSecurityContext ENDP
; ULONG __stdcall NtAlpcDeletePortSection( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
_6_1_7601_sp1_windows_7_NtAlpcDeletePortSection PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 28
mov edx , 7FFE0300h
call dword ptr [edx]
ret 12
_6_1_7601_sp1_windows_7_NtAlpcDeletePortSection ENDP
; ULONG __stdcall NtAlpcDeleteResourceReserve( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
_6_1_7601_sp1_windows_7_NtAlpcDeleteResourceReserve PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 29
mov edx , 7FFE0300h
call dword ptr [edx]
ret 12
_6_1_7601_sp1_windows_7_NtAlpcDeleteResourceReserve ENDP
; ULONG __stdcall NtAlpcDeleteSectionView( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
_6_1_7601_sp1_windows_7_NtAlpcDeleteSectionView PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 30
mov edx , 7FFE0300h
call dword ptr [edx]
ret 12
_6_1_7601_sp1_windows_7_NtAlpcDeleteSectionView ENDP
; ULONG __stdcall NtAlpcDeleteSecurityContext( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
_6_1_7601_sp1_windows_7_NtAlpcDeleteSecurityContext PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 31
mov edx , 7FFE0300h
call dword ptr [edx]
ret 12
_6_1_7601_sp1_windows_7_NtAlpcDeleteSecurityContext ENDP
; ULONG __stdcall NtAlpcDisconnectPort( ULONG arg_01 , ULONG arg_02 );
_6_1_7601_sp1_windows_7_NtAlpcDisconnectPort PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 32
mov edx , 7FFE0300h
call dword ptr [edx]
ret 8
_6_1_7601_sp1_windows_7_NtAlpcDisconnectPort ENDP
; ULONG __stdcall NtAlpcImpersonateClientOfPort( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
_6_1_7601_sp1_windows_7_NtAlpcImpersonateClientOfPort PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 33
mov edx , 7FFE0300h
call dword ptr [edx]
ret 12
_6_1_7601_sp1_windows_7_NtAlpcImpersonateClientOfPort ENDP
; ULONG __stdcall NtAlpcOpenSenderProcess( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 );
_6_1_7601_sp1_windows_7_NtAlpcOpenSenderProcess PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD
mov eax , 34
mov edx , 7FFE0300h
call dword ptr [edx]
ret 24
_6_1_7601_sp1_windows_7_NtAlpcOpenSenderProcess ENDP
; ULONG __stdcall NtAlpcOpenSenderThread( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 );
_6_1_7601_sp1_windows_7_NtAlpcOpenSenderThread PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD
mov eax , 35
mov edx , 7FFE0300h
call dword ptr [edx]
ret 24
_6_1_7601_sp1_windows_7_NtAlpcOpenSenderThread ENDP
; ULONG __stdcall NtAlpcQueryInformation( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
_6_1_7601_sp1_windows_7_NtAlpcQueryInformation PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 36
mov edx , 7FFE0300h
call dword ptr [edx]
ret 20
_6_1_7601_sp1_windows_7_NtAlpcQueryInformation ENDP
; ULONG __stdcall NtAlpcQueryInformationMessage( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 );
_6_1_7601_sp1_windows_7_NtAlpcQueryInformationMessage PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD
mov eax , 37
mov edx , 7FFE0300h
call dword ptr [edx]
ret 24
_6_1_7601_sp1_windows_7_NtAlpcQueryInformationMessage ENDP
; ULONG __stdcall NtAlpcRevokeSecurityContext( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
_6_1_7601_sp1_windows_7_NtAlpcRevokeSecurityContext PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 38
mov edx , 7FFE0300h
call dword ptr [edx]
ret 12
_6_1_7601_sp1_windows_7_NtAlpcRevokeSecurityContext ENDP
; ULONG __stdcall NtAlpcSendWaitReceivePort( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 , ULONG arg_08 );
_6_1_7601_sp1_windows_7_NtAlpcSendWaitReceivePort PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD , arg_08:DWORD
mov eax , 39
mov edx , 7FFE0300h
call dword ptr [edx]
ret 32
_6_1_7601_sp1_windows_7_NtAlpcSendWaitReceivePort ENDP
; ULONG __stdcall NtAlpcSetInformation( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
_6_1_7601_sp1_windows_7_NtAlpcSetInformation PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 40
mov edx , 7FFE0300h
call dword ptr [edx]
ret 16
_6_1_7601_sp1_windows_7_NtAlpcSetInformation ENDP
; ULONG __stdcall NtApphelpCacheControl( ULONG arg_01 , ULONG arg_02 );
_6_1_7601_sp1_windows_7_NtApphelpCacheControl PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 41
mov edx , 7FFE0300h
call dword ptr [edx]
ret 8
_6_1_7601_sp1_windows_7_NtApphelpCacheControl ENDP
; ULONG __stdcall NtAreMappedFilesTheSame( ULONG arg_01 , ULONG arg_02 );
_6_1_7601_sp1_windows_7_NtAreMappedFilesTheSame PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 42
mov edx , 7FFE0300h
call dword ptr [edx]
ret 8
_6_1_7601_sp1_windows_7_NtAreMappedFilesTheSame ENDP
; ULONG __stdcall NtAssignProcessToJobObject( ULONG arg_01 , ULONG arg_02 );
_6_1_7601_sp1_windows_7_NtAssignProcessToJobObject PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 43
mov edx , 7FFE0300h
call dword ptr [edx]
ret 8
_6_1_7601_sp1_windows_7_NtAssignProcessToJobObject ENDP
; ULONG __stdcall NtCallbackReturn( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
_6_1_7601_sp1_windows_7_NtCallbackReturn PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 44
mov edx , 7FFE0300h
call dword ptr [edx]
ret 12
_6_1_7601_sp1_windows_7_NtCallbackReturn ENDP
; ULONG __stdcall NtCancelIoFile( ULONG arg_01 , ULONG arg_02 );
_6_1_7601_sp1_windows_7_NtCancelIoFile PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 45
mov edx , 7FFE0300h
call dword ptr [edx]
ret 8
_6_1_7601_sp1_windows_7_NtCancelIoFile ENDP
; ULONG __stdcall NtCancelIoFileEx( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
_6_1_7601_sp1_windows_7_NtCancelIoFileEx PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 46
mov edx , 7FFE0300h
call dword ptr [edx]
ret 12
_6_1_7601_sp1_windows_7_NtCancelIoFileEx ENDP
; ULONG __stdcall NtCancelSynchronousIoFile( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
_6_1_7601_sp1_windows_7_NtCancelSynchronousIoFile PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 47
mov edx , 7FFE0300h
call dword ptr [edx]
ret 12
_6_1_7601_sp1_windows_7_NtCancelSynchronousIoFile ENDP
; ULONG __stdcall NtCancelTimer( ULONG arg_01 , ULONG arg_02 );
_6_1_7601_sp1_windows_7_NtCancelTimer PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 48
mov edx , 7FFE0300h
call dword ptr [edx]
ret 8
_6_1_7601_sp1_windows_7_NtCancelTimer ENDP
; ULONG __stdcall NtClearEvent( ULONG arg_01 );
_6_1_7601_sp1_windows_7_NtClearEvent PROC STDCALL arg_01:DWORD
mov eax , 49
mov edx , 7FFE0300h
call dword ptr [edx]
ret 4
_6_1_7601_sp1_windows_7_NtClearEvent ENDP
; ULONG __stdcall NtClose( ULONG arg_01 );
_6_1_7601_sp1_windows_7_NtClose PROC STDCALL arg_01:DWORD
mov eax , 50
mov edx , 7FFE0300h
call dword ptr [edx]
ret 4
_6_1_7601_sp1_windows_7_NtClose ENDP
; ULONG __stdcall NtCloseObjectAuditAlarm( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
_6_1_7601_sp1_windows_7_NtCloseObjectAuditAlarm PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 51
mov edx , 7FFE0300h
call dword ptr [edx]
ret 12
_6_1_7601_sp1_windows_7_NtCloseObjectAuditAlarm ENDP
; ULONG __stdcall NtCommitComplete( ULONG arg_01 , ULONG arg_02 );
_6_1_7601_sp1_windows_7_NtCommitComplete PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 52
mov edx , 7FFE0300h
call dword ptr [edx]
ret 8
_6_1_7601_sp1_windows_7_NtCommitComplete ENDP
; ULONG __stdcall NtCommitEnlistment( ULONG arg_01 , ULONG arg_02 );
_6_1_7601_sp1_windows_7_NtCommitEnlistment PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 53
mov edx , 7FFE0300h
call dword ptr [edx]
ret 8
_6_1_7601_sp1_windows_7_NtCommitEnlistment ENDP
; ULONG __stdcall NtCommitTransaction( ULONG arg_01 , ULONG arg_02 );
_6_1_7601_sp1_windows_7_NtCommitTransaction PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 54
mov edx , 7FFE0300h
call dword ptr [edx]
ret 8
_6_1_7601_sp1_windows_7_NtCommitTransaction ENDP
; ULONG __stdcall NtCompactKeys( ULONG arg_01 , ULONG arg_02 );
_6_1_7601_sp1_windows_7_NtCompactKeys PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 55
mov edx , 7FFE0300h
call dword ptr [edx]
ret 8
_6_1_7601_sp1_windows_7_NtCompactKeys ENDP
; ULONG __stdcall NtCompareTokens( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
_6_1_7601_sp1_windows_7_NtCompareTokens PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 56
mov edx , 7FFE0300h
call dword ptr [edx]
ret 12
_6_1_7601_sp1_windows_7_NtCompareTokens ENDP
; ULONG __stdcall NtCompleteConnectPort( ULONG arg_01 );
_6_1_7601_sp1_windows_7_NtCompleteConnectPort PROC STDCALL arg_01:DWORD
mov eax , 57
mov edx , 7FFE0300h
call dword ptr [edx]
ret 4
_6_1_7601_sp1_windows_7_NtCompleteConnectPort ENDP
; ULONG __stdcall NtCompressKey( ULONG arg_01 );
_6_1_7601_sp1_windows_7_NtCompressKey PROC STDCALL arg_01:DWORD
mov eax , 58
mov edx , 7FFE0300h
call dword ptr [edx]
ret 4
_6_1_7601_sp1_windows_7_NtCompressKey ENDP
; ULONG __stdcall NtConnectPort( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 , ULONG arg_08 );
_6_1_7601_sp1_windows_7_NtConnectPort PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD , arg_08:DWORD
mov eax , 59
mov edx , 7FFE0300h
call dword ptr [edx]
ret 32
_6_1_7601_sp1_windows_7_NtConnectPort ENDP
; ULONG __stdcall NtContinue( ULONG arg_01 , ULONG arg_02 );
_6_1_7601_sp1_windows_7_NtContinue PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 60
mov edx , 7FFE0300h
call dword ptr [edx]
ret 8
_6_1_7601_sp1_windows_7_NtContinue ENDP
; ULONG __stdcall NtCreateDebugObject( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
_6_1_7601_sp1_windows_7_NtCreateDebugObject PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 61
mov edx , 7FFE0300h
call dword ptr [edx]
ret 16
_6_1_7601_sp1_windows_7_NtCreateDebugObject ENDP
; ULONG __stdcall NtCreateDirectoryObject( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
_6_1_7601_sp1_windows_7_NtCreateDirectoryObject PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 62
mov edx , 7FFE0300h
call dword ptr [edx]
ret 12
_6_1_7601_sp1_windows_7_NtCreateDirectoryObject ENDP
; ULONG __stdcall NtCreateEnlistment( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 , ULONG arg_08 );
_6_1_7601_sp1_windows_7_NtCreateEnlistment PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD , arg_08:DWORD
mov eax , 63
mov edx , 7FFE0300h
call dword ptr [edx]
ret 32
_6_1_7601_sp1_windows_7_NtCreateEnlistment ENDP
; ULONG __stdcall NtCreateEvent( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
_6_1_7601_sp1_windows_7_NtCreateEvent PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 64
mov edx , 7FFE0300h
call dword ptr [edx]
ret 20
_6_1_7601_sp1_windows_7_NtCreateEvent ENDP
; ULONG __stdcall NtCreateEventPair( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
_6_1_7601_sp1_windows_7_NtCreateEventPair PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 65
mov edx , 7FFE0300h
call dword ptr [edx]
ret 12
_6_1_7601_sp1_windows_7_NtCreateEventPair ENDP
; ULONG __stdcall NtCreateFile( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 , ULONG arg_08 , ULONG arg_09 , ULONG arg_10 , ULONG arg_11 );
_6_1_7601_sp1_windows_7_NtCreateFile PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD , arg_08:DWORD , arg_09:DWORD , arg_10:DWORD , arg_11:DWORD
mov eax , 66
mov edx , 7FFE0300h
call dword ptr [edx]
ret 44
_6_1_7601_sp1_windows_7_NtCreateFile ENDP
; ULONG __stdcall NtCreateIoCompletion( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
_6_1_7601_sp1_windows_7_NtCreateIoCompletion PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 67
mov edx , 7FFE0300h
call dword ptr [edx]
ret 16
_6_1_7601_sp1_windows_7_NtCreateIoCompletion ENDP
; ULONG __stdcall NtCreateJobObject( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
_6_1_7601_sp1_windows_7_NtCreateJobObject PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 68
mov edx , 7FFE0300h
call dword ptr [edx]
ret 12
_6_1_7601_sp1_windows_7_NtCreateJobObject ENDP
; ULONG __stdcall NtCreateJobSet( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
_6_1_7601_sp1_windows_7_NtCreateJobSet PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 69
mov edx , 7FFE0300h
call dword ptr [edx]
ret 12
_6_1_7601_sp1_windows_7_NtCreateJobSet ENDP
; ULONG __stdcall NtCreateKey( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 );
_6_1_7601_sp1_windows_7_NtCreateKey PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD
mov eax , 70
mov edx , 7FFE0300h
call dword ptr [edx]
ret 28
_6_1_7601_sp1_windows_7_NtCreateKey ENDP
; ULONG __stdcall NtCreateKeyedEvent( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
_6_1_7601_sp1_windows_7_NtCreateKeyedEvent PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 71
mov edx , 7FFE0300h
call dword ptr [edx]
ret 16
_6_1_7601_sp1_windows_7_NtCreateKeyedEvent ENDP
; ULONG __stdcall NtCreateKeyTransacted( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 , ULONG arg_08 );
_6_1_7601_sp1_windows_7_NtCreateKeyTransacted PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD , arg_08:DWORD
mov eax , 72
mov edx , 7FFE0300h
call dword ptr [edx]
ret 32
_6_1_7601_sp1_windows_7_NtCreateKeyTransacted ENDP
; ULONG __stdcall NtCreateMailslotFile( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 , ULONG arg_08 );
_6_1_7601_sp1_windows_7_NtCreateMailslotFile PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD , arg_08:DWORD
mov eax , 73
mov edx , 7FFE0300h
call dword ptr [edx]
ret 32
_6_1_7601_sp1_windows_7_NtCreateMailslotFile ENDP
; ULONG __stdcall NtCreateMutant( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
_6_1_7601_sp1_windows_7_NtCreateMutant PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 74
mov edx , 7FFE0300h
call dword ptr [edx]
ret 16
_6_1_7601_sp1_windows_7_NtCreateMutant ENDP
; ULONG __stdcall NtCreateNamedPipeFile( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 , ULONG arg_08 , ULONG arg_09 , ULONG arg_10 , ULONG arg_11 , ULONG arg_12 , ULONG arg_13 , ULONG arg_14 );
_6_1_7601_sp1_windows_7_NtCreateNamedPipeFile PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD , arg_08:DWORD , arg_09:DWORD , arg_10:DWORD , arg_11:DWORD , arg_12:DWORD , arg_13:DWORD , arg_14:DWORD
mov eax , 75
mov edx , 7FFE0300h
call dword ptr [edx]
ret 56
_6_1_7601_sp1_windows_7_NtCreateNamedPipeFile ENDP
; ULONG __stdcall NtCreatePagingFile( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
_6_1_7601_sp1_windows_7_NtCreatePagingFile PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 76
mov edx , 7FFE0300h
call dword ptr [edx]
ret 16
_6_1_7601_sp1_windows_7_NtCreatePagingFile ENDP
; ULONG __stdcall NtCreatePort( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
_6_1_7601_sp1_windows_7_NtCreatePort PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 77
mov edx , 7FFE0300h
call dword ptr [edx]
ret 20
_6_1_7601_sp1_windows_7_NtCreatePort ENDP
; ULONG __stdcall NtCreatePrivateNamespace( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
_6_1_7601_sp1_windows_7_NtCreatePrivateNamespace PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 78
mov edx , 7FFE0300h
call dword ptr [edx]
ret 16
_6_1_7601_sp1_windows_7_NtCreatePrivateNamespace ENDP
; ULONG __stdcall NtCreateProcess( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 , ULONG arg_08 );
_6_1_7601_sp1_windows_7_NtCreateProcess PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD , arg_08:DWORD
mov eax , 79
mov edx , 7FFE0300h
call dword ptr [edx]
ret 32
_6_1_7601_sp1_windows_7_NtCreateProcess ENDP
; ULONG __stdcall NtCreateProcessEx( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 , ULONG arg_08 , ULONG arg_09 );
_6_1_7601_sp1_windows_7_NtCreateProcessEx PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD , arg_08:DWORD , arg_09:DWORD
mov eax , 80
mov edx , 7FFE0300h
call dword ptr [edx]
ret 36
_6_1_7601_sp1_windows_7_NtCreateProcessEx ENDP
; ULONG __stdcall NtCreateProfile( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 , ULONG arg_08 , ULONG arg_09 );
_6_1_7601_sp1_windows_7_NtCreateProfile PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD , arg_08:DWORD , arg_09:DWORD
mov eax , 81
mov edx , 7FFE0300h
call dword ptr [edx]
ret 36
_6_1_7601_sp1_windows_7_NtCreateProfile ENDP
; ULONG __stdcall NtCreateProfileEx( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 , ULONG arg_08 , ULONG arg_09 , ULONG arg_10 );
_6_1_7601_sp1_windows_7_NtCreateProfileEx PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD , arg_08:DWORD , arg_09:DWORD , arg_10:DWORD
mov eax , 82
mov edx , 7FFE0300h
call dword ptr [edx]
ret 40
_6_1_7601_sp1_windows_7_NtCreateProfileEx ENDP
; ULONG __stdcall NtCreateResourceManager( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 );
_6_1_7601_sp1_windows_7_NtCreateResourceManager PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD
mov eax , 83
mov edx , 7FFE0300h
call dword ptr [edx]
ret 28
_6_1_7601_sp1_windows_7_NtCreateResourceManager ENDP
; ULONG __stdcall NtCreateSection( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 );
_6_1_7601_sp1_windows_7_NtCreateSection PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD
mov eax , 84
mov edx , 7FFE0300h
call dword ptr [edx]
ret 28
_6_1_7601_sp1_windows_7_NtCreateSection ENDP
; ULONG __stdcall NtCreateSemaphore( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
_6_1_7601_sp1_windows_7_NtCreateSemaphore PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 85
mov edx , 7FFE0300h
call dword ptr [edx]
ret 20
_6_1_7601_sp1_windows_7_NtCreateSemaphore ENDP
; ULONG __stdcall NtCreateSymbolicLinkObject( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
_6_1_7601_sp1_windows_7_NtCreateSymbolicLinkObject PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 86
mov edx , 7FFE0300h
call dword ptr [edx]
ret 16
_6_1_7601_sp1_windows_7_NtCreateSymbolicLinkObject ENDP
; ULONG __stdcall NtCreateThread( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 , ULONG arg_08 );
_6_1_7601_sp1_windows_7_NtCreateThread PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD , arg_08:DWORD
mov eax , 87
mov edx , 7FFE0300h
call dword ptr [edx]
ret 32
_6_1_7601_sp1_windows_7_NtCreateThread ENDP
; ULONG __stdcall NtCreateThreadEx( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 , ULONG arg_08 , ULONG arg_09 , ULONG arg_10 , ULONG arg_11 );
_6_1_7601_sp1_windows_7_NtCreateThreadEx PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD , arg_08:DWORD , arg_09:DWORD , arg_10:DWORD , arg_11:DWORD
mov eax , 88
mov edx , 7FFE0300h
call dword ptr [edx]
ret 44
_6_1_7601_sp1_windows_7_NtCreateThreadEx ENDP
; ULONG __stdcall NtCreateTimer( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
_6_1_7601_sp1_windows_7_NtCreateTimer PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 89
mov edx , 7FFE0300h
call dword ptr [edx]
ret 16
_6_1_7601_sp1_windows_7_NtCreateTimer ENDP
; ULONG __stdcall NtCreateToken( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 , ULONG arg_08 , ULONG arg_09 , ULONG arg_10 , ULONG arg_11 , ULONG arg_12 , ULONG arg_13 );
_6_1_7601_sp1_windows_7_NtCreateToken PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD , arg_08:DWORD , arg_09:DWORD , arg_10:DWORD , arg_11:DWORD , arg_12:DWORD , arg_13:DWORD
mov eax , 90
mov edx , 7FFE0300h
call dword ptr [edx]
ret 52
_6_1_7601_sp1_windows_7_NtCreateToken ENDP
; ULONG __stdcall NtCreateTransaction( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 , ULONG arg_08 , ULONG arg_09 , ULONG arg_10 );
_6_1_7601_sp1_windows_7_NtCreateTransaction PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD , arg_08:DWORD , arg_09:DWORD , arg_10:DWORD
mov eax , 91
mov edx , 7FFE0300h
call dword ptr [edx]
ret 40
_6_1_7601_sp1_windows_7_NtCreateTransaction ENDP
; ULONG __stdcall NtCreateTransactionManager( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 );
_6_1_7601_sp1_windows_7_NtCreateTransactionManager PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD
mov eax , 92
mov edx , 7FFE0300h
call dword ptr [edx]
ret 24
_6_1_7601_sp1_windows_7_NtCreateTransactionManager ENDP
; ULONG __stdcall NtCreateUserProcess( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 , ULONG arg_08 , ULONG arg_09 , ULONG arg_10 , ULONG arg_11 );
_6_1_7601_sp1_windows_7_NtCreateUserProcess PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD , arg_08:DWORD , arg_09:DWORD , arg_10:DWORD , arg_11:DWORD
mov eax , 93
mov edx , 7FFE0300h
call dword ptr [edx]
ret 44
_6_1_7601_sp1_windows_7_NtCreateUserProcess ENDP
; ULONG __stdcall NtCreateWaitablePort( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
_6_1_7601_sp1_windows_7_NtCreateWaitablePort PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 94
mov edx , 7FFE0300h
call dword ptr [edx]
ret 20
_6_1_7601_sp1_windows_7_NtCreateWaitablePort ENDP
; ULONG __stdcall NtCreateWorkerFactory( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 , ULONG arg_08 , ULONG arg_09 , ULONG arg_10 );
_6_1_7601_sp1_windows_7_NtCreateWorkerFactory PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD , arg_08:DWORD , arg_09:DWORD , arg_10:DWORD
mov eax , 95
mov edx , 7FFE0300h
call dword ptr [edx]
ret 40
_6_1_7601_sp1_windows_7_NtCreateWorkerFactory ENDP
; ULONG __stdcall NtDebugActiveProcess( ULONG arg_01 , ULONG arg_02 );
_6_1_7601_sp1_windows_7_NtDebugActiveProcess PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 96
mov edx , 7FFE0300h
call dword ptr [edx]
ret 8
_6_1_7601_sp1_windows_7_NtDebugActiveProcess ENDP
; ULONG __stdcall NtDebugContinue( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
_6_1_7601_sp1_windows_7_NtDebugContinue PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 97
mov edx , 7FFE0300h
call dword ptr [edx]
ret 12
_6_1_7601_sp1_windows_7_NtDebugContinue ENDP
; ULONG __stdcall NtDelayExecution( ULONG arg_01 , ULONG arg_02 );
_6_1_7601_sp1_windows_7_NtDelayExecution PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 98
mov edx , 7FFE0300h
call dword ptr [edx]
ret 8
_6_1_7601_sp1_windows_7_NtDelayExecution ENDP
; ULONG __stdcall NtDeleteAtom( ULONG arg_01 );
_6_1_7601_sp1_windows_7_NtDeleteAtom PROC STDCALL arg_01:DWORD
mov eax , 99
mov edx , 7FFE0300h
call dword ptr [edx]
ret 4
_6_1_7601_sp1_windows_7_NtDeleteAtom ENDP
; ULONG __stdcall NtDeleteBootEntry( ULONG arg_01 );
_6_1_7601_sp1_windows_7_NtDeleteBootEntry PROC STDCALL arg_01:DWORD
mov eax , 100
mov edx , 7FFE0300h
call dword ptr [edx]
ret 4
_6_1_7601_sp1_windows_7_NtDeleteBootEntry ENDP
; ULONG __stdcall NtDeleteDriverEntry( ULONG arg_01 );
_6_1_7601_sp1_windows_7_NtDeleteDriverEntry PROC STDCALL arg_01:DWORD
mov eax , 101
mov edx , 7FFE0300h
call dword ptr [edx]
ret 4
_6_1_7601_sp1_windows_7_NtDeleteDriverEntry ENDP
; ULONG __stdcall NtDeleteFile( ULONG arg_01 );
_6_1_7601_sp1_windows_7_NtDeleteFile PROC STDCALL arg_01:DWORD
mov eax , 102
mov edx , 7FFE0300h
call dword ptr [edx]
ret 4
_6_1_7601_sp1_windows_7_NtDeleteFile ENDP
; ULONG __stdcall NtDeleteKey( ULONG arg_01 );
_6_1_7601_sp1_windows_7_NtDeleteKey PROC STDCALL arg_01:DWORD
mov eax , 103
mov edx , 7FFE0300h
call dword ptr [edx]
ret 4
_6_1_7601_sp1_windows_7_NtDeleteKey ENDP
; ULONG __stdcall NtDeleteObjectAuditAlarm( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
_6_1_7601_sp1_windows_7_NtDeleteObjectAuditAlarm PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 104
mov edx , 7FFE0300h
call dword ptr [edx]
ret 12
_6_1_7601_sp1_windows_7_NtDeleteObjectAuditAlarm ENDP
; ULONG __stdcall NtDeletePrivateNamespace( ULONG arg_01 );
_6_1_7601_sp1_windows_7_NtDeletePrivateNamespace PROC STDCALL arg_01:DWORD
mov eax , 105
mov edx , 7FFE0300h
call dword ptr [edx]
ret 4
_6_1_7601_sp1_windows_7_NtDeletePrivateNamespace ENDP
; ULONG __stdcall NtDeleteValueKey( ULONG arg_01 , ULONG arg_02 );
_6_1_7601_sp1_windows_7_NtDeleteValueKey PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 106
mov edx , 7FFE0300h
call dword ptr [edx]
ret 8
_6_1_7601_sp1_windows_7_NtDeleteValueKey ENDP
; ULONG __stdcall NtDeviceIoControlFile( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 , ULONG arg_08 , ULONG arg_09 , ULONG arg_10 );
_6_1_7601_sp1_windows_7_NtDeviceIoControlFile PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD , arg_08:DWORD , arg_09:DWORD , arg_10:DWORD
mov eax , 107
mov edx , 7FFE0300h
call dword ptr [edx]
ret 40
_6_1_7601_sp1_windows_7_NtDeviceIoControlFile ENDP
; ULONG __stdcall NtDisableLastKnownGood( );
_6_1_7601_sp1_windows_7_NtDisableLastKnownGood PROC STDCALL
mov eax , 108
mov edx , 7FFE0300h
call dword ptr [edx]
ret
_6_1_7601_sp1_windows_7_NtDisableLastKnownGood ENDP
; ULONG __stdcall NtDisplayString( ULONG arg_01 );
_6_1_7601_sp1_windows_7_NtDisplayString PROC STDCALL arg_01:DWORD
mov eax , 109
mov edx , 7FFE0300h
call dword ptr [edx]
ret 4
_6_1_7601_sp1_windows_7_NtDisplayString ENDP
; ULONG __stdcall NtDrawText( ULONG arg_01 );
_6_1_7601_sp1_windows_7_NtDrawText PROC STDCALL arg_01:DWORD
mov eax , 110
mov edx , 7FFE0300h
call dword ptr [edx]
ret 4
_6_1_7601_sp1_windows_7_NtDrawText ENDP
; ULONG __stdcall NtDuplicateObject( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 );
_6_1_7601_sp1_windows_7_NtDuplicateObject PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD
mov eax , 111
mov edx , 7FFE0300h
call dword ptr [edx]
ret 28
_6_1_7601_sp1_windows_7_NtDuplicateObject ENDP
; ULONG __stdcall NtDuplicateToken( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 );
_6_1_7601_sp1_windows_7_NtDuplicateToken PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD
mov eax , 112
mov edx , 7FFE0300h
call dword ptr [edx]
ret 24
_6_1_7601_sp1_windows_7_NtDuplicateToken ENDP
; ULONG __stdcall NtEnableLastKnownGood( );
_6_1_7601_sp1_windows_7_NtEnableLastKnownGood PROC STDCALL
mov eax , 113
mov edx , 7FFE0300h
call dword ptr [edx]
ret
_6_1_7601_sp1_windows_7_NtEnableLastKnownGood ENDP
; ULONG __stdcall NtEnumerateBootEntries( ULONG arg_01 , ULONG arg_02 );
_6_1_7601_sp1_windows_7_NtEnumerateBootEntries PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 114
mov edx , 7FFE0300h
call dword ptr [edx]
ret 8
_6_1_7601_sp1_windows_7_NtEnumerateBootEntries ENDP
; ULONG __stdcall NtEnumerateDriverEntries( ULONG arg_01 , ULONG arg_02 );
_6_1_7601_sp1_windows_7_NtEnumerateDriverEntries PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 115
mov edx , 7FFE0300h
call dword ptr [edx]
ret 8
_6_1_7601_sp1_windows_7_NtEnumerateDriverEntries ENDP
; ULONG __stdcall NtEnumerateKey( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 );
_6_1_7601_sp1_windows_7_NtEnumerateKey PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD
mov eax , 116
mov edx , 7FFE0300h
call dword ptr [edx]
ret 24
_6_1_7601_sp1_windows_7_NtEnumerateKey ENDP
; ULONG __stdcall NtEnumerateSystemEnvironmentValuesEx( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
_6_1_7601_sp1_windows_7_NtEnumerateSystemEnvironmentValuesEx PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 117
mov edx , 7FFE0300h
call dword ptr [edx]
ret 12
_6_1_7601_sp1_windows_7_NtEnumerateSystemEnvironmentValuesEx ENDP
; ULONG __stdcall NtEnumerateTransactionObject( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
_6_1_7601_sp1_windows_7_NtEnumerateTransactionObject PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 118
mov edx , 7FFE0300h
call dword ptr [edx]
ret 20
_6_1_7601_sp1_windows_7_NtEnumerateTransactionObject ENDP
; ULONG __stdcall NtEnumerateValueKey( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 );
_6_1_7601_sp1_windows_7_NtEnumerateValueKey PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD
mov eax , 119
mov edx , 7FFE0300h
call dword ptr [edx]
ret 24
_6_1_7601_sp1_windows_7_NtEnumerateValueKey ENDP
; ULONG __stdcall NtExtendSection( ULONG arg_01 , ULONG arg_02 );
_6_1_7601_sp1_windows_7_NtExtendSection PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 120
mov edx , 7FFE0300h
call dword ptr [edx]
ret 8
_6_1_7601_sp1_windows_7_NtExtendSection ENDP
; ULONG __stdcall NtFilterToken( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 );
_6_1_7601_sp1_windows_7_NtFilterToken PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD
mov eax , 121
mov edx , 7FFE0300h
call dword ptr [edx]
ret 24
_6_1_7601_sp1_windows_7_NtFilterToken ENDP
; ULONG __stdcall NtFindAtom( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
_6_1_7601_sp1_windows_7_NtFindAtom PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 122
mov edx , 7FFE0300h
call dword ptr [edx]
ret 12
_6_1_7601_sp1_windows_7_NtFindAtom ENDP
; ULONG __stdcall NtFlushBuffersFile( ULONG arg_01 , ULONG arg_02 );
_6_1_7601_sp1_windows_7_NtFlushBuffersFile PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 123
mov edx , 7FFE0300h
call dword ptr [edx]
ret 8
_6_1_7601_sp1_windows_7_NtFlushBuffersFile ENDP
; ULONG __stdcall NtFlushInstallUILanguage( ULONG arg_01 , ULONG arg_02 );
_6_1_7601_sp1_windows_7_NtFlushInstallUILanguage PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 124
mov edx , 7FFE0300h
call dword ptr [edx]
ret 8
_6_1_7601_sp1_windows_7_NtFlushInstallUILanguage ENDP
; ULONG __stdcall NtFlushInstructionCache( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
_6_1_7601_sp1_windows_7_NtFlushInstructionCache PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 125
mov edx , 7FFE0300h
call dword ptr [edx]
ret 12
_6_1_7601_sp1_windows_7_NtFlushInstructionCache ENDP
; ULONG __stdcall NtFlushKey( ULONG arg_01 );
_6_1_7601_sp1_windows_7_NtFlushKey PROC STDCALL arg_01:DWORD
mov eax , 126
mov edx , 7FFE0300h
call dword ptr [edx]
ret 4
_6_1_7601_sp1_windows_7_NtFlushKey ENDP
; ULONG __stdcall NtFlushProcessWriteBuffers( );
_6_1_7601_sp1_windows_7_NtFlushProcessWriteBuffers PROC STDCALL
mov eax , 127
mov edx , 7FFE0300h
call dword ptr [edx]
ret
_6_1_7601_sp1_windows_7_NtFlushProcessWriteBuffers ENDP
; ULONG __stdcall NtFlushVirtualMemory( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
_6_1_7601_sp1_windows_7_NtFlushVirtualMemory PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 128
mov edx , 7FFE0300h
call dword ptr [edx]
ret 16
_6_1_7601_sp1_windows_7_NtFlushVirtualMemory ENDP
; ULONG __stdcall NtFlushWriteBuffer( );
_6_1_7601_sp1_windows_7_NtFlushWriteBuffer PROC STDCALL
mov eax , 129
mov edx , 7FFE0300h
call dword ptr [edx]
ret
_6_1_7601_sp1_windows_7_NtFlushWriteBuffer ENDP
; ULONG __stdcall NtFreeUserPhysicalPages( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
_6_1_7601_sp1_windows_7_NtFreeUserPhysicalPages PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 130
mov edx , 7FFE0300h
call dword ptr [edx]
ret 12
_6_1_7601_sp1_windows_7_NtFreeUserPhysicalPages ENDP
; ULONG __stdcall NtFreeVirtualMemory( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
_6_1_7601_sp1_windows_7_NtFreeVirtualMemory PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 131
mov edx , 7FFE0300h
call dword ptr [edx]
ret 16
_6_1_7601_sp1_windows_7_NtFreeVirtualMemory ENDP
; ULONG __stdcall NtFreezeRegistry( ULONG arg_01 );
_6_1_7601_sp1_windows_7_NtFreezeRegistry PROC STDCALL arg_01:DWORD
mov eax , 132
mov edx , 7FFE0300h
call dword ptr [edx]
ret 4
_6_1_7601_sp1_windows_7_NtFreezeRegistry ENDP
; ULONG __stdcall NtFreezeTransactions( ULONG arg_01 , ULONG arg_02 );
_6_1_7601_sp1_windows_7_NtFreezeTransactions PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 133
mov edx , 7FFE0300h
call dword ptr [edx]
ret 8
_6_1_7601_sp1_windows_7_NtFreezeTransactions ENDP
; ULONG __stdcall NtFsControlFile( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 , ULONG arg_08 , ULONG arg_09 , ULONG arg_10 );
_6_1_7601_sp1_windows_7_NtFsControlFile PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD , arg_08:DWORD , arg_09:DWORD , arg_10:DWORD
mov eax , 134
mov edx , 7FFE0300h
call dword ptr [edx]
ret 40
_6_1_7601_sp1_windows_7_NtFsControlFile ENDP
; ULONG __stdcall NtGetContextThread( ULONG arg_01 , ULONG arg_02 );
_6_1_7601_sp1_windows_7_NtGetContextThread PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 135
mov edx , 7FFE0300h
call dword ptr [edx]
ret 8
_6_1_7601_sp1_windows_7_NtGetContextThread ENDP
; ULONG __stdcall NtGetCurrentProcessorNumber( );
_6_1_7601_sp1_windows_7_NtGetCurrentProcessorNumber PROC STDCALL
mov eax , 136
mov edx , 7FFE0300h
call dword ptr [edx]
ret
_6_1_7601_sp1_windows_7_NtGetCurrentProcessorNumber ENDP
; ULONG __stdcall NtGetDevicePowerState( ULONG arg_01 , ULONG arg_02 );
_6_1_7601_sp1_windows_7_NtGetDevicePowerState PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 137
mov edx , 7FFE0300h
call dword ptr [edx]
ret 8
_6_1_7601_sp1_windows_7_NtGetDevicePowerState ENDP
; ULONG __stdcall NtGetMUIRegistryInfo( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
_6_1_7601_sp1_windows_7_NtGetMUIRegistryInfo PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 138
mov edx , 7FFE0300h
call dword ptr [edx]
ret 12
_6_1_7601_sp1_windows_7_NtGetMUIRegistryInfo ENDP
; ULONG __stdcall NtGetNextProcess( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
_6_1_7601_sp1_windows_7_NtGetNextProcess PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 139
mov edx , 7FFE0300h
call dword ptr [edx]
ret 20
_6_1_7601_sp1_windows_7_NtGetNextProcess ENDP
; ULONG __stdcall NtGetNextThread( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 );
_6_1_7601_sp1_windows_7_NtGetNextThread PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD
mov eax , 140
mov edx , 7FFE0300h
call dword ptr [edx]
ret 24
_6_1_7601_sp1_windows_7_NtGetNextThread ENDP
; ULONG __stdcall NtGetNlsSectionPtr( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
_6_1_7601_sp1_windows_7_NtGetNlsSectionPtr PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 141
mov edx , 7FFE0300h
call dword ptr [edx]
ret 20
_6_1_7601_sp1_windows_7_NtGetNlsSectionPtr ENDP
; ULONG __stdcall NtGetNotificationResourceManager( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 );
_6_1_7601_sp1_windows_7_NtGetNotificationResourceManager PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD
mov eax , 142
mov edx , 7FFE0300h
call dword ptr [edx]
ret 28
_6_1_7601_sp1_windows_7_NtGetNotificationResourceManager ENDP
; ULONG __stdcall NtGetPlugPlayEvent( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
_6_1_7601_sp1_windows_7_NtGetPlugPlayEvent PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 143
mov edx , 7FFE0300h
call dword ptr [edx]
ret 16
_6_1_7601_sp1_windows_7_NtGetPlugPlayEvent ENDP
; ULONG __stdcall NtGetWriteWatch( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 );
_6_1_7601_sp1_windows_7_NtGetWriteWatch PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD
mov eax , 144
mov edx , 7FFE0300h
call dword ptr [edx]
ret 28
_6_1_7601_sp1_windows_7_NtGetWriteWatch ENDP
; ULONG __stdcall NtImpersonateAnonymousToken( ULONG arg_01 );
_6_1_7601_sp1_windows_7_NtImpersonateAnonymousToken PROC STDCALL arg_01:DWORD
mov eax , 145
mov edx , 7FFE0300h
call dword ptr [edx]
ret 4
_6_1_7601_sp1_windows_7_NtImpersonateAnonymousToken ENDP
; ULONG __stdcall NtImpersonateClientOfPort( ULONG arg_01 , ULONG arg_02 );
_6_1_7601_sp1_windows_7_NtImpersonateClientOfPort PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 146
mov edx , 7FFE0300h
call dword ptr [edx]
ret 8
_6_1_7601_sp1_windows_7_NtImpersonateClientOfPort ENDP
; ULONG __stdcall NtImpersonateThread( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
_6_1_7601_sp1_windows_7_NtImpersonateThread PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 147
mov edx , 7FFE0300h
call dword ptr [edx]
ret 12
_6_1_7601_sp1_windows_7_NtImpersonateThread ENDP
; ULONG __stdcall NtInitializeNlsFiles( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
_6_1_7601_sp1_windows_7_NtInitializeNlsFiles PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 148
mov edx , 7FFE0300h
call dword ptr [edx]
ret 12
_6_1_7601_sp1_windows_7_NtInitializeNlsFiles ENDP
; ULONG __stdcall NtInitializeRegistry( ULONG arg_01 );
_6_1_7601_sp1_windows_7_NtInitializeRegistry PROC STDCALL arg_01:DWORD
mov eax , 149
mov edx , 7FFE0300h
call dword ptr [edx]
ret 4
_6_1_7601_sp1_windows_7_NtInitializeRegistry ENDP
; ULONG __stdcall NtInitiatePowerAction( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
_6_1_7601_sp1_windows_7_NtInitiatePowerAction PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 150
mov edx , 7FFE0300h
call dword ptr [edx]
ret 16
_6_1_7601_sp1_windows_7_NtInitiatePowerAction ENDP
; ULONG __stdcall NtIsProcessInJob( ULONG arg_01 , ULONG arg_02 );
_6_1_7601_sp1_windows_7_NtIsProcessInJob PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 151
mov edx , 7FFE0300h
call dword ptr [edx]
ret 8
_6_1_7601_sp1_windows_7_NtIsProcessInJob ENDP
; ULONG __stdcall NtIsSystemResumeAutomatic( );
_6_1_7601_sp1_windows_7_NtIsSystemResumeAutomatic PROC STDCALL
mov eax , 152
mov edx , 7FFE0300h
call dword ptr [edx]
ret
_6_1_7601_sp1_windows_7_NtIsSystemResumeAutomatic ENDP
; ULONG __stdcall NtIsUILanguageComitted( );
_6_1_7601_sp1_windows_7_NtIsUILanguageComitted PROC STDCALL
mov eax , 153
mov edx , 7FFE0300h
call dword ptr [edx]
ret
_6_1_7601_sp1_windows_7_NtIsUILanguageComitted ENDP
; ULONG __stdcall NtListenPort( ULONG arg_01 , ULONG arg_02 );
_6_1_7601_sp1_windows_7_NtListenPort PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 154
mov edx , 7FFE0300h
call dword ptr [edx]
ret 8
_6_1_7601_sp1_windows_7_NtListenPort ENDP
; ULONG __stdcall NtLoadDriver( ULONG arg_01 );
_6_1_7601_sp1_windows_7_NtLoadDriver PROC STDCALL arg_01:DWORD
mov eax , 155
mov edx , 7FFE0300h
call dword ptr [edx]
ret 4
_6_1_7601_sp1_windows_7_NtLoadDriver ENDP
; ULONG __stdcall NtLoadKey( ULONG arg_01 , ULONG arg_02 );
_6_1_7601_sp1_windows_7_NtLoadKey PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 156
mov edx , 7FFE0300h
call dword ptr [edx]
ret 8
_6_1_7601_sp1_windows_7_NtLoadKey ENDP
; ULONG __stdcall NtLoadKey2( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
_6_1_7601_sp1_windows_7_NtLoadKey2 PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 157
mov edx , 7FFE0300h
call dword ptr [edx]
ret 12
_6_1_7601_sp1_windows_7_NtLoadKey2 ENDP
; ULONG __stdcall NtLoadKeyEx( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 , ULONG arg_08 );
_6_1_7601_sp1_windows_7_NtLoadKeyEx PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD , arg_08:DWORD
mov eax , 158
mov edx , 7FFE0300h
call dword ptr [edx]
ret 32
_6_1_7601_sp1_windows_7_NtLoadKeyEx ENDP
; ULONG __stdcall NtLockFile( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 , ULONG arg_08 , ULONG arg_09 , ULONG arg_10 );
_6_1_7601_sp1_windows_7_NtLockFile PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD , arg_08:DWORD , arg_09:DWORD , arg_10:DWORD
mov eax , 159
mov edx , 7FFE0300h
call dword ptr [edx]
ret 40
_6_1_7601_sp1_windows_7_NtLockFile ENDP
; ULONG __stdcall NtLockProductActivationKeys( ULONG arg_01 , ULONG arg_02 );
_6_1_7601_sp1_windows_7_NtLockProductActivationKeys PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 160
mov edx , 7FFE0300h
call dword ptr [edx]
ret 8
_6_1_7601_sp1_windows_7_NtLockProductActivationKeys ENDP
; ULONG __stdcall NtLockRegistryKey( ULONG arg_01 );
_6_1_7601_sp1_windows_7_NtLockRegistryKey PROC STDCALL arg_01:DWORD
mov eax , 161
mov edx , 7FFE0300h
call dword ptr [edx]
ret 4
_6_1_7601_sp1_windows_7_NtLockRegistryKey ENDP
; ULONG __stdcall NtLockVirtualMemory( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
_6_1_7601_sp1_windows_7_NtLockVirtualMemory PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 162
mov edx , 7FFE0300h
call dword ptr [edx]
ret 16
_6_1_7601_sp1_windows_7_NtLockVirtualMemory ENDP
; ULONG __stdcall NtMakePermanentObject( ULONG arg_01 );
_6_1_7601_sp1_windows_7_NtMakePermanentObject PROC STDCALL arg_01:DWORD
mov eax , 163
mov edx , 7FFE0300h
call dword ptr [edx]
ret 4
_6_1_7601_sp1_windows_7_NtMakePermanentObject ENDP
; ULONG __stdcall NtMakeTemporaryObject( ULONG arg_01 );
_6_1_7601_sp1_windows_7_NtMakeTemporaryObject PROC STDCALL arg_01:DWORD
mov eax , 164
mov edx , 7FFE0300h
call dword ptr [edx]
ret 4
_6_1_7601_sp1_windows_7_NtMakeTemporaryObject ENDP
; ULONG __stdcall NtMapCMFModule( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 );
_6_1_7601_sp1_windows_7_NtMapCMFModule PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD
mov eax , 165
mov edx , 7FFE0300h
call dword ptr [edx]
ret 24
_6_1_7601_sp1_windows_7_NtMapCMFModule ENDP
; ULONG __stdcall NtMapUserPhysicalPages( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
_6_1_7601_sp1_windows_7_NtMapUserPhysicalPages PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 166
mov edx , 7FFE0300h
call dword ptr [edx]
ret 12
_6_1_7601_sp1_windows_7_NtMapUserPhysicalPages ENDP
; ULONG __stdcall NtMapUserPhysicalPagesScatter( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
_6_1_7601_sp1_windows_7_NtMapUserPhysicalPagesScatter PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 167
mov edx , 7FFE0300h
call dword ptr [edx]
ret 12
_6_1_7601_sp1_windows_7_NtMapUserPhysicalPagesScatter ENDP
; ULONG __stdcall NtMapViewOfSection( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 , ULONG arg_08 , ULONG arg_09 , ULONG arg_10 );
_6_1_7601_sp1_windows_7_NtMapViewOfSection PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD , arg_08:DWORD , arg_09:DWORD , arg_10:DWORD
mov eax , 168
mov edx , 7FFE0300h
call dword ptr [edx]
ret 40
_6_1_7601_sp1_windows_7_NtMapViewOfSection ENDP
; ULONG __stdcall NtModifyBootEntry( ULONG arg_01 );
_6_1_7601_sp1_windows_7_NtModifyBootEntry PROC STDCALL arg_01:DWORD
mov eax , 169
mov edx , 7FFE0300h
call dword ptr [edx]
ret 4
_6_1_7601_sp1_windows_7_NtModifyBootEntry ENDP
; ULONG __stdcall NtModifyDriverEntry( ULONG arg_01 );
_6_1_7601_sp1_windows_7_NtModifyDriverEntry PROC STDCALL arg_01:DWORD
mov eax , 170
mov edx , 7FFE0300h
call dword ptr [edx]
ret 4
_6_1_7601_sp1_windows_7_NtModifyDriverEntry ENDP
; ULONG __stdcall NtNotifyChangeDirectoryFile( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 , ULONG arg_08 , ULONG arg_09 );
_6_1_7601_sp1_windows_7_NtNotifyChangeDirectoryFile PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD , arg_08:DWORD , arg_09:DWORD
mov eax , 171
mov edx , 7FFE0300h
call dword ptr [edx]
ret 36
_6_1_7601_sp1_windows_7_NtNotifyChangeDirectoryFile ENDP
; ULONG __stdcall NtNotifyChangeKey( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 , ULONG arg_08 , ULONG arg_09 , ULONG arg_10 );
_6_1_7601_sp1_windows_7_NtNotifyChangeKey PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD , arg_08:DWORD , arg_09:DWORD , arg_10:DWORD
mov eax , 172
mov edx , 7FFE0300h
call dword ptr [edx]
ret 40
_6_1_7601_sp1_windows_7_NtNotifyChangeKey ENDP
; ULONG __stdcall NtNotifyChangeMultipleKeys( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 , ULONG arg_08 , ULONG arg_09 , ULONG arg_10 , ULONG arg_11 , ULONG arg_12 );
_6_1_7601_sp1_windows_7_NtNotifyChangeMultipleKeys PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD , arg_08:DWORD , arg_09:DWORD , arg_10:DWORD , arg_11:DWORD , arg_12:DWORD
mov eax , 173
mov edx , 7FFE0300h
call dword ptr [edx]
ret 48
_6_1_7601_sp1_windows_7_NtNotifyChangeMultipleKeys ENDP
; ULONG __stdcall NtNotifyChangeSession( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 , ULONG arg_08 );
_6_1_7601_sp1_windows_7_NtNotifyChangeSession PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD , arg_08:DWORD
mov eax , 174
mov edx , 7FFE0300h
call dword ptr [edx]
ret 32
_6_1_7601_sp1_windows_7_NtNotifyChangeSession ENDP
; ULONG __stdcall NtOpenDirectoryObject( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
_6_1_7601_sp1_windows_7_NtOpenDirectoryObject PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 175
mov edx , 7FFE0300h
call dword ptr [edx]
ret 12
_6_1_7601_sp1_windows_7_NtOpenDirectoryObject ENDP
; ULONG __stdcall NtOpenEnlistment( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
_6_1_7601_sp1_windows_7_NtOpenEnlistment PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 176
mov edx , 7FFE0300h
call dword ptr [edx]
ret 20
_6_1_7601_sp1_windows_7_NtOpenEnlistment ENDP
; ULONG __stdcall NtOpenEvent( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
_6_1_7601_sp1_windows_7_NtOpenEvent PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 177
mov edx , 7FFE0300h
call dword ptr [edx]
ret 12
_6_1_7601_sp1_windows_7_NtOpenEvent ENDP
; ULONG __stdcall NtOpenEventPair( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
_6_1_7601_sp1_windows_7_NtOpenEventPair PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 178
mov edx , 7FFE0300h
call dword ptr [edx]
ret 12
_6_1_7601_sp1_windows_7_NtOpenEventPair ENDP
; ULONG __stdcall NtOpenFile( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 );
_6_1_7601_sp1_windows_7_NtOpenFile PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD
mov eax , 179
mov edx , 7FFE0300h
call dword ptr [edx]
ret 24
_6_1_7601_sp1_windows_7_NtOpenFile ENDP
; ULONG __stdcall NtOpenIoCompletion( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
_6_1_7601_sp1_windows_7_NtOpenIoCompletion PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 180
mov edx , 7FFE0300h
call dword ptr [edx]
ret 12
_6_1_7601_sp1_windows_7_NtOpenIoCompletion ENDP
; ULONG __stdcall NtOpenJobObject( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
_6_1_7601_sp1_windows_7_NtOpenJobObject PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 181
mov edx , 7FFE0300h
call dword ptr [edx]
ret 12
_6_1_7601_sp1_windows_7_NtOpenJobObject ENDP
; ULONG __stdcall NtOpenKey( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
_6_1_7601_sp1_windows_7_NtOpenKey PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 182
mov edx , 7FFE0300h
call dword ptr [edx]
ret 12
_6_1_7601_sp1_windows_7_NtOpenKey ENDP
; ULONG __stdcall NtOpenKeyEx( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
_6_1_7601_sp1_windows_7_NtOpenKeyEx PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 183
mov edx , 7FFE0300h
call dword ptr [edx]
ret 16
_6_1_7601_sp1_windows_7_NtOpenKeyEx ENDP
; ULONG __stdcall NtOpenKeyedEvent( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
_6_1_7601_sp1_windows_7_NtOpenKeyedEvent PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 184
mov edx , 7FFE0300h
call dword ptr [edx]
ret 12
_6_1_7601_sp1_windows_7_NtOpenKeyedEvent ENDP
; ULONG __stdcall NtOpenKeyTransacted( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
_6_1_7601_sp1_windows_7_NtOpenKeyTransacted PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 185
mov edx , 7FFE0300h
call dword ptr [edx]
ret 16
_6_1_7601_sp1_windows_7_NtOpenKeyTransacted ENDP
; ULONG __stdcall NtOpenKeyTransactedEx( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
_6_1_7601_sp1_windows_7_NtOpenKeyTransactedEx PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 186
mov edx , 7FFE0300h
call dword ptr [edx]
ret 20
_6_1_7601_sp1_windows_7_NtOpenKeyTransactedEx ENDP
; ULONG __stdcall NtOpenMutant( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
_6_1_7601_sp1_windows_7_NtOpenMutant PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 187
mov edx , 7FFE0300h
call dword ptr [edx]
ret 12
_6_1_7601_sp1_windows_7_NtOpenMutant ENDP
; ULONG __stdcall NtOpenObjectAuditAlarm( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 , ULONG arg_08 , ULONG arg_09 , ULONG arg_10 , ULONG arg_11 , ULONG arg_12 );
_6_1_7601_sp1_windows_7_NtOpenObjectAuditAlarm PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD , arg_08:DWORD , arg_09:DWORD , arg_10:DWORD , arg_11:DWORD , arg_12:DWORD
mov eax , 188
mov edx , 7FFE0300h
call dword ptr [edx]
ret 48
_6_1_7601_sp1_windows_7_NtOpenObjectAuditAlarm ENDP
; ULONG __stdcall NtOpenPrivateNamespace( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
_6_1_7601_sp1_windows_7_NtOpenPrivateNamespace PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 189
mov edx , 7FFE0300h
call dword ptr [edx]
ret 16
_6_1_7601_sp1_windows_7_NtOpenPrivateNamespace ENDP
; ULONG __stdcall NtOpenProcess( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
_6_1_7601_sp1_windows_7_NtOpenProcess PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 190
mov edx , 7FFE0300h
call dword ptr [edx]
ret 16
_6_1_7601_sp1_windows_7_NtOpenProcess ENDP
; ULONG __stdcall NtOpenProcessToken( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
_6_1_7601_sp1_windows_7_NtOpenProcessToken PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 191
mov edx , 7FFE0300h
call dword ptr [edx]
ret 12
_6_1_7601_sp1_windows_7_NtOpenProcessToken ENDP
; ULONG __stdcall NtOpenProcessTokenEx( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
_6_1_7601_sp1_windows_7_NtOpenProcessTokenEx PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 192
mov edx , 7FFE0300h
call dword ptr [edx]
ret 16
_6_1_7601_sp1_windows_7_NtOpenProcessTokenEx ENDP
; ULONG __stdcall NtOpenResourceManager( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
_6_1_7601_sp1_windows_7_NtOpenResourceManager PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 193
mov edx , 7FFE0300h
call dword ptr [edx]
ret 20
_6_1_7601_sp1_windows_7_NtOpenResourceManager ENDP
; ULONG __stdcall NtOpenSection( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
_6_1_7601_sp1_windows_7_NtOpenSection PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 194
mov edx , 7FFE0300h
call dword ptr [edx]
ret 12
_6_1_7601_sp1_windows_7_NtOpenSection ENDP
; ULONG __stdcall NtOpenSemaphore( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
_6_1_7601_sp1_windows_7_NtOpenSemaphore PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 195
mov edx , 7FFE0300h
call dword ptr [edx]
ret 12
_6_1_7601_sp1_windows_7_NtOpenSemaphore ENDP
; ULONG __stdcall NtOpenSession( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
_6_1_7601_sp1_windows_7_NtOpenSession PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 196
mov edx , 7FFE0300h
call dword ptr [edx]
ret 12
_6_1_7601_sp1_windows_7_NtOpenSession ENDP
; ULONG __stdcall NtOpenSymbolicLinkObject( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
_6_1_7601_sp1_windows_7_NtOpenSymbolicLinkObject PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 197
mov edx , 7FFE0300h
call dword ptr [edx]
ret 12
_6_1_7601_sp1_windows_7_NtOpenSymbolicLinkObject ENDP
; ULONG __stdcall NtOpenThread( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
_6_1_7601_sp1_windows_7_NtOpenThread PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 198
mov edx , 7FFE0300h
call dword ptr [edx]
ret 16
_6_1_7601_sp1_windows_7_NtOpenThread ENDP
; ULONG __stdcall NtOpenThreadToken( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
_6_1_7601_sp1_windows_7_NtOpenThreadToken PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 199
mov edx , 7FFE0300h
call dword ptr [edx]
ret 16
_6_1_7601_sp1_windows_7_NtOpenThreadToken ENDP
; ULONG __stdcall NtOpenThreadTokenEx( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
_6_1_7601_sp1_windows_7_NtOpenThreadTokenEx PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 200
mov edx , 7FFE0300h
call dword ptr [edx]
ret 20
_6_1_7601_sp1_windows_7_NtOpenThreadTokenEx ENDP
; ULONG __stdcall NtOpenTimer( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
_6_1_7601_sp1_windows_7_NtOpenTimer PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 201
mov edx , 7FFE0300h
call dword ptr [edx]
ret 12
_6_1_7601_sp1_windows_7_NtOpenTimer ENDP
; ULONG __stdcall NtOpenTransaction( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
_6_1_7601_sp1_windows_7_NtOpenTransaction PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 202
mov edx , 7FFE0300h
call dword ptr [edx]
ret 20
_6_1_7601_sp1_windows_7_NtOpenTransaction ENDP
; ULONG __stdcall NtOpenTransactionManager( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 );
_6_1_7601_sp1_windows_7_NtOpenTransactionManager PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD
mov eax , 203
mov edx , 7FFE0300h
call dword ptr [edx]
ret 24
_6_1_7601_sp1_windows_7_NtOpenTransactionManager ENDP
; ULONG __stdcall NtPlugPlayControl( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
_6_1_7601_sp1_windows_7_NtPlugPlayControl PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 204
mov edx , 7FFE0300h
call dword ptr [edx]
ret 12
_6_1_7601_sp1_windows_7_NtPlugPlayControl ENDP
; ULONG __stdcall NtPowerInformation( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
_6_1_7601_sp1_windows_7_NtPowerInformation PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 205
mov edx , 7FFE0300h
call dword ptr [edx]
ret 20
_6_1_7601_sp1_windows_7_NtPowerInformation ENDP
; ULONG __stdcall NtPrepareComplete( ULONG arg_01 , ULONG arg_02 );
_6_1_7601_sp1_windows_7_NtPrepareComplete PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 206
mov edx , 7FFE0300h
call dword ptr [edx]
ret 8
_6_1_7601_sp1_windows_7_NtPrepareComplete ENDP
; ULONG __stdcall NtPrepareEnlistment( ULONG arg_01 , ULONG arg_02 );
_6_1_7601_sp1_windows_7_NtPrepareEnlistment PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 207
mov edx , 7FFE0300h
call dword ptr [edx]
ret 8
_6_1_7601_sp1_windows_7_NtPrepareEnlistment ENDP
; ULONG __stdcall NtPrePrepareComplete( ULONG arg_01 , ULONG arg_02 );
_6_1_7601_sp1_windows_7_NtPrePrepareComplete PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 208
mov edx , 7FFE0300h
call dword ptr [edx]
ret 8
_6_1_7601_sp1_windows_7_NtPrePrepareComplete ENDP
; ULONG __stdcall NtPrePrepareEnlistment( ULONG arg_01 , ULONG arg_02 );
_6_1_7601_sp1_windows_7_NtPrePrepareEnlistment PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 209
mov edx , 7FFE0300h
call dword ptr [edx]
ret 8
_6_1_7601_sp1_windows_7_NtPrePrepareEnlistment ENDP
; ULONG __stdcall NtPrivilegeCheck( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
_6_1_7601_sp1_windows_7_NtPrivilegeCheck PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 210
mov edx , 7FFE0300h
call dword ptr [edx]
ret 12
_6_1_7601_sp1_windows_7_NtPrivilegeCheck ENDP
; ULONG __stdcall NtPrivilegedServiceAuditAlarm( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
_6_1_7601_sp1_windows_7_NtPrivilegedServiceAuditAlarm PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 211
mov edx , 7FFE0300h
call dword ptr [edx]
ret 20
_6_1_7601_sp1_windows_7_NtPrivilegedServiceAuditAlarm ENDP
; ULONG __stdcall NtPrivilegeObjectAuditAlarm( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 );
_6_1_7601_sp1_windows_7_NtPrivilegeObjectAuditAlarm PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD
mov eax , 212
mov edx , 7FFE0300h
call dword ptr [edx]
ret 24
_6_1_7601_sp1_windows_7_NtPrivilegeObjectAuditAlarm ENDP
; ULONG __stdcall NtPropagationComplete( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
_6_1_7601_sp1_windows_7_NtPropagationComplete PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 213
mov edx , 7FFE0300h
call dword ptr [edx]
ret 16
_6_1_7601_sp1_windows_7_NtPropagationComplete ENDP
; ULONG __stdcall NtPropagationFailed( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
_6_1_7601_sp1_windows_7_NtPropagationFailed PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 214
mov edx , 7FFE0300h
call dword ptr [edx]
ret 12
_6_1_7601_sp1_windows_7_NtPropagationFailed ENDP
; ULONG __stdcall NtProtectVirtualMemory( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
_6_1_7601_sp1_windows_7_NtProtectVirtualMemory PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 215
mov edx , 7FFE0300h
call dword ptr [edx]
ret 20
_6_1_7601_sp1_windows_7_NtProtectVirtualMemory ENDP
; ULONG __stdcall NtPulseEvent( ULONG arg_01 , ULONG arg_02 );
_6_1_7601_sp1_windows_7_NtPulseEvent PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 216
mov edx , 7FFE0300h
call dword ptr [edx]
ret 8
_6_1_7601_sp1_windows_7_NtPulseEvent ENDP
; ULONG __stdcall NtQueryAttributesFile( ULONG arg_01 , ULONG arg_02 );
_6_1_7601_sp1_windows_7_NtQueryAttributesFile PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 217
mov edx , 7FFE0300h
call dword ptr [edx]
ret 8
_6_1_7601_sp1_windows_7_NtQueryAttributesFile ENDP
; ULONG __stdcall NtQueryBootEntryOrder( ULONG arg_01 , ULONG arg_02 );
_6_1_7601_sp1_windows_7_NtQueryBootEntryOrder PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 218
mov edx , 7FFE0300h
call dword ptr [edx]
ret 8
_6_1_7601_sp1_windows_7_NtQueryBootEntryOrder ENDP
; ULONG __stdcall NtQueryBootOptions( ULONG arg_01 , ULONG arg_02 );
_6_1_7601_sp1_windows_7_NtQueryBootOptions PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 219
mov edx , 7FFE0300h
call dword ptr [edx]
ret 8
_6_1_7601_sp1_windows_7_NtQueryBootOptions ENDP
; ULONG __stdcall NtQueryDebugFilterState( ULONG arg_01 , ULONG arg_02 );
_6_1_7601_sp1_windows_7_NtQueryDebugFilterState PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 220
mov edx , 7FFE0300h
call dword ptr [edx]
ret 8
_6_1_7601_sp1_windows_7_NtQueryDebugFilterState ENDP
; ULONG __stdcall NtQueryDefaultLocale( ULONG arg_01 , ULONG arg_02 );
_6_1_7601_sp1_windows_7_NtQueryDefaultLocale PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 221
mov edx , 7FFE0300h
call dword ptr [edx]
ret 8
_6_1_7601_sp1_windows_7_NtQueryDefaultLocale ENDP
; ULONG __stdcall NtQueryDefaultUILanguage( ULONG arg_01 );
_6_1_7601_sp1_windows_7_NtQueryDefaultUILanguage PROC STDCALL arg_01:DWORD
mov eax , 222
mov edx , 7FFE0300h
call dword ptr [edx]
ret 4
_6_1_7601_sp1_windows_7_NtQueryDefaultUILanguage ENDP
; ULONG __stdcall NtQueryDirectoryFile( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 , ULONG arg_08 , ULONG arg_09 , ULONG arg_10 , ULONG arg_11 );
_6_1_7601_sp1_windows_7_NtQueryDirectoryFile PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD , arg_08:DWORD , arg_09:DWORD , arg_10:DWORD , arg_11:DWORD
mov eax , 223
mov edx , 7FFE0300h
call dword ptr [edx]
ret 44
_6_1_7601_sp1_windows_7_NtQueryDirectoryFile ENDP
; ULONG __stdcall NtQueryDirectoryObject( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 );
_6_1_7601_sp1_windows_7_NtQueryDirectoryObject PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD
mov eax , 224
mov edx , 7FFE0300h
call dword ptr [edx]
ret 28
_6_1_7601_sp1_windows_7_NtQueryDirectoryObject ENDP
; ULONG __stdcall NtQueryDriverEntryOrder( ULONG arg_01 , ULONG arg_02 );
_6_1_7601_sp1_windows_7_NtQueryDriverEntryOrder PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 225
mov edx , 7FFE0300h
call dword ptr [edx]
ret 8
_6_1_7601_sp1_windows_7_NtQueryDriverEntryOrder ENDP
; ULONG __stdcall NtQueryEaFile( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 , ULONG arg_08 , ULONG arg_09 );
_6_1_7601_sp1_windows_7_NtQueryEaFile PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD , arg_08:DWORD , arg_09:DWORD
mov eax , 226
mov edx , 7FFE0300h
call dword ptr [edx]
ret 36
_6_1_7601_sp1_windows_7_NtQueryEaFile ENDP
; ULONG __stdcall NtQueryEvent( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
_6_1_7601_sp1_windows_7_NtQueryEvent PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 227
mov edx , 7FFE0300h
call dword ptr [edx]
ret 20
_6_1_7601_sp1_windows_7_NtQueryEvent ENDP
; ULONG __stdcall NtQueryFullAttributesFile( ULONG arg_01 , ULONG arg_02 );
_6_1_7601_sp1_windows_7_NtQueryFullAttributesFile PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 228
mov edx , 7FFE0300h
call dword ptr [edx]
ret 8
_6_1_7601_sp1_windows_7_NtQueryFullAttributesFile ENDP
; ULONG __stdcall NtQueryInformationAtom( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
_6_1_7601_sp1_windows_7_NtQueryInformationAtom PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 229
mov edx , 7FFE0300h
call dword ptr [edx]
ret 20
_6_1_7601_sp1_windows_7_NtQueryInformationAtom ENDP
; ULONG __stdcall NtQueryInformationEnlistment( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
_6_1_7601_sp1_windows_7_NtQueryInformationEnlistment PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 230
mov edx , 7FFE0300h
call dword ptr [edx]
ret 20
_6_1_7601_sp1_windows_7_NtQueryInformationEnlistment ENDP
; ULONG __stdcall NtQueryInformationFile( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
_6_1_7601_sp1_windows_7_NtQueryInformationFile PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 231
mov edx , 7FFE0300h
call dword ptr [edx]
ret 20
_6_1_7601_sp1_windows_7_NtQueryInformationFile ENDP
; ULONG __stdcall NtQueryInformationJobObject( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
_6_1_7601_sp1_windows_7_NtQueryInformationJobObject PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 232
mov edx , 7FFE0300h
call dword ptr [edx]
ret 20
_6_1_7601_sp1_windows_7_NtQueryInformationJobObject ENDP
; ULONG __stdcall NtQueryInformationPort( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
_6_1_7601_sp1_windows_7_NtQueryInformationPort PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 233
mov edx , 7FFE0300h
call dword ptr [edx]
ret 20
_6_1_7601_sp1_windows_7_NtQueryInformationPort ENDP
; ULONG __stdcall NtQueryInformationProcess( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
_6_1_7601_sp1_windows_7_NtQueryInformationProcess PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 234
mov edx , 7FFE0300h
call dword ptr [edx]
ret 20
_6_1_7601_sp1_windows_7_NtQueryInformationProcess ENDP
; ULONG __stdcall NtQueryInformationResourceManager( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
_6_1_7601_sp1_windows_7_NtQueryInformationResourceManager PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 235
mov edx , 7FFE0300h
call dword ptr [edx]
ret 20
_6_1_7601_sp1_windows_7_NtQueryInformationResourceManager ENDP
; ULONG __stdcall NtQueryInformationThread( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
_6_1_7601_sp1_windows_7_NtQueryInformationThread PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 236
mov edx , 7FFE0300h
call dword ptr [edx]
ret 20
_6_1_7601_sp1_windows_7_NtQueryInformationThread ENDP
; ULONG __stdcall NtQueryInformationToken( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
_6_1_7601_sp1_windows_7_NtQueryInformationToken PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 237
mov edx , 7FFE0300h
call dword ptr [edx]
ret 20
_6_1_7601_sp1_windows_7_NtQueryInformationToken ENDP
; ULONG __stdcall NtQueryInformationTransaction( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
_6_1_7601_sp1_windows_7_NtQueryInformationTransaction PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 238
mov edx , 7FFE0300h
call dword ptr [edx]
ret 20
_6_1_7601_sp1_windows_7_NtQueryInformationTransaction ENDP
; ULONG __stdcall NtQueryInformationTransactionManager( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
_6_1_7601_sp1_windows_7_NtQueryInformationTransactionManager PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 239
mov edx , 7FFE0300h
call dword ptr [edx]
ret 20
_6_1_7601_sp1_windows_7_NtQueryInformationTransactionManager ENDP
; ULONG __stdcall NtQueryInformationWorkerFactory( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
_6_1_7601_sp1_windows_7_NtQueryInformationWorkerFactory PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 240
mov edx , 7FFE0300h
call dword ptr [edx]
ret 20
_6_1_7601_sp1_windows_7_NtQueryInformationWorkerFactory ENDP
; ULONG __stdcall NtQueryInstallUILanguage( ULONG arg_01 );
_6_1_7601_sp1_windows_7_NtQueryInstallUILanguage PROC STDCALL arg_01:DWORD
mov eax , 241
mov edx , 7FFE0300h
call dword ptr [edx]
ret 4
_6_1_7601_sp1_windows_7_NtQueryInstallUILanguage ENDP
; ULONG __stdcall NtQueryIntervalProfile( ULONG arg_01 , ULONG arg_02 );
_6_1_7601_sp1_windows_7_NtQueryIntervalProfile PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 242
mov edx , 7FFE0300h
call dword ptr [edx]
ret 8
_6_1_7601_sp1_windows_7_NtQueryIntervalProfile ENDP
; ULONG __stdcall NtQueryIoCompletion( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
_6_1_7601_sp1_windows_7_NtQueryIoCompletion PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 243
mov edx , 7FFE0300h
call dword ptr [edx]
ret 20
_6_1_7601_sp1_windows_7_NtQueryIoCompletion ENDP
; ULONG __stdcall NtQueryKey( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
_6_1_7601_sp1_windows_7_NtQueryKey PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 244
mov edx , 7FFE0300h
call dword ptr [edx]
ret 20
_6_1_7601_sp1_windows_7_NtQueryKey ENDP
; ULONG __stdcall NtQueryLicenseValue( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
_6_1_7601_sp1_windows_7_NtQueryLicenseValue PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 245
mov edx , 7FFE0300h
call dword ptr [edx]
ret 20
_6_1_7601_sp1_windows_7_NtQueryLicenseValue ENDP
; ULONG __stdcall NtQueryMultipleValueKey( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 );
_6_1_7601_sp1_windows_7_NtQueryMultipleValueKey PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD
mov eax , 246
mov edx , 7FFE0300h
call dword ptr [edx]
ret 24
_6_1_7601_sp1_windows_7_NtQueryMultipleValueKey ENDP
; ULONG __stdcall NtQueryMutant( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
_6_1_7601_sp1_windows_7_NtQueryMutant PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 247
mov edx , 7FFE0300h
call dword ptr [edx]
ret 20
_6_1_7601_sp1_windows_7_NtQueryMutant ENDP
; ULONG __stdcall NtQueryObject( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
_6_1_7601_sp1_windows_7_NtQueryObject PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 248
mov edx , 7FFE0300h
call dword ptr [edx]
ret 20
_6_1_7601_sp1_windows_7_NtQueryObject ENDP
; ULONG __stdcall NtQueryOpenSubKeys( ULONG arg_01 , ULONG arg_02 );
_6_1_7601_sp1_windows_7_NtQueryOpenSubKeys PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 249
mov edx , 7FFE0300h
call dword ptr [edx]
ret 8
_6_1_7601_sp1_windows_7_NtQueryOpenSubKeys ENDP
; ULONG __stdcall NtQueryOpenSubKeysEx( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
_6_1_7601_sp1_windows_7_NtQueryOpenSubKeysEx PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 250
mov edx , 7FFE0300h
call dword ptr [edx]
ret 16
_6_1_7601_sp1_windows_7_NtQueryOpenSubKeysEx ENDP
; ULONG __stdcall NtQueryPerformanceCounter( ULONG arg_01 , ULONG arg_02 );
_6_1_7601_sp1_windows_7_NtQueryPerformanceCounter PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 251
mov edx , 7FFE0300h
call dword ptr [edx]
ret 8
_6_1_7601_sp1_windows_7_NtQueryPerformanceCounter ENDP
; ULONG __stdcall NtQueryPortInformationProcess( );
_6_1_7601_sp1_windows_7_NtQueryPortInformationProcess PROC STDCALL
mov eax , 252
mov edx , 7FFE0300h
call dword ptr [edx]
ret
_6_1_7601_sp1_windows_7_NtQueryPortInformationProcess ENDP
; ULONG __stdcall NtQueryQuotaInformationFile( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 , ULONG arg_08 , ULONG arg_09 );
_6_1_7601_sp1_windows_7_NtQueryQuotaInformationFile PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD , arg_08:DWORD , arg_09:DWORD
mov eax , 253
mov edx , 7FFE0300h
call dword ptr [edx]
ret 36
_6_1_7601_sp1_windows_7_NtQueryQuotaInformationFile ENDP
; ULONG __stdcall NtQuerySection( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
_6_1_7601_sp1_windows_7_NtQuerySection PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 254
mov edx , 7FFE0300h
call dword ptr [edx]
ret 20
_6_1_7601_sp1_windows_7_NtQuerySection ENDP
; ULONG __stdcall NtQuerySecurityAttributesToken( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 );
_6_1_7601_sp1_windows_7_NtQuerySecurityAttributesToken PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD
mov eax , 255
mov edx , 7FFE0300h
call dword ptr [edx]
ret 24
_6_1_7601_sp1_windows_7_NtQuerySecurityAttributesToken ENDP
; ULONG __stdcall NtQuerySecurityObject( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
_6_1_7601_sp1_windows_7_NtQuerySecurityObject PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 256
mov edx , 7FFE0300h
call dword ptr [edx]
ret 20
_6_1_7601_sp1_windows_7_NtQuerySecurityObject ENDP
; ULONG __stdcall NtQuerySemaphore( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
_6_1_7601_sp1_windows_7_NtQuerySemaphore PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 257
mov edx , 7FFE0300h
call dword ptr [edx]
ret 20
_6_1_7601_sp1_windows_7_NtQuerySemaphore ENDP
; ULONG __stdcall NtQuerySymbolicLinkObject( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
_6_1_7601_sp1_windows_7_NtQuerySymbolicLinkObject PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 258
mov edx , 7FFE0300h
call dword ptr [edx]
ret 12
_6_1_7601_sp1_windows_7_NtQuerySymbolicLinkObject ENDP
; ULONG __stdcall NtQuerySystemEnvironmentValue( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
_6_1_7601_sp1_windows_7_NtQuerySystemEnvironmentValue PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 259
mov edx , 7FFE0300h
call dword ptr [edx]
ret 16
_6_1_7601_sp1_windows_7_NtQuerySystemEnvironmentValue ENDP
; ULONG __stdcall NtQuerySystemEnvironmentValueEx( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
_6_1_7601_sp1_windows_7_NtQuerySystemEnvironmentValueEx PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 260
mov edx , 7FFE0300h
call dword ptr [edx]
ret 20
_6_1_7601_sp1_windows_7_NtQuerySystemEnvironmentValueEx ENDP
; ULONG __stdcall NtQuerySystemInformation( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
_6_1_7601_sp1_windows_7_NtQuerySystemInformation PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 261
mov edx , 7FFE0300h
call dword ptr [edx]
ret 16
_6_1_7601_sp1_windows_7_NtQuerySystemInformation ENDP
; ULONG __stdcall NtQuerySystemInformationEx( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 );
_6_1_7601_sp1_windows_7_NtQuerySystemInformationEx PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD
mov eax , 262
mov edx , 7FFE0300h
call dword ptr [edx]
ret 24
_6_1_7601_sp1_windows_7_NtQuerySystemInformationEx ENDP
; ULONG __stdcall NtQuerySystemTime( ULONG arg_01 );
_6_1_7601_sp1_windows_7_NtQuerySystemTime PROC STDCALL arg_01:DWORD
mov eax , 263
mov edx , 7FFE0300h
call dword ptr [edx]
ret 4
_6_1_7601_sp1_windows_7_NtQuerySystemTime ENDP
; ULONG __stdcall NtQueryTimer( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
_6_1_7601_sp1_windows_7_NtQueryTimer PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 264
mov edx , 7FFE0300h
call dword ptr [edx]
ret 20
_6_1_7601_sp1_windows_7_NtQueryTimer ENDP
; ULONG __stdcall NtQueryTimerResolution( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
_6_1_7601_sp1_windows_7_NtQueryTimerResolution PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 265
mov edx , 7FFE0300h
call dword ptr [edx]
ret 12
_6_1_7601_sp1_windows_7_NtQueryTimerResolution ENDP
; ULONG __stdcall NtQueryValueKey( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 );
_6_1_7601_sp1_windows_7_NtQueryValueKey PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD
mov eax , 266
mov edx , 7FFE0300h
call dword ptr [edx]
ret 24
_6_1_7601_sp1_windows_7_NtQueryValueKey ENDP
; ULONG __stdcall NtQueryVirtualMemory( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 );
_6_1_7601_sp1_windows_7_NtQueryVirtualMemory PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD
mov eax , 267
mov edx , 7FFE0300h
call dword ptr [edx]
ret 24
_6_1_7601_sp1_windows_7_NtQueryVirtualMemory ENDP
; ULONG __stdcall NtQueryVolumeInformationFile( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
_6_1_7601_sp1_windows_7_NtQueryVolumeInformationFile PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 268
mov edx , 7FFE0300h
call dword ptr [edx]
ret 20
_6_1_7601_sp1_windows_7_NtQueryVolumeInformationFile ENDP
; ULONG __stdcall NtQueueApcThread( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
_6_1_7601_sp1_windows_7_NtQueueApcThread PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 269
mov edx , 7FFE0300h
call dword ptr [edx]
ret 20
_6_1_7601_sp1_windows_7_NtQueueApcThread ENDP
; ULONG __stdcall NtQueueApcThreadEx( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 );
_6_1_7601_sp1_windows_7_NtQueueApcThreadEx PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD
mov eax , 270
mov edx , 7FFE0300h
call dword ptr [edx]
ret 24
_6_1_7601_sp1_windows_7_NtQueueApcThreadEx ENDP
; ULONG __stdcall NtRaiseException( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
_6_1_7601_sp1_windows_7_NtRaiseException PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 271
mov edx , 7FFE0300h
call dword ptr [edx]
ret 12
_6_1_7601_sp1_windows_7_NtRaiseException ENDP
; ULONG __stdcall NtRaiseHardError( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 );
_6_1_7601_sp1_windows_7_NtRaiseHardError PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD
mov eax , 272
mov edx , 7FFE0300h
call dword ptr [edx]
ret 24
_6_1_7601_sp1_windows_7_NtRaiseHardError ENDP
; ULONG __stdcall NtReadFile( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 , ULONG arg_08 , ULONG arg_09 );
_6_1_7601_sp1_windows_7_NtReadFile PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD , arg_08:DWORD , arg_09:DWORD
mov eax , 273
mov edx , 7FFE0300h
call dword ptr [edx]
ret 36
_6_1_7601_sp1_windows_7_NtReadFile ENDP
; ULONG __stdcall NtReadFileScatter( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 , ULONG arg_08 , ULONG arg_09 );
_6_1_7601_sp1_windows_7_NtReadFileScatter PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD , arg_08:DWORD , arg_09:DWORD
mov eax , 274
mov edx , 7FFE0300h
call dword ptr [edx]
ret 36
_6_1_7601_sp1_windows_7_NtReadFileScatter ENDP
; ULONG __stdcall NtReadOnlyEnlistment( ULONG arg_01 , ULONG arg_02 );
_6_1_7601_sp1_windows_7_NtReadOnlyEnlistment PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 275
mov edx , 7FFE0300h
call dword ptr [edx]
ret 8
_6_1_7601_sp1_windows_7_NtReadOnlyEnlistment ENDP
; ULONG __stdcall NtReadRequestData( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 );
_6_1_7601_sp1_windows_7_NtReadRequestData PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD
mov eax , 276
mov edx , 7FFE0300h
call dword ptr [edx]
ret 24
_6_1_7601_sp1_windows_7_NtReadRequestData ENDP
; ULONG __stdcall NtReadVirtualMemory( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
_6_1_7601_sp1_windows_7_NtReadVirtualMemory PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 277
mov edx , 7FFE0300h
call dword ptr [edx]
ret 20
_6_1_7601_sp1_windows_7_NtReadVirtualMemory ENDP
; ULONG __stdcall NtRecoverEnlistment( ULONG arg_01 , ULONG arg_02 );
_6_1_7601_sp1_windows_7_NtRecoverEnlistment PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 278
mov edx , 7FFE0300h
call dword ptr [edx]
ret 8
_6_1_7601_sp1_windows_7_NtRecoverEnlistment ENDP
; ULONG __stdcall NtRecoverResourceManager( ULONG arg_01 );
_6_1_7601_sp1_windows_7_NtRecoverResourceManager PROC STDCALL arg_01:DWORD
mov eax , 279
mov edx , 7FFE0300h
call dword ptr [edx]
ret 4
_6_1_7601_sp1_windows_7_NtRecoverResourceManager ENDP
; ULONG __stdcall NtRecoverTransactionManager( ULONG arg_01 );
_6_1_7601_sp1_windows_7_NtRecoverTransactionManager PROC STDCALL arg_01:DWORD
mov eax , 280
mov edx , 7FFE0300h
call dword ptr [edx]
ret 4
_6_1_7601_sp1_windows_7_NtRecoverTransactionManager ENDP
; ULONG __stdcall NtRegisterProtocolAddressInformation( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
_6_1_7601_sp1_windows_7_NtRegisterProtocolAddressInformation PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 281
mov edx , 7FFE0300h
call dword ptr [edx]
ret 20
_6_1_7601_sp1_windows_7_NtRegisterProtocolAddressInformation ENDP
; ULONG __stdcall NtRegisterThreadTerminatePort( ULONG arg_01 );
_6_1_7601_sp1_windows_7_NtRegisterThreadTerminatePort PROC STDCALL arg_01:DWORD
mov eax , 282
mov edx , 7FFE0300h
call dword ptr [edx]
ret 4
_6_1_7601_sp1_windows_7_NtRegisterThreadTerminatePort ENDP
; ULONG __stdcall NtReleaseKeyedEvent( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
_6_1_7601_sp1_windows_7_NtReleaseKeyedEvent PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 283
mov edx , 7FFE0300h
call dword ptr [edx]
ret 16
_6_1_7601_sp1_windows_7_NtReleaseKeyedEvent ENDP
; ULONG __stdcall NtReleaseMutant( ULONG arg_01 , ULONG arg_02 );
_6_1_7601_sp1_windows_7_NtReleaseMutant PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 284
mov edx , 7FFE0300h
call dword ptr [edx]
ret 8
_6_1_7601_sp1_windows_7_NtReleaseMutant ENDP
; ULONG __stdcall NtReleaseSemaphore( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
_6_1_7601_sp1_windows_7_NtReleaseSemaphore PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 285
mov edx , 7FFE0300h
call dword ptr [edx]
ret 12
_6_1_7601_sp1_windows_7_NtReleaseSemaphore ENDP
; ULONG __stdcall NtReleaseWorkerFactoryWorker( ULONG arg_01 );
_6_1_7601_sp1_windows_7_NtReleaseWorkerFactoryWorker PROC STDCALL arg_01:DWORD
mov eax , 286
mov edx , 7FFE0300h
call dword ptr [edx]
ret 4
_6_1_7601_sp1_windows_7_NtReleaseWorkerFactoryWorker ENDP
; ULONG __stdcall NtRemoveIoCompletion( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
_6_1_7601_sp1_windows_7_NtRemoveIoCompletion PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 287
mov edx , 7FFE0300h
call dword ptr [edx]
ret 20
_6_1_7601_sp1_windows_7_NtRemoveIoCompletion ENDP
; ULONG __stdcall NtRemoveIoCompletionEx( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 );
_6_1_7601_sp1_windows_7_NtRemoveIoCompletionEx PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD
mov eax , 288
mov edx , 7FFE0300h
call dword ptr [edx]
ret 24
_6_1_7601_sp1_windows_7_NtRemoveIoCompletionEx ENDP
; ULONG __stdcall NtRemoveProcessDebug( ULONG arg_01 , ULONG arg_02 );
_6_1_7601_sp1_windows_7_NtRemoveProcessDebug PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 289
mov edx , 7FFE0300h
call dword ptr [edx]
ret 8
_6_1_7601_sp1_windows_7_NtRemoveProcessDebug ENDP
; ULONG __stdcall NtRenameKey( ULONG arg_01 , ULONG arg_02 );
_6_1_7601_sp1_windows_7_NtRenameKey PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 290
mov edx , 7FFE0300h
call dword ptr [edx]
ret 8
_6_1_7601_sp1_windows_7_NtRenameKey ENDP
; ULONG __stdcall NtRenameTransactionManager( ULONG arg_01 , ULONG arg_02 );
_6_1_7601_sp1_windows_7_NtRenameTransactionManager PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 291
mov edx , 7FFE0300h
call dword ptr [edx]
ret 8
_6_1_7601_sp1_windows_7_NtRenameTransactionManager ENDP
; ULONG __stdcall NtReplaceKey( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
_6_1_7601_sp1_windows_7_NtReplaceKey PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 292
mov edx , 7FFE0300h
call dword ptr [edx]
ret 12
_6_1_7601_sp1_windows_7_NtReplaceKey ENDP
; ULONG __stdcall NtReplacePartitionUnit( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
_6_1_7601_sp1_windows_7_NtReplacePartitionUnit PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 293
mov edx , 7FFE0300h
call dword ptr [edx]
ret 12
_6_1_7601_sp1_windows_7_NtReplacePartitionUnit ENDP
; ULONG __stdcall NtReplyPort( ULONG arg_01 , ULONG arg_02 );
_6_1_7601_sp1_windows_7_NtReplyPort PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 294
mov edx , 7FFE0300h
call dword ptr [edx]
ret 8
_6_1_7601_sp1_windows_7_NtReplyPort ENDP
; ULONG __stdcall NtReplyWaitReceivePort( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
_6_1_7601_sp1_windows_7_NtReplyWaitReceivePort PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 295
mov edx , 7FFE0300h
call dword ptr [edx]
ret 16
_6_1_7601_sp1_windows_7_NtReplyWaitReceivePort ENDP
; ULONG __stdcall NtReplyWaitReceivePortEx( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
_6_1_7601_sp1_windows_7_NtReplyWaitReceivePortEx PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 296
mov edx , 7FFE0300h
call dword ptr [edx]
ret 20
_6_1_7601_sp1_windows_7_NtReplyWaitReceivePortEx ENDP
; ULONG __stdcall NtReplyWaitReplyPort( ULONG arg_01 , ULONG arg_02 );
_6_1_7601_sp1_windows_7_NtReplyWaitReplyPort PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 297
mov edx , 7FFE0300h
call dword ptr [edx]
ret 8
_6_1_7601_sp1_windows_7_NtReplyWaitReplyPort ENDP
; ULONG __stdcall NtRequestPort( ULONG arg_01 , ULONG arg_02 );
_6_1_7601_sp1_windows_7_NtRequestPort PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 298
mov edx , 7FFE0300h
call dword ptr [edx]
ret 8
_6_1_7601_sp1_windows_7_NtRequestPort ENDP
; ULONG __stdcall NtRequestWaitReplyPort( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
_6_1_7601_sp1_windows_7_NtRequestWaitReplyPort PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 299
mov edx , 7FFE0300h
call dword ptr [edx]
ret 12
_6_1_7601_sp1_windows_7_NtRequestWaitReplyPort ENDP
; ULONG __stdcall NtResetEvent( ULONG arg_01 , ULONG arg_02 );
_6_1_7601_sp1_windows_7_NtResetEvent PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 300
mov edx , 7FFE0300h
call dword ptr [edx]
ret 8
_6_1_7601_sp1_windows_7_NtResetEvent ENDP
; ULONG __stdcall NtResetWriteWatch( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
_6_1_7601_sp1_windows_7_NtResetWriteWatch PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 301
mov edx , 7FFE0300h
call dword ptr [edx]
ret 12
_6_1_7601_sp1_windows_7_NtResetWriteWatch ENDP
; ULONG __stdcall NtRestoreKey( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
_6_1_7601_sp1_windows_7_NtRestoreKey PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 302
mov edx , 7FFE0300h
call dword ptr [edx]
ret 12
_6_1_7601_sp1_windows_7_NtRestoreKey ENDP
; ULONG __stdcall NtResumeProcess( ULONG arg_01 );
_6_1_7601_sp1_windows_7_NtResumeProcess PROC STDCALL arg_01:DWORD
mov eax , 303
mov edx , 7FFE0300h
call dword ptr [edx]
ret 4
_6_1_7601_sp1_windows_7_NtResumeProcess ENDP
; ULONG __stdcall NtResumeThread( ULONG arg_01 , ULONG arg_02 );
_6_1_7601_sp1_windows_7_NtResumeThread PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 304
mov edx , 7FFE0300h
call dword ptr [edx]
ret 8
_6_1_7601_sp1_windows_7_NtResumeThread ENDP
; ULONG __stdcall NtRollbackComplete( ULONG arg_01 , ULONG arg_02 );
_6_1_7601_sp1_windows_7_NtRollbackComplete PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 305
mov edx , 7FFE0300h
call dword ptr [edx]
ret 8
_6_1_7601_sp1_windows_7_NtRollbackComplete ENDP
; ULONG __stdcall NtRollbackEnlistment( ULONG arg_01 , ULONG arg_02 );
_6_1_7601_sp1_windows_7_NtRollbackEnlistment PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 306
mov edx , 7FFE0300h
call dword ptr [edx]
ret 8
_6_1_7601_sp1_windows_7_NtRollbackEnlistment ENDP
; ULONG __stdcall NtRollbackTransaction( ULONG arg_01 , ULONG arg_02 );
_6_1_7601_sp1_windows_7_NtRollbackTransaction PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 307
mov edx , 7FFE0300h
call dword ptr [edx]
ret 8
_6_1_7601_sp1_windows_7_NtRollbackTransaction ENDP
; ULONG __stdcall NtRollforwardTransactionManager( ULONG arg_01 , ULONG arg_02 );
_6_1_7601_sp1_windows_7_NtRollforwardTransactionManager PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 308
mov edx , 7FFE0300h
call dword ptr [edx]
ret 8
_6_1_7601_sp1_windows_7_NtRollforwardTransactionManager ENDP
; ULONG __stdcall NtSaveKey( ULONG arg_01 , ULONG arg_02 );
_6_1_7601_sp1_windows_7_NtSaveKey PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 309
mov edx , 7FFE0300h
call dword ptr [edx]
ret 8
_6_1_7601_sp1_windows_7_NtSaveKey ENDP
; ULONG __stdcall NtSaveKeyEx( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
_6_1_7601_sp1_windows_7_NtSaveKeyEx PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 310
mov edx , 7FFE0300h
call dword ptr [edx]
ret 12
_6_1_7601_sp1_windows_7_NtSaveKeyEx ENDP
; ULONG __stdcall NtSaveMergedKeys( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
_6_1_7601_sp1_windows_7_NtSaveMergedKeys PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 311
mov edx , 7FFE0300h
call dword ptr [edx]
ret 12
_6_1_7601_sp1_windows_7_NtSaveMergedKeys ENDP
; ULONG __stdcall NtSecureConnectPort( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 , ULONG arg_08 , ULONG arg_09 );
_6_1_7601_sp1_windows_7_NtSecureConnectPort PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD , arg_08:DWORD , arg_09:DWORD
mov eax , 312
mov edx , 7FFE0300h
call dword ptr [edx]
ret 36
_6_1_7601_sp1_windows_7_NtSecureConnectPort ENDP
; ULONG __stdcall NtSerializeBoot( );
_6_1_7601_sp1_windows_7_NtSerializeBoot PROC STDCALL
mov eax , 313
mov edx , 7FFE0300h
call dword ptr [edx]
ret
_6_1_7601_sp1_windows_7_NtSerializeBoot ENDP
; ULONG __stdcall NtSetBootEntryOrder( ULONG arg_01 , ULONG arg_02 );
_6_1_7601_sp1_windows_7_NtSetBootEntryOrder PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 314
mov edx , 7FFE0300h
call dword ptr [edx]
ret 8
_6_1_7601_sp1_windows_7_NtSetBootEntryOrder ENDP
; ULONG __stdcall NtSetBootOptions( ULONG arg_01 , ULONG arg_02 );
_6_1_7601_sp1_windows_7_NtSetBootOptions PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 315
mov edx , 7FFE0300h
call dword ptr [edx]
ret 8
_6_1_7601_sp1_windows_7_NtSetBootOptions ENDP
; ULONG __stdcall NtSetContextThread( ULONG arg_01 , ULONG arg_02 );
_6_1_7601_sp1_windows_7_NtSetContextThread PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 316
mov edx , 7FFE0300h
call dword ptr [edx]
ret 8
_6_1_7601_sp1_windows_7_NtSetContextThread ENDP
; ULONG __stdcall NtSetDebugFilterState( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
_6_1_7601_sp1_windows_7_NtSetDebugFilterState PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 317
mov edx , 7FFE0300h
call dword ptr [edx]
ret 12
_6_1_7601_sp1_windows_7_NtSetDebugFilterState ENDP
; ULONG __stdcall NtSetDefaultHardErrorPort( ULONG arg_01 );
_6_1_7601_sp1_windows_7_NtSetDefaultHardErrorPort PROC STDCALL arg_01:DWORD
mov eax , 318
mov edx , 7FFE0300h
call dword ptr [edx]
ret 4
_6_1_7601_sp1_windows_7_NtSetDefaultHardErrorPort ENDP
; ULONG __stdcall NtSetDefaultLocale( ULONG arg_01 , ULONG arg_02 );
_6_1_7601_sp1_windows_7_NtSetDefaultLocale PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 319
mov edx , 7FFE0300h
call dword ptr [edx]
ret 8
_6_1_7601_sp1_windows_7_NtSetDefaultLocale ENDP
; ULONG __stdcall NtSetDefaultUILanguage( ULONG arg_01 );
_6_1_7601_sp1_windows_7_NtSetDefaultUILanguage PROC STDCALL arg_01:DWORD
mov eax , 320
mov edx , 7FFE0300h
call dword ptr [edx]
ret 4
_6_1_7601_sp1_windows_7_NtSetDefaultUILanguage ENDP
; ULONG __stdcall NtSetDriverEntryOrder( ULONG arg_01 , ULONG arg_02 );
_6_1_7601_sp1_windows_7_NtSetDriverEntryOrder PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 321
mov edx , 7FFE0300h
call dword ptr [edx]
ret 8
_6_1_7601_sp1_windows_7_NtSetDriverEntryOrder ENDP
; ULONG __stdcall NtSetEaFile( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
_6_1_7601_sp1_windows_7_NtSetEaFile PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 322
mov edx , 7FFE0300h
call dword ptr [edx]
ret 16
_6_1_7601_sp1_windows_7_NtSetEaFile ENDP
; ULONG __stdcall NtSetEvent( ULONG arg_01 , ULONG arg_02 );
_6_1_7601_sp1_windows_7_NtSetEvent PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 323
mov edx , 7FFE0300h
call dword ptr [edx]
ret 8
_6_1_7601_sp1_windows_7_NtSetEvent ENDP
; ULONG __stdcall NtSetEventBoostPriority( ULONG arg_01 );
_6_1_7601_sp1_windows_7_NtSetEventBoostPriority PROC STDCALL arg_01:DWORD
mov eax , 324
mov edx , 7FFE0300h
call dword ptr [edx]
ret 4
_6_1_7601_sp1_windows_7_NtSetEventBoostPriority ENDP
; ULONG __stdcall NtSetHighEventPair( ULONG arg_01 );
_6_1_7601_sp1_windows_7_NtSetHighEventPair PROC STDCALL arg_01:DWORD
mov eax , 325
mov edx , 7FFE0300h
call dword ptr [edx]
ret 4
_6_1_7601_sp1_windows_7_NtSetHighEventPair ENDP
; ULONG __stdcall NtSetHighWaitLowEventPair( ULONG arg_01 );
_6_1_7601_sp1_windows_7_NtSetHighWaitLowEventPair PROC STDCALL arg_01:DWORD
mov eax , 326
mov edx , 7FFE0300h
call dword ptr [edx]
ret 4
_6_1_7601_sp1_windows_7_NtSetHighWaitLowEventPair ENDP
; ULONG __stdcall NtSetInformationDebugObject( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
_6_1_7601_sp1_windows_7_NtSetInformationDebugObject PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 327
mov edx , 7FFE0300h
call dword ptr [edx]
ret 20
_6_1_7601_sp1_windows_7_NtSetInformationDebugObject ENDP
; ULONG __stdcall NtSetInformationEnlistment( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
_6_1_7601_sp1_windows_7_NtSetInformationEnlistment PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 328
mov edx , 7FFE0300h
call dword ptr [edx]
ret 16
_6_1_7601_sp1_windows_7_NtSetInformationEnlistment ENDP
; ULONG __stdcall NtSetInformationFile( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
_6_1_7601_sp1_windows_7_NtSetInformationFile PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 329
mov edx , 7FFE0300h
call dword ptr [edx]
ret 20
_6_1_7601_sp1_windows_7_NtSetInformationFile ENDP
; ULONG __stdcall NtSetInformationJobObject( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
_6_1_7601_sp1_windows_7_NtSetInformationJobObject PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 330
mov edx , 7FFE0300h
call dword ptr [edx]
ret 16
_6_1_7601_sp1_windows_7_NtSetInformationJobObject ENDP
; ULONG __stdcall NtSetInformationKey( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
_6_1_7601_sp1_windows_7_NtSetInformationKey PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 331
mov edx , 7FFE0300h
call dword ptr [edx]
ret 16
_6_1_7601_sp1_windows_7_NtSetInformationKey ENDP
; ULONG __stdcall NtSetInformationObject( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
_6_1_7601_sp1_windows_7_NtSetInformationObject PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 332
mov edx , 7FFE0300h
call dword ptr [edx]
ret 16
_6_1_7601_sp1_windows_7_NtSetInformationObject ENDP
; ULONG __stdcall NtSetInformationProcess( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
_6_1_7601_sp1_windows_7_NtSetInformationProcess PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 333
mov edx , 7FFE0300h
call dword ptr [edx]
ret 16
_6_1_7601_sp1_windows_7_NtSetInformationProcess ENDP
; ULONG __stdcall NtSetInformationResourceManager( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
_6_1_7601_sp1_windows_7_NtSetInformationResourceManager PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 334
mov edx , 7FFE0300h
call dword ptr [edx]
ret 16
_6_1_7601_sp1_windows_7_NtSetInformationResourceManager ENDP
; ULONG __stdcall NtSetInformationThread( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
_6_1_7601_sp1_windows_7_NtSetInformationThread PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 335
mov edx , 7FFE0300h
call dword ptr [edx]
ret 16
_6_1_7601_sp1_windows_7_NtSetInformationThread ENDP
; ULONG __stdcall NtSetInformationToken( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
_6_1_7601_sp1_windows_7_NtSetInformationToken PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 336
mov edx , 7FFE0300h
call dword ptr [edx]
ret 16
_6_1_7601_sp1_windows_7_NtSetInformationToken ENDP
; ULONG __stdcall NtSetInformationTransaction( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
_6_1_7601_sp1_windows_7_NtSetInformationTransaction PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 337
mov edx , 7FFE0300h
call dword ptr [edx]
ret 16
_6_1_7601_sp1_windows_7_NtSetInformationTransaction ENDP
; ULONG __stdcall NtSetInformationTransactionManager( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
_6_1_7601_sp1_windows_7_NtSetInformationTransactionManager PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 338
mov edx , 7FFE0300h
call dword ptr [edx]
ret 16
_6_1_7601_sp1_windows_7_NtSetInformationTransactionManager ENDP
; ULONG __stdcall NtSetInformationWorkerFactory( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
_6_1_7601_sp1_windows_7_NtSetInformationWorkerFactory PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 339
mov edx , 7FFE0300h
call dword ptr [edx]
ret 16
_6_1_7601_sp1_windows_7_NtSetInformationWorkerFactory ENDP
; ULONG __stdcall NtSetIntervalProfile( ULONG arg_01 , ULONG arg_02 );
_6_1_7601_sp1_windows_7_NtSetIntervalProfile PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 340
mov edx , 7FFE0300h
call dword ptr [edx]
ret 8
_6_1_7601_sp1_windows_7_NtSetIntervalProfile ENDP
; ULONG __stdcall NtSetIoCompletion( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
_6_1_7601_sp1_windows_7_NtSetIoCompletion PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 341
mov edx , 7FFE0300h
call dword ptr [edx]
ret 20
_6_1_7601_sp1_windows_7_NtSetIoCompletion ENDP
; ULONG __stdcall NtSetIoCompletionEx( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 );
_6_1_7601_sp1_windows_7_NtSetIoCompletionEx PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD
mov eax , 342
mov edx , 7FFE0300h
call dword ptr [edx]
ret 24
_6_1_7601_sp1_windows_7_NtSetIoCompletionEx ENDP
; ULONG __stdcall NtSetLdtEntries( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 );
_6_1_7601_sp1_windows_7_NtSetLdtEntries PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD
mov eax , 343
mov edx , 7FFE0300h
call dword ptr [edx]
ret 24
_6_1_7601_sp1_windows_7_NtSetLdtEntries ENDP
; ULONG __stdcall NtSetLowEventPair( ULONG arg_01 );
_6_1_7601_sp1_windows_7_NtSetLowEventPair PROC STDCALL arg_01:DWORD
mov eax , 344
mov edx , 7FFE0300h
call dword ptr [edx]
ret 4
_6_1_7601_sp1_windows_7_NtSetLowEventPair ENDP
; ULONG __stdcall NtSetLowWaitHighEventPair( ULONG arg_01 );
_6_1_7601_sp1_windows_7_NtSetLowWaitHighEventPair PROC STDCALL arg_01:DWORD
mov eax , 345
mov edx , 7FFE0300h
call dword ptr [edx]
ret 4
_6_1_7601_sp1_windows_7_NtSetLowWaitHighEventPair ENDP
; ULONG __stdcall NtSetQuotaInformationFile( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
_6_1_7601_sp1_windows_7_NtSetQuotaInformationFile PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 346
mov edx , 7FFE0300h
call dword ptr [edx]
ret 16
_6_1_7601_sp1_windows_7_NtSetQuotaInformationFile ENDP
; ULONG __stdcall NtSetSecurityObject( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
_6_1_7601_sp1_windows_7_NtSetSecurityObject PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 347
mov edx , 7FFE0300h
call dword ptr [edx]
ret 12
_6_1_7601_sp1_windows_7_NtSetSecurityObject ENDP
; ULONG __stdcall NtSetSystemEnvironmentValue( ULONG arg_01 , ULONG arg_02 );
_6_1_7601_sp1_windows_7_NtSetSystemEnvironmentValue PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 348
mov edx , 7FFE0300h
call dword ptr [edx]
ret 8
_6_1_7601_sp1_windows_7_NtSetSystemEnvironmentValue ENDP
; ULONG __stdcall NtSetSystemEnvironmentValueEx( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
_6_1_7601_sp1_windows_7_NtSetSystemEnvironmentValueEx PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 349
mov edx , 7FFE0300h
call dword ptr [edx]
ret 20
_6_1_7601_sp1_windows_7_NtSetSystemEnvironmentValueEx ENDP
; ULONG __stdcall NtSetSystemInformation( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
_6_1_7601_sp1_windows_7_NtSetSystemInformation PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 350
mov edx , 7FFE0300h
call dword ptr [edx]
ret 12
_6_1_7601_sp1_windows_7_NtSetSystemInformation ENDP
; ULONG __stdcall NtSetSystemPowerState( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
_6_1_7601_sp1_windows_7_NtSetSystemPowerState PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 351
mov edx , 7FFE0300h
call dword ptr [edx]
ret 12
_6_1_7601_sp1_windows_7_NtSetSystemPowerState ENDP
; ULONG __stdcall NtSetSystemTime( ULONG arg_01 , ULONG arg_02 );
_6_1_7601_sp1_windows_7_NtSetSystemTime PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 352
mov edx , 7FFE0300h
call dword ptr [edx]
ret 8
_6_1_7601_sp1_windows_7_NtSetSystemTime ENDP
; ULONG __stdcall NtSetThreadExecutionState( ULONG arg_01 , ULONG arg_02 );
_6_1_7601_sp1_windows_7_NtSetThreadExecutionState PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 353
mov edx , 7FFE0300h
call dword ptr [edx]
ret 8
_6_1_7601_sp1_windows_7_NtSetThreadExecutionState ENDP
; ULONG __stdcall NtSetTimer( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 );
_6_1_7601_sp1_windows_7_NtSetTimer PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD
mov eax , 354
mov edx , 7FFE0300h
call dword ptr [edx]
ret 28
_6_1_7601_sp1_windows_7_NtSetTimer ENDP
; ULONG __stdcall NtSetTimerEx( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
_6_1_7601_sp1_windows_7_NtSetTimerEx PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 355
mov edx , 7FFE0300h
call dword ptr [edx]
ret 16
_6_1_7601_sp1_windows_7_NtSetTimerEx ENDP
; ULONG __stdcall NtSetTimerResolution( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
_6_1_7601_sp1_windows_7_NtSetTimerResolution PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 356
mov edx , 7FFE0300h
call dword ptr [edx]
ret 12
_6_1_7601_sp1_windows_7_NtSetTimerResolution ENDP
; ULONG __stdcall NtSetUuidSeed( ULONG arg_01 );
_6_1_7601_sp1_windows_7_NtSetUuidSeed PROC STDCALL arg_01:DWORD
mov eax , 357
mov edx , 7FFE0300h
call dword ptr [edx]
ret 4
_6_1_7601_sp1_windows_7_NtSetUuidSeed ENDP
; ULONG __stdcall NtSetValueKey( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 );
_6_1_7601_sp1_windows_7_NtSetValueKey PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD
mov eax , 358
mov edx , 7FFE0300h
call dword ptr [edx]
ret 24
_6_1_7601_sp1_windows_7_NtSetValueKey ENDP
; ULONG __stdcall NtSetVolumeInformationFile( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
_6_1_7601_sp1_windows_7_NtSetVolumeInformationFile PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 359
mov edx , 7FFE0300h
call dword ptr [edx]
ret 20
_6_1_7601_sp1_windows_7_NtSetVolumeInformationFile ENDP
; ULONG __stdcall NtShutdownSystem( ULONG arg_01 );
_6_1_7601_sp1_windows_7_NtShutdownSystem PROC STDCALL arg_01:DWORD
mov eax , 360
mov edx , 7FFE0300h
call dword ptr [edx]
ret 4
_6_1_7601_sp1_windows_7_NtShutdownSystem ENDP
; ULONG __stdcall NtShutdownWorkerFactory( ULONG arg_01 , ULONG arg_02 );
_6_1_7601_sp1_windows_7_NtShutdownWorkerFactory PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 361
mov edx , 7FFE0300h
call dword ptr [edx]
ret 8
_6_1_7601_sp1_windows_7_NtShutdownWorkerFactory ENDP
; ULONG __stdcall NtSignalAndWaitForSingleObject( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
_6_1_7601_sp1_windows_7_NtSignalAndWaitForSingleObject PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 362
mov edx , 7FFE0300h
call dword ptr [edx]
ret 16
_6_1_7601_sp1_windows_7_NtSignalAndWaitForSingleObject ENDP
; ULONG __stdcall NtSinglePhaseReject( ULONG arg_01 , ULONG arg_02 );
_6_1_7601_sp1_windows_7_NtSinglePhaseReject PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 363
mov edx , 7FFE0300h
call dword ptr [edx]
ret 8
_6_1_7601_sp1_windows_7_NtSinglePhaseReject ENDP
; ULONG __stdcall NtStartProfile( ULONG arg_01 );
_6_1_7601_sp1_windows_7_NtStartProfile PROC STDCALL arg_01:DWORD
mov eax , 364
mov edx , 7FFE0300h
call dword ptr [edx]
ret 4
_6_1_7601_sp1_windows_7_NtStartProfile ENDP
; ULONG __stdcall NtStopProfile( ULONG arg_01 );
_6_1_7601_sp1_windows_7_NtStopProfile PROC STDCALL arg_01:DWORD
mov eax , 365
mov edx , 7FFE0300h
call dword ptr [edx]
ret 4
_6_1_7601_sp1_windows_7_NtStopProfile ENDP
; ULONG __stdcall NtSuspendProcess( ULONG arg_01 );
_6_1_7601_sp1_windows_7_NtSuspendProcess PROC STDCALL arg_01:DWORD
mov eax , 366
mov edx , 7FFE0300h
call dword ptr [edx]
ret 4
_6_1_7601_sp1_windows_7_NtSuspendProcess ENDP
; ULONG __stdcall NtSuspendThread( ULONG arg_01 , ULONG arg_02 );
_6_1_7601_sp1_windows_7_NtSuspendThread PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 367
mov edx , 7FFE0300h
call dword ptr [edx]
ret 8
_6_1_7601_sp1_windows_7_NtSuspendThread ENDP
; ULONG __stdcall NtSystemDebugControl( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 );
_6_1_7601_sp1_windows_7_NtSystemDebugControl PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD
mov eax , 368
mov edx , 7FFE0300h
call dword ptr [edx]
ret 24
_6_1_7601_sp1_windows_7_NtSystemDebugControl ENDP
; ULONG __stdcall NtTerminateJobObject( ULONG arg_01 , ULONG arg_02 );
_6_1_7601_sp1_windows_7_NtTerminateJobObject PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 369
mov edx , 7FFE0300h
call dword ptr [edx]
ret 8
_6_1_7601_sp1_windows_7_NtTerminateJobObject ENDP
; ULONG __stdcall NtTerminateProcess( ULONG arg_01 , ULONG arg_02 );
_6_1_7601_sp1_windows_7_NtTerminateProcess PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 370
mov edx , 7FFE0300h
call dword ptr [edx]
ret 8
_6_1_7601_sp1_windows_7_NtTerminateProcess ENDP
; ULONG __stdcall NtTerminateThread( ULONG arg_01 , ULONG arg_02 );
_6_1_7601_sp1_windows_7_NtTerminateThread PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 371
mov edx , 7FFE0300h
call dword ptr [edx]
ret 8
_6_1_7601_sp1_windows_7_NtTerminateThread ENDP
; ULONG __stdcall NtTestAlert( );
_6_1_7601_sp1_windows_7_NtTestAlert PROC STDCALL
mov eax , 372
mov edx , 7FFE0300h
call dword ptr [edx]
ret
_6_1_7601_sp1_windows_7_NtTestAlert ENDP
; ULONG __stdcall NtThawRegistry( );
_6_1_7601_sp1_windows_7_NtThawRegistry PROC STDCALL
mov eax , 373
mov edx , 7FFE0300h
call dword ptr [edx]
ret
_6_1_7601_sp1_windows_7_NtThawRegistry ENDP
; ULONG __stdcall NtThawTransactions( );
_6_1_7601_sp1_windows_7_NtThawTransactions PROC STDCALL
mov eax , 374
mov edx , 7FFE0300h
call dword ptr [edx]
ret
_6_1_7601_sp1_windows_7_NtThawTransactions ENDP
; ULONG __stdcall NtTraceControl( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 );
_6_1_7601_sp1_windows_7_NtTraceControl PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD
mov eax , 375
mov edx , 7FFE0300h
call dword ptr [edx]
ret 24
_6_1_7601_sp1_windows_7_NtTraceControl ENDP
; ULONG __stdcall NtTraceEvent( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
_6_1_7601_sp1_windows_7_NtTraceEvent PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 376
mov edx , 7FFE0300h
call dword ptr [edx]
ret 16
_6_1_7601_sp1_windows_7_NtTraceEvent ENDP
; ULONG __stdcall NtTranslateFilePath( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
_6_1_7601_sp1_windows_7_NtTranslateFilePath PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 377
mov edx , 7FFE0300h
call dword ptr [edx]
ret 16
_6_1_7601_sp1_windows_7_NtTranslateFilePath ENDP
; ULONG __stdcall NtUmsThreadYield( ULONG arg_01 );
_6_1_7601_sp1_windows_7_NtUmsThreadYield PROC STDCALL arg_01:DWORD
mov eax , 378
mov edx , 7FFE0300h
call dword ptr [edx]
ret 4
_6_1_7601_sp1_windows_7_NtUmsThreadYield ENDP
; ULONG __stdcall NtUnloadDriver( ULONG arg_01 );
_6_1_7601_sp1_windows_7_NtUnloadDriver PROC STDCALL arg_01:DWORD
mov eax , 379
mov edx , 7FFE0300h
call dword ptr [edx]
ret 4
_6_1_7601_sp1_windows_7_NtUnloadDriver ENDP
; ULONG __stdcall NtUnloadKey( ULONG arg_01 );
_6_1_7601_sp1_windows_7_NtUnloadKey PROC STDCALL arg_01:DWORD
mov eax , 380
mov edx , 7FFE0300h
call dword ptr [edx]
ret 4
_6_1_7601_sp1_windows_7_NtUnloadKey ENDP
; ULONG __stdcall NtUnloadKey2( ULONG arg_01 , ULONG arg_02 );
_6_1_7601_sp1_windows_7_NtUnloadKey2 PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 381
mov edx , 7FFE0300h
call dword ptr [edx]
ret 8
_6_1_7601_sp1_windows_7_NtUnloadKey2 ENDP
; ULONG __stdcall NtUnloadKeyEx( ULONG arg_01 , ULONG arg_02 );
_6_1_7601_sp1_windows_7_NtUnloadKeyEx PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 382
mov edx , 7FFE0300h
call dword ptr [edx]
ret 8
_6_1_7601_sp1_windows_7_NtUnloadKeyEx ENDP
; ULONG __stdcall NtUnlockFile( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
_6_1_7601_sp1_windows_7_NtUnlockFile PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 383
mov edx , 7FFE0300h
call dword ptr [edx]
ret 20
_6_1_7601_sp1_windows_7_NtUnlockFile ENDP
; ULONG __stdcall NtUnlockVirtualMemory( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
_6_1_7601_sp1_windows_7_NtUnlockVirtualMemory PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 384
mov edx , 7FFE0300h
call dword ptr [edx]
ret 16
_6_1_7601_sp1_windows_7_NtUnlockVirtualMemory ENDP
; ULONG __stdcall NtUnmapViewOfSection( ULONG arg_01 , ULONG arg_02 );
_6_1_7601_sp1_windows_7_NtUnmapViewOfSection PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 385
mov edx , 7FFE0300h
call dword ptr [edx]
ret 8
_6_1_7601_sp1_windows_7_NtUnmapViewOfSection ENDP
; ULONG __stdcall NtVdmControl( ULONG arg_01 , ULONG arg_02 );
_6_1_7601_sp1_windows_7_NtVdmControl PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 386
mov edx , 7FFE0300h
call dword ptr [edx]
ret 8
_6_1_7601_sp1_windows_7_NtVdmControl ENDP
; ULONG __stdcall NtWaitForDebugEvent( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
_6_1_7601_sp1_windows_7_NtWaitForDebugEvent PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 387
mov edx , 7FFE0300h
call dword ptr [edx]
ret 16
_6_1_7601_sp1_windows_7_NtWaitForDebugEvent ENDP
; ULONG __stdcall NtWaitForKeyedEvent( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
_6_1_7601_sp1_windows_7_NtWaitForKeyedEvent PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 388
mov edx , 7FFE0300h
call dword ptr [edx]
ret 16
_6_1_7601_sp1_windows_7_NtWaitForKeyedEvent ENDP
; ULONG __stdcall NtWaitForMultipleObjects( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
_6_1_7601_sp1_windows_7_NtWaitForMultipleObjects PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 389
mov edx , 7FFE0300h
call dword ptr [edx]
ret 20
_6_1_7601_sp1_windows_7_NtWaitForMultipleObjects ENDP
; ULONG __stdcall NtWaitForMultipleObjects32( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
_6_1_7601_sp1_windows_7_NtWaitForMultipleObjects32 PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 390
mov edx , 7FFE0300h
call dword ptr [edx]
ret 20
_6_1_7601_sp1_windows_7_NtWaitForMultipleObjects32 ENDP
; ULONG __stdcall NtWaitForSingleObject( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
_6_1_7601_sp1_windows_7_NtWaitForSingleObject PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 391
mov edx , 7FFE0300h
call dword ptr [edx]
ret 12
_6_1_7601_sp1_windows_7_NtWaitForSingleObject ENDP
; ULONG __stdcall NtWaitForWorkViaWorkerFactory( ULONG arg_01 , ULONG arg_02 );
_6_1_7601_sp1_windows_7_NtWaitForWorkViaWorkerFactory PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 392
mov edx , 7FFE0300h
call dword ptr [edx]
ret 8
_6_1_7601_sp1_windows_7_NtWaitForWorkViaWorkerFactory ENDP
; ULONG __stdcall NtWaitHighEventPair( ULONG arg_01 );
_6_1_7601_sp1_windows_7_NtWaitHighEventPair PROC STDCALL arg_01:DWORD
mov eax , 393
mov edx , 7FFE0300h
call dword ptr [edx]
ret 4
_6_1_7601_sp1_windows_7_NtWaitHighEventPair ENDP
; ULONG __stdcall NtWaitLowEventPair( ULONG arg_01 );
_6_1_7601_sp1_windows_7_NtWaitLowEventPair PROC STDCALL arg_01:DWORD
mov eax , 394
mov edx , 7FFE0300h
call dword ptr [edx]
ret 4
_6_1_7601_sp1_windows_7_NtWaitLowEventPair ENDP
; ULONG __stdcall NtWorkerFactoryWorkerReady( ULONG arg_01 );
_6_1_7601_sp1_windows_7_NtWorkerFactoryWorkerReady PROC STDCALL arg_01:DWORD
mov eax , 395
mov edx , 7FFE0300h
call dword ptr [edx]
ret 4
_6_1_7601_sp1_windows_7_NtWorkerFactoryWorkerReady ENDP
; ULONG __stdcall NtWriteFile( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 , ULONG arg_08 , ULONG arg_09 );
_6_1_7601_sp1_windows_7_NtWriteFile PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD , arg_08:DWORD , arg_09:DWORD
mov eax , 396
mov edx , 7FFE0300h
call dword ptr [edx]
ret 36
_6_1_7601_sp1_windows_7_NtWriteFile ENDP
; ULONG __stdcall NtWriteFileGather( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 , ULONG arg_08 , ULONG arg_09 );
_6_1_7601_sp1_windows_7_NtWriteFileGather PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD , arg_08:DWORD , arg_09:DWORD
mov eax , 397
mov edx , 7FFE0300h
call dword ptr [edx]
ret 36
_6_1_7601_sp1_windows_7_NtWriteFileGather ENDP
; ULONG __stdcall NtWriteRequestData( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 );
_6_1_7601_sp1_windows_7_NtWriteRequestData PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD
mov eax , 398
mov edx , 7FFE0300h
call dword ptr [edx]
ret 24
_6_1_7601_sp1_windows_7_NtWriteRequestData ENDP
; ULONG __stdcall NtWriteVirtualMemory( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
_6_1_7601_sp1_windows_7_NtWriteVirtualMemory PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 399
mov edx , 7FFE0300h
call dword ptr [edx]
ret 20
_6_1_7601_sp1_windows_7_NtWriteVirtualMemory ENDP
; ULONG __stdcall NtYieldExecution( );
_6_1_7601_sp1_windows_7_NtYieldExecution PROC STDCALL
mov eax , 400
mov edx , 7FFE0300h
call dword ptr [edx]
ret
_6_1_7601_sp1_windows_7_NtYieldExecution ENDP
|
;;;
;;; This is Suggested Project 7.9.2.3
;;; Basically do simple signed addition, subtraction, multiplication, modulo
;;; With unsigned word and double-word sizes
;;; Pg. 137 for the problem
;;; Pg. 24 for Registers
;;; Pg. 48 for Data Types
SECTION .data
SUCCESS: equ 0 ; Default success value
SYS_EXIT: equ 60 ; Default system exit value
;; Variables used by the project
wNum1: dw 350
wNum2: dw 300
wNum3: dw 325
wNum4: dw 500
dNum1: dd 100000
;; Answers
wAns1: dw 0 ; wAns1 = wNum1 + wNum2 650
wAns2: dw 0 ; wAns2 = wNum1 + wNum3 675
wAns3: dw 0 ; wAns3 = wNum3 + wNum4 825
wAns6: dw 0 ; wAns6 = wNum1 - wNum2 50
wAns7: dw 0 ; wAns7 = wNum1 - wNum3 25
wAns8: dw 0 ; wAns8 = wNum2 - wNum4 300 - 500 = -200 => 65336
dAns11: dd 0 ; dAns11 = wNum1 * wNum3 113750
dAns12: dd 0 ; dAns12 = wNum2 * wNum2 90000
dAns13: dd 0 ; dAns13 = wNum2 * wNum4 150000
wAns16: dw 0 ; wAns16 = wNum1 / wNum2 1
wAns17: dw 0 ; wAns17 = wNum3 / wNum4 0
wAns18: dw 0 ; wAns18 = dNum1 / wNum4 200
wRem18: dw 0 ; wRem18 = dNum1 % wNum4 0
SECTION .text ; Code Section
global _start ; Standard start
_start:
;; wAns1 = wNum1 + wNum2
mov ax, word [wNum1]
add ax, word [wNum2]
mov word [wAns1], ax
;; wAns2 = wNum1 + wNum3
mov ax, word [wNum1]
add ax, word [wNum3]
mov word [wAns2], ax
;; wAns3 = wNum3 + wNum4
mov ax, word [wNum3]
add ax, word [wNum4]
mov word [wAns3], ax
;; wAns6 = wNum1 - wNum2
mov ax, word [wNum1]
sub ax, word [wNum2]
mov word [wAns6], ax
;; wAns7 = wNum1 - wNum3
mov ax, word [wNum1]
sub ax, word [wNum3]
mov word [wAns7], ax
;; wAns8 = wNum2 - wNum4
mov ax, word [wNum2]
sub ax, word [wNum4]
mov word [wAns8], ax
;; wAns11 = wNum1 * wNum3
mov ax, word [wNum1]
mul word [wNum3]
mov word [dAns11], ax
mov word [dAns11+2], dx
;; wAns12 = wNum2 * wNum2
mov ax, word [wNum2]
mul ax
mov word [dAns12], ax
mov word [dAns12+2], dx
;; wAns13 = wNum2 * wNum4
mov ax, word [wNum2]
mul word [wNum4]
mov word [dAns13], ax
mov word [dAns13+2], dx
;; wAns16 = wNum1 / wNum2
mov dx, 0
mov ax, word [wNum1]
div word [wNum2]
mov word [wAns16], ax
;; wAns17 = wNum3 / wNum4
mov dx, 0
mov ax, word [wNum3]
div word [wNum4]
mov word [wAns17], ax
;; wAns18 = dNum1 / wNum4
mov eax, dword [dNum1]
cdq ; Pg. 91 Convert dword to qword edx:eax
movzx ecx, word [wNum4] ; Divisor has to be dword so convert
div ecx
mov word [wAns18], ax
mov word [wRem18], dx ; Remember the remainder is stored in dx
; Done, terminate program
last:
mov rax, SYS_EXIT ; Call code for exit
mov rdi, SUCCESS ; Exit with success
syscall
|
; Note that this whole ASM file is currently pseudo code
TWO_PI_Q5_11 .set 0011001001000100b
PI_Q5_11 .set 0001100100100010b
WINDOW_SIZE .set 1024
INV_WINDOW_SIZE_Q15 .set 0000000000100000b
HOP_SIZE .set 256
INV_HOP_SIZE_Q15 .set 0000000010000000b
STEP_SIZE .set 1
WINDOW_SCALE_FACTOR .set 0x59BA ;Q15 0.701 ; Constant that comes from sqrt(((WINDOW_SIZE/HOP_SIZE)/2))
DELTA_PHI_CONST .set 0x00C9 ; Q15 0.00613 ; approx 2pi/WINDOW_SIZE
HANN_WINDOW_START .set 0x0000 ; TBD but it shall be 1024 big
FFT_BUF_START .set 0x0000 ; TBD but it shall be 2048 big
MAGNITUDE_FRAME_START .set 0x0000 ; TBD but it shall be 1024 big
PHASE_FRAME_START .set 0x0000 ; TBD but it shall be 1024 big
PREV_PHASE_FRAME_START .set 0x0000 ; TBD but it shall be 1024 big
DELTA_PHI_START .set 0x0000 ; TBD but it shall be 1024 big
BIT_REV_INDEX_START .set 0x0000 ; TBD but it shall be 1024 big
TRUE_FREQ_START .set 0x0000 ; TBD but it shall be 1024 big
CUMMULATIVE_PHASE_START .set 0x0000 ; TBD but it shall be 1024 big
HOP_OUT .set 0x0000 ; TBD but it shall be 1 big
ALPHA .set 0x0000 ; TBD but it shall be 1 big
ATAN2_R .set 0x0000 ; TBD but it shall be 1024 big
ATAN2_J .set 0x0000 ; TBD but it shall be 1024 big
INPUT_RING_BUF .usect "PITCH_SHIFT_RING_BUF_IN", 1200 ; 5*HOP_SIZE
OUTPUT_RING_BUF .usect "PITCH_SHIFT_RING_BUF_OUT", 2300 ; 7*HOP_SIZE*2^(4/12) rounded up to nearest 100
_cifft_SCALE:
RET
_cfft_SCALE:
RET
_sqrt_16:
RET
_atan16:
RET
** T0 = input (Q5.11)
** T1 = output (Q5.11)
_mod_2pi: .macro
NOP
.endm
_time_stretch:
MOV #HANN_WINDOW_START, AR0 ; Need a pointer to the hanning window
MOV #1023, BRC0 ; RTPBLOCAL will loop BRC0+1 times
RPTBLOCAL ps_loop1_end ; Loop with WINDOW_SIZE iterations to move new window into work buffer
MOV *AR4+, AC0 ; Assume AR4 is the input FFT_BUF
MOV *AR0, AC1
MPY AC1, AC0 ; Window the sample
MPY #WINDOW_SCALE_FACTOR, AC0
ADD #1, AR0
ps_loop1_end: ADD #1, AR4
; FFT the frame
SUB #2048, AR4
MOV #1024, T0
CALL _cfft_SCALE ; Best performance with twiddle in ROM and FFT_BUF in DARAM
; Calculate magnitude frame
MOV #MAGNITUDE_FRAME_START, AR0
MOV #1023, BRC0
RPTBLOCAL mag_frame_loop_end
MOV *AR4+, AC0
MOV *AR4+, AC1
SQR AC0
SQR AC1
ADD AC1, AC0
mag_frame_loop_end: MOV AC0, *AR0+
CALL _sqrt_16 ; Call sqrt on all magnitude frame members
; Calculate the phase frame, the angles for each sample
MOV #ATAN2_R, AR0
MOV #ATAN2_J, AR1
SUB #2048, AR4
MOV #1023, BRC0 ; Another 1024 iterations
RPTBLOCAL ps_loop2_end
MOV *AR4+, *AR0+
ps_loop2_end: MOV *AR4+, *AR1+
MOV #ATAN2_R, AR0 ; Set pointers back to beginning
MOV #ATAN2_J, AR1
MOV #PHASE_FRAME_START, AR2
MOV #1024, T0
CALL _atan16
; Calculate delta phi
MOV 1023, BRC0
MOV #DELTA_PHI_START, AR0
MOV #PHASE_FRAME_START, AR1
MOV #PREV_PHASE_FRAME_START, AR2
MOV #BIT_REV_INDEX, AR3
RPTBLOCAL ps_loop3_end
MOV *AR0, AC0
MOV #HOP_SIZE, AC0
MPY #DELTA_PHI_CONST, AC0
MPY *AR3+, AC0
NEG AC0
ADD *AR1, AC0
SUB *AR2, AC0
ADD #PI_Q5_11, AC0
_mod_2pi
SUB #PI_Q5_11, AC0
MOV *AR1+, *AR2+
MOV AC0, T0
ps_loop3_end: MOV T1, *AR0+
MOV #1023, BRC0
SUB 1024, AR0 ; Go back to beginning of delta phi vector
MOV #TRUE_FREQ_START, AR1
SUB #1024, AR3 ; Go back to beginning of bit reversed index vector
RPTBLOCAL ps_loop4_end
MOV #DELTA_PHI_CONST, AC0
MPY *AR3+, AC0
MOV *AR0+, AC1
MPY #INV_HOP_SIZE_Q15, AC1
ADD AC1, AC0
ps_loop4_end: MOV AC1, *AR1+
; Calculate the cumulative phase
MOV #1023, BRC0
MOV #CUMMULATIVE_PHASE_START, AR0
SUB #1024, AR1 ; Go back to beginning of true freq vector
MOV #HOP_OUT, AR2
RPTBLOCAL ps_loop5_end
MOV *AR2, AC0
MPY *AR1+, AC0
MOV AC0, T0
_mod_2pi
ps_loop5_end: MOV T1, *AR0+
; Phase shift the FFT'd buffer, assume AR7 pointsa at sine wave
; This has not been implemented yet
MOV #1023, BRC0
SUB #1024, AR0 ; Go back to beginning of cummulative phase
SUB #2048, AR4 ; Go back to beginning of the FFT buffer
RPTBLOCAL ps_loop6_end
;MOV *AR0+, T0
;MOV *AR7(T0),
ps_loop6_end: NOP
; IFFT
MOV #FFT_BUF_START, AR0
MOV #1024, T0
CALL _cifft_SCALE
; Hann window the result
MOV #1023, BRC0
SUB #2048, AR4
MOV #HANN_WINDOW_START, AR0
RPTBLOCAL ps_loop7_end
MOV *AR4+, AC0
MPY *AR0+, AC0
MPY #WINDOW_SCALE_FACTOR, AC0
MPY #INV_WINDOW_SIZE_Q15, AC0
ADD *AR7, AC0
ps_loop7_end: MOV AC0, *AR7+
; Zero old values so it won't keep accumulating
MOV #HOP_OUT, BRC0
RPTBLOCAL ps_loop8_end
ps_loop8_end: MOV #0, *AR7+
SUB #WINDOW_SIZE, AR7 ; Only subtract the window size, so it will have kipped hop out size
RET
_resample:
MOV #HOP_OUT, AC0
MPY #4, AC0
SUB AC0, AR7
MOV #1023, BRC0
; Make AR0 point at the output buffer
RPTBLOCAL ps_loop9_end
MOV *AR7+, AC1
MOV *AR7+, AC0
SUB AC1, AC0
MPY #ALPHA, AC1
ADD AC1, AC0
MOV AC0, *AR0+
ps_loop9_end: SUB #1, AR7 ; Go one back so it will only loop 1024 times over AR7
MOV HOP_OUT, AC0
MPY #4, AC0
ADD AC0, AR7
RET |
; A335087: Row sums of A335436.
; 1,7,34,150,628,2540,10024,38840,148368,560368,2096928,7786592,28726592,105390272,384788096,1398978432,5067403520,18294707968,65854095872,236421150208,846732997632,3025927678976,10792083499008,38420157773824,136547503083520,484546494459904,1716976084393984
mov $1,2
mov $2,$0
lpb $2
add $1,$2
sub $0,$1
mul $1,2
sub $1,$0
sub $2,1
lpe
sub $1,1
mov $0,$1
|
; WARNING: do not edit!
; Generated from openssl/crypto/aes/asm/aesni-mb-x86_64.pl
;
; Copyright 2013-2020 The OpenSSL Project Authors. All Rights Reserved.
;
; Licensed under the OpenSSL license (the "License"). You may not use
; this file except in compliance with the License. You can obtain a copy
; in the file LICENSE in the source distribution or at
; https://www.openssl.org/source/license.html
default rel
%define XMMWORD
%define YMMWORD
%define ZMMWORD
section .text code align=64
EXTERN OPENSSL_ia32cap_P
global aesni_multi_cbc_encrypt
ALIGN 32
aesni_multi_cbc_encrypt:
mov QWORD[8+rsp],rdi ;WIN64 prologue
mov QWORD[16+rsp],rsi
mov rax,rsp
$L$SEH_begin_aesni_multi_cbc_encrypt:
mov rdi,rcx
mov rsi,rdx
mov rdx,r8
mov rax,rsp
push rbx
push rbp
push r12
push r13
push r14
push r15
lea rsp,[((-168))+rsp]
movaps XMMWORD[rsp],xmm6
movaps XMMWORD[16+rsp],xmm7
movaps XMMWORD[32+rsp],xmm8
movaps XMMWORD[48+rsp],xmm9
movaps XMMWORD[64+rsp],xmm10
movaps XMMWORD[80+rsp],xmm11
movaps XMMWORD[96+rsp],xmm12
movaps XMMWORD[(-104)+rax],xmm13
movaps XMMWORD[(-88)+rax],xmm14
movaps XMMWORD[(-72)+rax],xmm15
sub rsp,48
and rsp,-64
mov QWORD[16+rsp],rax
$L$enc4x_body:
movdqu xmm12,XMMWORD[rsi]
lea rsi,[120+rsi]
lea rdi,[80+rdi]
$L$enc4x_loop_grande:
mov DWORD[24+rsp],edx
xor edx,edx
mov ecx,DWORD[((-64))+rdi]
mov r8,QWORD[((-80))+rdi]
cmp ecx,edx
mov r12,QWORD[((-72))+rdi]
cmovg edx,ecx
test ecx,ecx
movdqu xmm2,XMMWORD[((-56))+rdi]
mov DWORD[32+rsp],ecx
cmovle r8,rsp
mov ecx,DWORD[((-24))+rdi]
mov r9,QWORD[((-40))+rdi]
cmp ecx,edx
mov r13,QWORD[((-32))+rdi]
cmovg edx,ecx
test ecx,ecx
movdqu xmm3,XMMWORD[((-16))+rdi]
mov DWORD[36+rsp],ecx
cmovle r9,rsp
mov ecx,DWORD[16+rdi]
mov r10,QWORD[rdi]
cmp ecx,edx
mov r14,QWORD[8+rdi]
cmovg edx,ecx
test ecx,ecx
movdqu xmm4,XMMWORD[24+rdi]
mov DWORD[40+rsp],ecx
cmovle r10,rsp
mov ecx,DWORD[56+rdi]
mov r11,QWORD[40+rdi]
cmp ecx,edx
mov r15,QWORD[48+rdi]
cmovg edx,ecx
test ecx,ecx
movdqu xmm5,XMMWORD[64+rdi]
mov DWORD[44+rsp],ecx
cmovle r11,rsp
test edx,edx
jz NEAR $L$enc4x_done
movups xmm1,XMMWORD[((16-120))+rsi]
pxor xmm2,xmm12
movups xmm0,XMMWORD[((32-120))+rsi]
pxor xmm3,xmm12
mov eax,DWORD[((240-120))+rsi]
pxor xmm4,xmm12
movdqu xmm6,XMMWORD[r8]
pxor xmm5,xmm12
movdqu xmm7,XMMWORD[r9]
pxor xmm2,xmm6
movdqu xmm8,XMMWORD[r10]
pxor xmm3,xmm7
movdqu xmm9,XMMWORD[r11]
pxor xmm4,xmm8
pxor xmm5,xmm9
movdqa xmm10,XMMWORD[32+rsp]
xor rbx,rbx
jmp NEAR $L$oop_enc4x
ALIGN 32
$L$oop_enc4x:
add rbx,16
lea rbp,[16+rsp]
mov ecx,1
sub rbp,rbx
DB 102,15,56,220,209
prefetcht0 [31+rbx*1+r8]
prefetcht0 [31+rbx*1+r9]
DB 102,15,56,220,217
prefetcht0 [31+rbx*1+r10]
prefetcht0 [31+rbx*1+r10]
DB 102,15,56,220,225
DB 102,15,56,220,233
movups xmm1,XMMWORD[((48-120))+rsi]
cmp ecx,DWORD[32+rsp]
DB 102,15,56,220,208
DB 102,15,56,220,216
DB 102,15,56,220,224
cmovge r8,rbp
cmovg r12,rbp
DB 102,15,56,220,232
movups xmm0,XMMWORD[((-56))+rsi]
cmp ecx,DWORD[36+rsp]
DB 102,15,56,220,209
DB 102,15,56,220,217
DB 102,15,56,220,225
cmovge r9,rbp
cmovg r13,rbp
DB 102,15,56,220,233
movups xmm1,XMMWORD[((-40))+rsi]
cmp ecx,DWORD[40+rsp]
DB 102,15,56,220,208
DB 102,15,56,220,216
DB 102,15,56,220,224
cmovge r10,rbp
cmovg r14,rbp
DB 102,15,56,220,232
movups xmm0,XMMWORD[((-24))+rsi]
cmp ecx,DWORD[44+rsp]
DB 102,15,56,220,209
DB 102,15,56,220,217
DB 102,15,56,220,225
cmovge r11,rbp
cmovg r15,rbp
DB 102,15,56,220,233
movups xmm1,XMMWORD[((-8))+rsi]
movdqa xmm11,xmm10
DB 102,15,56,220,208
prefetcht0 [15+rbx*1+r12]
prefetcht0 [15+rbx*1+r13]
DB 102,15,56,220,216
prefetcht0 [15+rbx*1+r14]
prefetcht0 [15+rbx*1+r15]
DB 102,15,56,220,224
DB 102,15,56,220,232
movups xmm0,XMMWORD[((128-120))+rsi]
pxor xmm12,xmm12
DB 102,15,56,220,209
pcmpgtd xmm11,xmm12
movdqu xmm12,XMMWORD[((-120))+rsi]
DB 102,15,56,220,217
paddd xmm10,xmm11
movdqa XMMWORD[32+rsp],xmm10
DB 102,15,56,220,225
DB 102,15,56,220,233
movups xmm1,XMMWORD[((144-120))+rsi]
cmp eax,11
DB 102,15,56,220,208
DB 102,15,56,220,216
DB 102,15,56,220,224
DB 102,15,56,220,232
movups xmm0,XMMWORD[((160-120))+rsi]
jb NEAR $L$enc4x_tail
DB 102,15,56,220,209
DB 102,15,56,220,217
DB 102,15,56,220,225
DB 102,15,56,220,233
movups xmm1,XMMWORD[((176-120))+rsi]
DB 102,15,56,220,208
DB 102,15,56,220,216
DB 102,15,56,220,224
DB 102,15,56,220,232
movups xmm0,XMMWORD[((192-120))+rsi]
je NEAR $L$enc4x_tail
DB 102,15,56,220,209
DB 102,15,56,220,217
DB 102,15,56,220,225
DB 102,15,56,220,233
movups xmm1,XMMWORD[((208-120))+rsi]
DB 102,15,56,220,208
DB 102,15,56,220,216
DB 102,15,56,220,224
DB 102,15,56,220,232
movups xmm0,XMMWORD[((224-120))+rsi]
jmp NEAR $L$enc4x_tail
ALIGN 32
$L$enc4x_tail:
DB 102,15,56,220,209
DB 102,15,56,220,217
DB 102,15,56,220,225
DB 102,15,56,220,233
movdqu xmm6,XMMWORD[rbx*1+r8]
movdqu xmm1,XMMWORD[((16-120))+rsi]
DB 102,15,56,221,208
movdqu xmm7,XMMWORD[rbx*1+r9]
pxor xmm6,xmm12
DB 102,15,56,221,216
movdqu xmm8,XMMWORD[rbx*1+r10]
pxor xmm7,xmm12
DB 102,15,56,221,224
movdqu xmm9,XMMWORD[rbx*1+r11]
pxor xmm8,xmm12
DB 102,15,56,221,232
movdqu xmm0,XMMWORD[((32-120))+rsi]
pxor xmm9,xmm12
movups XMMWORD[(-16)+rbx*1+r12],xmm2
pxor xmm2,xmm6
movups XMMWORD[(-16)+rbx*1+r13],xmm3
pxor xmm3,xmm7
movups XMMWORD[(-16)+rbx*1+r14],xmm4
pxor xmm4,xmm8
movups XMMWORD[(-16)+rbx*1+r15],xmm5
pxor xmm5,xmm9
dec edx
jnz NEAR $L$oop_enc4x
mov rax,QWORD[16+rsp]
mov edx,DWORD[24+rsp]
lea rdi,[160+rdi]
dec edx
jnz NEAR $L$enc4x_loop_grande
$L$enc4x_done:
movaps xmm6,XMMWORD[((-216))+rax]
movaps xmm7,XMMWORD[((-200))+rax]
movaps xmm8,XMMWORD[((-184))+rax]
movaps xmm9,XMMWORD[((-168))+rax]
movaps xmm10,XMMWORD[((-152))+rax]
movaps xmm11,XMMWORD[((-136))+rax]
movaps xmm12,XMMWORD[((-120))+rax]
mov r15,QWORD[((-48))+rax]
mov r14,QWORD[((-40))+rax]
mov r13,QWORD[((-32))+rax]
mov r12,QWORD[((-24))+rax]
mov rbp,QWORD[((-16))+rax]
mov rbx,QWORD[((-8))+rax]
lea rsp,[rax]
$L$enc4x_epilogue:
mov rdi,QWORD[8+rsp] ;WIN64 epilogue
mov rsi,QWORD[16+rsp]
DB 0F3h,0C3h ;repret
$L$SEH_end_aesni_multi_cbc_encrypt:
global aesni_multi_cbc_decrypt
ALIGN 32
aesni_multi_cbc_decrypt:
mov QWORD[8+rsp],rdi ;WIN64 prologue
mov QWORD[16+rsp],rsi
mov rax,rsp
$L$SEH_begin_aesni_multi_cbc_decrypt:
mov rdi,rcx
mov rsi,rdx
mov rdx,r8
mov rax,rsp
push rbx
push rbp
push r12
push r13
push r14
push r15
lea rsp,[((-168))+rsp]
movaps XMMWORD[rsp],xmm6
movaps XMMWORD[16+rsp],xmm7
movaps XMMWORD[32+rsp],xmm8
movaps XMMWORD[48+rsp],xmm9
movaps XMMWORD[64+rsp],xmm10
movaps XMMWORD[80+rsp],xmm11
movaps XMMWORD[96+rsp],xmm12
movaps XMMWORD[(-104)+rax],xmm13
movaps XMMWORD[(-88)+rax],xmm14
movaps XMMWORD[(-72)+rax],xmm15
sub rsp,48
and rsp,-64
mov QWORD[16+rsp],rax
$L$dec4x_body:
movdqu xmm12,XMMWORD[rsi]
lea rsi,[120+rsi]
lea rdi,[80+rdi]
$L$dec4x_loop_grande:
mov DWORD[24+rsp],edx
xor edx,edx
mov ecx,DWORD[((-64))+rdi]
mov r8,QWORD[((-80))+rdi]
cmp ecx,edx
mov r12,QWORD[((-72))+rdi]
cmovg edx,ecx
test ecx,ecx
movdqu xmm6,XMMWORD[((-56))+rdi]
mov DWORD[32+rsp],ecx
cmovle r8,rsp
mov ecx,DWORD[((-24))+rdi]
mov r9,QWORD[((-40))+rdi]
cmp ecx,edx
mov r13,QWORD[((-32))+rdi]
cmovg edx,ecx
test ecx,ecx
movdqu xmm7,XMMWORD[((-16))+rdi]
mov DWORD[36+rsp],ecx
cmovle r9,rsp
mov ecx,DWORD[16+rdi]
mov r10,QWORD[rdi]
cmp ecx,edx
mov r14,QWORD[8+rdi]
cmovg edx,ecx
test ecx,ecx
movdqu xmm8,XMMWORD[24+rdi]
mov DWORD[40+rsp],ecx
cmovle r10,rsp
mov ecx,DWORD[56+rdi]
mov r11,QWORD[40+rdi]
cmp ecx,edx
mov r15,QWORD[48+rdi]
cmovg edx,ecx
test ecx,ecx
movdqu xmm9,XMMWORD[64+rdi]
mov DWORD[44+rsp],ecx
cmovle r11,rsp
test edx,edx
jz NEAR $L$dec4x_done
movups xmm1,XMMWORD[((16-120))+rsi]
movups xmm0,XMMWORD[((32-120))+rsi]
mov eax,DWORD[((240-120))+rsi]
movdqu xmm2,XMMWORD[r8]
movdqu xmm3,XMMWORD[r9]
pxor xmm2,xmm12
movdqu xmm4,XMMWORD[r10]
pxor xmm3,xmm12
movdqu xmm5,XMMWORD[r11]
pxor xmm4,xmm12
pxor xmm5,xmm12
movdqa xmm10,XMMWORD[32+rsp]
xor rbx,rbx
jmp NEAR $L$oop_dec4x
ALIGN 32
$L$oop_dec4x:
add rbx,16
lea rbp,[16+rsp]
mov ecx,1
sub rbp,rbx
DB 102,15,56,222,209
prefetcht0 [31+rbx*1+r8]
prefetcht0 [31+rbx*1+r9]
DB 102,15,56,222,217
prefetcht0 [31+rbx*1+r10]
prefetcht0 [31+rbx*1+r11]
DB 102,15,56,222,225
DB 102,15,56,222,233
movups xmm1,XMMWORD[((48-120))+rsi]
cmp ecx,DWORD[32+rsp]
DB 102,15,56,222,208
DB 102,15,56,222,216
DB 102,15,56,222,224
cmovge r8,rbp
cmovg r12,rbp
DB 102,15,56,222,232
movups xmm0,XMMWORD[((-56))+rsi]
cmp ecx,DWORD[36+rsp]
DB 102,15,56,222,209
DB 102,15,56,222,217
DB 102,15,56,222,225
cmovge r9,rbp
cmovg r13,rbp
DB 102,15,56,222,233
movups xmm1,XMMWORD[((-40))+rsi]
cmp ecx,DWORD[40+rsp]
DB 102,15,56,222,208
DB 102,15,56,222,216
DB 102,15,56,222,224
cmovge r10,rbp
cmovg r14,rbp
DB 102,15,56,222,232
movups xmm0,XMMWORD[((-24))+rsi]
cmp ecx,DWORD[44+rsp]
DB 102,15,56,222,209
DB 102,15,56,222,217
DB 102,15,56,222,225
cmovge r11,rbp
cmovg r15,rbp
DB 102,15,56,222,233
movups xmm1,XMMWORD[((-8))+rsi]
movdqa xmm11,xmm10
DB 102,15,56,222,208
prefetcht0 [15+rbx*1+r12]
prefetcht0 [15+rbx*1+r13]
DB 102,15,56,222,216
prefetcht0 [15+rbx*1+r14]
prefetcht0 [15+rbx*1+r15]
DB 102,15,56,222,224
DB 102,15,56,222,232
movups xmm0,XMMWORD[((128-120))+rsi]
pxor xmm12,xmm12
DB 102,15,56,222,209
pcmpgtd xmm11,xmm12
movdqu xmm12,XMMWORD[((-120))+rsi]
DB 102,15,56,222,217
paddd xmm10,xmm11
movdqa XMMWORD[32+rsp],xmm10
DB 102,15,56,222,225
DB 102,15,56,222,233
movups xmm1,XMMWORD[((144-120))+rsi]
cmp eax,11
DB 102,15,56,222,208
DB 102,15,56,222,216
DB 102,15,56,222,224
DB 102,15,56,222,232
movups xmm0,XMMWORD[((160-120))+rsi]
jb NEAR $L$dec4x_tail
DB 102,15,56,222,209
DB 102,15,56,222,217
DB 102,15,56,222,225
DB 102,15,56,222,233
movups xmm1,XMMWORD[((176-120))+rsi]
DB 102,15,56,222,208
DB 102,15,56,222,216
DB 102,15,56,222,224
DB 102,15,56,222,232
movups xmm0,XMMWORD[((192-120))+rsi]
je NEAR $L$dec4x_tail
DB 102,15,56,222,209
DB 102,15,56,222,217
DB 102,15,56,222,225
DB 102,15,56,222,233
movups xmm1,XMMWORD[((208-120))+rsi]
DB 102,15,56,222,208
DB 102,15,56,222,216
DB 102,15,56,222,224
DB 102,15,56,222,232
movups xmm0,XMMWORD[((224-120))+rsi]
jmp NEAR $L$dec4x_tail
ALIGN 32
$L$dec4x_tail:
DB 102,15,56,222,209
DB 102,15,56,222,217
DB 102,15,56,222,225
pxor xmm6,xmm0
pxor xmm7,xmm0
DB 102,15,56,222,233
movdqu xmm1,XMMWORD[((16-120))+rsi]
pxor xmm8,xmm0
pxor xmm9,xmm0
movdqu xmm0,XMMWORD[((32-120))+rsi]
DB 102,15,56,223,214
DB 102,15,56,223,223
movdqu xmm6,XMMWORD[((-16))+rbx*1+r8]
movdqu xmm7,XMMWORD[((-16))+rbx*1+r9]
DB 102,65,15,56,223,224
DB 102,65,15,56,223,233
movdqu xmm8,XMMWORD[((-16))+rbx*1+r10]
movdqu xmm9,XMMWORD[((-16))+rbx*1+r11]
movups XMMWORD[(-16)+rbx*1+r12],xmm2
movdqu xmm2,XMMWORD[rbx*1+r8]
movups XMMWORD[(-16)+rbx*1+r13],xmm3
movdqu xmm3,XMMWORD[rbx*1+r9]
pxor xmm2,xmm12
movups XMMWORD[(-16)+rbx*1+r14],xmm4
movdqu xmm4,XMMWORD[rbx*1+r10]
pxor xmm3,xmm12
movups XMMWORD[(-16)+rbx*1+r15],xmm5
movdqu xmm5,XMMWORD[rbx*1+r11]
pxor xmm4,xmm12
pxor xmm5,xmm12
dec edx
jnz NEAR $L$oop_dec4x
mov rax,QWORD[16+rsp]
mov edx,DWORD[24+rsp]
lea rdi,[160+rdi]
dec edx
jnz NEAR $L$dec4x_loop_grande
$L$dec4x_done:
movaps xmm6,XMMWORD[((-216))+rax]
movaps xmm7,XMMWORD[((-200))+rax]
movaps xmm8,XMMWORD[((-184))+rax]
movaps xmm9,XMMWORD[((-168))+rax]
movaps xmm10,XMMWORD[((-152))+rax]
movaps xmm11,XMMWORD[((-136))+rax]
movaps xmm12,XMMWORD[((-120))+rax]
mov r15,QWORD[((-48))+rax]
mov r14,QWORD[((-40))+rax]
mov r13,QWORD[((-32))+rax]
mov r12,QWORD[((-24))+rax]
mov rbp,QWORD[((-16))+rax]
mov rbx,QWORD[((-8))+rax]
lea rsp,[rax]
$L$dec4x_epilogue:
mov rdi,QWORD[8+rsp] ;WIN64 epilogue
mov rsi,QWORD[16+rsp]
DB 0F3h,0C3h ;repret
$L$SEH_end_aesni_multi_cbc_decrypt:
EXTERN __imp_RtlVirtualUnwind
ALIGN 16
se_handler:
push rsi
push rdi
push rbx
push rbp
push r12
push r13
push r14
push r15
pushfq
sub rsp,64
mov rax,QWORD[120+r8]
mov rbx,QWORD[248+r8]
mov rsi,QWORD[8+r9]
mov r11,QWORD[56+r9]
mov r10d,DWORD[r11]
lea r10,[r10*1+rsi]
cmp rbx,r10
jb NEAR $L$in_prologue
mov rax,QWORD[152+r8]
mov r10d,DWORD[4+r11]
lea r10,[r10*1+rsi]
cmp rbx,r10
jae NEAR $L$in_prologue
mov rax,QWORD[16+rax]
mov rbx,QWORD[((-8))+rax]
mov rbp,QWORD[((-16))+rax]
mov r12,QWORD[((-24))+rax]
mov r13,QWORD[((-32))+rax]
mov r14,QWORD[((-40))+rax]
mov r15,QWORD[((-48))+rax]
mov QWORD[144+r8],rbx
mov QWORD[160+r8],rbp
mov QWORD[216+r8],r12
mov QWORD[224+r8],r13
mov QWORD[232+r8],r14
mov QWORD[240+r8],r15
lea rsi,[((-56-160))+rax]
lea rdi,[512+r8]
mov ecx,20
DD 0xa548f3fc
$L$in_prologue:
mov rdi,QWORD[8+rax]
mov rsi,QWORD[16+rax]
mov QWORD[152+r8],rax
mov QWORD[168+r8],rsi
mov QWORD[176+r8],rdi
mov rdi,QWORD[40+r9]
mov rsi,r8
mov ecx,154
DD 0xa548f3fc
mov rsi,r9
xor rcx,rcx
mov rdx,QWORD[8+rsi]
mov r8,QWORD[rsi]
mov r9,QWORD[16+rsi]
mov r10,QWORD[40+rsi]
lea r11,[56+rsi]
lea r12,[24+rsi]
mov QWORD[32+rsp],r10
mov QWORD[40+rsp],r11
mov QWORD[48+rsp],r12
mov QWORD[56+rsp],rcx
call QWORD[__imp_RtlVirtualUnwind]
mov eax,1
add rsp,64
popfq
pop r15
pop r14
pop r13
pop r12
pop rbp
pop rbx
pop rdi
pop rsi
DB 0F3h,0C3h ;repret
section .pdata rdata align=4
ALIGN 4
DD $L$SEH_begin_aesni_multi_cbc_encrypt wrt ..imagebase
DD $L$SEH_end_aesni_multi_cbc_encrypt wrt ..imagebase
DD $L$SEH_info_aesni_multi_cbc_encrypt wrt ..imagebase
DD $L$SEH_begin_aesni_multi_cbc_decrypt wrt ..imagebase
DD $L$SEH_end_aesni_multi_cbc_decrypt wrt ..imagebase
DD $L$SEH_info_aesni_multi_cbc_decrypt wrt ..imagebase
section .xdata rdata align=8
ALIGN 8
$L$SEH_info_aesni_multi_cbc_encrypt:
DB 9,0,0,0
DD se_handler wrt ..imagebase
DD $L$enc4x_body wrt ..imagebase,$L$enc4x_epilogue wrt ..imagebase
$L$SEH_info_aesni_multi_cbc_decrypt:
DB 9,0,0,0
DD se_handler wrt ..imagebase
DD $L$dec4x_body wrt ..imagebase,$L$dec4x_epilogue wrt ..imagebase
|
; void *zx_cxy2saddr_callee(uchar x, uchar y)
SECTION code_clib
SECTION code_arch
PUBLIC _zx_cxy2saddr_callee
EXTERN asm_zx_cxy2saddr
_zx_cxy2saddr_callee:
pop hl
ex (sp),hl
jp asm_zx_cxy2saddr
|
/*
* ApplyMetadataMutation.cpp
*
* This source file is part of the FoundationDB open source project
*
* Copyright 2013-2019 Apple Inc. and the FoundationDB project authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "fdbclient/MutationList.h"
#include "fdbclient/SystemData.h"
#include "fdbclient/BackupAgent.actor.h"
#include "fdbclient/Notified.h"
#include "fdbserver/ApplyMetadataMutation.h"
#include "fdbserver/IKeyValueStore.h"
#include "fdbserver/LogSystem.h"
#include "fdbserver/LogProtocolMessage.h"
Reference<StorageInfo> getStorageInfo(UID id, std::map<UID, Reference<StorageInfo>>* storageCache, IKeyValueStore* txnStateStore) {
Reference<StorageInfo> storageInfo;
auto cacheItr = storageCache->find(id);
if(cacheItr == storageCache->end()) {
storageInfo = Reference<StorageInfo>( new StorageInfo() );
storageInfo->tag = decodeServerTagValue( txnStateStore->readValue( serverTagKeyFor(id) ).get().get() );
storageInfo->interf = decodeServerListValue( txnStateStore->readValue( serverListKeyFor(id) ).get().get() );
(*storageCache)[id] = storageInfo;
} else {
storageInfo = cacheItr->second;
}
return storageInfo;
}
// It is incredibly important that any modifications to txnStateStore are done in such a way that
// the same operations will be done on all proxies at the same time. Otherwise, the data stored in
// txnStateStore will become corrupted.
void applyMetadataMutations(UID const& dbgid, Arena &arena, VectorRef<MutationRef> const& mutations, IKeyValueStore* txnStateStore, LogPushData* toCommit, bool *confChange, Reference<ILogSystem> logSystem, Version popVersion,
KeyRangeMap<std::set<Key> >* vecBackupKeys, KeyRangeMap<ServerCacheInfo>* keyInfo, KeyRangeMap<bool>* cacheInfo, std::map<Key, applyMutationsData>* uid_applyMutationsData, RequestStream<CommitTransactionRequest> commit,
Database cx, NotifiedVersion* commitVersion, std::map<UID, Reference<StorageInfo>>* storageCache, std::map<Tag, Version>* tag_popped, bool initialCommit ) {
//std::map<keyRef, vector<uint16_t>> cacheRangeInfo;
std::map<KeyRef, MutationRef> cachedRangeInfo;
for (auto const& m : mutations) {
//TraceEvent("MetadataMutation", dbgid).detail("M", m.toString());
if (m.param1.size() && m.param1[0] == systemKeys.begin[0] && m.type == MutationRef::SetValue) {
if(m.param1.startsWith(keyServersPrefix)) {
if(keyInfo) {
KeyRef k = m.param1.removePrefix(keyServersPrefix);
if(k != allKeys.end) {
KeyRef end = keyInfo->rangeContaining(k).end();
KeyRangeRef insertRange(k,end);
vector<UID> src, dest;
decodeKeyServersValue(m.param2, src, dest);
ASSERT(storageCache);
ServerCacheInfo info;
info.tags.reserve(src.size() + dest.size());
info.src_info.reserve(src.size());
info.dest_info.reserve(dest.size());
for (const auto& id : src) {
auto storageInfo = getStorageInfo(id, storageCache, txnStateStore);
ASSERT(storageInfo->tag != invalidTag);
info.tags.push_back( storageInfo->tag );
info.src_info.push_back( storageInfo );
}
for (const auto& id : dest) {
auto storageInfo = getStorageInfo(id, storageCache, txnStateStore);
ASSERT(storageInfo->tag != invalidTag);
info.tags.push_back( storageInfo->tag );
info.dest_info.push_back( storageInfo );
}
uniquify(info.tags);
keyInfo->insert(insertRange,info);
}
}
if(!initialCommit) txnStateStore->set(KeyValueRef(m.param1, m.param2));
} else if (m.param1.startsWith(serverKeysPrefix)) {
if(toCommit) {
MutationRef privatized = m;
privatized.param1 = m.param1.withPrefix(systemKeys.begin, arena);
TraceEvent(SevDebug, "SendingPrivateMutation", dbgid).detail("Original", m.toString()).detail("Privatized", privatized.toString()).detail("Server", serverKeysDecodeServer(m.param1))
.detail("TagKey", serverTagKeyFor( serverKeysDecodeServer(m.param1) )).detail("Tag", decodeServerTagValue( txnStateStore->readValue( serverTagKeyFor( serverKeysDecodeServer(m.param1) ) ).get().get() ).toString());
toCommit->addTag( decodeServerTagValue( txnStateStore->readValue( serverTagKeyFor( serverKeysDecodeServer(m.param1) ) ).get().get() ) );
toCommit->addTypedMessage(privatized);
}
} else if (m.param1.startsWith(serverTagPrefix)) {
UID id = decodeServerTagKey(m.param1);
Tag tag = decodeServerTagValue(m.param2);
if(toCommit) {
MutationRef privatized = m;
privatized.param1 = m.param1.withPrefix(systemKeys.begin, arena);
TraceEvent("ServerTag", dbgid).detail("Server", id).detail("Tag", tag.toString());
toCommit->addTag(tag);
toCommit->addTypedMessage(LogProtocolMessage());
toCommit->addTag(tag);
toCommit->addTypedMessage(privatized);
}
if(!initialCommit) {
txnStateStore->set(KeyValueRef(m.param1, m.param2));
if(storageCache) {
auto cacheItr = storageCache->find(id);
if(cacheItr == storageCache->end()) {
Reference<StorageInfo> storageInfo = Reference<StorageInfo>( new StorageInfo() );
storageInfo->tag = tag;
Optional<Key> interfKey = txnStateStore->readValue( serverListKeyFor(id) ).get();
if(interfKey.present()) {
storageInfo->interf = decodeServerListValue( interfKey.get() );
}
(*storageCache)[id] = storageInfo;
} else {
cacheItr->second->tag = tag;
//These tag vectors will be repopulated by the proxy when it detects their sizes are 0.
for(auto& it : keyInfo->ranges()) {
it.value().tags.clear();
}
}
}
}
} else if (m.param1.startsWith(storageCachePrefix)) {
if(cacheInfo) {
KeyRef k = m.param1.removePrefix(storageCachePrefix);
// Create a private mutation for storage servers
// This is done to make the storage servers aware of the cached key-ranges
if(toCommit)
{
MutationRef privatized = m;
privatized.param1 = m.param1.withPrefix(systemKeys.begin, arena);
TraceEvent(SevDebug, "SendingPrivateMutation", dbgid).detail("Original", m.toString()).detail("Privatized", privatized.toString());
cachedRangeInfo[k] = privatized;
}
if(k != allKeys.end) {
KeyRef end = cacheInfo->rangeContaining(k).end();
vector<uint16_t> serverIndices;
decodeStorageCacheValue(m.param2, serverIndices);
cacheInfo->insert(KeyRangeRef(k,end),serverIndices.size() > 0);
}
}
if(!initialCommit) txnStateStore->set(KeyValueRef(m.param1, m.param2));
} else if (m.param1.startsWith(cacheKeysPrefix)) {
// Create a private mutation for cache servers
// This is done to make the cache servers aware of the cached key-ranges
if(toCommit) {
MutationRef privatized = m;
privatized.param1 = m.param1.withPrefix(systemKeys.begin, arena);
TraceEvent(SevDebug, "SendingPrivateMutation", dbgid).detail("Original", m.toString()).detail("Privatized", privatized.toString());
toCommit->addTag( cacheTag );
toCommit->addTypedMessage(privatized);
}
}
else if (m.param1.startsWith(configKeysPrefix) || m.param1 == coordinatorsKey) {
if(Optional<StringRef>(m.param2) != txnStateStore->readValue(m.param1).get().castTo<StringRef>()) { // FIXME: Make this check more specific, here or by reading configuration whenever there is a change
if((!m.param1.startsWith( excludedServersPrefix ) && m.param1 != excludedServersVersionKey) &&
(!m.param1.startsWith( failedServersPrefix ) && m.param1 != failedServersVersionKey)) {
auto t = txnStateStore->readValue(m.param1).get();
TraceEvent("MutationRequiresRestart", dbgid)
.detail("M", m.toString())
.detail("PrevValue", t.present() ? t.get() : LiteralStringRef("(none)"))
.detail("ToCommit", toCommit!=nullptr);
if(confChange) *confChange = true;
}
}
if(!initialCommit) txnStateStore->set(KeyValueRef(m.param1, m.param2));
}
else if (m.param1.startsWith(serverListPrefix)) {
if(!initialCommit) {
txnStateStore->set(KeyValueRef(m.param1, m.param2));
if(storageCache) {
UID id = decodeServerListKey(m.param1);
StorageServerInterface interf = decodeServerListValue(m.param2);
auto cacheItr = storageCache->find(id);
if(cacheItr == storageCache->end()) {
Reference<StorageInfo> storageInfo = Reference<StorageInfo>( new StorageInfo() );
storageInfo->interf = interf;
Optional<Key> tagKey = txnStateStore->readValue( serverTagKeyFor(id) ).get();
if(tagKey.present()) {
storageInfo->tag = decodeServerTagValue( tagKey.get() );
}
(*storageCache)[id] = storageInfo;
} else {
cacheItr->second->interf = interf;
}
}
}
} else if( m.param1 == databaseLockedKey || m.param1 == metadataVersionKey || m.param1 == mustContainSystemMutationsKey || m.param1.startsWith(applyMutationsBeginRange.begin) ||
m.param1.startsWith(applyMutationsAddPrefixRange.begin) || m.param1.startsWith(applyMutationsRemovePrefixRange.begin) || m.param1.startsWith(tagLocalityListPrefix) || m.param1.startsWith(serverTagHistoryPrefix) || m.param1.startsWith(testOnlyTxnStateStorePrefixRange.begin) ) {
if(!initialCommit) txnStateStore->set(KeyValueRef(m.param1, m.param2));
}
else if (m.param1.startsWith(applyMutationsEndRange.begin)) {
if(!initialCommit) txnStateStore->set(KeyValueRef(m.param1, m.param2));
if(uid_applyMutationsData != nullptr) {
Key uid = m.param1.removePrefix(applyMutationsEndRange.begin);
auto &p = (*uid_applyMutationsData)[uid];
p.endVersion = BinaryReader::fromStringRef<Version>(m.param2, Unversioned());
if(p.keyVersion == Reference<KeyRangeMap<Version>>())
p.keyVersion = Reference<KeyRangeMap<Version>>( new KeyRangeMap<Version>() );
if(!p.worker.isValid() || p.worker.isReady()) {
auto addPrefixValue = txnStateStore->readValue(uid.withPrefix(applyMutationsAddPrefixRange.begin)).get();
auto removePrefixValue = txnStateStore->readValue(uid.withPrefix(applyMutationsRemovePrefixRange.begin)).get();
auto beginValue = txnStateStore->readValue(uid.withPrefix(applyMutationsBeginRange.begin)).get();
p.worker = applyMutations( cx, uid, addPrefixValue.present() ? addPrefixValue.get() : Key(),
removePrefixValue.present() ? removePrefixValue.get() : Key(),
beginValue.present() ? BinaryReader::fromStringRef<Version>(beginValue.get(), Unversioned()) : 0,
&p.endVersion, commit, commitVersion, p.keyVersion );
}
}
}
else if (m.param1.startsWith(applyMutationsKeyVersionMapRange.begin)) {
if(!initialCommit) txnStateStore->set(KeyValueRef(m.param1, m.param2));
if(uid_applyMutationsData != nullptr) {
if(m.param1.size() >= applyMutationsKeyVersionMapRange.begin.size() + sizeof(UID)) {
Key uid = m.param1.substr(applyMutationsKeyVersionMapRange.begin.size(), sizeof(UID));
Key k = m.param1.substr(applyMutationsKeyVersionMapRange.begin.size() + sizeof(UID));
auto &p = (*uid_applyMutationsData)[uid];
if(p.keyVersion == Reference<KeyRangeMap<Version>>())
p.keyVersion = Reference<KeyRangeMap<Version>>( new KeyRangeMap<Version>() );
p.keyVersion->rawInsert( k, BinaryReader::fromStringRef<Version>(m.param2, Unversioned()) );
}
}
}
else if (m.param1.startsWith(logRangesRange.begin)) {
if(!initialCommit) txnStateStore->set(KeyValueRef(m.param1, m.param2));
if (vecBackupKeys) {
Key logDestination;
KeyRef logRangeBegin = logRangesDecodeKey(m.param1, nullptr);
Key logRangeEnd = logRangesDecodeValue(m.param2, &logDestination);
// Insert the logDestination into each range of vecBackupKeys overlapping the decoded range
for (auto& logRange : vecBackupKeys->modify(KeyRangeRef(logRangeBegin, logRangeEnd))) {
logRange->value().insert(logDestination);
}
for (auto& logRange : vecBackupKeys->modify(singleKeyRange(metadataVersionKey))) {
logRange->value().insert(logDestination);
}
// Log the modification
TraceEvent("LogRangeAdd").detail("LogRanges", vecBackupKeys->size()).detail("MutationKey", m.param1)
.detail("LogRangeBegin", logRangeBegin).detail("LogRangeEnd", logRangeEnd);
}
}
else if (m.param1.startsWith(globalKeysPrefix)) {
if(toCommit) {
// Notifies all servers that a Master's server epoch ends
auto allServers = txnStateStore->readRange(serverTagKeys).get();
std::set<Tag> allTags;
if(m.param1 == killStorageKey) {
int8_t safeLocality = BinaryReader::fromStringRef<int8_t>(m.param2, Unversioned());
for (auto &kv : allServers) {
Tag t = decodeServerTagValue(kv.value);
if(t.locality != safeLocality) {
allTags.insert(t);
}
}
} else {
for (auto &kv : allServers) {
allTags.insert(decodeServerTagValue(kv.value));
}
}
if (m.param1 == lastEpochEndKey) {
toCommit->addTags(allTags);
toCommit->addTypedMessage(LogProtocolMessage());
}
MutationRef privatized = m;
privatized.param1 = m.param1.withPrefix(systemKeys.begin, arena);
toCommit->addTags(allTags);
toCommit->addTypedMessage(privatized);
}
}
else if (m.param1 == minRequiredCommitVersionKey) {
Version requested = BinaryReader::fromStringRef<Version>(m.param2, Unversioned());
TraceEvent("MinRequiredCommitVersion", dbgid).detail("Min", requested).detail("Current", popVersion).detail("HasConf", !!confChange);
if(!initialCommit) txnStateStore->set(KeyValueRef(m.param1, m.param2));
if (confChange) *confChange = true;
TEST(true); // Recovering at a higher version.
}
}
else if (m.param2.size() && m.param2[0] == systemKeys.begin[0] && m.type == MutationRef::ClearRange) {
KeyRangeRef range(m.param1, m.param2);
if (keyServersKeys.intersects(range)) {
KeyRangeRef r = range & keyServersKeys;
if(keyInfo) {
KeyRangeRef clearRange(r.begin.removePrefix(keyServersPrefix), r.end.removePrefix(keyServersPrefix));
keyInfo->insert(clearRange, clearRange.begin == StringRef() ? ServerCacheInfo() : keyInfo->rangeContainingKeyBefore(clearRange.begin).value());
}
if(!initialCommit) txnStateStore->clear(r);
}
if (configKeys.intersects(range)) {
if(!initialCommit) txnStateStore->clear(range & configKeys);
if(!excludedServersKeys.contains(range) && !failedServersKeys.contains(range)) {
TraceEvent("MutationRequiresRestart", dbgid).detail("M", m.toString());
if(confChange) *confChange = true;
}
}
if ( serverListKeys.intersects( range )) {
if(!initialCommit) txnStateStore->clear( range & serverListKeys );
}
if ( tagLocalityListKeys.intersects( range )) {
if(!initialCommit) txnStateStore->clear( range & tagLocalityListKeys );
}
if ( serverTagKeys.intersects( range )) {
// Storage server removal always happens in a separate version from any prior writes (or any subsequent reuse of the tag) so we
// can safely destroy the tag here without any concern about intra-batch ordering
if (logSystem && popVersion) {
auto serverKeysCleared = txnStateStore->readRange( range & serverTagKeys ).get(); // read is expected to be immediately available
for(auto &kv : serverKeysCleared) {
Tag tag = decodeServerTagValue(kv.value);
TraceEvent("ServerTagRemove").detail("PopVersion", popVersion).detail("Tag", tag.toString()).detail("Server", decodeServerTagKey(kv.key));
logSystem->pop( popVersion, decodeServerTagValue(kv.value) );
(*tag_popped)[tag] = popVersion;
if(toCommit) {
MutationRef privatized = m;
privatized.param1 = kv.key.withPrefix(systemKeys.begin, arena);
privatized.param2 = keyAfter(kv.key, arena).withPrefix(systemKeys.begin, arena);
toCommit->addTag(decodeServerTagValue(kv.value));
toCommit->addTypedMessage(privatized);
}
}
}
if(!initialCommit) {
KeyRangeRef clearRange = range & serverTagKeys;
txnStateStore->clear(clearRange);
if(storageCache && clearRange.singleKeyRange()) {
storageCache->erase(decodeServerTagKey(clearRange.begin));
}
}
}
if ( serverTagHistoryKeys.intersects( range )) {
//Once a tag has been removed from history we should pop it, since we no longer have a record of the tag once it has been removed from history
if (logSystem && popVersion) {
auto serverKeysCleared = txnStateStore->readRange( range & serverTagHistoryKeys ).get(); // read is expected to be immediately available
for(auto &kv : serverKeysCleared) {
Tag tag = decodeServerTagValue(kv.value);
TraceEvent("ServerTagHistoryRemove").detail("PopVersion", popVersion).detail("Tag", tag.toString()).detail("Version", decodeServerTagHistoryKey(kv.key));
logSystem->pop( popVersion, tag );
(*tag_popped)[tag] = popVersion;
}
}
if(!initialCommit) txnStateStore->clear( range & serverTagHistoryKeys );
}
if (range.contains(coordinatorsKey)) {
if(!initialCommit) txnStateStore->clear(singleKeyRange(coordinatorsKey));
}
if (range.contains(databaseLockedKey)) {
if(!initialCommit) txnStateStore->clear(singleKeyRange(databaseLockedKey));
}
if (range.contains(metadataVersionKey)) {
if(!initialCommit) txnStateStore->clear(singleKeyRange(metadataVersionKey));
}
if (range.contains(mustContainSystemMutationsKey)) {
if(!initialCommit) txnStateStore->clear(singleKeyRange(mustContainSystemMutationsKey));
}
if (range.intersects(testOnlyTxnStateStorePrefixRange)) {
if(!initialCommit) txnStateStore->clear(range & testOnlyTxnStateStorePrefixRange);
}
if(range.intersects(applyMutationsEndRange)) {
KeyRangeRef commonEndRange(range & applyMutationsEndRange);
if(!initialCommit) txnStateStore->clear(commonEndRange);
if(uid_applyMutationsData != nullptr) {
uid_applyMutationsData->erase(uid_applyMutationsData->lower_bound(m.param1.substr(applyMutationsEndRange.begin.size())),
m.param2 == applyMutationsEndRange.end ? uid_applyMutationsData->end() : uid_applyMutationsData->lower_bound(m.param2.substr(applyMutationsEndRange.begin.size())));
}
}
if(range.intersects(applyMutationsKeyVersionMapRange)) {
KeyRangeRef commonApplyRange(range & applyMutationsKeyVersionMapRange);
if(!initialCommit) txnStateStore->clear(commonApplyRange);
if(uid_applyMutationsData != nullptr) {
if(m.param1.size() >= applyMutationsKeyVersionMapRange.begin.size() + sizeof(UID) && m.param2.size() >= applyMutationsKeyVersionMapRange.begin.size() + sizeof(UID)) {
Key uid = m.param1.substr(applyMutationsKeyVersionMapRange.begin.size(), sizeof(UID));
Key uid2 = m.param2.substr(applyMutationsKeyVersionMapRange.begin.size(), sizeof(UID));
if(uid == uid2) {
auto &p = (*uid_applyMutationsData)[uid];
if(p.keyVersion == Reference<KeyRangeMap<Version>>())
p.keyVersion = Reference<KeyRangeMap<Version>>( new KeyRangeMap<Version>() );
p.keyVersion->rawErase( KeyRangeRef( m.param1.substr(applyMutationsKeyVersionMapRange.begin.size() + sizeof(UID)), m.param2.substr(applyMutationsKeyVersionMapRange.begin.size() + sizeof(UID))) );
}
}
}
}
if (range.intersects(logRangesRange)) {
KeyRangeRef commonLogRange(range & logRangesRange);
TraceEvent("LogRangeClear")
.detail("RangeBegin", range.begin).detail("RangeEnd", range.end)
.detail("IntersectBegin", commonLogRange.begin).detail("IntersectEnd", commonLogRange.end);
// Remove the key range from the vector, if defined
if (vecBackupKeys) {
KeyRef logKeyBegin;
Key logKeyEnd, logDestination;
// Identify the backup keys being removed
// read is expected to be immediately available
auto logRangesAffected = txnStateStore->readRange(commonLogRange).get();
TraceEvent("LogRangeClearBegin").detail("AffectedLogRanges", logRangesAffected.size());
// Add the backup name to the backup locations that do not have it
for (auto logRangeAffected : logRangesAffected)
{
// Parse the backup key and name
logKeyBegin = logRangesDecodeKey(logRangeAffected.key, nullptr);
// Decode the log destination and key value
logKeyEnd = logRangesDecodeValue(logRangeAffected.value, &logDestination);
TraceEvent("LogRangeErase").detail("AffectedKey", logRangeAffected.key).detail("AffectedValue", logRangeAffected.value)
.detail("LogKeyBegin", logKeyBegin).detail("LogKeyEnd", logKeyEnd)
.detail("LogDestination", logDestination);
// Identify the locations to place the backup key
auto logRanges = vecBackupKeys->modify(KeyRangeRef(logKeyBegin, logKeyEnd));
// Remove the log prefix from the ranges which include it
for (auto logRange : logRanges)
{
auto &logRangeMap = logRange->value();
// Remove the backup name from the range
logRangeMap.erase(logDestination);
}
bool foundKey = false;
for(auto &it : vecBackupKeys->intersectingRanges(normalKeys)) {
if(it.value().count(logDestination) > 0) {
foundKey = true;
break;
}
}
if(!foundKey) {
auto logRanges = vecBackupKeys->modify(singleKeyRange(metadataVersionKey));
for (auto logRange : logRanges) {
auto &logRangeMap = logRange->value();
logRangeMap.erase(logDestination);
}
}
}
// Coallesce the entire range
vecBackupKeys->coalesce(allKeys);
}
if(!initialCommit) txnStateStore->clear(commonLogRange);
}
}
}
// If we accumulated private mutations for cached key-ranges, we also need to
// tag them with the relevant storage servers. This is done to make the storage
// servers aware of the cached key-ranges
// NOTE: we are assuming non-colliding cached key-ranges
// TODO Note that, we are currently not handling the case when cached key-ranges move out
// to different storage servers. This would require some checking when keys in the keyServersPrefix change.
// For the first implementation, we could just send the entire map to every storage server. Revisit!
if (cachedRangeInfo.size() != 0 && toCommit) {
std::map<KeyRef, MutationRef>::iterator itr;
KeyRef keyBegin, keyEnd;
vector<uint16_t> serverIndices;
MutationRef mutationBegin, mutationEnd;
for (itr = cachedRangeInfo.begin(); itr != cachedRangeInfo.end(); ++itr) {
// first figure out the begin and end keys for the cached-range,
// the begin and end mutations can be in any order
decodeStorageCacheValue(itr->second.param2, serverIndices);
// serverIndices count should be greater than zero for beginKey mutations
if (serverIndices.size() > 0) {
keyBegin = itr->first;
mutationBegin = itr->second;
++itr;
keyEnd = itr->first;
mutationEnd = itr->second;
} else {
keyEnd = itr->first;
mutationEnd = itr->second;
++itr;
keyBegin = itr->first;
mutationBegin = itr->second;
}
// Now get all the storage server tags for the cached key-ranges
std::set<Tag> allTags;
auto ranges = keyInfo->intersectingRanges(KeyRangeRef(keyBegin, keyEnd));
for(auto it : ranges) {
auto& r = it.value();
for(auto info : r.src_info) {
allTags.insert(info->tag);
}
for(auto info : r.dest_info) {
allTags.insert(info->tag);
}
}
// Add the tags to both begin and end mutations
toCommit->addTags(allTags);
toCommit->addTypedMessage(mutationBegin);
toCommit->addTags(allTags);
toCommit->addTypedMessage(mutationEnd);
}
}
}
|
//
// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.20714
//
//
///
// Resource Bindings:
//
// Name Type Format Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// TextureSampler sampler NA NA 0 1
// TextureBase texture float4 2d 0 1
// TextureDetail texture float4 2d 1 1
//
//
//
// Input signature:
//
// Name Index Mask Register SysValue Format Used
// -------------------- ----- ------ -------- -------- ------- ------
// TEXCOORD 0 xyzw 0 NONE float xy
//
//
// Output signature:
//
// Name Index Mask Register SysValue Format Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Target 0 xyzw 0 TARGET float xyzw
//
ps_5_0
dcl_globalFlags refactoringAllowed
dcl_sampler s0, mode_default
dcl_resource_texture2d (float,float,float,float) t0
dcl_resource_texture2d (float,float,float,float) t1
dcl_input_ps linear v0.xy
dcl_output o0.xyzw
dcl_temps 2
sample_indexable(texture2d)(float,float,float,float) r0.xyzw, v0.xyxx, t0.xyzw, s0
sample_indexable(texture2d)(float,float,float,float) r1.xyzw, v0.xyxx, t1.xyzw, s0
mul o0.xyzw, r0.xyzw, r1.xyzw
ret
// Approximately 4 instruction slots used
|
; A028050: Expansion of 1/((1-3x)(1-4x)(1-10x)(1-11x)).
; Submitted by Christian Krause
; 1,28,515,7910,110241,1448328,18302575,225096970,2713995581,32234230028,378383333835,4400300953230,50784218810521,582435753818128,6644887820416295,75474715560668690,854031383578979061
mov $1,1
mov $2,$0
mov $3,$0
lpb $2
mov $0,$3
sub $2,1
sub $0,$2
seq $0,19742 ; Expansion of 1/((1-4x)(1-10x)(1-11x)).
mul $1,3
add $1,$0
lpe
mov $0,$1
|
; A145069: a(n) = n*(n^2 + 3*n + 5)/3.
; 0,3,10,23,44,75,118,175,248,339,450,583,740,923,1134,1375,1648,1955,2298,2679,3100,3563,4070,4623,5224,5875,6578,7335,8148,9019,9950,10943,12000,13123,14314,15575,16908,18315,19798,21359,23000,24723,26530,28423,30404,32475,34638,36895,39248,41699,44250,46903,49660,52523,55494,58575,61768,65075,68498,72039,75700,79483,83390,87423,91584,95875,100298,104855,109548,114379,119350,124463,129720,135123,140674,146375,152228,158235,164398,170719,177200,183843,190650,197623,204764,212075,219558,227215,235048,243059,251250,259623,268180,276923,285854,294975,304288,313795,323498,333399,343500,353803,364310,375023,385944,397075,408418,419975,431748,443739,455950,468383,481040,493923,507034,520375,533948,547755,561798,576079,590600,605363,620370,635623,651124,666875,682878,699135,715648,732419,749450,766743,784300,802123,820214,838575,857208,876115,895298,914759,934500,954523,974830,995423,1016304,1037475,1058938,1080695,1102748,1125099,1147750,1170703,1193960,1217523,1241394,1265575,1290068,1314875,1339998,1365439,1391200,1417283,1443690,1470423,1497484,1524875,1552598,1580655,1609048,1637779,1666850,1696263,1726020,1756123,1786574,1817375,1848528,1880035,1911898,1944119,1976700,2009643,2042950,2076623,2110664,2145075,2179858,2215015,2250548,2286459,2322750,2359423,2396480,2433923,2471754,2509975,2548588,2587595,2626998,2666799,2707000,2747603,2788610,2830023,2871844,2914075,2956718,2999775,3043248,3087139,3131450,3176183,3221340,3266923,3312934,3359375,3406248,3453555,3501298,3549479,3598100,3647163,3696670,3746623,3797024,3847875,3899178,3950935,4003148,4055819,4108950,4162543,4216600,4271123,4326114,4381575,4437508,4493915,4550798,4608159,4666000,4724323,4783130,4842423,4902204,4962475,5023238,5084495,5146248,5208499
add $0,1
mov $1,$0
mul $1,$0
add $1,2
mul $1,$0
sub $1,1
div $1,3
|
.global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r14
push %r8
push %rbp
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_WC_ht+0x15181, %rcx
cmp $58868, %r11
mov (%rcx), %rdi
nop
nop
nop
nop
nop
sub %r11, %r11
lea addresses_normal_ht+0x16b81, %r14
clflush (%r14)
nop
sub %rbp, %rbp
mov $0x6162636465666768, %r8
movq %r8, %xmm1
vmovups %ymm1, (%r14)
nop
nop
add %rdi, %rdi
lea addresses_UC_ht+0x18181, %rsi
lea addresses_UC_ht+0x16b98, %rdi
dec %rbx
mov $3, %rcx
rep movsw
nop
nop
nop
nop
xor $13119, %r11
lea addresses_normal_ht+0xe281, %r8
and $7932, %rbp
mov $0x6162636465666768, %rsi
movq %rsi, %xmm0
movups %xmm0, (%r8)
nop
nop
nop
nop
nop
sub %rbp, %rbp
lea addresses_WC_ht+0x6ff5, %rsi
lea addresses_WT_ht+0x9081, %rdi
inc %r14
mov $86, %rcx
rep movsl
nop
nop
dec %rdi
lea addresses_A_ht+0xcc1d, %rdi
nop
nop
nop
sub %r14, %r14
movups (%rdi), %xmm2
vpextrq $0, %xmm2, %rsi
nop
and %rbx, %rbx
lea addresses_WT_ht+0xf741, %rsi
nop
nop
add $48958, %r11
mov $0x6162636465666768, %rdi
movq %rdi, %xmm3
movups %xmm3, (%rsi)
nop
nop
nop
nop
nop
and $37982, %r14
lea addresses_WT_ht+0x13ca1, %rsi
lea addresses_D_ht+0x52b1, %rdi
nop
nop
nop
nop
add $6859, %r11
mov $99, %rcx
rep movsq
nop
add $40151, %r11
lea addresses_normal_ht+0x17d81, %rsi
lea addresses_normal_ht+0x466d, %rdi
nop
nop
nop
nop
inc %rbx
mov $37, %rcx
rep movsb
nop
nop
nop
nop
nop
cmp $18028, %rcx
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %r8
pop %r14
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r15
push %r8
push %rax
push %rbx
push %rcx
push %rdi
push %rsi
// REPMOV
lea addresses_RW+0x199f1, %rsi
lea addresses_UC+0x11dc1, %rdi
nop
nop
nop
sub %rbx, %rbx
mov $102, %rcx
rep movsl
nop
inc %rax
// Load
lea addresses_D+0x57f9, %rcx
clflush (%rcx)
nop
nop
nop
nop
and %r15, %r15
vmovups (%rcx), %ymm2
vextracti128 $1, %ymm2, %xmm2
vpextrq $0, %xmm2, %rbx
nop
nop
nop
nop
nop
cmp %rbx, %rbx
// Faulty Load
lea addresses_A+0x3581, %rsi
clflush (%rsi)
nop
lfence
mov (%rsi), %rax
lea oracles, %rdi
and $0xff, %rax
shlq $12, %rax
mov (%rdi,%rax,1), %rax
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rax
pop %r8
pop %r15
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_A', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_RW', 'congruent': 3, 'same': False}, 'dst': {'type': 'addresses_UC', 'congruent': 6, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_D', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 2, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_A', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 10, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 9, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 0, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 8, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 7, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 1, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 5, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 4, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 11, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 2, 'same': True}}
{'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
*/
|
_spin: file format elf32-i386
Disassembly of section .text:
00000000 <main>:
#include "types.h"
#include "user.h"
int
main(int argc, char* argv[]) {
0: 8d 4c 24 04 lea 0x4(%esp),%ecx
4: 83 e4 f0 and $0xfffffff0,%esp
7: ff 71 fc pushl -0x4(%ecx)
a: 55 push %ebp
b: 89 e5 mov %esp,%ebp
d: 53 push %ebx
e: 51 push %ecx
f: 83 ec 10 sub $0x10,%esp
12: 89 cb mov %ecx,%ebx
int i;
int x = 0;
14: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
if (argc != 2){
1b: 83 3b 02 cmpl $0x2,(%ebx)
1e: 74 05 je 25 <main+0x25>
exit();
20: e8 9e 02 00 00 call 2c3 <exit>
}
for (i = 1; i < atoi(argv[1]); i++){
25: c7 45 f4 01 00 00 00 movl $0x1,-0xc(%ebp)
2c: eb 08 jmp 36 <main+0x36>
x++;
2e: 83 45 f0 01 addl $0x1,-0x10(%ebp)
int i;
int x = 0;
if (argc != 2){
exit();
}
for (i = 1; i < atoi(argv[1]); i++){
32: 83 45 f4 01 addl $0x1,-0xc(%ebp)
36: 8b 43 04 mov 0x4(%ebx),%eax
39: 83 c0 04 add $0x4,%eax
3c: 8b 00 mov (%eax),%eax
3e: 83 ec 0c sub $0xc,%esp
41: 50 push %eax
42: e8 ea 01 00 00 call 231 <atoi>
47: 83 c4 10 add $0x10,%esp
4a: 3b 45 f4 cmp -0xc(%ebp),%eax
4d: 7f df jg 2e <main+0x2e>
x++;
}
printf(1, "pid(%d): x = %d\n", getpid(), x);
4f: e8 ef 02 00 00 call 343 <getpid>
54: ff 75 f0 pushl -0x10(%ebp)
57: 50 push %eax
58: 68 f0 07 00 00 push $0x7f0
5d: 6a 01 push $0x1
5f: e8 d6 03 00 00 call 43a <printf>
64: 83 c4 10 add $0x10,%esp
exit();
67: e8 57 02 00 00 call 2c3 <exit>
0000006c <stosb>:
"cc");
}
static inline void
stosb(void *addr, int data, int cnt)
{
6c: 55 push %ebp
6d: 89 e5 mov %esp,%ebp
6f: 57 push %edi
70: 53 push %ebx
asm volatile("cld; rep stosb" :
71: 8b 4d 08 mov 0x8(%ebp),%ecx
74: 8b 55 10 mov 0x10(%ebp),%edx
77: 8b 45 0c mov 0xc(%ebp),%eax
7a: 89 cb mov %ecx,%ebx
7c: 89 df mov %ebx,%edi
7e: 89 d1 mov %edx,%ecx
80: fc cld
81: f3 aa rep stos %al,%es:(%edi)
83: 89 ca mov %ecx,%edx
85: 89 fb mov %edi,%ebx
87: 89 5d 08 mov %ebx,0x8(%ebp)
8a: 89 55 10 mov %edx,0x10(%ebp)
"=D" (addr), "=c" (cnt) :
"0" (addr), "1" (cnt), "a" (data) :
"memory", "cc");
}
8d: 90 nop
8e: 5b pop %ebx
8f: 5f pop %edi
90: 5d pop %ebp
91: c3 ret
00000092 <strcpy>:
#include "user.h"
#include "x86.h"
char*
strcpy(char *s, char *t)
{
92: 55 push %ebp
93: 89 e5 mov %esp,%ebp
95: 83 ec 10 sub $0x10,%esp
char *os;
os = s;
98: 8b 45 08 mov 0x8(%ebp),%eax
9b: 89 45 fc mov %eax,-0x4(%ebp)
while((*s++ = *t++) != 0)
9e: 90 nop
9f: 8b 45 08 mov 0x8(%ebp),%eax
a2: 8d 50 01 lea 0x1(%eax),%edx
a5: 89 55 08 mov %edx,0x8(%ebp)
a8: 8b 55 0c mov 0xc(%ebp),%edx
ab: 8d 4a 01 lea 0x1(%edx),%ecx
ae: 89 4d 0c mov %ecx,0xc(%ebp)
b1: 0f b6 12 movzbl (%edx),%edx
b4: 88 10 mov %dl,(%eax)
b6: 0f b6 00 movzbl (%eax),%eax
b9: 84 c0 test %al,%al
bb: 75 e2 jne 9f <strcpy+0xd>
;
return os;
bd: 8b 45 fc mov -0x4(%ebp),%eax
}
c0: c9 leave
c1: c3 ret
000000c2 <strcmp>:
int
strcmp(const char *p, const char *q)
{
c2: 55 push %ebp
c3: 89 e5 mov %esp,%ebp
while(*p && *p == *q)
c5: eb 08 jmp cf <strcmp+0xd>
p++, q++;
c7: 83 45 08 01 addl $0x1,0x8(%ebp)
cb: 83 45 0c 01 addl $0x1,0xc(%ebp)
}
int
strcmp(const char *p, const char *q)
{
while(*p && *p == *q)
cf: 8b 45 08 mov 0x8(%ebp),%eax
d2: 0f b6 00 movzbl (%eax),%eax
d5: 84 c0 test %al,%al
d7: 74 10 je e9 <strcmp+0x27>
d9: 8b 45 08 mov 0x8(%ebp),%eax
dc: 0f b6 10 movzbl (%eax),%edx
df: 8b 45 0c mov 0xc(%ebp),%eax
e2: 0f b6 00 movzbl (%eax),%eax
e5: 38 c2 cmp %al,%dl
e7: 74 de je c7 <strcmp+0x5>
p++, q++;
return (uchar)*p - (uchar)*q;
e9: 8b 45 08 mov 0x8(%ebp),%eax
ec: 0f b6 00 movzbl (%eax),%eax
ef: 0f b6 d0 movzbl %al,%edx
f2: 8b 45 0c mov 0xc(%ebp),%eax
f5: 0f b6 00 movzbl (%eax),%eax
f8: 0f b6 c0 movzbl %al,%eax
fb: 29 c2 sub %eax,%edx
fd: 89 d0 mov %edx,%eax
}
ff: 5d pop %ebp
100: c3 ret
00000101 <strlen>:
uint
strlen(char *s)
{
101: 55 push %ebp
102: 89 e5 mov %esp,%ebp
104: 83 ec 10 sub $0x10,%esp
int n;
for(n = 0; s[n]; n++)
107: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp)
10e: eb 04 jmp 114 <strlen+0x13>
110: 83 45 fc 01 addl $0x1,-0x4(%ebp)
114: 8b 55 fc mov -0x4(%ebp),%edx
117: 8b 45 08 mov 0x8(%ebp),%eax
11a: 01 d0 add %edx,%eax
11c: 0f b6 00 movzbl (%eax),%eax
11f: 84 c0 test %al,%al
121: 75 ed jne 110 <strlen+0xf>
;
return n;
123: 8b 45 fc mov -0x4(%ebp),%eax
}
126: c9 leave
127: c3 ret
00000128 <memset>:
void*
memset(void *dst, int c, uint n)
{
128: 55 push %ebp
129: 89 e5 mov %esp,%ebp
stosb(dst, c, n);
12b: 8b 45 10 mov 0x10(%ebp),%eax
12e: 50 push %eax
12f: ff 75 0c pushl 0xc(%ebp)
132: ff 75 08 pushl 0x8(%ebp)
135: e8 32 ff ff ff call 6c <stosb>
13a: 83 c4 0c add $0xc,%esp
return dst;
13d: 8b 45 08 mov 0x8(%ebp),%eax
}
140: c9 leave
141: c3 ret
00000142 <strchr>:
char*
strchr(const char *s, char c)
{
142: 55 push %ebp
143: 89 e5 mov %esp,%ebp
145: 83 ec 04 sub $0x4,%esp
148: 8b 45 0c mov 0xc(%ebp),%eax
14b: 88 45 fc mov %al,-0x4(%ebp)
for(; *s; s++)
14e: eb 14 jmp 164 <strchr+0x22>
if(*s == c)
150: 8b 45 08 mov 0x8(%ebp),%eax
153: 0f b6 00 movzbl (%eax),%eax
156: 3a 45 fc cmp -0x4(%ebp),%al
159: 75 05 jne 160 <strchr+0x1e>
return (char*)s;
15b: 8b 45 08 mov 0x8(%ebp),%eax
15e: eb 13 jmp 173 <strchr+0x31>
}
char*
strchr(const char *s, char c)
{
for(; *s; s++)
160: 83 45 08 01 addl $0x1,0x8(%ebp)
164: 8b 45 08 mov 0x8(%ebp),%eax
167: 0f b6 00 movzbl (%eax),%eax
16a: 84 c0 test %al,%al
16c: 75 e2 jne 150 <strchr+0xe>
if(*s == c)
return (char*)s;
return 0;
16e: b8 00 00 00 00 mov $0x0,%eax
}
173: c9 leave
174: c3 ret
00000175 <gets>:
char*
gets(char *buf, int max)
{
175: 55 push %ebp
176: 89 e5 mov %esp,%ebp
178: 83 ec 18 sub $0x18,%esp
int i, cc;
char c;
for(i=0; i+1 < max; ){
17b: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
182: eb 42 jmp 1c6 <gets+0x51>
cc = read(0, &c, 1);
184: 83 ec 04 sub $0x4,%esp
187: 6a 01 push $0x1
189: 8d 45 ef lea -0x11(%ebp),%eax
18c: 50 push %eax
18d: 6a 00 push $0x0
18f: e8 47 01 00 00 call 2db <read>
194: 83 c4 10 add $0x10,%esp
197: 89 45 f0 mov %eax,-0x10(%ebp)
if(cc < 1)
19a: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
19e: 7e 33 jle 1d3 <gets+0x5e>
break;
buf[i++] = c;
1a0: 8b 45 f4 mov -0xc(%ebp),%eax
1a3: 8d 50 01 lea 0x1(%eax),%edx
1a6: 89 55 f4 mov %edx,-0xc(%ebp)
1a9: 89 c2 mov %eax,%edx
1ab: 8b 45 08 mov 0x8(%ebp),%eax
1ae: 01 c2 add %eax,%edx
1b0: 0f b6 45 ef movzbl -0x11(%ebp),%eax
1b4: 88 02 mov %al,(%edx)
if(c == '\n' || c == '\r')
1b6: 0f b6 45 ef movzbl -0x11(%ebp),%eax
1ba: 3c 0a cmp $0xa,%al
1bc: 74 16 je 1d4 <gets+0x5f>
1be: 0f b6 45 ef movzbl -0x11(%ebp),%eax
1c2: 3c 0d cmp $0xd,%al
1c4: 74 0e je 1d4 <gets+0x5f>
gets(char *buf, int max)
{
int i, cc;
char c;
for(i=0; i+1 < max; ){
1c6: 8b 45 f4 mov -0xc(%ebp),%eax
1c9: 83 c0 01 add $0x1,%eax
1cc: 3b 45 0c cmp 0xc(%ebp),%eax
1cf: 7c b3 jl 184 <gets+0xf>
1d1: eb 01 jmp 1d4 <gets+0x5f>
cc = read(0, &c, 1);
if(cc < 1)
break;
1d3: 90 nop
buf[i++] = c;
if(c == '\n' || c == '\r')
break;
}
buf[i] = '\0';
1d4: 8b 55 f4 mov -0xc(%ebp),%edx
1d7: 8b 45 08 mov 0x8(%ebp),%eax
1da: 01 d0 add %edx,%eax
1dc: c6 00 00 movb $0x0,(%eax)
return buf;
1df: 8b 45 08 mov 0x8(%ebp),%eax
}
1e2: c9 leave
1e3: c3 ret
000001e4 <stat>:
int
stat(char *n, struct stat *st)
{
1e4: 55 push %ebp
1e5: 89 e5 mov %esp,%ebp
1e7: 83 ec 18 sub $0x18,%esp
int fd;
int r;
fd = open(n, O_RDONLY);
1ea: 83 ec 08 sub $0x8,%esp
1ed: 6a 00 push $0x0
1ef: ff 75 08 pushl 0x8(%ebp)
1f2: e8 0c 01 00 00 call 303 <open>
1f7: 83 c4 10 add $0x10,%esp
1fa: 89 45 f4 mov %eax,-0xc(%ebp)
if(fd < 0)
1fd: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
201: 79 07 jns 20a <stat+0x26>
return -1;
203: b8 ff ff ff ff mov $0xffffffff,%eax
208: eb 25 jmp 22f <stat+0x4b>
r = fstat(fd, st);
20a: 83 ec 08 sub $0x8,%esp
20d: ff 75 0c pushl 0xc(%ebp)
210: ff 75 f4 pushl -0xc(%ebp)
213: e8 03 01 00 00 call 31b <fstat>
218: 83 c4 10 add $0x10,%esp
21b: 89 45 f0 mov %eax,-0x10(%ebp)
close(fd);
21e: 83 ec 0c sub $0xc,%esp
221: ff 75 f4 pushl -0xc(%ebp)
224: e8 c2 00 00 00 call 2eb <close>
229: 83 c4 10 add $0x10,%esp
return r;
22c: 8b 45 f0 mov -0x10(%ebp),%eax
}
22f: c9 leave
230: c3 ret
00000231 <atoi>:
int
atoi(const char *s)
{
231: 55 push %ebp
232: 89 e5 mov %esp,%ebp
234: 83 ec 10 sub $0x10,%esp
int n;
n = 0;
237: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp)
while('0' <= *s && *s <= '9')
23e: eb 25 jmp 265 <atoi+0x34>
n = n*10 + *s++ - '0';
240: 8b 55 fc mov -0x4(%ebp),%edx
243: 89 d0 mov %edx,%eax
245: c1 e0 02 shl $0x2,%eax
248: 01 d0 add %edx,%eax
24a: 01 c0 add %eax,%eax
24c: 89 c1 mov %eax,%ecx
24e: 8b 45 08 mov 0x8(%ebp),%eax
251: 8d 50 01 lea 0x1(%eax),%edx
254: 89 55 08 mov %edx,0x8(%ebp)
257: 0f b6 00 movzbl (%eax),%eax
25a: 0f be c0 movsbl %al,%eax
25d: 01 c8 add %ecx,%eax
25f: 83 e8 30 sub $0x30,%eax
262: 89 45 fc mov %eax,-0x4(%ebp)
atoi(const char *s)
{
int n;
n = 0;
while('0' <= *s && *s <= '9')
265: 8b 45 08 mov 0x8(%ebp),%eax
268: 0f b6 00 movzbl (%eax),%eax
26b: 3c 2f cmp $0x2f,%al
26d: 7e 0a jle 279 <atoi+0x48>
26f: 8b 45 08 mov 0x8(%ebp),%eax
272: 0f b6 00 movzbl (%eax),%eax
275: 3c 39 cmp $0x39,%al
277: 7e c7 jle 240 <atoi+0xf>
n = n*10 + *s++ - '0';
return n;
279: 8b 45 fc mov -0x4(%ebp),%eax
}
27c: c9 leave
27d: c3 ret
0000027e <memmove>:
void*
memmove(void *vdst, void *vsrc, int n)
{
27e: 55 push %ebp
27f: 89 e5 mov %esp,%ebp
281: 83 ec 10 sub $0x10,%esp
char *dst, *src;
dst = vdst;
284: 8b 45 08 mov 0x8(%ebp),%eax
287: 89 45 fc mov %eax,-0x4(%ebp)
src = vsrc;
28a: 8b 45 0c mov 0xc(%ebp),%eax
28d: 89 45 f8 mov %eax,-0x8(%ebp)
while(n-- > 0)
290: eb 17 jmp 2a9 <memmove+0x2b>
*dst++ = *src++;
292: 8b 45 fc mov -0x4(%ebp),%eax
295: 8d 50 01 lea 0x1(%eax),%edx
298: 89 55 fc mov %edx,-0x4(%ebp)
29b: 8b 55 f8 mov -0x8(%ebp),%edx
29e: 8d 4a 01 lea 0x1(%edx),%ecx
2a1: 89 4d f8 mov %ecx,-0x8(%ebp)
2a4: 0f b6 12 movzbl (%edx),%edx
2a7: 88 10 mov %dl,(%eax)
{
char *dst, *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
2a9: 8b 45 10 mov 0x10(%ebp),%eax
2ac: 8d 50 ff lea -0x1(%eax),%edx
2af: 89 55 10 mov %edx,0x10(%ebp)
2b2: 85 c0 test %eax,%eax
2b4: 7f dc jg 292 <memmove+0x14>
*dst++ = *src++;
return vdst;
2b6: 8b 45 08 mov 0x8(%ebp),%eax
}
2b9: c9 leave
2ba: c3 ret
000002bb <fork>:
name: \
movl $SYS_ ## name, %eax; \
int $T_SYSCALL; \
ret
SYSCALL(fork)
2bb: b8 01 00 00 00 mov $0x1,%eax
2c0: cd 40 int $0x40
2c2: c3 ret
000002c3 <exit>:
SYSCALL(exit)
2c3: b8 02 00 00 00 mov $0x2,%eax
2c8: cd 40 int $0x40
2ca: c3 ret
000002cb <wait>:
SYSCALL(wait)
2cb: b8 03 00 00 00 mov $0x3,%eax
2d0: cd 40 int $0x40
2d2: c3 ret
000002d3 <pipe>:
SYSCALL(pipe)
2d3: b8 04 00 00 00 mov $0x4,%eax
2d8: cd 40 int $0x40
2da: c3 ret
000002db <read>:
SYSCALL(read)
2db: b8 05 00 00 00 mov $0x5,%eax
2e0: cd 40 int $0x40
2e2: c3 ret
000002e3 <write>:
SYSCALL(write)
2e3: b8 10 00 00 00 mov $0x10,%eax
2e8: cd 40 int $0x40
2ea: c3 ret
000002eb <close>:
SYSCALL(close)
2eb: b8 15 00 00 00 mov $0x15,%eax
2f0: cd 40 int $0x40
2f2: c3 ret
000002f3 <kill>:
SYSCALL(kill)
2f3: b8 06 00 00 00 mov $0x6,%eax
2f8: cd 40 int $0x40
2fa: c3 ret
000002fb <exec>:
SYSCALL(exec)
2fb: b8 07 00 00 00 mov $0x7,%eax
300: cd 40 int $0x40
302: c3 ret
00000303 <open>:
SYSCALL(open)
303: b8 0f 00 00 00 mov $0xf,%eax
308: cd 40 int $0x40
30a: c3 ret
0000030b <mknod>:
SYSCALL(mknod)
30b: b8 11 00 00 00 mov $0x11,%eax
310: cd 40 int $0x40
312: c3 ret
00000313 <unlink>:
SYSCALL(unlink)
313: b8 12 00 00 00 mov $0x12,%eax
318: cd 40 int $0x40
31a: c3 ret
0000031b <fstat>:
SYSCALL(fstat)
31b: b8 08 00 00 00 mov $0x8,%eax
320: cd 40 int $0x40
322: c3 ret
00000323 <link>:
SYSCALL(link)
323: b8 13 00 00 00 mov $0x13,%eax
328: cd 40 int $0x40
32a: c3 ret
0000032b <mkdir>:
SYSCALL(mkdir)
32b: b8 14 00 00 00 mov $0x14,%eax
330: cd 40 int $0x40
332: c3 ret
00000333 <chdir>:
SYSCALL(chdir)
333: b8 09 00 00 00 mov $0x9,%eax
338: cd 40 int $0x40
33a: c3 ret
0000033b <dup>:
SYSCALL(dup)
33b: b8 0a 00 00 00 mov $0xa,%eax
340: cd 40 int $0x40
342: c3 ret
00000343 <getpid>:
SYSCALL(getpid)
343: b8 0b 00 00 00 mov $0xb,%eax
348: cd 40 int $0x40
34a: c3 ret
0000034b <sbrk>:
SYSCALL(sbrk)
34b: b8 0c 00 00 00 mov $0xc,%eax
350: cd 40 int $0x40
352: c3 ret
00000353 <sleep>:
SYSCALL(sleep)
353: b8 0d 00 00 00 mov $0xd,%eax
358: cd 40 int $0x40
35a: c3 ret
0000035b <uptime>:
SYSCALL(uptime)
35b: b8 0e 00 00 00 mov $0xe,%eax
360: cd 40 int $0x40
362: c3 ret
00000363 <putc>:
#include "stat.h"
#include "user.h"
static void
putc(int fd, char c)
{
363: 55 push %ebp
364: 89 e5 mov %esp,%ebp
366: 83 ec 18 sub $0x18,%esp
369: 8b 45 0c mov 0xc(%ebp),%eax
36c: 88 45 f4 mov %al,-0xc(%ebp)
write(fd, &c, 1);
36f: 83 ec 04 sub $0x4,%esp
372: 6a 01 push $0x1
374: 8d 45 f4 lea -0xc(%ebp),%eax
377: 50 push %eax
378: ff 75 08 pushl 0x8(%ebp)
37b: e8 63 ff ff ff call 2e3 <write>
380: 83 c4 10 add $0x10,%esp
}
383: 90 nop
384: c9 leave
385: c3 ret
00000386 <printint>:
static void
printint(int fd, int xx, int base, int sgn)
{
386: 55 push %ebp
387: 89 e5 mov %esp,%ebp
389: 53 push %ebx
38a: 83 ec 24 sub $0x24,%esp
static char digits[] = "0123456789ABCDEF";
char buf[16];
int i, neg;
uint x;
neg = 0;
38d: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
if(sgn && xx < 0){
394: 83 7d 14 00 cmpl $0x0,0x14(%ebp)
398: 74 17 je 3b1 <printint+0x2b>
39a: 83 7d 0c 00 cmpl $0x0,0xc(%ebp)
39e: 79 11 jns 3b1 <printint+0x2b>
neg = 1;
3a0: c7 45 f0 01 00 00 00 movl $0x1,-0x10(%ebp)
x = -xx;
3a7: 8b 45 0c mov 0xc(%ebp),%eax
3aa: f7 d8 neg %eax
3ac: 89 45 ec mov %eax,-0x14(%ebp)
3af: eb 06 jmp 3b7 <printint+0x31>
} else {
x = xx;
3b1: 8b 45 0c mov 0xc(%ebp),%eax
3b4: 89 45 ec mov %eax,-0x14(%ebp)
}
i = 0;
3b7: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
do{
buf[i++] = digits[x % base];
3be: 8b 4d f4 mov -0xc(%ebp),%ecx
3c1: 8d 41 01 lea 0x1(%ecx),%eax
3c4: 89 45 f4 mov %eax,-0xc(%ebp)
3c7: 8b 5d 10 mov 0x10(%ebp),%ebx
3ca: 8b 45 ec mov -0x14(%ebp),%eax
3cd: ba 00 00 00 00 mov $0x0,%edx
3d2: f7 f3 div %ebx
3d4: 89 d0 mov %edx,%eax
3d6: 0f b6 80 54 0a 00 00 movzbl 0xa54(%eax),%eax
3dd: 88 44 0d dc mov %al,-0x24(%ebp,%ecx,1)
}while((x /= base) != 0);
3e1: 8b 5d 10 mov 0x10(%ebp),%ebx
3e4: 8b 45 ec mov -0x14(%ebp),%eax
3e7: ba 00 00 00 00 mov $0x0,%edx
3ec: f7 f3 div %ebx
3ee: 89 45 ec mov %eax,-0x14(%ebp)
3f1: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
3f5: 75 c7 jne 3be <printint+0x38>
if(neg)
3f7: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
3fb: 74 2d je 42a <printint+0xa4>
buf[i++] = '-';
3fd: 8b 45 f4 mov -0xc(%ebp),%eax
400: 8d 50 01 lea 0x1(%eax),%edx
403: 89 55 f4 mov %edx,-0xc(%ebp)
406: c6 44 05 dc 2d movb $0x2d,-0x24(%ebp,%eax,1)
while(--i >= 0)
40b: eb 1d jmp 42a <printint+0xa4>
putc(fd, buf[i]);
40d: 8d 55 dc lea -0x24(%ebp),%edx
410: 8b 45 f4 mov -0xc(%ebp),%eax
413: 01 d0 add %edx,%eax
415: 0f b6 00 movzbl (%eax),%eax
418: 0f be c0 movsbl %al,%eax
41b: 83 ec 08 sub $0x8,%esp
41e: 50 push %eax
41f: ff 75 08 pushl 0x8(%ebp)
422: e8 3c ff ff ff call 363 <putc>
427: 83 c4 10 add $0x10,%esp
buf[i++] = digits[x % base];
}while((x /= base) != 0);
if(neg)
buf[i++] = '-';
while(--i >= 0)
42a: 83 6d f4 01 subl $0x1,-0xc(%ebp)
42e: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
432: 79 d9 jns 40d <printint+0x87>
putc(fd, buf[i]);
}
434: 90 nop
435: 8b 5d fc mov -0x4(%ebp),%ebx
438: c9 leave
439: c3 ret
0000043a <printf>:
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, char *fmt, ...)
{
43a: 55 push %ebp
43b: 89 e5 mov %esp,%ebp
43d: 83 ec 28 sub $0x28,%esp
char *s;
int c, i, state;
uint *ap;
state = 0;
440: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp)
ap = (uint*)(void*)&fmt + 1;
447: 8d 45 0c lea 0xc(%ebp),%eax
44a: 83 c0 04 add $0x4,%eax
44d: 89 45 e8 mov %eax,-0x18(%ebp)
for(i = 0; fmt[i]; i++){
450: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
457: e9 59 01 00 00 jmp 5b5 <printf+0x17b>
c = fmt[i] & 0xff;
45c: 8b 55 0c mov 0xc(%ebp),%edx
45f: 8b 45 f0 mov -0x10(%ebp),%eax
462: 01 d0 add %edx,%eax
464: 0f b6 00 movzbl (%eax),%eax
467: 0f be c0 movsbl %al,%eax
46a: 25 ff 00 00 00 and $0xff,%eax
46f: 89 45 e4 mov %eax,-0x1c(%ebp)
if(state == 0){
472: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
476: 75 2c jne 4a4 <printf+0x6a>
if(c == '%'){
478: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp)
47c: 75 0c jne 48a <printf+0x50>
state = '%';
47e: c7 45 ec 25 00 00 00 movl $0x25,-0x14(%ebp)
485: e9 27 01 00 00 jmp 5b1 <printf+0x177>
} else {
putc(fd, c);
48a: 8b 45 e4 mov -0x1c(%ebp),%eax
48d: 0f be c0 movsbl %al,%eax
490: 83 ec 08 sub $0x8,%esp
493: 50 push %eax
494: ff 75 08 pushl 0x8(%ebp)
497: e8 c7 fe ff ff call 363 <putc>
49c: 83 c4 10 add $0x10,%esp
49f: e9 0d 01 00 00 jmp 5b1 <printf+0x177>
}
} else if(state == '%'){
4a4: 83 7d ec 25 cmpl $0x25,-0x14(%ebp)
4a8: 0f 85 03 01 00 00 jne 5b1 <printf+0x177>
if(c == 'd'){
4ae: 83 7d e4 64 cmpl $0x64,-0x1c(%ebp)
4b2: 75 1e jne 4d2 <printf+0x98>
printint(fd, *ap, 10, 1);
4b4: 8b 45 e8 mov -0x18(%ebp),%eax
4b7: 8b 00 mov (%eax),%eax
4b9: 6a 01 push $0x1
4bb: 6a 0a push $0xa
4bd: 50 push %eax
4be: ff 75 08 pushl 0x8(%ebp)
4c1: e8 c0 fe ff ff call 386 <printint>
4c6: 83 c4 10 add $0x10,%esp
ap++;
4c9: 83 45 e8 04 addl $0x4,-0x18(%ebp)
4cd: e9 d8 00 00 00 jmp 5aa <printf+0x170>
} else if(c == 'x' || c == 'p'){
4d2: 83 7d e4 78 cmpl $0x78,-0x1c(%ebp)
4d6: 74 06 je 4de <printf+0xa4>
4d8: 83 7d e4 70 cmpl $0x70,-0x1c(%ebp)
4dc: 75 1e jne 4fc <printf+0xc2>
printint(fd, *ap, 16, 0);
4de: 8b 45 e8 mov -0x18(%ebp),%eax
4e1: 8b 00 mov (%eax),%eax
4e3: 6a 00 push $0x0
4e5: 6a 10 push $0x10
4e7: 50 push %eax
4e8: ff 75 08 pushl 0x8(%ebp)
4eb: e8 96 fe ff ff call 386 <printint>
4f0: 83 c4 10 add $0x10,%esp
ap++;
4f3: 83 45 e8 04 addl $0x4,-0x18(%ebp)
4f7: e9 ae 00 00 00 jmp 5aa <printf+0x170>
} else if(c == 's'){
4fc: 83 7d e4 73 cmpl $0x73,-0x1c(%ebp)
500: 75 43 jne 545 <printf+0x10b>
s = (char*)*ap;
502: 8b 45 e8 mov -0x18(%ebp),%eax
505: 8b 00 mov (%eax),%eax
507: 89 45 f4 mov %eax,-0xc(%ebp)
ap++;
50a: 83 45 e8 04 addl $0x4,-0x18(%ebp)
if(s == 0)
50e: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
512: 75 25 jne 539 <printf+0xff>
s = "(null)";
514: c7 45 f4 01 08 00 00 movl $0x801,-0xc(%ebp)
while(*s != 0){
51b: eb 1c jmp 539 <printf+0xff>
putc(fd, *s);
51d: 8b 45 f4 mov -0xc(%ebp),%eax
520: 0f b6 00 movzbl (%eax),%eax
523: 0f be c0 movsbl %al,%eax
526: 83 ec 08 sub $0x8,%esp
529: 50 push %eax
52a: ff 75 08 pushl 0x8(%ebp)
52d: e8 31 fe ff ff call 363 <putc>
532: 83 c4 10 add $0x10,%esp
s++;
535: 83 45 f4 01 addl $0x1,-0xc(%ebp)
} else if(c == 's'){
s = (char*)*ap;
ap++;
if(s == 0)
s = "(null)";
while(*s != 0){
539: 8b 45 f4 mov -0xc(%ebp),%eax
53c: 0f b6 00 movzbl (%eax),%eax
53f: 84 c0 test %al,%al
541: 75 da jne 51d <printf+0xe3>
543: eb 65 jmp 5aa <printf+0x170>
putc(fd, *s);
s++;
}
} else if(c == 'c'){
545: 83 7d e4 63 cmpl $0x63,-0x1c(%ebp)
549: 75 1d jne 568 <printf+0x12e>
putc(fd, *ap);
54b: 8b 45 e8 mov -0x18(%ebp),%eax
54e: 8b 00 mov (%eax),%eax
550: 0f be c0 movsbl %al,%eax
553: 83 ec 08 sub $0x8,%esp
556: 50 push %eax
557: ff 75 08 pushl 0x8(%ebp)
55a: e8 04 fe ff ff call 363 <putc>
55f: 83 c4 10 add $0x10,%esp
ap++;
562: 83 45 e8 04 addl $0x4,-0x18(%ebp)
566: eb 42 jmp 5aa <printf+0x170>
} else if(c == '%'){
568: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp)
56c: 75 17 jne 585 <printf+0x14b>
putc(fd, c);
56e: 8b 45 e4 mov -0x1c(%ebp),%eax
571: 0f be c0 movsbl %al,%eax
574: 83 ec 08 sub $0x8,%esp
577: 50 push %eax
578: ff 75 08 pushl 0x8(%ebp)
57b: e8 e3 fd ff ff call 363 <putc>
580: 83 c4 10 add $0x10,%esp
583: eb 25 jmp 5aa <printf+0x170>
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
585: 83 ec 08 sub $0x8,%esp
588: 6a 25 push $0x25
58a: ff 75 08 pushl 0x8(%ebp)
58d: e8 d1 fd ff ff call 363 <putc>
592: 83 c4 10 add $0x10,%esp
putc(fd, c);
595: 8b 45 e4 mov -0x1c(%ebp),%eax
598: 0f be c0 movsbl %al,%eax
59b: 83 ec 08 sub $0x8,%esp
59e: 50 push %eax
59f: ff 75 08 pushl 0x8(%ebp)
5a2: e8 bc fd ff ff call 363 <putc>
5a7: 83 c4 10 add $0x10,%esp
}
state = 0;
5aa: 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++){
5b1: 83 45 f0 01 addl $0x1,-0x10(%ebp)
5b5: 8b 55 0c mov 0xc(%ebp),%edx
5b8: 8b 45 f0 mov -0x10(%ebp),%eax
5bb: 01 d0 add %edx,%eax
5bd: 0f b6 00 movzbl (%eax),%eax
5c0: 84 c0 test %al,%al
5c2: 0f 85 94 fe ff ff jne 45c <printf+0x22>
putc(fd, c);
}
state = 0;
}
}
}
5c8: 90 nop
5c9: c9 leave
5ca: c3 ret
000005cb <free>:
static Header base;
static Header *freep;
void
free(void *ap)
{
5cb: 55 push %ebp
5cc: 89 e5 mov %esp,%ebp
5ce: 83 ec 10 sub $0x10,%esp
Header *bp, *p;
bp = (Header*)ap - 1;
5d1: 8b 45 08 mov 0x8(%ebp),%eax
5d4: 83 e8 08 sub $0x8,%eax
5d7: 89 45 f8 mov %eax,-0x8(%ebp)
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
5da: a1 70 0a 00 00 mov 0xa70,%eax
5df: 89 45 fc mov %eax,-0x4(%ebp)
5e2: eb 24 jmp 608 <free+0x3d>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
5e4: 8b 45 fc mov -0x4(%ebp),%eax
5e7: 8b 00 mov (%eax),%eax
5e9: 3b 45 fc cmp -0x4(%ebp),%eax
5ec: 77 12 ja 600 <free+0x35>
5ee: 8b 45 f8 mov -0x8(%ebp),%eax
5f1: 3b 45 fc cmp -0x4(%ebp),%eax
5f4: 77 24 ja 61a <free+0x4f>
5f6: 8b 45 fc mov -0x4(%ebp),%eax
5f9: 8b 00 mov (%eax),%eax
5fb: 3b 45 f8 cmp -0x8(%ebp),%eax
5fe: 77 1a ja 61a <free+0x4f>
free(void *ap)
{
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
600: 8b 45 fc mov -0x4(%ebp),%eax
603: 8b 00 mov (%eax),%eax
605: 89 45 fc mov %eax,-0x4(%ebp)
608: 8b 45 f8 mov -0x8(%ebp),%eax
60b: 3b 45 fc cmp -0x4(%ebp),%eax
60e: 76 d4 jbe 5e4 <free+0x19>
610: 8b 45 fc mov -0x4(%ebp),%eax
613: 8b 00 mov (%eax),%eax
615: 3b 45 f8 cmp -0x8(%ebp),%eax
618: 76 ca jbe 5e4 <free+0x19>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
break;
if(bp + bp->s.size == p->s.ptr){
61a: 8b 45 f8 mov -0x8(%ebp),%eax
61d: 8b 40 04 mov 0x4(%eax),%eax
620: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx
627: 8b 45 f8 mov -0x8(%ebp),%eax
62a: 01 c2 add %eax,%edx
62c: 8b 45 fc mov -0x4(%ebp),%eax
62f: 8b 00 mov (%eax),%eax
631: 39 c2 cmp %eax,%edx
633: 75 24 jne 659 <free+0x8e>
bp->s.size += p->s.ptr->s.size;
635: 8b 45 f8 mov -0x8(%ebp),%eax
638: 8b 50 04 mov 0x4(%eax),%edx
63b: 8b 45 fc mov -0x4(%ebp),%eax
63e: 8b 00 mov (%eax),%eax
640: 8b 40 04 mov 0x4(%eax),%eax
643: 01 c2 add %eax,%edx
645: 8b 45 f8 mov -0x8(%ebp),%eax
648: 89 50 04 mov %edx,0x4(%eax)
bp->s.ptr = p->s.ptr->s.ptr;
64b: 8b 45 fc mov -0x4(%ebp),%eax
64e: 8b 00 mov (%eax),%eax
650: 8b 10 mov (%eax),%edx
652: 8b 45 f8 mov -0x8(%ebp),%eax
655: 89 10 mov %edx,(%eax)
657: eb 0a jmp 663 <free+0x98>
} else
bp->s.ptr = p->s.ptr;
659: 8b 45 fc mov -0x4(%ebp),%eax
65c: 8b 10 mov (%eax),%edx
65e: 8b 45 f8 mov -0x8(%ebp),%eax
661: 89 10 mov %edx,(%eax)
if(p + p->s.size == bp){
663: 8b 45 fc mov -0x4(%ebp),%eax
666: 8b 40 04 mov 0x4(%eax),%eax
669: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx
670: 8b 45 fc mov -0x4(%ebp),%eax
673: 01 d0 add %edx,%eax
675: 3b 45 f8 cmp -0x8(%ebp),%eax
678: 75 20 jne 69a <free+0xcf>
p->s.size += bp->s.size;
67a: 8b 45 fc mov -0x4(%ebp),%eax
67d: 8b 50 04 mov 0x4(%eax),%edx
680: 8b 45 f8 mov -0x8(%ebp),%eax
683: 8b 40 04 mov 0x4(%eax),%eax
686: 01 c2 add %eax,%edx
688: 8b 45 fc mov -0x4(%ebp),%eax
68b: 89 50 04 mov %edx,0x4(%eax)
p->s.ptr = bp->s.ptr;
68e: 8b 45 f8 mov -0x8(%ebp),%eax
691: 8b 10 mov (%eax),%edx
693: 8b 45 fc mov -0x4(%ebp),%eax
696: 89 10 mov %edx,(%eax)
698: eb 08 jmp 6a2 <free+0xd7>
} else
p->s.ptr = bp;
69a: 8b 45 fc mov -0x4(%ebp),%eax
69d: 8b 55 f8 mov -0x8(%ebp),%edx
6a0: 89 10 mov %edx,(%eax)
freep = p;
6a2: 8b 45 fc mov -0x4(%ebp),%eax
6a5: a3 70 0a 00 00 mov %eax,0xa70
}
6aa: 90 nop
6ab: c9 leave
6ac: c3 ret
000006ad <morecore>:
static Header*
morecore(uint nu)
{
6ad: 55 push %ebp
6ae: 89 e5 mov %esp,%ebp
6b0: 83 ec 18 sub $0x18,%esp
char *p;
Header *hp;
if(nu < 4096)
6b3: 81 7d 08 ff 0f 00 00 cmpl $0xfff,0x8(%ebp)
6ba: 77 07 ja 6c3 <morecore+0x16>
nu = 4096;
6bc: c7 45 08 00 10 00 00 movl $0x1000,0x8(%ebp)
p = sbrk(nu * sizeof(Header));
6c3: 8b 45 08 mov 0x8(%ebp),%eax
6c6: c1 e0 03 shl $0x3,%eax
6c9: 83 ec 0c sub $0xc,%esp
6cc: 50 push %eax
6cd: e8 79 fc ff ff call 34b <sbrk>
6d2: 83 c4 10 add $0x10,%esp
6d5: 89 45 f4 mov %eax,-0xc(%ebp)
if(p == (char*)-1)
6d8: 83 7d f4 ff cmpl $0xffffffff,-0xc(%ebp)
6dc: 75 07 jne 6e5 <morecore+0x38>
return 0;
6de: b8 00 00 00 00 mov $0x0,%eax
6e3: eb 26 jmp 70b <morecore+0x5e>
hp = (Header*)p;
6e5: 8b 45 f4 mov -0xc(%ebp),%eax
6e8: 89 45 f0 mov %eax,-0x10(%ebp)
hp->s.size = nu;
6eb: 8b 45 f0 mov -0x10(%ebp),%eax
6ee: 8b 55 08 mov 0x8(%ebp),%edx
6f1: 89 50 04 mov %edx,0x4(%eax)
free((void*)(hp + 1));
6f4: 8b 45 f0 mov -0x10(%ebp),%eax
6f7: 83 c0 08 add $0x8,%eax
6fa: 83 ec 0c sub $0xc,%esp
6fd: 50 push %eax
6fe: e8 c8 fe ff ff call 5cb <free>
703: 83 c4 10 add $0x10,%esp
return freep;
706: a1 70 0a 00 00 mov 0xa70,%eax
}
70b: c9 leave
70c: c3 ret
0000070d <malloc>:
void*
malloc(uint nbytes)
{
70d: 55 push %ebp
70e: 89 e5 mov %esp,%ebp
710: 83 ec 18 sub $0x18,%esp
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
713: 8b 45 08 mov 0x8(%ebp),%eax
716: 83 c0 07 add $0x7,%eax
719: c1 e8 03 shr $0x3,%eax
71c: 83 c0 01 add $0x1,%eax
71f: 89 45 ec mov %eax,-0x14(%ebp)
if((prevp = freep) == 0){
722: a1 70 0a 00 00 mov 0xa70,%eax
727: 89 45 f0 mov %eax,-0x10(%ebp)
72a: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
72e: 75 23 jne 753 <malloc+0x46>
base.s.ptr = freep = prevp = &base;
730: c7 45 f0 68 0a 00 00 movl $0xa68,-0x10(%ebp)
737: 8b 45 f0 mov -0x10(%ebp),%eax
73a: a3 70 0a 00 00 mov %eax,0xa70
73f: a1 70 0a 00 00 mov 0xa70,%eax
744: a3 68 0a 00 00 mov %eax,0xa68
base.s.size = 0;
749: c7 05 6c 0a 00 00 00 movl $0x0,0xa6c
750: 00 00 00
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
753: 8b 45 f0 mov -0x10(%ebp),%eax
756: 8b 00 mov (%eax),%eax
758: 89 45 f4 mov %eax,-0xc(%ebp)
if(p->s.size >= nunits){
75b: 8b 45 f4 mov -0xc(%ebp),%eax
75e: 8b 40 04 mov 0x4(%eax),%eax
761: 3b 45 ec cmp -0x14(%ebp),%eax
764: 72 4d jb 7b3 <malloc+0xa6>
if(p->s.size == nunits)
766: 8b 45 f4 mov -0xc(%ebp),%eax
769: 8b 40 04 mov 0x4(%eax),%eax
76c: 3b 45 ec cmp -0x14(%ebp),%eax
76f: 75 0c jne 77d <malloc+0x70>
prevp->s.ptr = p->s.ptr;
771: 8b 45 f4 mov -0xc(%ebp),%eax
774: 8b 10 mov (%eax),%edx
776: 8b 45 f0 mov -0x10(%ebp),%eax
779: 89 10 mov %edx,(%eax)
77b: eb 26 jmp 7a3 <malloc+0x96>
else {
p->s.size -= nunits;
77d: 8b 45 f4 mov -0xc(%ebp),%eax
780: 8b 40 04 mov 0x4(%eax),%eax
783: 2b 45 ec sub -0x14(%ebp),%eax
786: 89 c2 mov %eax,%edx
788: 8b 45 f4 mov -0xc(%ebp),%eax
78b: 89 50 04 mov %edx,0x4(%eax)
p += p->s.size;
78e: 8b 45 f4 mov -0xc(%ebp),%eax
791: 8b 40 04 mov 0x4(%eax),%eax
794: c1 e0 03 shl $0x3,%eax
797: 01 45 f4 add %eax,-0xc(%ebp)
p->s.size = nunits;
79a: 8b 45 f4 mov -0xc(%ebp),%eax
79d: 8b 55 ec mov -0x14(%ebp),%edx
7a0: 89 50 04 mov %edx,0x4(%eax)
}
freep = prevp;
7a3: 8b 45 f0 mov -0x10(%ebp),%eax
7a6: a3 70 0a 00 00 mov %eax,0xa70
return (void*)(p + 1);
7ab: 8b 45 f4 mov -0xc(%ebp),%eax
7ae: 83 c0 08 add $0x8,%eax
7b1: eb 3b jmp 7ee <malloc+0xe1>
}
if(p == freep)
7b3: a1 70 0a 00 00 mov 0xa70,%eax
7b8: 39 45 f4 cmp %eax,-0xc(%ebp)
7bb: 75 1e jne 7db <malloc+0xce>
if((p = morecore(nunits)) == 0)
7bd: 83 ec 0c sub $0xc,%esp
7c0: ff 75 ec pushl -0x14(%ebp)
7c3: e8 e5 fe ff ff call 6ad <morecore>
7c8: 83 c4 10 add $0x10,%esp
7cb: 89 45 f4 mov %eax,-0xc(%ebp)
7ce: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
7d2: 75 07 jne 7db <malloc+0xce>
return 0;
7d4: b8 00 00 00 00 mov $0x0,%eax
7d9: eb 13 jmp 7ee <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){
7db: 8b 45 f4 mov -0xc(%ebp),%eax
7de: 89 45 f0 mov %eax,-0x10(%ebp)
7e1: 8b 45 f4 mov -0xc(%ebp),%eax
7e4: 8b 00 mov (%eax),%eax
7e6: 89 45 f4 mov %eax,-0xc(%ebp)
return (void*)(p + 1);
}
if(p == freep)
if((p = morecore(nunits)) == 0)
return 0;
}
7e9: e9 6d ff ff ff jmp 75b <malloc+0x4e>
}
7ee: c9 leave
7ef: c3 ret
|
; A157757: a(n) = 2809*n^2 - 4618*n + 1898.
; 89,3898,13325,28370,49033,75314,107213,144730,187865,236618,290989,350978,416585,487810,564653,647114,735193,828890,928205,1033138,1143689,1259858,1381645,1509050,1642073,1780714,1924973,2074850,2230345,2391458,2558189,2730538,2908505,3092090,3281293,3476114,3676553,3882610,4094285,4311578,4534489,4763018,4997165,5236930,5482313,5733314,5989933,6252170,6520025,6793498,7072589,7357298,7647625,7943570,8245133,8552314,8865113,9183530,9507565,9837218,10172489,10513378,10859885,11212010,11569753,11933114,12302093,12676690,13056905,13442738,13834189,14231258,14633945,15042250,15456173,15875714,16300873,16731650,17168045,17610058,18057689,18510938,18969805,19434290,19904393,20380114,20861453,21348410,21840985,22339178,22842989,23352418,23867465,24388130,24914413,25446314,25983833,26526970,27075725,27630098,28190089,28755698,29326925,29903770,30486233,31074314,31668013,32267330,32872265,33482818,34098989,34720778,35348185,35981210,36619853,37264114,37913993,38569490,39230605,39897338,40569689,41247658,41931245,42620450,43315273,44015714,44721773,45433450,46150745,46873658,47602189,48336338,49076105,49821490,50572493,51329114,52091353,52859210,53632685,54411778,55196489,55986818,56782765,57584330,58391513,59204314,60022733,60846770,61676425,62511698,63352589,64199098,65051225,65908970,66772333,67641314,68515913,69396130,70281965,71173418,72070489,72973178,73881485,74795410,75714953,76640114,77570893,78507290,79449305,80396938,81350189,82309058,83273545,84243650,85219373,86200714,87187673,88180250,89178445,90182258,91191689,92206738,93227405,94253690,95285593,96323114,97366253,98415010,99469385,100529378,101594989,102666218,103743065,104825530,105913613,107007314,108106633,109211570,110322125,111438298,112560089,113687498,114820525,115959170,117103433,118253314,119408813,120569930,121736665,122909018,124086989,125270578,126459785,127654610,128855053,130061114,131272793,132490090,133713005,134941538,136175689,137415458,138660845,139911850,141168473,142430714,143698573,144972050,146251145,147535858,148826189,150122138,151423705,152730890,154043693,155362114,156686153,158015810,159351085,160691978,162038489,163390618,164748365,166111730,167480713,168855314,170235533,171621370,173012825,174409898
mov $5,$0
mul $0,10
mov $2,$0
mul $2,2
mov $3,$2
add $2,5
add $3,$2
pow $2,2
pow $3,2
add $3,$2
add $3,1
mov $4,$2
add $4,$2
add $4,6
add $4,$3
mov $1,$4
sub $1,18
mov $6,$5
mul $6,$5
mov $7,$6
mul $7,9
add $1,$7
|
;
; Grundy Newbrain Specific libraries
;
; Stefano Bodrato - 19/05/2007
;
;
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
;
; put a byte block to stream, return the number of written bytes
;
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
;
; int nb_putblock( int stream, char *bytes, int length );
;
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
;
;
; $Id: nb_putblock.asm,v 1.3 2007/06/08 15:15:21 stefano Exp $
;
XLIB nb_putblock
LIB ZCALL
.nb_putblock
ld ix,2
add ix,sp
ld e,(ix+4) ; stream
ld c,(ix+0) ; block length
ld b,(ix+1)
ld l,(ix+2) ; block location
ld h,(ix+3)
call ZCALL
defb $3d ; zblkout
ld h,b
ld l,c
ret
|
/*!
* Copyright (c) 2016 Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See LICENSE file in the project root for license information.
*/
#ifdef USE_SOCKET
#include <LightGBM/config.h>
#include <LightGBM/utils/common.h>
#include <LightGBM/utils/text_reader.h>
#include <algorithm>
#include <chrono>
#include <cstring>
#include <string>
#include <thread>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include "linkers.h"
namespace LightGBM {
Linkers::Linkers(Config config) {
is_init_ = false;
// start up socket
TcpSocket::Startup();
network_time_ = std::chrono::duration<double, std::milli>(0);
num_machines_ = config.num_machines;
local_listen_port_ = config.local_listen_port;
socket_timeout_ = config.time_out;
rank_ = -1;
// parse clients from file
ParseMachineList(config.machines, config.machine_list_filename);
if (rank_ == -1) {
// get ip list of local machine
std::unordered_set<std::string> local_ip_list = TcpSocket::GetLocalIpList();
// get local rank
for (size_t i = 0; i < client_ips_.size(); ++i) {
if (local_ip_list.count(client_ips_[i]) > 0 && client_ports_[i] == local_listen_port_) {
rank_ = static_cast<int>(i);
break;
}
}
}
if (rank_ == -1) {
Log::Fatal("Machine list file doesn't contain the local machine");
}
// construct listener
listener_ = std::unique_ptr<TcpSocket>(new TcpSocket());
TryBind(local_listen_port_);
for (int i = 0; i < num_machines_; ++i) {
linkers_.push_back(nullptr);
}
// construct communication topo
bruck_map_ = BruckMap::Construct(rank_, num_machines_);
recursive_halving_map_ = RecursiveHalvingMap::Construct(rank_, num_machines_);
// construct linkers
Construct();
// free listener
listener_->Close();
is_init_ = true;
}
Linkers::~Linkers() {
if (is_init_) {
for (size_t i = 0; i < linkers_.size(); ++i) {
if (linkers_[i] != nullptr) {
linkers_[i]->Close();
}
}
TcpSocket::Finalize();
Log::Info("Finished linking network in %f seconds", network_time_ * 1e-3);
}
}
void Linkers::ParseMachineList(const std::string& machines, const std::string& filename) {
std::vector<std::string> lines;
if (machines.empty()) {
TextReader<size_t> machine_list_reader(filename.c_str(), false);
machine_list_reader.ReadAllLines();
if (machine_list_reader.Lines().empty()) {
Log::Fatal("Machine list file %s doesn't exist", filename.c_str());
}
lines = machine_list_reader.Lines();
} else {
lines = Common::Split(machines.c_str(), ',');
}
for (auto& line : lines) {
line = Common::Trim(line);
if (line.find("rank=") != std::string::npos) {
std::vector<std::string> str_after_split = Common::Split(line.c_str(), '=');
Common::Atoi(str_after_split[1].c_str(), &rank_);
continue;
}
std::vector<std::string> str_after_split = Common::Split(line.c_str(), ' ');
if (str_after_split.size() != 2) {
str_after_split = Common::Split(line.c_str(), ':');
if (str_after_split.size() != 2) {
continue;
}
}
if (client_ips_.size() >= static_cast<size_t>(num_machines_)) {
Log::Warning("machine_list size is larger than the parameter num_machines, ignoring redundant entries");
break;
}
str_after_split[0] = Common::Trim(str_after_split[0]);
str_after_split[1] = Common::Trim(str_after_split[1]);
client_ips_.push_back(str_after_split[0]);
client_ports_.push_back(atoi(str_after_split[1].c_str()));
}
if (client_ips_.empty()) {
Log::Fatal("Cannot find any ip and port.\n"
"Please check machine_list_filename or machines parameter");
}
if (client_ips_.size() != static_cast<size_t>(num_machines_)) {
Log::Warning("World size is larger than the machine_list size, change world size to %d", client_ips_.size());
num_machines_ = static_cast<int>(client_ips_.size());
}
}
void Linkers::TryBind(int port) {
Log::Info("Trying to bind port %d...", port);
if (listener_->Bind(port)) {
Log::Info("Binding port %d succeeded", port);
} else {
Log::Fatal("Binding port %d failed", port);
}
}
void Linkers::SetLinker(int rank, const TcpSocket& socket) {
linkers_[rank].reset(new TcpSocket(socket));
// set timeout
linkers_[rank]->SetTimeout(socket_timeout_ * 1000 * 60);
}
void Linkers::ListenThread(int incoming_cnt) {
Log::Info("Listening...");
char buffer[100];
int connected_cnt = 0;
while (connected_cnt < incoming_cnt) {
// accept incoming socket
TcpSocket handler = listener_->Accept();
if (handler.IsClosed()) {
continue;
}
// receive rank
int read_cnt = 0;
int size_of_int = static_cast<int>(sizeof(int));
while (read_cnt < size_of_int) {
int cur_read_cnt = handler.Recv(buffer + read_cnt, size_of_int - read_cnt);
read_cnt += cur_read_cnt;
}
int* ptr_in_rank = reinterpret_cast<int*>(buffer);
int in_rank = *ptr_in_rank;
// add new socket
SetLinker(in_rank, handler);
++connected_cnt;
}
}
void Linkers::Construct() {
// save ranks that need to connect with
std::unordered_map<int, int> need_connect;
for (int i = 0; i < num_machines_; ++i) {
if (i != rank_) {
need_connect[i] = 1;
}
}
int need_connect_cnt = 0;
int incoming_cnt = 0;
for (auto it = need_connect.begin(); it != need_connect.end(); ++it) {
int machine_rank = it->first;
if (machine_rank >= 0 && machine_rank != rank_) {
++need_connect_cnt;
}
if (machine_rank < rank_) {
++incoming_cnt;
}
}
// start listener
listener_->SetTimeout(socket_timeout_);
listener_->Listen(incoming_cnt);
std::thread listen_thread(&Linkers::ListenThread, this, incoming_cnt);
const int connect_fail_constant_factor = 20;
const int connect_fail_retries_scale_factor = static_cast<int>(num_machines_ / connect_fail_constant_factor);
const int connect_fail_retry_cnt = std::max(connect_fail_constant_factor, connect_fail_retries_scale_factor);
const int connect_fail_retry_first_delay_interval = 200; // 0.2 s
const float connect_fail_retry_delay_factor = 1.3f;
// start connect
for (auto it = need_connect.begin(); it != need_connect.end(); ++it) {
int out_rank = it->first;
// let smaller rank connect to larger rank
if (out_rank > rank_) {
TcpSocket cur_socket;
int connect_fail_delay_time = connect_fail_retry_first_delay_interval;
for (int i = 0; i < connect_fail_retry_cnt; ++i) {
if (cur_socket.Connect(client_ips_[out_rank].c_str(), client_ports_[out_rank])) {
break;
} else {
Log::Warning("Connecting to rank %d failed, waiting for %d milliseconds", out_rank, connect_fail_delay_time);
std::this_thread::sleep_for(std::chrono::milliseconds(connect_fail_delay_time));
connect_fail_delay_time = static_cast<int>(connect_fail_delay_time * connect_fail_retry_delay_factor);
}
}
// send local rank
cur_socket.Send(reinterpret_cast<const char*>(&rank_), sizeof(rank_));
SetLinker(out_rank, cur_socket);
}
}
// wait for listener
listen_thread.join();
// print connected linkers
PrintLinkers();
}
bool Linkers::CheckLinker(int rank) {
if (linkers_[rank] == nullptr || linkers_[rank]->IsClosed()) {
return false;
}
return true;
}
void Linkers::PrintLinkers() {
for (int i = 0; i < num_machines_; ++i) {
if (CheckLinker(i)) {
Log::Info("Connected to rank %d", i);
}
}
}
} // namespace LightGBM
#endif // USE_SOCKET
|
#include "GamePCH.h"
#include "BulletDebugDraw.h"
#include "Helpers/ResourceManager.h"
#include "Mesh/Mesh.h"
#include "Mesh/Material.h"
#include "GameObjects/GameCamera.h"
#include "GameObjects/FollowCamera.h"
BulletDebugDraw::BulletDebugDraw(ResourceManager* aResourceManager, GameCamera* aCamera)
{
m_debugMode = 0;
m_Resources = aResourceManager;
m_Camera = aCamera;
m_DebugMaterial = m_Resources->GetMaterial("DebugMaterial");
m_DebugWorlMatrix.SetIdentity();
}
BulletDebugDraw::~BulletDebugDraw()
{
m_Camera = nullptr;
m_Resources = nullptr;
}
void BulletDebugDraw::drawLine(const btVector3& from, const btVector3& to, const btVector3& color)
{
if (m_debugMode > 0)
{
float DebugVerts[6] = { from.getX(), from.getY(), from.getZ(),
to.getX(), to.getY(), to.getZ() };
m_DebugMaterial->SetColor(MyColor(color.getX() * 255, color.getY() * 255, color.getZ() * 255, 255));
GLuint shader = m_DebugMaterial->GetShader()->GetProgram();
GLuint buffer = 0;
glGenBuffers(1, &buffer);
glBindBuffer(GL_ARRAY_BUFFER, buffer);
glBufferData(GL_ARRAY_BUFFER, sizeof(GL_FLOAT) * 6, &DebugVerts[0], GL_STATIC_DRAW);
GLuint loc = glGetAttribLocation(shader, "a_Position");
if (loc != -1)
{
glVertexAttribPointer(loc, 3, GL_FLOAT, GL_FALSE, sizeof(float) * 3, 0);
glEnableVertexAttribArray(loc);
}
glDisable(GL_CULL_FACE);
Mesh::SetupDebugUniforms(m_DebugMaterial, m_DebugWorlMatrix, m_Camera);
glPointSize(5.0f);
glLineWidth(2.0f);
glDrawArrays(GL_POINTS, 0, 2);
glDrawArrays(GL_LINES, 0, 2);
glDisableVertexAttribArray(loc);
glEnable(GL_CULL_FACE);
}
}
void BulletDebugDraw::setDebugMode(int debugMode)
{
m_debugMode = debugMode;
}
void BulletDebugDraw::AddRayPoints(btVector3* aRayPoints, int numPoints)
{
if (m_Raypoints.size() == 0)
{
for (int i = 0; i < numPoints; i++)
{
m_Raypoints.push_back(aRayPoints[i]);
}
}
}
void BulletDebugDraw::DrawRays()
{
if (!m_Raypoints.empty())
{
drawLine(m_Raypoints[0], m_Raypoints[1], btVector3(1, 0, 0));
m_Raypoints.clear();
}
}
void BulletDebugDraw::draw3dText(const btVector3& location, const char* textString)
{
}
void BulletDebugDraw::reportErrorWarning(const char* warningString)
{
printf(warningString);
}
void BulletDebugDraw::drawContactPoint(const btVector3& pointOnB, const btVector3& normalOnB, btScalar distance, int lifeTime, const btVector3& color)
{
{
//btVector3 to = pointOnB + normalOnB * distance;
//const btVector3&from = pointOnB;
//drawLine(from, to, color);
}
} |
// __BEGIN_LICENSE__
// Copyright (c) 2006-2013, United States Government as represented by the
// Administrator of the National Aeronautics and Space Administration. All
// rights reserved.
//
// The NASA Vision Workbench is 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.
// __END_LICENSE__
// TestPinholeModel.h
#include <gtest/gtest_VW.h>
#include <vw/Math/Vector.h>
#include <vw/Math/EulerAngles.h>
#include <vw/Math/LinearAlgebra.h>
#include <vw/Camera/CameraGeometry.h>
#include <vw/Camera/CameraTransform.h>
#include <vw/Camera/LensDistortion.h>
#include <vw/Camera/PinholeModel.h>
#include <test/Helpers.h>
#include <boost/random.hpp>
using namespace vw;
using namespace vw::camera;
using namespace vw::test;
TEST( PinholeModel, StandardConstruct ) {
Matrix<double,3,3> pose;
pose.set_identity();
// Create an imaginary 1000x1000 pixel imager
PinholeModel pinhole( Vector3(0,0,0), // camera center
pose, // camera pose
500,500, // fx, fy
500,500, // cx, cy
NullLensDistortion());
EXPECT_VECTOR_NEAR(pinhole.point_to_pixel(Vector3(0,0,10)),
Vector2(500,500), 1e-6);
EXPECT_VECTOR_NEAR(pinhole.point_to_pixel(Vector3(-10,0,10)),
Vector2(0,500), 1e-6);
EXPECT_VECTOR_NEAR(pinhole.point_to_pixel(Vector3(10,0,10)),
Vector2(1000,500), 1e-6);
EXPECT_VECTOR_NEAR(pinhole.point_to_pixel(Vector3(0,-10,10)),
Vector2(500,0), 1e-6);
EXPECT_VECTOR_NEAR(pinhole.point_to_pixel(Vector3(0,10,10)),
Vector2(500,1000), 1e-6);
EXPECT_STREQ( "Pinhole", pinhole.type().c_str() );
}
TEST( PinholeModel, CoordinateFrame ) {
Matrix<double,3,3> pose;
pose.set_identity();
// Create an imaginary 1000x1000 pixel imager, where the camera
// coordinate system is mapped as follows:
//
// +u : along the camera +Y axis
// +v : along the camera +X axis
// +w : along the camera -Z axis
PinholeModel pinhole( Vector3(0,0,0), // camera center
pose, // camera pose
500,500, // fx, fy
500,500,
Vector3(0, 1, 0),
Vector3(1, 0, 0),
Vector3(0, 0, -1),
NullLensDistortion()); // cx, cy
EXPECT_VECTOR_NEAR(pinhole.point_to_pixel(Vector3(0,0,-10)),
Vector2(500,500), 1e-5);
EXPECT_VECTOR_NEAR(pinhole.point_to_pixel(Vector3(-10,0,-10)),
Vector2(500,0), 1e-5);
EXPECT_VECTOR_NEAR(pinhole.point_to_pixel(Vector3(10,0,-10)),
Vector2(500,1000), 1e-5);
EXPECT_VECTOR_NEAR(pinhole.point_to_pixel(Vector3(0,-10,-10)),
Vector2(0,500), 1e-5);
EXPECT_VECTOR_NEAR(pinhole.point_to_pixel(Vector3(0,10,-10)),
Vector2(1000,500), 1e-5);
}
TEST( PinholeModel, TsaiDistortion ) {
// Create an imaginary 1000x1000 pixel imager
PinholeModel pinhole( Vector3(0,0,0), // camera center
math::identity_matrix<3>(), // camera pose
500,500, // fx, fy
500,500, // cx, cy
TsaiLensDistortion(Vector<double, TsaiLensDistortion::num_distortion_params>
(-0.2805362343788147,
0.1062035113573074,
-0.0001422458299202845,
0.00116333004552871)));
const LensDistortion* distortion = pinhole.lens_distortion();
#if defined(VW_HAVE_PKG_LAPACK)
Vector2 distorted_pix = distortion->distorted_coordinates(pinhole, Vector2(200,200));
Vector2 undistorted_pix = distortion->undistorted_coordinates(pinhole, distorted_pix);
EXPECT_VECTOR_NEAR( distorted_pix,
Vector2(244.865,244.395),
1e-1 );
EXPECT_VECTOR_NEAR( undistorted_pix,
Vector2(200,200),
1e-1 );
#endif
}
TEST( PinholeModel, ScalePinhole ) {
Matrix<double,3,3> rot = vw::math::euler_to_quaternion(1.15, 0.0, -1.57, "xyz").rotation_matrix();
PinholeModel pinhole4(Vector3(-0.329, 0.065, -0.82),
rot,
605.320556640625,
606.3638305664062,
518.89208984375,
387.5555114746094,
Vector3(1, 0, 0),
Vector3(0, -1, 0),
Vector3(0, 0, 1),
TsaiLensDistortion(Vector<double, TsaiLensDistortion::num_distortion_params>
(-0.2796604335308075,
0.1031486615538597,
-0.0007824968779459596,
0.0009675505571067333)));
PinholeModel scaled = scale_camera(pinhole4, .1);
Vector3 point = Vector3(2,-1,1) +
5*pinhole4.pixel_to_vector(Vector2(500,500)) +
pinhole4.camera_center();
Vector2 o_return = pinhole4.point_to_pixel(point);
Vector2 s_return = scaled.point_to_pixel(point);
EXPECT_NEAR(o_return[0],s_return[0]*10,1);
EXPECT_NEAR(o_return[1],s_return[1]*10,1);
}
TEST( PinholeModel, ProjectiveMatrix ) {
// First set control camera
Matrix<double,3,3> pose = math::euler_to_rotation_matrix(1.3,2.0,-.7,"xyz");
// Create an imaginary 1000x1000 pixel imager
PinholeModel control_pinhole( Vector3(0,4,-10),
pose, 600, 700,
500, 500,
NullLensDistortion() );
// Make solve control camera (w/ random input for now)
pose.set_identity();
PinholeModel solved_pinhole( Vector3(-5,-2,5),
pose, 833, 544,
400, 700,
NullLensDistortion() );
// Create Measurements used to solve for camera matrix
std::vector<Vector<double> > world_m, image_m;
boost::minstd_rand random_gen(42u);
boost::normal_distribution<double> normal(0,20);
boost::variate_generator<boost::minstd_rand&,
boost::normal_distribution<double> > generator( random_gen, normal );
for ( uint8 i = 0; i < 6; i++ ) {
Vector3 point( generator(), generator(), generator()+60.0 );
world_m.push_back( Vector4(point[0],point[1],point[2],1) );
Vector2 pixel = control_pinhole.point_to_pixel(point);
image_m.push_back( Vector3(pixel[0],pixel[1],1) );
}
// Building Camera Matrix
CameraMatrixFittingFunctor fitfunc;
Matrix<double> P = fitfunc(world_m,image_m);
solved_pinhole.set_camera_matrix( P );
// Compare camera matrices
{
Vector3 solved = solved_pinhole.camera_center( Vector2() );
Vector3 control = control_pinhole.camera_center( Vector2() );
EXPECT_VECTOR_NEAR( solved,
control, 1e-8 );
}
{
Quaternion<double> solved = solved_pinhole.camera_pose( Vector2() );
Quaternion<double> control = control_pinhole.camera_pose( Vector2() );
for ( uint32 i = 0; i < 4; i ++ )
EXPECT_NEAR( solved[i], control[i], 1e-8 );
}
{
Vector2 s_focal = solved_pinhole.focal_length();
Vector2 c_focal = control_pinhole.focal_length();
EXPECT_NEAR( s_focal[0]/s_focal[1],c_focal[0]/c_focal[1], 1e-2 );
EXPECT_VECTOR_NEAR( elem_quot(solved_pinhole.point_offset(),s_focal),
elem_quot(control_pinhole.point_offset(),c_focal), 1e-2 );
}
}
/// Helper class for testing PinholeModel objects
class PinholeTest : public ::testing::Test {
protected:
PinholeTest() {}
/// Init with a set of constants and no lens distortion
virtual void SetUp() {
expect_rot = vw::math::euler_to_rotation_matrix(1.15, 0.0, -1.57, "xyz");
pinhole = PinholeModel(Vector3(-0.329, 0.065, -0.82),
expect_rot,
605.320556640625,
606.3638305664062,
518.89208984375,
387.5555114746094);
}
/// Iterate through a grid of pixels and make sure that the pixels project
/// out and then back in to the same pixel.
void projection_test(double tolerance=1e-6) {
Vector2 image_size = pinhole.point_offset();
image_size *= 2;
for ( unsigned x = 10; x < image_size.x(); x+=80 ) {
for ( unsigned y = 10; y < image_size.y(); y+=80 ) {
EXPECT_VECTOR_NEAR( Vector2(x,y),
pinhole.point_to_pixel(pinhole.pixel_to_vector(Vector2(x,y)) +
pinhole.camera_center(Vector2(x,y))),
tolerance );
}
}
}
/// Write a .tsai file, then read it back in and make sure nothing has changed.
void readback_test(std::string const& file) {
pinhole.write( file );
PinholeModel read_back;
read_back.read( file );
EXPECT_VECTOR_DOUBLE_EQ( read_back.camera_center(),
pinhole.camera_center() );
Matrix<double> read_back_R =
read_back.camera_pose().rotation_matrix();
EXPECT_MATRIX_NEAR( read_back_R, expect_rot,1e-8 );
EXPECT_VECTOR_DOUBLE_EQ( read_back.coordinate_frame_u_direction(),
pinhole.coordinate_frame_u_direction() );
EXPECT_VECTOR_DOUBLE_EQ( read_back.coordinate_frame_v_direction(),
pinhole.coordinate_frame_v_direction() );
EXPECT_VECTOR_DOUBLE_EQ( read_back.coordinate_frame_w_direction(),
pinhole.coordinate_frame_w_direction() );
EXPECT_STREQ( read_back.lens_distortion()->name().c_str(),
pinhole.lens_distortion()->name().c_str() );
EXPECT_VECTOR_DOUBLE_EQ( read_back.lens_distortion()->distortion_parameters(),
pinhole.lens_distortion()->distortion_parameters() );
}
PinholeModel pinhole;
Matrix<double> expect_rot;
};
TEST_F( PinholeTest, NullLensDistortion ) {
projection_test();
UnlinkName file("NullCam.tsai");
readback_test( file );
// check enforcement that pose returns the rotation from camera
// frame to world frame.
Vector2 center_pixel = pinhole.point_offset();
Quaternion<double> center_pose =
pinhole.camera_pose(center_pixel);
double angle_from_z =
acos(dot_prod(Vector3(0,0,1),inverse(center_pose).rotate(pinhole.pixel_to_vector(center_pixel))));
EXPECT_LT( angle_from_z, 0.5 );
}
TEST_F( PinholeTest, TsaiLensDistortion ) {
pinhole.set_lens_distortion(TsaiLensDistortion
(Vector<double, TsaiLensDistortion::num_distortion_params>
(-0.2796604335308075,
0.1031486615538597,
-0.0007824968779459596,
0.0009675505571067333) ) );
#if defined(VW_HAVE_PKG_LAPACK) && VW_HAVE_PKG_LAPACK==1
projection_test(1e-4);
#endif
UnlinkName file("TsaiCam.tsai");
readback_test( file );
}
TEST_F( PinholeTest, BrownConradyDistortion ) {
pinhole.set_lens_distortion(
BrownConradyDistortion(Vector2(-0.6,-0.2),
Vector3(.1336185e-8,
-0.5226175e-12,
0),
Vector2(.5495819e-9,
0),
0.201) );
#if defined(VW_HAVE_PKG_LAPACK)
projection_test(1e-4);
#endif
UnlinkName file("BrownConrady.tsai");
readback_test( file );
}
TEST_F( PinholeTest, AdjustableTsaiDistortion ) {
Vector<double> distort_coeff(6);
distort_coeff[0] = 0.007646500298509824; // k1
distort_coeff[1] = -0.01743067138801845; // k2
distort_coeff[2] = 0.00980946292640812; // k3
distort_coeff[3] = -2.98092556225311e-05; // p1
distort_coeff[4] = -1.339089765674149e-05; // p2
distort_coeff[5] = -1.221974557659228e-05; // alpha = skew
pinhole.set_lens_distortion(
AdjustableTsaiLensDistortion( distort_coeff ) );
#if defined(VW_HAVE_PKG_LAPACK)
projection_test(1e-4);
#endif
UnlinkName file("AdjustedTsai.tsai");
readback_test( file );
}
TEST_F( PinholeTest, OldFormatReadTest ) {
UnlinkName filename("monkey.tsai");
std::ofstream filestream( filename.c_str() );
filestream << "fu = 54.6\n";
filestream << "fv = 45.3\n";
filestream << "cu = 3\n";
filestream << "cv = 5\n";
filestream << "u_direction = 1 0 0\n";
filestream << "v_direction = 0 1 0\n";
filestream << "w_direction = 0 0 1\n";
filestream << "C = 18.6 14.4 13.3\n";
filestream << "R = 1 0 0 0 1 0 0 0 1\n";
filestream << "k1 = 0.001\n";
filestream << "k2 = 0.001\n";
filestream << "p1 = 0.010\n";
filestream << "p2 = 1\n";
filestream.close();
PinholeModel monkey;
ASSERT_NO_THROW( monkey.read( filename ) );
EXPECT_VECTOR_NEAR( Vector2(54.6,45.3),
monkey.focal_length(), 1e-5 );
EXPECT_VECTOR_NEAR( Vector2(3,5),
monkey.point_offset(), 1e-5 );
EXPECT_VECTOR_NEAR( Vector3(18.6,14.4,13.3),
monkey.camera_center(Vector2()), 1e-5 );
}
|
/*
* Copyright 2010-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file 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 <aws/apigateway/model/CreateDeploymentResult.h>
#include <aws/core/utils/json/JsonSerializer.h>
#include <aws/core/AmazonWebServiceResult.h>
#include <aws/core/utils/StringUtils.h>
#include <aws/core/utils/UnreferencedParam.h>
#include <utility>
using namespace Aws::APIGateway::Model;
using namespace Aws::Utils::Json;
using namespace Aws::Utils;
using namespace Aws;
CreateDeploymentResult::CreateDeploymentResult()
{
}
CreateDeploymentResult::CreateDeploymentResult(const Aws::AmazonWebServiceResult<JsonValue>& result)
{
*this = result;
}
CreateDeploymentResult& CreateDeploymentResult::operator =(const Aws::AmazonWebServiceResult<JsonValue>& result)
{
JsonView jsonValue = result.GetPayload().View();
if(jsonValue.ValueExists("id"))
{
m_id = jsonValue.GetString("id");
}
if(jsonValue.ValueExists("description"))
{
m_description = jsonValue.GetString("description");
}
if(jsonValue.ValueExists("createdDate"))
{
m_createdDate = jsonValue.GetDouble("createdDate");
}
if(jsonValue.ValueExists("apiSummary"))
{
Aws::Map<Aws::String, JsonView> apiSummaryJsonMap = jsonValue.GetObject("apiSummary").GetAllObjects();
for(auto& apiSummaryItem : apiSummaryJsonMap)
{
Aws::Map<Aws::String, JsonView> mapOfMethodSnapshotJsonMap = apiSummaryItem.second.GetAllObjects();
Aws::Map<Aws::String, MethodSnapshot> mapOfMethodSnapshotMap;
for(auto& mapOfMethodSnapshotItem : mapOfMethodSnapshotJsonMap)
{
mapOfMethodSnapshotMap[mapOfMethodSnapshotItem.first] = mapOfMethodSnapshotItem.second.AsObject();
}
m_apiSummary[apiSummaryItem.first] = std::move(mapOfMethodSnapshotMap);
}
}
return *this;
}
|
/*
Copyright 2020 The OneFlow Authors. All rights reserved.
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 "oneflow/core/framework/op_expr_grad_function.h"
#include "oneflow/core/framework/op_builder.h"
#include "oneflow/core/framework/op_interpreter/op_interpreter_util.h"
#include "oneflow/core/functional/functional.h"
namespace oneflow {
namespace one {
class BroadcastBinaryGrad : public OpExprGradFunction<AutoGradCaptureState> {
public:
BroadcastBinaryGrad() = default;
virtual ~BroadcastBinaryGrad() = default;
virtual Maybe<void> Init(const OpExpr& op) override { return Maybe<void>::Ok(); }
Maybe<void> Capture(AutoGradCaptureState* ctx, const TensorTuple& inputs,
const TensorTuple& outputs, const AttrMap& attrs) const override {
CHECK_EQ_OR_RETURN(inputs.size(), 2);
CHECK_EQ_OR_RETURN(outputs.size(), 1);
ctx->SaveTensorForBackward(inputs.at(0));
ctx->SaveTensorForBackward(inputs.at(1));
ctx->SaveTensorForBackward(outputs.at(0));
return Maybe<void>::Ok();
}
};
class BroadcastAdd : public BroadcastBinaryGrad {
public:
Maybe<void> Apply(const AutoGradCaptureState* ctx, const TensorTuple& out_grads,
TensorTuple* in_grads) const override {
const auto& x = ctx->SavedTensors().at(0);
const auto& y = ctx->SavedTensors().at(1);
in_grads->resize(2);
if (x->requires_grad()) {
in_grads->at(0) = JUST(functional::BroadcastReduceSumLike(out_grads.at(0), x));
}
if (y->requires_grad()) {
in_grads->at(1) = JUST(functional::BroadcastReduceSumLike(out_grads.at(0), y));
}
return Maybe<void>::Ok();
}
};
REGISTER_OP_EXPR_GRAD_FUNCTION("broadcast_add", BroadcastAdd);
class BroadcastSub : public BroadcastBinaryGrad {
public:
Maybe<void> Apply(const AutoGradCaptureState* ctx, const TensorTuple& out_grads,
TensorTuple* in_grads) const override {
const auto& x = ctx->SavedTensors().at(0);
const auto& y = ctx->SavedTensors().at(1);
in_grads->resize(2);
if (x->requires_grad()) {
in_grads->at(0) = JUST(functional::BroadcastReduceSumLike(out_grads.at(0), x));
}
if (y->requires_grad()) {
const auto& grad = JUST(functional::ScalarMul(out_grads.at(0), functional::Scalar(-1.f)));
in_grads->at(1) = JUST(functional::BroadcastReduceSumLike(grad, y));
}
return Maybe<void>::Ok();
}
};
REGISTER_OP_EXPR_GRAD_FUNCTION("broadcast_sub", BroadcastSub);
class BroadcastMul : public BroadcastBinaryGrad {
public:
Maybe<void> Apply(const AutoGradCaptureState* ctx, const TensorTuple& out_grads,
TensorTuple* in_grads) const override {
const auto& x = ctx->SavedTensors().at(0);
const auto& y = ctx->SavedTensors().at(1);
in_grads->resize(2);
if (x->requires_grad()) {
const auto& x_grad = JUST(functional::Mul(out_grads.at(0), y));
in_grads->at(0) = JUST(functional::BroadcastReduceSumLike(x_grad, x));
}
if (y->requires_grad()) {
const auto& y_grad = JUST(functional::Mul(out_grads.at(0), x));
in_grads->at(1) = JUST(functional::BroadcastReduceSumLike(y_grad, y));
}
return Maybe<void>::Ok();
}
};
REGISTER_OP_EXPR_GRAD_FUNCTION("broadcast_mul", BroadcastMul);
class BroadcastDiv : public BroadcastBinaryGrad {
public:
Maybe<void> Apply(const AutoGradCaptureState* ctx, const TensorTuple& out_grads,
TensorTuple* in_grads) const override {
const auto& x = ctx->SavedTensors().at(0);
const auto& y = ctx->SavedTensors().at(1);
const auto& z = ctx->SavedTensors().at(2);
in_grads->resize(2);
if (x->requires_grad()) {
const auto& x_grad = JUST(functional::Div(out_grads.at(0), y));
in_grads->at(0) = JUST(functional::BroadcastReduceSumLike(x_grad, x));
}
if (y->requires_grad()) { in_grads->at(1) = JUST(functional::DivGrad(out_grads.at(0), z, y)); }
return Maybe<void>::Ok();
}
};
REGISTER_OP_EXPR_GRAD_FUNCTION("broadcast_div", BroadcastDiv);
class BroadcastPow : public BroadcastBinaryGrad {
public:
Maybe<void> Apply(const AutoGradCaptureState* ctx, const TensorTuple& out_grads,
TensorTuple* in_grads) const override {
const auto& x = ctx->SavedTensors().at(0);
const auto& y = ctx->SavedTensors().at(1);
const auto& z = ctx->SavedTensors().at(2);
in_grads->resize(2);
if (x->requires_grad()) {
in_grads->at(0) = JUST(functional::BroadcastPowXGrad(out_grads.at(0), x, y, z));
}
if (y->requires_grad()) {
in_grads->at(1) = JUST(functional::BroadcastPowYGrad(out_grads.at(0), x, y, z));
}
return Maybe<void>::Ok();
}
};
REGISTER_OP_EXPR_GRAD_FUNCTION("broadcast_pow", BroadcastPow);
class BroadcastMinMax : public BroadcastBinaryGrad {
public:
Maybe<void> Apply(const AutoGradCaptureState* ctx, const TensorTuple& out_grads,
TensorTuple* in_grads) const override {
const auto& x = ctx->SavedTensors().at(0);
const auto& y = ctx->SavedTensors().at(1);
const auto& out = ctx->SavedTensors().at(2);
const auto& out_shape = *(out->shape());
in_grads->resize(2);
if (x->requires_grad() || y->requires_grad()) {
const auto& x_shape = *(x->shape());
const auto& y_shape = *(y->shape());
auto broad_x_ = x;
auto broad_y_ = y;
if (x_shape != out_shape) {
const Shape& left_extended_x_shape =
CreateLeftExtendedShape(ShapeView(x_shape), out_shape.NumAxes());
const AxisVector& broadcast_axis_vec = left_extended_x_shape.Axes4BroadcastTo(out_shape);
const std::vector<int32_t> x_axis =
std::vector<int32_t>{broadcast_axis_vec.begin(), broadcast_axis_vec.end()};
broad_x_ = JUST(functional::BroadcastLike(x, out, x_axis));
}
if (y_shape != out_shape) {
const Shape& left_extended_y_shape =
CreateLeftExtendedShape(ShapeView(y_shape), out_shape.NumAxes());
const AxisVector& broadcast_axis_vec = left_extended_y_shape.Axes4BroadcastTo(out_shape);
const std::vector<int32_t> y_axis =
std::vector<int32_t>{broadcast_axis_vec.begin(), broadcast_axis_vec.end()};
broad_y_ = JUST(functional::BroadcastLike(y, out, y_axis));
}
const auto& broad_grads =
JUST(elementwise_grad_functor_(out_grads.at(0), broad_x_, broad_y_));
if (x->requires_grad()) {
in_grads->at(0) = JUST(functional::BroadcastReduceSumLike(broad_grads->at(0), x));
}
if (y->requires_grad()) {
in_grads->at(1) = JUST(functional::BroadcastReduceSumLike(broad_grads->at(1), y));
}
}
return Maybe<void>::Ok();
}
protected:
std::function<Maybe<TensorTuple>(const std::shared_ptr<Tensor>&, const std::shared_ptr<Tensor>&,
const std::shared_ptr<Tensor>&)>
elementwise_grad_functor_;
};
class BroadcastMinimum : public BroadcastMinMax {
public:
Maybe<void> Init(const OpExpr& op) override {
JUST(BroadcastMinMax::Init(op));
elementwise_grad_functor_ = functional::ElementwiseMinGrad;
return Maybe<void>::Ok();
}
};
class BroadcastMaximum : public BroadcastMinMax {
public:
Maybe<void> Init(const OpExpr& op) override {
JUST(BroadcastMinMax::Init(op));
elementwise_grad_functor_ = functional::ElementwiseMaxGrad;
return Maybe<void>::Ok();
}
};
REGISTER_OP_EXPR_GRAD_FUNCTION("broadcast_minimum", BroadcastMinimum);
REGISTER_OP_EXPR_GRAD_FUNCTION("broadcast_maximum", BroadcastMaximum);
} // namespace one
} // namespace oneflow
|
; A001550: a(n) = 1^n + 2^n + 3^n.
; 3,6,14,36,98,276,794,2316,6818,20196,60074,179196,535538,1602516,4799354,14381676,43112258,129271236,387682634,1162785756,3487832978,10462450356,31385253914,94151567436,282446313698,847322163876,2541932937194,7625731702716,22877060890418,68630914235796,205892205836474,617675543767596,1853024483819138,5559069156490116
mov $1,2
mov $2,1
mov $3,1
lpb $0,1
sub $0,1
mul $1,2
add $1,1
add $3,$2
mov $2,$3
sub $2,2
add $1,$2
mul $3,2
lpe
add $1,1
|
global pic_disable
pic_disable:
push ax
mov al, 0xff
out 0xa1, al
out 0x21, al
pop ax
ret |
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: Core implementation of vgui
//
// $NoKeywords: $
//=============================================================================//
#include "vgui_internal.h"
#include <vgui/ISurface.h>
#include <vgui/ILocalize.h>
#include <vgui/IPanel.h>
#include "filesystem.h"
#include <vstdlib/IKeyValuesSystem.h>
#include <stdio.h>
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
namespace vgui
{
ISurface *g_pSurface = NULL;
IPanel *g_pIPanel = NULL;
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
static void *InitializeInterface( char const *interfaceName, CreateInterfaceFn *factoryList, int numFactories )
{
void *retval;
for ( int i = 0; i < numFactories; i++ )
{
CreateInterfaceFn factory = factoryList[ i ];
if ( !factory )
continue;
retval = factory( interfaceName, NULL );
if ( retval )
return retval;
}
// No provider for requested interface!!!
// assert( !"No provider for requested interface!!!" );
return NULL;
}
//-----------------------------------------------------------------------------
// Purpose:
// Output : Returns true on success, false on failure.
//-----------------------------------------------------------------------------
bool VGui_InternalLoadInterfaces( CreateInterfaceFn *factoryList, int numFactories )
{
// loads all the interfaces
g_pSurface = (ISurface *)InitializeInterface(VGUI_SURFACE_INTERFACE_VERSION, factoryList, numFactories );
// g_pKeyValues = (IKeyValues *)InitializeInterface(KEYVALUES_INTERFACE_VERSION, factoryList, numFactories );
g_pIPanel = (IPanel *)InitializeInterface(VGUI_PANEL_INTERFACE_VERSION, factoryList, numFactories );
if (g_pSurface && /*g_pKeyValues &&*/ g_pIPanel)
return true;
return false;
}
} // namespace vgui
|
#include <algine/core/shader/BaseUniformBlock.h>
#include <algine/core/Engine.h>
#include <algine/gl.h>
using namespace std;
namespace algine {
void BaseUniformBlock::init(const ShaderProgram *shaderProgram) {
const uint blockIndex = getIndex(shaderProgram);
glGetActiveUniformBlockiv(shaderProgram->id, blockIndex, GL_UNIFORM_BLOCK_DATA_SIZE,
reinterpret_cast<int*>(&m_blockSize));
}
void BaseUniformBlock::assignBindingPoint(const ShaderProgram *shaderProgram) const {
glUniformBlockBinding(shaderProgram->id, getIndex(shaderProgram), m_bindingPoint);
}
void BaseUniformBlock::allocateSuitableBufferSize() {
m_uniformBuffer->bind();
m_uniformBuffer->setData(m_blockSize, nullptr, Buffer::DynamicDraw);
m_uniformBuffer->unbind();
}
// Engine::defaultUniformBuffer()->bind() because:
// glBindBufferBase also binds buffer to the generic buffer binding point specified by target
// https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/glBindBufferBase.xhtml
void BaseUniformBlock::linkBuffer() const {
glBindBufferBase(GL_UNIFORM_BUFFER, m_bindingPoint, m_uniformBuffer->m_id);
Engine::defaultUniformBuffer()->bind();
}
void BaseUniformBlock::linkBuffer(const uint offset, const uint size) const {
glBindBufferRange(GL_UNIFORM_BUFFER, m_bindingPoint, m_uniformBuffer->m_id, offset, size);
Engine::defaultUniformBuffer()->bind();
}
void BaseUniformBlock::bindBuffer() const {
m_uniformBuffer->bind();
}
void BaseUniformBlock::unbindBuffer() const {
m_uniformBuffer->unbind();
}
void BaseUniformBlock::setBuffer(UniformBuffer *buffer) {
m_uniformBuffer = buffer;
}
void BaseUniformBlock::setName(const string &name) {
m_name = name;
}
void BaseUniformBlock::setBindingPoint(const uint bindingPoint) {
m_bindingPoint = bindingPoint;
}
UniformBuffer* BaseUniformBlock::getBuffer() const {
return m_uniformBuffer;
}
string BaseUniformBlock::getName() const {
return m_name;
}
uint BaseUniformBlock::getBindingPoint() const {
return m_bindingPoint;
}
uint BaseUniformBlock::getIndex(const ShaderProgram *shaderProgram) const {
return glGetUniformBlockIndex(shaderProgram->id, m_name.c_str());;
}
uint BaseUniformBlock::getSize() const {
return m_blockSize;
}
uint BaseUniformBlock::getVarIndex(const std::string &name, const ShaderProgram *shaderProgram) {
uint index;
auto varName = name.c_str();
glGetUniformIndices(shaderProgram->id, 1, &varName, &index);
return index;
}
uint BaseUniformBlock::getVarOffset(const std::string &name, const ShaderProgram *shaderProgram) {
uint varIndex = getVarIndex(name, shaderProgram);
// If skip this check and the GLSL compiler removes the variable (if it unused, e.g in packed format),
// then there will be GL_INVALID_VALUE: "A uniform index exceeds the total number of uniforms."
// Since varIndex will contain VariableNotFound
if (varIndex != VariableNotFound) {
int offset;
glGetActiveUniformsiv(shaderProgram->id, 1, &varIndex, GL_UNIFORM_OFFSET, &offset);
return offset;
}
return VariableNotFound;
}
bool BaseUniformBlock::isVarValid(const std::string &name, const ShaderProgram *shaderProgram) {
return getVarIndex(name, shaderProgram) != VariableNotFound;
}
}
|
/*************************************************************************/
/* globals.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */
/* 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 "globals.h"
#include "os/dir_access.h"
#include "os/file_access.h"
#include "os/keyboard.h"
#include "io/marshalls.h"
#include "bind/core_bind.h"
#include "os/os.h"
#include "io/file_access_pack.h"
#include "io/file_access_network.h"
Globals *Globals::singleton=NULL;
Globals *Globals::get_singleton() {
return singleton;
}
String Globals::get_resource_path() const {
return resource_path;
};
String Globals::localize_path(const String& p_path) const {
if (resource_path=="")
return p_path; //not initialied yet
if (p_path.find(":/") != -1)
return p_path.simplify_path();
DirAccess *dir = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
String path = p_path.replace("\\","/").simplify_path();
if (dir->change_dir(path)==OK) {
String cwd = dir->get_current_dir();
cwd = cwd.replace("\\","/");
memdelete(dir);
if (!cwd.begins_with(resource_path)) {
return p_path;
};
return cwd.replace_first(resource_path, "res:/");
} else {
memdelete(dir);
int sep = path.find_last("/");
if (sep == -1) {
return "res://"+path;
};
String parent = path.substr(0, sep);
String plocal = localize_path(parent);
if (plocal == "") {
return "";
};
return plocal + path.substr(sep, path.size() - sep);
};
}
void Globals::set_persisting(const String& p_name, bool p_persist) {
ERR_FAIL_COND(!props.has(p_name));
props[p_name].persist=p_persist;
}
bool Globals::is_persisting(const String& p_name) const {
ERR_FAIL_COND_V(!props.has(p_name),false);
return props[p_name].persist;
}
String Globals::globalize_path(const String& p_path) const {
if (p_path.begins_with("res://")) {
if (resource_path != "") {
return p_path.replace("res:/",resource_path);
};
return p_path.replace("res://", "");
};
return p_path;
}
bool Globals::_set(const StringName& p_name, const Variant& p_value) {
_THREAD_SAFE_METHOD_
if (p_value.get_type()==Variant::NIL)
props.erase(p_name);
else {
if (props.has(p_name)) {
if (!props[p_name].overrided)
props[p_name].variant=p_value;
} else {
props[p_name]=VariantContainer(p_value,last_order++);
}
}
if (!disable_platform_override) {
String s=String(p_name);
int sl = s.find("/");
int p = s.find(".");
if (p!=-1 && sl!=-1 && p < sl) {
Vector<String> ps = s.substr(0,sl).split(".");
String prop=s.substr(sl,s.length()-sl);
for(int i=1;i<ps.size();i++) {
if (ps[i]==OS::get_singleton()->get_name()) {
String fullprop=ps[0]+prop;
set(fullprop,p_value);
props[fullprop].overrided=true;
}
}
}
}
return true;
}
bool Globals::_get(const StringName& p_name,Variant &r_ret) const {
_THREAD_SAFE_METHOD_
if (!props.has(p_name))
return false;
r_ret=props[p_name].variant;
return true;
}
struct _VCSort {
String name;
Variant::Type type;
int order;
int flags;
bool operator<(const _VCSort& p_vcs) const{ return order==p_vcs.order?name<p_vcs.name:order< p_vcs.order; }
};
void Globals::_get_property_list(List<PropertyInfo> *p_list) const {
_THREAD_SAFE_METHOD_
Set<_VCSort> vclist;
for(Map<StringName,VariantContainer>::Element *E=props.front();E;E=E->next()) {
const VariantContainer *v=&E->get();
if (v->hide_from_editor)
continue;
_VCSort vc;
vc.name=E->key();
vc.order=v->order;
vc.type=v->variant.get_type();
if (vc.name.begins_with("input/") || vc.name.begins_with("import/") || vc.name.begins_with("export/") || vc.name.begins_with("/remap") || vc.name.begins_with("/locale") || vc.name.begins_with("/autoload"))
vc.flags=PROPERTY_USAGE_CHECKABLE|PROPERTY_USAGE_STORAGE;
else
vc.flags=PROPERTY_USAGE_CHECKABLE|PROPERTY_USAGE_EDITOR|PROPERTY_USAGE_STORAGE;
if (v->persist) {
vc.flags|=PROPERTY_USAGE_CHECKED;
}
vclist.insert(vc);
}
for(Set<_VCSort>::Element *E=vclist.front();E;E=E->next()) {
if (custom_prop_info.has(E->get().name)) {
PropertyInfo pi=custom_prop_info[E->get().name];
pi.name=E->get().name;
pi.usage=E->get().flags;
p_list->push_back( pi );
} else
p_list->push_back( PropertyInfo(E->get().type, E->get().name,PROPERTY_HINT_NONE,"",E->get().flags) );
}
}
bool Globals::_load_resource_pack(const String& p_pack) {
if (PackedData::get_singleton()->is_disabled())
return false;
bool ok = PackedData::get_singleton()->add_pack(p_pack)==OK;
if (!ok)
return false;
//if data.pck is found, all directory access will be from here
DirAccess::make_default<DirAccessPack>(DirAccess::ACCESS_RESOURCES);
using_datapack=true;
return true;
}
Error Globals::setup(const String& p_path,const String & p_main_pack) {
//an absolute mess of a function, must be cleaned up and reorganized somehow at some point
//_load_settings(p_path+"/override.cfg");
if (p_main_pack!="") {
bool ok = _load_resource_pack(p_main_pack);
ERR_FAIL_COND_V(!ok,ERR_CANT_OPEN);
if (_load_settings("res://engine.cfg")==OK || _load_settings_binary("res://engine.cfb")==OK) {
_load_settings("res://override.cfg");
}
return OK;
}
if (OS::get_singleton()->get_executable_path()!="") {
if (_load_resource_pack(OS::get_singleton()->get_executable_path())) {
if (p_path!="") {
resource_path=p_path;
} else {
DirAccess *d = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
resource_path=d->get_current_dir();
memdelete(d);
}
if (_load_settings("res://engine.cfg")==OK || _load_settings_binary("res://engine.cfb")==OK) {
_load_settings("res://override.cfg");
}
return OK;
}
}
if (FileAccessNetworkClient::get_singleton()) {
if (_load_settings("res://engine.cfg")==OK || _load_settings_binary("res://engine.cfb")==OK) {
_load_settings("res://override.cfg");
}
return OK;
}
if (OS::get_singleton()->get_resource_dir()!="") {
//OS will call Globals->get_resource_path which will be empty if not overriden!
//if the OS would rather use somewhere else, then it will not be empty.
resource_path=OS::get_singleton()->get_resource_dir().replace("\\","/");
if (resource_path.length() && resource_path[ resource_path.length()-1]=='/')
resource_path=resource_path.substr(0,resource_path.length()-1); // chop end
print_line("has res dir: "+resource_path);
if (!_load_resource_pack("res://data.pck"))
_load_resource_pack("res://data.pcz");
// make sure this is load from the resource path
print_line("exists engine cfg? "+itos(FileAccess::exists("/engine.cfg")));
if (_load_settings("res://engine.cfg")==OK || _load_settings_binary("res://engine.cfb")==OK) {
print_line("loaded engine.cfg");
_load_settings("res://override.cfg");
}
return OK;
}
DirAccess *d = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
if (!d) {
resource_path = p_path;
} else {
d->change_dir(p_path);
String candidate = d->get_current_dir();
String current_dir = d->get_current_dir();
bool found = false;
bool first_time=true;
while(true) {
//try to load settings in ascending through dirs shape!
//tries to open pack, but only first time
if (first_time && (_load_resource_pack(current_dir+"/data.pck") || _load_resource_pack(current_dir+"/data.pcz") )) {
if (_load_settings("res://engine.cfg")==OK || _load_settings_binary("res://engine.cfb")==OK) {
_load_settings("res://override.cfg");
found=true;
}
break;
} else if (_load_settings(current_dir+"/engine.cfg")==OK || _load_settings_binary(current_dir+"/engine.cfb")==OK) {
_load_settings(current_dir+"/override.cfg");
candidate=current_dir;
found=true;
break;
}
d->change_dir("..");
if (d->get_current_dir()==current_dir)
break; //not doing anything useful
current_dir=d->get_current_dir();
first_time=false;
}
resource_path=candidate;
resource_path = resource_path.replace("\\","/"); // windows path to unix path just in case
memdelete(d);
if (!found)
return ERR_FILE_NOT_FOUND;
};
if (resource_path.length() && resource_path[ resource_path.length()-1]=='/')
resource_path=resource_path.substr(0,resource_path.length()-1); // chop end
return OK;
}
bool Globals::has(String p_var) const {
_THREAD_SAFE_METHOD_
return props.has(p_var);
}
static Vector<String> _decode_params(const String& p_string) {
int begin=p_string.find("(");
ERR_FAIL_COND_V(begin==-1,Vector<String>());
begin++;
int end=p_string.find(")");
ERR_FAIL_COND_V(end<begin,Vector<String>());
return p_string.substr(begin,end-begin).split(",");
}
static String _get_chunk(const String& str,int &pos, int close_pos) {
enum {
MIN_COMMA,
MIN_COLON,
MIN_CLOSE,
MIN_QUOTE,
MIN_PARENTHESIS,
MIN_CURLY_OPEN,
MIN_OPEN
};
int min_pos=close_pos;
int min_what=MIN_CLOSE;
#define TEST_MIN(m_how,m_what) \
{\
int res = str.find(m_how,pos);\
if (res!=-1 && res < min_pos) {\
min_pos=res;\
min_what=m_what;\
}\
}\
TEST_MIN(",",MIN_COMMA);
TEST_MIN("[",MIN_OPEN);
TEST_MIN("{",MIN_CURLY_OPEN);
TEST_MIN("(",MIN_PARENTHESIS);
TEST_MIN("\"",MIN_QUOTE);
int end=min_pos;
switch(min_what) {
case MIN_COMMA: {
} break;
case MIN_CLOSE: {
//end because it's done
} break;
case MIN_QUOTE: {
end=str.find("\"",min_pos+1)+1;
ERR_FAIL_COND_V(end==-1,Variant());
} break;
case MIN_PARENTHESIS: {
end=str.find(")",min_pos+1)+1;
ERR_FAIL_COND_V(end==-1,Variant());
} break;
case MIN_OPEN: {
int level=1;
end++;
while(end<close_pos) {
if (str[end]=='[')
level++;
if (str[end]==']') {
level--;
if (level==0)
break;
}
end++;
}
ERR_FAIL_COND_V(level!=0,Variant());
end++;
} break;
case MIN_CURLY_OPEN: {
int level=1;
end++;
while(end<close_pos) {
if (str[end]=='{')
level++;
if (str[end]=='}') {
level--;
if (level==0)
break;
}
end++;
}
ERR_FAIL_COND_V(level!=0,Variant());
end++;
} break;
}
String ret = str.substr(pos,end-pos);
pos=end;
while(pos<close_pos) {
if (str[pos]!=',' && str[pos]!=' ' && str[pos]!=':')
break;
pos++;
}
return ret;
}
static Variant _decode_variant(const String& p_string) {
String str = p_string.strip_edges();
if (str.nocasecmp_to("true")==0)
return Variant(true);
if (str.nocasecmp_to("false")==0)
return Variant(false);
if (str.nocasecmp_to("nil")==0)
return Variant();
if (str.is_valid_float()) {
if (str.find(".")==-1)
return str.to_int();
else
return str.to_double();
}
if (str.begins_with("#")) { //string
return Color::html(str);
}
if (str.begins_with("\"")) { //string
int end = str.find_last("\"");
ERR_FAIL_COND_V(end==0,Variant());
return str.substr(1,end-1).xml_unescape();
}
if (str.begins_with("[")) { //array
int close_pos = str.find_last("]");
ERR_FAIL_COND_V(close_pos==-1,Variant());
Array array;
int pos=1;
while(pos<close_pos) {
String s = _get_chunk(str,pos,close_pos);
array.push_back(_decode_variant(s));
}
return array;
}
if (str.begins_with("{")) { //array
int close_pos = str.find_last("}");
ERR_FAIL_COND_V(close_pos==-1,Variant());
Dictionary d;
int pos=1;
while(pos<close_pos) {
String key = _get_chunk(str,pos,close_pos);
String data = _get_chunk(str,pos,close_pos);
d[_decode_variant(key)]=_decode_variant(data);
}
return d;
}
if (str.begins_with("key")) {
Vector<String> params = _decode_params(p_string);
ERR_FAIL_COND_V(params.size()!=1 && params.size()!=2,Variant());
int scode=0;
if (params[0].is_numeric()) {
scode=params[0].to_int();
if (scode<10)
scode+=KEY_0;
} else
scode=find_keycode(params[0]);
InputEvent ie;
ie.type=InputEvent::KEY;
ie.key.scancode=scode;
if (params.size()==2) {
String mods=params[1];
if (mods.findn("C")!=-1)
ie.key.mod.control=true;
if (mods.findn("A")!=-1)
ie.key.mod.alt=true;
if (mods.findn("S")!=-1)
ie.key.mod.shift=true;
if (mods.findn("M")!=-1)
ie.key.mod.meta=true;
}
return ie;
}
if (str.begins_with("mbutton")) {
Vector<String> params = _decode_params(p_string);
ERR_FAIL_COND_V(params.size()!=2,Variant());
InputEvent ie;
ie.type=InputEvent::MOUSE_BUTTON;
ie.device=params[0].to_int();
ie.mouse_button.button_index=params[1].to_int();
return ie;
}
if (str.begins_with("jbutton")) {
Vector<String> params = _decode_params(p_string);
ERR_FAIL_COND_V(params.size()!=2,Variant());
InputEvent ie;
ie.type=InputEvent::JOYSTICK_BUTTON;
ie.device=params[0].to_int();
ie.joy_button.button_index=params[1].to_int();
return ie;
}
if (str.begins_with("jaxis")) {
Vector<String> params = _decode_params(p_string);
ERR_FAIL_COND_V(params.size()!=2,Variant());
InputEvent ie;
ie.type=InputEvent::JOYSTICK_MOTION;
ie.device=params[0].to_int();
ie.joy_motion.axis=params[1].to_int();
return ie;
}
if (str.begins_with("img")) {
Vector<String> params = _decode_params(p_string);
if (params.size()==0) {
return Image();
}
ERR_FAIL_COND_V(params.size()!=5,Image());
String format=params[0].strip_edges();
Image::Format imgformat;
if (format=="grayscale") {
imgformat=Image::FORMAT_GRAYSCALE;
} else if (format=="intensity") {
imgformat=Image::FORMAT_INTENSITY;
} else if (format=="grayscale_alpha") {
imgformat=Image::FORMAT_GRAYSCALE_ALPHA;
} else if (format=="rgb") {
imgformat=Image::FORMAT_RGB;
} else if (format=="rgba") {
imgformat=Image::FORMAT_RGBA;
} else if (format=="indexed") {
imgformat=Image::FORMAT_INDEXED;
} else if (format=="indexed_alpha") {
imgformat=Image::FORMAT_INDEXED_ALPHA;
} else if (format=="bc1") {
imgformat=Image::FORMAT_BC1;
} else if (format=="bc2") {
imgformat=Image::FORMAT_BC2;
} else if (format=="bc3") {
imgformat=Image::FORMAT_BC3;
} else if (format=="bc4") {
imgformat=Image::FORMAT_BC4;
} else if (format=="bc5") {
imgformat=Image::FORMAT_BC5;
} else if (format=="custom") {
imgformat=Image::FORMAT_CUSTOM;
} else {
ERR_FAIL_V( Image() );
}
int mipmaps=params[1].to_int();
int w=params[2].to_int();
int h=params[3].to_int();
if (w == 0 && h == 0) {
//r_v = Image(w, h, imgformat);
return Image();
};
String data=params[4];
int datasize=data.length()/2;
DVector<uint8_t> pixels;
pixels.resize(datasize);
DVector<uint8_t>::Write wb = pixels.write();
const CharType *cptr=data.c_str();
int idx=0;
uint8_t byte;
while( idx<datasize*2) {
CharType c=*(cptr++);
ERR_FAIL_COND_V(c=='<',ERR_FILE_CORRUPT);
if ( (c>='0' && c<='9') || (c>='A' && c<='F') || (c>='a' && c<='f') ) {
if (idx&1) {
byte|=HEX2CHR(c);
wb[idx>>1]=byte;
} else {
byte=HEX2CHR(c)<<4;
}
idx++;
}
}
wb = DVector<uint8_t>::Write();
return Image(w,h,mipmaps,imgformat,pixels);
}
if (str.find(",")!=-1) { //vector2 or vector3
Vector<float> farr = str.split_floats(",",true);
if (farr.size()==2) {
return Point2(farr[0],farr[1]);
}
if (farr.size()==3) {
return Vector3(farr[0],farr[1],farr[2]);
}
ERR_FAIL_V(Variant());
}
return Variant();
}
Error Globals::_load_settings_binary(const String p_path) {
Error err;
FileAccess *f= FileAccess::open(p_path,FileAccess::READ,&err);
if (err!=OK) {
return err;
}
uint8_t hdr[4];
f->get_buffer(hdr,4);
if (hdr[0]!='E'|| hdr[1]!='C' || hdr[2]!='F' || hdr[3]!='G') {
memdelete(f);
ERR_EXPLAIN("Corrupted header in binary engine.cfb (not ECFG)");
ERR_FAIL_V(ERR_FILE_CORRUPT;)
}
uint32_t count=f->get_32();
for(int i=0;i<count;i++) {
uint32_t slen=f->get_32();
CharString cs;
cs.resize(slen+1);
cs[slen]=0;
f->get_buffer((uint8_t*)cs.ptr(),slen);
String key;
key.parse_utf8(cs.ptr());
uint32_t vlen=f->get_32();
Vector<uint8_t> d;
d.resize(vlen);
f->get_buffer(d.ptr(),vlen);
Variant value;
Error err = decode_variant(value,d.ptr(),d.size());
ERR_EXPLAIN("Error decoding property: "+key);
ERR_CONTINUE(err!=OK);
set(key,value);
set_persisting(key,true);
}
return OK;
}
Error Globals::_load_settings(const String p_path) {
Error err;
FileAccess *f= FileAccess::open(p_path,FileAccess::READ,&err);
if (err!=OK) {
return err;
}
String line;
String section;
String subpath;
int line_count = 0;
while(!f->eof_reached()) {
String line = f->get_line().strip_edges();
line_count++;
if (line=="")
continue;
// find comments
{
int pos=0;
while (true) {
int ret = line.find(";",pos);
if (ret==-1)
break;
int qc=0;
for(int i=0;i<ret;i++) {
if (line[i]=='"')
qc++;
}
if ( !(qc&1) ) {
//not inside string, real comment
line=line.substr(0,ret);
break;
}
pos=ret+1;
}
}
if (line.begins_with("[")) {
int end = line.find_last("]");
ERR_CONTINUE(end!=line.length()-1);
String section=line.substr(1,line.length()-2);
if (section=="global" || section == "")
subpath="";
else
subpath=section+"/";
} else if (line.find("=")!=-1) {
int eqpos = line.find("=");
String var=line.substr(0,eqpos).strip_edges();
String value=line.substr(eqpos+1,line.length()).strip_edges();
Variant val = _decode_variant(value);
set(subpath+var,val);
set_persisting(subpath+var,true);
//props[subpath+var]=VariantContainer(val,last_order++,true);
} else {
if (line.length() > 0) {
ERR_PRINT(String("Syntax error on line "+itos(line_count)+" of file "+p_path).ascii().get_data());
};
};
}
memdelete(f);
return OK;
}
static String _encode_variant(const Variant& p_variant) {
switch(p_variant.get_type()) {
case Variant::BOOL: {
bool val = p_variant;
return (val?"true":"false");
} break;
case Variant::INT: {
int val = p_variant;
return itos(val);
} break;
case Variant::REAL: {
float val = p_variant;
return rtos(val)+(val==int(val)?".0":"");
} break;
case Variant::STRING: {
String val = p_variant;
return "\""+val.xml_escape()+"\"";
} break;
case Variant::COLOR: {
Color val = p_variant;
return "#"+val.to_html();
} break;
case Variant::STRING_ARRAY:
case Variant::INT_ARRAY:
case Variant::REAL_ARRAY:
case Variant::ARRAY: {
Array arr = p_variant;
String str="[";
for(int i=0;i<arr.size();i++) {
if (i>0)
str+=", ";
str+=_encode_variant(arr[i]);
}
str+="]";
return str;
} break;
case Variant::DICTIONARY: {
Dictionary d = p_variant;
String str="{";
List<Variant> keys;
d.get_key_list(&keys);
for(List<Variant>::Element *E=keys.front();E;E=E->next()) {
if (E!=keys.front())
str+=", ";
str+=_encode_variant(E->get());
str+=":";
str+=_encode_variant(d[E->get()]);
}
str+="}";
return str;
} break;
case Variant::IMAGE: {
String str="img(";
Image img=p_variant;
if (!img.empty()) {
String format;
switch(img.get_format()) {
case Image::FORMAT_GRAYSCALE: format="grayscale"; break;
case Image::FORMAT_INTENSITY: format="intensity"; break;
case Image::FORMAT_GRAYSCALE_ALPHA: format="grayscale_alpha"; break;
case Image::FORMAT_RGB: format="rgb"; break;
case Image::FORMAT_RGBA: format="rgba"; break;
case Image::FORMAT_INDEXED : format="indexed"; break;
case Image::FORMAT_INDEXED_ALPHA: format="indexed_alpha"; break;
case Image::FORMAT_BC1: format="bc1"; break;
case Image::FORMAT_BC2: format="bc2"; break;
case Image::FORMAT_BC3: format="bc3"; break;
case Image::FORMAT_BC4: format="bc4"; break;
case Image::FORMAT_BC5: format="bc5"; break;
case Image::FORMAT_CUSTOM: format="custom custom_size="+itos(img.get_data().size())+""; break;
default: {}
}
str+=format+", ";
str+=itos(img.get_mipmaps())+", ";
str+=itos(img.get_width())+", ";
str+=itos(img.get_height())+", ";
DVector<uint8_t> data = img.get_data();
int ds=data.size();
DVector<uint8_t>::Read r = data.read();
for(int i=0;i<ds;i++) {
uint8_t byte = r[i];
const char hex[16]={'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};
char bstr[3]={ hex[byte>>4], hex[byte&0xF], 0};
str+=bstr;
}
}
str+=")";
return str;
} break;
case Variant::INPUT_EVENT: {
InputEvent ev = p_variant;
switch(ev.type) {
case InputEvent::KEY: {
String mods;
if (ev.key.mod.control)
mods+="C";
if (ev.key.mod.shift)
mods+="S";
if (ev.key.mod.alt)
mods+="A";
if (ev.key.mod.meta)
mods+="M";
if (mods!="")
mods=", "+mods;
return "key("+keycode_get_string(ev.key.scancode)+mods+")";
} break;
case InputEvent::MOUSE_BUTTON: {
return "mbutton("+itos(ev.device)+", "+itos(ev.mouse_button.button_index)+")";
} break;
case InputEvent::JOYSTICK_BUTTON: {
return "jbutton("+itos(ev.device)+", "+itos(ev.joy_button.button_index)+")";
} break;
case InputEvent::JOYSTICK_MOTION: {
return "jaxis("+itos(ev.device)+", "+itos(ev.joy_motion.axis)+")";
} break;
default: {
return "nil";
} break;
}
} break;
default: {}
}
return "nil"; //don't know wha to do with this
}
int Globals::get_order(const String& p_name) const {
ERR_FAIL_COND_V(!props.has(p_name),-1);
return props[p_name].order;
}
void Globals::set_order(const String& p_name, int p_order){
ERR_FAIL_COND(!props.has(p_name));
props[p_name].order=p_order;
}
void Globals::clear(const String& p_name) {
ERR_FAIL_COND(!props.has(p_name));
props.erase(p_name);
}
Error Globals::save() {
return save_custom(get_resource_path()+"/engine.cfg");
}
Error Globals::_save_settings_binary(const String& p_file,const Map<String,List<String> > &props,const CustomMap& p_custom) {
Error err;
FileAccess *file = FileAccess::open(p_file,FileAccess::WRITE,&err);
if (err!=OK) {
ERR_EXPLAIN("Coudln't save engine.cfb at "+p_file);
ERR_FAIL_COND_V(err,err)
}
uint8_t hdr[4]={'E','C','F','G'};
file->store_buffer(hdr,4);
int count=0;
for(Map<String,List<String> >::Element *E=props.front();E;E=E->next()) {
for(List<String>::Element *F=E->get().front();F;F=F->next()) {
count++;
}
}
file->store_32(count); //store how many properties are saved
for(Map<String,List<String> >::Element *E=props.front();E;E=E->next()) {
for(List<String>::Element *F=E->get().front();F;F=F->next()) {
String key = F->get();
if (E->key()!="")
key=E->key()+"/"+key;
Variant value;
if (p_custom.has(key))
value=p_custom[key];
else
value = get(key);
file->store_32(key.length());
file->store_string(key);
int len;
Error err = encode_variant(value,NULL,len);
if (err!=OK)
memdelete(file);
ERR_FAIL_COND_V( err != OK, ERR_INVALID_DATA );
Vector<uint8_t> buff;
buff.resize(len);
err = encode_variant(value,&buff[0],len);
if (err!=OK)
memdelete(file);
ERR_FAIL_COND_V( err != OK, ERR_INVALID_DATA );
file->store_32(len);
file->store_buffer(buff.ptr(),buff.size());
}
}
file->close();
memdelete(file);
return OK;
}
Error Globals::_save_settings_text(const String& p_file,const Map<String,List<String> > &props,const CustomMap& p_custom) {
Error err;
FileAccess *file = FileAccess::open(p_file,FileAccess::WRITE,&err);
if (err) {
ERR_EXPLAIN("Coudln't save engine.cfg - "+p_file);
ERR_FAIL_COND_V(err,err)
}
for(Map<String,List<String> >::Element *E=props.front();E;E=E->next()) {
if (E!=props.front())
file->store_string("\n");
if (E->key()!="")
file->store_string("["+E->key()+"]\n\n");
for(List<String>::Element *F=E->get().front();F;F=F->next()) {
String key = F->get();
if (E->key()!="")
key=E->key()+"/"+key;
Variant value;
if (p_custom.has(key))
value=p_custom[key];
else
value = get(key);
file->store_string(F->get()+"="+_encode_variant(value)+"\n");
}
}
file->close();
memdelete(file);
return OK;
}
Error Globals::_save_custom_bnd(const String &p_file) { // add other params as dictionary and array?
return save_custom(p_file);
};
Error Globals::save_custom(const String& p_path,const CustomMap& p_custom,const Set<String>& p_ignore_masks) {
ERR_FAIL_COND_V(p_path=="",ERR_INVALID_PARAMETER);
Set<_VCSort> vclist;
for(Map<StringName,VariantContainer>::Element *G=props.front();G;G=G->next()) {
const VariantContainer *v=&G->get();
if (v->hide_from_editor)
continue;
if (p_custom.has(G->key()))
continue;
bool discard=false;
for(const Set<String>::Element *E=p_ignore_masks.front();E;E=E->next()) {
if ( String(G->key()).match(E->get())) {
discard=true;
break;
}
}
if (discard)
continue;
_VCSort vc;
vc.name=G->key();//*k;
vc.order=v->order;
vc.type=v->variant.get_type();
vc.flags=PROPERTY_USAGE_CHECKABLE|PROPERTY_USAGE_EDITOR|PROPERTY_USAGE_STORAGE;
if (!v->persist)
continue;
vclist.insert(vc);
}
for(const Map<String,Variant>::Element *E=p_custom.front();E;E=E->next()) {
_VCSort vc;
vc.name=E->key();
vc.order=0xFFFFFFF;
vc.type=E->get().get_type();
vc.flags=PROPERTY_USAGE_STORAGE;
vclist.insert(vc);
}
Map<String,List<String> > props;
for(Set<_VCSort>::Element *E=vclist.front();E;E=E->next()) {
String category = E->get().name;
String name = E->get().name;
int div = category.find("/");
if (div<0)
category="";
else {
category=category.substr(0,div);
name=name.substr(div+1,name.size());
}
props[category].push_back(name);
}
if (p_path.ends_with(".cfg"))
return _save_settings_text(p_path,props,p_custom);
else if (p_path.ends_with(".cfb"))
return _save_settings_binary(p_path,props,p_custom);
else {
ERR_EXPLAIN("Unknown config file format: "+p_path);
ERR_FAIL_V( ERR_FILE_UNRECOGNIZED );
}
return OK;
#if 0
Error err = file->open(dst_file,FileAccess::WRITE);
if (err) {
memdelete(file);
ERR_EXPLAIN("Coudln't save engine.cfg");
ERR_FAIL_COND_V(err,err)
}
for(Map<String,List<String> >::Element *E=props.front();E;E=E->next()) {
if (E!=props.front())
file->store_string("\n");
if (E->key()!="")
file->store_string("["+E->key()+"]\n\n");
for(List<String>::Element *F=E->get().front();F;F=F->next()) {
String key = F->get();
if (E->key()!="")
key=E->key()+"/"+key;
Variant value;
if (p_custom.has(key))
value=p_custom[key];
else
value = get(key);
file->store_string(F->get()+"="+_encode_variant(value)+"\n");
}
}
file->close();
memdelete(file);
return OK;
#endif
}
Variant _GLOBAL_DEF( const String& p_var, const Variant& p_default) {
if (Globals::get_singleton()->has(p_var))
return Globals::get_singleton()->get(p_var);
Globals::get_singleton()->set(p_var,p_default);
return p_default;
}
void Globals::add_singleton(const Singleton &p_singleton) {
singletons.push_back(p_singleton);
}
Object* Globals::get_singleton_object(const String& p_name) const {
for(const List<Singleton>::Element *E=singletons.front();E;E=E->next()) {
if (E->get().name == p_name) {
return E->get().ptr;
};
};
return NULL;
};
bool Globals::has_singleton(const String& p_name) const {
return get_singleton_object(p_name) != NULL;
};
void Globals::get_singletons(List<Singleton> *p_singletons) {
for(List<Singleton>::Element *E=singletons.front();E;E=E->next())
p_singletons->push_back(E->get());
}
Vector<String> Globals::get_optimizer_presets() const {
List<PropertyInfo> pi;
Globals::get_singleton()->get_property_list(&pi);
Vector<String> names;
for (List<PropertyInfo>::Element *E=pi.front();E;E=E->next()) {
if (!E->get().name.begins_with("optimizer_presets/"))
continue;
names.push_back(E->get().name.get_slicec('/',1));
}
names.sort();
return names;
}
void Globals::set_custom_property_info(const String& p_prop,const PropertyInfo& p_info) {
ERR_FAIL_COND(!props.has(p_prop));
custom_prop_info[p_prop]=p_info;
}
void Globals::set_disable_platform_override(bool p_disable) {
disable_platform_override=p_disable;
}
bool Globals::is_using_datapack() const {
return using_datapack;
}
void Globals::_bind_methods() {
ObjectTypeDB::bind_method(_MD("has","name"),&Globals::has);
ObjectTypeDB::bind_method(_MD("set_order","name","pos"),&Globals::set_order);
ObjectTypeDB::bind_method(_MD("get_order","name"),&Globals::get_order);
ObjectTypeDB::bind_method(_MD("set_persisting","name","enable"),&Globals::set_persisting);
ObjectTypeDB::bind_method(_MD("is_persisting","name"),&Globals::is_persisting);
ObjectTypeDB::bind_method(_MD("clear","name"),&Globals::clear);
ObjectTypeDB::bind_method(_MD("localize_path","path"),&Globals::localize_path);
ObjectTypeDB::bind_method(_MD("globalize_path","path"),&Globals::globalize_path);
ObjectTypeDB::bind_method(_MD("save"),&Globals::save);
ObjectTypeDB::bind_method(_MD("has_singleton"),&Globals::has_singleton);
ObjectTypeDB::bind_method(_MD("get_singleton"),&Globals::get_singleton_object);
ObjectTypeDB::bind_method(_MD("load_resource_pack"),&Globals::_load_resource_pack);
ObjectTypeDB::bind_method(_MD("save_custom"),&Globals::_save_custom_bnd);
}
Globals::Globals() {
singleton=this;
last_order=0;
disable_platform_override=false;
Array va;
InputEvent key;
key.type=InputEvent::KEY;
InputEvent joyb;
joyb.type=InputEvent::JOYSTICK_BUTTON;
set("application/name","" );
set("application/main_scene","");
custom_prop_info["application/main_scene"]=PropertyInfo(Variant::STRING,"application/main_scene",PROPERTY_HINT_FILE,"scn,res,xscn,xml");
set("application/disable_stdout",false);
set("application/use_shared_user_dir",true);
key.key.scancode=KEY_RETURN;
va.push_back(key);
key.key.scancode=KEY_ENTER;
va.push_back(key);
key.key.scancode=KEY_SPACE;
va.push_back(key);
joyb.joy_button.button_index=JOY_BUTTON_0;
va.push_back(joyb);
set("input/ui_accept",va);
va=Array();
key.key.scancode=KEY_SPACE;
va.push_back(key);
joyb.joy_button.button_index=JOY_BUTTON_3;
va.push_back(joyb);
set("input/ui_select",va);
va=Array();
key.key.scancode=KEY_ESCAPE;
va.push_back(key);
joyb.joy_button.button_index=JOY_BUTTON_1;
va.push_back(joyb);
set("input/ui_cancel",va);
va=Array();
key.key.scancode=KEY_TAB;
va.push_back(key);
set("input/ui_focus_next",va);
va=Array();
key.key.scancode=KEY_TAB;
key.key.mod.shift=true;
va.push_back(key);
set("input/ui_focus_prev",va);
key.key.mod.shift=false;
va=Array();
key.key.scancode=KEY_LEFT;
va.push_back(key);
joyb.joy_button.button_index=JOY_DPAD_LEFT;
va.push_back(joyb);
set("input/ui_left",va);
va=Array();
key.key.scancode=KEY_RIGHT;
va.push_back(key);
joyb.joy_button.button_index=JOY_DPAD_RIGHT;
va.push_back(joyb);
set("input/ui_right",va);
va=Array();
key.key.scancode=KEY_UP;
va.push_back(key);
joyb.joy_button.button_index=JOY_DPAD_UP;
va.push_back(joyb);
set("input/ui_up",va);
va=Array();
key.key.scancode=KEY_DOWN;
va.push_back(key);
joyb.joy_button.button_index=JOY_DPAD_DOWN;
va.push_back(joyb);
set("input/ui_down",va);
va=Array();
key.key.scancode=KEY_PAGEUP;
va.push_back(key);
set("input/ui_page_up",va);
va=Array();
key.key.scancode=KEY_PAGEDOWN;
va.push_back(key);
set("input/ui_page_down",va);
// set("display/orientation", "landscape");
custom_prop_info["display/orientation"]=PropertyInfo(Variant::STRING,"display/orientation",PROPERTY_HINT_ENUM,"landscape,portrait,reverse_landscape,reverse_portrait,sensor_landscape,sensor_portrait,sensor");
custom_prop_info["render/mipmap_policy"]=PropertyInfo(Variant::INT,"render/mipmap_policy",PROPERTY_HINT_ENUM,"Allow,Allow For Po2,Disallow");
custom_prop_info["render/thread_model"]=PropertyInfo(Variant::INT,"render/thread_model",PROPERTY_HINT_ENUM,"Single-Unsafe,Single-Safe,Multi-Threaded");
custom_prop_info["physics_2d/thread_model"]=PropertyInfo(Variant::INT,"physics_2d/thread_model",PROPERTY_HINT_ENUM,"Single-Unsafe,Single-Safe,Multi-Threaded");
using_datapack=false;
}
Globals::~Globals() {
singleton=NULL;
}
|
#include <array>
#include "libpldm/pdr.h"
#include "libpldm/platform.h"
#include <gtest/gtest.h>
TEST(PDRAccess, testInit)
{
auto repo = pldm_pdr_init();
EXPECT_EQ(pldm_pdr_get_record_count(repo), 0u);
EXPECT_EQ(pldm_pdr_get_repo_size(repo), 0u);
pldm_pdr_destroy(repo);
}
TEST(PDRUpdate, testAdd)
{
auto repo = pldm_pdr_init();
std::array<uint8_t, 10> data{};
auto handle = pldm_pdr_add(repo, data.data(), data.size(), 0, false);
EXPECT_EQ(handle, 1u);
EXPECT_EQ(pldm_pdr_get_record_count(repo), 1u);
EXPECT_EQ(pldm_pdr_get_repo_size(repo), data.size());
handle = pldm_pdr_add(repo, data.data(), data.size(), 0u, false);
EXPECT_EQ(handle, 2u);
handle = pldm_pdr_add(repo, data.data(), data.size(), 0u, false);
EXPECT_EQ(handle, 3u);
handle = pldm_pdr_add(repo, data.data(), data.size(), htole32(0xdeeddeedu),
false);
EXPECT_EQ(handle, htole32(0xdeeddeed));
EXPECT_EQ(pldm_pdr_get_record_count(repo), 4u);
EXPECT_EQ(pldm_pdr_get_repo_size(repo), data.size() * 4u);
pldm_pdr_destroy(repo);
}
TEST(PDRUpdate, testRemove)
{
std::array<uint8_t, 10> data{};
auto repo = pldm_pdr_init();
pldm_pdr_remove_remote_pdrs(repo);
EXPECT_EQ(pldm_pdr_get_record_count(repo), 0u);
pldm_pdr_destroy(repo);
repo = pldm_pdr_init();
pldm_pdr_add(repo, data.data(), data.size(), 0, true);
pldm_pdr_remove_remote_pdrs(repo);
EXPECT_EQ(pldm_pdr_get_record_count(repo), 0u);
pldm_pdr_destroy(repo);
repo = pldm_pdr_init();
pldm_pdr_add(repo, data.data(), data.size(), 0, false);
pldm_pdr_remove_remote_pdrs(repo);
EXPECT_EQ(pldm_pdr_get_record_count(repo), 1u);
pldm_pdr_destroy(repo);
repo = pldm_pdr_init();
pldm_pdr_add(repo, data.data(), data.size(), 0, false);
pldm_pdr_add(repo, data.data(), data.size(), 0, true);
pldm_pdr_remove_remote_pdrs(repo);
EXPECT_EQ(pldm_pdr_get_record_count(repo), 1u);
pldm_pdr_destroy(repo);
repo = pldm_pdr_init();
pldm_pdr_add(repo, data.data(), data.size(), 0, true);
pldm_pdr_add(repo, data.data(), data.size(), 0, false);
pldm_pdr_remove_remote_pdrs(repo);
EXPECT_EQ(pldm_pdr_get_record_count(repo), 1u);
pldm_pdr_destroy(repo);
repo = pldm_pdr_init();
pldm_pdr_add(repo, data.data(), data.size(), 0, true);
pldm_pdr_add(repo, data.data(), data.size(), 0, true);
pldm_pdr_add(repo, data.data(), data.size(), 0, true);
pldm_pdr_add(repo, data.data(), data.size(), 0, true);
pldm_pdr_remove_remote_pdrs(repo);
EXPECT_EQ(pldm_pdr_get_record_count(repo), 0u);
pldm_pdr_add(repo, data.data(), data.size(), 0, true);
pldm_pdr_add(repo, data.data(), data.size(), 0, false);
EXPECT_EQ(pldm_pdr_get_record_count(repo), 2u);
pldm_pdr_destroy(repo);
repo = pldm_pdr_init();
pldm_pdr_add(repo, data.data(), data.size(), 0, false);
pldm_pdr_add(repo, data.data(), data.size(), 0, false);
pldm_pdr_add(repo, data.data(), data.size(), 0, false);
pldm_pdr_add(repo, data.data(), data.size(), 0, false);
pldm_pdr_remove_remote_pdrs(repo);
EXPECT_EQ(pldm_pdr_get_record_count(repo), 4u);
pldm_pdr_add(repo, data.data(), data.size(), 0, true);
pldm_pdr_add(repo, data.data(), data.size(), 0, false);
EXPECT_EQ(pldm_pdr_get_record_count(repo), 6u);
pldm_pdr_destroy(repo);
repo = pldm_pdr_init();
pldm_pdr_add(repo, data.data(), data.size(), 0, true);
pldm_pdr_add(repo, data.data(), data.size(), 0, false);
pldm_pdr_add(repo, data.data(), data.size(), 0, false);
pldm_pdr_add(repo, data.data(), data.size(), 0, false);
pldm_pdr_remove_remote_pdrs(repo);
EXPECT_EQ(pldm_pdr_get_record_count(repo), 3u);
pldm_pdr_add(repo, data.data(), data.size(), 0, true);
pldm_pdr_add(repo, data.data(), data.size(), 0, false);
EXPECT_EQ(pldm_pdr_get_record_count(repo), 5u);
pldm_pdr_destroy(repo);
repo = pldm_pdr_init();
pldm_pdr_add(repo, data.data(), data.size(), 0, false);
pldm_pdr_add(repo, data.data(), data.size(), 0, false);
pldm_pdr_add(repo, data.data(), data.size(), 0, false);
pldm_pdr_add(repo, data.data(), data.size(), 0, true);
pldm_pdr_remove_remote_pdrs(repo);
EXPECT_EQ(pldm_pdr_get_record_count(repo), 3u);
pldm_pdr_add(repo, data.data(), data.size(), 0, true);
pldm_pdr_add(repo, data.data(), data.size(), 0, false);
EXPECT_EQ(pldm_pdr_get_record_count(repo), 5u);
pldm_pdr_destroy(repo);
repo = pldm_pdr_init();
pldm_pdr_add(repo, data.data(), data.size(), 0, true);
pldm_pdr_add(repo, data.data(), data.size(), 0, false);
pldm_pdr_add(repo, data.data(), data.size(), 0, true);
pldm_pdr_add(repo, data.data(), data.size(), 0, false);
pldm_pdr_remove_remote_pdrs(repo);
EXPECT_EQ(pldm_pdr_get_record_count(repo), 2u);
pldm_pdr_add(repo, data.data(), data.size(), 0, false);
pldm_pdr_add(repo, data.data(), data.size(), 0, true);
EXPECT_EQ(pldm_pdr_get_record_count(repo), 4u);
pldm_pdr_destroy(repo);
repo = pldm_pdr_init();
pldm_pdr_add(repo, data.data(), data.size(), 0, false);
pldm_pdr_add(repo, data.data(), data.size(), 0, false);
pldm_pdr_add(repo, data.data(), data.size(), 0, false);
pldm_pdr_add(repo, data.data(), data.size(), 0, true);
pldm_pdr_remove_remote_pdrs(repo);
EXPECT_EQ(pldm_pdr_get_record_count(repo), 3u);
pldm_pdr_add(repo, data.data(), data.size(), 0, false);
pldm_pdr_add(repo, data.data(), data.size(), 0, true);
EXPECT_EQ(pldm_pdr_get_record_count(repo), 5u);
pldm_pdr_destroy(repo);
repo = pldm_pdr_init();
pldm_pdr_add(repo, data.data(), data.size(), 0, false);
pldm_pdr_add(repo, data.data(), data.size(), 0, true);
pldm_pdr_add(repo, data.data(), data.size(), 0, false);
pldm_pdr_add(repo, data.data(), data.size(), 0, true);
pldm_pdr_remove_remote_pdrs(repo);
EXPECT_EQ(pldm_pdr_get_record_count(repo), 2u);
pldm_pdr_add(repo, data.data(), data.size(), 0, false);
pldm_pdr_add(repo, data.data(), data.size(), 0, true);
EXPECT_EQ(pldm_pdr_get_record_count(repo), 4u);
pldm_pdr_destroy(repo);
repo = pldm_pdr_init();
pldm_pdr_add(repo, data.data(), data.size(), 0, true);
pldm_pdr_add(repo, data.data(), data.size(), 0, true);
pldm_pdr_add(repo, data.data(), data.size(), 0, true);
pldm_pdr_add(repo, data.data(), data.size(), 0, false);
pldm_pdr_remove_remote_pdrs(repo);
EXPECT_EQ(pldm_pdr_get_record_count(repo), 1u);
pldm_pdr_add(repo, data.data(), data.size(), 0, false);
pldm_pdr_add(repo, data.data(), data.size(), 0, true);
EXPECT_EQ(pldm_pdr_get_record_count(repo), 3u);
pldm_pdr_destroy(repo);
repo = pldm_pdr_init();
pldm_pdr_add(repo, data.data(), data.size(), 0, false);
pldm_pdr_add(repo, data.data(), data.size(), 0, true);
pldm_pdr_add(repo, data.data(), data.size(), 0, true);
pldm_pdr_add(repo, data.data(), data.size(), 0, true);
pldm_pdr_remove_remote_pdrs(repo);
EXPECT_EQ(pldm_pdr_get_record_count(repo), 1u);
pldm_pdr_add(repo, data.data(), data.size(), 0, false);
pldm_pdr_add(repo, data.data(), data.size(), 0, true);
EXPECT_EQ(pldm_pdr_get_record_count(repo), 3u);
pldm_pdr_destroy(repo);
repo = pldm_pdr_init();
pldm_pdr_add(repo, data.data(), data.size(), 0, false);
pldm_pdr_add(repo, data.data(), data.size(), 0, true);
pldm_pdr_add(repo, data.data(), data.size(), 0, true);
pldm_pdr_add(repo, data.data(), data.size(), 0, false);
pldm_pdr_remove_remote_pdrs(repo);
EXPECT_EQ(pldm_pdr_get_record_count(repo), 2u);
pldm_pdr_add(repo, data.data(), data.size(), 0, false);
pldm_pdr_add(repo, data.data(), data.size(), 0, true);
EXPECT_EQ(pldm_pdr_get_record_count(repo), 4u);
pldm_pdr_destroy(repo);
repo = pldm_pdr_init();
pldm_pdr_add(repo, data.data(), data.size(), 0, true);
pldm_pdr_add(repo, data.data(), data.size(), 0, false);
pldm_pdr_add(repo, data.data(), data.size(), 0, false);
pldm_pdr_add(repo, data.data(), data.size(), 0, true);
pldm_pdr_remove_remote_pdrs(repo);
EXPECT_EQ(pldm_pdr_get_record_count(repo), 2u);
auto handle = pldm_pdr_add(repo, data.data(), data.size(), 0, false);
EXPECT_EQ(handle, 3u);
handle = pldm_pdr_add(repo, data.data(), data.size(), 0, true);
EXPECT_EQ(handle, 4u);
EXPECT_EQ(pldm_pdr_get_record_count(repo), 4u);
pldm_pdr_destroy(repo);
}
TEST(PDRAccess, testGet)
{
auto repo = pldm_pdr_init();
std::array<uint32_t, 10> in{100, 345, 3, 6, 89, 0, 11, 45, 23434, 123123};
pldm_pdr_add(repo, reinterpret_cast<uint8_t*>(in.data()), sizeof(in), 1,
false);
EXPECT_EQ(pldm_pdr_get_record_count(repo), 1u);
EXPECT_EQ(pldm_pdr_get_repo_size(repo), sizeof(in));
uint32_t size{};
uint32_t nextRecHdl{};
uint8_t* outData = nullptr;
auto hdl = pldm_pdr_find_record(repo, 0, &outData, &size, &nextRecHdl);
EXPECT_NE(hdl, nullptr);
EXPECT_EQ(size, sizeof(in));
EXPECT_EQ(nextRecHdl, 0u);
EXPECT_EQ(memcmp(outData, in.data(), sizeof(in)), 0);
outData = nullptr;
auto hdl2 = pldm_pdr_find_record(repo, 1, &outData, &size, &nextRecHdl);
EXPECT_EQ(hdl, hdl2);
EXPECT_NE(hdl, nullptr);
EXPECT_EQ(size, sizeof(in));
EXPECT_EQ(nextRecHdl, 0u);
EXPECT_EQ(memcmp(outData, in.data(), sizeof(in)), 0);
outData = nullptr;
hdl = pldm_pdr_find_record(repo, htole32(0xdeaddead), &outData, &size,
&nextRecHdl);
EXPECT_EQ(hdl, nullptr);
EXPECT_EQ(size, 0u);
EXPECT_EQ(nextRecHdl, 0u);
EXPECT_EQ(outData, nullptr);
outData = nullptr;
std::array<uint32_t, 10> in2{1000, 3450, 30, 60, 890,
0, 110, 450, 234034, 123123};
pldm_pdr_add(repo, reinterpret_cast<uint8_t*>(in2.data()), sizeof(in2), 2,
false);
pldm_pdr_add(repo, reinterpret_cast<uint8_t*>(in2.data()), sizeof(in2), 3,
false);
pldm_pdr_add(repo, reinterpret_cast<uint8_t*>(in2.data()), sizeof(in2), 4,
true);
EXPECT_EQ(pldm_pdr_get_record_count(repo), 4u);
EXPECT_EQ(pldm_pdr_get_repo_size(repo), sizeof(in2) * 4);
hdl = pldm_pdr_find_record(repo, 0, &outData, &size, &nextRecHdl);
EXPECT_NE(hdl, nullptr);
EXPECT_EQ(size, sizeof(in));
EXPECT_EQ(nextRecHdl, 2u);
EXPECT_EQ(memcmp(outData, in.data(), sizeof(in)), 0);
outData = nullptr;
hdl2 = pldm_pdr_find_record(repo, 1, &outData, &size, &nextRecHdl);
EXPECT_EQ(hdl, hdl2);
EXPECT_NE(hdl, nullptr);
EXPECT_EQ(size, sizeof(in));
EXPECT_EQ(nextRecHdl, 2u);
EXPECT_EQ(memcmp(outData, in.data(), sizeof(in)), 0);
outData = nullptr;
hdl = pldm_pdr_find_record(repo, 2, &outData, &size, &nextRecHdl);
EXPECT_NE(hdl, nullptr);
EXPECT_EQ(size, sizeof(in2));
EXPECT_EQ(nextRecHdl, 3u);
EXPECT_EQ(memcmp(outData, in2.data(), sizeof(in2)), 0);
outData = nullptr;
hdl = pldm_pdr_find_record(repo, 3, &outData, &size, &nextRecHdl);
EXPECT_NE(hdl, nullptr);
EXPECT_EQ(pldm_pdr_record_is_remote(hdl), false);
EXPECT_EQ(size, sizeof(in2));
EXPECT_EQ(nextRecHdl, 4u);
EXPECT_EQ(memcmp(outData, in2.data(), sizeof(in2)), 0);
outData = nullptr;
hdl = pldm_pdr_find_record(repo, 4, &outData, &size, &nextRecHdl);
EXPECT_NE(hdl, nullptr);
EXPECT_EQ(pldm_pdr_record_is_remote(hdl), true);
EXPECT_EQ(size, sizeof(in2));
EXPECT_EQ(nextRecHdl, 0u);
EXPECT_EQ(memcmp(outData, in2.data(), sizeof(in2)), 0);
outData = nullptr;
pldm_pdr_destroy(repo);
}
TEST(PDRAccess, testGetNext)
{
auto repo = pldm_pdr_init();
std::array<uint32_t, 10> in{100, 345, 3, 6, 89, 0, 11, 45, 23434, 123123};
pldm_pdr_add(repo, reinterpret_cast<uint8_t*>(in.data()), sizeof(in), 1,
false);
EXPECT_EQ(pldm_pdr_get_record_count(repo), 1u);
EXPECT_EQ(pldm_pdr_get_repo_size(repo), sizeof(in));
uint32_t size{};
uint32_t nextRecHdl{};
uint8_t* outData = nullptr;
auto hdl = pldm_pdr_find_record(repo, 0, &outData, &size, &nextRecHdl);
EXPECT_NE(hdl, nullptr);
EXPECT_EQ(size, sizeof(in));
EXPECT_EQ(nextRecHdl, 0u);
EXPECT_EQ(memcmp(outData, in.data(), sizeof(in)), 0);
outData = nullptr;
std::array<uint32_t, 10> in2{1000, 3450, 30, 60, 890,
0, 110, 450, 234034, 123123};
pldm_pdr_add(repo, reinterpret_cast<uint8_t*>(in2.data()), sizeof(in2), 2,
false);
pldm_pdr_add(repo, reinterpret_cast<uint8_t*>(in2.data()), sizeof(in2), 3,
false);
pldm_pdr_add(repo, reinterpret_cast<uint8_t*>(in2.data()), sizeof(in2), 4,
false);
EXPECT_EQ(pldm_pdr_get_record_count(repo), 4u);
EXPECT_EQ(pldm_pdr_get_repo_size(repo), sizeof(in2) * 4);
hdl = pldm_pdr_get_next_record(repo, hdl, &outData, &size, &nextRecHdl);
EXPECT_NE(hdl, nullptr);
EXPECT_EQ(size, sizeof(in2));
EXPECT_EQ(nextRecHdl, 3u);
EXPECT_EQ(memcmp(outData, in2.data(), sizeof(in2)), 0);
outData = nullptr;
hdl = pldm_pdr_get_next_record(repo, hdl, &outData, &size, &nextRecHdl);
EXPECT_NE(hdl, nullptr);
EXPECT_EQ(size, sizeof(in2));
EXPECT_EQ(nextRecHdl, 4u);
EXPECT_EQ(memcmp(outData, in2.data(), sizeof(in2)), 0);
outData = nullptr;
hdl = pldm_pdr_get_next_record(repo, hdl, &outData, &size, &nextRecHdl);
EXPECT_NE(hdl, nullptr);
EXPECT_EQ(size, sizeof(in2));
EXPECT_EQ(nextRecHdl, 0u);
EXPECT_EQ(memcmp(outData, in2.data(), sizeof(in2)), 0);
outData = nullptr;
pldm_pdr_destroy(repo);
}
TEST(PDRAccess, testFindByType)
{
auto repo = pldm_pdr_init();
std::array<uint8_t, sizeof(pldm_pdr_hdr)> data{};
pldm_pdr_hdr* hdr = reinterpret_cast<pldm_pdr_hdr*>(data.data());
hdr->type = 1;
auto first = pldm_pdr_add(repo, data.data(), data.size(), 0, false);
hdr->type = 2;
auto second = pldm_pdr_add(repo, data.data(), data.size(), 0, false);
hdr->type = 3;
auto third = pldm_pdr_add(repo, data.data(), data.size(), 0, false);
hdr->type = 4;
auto fourth = pldm_pdr_add(repo, data.data(), data.size(), 0, false);
uint8_t* outData = nullptr;
uint32_t size{};
auto firstRec =
pldm_pdr_find_record_by_type(repo, 1, nullptr, &outData, &size);
EXPECT_EQ(pldm_pdr_get_record_handle(repo, firstRec), first);
outData = nullptr;
auto secondRec =
pldm_pdr_find_record_by_type(repo, 2, nullptr, &outData, &size);
EXPECT_EQ(pldm_pdr_get_record_handle(repo, secondRec), second);
outData = nullptr;
auto thirdRec =
pldm_pdr_find_record_by_type(repo, 3, nullptr, &outData, &size);
EXPECT_EQ(pldm_pdr_get_record_handle(repo, thirdRec), third);
outData = nullptr;
auto fourthRec =
pldm_pdr_find_record_by_type(repo, 4, nullptr, &outData, &size);
EXPECT_EQ(pldm_pdr_get_record_handle(repo, fourthRec), fourth);
outData = nullptr;
auto fifthRec =
pldm_pdr_find_record_by_type(repo, 5, nullptr, &outData, &size);
EXPECT_EQ(fifthRec, nullptr);
EXPECT_EQ(outData, nullptr);
EXPECT_EQ(size, 0u);
auto rec =
pldm_pdr_find_record_by_type(repo, 3, secondRec, &outData, &size);
EXPECT_EQ(pldm_pdr_get_record_handle(repo, rec), third);
outData = nullptr;
rec = pldm_pdr_find_record_by_type(repo, 4, secondRec, &outData, &size);
EXPECT_EQ(pldm_pdr_get_record_handle(repo, rec), fourth);
outData = nullptr;
rec = pldm_pdr_find_record_by_type(repo, 2, firstRec, &outData, &size);
EXPECT_EQ(pldm_pdr_get_record_handle(repo, rec), second);
outData = nullptr;
pldm_pdr_destroy(repo);
}
TEST(PDRUpdate, testAddFruRecordSet)
{
auto repo = pldm_pdr_init();
auto handle = pldm_pdr_add_fru_record_set(repo, 1, 10, 1, 0, 100, 0);
EXPECT_EQ(handle, 1u);
EXPECT_EQ(pldm_pdr_get_record_count(repo), 1u);
EXPECT_EQ(pldm_pdr_get_repo_size(repo),
sizeof(pldm_pdr_hdr) + sizeof(pldm_pdr_fru_record_set));
uint32_t size{};
uint32_t nextRecHdl{};
uint8_t* outData = nullptr;
auto hdl = pldm_pdr_find_record(repo, 0, &outData, &size, &nextRecHdl);
EXPECT_NE(hdl, nullptr);
EXPECT_EQ(size, sizeof(pldm_pdr_hdr) + sizeof(pldm_pdr_fru_record_set));
EXPECT_EQ(nextRecHdl, 0u);
pldm_pdr_hdr* hdr = reinterpret_cast<pldm_pdr_hdr*>(outData);
EXPECT_EQ(hdr->version, 1u);
EXPECT_EQ(hdr->type, PLDM_PDR_FRU_RECORD_SET);
EXPECT_EQ(hdr->length, htole16(sizeof(pldm_pdr_fru_record_set)));
EXPECT_EQ(hdr->record_handle, htole32(1));
pldm_pdr_fru_record_set* fru = reinterpret_cast<pldm_pdr_fru_record_set*>(
outData + sizeof(pldm_pdr_hdr));
EXPECT_EQ(fru->terminus_handle, htole16(1));
EXPECT_EQ(fru->fru_rsi, htole16(10));
EXPECT_EQ(fru->entity_type, htole16(1));
EXPECT_EQ(fru->entity_instance, htole16(0));
EXPECT_EQ(fru->container_id, htole16(100));
outData = nullptr;
handle = pldm_pdr_add_fru_record_set(repo, 2, 11, 2, 1, 101, 0);
EXPECT_EQ(handle, 2u);
EXPECT_EQ(pldm_pdr_get_record_count(repo), 2u);
EXPECT_EQ(pldm_pdr_get_repo_size(repo),
2 * (sizeof(pldm_pdr_hdr) + sizeof(pldm_pdr_fru_record_set)));
hdl = pldm_pdr_find_record(repo, 2, &outData, &size, &nextRecHdl);
EXPECT_NE(hdl, nullptr);
EXPECT_EQ(size, sizeof(pldm_pdr_hdr) + sizeof(pldm_pdr_fru_record_set));
EXPECT_EQ(nextRecHdl, 0u);
hdr = reinterpret_cast<pldm_pdr_hdr*>(outData);
EXPECT_EQ(hdr->version, 1u);
EXPECT_EQ(hdr->type, PLDM_PDR_FRU_RECORD_SET);
EXPECT_EQ(hdr->length, htole16(sizeof(pldm_pdr_fru_record_set)));
EXPECT_EQ(hdr->record_handle, htole32(2));
fru = reinterpret_cast<pldm_pdr_fru_record_set*>(outData +
sizeof(pldm_pdr_hdr));
EXPECT_EQ(fru->terminus_handle, htole16(2));
EXPECT_EQ(fru->fru_rsi, htole16(11));
EXPECT_EQ(fru->entity_type, htole16(2));
EXPECT_EQ(fru->entity_instance, htole16(1));
EXPECT_EQ(fru->container_id, htole16(101));
outData = nullptr;
hdl = pldm_pdr_find_record(repo, 1, &outData, &size, &nextRecHdl);
EXPECT_NE(hdl, nullptr);
EXPECT_EQ(size, sizeof(pldm_pdr_hdr) + sizeof(pldm_pdr_fru_record_set));
EXPECT_EQ(nextRecHdl, 2u);
hdr = reinterpret_cast<pldm_pdr_hdr*>(outData);
EXPECT_EQ(hdr->version, 1u);
EXPECT_EQ(hdr->type, PLDM_PDR_FRU_RECORD_SET);
EXPECT_EQ(hdr->length, htole16(sizeof(pldm_pdr_fru_record_set)));
EXPECT_EQ(hdr->record_handle, htole32(1));
fru = reinterpret_cast<pldm_pdr_fru_record_set*>(outData +
sizeof(pldm_pdr_hdr));
EXPECT_EQ(fru->terminus_handle, htole16(1));
EXPECT_EQ(fru->fru_rsi, htole16(10));
EXPECT_EQ(fru->entity_type, htole16(1));
EXPECT_EQ(fru->entity_instance, htole16(0));
EXPECT_EQ(fru->container_id, htole16(100));
outData = nullptr;
pldm_pdr_destroy(repo);
}
TEST(PDRUpdate, tesFindtFruRecordSet)
{
auto repo = pldm_pdr_init();
uint16_t terminusHdl{};
uint16_t entityType{};
uint16_t entityInstanceNum{};
uint16_t containerId{};
auto first = pldm_pdr_add_fru_record_set(repo, 1, 1, 1, 0, 100, 1);
auto second = pldm_pdr_add_fru_record_set(repo, 1, 2, 1, 1, 100, 2);
auto third = pldm_pdr_add_fru_record_set(repo, 1, 3, 1, 2, 100, 3);
EXPECT_EQ(first, pldm_pdr_get_record_handle(
repo, pldm_pdr_fru_record_set_find_by_rsi(
repo, 1, &terminusHdl, &entityType,
&entityInstanceNum, &containerId, false)));
EXPECT_EQ(second, pldm_pdr_get_record_handle(
repo, pldm_pdr_fru_record_set_find_by_rsi(
repo, 2, &terminusHdl, &entityType,
&entityInstanceNum, &containerId, false)));
EXPECT_EQ(third, pldm_pdr_get_record_handle(
repo, pldm_pdr_fru_record_set_find_by_rsi(
repo, 3, &terminusHdl, &entityType,
&entityInstanceNum, &containerId, false)));
EXPECT_EQ(terminusHdl, 1u);
EXPECT_EQ(entityType, 1u);
EXPECT_EQ(entityInstanceNum, 2u);
EXPECT_EQ(containerId, 100u);
EXPECT_EQ(nullptr, pldm_pdr_fru_record_set_find_by_rsi(
repo, 4, &terminusHdl, &entityType,
&entityInstanceNum, &containerId, false));
pldm_pdr_destroy(repo);
}
TEST(EntityAssociationPDR, testInit)
{
auto tree = pldm_entity_association_tree_init();
EXPECT_NE(tree, nullptr);
pldm_entity_association_tree_destroy(tree);
}
TEST(EntityAssociationPDR, testBuild)
{
// 1
// |
// 2--3--4
// |
// 5--6--7
// | |
// 9 8
pldm_entity entities[9]{};
entities[0].entity_type = 1;
entities[1].entity_type = 2;
entities[2].entity_type = 2;
entities[3].entity_type = 3;
entities[4].entity_type = 4;
entities[5].entity_type = 5;
entities[6].entity_type = 5;
entities[7].entity_type = 6;
entities[8].entity_type = 7;
auto tree = pldm_entity_association_tree_init();
auto l1 = pldm_entity_association_tree_add(
tree, &entities[0], 0xFFFF, nullptr, PLDM_ENTITY_ASSOCIAION_PHYSICAL,
false);
EXPECT_NE(l1, nullptr);
auto l2a = pldm_entity_association_tree_add(
tree, &entities[1], 0xFFFF, l1, PLDM_ENTITY_ASSOCIAION_PHYSICAL, false);
EXPECT_NE(l2a, nullptr);
auto l2b = pldm_entity_association_tree_add(
tree, &entities[2], 0xFFFF, l1, PLDM_ENTITY_ASSOCIAION_PHYSICAL, false);
EXPECT_NE(l2b, nullptr);
auto l2c = pldm_entity_association_tree_add(
tree, &entities[3], 0xFFFF, l1, PLDM_ENTITY_ASSOCIAION_PHYSICAL, false);
EXPECT_NE(l2c, nullptr);
auto l3a = pldm_entity_association_tree_add(tree, &entities[4], 0xFFFF, l2a,
PLDM_ENTITY_ASSOCIAION_PHYSICAL,
false);
EXPECT_NE(l3a, nullptr);
auto l3b = pldm_entity_association_tree_add(tree, &entities[5], 0xFFFF, l2a,
PLDM_ENTITY_ASSOCIAION_PHYSICAL,
false);
EXPECT_NE(l3b, nullptr);
auto l3c = pldm_entity_association_tree_add(tree, &entities[6], 0xFFFF, l2a,
PLDM_ENTITY_ASSOCIAION_PHYSICAL,
false);
EXPECT_NE(l3b, nullptr);
auto l4a = pldm_entity_association_tree_add(tree, &entities[7], 0xFFFF, l3a,
PLDM_ENTITY_ASSOCIAION_PHYSICAL,
false);
EXPECT_NE(l4a, nullptr);
auto l4b = pldm_entity_association_tree_add(tree, &entities[8], 0xFFFF, l3b,
PLDM_ENTITY_ASSOCIAION_PHYSICAL,
false);
EXPECT_NE(l4b, nullptr);
EXPECT_EQ(pldm_entity_is_node_parent(l1), true);
EXPECT_EQ(pldm_entity_is_node_parent(l2a), true);
EXPECT_EQ(pldm_entity_is_node_parent(l3a), true);
EXPECT_EQ(pldm_entity_is_node_parent(l3b), true);
EXPECT_EQ(pldm_entity_is_node_parent(l2b), false);
EXPECT_EQ(pldm_entity_is_node_parent(l2c), false);
EXPECT_EQ(pldm_entity_is_node_parent(l3c), false);
EXPECT_EQ(pldm_entity_is_node_parent(l4a), false);
EXPECT_EQ(pldm_entity_is_node_parent(l4b), false);
EXPECT_EQ(pldm_entity_is_exist_parent(l1), false);
pldm_entity nodeL1 = pldm_entity_extract(l1);
pldm_entity parentL2a = pldm_entity_get_parent(l2a);
pldm_entity parentL2b = pldm_entity_get_parent(l2b);
pldm_entity parentL2c = pldm_entity_get_parent(l2c);
EXPECT_EQ(pldm_entity_is_exist_parent(l2a), true);
EXPECT_EQ(pldm_entity_is_exist_parent(l2b), true);
EXPECT_EQ(pldm_entity_is_exist_parent(l2c), true);
EXPECT_EQ(parentL2a.entity_type, nodeL1.entity_type);
EXPECT_EQ(parentL2a.entity_instance_num, nodeL1.entity_instance_num);
EXPECT_EQ(parentL2a.entity_container_id, nodeL1.entity_container_id);
EXPECT_EQ(parentL2b.entity_type, nodeL1.entity_type);
EXPECT_EQ(parentL2b.entity_instance_num, nodeL1.entity_instance_num);
EXPECT_EQ(parentL2b.entity_container_id, nodeL1.entity_container_id);
EXPECT_EQ(parentL2c.entity_type, nodeL1.entity_type);
EXPECT_EQ(parentL2c.entity_instance_num, nodeL1.entity_instance_num);
EXPECT_EQ(parentL2c.entity_container_id, nodeL1.entity_container_id);
pldm_entity nodeL2a = pldm_entity_extract(l2a);
pldm_entity parentL3a = pldm_entity_get_parent(l3a);
pldm_entity parentL3b = pldm_entity_get_parent(l3b);
pldm_entity parentL3c = pldm_entity_get_parent(l3c);
EXPECT_EQ(pldm_entity_is_exist_parent(l3a), true);
EXPECT_EQ(pldm_entity_is_exist_parent(l3b), true);
EXPECT_EQ(pldm_entity_is_exist_parent(l3c), true);
EXPECT_EQ(parentL3a.entity_type, nodeL2a.entity_type);
EXPECT_EQ(parentL3a.entity_instance_num, nodeL2a.entity_instance_num);
EXPECT_EQ(parentL3a.entity_container_id, nodeL2a.entity_container_id);
EXPECT_EQ(parentL3b.entity_type, nodeL2a.entity_type);
EXPECT_EQ(parentL3b.entity_instance_num, nodeL2a.entity_instance_num);
EXPECT_EQ(parentL3b.entity_container_id, nodeL2a.entity_container_id);
EXPECT_EQ(parentL3c.entity_type, nodeL2a.entity_type);
EXPECT_EQ(parentL3c.entity_instance_num, nodeL2a.entity_instance_num);
EXPECT_EQ(parentL3c.entity_container_id, nodeL2a.entity_container_id);
pldm_entity nodeL3a = pldm_entity_extract(l3a);
pldm_entity parentL4a = pldm_entity_get_parent(l4a);
EXPECT_EQ(pldm_entity_is_exist_parent(l4a), true);
EXPECT_EQ(parentL4a.entity_type, nodeL3a.entity_type);
EXPECT_EQ(parentL4a.entity_instance_num, nodeL3a.entity_instance_num);
EXPECT_EQ(parentL4a.entity_container_id, nodeL3a.entity_container_id);
pldm_entity nodeL3b = pldm_entity_extract(l3b);
pldm_entity parentL4b = pldm_entity_get_parent(l4b);
EXPECT_EQ(pldm_entity_is_exist_parent(l4b), true);
EXPECT_EQ(parentL4b.entity_type, nodeL3b.entity_type);
EXPECT_EQ(parentL4b.entity_instance_num, nodeL3b.entity_instance_num);
EXPECT_EQ(parentL4b.entity_container_id, nodeL3b.entity_container_id);
size_t num{};
pldm_entity* out = nullptr;
pldm_entity_association_tree_visit(tree, &out, &num);
EXPECT_EQ(num, 9u);
EXPECT_EQ(out[0].entity_type, 1u);
EXPECT_EQ(out[0].entity_instance_num, 1u);
EXPECT_EQ(out[0].entity_container_id, 0u);
EXPECT_EQ(out[1].entity_type, 2u);
EXPECT_EQ(out[1].entity_instance_num, 1u);
EXPECT_EQ(out[1].entity_container_id, 1u);
EXPECT_EQ(out[2].entity_type, 2u);
EXPECT_EQ(out[2].entity_instance_num, 2u);
EXPECT_EQ(out[2].entity_container_id, 1u);
EXPECT_EQ(out[3].entity_type, 3u);
EXPECT_EQ(out[3].entity_instance_num, 1u);
EXPECT_EQ(out[3].entity_container_id, 1u);
EXPECT_EQ(out[4].entity_type, 4u);
EXPECT_EQ(out[4].entity_instance_num, 1u);
EXPECT_EQ(out[4].entity_container_id, 2u);
EXPECT_EQ(out[5].entity_type, 5u);
EXPECT_EQ(out[5].entity_instance_num, 1u);
EXPECT_EQ(out[5].entity_container_id, 2u);
EXPECT_EQ(out[6].entity_type, 5u);
EXPECT_EQ(out[6].entity_instance_num, 2u);
EXPECT_EQ(out[6].entity_container_id, 2u);
EXPECT_EQ(out[7].entity_type, 7u);
EXPECT_EQ(out[7].entity_instance_num, 1u);
EXPECT_EQ(out[7].entity_container_id, 4u);
EXPECT_EQ(out[8].entity_type, 6u);
EXPECT_EQ(out[8].entity_instance_num, 1u);
EXPECT_EQ(out[8].entity_container_id, 3u);
free(out);
pldm_entity p1 = pldm_entity_extract(l1);
EXPECT_EQ(p1.entity_type, 1u);
EXPECT_EQ(p1.entity_instance_num, 1u);
EXPECT_EQ(p1.entity_container_id, 0u);
pldm_entity p2a = pldm_entity_extract(l2a);
EXPECT_EQ(p2a.entity_type, 2u);
EXPECT_EQ(p2a.entity_instance_num, 1u);
EXPECT_EQ(p2a.entity_container_id, 1u);
pldm_entity p2b = pldm_entity_extract(l2b);
EXPECT_EQ(p2b.entity_type, 2u);
EXPECT_EQ(p2b.entity_instance_num, 2u);
EXPECT_EQ(p2b.entity_container_id, 1u);
pldm_entity p2c = pldm_entity_extract(l2c);
EXPECT_EQ(p2c.entity_type, 3u);
EXPECT_EQ(p2c.entity_instance_num, 1u);
EXPECT_EQ(p2c.entity_container_id, 1u);
pldm_entity p3a = pldm_entity_extract(l3a);
EXPECT_EQ(p3a.entity_type, 4u);
EXPECT_EQ(p3a.entity_instance_num, 1u);
EXPECT_EQ(p3a.entity_container_id, 2u);
pldm_entity p3b = pldm_entity_extract(l3b);
EXPECT_EQ(p3b.entity_type, 5u);
EXPECT_EQ(p3b.entity_instance_num, 1u);
EXPECT_EQ(p3b.entity_container_id, 2u);
pldm_entity p3c = pldm_entity_extract(l3c);
EXPECT_EQ(p3c.entity_type, 5u);
EXPECT_EQ(p3c.entity_instance_num, 2u);
EXPECT_EQ(p3c.entity_container_id, 2u);
pldm_entity p4a = pldm_entity_extract(l4a);
EXPECT_EQ(p4a.entity_type, 6u);
EXPECT_EQ(p4a.entity_instance_num, 1u);
EXPECT_EQ(p4a.entity_container_id, 3u);
pldm_entity p4b = pldm_entity_extract(l4b);
EXPECT_EQ(p4b.entity_type, 7u);
EXPECT_EQ(p4b.entity_instance_num, 1u);
EXPECT_EQ(p4b.entity_container_id, 4u);
pldm_entity_association_tree_destroy(tree);
}
TEST(EntityAssociationPDR, testSpecialTrees)
{
pldm_entity entities[3]{};
entities[0].entity_type = 1;
entities[1].entity_type = 2;
entities[2].entity_type = 1;
// A
auto tree = pldm_entity_association_tree_init();
auto node = pldm_entity_association_tree_add(
tree, &entities[0], 0xFFFF, nullptr, PLDM_ENTITY_ASSOCIAION_PHYSICAL,
false);
EXPECT_NE(node, nullptr);
size_t num{};
pldm_entity* out = nullptr;
pldm_entity_association_tree_visit(tree, &out, &num);
EXPECT_EQ(num, 1u);
EXPECT_EQ(out[0].entity_type, 1u);
EXPECT_EQ(out[0].entity_instance_num, 1u);
EXPECT_EQ(out[0].entity_container_id, 0u);
free(out);
pldm_entity_association_tree_destroy(tree);
// A-A-A
tree = pldm_entity_association_tree_init();
node = pldm_entity_association_tree_add(tree, &entities[0], 0xFFFF, nullptr,
PLDM_ENTITY_ASSOCIAION_PHYSICAL,
false);
EXPECT_NE(node, nullptr);
node = pldm_entity_association_tree_add(tree, &entities[1], 0xFFFF, nullptr,
PLDM_ENTITY_ASSOCIAION_PHYSICAL,
false);
EXPECT_NE(node, nullptr);
node = pldm_entity_association_tree_add(tree, &entities[2], 0xFFFF, nullptr,
PLDM_ENTITY_ASSOCIAION_PHYSICAL,
false);
EXPECT_NE(node, nullptr);
pldm_entity_association_tree_visit(tree, &out, &num);
EXPECT_EQ(num, 3u);
EXPECT_EQ(out[0].entity_type, 1u);
EXPECT_EQ(out[0].entity_instance_num, 1u);
EXPECT_EQ(out[0].entity_container_id, 0u);
EXPECT_EQ(out[1].entity_type, 1u);
EXPECT_EQ(out[1].entity_instance_num, 2u);
EXPECT_EQ(out[1].entity_container_id, 0u);
EXPECT_EQ(out[2].entity_type, 2u);
EXPECT_EQ(out[2].entity_instance_num, 1u);
EXPECT_EQ(out[2].entity_container_id, 0u);
free(out);
pldm_entity_association_tree_destroy(tree);
// A
// |
// A
// |
// A
tree = pldm_entity_association_tree_init();
node = pldm_entity_association_tree_add(tree, &entities[0], 0xFFFF, nullptr,
PLDM_ENTITY_ASSOCIAION_PHYSICAL,
false);
EXPECT_NE(node, nullptr);
auto node1 = pldm_entity_association_tree_add(
tree, &entities[1], 0xFFFF, node, PLDM_ENTITY_ASSOCIAION_PHYSICAL,
false);
EXPECT_NE(node1, nullptr);
auto node2 = pldm_entity_association_tree_add(
tree, &entities[2], 0xFFFF, node1, PLDM_ENTITY_ASSOCIAION_PHYSICAL,
false);
EXPECT_NE(node2, nullptr);
pldm_entity_association_tree_visit(tree, &out, &num);
EXPECT_EQ(num, 3u);
EXPECT_EQ(out[0].entity_type, 1u);
EXPECT_EQ(out[0].entity_instance_num, 1u);
EXPECT_EQ(out[0].entity_container_id, 0u);
EXPECT_EQ(out[1].entity_type, 2u);
EXPECT_EQ(out[1].entity_instance_num, 1u);
EXPECT_EQ(out[1].entity_container_id, 1u);
EXPECT_EQ(out[2].entity_type, 1u);
EXPECT_EQ(out[2].entity_instance_num, 1u);
EXPECT_EQ(out[2].entity_container_id, 2u);
free(out);
pldm_entity_association_tree_destroy(tree);
// A-A
// |
// A-A
tree = pldm_entity_association_tree_init();
node = pldm_entity_association_tree_add(tree, &entities[0], 0xFFFF, nullptr,
PLDM_ENTITY_ASSOCIAION_PHYSICAL,
false);
EXPECT_NE(node, nullptr);
node = pldm_entity_association_tree_add(tree, &entities[0], 0xFFFF, nullptr,
PLDM_ENTITY_ASSOCIAION_PHYSICAL,
false);
EXPECT_NE(node, nullptr);
node1 = pldm_entity_association_tree_add(tree, &entities[1], 0xFFFF, node,
PLDM_ENTITY_ASSOCIAION_PHYSICAL,
false);
EXPECT_NE(node1, nullptr);
node2 = pldm_entity_association_tree_add(tree, &entities[2], 0xFFFF, node,
PLDM_ENTITY_ASSOCIAION_PHYSICAL,
false);
EXPECT_NE(node2, nullptr);
pldm_entity_association_tree_visit(tree, &out, &num);
EXPECT_EQ(num, 4u);
EXPECT_EQ(out[0].entity_type, 1u);
EXPECT_EQ(out[0].entity_instance_num, 1u);
EXPECT_EQ(out[0].entity_container_id, 0u);
EXPECT_EQ(out[1].entity_type, 1u);
EXPECT_EQ(out[1].entity_instance_num, 2u);
EXPECT_EQ(out[1].entity_container_id, 0u);
EXPECT_EQ(out[2].entity_type, 2u);
EXPECT_EQ(out[2].entity_instance_num, 1u);
EXPECT_EQ(out[2].entity_container_id, 1u);
EXPECT_EQ(out[3].entity_type, 1u);
EXPECT_EQ(out[3].entity_instance_num, 1u);
EXPECT_EQ(out[3].entity_container_id, 1u);
free(out);
pldm_entity_association_tree_destroy(tree);
}
TEST(EntityAssociationPDR, testPDR)
{
// e = entity type, c = container id, i = instance num
// INPUT
// 1(e=1)--1a(e=2)
// |
// 2(e=2)--3(e=2)--4(e=2)--5(e=3)
// |
// 6(e=4)--7(e=5)--8(e=5)--9(e=5)
// | |
// 11(e=6) 10(e=7)
// Expected OUTPUT
// 1(e=1,c=0,i=1)
// |
// 2(e=2,c=1,i=1)--3(e=2,c=1,i=2)--4(e=3,c=1,i=1)--5(e=3,c=1,i=2)
// |
// 6(e=4,c=2,i=1)--7(e=5,c=2,i=1)--8(e=5,c=2,i=2)--9(e=5,c=2,i=3)
// | |
// 10(e=6,c=3,i=1) 11(e=7,c=4,i=1)
pldm_entity entities[11]{};
entities[0].entity_type = 1;
entities[1].entity_type = 2;
entities[2].entity_type = 3;
entities[3].entity_type = 2;
entities[4].entity_type = 3;
entities[5].entity_type = 4;
entities[6].entity_type = 5;
entities[7].entity_type = 5;
entities[8].entity_type = 5;
entities[9].entity_type = 6;
entities[10].entity_type = 7;
auto tree = pldm_entity_association_tree_init();
auto l1 = pldm_entity_association_tree_add(
tree, &entities[0], 0xFFFF, nullptr, PLDM_ENTITY_ASSOCIAION_PHYSICAL,
false);
EXPECT_NE(l1, nullptr);
auto l1a = pldm_entity_association_tree_add(
tree, &entities[1], 0xFFFF, nullptr, PLDM_ENTITY_ASSOCIAION_PHYSICAL,
false);
EXPECT_NE(l1a, nullptr);
auto l2a = pldm_entity_association_tree_add(
tree, &entities[1], 0xFFFF, l1, PLDM_ENTITY_ASSOCIAION_PHYSICAL, false);
EXPECT_NE(l2a, nullptr);
auto l2b = pldm_entity_association_tree_add(
tree, &entities[2], 0xFFFF, l1, PLDM_ENTITY_ASSOCIAION_LOGICAL, false);
EXPECT_NE(l2b, nullptr);
auto l2c = pldm_entity_association_tree_add(
tree, &entities[3], 0xFFFF, l1, PLDM_ENTITY_ASSOCIAION_PHYSICAL, false);
EXPECT_NE(l2c, nullptr);
auto l2d = pldm_entity_association_tree_add(
tree, &entities[4], 0xFFFF, l1, PLDM_ENTITY_ASSOCIAION_LOGICAL, false);
EXPECT_NE(l2d, nullptr);
auto l3a = pldm_entity_association_tree_add(tree, &entities[5], 0xFFFF, l2a,
PLDM_ENTITY_ASSOCIAION_PHYSICAL,
false);
EXPECT_NE(l3a, nullptr);
auto l3b = pldm_entity_association_tree_add(tree, &entities[6], 0xFFFF, l2a,
PLDM_ENTITY_ASSOCIAION_PHYSICAL,
false);
EXPECT_NE(l3b, nullptr);
auto l3c = pldm_entity_association_tree_add(
tree, &entities[7], 0xFFFF, l2a, PLDM_ENTITY_ASSOCIAION_LOGICAL, false);
EXPECT_NE(l3c, nullptr);
auto l3d = pldm_entity_association_tree_add(
tree, &entities[8], 0xFFFF, l2a, PLDM_ENTITY_ASSOCIAION_LOGICAL, false);
EXPECT_NE(l3d, nullptr);
auto l4a = pldm_entity_association_tree_add(tree, &entities[9], 0xFFFF, l3a,
PLDM_ENTITY_ASSOCIAION_PHYSICAL,
false);
EXPECT_NE(l4a, nullptr);
auto l4b =
pldm_entity_association_tree_add(tree, &entities[10], 0xFFFF, l3b,
PLDM_ENTITY_ASSOCIAION_LOGICAL, false);
EXPECT_NE(l4b, nullptr);
EXPECT_EQ(pldm_entity_get_num_children(l1, PLDM_ENTITY_ASSOCIAION_PHYSICAL),
2);
EXPECT_EQ(pldm_entity_get_num_children(l1, PLDM_ENTITY_ASSOCIAION_LOGICAL),
2);
EXPECT_EQ(
pldm_entity_get_num_children(l2a, PLDM_ENTITY_ASSOCIAION_PHYSICAL), 2);
EXPECT_EQ(
pldm_entity_get_num_children(l3b, PLDM_ENTITY_ASSOCIAION_PHYSICAL), 0);
EXPECT_EQ(pldm_entity_get_num_children(l3b, PLDM_ENTITY_ASSOCIAION_LOGICAL),
1);
auto repo = pldm_pdr_init();
pldm_entity_association_pdr_add(tree, repo, false);
EXPECT_EQ(pldm_pdr_get_record_count(repo), 6u);
uint32_t currRecHandle{};
uint32_t nextRecHandle{};
uint8_t* data = nullptr;
uint32_t size{};
uint32_t commonSize = sizeof(struct pldm_pdr_hdr) + sizeof(uint16_t) +
sizeof(uint8_t) + sizeof(pldm_entity) +
sizeof(uint8_t);
pldm_pdr_find_record(repo, currRecHandle, &data, &size, &nextRecHandle);
EXPECT_EQ(size, commonSize + (pldm_entity_get_num_children(
l1, PLDM_ENTITY_ASSOCIAION_LOGICAL) *
sizeof(pldm_entity)));
uint8_t* start = data;
pldm_pdr_hdr* hdr = reinterpret_cast<pldm_pdr_hdr*>(start);
EXPECT_EQ(le32toh(hdr->record_handle), 1u);
EXPECT_EQ(hdr->type, PLDM_PDR_ENTITY_ASSOCIATION);
EXPECT_EQ(le16toh(hdr->length), size - sizeof(struct pldm_pdr_hdr));
start += sizeof(pldm_pdr_hdr);
uint16_t* containerId = reinterpret_cast<uint16_t*>(start);
EXPECT_EQ(le16toh(*containerId), 1u);
start += sizeof(uint16_t);
EXPECT_EQ(*start, PLDM_ENTITY_ASSOCIAION_LOGICAL);
start += sizeof(uint8_t);
pldm_entity* entity = reinterpret_cast<pldm_entity*>(start);
EXPECT_EQ(le16toh(entity->entity_type), 1u);
EXPECT_EQ(le16toh(entity->entity_instance_num), 1u);
EXPECT_EQ(le16toh(entity->entity_container_id), 0u);
start += sizeof(pldm_entity);
EXPECT_EQ(*start,
pldm_entity_get_num_children(l1, PLDM_ENTITY_ASSOCIAION_LOGICAL));
start += sizeof(uint8_t);
entity = reinterpret_cast<pldm_entity*>(start);
EXPECT_EQ(le16toh(entity->entity_type), 3u);
EXPECT_EQ(le16toh(entity->entity_instance_num), 1u);
EXPECT_EQ(le16toh(entity->entity_container_id), 1u);
start += sizeof(pldm_entity);
entity = reinterpret_cast<pldm_entity*>(start);
EXPECT_EQ(le16toh(entity->entity_type), 3u);
EXPECT_EQ(le16toh(entity->entity_instance_num), 2u);
EXPECT_EQ(le16toh(entity->entity_container_id), 1u);
start += sizeof(pldm_entity);
currRecHandle = nextRecHandle;
pldm_pdr_find_record(repo, currRecHandle, &data, &size, &nextRecHandle);
EXPECT_EQ(size, commonSize + (pldm_entity_get_num_children(
l1, PLDM_ENTITY_ASSOCIAION_PHYSICAL) *
sizeof(pldm_entity)));
start = data;
hdr = reinterpret_cast<pldm_pdr_hdr*>(start);
EXPECT_EQ(le32toh(hdr->record_handle), 2u);
EXPECT_EQ(hdr->type, PLDM_PDR_ENTITY_ASSOCIATION);
EXPECT_EQ(le16toh(hdr->length), size - sizeof(struct pldm_pdr_hdr));
start += sizeof(pldm_pdr_hdr);
containerId = reinterpret_cast<uint16_t*>(start);
EXPECT_EQ(le16toh(*containerId), 1u);
start += sizeof(uint16_t);
EXPECT_EQ(*start, PLDM_ENTITY_ASSOCIAION_PHYSICAL);
start += sizeof(uint8_t);
entity = reinterpret_cast<pldm_entity*>(start);
EXPECT_EQ(le16toh(entity->entity_type), 1u);
EXPECT_EQ(le16toh(entity->entity_instance_num), 1u);
EXPECT_EQ(le16toh(entity->entity_container_id), 0u);
start += sizeof(pldm_entity);
EXPECT_EQ(*start, pldm_entity_get_num_children(
l1, PLDM_ENTITY_ASSOCIAION_PHYSICAL));
start += sizeof(uint8_t);
entity = reinterpret_cast<pldm_entity*>(start);
EXPECT_EQ(le16toh(entity->entity_type), 2u);
EXPECT_EQ(le16toh(entity->entity_instance_num), 1u);
EXPECT_EQ(le16toh(entity->entity_container_id), 1u);
start += sizeof(pldm_entity);
entity = reinterpret_cast<pldm_entity*>(start);
EXPECT_EQ(le16toh(entity->entity_type), 2u);
EXPECT_EQ(le16toh(entity->entity_instance_num), 2u);
EXPECT_EQ(le16toh(entity->entity_container_id), 1u);
start += sizeof(pldm_entity);
currRecHandle = nextRecHandle;
pldm_pdr_find_record(repo, currRecHandle, &data, &size, &nextRecHandle);
EXPECT_EQ(size, commonSize + (pldm_entity_get_num_children(
l2a, PLDM_ENTITY_ASSOCIAION_LOGICAL) *
sizeof(pldm_entity)));
start = data;
hdr = reinterpret_cast<pldm_pdr_hdr*>(start);
EXPECT_EQ(le32toh(hdr->record_handle), 3u);
EXPECT_EQ(hdr->type, PLDM_PDR_ENTITY_ASSOCIATION);
EXPECT_EQ(le16toh(hdr->length), size - sizeof(struct pldm_pdr_hdr));
start += sizeof(pldm_pdr_hdr);
containerId = reinterpret_cast<uint16_t*>(start);
EXPECT_EQ(le16toh(*containerId), 2u);
start += sizeof(uint16_t);
EXPECT_EQ(*start, PLDM_ENTITY_ASSOCIAION_LOGICAL);
start += sizeof(uint8_t);
entity = reinterpret_cast<pldm_entity*>(start);
EXPECT_EQ(le16toh(entity->entity_type), 2u);
EXPECT_EQ(le16toh(entity->entity_instance_num), 1u);
EXPECT_EQ(le16toh(entity->entity_container_id), 1u);
start += sizeof(pldm_entity);
EXPECT_EQ(*start, pldm_entity_get_num_children(
l2a, PLDM_ENTITY_ASSOCIAION_LOGICAL));
start += sizeof(uint8_t);
entity = reinterpret_cast<pldm_entity*>(start);
EXPECT_EQ(le16toh(entity->entity_type), 5);
EXPECT_EQ(le16toh(entity->entity_instance_num), 2u);
EXPECT_EQ(le16toh(entity->entity_container_id), 2u);
start += sizeof(pldm_entity);
entity = reinterpret_cast<pldm_entity*>(start);
EXPECT_EQ(le16toh(entity->entity_type), 5u);
EXPECT_EQ(le16toh(entity->entity_instance_num), 3u);
EXPECT_EQ(le16toh(entity->entity_container_id), 2u);
start += sizeof(pldm_entity);
currRecHandle = nextRecHandle;
pldm_pdr_find_record(repo, currRecHandle, &data, &size, &nextRecHandle);
EXPECT_EQ(size, commonSize + (pldm_entity_get_num_children(
l2a, PLDM_ENTITY_ASSOCIAION_PHYSICAL) *
sizeof(pldm_entity)));
start = data;
hdr = reinterpret_cast<pldm_pdr_hdr*>(start);
EXPECT_EQ(le32toh(hdr->record_handle), 4u);
EXPECT_EQ(hdr->type, PLDM_PDR_ENTITY_ASSOCIATION);
EXPECT_EQ(le16toh(hdr->length), size - sizeof(struct pldm_pdr_hdr));
start += sizeof(pldm_pdr_hdr);
containerId = reinterpret_cast<uint16_t*>(start);
EXPECT_EQ(le16toh(*containerId), 2u);
start += sizeof(uint16_t);
EXPECT_EQ(*start, PLDM_ENTITY_ASSOCIAION_PHYSICAL);
start += sizeof(uint8_t);
entity = reinterpret_cast<pldm_entity*>(start);
EXPECT_EQ(le16toh(entity->entity_type), 2u);
EXPECT_EQ(le16toh(entity->entity_instance_num), 1u);
EXPECT_EQ(le16toh(entity->entity_container_id), 1u);
start += sizeof(pldm_entity);
EXPECT_EQ(*start, pldm_entity_get_num_children(
l2a, PLDM_ENTITY_ASSOCIAION_PHYSICAL));
start += sizeof(uint8_t);
entity = reinterpret_cast<pldm_entity*>(start);
EXPECT_EQ(le16toh(entity->entity_type), 4u);
EXPECT_EQ(le16toh(entity->entity_instance_num), 1u);
EXPECT_EQ(le16toh(entity->entity_container_id), 2u);
start += sizeof(pldm_entity);
entity = reinterpret_cast<pldm_entity*>(start);
EXPECT_EQ(le16toh(entity->entity_type), 5u);
EXPECT_EQ(le16toh(entity->entity_instance_num), 1u);
EXPECT_EQ(le16toh(entity->entity_container_id), 2u);
start += sizeof(pldm_entity);
currRecHandle = nextRecHandle;
pldm_pdr_find_record(repo, currRecHandle, &data, &size, &nextRecHandle);
EXPECT_EQ(size, commonSize + (pldm_entity_get_num_children(
l3a, PLDM_ENTITY_ASSOCIAION_PHYSICAL) *
sizeof(pldm_entity)));
start = data;
hdr = reinterpret_cast<pldm_pdr_hdr*>(start);
EXPECT_EQ(le32toh(hdr->record_handle), 5u);
EXPECT_EQ(hdr->type, PLDM_PDR_ENTITY_ASSOCIATION);
EXPECT_EQ(le16toh(hdr->length), size - sizeof(struct pldm_pdr_hdr));
start += sizeof(pldm_pdr_hdr);
containerId = reinterpret_cast<uint16_t*>(start);
EXPECT_EQ(le16toh(*containerId), 3u);
start += sizeof(uint16_t);
EXPECT_EQ(*start, PLDM_ENTITY_ASSOCIAION_PHYSICAL);
start += sizeof(uint8_t);
entity = reinterpret_cast<pldm_entity*>(start);
EXPECT_EQ(le16toh(entity->entity_type), 4u);
EXPECT_EQ(le16toh(entity->entity_instance_num), 1u);
EXPECT_EQ(le16toh(entity->entity_container_id), 2u);
start += sizeof(pldm_entity);
EXPECT_EQ(*start, pldm_entity_get_num_children(
l3a, PLDM_ENTITY_ASSOCIAION_PHYSICAL));
start += sizeof(uint8_t);
entity = reinterpret_cast<pldm_entity*>(start);
EXPECT_EQ(le16toh(entity->entity_type), 6u);
EXPECT_EQ(le16toh(entity->entity_instance_num), 1u);
EXPECT_EQ(le16toh(entity->entity_container_id), 3u);
start += sizeof(pldm_entity);
currRecHandle = nextRecHandle;
pldm_pdr_find_record(repo, currRecHandle, &data, &size, &nextRecHandle);
EXPECT_EQ(size, commonSize + (pldm_entity_get_num_children(
l3b, PLDM_ENTITY_ASSOCIAION_LOGICAL) *
sizeof(pldm_entity)));
start = data;
hdr = reinterpret_cast<pldm_pdr_hdr*>(start);
EXPECT_EQ(le32toh(hdr->record_handle), 6u);
EXPECT_EQ(hdr->type, PLDM_PDR_ENTITY_ASSOCIATION);
EXPECT_EQ(le16toh(hdr->length), size - sizeof(struct pldm_pdr_hdr));
start += sizeof(pldm_pdr_hdr);
containerId = reinterpret_cast<uint16_t*>(start);
EXPECT_EQ(le16toh(*containerId), 4u);
start += sizeof(uint16_t);
EXPECT_EQ(*start, PLDM_ENTITY_ASSOCIAION_LOGICAL);
start += sizeof(uint8_t);
entity = reinterpret_cast<pldm_entity*>(start);
EXPECT_EQ(le16toh(entity->entity_type), 5u);
EXPECT_EQ(le16toh(entity->entity_instance_num), 1u);
EXPECT_EQ(le16toh(entity->entity_container_id), 2u);
start += sizeof(pldm_entity);
EXPECT_EQ(*start, pldm_entity_get_num_children(
l3b, PLDM_ENTITY_ASSOCIAION_LOGICAL));
start += sizeof(uint8_t);
entity = reinterpret_cast<pldm_entity*>(start);
EXPECT_EQ(le16toh(entity->entity_type), 7u);
EXPECT_EQ(le16toh(entity->entity_instance_num), 1u);
EXPECT_EQ(le16toh(entity->entity_container_id), 4u);
EXPECT_EQ(nextRecHandle, 0u);
pldm_pdr_destroy(repo);
pldm_entity_association_tree_destroy(tree);
}
TEST(EntityAssociationPDR, testFind)
{
// 1
// |
// 2--3--4
// |
// 5--6--7
// | |
// 8 9
pldm_entity entities[9]{};
entities[0].entity_type = 1;
entities[1].entity_type = 2;
entities[2].entity_type = 2;
entities[3].entity_type = 3;
entities[4].entity_type = 4;
entities[5].entity_type = 5;
entities[6].entity_type = 5;
entities[7].entity_type = 6;
entities[8].entity_type = 7;
auto tree = pldm_entity_association_tree_init();
auto l1 = pldm_entity_association_tree_add(
tree, &entities[0], 0xFFFF, nullptr, PLDM_ENTITY_ASSOCIAION_PHYSICAL,
false);
EXPECT_NE(l1, nullptr);
auto l2a = pldm_entity_association_tree_add(
tree, &entities[1], 0xFFFF, l1, PLDM_ENTITY_ASSOCIAION_PHYSICAL, false);
EXPECT_NE(l2a, nullptr);
auto l2b = pldm_entity_association_tree_add(
tree, &entities[2], 0xFFFF, l1, PLDM_ENTITY_ASSOCIAION_PHYSICAL, false);
EXPECT_NE(l2b, nullptr);
auto l2c = pldm_entity_association_tree_add(
tree, &entities[3], 0xFFFF, l1, PLDM_ENTITY_ASSOCIAION_PHYSICAL, false);
EXPECT_NE(l2c, nullptr);
auto l3a = pldm_entity_association_tree_add(tree, &entities[4], 0xFFFF, l2a,
PLDM_ENTITY_ASSOCIAION_PHYSICAL,
false);
EXPECT_NE(l3a, nullptr);
auto l3b = pldm_entity_association_tree_add(tree, &entities[5], 0xFFFF, l2a,
PLDM_ENTITY_ASSOCIAION_PHYSICAL,
false);
EXPECT_NE(l3b, nullptr);
auto l3c = pldm_entity_association_tree_add(tree, &entities[6], 0xFFFF, l2a,
PLDM_ENTITY_ASSOCIAION_PHYSICAL,
false);
EXPECT_NE(l3c, nullptr);
auto l4a = pldm_entity_association_tree_add(tree, &entities[7], 0xFFFF, l3a,
PLDM_ENTITY_ASSOCIAION_PHYSICAL,
false);
EXPECT_NE(l4a, nullptr);
auto l4b = pldm_entity_association_tree_add(tree, &entities[8], 0xFFFF, l3b,
PLDM_ENTITY_ASSOCIAION_PHYSICAL,
false);
EXPECT_NE(l4b, nullptr);
pldm_entity entity{};
entity.entity_type = 1;
entity.entity_instance_num = 1;
auto result = pldm_entity_association_tree_find(tree, &entity, false);
EXPECT_EQ(result, l1);
EXPECT_EQ(entity.entity_container_id, 0);
entity.entity_type = 2;
entity.entity_instance_num = 1;
result = pldm_entity_association_tree_find(tree, &entity, false);
EXPECT_EQ(result, l2a);
EXPECT_EQ(entity.entity_container_id, 1);
entity.entity_type = 2;
entity.entity_instance_num = 2;
result = pldm_entity_association_tree_find(tree, &entity, false);
EXPECT_EQ(result, l2b);
EXPECT_EQ(entity.entity_container_id, 1);
entity.entity_type = 3;
entity.entity_instance_num = 1;
result = pldm_entity_association_tree_find(tree, &entity, false);
EXPECT_EQ(result, l2c);
EXPECT_EQ(entity.entity_container_id, 1);
entity.entity_type = 7;
entity.entity_instance_num = 1;
result = pldm_entity_association_tree_find(tree, &entity, false);
EXPECT_EQ(result, l4b);
EXPECT_EQ(entity.entity_container_id, 4);
pldm_entity_association_tree_destroy(tree);
}
TEST(EntityAssociationPDR, testCopyTree)
{
pldm_entity entities[4]{};
entities[0].entity_type = 1;
entities[1].entity_type = 2;
entities[2].entity_type = 2;
entities[3].entity_type = 3;
auto orgTree = pldm_entity_association_tree_init();
auto newTree = pldm_entity_association_tree_init();
auto l1 = pldm_entity_association_tree_add(
orgTree, &entities[0], 0xFFFF, nullptr, PLDM_ENTITY_ASSOCIAION_PHYSICAL,
false);
EXPECT_NE(l1, nullptr);
auto l2a = pldm_entity_association_tree_add(
orgTree, &entities[1], 0xFFFF, l1, PLDM_ENTITY_ASSOCIAION_PHYSICAL,
false);
EXPECT_NE(l2a, nullptr);
auto l2b = pldm_entity_association_tree_add(
orgTree, &entities[2], 0xFFFF, l1, PLDM_ENTITY_ASSOCIAION_PHYSICAL,
false);
EXPECT_NE(l2b, nullptr);
auto l2c = pldm_entity_association_tree_add(
orgTree, &entities[3], 0xFFFF, l1, PLDM_ENTITY_ASSOCIAION_PHYSICAL,
false);
EXPECT_NE(l2c, nullptr);
size_t orgNum{};
pldm_entity* orgOut = nullptr;
pldm_entity_association_tree_visit(orgTree, &orgOut, &orgNum);
EXPECT_EQ(orgNum, 4u);
pldm_entity_association_tree_copy_root(orgTree, newTree);
size_t newNum{};
pldm_entity* newOut = nullptr;
pldm_entity_association_tree_visit(newTree, &newOut, &newNum);
EXPECT_EQ(newNum, orgNum);
EXPECT_EQ(newOut[0].entity_type, 1u);
EXPECT_EQ(newOut[0].entity_instance_num, 1u);
EXPECT_EQ(newOut[0].entity_container_id, 0u);
free(orgOut);
free(newOut);
pldm_entity_association_tree_destroy(orgTree);
pldm_entity_association_tree_destroy(newTree);
}
TEST(EntityAssociationPDR, testExtract)
{
std::vector<uint8_t> pdr{};
pdr.resize(sizeof(pldm_pdr_hdr) + sizeof(pldm_pdr_entity_association) +
sizeof(pldm_entity) * 4);
pldm_pdr_hdr* hdr = reinterpret_cast<pldm_pdr_hdr*>(pdr.data());
hdr->type = PLDM_PDR_ENTITY_ASSOCIATION;
hdr->length =
htole16(sizeof(pldm_pdr_entity_association) + sizeof(pldm_entity) * 4);
pldm_pdr_entity_association* e =
reinterpret_cast<pldm_pdr_entity_association*>(pdr.data() +
sizeof(pldm_pdr_hdr));
e->container_id = htole16(1);
e->num_children = 5;
e->container.entity_type = htole16(1);
e->container.entity_instance_num = htole16(1);
e->container.entity_container_id = htole16(0);
pldm_entity* entity = e->children;
entity->entity_type = htole16(2);
entity->entity_instance_num = htole16(1);
entity->entity_container_id = htole16(1);
++entity;
entity->entity_type = htole16(3);
entity->entity_instance_num = htole16(1);
entity->entity_container_id = htole16(1);
++entity;
entity->entity_type = htole16(4);
entity->entity_instance_num = htole16(1);
entity->entity_container_id = htole16(1);
++entity;
entity->entity_type = htole16(5);
entity->entity_instance_num = htole16(1);
entity->entity_container_id = htole16(1);
++entity;
entity->entity_type = htole16(6);
entity->entity_instance_num = htole16(1);
entity->entity_container_id = htole16(1);
size_t num{};
pldm_entity* out = nullptr;
pldm_entity_association_pdr_extract(pdr.data(), pdr.size(), &num, &out);
EXPECT_EQ(num, (unsigned)e->num_children + 1);
EXPECT_EQ(out[0].entity_type, 1u);
EXPECT_EQ(out[0].entity_instance_num, 1u);
EXPECT_EQ(out[0].entity_container_id, 0u);
EXPECT_EQ(out[1].entity_type, 2u);
EXPECT_EQ(out[1].entity_instance_num, 1u);
EXPECT_EQ(out[1].entity_container_id, 1u);
EXPECT_EQ(out[2].entity_type, 3u);
EXPECT_EQ(out[2].entity_instance_num, 1u);
EXPECT_EQ(out[2].entity_container_id, 1u);
EXPECT_EQ(out[3].entity_type, 4u);
EXPECT_EQ(out[3].entity_instance_num, 1u);
EXPECT_EQ(out[3].entity_container_id, 1u);
EXPECT_EQ(out[4].entity_type, 5u);
EXPECT_EQ(out[4].entity_instance_num, 1u);
EXPECT_EQ(out[4].entity_container_id, 1u);
EXPECT_EQ(out[5].entity_type, 6u);
EXPECT_EQ(out[5].entity_instance_num, 1u);
EXPECT_EQ(out[5].entity_container_id, 1u);
free(out);
}
TEST(EntityAssociationPDR, testGetChildren)
{
pldm_entity entities[4]{};
entities[0].entity_type = 1;
entities[1].entity_type = 2;
entities[2].entity_type = 2;
entities[3].entity_type = 3;
auto tree = pldm_entity_association_tree_init();
auto l1 = pldm_entity_association_tree_add(
tree, &entities[0], 0xFFFF, nullptr, PLDM_ENTITY_ASSOCIAION_PHYSICAL,
false);
EXPECT_NE(l1, nullptr);
auto l2a = pldm_entity_association_tree_add(
tree, &entities[1], 0xFFFF, l1, PLDM_ENTITY_ASSOCIAION_PHYSICAL, false);
EXPECT_NE(l2a, nullptr);
auto l2b = pldm_entity_association_tree_add(
tree, &entities[2], 0xFFFF, l1, PLDM_ENTITY_ASSOCIAION_PHYSICAL, false);
EXPECT_NE(l2b, nullptr);
auto l2c = pldm_entity_association_tree_add(
tree, &entities[3], 0xFFFF, l1, PLDM_ENTITY_ASSOCIAION_PHYSICAL, false);
EXPECT_NE(l2c, nullptr);
pldm_entity et1;
et1.entity_type = 2;
et1.entity_instance_num = 1;
EXPECT_EQ(true, pldm_is_current_parent_child(l1, &et1));
pldm_entity et2;
et2.entity_type = 2;
et2.entity_instance_num = 2;
EXPECT_EQ(true, pldm_is_current_parent_child(l1, &et2));
pldm_entity et3;
et3.entity_type = 2;
et3.entity_instance_num = 3;
EXPECT_EQ(false, pldm_is_current_parent_child(l1, &et3));
pldm_entity_association_tree_destroy(tree);
}
TEST(EntityAssociationPDR, testEntityInstanceNumber)
{
pldm_entity entities[9]{};
entities[0].entity_type = 1;
entities[1].entity_type = 2;
entities[2].entity_type = 2;
entities[3].entity_type = 2;
entities[4].entity_type = 2;
entities[5].entity_type = 2;
entities[6].entity_type = 2;
entities[7].entity_type = 3;
entities[8].entity_type = 3;
auto tree = pldm_entity_association_tree_init();
auto repo = pldm_pdr_init();
uint16_t terminusHdl{};
uint16_t entityType{};
uint16_t entityInstanceNum{};
uint16_t containerId{};
auto node = pldm_entity_association_tree_add(
tree, &entities[0], 0xFFFF, nullptr, PLDM_ENTITY_ASSOCIAION_PHYSICAL,
false);
EXPECT_NE(node, nullptr);
auto l1 = pldm_entity_association_tree_add(
tree, &entities[1], 63, node, PLDM_ENTITY_ASSOCIAION_PHYSICAL, false);
auto first = pldm_pdr_add_fru_record_set(
repo, 1, 1, entities[1].entity_type, entities[1].entity_instance_num,
entities[1].entity_container_id, 1);
EXPECT_NE(l1, nullptr);
EXPECT_EQ(entities[1].entity_instance_num, 63);
EXPECT_EQ(first, pldm_pdr_get_record_handle(
repo, pldm_pdr_fru_record_set_find_by_rsi(
repo, 1, &terminusHdl, &entityType,
&entityInstanceNum, &containerId, false)));
EXPECT_EQ(entityType, 2);
EXPECT_EQ(entityInstanceNum, 63);
auto l2 = pldm_entity_association_tree_add(
tree, &entities[2], 37, node, PLDM_ENTITY_ASSOCIAION_PHYSICAL, false);
auto second = pldm_pdr_add_fru_record_set(
repo, 1, 2, entities[2].entity_type, entities[2].entity_instance_num,
entities[2].entity_container_id, 2);
EXPECT_NE(l2, nullptr);
EXPECT_EQ(entities[2].entity_instance_num, 37);
EXPECT_EQ(second, pldm_pdr_get_record_handle(
repo, pldm_pdr_fru_record_set_find_by_rsi(
repo, 2, &terminusHdl, &entityType,
&entityInstanceNum, &containerId, false)));
EXPECT_EQ(entityType, 2);
EXPECT_EQ(entityInstanceNum, 37);
auto l3 = pldm_entity_association_tree_add(
tree, &entities[3], 44, node, PLDM_ENTITY_ASSOCIAION_PHYSICAL, false);
auto third = pldm_pdr_add_fru_record_set(
repo, 1, 3, entities[3].entity_type, entities[3].entity_instance_num,
entities[3].entity_container_id, 3);
EXPECT_NE(l3, nullptr);
EXPECT_EQ(entities[3].entity_instance_num, 44);
EXPECT_EQ(third, pldm_pdr_get_record_handle(
repo, pldm_pdr_fru_record_set_find_by_rsi(
repo, 3, &terminusHdl, &entityType,
&entityInstanceNum, &containerId, false)));
EXPECT_EQ(entityType, 2);
EXPECT_EQ(entityInstanceNum, 44);
auto l4 = pldm_entity_association_tree_add(
tree, &entities[4], 89, node, PLDM_ENTITY_ASSOCIAION_PHYSICAL, false);
auto fourth = pldm_pdr_add_fru_record_set(
repo, 1, 4, entities[4].entity_type, entities[4].entity_instance_num,
entities[4].entity_container_id, 4);
EXPECT_NE(l4, nullptr);
EXPECT_EQ(entities[4].entity_instance_num, 89);
EXPECT_EQ(fourth, pldm_pdr_get_record_handle(
repo, pldm_pdr_fru_record_set_find_by_rsi(
repo, 4, &terminusHdl, &entityType,
&entityInstanceNum, &containerId, false)));
EXPECT_EQ(entityType, 2);
EXPECT_EQ(entityInstanceNum, 89);
auto l5 = pldm_entity_association_tree_add(tree, &entities[5], 0xFFFF, node,
PLDM_ENTITY_ASSOCIAION_PHYSICAL,
false);
auto fifth = pldm_pdr_add_fru_record_set(
repo, 1, 5, entities[5].entity_type, entities[5].entity_instance_num,
entities[5].entity_container_id, 5);
EXPECT_NE(l5, nullptr);
EXPECT_EQ(entities[5].entity_instance_num, 90);
EXPECT_EQ(fifth, pldm_pdr_get_record_handle(
repo, pldm_pdr_fru_record_set_find_by_rsi(
repo, 5, &terminusHdl, &entityType,
&entityInstanceNum, &containerId, false)));
EXPECT_EQ(entityType, 2);
EXPECT_EQ(entityInstanceNum, 90);
auto l6 = pldm_entity_association_tree_add(
tree, &entities[6], 90, node, PLDM_ENTITY_ASSOCIAION_PHYSICAL, false);
EXPECT_EQ(l6, nullptr);
auto l7 = pldm_entity_association_tree_add(
tree, &entities[7], 100, l1, PLDM_ENTITY_ASSOCIAION_PHYSICAL, false);
auto seventh = pldm_pdr_add_fru_record_set(
repo, 1, 7, entities[7].entity_type, entities[7].entity_instance_num,
entities[7].entity_container_id, 7);
EXPECT_NE(l7, nullptr);
EXPECT_EQ(entities[7].entity_instance_num, 100);
EXPECT_EQ(seventh, pldm_pdr_get_record_handle(
repo, pldm_pdr_fru_record_set_find_by_rsi(
repo, 7, &terminusHdl, &entityType,
&entityInstanceNum, &containerId, false)));
EXPECT_EQ(entityType, 3);
EXPECT_EQ(entityInstanceNum, 100);
auto l8 = pldm_entity_association_tree_add(
tree, &entities[8], 100, l2, PLDM_ENTITY_ASSOCIAION_PHYSICAL, false);
auto eighth = pldm_pdr_add_fru_record_set(
repo, 1, 8, entities[8].entity_type, entities[8].entity_instance_num,
entities[8].entity_container_id, 8);
EXPECT_NE(l8, nullptr);
EXPECT_EQ(entities[8].entity_instance_num, 100);
EXPECT_EQ(eighth, pldm_pdr_get_record_handle(
repo, pldm_pdr_fru_record_set_find_by_rsi(
repo, 8, &terminusHdl, &entityType,
&entityInstanceNum, &containerId, false)));
EXPECT_EQ(entityType, 3);
EXPECT_EQ(entityInstanceNum, 100);
pldm_pdr_destroy(repo);
pldm_entity_association_tree_destroy(tree);
}
TEST(EntityAssociationPDR, findAndAddHostPDR)
{
// Tree - 1
//
// 11521(1,0)
// |
// 45 (1,1)
// |
// 64 (1,2)
// |
// -----------------------
// | |
// 67(0,3) 67(1,3)
// | |
// 135(0,4) 135(0,5)
// | |
// 32903(0,6) 32903(0,7)
pldm_entity entities[9]{};
entities[0].entity_type = 11521;
entities[1].entity_type = 45;
entities[2].entity_type = 64;
entities[3].entity_type = 67;
entities[4].entity_type = 67;
entities[5].entity_type = 135;
entities[5].entity_container_id = 2;
entities[6].entity_type = 135;
entities[6].entity_container_id = 3;
entities[7].entity_type = 32903;
entities[8].entity_type = 32903;
auto tree = pldm_entity_association_tree_init();
auto l1 =
pldm_entity_association_tree_add(tree, &entities[0], 0xFFFF, nullptr,
PLDM_ENTITY_ASSOCIAION_LOGICAL, false);
EXPECT_NE(l1, nullptr);
auto l2 = pldm_entity_association_tree_add(
tree, &entities[1], 0xFFFF, l1, PLDM_ENTITY_ASSOCIAION_PHYSICAL, false);
EXPECT_NE(l2, nullptr);
auto l3 = pldm_entity_association_tree_add(
tree, &entities[2], 0xFFFF, l2, PLDM_ENTITY_ASSOCIAION_PHYSICAL, false);
EXPECT_NE(l3, nullptr);
auto l4a = pldm_entity_association_tree_add(
tree, &entities[3], 0, l3, PLDM_ENTITY_ASSOCIAION_PHYSICAL, false);
EXPECT_NE(l4a, nullptr);
auto l4b = pldm_entity_association_tree_add(
tree, &entities[4], 1, l3, PLDM_ENTITY_ASSOCIAION_PHYSICAL, false);
EXPECT_NE(l4b, nullptr);
auto l5a = pldm_entity_association_tree_add(
tree, &entities[5], 0, l4a, PLDM_ENTITY_ASSOCIAION_PHYSICAL, true);
EXPECT_NE(l5a, nullptr);
auto l5b = pldm_entity_association_tree_add(
tree, &entities[6], 0, l4b, PLDM_ENTITY_ASSOCIAION_PHYSICAL, true);
EXPECT_NE(l5b, nullptr);
pldm_entity entity{};
entity.entity_type = 135;
entity.entity_instance_num = 0;
entity.entity_container_id = 2;
auto result1 = pldm_entity_association_tree_find(tree, &entity, true);
EXPECT_EQ(result1, l5a);
EXPECT_EQ(entities[5].entity_container_id, 4);
EXPECT_EQ(pldm_extract_host_container_id(l5a), 2);
auto l6a = pldm_entity_association_tree_add(
tree, &entities[7], 0, result1, PLDM_ENTITY_ASSOCIAION_PHYSICAL, true);
EXPECT_NE(l6a, nullptr);
entity.entity_type = 135;
entity.entity_instance_num = 0;
entity.entity_container_id = 3;
auto result2 = pldm_entity_association_tree_find(tree, &entity, true);
EXPECT_EQ(result2, l5b);
EXPECT_EQ(entities[6].entity_container_id, 5);
EXPECT_EQ(pldm_extract_host_container_id(l5b), 3);
auto l7a = pldm_entity_association_tree_add(
tree, &entities[8], 0, result2, PLDM_ENTITY_ASSOCIAION_PHYSICAL, true);
EXPECT_NE(l7a, nullptr);
pldm_entity_association_tree_destroy(tree);
}
|
; A047516: Numbers that are congruent to {1, 3, 4, 6, 7} mod 8.
; 1,3,4,6,7,9,11,12,14,15,17,19,20,22,23,25,27,28,30,31,33,35,36,38,39,41,43,44,46,47,49,51,52,54,55,57,59,60,62,63,65,67,68,70,71,73,75,76,78,79,81,83,84,86,87,89,91,92,94,95,97,99,100,102,103,105,107,108,110,111,113,115,116,118,119,121,123,124,126,127,129,131,132,134,135,137,139,140,142,143,145,147,148,150,151,153,155,156,158,159
mul $0,8
add $0,7
div $0,5
|
DEVICE ZXSPECTRUM48
org $8000
; 17 bytes block of "default" memory values
db "ABCDEFGHIJKLMNOPZ"
ALIGN 0 ; error
ALIGN 1,-1 ; error
ALIGN 1,256 ; error
ALIGN 3 ; error
ALIGN 5,10 ; error
ALIGN $10000 ; error
; re-run over the initial values again with different ALIGN directives
org $8000
db 'a' ; [8000] = 'a'
ALIGN 1 ; effective nothing should happen here
ALIGN 1, '!' ; and neighter here
ALIGN 2 ; this should advance to $8002 + preserve memory
ALIGN 4, 'b' ; [8002] = [8003] = 'b'
ALIGN 7, '!' ; error
ALIGN 8 ; advance to 8008, preserve memory
ALIGN 16, 'c' ; [8008..800F] = 'c'
ALIGN ; should not make any difference (already at MOD 4 address)
; the final result should be "aBbbEFGHccccccccZ"
SAVEBIN "dir_align.bin", $8000, 17 ; modified area is saved into BIN file
ALIGN 1, ; error
|
dnl AMD K7 mpn_copyi -- copy limb vector, incrementing.
dnl Copyright 1999, 2000, 2002, 2003 Free Software Foundation, Inc.
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 modify
dnl it under the terms of either:
dnl
dnl * the GNU Lesser General Public License as published by the Free
dnl Software Foundation; either version 3 of the License, or (at your
dnl option) any later version.
dnl
dnl or
dnl
dnl * the GNU General Public License as published by the Free Software
dnl Foundation; either version 2 of the License, or (at your option) any
dnl later version.
dnl
dnl or both in parallel, as here.
dnl
dnl The GNU MP Library is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
dnl for more details.
dnl
dnl You should have received copies of the GNU General Public License and the
dnl GNU Lesser General Public License along with the GNU MP Library. If not,
dnl see https://www.gnu.org/licenses/.
include(`../config.m4')
C alignment dst/src, A=0mod8 N=4mod8
C A/A A/N N/A N/N
C K7 0.75 1.0 1.0 0.75
C void mpn_copyi (mp_ptr dst, mp_srcptr src, mp_size_t size);
C
C Copy src,size to dst,size.
C
C This code at 0.75 or 1.0 c/l is always faster than a plain rep movsl at
C 1.33 c/l.
C
C The K7 can do a 64-bit load and 64-bit store in one cycle (optimization
C guile 22007 appendix B), so 0.5 c/l should be possible, however nothing
C under 0.7 c/l is known. Apparently only two 32-bit stores can be done in
C one cycle, so perhaps some scheduling is needed to ensure it's a
C load+store in each cycle, not store+store.
C
C If both source and destination are unaligned then one limb is processed at
C the start to make them aligned and so get 0.75 c/l, whereas if they'd been
C used unaligned it would be 1.5 c/l.
defframe(PARAM_SIZE,12)
defframe(PARAM_SRC, 8)
defframe(PARAM_DST, 4)
dnl parameter space reused
define(SAVE_EBX,`PARAM_SIZE')
dnl minimum 5 since the unrolled code can't handle less than 5
deflit(UNROLL_THRESHOLD, 5)
TEXT
ALIGN(32)
PROLOGUE(mpn_copyi)
deflit(`FRAME',0)
movl PARAM_SIZE, %ecx
movl %ebx, SAVE_EBX
movl PARAM_SRC, %eax
movl PARAM_DST, %edx
cmpl $UNROLL_THRESHOLD, %ecx
jae L(unroll)
orl %ecx, %ecx
jz L(simple_done)
L(simple):
C eax src, incrementing
C ebx scratch
C ecx counter
C edx dst, incrementing
C
C this loop is 2 cycles/limb
movl (%eax), %ebx
movl %ebx, (%edx)
decl %ecx
leal 4(%eax), %eax
leal 4(%edx), %edx
jnz L(simple)
L(simple_done):
movl SAVE_EBX, %ebx
ret
L(unroll):
movl %eax, %ebx
leal -12(%eax,%ecx,4), %eax C src end - 12
subl $3, %ecx C size-3
andl %edx, %ebx
leal (%edx,%ecx,4), %edx C dst end - 12
negl %ecx
testl $4, %ebx C testl to pad code closer to 16 bytes for L(top)
jz L(aligned)
C both src and dst unaligned, process one limb to align them
movl (%eax,%ecx,4), %ebx
movl %ebx, (%edx,%ecx,4)
incl %ecx
L(aligned):
ALIGN(16)
L(top):
C eax src end - 12
C ebx
C ecx counter, negative, limbs
C edx dst end - 12
movq (%eax,%ecx,4), %mm0
movq 8(%eax,%ecx,4), %mm1
addl $4, %ecx
movq %mm0, -16(%edx,%ecx,4)
movq %mm1, -16+8(%edx,%ecx,4)
ja L(top) C jump no carry and not zero
C now %ecx is 0 to 3 representing respectively 3 to 0 limbs remaining
testb $2, %cl
jnz L(finish_not_two)
movq (%eax,%ecx,4), %mm0
movq %mm0, (%edx,%ecx,4)
L(finish_not_two):
testb $1, %cl
jnz L(done)
movl 8(%eax), %ebx
movl %ebx, 8(%edx)
L(done):
movl SAVE_EBX, %ebx
emms
ret
EPILOGUE()
|
db MILTANK ; 241
db 95, 80, 105, 100, 40, 70
; hp atk def spd sat sdf
db NORMAL, NORMAL ; type
db 45 ; catch rate
db 200 ; base exp
db MOOMOO_MILK, MOOMOO_MILK ; items
db GENDER_F100 ; gender ratio
db 100 ; unknown 1
db 20 ; step cycles to hatch
db 5 ; unknown 2
INCBIN "gfx/pokemon/miltank/front.dimensions"
db 0, 0, 0, 0 ; padding
db GROWTH_SLOW ; growth rate
dn EGG_GROUND, EGG_GROUND ; egg groups
; tm/hm learnset
tmhm DYNAMICPUNCH, HEADBUTT, CURSE, ROLLOUT, TOXIC, ZAP_CANNON, ROCK_SMASH, PSYCH_UP, HIDDEN_POWER, SUNNY_DAY, SWEET_SCENT, SNORE, BLIZZARD, HYPER_BEAM, ICY_WIND, PROTECT, RAIN_DANCE, ENDURE, FRUSTRATION, IRON_TAIL, THUNDER, EARTHQUAKE, RETURN, SHADOW_BALL, MUD_SLAP, DOUBLE_TEAM, ICE_PUNCH, SWAGGER, SLEEP_TALK, SANDSTORM, DEFENSE_CURL, THUNDERPUNCH, REST, ATTRACT, FIRE_PUNCH, SURF, STRENGTH, THUNDERBOLT, ICE_BEAM
; end
|
// Copyright 2014 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "src/base/iterator.h"
#include "src/compiler/backend/instruction-selector-impl.h"
#include "src/compiler/node-matchers.h"
#include "src/compiler/node-properties.h"
#include "src/execution/ppc/frame-constants-ppc.h"
namespace v8 {
namespace internal {
namespace compiler {
enum ImmediateMode {
kInt16Imm,
kInt16Imm_Unsigned,
kInt16Imm_Negate,
kInt16Imm_4ByteAligned,
kShift32Imm,
kShift64Imm,
kNoImmediate
};
// Adds PPC-specific methods for generating operands.
class PPCOperandGenerator final : public OperandGenerator {
public:
explicit PPCOperandGenerator(InstructionSelector* selector)
: OperandGenerator(selector) {}
InstructionOperand UseOperand(Node* node, ImmediateMode mode) {
if (CanBeImmediate(node, mode)) {
return UseImmediate(node);
}
return UseRegister(node);
}
bool CanBeImmediate(Node* node, ImmediateMode mode) {
int64_t value;
if (node->opcode() == IrOpcode::kInt32Constant)
value = OpParameter<int32_t>(node->op());
else if (node->opcode() == IrOpcode::kInt64Constant)
value = OpParameter<int64_t>(node->op());
else
return false;
return CanBeImmediate(value, mode);
}
bool CanBeImmediate(int64_t value, ImmediateMode mode) {
switch (mode) {
case kInt16Imm:
return is_int16(value);
case kInt16Imm_Unsigned:
return is_uint16(value);
case kInt16Imm_Negate:
return is_int16(-value);
case kInt16Imm_4ByteAligned:
return is_int16(value) && !(value & 3);
case kShift32Imm:
return 0 <= value && value < 32;
case kShift64Imm:
return 0 <= value && value < 64;
case kNoImmediate:
return false;
}
return false;
}
};
namespace {
void VisitRR(InstructionSelector* selector, InstructionCode opcode,
Node* node) {
PPCOperandGenerator g(selector);
selector->Emit(opcode, g.DefineAsRegister(node),
g.UseRegister(node->InputAt(0)));
}
void VisitRRR(InstructionSelector* selector, InstructionCode opcode,
Node* node) {
PPCOperandGenerator g(selector);
selector->Emit(opcode, g.DefineAsRegister(node),
g.UseRegister(node->InputAt(0)),
g.UseRegister(node->InputAt(1)));
}
void VisitRRO(InstructionSelector* selector, InstructionCode opcode, Node* node,
ImmediateMode operand_mode) {
PPCOperandGenerator g(selector);
selector->Emit(opcode, g.DefineAsRegister(node),
g.UseRegister(node->InputAt(0)),
g.UseOperand(node->InputAt(1), operand_mode));
}
#if V8_TARGET_ARCH_PPC64
void VisitTryTruncateDouble(InstructionSelector* selector,
InstructionCode opcode, Node* node) {
PPCOperandGenerator g(selector);
InstructionOperand inputs[] = {g.UseRegister(node->InputAt(0))};
InstructionOperand outputs[2];
size_t output_count = 0;
outputs[output_count++] = g.DefineAsRegister(node);
Node* success_output = NodeProperties::FindProjection(node, 1);
if (success_output) {
outputs[output_count++] = g.DefineAsRegister(success_output);
}
selector->Emit(opcode, output_count, outputs, 1, inputs);
}
#endif
// Shared routine for multiple binary operations.
template <typename Matcher>
void VisitBinop(InstructionSelector* selector, Node* node,
InstructionCode opcode, ImmediateMode operand_mode,
FlagsContinuation* cont) {
PPCOperandGenerator g(selector);
Matcher m(node);
InstructionOperand inputs[4];
size_t input_count = 0;
InstructionOperand outputs[2];
size_t output_count = 0;
inputs[input_count++] = g.UseRegister(m.left().node());
inputs[input_count++] = g.UseOperand(m.right().node(), operand_mode);
if (cont->IsDeoptimize()) {
// If we can deoptimize as a result of the binop, we need to make sure that
// the deopt inputs are not overwritten by the binop result. One way
// to achieve that is to declare the output register as same-as-first.
outputs[output_count++] = g.DefineSameAsFirst(node);
} else {
outputs[output_count++] = g.DefineAsRegister(node);
}
DCHECK_NE(0u, input_count);
DCHECK_NE(0u, output_count);
DCHECK_GE(arraysize(inputs), input_count);
DCHECK_GE(arraysize(outputs), output_count);
selector->EmitWithContinuation(opcode, output_count, outputs, input_count,
inputs, cont);
}
// Shared routine for multiple binary operations.
template <typename Matcher>
void VisitBinop(InstructionSelector* selector, Node* node,
InstructionCode opcode, ImmediateMode operand_mode) {
FlagsContinuation cont;
VisitBinop<Matcher>(selector, node, opcode, operand_mode, &cont);
}
} // namespace
void InstructionSelector::VisitStackSlot(Node* node) {
StackSlotRepresentation rep = StackSlotRepresentationOf(node->op());
int slot = frame_->AllocateSpillSlot(rep.size());
OperandGenerator g(this);
Emit(kArchStackSlot, g.DefineAsRegister(node),
sequence()->AddImmediate(Constant(slot)), 0, nullptr);
}
void InstructionSelector::VisitAbortCSAAssert(Node* node) {
PPCOperandGenerator g(this);
Emit(kArchAbortCSAAssert, g.NoOutput(), g.UseFixed(node->InputAt(0), r4));
}
void InstructionSelector::VisitLoad(Node* node) {
LoadRepresentation load_rep = LoadRepresentationOf(node->op());
PPCOperandGenerator g(this);
Node* base = node->InputAt(0);
Node* offset = node->InputAt(1);
InstructionCode opcode = kArchNop;
ImmediateMode mode = kInt16Imm;
switch (load_rep.representation()) {
case MachineRepresentation::kFloat32:
opcode = kPPC_LoadFloat32;
break;
case MachineRepresentation::kFloat64:
opcode = kPPC_LoadDouble;
break;
case MachineRepresentation::kBit: // Fall through.
case MachineRepresentation::kWord8:
opcode = load_rep.IsSigned() ? kPPC_LoadWordS8 : kPPC_LoadWordU8;
break;
case MachineRepresentation::kWord16:
opcode = load_rep.IsSigned() ? kPPC_LoadWordS16 : kPPC_LoadWordU16;
break;
case MachineRepresentation::kWord32:
opcode = kPPC_LoadWordU32;
break;
case MachineRepresentation::kCompressedPointer: // Fall through.
case MachineRepresentation::kCompressed:
#ifdef V8_COMPRESS_POINTERS
opcode = kPPC_LoadWordS32;
mode = kInt16Imm_4ByteAligned;
break;
#else
UNREACHABLE();
#endif
#ifdef V8_COMPRESS_POINTERS
case MachineRepresentation::kTaggedSigned:
opcode = kPPC_LoadDecompressTaggedSigned;
break;
case MachineRepresentation::kTaggedPointer:
opcode = kPPC_LoadDecompressTaggedPointer;
break;
case MachineRepresentation::kTagged:
opcode = kPPC_LoadDecompressAnyTagged;
break;
#else
case MachineRepresentation::kTaggedSigned: // Fall through.
case MachineRepresentation::kTaggedPointer: // Fall through.
case MachineRepresentation::kTagged: // Fall through.
#endif
case MachineRepresentation::kWord64:
opcode = kPPC_LoadWord64;
mode = kInt16Imm_4ByteAligned;
break;
case MachineRepresentation::kSimd128:
opcode = kPPC_LoadSimd128;
// Vectors do not support MRI mode, only MRR is available.
mode = kNoImmediate;
break;
case MachineRepresentation::kNone:
UNREACHABLE();
}
if (node->opcode() == IrOpcode::kPoisonedLoad &&
poisoning_level_ != PoisoningMitigationLevel::kDontPoison) {
opcode |= MiscField::encode(kMemoryAccessPoisoned);
}
bool is_atomic = (node->opcode() == IrOpcode::kWord32AtomicLoad ||
node->opcode() == IrOpcode::kWord64AtomicLoad);
if (g.CanBeImmediate(offset, mode)) {
Emit(opcode | AddressingModeField::encode(kMode_MRI),
g.DefineAsRegister(node), g.UseRegister(base), g.UseImmediate(offset),
g.UseImmediate(is_atomic));
} else if (g.CanBeImmediate(base, mode)) {
Emit(opcode | AddressingModeField::encode(kMode_MRI),
g.DefineAsRegister(node), g.UseRegister(offset), g.UseImmediate(base),
g.UseImmediate(is_atomic));
} else {
Emit(opcode | AddressingModeField::encode(kMode_MRR),
g.DefineAsRegister(node), g.UseRegister(base), g.UseRegister(offset),
g.UseImmediate(is_atomic));
}
}
void InstructionSelector::VisitPoisonedLoad(Node* node) { VisitLoad(node); }
void InstructionSelector::VisitProtectedLoad(Node* node) {
// TODO(eholk)
UNIMPLEMENTED();
}
void InstructionSelector::VisitStore(Node* node) {
PPCOperandGenerator g(this);
Node* base = node->InputAt(0);
Node* offset = node->InputAt(1);
Node* value = node->InputAt(2);
bool is_atomic = (node->opcode() == IrOpcode::kWord32AtomicStore ||
node->opcode() == IrOpcode::kWord64AtomicStore);
MachineRepresentation rep;
WriteBarrierKind write_barrier_kind = kNoWriteBarrier;
if (is_atomic) {
rep = AtomicStoreRepresentationOf(node->op());
} else {
StoreRepresentation store_rep = StoreRepresentationOf(node->op());
write_barrier_kind = store_rep.write_barrier_kind();
rep = store_rep.representation();
}
if (FLAG_enable_unconditional_write_barriers &&
CanBeTaggedOrCompressedPointer(rep)) {
write_barrier_kind = kFullWriteBarrier;
}
if (write_barrier_kind != kNoWriteBarrier && !FLAG_disable_write_barriers) {
DCHECK(CanBeTaggedOrCompressedPointer(rep));
AddressingMode addressing_mode;
InstructionOperand inputs[3];
size_t input_count = 0;
inputs[input_count++] = g.UseUniqueRegister(base);
// OutOfLineRecordWrite uses the offset in an 'add' instruction as well as
// for the store itself, so we must check compatibility with both.
if (g.CanBeImmediate(offset, kInt16Imm)
#if V8_TARGET_ARCH_PPC64
&& g.CanBeImmediate(offset, kInt16Imm_4ByteAligned)
#endif
) {
inputs[input_count++] = g.UseImmediate(offset);
addressing_mode = kMode_MRI;
} else {
inputs[input_count++] = g.UseUniqueRegister(offset);
addressing_mode = kMode_MRR;
}
inputs[input_count++] = g.UseUniqueRegister(value);
RecordWriteMode record_write_mode =
WriteBarrierKindToRecordWriteMode(write_barrier_kind);
InstructionOperand temps[] = {g.TempRegister(), g.TempRegister()};
size_t const temp_count = arraysize(temps);
InstructionCode code = kArchStoreWithWriteBarrier;
code |= AddressingModeField::encode(addressing_mode);
code |= MiscField::encode(static_cast<int>(record_write_mode));
CHECK_EQ(is_atomic, false);
Emit(code, 0, nullptr, input_count, inputs, temp_count, temps);
} else {
ArchOpcode opcode;
ImmediateMode mode = kInt16Imm;
switch (rep) {
case MachineRepresentation::kFloat32:
opcode = kPPC_StoreFloat32;
break;
case MachineRepresentation::kFloat64:
opcode = kPPC_StoreDouble;
break;
case MachineRepresentation::kBit: // Fall through.
case MachineRepresentation::kWord8:
opcode = kPPC_StoreWord8;
break;
case MachineRepresentation::kWord16:
opcode = kPPC_StoreWord16;
break;
case MachineRepresentation::kWord32:
opcode = kPPC_StoreWord32;
break;
case MachineRepresentation::kCompressedPointer: // Fall through.
case MachineRepresentation::kCompressed:
#ifdef V8_COMPRESS_POINTERS
opcode = kPPC_StoreCompressTagged;
break;
#else
UNREACHABLE();
break;
#endif
case MachineRepresentation::kTaggedSigned: // Fall through.
case MachineRepresentation::kTaggedPointer: // Fall through.
case MachineRepresentation::kTagged:
mode = kInt16Imm_4ByteAligned;
opcode = kPPC_StoreCompressTagged;
break;
case MachineRepresentation::kWord64:
opcode = kPPC_StoreWord64;
mode = kInt16Imm_4ByteAligned;
break;
case MachineRepresentation::kSimd128:
opcode = kPPC_StoreSimd128;
// Vectors do not support MRI mode, only MRR is available.
mode = kNoImmediate;
break;
case MachineRepresentation::kNone:
UNREACHABLE();
}
if (g.CanBeImmediate(offset, mode)) {
Emit(opcode | AddressingModeField::encode(kMode_MRI), g.NoOutput(),
g.UseRegister(base), g.UseImmediate(offset), g.UseRegister(value),
g.UseImmediate(is_atomic));
} else if (g.CanBeImmediate(base, mode)) {
Emit(opcode | AddressingModeField::encode(kMode_MRI), g.NoOutput(),
g.UseRegister(offset), g.UseImmediate(base), g.UseRegister(value),
g.UseImmediate(is_atomic));
} else {
Emit(opcode | AddressingModeField::encode(kMode_MRR), g.NoOutput(),
g.UseRegister(base), g.UseRegister(offset), g.UseRegister(value),
g.UseImmediate(is_atomic));
}
}
}
void InstructionSelector::VisitProtectedStore(Node* node) {
// TODO(eholk)
UNIMPLEMENTED();
}
// Architecture supports unaligned access, therefore VisitLoad is used instead
void InstructionSelector::VisitUnalignedLoad(Node* node) { UNREACHABLE(); }
// Architecture supports unaligned access, therefore VisitStore is used instead
void InstructionSelector::VisitUnalignedStore(Node* node) { UNREACHABLE(); }
template <typename Matcher>
static void VisitLogical(InstructionSelector* selector, Node* node, Matcher* m,
ArchOpcode opcode, bool left_can_cover,
bool right_can_cover, ImmediateMode imm_mode) {
PPCOperandGenerator g(selector);
// Map instruction to equivalent operation with inverted right input.
ArchOpcode inv_opcode = opcode;
switch (opcode) {
case kPPC_And:
inv_opcode = kPPC_AndComplement;
break;
case kPPC_Or:
inv_opcode = kPPC_OrComplement;
break;
default:
UNREACHABLE();
}
// Select Logical(y, ~x) for Logical(Xor(x, -1), y).
if ((m->left().IsWord32Xor() || m->left().IsWord64Xor()) && left_can_cover) {
Matcher mleft(m->left().node());
if (mleft.right().Is(-1)) {
selector->Emit(inv_opcode, g.DefineAsRegister(node),
g.UseRegister(m->right().node()),
g.UseRegister(mleft.left().node()));
return;
}
}
// Select Logical(x, ~y) for Logical(x, Xor(y, -1)).
if ((m->right().IsWord32Xor() || m->right().IsWord64Xor()) &&
right_can_cover) {
Matcher mright(m->right().node());
if (mright.right().Is(-1)) {
// TODO(all): support shifted operand on right.
selector->Emit(inv_opcode, g.DefineAsRegister(node),
g.UseRegister(m->left().node()),
g.UseRegister(mright.left().node()));
return;
}
}
VisitBinop<Matcher>(selector, node, opcode, imm_mode);
}
static inline bool IsContiguousMask32(uint32_t value, int* mb, int* me) {
int mask_width = base::bits::CountPopulation(value);
int mask_msb = base::bits::CountLeadingZeros32(value);
int mask_lsb = base::bits::CountTrailingZeros32(value);
if ((mask_width == 0) || (mask_msb + mask_width + mask_lsb != 32))
return false;
*mb = mask_lsb + mask_width - 1;
*me = mask_lsb;
return true;
}
#if V8_TARGET_ARCH_PPC64
static inline bool IsContiguousMask64(uint64_t value, int* mb, int* me) {
int mask_width = base::bits::CountPopulation(value);
int mask_msb = base::bits::CountLeadingZeros64(value);
int mask_lsb = base::bits::CountTrailingZeros64(value);
if ((mask_width == 0) || (mask_msb + mask_width + mask_lsb != 64))
return false;
*mb = mask_lsb + mask_width - 1;
*me = mask_lsb;
return true;
}
#endif
// TODO(mbrandy): Absorb rotate-right into rlwinm?
void InstructionSelector::VisitWord32And(Node* node) {
PPCOperandGenerator g(this);
Int32BinopMatcher m(node);
int mb = 0;
int me = 0;
if (m.right().HasResolvedValue() &&
IsContiguousMask32(m.right().ResolvedValue(), &mb, &me)) {
int sh = 0;
Node* left = m.left().node();
if ((m.left().IsWord32Shr() || m.left().IsWord32Shl()) &&
CanCover(node, left)) {
// Try to absorb left/right shift into rlwinm
Int32BinopMatcher mleft(m.left().node());
if (mleft.right().IsInRange(0, 31)) {
left = mleft.left().node();
sh = mleft.right().ResolvedValue();
if (m.left().IsWord32Shr()) {
// Adjust the mask such that it doesn't include any rotated bits.
if (mb > 31 - sh) mb = 31 - sh;
sh = (32 - sh) & 0x1F;
} else {
// Adjust the mask such that it doesn't include any rotated bits.
if (me < sh) me = sh;
}
}
}
if (mb >= me) {
Emit(kPPC_RotLeftAndMask32, g.DefineAsRegister(node), g.UseRegister(left),
g.TempImmediate(sh), g.TempImmediate(mb), g.TempImmediate(me));
return;
}
}
VisitLogical<Int32BinopMatcher>(
this, node, &m, kPPC_And, CanCover(node, m.left().node()),
CanCover(node, m.right().node()), kInt16Imm_Unsigned);
}
#if V8_TARGET_ARCH_PPC64
// TODO(mbrandy): Absorb rotate-right into rldic?
void InstructionSelector::VisitWord64And(Node* node) {
PPCOperandGenerator g(this);
Int64BinopMatcher m(node);
int mb = 0;
int me = 0;
if (m.right().HasResolvedValue() &&
IsContiguousMask64(m.right().ResolvedValue(), &mb, &me)) {
int sh = 0;
Node* left = m.left().node();
if ((m.left().IsWord64Shr() || m.left().IsWord64Shl()) &&
CanCover(node, left)) {
// Try to absorb left/right shift into rldic
Int64BinopMatcher mleft(m.left().node());
if (mleft.right().IsInRange(0, 63)) {
left = mleft.left().node();
sh = mleft.right().ResolvedValue();
if (m.left().IsWord64Shr()) {
// Adjust the mask such that it doesn't include any rotated bits.
if (mb > 63 - sh) mb = 63 - sh;
sh = (64 - sh) & 0x3F;
} else {
// Adjust the mask such that it doesn't include any rotated bits.
if (me < sh) me = sh;
}
}
}
if (mb >= me) {
bool match = false;
ArchOpcode opcode;
int mask;
if (me == 0) {
match = true;
opcode = kPPC_RotLeftAndClearLeft64;
mask = mb;
} else if (mb == 63) {
match = true;
opcode = kPPC_RotLeftAndClearRight64;
mask = me;
} else if (sh && me <= sh && m.left().IsWord64Shl()) {
match = true;
opcode = kPPC_RotLeftAndClear64;
mask = mb;
}
if (match) {
Emit(opcode, g.DefineAsRegister(node), g.UseRegister(left),
g.TempImmediate(sh), g.TempImmediate(mask));
return;
}
}
}
VisitLogical<Int64BinopMatcher>(
this, node, &m, kPPC_And, CanCover(node, m.left().node()),
CanCover(node, m.right().node()), kInt16Imm_Unsigned);
}
#endif
void InstructionSelector::VisitWord32Or(Node* node) {
Int32BinopMatcher m(node);
VisitLogical<Int32BinopMatcher>(
this, node, &m, kPPC_Or, CanCover(node, m.left().node()),
CanCover(node, m.right().node()), kInt16Imm_Unsigned);
}
#if V8_TARGET_ARCH_PPC64
void InstructionSelector::VisitWord64Or(Node* node) {
Int64BinopMatcher m(node);
VisitLogical<Int64BinopMatcher>(
this, node, &m, kPPC_Or, CanCover(node, m.left().node()),
CanCover(node, m.right().node()), kInt16Imm_Unsigned);
}
#endif
void InstructionSelector::VisitWord32Xor(Node* node) {
PPCOperandGenerator g(this);
Int32BinopMatcher m(node);
if (m.right().Is(-1)) {
Emit(kPPC_Not, g.DefineAsRegister(node), g.UseRegister(m.left().node()));
} else {
VisitBinop<Int32BinopMatcher>(this, node, kPPC_Xor, kInt16Imm_Unsigned);
}
}
void InstructionSelector::VisitStackPointerGreaterThan(
Node* node, FlagsContinuation* cont) {
StackCheckKind kind = StackCheckKindOf(node->op());
InstructionCode opcode =
kArchStackPointerGreaterThan | MiscField::encode(static_cast<int>(kind));
PPCOperandGenerator g(this);
// No outputs.
InstructionOperand* const outputs = nullptr;
const int output_count = 0;
// Applying an offset to this stack check requires a temp register. Offsets
// are only applied to the first stack check. If applying an offset, we must
// ensure the input and temp registers do not alias, thus kUniqueRegister.
InstructionOperand temps[] = {g.TempRegister()};
const int temp_count = (kind == StackCheckKind::kJSFunctionEntry) ? 1 : 0;
const auto register_mode = (kind == StackCheckKind::kJSFunctionEntry)
? OperandGenerator::kUniqueRegister
: OperandGenerator::kRegister;
Node* const value = node->InputAt(0);
InstructionOperand inputs[] = {g.UseRegisterWithMode(value, register_mode)};
static constexpr int input_count = arraysize(inputs);
EmitWithContinuation(opcode, output_count, outputs, input_count, inputs,
temp_count, temps, cont);
}
#if V8_TARGET_ARCH_PPC64
void InstructionSelector::VisitWord64Xor(Node* node) {
PPCOperandGenerator g(this);
Int64BinopMatcher m(node);
if (m.right().Is(-1)) {
Emit(kPPC_Not, g.DefineAsRegister(node), g.UseRegister(m.left().node()));
} else {
VisitBinop<Int64BinopMatcher>(this, node, kPPC_Xor, kInt16Imm_Unsigned);
}
}
#endif
void InstructionSelector::VisitWord32Shl(Node* node) {
PPCOperandGenerator g(this);
Int32BinopMatcher m(node);
if (m.left().IsWord32And() && m.right().IsInRange(0, 31)) {
// Try to absorb logical-and into rlwinm
Int32BinopMatcher mleft(m.left().node());
int sh = m.right().ResolvedValue();
int mb;
int me;
if (mleft.right().HasResolvedValue() &&
IsContiguousMask32(mleft.right().ResolvedValue() << sh, &mb, &me)) {
// Adjust the mask such that it doesn't include any rotated bits.
if (me < sh) me = sh;
if (mb >= me) {
Emit(kPPC_RotLeftAndMask32, g.DefineAsRegister(node),
g.UseRegister(mleft.left().node()), g.TempImmediate(sh),
g.TempImmediate(mb), g.TempImmediate(me));
return;
}
}
}
VisitRRO(this, kPPC_ShiftLeft32, node, kShift32Imm);
}
#if V8_TARGET_ARCH_PPC64
void InstructionSelector::VisitWord64Shl(Node* node) {
PPCOperandGenerator g(this);
Int64BinopMatcher m(node);
// TODO(mbrandy): eliminate left sign extension if right >= 32
if (m.left().IsWord64And() && m.right().IsInRange(0, 63)) {
// Try to absorb logical-and into rldic
Int64BinopMatcher mleft(m.left().node());
int sh = m.right().ResolvedValue();
int mb;
int me;
if (mleft.right().HasResolvedValue() &&
IsContiguousMask64(mleft.right().ResolvedValue() << sh, &mb, &me)) {
// Adjust the mask such that it doesn't include any rotated bits.
if (me < sh) me = sh;
if (mb >= me) {
bool match = false;
ArchOpcode opcode;
int mask;
if (me == 0) {
match = true;
opcode = kPPC_RotLeftAndClearLeft64;
mask = mb;
} else if (mb == 63) {
match = true;
opcode = kPPC_RotLeftAndClearRight64;
mask = me;
} else if (sh && me <= sh) {
match = true;
opcode = kPPC_RotLeftAndClear64;
mask = mb;
}
if (match) {
Emit(opcode, g.DefineAsRegister(node),
g.UseRegister(mleft.left().node()), g.TempImmediate(sh),
g.TempImmediate(mask));
return;
}
}
}
}
VisitRRO(this, kPPC_ShiftLeft64, node, kShift64Imm);
}
#endif
void InstructionSelector::VisitWord32Shr(Node* node) {
PPCOperandGenerator g(this);
Int32BinopMatcher m(node);
if (m.left().IsWord32And() && m.right().IsInRange(0, 31)) {
// Try to absorb logical-and into rlwinm
Int32BinopMatcher mleft(m.left().node());
int sh = m.right().ResolvedValue();
int mb;
int me;
if (mleft.right().HasResolvedValue() &&
IsContiguousMask32((uint32_t)(mleft.right().ResolvedValue()) >> sh, &mb,
&me)) {
// Adjust the mask such that it doesn't include any rotated bits.
if (mb > 31 - sh) mb = 31 - sh;
sh = (32 - sh) & 0x1F;
if (mb >= me) {
Emit(kPPC_RotLeftAndMask32, g.DefineAsRegister(node),
g.UseRegister(mleft.left().node()), g.TempImmediate(sh),
g.TempImmediate(mb), g.TempImmediate(me));
return;
}
}
}
VisitRRO(this, kPPC_ShiftRight32, node, kShift32Imm);
}
#if V8_TARGET_ARCH_PPC64
void InstructionSelector::VisitWord64Shr(Node* node) {
PPCOperandGenerator g(this);
Int64BinopMatcher m(node);
if (m.left().IsWord64And() && m.right().IsInRange(0, 63)) {
// Try to absorb logical-and into rldic
Int64BinopMatcher mleft(m.left().node());
int sh = m.right().ResolvedValue();
int mb;
int me;
if (mleft.right().HasResolvedValue() &&
IsContiguousMask64((uint64_t)(mleft.right().ResolvedValue()) >> sh, &mb,
&me)) {
// Adjust the mask such that it doesn't include any rotated bits.
if (mb > 63 - sh) mb = 63 - sh;
sh = (64 - sh) & 0x3F;
if (mb >= me) {
bool match = false;
ArchOpcode opcode;
int mask;
if (me == 0) {
match = true;
opcode = kPPC_RotLeftAndClearLeft64;
mask = mb;
} else if (mb == 63) {
match = true;
opcode = kPPC_RotLeftAndClearRight64;
mask = me;
}
if (match) {
Emit(opcode, g.DefineAsRegister(node),
g.UseRegister(mleft.left().node()), g.TempImmediate(sh),
g.TempImmediate(mask));
return;
}
}
}
}
VisitRRO(this, kPPC_ShiftRight64, node, kShift64Imm);
}
#endif
void InstructionSelector::VisitWord32Sar(Node* node) {
PPCOperandGenerator g(this);
Int32BinopMatcher m(node);
// Replace with sign extension for (x << K) >> K where K is 16 or 24.
if (CanCover(node, m.left().node()) && m.left().IsWord32Shl()) {
Int32BinopMatcher mleft(m.left().node());
if (mleft.right().Is(16) && m.right().Is(16)) {
Emit(kPPC_ExtendSignWord16, g.DefineAsRegister(node),
g.UseRegister(mleft.left().node()));
return;
} else if (mleft.right().Is(24) && m.right().Is(24)) {
Emit(kPPC_ExtendSignWord8, g.DefineAsRegister(node),
g.UseRegister(mleft.left().node()));
return;
}
}
VisitRRO(this, kPPC_ShiftRightAlg32, node, kShift32Imm);
}
#if !V8_TARGET_ARCH_PPC64
void VisitPairBinop(InstructionSelector* selector, InstructionCode opcode,
InstructionCode opcode2, Node* node) {
PPCOperandGenerator g(selector);
Node* projection1 = NodeProperties::FindProjection(node, 1);
if (projection1) {
// We use UseUniqueRegister here to avoid register sharing with the output
// registers.
InstructionOperand inputs[] = {
g.UseRegister(node->InputAt(0)), g.UseUniqueRegister(node->InputAt(1)),
g.UseRegister(node->InputAt(2)), g.UseUniqueRegister(node->InputAt(3))};
InstructionOperand outputs[] = {
g.DefineAsRegister(node),
g.DefineAsRegister(NodeProperties::FindProjection(node, 1))};
selector->Emit(opcode, 2, outputs, 4, inputs);
} else {
// The high word of the result is not used, so we emit the standard 32 bit
// instruction.
selector->Emit(opcode2, g.DefineSameAsFirst(node),
g.UseRegister(node->InputAt(0)),
g.UseRegister(node->InputAt(2)));
}
}
void InstructionSelector::VisitInt32PairAdd(Node* node) {
VisitPairBinop(this, kPPC_AddPair, kPPC_Add32, node);
}
void InstructionSelector::VisitInt32PairSub(Node* node) {
VisitPairBinop(this, kPPC_SubPair, kPPC_Sub, node);
}
void InstructionSelector::VisitInt32PairMul(Node* node) {
PPCOperandGenerator g(this);
Node* projection1 = NodeProperties::FindProjection(node, 1);
if (projection1) {
InstructionOperand inputs[] = {g.UseUniqueRegister(node->InputAt(0)),
g.UseUniqueRegister(node->InputAt(1)),
g.UseUniqueRegister(node->InputAt(2)),
g.UseUniqueRegister(node->InputAt(3))};
InstructionOperand outputs[] = {
g.DefineAsRegister(node),
g.DefineAsRegister(NodeProperties::FindProjection(node, 1))};
InstructionOperand temps[] = {g.TempRegister(), g.TempRegister()};
Emit(kPPC_MulPair, 2, outputs, 4, inputs, 2, temps);
} else {
// The high word of the result is not used, so we emit the standard 32 bit
// instruction.
Emit(kPPC_Mul32, g.DefineSameAsFirst(node), g.UseRegister(node->InputAt(0)),
g.UseRegister(node->InputAt(2)));
}
}
namespace {
// Shared routine for multiple shift operations.
void VisitPairShift(InstructionSelector* selector, InstructionCode opcode,
Node* node) {
PPCOperandGenerator g(selector);
// We use g.UseUniqueRegister here to guarantee that there is
// no register aliasing of input registers with output registers.
Int32Matcher m(node->InputAt(2));
InstructionOperand shift_operand;
if (m.HasResolvedValue()) {
shift_operand = g.UseImmediate(m.node());
} else {
shift_operand = g.UseUniqueRegister(m.node());
}
InstructionOperand inputs[] = {g.UseUniqueRegister(node->InputAt(0)),
g.UseUniqueRegister(node->InputAt(1)),
shift_operand};
Node* projection1 = NodeProperties::FindProjection(node, 1);
InstructionOperand outputs[2];
InstructionOperand temps[1];
int32_t output_count = 0;
int32_t temp_count = 0;
outputs[output_count++] = g.DefineAsRegister(node);
if (projection1) {
outputs[output_count++] = g.DefineAsRegister(projection1);
} else {
temps[temp_count++] = g.TempRegister();
}
selector->Emit(opcode, output_count, outputs, 3, inputs, temp_count, temps);
}
} // namespace
void InstructionSelector::VisitWord32PairShl(Node* node) {
VisitPairShift(this, kPPC_ShiftLeftPair, node);
}
void InstructionSelector::VisitWord32PairShr(Node* node) {
VisitPairShift(this, kPPC_ShiftRightPair, node);
}
void InstructionSelector::VisitWord32PairSar(Node* node) {
VisitPairShift(this, kPPC_ShiftRightAlgPair, node);
}
#endif
#if V8_TARGET_ARCH_PPC64
void InstructionSelector::VisitWord64Sar(Node* node) {
PPCOperandGenerator g(this);
Int64BinopMatcher m(node);
if (CanCover(m.node(), m.left().node()) && m.left().IsLoad() &&
m.right().Is(32)) {
// Just load and sign-extend the interesting 4 bytes instead. This happens,
// for example, when we're loading and untagging SMIs.
BaseWithIndexAndDisplacement64Matcher mleft(m.left().node(),
AddressOption::kAllowAll);
if (mleft.matches() && mleft.index() == nullptr) {
int64_t offset = 0;
Node* displacement = mleft.displacement();
if (displacement != nullptr) {
Int64Matcher mdisplacement(displacement);
DCHECK(mdisplacement.HasResolvedValue());
offset = mdisplacement.ResolvedValue();
}
offset = SmiWordOffset(offset);
if (g.CanBeImmediate(offset, kInt16Imm_4ByteAligned)) {
Emit(kPPC_LoadWordS32 | AddressingModeField::encode(kMode_MRI),
g.DefineAsRegister(node), g.UseRegister(mleft.base()),
g.TempImmediate(offset), g.UseImmediate(0));
return;
}
}
}
VisitRRO(this, kPPC_ShiftRightAlg64, node, kShift64Imm);
}
#endif
void InstructionSelector::VisitWord32Rol(Node* node) { UNREACHABLE(); }
void InstructionSelector::VisitWord64Rol(Node* node) { UNREACHABLE(); }
// TODO(mbrandy): Absorb logical-and into rlwinm?
void InstructionSelector::VisitWord32Ror(Node* node) {
VisitRRO(this, kPPC_RotRight32, node, kShift32Imm);
}
#if V8_TARGET_ARCH_PPC64
// TODO(mbrandy): Absorb logical-and into rldic?
void InstructionSelector::VisitWord64Ror(Node* node) {
VisitRRO(this, kPPC_RotRight64, node, kShift64Imm);
}
#endif
void InstructionSelector::VisitWord32Clz(Node* node) {
PPCOperandGenerator g(this);
Emit(kPPC_Cntlz32, g.DefineAsRegister(node), g.UseRegister(node->InputAt(0)));
}
#if V8_TARGET_ARCH_PPC64
void InstructionSelector::VisitWord64Clz(Node* node) {
PPCOperandGenerator g(this);
Emit(kPPC_Cntlz64, g.DefineAsRegister(node), g.UseRegister(node->InputAt(0)));
}
#endif
void InstructionSelector::VisitWord32Popcnt(Node* node) {
PPCOperandGenerator g(this);
Emit(kPPC_Popcnt32, g.DefineAsRegister(node),
g.UseRegister(node->InputAt(0)));
}
#if V8_TARGET_ARCH_PPC64
void InstructionSelector::VisitWord64Popcnt(Node* node) {
PPCOperandGenerator g(this);
Emit(kPPC_Popcnt64, g.DefineAsRegister(node),
g.UseRegister(node->InputAt(0)));
}
#endif
void InstructionSelector::VisitWord32Ctz(Node* node) { UNREACHABLE(); }
#if V8_TARGET_ARCH_PPC64
void InstructionSelector::VisitWord64Ctz(Node* node) { UNREACHABLE(); }
#endif
void InstructionSelector::VisitWord32ReverseBits(Node* node) { UNREACHABLE(); }
#if V8_TARGET_ARCH_PPC64
void InstructionSelector::VisitWord64ReverseBits(Node* node) { UNREACHABLE(); }
#endif
void InstructionSelector::VisitWord64ReverseBytes(Node* node) {
PPCOperandGenerator g(this);
InstructionOperand temp[] = {g.TempRegister()};
Emit(kPPC_ByteRev64, g.DefineAsRegister(node),
g.UseUniqueRegister(node->InputAt(0)), 1, temp);
}
void InstructionSelector::VisitWord32ReverseBytes(Node* node) {
PPCOperandGenerator g(this);
Emit(kPPC_ByteRev32, g.DefineAsRegister(node),
g.UseRegister(node->InputAt(0)));
}
void InstructionSelector::VisitSimd128ReverseBytes(Node* node) {
// TODO(miladfar): Implement the ppc selector for reversing SIMD bytes.
// Check if the input node is a Load and do a Load Reverse at once.
UNIMPLEMENTED();
}
void InstructionSelector::VisitInt32Add(Node* node) {
VisitBinop<Int32BinopMatcher>(this, node, kPPC_Add32, kInt16Imm);
}
#if V8_TARGET_ARCH_PPC64
void InstructionSelector::VisitInt64Add(Node* node) {
VisitBinop<Int64BinopMatcher>(this, node, kPPC_Add64, kInt16Imm);
}
#endif
void InstructionSelector::VisitInt32Sub(Node* node) {
PPCOperandGenerator g(this);
Int32BinopMatcher m(node);
if (m.left().Is(0)) {
Emit(kPPC_Neg, g.DefineAsRegister(node), g.UseRegister(m.right().node()));
} else {
VisitBinop<Int32BinopMatcher>(this, node, kPPC_Sub, kInt16Imm_Negate);
}
}
#if V8_TARGET_ARCH_PPC64
void InstructionSelector::VisitInt64Sub(Node* node) {
PPCOperandGenerator g(this);
Int64BinopMatcher m(node);
if (m.left().Is(0)) {
Emit(kPPC_Neg, g.DefineAsRegister(node), g.UseRegister(m.right().node()));
} else {
VisitBinop<Int64BinopMatcher>(this, node, kPPC_Sub, kInt16Imm_Negate);
}
}
#endif
namespace {
void VisitCompare(InstructionSelector* selector, InstructionCode opcode,
InstructionOperand left, InstructionOperand right,
FlagsContinuation* cont);
void EmitInt32MulWithOverflow(InstructionSelector* selector, Node* node,
FlagsContinuation* cont) {
PPCOperandGenerator g(selector);
Int32BinopMatcher m(node);
InstructionOperand result_operand = g.DefineAsRegister(node);
InstructionOperand high32_operand = g.TempRegister();
InstructionOperand temp_operand = g.TempRegister();
{
InstructionOperand outputs[] = {result_operand, high32_operand};
InstructionOperand inputs[] = {g.UseRegister(m.left().node()),
g.UseRegister(m.right().node())};
selector->Emit(kPPC_Mul32WithHigh32, 2, outputs, 2, inputs);
}
{
InstructionOperand shift_31 = g.UseImmediate(31);
InstructionOperand outputs[] = {temp_operand};
InstructionOperand inputs[] = {result_operand, shift_31};
selector->Emit(kPPC_ShiftRightAlg32, 1, outputs, 2, inputs);
}
VisitCompare(selector, kPPC_Cmp32, high32_operand, temp_operand, cont);
}
} // namespace
void InstructionSelector::VisitInt32Mul(Node* node) {
VisitRRR(this, kPPC_Mul32, node);
}
#if V8_TARGET_ARCH_PPC64
void InstructionSelector::VisitInt64Mul(Node* node) {
VisitRRR(this, kPPC_Mul64, node);
}
#endif
void InstructionSelector::VisitInt32MulHigh(Node* node) {
PPCOperandGenerator g(this);
Emit(kPPC_MulHigh32, g.DefineAsRegister(node),
g.UseRegister(node->InputAt(0)), g.UseRegister(node->InputAt(1)));
}
void InstructionSelector::VisitUint32MulHigh(Node* node) {
PPCOperandGenerator g(this);
Emit(kPPC_MulHighU32, g.DefineAsRegister(node),
g.UseRegister(node->InputAt(0)), g.UseRegister(node->InputAt(1)));
}
void InstructionSelector::VisitInt32Div(Node* node) {
VisitRRR(this, kPPC_Div32, node);
}
#if V8_TARGET_ARCH_PPC64
void InstructionSelector::VisitInt64Div(Node* node) {
VisitRRR(this, kPPC_Div64, node);
}
#endif
void InstructionSelector::VisitUint32Div(Node* node) {
VisitRRR(this, kPPC_DivU32, node);
}
#if V8_TARGET_ARCH_PPC64
void InstructionSelector::VisitUint64Div(Node* node) {
VisitRRR(this, kPPC_DivU64, node);
}
#endif
void InstructionSelector::VisitInt32Mod(Node* node) {
VisitRRR(this, kPPC_Mod32, node);
}
#if V8_TARGET_ARCH_PPC64
void InstructionSelector::VisitInt64Mod(Node* node) {
VisitRRR(this, kPPC_Mod64, node);
}
#endif
void InstructionSelector::VisitUint32Mod(Node* node) {
VisitRRR(this, kPPC_ModU32, node);
}
#if V8_TARGET_ARCH_PPC64
void InstructionSelector::VisitUint64Mod(Node* node) {
VisitRRR(this, kPPC_ModU64, node);
}
#endif
void InstructionSelector::VisitChangeFloat32ToFloat64(Node* node) {
VisitRR(this, kPPC_Float32ToDouble, node);
}
void InstructionSelector::VisitRoundInt32ToFloat32(Node* node) {
VisitRR(this, kPPC_Int32ToFloat32, node);
}
void InstructionSelector::VisitRoundUint32ToFloat32(Node* node) {
VisitRR(this, kPPC_Uint32ToFloat32, node);
}
void InstructionSelector::VisitChangeInt32ToFloat64(Node* node) {
VisitRR(this, kPPC_Int32ToDouble, node);
}
void InstructionSelector::VisitChangeUint32ToFloat64(Node* node) {
VisitRR(this, kPPC_Uint32ToDouble, node);
}
void InstructionSelector::VisitChangeFloat64ToInt32(Node* node) {
VisitRR(this, kPPC_DoubleToInt32, node);
}
void InstructionSelector::VisitChangeFloat64ToUint32(Node* node) {
VisitRR(this, kPPC_DoubleToUint32, node);
}
void InstructionSelector::VisitTruncateFloat64ToUint32(Node* node) {
VisitRR(this, kPPC_DoubleToUint32, node);
}
void InstructionSelector::VisitSignExtendWord8ToInt32(Node* node) {
// TODO(mbrandy): inspect input to see if nop is appropriate.
VisitRR(this, kPPC_ExtendSignWord8, node);
}
void InstructionSelector::VisitSignExtendWord16ToInt32(Node* node) {
// TODO(mbrandy): inspect input to see if nop is appropriate.
VisitRR(this, kPPC_ExtendSignWord16, node);
}
#if V8_TARGET_ARCH_PPC64
void InstructionSelector::VisitTryTruncateFloat32ToInt64(Node* node) {
VisitTryTruncateDouble(this, kPPC_DoubleToInt64, node);
}
void InstructionSelector::VisitTryTruncateFloat64ToInt64(Node* node) {
VisitTryTruncateDouble(this, kPPC_DoubleToInt64, node);
}
void InstructionSelector::VisitTruncateFloat64ToInt64(Node* node) {
VisitRR(this, kPPC_DoubleToInt64, node);
}
void InstructionSelector::VisitTryTruncateFloat32ToUint64(Node* node) {
VisitTryTruncateDouble(this, kPPC_DoubleToUint64, node);
}
void InstructionSelector::VisitTryTruncateFloat64ToUint64(Node* node) {
VisitTryTruncateDouble(this, kPPC_DoubleToUint64, node);
}
void InstructionSelector::VisitBitcastWord32ToWord64(Node* node) {
DCHECK(SmiValuesAre31Bits());
DCHECK(COMPRESS_POINTERS_BOOL);
EmitIdentity(node);
}
void InstructionSelector::VisitChangeInt32ToInt64(Node* node) {
// TODO(mbrandy): inspect input to see if nop is appropriate.
VisitRR(this, kPPC_ExtendSignWord32, node);
}
void InstructionSelector::VisitSignExtendWord8ToInt64(Node* node) {
// TODO(mbrandy): inspect input to see if nop is appropriate.
VisitRR(this, kPPC_ExtendSignWord8, node);
}
void InstructionSelector::VisitSignExtendWord16ToInt64(Node* node) {
// TODO(mbrandy): inspect input to see if nop is appropriate.
VisitRR(this, kPPC_ExtendSignWord16, node);
}
void InstructionSelector::VisitSignExtendWord32ToInt64(Node* node) {
// TODO(mbrandy): inspect input to see if nop is appropriate.
VisitRR(this, kPPC_ExtendSignWord32, node);
}
bool InstructionSelector::ZeroExtendsWord32ToWord64NoPhis(Node* node) {
UNIMPLEMENTED();
}
void InstructionSelector::VisitChangeUint32ToUint64(Node* node) {
// TODO(mbrandy): inspect input to see if nop is appropriate.
VisitRR(this, kPPC_Uint32ToUint64, node);
}
void InstructionSelector::VisitChangeFloat64ToUint64(Node* node) {
VisitRR(this, kPPC_DoubleToUint64, node);
}
void InstructionSelector::VisitChangeFloat64ToInt64(Node* node) {
VisitRR(this, kPPC_DoubleToInt64, node);
}
#endif
void InstructionSelector::VisitTruncateFloat64ToFloat32(Node* node) {
VisitRR(this, kPPC_DoubleToFloat32, node);
}
void InstructionSelector::VisitTruncateFloat64ToWord32(Node* node) {
VisitRR(this, kArchTruncateDoubleToI, node);
}
void InstructionSelector::VisitRoundFloat64ToInt32(Node* node) {
VisitRR(this, kPPC_DoubleToInt32, node);
}
void InstructionSelector::VisitTruncateFloat32ToInt32(Node* node) {
PPCOperandGenerator g(this);
InstructionCode opcode = kPPC_Float32ToInt32;
TruncateKind kind = OpParameter<TruncateKind>(node->op());
if (kind == TruncateKind::kSetOverflowToMin) {
opcode |= MiscField::encode(true);
}
Emit(opcode, g.DefineAsRegister(node), g.UseRegister(node->InputAt(0)));
}
void InstructionSelector::VisitTruncateFloat32ToUint32(Node* node) {
PPCOperandGenerator g(this);
InstructionCode opcode = kPPC_Float32ToUint32;
TruncateKind kind = OpParameter<TruncateKind>(node->op());
if (kind == TruncateKind::kSetOverflowToMin) {
opcode |= MiscField::encode(true);
}
Emit(opcode, g.DefineAsRegister(node), g.UseRegister(node->InputAt(0)));
}
#if V8_TARGET_ARCH_PPC64
void InstructionSelector::VisitTruncateInt64ToInt32(Node* node) {
// TODO(mbrandy): inspect input to see if nop is appropriate.
VisitRR(this, kPPC_Int64ToInt32, node);
}
void InstructionSelector::VisitRoundInt64ToFloat32(Node* node) {
VisitRR(this, kPPC_Int64ToFloat32, node);
}
void InstructionSelector::VisitRoundInt64ToFloat64(Node* node) {
VisitRR(this, kPPC_Int64ToDouble, node);
}
void InstructionSelector::VisitChangeInt64ToFloat64(Node* node) {
VisitRR(this, kPPC_Int64ToDouble, node);
}
void InstructionSelector::VisitRoundUint64ToFloat32(Node* node) {
VisitRR(this, kPPC_Uint64ToFloat32, node);
}
void InstructionSelector::VisitRoundUint64ToFloat64(Node* node) {
VisitRR(this, kPPC_Uint64ToDouble, node);
}
#endif
void InstructionSelector::VisitBitcastFloat32ToInt32(Node* node) {
VisitRR(this, kPPC_BitcastFloat32ToInt32, node);
}
#if V8_TARGET_ARCH_PPC64
void InstructionSelector::VisitBitcastFloat64ToInt64(Node* node) {
VisitRR(this, kPPC_BitcastDoubleToInt64, node);
}
#endif
void InstructionSelector::VisitBitcastInt32ToFloat32(Node* node) {
VisitRR(this, kPPC_BitcastInt32ToFloat32, node);
}
#if V8_TARGET_ARCH_PPC64
void InstructionSelector::VisitBitcastInt64ToFloat64(Node* node) {
VisitRR(this, kPPC_BitcastInt64ToDouble, node);
}
#endif
void InstructionSelector::VisitFloat32Add(Node* node) {
VisitRRR(this, kPPC_AddDouble | MiscField::encode(1), node);
}
void InstructionSelector::VisitFloat64Add(Node* node) {
// TODO(mbrandy): detect multiply-add
VisitRRR(this, kPPC_AddDouble, node);
}
void InstructionSelector::VisitFloat32Sub(Node* node) {
VisitRRR(this, kPPC_SubDouble | MiscField::encode(1), node);
}
void InstructionSelector::VisitFloat64Sub(Node* node) {
// TODO(mbrandy): detect multiply-subtract
VisitRRR(this, kPPC_SubDouble, node);
}
void InstructionSelector::VisitFloat32Mul(Node* node) {
VisitRRR(this, kPPC_MulDouble | MiscField::encode(1), node);
}
void InstructionSelector::VisitFloat64Mul(Node* node) {
// TODO(mbrandy): detect negate
VisitRRR(this, kPPC_MulDouble, node);
}
void InstructionSelector::VisitFloat32Div(Node* node) {
VisitRRR(this, kPPC_DivDouble | MiscField::encode(1), node);
}
void InstructionSelector::VisitFloat64Div(Node* node) {
VisitRRR(this, kPPC_DivDouble, node);
}
void InstructionSelector::VisitFloat64Mod(Node* node) {
PPCOperandGenerator g(this);
Emit(kPPC_ModDouble, g.DefineAsFixed(node, d1),
g.UseFixed(node->InputAt(0), d1), g.UseFixed(node->InputAt(1), d2))
->MarkAsCall();
}
void InstructionSelector::VisitFloat32Max(Node* node) {
VisitRRR(this, kPPC_MaxDouble | MiscField::encode(1), node);
}
void InstructionSelector::VisitFloat64Max(Node* node) {
VisitRRR(this, kPPC_MaxDouble, node);
}
void InstructionSelector::VisitFloat64SilenceNaN(Node* node) {
VisitRR(this, kPPC_Float64SilenceNaN, node);
}
void InstructionSelector::VisitFloat32Min(Node* node) {
VisitRRR(this, kPPC_MinDouble | MiscField::encode(1), node);
}
void InstructionSelector::VisitFloat64Min(Node* node) {
VisitRRR(this, kPPC_MinDouble, node);
}
void InstructionSelector::VisitFloat32Abs(Node* node) {
VisitRR(this, kPPC_AbsDouble | MiscField::encode(1), node);
}
void InstructionSelector::VisitFloat64Abs(Node* node) {
VisitRR(this, kPPC_AbsDouble, node);
}
void InstructionSelector::VisitFloat32Sqrt(Node* node) {
VisitRR(this, kPPC_SqrtDouble | MiscField::encode(1), node);
}
void InstructionSelector::VisitFloat64Ieee754Unop(Node* node,
InstructionCode opcode) {
PPCOperandGenerator g(this);
Emit(opcode, g.DefineAsFixed(node, d1), g.UseFixed(node->InputAt(0), d1))
->MarkAsCall();
}
void InstructionSelector::VisitFloat64Ieee754Binop(Node* node,
InstructionCode opcode) {
PPCOperandGenerator g(this);
Emit(opcode, g.DefineAsFixed(node, d1), g.UseFixed(node->InputAt(0), d1),
g.UseFixed(node->InputAt(1), d2))
->MarkAsCall();
}
void InstructionSelector::VisitFloat64Sqrt(Node* node) {
VisitRR(this, kPPC_SqrtDouble, node);
}
void InstructionSelector::VisitFloat32RoundDown(Node* node) {
VisitRR(this, kPPC_FloorDouble | MiscField::encode(1), node);
}
void InstructionSelector::VisitFloat64RoundDown(Node* node) {
VisitRR(this, kPPC_FloorDouble, node);
}
void InstructionSelector::VisitFloat32RoundUp(Node* node) {
VisitRR(this, kPPC_CeilDouble | MiscField::encode(1), node);
}
void InstructionSelector::VisitFloat64RoundUp(Node* node) {
VisitRR(this, kPPC_CeilDouble, node);
}
void InstructionSelector::VisitFloat32RoundTruncate(Node* node) {
VisitRR(this, kPPC_TruncateDouble | MiscField::encode(1), node);
}
void InstructionSelector::VisitFloat64RoundTruncate(Node* node) {
VisitRR(this, kPPC_TruncateDouble, node);
}
void InstructionSelector::VisitFloat64RoundTiesAway(Node* node) {
VisitRR(this, kPPC_RoundDouble, node);
}
void InstructionSelector::VisitFloat32RoundTiesEven(Node* node) {
UNREACHABLE();
}
void InstructionSelector::VisitFloat64RoundTiesEven(Node* node) {
UNREACHABLE();
}
void InstructionSelector::VisitFloat32Neg(Node* node) {
VisitRR(this, kPPC_NegDouble, node);
}
void InstructionSelector::VisitFloat64Neg(Node* node) {
VisitRR(this, kPPC_NegDouble, node);
}
void InstructionSelector::VisitInt32AddWithOverflow(Node* node) {
if (Node* ovf = NodeProperties::FindProjection(node, 1)) {
FlagsContinuation cont = FlagsContinuation::ForSet(kOverflow, ovf);
return VisitBinop<Int32BinopMatcher>(this, node, kPPC_AddWithOverflow32,
kInt16Imm, &cont);
}
FlagsContinuation cont;
VisitBinop<Int32BinopMatcher>(this, node, kPPC_AddWithOverflow32, kInt16Imm,
&cont);
}
void InstructionSelector::VisitInt32SubWithOverflow(Node* node) {
if (Node* ovf = NodeProperties::FindProjection(node, 1)) {
FlagsContinuation cont = FlagsContinuation::ForSet(kOverflow, ovf);
return VisitBinop<Int32BinopMatcher>(this, node, kPPC_SubWithOverflow32,
kInt16Imm_Negate, &cont);
}
FlagsContinuation cont;
VisitBinop<Int32BinopMatcher>(this, node, kPPC_SubWithOverflow32,
kInt16Imm_Negate, &cont);
}
#if V8_TARGET_ARCH_PPC64
void InstructionSelector::VisitInt64AddWithOverflow(Node* node) {
if (Node* ovf = NodeProperties::FindProjection(node, 1)) {
FlagsContinuation cont = FlagsContinuation::ForSet(kOverflow, ovf);
return VisitBinop<Int64BinopMatcher>(this, node, kPPC_Add64, kInt16Imm,
&cont);
}
FlagsContinuation cont;
VisitBinop<Int64BinopMatcher>(this, node, kPPC_Add64, kInt16Imm, &cont);
}
void InstructionSelector::VisitInt64SubWithOverflow(Node* node) {
if (Node* ovf = NodeProperties::FindProjection(node, 1)) {
FlagsContinuation cont = FlagsContinuation::ForSet(kOverflow, ovf);
return VisitBinop<Int64BinopMatcher>(this, node, kPPC_Sub, kInt16Imm_Negate,
&cont);
}
FlagsContinuation cont;
VisitBinop<Int64BinopMatcher>(this, node, kPPC_Sub, kInt16Imm_Negate, &cont);
}
#endif
static bool CompareLogical(FlagsContinuation* cont) {
switch (cont->condition()) {
case kUnsignedLessThan:
case kUnsignedGreaterThanOrEqual:
case kUnsignedLessThanOrEqual:
case kUnsignedGreaterThan:
return true;
default:
return false;
}
UNREACHABLE();
}
namespace {
// Shared routine for multiple compare operations.
void VisitCompare(InstructionSelector* selector, InstructionCode opcode,
InstructionOperand left, InstructionOperand right,
FlagsContinuation* cont) {
selector->EmitWithContinuation(opcode, left, right, cont);
}
// Shared routine for multiple word compare operations.
void VisitWordCompare(InstructionSelector* selector, Node* node,
InstructionCode opcode, FlagsContinuation* cont,
bool commutative, ImmediateMode immediate_mode) {
PPCOperandGenerator g(selector);
Node* left = node->InputAt(0);
Node* right = node->InputAt(1);
// Match immediates on left or right side of comparison.
if (g.CanBeImmediate(right, immediate_mode)) {
VisitCompare(selector, opcode, g.UseRegister(left), g.UseImmediate(right),
cont);
} else if (g.CanBeImmediate(left, immediate_mode)) {
if (!commutative) cont->Commute();
VisitCompare(selector, opcode, g.UseRegister(right), g.UseImmediate(left),
cont);
} else {
VisitCompare(selector, opcode, g.UseRegister(left), g.UseRegister(right),
cont);
}
}
void VisitWord32Compare(InstructionSelector* selector, Node* node,
FlagsContinuation* cont) {
ImmediateMode mode = (CompareLogical(cont) ? kInt16Imm_Unsigned : kInt16Imm);
VisitWordCompare(selector, node, kPPC_Cmp32, cont, false, mode);
}
#if V8_TARGET_ARCH_PPC64
void VisitWord64Compare(InstructionSelector* selector, Node* node,
FlagsContinuation* cont) {
ImmediateMode mode = (CompareLogical(cont) ? kInt16Imm_Unsigned : kInt16Imm);
VisitWordCompare(selector, node, kPPC_Cmp64, cont, false, mode);
}
#endif
// Shared routine for multiple float32 compare operations.
void VisitFloat32Compare(InstructionSelector* selector, Node* node,
FlagsContinuation* cont) {
PPCOperandGenerator g(selector);
Node* left = node->InputAt(0);
Node* right = node->InputAt(1);
VisitCompare(selector, kPPC_CmpDouble, g.UseRegister(left),
g.UseRegister(right), cont);
}
// Shared routine for multiple float64 compare operations.
void VisitFloat64Compare(InstructionSelector* selector, Node* node,
FlagsContinuation* cont) {
PPCOperandGenerator g(selector);
Node* left = node->InputAt(0);
Node* right = node->InputAt(1);
VisitCompare(selector, kPPC_CmpDouble, g.UseRegister(left),
g.UseRegister(right), cont);
}
} // namespace
// Shared routine for word comparisons against zero.
void InstructionSelector::VisitWordCompareZero(Node* user, Node* value,
FlagsContinuation* cont) {
// Try to combine with comparisons against 0 by simply inverting the branch.
while (value->opcode() == IrOpcode::kWord32Equal && CanCover(user, value)) {
Int32BinopMatcher m(value);
if (!m.right().Is(0)) break;
user = value;
value = m.left().node();
cont->Negate();
}
if (CanCover(user, value)) {
switch (value->opcode()) {
case IrOpcode::kWord32Equal:
cont->OverwriteAndNegateIfEqual(kEqual);
return VisitWord32Compare(this, value, cont);
case IrOpcode::kInt32LessThan:
cont->OverwriteAndNegateIfEqual(kSignedLessThan);
return VisitWord32Compare(this, value, cont);
case IrOpcode::kInt32LessThanOrEqual:
cont->OverwriteAndNegateIfEqual(kSignedLessThanOrEqual);
return VisitWord32Compare(this, value, cont);
case IrOpcode::kUint32LessThan:
cont->OverwriteAndNegateIfEqual(kUnsignedLessThan);
return VisitWord32Compare(this, value, cont);
case IrOpcode::kUint32LessThanOrEqual:
cont->OverwriteAndNegateIfEqual(kUnsignedLessThanOrEqual);
return VisitWord32Compare(this, value, cont);
#if V8_TARGET_ARCH_PPC64
case IrOpcode::kWord64Equal:
cont->OverwriteAndNegateIfEqual(kEqual);
return VisitWord64Compare(this, value, cont);
case IrOpcode::kInt64LessThan:
cont->OverwriteAndNegateIfEqual(kSignedLessThan);
return VisitWord64Compare(this, value, cont);
case IrOpcode::kInt64LessThanOrEqual:
cont->OverwriteAndNegateIfEqual(kSignedLessThanOrEqual);
return VisitWord64Compare(this, value, cont);
case IrOpcode::kUint64LessThan:
cont->OverwriteAndNegateIfEqual(kUnsignedLessThan);
return VisitWord64Compare(this, value, cont);
case IrOpcode::kUint64LessThanOrEqual:
cont->OverwriteAndNegateIfEqual(kUnsignedLessThanOrEqual);
return VisitWord64Compare(this, value, cont);
#endif
case IrOpcode::kFloat32Equal:
cont->OverwriteAndNegateIfEqual(kEqual);
return VisitFloat32Compare(this, value, cont);
case IrOpcode::kFloat32LessThan:
cont->OverwriteAndNegateIfEqual(kUnsignedLessThan);
return VisitFloat32Compare(this, value, cont);
case IrOpcode::kFloat32LessThanOrEqual:
cont->OverwriteAndNegateIfEqual(kUnsignedLessThanOrEqual);
return VisitFloat32Compare(this, value, cont);
case IrOpcode::kFloat64Equal:
cont->OverwriteAndNegateIfEqual(kEqual);
return VisitFloat64Compare(this, value, cont);
case IrOpcode::kFloat64LessThan:
cont->OverwriteAndNegateIfEqual(kUnsignedLessThan);
return VisitFloat64Compare(this, value, cont);
case IrOpcode::kFloat64LessThanOrEqual:
cont->OverwriteAndNegateIfEqual(kUnsignedLessThanOrEqual);
return VisitFloat64Compare(this, value, cont);
case IrOpcode::kProjection:
// Check if this is the overflow output projection of an
// <Operation>WithOverflow node.
if (ProjectionIndexOf(value->op()) == 1u) {
// We cannot combine the <Operation>WithOverflow with this branch
// unless the 0th projection (the use of the actual value of the
// <Operation> is either nullptr, which means there's no use of the
// actual value, or was already defined, which means it is scheduled
// *AFTER* this branch).
Node* const node = value->InputAt(0);
Node* const result = NodeProperties::FindProjection(node, 0);
if (result == nullptr || IsDefined(result)) {
switch (node->opcode()) {
case IrOpcode::kInt32AddWithOverflow:
cont->OverwriteAndNegateIfEqual(kOverflow);
return VisitBinop<Int32BinopMatcher>(
this, node, kPPC_AddWithOverflow32, kInt16Imm, cont);
case IrOpcode::kInt32SubWithOverflow:
cont->OverwriteAndNegateIfEqual(kOverflow);
return VisitBinop<Int32BinopMatcher>(
this, node, kPPC_SubWithOverflow32, kInt16Imm_Negate, cont);
case IrOpcode::kInt32MulWithOverflow:
cont->OverwriteAndNegateIfEqual(kNotEqual);
return EmitInt32MulWithOverflow(this, node, cont);
#if V8_TARGET_ARCH_PPC64
case IrOpcode::kInt64AddWithOverflow:
cont->OverwriteAndNegateIfEqual(kOverflow);
return VisitBinop<Int64BinopMatcher>(this, node, kPPC_Add64,
kInt16Imm, cont);
case IrOpcode::kInt64SubWithOverflow:
cont->OverwriteAndNegateIfEqual(kOverflow);
return VisitBinop<Int64BinopMatcher>(this, node, kPPC_Sub,
kInt16Imm_Negate, cont);
#endif
default:
break;
}
}
}
break;
case IrOpcode::kInt32Sub:
return VisitWord32Compare(this, value, cont);
case IrOpcode::kWord32And:
// TODO(mbandy): opportunity for rlwinm?
return VisitWordCompare(this, value, kPPC_Tst32, cont, true,
kInt16Imm_Unsigned);
// TODO(mbrandy): Handle?
// case IrOpcode::kInt32Add:
// case IrOpcode::kWord32Or:
// case IrOpcode::kWord32Xor:
// case IrOpcode::kWord32Sar:
// case IrOpcode::kWord32Shl:
// case IrOpcode::kWord32Shr:
// case IrOpcode::kWord32Ror:
#if V8_TARGET_ARCH_PPC64
case IrOpcode::kInt64Sub:
return VisitWord64Compare(this, value, cont);
case IrOpcode::kWord64And:
// TODO(mbandy): opportunity for rldic?
return VisitWordCompare(this, value, kPPC_Tst64, cont, true,
kInt16Imm_Unsigned);
// TODO(mbrandy): Handle?
// case IrOpcode::kInt64Add:
// case IrOpcode::kWord64Or:
// case IrOpcode::kWord64Xor:
// case IrOpcode::kWord64Sar:
// case IrOpcode::kWord64Shl:
// case IrOpcode::kWord64Shr:
// case IrOpcode::kWord64Ror:
#endif
case IrOpcode::kStackPointerGreaterThan:
cont->OverwriteAndNegateIfEqual(kStackPointerGreaterThanCondition);
return VisitStackPointerGreaterThan(value, cont);
default:
break;
}
}
// Branch could not be combined with a compare, emit compare against 0.
PPCOperandGenerator g(this);
VisitCompare(this, kPPC_Cmp32, g.UseRegister(value), g.TempImmediate(0),
cont);
}
void InstructionSelector::VisitSwitch(Node* node, const SwitchInfo& sw) {
PPCOperandGenerator g(this);
InstructionOperand value_operand = g.UseRegister(node->InputAt(0));
// Emit either ArchTableSwitch or ArchBinarySearchSwitch.
if (enable_switch_jump_table_ == kEnableSwitchJumpTable) {
static const size_t kMaxTableSwitchValueRange = 2 << 16;
size_t table_space_cost = 4 + sw.value_range();
size_t table_time_cost = 3;
size_t lookup_space_cost = 3 + 2 * sw.case_count();
size_t lookup_time_cost = sw.case_count();
if (sw.case_count() > 0 &&
table_space_cost + 3 * table_time_cost <=
lookup_space_cost + 3 * lookup_time_cost &&
sw.min_value() > std::numeric_limits<int32_t>::min() &&
sw.value_range() <= kMaxTableSwitchValueRange) {
InstructionOperand index_operand = value_operand;
if (sw.min_value()) {
index_operand = g.TempRegister();
Emit(kPPC_Sub, index_operand, value_operand,
g.TempImmediate(sw.min_value()));
}
// Generate a table lookup.
return EmitTableSwitch(sw, index_operand);
}
}
// Generate a tree of conditional jumps.
return EmitBinarySearchSwitch(sw, value_operand);
}
void InstructionSelector::VisitWord32Equal(Node* const node) {
FlagsContinuation cont = FlagsContinuation::ForSet(kEqual, node);
VisitWord32Compare(this, node, &cont);
}
void InstructionSelector::VisitInt32LessThan(Node* node) {
FlagsContinuation cont = FlagsContinuation::ForSet(kSignedLessThan, node);
VisitWord32Compare(this, node, &cont);
}
void InstructionSelector::VisitInt32LessThanOrEqual(Node* node) {
FlagsContinuation cont =
FlagsContinuation::ForSet(kSignedLessThanOrEqual, node);
VisitWord32Compare(this, node, &cont);
}
void InstructionSelector::VisitUint32LessThan(Node* node) {
FlagsContinuation cont = FlagsContinuation::ForSet(kUnsignedLessThan, node);
VisitWord32Compare(this, node, &cont);
}
void InstructionSelector::VisitUint32LessThanOrEqual(Node* node) {
FlagsContinuation cont =
FlagsContinuation::ForSet(kUnsignedLessThanOrEqual, node);
VisitWord32Compare(this, node, &cont);
}
#if V8_TARGET_ARCH_PPC64
void InstructionSelector::VisitWord64Equal(Node* const node) {
FlagsContinuation cont = FlagsContinuation::ForSet(kEqual, node);
VisitWord64Compare(this, node, &cont);
}
void InstructionSelector::VisitInt64LessThan(Node* node) {
FlagsContinuation cont = FlagsContinuation::ForSet(kSignedLessThan, node);
VisitWord64Compare(this, node, &cont);
}
void InstructionSelector::VisitInt64LessThanOrEqual(Node* node) {
FlagsContinuation cont =
FlagsContinuation::ForSet(kSignedLessThanOrEqual, node);
VisitWord64Compare(this, node, &cont);
}
void InstructionSelector::VisitUint64LessThan(Node* node) {
FlagsContinuation cont = FlagsContinuation::ForSet(kUnsignedLessThan, node);
VisitWord64Compare(this, node, &cont);
}
void InstructionSelector::VisitUint64LessThanOrEqual(Node* node) {
FlagsContinuation cont =
FlagsContinuation::ForSet(kUnsignedLessThanOrEqual, node);
VisitWord64Compare(this, node, &cont);
}
#endif
void InstructionSelector::VisitInt32MulWithOverflow(Node* node) {
if (Node* ovf = NodeProperties::FindProjection(node, 1)) {
FlagsContinuation cont = FlagsContinuation::ForSet(kNotEqual, ovf);
return EmitInt32MulWithOverflow(this, node, &cont);
}
FlagsContinuation cont;
EmitInt32MulWithOverflow(this, node, &cont);
}
void InstructionSelector::VisitFloat32Equal(Node* node) {
FlagsContinuation cont = FlagsContinuation::ForSet(kEqual, node);
VisitFloat32Compare(this, node, &cont);
}
void InstructionSelector::VisitFloat32LessThan(Node* node) {
FlagsContinuation cont = FlagsContinuation::ForSet(kUnsignedLessThan, node);
VisitFloat32Compare(this, node, &cont);
}
void InstructionSelector::VisitFloat32LessThanOrEqual(Node* node) {
FlagsContinuation cont =
FlagsContinuation::ForSet(kUnsignedLessThanOrEqual, node);
VisitFloat32Compare(this, node, &cont);
}
void InstructionSelector::VisitFloat64Equal(Node* node) {
FlagsContinuation cont = FlagsContinuation::ForSet(kEqual, node);
VisitFloat64Compare(this, node, &cont);
}
void InstructionSelector::VisitFloat64LessThan(Node* node) {
FlagsContinuation cont = FlagsContinuation::ForSet(kUnsignedLessThan, node);
VisitFloat64Compare(this, node, &cont);
}
void InstructionSelector::VisitFloat64LessThanOrEqual(Node* node) {
FlagsContinuation cont =
FlagsContinuation::ForSet(kUnsignedLessThanOrEqual, node);
VisitFloat64Compare(this, node, &cont);
}
void InstructionSelector::EmitPrepareArguments(
ZoneVector<PushParameter>* arguments, const CallDescriptor* call_descriptor,
Node* node) {
PPCOperandGenerator g(this);
// Prepare for C function call.
if (call_descriptor->IsCFunctionCall()) {
Emit(kArchPrepareCallCFunction | MiscField::encode(static_cast<int>(
call_descriptor->ParameterCount())),
0, nullptr, 0, nullptr);
// Poke any stack arguments.
int slot = kStackFrameExtraParamSlot;
for (PushParameter input : (*arguments)) {
if (input.node == nullptr) continue;
Emit(kPPC_StoreToStackSlot, g.NoOutput(), g.UseRegister(input.node),
g.TempImmediate(slot));
++slot;
}
} else {
// Push any stack arguments.
for (PushParameter input : base::Reversed(*arguments)) {
// Skip any alignment holes in pushed nodes.
if (input.node == nullptr) continue;
Emit(kPPC_Push, g.NoOutput(), g.UseRegister(input.node));
}
}
}
bool InstructionSelector::IsTailCallAddressImmediate() { return false; }
int InstructionSelector::GetTempsCountForTailCallFromJSFunction() { return 3; }
void InstructionSelector::VisitFloat64ExtractLowWord32(Node* node) {
PPCOperandGenerator g(this);
Emit(kPPC_DoubleExtractLowWord32, g.DefineAsRegister(node),
g.UseRegister(node->InputAt(0)));
}
void InstructionSelector::VisitFloat64ExtractHighWord32(Node* node) {
PPCOperandGenerator g(this);
Emit(kPPC_DoubleExtractHighWord32, g.DefineAsRegister(node),
g.UseRegister(node->InputAt(0)));
}
void InstructionSelector::VisitFloat64InsertLowWord32(Node* node) {
PPCOperandGenerator g(this);
Node* left = node->InputAt(0);
Node* right = node->InputAt(1);
if (left->opcode() == IrOpcode::kFloat64InsertHighWord32 &&
CanCover(node, left)) {
left = left->InputAt(1);
Emit(kPPC_DoubleConstruct, g.DefineAsRegister(node), g.UseRegister(left),
g.UseRegister(right));
return;
}
Emit(kPPC_DoubleInsertLowWord32, g.DefineSameAsFirst(node),
g.UseRegister(left), g.UseRegister(right));
}
void InstructionSelector::VisitFloat64InsertHighWord32(Node* node) {
PPCOperandGenerator g(this);
Node* left = node->InputAt(0);
Node* right = node->InputAt(1);
if (left->opcode() == IrOpcode::kFloat64InsertLowWord32 &&
CanCover(node, left)) {
left = left->InputAt(1);
Emit(kPPC_DoubleConstruct, g.DefineAsRegister(node), g.UseRegister(right),
g.UseRegister(left));
return;
}
Emit(kPPC_DoubleInsertHighWord32, g.DefineSameAsFirst(node),
g.UseRegister(left), g.UseRegister(right));
}
void InstructionSelector::VisitMemoryBarrier(Node* node) {
PPCOperandGenerator g(this);
Emit(kPPC_Sync, g.NoOutput());
}
void InstructionSelector::VisitWord32AtomicLoad(Node* node) { VisitLoad(node); }
void InstructionSelector::VisitWord64AtomicLoad(Node* node) { VisitLoad(node); }
void InstructionSelector::VisitWord32AtomicStore(Node* node) {
VisitStore(node);
}
void InstructionSelector::VisitWord64AtomicStore(Node* node) {
VisitStore(node);
}
void VisitAtomicExchange(InstructionSelector* selector, Node* node,
ArchOpcode opcode) {
PPCOperandGenerator g(selector);
Node* base = node->InputAt(0);
Node* index = node->InputAt(1);
Node* value = node->InputAt(2);
AddressingMode addressing_mode = kMode_MRR;
InstructionOperand inputs[3];
size_t input_count = 0;
inputs[input_count++] = g.UseUniqueRegister(base);
inputs[input_count++] = g.UseUniqueRegister(index);
inputs[input_count++] = g.UseUniqueRegister(value);
InstructionOperand outputs[1];
outputs[0] = g.UseUniqueRegister(node);
InstructionCode code = opcode | AddressingModeField::encode(addressing_mode);
selector->Emit(code, 1, outputs, input_count, inputs);
}
void InstructionSelector::VisitWord32AtomicExchange(Node* node) {
ArchOpcode opcode;
MachineType type = AtomicOpType(node->op());
if (type == MachineType::Int8()) {
opcode = kWord32AtomicExchangeInt8;
} else if (type == MachineType::Uint8()) {
opcode = kPPC_AtomicExchangeUint8;
} else if (type == MachineType::Int16()) {
opcode = kWord32AtomicExchangeInt16;
} else if (type == MachineType::Uint16()) {
opcode = kPPC_AtomicExchangeUint16;
} else if (type == MachineType::Int32() || type == MachineType::Uint32()) {
opcode = kPPC_AtomicExchangeWord32;
} else {
UNREACHABLE();
}
VisitAtomicExchange(this, node, opcode);
}
void InstructionSelector::VisitWord64AtomicExchange(Node* node) {
ArchOpcode opcode;
MachineType type = AtomicOpType(node->op());
if (type == MachineType::Uint8()) {
opcode = kPPC_AtomicExchangeUint8;
} else if (type == MachineType::Uint16()) {
opcode = kPPC_AtomicExchangeUint16;
} else if (type == MachineType::Uint32()) {
opcode = kPPC_AtomicExchangeWord32;
} else if (type == MachineType::Uint64()) {
opcode = kPPC_AtomicExchangeWord64;
} else {
UNREACHABLE();
}
VisitAtomicExchange(this, node, opcode);
}
void VisitAtomicCompareExchange(InstructionSelector* selector, Node* node,
ArchOpcode opcode) {
PPCOperandGenerator g(selector);
Node* base = node->InputAt(0);
Node* index = node->InputAt(1);
Node* old_value = node->InputAt(2);
Node* new_value = node->InputAt(3);
AddressingMode addressing_mode = kMode_MRR;
InstructionCode code = opcode | AddressingModeField::encode(addressing_mode);
InstructionOperand inputs[4];
size_t input_count = 0;
inputs[input_count++] = g.UseUniqueRegister(base);
inputs[input_count++] = g.UseUniqueRegister(index);
inputs[input_count++] = g.UseUniqueRegister(old_value);
inputs[input_count++] = g.UseUniqueRegister(new_value);
InstructionOperand outputs[1];
size_t output_count = 0;
outputs[output_count++] = g.DefineAsRegister(node);
selector->Emit(code, output_count, outputs, input_count, inputs);
}
void InstructionSelector::VisitWord32AtomicCompareExchange(Node* node) {
MachineType type = AtomicOpType(node->op());
ArchOpcode opcode;
if (type == MachineType::Int8()) {
opcode = kWord32AtomicCompareExchangeInt8;
} else if (type == MachineType::Uint8()) {
opcode = kPPC_AtomicCompareExchangeUint8;
} else if (type == MachineType::Int16()) {
opcode = kWord32AtomicCompareExchangeInt16;
} else if (type == MachineType::Uint16()) {
opcode = kPPC_AtomicCompareExchangeUint16;
} else if (type == MachineType::Int32() || type == MachineType::Uint32()) {
opcode = kPPC_AtomicCompareExchangeWord32;
} else {
UNREACHABLE();
}
VisitAtomicCompareExchange(this, node, opcode);
}
void InstructionSelector::VisitWord64AtomicCompareExchange(Node* node) {
MachineType type = AtomicOpType(node->op());
ArchOpcode opcode;
if (type == MachineType::Uint8()) {
opcode = kPPC_AtomicCompareExchangeUint8;
} else if (type == MachineType::Uint16()) {
opcode = kPPC_AtomicCompareExchangeUint16;
} else if (type == MachineType::Uint32()) {
opcode = kPPC_AtomicCompareExchangeWord32;
} else if (type == MachineType::Uint64()) {
opcode = kPPC_AtomicCompareExchangeWord64;
} else {
UNREACHABLE();
}
VisitAtomicCompareExchange(this, node, opcode);
}
void VisitAtomicBinaryOperation(InstructionSelector* selector, Node* node,
ArchOpcode int8_op, ArchOpcode uint8_op,
ArchOpcode int16_op, ArchOpcode uint16_op,
ArchOpcode int32_op, ArchOpcode uint32_op,
ArchOpcode int64_op, ArchOpcode uint64_op) {
PPCOperandGenerator g(selector);
Node* base = node->InputAt(0);
Node* index = node->InputAt(1);
Node* value = node->InputAt(2);
MachineType type = AtomicOpType(node->op());
ArchOpcode opcode;
if (type == MachineType::Int8()) {
opcode = int8_op;
} else if (type == MachineType::Uint8()) {
opcode = uint8_op;
} else if (type == MachineType::Int16()) {
opcode = int16_op;
} else if (type == MachineType::Uint16()) {
opcode = uint16_op;
} else if (type == MachineType::Int32()) {
opcode = int32_op;
} else if (type == MachineType::Uint32()) {
opcode = uint32_op;
} else if (type == MachineType::Int64()) {
opcode = int64_op;
} else if (type == MachineType::Uint64()) {
opcode = uint64_op;
} else {
UNREACHABLE();
}
AddressingMode addressing_mode = kMode_MRR;
InstructionCode code = opcode | AddressingModeField::encode(addressing_mode);
InstructionOperand inputs[3];
size_t input_count = 0;
inputs[input_count++] = g.UseUniqueRegister(base);
inputs[input_count++] = g.UseUniqueRegister(index);
inputs[input_count++] = g.UseUniqueRegister(value);
InstructionOperand outputs[1];
size_t output_count = 0;
outputs[output_count++] = g.DefineAsRegister(node);
selector->Emit(code, output_count, outputs, input_count, inputs);
}
void InstructionSelector::VisitWord32AtomicBinaryOperation(
Node* node, ArchOpcode int8_op, ArchOpcode uint8_op, ArchOpcode int16_op,
ArchOpcode uint16_op, ArchOpcode word32_op) {
// Unused
UNREACHABLE();
}
void InstructionSelector::VisitWord64AtomicBinaryOperation(
Node* node, ArchOpcode uint8_op, ArchOpcode uint16_op, ArchOpcode uint32_op,
ArchOpcode uint64_op) {
// Unused
UNREACHABLE();
}
#define VISIT_ATOMIC_BINOP(op) \
void InstructionSelector::VisitWord32Atomic##op(Node* node) { \
VisitAtomicBinaryOperation( \
this, node, kPPC_Atomic##op##Int8, kPPC_Atomic##op##Uint8, \
kPPC_Atomic##op##Int16, kPPC_Atomic##op##Uint16, \
kPPC_Atomic##op##Int32, kPPC_Atomic##op##Uint32, \
kPPC_Atomic##op##Int64, kPPC_Atomic##op##Uint64); \
} \
void InstructionSelector::VisitWord64Atomic##op(Node* node) { \
VisitAtomicBinaryOperation( \
this, node, kPPC_Atomic##op##Int8, kPPC_Atomic##op##Uint8, \
kPPC_Atomic##op##Int16, kPPC_Atomic##op##Uint16, \
kPPC_Atomic##op##Int32, kPPC_Atomic##op##Uint32, \
kPPC_Atomic##op##Int64, kPPC_Atomic##op##Uint64); \
}
VISIT_ATOMIC_BINOP(Add)
VISIT_ATOMIC_BINOP(Sub)
VISIT_ATOMIC_BINOP(And)
VISIT_ATOMIC_BINOP(Or)
VISIT_ATOMIC_BINOP(Xor)
#undef VISIT_ATOMIC_BINOP
void InstructionSelector::VisitInt32AbsWithOverflow(Node* node) {
UNREACHABLE();
}
void InstructionSelector::VisitInt64AbsWithOverflow(Node* node) {
UNREACHABLE();
}
#define SIMD_TYPES(V) \
V(F64x2) \
V(F32x4) \
V(I32x4) \
V(I16x8) \
V(I8x16)
#define SIMD_BINOP_LIST(V) \
V(F64x2Add) \
V(F64x2Sub) \
V(F64x2Mul) \
V(F64x2Eq) \
V(F64x2Ne) \
V(F64x2Le) \
V(F64x2Lt) \
V(F64x2Div) \
V(F64x2Min) \
V(F64x2Max) \
V(F32x4Add) \
V(F32x4AddHoriz) \
V(F32x4Sub) \
V(F32x4Mul) \
V(F32x4Eq) \
V(F32x4Ne) \
V(F32x4Lt) \
V(F32x4Le) \
V(F32x4Div) \
V(F32x4Min) \
V(F32x4Max) \
V(I64x2Add) \
V(I64x2Sub) \
V(I64x2Mul) \
V(I32x4Add) \
V(I32x4AddHoriz) \
V(I32x4Sub) \
V(I32x4Mul) \
V(I32x4MinS) \
V(I32x4MinU) \
V(I32x4MaxS) \
V(I32x4MaxU) \
V(I32x4Eq) \
V(I32x4Ne) \
V(I32x4GtS) \
V(I32x4GeS) \
V(I32x4GtU) \
V(I32x4GeU) \
V(I32x4DotI16x8S) \
V(I16x8Add) \
V(I16x8AddHoriz) \
V(I16x8Sub) \
V(I16x8Mul) \
V(I16x8MinS) \
V(I16x8MinU) \
V(I16x8MaxS) \
V(I16x8MaxU) \
V(I16x8Eq) \
V(I16x8Ne) \
V(I16x8GtS) \
V(I16x8GeS) \
V(I16x8GtU) \
V(I16x8GeU) \
V(I16x8SConvertI32x4) \
V(I16x8UConvertI32x4) \
V(I16x8AddSatS) \
V(I16x8SubSatS) \
V(I16x8AddSatU) \
V(I16x8SubSatU) \
V(I16x8RoundingAverageU) \
V(I8x16Add) \
V(I8x16Sub) \
V(I8x16Mul) \
V(I8x16MinS) \
V(I8x16MinU) \
V(I8x16MaxS) \
V(I8x16MaxU) \
V(I8x16Eq) \
V(I8x16Ne) \
V(I8x16GtS) \
V(I8x16GeS) \
V(I8x16GtU) \
V(I8x16GeU) \
V(I8x16SConvertI16x8) \
V(I8x16UConvertI16x8) \
V(I8x16AddSatS) \
V(I8x16SubSatS) \
V(I8x16AddSatU) \
V(I8x16SubSatU) \
V(I8x16RoundingAverageU) \
V(I8x16Swizzle) \
V(S128And) \
V(S128Or) \
V(S128Xor) \
V(S128AndNot)
#define SIMD_UNOP_LIST(V) \
V(F64x2Abs) \
V(F64x2Neg) \
V(F64x2Sqrt) \
V(F64x2Ceil) \
V(F64x2Floor) \
V(F64x2Trunc) \
V(F64x2NearestInt) \
V(F32x4Abs) \
V(F32x4Neg) \
V(F32x4RecipApprox) \
V(F32x4RecipSqrtApprox) \
V(F32x4Sqrt) \
V(F32x4SConvertI32x4) \
V(F32x4UConvertI32x4) \
V(F32x4Ceil) \
V(F32x4Floor) \
V(F32x4Trunc) \
V(F32x4NearestInt) \
V(I64x2Neg) \
V(I32x4Neg) \
V(I32x4Abs) \
V(I32x4SConvertF32x4) \
V(I32x4UConvertF32x4) \
V(I32x4SConvertI16x8Low) \
V(I32x4SConvertI16x8High) \
V(I32x4UConvertI16x8Low) \
V(I32x4UConvertI16x8High) \
V(I16x8Neg) \
V(I16x8Abs) \
V(I8x16Neg) \
V(I8x16Abs) \
V(I16x8SConvertI8x16Low) \
V(I16x8SConvertI8x16High) \
V(I16x8UConvertI8x16Low) \
V(I16x8UConvertI8x16High) \
V(S128Not)
#define SIMD_SHIFT_LIST(V) \
V(I64x2Shl) \
V(I64x2ShrS) \
V(I64x2ShrU) \
V(I32x4Shl) \
V(I32x4ShrS) \
V(I32x4ShrU) \
V(I16x8Shl) \
V(I16x8ShrS) \
V(I16x8ShrU) \
V(I8x16Shl) \
V(I8x16ShrS) \
V(I8x16ShrU)
#define SIMD_BOOL_LIST(V) \
V(V32x4AnyTrue) \
V(V16x8AnyTrue) \
V(V8x16AnyTrue) \
V(V32x4AllTrue) \
V(V16x8AllTrue) \
V(V8x16AllTrue)
#define SIMD_VISIT_SPLAT(Type) \
void InstructionSelector::Visit##Type##Splat(Node* node) { \
PPCOperandGenerator g(this); \
Emit(kPPC_##Type##Splat, g.DefineAsRegister(node), \
g.UseRegister(node->InputAt(0))); \
}
SIMD_TYPES(SIMD_VISIT_SPLAT)
#undef SIMD_VISIT_SPLAT
#define SIMD_VISIT_EXTRACT_LANE(Type, Sign) \
void InstructionSelector::Visit##Type##ExtractLane##Sign(Node* node) { \
PPCOperandGenerator g(this); \
int32_t lane = OpParameter<int32_t>(node->op()); \
Emit(kPPC_##Type##ExtractLane##Sign, g.DefineAsRegister(node), \
g.UseRegister(node->InputAt(0)), g.UseImmediate(lane)); \
}
SIMD_VISIT_EXTRACT_LANE(F64x2, )
SIMD_VISIT_EXTRACT_LANE(F32x4, )
SIMD_VISIT_EXTRACT_LANE(I32x4, )
SIMD_VISIT_EXTRACT_LANE(I16x8, U)
SIMD_VISIT_EXTRACT_LANE(I16x8, S)
SIMD_VISIT_EXTRACT_LANE(I8x16, U)
SIMD_VISIT_EXTRACT_LANE(I8x16, S)
#undef SIMD_VISIT_EXTRACT_LANE
#define SIMD_VISIT_REPLACE_LANE(Type) \
void InstructionSelector::Visit##Type##ReplaceLane(Node* node) { \
PPCOperandGenerator g(this); \
int32_t lane = OpParameter<int32_t>(node->op()); \
Emit(kPPC_##Type##ReplaceLane, g.DefineSameAsFirst(node), \
g.UseRegister(node->InputAt(0)), g.UseImmediate(lane), \
g.UseRegister(node->InputAt(1))); \
}
SIMD_TYPES(SIMD_VISIT_REPLACE_LANE)
#undef SIMD_VISIT_REPLACE_LANE
#define SIMD_VISIT_BINOP(Opcode) \
void InstructionSelector::Visit##Opcode(Node* node) { \
PPCOperandGenerator g(this); \
InstructionOperand temps[] = {g.TempSimd128Register(), \
g.TempSimd128Register()}; \
Emit(kPPC_##Opcode, g.DefineAsRegister(node), \
g.UseUniqueRegister(node->InputAt(0)), \
g.UseUniqueRegister(node->InputAt(1)), arraysize(temps), temps); \
}
SIMD_BINOP_LIST(SIMD_VISIT_BINOP)
#undef SIMD_VISIT_BINOP
#undef SIMD_BINOP_LIST
#define SIMD_VISIT_UNOP(Opcode) \
void InstructionSelector::Visit##Opcode(Node* node) { \
PPCOperandGenerator g(this); \
InstructionOperand temps[] = {g.TempSimd128Register()}; \
Emit(kPPC_##Opcode, g.DefineAsRegister(node), \
g.UseRegister(node->InputAt(0)), arraysize(temps), temps); \
}
SIMD_UNOP_LIST(SIMD_VISIT_UNOP)
#undef SIMD_VISIT_UNOP
#undef SIMD_UNOP_LIST
#define SIMD_VISIT_SHIFT(Opcode) \
void InstructionSelector::Visit##Opcode(Node* node) { \
PPCOperandGenerator g(this); \
Emit(kPPC_##Opcode, g.DefineAsRegister(node), \
g.UseUniqueRegister(node->InputAt(0)), \
g.UseUniqueRegister(node->InputAt(1))); \
}
SIMD_SHIFT_LIST(SIMD_VISIT_SHIFT)
#undef SIMD_VISIT_SHIFT
#undef SIMD_SHIFT_LIST
#define SIMD_VISIT_BOOL(Opcode) \
void InstructionSelector::Visit##Opcode(Node* node) { \
PPCOperandGenerator g(this); \
Emit(kPPC_##Opcode, g.DefineAsRegister(node), \
g.UseUniqueRegister(node->InputAt(0))); \
}
SIMD_BOOL_LIST(SIMD_VISIT_BOOL)
#undef SIMD_VISIT_BOOL
#undef SIMD_BOOL_LIST
#define SIMD_VISIT_BITMASK(Opcode) \
void InstructionSelector::Visit##Opcode(Node* node) { \
PPCOperandGenerator g(this); \
InstructionOperand temps[] = {g.TempRegister()}; \
Emit(kPPC_##Opcode, g.DefineAsRegister(node), \
g.UseUniqueRegister(node->InputAt(0)), arraysize(temps), temps); \
}
SIMD_VISIT_BITMASK(I8x16BitMask)
SIMD_VISIT_BITMASK(I16x8BitMask)
SIMD_VISIT_BITMASK(I32x4BitMask)
#undef SIMD_VISIT_BITMASK
#define SIMD_VISIT_PMIN_MAX(Type) \
void InstructionSelector::Visit##Type(Node* node) { \
PPCOperandGenerator g(this); \
Emit(kPPC_##Type, g.DefineAsRegister(node), \
g.UseRegister(node->InputAt(0)), g.UseRegister(node->InputAt(1))); \
}
SIMD_VISIT_PMIN_MAX(F64x2Pmin)
SIMD_VISIT_PMIN_MAX(F32x4Pmin)
SIMD_VISIT_PMIN_MAX(F64x2Pmax)
SIMD_VISIT_PMIN_MAX(F32x4Pmax)
#undef SIMD_VISIT_PMIN_MAX
#undef SIMD_TYPES
void InstructionSelector::VisitI8x16Shuffle(Node* node) {
uint8_t shuffle[kSimd128Size];
bool is_swizzle;
CanonicalizeShuffle(node, shuffle, &is_swizzle);
PPCOperandGenerator g(this);
Node* input0 = node->InputAt(0);
Node* input1 = node->InputAt(1);
// Remap the shuffle indices to match IBM lane numbering.
int max_index = 15;
int total_lane_count = 2 * kSimd128Size;
uint8_t shuffle_remapped[kSimd128Size];
for (int i = 0; i < kSimd128Size; i++) {
uint8_t current_index = shuffle[i];
shuffle_remapped[i] = (current_index <= max_index
? max_index - current_index
: total_lane_count - current_index + max_index);
}
Emit(kPPC_I8x16Shuffle, g.DefineAsRegister(node), g.UseUniqueRegister(input0),
g.UseUniqueRegister(input1),
g.UseImmediate(wasm::SimdShuffle::Pack4Lanes(shuffle_remapped)),
g.UseImmediate(wasm::SimdShuffle::Pack4Lanes(shuffle_remapped + 4)),
g.UseImmediate(wasm::SimdShuffle::Pack4Lanes(shuffle_remapped + 8)),
g.UseImmediate(wasm::SimdShuffle::Pack4Lanes(shuffle_remapped + 12)));
}
void InstructionSelector::VisitS128Zero(Node* node) {
PPCOperandGenerator g(this);
Emit(kPPC_S128Zero, g.DefineAsRegister(node));
}
void InstructionSelector::VisitS128Select(Node* node) {
PPCOperandGenerator g(this);
Emit(kPPC_S128Select, g.DefineAsRegister(node),
g.UseRegister(node->InputAt(0)), g.UseRegister(node->InputAt(1)),
g.UseRegister(node->InputAt(2)));
}
void InstructionSelector::VisitS128Const(Node* node) {
PPCOperandGenerator g(this);
uint32_t val[kSimd128Size / sizeof(uint32_t)];
base::Memcpy(val, S128ImmediateParameterOf(node->op()).data(), kSimd128Size);
// If all bytes are zeros, avoid emitting code for generic constants.
bool all_zeros = !(val[0] || val[1] || val[2] || val[3]);
bool all_ones = val[0] == UINT32_MAX && val[1] == UINT32_MAX &&
val[2] == UINT32_MAX && val[3] == UINT32_MAX;
InstructionOperand dst = g.DefineAsRegister(node);
if (all_zeros) {
Emit(kPPC_S128Zero, dst);
} else if (all_ones) {
Emit(kPPC_S128AllOnes, dst);
} else {
Emit(kPPC_S128Const, dst, g.UseImmediate(val[0]), g.UseImmediate(val[1]),
g.UseImmediate(val[2]), g.UseImmediate(val[3]));
}
}
void InstructionSelector::VisitI64x2ExtMulLowI32x4S(Node* node) {
UNIMPLEMENTED();
}
void InstructionSelector::VisitI64x2ExtMulHighI32x4S(Node* node) {
UNIMPLEMENTED();
}
void InstructionSelector::VisitI64x2ExtMulLowI32x4U(Node* node) {
UNIMPLEMENTED();
}
void InstructionSelector::VisitI64x2ExtMulHighI32x4U(Node* node) {
UNIMPLEMENTED();
}
void InstructionSelector::VisitI32x4ExtMulLowI16x8S(Node* node) {
UNIMPLEMENTED();
}
void InstructionSelector::VisitI32x4ExtMulHighI16x8S(Node* node) {
UNIMPLEMENTED();
}
void InstructionSelector::VisitI32x4ExtMulLowI16x8U(Node* node) {
UNIMPLEMENTED();
}
void InstructionSelector::VisitI32x4ExtMulHighI16x8U(Node* node) {
UNIMPLEMENTED();
}
void InstructionSelector::VisitI16x8ExtMulLowI8x16S(Node* node) {
UNIMPLEMENTED();
}
void InstructionSelector::VisitI16x8ExtMulHighI8x16S(Node* node) {
UNIMPLEMENTED();
}
void InstructionSelector::VisitI16x8ExtMulLowI8x16U(Node* node) {
UNIMPLEMENTED();
}
void InstructionSelector::VisitI16x8ExtMulHighI8x16U(Node* node) {
UNIMPLEMENTED();
}
void InstructionSelector::EmitPrepareResults(
ZoneVector<PushParameter>* results, const CallDescriptor* call_descriptor,
Node* node) {
PPCOperandGenerator g(this);
for (PushParameter output : *results) {
if (!output.location.IsCallerFrameSlot()) continue;
// Skip any alignment holes in nodes.
if (output.node != nullptr) {
DCHECK(!call_descriptor->IsCFunctionCall());
if (output.location.GetType() == MachineType::Float32()) {
MarkAsFloat32(output.node);
} else if (output.location.GetType() == MachineType::Float64()) {
MarkAsFloat64(output.node);
} else if (output.location.GetType() == MachineType::Simd128()) {
MarkAsSimd128(output.node);
}
int offset = call_descriptor->GetOffsetToReturns();
int reverse_slot = -output.location.GetLocation() - offset;
Emit(kPPC_Peek, g.DefineAsRegister(output.node),
g.UseImmediate(reverse_slot));
}
}
}
void InstructionSelector::VisitLoadTransform(Node* node) {
LoadTransformParameters params = LoadTransformParametersOf(node->op());
PPCOperandGenerator g(this);
Node* base = node->InputAt(0);
Node* index = node->InputAt(1);
ArchOpcode opcode;
switch (params.transformation) {
case LoadTransformation::kS128Load8Splat:
opcode = kPPC_S128Load8Splat;
break;
case LoadTransformation::kS128Load16Splat:
opcode = kPPC_S128Load16Splat;
break;
case LoadTransformation::kS128Load32Splat:
opcode = kPPC_S128Load32Splat;
break;
case LoadTransformation::kS128Load64Splat:
opcode = kPPC_S128Load64Splat;
break;
case LoadTransformation::kS128Load8x8S:
opcode = kPPC_S128Load8x8S;
break;
case LoadTransformation::kS128Load8x8U:
opcode = kPPC_S128Load8x8U;
break;
case LoadTransformation::kS128Load16x4S:
opcode = kPPC_S128Load16x4S;
break;
case LoadTransformation::kS128Load16x4U:
opcode = kPPC_S128Load16x4U;
break;
case LoadTransformation::kS128Load32x2S:
opcode = kPPC_S128Load32x2S;
break;
case LoadTransformation::kS128Load32x2U:
opcode = kPPC_S128Load32x2U;
break;
case LoadTransformation::kS128Load32Zero:
opcode = kPPC_S128Load32Zero;
break;
case LoadTransformation::kS128Load64Zero:
opcode = kPPC_S128Load64Zero;
break;
default:
UNREACHABLE();
}
Emit(opcode | AddressingModeField::encode(kMode_MRR),
g.DefineAsRegister(node), g.UseRegister(base), g.UseRegister(index));
}
// static
MachineOperatorBuilder::Flags
InstructionSelector::SupportedMachineOperatorFlags() {
return MachineOperatorBuilder::kFloat32RoundDown |
MachineOperatorBuilder::kFloat64RoundDown |
MachineOperatorBuilder::kFloat32RoundUp |
MachineOperatorBuilder::kFloat64RoundUp |
MachineOperatorBuilder::kFloat32RoundTruncate |
MachineOperatorBuilder::kFloat64RoundTruncate |
MachineOperatorBuilder::kFloat64RoundTiesAway |
MachineOperatorBuilder::kWord32Popcnt |
MachineOperatorBuilder::kWord64Popcnt;
// We omit kWord32ShiftIsSafe as s[rl]w use 0x3F as a mask rather than 0x1F.
}
// static
MachineOperatorBuilder::AlignmentRequirements
InstructionSelector::AlignmentRequirements() {
return MachineOperatorBuilder::AlignmentRequirements::
FullUnalignedAccessSupport();
}
} // namespace compiler
} // namespace internal
} // namespace v8
|
ViridianMart_Script:
call ViridianMartScript_1d47d
call EnableAutoTextBoxDrawing
ld hl, ViridianMart_ScriptPointers
ld a, [wViridianMartCurScript]
jp CallFunctionInTable
ViridianMartScript_1d47d:
CheckEvent EVENT_OAK_GOT_PARCEL
jr nz, .delivered_parcel
ld hl, ViridianMart_TextPointers
jr .done
.delivered_parcel
ld hl, ViridianMart_TextPointers2
.done
ld a, l
ld [wMapTextPtr], a
ld a, h
ld [wMapTextPtr+1], a
ret
ViridianMart_ScriptPointers:
dw ViridianMartScript0
dw ViridianMartScript1
dw ViridianMartScript2
ViridianMartScript0:
call UpdateSprites
ld a, $4
ldh [hSpriteIndexOrTextID], a
call DisplayTextID
ld hl, wSimulatedJoypadStatesEnd
ld de, RLEMovement1d4bb
call DecodeRLEList
dec a
ld [wSimulatedJoypadStatesIndex], a
call StartSimulatingJoypadStates
ld a, $1
ld [wViridianMartCurScript], a
ret
RLEMovement1d4bb:
db D_LEFT, 1
db D_UP, 2
db -1 ; end
ViridianMartScript1:
ld a, [wSimulatedJoypadStatesIndex]
and a
ret nz
call Delay3
ld a, $5
ldh [hSpriteIndexOrTextID], a
call DisplayTextID
lb bc, OAKS_PARCEL, 1
call GiveItem
SetEvent EVENT_GOT_OAKS_PARCEL
ld a, $2
ld [wViridianMartCurScript], a
; fallthrough
ViridianMartScript2:
ret
ViridianMart_TextPointers:
dw ViridianMartText1
dw ViridianMartText2
dw ViridianMartText3
dw ViridianMartText4
dw ViridianMartText5
ViridianMart_TextPointers2:
dw ViridianCashierText
dw ViridianMartText2
dw ViridianMartText3
ViridianMartText1:
text_far _ViridianMartText1
text_end
ViridianMartText4:
text_far _ViridianMartText4
text_end
ViridianMartText5:
text_far ViridianMartParcelQuestText
sound_get_key_item
text_end
ViridianMartText2:
text_far _ViridianMartText2
text_end
ViridianMartText3:
text_far _ViridianMartText3
text_end
|
; A083039: Number of divisors of n that are <= 3.
; 1,2,2,2,1,3,1,2,2,2,1,3,1,2,2,2,1,3,1,2,2,2,1,3,1,2,2,2,1,3,1,2,2,2,1,3,1,2,2,2,1,3,1,2,2,2,1,3,1,2,2,2,1,3,1,2,2,2,1,3,1,2,2,2,1,3,1,2,2,2,1,3,1,2,2,2,1,3,1,2,2,2,1,3,1,2,2,2,1,3
mov $1,$0
mod $0,3
fac $0
mod $1,2
add $1,$0
|
; A019495: Define the sequence T(a(0),a(1)) by a(n+2) is the greatest integer such that a(n+2)/a(n+1) < a(n+1)/a(n) for n >= 0. This is T(4,11).
; Submitted by Christian Krause
; 4,11,30,81,218,586,1575,4233,11376,30572,82159,220793,593356,1594576,4285239,11516085,30948148,83169572,223508615,600653577,1614187084,4337941272,11657715927,31328764525,84192434676,226257439900,608040726071,1634039193249,4391291521420,11801088557584,31714061902887,85227876858341,229040071121236,615518725949428,1654135453851943,4445297899701561,11946224458870604,32104097867389128,86276053444950839,231856924582735901,623088694144604020,1674478868679586828,4499968476404027735,12093145316666752017
mov $4,2
lpb $4
sub $4,1
add $0,$4
sub $0,1
mov $1,4
mov $2,4
lpb $0
sub $0,1
sub $3,$2
div $3,$2
mov $2,$1
mul $1,3
add $1,$3
mul $3,$1
lpe
div $4,2
lpe
mov $0,$1
|
; A195986: Exponent of the largest power of 2 that divides 5^n - 3^n.
; 1,4,1,5,1,4,1,6,1,4,1,5,1,4,1,7,1,4,1,5,1,4,1,6,1,4,1,5,1,4,1,8,1,4,1,5,1,4,1,6,1,4,1,5,1,4,1,7,1,4,1,5,1,4,1,6,1,4,1,5,1,4,1,9,1,4,1,5,1,4,1,6,1,4,1,5,1,4,1,7,1,4,1,5,1,4,1,6,1,4,1,5,1,4,1,8,1,4,1,5
lpb $0
sub $0,1
mul $0,4
dif $0,8
add $1,1
max $1,3
lpe
add $1,1
mov $0,$1
|
#include <iostream>
#include <chrono>
#include <vector>
#include "Util.h"
namespace
{
const int WOLKSENSE_MULTIPLIER_FACTOR = 10;
const int PRESSURE_CONVERSION_FACTOR = 10 * WOLKSENSE_MULTIPLIER_FACTOR;
}
using namespace Poco::JSON;
using namespace std::chrono;
namespace execConn
{
const std::string Util::LORA_TEMPERATURE= "Temp";
const std::string Util::LORA_HUMIDITY= "Humidity";
const std::string Util::LORA_BAROMETER = "Barometer";
const std::string Util::LORA_POLLUTION = "Pollution";
const std::string Util::LORA_ADDRESS= "Address";
const std::string Util::MQTT_TEMPERATURE = "T";
const std::string Util::MQTT_HUMIDITY = "H";
const std::string Util::MQTT_BAROMETER = "P";
const std::string Util::MQTT_GENERIC = "GEN";
const std::string Util::MQTT_RTC = "RTC";
const std::string Util::MQTT_READINGS = "READINGS";
const std::string Util::MQTT_TIMESTAMP = "R";
const int Util::WOLKSENSE_TEMP_MIN_VALUE = -400;
const int Util::WOLKSENSE_TEMP_MAX_VALUE = 850;
const int Util::WOLKSENSE_PRESSURE_MIN_VALUE = 8000;
const int Util::WOLKSENSE_PRESSURE_MAX_VALUE = 11000;
const int Util::WOLKSENSE_HUMID_MIN_VALUE = 10;
const int Util::WOLKSENSE_HUMID_MAX_VALUE = 1000;
const int Util::WOLKSENSE_GENERIC_MIN_VALUE = 0;
const int Util::WOLKSENSE_GENERIC_MAX_VALUE = 1000;
namespace
{
const int WOLKSENSE_MULTIPLIER_FACTOR = 10;
const int PRESSURE_CONVERSION_FACTOR = 10;
}
using namespace Poco::JSON;
using namespace std::chrono;
std::string Util::loRaToMqtt(const std::string& json)
{
Parser loParser;
Poco::Dynamic::Var loParsedJson = loParser.parse(json.c_str());
Poco::Dynamic::Var loParsedJsonResult = loParser.result();
Object::Ptr loJsonObject = loParsedJsonResult.extract<Object::Ptr>();
std::string temp = getValue(loJsonObject, LORA_TEMPERATURE);
std::string humid = getValue(loJsonObject, LORA_HUMIDITY);
std::string pressure = getValue(loJsonObject, LORA_BAROMETER);
std::string pollution = getValue(loJsonObject, LORA_POLLUTION);
try
{
float p = std::stof(pressure);
pressure = floatToWolksenseStrInt(p, WOLKSENSE_MULTIPLIER_FACTOR, true,
WOLKSENSE_PRESSURE_MIN_VALUE, WOLKSENSE_PRESSURE_MAX_VALUE);
}
catch(...)
{
std::cout<<"Could not parse pressure value: " << pressure<<std::endl;
}
try
{
temp = strFloatToWolksenseStrInt(temp, WOLKSENSE_MULTIPLIER_FACTOR, true,
WOLKSENSE_TEMP_MIN_VALUE, WOLKSENSE_TEMP_MAX_VALUE);
}
catch(...)
{
std::cout<<"Could not parse temperature value: "<< temp <<std::endl;
}
try
{
humid = strFloatToWolksenseStrInt(humid, WOLKSENSE_MULTIPLIER_FACTOR, true,
WOLKSENSE_HUMID_MIN_VALUE, WOLKSENSE_HUMID_MAX_VALUE);
}
catch(...)
{
std::cout<<"Could not parse humidity value: " << humid <<std::endl;
}
try
{
pollution = strFloatToWolksenseStrInt(pollution, WOLKSENSE_MULTIPLIER_FACTOR, true,
WOLKSENSE_GENERIC_MIN_VALUE, WOLKSENSE_GENERIC_MAX_VALUE);
}
catch(...)
{
std::cout<< "Could not parse light value: " << pollution <<std::endl;
}
seconds sec = duration_cast<seconds>(system_clock::now().time_since_epoch());
unsigned timestamp = sec.count();
std::stringstream mqttMsg;
mqttMsg << MQTT_RTC << " " << timestamp << ";";
mqttMsg << MQTT_READINGS << " ";
mqttMsg << MQTT_TIMESTAMP << ":" << timestamp << ",";
if(!temp.empty())
{
mqttMsg << MQTT_TEMPERATURE << ":" << temp << ",";
}
if(!humid.empty())
{
mqttMsg << MQTT_HUMIDITY << ":" << humid << ",";
}
if(!pressure.empty())
{
mqttMsg << MQTT_BAROMETER << ":" << pressure << ",";
}
if(!pollution.empty())
{
mqttMsg << MQTT_GENERIC << ":" << pollution << ",";
}
std::string msgStr = mqttMsg.str();
if(msgStr.back() == ',')
{
msgStr.pop_back();
}
msgStr.append(";");
return msgStr;
}
std::string Util::getJSONValue(const std::string& json, const std::string& key)
{
Parser loParser;
Poco::Dynamic::Var loParsedJson = loParser.parse(json.c_str());
Poco::Dynamic::Var loParsedJsonResult = loParser.result();
Object::Ptr loJsonObject = loParsedJsonResult.extract<Object::Ptr>();
return getValue(loJsonObject, key.c_str());
}
std::string Util::getValue(Poco::JSON::Object::Ptr aoJsonObject, const std::string& key)
{
Poco::Dynamic::Var loVariable;
std::string lsReturn;
loVariable = aoJsonObject->get(key);
if(!loVariable.isEmpty())
{
lsReturn = loVariable.convert<std::string>();
}
return lsReturn;
}
std::string Util::strFloatToWolksenseStrInt(const std::string& floatValue, int multiplier, bool limit, int min, int max)
{
std::stringstream wsv;
float f = std::stof(floatValue);
f *= multiplier;
int intVal = static_cast<int>(f);
if(limit)
intVal = limitInt(intVal, min, max);
unsigned absIntVal = std::abs(intVal);
if(intVal >= 0)
wsv << "+";
else
wsv << "-";
if(absIntVal < 10)
wsv << "0";
wsv << absIntVal;
return wsv.str();
}
std::string Util::floatToWolksenseStrInt(float value, int multiplier, bool limit, int min, int max)
{
return strFloatToWolksenseStrInt(std::to_string(value), multiplier, limit, min, max);
}
int Util::limitInt(int value, int min, int max)
{
int limitedValue;
if(value < min)
limitedValue = min;
else if(value > max)
limitedValue = max;
else
limitedValue = value;
return limitedValue;
}
}
|
; uint z80_get_int_state(void)
SECTION code_clib
SECTION code_z80
PUBLIC z80_get_int_state
PUBLIC cpu_get_int_state
EXTERN asm_z80_get_int_state
EXTERN asm_cpu_get_int_state
defc z80_get_int_state = asm_z80_get_int_state
defc cpu_get_int_state = asm_cpu_get_int_state
|
; A328882: a(n) = n - 2^(sum of digits of n).
; -1,-1,-2,-5,-12,-27,-58,-121,-248,-503,8,7,4,-3,-18,-49,-112,-239,-494,-1005,16,13,6,-9,-40,-103,-230,-485,-996,-2019,22,15,0,-31,-94,-221,-476,-987,-2010,-4057,24,9,-22,-85,-212,-467,-978,-2001,-4048,-8143,18,-13,-76,-203,-458,-969,-1992,-4039,-8134,-16325,-4,-67,-194,-449,-960,-1983,-4030,-8125,-16316,-32699,-58,-185,-440,-951,-1974,-4021,-8116,-16307,-32690,-65457,-176,-431,-942,-1965,-4012,-8107,-16298,-32681,-65448,-130983,-422,-933,-1956,-4003,-8098,-16289,-32672,-65439,-130974,-262045
mov $1,$0
seq $1,329562 ; a(n) = 2^(sum of digits of n).
sub $0,$1
|
; A050482: Sum of remainders when n-th prime is divided by all preceding integers.
; 0,1,4,8,22,28,51,64,98,151,167,233,297,325,403,505,635,645,790,904,923,1113,1244,1422,1654,1800,1888,2056,2098,2256,2849,3066,3326,3450,3969,4045,4329,4696,5014,5325,5767,5759,6499,6565,6898,7022,7817,8853,9176,9298,9646,10232,10206,11267,11714,12364,12926,13014,13560,13954,14222,15288,16722,17218,17312,17856,19367,20051,21460,21662,22056,23070,23909,24673,25433,26169,26975,27876,28465,29575,31317,31231,33111,33165,34331,34838,35848,36963,37755,37987,38839,40959,42050,42858,44210,45194,46092
seq $0,40 ; The prime numbers.
sub $0,1
seq $0,4125 ; Sum of remainders of n mod k, for k = 1, 2, 3, ..., n.
|
; A176844: The number of iterations of the map n -> n - bigomega(sigma(n)) until reaching 1.
; 0,1,1,2,2,2,3,3,4,4,4,5,5,5,5,6,6,7,7,7,7,8,8,8,9,9,9,9,10,10,10,11,10,11,11,12,12,12,12,13,13,13,14,14,14,14,14,15,15,16,15,16,16,16,17,16,17,17,18,18,19,17,19,20,20,19,21,21,20,21,20,21,21,21,22,22,21,22,22
lpb $0
mov $2,$0
seq $2,58063 ; Number of prime factors (when counted with multiplicity) of sigma(n), the sum of divisors of n.
sub $0,$2
mov $3,$2
min $3,1
add $1,$3
lpe
mov $0,$1
|
dc.l $00000011
dc.l $00000122
dc.l $00001233
dc.l $00441356
dc.l $04444135
dc.l $00127411
dc.l $01237444
dc.l $12357473
dc.l $12357722
dc.l $11222211
dc.l $01111156
dc.l $00016677
dc.l $00888677
dc.l $0899a866
dc.l $0444aa81
dc.l $0044448b
dc.l $11000000
dc.l $22100000
dc.l $33210000
dc.l $65314400
dc.l $53144440
dc.l $11472100
dc.l $44473210
dc.l $37475321
dc.l $22775321
dc.l $11222211
dc.l $65111110
dc.l $77610000
dc.l $76618000
dc.l $661aa800
dc.l $11aa8800
dc.l $bb888000
dc.l $00000011
dc.l $00000122
dc.l $00001233
dc.l $00441356
dc.l $04444135
dc.l $00127411
dc.l $01237444
dc.l $12357473
dc.l $12357722
dc.l $11222211
dc.l $01111156
dc.l $00001677
dc.l $00081667
dc.l $008aa166
dc.l $0088aa11
dc.l $00088800
dc.l $11000000
dc.l $22100000
dc.l $33210000
dc.l $65314400
dc.l $53144440
dc.l $11472100
dc.l $44473210
dc.l $37475321
dc.l $22775321
dc.l $11222211
dc.l $65111110
dc.l $77661000
dc.l $77688800
dc.l $668a9980
dc.l $18aa4440
dc.l $08444400
palette_goomba:
dc.w $0e00
dc.w $0026
dc.w $0048
dc.w $026c
dc.w $0222
dc.w $04ae
dc.w $06ae
dc.w $0eee
dc.w $0008
dc.w $088e
dc.w $046c
dc.w $0222
;palette size octet : 24 ,hexa $0018
;size octet : 448 ,hexa $01c0,tile : 7
|
; A305189: a(n) = 1*2 + 3 + 4*5 + 6 + 7*8 + 9 + 10*11 + 12 + ... + (up to n).
; 1,2,5,9,25,31,38,87,96,106,206,218,231,400,415,431,687,705,724,1085,1106,1128,1612,1636,1661,2286,2313,2341,3125,3155,3186,4147,4180,4214,5370,5406,5443,6812,6851,6891,8491,8533,8576,10425,10470,10516,12632,12680,12729,15130,15181,15233,17937,17991,18046,21071,21128,21186,24550,24610,24671,28392,28455,28519,32615,32681,32748,37237,37306,37376,42276,42348,42421,47750,47825,47901,53677,53755,53834,60075,60156,60238,66962,67046,67131,74356,74443,74531,82275,82365,82456,90737,90830,90924,99760,99856,99953,109362,109461,109561,119561,119663,119766,130375,130480,130586,141822,141930,142039,153920,154031,154143,166687,166801,166916,180141,180258,180376,194300,194420,194541,209182,209305,209429,224805,224931,225058,241187,241316,241446,258346,258478,258611,276300,276435,276571,295067,295205,295344,314665,314806,314948,335112,335256,335401,356426,356573,356721,378625,378775,378926,401727,401880,402034,425750,425906,426063,450712,450871,451031,476631,476793,476956,503525,503690,503856,531412,531580,531749,560310,560481,560653,590237,590411,590586,621211,621388,621566,653250,653430,653611,686372,686555,686739,720595,720781,720968,755937,756126,756316,792416,792608,792801,830050,830245,830441,868857,869055,869254,908855,909056,909258,950062,950266,950471,992496,992703,992911,1036175,1036385,1036596,1081117,1081330,1081544,1127340,1127556,1127773,1174862,1175081,1175301,1223701,1223923,1224146,1273875,1274100,1274326,1325402,1325630,1325859,1378300,1378531,1378763,1432587,1432821,1433056,1488281,1488518,1488756,1545400,1545640,1545881,1603962,1604205,1604449,1663985,1664231,1664478,1725487,1725736,1725986
mov $3,$0
add $3,1
mov $6,$0
lpb $3
mov $0,$6
sub $3,1
sub $0,$3
mov $2,$0
mul $0,2
mod $0,3
mov $4,0
add $4,$2
mov $5,$4
mul $5,2
lpb $0
mov $0,1
mul $5,$4
sub $5,2
lpe
div $5,2
add $5,1
add $1,$5
lpe
|
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''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.
//
// Copyright (c) 2008-2021 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#include "foundation/PxBounds3.h"
#include "foundation/PxMathUtils.h"
#include "ConvexHullUtils.h"
#include "GuBox.h"
#include "GuConvexMeshData.h"
#include "PsUtilities.h"
#include "PsVecMath.h"
#include "VolumeIntegration.h"
using namespace physx;
using namespace Ps::aos;
namespace local {
static const float MIN_ADJACENT_ANGLE =
3.0f; // in degrees - result wont have two adjacent facets within this angle of each other.
static const float MAXDOT_MINANG = cosf(Ps::degToRad(MIN_ADJACENT_ANGLE)); // adjacent angle for dot product tests
//////////////////////////////////////////////////////////////////////////
// helper class for ConvexHullCrop
class VertFlag {
public:
PxU8 planetest;
PxU8 undermap;
PxU8 overmap;
};
//////////////////////////////////////////////////////////////////////////|
// helper class for ConvexHullCrop
class EdgeFlag {
public:
PxI16 undermap;
};
//////////////////////////////////////////////////////////////////////////|
// helper class for ConvexHullCrop
class Coplanar {
public:
PxU16 ea;
PxU8 v0;
PxU8 v1;
};
//////////////////////////////////////////////////////////////////////////
// plane test
enum PlaneTestResult { eCOPLANAR = 0, eUNDER = 1 << 0, eOVER = 1 << 1 };
//////////////////////////////////////////////////////////////////////////
// test where vertex lies in respect to the plane
static PlaneTestResult planeTest(const PxPlane &p, const PxVec3 &v, float epsilon) {
const float a = v.dot(p.n) + p.d;
PlaneTestResult flag = (a > epsilon) ? eOVER : ((a < -epsilon) ? eUNDER : eCOPLANAR);
return flag;
}
// computes the OBB for this set of points relative to this transform matrix. SIMD version
void computeOBBSIMD(PxU32 vcount, const Vec4V *points, Vec4V &sides, const QuatV &rot, Vec4V &trans) {
PX_ASSERT(vcount);
Vec4V minV = V4Load(FLT_MAX);
Vec4V maxV = V4Load(FLT_MIN);
for (PxU32 i = 0; i < vcount; i++) {
const Vec4V &vertexV = points[i];
const Vec4V t = V4Sub(vertexV, trans);
const Vec4V v = Vec4V_From_Vec3V(QuatRotateInv(rot, Vec3V_From_Vec4V(t)));
minV = V4Min(minV, v);
maxV = V4Max(maxV, v);
}
sides = V4Sub(maxV, minV);
Mat33V tmpMat;
QuatGetMat33V(rot, tmpMat.col0, tmpMat.col1, tmpMat.col2);
const FloatV coe = FLoad(0.5f);
const Vec4V deltaVec = V4Sub(maxV, V4Scale(sides, coe));
const Vec4V t0 = V4Scale(Vec4V_From_Vec3V(tmpMat.col0), V4GetX(deltaVec));
trans = V4Add(trans, t0);
const Vec4V t1 = V4Scale(Vec4V_From_Vec3V(tmpMat.col1), V4GetY(deltaVec));
trans = V4Add(trans, t1);
const Vec4V t2 = V4Scale(Vec4V_From_Vec3V(tmpMat.col2), V4GetZ(deltaVec));
trans = V4Add(trans, t2);
}
} // namespace local
//////////////////////////////////////////////////////////////////////////
// construct the base cube from given min/max
ConvexHull::ConvexHull(const PxVec3 &bmin, const PxVec3 &bmax, const Ps::Array<PxPlane> &inPlanes)
: mInputPlanes(inPlanes) {
// min max verts of the cube - 8 verts
mVertices.pushBack(PxVec3(bmin.x, bmin.y, bmin.z)); // ---
mVertices.pushBack(PxVec3(bmin.x, bmin.y, bmax.z)); // --+
mVertices.pushBack(PxVec3(bmin.x, bmax.y, bmin.z)); // -+-
mVertices.pushBack(PxVec3(bmin.x, bmax.y, bmax.z)); // -++
mVertices.pushBack(PxVec3(bmax.x, bmin.y, bmin.z)); // +--
mVertices.pushBack(PxVec3(bmax.x, bmin.y, bmax.z)); // +-+
mVertices.pushBack(PxVec3(bmax.x, bmax.y, bmin.z)); // ++-
mVertices.pushBack(PxVec3(bmax.x, bmax.y, bmax.z)); // +++
// cube planes - 6 planes
mFacets.pushBack(PxPlane(PxVec3(-1.f, 0, 0), bmin.x)); // 0,1,3,2
mFacets.pushBack(PxPlane(PxVec3(1.f, 0, 0), -bmax.x)); // 6,7,5,4
mFacets.pushBack(PxPlane(PxVec3(0, -1.f, 0), bmin.y)); // 0,4,5,1
mFacets.pushBack(PxPlane(PxVec3(0, 1.f, 0), -bmax.y)); // 3,7,6,2
mFacets.pushBack(PxPlane(PxVec3(0, 0, -1.f), bmin.z)); // 0,2,6,4
mFacets.pushBack(PxPlane(PxVec3(0, 0, 1.f), -bmax.z)); // 1,5,7,3
// cube edges - 24 edges
mEdges.pushBack(HalfEdge(11, 0, 0));
mEdges.pushBack(HalfEdge(23, 1, 0));
mEdges.pushBack(HalfEdge(15, 3, 0));
mEdges.pushBack(HalfEdge(16, 2, 0));
mEdges.pushBack(HalfEdge(13, 6, 1));
mEdges.pushBack(HalfEdge(21, 7, 1));
mEdges.pushBack(HalfEdge(9, 5, 1));
mEdges.pushBack(HalfEdge(18, 4, 1));
mEdges.pushBack(HalfEdge(19, 0, 2));
mEdges.pushBack(HalfEdge(6, 4, 2));
mEdges.pushBack(HalfEdge(20, 5, 2));
mEdges.pushBack(HalfEdge(0, 1, 2));
mEdges.pushBack(HalfEdge(22, 3, 3));
mEdges.pushBack(HalfEdge(4, 7, 3));
mEdges.pushBack(HalfEdge(17, 6, 3));
mEdges.pushBack(HalfEdge(2, 2, 3));
mEdges.pushBack(HalfEdge(3, 0, 4));
mEdges.pushBack(HalfEdge(14, 2, 4));
mEdges.pushBack(HalfEdge(7, 6, 4));
mEdges.pushBack(HalfEdge(8, 4, 4));
mEdges.pushBack(HalfEdge(10, 1, 5));
mEdges.pushBack(HalfEdge(5, 5, 5));
mEdges.pushBack(HalfEdge(12, 7, 5));
mEdges.pushBack(HalfEdge(1, 3, 5));
}
//////////////////////////////////////////////////////////////////////////
// create the initial convex hull from given OBB
ConvexHull::ConvexHull(const PxVec3 &extent, const PxTransform &transform, const Ps::Array<PxPlane> &inPlanes)
: mInputPlanes(inPlanes) {
// get the OBB corner points
PxVec3 extentPoints[8];
PxMat33 rot(transform.q);
Gu::computeOBBPoints(extentPoints, transform.p, extent, rot.column0, rot.column1, rot.column2);
mVertices.pushBack(PxVec3(extentPoints[0].x, extentPoints[0].y, extentPoints[0].z)); // ---
mVertices.pushBack(PxVec3(extentPoints[4].x, extentPoints[4].y, extentPoints[4].z)); // --+
mVertices.pushBack(PxVec3(extentPoints[3].x, extentPoints[3].y, extentPoints[3].z)); // -+-
mVertices.pushBack(PxVec3(extentPoints[7].x, extentPoints[7].y, extentPoints[7].z)); // -++
mVertices.pushBack(PxVec3(extentPoints[1].x, extentPoints[1].y, extentPoints[1].z)); // +--
mVertices.pushBack(PxVec3(extentPoints[5].x, extentPoints[5].y, extentPoints[5].z)); // +-+
mVertices.pushBack(PxVec3(extentPoints[2].x, extentPoints[2].y, extentPoints[2].z)); // ++-
mVertices.pushBack(PxVec3(extentPoints[6].x, extentPoints[6].y, extentPoints[6].z)); // +++
// cube planes - 6 planes
PxPlane plane0(extentPoints[0], extentPoints[4], extentPoints[7]); // 0,1,3,2
mFacets.pushBack(PxPlane(plane0.n, plane0.d));
PxPlane plane1(extentPoints[2], extentPoints[6], extentPoints[5]); // 6,7,5,4
mFacets.pushBack(PxPlane(plane1.n, plane1.d));
PxPlane plane2(extentPoints[0], extentPoints[1], extentPoints[5]); // 0,4,5,1
mFacets.pushBack(PxPlane(plane2.n, plane2.d));
PxPlane plane3(extentPoints[7], extentPoints[6], extentPoints[2]); // 3,7,6,2
mFacets.pushBack(PxPlane(plane3.n, plane3.d));
PxPlane plane4(extentPoints[0], extentPoints[3], extentPoints[2]); // 0,2,6,4
mFacets.pushBack(PxPlane(plane4.n, plane4.d));
PxPlane plane5(extentPoints[4], extentPoints[5], extentPoints[6]); // 1,5,7,3
mFacets.pushBack(PxPlane(plane5.n, plane5.d));
// cube edges - 24 edges
mEdges.pushBack(HalfEdge(11, 0, 0));
mEdges.pushBack(HalfEdge(23, 1, 0));
mEdges.pushBack(HalfEdge(15, 3, 0));
mEdges.pushBack(HalfEdge(16, 2, 0));
mEdges.pushBack(HalfEdge(13, 6, 1));
mEdges.pushBack(HalfEdge(21, 7, 1));
mEdges.pushBack(HalfEdge(9, 5, 1));
mEdges.pushBack(HalfEdge(18, 4, 1));
mEdges.pushBack(HalfEdge(19, 0, 2));
mEdges.pushBack(HalfEdge(6, 4, 2));
mEdges.pushBack(HalfEdge(20, 5, 2));
mEdges.pushBack(HalfEdge(0, 1, 2));
mEdges.pushBack(HalfEdge(22, 3, 3));
mEdges.pushBack(HalfEdge(4, 7, 3));
mEdges.pushBack(HalfEdge(17, 6, 3));
mEdges.pushBack(HalfEdge(2, 2, 3));
mEdges.pushBack(HalfEdge(3, 0, 4));
mEdges.pushBack(HalfEdge(14, 2, 4));
mEdges.pushBack(HalfEdge(7, 6, 4));
mEdges.pushBack(HalfEdge(8, 4, 4));
mEdges.pushBack(HalfEdge(10, 1, 5));
mEdges.pushBack(HalfEdge(5, 5, 5));
mEdges.pushBack(HalfEdge(12, 7, 5));
mEdges.pushBack(HalfEdge(1, 3, 5));
}
//////////////////////////////////////////////////////////////////////////
// finds the candidate plane, returns -1 otherwise
PxI32 ConvexHull::findCandidatePlane(float planeTestEpsilon, float epsilon) const {
PxI32 p = -1;
float md = 0.0f;
PxU32 i, j;
for (i = 0; i < mInputPlanes.size(); i++) {
float d = 0.0f;
float dmax = 0.0f;
float dmin = 0.0f;
for (j = 0; j < mVertices.size(); j++) {
dmax = PxMax(dmax, mVertices[j].dot(mInputPlanes[i].n) + mInputPlanes[i].d);
dmin = PxMin(dmin, mVertices[j].dot(mInputPlanes[i].n) + mInputPlanes[i].d);
}
float dr = dmax - dmin;
if (dr < planeTestEpsilon)
dr = 1.0f; // shouldn't happen.
d = dmax / dr;
// we have a better candidate try another one
if (d <= md)
continue;
// check if we dont have already that plane or if the normals are nearly the same
for (j = 0; j < mFacets.size(); j++) {
if (mInputPlanes[i] == mFacets[j]) {
d = 0.0f;
continue;
}
if (mInputPlanes[i].n.dot(mFacets[j].n) > local::MAXDOT_MINANG) {
for (PxU32 k = 0; k < mEdges.size(); k++) {
if (mEdges[k].p != j)
continue;
if (mVertices[mEdges[k].v].dot(mInputPlanes[i].n) + mInputPlanes[i].d < 0) {
d = 0; // so this plane wont get selected.
break;
}
}
}
}
if (d > md) {
p = PxI32(i);
md = d;
}
}
return (md > epsilon) ? p : -1;
}
//////////////////////////////////////////////////////////////////////////
// internal hull check
bool ConvexHull::assertIntact(float epsilon) const {
PxU32 i;
PxU32 estart = 0;
for (i = 0; i < mEdges.size(); i++) {
if (mEdges[estart].p != mEdges[i].p) {
estart = i;
}
PxU32 inext = i + 1;
if (inext >= mEdges.size() || mEdges[inext].p != mEdges[i].p) {
inext = estart;
}
PX_ASSERT(mEdges[inext].p == mEdges[i].p);
PxI16 nb = mEdges[i].ea;
if (nb == 255 || nb == -1)
return false;
PX_ASSERT(nb != -1);
PX_ASSERT(i == PxU32(mEdges[PxU32(nb)].ea));
// Check that the vertex of the next edge is the vertex of the adjacent half edge.
// Otherwise the two half edges are not really adjacent and we have a hole.
PX_ASSERT(mEdges[PxU32(nb)].v == mEdges[inext].v);
if (!(mEdges[PxU32(nb)].v == mEdges[inext].v))
return false;
}
for (i = 0; i < mEdges.size(); i++) {
PX_ASSERT(local::eCOPLANAR == local::planeTest(mFacets[mEdges[i].p], mVertices[mEdges[i].v], epsilon));
if (local::eCOPLANAR != local::planeTest(mFacets[mEdges[i].p], mVertices[mEdges[i].v], epsilon))
return false;
if (mEdges[estart].p != mEdges[i].p) {
estart = i;
}
PxU32 i1 = i + 1;
if (i1 >= mEdges.size() || mEdges[i1].p != mEdges[i].p) {
i1 = estart;
}
PxU32 i2 = i1 + 1;
if (i2 >= mEdges.size() || mEdges[i2].p != mEdges[i].p) {
i2 = estart;
}
if (i == i2)
continue; // i sliced tangent to an edge and created 2 meaningless edges
// check the face normal against the triangle from edges
PxVec3 localNormal =
(mVertices[mEdges[i1].v] - mVertices[mEdges[i].v]).cross(mVertices[mEdges[i2].v] - mVertices[mEdges[i1].v]);
const float m = localNormal.magnitude();
if (m == 0.0f)
localNormal = PxVec3(1.f, 0.0f, 0.0f);
localNormal *= (1.0f / m);
if (localNormal.dot(mFacets[mEdges[i].p].n) <= 0.0f)
return false;
}
return true;
}
// returns the maximum number of vertices on a face
PxU32 ConvexHull::maxNumVertsPerFace() const {
PxU32 maxVerts = 0;
PxU32 currentVerts = 0;
PxU32 estart = 0;
for (PxU32 i = 0; i < mEdges.size(); i++) {
if (mEdges[estart].p != mEdges[i].p) {
if (currentVerts > maxVerts) {
maxVerts = currentVerts + 1;
}
currentVerts = 0;
estart = i;
} else {
currentVerts++;
}
}
return maxVerts;
}
//////////////////////////////////////////////////////////////////////////
// slice the input convexHull with the slice plane
ConvexHull *physx::convexHullCrop(const ConvexHull &convex, const PxPlane &slice, float planeTestEpsilon) {
static const PxU8 invalidIndex = PxU8(-1);
PxU32 i;
PxU32 vertCountUnder = 0; // Running count of the vertices UNDER the slicing plane.
PX_ASSERT(convex.getEdges().size() < 480);
// Arrays of mapping information associated with features in the input convex.
// edgeflag[i].undermap - output index of input edge convex->edges[i]
// vertflag[i].undermap - output index of input vertex convex->vertices[i]
// vertflag[i].planetest - the side-of-plane classification of convex->vertices[i]
// (There are other members but they are unused.)
local::EdgeFlag edgeFlag[512];
local::VertFlag vertFlag[256];
// Lists of output features. Populated during clipping.
// Coplanar edges have one sibling in tmpunderedges and one in coplanaredges.
// coplanaredges holds the sibling that belong to the new polygon created from slicing.
ConvexHull::HalfEdge tmpUnderEdges[512]; // The output edge list.
PxPlane tmpUnderPlanes[128]; // The output plane list.
local::Coplanar coplanarEdges[512]; // The coplanar edge list.
PxU32 coplanarEdgesNum = 0; // Running count of coplanar edges.
// Created vertices on the slicing plane (stored for output after clipping).
Ps::Array<PxVec3> createdVerts;
// Logical OR of individual vertex flags.
PxU32 convexClipFlags = 0;
// Classify each vertex against the slicing plane as OVER | COPLANAR | UNDER.
// OVER - Vertex is over (outside) the slicing plane. Will not be output.
// COPLANAR - Vertex is on the slicing plane. A copy will be output.
// UNDER - Vertex is under (inside) the slicing plane. Will be output.
// We keep an array of information structures for each vertex in the input convex.
// vertflag[i].undermap - The (computed) index of convex->vertices[i] in the output.
// invalidIndex for OVER vertices - they are not output.
// initially invalidIndex for COPLANAR vertices - set later.
// vertflag[i].overmap - Unused - we don't care about the over part.
// vertflag[i].planetest - The classification (clip flag) of convex->vertices[i].
for (i = 0; i < convex.getVertices().size(); i++) {
local::PlaneTestResult vertexClipFlag = local::planeTest(slice, convex.getVertices()[i], planeTestEpsilon);
switch (vertexClipFlag) {
case local::eOVER:
case local::eCOPLANAR:
vertFlag[i].undermap = invalidIndex; // Initially invalid for COPLANAR
vertFlag[i].overmap = invalidIndex;
break;
case local::eUNDER:
vertFlag[i].undermap = Ps::to8(vertCountUnder++);
vertFlag[i].overmap = invalidIndex;
break;
}
vertFlag[i].planetest = PxU8(vertexClipFlag);
convexClipFlags |= vertexClipFlag;
}
// Check special case: everything UNDER or COPLANAR.
// This way we know we wont end up with silly faces / edges later on.
if ((convexClipFlags & local::eOVER) == 0) {
// Just return a copy of the same convex.
ConvexHull *dst = PX_NEW_TEMP(ConvexHull)(convex);
return dst;
}
PxU16 underEdgeCount = 0; // Running count of output edges.
PxU16 underPlanesCount = 0; // Running count of output planes.
// Clipping Loop
// =============
//
// for each plane
//
// for each edge
//
// if first UNDER & second !UNDER
// output current edge -> tmpunderedges
// if we have done the sibling
// connect current edge to its sibling
// set vout = first vertex of sibling
// else if second is COPLANAR
// if we havent already copied it
// copy second -> createdverts
// set vout = index of created vertex
// else
// generate a new vertex -> createdverts
// set vout = index of created vertex
// if vin is already set and vin != vout (non-trivial edge)
// output coplanar edge -> tmpunderedges (one sibling)
// set coplanaredge to new edge index (for connecting the other sibling)
//
// else if first !UNDER & second UNDER
// if we have done the sibling
// connect current edge to its sibling
// set vin = second vertex of sibling (this is a bit of a pain)
// else if first is COPLANAR
// if we havent already copied it
// copy first -> createdverts
// set vin = index of created vertex
// else
// generate a new vertex -> createdverts
// set vin = index of created vertex
// if vout is already set and vin != vout (non-trivial edge)
// output coplanar edge -> tmpunderedges (one sibling)
// set coplanaredge to new edge index (for connecting the other sibling)
// output current edge -> tmpunderedges
//
// else if first UNDER & second UNDER
// output current edge -> tmpunderedges
//
// next edge
//
// if part of current plane was UNDER
// output current plane -> tmpunderplanes
//
// if coplanaredge is set
// output coplanar edge -> coplanaredges
//
// next plane
//
// Indexing is a bit tricky here:
//
// e0 - index of the current edge
// e1 - index of the next edge
// estart - index of the first edge in the current plane
// currentplane - index of the current plane
// enextface - first edge of next plane
PxU32 e0 = 0;
for (PxU32 currentplane = 0; currentplane < convex.getFacets().size(); currentplane++) {
PxU32 eStart = e0;
PxU32 eNextFace = 0xffffffff;
PxU32 e1 = e0 + 1;
PxU8 vout = invalidIndex;
PxU8 vin = invalidIndex;
PxU32 coplanarEdge = invalidIndex;
// Logical OR of individual vertex flags in the current plane.
PxU32 planeSide = 0;
do {
// Next edge modulo logic
if (e1 >= convex.getEdges().size() || convex.getEdges()[e1].p != currentplane) {
eNextFace = e1;
e1 = eStart;
}
const ConvexHull::HalfEdge &edge0 = convex.getEdges()[e0];
const ConvexHull::HalfEdge &edge1 = convex.getEdges()[e1];
const ConvexHull::HalfEdge &edgea = convex.getEdges()[PxU32(edge0.ea)];
planeSide |= vertFlag[edge0.v].planetest;
if (vertFlag[edge0.v].planetest == local::eUNDER && vertFlag[edge1.v].planetest != local::eUNDER) {
// first is UNDER, second is COPLANAR or OVER
// Output current edge.
edgeFlag[e0].undermap = short(underEdgeCount);
tmpUnderEdges[underEdgeCount].v = vertFlag[edge0.v].undermap;
tmpUnderEdges[underEdgeCount].p = PxU8(underPlanesCount);
PX_ASSERT(tmpUnderEdges[underEdgeCount].v != invalidIndex);
if (PxU32(edge0.ea) < e0) {
// We have already done the sibling.
// Connect current edge to its sibling.
PX_ASSERT(edgeFlag[edge0.ea].undermap != invalidIndex);
tmpUnderEdges[underEdgeCount].ea = edgeFlag[edge0.ea].undermap;
tmpUnderEdges[edgeFlag[edge0.ea].undermap].ea = short(underEdgeCount);
// Set vout = first vertex of (output, clipped) sibling.
vout = tmpUnderEdges[edgeFlag[edge0.ea].undermap].v;
} else if (vertFlag[edge1.v].planetest == local::eCOPLANAR) {
// Boundary case.
// We output coplanar vertices once.
if (vertFlag[edge1.v].undermap == invalidIndex) {
createdVerts.pushBack(convex.getVertices()[edge1.v]);
// Remember the index so we don't output it again.
vertFlag[edge1.v].undermap = Ps::to8(vertCountUnder++);
}
vout = vertFlag[edge1.v].undermap;
} else {
// Add new vertex.
const PxPlane &p0 = convex.getFacets()[edge0.p];
const PxPlane &pa = convex.getFacets()[edgea.p];
createdVerts.pushBack(threePlaneIntersection(p0, pa, slice));
vout = Ps::to8(vertCountUnder++);
}
// We added an edge, increment the counter
underEdgeCount++;
if (vin != invalidIndex && vin != vout) {
// We already have vin and a non-trivial edge
// Output coplanar edge
PX_ASSERT(vout != invalidIndex);
coplanarEdge = underEdgeCount;
tmpUnderEdges[underEdgeCount].v = vout;
tmpUnderEdges[underEdgeCount].p = PxU8(underPlanesCount);
tmpUnderEdges[underEdgeCount].ea = invalidIndex;
underEdgeCount++;
}
} else if (vertFlag[edge0.v].planetest != local::eUNDER && vertFlag[edge1.v].planetest == local::eUNDER) {
// First is OVER or COPLANAR, second is UNDER.
if (PxU32(edge0.ea) < e0) {
// We have already done the sibling.
// We need the second vertex of the sibling.
// Which is the vertex of the next edge in the adjacent poly.
int nea = edgeFlag[edge0.ea].undermap + 1;
int p = tmpUnderEdges[edgeFlag[edge0.ea].undermap].p;
if (nea >= underEdgeCount || tmpUnderEdges[nea].p != p) {
// End of polygon, next edge is first edge
nea -= 2;
while (nea > 0 && tmpUnderEdges[nea - 1].p == p)
nea--;
}
vin = tmpUnderEdges[nea].v;
PX_ASSERT(vin < vertCountUnder);
} else if (vertFlag[edge0.v].planetest == local::eCOPLANAR) {
// Boundary case.
// We output coplanar vertices once.
if (vertFlag[edge0.v].undermap == invalidIndex) {
createdVerts.pushBack(convex.getVertices()[edge0.v]);
// Remember the index so we don't output it again.
vertFlag[edge0.v].undermap = Ps::to8(vertCountUnder++);
}
vin = vertFlag[edge0.v].undermap;
} else {
// Add new vertex.
const PxPlane &p0 = convex.getFacets()[edge0.p];
const PxPlane &pa = convex.getFacets()[edgea.p];
createdVerts.pushBack(threePlaneIntersection(p0, pa, slice));
vin = Ps::to8(vertCountUnder++);
}
if (vout != invalidIndex && vin != vout) {
// We have been in and out, Add the coplanar edge
coplanarEdge = underEdgeCount;
tmpUnderEdges[underEdgeCount].v = vout;
tmpUnderEdges[underEdgeCount].p = Ps::to8(underPlanesCount);
tmpUnderEdges[underEdgeCount].ea = invalidIndex;
underEdgeCount++;
}
// Output current edge.
tmpUnderEdges[underEdgeCount].v = vin;
tmpUnderEdges[underEdgeCount].p = Ps::to8(underPlanesCount);
edgeFlag[e0].undermap = short(underEdgeCount);
if (PxU32(edge0.ea) < e0) {
// We have already done the sibling.
// Connect current edge to its sibling.
PX_ASSERT(edgeFlag[edge0.ea].undermap != invalidIndex);
tmpUnderEdges[underEdgeCount].ea = edgeFlag[edge0.ea].undermap;
tmpUnderEdges[edgeFlag[edge0.ea].undermap].ea = short(underEdgeCount);
}
PX_ASSERT(edgeFlag[e0].undermap == underEdgeCount);
underEdgeCount++;
} else if (vertFlag[edge0.v].planetest == local::eUNDER && vertFlag[edge1.v].planetest == local::eUNDER) {
// Both UNDER
// Output current edge.
edgeFlag[e0].undermap = short(underEdgeCount);
tmpUnderEdges[underEdgeCount].v = vertFlag[edge0.v].undermap;
tmpUnderEdges[underEdgeCount].p = Ps::to8(underPlanesCount);
if (PxU32(edge0.ea) < e0) {
// We have already done the sibling.
// Connect current edge to its sibling.
PX_ASSERT(edgeFlag[edge0.ea].undermap != invalidIndex);
tmpUnderEdges[underEdgeCount].ea = edgeFlag[edge0.ea].undermap;
tmpUnderEdges[edgeFlag[edge0.ea].undermap].ea = short(underEdgeCount);
}
underEdgeCount++;
}
e0 = e1;
e1++; // do the modulo at the beginning of the loop
} while (e0 != eStart);
e0 = eNextFace;
if (planeSide & local::eUNDER) {
// At least part of current plane is UNDER.
// Output current plane.
tmpUnderPlanes[underPlanesCount] = convex.getFacets()[currentplane];
underPlanesCount++;
}
if (coplanarEdge != invalidIndex) {
// We have a coplanar edge.
// Add to coplanaredges for later processing.
// (One sibling is in place but one is missing)
PX_ASSERT(vin != invalidIndex);
PX_ASSERT(vout != invalidIndex);
PX_ASSERT(coplanarEdge != 511);
coplanarEdges[coplanarEdgesNum].ea = PxU8(coplanarEdge);
coplanarEdges[coplanarEdgesNum].v0 = vin;
coplanarEdges[coplanarEdgesNum].v1 = vout;
coplanarEdgesNum++;
}
// Reset coplanar edge infos for next poly
vin = invalidIndex;
vout = invalidIndex;
coplanarEdge = invalidIndex;
}
// Add the new plane to the mix:
if (coplanarEdgesNum > 0) {
tmpUnderPlanes[underPlanesCount++] = slice;
}
// Sort the coplanar edges in winding order.
for (i = 0; i < coplanarEdgesNum - 1; i++) {
if (coplanarEdges[i].v1 != coplanarEdges[i + 1].v0) {
PxU32 j = 0;
for (j = i + 2; j < coplanarEdgesNum; j++) {
if (coplanarEdges[i].v1 == coplanarEdges[j].v0) {
local::Coplanar tmp = coplanarEdges[i + 1];
coplanarEdges[i + 1] = coplanarEdges[j];
coplanarEdges[j] = tmp;
break;
}
}
if (j >= coplanarEdgesNum) {
// PX_ASSERT(j<coplanaredges_num);
return NULL;
}
}
}
// PT: added this line to fix DE2904
if (!vertCountUnder)
return NULL;
// Create the output convex.
ConvexHull *punder = PX_NEW_TEMP(ConvexHull)(convex.getInputPlanes());
ConvexHull &under = *punder;
// Copy UNDER vertices
PxU32 k = 0;
for (i = 0; i < convex.getVertices().size(); i++) {
if (vertFlag[i].planetest == local::eUNDER) {
under.getVertices().pushBack(convex.getVertices()[i]);
k++;
}
}
// Copy created vertices
i = 0;
while (k < vertCountUnder) {
under.getVertices().pushBack(createdVerts[i++]);
k++;
}
PX_ASSERT(i == createdVerts.size());
// Copy the output edges and output planes.
under.getEdges().resize(underEdgeCount + coplanarEdgesNum);
under.getFacets().resize(underPlanesCount);
// Add the coplanar edge siblings that belong to the new polygon (coplanaredges).
for (i = 0; i < coplanarEdgesNum; i++) {
under.getEdges()[underEdgeCount + i].p = PxU8(underPlanesCount - 1);
under.getEdges()[underEdgeCount + i].ea = short(coplanarEdges[i].ea);
tmpUnderEdges[coplanarEdges[i].ea].ea = PxI16(underEdgeCount + i);
under.getEdges()[underEdgeCount + i].v = coplanarEdges[i].v0;
}
PxMemCopy(under.getEdges().begin(), tmpUnderEdges, sizeof(ConvexHull::HalfEdge) * underEdgeCount);
PxMemCopy(under.getFacets().begin(), tmpUnderPlanes, sizeof(PxPlane) * underPlanesCount);
return punder;
}
bool physx::computeOBBFromConvex(const PxConvexMeshDesc &desc, PxVec3 &sides, PxTransform &matrix) {
PxIntegrals integrals;
// using the centroid of the convex for the volume integration solved accuracy issues in cases where the inertia
// tensor ended up close to not being positive definite and after a few further transforms the diagonalized inertia
// tensor ended up with negative values.
const PxVec3 *verts = (reinterpret_cast<const PxVec3 *>(desc.points.data));
const PxU32 *ind = (reinterpret_cast<const PxU32 *>(desc.indices.data));
const PxHullPolygon *polygons = (reinterpret_cast<const PxHullPolygon *>(desc.polygons.data));
PxVec3 mean(0.0f);
for (PxU32 i = 0; i < desc.points.count; i++)
mean += verts[i];
mean *= (1.0f / desc.points.count);
PxU8 *indices = reinterpret_cast<PxU8 *>(PX_ALLOC_TEMP(sizeof(PxU8) * desc.indices.count, "PxU8"));
for (PxU32 i = 0; i < desc.indices.count; i++) {
indices[i] = Ps::to8(ind[i]);
}
// we need to move the polygon data to internal format
Gu::HullPolygonData *polygonData = reinterpret_cast<Gu::HullPolygonData *>(
PX_ALLOC_TEMP(sizeof(Gu::HullPolygonData) * desc.polygons.count, "Gu::HullPolygonData"));
for (PxU32 i = 0; i < desc.polygons.count; i++) {
polygonData[i].mPlane =
PxPlane(polygons[i].mPlane[0], polygons[i].mPlane[1], polygons[i].mPlane[2], polygons[i].mPlane[3]);
polygonData[i].mNbVerts = Ps::to8(polygons[i].mNbVerts);
polygonData[i].mVRef8 = polygons[i].mIndexBase;
}
PxConvexMeshDesc inDesc;
inDesc.points.data = desc.points.data;
inDesc.points.count = desc.points.count;
inDesc.polygons.data = polygonData;
inDesc.polygons.count = desc.polygons.count;
inDesc.indices.data = indices;
inDesc.indices.count = desc.indices.count;
// compute volume integrals to get basis axis
bool status = (desc.flags & PxConvexFlag::eFAST_INERTIA_COMPUTATION)
? computeVolumeIntegralsEberlySIMD(inDesc, 1.0f, integrals, mean)
: computeVolumeIntegralsEberly(inDesc, 1.0f, integrals, mean);
if (status) {
Vec4V *pointsV = reinterpret_cast<Vec4V *>(PX_ALLOC_TEMP(sizeof(Vec4V) * desc.points.count, "Vec4V"));
for (PxU32 i = 0; i < desc.points.count; i++) {
// safe to V4 load, same as volume integration - we allocate one more vector
pointsV[i] = V4LoadU(&verts[i].x);
}
PxMat33 inertia;
integrals.getOriginInertia(inertia);
PxQuat inertiaQuat;
PxDiagonalize(inertia, inertiaQuat);
PxMat33 baseAxis(inertiaQuat);
Vec4V center = V4LoadU(&integrals.COM.x);
const PxU32 numSteps = 20;
const float subStep = Ps::degToRad(float(360 / numSteps));
float bestVolume = FLT_MAX;
for (PxU32 axis = 0; axis < 3; axis++) {
for (PxU32 iStep = 0; iStep < numSteps; iStep++) {
PxQuat quat(iStep * subStep, baseAxis[axis]);
Vec4V transV = center;
Vec4V psidesV;
const QuatV rotV = QuatVLoadU(&quat.x);
local::computeOBBSIMD(desc.points.count, pointsV, psidesV, rotV, transV);
PxVec3 psides;
V3StoreU(Vec3V_From_Vec4V(psidesV), psides);
const float volume = psides[0] * psides[1] * psides[2]; // the volume of the cube
if (volume <= bestVolume) {
bestVolume = volume;
sides = psides;
V4StoreU(rotV, &matrix.q.x);
V3StoreU(Vec3V_From_Vec4V(transV), matrix.p);
}
}
}
PX_FREE_AND_RESET(pointsV);
} else {
PX_FREE_AND_RESET(indices);
PX_FREE_AND_RESET(polygonData);
return false;
}
PX_FREE_AND_RESET(indices);
PX_FREE_AND_RESET(polygonData);
return true;
}
|
; A186349: Adjusted joint rank sequence of (f(i)) and (g(j)) with f(i) after g(j) when f(i)=g(j), where f(i)=8i and g(j)=j^2. Complement of A186348.
; 1,2,4,5,8,10,13,15,19,22,26,29,34,38,43,47,53,58,64,69,76,82,89,95,103,110,118,125,134,142,151,159,169,178,188,197,208,218,229,239,251,262,274,285,298,310,323,335,349,362,376,389,404,418,433,447,463,478,494,509,526,542,559,575,593,610,628,645,664,682,701,719,739,758,778,797,818,838,859,879,901,922,944,965,988,1010
mov $1,2
add $1,$0
add $0,8
mul $1,$0
div $1,8
sub $1,1
|
; auto-generated by gen-masm.sh
.386
.MODEL FLAT
.CODE
DCThunk_size = 16
DCArgs_size = 20
DCValue_size = 8
CTX_thunk = 0
CTX_phandler = 16
CTX_pargsvt = 20
CTX_stack_cleanup = 24
CTX_userdata = 28
frame_arg0 = 8
frame_ret = 4
frame_parent = 0
frame_CTX = -4
frame_DCArgs = -24
frame_DCValue = -32
_dcCallbackThunkEntry PROC
OPTION PROLOGUE:NONE, EPILOGUE:NONE
push EBP
mov EBP,ESP
push EAX
push 0
push EDX
push ECX
lea ECX,dword ptr [EBP+frame_arg0]
push ECX
push dword ptr [EAX+CTX_pargsvt]
mov ECX,ESP
push 0
push 0
mov EDX,ESP
and ESP,-16
push dword ptr [EAX+CTX_userdata]
push EDX
push ECX
push EAX
call dword ptr [EAX+CTX_phandler]
mov ESP,EBP
pop ECX
pop ECX
mov EDX,dword ptr [EBP+frame_CTX]
add ESP,dword ptr [EDX+CTX_stack_cleanup]
push ECX
lea EDX,dword ptr [EBP+frame_DCValue]
mov EBP,dword ptr [EBP+0]
cmp AL,102
je return_f32
cmp AL,100
je return_f64
return_i64:
mov EAX,dword ptr [EDX+0]
mov EDX,dword ptr [EDX+4]
ret
return_f32:
fld dword ptr [EDX+0]
ret
return_f64:
fld qword ptr [EDX+0]
return_void:
ret
_dcCallbackThunkEntry ENDP
END
|
main:
li %r5, 0xA
.loop:
subi %r5, %r5, 0x5
cmpi %r5, 0x0
bne .loop
li %r5, 0xFFFF
rtn
|
; A153973: a(n) = 3*a(n-1) - 2*a(n-2), with a(1) = 9, a(2) = 12.
; 9,12,18,30,54,102,198,390,774,1542,3078,6150,12294,24582,49158,98310,196614,393222,786438,1572870,3145734,6291462,12582918,25165830,50331654,100663302,201326598,402653190,805306374,1610612742,3221225478,6442450950,12884901894,25769803782,51539607558,103079215110,206158430214,412316860422,824633720838,1649267441670,3298534883334,6597069766662,13194139533318,26388279066630,52776558133254,105553116266502,211106232532998,422212465065990,844424930131974,1688849860263942,3377699720527878
mov $1,2
pow $1,$0
add $1,2
mul $1,3
mov $0,$1
|
; Rectangle, Intervals and Points
; 05.2006 aralbrec
SECTION code_clib
PUBLIC r_IntersectRect16
PUBLIC _r_IntersectRect16
EXTERN RIntersectRect16
; int r_IntersectRect16(struct r_Rect16 *r1, struct r_Rect16 *r2, struct r_Rect16 *result)
.r_IntersectRect16
._r_IntersectRect16
ld hl,7
add hl,sp
ld d,(hl)
dec hl
ld e,(hl)
dec hl
push de
ld d,(hl)
dec hl
ld e,(hl)
dec hl
ld b,(hl)
dec hl
ld c,(hl)
ld ixl,c
ld ixh,b
ex de,hl
ld c,(hl)
inc hl
ld b,(hl)
inc hl
ld e,(hl)
inc hl
ld d,(hl)
inc hl
ex (sp),hl
ld a,(hl)
inc hl
push hl
ld h,(hl)
ld l,a
; stack = r2.y, r1.width-1
exx
pop hl
inc hl
pop de
ld a,(hl)
inc hl
ex af,af
ld a,(hl)
inc hl
ld c,(hl)
inc hl
ld b,(hl)
inc hl
push bc
ld c,(hl)
inc hl
ld b,(hl)
push bc
ex de,hl
ld e,(hl)
inc hl
ld d,(hl)
inc hl
push de
ld e,(hl)
inc hl
ld d,(hl)
push de
ld d,a
ex af,af
ld e,a
exx
call RIntersectRect16
ld hl,0
ret nc
inc l
ret
|
; A194817: Number of integers k in [1,n] such that {n*r+k*r} < {n*r-k*r}, where { } = fractional part and r=sqrt(3).
; 0,1,1,2,3,4,4,4,5,5,5,5,6,6,7,8,9,9,10,11,12,12,12,13,13,13,13,14,14,15,16,17,17,18,19,19,19,19,20,20,20,20,21,21,22,23,24,24,25,26,26,26,26,27,27,28,29,30,30,31,32,33,33,33,34,34,34,34,35,35,36,37
mov $2,$0
mov $4,$0
lpb $2
mov $0,$4
sub $2,1
sub $0,$2
mov $3,$0
lpb $0
sub $3,1
add $0,$3
seq $0,188082 ; [nr+kr]-[nr]-[kr], where r=sqrt(3), k=1, [ ]=floor.
add $3,$0
lpe
add $1,$0
lpe
mov $0,$1
|
; A047489: Numbers that are congruent to {1, 2, 3, 5, 7} mod 8.
; 1,2,3,5,7,9,10,11,13,15,17,18,19,21,23,25,26,27,29,31,33,34,35,37,39,41,42,43,45,47,49,50,51,53,55,57,58,59,61,63,65,66,67,69,71,73,74,75,77,79,81,82,83,85,87,89,90,91,93,95,97,98,99,101,103,105,106,107,109,111,113,114,115,117,119,121,122,123,125,127,129,130,131,133,135,137,138,139,141,143,145,146,147,149,151,153,154,155,157,159,161,162,163,165,167,169,170,171,173,175,177,178,179,181,183,185,186,187,189,191,193,194,195,197,199,201,202,203,205,207,209,210,211,213,215,217,218,219,221,223,225,226,227,229,231,233,234,235,237,239,241,242,243,245,247,249,250,251,253,255,257,258,259,261,263,265,266,267,269,271,273,274,275,277,279,281,282,283,285,287,289,290,291,293,295,297,298,299,301,303,305,306,307,309,311,313,314,315,317,319,321,322,323,325,327,329,330,331,333,335,337,338,339,341,343,345,346,347,349,351,353,354,355,357,359,361,362,363,365,367,369,370,371,373,375,377,378,379,381,383,385,386,387,389,391,393,394,395,397,399
mov $2,$0
add $2,5
lpb $0,1
sub $0,1
add $1,2
trn $2,5
trn $1,$2
lpe
add $1,1
|
COMMENT @----------------------------------------------------------------------
Copyright (c) GeoWorks 1990 -- All Rights Reserved
PROJECT: PC GEOS
MODULE: CommonUI/CMain
FILE: cmainDocumentRM.asm
ROUTINES:
Name Description
---- -----------
GLB OLDocument Open look document class
REVISION HISTORY:
Name Date Description
---- ---- -----------
chris 9/ 9/93 Made Redwood specific
DESCRIPTION:
$Id: cmainDocumentRedwood.asm,v 1.1 97/04/07 10:52:01 newdeal Exp $
------------------------------------------------------------------------------@
DocSaveAsClose segment resource
COMMENT @----------------------------------------------------------------------
ROUTINE: DocCheckIfOnRamdisk
SYNOPSIS: Checks to see if document is currently being saved to the
RAMDisk.
CALLED BY: FAR
PASS: *ds:si -- document
RETURN: zero flag set if current doc path is SP_TOP (i.e. the ramdisk)
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Chris 7/29/93 Initial version
------------------------------------------------------------------------------@
if UNTITLED_DOCS_ON_SP_TOP
DocCheckIfOnRamdisk proc far uses ax, bx, cx, dx, di, si, es
.enter
mov ax, ATTR_GEN_PATH_DATA
call ObjVarFindData ;ds:bx = GenFilePath
mov cx, ds:[bx].GFP_disk
lea si, ds:[bx].GFP_path ;ds:si = path string
mov dx, SP_TOP ;see if on RAM disk
mov di, offset noPath
segmov es, cs
call FileComparePaths
CheckHack <(PCT_EQUAL eq 0)>
tst al
.leave
ret
DocCheckIfOnRamdisk endp
noPath byte 0
endif
COMMENT @----------------------------------------------------------------------
METHOD: OLDocumentQuerySaveDocuments --
MSG_META_QUERY_SAVE_DOCUMENTS for OLDocumentClass
DESCRIPTION: Queries to save documents for an app switch.
PASS: *ds:si - instance data
es - segment of MetaClass
ax - MSG_META_QUERY_SAVE_DOCUMENTS
RETURN: nothing
ax, cx, dx, bp - destroyed
ALLOWED TO DESTROY:
bx, si, di, ds, es
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
chris 8/26/93 Initial Version
------------------------------------------------------------------------------@
if VOLATILE_SYSTEM_STATE
OLDocumentQuerySaveDocuments method dynamic OLDocumentClass, \
MSG_META_QUERY_SAVE_DOCUMENTS
;
; Grab the model exclusive. Doing this means we have to clean things
; up when we return to the application, so the document with the
; target gets the model again. See OLApplicationGainedFullScreenExcl.
; cbh 8/30/93
;
; mov di, ds:[si] ;no view yet, skip (10/3/93)
; add di, ds:[di].Gen_offset ; (doesn't seem to be needed
; cmp {word} ds:[di].GCI_genView, 0 ; now. 10/11/93 cbh)
; jz doNothing
call MetaGrabModelExclLow
clr bp ;not IACP, at least pretend
; not...
clr ax ;al non-zero: query-save
inc ax ;ah zero: not autosave
call SaveAndMaybeClose
ret
doNothing:
mov ax, MSG_OLDG_DOC_MARKED_CLEAN
call GenCallParent
ret
OLDocumentQuerySaveDocuments endm
endif
COMMENT @----------------------------------------------------------------------
METHOD: OLDocumentWaitForQuery --
MSG_OL_DOCUMENT_WAIT_FOR_QUERY for OLDocumentClass
DESCRIPTION: Sets OLDA_WAITING_FOR_SAVE_QUERY
PASS: *ds:si - instance data
es - segment of MetaClass
ax - MSG_OL_DOCUMENT_WAIT_FOR_QUERY
RETURN:
ax, cx, dx, bp - destroyed
ALLOWED TO DESTROY:
bx, si, di, ds, es
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
chris 8/27/93 Initial Version
------------------------------------------------------------------------------@
if VOLATILE_SYSTEM_STATE
OLDocumentWaitForQuery method dynamic OLDocumentClass, \
MSG_OL_DOCUMENT_WAIT_FOR_QUERY
ornf ds:[di].OLDI_attrs, mask OLDA_WAITING_FOR_SAVE_QUERY
ret
OLDocumentWaitForQuery endm
endif
COMMENT @----------------------------------------------------------------------
METHOD: OLDocumentQueryIfWaiting --
MSG_OL_DOCUMENT_QUERY_IF_WAITING for OLDocumentClass
DESCRIPTION: If we're waiting for a query, we'll query ourselves, and
return the carry set.
PASS: *ds:si - instance data
es - segment of MetaClass
ax - MSG_OL_DOCUMENT_QUERY_IF_WAITING
RETURN: carry set if we did a query
ax, cx, dx, bp - destroyed
ALLOWED TO DESTROY:
bx, si, di, ds, es
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
chris 8/27/93 Initial Version
------------------------------------------------------------------------------@
if VOLATILE_SYSTEM_STATE
OLDocumentQueryIfWaiting method dynamic OLDocumentClass, \
MSG_OL_DOCUMENT_QUERY_IF_WAITING
test ds:[di].OLDI_attrs, mask OLDA_WAITING_FOR_SAVE_QUERY
jz exit ;not waiting, exit (c=0)
and ds:[di].OLDI_attrs, not mask OLDA_WAITING_FOR_SAVE_QUERY
mov ax, MSG_META_QUERY_SAVE_DOCUMENTS
call ObjCallInstanceNoLock
stc
exit:
ret
OLDocumentQueryIfWaiting endm
endif
COMMENT @----------------------------------------------------------------------
METHOD: OLDocumentClose -- MSG_GEN_DOCUMENT_CLOSE for
OLDocumentClass
DESCRIPTION: Do what appears to the user to be "closing the document". This
involves asking for confirmation and possibly canceling or
transforming to a save as.
PASS:
*ds:si - instance data
es - segment of OLDocumentClass
ax - The message
bp - IACPConnection performing the close (0 = user)
RETURN:
cx - DocQuitStatus (DQS_OK, DQS_DELAYED, DQS_CANCEL, DQS_SAVE_ERROR)
DESTROYED:
bx, si, di, ds, es
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 1/90 Initial version
------------------------------------------------------------------------------@
if VOLATILE_SYSTEM_STATE
OLDocumentClose method dynamic OLDocumentClass, MSG_GEN_DOCUMENT_CLOSE
EC < call GenCheckGenAssumption >
mov di, ds:[si]
add di, ds:[di].Gen_offset
mov ax, ds:[di].GDI_attrs
test ax, mask GDA_CLOSING
jz notClosing
exit:
mov cx, DQS_CANCEL
Destroy ax, dx, bp
ret
notClosing:
clr ax ;do normal close
call SaveAndMaybeClose
ret
OLDocumentClose endm
endif
COMMENT @----------------------------------------------------------------------
ROUTINE: SaveAndMaybeClose
SYNOPSIS: Saves the document, then closes if desired.
CALLED BY: OLDocumentClose, OLDocumentQuerySave
PASS: *ds:si -- OLDocumentClass
al -- zero if we're supposed to always close (original
function of this code). Non-zero if we're just saving
or deleting, as we switch apps in Redwood
ah -- non-zero if doing autosave
bp -- IACP connection (0 if user)
RETURN: cx - DocQuitStatus
(DQS_OK, DQS_DELAYED, DQS_CANCEL, DQS_SAVE_ERROR)
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
if always closing (al = 0, ah = 0)
put up message whether user should save the file;
if yes
save the file
close the file
elseif switching apps in redwood (al = 1, ah = 0)
if previously saved file (not on ramdisk)
resave
else
put up message whether user should save or delete file
if yes
save the file
else
delete the file
elseif autosaving in Redwood (al = 1, ah = 1)
put up message whether user should save or close file
if yes
save the file
else
close the file
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Chris 6/23/93 Initial version
------------------------------------------------------------------------------@
if VOLATILE_SYSTEM_STATE
SaveAndMaybeClose proc far
tst bp
LONG jnz iacpClose
doClose:
push bp
push ax
mov bx, ax ;we'll keep the flag in bx for awhile
mov ax, GDO_CLOSE
call OLDocSetOperation
; check for dirty
call OLDocumentGetAttrs
tst bx ;don't set close bit if not closing
; 7/26/93 cbh
jnz doneWithCloseBit
ornf ax, mask GDA_CLOSING
doneWithCloseBit:
mov ds:[di].GDI_attrs, ax
test ax, mask GDA_DIRTY
LONG jz cleanOnEntry
; --- the file is dirty (has been modified)
; if transparent mode then always save changes
push es, ax
segmov es, dgroup, ax ;es = dgroup
test es:[docControlOptions], mask DCO_TRANSPARENT_DOC
pop es, ax
jz testIACP
; if confirm save mode, bring up dialog
push es, ax
segmov es, dgroup, ax
test es:[docControlOptions], mask DCO_USER_CONFIRM_SAVE
pop es, ax
jz saveChanges
jmp clean
testIACP:
; if IACP close, same as transparent mode
tst bp
jnz saveChanges
; if "save" has failed before then don't ask, just try to save changes
test ax, mask GDA_SAVE_FAILED
jnz saveChanges
push ax
call GetUIParentAttrs
test ax, mask GDCA_DO_NOT_SAVE_FILES
pop ax
LONG jnz revertClose
mov_tr cx, ax
mov ax, SDBT_FILE_CLOSE_ATTACH_DIRTY
test cx, mask GDA_ATTACH_TO_DIRTY_FILE
jnz normalDirty
mov ax, SDBT_FILE_CLOSE_SAVE_CHANGES_UNTITLED
test cx, mask GDA_UNTITLED
jnz checkRedwoodFlags
mov ax, SDBT_FILE_CLOSE_SAVE_CHANGES_TITLED
checkRedwoodFlags:
tst bl ;see if doing app switch here
; (no close) 6/23/93 cbh
jz normalDirty ;not doing app switch...
add ax, SDBT_QUERY_SAVE_ON_APP_SWITCH_UNTITLED - \
SDBT_FILE_CLOSE_SAVE_CHANGES_UNTITLED
;if AUTOSAVE_BASED_ON_DIRTY_BLOCKS
if 0 ;not needed anymore
tst bh
jz normalDirty
add ax, SDBT_QUERY_AUTOSAVE_UNTITLED - \
SDBT_QUERY_SAVE_ON_APP_SWITCH_UNTITLED
endif
normalDirty:
call FarCallStandardDialogDS_SI
cmp ax, IC_NULL ;null -> abort
LONG jz cancel
cmp ax, IC_DISMISS ;cancel -> abort
LONG jz cancel
cmp ax, IC_NO ;no -> revert
LONG jz revertClose
EC < cmp ax, IC_YES >
EC < ERROR_NE OL_ERROR >
; check for temporary file, if so then do a "save as"
saveChanges:
;
; We're changing the check here to do a save-as if the document is
; currently on the RAM drive. This catches geodex style documents
; being initially opened on the RAM drive, but aren't technically
; untitled. For Redwood 7/30/93.
;
if UNTITLED_DOCS_ON_SP_TOP
call DocCheckIfOnRamdisk
LONG jz temporary
else
test ds:[di].GDI_attrs, mask GDA_UNTITLED
LONG jnz temporary
endif
test ds:[di].GDI_attrs, mask GDA_READ_ONLY
LONG jnz readOnly
reallySaveChanges:
; save the changes...
call IsFileDirty
jnc retrySave
mov cx, TRUE ; about to save, not update
mov ax, MSG_GEN_DOCUMENT_WRITE_CACHED_DATA_TO_FILE
call ObjCallInstanceNoLock
retrySave:
mov ax, MSG_GEN_DOCUMENT_PHYSICAL_SAVE
call ObjCallInstanceNoLock ;returns error in carry
jnc clean
call ConvertErrorCode
cmp ax, ERROR_SHORT_READ_WRITE
jz diskFull
handleOtherError:
mov cx, offset CallStandardDialogDS_SI
call HandleSaveError
jnc retrySave
mov cx, DQS_SAVE_ERROR
jmp cancelWithCode
diskFull:
pop bp
push bp
tst bp
jnz handleOtherError
;
; mark save-failed, so that if user decides to move document to
; another directory, the old (unsaved) one will be deleted
; - brianc 7/14/93
;
mov ax, mask GDA_SAVE_FAILED ;mark that save failed
clr bx
call OLDocSetAttrs
pop ax
pop bp
mov ax, MSG_OL_DOCUMENT_CONTINUE_CLOSE_AFTER_DISK_FULL
call OLDocumentShowLowDiskError
mov ax, DQS_DELAYED
jmp exit
; actually close the file
cleanOnEntry:
if UNTITLED_DOCS_ON_SP_TOP
;
; Our document was clean on entry. If we're on a Ramdisk, we're
; probably a new, undirtied document (i.e. nothing is in it), or
; I'm a hoser. Let's delete the thing.
;
call DocCheckIfOnRamdisk ;not on ramdisk, branch
jnz clean
pop ax
clr al ;else ensure it's closed
push ax
endif
clean:
; If we got here, lets assume somehow we've marked the document
; clean. This should catch the non-standard save cases that I've
; missed. 7/26/93 cbh (Doesn't actually seem to mark the document
; clean, apparently because it was closing anyway in the old version.
; I'll do so here. 7/27/93 cbh)
call markCleanTellDocGroupReallyQueued
mov ax, MSG_OLDC_TEST_FOR_DISPLAY_MAIN_DIALOG
call SendToDocumentControl
closeCommon:
mov cx, DQS_OK
done:
pop ax
pop bp
tst ax ;not supposed to close, branch
jnz afterClose
call OLDocumentSendCloseAck
afterClose:
call OLDocClearOperation
exit:
Destroy ax, dx, bp
ret
; close without saving changes
revertClose:
;
; For switch-apps mode only (al != 0):
; If an untitled document, we'll delete it and close. If a titled
; document, we`ll revert it and not close. Set ax appropriately for
; this. (cbh 12/16/93)
;
if UNTITLED_DOCS_ON_SP_TOP
call DocCheckIfOnRamdisk ;not on ramdisk, branch
jnz doRevert
else
mov di, ds:[si]
add di, ds:[di].Gen_offset
test ds:[di].GDI_attrs, mask GDA_UNTITLED
jz doRevert
endif
pop ax
clr al ;else ensure it's closed
push ax
doRevert:
;
; Tell OLDocumentRemoveConnection to revert before it closes the
; file.
;
pop ax
tst ax ;not closing file? revert only
jnz revertNoClose
mov di, ds:[si]
add di, ds:[di].Vis_offset
ornf ds:[di].OLDI_attrs, mask OLDA_REVERT_BEFORE_CLOSE
mov cx, DQS_OK
pop bp
call OLDocumentSendCloseAck
call markCleanTellDocGroupQueued ;moved here 5/ 8/94
jmp afterClose
revertNoClose:
pop bp
;
; Experiment with marking busy
;
mov ax, MSG_GEN_APPLICATION_MARK_APP_COMPLETELY_BUSY
call UserCallApplication
mov ax, MSG_GEN_DOCUMENT_REVERT_NO_PROMPT
call ObjCallInstanceNoLock
mov ax, MSG_GEN_APPLICATION_MARK_APP_NOT_COMPLETELY_BUSY
call UserSendToApplicationViaProcess
;
; For Redwood, we could mark clean and notify the doc group here,
; but it will be better to do it at the end of the true revert.
; 5/ 8/94 cbh
;
jmp afterClose
; user said CANCEL
cancel:
mov cx, DQS_CANCEL
cancelWithCode:
;
; Cancelling, make sure any query-result message is cleaned out of
; the system, so that the result message isn't called later on
; for some other reason. 3/30/94 cbh
;
push cx, dx, bp
clr cx
mov ax, MSG_META_QUERY_SAVE_DOCUMENTS
call GenCallParent ;sending to app control is
; sufficient to clear out
; return message
pop cx, dx, bp
clr ax ;bits to set
mov bx, mask GDA_CLOSING ;bits to clear
call OLDocSetAttrs
jmp done
; closing a read-only or public file -- if transparent mode then
; discard changes
readOnly:
call GetDocOptions
test ax, mask DCO_TRANSPARENT_DOC
jnz revertClose
; closing a temporary file -- do a save as
temporary:
tst bp
jnz temporaryIACP
mov ax, MSG_GEN_DOCUMENT_CONTROL_INITIATE_SAVE_DOC
call SendToDocumentControl
mov cx, DQS_DELAYED
jmp done
temporaryIACP:
; read-only dirty file closed through IACP gets put in untitled...I
; think (dirty untitled gets saved to itself)
test ds:[di].GDI_attrs, mask GDA_UNTITLED
LONG jnz reallySaveChanges
mov ax, MSG_GEN_DOCUMENT_PHYSICAL_COPY_TEMPLATE
call ObjCallInstanceNoLock
jmp clean
iacpClose:
mov di, ds:[si]
add di, ds:[di].Vis_offset
test ds:[di].OLDI_attrs, mask OLDA_USER_OPENED
jnz closeCommon ; assume user will deal with any
; problems
push si
mov si, ds:[di].OLDI_iacpEngConnects
call ChunkArrayGetCount
pop si
cmp cx, 1
LONG jne closeCommon ; won't actually be closed yet, so
; do nothing
jmp doClose
;------------------------------------------------------------
markCleanTellDocGroupQueued:
clr ax ;set clean
mov bx, mask GDA_DIRTY
call OLDocSetAttrs
push si
mov ax, MSG_OLDG_DOC_MARKED_CLEAN
call GenFindParent
mov di, mask MF_FORCE_QUEUE ;queue it, get doc deleted 1st
call ObjMessage ; (cbh 11/12/93)
pop si
retn
;------------------------------------------------------------
markCleanTellDocGroupReallyQueued:
clr ax ;set clean
mov bx, mask GDA_DIRTY
call OLDocSetAttrs
push si
mov ax, MSG_OLDG_DOC_MARKED_CLEAN
call GenFindParent
mov di, mask MF_RECORD
call ObjMessage
push cx, dx, bp
mov cx, di ; message to send after flush
;
; Attempt to really slow down this process, after all current
; messages are flushed.
;
mov dx, bx ; pass a block owned by process
mov bp, OFIQNS_INPUT_OBJ_OF_OWNING_GEODE ; app obj is next stop
mov ax, MSG_META_OBJ_FLUSH_INPUT_QUEUE
mov di, mask MF_RECORD ; Flush through a second time
call ObjMessage ; wrap up into event
mov cx, di ; event in cx
; dx is already block owned by process
; bp is next stop
; ax is message
mov di, mask MF_CALL or mask MF_FIXUP_DS
call ObjMessage ; Finally, send this after a flush
pop cx, dx, bp
pop si
retn
SaveAndMaybeClose endp
endif
DocSaveAsClose ends
|
; A111455: Numbers n such that 101*n + 97 is prime.
; Submitted by Christian Krause
; 0,14,24,32,36,42,50,62,66,72,84,86,90,102,104,116,126,146,164,192,200,206,224,230,240,246,260,270,282,290,326,330,332,336,344,350,354,360,374,396,402,410,414,422,440,456,482,492,494,504,506,510,546,552,570
mov $2,$0
add $2,2
pow $2,2
lpb $2
add $1,48
sub $2,1
mov $3,$1
add $1,13
mul $3,2
seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0.
sub $0,$3
add $1,40
mov $4,$0
max $4,0
cmp $4,$0
mul $2,$4
lpe
mov $0,$1
sub $0,101
div $0,101
mul $0,2
|
#pragma once
#include "pch.h"
#include "bansystem.h"
#include "serverauthentication.h"
#include "concommand.h"
#include "miscserverscript.h"
#include <filesystem>
#include "configurables.h"
#include "masterserver.h"
//#include "masterserver.h"
const char* BANLIST_PATH_SUFFIX = "/banlist.txt";
ServerBanSystem* g_ServerBanSystem;
void ServerBanSystem::OpenBanlist()
{
std::ifstream enabledModsStream(GetNorthstarPrefix() + "/banlist.txt");
std::stringstream enabledModsStringStream;
if (!enabledModsStream.fail())
{
std::string line;
while (std::getline(enabledModsStream, line))
m_vBannedUids.push_back(strtoll(line.c_str(), nullptr, 10));
enabledModsStream.close();
}
// open write stream for banlist
m_sBanlistStream.open(GetNorthstarPrefix() + "/banlist.txt", std::ofstream::out | std::ofstream::binary | std::ofstream::app);
}
void ServerBanSystem::ParseRemoteBanlistString(std::string banlisttring)
{
//spdlog::info("Parsing remote banlist!");
//std::getline(std::cin, banlisttring);
std::stringstream banliststream(banlisttring + "\n");
uint64_t uid;
//m_vBannedUids.clear();
//load banned UIDs from file
std::ifstream enabledModsStream(GetNorthstarPrefix() + "/banlist.txt");
std::stringstream enabledModsStringStream;
if (!enabledModsStream.fail())
{
std::string line;
m_vBannedUids.clear();//clear currently running bannedUID vec
while (std::getline(enabledModsStream, line))
m_vBannedUids.push_back(strtoll(line.c_str(), nullptr, 10));
while (banliststream >> uid)
{
//spdlog::info("{}has been inserted into m_vBannedUids! ",uid);
InsertBanUID(uid);
}
g_MasterServerManager->LocalBanlistVersion = g_MasterServerManager->RemoteBanlistVersion;
banliststream.clear();
banliststream.seekg(0);
enabledModsStream.close();
}
//Add Remote BannedUIDs from Masterserver, without overwrtiing actual banlist.txt
}
void ServerBanSystem::PrintBanlist()
{
//spdlog::info("Localbanlist:");
for (int i = 0; i < m_vBannedUids.size(); i++)
spdlog::info("Localbanlist:{}" ,m_vBannedUids.at(i));
}
void ServerBanSystem::ClearBanlist()
{
m_vBannedUids.clear();
// reopen the file, don't provide std::ofstream::app so it clears on open
m_sBanlistStream.close();
m_sBanlistStream.open(GetNorthstarPrefix() + "/banlist.txt", std::ofstream::out | std::ofstream::binary);
}
void ServerBanSystem::InsertBanUID(uint64_t uid)
{
auto findResult = std::find(m_vBannedUids.begin(), m_vBannedUids.end(), uid);
if (findResult == m_vBannedUids.end()) {
//cannot find UID in m_vBannedUids, perform ban
m_vBannedUids.push_back(uid);
}
else
{
spdlog::info("Bypassing Incoming Ban from masterserver:{}, Player is already banned!", uid);
}
}
void ServerBanSystem::BanUID(uint64_t uid)
{
m_vBannedUids.push_back(uid);
m_sBanlistStream << std::to_string(uid) << std::endl;
spdlog::info("{} was banned", uid);
}
void ServerBanSystem::UnbanUID(uint64_t uid)
{
auto findResult = std::find(m_vBannedUids.begin(), m_vBannedUids.end(), uid);
if (findResult == m_vBannedUids.end())
return;
m_vBannedUids.erase(findResult);
spdlog::info("{} was unbanned", uid);
// todo: this needs to erase from the banlist file
// atm unsure how to do this aside from just clearing and fully rewriting the file
}
bool ServerBanSystem::IsUIDAllowed(uint64_t uid)
{
return std::find(m_vBannedUids.begin(), m_vBannedUids.end(), uid) == m_vBannedUids.end();
}
void BanPlayerCommand(const CCommand& args)
{
if (args.ArgC() < 2)
return;
// assuming maxplayers 32
for (int i = 0; i < 32; i++)
{
void* player = GetPlayerByIndex(i);
if (!strcmp((char*)player + 0x16, args.Arg(1)) || !strcmp((char*)player + 0xF500, args.Arg(1)))
{
g_ServerBanSystem->BanUID(strtoll((char*)player + 0xF500, nullptr, 10));
CBaseClient__Disconnect(player, 1, "Banned from server");
break;
}
}
}
void UnbanPlayerCommand(const CCommand& args)
{
if (args.ArgC() < 2)
return;
// assumedly the player being unbanned here wasn't already connected, so don't need to iterate over players or anything
g_ServerBanSystem->UnbanUID(strtoll(args.Arg(1), nullptr, 10));
}
void ClearBanlistCommand(const CCommand& args) { g_ServerBanSystem->ClearBanlist(); }
void InitialiseBanSystem(HMODULE baseAddress)
{
g_ServerBanSystem = new ServerBanSystem;
g_ServerBanSystem->OpenBanlist();
RegisterConCommand("ban", BanPlayerCommand, "bans a given player by uid or name", FCVAR_GAMEDLL);
RegisterConCommand("unban", UnbanPlayerCommand, "unbans a given player by uid", FCVAR_NONE);
RegisterConCommand("clearbanlist", ClearBanlistCommand, "clears all uids on the banlist", FCVAR_NONE);
} |
; A087624: a(n)=0 if n is prime, A001221(n) otherwise.
; 0,0,0,1,0,2,0,1,1,2,0,2,0,2,2,1,0,2,0,2,2,2,0,2,1,2,1,2,0,3,0,1,2,2,2,2,0,2,2,2,0,3,0,2,2,2,0,2,1,2,2,2,0,2,2,2,2,2,0,3,0,2,2,1,2,3,0,2,2,3,0,2,0,2,2,2,2,3,0,2,1,2,0,3,2,2,2,2,0,3,2,2,2,2,2,2,0,2,2,2
add $0,1
mov $3,$0
mov $4,$0
lpb $3
mov $5,$4
mov $6,0
lpb $5
mov $7,$0
mov $8,$2
cmp $8,0
add $2,$8
div $0,$2
max $6,$0
mod $7,$2
cmp $7,0
sub $5,$7
lpe
sub $3,1
cmp $6,0
cmp $6,0
add $1,$6
add $2,1
mov $7,$0
cmp $7,1
cmp $7,0
sub $3,$7
lpe
sub $1,1
mov $0,$1
|
// Copyright (c) 2013 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 "base/trace_event/trace_event_impl.h"
namespace base {
namespace trace_event {
// Enable everything but debug and test categories by default.
const char CategoryFilter::kDefaultCategoryFilterString[] = "-*Debug,-*Test";
// Constant used by TraceLog's internal implementation of trace_option.
const TraceLog::InternalTraceOptions
TraceLog::kInternalNone = 0;
const TraceLog::InternalTraceOptions
TraceLog::kInternalRecordUntilFull = 1 << 0;
const TraceLog::InternalTraceOptions
TraceLog::kInternalRecordContinuously = 1 << 1;
const TraceLog::InternalTraceOptions
TraceLog::kInternalEnableSampling = 1 << 2;
const TraceLog::InternalTraceOptions
TraceLog::kInternalEchoToConsole = 1 << 3;
const TraceLog::InternalTraceOptions
TraceLog::kInternalRecordAsMuchAsPossible = 1 << 4;
} // namespace trace_event
} // namespace base
|
// MFCApplication3.cpp : アプリケーションのクラス動作を定義します。
//
#include "pch.h"
#include "framework.h"
#include "MFCApplication3.h"
#include "MFCApplication3Dlg.h"
#include "CMFCAppInputDlg.h"
#include "CPerson.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
// CMFCApplication3App
BEGIN_MESSAGE_MAP(CMFCApplication3App, CWinApp)
ON_COMMAND(ID_HELP, &CWinApp::OnHelp)
END_MESSAGE_MAP()
// CMFCApplication3App の構築
CMFCApplication3App::CMFCApplication3App()
{
// 再起動マネージャーをサポートします
m_dwRestartManagerSupportFlags = AFX_RESTART_MANAGER_SUPPORT_RESTART;
// TODO: この位置に構築用コードを追加してください。
// ここに InitInstance 中の重要な初期化処理をすべて記述してください。
}
// 唯一の CMFCApplication3App オブジェクト
CMFCApplication3App theApp;
// CMFCApplication3App の初期化
BOOL CMFCApplication3App::InitInstance()
{
// アプリケーション マニフェストが visual スタイルを有効にするために、
// ComCtl32.dll Version 6 以降の使用を指定する場合は、
// Windows XP に InitCommonControlsEx() が必要です。さもなければ、ウィンドウ作成はすべて失敗します。
INITCOMMONCONTROLSEX InitCtrls;
InitCtrls.dwSize = sizeof(InitCtrls);
// アプリケーションで使用するすべてのコモン コントロール クラスを含めるには、
// これを設定します。
InitCtrls.dwICC = ICC_WIN95_CLASSES;
InitCommonControlsEx(&InitCtrls);
CWinApp::InitInstance();
AfxEnableControlContainer();
// ダイアログにシェル ツリー ビューまたはシェル リスト ビュー コントロールが
// 含まれている場合にシェル マネージャーを作成します。
CShellManager *pShellManager = new CShellManager;
// MFC コントロールでテーマを有効にするために、"Windows ネイティブ" のビジュアル マネージャーをアクティブ化
CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerWindows));
// 標準初期化
// これらの機能を使わずに最終的な実行可能ファイルの
// サイズを縮小したい場合は、以下から不要な初期化
// ルーチンを削除してください。
// 設定が格納されているレジストリ キーを変更します。
// TODO: 会社名または組織名などの適切な文字列に
// この文字列を変更してください。
SetRegistryKey(_T("アプリケーション ウィザードで生成されたローカル アプリケーション"));
CMFCAppInputDlg dlg;
m_pMainWnd = &dlg;
CPerson YamadaSun(CString(_T("山田")), CString(_T("息子")), 10, CPerson::PERSON_SEX_TYPE_MALE);
YamadaSun.AddRelations(CPerson(CString(_T("山田")), CString(_T("父")), 35, CPerson::PERSON_SEX_TYPE_MALE));
YamadaSun.AddRelations(CPerson(CString(_T("山田")), CString(_T("母")), 35, CPerson::PERSON_SEX_TYPE_FEMALE));
YamadaSun.AddRelations(CPerson(CString(_T("山田")), CString(_T("祖父")), 60, CPerson::PERSON_SEX_TYPE_MALE));
YamadaSun.AddRelations(CPerson(CString(_T("山田")), CString(_T("祖母")), 60, CPerson::PERSON_SEX_TYPE_FEMALE));
YamadaSun.AddRelations(CPerson(CString(_T("山田")), CString(_T("弟")), 7, CPerson::PERSON_SEX_TYPE_MALE));
CPerson SuzukiSun(CString(_T("鈴木")), CString(_T("息子")), 7, CPerson::PERSON_SEX_TYPE_MALE);
SuzukiSun.AddRelations(CPerson(CString(_T("鈴木")), CString(_T("父")), 39, CPerson::PERSON_SEX_TYPE_MALE));
SuzukiSun.AddRelations(CPerson(CString(_T("鈴木")), CString(_T("母")), 38, CPerson::PERSON_SEX_TYPE_FEMALE));
SuzukiSun.AddRelations(CPerson(CString(_T("鈴木")), CString(_T("祖父")), 70, CPerson::PERSON_SEX_TYPE_MALE));
SuzukiSun.AddRelations(CPerson(CString(_T("鈴木")), CString(_T("祖母")), 64, CPerson::PERSON_SEX_TYPE_FEMALE));
SuzukiSun.AddRelations(CPerson(CString(_T("鈴木")), CString(_T("妹")), 6, CPerson::PERSON_SEX_TYPE_FEMALE));
CPerson TankaDaughter(CString(_T("鈴木")), CString(_T("娘")), 15, CPerson::PERSON_SEX_TYPE_FEMALE);
TankaDaughter.AddRelations(CPerson(CString(_T("鈴木")), CString(_T("父")), 45, CPerson::PERSON_SEX_TYPE_MALE));
TankaDaughter.AddRelations(CPerson(CString(_T("鈴木")), CString(_T("母")), 42, CPerson::PERSON_SEX_TYPE_FEMALE));
TankaDaughter.AddRelations(CPerson(CString(_T("鈴木")), CString(_T("祖母")), 64, CPerson::PERSON_SEX_TYPE_FEMALE));
TankaDaughter.AddRelations(CPerson(CString(_T("鈴木")), CString(_T("妹")), 12, CPerson::PERSON_SEX_TYPE_FEMALE));
CPersonInfo PersonInfo;
PersonInfo.Add(0, new CPerson(&YamadaSun));
PersonInfo.Add(1, new CPerson(&SuzukiSun));
PersonInfo.Add(2, new CPerson(&TankaDaughter));
dlg.SetPersonInfo(PersonInfo);
INT_PTR nResponse = dlg.DoModal();
if (nResponse == IDOK)
{
}
else if (nResponse == IDCANCEL)
{
// TODO: ダイアログが <キャンセル> で消された時のコードを
// 記述してください。
}
else if (nResponse == -1)
{
TRACE(traceAppMsg, 0, "警告: ダイアログの作成に失敗しました。アプリケーションは予期せずに終了します。\n");
TRACE(traceAppMsg, 0, "警告: ダイアログで MFC コントロールを使用している場合、#define _AFX_NO_MFC_CONTROLS_IN_DIALOGS を指定できません。\n");
}
// 上で作成されたシェル マネージャーを削除します。
if (pShellManager != nullptr)
{
delete pShellManager;
}
#if !defined(_AFXDLL) && !defined(_AFX_NO_MFC_CONTROLS_IN_DIALOGS)
ControlBarCleanUp();
#endif
// ダイアログは閉じられました。アプリケーションのメッセージ ポンプを開始しないで
// アプリケーションを終了するために FALSE を返してください。
return FALSE;
}
|
/*****************************************************************************************
* *
* OpenSpace *
* *
* Copyright (c) 2014-2019 *
* *
* 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 <modules/volume/rendering/renderabletimevaryingvolume.h>
#include <modules/volume/rendering/basicvolumeraycaster.h>
#include <modules/volume/rendering/volumeclipplanes.h>
#include <modules/volume/transferfunctionhandler.h>
#include <modules/volume/rawvolume.h>
#include <modules/volume/rawvolumereader.h>
#include <modules/volume/volumegridtype.h>
#include <openspace/documentation/documentation.h>
#include <openspace/documentation/verifier.h>
#include <openspace/engine/globals.h>
#include <openspace/rendering/raycastermanager.h>
#include <openspace/rendering/renderengine.h>
#include <openspace/util/histogram.h>
#include <openspace/util/time.h>
#include <openspace/util/timemanager.h>
#include <openspace/util/updatestructures.h>
#include <ghoul/filesystem/file.h>
#include <ghoul/filesystem/filesystem.h>
#include <ghoul/logging/logmanager.h>
#include <ghoul/opengl/texture.h>
namespace {
constexpr const char* _loggerCat = "RenderableTimeVaryingVolume";
} // namespace
namespace {
const char* KeyStepSize = "StepSize";
const char* KeyGridType = "GridType";
const char* KeyTransferFunction = "TransferFunction";
const char* KeySourceDirectory = "SourceDirectory";
const char* KeyClipPlanes = "ClipPlanes";
const char* KeySecondsBefore = "SecondsBefore";
const char* KeySecondsAfter = "SecondsAfter";
const float SecondsInOneDay = 60 * 60 * 24;
constexpr const float VolumeMaxOpacity = 500;
static const openspace::properties::Property::PropertyInfo StepSizeInfo = {
"stepSize",
"Step Size",
"" // @TODO Missing documentation
};
constexpr openspace::properties::Property::PropertyInfo GridTypeInfo = {
"gridType",
"Grid Type",
"" // @TODO Missing documentation
};
constexpr openspace::properties::Property::PropertyInfo SecondsBeforeInfo = {
"secondsBefore",
"Seconds before",
"" // @TODO Missing documentation
};
constexpr openspace::properties::Property::PropertyInfo SecondsAfterInfo = {
"secondsAfter",
"Seconds after",
"" // @TODO Missing documentation
};
constexpr openspace::properties::Property::PropertyInfo SourceDirectoryInfo = {
"sourceDirectory",
"Source Directory",
"" // @TODO Missing documentation
};
constexpr openspace::properties::Property::PropertyInfo TransferFunctionInfo = {
"transferFunctionPath",
"Transfer Function Path",
""
};
constexpr openspace::properties::Property::PropertyInfo TriggerTimeJumpInfo = {
"triggerTimeJump",
"Jump",
"" // @TODO Missing documentation
};
constexpr openspace::properties::Property::PropertyInfo JumpToTimestepInfo = {
"jumpToTimestep",
"Jump to timestep",
"" // @TODO Missing documentation
};
constexpr openspace::properties::Property::PropertyInfo CurrentTimeStepInfo = {
"currentTimestep",
"Current timestep",
"" // @TODO Missing documentation
};
constexpr openspace::properties::Property::PropertyInfo rNormalizationInfo = {
"rNormalization",
"Radius normalization",
"" // @TODO Missing documentation
};
constexpr openspace::properties::Property::PropertyInfo rUpperBoundInfo = {
"rUpperBound",
"Radius upper bound",
"" // @TODO Missing documentation
};
} // namespace
namespace openspace::volume {
documentation::Documentation RenderableTimeVaryingVolume::Documentation() {
using namespace documentation;
return {
"RenderableTimevaryingVolume",
"volume_renderable_timevaryingvolume",
{
{
KeySourceDirectory,
new StringVerifier,
Optional::No,
"Specifies the path to load timesteps from"
},
{
KeyTransferFunction,
new StringVerifier,
Optional::No,
"Specifies the transfer function file path"
},
{
KeySecondsBefore,
new DoubleVerifier,
Optional::Yes,
"Specifies the number of seconds to show the the first timestep before "
"its actual time. The default value is 0."
},
{
KeySecondsAfter,
new DoubleVerifier,
Optional::No,
"Specifies the number of seconds to show the the last timestep after its "
"actual time"
}
}
};
}
RenderableTimeVaryingVolume::RenderableTimeVaryingVolume(
const ghoul::Dictionary& dictionary)
: Renderable(dictionary)
, _gridType(GridTypeInfo, properties::OptionProperty::DisplayType::Dropdown)
, _stepSize(StepSizeInfo, 0.02f, 0.001f, 0.1f)
, _rNormalization(rNormalizationInfo, 0.f, 0.f, 2.f)
, _rUpperBound(rUpperBoundInfo, 1.f, 0.f, 2.f)
, _secondsBefore(SecondsBeforeInfo, 0.f, 0.01f, SecondsInOneDay)
, _secondsAfter(SecondsAfterInfo, 0.f, 0.01f, SecondsInOneDay)
, _sourceDirectory(SourceDirectoryInfo)
, _transferFunctionPath(TransferFunctionInfo)
, _triggerTimeJump(TriggerTimeJumpInfo)
, _jumpToTimestep(JumpToTimestepInfo, 0, 0, 256)
, _currentTimestep(CurrentTimeStepInfo, 0, 0, 256)
{
documentation::testSpecificationAndThrow(
Documentation(),
dictionary,
"RenderableTimeVaryingVolume"
);
_sourceDirectory = absPath(dictionary.value<std::string>(KeySourceDirectory));
_transferFunctionPath = absPath(dictionary.value<std::string>(KeyTransferFunction));
_transferFunction = std::make_shared<openspace::TransferFunction>(
_transferFunctionPath,
[](const openspace::TransferFunction&) {}
);
_gridType.addOptions({
{ static_cast<int>(volume::VolumeGridType::Cartesian), "Cartesian grid" },
{ static_cast<int>(volume::VolumeGridType::Spherical), "Spherical grid" }
});
_gridType = static_cast<int>(volume::VolumeGridType::Cartesian);
if (dictionary.hasKeyAndValue<float>(KeyStepSize)) {
_stepSize = dictionary.value<float>(KeyStepSize);
}
if (dictionary.hasKeyAndValue<float>(KeySecondsBefore)) {
_secondsBefore = dictionary.value<float>(KeySecondsBefore);
}
_secondsAfter = dictionary.value<float>(KeySecondsAfter);
ghoul::Dictionary clipPlanesDictionary;
dictionary.getValue(KeyClipPlanes, clipPlanesDictionary);
_clipPlanes = std::make_shared<volume::VolumeClipPlanes>(clipPlanesDictionary);
_clipPlanes->setIdentifier("clipPlanes");
_clipPlanes->setGuiName("Clip Planes");
if (dictionary.hasKeyAndValue<std::string>(KeyGridType)) {
VolumeGridType gridType = volume::parseGridType(
dictionary.value<std::string>(KeyGridType)
);
_gridType = static_cast<std::underlying_type_t<VolumeGridType>>(gridType);
}
addProperty(_opacity);
}
RenderableTimeVaryingVolume::~RenderableTimeVaryingVolume() {}
void RenderableTimeVaryingVolume::initializeGL() {
using RawPath = ghoul::filesystem::Directory::RawPath;
ghoul::filesystem::Directory sequenceDir(_sourceDirectory, RawPath::Yes);
if (!FileSys.directoryExists(sequenceDir)) {
LERROR(fmt::format("Could not load sequence directory '{}'", sequenceDir.path()));
return;
}
using Recursive = ghoul::filesystem::Directory::Recursive;
using Sort = ghoul::filesystem::Directory::Sort;
std::vector<std::string> sequencePaths = sequenceDir.read(Recursive::Yes, Sort::No);
for (const std::string& path : sequencePaths) {
ghoul::filesystem::File currentFile(path);
std::string extension = currentFile.fileExtension();
if (extension == "dictionary") {
loadTimestepMetadata(path);
}
}
// TODO: defer loading of data to later (separate thread or at least not when loading)
for (std::pair<const double, Timestep>& p : _volumeTimesteps) {
Timestep& t = p.second;
std::string path = FileSys.pathByAppendingComponent(
_sourceDirectory, t.baseName
) + ".rawvolume";
RawVolumeReader<float> reader(path, t.metadata.dimensions);
t.rawVolume = reader.read();
float min = t.metadata.minValue;
float diff = t.metadata.maxValue - t.metadata.minValue;
float* data = t.rawVolume->data();
for (size_t i = 0; i < t.rawVolume->nCells(); ++i) {
data[i] = glm::clamp((data[i] - min) / diff, 0.f, 1.f);
}
t.histogram = std::make_shared<Histogram>(0.f, 1.f, 100);
for (size_t i = 0; i < t.rawVolume->nCells(); ++i) {
t.histogram->add(data[i]);
}
// TODO: handle normalization properly for different timesteps + transfer function
t.texture = std::make_shared<ghoul::opengl::Texture>(
t.metadata.dimensions,
ghoul::opengl::Texture::Format::Red,
GL_RED,
GL_FLOAT,
ghoul::opengl::Texture::FilterMode::Linear,
ghoul::opengl::Texture::WrappingMode::Clamp
);
t.texture->setPixelData(
reinterpret_cast<void*>(data),
ghoul::opengl::Texture::TakeOwnership::No
);
t.texture->uploadTexture();
}
_clipPlanes->initialize();
_raycaster = std::make_unique<volume::BasicVolumeRaycaster>(
nullptr,
_transferFunction,
_clipPlanes
);
_raycaster->initialize();
global::raycasterManager.attachRaycaster(*_raycaster.get());
onEnabledChange([&](bool enabled) {
if (enabled) {
global::raycasterManager.attachRaycaster(*_raycaster.get());
}
else {
global::raycasterManager.detachRaycaster(*_raycaster.get());
}
});
_triggerTimeJump.onChange([this] () { jumpToTimestep(_jumpToTimestep); });
_jumpToTimestep.onChange([this] () { jumpToTimestep(_jumpToTimestep); });
const int lastTimestep = !_volumeTimesteps.empty() ?
static_cast<int>(_volumeTimesteps.size() - 1) :
0;
_currentTimestep.setMaxValue(lastTimestep);
_jumpToTimestep.setMaxValue(lastTimestep);
addProperty(_stepSize);
addProperty(_transferFunctionPath);
addProperty(_sourceDirectory);
addPropertySubOwner(_clipPlanes.get());
addProperty(_triggerTimeJump);
addProperty(_jumpToTimestep);
addProperty(_currentTimestep);
addProperty(_rNormalization);
addProperty(_rUpperBound);
addProperty(_gridType);
_raycaster->setGridType(static_cast<VolumeGridType>(_gridType.value()));
_gridType.onChange([this] {
_raycaster->setGridType(static_cast<VolumeGridType>(_gridType.value()));
});
_transferFunctionPath.onChange([this] {
_transferFunction = std::make_shared<openspace::TransferFunction>(
_transferFunctionPath
);
_raycaster->setTransferFunction(_transferFunction);
});
}
void RenderableTimeVaryingVolume::loadTimestepMetadata(const std::string& path) {
RawVolumeMetadata metadata;
try {
ghoul::Dictionary dictionary = ghoul::lua::loadDictionaryFromFile(path);
metadata = RawVolumeMetadata::createFromDictionary(dictionary);
} catch (...) {
return;
}
Timestep t;
t.metadata = metadata;
t.baseName = ghoul::filesystem::File(path).baseName();
t.inRam = false;
t.onGpu = false;
_volumeTimesteps[t.metadata.time] = std::move(t);
}
RenderableTimeVaryingVolume::Timestep* RenderableTimeVaryingVolume::currentTimestep() {
if (_volumeTimesteps.empty()) {
return nullptr;
}
double currentTime = global::timeManager.time().j2000Seconds();
// Get the first item with time > currentTime
auto currentTimestepIt = _volumeTimesteps.upper_bound(currentTime);
if (currentTimestepIt == _volumeTimesteps.end()) {
// No such timestep was found: show last timestep if it is within the time margin.
Timestep* lastTimestep = &(_volumeTimesteps.rbegin()->second);
double threshold = lastTimestep->metadata.time +
static_cast<double>(_secondsAfter);
return currentTime < threshold ? lastTimestep : nullptr;
}
if (currentTimestepIt == _volumeTimesteps.begin()) {
// No such timestep was found: show first timestep if it is within the time margin
Timestep* firstTimestep = &(_volumeTimesteps.begin()->second);
double threshold = firstTimestep->metadata.time -
static_cast<double>(_secondsBefore);
return currentTime >= threshold ? firstTimestep : nullptr;
}
// Get the last item with time <= currentTime
currentTimestepIt--;
return &(currentTimestepIt->second);
}
int RenderableTimeVaryingVolume::timestepIndex(
const RenderableTimeVaryingVolume::Timestep* t) const
{
if (!t) {
return -1;
}
int index = 0;
for (const std::pair<const double, Timestep>& it : _volumeTimesteps) {
if (&(it.second) == t) {
return index;
}
++index;
}
return -1;
}
// @TODO Can this be turned into a const ref?
RenderableTimeVaryingVolume::Timestep* RenderableTimeVaryingVolume::timestepFromIndex(
int target)
{
if (target < 0) {
target = 0;
}
int index = 0;
for (std::pair<const double, Timestep>& it : _volumeTimesteps) {
if (index == target) {
return &(it.second);
}
++index;
}
return nullptr;
}
void RenderableTimeVaryingVolume::jumpToTimestep(int target) {
Timestep* t = timestepFromIndex(target);
if (t) {
global::timeManager.setTimeNextFrame(t->metadata.time);
}
}
void RenderableTimeVaryingVolume::update(const UpdateData&) {
_transferFunction->update();
if (_raycaster) {
Timestep* t = currentTimestep();
_currentTimestep = timestepIndex(t);
// Set scale and translation matrices:
// The original data cube is a unit cube centered in 0
// ie with lower bound from (-0.5, -0.5, -0.5) and upper bound (0.5, 0.5, 0.5)
if (t && t->texture) {
if (_raycaster->gridType() == volume::VolumeGridType::Cartesian) {
glm::dvec3 scale = t->metadata.upperDomainBound -
t->metadata.lowerDomainBound;
glm::dvec3 translation =
(t->metadata.lowerDomainBound + t->metadata.upperDomainBound) * 0.5f;
glm::dmat4 modelTransform = glm::translate(glm::dmat4(1.0), translation);
glm::dmat4 scaleMatrix = glm::scale(glm::dmat4(1.0), scale);
modelTransform = modelTransform * scaleMatrix;
_raycaster->setModelTransform(glm::mat4(modelTransform));
} else {
// The diameter is two times the maximum radius.
// No translation: the sphere is always centered in (0, 0, 0)
_raycaster->setModelTransform(
glm::scale(
glm::dmat4(1.0),
glm::dvec3(2.0 * t->metadata.upperDomainBound[0])
)
);
}
_raycaster->setVolumeTexture(t->texture);
} else {
_raycaster->setVolumeTexture(nullptr);
}
_raycaster->setStepSize(_stepSize);
_raycaster->setOpacity(_opacity * VolumeMaxOpacity);
_raycaster->setRNormalization(_rNormalization);
_raycaster->setRUpperBound(_rUpperBound);
}
}
void RenderableTimeVaryingVolume::render(const RenderData& data, RendererTasks& tasks) {
if (_raycaster && _raycaster->volumeTexture()) {
tasks.raycasterTasks.push_back({ _raycaster.get(), data });
}
}
bool RenderableTimeVaryingVolume::isReady() const {
return true;
}
void RenderableTimeVaryingVolume::deinitializeGL() {
if (_raycaster) {
global::raycasterManager.detachRaycaster(*_raycaster.get());
_raycaster = nullptr;
}
}
} // namespace openspace::volume
|
INCLUDE MESSW.ASM
KANJI EQU FALSE
Rainbow EQU FALSE
INCLUDE DOSSYM.ASM
;
; segment ordering for MSDOS
;
CONSTANTS SEGMENT BYTE PUBLIC 'CONST'
CONSTANTS ENDS
DATA SEGMENT BYTE PUBLIC 'DATA'
DATA ENDS
CODE SEGMENT BYTE PUBLIC 'CODE'
CODE ENDS
LAST SEGMENT BYTE PUBLIC 'LAST'
LAST ENDS
DOSGROUP GROUP CODE,CONSTANTS,DATA,LAST
CONSTANTS SEGMENT BYTE PUBLIC 'CONST'
PUBLIC DIVMES
DIVMES DB 13,10,"Divide overflow",13,10
PUBLIC DivMesLen
DivMesLen DB $-DivMes ; Length of the above message in bytes
;
; The next variable points to the country table for the current country
; ( the table returned by the AL=0 INTERNATIONAL call).
;
PUBLIC Current_Country
IF KANJI
Current_Country DW OFFSET DOSGROUP:JAPTABLE
ELSE
Current_Country DW OFFSET DOSGROUP:USTABLE
ENDIF
;
; The international tabel(s).
; This is simply a sequence of tables of the following form:
;
; BYTE Size of this table excluding this byte and the next
; BYTE Country code represented by this table
; A sequence of n bytes, where n is the number specified
; by the first byte above and is not > internat_block_max,
; in the correct order for being returned by the
; INTERNATIONAL call as follows:
; WORD Date format 0=mdy, 1=dmy, 2=ymd
; 5 BYTE Currency symbol null terminated
; 2 BYTE thousands separator null terminated
; 2 BYTE Decimal point null terminated
; 2 BYTE Date separator null terminated
; 2 BYTE Time separator null terminated
; 1 BYTE Bit field. Currency format.
; Bit 0. =0 $ before # =1 $ after #
; Bit 1. no. of spaces between # and $ (0 or 1)
; 1 BYTE No. of significant decimal digits in currency
; 1 BYTE Bit field. Time format.
; Bit 0. =0 12 hour clock =1 24 hour
; WORD Segment offset for address of case conversion routine
; WORD RESERVED. Filled in by DOS. Segment value for above routine
; 2 BYTE Data list separator null terminated.
; NOTE: The segment part of the DWORD Map_call is set
; by the INTERNATIONAL call. Do not try to initialize
; it to anything meaningful.
;
; The list of tables is terminated by putting a byte of -1 after the last
; table (a table with length -1).
PUBLIC international_table
international_table LABEL BYTE
IF KANJI
DB SIZE internat_block ; Size in bytes of this table
DB 81 ; Country code
JAPTABLE internat_block <2,'\',0,0,0,0,',',0,'.',0,'-',0,':',0,0,0,1,OFFSET DOSGROUP:MAP_DCASE , 0,',',0>
ENDIF
DB SIZE internat_block ; Size in bytes of this table
DB 1 ; Country code
USTABLE internat_block <0,'$',0,0,0,0,',',0,'.',0,'-',0,':',0,0,2,0,OFFSET DOSGROUP:MAP_DCASE,0,',',0>
; Tables for the IBM PC character set follow. The values
; associated with some of the currency symbols may change with
; other character sets. You may wish to add or delete country
; entries. NOTE: It is not a mistake that the JAPANESE entry
; has different currency symbols for the KANJI and
; non-KANJI versions.
IF NOT KANJI
IF IBM
DB SIZE internat_block ; Size in bytes of this table
DB 44 ; Country code
UKTABLE internat_block <1,9Ch,0,0,0,0,',',0,'.',0,'-',0,':',0,0,2,0,OFFSET DOSGROUP:MAP_DCASE,0,',',0>
DB SIZE internat_block ; Size in bytes of this table
DB 49 ; Country code
GRMTABLE internat_block <1,'D','M',0,0,0,'.',0,',',0,'.',0,'.',0,3,2,1,OFFSET DOSGROUP:MAP_DCASE,0,';',0>
DB SIZE internat_block ; Size in bytes of this table
DB 33 ; Country code
FRNTABLE internat_block <1,'F',0,0,0,0,' ',0,',',0,'/',0,':',0,3,2,1,OFFSET DOSGROUP:MAP_DCASE,0,';',0>
DB SIZE internat_block ; Size in bytes of this table
DB 81 ; Country code
JAPTABLE internat_block <2,9DH,0,0,0,0,',',0,'.',0,'-',0,':',0,0,0,1,OFFSET DOSGROUP:MAP_DCASE , 0,',',0>
ENDIF
DB -1 ; End of tables
CONSTANTS ENDS
CODE SEGMENT BYTE PUBLIC 'CODE'
ASSUME CS:DOSGROUP,DS:NOTHING,ES:NOTHING,SS:NOTHING
;CASE MAPPER ROUTINE FOR 80H-FFH character range
; ENTRY: AL = Character to map
; EXIT: AL = The converted character
; Alters no registers except AL and flags.
; The routine should do nothing to chars below 80H.
;
; Example:
MAP_DCASE PROC FAR
IF NOT KANJI
IF IBM
CMP AL,80H
JB L_RET ;Map no chars below 80H ever
CMP AL,0A7H
JA L_RET ;This routine maps chars between 80H and A7H
SUB AL,80H ;Turn into index value
PUSH DS
PUSH BX
PUSH CS ;Move to DS
POP DS
MOV BX,OFFSET DOSGROUP:TABLE
XLAT ;Get upper case character
POP BX
POP DS
ENDIF
ENDIF
L_RET: RET
MAP_DCASE ENDP
IF NOT KANJI
IF IBM
TABLE: DB 80H,9AH,"E","A",8EH,"A",8FH,80H
DB "E","E","E","I","I","I",8EH,8FH
DB 90H,92H,92H,"O",99H,"O","U","U"
DB "Y",99H,9AH,9BH,9CH,9DH,9EH,9FH
DB "A","I","O","U",0A5H,0A5H,0A6H,0A7H
ENDIF
ENDIF
SUBTTL EDIT FUNCTION ASSIGNMENTS AND HEADERS
PAGE
; The following two tables implement the current buffered input editing
; routines. The tables are pairwise associated in reverse order for ease
; in indexing. That is; The first entry in ESCTAB corresponds to the last
; entry in ESCFUNC, and the last entry in ESCTAB to the first entry in ESCFUNC.
PUBLIC ESCCHAR
ESCCHAR DB ESCCH ;Lead-in character for escape sequences
IF NOT Rainbow
ESCTAB:
IF NOT IBM
IF WANG
DB 0C0h ; ^Z inserter
DB 0C1H ; Copy one char
DB 0C7H ; Skip one char
DB 08AH ; Copy to char
DB 088H ; Skip to char
DB 09AH ; Copy line
DB 0CBH ; Kill line (no change in template)
DB 08BH ; Reedit line (new template)
DB 0C3H ; Backspace
DB 0C6H ; Enter insert mode
IF NOT TOGLINS
DB 0D6H ; Exit insert mode
ENDIF
DB 0C6H ; Escape character
DB 0C6H ; End of table
ELSE
; VT52 equivalences
DB "Z" ; ^Z inserter
DB "S" ; F1 Copy one char
DB "V" ; F4 Skip one char
DB "T" ; F2 Copy to char
DB "W" ; F5 Skip to char
DB "U" ; F3 Copy line
DB "E" ; SHIFT ERASE Kill line (no change in template)
DB "J" ; ERASE Reedit line (new template)
DB "D" ; LEFT Backspace
DB "P" ; BLUE Enter insert mode
DB "Q" ; RED Exit insert mode
DB "R" ; GRAY Escape character
DB "R" ; End of table
ENDIF
ENDIF
IF IBM
DB 64 ; Ctrl-Z - F6
DB 77 ; Copy one char - -->
DB 59 ; Copy one char - F1
DB 83 ; Skip one char - DEL
DB 60 ; Copy to char - F2
DB 62 ; Skip to char - F4
DB 61 ; Copy line - F3
DB 61 ; Kill line (no change to template ) - Not used
DB 63 ; Reedit line (new template) - F5
DB 75 ; Backspace - <--
DB 82 ; Enter insert mode - INS (toggle)
DB 65 ; Escape character - F7
DB 65 ; End of table
ENDIF
ESCEND:
ESCTABLEN EQU ESCEND-ESCTAB
ESCFUNC LABEL WORD
short_addr GETCH ; Ignore the escape sequence
short_addr TWOESC
IF NOT TOGLINS
short_addr EXITINS
ENDIF
short_addr ENTERINS
short_addr BACKSP
short_addr REEDIT
short_addr KILNEW
short_addr COPYLIN
short_addr SKIPSTR
short_addr COPYSTR
short_addr SKIPONE
short_addr COPYONE
IF IBM
short_addr COPYONE
ENDIF
short_addr CTRLZ
ENDIF
;
; OEMFunction key is expected to process a single function
; key input from a device and dispatch to the proper
; routines leaving all registers UNTOUCHED.
;
; Inputs: CS, SS are DOSGROUP
; Outputs: None. This function is expected to JMP to onw of
; the following labels:
;
; GetCh - ignore the sequence
; TwoEsc - insert an ESCChar in the buffer
; ExitIns - toggle insert mode
; EnterIns - toggle insert mode
; BackSp - move backwards one space
; ReEdit - reedit the line with a new template
; KilNew - discard the current line and start from scratch
; CopyLin - copy the rest of the template into the line
; SkipStr - read the next character and skip to it in the template
; CopyStr - read next char and copy from template to line until char
; SkipOne - advance position in template one character
; CopyOne - copy next character in template into line
; CtrlZ - place a ^Z into the template
; Registers that are allowed to be modified by this function are:
; AX, CX, BP
PUBLIC OEMFunctionKey
OEMFunctionKey PROC NEAR
ASSUME DS:NOTHING,ES:NOTHING,SS:DOSGROUP
invoke $STD_CON_INPUT_NO_ECHO ; Get the second byte of the sequence
IF NOT Rainbow
MOV CL,ESCTABLEN ; length of table for scan
PUSH DI ; save DI (cannot change it!)
MOV DI,OFFSET DOSGROUP:ESCTAB ; offset of second byte table
REPNE SCASB ; Look it up in the table
POP DI ; restore DI
SHL CX,1 ; convert byte offset to word
MOV BP,CX ; move to indexable register
JMP [BP+OFFSET DOSGROUP:ESCFUNC] ; Go to the right routine
ENDIF
IF Rainbow
TransferIf MACRO value,address
local a
CMP AL,value
JNZ a
transfer address
a:
ENDM
CMP AL,'[' ; is it second lead char
JZ EatParm ; yes, go walk tree
GoGetCh:
transfer GetCh ; no, ignore sequence
EatParm:
invoke $STD_CON_INPUT_NO_ECHO ; get argument
CMP AL,'A' ; is it alphabetic arg?
JAE EatAlpha ; yes, go snarf one up
XOR BP,BP ; init digit counter
JMP InDigit ; jump into internal eat digit routine
EatNum:
invoke $STD_CON_INPUT_NO_ECHO ; get next digit
InDigit:
CMP AL,'9' ; still a digit?
JA CheckNumEnd ; no, go check for end char
SUB AL,'0' ; turn into potential digit
JB GoGetCh ; oops, not a digit, ignore
MOV CX,BP ; save BP for 10 multiply
CBW ; make AL into AX
SHL BP,1 ; 2*BP
SHL BP,1 ; 4*BP
ADD BP,CX ; 5*BP
SHL BP,1 ; 10*BP
ADD BP,AX ; 10*BP + digit
JMP EatNum ; continue with number
CheckNumEnd:
CMP AL,7Eh ; is it end char ~
JNZ GoGetCh ; nope, ignore key sequence
MOV AX,BP
transferIf 1,SkipStr ; FIND key
transferIf 2,EnterIns ; INSERT HERE key
transferIf 3,SkipOne ; REMOVE
transferIf 4,CopyStr ; SELECT
transferIf 17,TwoEsc ; INTERRUPT
transferIf 18,ReEdit ; RESUME
transferIf 19,KilNew ; CANCEL
transferIf 21,CtrlZ ; EXIT
transferIf 29,CopyLin ; DO
JMP GoGetCh
EatAlpha:
CMP AL,'O' ; is it O?
JA GoGetCh ; no, after assume bogus
JZ EatPQRS ; eat the rest of the bogus key
transferIf 'C',CopyOne ; RIGHT
transferIf 'D',BackSp ; LEFT
JMP GoGetCh
EatPQRS:
invoke $STD_CON_INPUT_NO_ECHO ; eat char after O
JMP GoGetCh
ENDIF
OEMFunctionKey ENDP
CODE ENDS
do_ext
END
|
; A044470: Numbers n such that string 2,2 occurs in the base 5 representation of n but not of n+1.
; 12,37,64,87,112,137,162,189,212,237,262,287,324,337,362,387,412,439,462,487,512,537,564,587,612,637,662,689,712,737,762,787,814,837,862,887,912,949,962,987,1012,1037,1064,1087,1112
mov $4,5
mov $5,$0
mul $0,2
add $0,1
mov $1,3125
gcd $1,$0
div $1,4
lpb $0
mul $0,$2
add $1,$4
lpe
mul $1,2
add $1,2
mov $3,$5
mul $3,25
add $1,$3
mov $0,$1
|
<%
import collections
import pwnlib.abi
import pwnlib.constants
import pwnlib.shellcraft
import six
%>
<%docstring>ioperm(from, num, turn_on) -> str
Invokes the syscall ioperm.
See 'man 2 ioperm' for more information.
Arguments:
from(unsigned): from
num(unsigned): num
turn_on(int): turn_on
Returns:
int
</%docstring>
<%page args="from=0, num=0, turn_on=0"/>
<%
abi = pwnlib.abi.ABI.syscall()
stack = abi.stack
regs = abi.register_arguments[1:]
allregs = pwnlib.shellcraft.registers.current()
can_pushstr = []
can_pushstr_array = []
argument_names = ['from', 'num', 'turn_on']
argument_values = [from, num, turn_on]
# Load all of the arguments into their destination registers / stack slots.
register_arguments = dict()
stack_arguments = collections.OrderedDict()
string_arguments = dict()
dict_arguments = dict()
array_arguments = dict()
syscall_repr = []
for name, arg in zip(argument_names, argument_values):
if arg is not None:
syscall_repr.append('%s=%r' % (name, arg))
# If the argument itself (input) is a register...
if arg in allregs:
index = argument_names.index(name)
if index < len(regs):
target = regs[index]
register_arguments[target] = arg
elif arg is not None:
stack_arguments[index] = arg
# The argument is not a register. It is a string value, and we
# are expecting a string value
elif name in can_pushstr and isinstance(arg, (six.binary_type, six.text_type)):
if isinstance(arg, six.text_type):
arg = arg.encode('utf-8')
string_arguments[name] = arg
# The argument is not a register. It is a dictionary, and we are
# expecting K:V paris.
elif name in can_pushstr_array and isinstance(arg, dict):
array_arguments[name] = ['%s=%s' % (k,v) for (k,v) in arg.items()]
# The arguent is not a register. It is a list, and we are expecting
# a list of arguments.
elif name in can_pushstr_array and isinstance(arg, (list, tuple)):
array_arguments[name] = arg
# The argument is not a register, string, dict, or list.
# It could be a constant string ('O_RDONLY') for an integer argument,
# an actual integer value, or a constant.
else:
index = argument_names.index(name)
if index < len(regs):
target = regs[index]
register_arguments[target] = arg
elif arg is not None:
stack_arguments[target] = arg
# Some syscalls have different names on various architectures.
# Determine which syscall number to use for the current architecture.
for syscall in ['SYS_ioperm']:
if hasattr(pwnlib.constants, syscall):
break
else:
raise Exception("Could not locate any syscalls: %r" % syscalls)
%>
/* ioperm(${', '.join(syscall_repr)}) */
%for name, arg in string_arguments.items():
${pwnlib.shellcraft.pushstr(arg, append_null=(b'\x00' not in arg))}
${pwnlib.shellcraft.mov(regs[argument_names.index(name)], abi.stack)}
%endfor
%for name, arg in array_arguments.items():
${pwnlib.shellcraft.pushstr_array(regs[argument_names.index(name)], arg)}
%endfor
%for name, arg in stack_arguments.items():
${pwnlib.shellcraft.push(arg)}
%endfor
${pwnlib.shellcraft.setregs(register_arguments)}
${pwnlib.shellcraft.syscall(syscall)} |
#include <iostream>
#include <string.h>
class MyString
{
char* string_content; // 문자열 데이터를 가리키는 포인터
int string_length; // 문자열 길이
int memory_capacity; // 현재 할당된 용량
public:
// 문자 하나로 생성
MyString(char c);
// 문자열로 부터 생성
MyString(const char* str);
// 복사 생성자
MyString(const MyString& str);
~MyString();
int length() const;
int capacity() const;
void reserve(int size);
void print() const;
void println() const;
MyString& assign(const MyString& str);
MyString& assign(const char* str);
char at(int i) const;
MyString& insert(int loc, const MyString& str);
MyString& insert(int loc, const char* str);
MyString& insert(int loc, char c);
MyString& erase(int loc, int num);
int find(int find_from, const MyString& str) const;
int find(int find_from, const char* str) const;
int find(int find_from, char c) const;
int compare(const MyString& str) const;
};
MyString::MyString(char c)
{
string_content = new char[1];
string_content[0] = c;
memory_capacity = 1;
string_length = 1;
}
MyString::MyString(const char* str)
{
string_length = strlen(str);
memory_capacity = string_length;
string_content = new char[string_length];
for (int i = 0; i != string_length; i++) string_content[i] = str[i];
}
MyString::MyString(const MyString& str)
{
string_length = str.string_length;
memory_capacity = str.string_length;
string_content = new char[string_length];
for (int i = 0; i != string_length; i++)
{
string_content[i] = str.string_content[i];
}
}
MyString::~MyString() { delete[] string_content; }
int MyString::length() const { return string_length; }
void MyString::print() const
{
for (int i = 0; i != string_length; i++)
{
std::cout << string_content[i];
}
}
void MyString::println() const
{
for (int i = 0; i != string_length; i++)
{
std::cout << string_content[i];
}
std::cout << std::endl;
}
MyString& MyString::assign(const MyString& str)
{
if (str.string_length > memory_capacity)
{
// 그러면 다시 할당을 해줘야만 한다.
delete[] string_content;
string_content = new char[str.string_length];
memory_capacity = str.string_length;
}
for (int i = 0; i != str.string_length; i++)
{
string_content[i] = str.string_content[i];
}
// 그리고 굳이 str.string_length + 1 ~ string_length 부분은 초기화
// 시킬 필요는 없다. 왜냐하면 거기 까지는 읽어들이지 않기 때문이다.
string_length = str.string_length;
return *this;
}
MyString& MyString::assign(const char* str)
{
int str_length = strlen(str);
if (str_length > memory_capacity)
{
// 그러면 다시 할당을 해줘야만 한다.
delete[] string_content;
string_content = new char[str_length];
memory_capacity = str_length;
}
for (int i = 0; i != str_length; i++)
{
string_content[i] = str[i];
}
string_length = str_length;
return *this;
}
int MyString::capacity() const { return memory_capacity; }
void MyString::reserve(int size)
{
if (size > memory_capacity)
{
char* prev_string_content = string_content;
string_content = new char[size];
memory_capacity = size;
for (int i = 0; i != string_length; i++)
string_content[i] = prev_string_content[i];
delete[] prev_string_content;
}
// 만일 예약하려는 size 가 현재 capacity 보다 작다면
// 아무것도 안해도 된다.
}
char MyString::at(int i) const
{
if (i >= string_length || i < 0)
{
return 0;
}
else
{
return string_content[i];
}
}
MyString& MyString::insert(int loc, const MyString& str)
{
// 이는 i 의 위치 바로 앞에 문자를 삽입하게 된다. 예를 들어서
// abc 라는 문자열에 insert(1, "d") 를 하게 된다면 adbc 가 된다.
// 범위를 벗어나는 입력에 대해서는 삽입을 수행하지 않는다.
if (loc < 0 || loc > string_length) return *this;
if (string_length + str.string_length > memory_capacity)
{
// 이제 새롭게 동적으로 할당을 해야 한다.
if (memory_capacity * 2 > string_length + str.string_length)
memory_capacity *= 2;
else
memory_capacity = string_length + str.string_length;
char* prev_string_content = string_content;
string_content = new char[memory_capacity];
// 일단 insert 되는 부분 직전까지의 내용을 복사한다.
int i;
for (i = 0; i < loc; i++)
{
string_content[i] = prev_string_content[i];
}
// 그리고 새롭에 insert 되는 문자열을 넣는다.
for (int j = 0; j != str.string_length; j++)
{
string_content[i + j] = str.string_content[j];
}
// 이제 다시 원 문자열의 나머지 뒷부분을 복사한다.
for (; i < string_length; i++)
{
string_content[str.string_length + i] = prev_string_content[i];
}
delete[] prev_string_content;
string_length = string_length + str.string_length;
return *this;
}
// 만일 초과하지 않는 경우 굳이 동적할당을 할 필요가 없게 된다.
// 효율적으로 insert 하기 위해, 밀리는 부분을 먼저 뒤로 밀어버린다.
for (int i = string_length - 1; i >= loc; i--)
{
// 뒤로 밀기. 이 때 원래의 문자열 데이터가 사라지지 않게 함
string_content[i + str.string_length] = string_content[i];
}
// 그리고 insert 되는 문자 다시 집어넣기
for (int i = 0; i < str.string_length; i++)
string_content[i + loc] = str.string_content[i];
string_length = string_length + str.string_length;
return *this;
}
MyString& MyString::insert(int loc, const char* str)
{
MyString temp(str);
return insert(loc, temp);
}
MyString& MyString::insert(int loc, char c)
{
MyString temp(c);
return insert(loc, temp);
}
MyString& MyString::erase(int loc, int num)
{
// loc 의 앞 부터 시작해서 num 문자를 지운다.
if (num < 0 || loc < 0 || loc > string_length) return *this;
// 지운다는 것은 단순히 뒤의 문자들을 앞으로 끌고 온다고
// 생각하면 됩니다.
//문제1
if (num + loc > string_length)
{
string_length = loc;
return *this;
}
for (int i = loc + num; i < string_length; i++)
{
string_content[i - num] = string_content[i];
}
string_length -= num;
return *this;
}
int MyString::find(int find_from, const MyString& str) const
{
int i, j;
if (str.string_length == 0) return -1;
for (i = find_from; i <= string_length - str.string_length; i++)
{
for (j = 0; j < str.string_length; j++)
{
if (string_content[i + j] != str.string_content[j]) break;
}
if (j == str.string_length) return i;
}
return -1; // 찾지 못했음
}
int MyString::find(int find_from, const char* str) const
{
MyString temp(str);
return find(find_from, temp);
}
int MyString::find(int find_from, char c) const
{
MyString temp(c);
return find(find_from, temp);
}
int MyString::compare(const MyString& str) const
{
// (*this) - (str) 을 수행해서 그 1, 0, -1 로 그 결과를 리턴한다
// 1 은 (*this) 가 사전식으로 더 뒤에 온다는 의미. 0 은 두 문자열
// 이 같다는 의미, -1 은 (*this) 가 사전식으로 더 앞에 온다는 의미이다.
for (int i = 0; i < std::min(string_length, str.string_length); i++)
{
if (string_content[i] > str.string_content[i])
return 1;
else if (string_content[i] < str.string_content[i])
return -1;
}
// 여기 까지 했는데 끝나지 않았다면 앞 부분 까지 모두 똑같은 것이 된다.
// 만일 문자열 길이가 같다면 두 문자열은 아예 같은 문자열이 된다.
if (string_length == str.string_length) return 0;
// 참고로 abc 와 abcd 의 크기 비교는 abcd 가 더 뒤에 오게 된다.
else if (string_length > str.string_length)
return 1;
return -1;
}
int main()
{
MyString str1("abcdef");
MyString str2("abcde");
str1.erase(2,10);
str1.println();
} |
SECTION code_sound_bit
PUBLIC _bitfx_2
EXTERN asm_bit_beep_raw
_bitfx_2:
; Strange squeak hl=300,de=2
; Game up hl=300,de=10 inc de
; - like a PACMAN sound
ld b,1
fx6_1:
push bc
ld de,10
ld hl,300
fx6_2:
push de
push hl
call asm_bit_beep_raw
pop hl
pop de
; inc de
ld bc,10
or a
sbc hl,bc
jr nc, fx6_2
pop bc
djnz fx6_1
scf
ret
|
;; @file
; Main routine of the pre-SEC code up through the jump into SEC.
;
; Copyright (c) 2008 - 2016, Intel Corporation. All rights reserved.<BR>
;
; This program and the accompanying materials
; are licensed and made available under the terms and conditions of the BSD License
; which accompanies this distribution. The full text of the license may be found at
; http://opensource.org/licenses/bsd-license.php.
;
; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED
;
;;
BITS 32
Main32:
;
; Search for the SEC entry point
;
OneTimeCall Flat32SearchForSecEntryPoint
;
; ESI - SEC Core entry point
; EBP - Start of BFV
;
;
; Restore initial EAX value into the EAX register
;
mov eax, esp
;
; Jump to the 32-bit SEC entry point
;
jmp esi
ALIGN 16
out 0x80, ax
jmp short Main32
ALIGN 16
Gigabytes:
|
/*
Converts hhp (HTML Help Workshop) files into cached
version for faster reading
Usage: hhp2cached file.hhp [file2.hhp ...]
*/
// For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif
#include "wx/html/helpdata.h"
class MyApp : public wxApp
{
public:
virtual bool OnInit();
};
IMPLEMENT_APP(MyApp);
bool MyApp::OnInit()
{
for (int i = 1; i < argc; i++)
{
wxHtmlHelpData data;
wxPrintf(wxT("Processing %s...\n"), argv[i]);
data.SetTempDir(wxPathOnly(argv[i]));
data.AddBook(argv[i]);
}
return false;
}
|
; 16 bit colour definitions V2.01 2000 Tony Tebby
section driver
xdef pt.palql
xdef pt.pal256
xdef pt.spxlw
xdef pt.rpxlw
xdef pt.samsk
pt.palql equ 8*2 ; size of QL palette
pt.pal256 equ 256*2 ; size of 256 colour palette
pt.spxlw equ 1 ; shift pixels to long word
pt.rpxlw equ 1 ; round up pixels to long word
pt.samsk equ $00000000 ; xy save area origin mask
end
|
; ************************************************************************* ;
; Organizacion del Computador II ;
; ;
; Implementacion de la funcion Merge 1 ;
; ;
; ************************************************************************* ;
; void ASM_merge1(uint32_t w, uint32_t h, uint8_t* data1, uint8_t* data2, float value)
; void ASM_merge1(uint32_t w, uint32_t h, uint8_t* data1, uint8_t* data2, float value)
global ASM_merge1
;value--> xmm0
section .data
uno: dd 1.0, 0.0, 0.0, 0.0
mask_ordenar: db 0x00, 0x04,0x08, 0x0c, 0x01, 0x05, 0x09, 0x0d, 0x02,0x06, 0x0a, 0x0e, 0x03, 0x07, 0x0b, 0x0f
section .text
ASM_merge1:
push rbp
mov rbp, rsp
push rbx
push r12
push r13
push r14
push r15
sub rsp, 8
mov r13, rdx ; r13 = data1
mov r14, rcx ; r14 = data2
;limpio parte alta
mov edi, edi
mov esi, esi
mov r12d, edi
mov r15d, esi
mov rax, r12
mul r15
shr rax, 2
xor r12, r12
mov r12, rax
xorps xmm5, xmm5
movss xmm1, xmm0
shufps xmm1, xmm1 , 00h ; xmm9 = value | value | value | value
mov r9d, 1
xorps xmm9, xmm9
cvtsi2ss xmm9, r9d ; xmm9 = 1
subss xmm9, xmm0 ; xmm9 = 1 - value
shufps xmm9, xmm9 , 00h ; xmm9 = 1-value | 1-value | 1-value | 1-value
movdqu xmm2, [mask_ordenar]
.ciclo:
movdqu xmm3, [r13] ;xmm3=b|g|r|a|b|g|r|a|b|g|r|a|b|g|r|a|
pshufb xmm3, xmm2 ;xmm3=b|b|b|b|g|g|g|g|r|r|r|r|a|a|a|a
movdqu xmm4, xmm3
punpcklbw xmm4, xmm5 ;xmm4 = 0r|0r|0r|0r|0a|0a|0a|0a
movdqu xmm6, xmm4
punpcklwd xmm4,xmm5 ; xmm4= 000a|000a|000a|000a|
punpckhwd xmm6,xmm5 ; xmm6= 000r|000r|000r|000r|
movdqu xmm7, xmm3
punpckhbw xmm7, xmm5 ;xmm7 = 0b|0b|0b|0b|0g|0g|0g|0g
movdqu xmm8, xmm7 ; los 8 numeros de la parte alta en 32 bit
punpcklwd xmm7,xmm5 ; xmm7= 000g|000g|000g|000g|
punpckhwd xmm8,xmm5 ; xmm8= 000b|000b|000b|000b|
cvtdq2ps xmm6,xmm6 ; convertimos a float
mulps xmm6,xmm1 ; multiplicamos por value
cvtdq2ps xmm7,xmm7 ; convertimos a float
mulps xmm7,xmm1 ; multiplicamos por value
cvtdq2ps xmm8,xmm8 ; convertimos a float
mulps xmm8,xmm1 ; multiplicamos por value
movdqu xmm10, [r14] ;xmm10=b|g|r|a|b|g|r|a|b|g|r|a|b|g|r|a|
pshufb xmm10, xmm2 ;xmm10=b|b|b|b|g|g|g|g|r|r|r|r|a|a|a|a
movdqu xmm11, xmm10
punpcklbw xmm11, xmm5 ;xmm11 = 0r|0r|0r|0r|0a|0a|0a|0a
movdqu xmm12, xmm11
punpckhwd xmm12,xmm5 ; xmm12= 000r|000r|000r|000r|
movdqu xmm13, xmm10
punpckhbw xmm13, xmm5 ;xmm13 = 0b|0b|0b|0b|0g|0g|0g|0g
movdqu xmm14, xmm13 ; los 8 numeros de la parte alta en 32 bit
punpcklwd xmm13,xmm5 ; xmm13= 000g|000g|000g|000g|
punpckhwd xmm14,xmm5 ; xmm14= 000b|000b|000b|000b|
cvtdq2ps xmm12,xmm12 ; convertimos a float
mulps xmm12,xmm9 ; multiplicamos por value
cvtdq2ps xmm13,xmm13 ; convertimos a float
mulps xmm13,xmm9 ; multiplicamos por 1-value
cvtdq2ps xmm14,xmm14 ; convertimos a float
mulps xmm14,xmm9 ; multiplicamos por value
addps xmm6, xmm12
addps xmm7, xmm13
addps xmm8, xmm14
; proceso de empaquetado:
; lo volvemos a convertir en enteros de 32
cvtps2dq xmm6, xmm6
cvtps2dq xmm7, xmm7
cvtps2dq xmm8, xmm8
packusdw xmm4, xmm6
packusdw xmm7, xmm8
packuswb xmm4, xmm7
pshufb xmm4, xmm2
movdqu [r13], xmm4
add r13, 16
add r14, 16
dec r12
cmp r12, 0
je .fin
jmp .ciclo
.fin:
add rsp, 8
pop r15
pop r14
pop r13
pop r12
pop rbx
pop rbp
ret
|
// Copyright (C) 2015 The Regents of the University of California (Regents).
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following
// disclaimer in the documentation and/or other materials provided
// with the distribution.
//
// * Neither the name of The Regents or University of California nor the
// names of its contributors may be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS 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.
//
// Please contact the author of this library if you have any questions.
// Author: Chris Sweeney (cmsweeney@cs.ucsb.edu)
#include "theia/sfm/global_pose_estimation/nonlinear_position_estimator.h"
#include <Eigen/Core>
#include <algorithm>
#include <ceres/ceres.h>
#include <ceres/rotation.h>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include "theia/sfm/global_pose_estimation/pairwise_translation_error.h"
#include "theia/sfm/reconstruction.h"
#include "theia/sfm/types.h"
#include "theia/util/map_util.h"
#include "theia/util/random.h"
#include "theia/util/util.h"
namespace theia {
namespace {
using Eigen::Matrix3d;
using Eigen::Vector3d;
Vector3d GetRotatedTranslation(const Vector3d& rotation_angle_axis,
const Vector3d& translation) {
Matrix3d rotation;
ceres::AngleAxisToRotationMatrix(
rotation_angle_axis.data(),
ceres::ColumnMajorAdapter3x3(rotation.data()));
return rotation.transpose() * translation;
}
Vector3d GetRotatedFeatureRay(const Camera& camera,
const Vector3d& orientation,
const Feature& feature) {
Camera temp_camera = camera;
temp_camera.SetOrientationFromAngleAxis(orientation);
// Get the image ray rotated into the world reference frame.
return camera.PixelToUnitDepthRay(feature.point_).normalized();
}
// Sorts the pairs such that the number of views (i.e. the int) is sorted in
// descending order.
bool CompareViewsPerTrack(const std::pair<TrackId, int>& t1,
const std::pair<TrackId, int>& t2) {
return t1.second > t2.second;
}
} // namespace
NonlinearPositionEstimator::NonlinearPositionEstimator(
const NonlinearPositionEstimator::Options& options,
const Reconstruction& reconstruction)
: options_(options), reconstruction_(reconstruction) {
CHECK_GT(options_.num_threads, 0);
CHECK_GE(options_.min_num_points_per_view, 0);
CHECK_GT(options_.point_to_camera_weight, 0);
CHECK_GT(options_.robust_loss_width, 0);
if (options_.rng.get() == nullptr) {
rng_ = std::make_shared<RandomNumberGenerator>();
} else {
rng_ = options_.rng;
}
}
bool NonlinearPositionEstimator::EstimatePositions(
const std::unordered_map<ViewIdPair, TwoViewInfo>& view_pairs,
const std::unordered_map<ViewId, Vector3d>& orientations,
std::unordered_map<ViewId, Vector3d>* positions) {
CHECK_NOTNULL(positions);
if (view_pairs.empty() || orientations.empty()) {
VLOG(2) << "Number of view_pairs = " << view_pairs.size()
<< " Number of orientations = " << orientations.size();
return false;
}
triangulated_points_.clear();
problem_.reset(new ceres::Problem());
view_pairs_ = &view_pairs;
// Iterative schur is only used if the problem is large enough, otherwise
// sparse schur is used.
static const int kMinNumCamerasForIterativeSolve = 1000;
// Initialize positions to be random.
InitializeRandomPositions(orientations, positions);
// Add the constraints to the problem.
AddCameraToCameraConstraints(orientations, positions);
if (options_.min_num_points_per_view > 0) {
AddPointToCameraConstraints(orientations, positions);
AddCamerasAndPointsToParameterGroups(positions);
}
// Set one camera to be at the origin to remove the ambiguity of the origin.
positions->begin()->second.setZero();
problem_->SetParameterBlockConstant(positions->begin()->second.data());
// Set the solver options.
ceres::Solver::Summary summary;
solver_options_.num_threads = options_.num_threads;
solver_options_.max_num_iterations = options_.max_num_iterations;
// Choose the type of linear solver. For sufficiently large problems, we want
// to use iterative methods (e.g., Conjugate Gradient or Iterative Schur);
// however, we only want to use a Schur solver if 3D points are used in the
// optimization.
if (positions->size() > kMinNumCamerasForIterativeSolve) {
if (options_.min_num_points_per_view > 0) {
solver_options_.linear_solver_type = ceres::ITERATIVE_SCHUR;
solver_options_.preconditioner_type = ceres::SCHUR_JACOBI;
} else {
solver_options_.linear_solver_type = ceres::CGNR;
solver_options_.preconditioner_type = ceres::JACOBI;
}
} else {
if (options_.min_num_points_per_view > 0) {
solver_options_.linear_solver_type = ceres::SPARSE_SCHUR;
} else {
solver_options_.linear_solver_type = ceres::SPARSE_NORMAL_CHOLESKY;
}
}
ceres::Solve(solver_options_, problem_.get(), &summary);
LOG(INFO) << summary.FullReport();
return summary.IsSolutionUsable();
}
void NonlinearPositionEstimator::InitializeRandomPositions(
const std::unordered_map<ViewId, Vector3d>& orientations,
std::unordered_map<ViewId, Vector3d>* positions) {
std::unordered_set<ViewId> constrained_positions;
constrained_positions.reserve(orientations.size());
for (const auto& view_pair : *view_pairs_) {
constrained_positions.insert(view_pair.first.first);
constrained_positions.insert(view_pair.first.second);
}
positions->reserve(orientations.size());
for (const auto& orientation : orientations) {
if (ContainsKey(constrained_positions, orientation.first)) {
(*positions)[orientation.first] = 100.0 * rng_->RandVector3d();
}
}
}
void NonlinearPositionEstimator::AddCameraToCameraConstraints(
const std::unordered_map<ViewId, Vector3d>& orientations,
std::unordered_map<ViewId, Vector3d>* positions) {
for (const auto& view_pair : *view_pairs_) {
const ViewId view_id1 = view_pair.first.first;
const ViewId view_id2 = view_pair.first.second;
Vector3d* position1 = FindOrNull(*positions, view_id1);
Vector3d* position2 = FindOrNull(*positions, view_id2);
// Do not add this view pair if one or both of the positions do not exist.
if (position1 == nullptr || position2 == nullptr) {
continue;
}
// Rotate the relative translation so that it is aligned to the global
// orientation frame.
const Vector3d translation_direction = GetRotatedTranslation(
FindOrDie(orientations, view_id1), view_pair.second.position_2);
ceres::CostFunction* cost_function =
PairwiseTranslationError::Create(translation_direction, 1.0);
problem_->AddResidualBlock(cost_function,
new ceres::HuberLoss(options_.robust_loss_width),
position1->data(),
position2->data());
}
VLOG(2) << problem_->NumResidualBlocks()
<< " camera to camera constraints "
"were added to the position "
"estimation problem.";
}
void NonlinearPositionEstimator::AddPointToCameraConstraints(
const std::unordered_map<ViewId, Eigen::Vector3d>& orientations,
std::unordered_map<ViewId, Eigen::Vector3d>* positions) {
const int num_camera_to_camera_constraints = problem_->NumResidualBlocks();
std::unordered_set<TrackId> tracks_to_add;
const int num_point_to_camera_constraints =
FindTracksForProblem(*positions, &tracks_to_add);
if (num_point_to_camera_constraints == 0) {
return;
}
const double point_to_camera_weight =
options_.point_to_camera_weight *
static_cast<double>(num_camera_to_camera_constraints) /
static_cast<double>(num_point_to_camera_constraints);
triangulated_points_.reserve(tracks_to_add.size());
for (const TrackId track_id : tracks_to_add) {
triangulated_points_[track_id] = 100.0 * rng_->RandVector3d();
AddTrackToProblem(
track_id, orientations, point_to_camera_weight, positions);
}
VLOG(2) << num_point_to_camera_constraints
<< " point to camera constriants "
"were added to the position "
"estimation problem.";
}
int NonlinearPositionEstimator::FindTracksForProblem(
const std::unordered_map<ViewId, Eigen::Vector3d>& positions,
std::unordered_set<TrackId>* tracks_to_add) {
CHECK_NOTNULL(tracks_to_add)->clear();
std::unordered_map<ViewId, int> tracks_per_camera;
for (const auto& position : positions) {
tracks_per_camera[position.first] = 0;
}
// Add the tracks that see the most views until each camera has the minimum
// number of tracks.
for (const auto& position : positions) {
const View* view = reconstruction_.View(position.first);
if (view == nullptr ||
view->NumFeatures() < options_.min_num_points_per_view) {
continue;
}
// Get the tracks in sorted order so that we add the tracks that see the
// most cameras first.
const std::vector<TrackId>& sorted_tracks =
GetTracksSortedByNumViews(reconstruction_, *view, *tracks_to_add);
for (int i = 0;
i < sorted_tracks.size() &&
tracks_per_camera[position.first] < options_.min_num_points_per_view;
i++) {
// Update the number of point to camera constraints for each camera.
tracks_to_add->insert(sorted_tracks[i]);
for (const ViewId view_id :
reconstruction_.Track(sorted_tracks[i])->ViewIds()) {
if (!ContainsKey(positions, view_id)) {
continue;
}
++tracks_per_camera[view_id];
}
}
}
int num_point_to_camera_constraints = 0;
for (const auto& tracks_in_camera : tracks_per_camera) {
num_point_to_camera_constraints += tracks_in_camera.second;
}
return num_point_to_camera_constraints;
}
std::vector<TrackId> NonlinearPositionEstimator::GetTracksSortedByNumViews(
const Reconstruction& reconstruction,
const View& view,
const std::unordered_set<TrackId>& existing_tracks) {
std::vector<std::pair<TrackId, int> > views_per_track;
views_per_track.reserve(view.NumFeatures());
const auto& track_ids = view.TrackIds();
for (const auto& track_id : track_ids) {
const Track* track = reconstruction.Track(track_id);
if (track == nullptr || ContainsKey(existing_tracks, track_id)) {
continue;
}
views_per_track.emplace_back(track_id, track->NumViews());
}
// Return an empty array if no tracks could be found for this view.
std::vector<TrackId> sorted_tracks(views_per_track.size());
if (views_per_track.size() == 0) {
return sorted_tracks;
}
// Sort the tracks by the number of views. Only sort the first few tracks
// since those are the ones that will be added to the problem.
const int num_tracks_to_sort =
std::min(static_cast<int>(views_per_track.size()),
options_.min_num_points_per_view);
std::partial_sort(views_per_track.begin(),
views_per_track.begin() + num_tracks_to_sort,
views_per_track.end(),
CompareViewsPerTrack);
for (int i = 0; i < num_tracks_to_sort; i++) {
sorted_tracks[i] = views_per_track[i].first;
}
return sorted_tracks;
}
void NonlinearPositionEstimator::AddTrackToProblem(
const TrackId track_id,
const std::unordered_map<ViewId, Vector3d>& orientations,
const double point_to_camera_weight,
std::unordered_map<ViewId, Vector3d>* positions) {
// For each view in the track add the point to camera correspondences.
for (const ViewId view_id : reconstruction_.Track(track_id)->ViewIds()) {
if (!ContainsKey(*positions, view_id)) {
continue;
}
Vector3d& camera_position = FindOrDie(*positions, view_id);
Vector3d& point = FindOrDie(triangulated_points_, track_id);
// Rotate the feature ray to be in the global orientation frame.
const Vector3d feature_ray = GetRotatedFeatureRay(
reconstruction_.View(view_id)->Camera(),
FindOrDie(orientations, view_id),
*reconstruction_.View(view_id)->GetFeature(track_id));
// Rotate the relative translation so that it is aligned to the global
// orientation frame.
ceres::CostFunction* cost_function =
PairwiseTranslationError::Create(feature_ray, point_to_camera_weight);
// Add the residual block
problem_->AddResidualBlock(cost_function,
new ceres::HuberLoss(options_.robust_loss_width),
camera_position.data(),
point.data());
}
}
void NonlinearPositionEstimator::AddCamerasAndPointsToParameterGroups(
std::unordered_map<ViewId, Vector3d>* positions) {
CHECK_GT(triangulated_points_.size(), 0)
<< "Cannot set the Ceres parameter groups for Schur based solvers "
"because there are no triangulated points.";
// Create a custom ordering for Schur-based problems.
solver_options_.linear_solver_ordering.reset(
new ceres::ParameterBlockOrdering);
ceres::ParameterBlockOrdering* parameter_ordering =
solver_options_.linear_solver_ordering.get();
// Add point parameters to group 0.
for (auto& point : triangulated_points_) {
parameter_ordering->AddElementToGroup(point.second.data(), 0);
}
// Add camera parameters to group 1.
for (auto& position : *positions) {
parameter_ordering->AddElementToGroup(position.second.data(), 1);
}
}
std::unordered_map<ViewId, Eigen::Vector3d> NonlinearPositionEstimator::EstimatePositionsWrapper(
const std::unordered_map<ViewIdPair, TwoViewInfo>& view_pairs,
const std::unordered_map<ViewId, Eigen::Vector3d>& orientation) {
std::unordered_map<ViewId, Eigen::Vector3d> positions;
EstimatePositions(view_pairs, orientation, &positions);
return positions;
}
} // namespace theia
|
; A183293: Complement of A056000.
; 1,2,3,4,6,7,8,9,10,12,13,14,15,16,17,19,20,21,22,23,24,25,27,28,29,30,31,32,33,34,36,37,38,39,40,41,42,43,44,46,47,48,49,50,51,52,53,54,55,57,58,59,60,61,62,63,64,65,66,67,69,70,71,72,73,74,75,76,77,78,79,80,82,83,84,85,86,87,88,89
mov $1,$0
add $0,1
lpb $0
add $1,1
add $2,1
sub $0,$2
trn $0,3
lpe
|
;;
;; Copyright (c) 2018, Intel Corporation
;;
;; Redistribution and use in source and binary forms, with or without
;; modification, are permitted provided that the following conditions are met:
;;
;; * Redistributions of source code must retain the above copyright notice,
;; this list of conditions and the following disclaimer.
;; * Redistributions in binary form must reproduce the above copyright
;; notice, this list of conditions and the following disclaimer in the
;; documentation and/or other materials provided with the distribution.
;; * Neither the name of Intel Corporation nor the names of its contributors
;; may be used to endorse or promote products derived from this software
;; without specific prior written permission.
;;
;; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
;; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
;; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
;; DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
;; FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
;; SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
;; CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
;; OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
;; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
;;
%include "include/os.asm"
section .data
default rel
MKGLOBAL(len_shift_tab,data,internal)
MKGLOBAL(len_mask_tab,data,internal)
MKGLOBAL(padding_0x80_tab16,data,internal)
;;; The following tables are used to insert a word into
;;; a SIMD register and must be defined together.
;;; If resized, update len_tab_diff definition in const.inc module.
;;; Other modifications may require updates to dependant modules.
;;; Table used to shuffle word to correct index
;;; Used by macros:
;;; - PINSRW_COMMON
;;; - XPINSRW
;;; - XVPINSRW
align 16
len_shift_tab:
db 0x00, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
db 0xff, 0xff, 0x00, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
db 0xff, 0xff, 0xff, 0xff, 0x00, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
db 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
db 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
db 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x01, 0xff, 0xff, 0xff, 0xff,
db 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x01, 0xff, 0xff,
db 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x01
;;; Table used to zero index
align 16
len_mask_tab:
dw 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
dw 0xffff, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
dw 0xffff, 0xffff, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
dw 0xffff, 0xffff, 0xffff, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff,
dw 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0xffff, 0xffff, 0xffff,
dw 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0xffff, 0xffff,
dw 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0xffff,
dw 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000
;;; Table to do 0x80 byte shift for padding prefix
align 16
padding_0x80_tab16:
db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
db 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
%ifdef LINUX
section .note.GNU-stack noalloc noexec nowrite progbits
%endif
|
/* Copyright 2017 The TensorFlow Authors. All Rights Reserved.
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 "tensorflow/compiler/xla/service/gpu/stream_assignment.h"
#include "tensorflow/compiler/xla/map_util.h"
#include "tensorflow/compiler/xla/ptr_util.h"
#include "tensorflow/compiler/xla/service/gpu/ir_emission_utils.h"
#include "tensorflow/compiler/xla/service/hlo_computation.h"
#include "tensorflow/compiler/xla/service/hlo_reachability.h"
namespace xla {
namespace gpu {
bool StreamAssignment::HasStreamAssigned(const HloInstruction& hlo) const {
return hlo_to_stream_number_.count(&hlo);
}
int StreamAssignment::StreamNumberForHlo(const HloInstruction& hlo) const {
return FindOrDie(hlo_to_stream_number_, &hlo);
}
void StreamAssignment::AssignStreamToHlo(const HloInstruction* hlo,
int stream_num) {
CHECK_GE(stream_num, 0);
if (stream_num >= stream_count_) {
stream_count_ = stream_num + 1;
}
InsertOrDie(&hlo_to_stream_number_, hlo, stream_num);
VLOG(2) << "Assign stream #" << stream_num << " to " << hlo->ToString();
}
namespace {
// Returns whether the two HLOs can run concurrently, i.e., neither is a
// transitive consumer of the other.
bool CanRunConcurrently(const HloInstruction& a, const HloInstruction& b,
const HloReachabilityMap& reachability) {
return !reachability.IsConnected(&a, &b);
}
constexpr int kInvalidStreamNum = -1;
// Returns true iff `stream_num` is an invalid stream number.
inline bool IsStreamNumValid(int stream_num) {
return stream_num != kInvalidStreamNum;
}
// Returns which existing stream to assign to `hlo`, or -1 if a stream is not
// needed. `stream_assignment` is the existing stream assignment for all
// instructions topologically before `hlo`. `seen_gemms` contains all GEMMs that
// are topologically before `hlo`.
int ComputeStreamToAssign(
const HloInstruction& hlo, const StreamAssignment& stream_assignment,
const HloReachabilityMap& reachability,
const std::vector<const HloInstruction*>& seen_gemms) {
if (hlo.opcode() == HloOpcode::kParameter ||
hlo.opcode() == HloOpcode::kConstant) {
// kParameter and kConstant do not need a thunk.
return kInvalidStreamNum;
}
if (hlo.GetModule()
->config()
.debug_options()
.xla_gpu_disable_multi_streaming()) {
return 0;
}
if (!ImplementedAsGemm(hlo)) {
// If `hlo` is not implemented as a GEMM, keep it close to its operands to
// avoid excessive synchronization.
int stream_num = -1;
for (const auto* operand : hlo.operands()) {
if (stream_assignment.HasStreamAssigned(*operand)) {
stream_num = std::max(stream_num,
stream_assignment.StreamNumberForHlo(*operand));
}
}
if (!IsStreamNumValid(stream_num)) {
stream_num = 0;
}
return stream_num;
}
// Assign different streams to concurrent GEMMs. The code below uses a
// greedy approach. First, we compute as forbidden_stream_numbers the
// streams assigned to GEMMs that are concurrent with `hlo`. Then, we assign
// `hlo` a different stream.
std::set<int> forbidden_stream_numbers;
for (const auto* seen_gemm : seen_gemms) {
int stream_num = stream_assignment.StreamNumberForHlo(*seen_gemm);
if (!forbidden_stream_numbers.count(stream_num) &&
CanRunConcurrently(*seen_gemm, hlo, reachability)) {
forbidden_stream_numbers.insert(stream_num);
}
}
for (int stream_num = 0; stream_num < stream_assignment.StreamCount();
++stream_num) {
if (!forbidden_stream_numbers.count(stream_num)) {
return stream_num;
}
}
return stream_assignment.StreamCount();
}
} // namespace
std::unique_ptr<StreamAssignment> AssignStreams(const HloModule& module) {
auto stream_assignment = MakeUnique<StreamAssignment>();
const HloComputation& computation = *module.entry_computation();
std::unique_ptr<HloReachabilityMap> reachability =
computation.ComputeReachability();
std::vector<const HloInstruction*> seen_gemms;
// The execution of different RNG Hlo instructions in the same module updates
// a common global variable. To avoid a race condition, we simply assign all
// RNG kernels to the same stream to make them run sequentially.
//
// TODO(b/111791052): If we remove such a common variable, we will need to
// clean up the code here.
int stream_num_for_rng = kInvalidStreamNum;
for (const auto* hlo : computation.MakeInstructionPostOrder()) {
// If we ever enable fusion of RNG instructions, we will need to extend this
// code to look inside a fused instruction.
int stream_num = (hlo->opcode() == HloOpcode::kRng &&
IsStreamNumValid(stream_num_for_rng))
? stream_num_for_rng
: ComputeStreamToAssign(*hlo, *stream_assignment,
*reachability, seen_gemms);
if (IsStreamNumValid(stream_num)) {
stream_assignment->AssignStreamToHlo(hlo, stream_num);
if (hlo->opcode() == HloOpcode::kRng &&
!IsStreamNumValid(stream_num_for_rng)) {
stream_num_for_rng = stream_num;
}
}
if (ImplementedAsGemm(*hlo)) {
seen_gemms.push_back(hlo);
}
}
return stream_assignment;
}
} // namespace gpu
} // namespace xla
|
; void sp1_MoveSprAbs(struct sp1_ss *s, struct sp1_Rect *clip, uchar *frame, uchar row, uchar col, uchar vrot, uchar hrot)
SECTION code_clib
SECTION code_temp_sp1
PUBLIC _sp1_MoveSprAbs
EXTERN l0_sp1_MoveSprAbs_callee
_sp1_MoveSprAbs:
ld hl,2
add hl,sp
ld e,(hl)
inc hl
ld d,(hl)
inc hl
push de
ld e,(hl)
inc hl
ld d,(hl)
inc hl
push de
ld e,(hl)
inc hl
ld d,(hl)
inc hl
push de
ld d,(hl)
inc hl
inc hl
ld e,(hl)
inc hl
inc hl
ld c,(hl)
inc hl
inc hl
ld b,(hl)
pop hl
pop iy
jp l0_sp1_MoveSprAbs_callee
|
; A084059: a(n) = 4*a(n-1) + 2*a(n-2) for n>1, a(0)=1, a(1)=2.
; 1,2,10,44,196,872,3880,17264,76816,341792,1520800,6766784,30108736,133968512,596091520,2652303104,11801395456,52510188032,233643543040,1039594548224,4625665278976,20581850212352,91578731407360,407478626054144,1813071967031296,8067245120233472,35895124414996480,159714987900452864,710650200431804416,3162030777528123392,14069423510976102400,62601755598960656384,278545869417794830336,1239386988869100634112,5514639694311992197120,24537332754986170056704,109178610408568664621056,485789107144246998597632,2161513649394125323632640,9617632811864995291725824,42793558546248231814168576,190409499808722917840125952,847225116327388134988840960,3769719464926998375635615744,16773328092362769772520144896,74632751299305075841351811072,332077661381945842910447534080,1477576148126393523324493758464,6574459915269465779118870102016,29252991957330650163124467924992,130160887659861532210735611904000,579149534554107429169191383465984,2576919913536152781098236757671936,11465978723252825982731329797619712,51017754720083609493121792705822720,227002976326840089937949830418530304
mov $1,1
mov $3,1
lpb $0
sub $0,1
add $2,$3
mul $2,2
mov $3,$1
mov $1,$2
mul $2,2
lpe
mov $0,$1
|
_setgid: file format elf32-i386
Disassembly of section .text:
00000000 <main>:
#include "types.h"
#include "user.h"
int
main(int argc, char *argv[])
{
0: 55 push %ebp
1: 89 e5 mov %esp,%ebp
3: 83 e4 f0 and $0xfffffff0,%esp
exit();
6: e8 68 02 00 00 call 273 <exit>
0000000b <stosb>:
"cc");
}
static inline void
stosb(void *addr, int data, int cnt)
{
b: 55 push %ebp
c: 89 e5 mov %esp,%ebp
e: 57 push %edi
f: 53 push %ebx
asm volatile("cld; rep stosb" :
10: 8b 4d 08 mov 0x8(%ebp),%ecx
13: 8b 55 10 mov 0x10(%ebp),%edx
16: 8b 45 0c mov 0xc(%ebp),%eax
19: 89 cb mov %ecx,%ebx
1b: 89 df mov %ebx,%edi
1d: 89 d1 mov %edx,%ecx
1f: fc cld
20: f3 aa rep stos %al,%es:(%edi)
22: 89 ca mov %ecx,%edx
24: 89 fb mov %edi,%ebx
26: 89 5d 08 mov %ebx,0x8(%ebp)
29: 89 55 10 mov %edx,0x10(%ebp)
"=D" (addr), "=c" (cnt) :
"0" (addr), "1" (cnt), "a" (data) :
"memory", "cc");
}
2c: 5b pop %ebx
2d: 5f pop %edi
2e: 5d pop %ebp
2f: c3 ret
00000030 <strcpy>:
#include "user.h"
#include "x86.h"
char*
strcpy(char *s, char *t)
{
30: 55 push %ebp
31: 89 e5 mov %esp,%ebp
33: 83 ec 10 sub $0x10,%esp
char *os;
os = s;
36: 8b 45 08 mov 0x8(%ebp),%eax
39: 89 45 fc mov %eax,-0x4(%ebp)
while((*s++ = *t++) != 0)
3c: 90 nop
3d: 8b 45 08 mov 0x8(%ebp),%eax
40: 8d 50 01 lea 0x1(%eax),%edx
43: 89 55 08 mov %edx,0x8(%ebp)
46: 8b 55 0c mov 0xc(%ebp),%edx
49: 8d 4a 01 lea 0x1(%edx),%ecx
4c: 89 4d 0c mov %ecx,0xc(%ebp)
4f: 0f b6 12 movzbl (%edx),%edx
52: 88 10 mov %dl,(%eax)
54: 0f b6 00 movzbl (%eax),%eax
57: 84 c0 test %al,%al
59: 75 e2 jne 3d <strcpy+0xd>
;
return os;
5b: 8b 45 fc mov -0x4(%ebp),%eax
}
5e: c9 leave
5f: c3 ret
00000060 <strcmp>:
int
strcmp(const char *p, const char *q)
{
60: 55 push %ebp
61: 89 e5 mov %esp,%ebp
while(*p && *p == *q)
63: eb 08 jmp 6d <strcmp+0xd>
p++, q++;
65: 83 45 08 01 addl $0x1,0x8(%ebp)
69: 83 45 0c 01 addl $0x1,0xc(%ebp)
}
int
strcmp(const char *p, const char *q)
{
while(*p && *p == *q)
6d: 8b 45 08 mov 0x8(%ebp),%eax
70: 0f b6 00 movzbl (%eax),%eax
73: 84 c0 test %al,%al
75: 74 10 je 87 <strcmp+0x27>
77: 8b 45 08 mov 0x8(%ebp),%eax
7a: 0f b6 10 movzbl (%eax),%edx
7d: 8b 45 0c mov 0xc(%ebp),%eax
80: 0f b6 00 movzbl (%eax),%eax
83: 38 c2 cmp %al,%dl
85: 74 de je 65 <strcmp+0x5>
p++, q++;
return (uchar)*p - (uchar)*q;
87: 8b 45 08 mov 0x8(%ebp),%eax
8a: 0f b6 00 movzbl (%eax),%eax
8d: 0f b6 d0 movzbl %al,%edx
90: 8b 45 0c mov 0xc(%ebp),%eax
93: 0f b6 00 movzbl (%eax),%eax
96: 0f b6 c0 movzbl %al,%eax
99: 29 c2 sub %eax,%edx
9b: 89 d0 mov %edx,%eax
}
9d: 5d pop %ebp
9e: c3 ret
0000009f <strlen>:
uint
strlen(char *s)
{
9f: 55 push %ebp
a0: 89 e5 mov %esp,%ebp
a2: 83 ec 10 sub $0x10,%esp
int n;
for(n = 0; s[n]; n++)
a5: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp)
ac: eb 04 jmp b2 <strlen+0x13>
ae: 83 45 fc 01 addl $0x1,-0x4(%ebp)
b2: 8b 55 fc mov -0x4(%ebp),%edx
b5: 8b 45 08 mov 0x8(%ebp),%eax
b8: 01 d0 add %edx,%eax
ba: 0f b6 00 movzbl (%eax),%eax
bd: 84 c0 test %al,%al
bf: 75 ed jne ae <strlen+0xf>
;
return n;
c1: 8b 45 fc mov -0x4(%ebp),%eax
}
c4: c9 leave
c5: c3 ret
000000c6 <memset>:
void*
memset(void *dst, int c, uint n)
{
c6: 55 push %ebp
c7: 89 e5 mov %esp,%ebp
c9: 83 ec 0c sub $0xc,%esp
stosb(dst, c, n);
cc: 8b 45 10 mov 0x10(%ebp),%eax
cf: 89 44 24 08 mov %eax,0x8(%esp)
d3: 8b 45 0c mov 0xc(%ebp),%eax
d6: 89 44 24 04 mov %eax,0x4(%esp)
da: 8b 45 08 mov 0x8(%ebp),%eax
dd: 89 04 24 mov %eax,(%esp)
e0: e8 26 ff ff ff call b <stosb>
return dst;
e5: 8b 45 08 mov 0x8(%ebp),%eax
}
e8: c9 leave
e9: c3 ret
000000ea <strchr>:
char*
strchr(const char *s, char c)
{
ea: 55 push %ebp
eb: 89 e5 mov %esp,%ebp
ed: 83 ec 04 sub $0x4,%esp
f0: 8b 45 0c mov 0xc(%ebp),%eax
f3: 88 45 fc mov %al,-0x4(%ebp)
for(; *s; s++)
f6: eb 14 jmp 10c <strchr+0x22>
if(*s == c)
f8: 8b 45 08 mov 0x8(%ebp),%eax
fb: 0f b6 00 movzbl (%eax),%eax
fe: 3a 45 fc cmp -0x4(%ebp),%al
101: 75 05 jne 108 <strchr+0x1e>
return (char*)s;
103: 8b 45 08 mov 0x8(%ebp),%eax
106: eb 13 jmp 11b <strchr+0x31>
}
char*
strchr(const char *s, char c)
{
for(; *s; s++)
108: 83 45 08 01 addl $0x1,0x8(%ebp)
10c: 8b 45 08 mov 0x8(%ebp),%eax
10f: 0f b6 00 movzbl (%eax),%eax
112: 84 c0 test %al,%al
114: 75 e2 jne f8 <strchr+0xe>
if(*s == c)
return (char*)s;
return 0;
116: b8 00 00 00 00 mov $0x0,%eax
}
11b: c9 leave
11c: c3 ret
0000011d <gets>:
char*
gets(char *buf, int max)
{
11d: 55 push %ebp
11e: 89 e5 mov %esp,%ebp
120: 83 ec 28 sub $0x28,%esp
int i, cc;
char c;
for(i=0; i+1 < max; ){
123: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
12a: eb 4c jmp 178 <gets+0x5b>
cc = read(0, &c, 1);
12c: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
133: 00
134: 8d 45 ef lea -0x11(%ebp),%eax
137: 89 44 24 04 mov %eax,0x4(%esp)
13b: c7 04 24 00 00 00 00 movl $0x0,(%esp)
142: e8 44 01 00 00 call 28b <read>
147: 89 45 f0 mov %eax,-0x10(%ebp)
if(cc < 1)
14a: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
14e: 7f 02 jg 152 <gets+0x35>
break;
150: eb 31 jmp 183 <gets+0x66>
buf[i++] = c;
152: 8b 45 f4 mov -0xc(%ebp),%eax
155: 8d 50 01 lea 0x1(%eax),%edx
158: 89 55 f4 mov %edx,-0xc(%ebp)
15b: 89 c2 mov %eax,%edx
15d: 8b 45 08 mov 0x8(%ebp),%eax
160: 01 c2 add %eax,%edx
162: 0f b6 45 ef movzbl -0x11(%ebp),%eax
166: 88 02 mov %al,(%edx)
if(c == '\n' || c == '\r')
168: 0f b6 45 ef movzbl -0x11(%ebp),%eax
16c: 3c 0a cmp $0xa,%al
16e: 74 13 je 183 <gets+0x66>
170: 0f b6 45 ef movzbl -0x11(%ebp),%eax
174: 3c 0d cmp $0xd,%al
176: 74 0b je 183 <gets+0x66>
gets(char *buf, int max)
{
int i, cc;
char c;
for(i=0; i+1 < max; ){
178: 8b 45 f4 mov -0xc(%ebp),%eax
17b: 83 c0 01 add $0x1,%eax
17e: 3b 45 0c cmp 0xc(%ebp),%eax
181: 7c a9 jl 12c <gets+0xf>
break;
buf[i++] = c;
if(c == '\n' || c == '\r')
break;
}
buf[i] = '\0';
183: 8b 55 f4 mov -0xc(%ebp),%edx
186: 8b 45 08 mov 0x8(%ebp),%eax
189: 01 d0 add %edx,%eax
18b: c6 00 00 movb $0x0,(%eax)
return buf;
18e: 8b 45 08 mov 0x8(%ebp),%eax
}
191: c9 leave
192: c3 ret
00000193 <stat>:
int
stat(char *n, struct stat *st)
{
193: 55 push %ebp
194: 89 e5 mov %esp,%ebp
196: 83 ec 28 sub $0x28,%esp
int fd;
int r;
fd = open(n, O_RDONLY);
199: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
1a0: 00
1a1: 8b 45 08 mov 0x8(%ebp),%eax
1a4: 89 04 24 mov %eax,(%esp)
1a7: e8 07 01 00 00 call 2b3 <open>
1ac: 89 45 f4 mov %eax,-0xc(%ebp)
if(fd < 0)
1af: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
1b3: 79 07 jns 1bc <stat+0x29>
return -1;
1b5: b8 ff ff ff ff mov $0xffffffff,%eax
1ba: eb 23 jmp 1df <stat+0x4c>
r = fstat(fd, st);
1bc: 8b 45 0c mov 0xc(%ebp),%eax
1bf: 89 44 24 04 mov %eax,0x4(%esp)
1c3: 8b 45 f4 mov -0xc(%ebp),%eax
1c6: 89 04 24 mov %eax,(%esp)
1c9: e8 fd 00 00 00 call 2cb <fstat>
1ce: 89 45 f0 mov %eax,-0x10(%ebp)
close(fd);
1d1: 8b 45 f4 mov -0xc(%ebp),%eax
1d4: 89 04 24 mov %eax,(%esp)
1d7: e8 bf 00 00 00 call 29b <close>
return r;
1dc: 8b 45 f0 mov -0x10(%ebp),%eax
}
1df: c9 leave
1e0: c3 ret
000001e1 <atoi>:
int
atoi(const char *s)
{
1e1: 55 push %ebp
1e2: 89 e5 mov %esp,%ebp
1e4: 83 ec 10 sub $0x10,%esp
int n;
n = 0;
1e7: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp)
while('0' <= *s && *s <= '9')
1ee: eb 25 jmp 215 <atoi+0x34>
n = n*10 + *s++ - '0';
1f0: 8b 55 fc mov -0x4(%ebp),%edx
1f3: 89 d0 mov %edx,%eax
1f5: c1 e0 02 shl $0x2,%eax
1f8: 01 d0 add %edx,%eax
1fa: 01 c0 add %eax,%eax
1fc: 89 c1 mov %eax,%ecx
1fe: 8b 45 08 mov 0x8(%ebp),%eax
201: 8d 50 01 lea 0x1(%eax),%edx
204: 89 55 08 mov %edx,0x8(%ebp)
207: 0f b6 00 movzbl (%eax),%eax
20a: 0f be c0 movsbl %al,%eax
20d: 01 c8 add %ecx,%eax
20f: 83 e8 30 sub $0x30,%eax
212: 89 45 fc mov %eax,-0x4(%ebp)
atoi(const char *s)
{
int n;
n = 0;
while('0' <= *s && *s <= '9')
215: 8b 45 08 mov 0x8(%ebp),%eax
218: 0f b6 00 movzbl (%eax),%eax
21b: 3c 2f cmp $0x2f,%al
21d: 7e 0a jle 229 <atoi+0x48>
21f: 8b 45 08 mov 0x8(%ebp),%eax
222: 0f b6 00 movzbl (%eax),%eax
225: 3c 39 cmp $0x39,%al
227: 7e c7 jle 1f0 <atoi+0xf>
n = n*10 + *s++ - '0';
return n;
229: 8b 45 fc mov -0x4(%ebp),%eax
}
22c: c9 leave
22d: c3 ret
0000022e <memmove>:
void*
memmove(void *vdst, void *vsrc, int n)
{
22e: 55 push %ebp
22f: 89 e5 mov %esp,%ebp
231: 83 ec 10 sub $0x10,%esp
char *dst, *src;
dst = vdst;
234: 8b 45 08 mov 0x8(%ebp),%eax
237: 89 45 fc mov %eax,-0x4(%ebp)
src = vsrc;
23a: 8b 45 0c mov 0xc(%ebp),%eax
23d: 89 45 f8 mov %eax,-0x8(%ebp)
while(n-- > 0)
240: eb 17 jmp 259 <memmove+0x2b>
*dst++ = *src++;
242: 8b 45 fc mov -0x4(%ebp),%eax
245: 8d 50 01 lea 0x1(%eax),%edx
248: 89 55 fc mov %edx,-0x4(%ebp)
24b: 8b 55 f8 mov -0x8(%ebp),%edx
24e: 8d 4a 01 lea 0x1(%edx),%ecx
251: 89 4d f8 mov %ecx,-0x8(%ebp)
254: 0f b6 12 movzbl (%edx),%edx
257: 88 10 mov %dl,(%eax)
{
char *dst, *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
259: 8b 45 10 mov 0x10(%ebp),%eax
25c: 8d 50 ff lea -0x1(%eax),%edx
25f: 89 55 10 mov %edx,0x10(%ebp)
262: 85 c0 test %eax,%eax
264: 7f dc jg 242 <memmove+0x14>
*dst++ = *src++;
return vdst;
266: 8b 45 08 mov 0x8(%ebp),%eax
}
269: c9 leave
26a: c3 ret
0000026b <fork>:
name: \
movl $SYS_ ## name, %eax; \
int $T_SYSCALL; \
ret
SYSCALL(fork)
26b: b8 01 00 00 00 mov $0x1,%eax
270: cd 40 int $0x40
272: c3 ret
00000273 <exit>:
SYSCALL(exit)
273: b8 02 00 00 00 mov $0x2,%eax
278: cd 40 int $0x40
27a: c3 ret
0000027b <wait>:
SYSCALL(wait)
27b: b8 03 00 00 00 mov $0x3,%eax
280: cd 40 int $0x40
282: c3 ret
00000283 <pipe>:
SYSCALL(pipe)
283: b8 04 00 00 00 mov $0x4,%eax
288: cd 40 int $0x40
28a: c3 ret
0000028b <read>:
SYSCALL(read)
28b: b8 05 00 00 00 mov $0x5,%eax
290: cd 40 int $0x40
292: c3 ret
00000293 <write>:
SYSCALL(write)
293: b8 10 00 00 00 mov $0x10,%eax
298: cd 40 int $0x40
29a: c3 ret
0000029b <close>:
SYSCALL(close)
29b: b8 15 00 00 00 mov $0x15,%eax
2a0: cd 40 int $0x40
2a2: c3 ret
000002a3 <kill>:
SYSCALL(kill)
2a3: b8 06 00 00 00 mov $0x6,%eax
2a8: cd 40 int $0x40
2aa: c3 ret
000002ab <exec>:
SYSCALL(exec)
2ab: b8 07 00 00 00 mov $0x7,%eax
2b0: cd 40 int $0x40
2b2: c3 ret
000002b3 <open>:
SYSCALL(open)
2b3: b8 0f 00 00 00 mov $0xf,%eax
2b8: cd 40 int $0x40
2ba: c3 ret
000002bb <mknod>:
SYSCALL(mknod)
2bb: b8 11 00 00 00 mov $0x11,%eax
2c0: cd 40 int $0x40
2c2: c3 ret
000002c3 <unlink>:
SYSCALL(unlink)
2c3: b8 12 00 00 00 mov $0x12,%eax
2c8: cd 40 int $0x40
2ca: c3 ret
000002cb <fstat>:
SYSCALL(fstat)
2cb: b8 08 00 00 00 mov $0x8,%eax
2d0: cd 40 int $0x40
2d2: c3 ret
000002d3 <link>:
SYSCALL(link)
2d3: b8 13 00 00 00 mov $0x13,%eax
2d8: cd 40 int $0x40
2da: c3 ret
000002db <mkdir>:
SYSCALL(mkdir)
2db: b8 14 00 00 00 mov $0x14,%eax
2e0: cd 40 int $0x40
2e2: c3 ret
000002e3 <chdir>:
SYSCALL(chdir)
2e3: b8 09 00 00 00 mov $0x9,%eax
2e8: cd 40 int $0x40
2ea: c3 ret
000002eb <dup>:
SYSCALL(dup)
2eb: b8 0a 00 00 00 mov $0xa,%eax
2f0: cd 40 int $0x40
2f2: c3 ret
000002f3 <getpid>:
SYSCALL(getpid)
2f3: b8 0b 00 00 00 mov $0xb,%eax
2f8: cd 40 int $0x40
2fa: c3 ret
000002fb <sbrk>:
SYSCALL(sbrk)
2fb: b8 0c 00 00 00 mov $0xc,%eax
300: cd 40 int $0x40
302: c3 ret
00000303 <sleep>:
SYSCALL(sleep)
303: b8 0d 00 00 00 mov $0xd,%eax
308: cd 40 int $0x40
30a: c3 ret
0000030b <uptime>:
SYSCALL(uptime)
30b: b8 0e 00 00 00 mov $0xe,%eax
310: cd 40 int $0x40
312: c3 ret
00000313 <date>:
SYSCALL(date)
313: b8 16 00 00 00 mov $0x16,%eax
318: cd 40 int $0x40
31a: c3 ret
0000031b <timem>:
SYSCALL(timem)
31b: b8 17 00 00 00 mov $0x17,%eax
320: cd 40 int $0x40
322: c3 ret
00000323 <getuid>:
SYSCALL(getuid)
323: b8 18 00 00 00 mov $0x18,%eax
328: cd 40 int $0x40
32a: c3 ret
0000032b <getgid>:
SYSCALL(getgid)
32b: b8 19 00 00 00 mov $0x19,%eax
330: cd 40 int $0x40
332: c3 ret
00000333 <getppid>:
SYSCALL(getppid)
333: b8 1a 00 00 00 mov $0x1a,%eax
338: cd 40 int $0x40
33a: c3 ret
0000033b <setuid>:
SYSCALL(setuid)
33b: b8 1b 00 00 00 mov $0x1b,%eax
340: cd 40 int $0x40
342: c3 ret
00000343 <setgid>:
SYSCALL(setgid)
343: b8 1c 00 00 00 mov $0x1c,%eax
348: cd 40 int $0x40
34a: c3 ret
0000034b <getprocs>:
SYSCALL(getprocs)
34b: b8 1d 00 00 00 mov $0x1d,%eax
350: cd 40 int $0x40
352: c3 ret
00000353 <setpriority>:
SYSCALL(setpriority)
353: b8 1e 00 00 00 mov $0x1e,%eax
358: cd 40 int $0x40
35a: c3 ret
0000035b <putc>:
#include "stat.h"
#include "user.h"
static void
putc(int fd, char c)
{
35b: 55 push %ebp
35c: 89 e5 mov %esp,%ebp
35e: 83 ec 18 sub $0x18,%esp
361: 8b 45 0c mov 0xc(%ebp),%eax
364: 88 45 f4 mov %al,-0xc(%ebp)
write(fd, &c, 1);
367: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
36e: 00
36f: 8d 45 f4 lea -0xc(%ebp),%eax
372: 89 44 24 04 mov %eax,0x4(%esp)
376: 8b 45 08 mov 0x8(%ebp),%eax
379: 89 04 24 mov %eax,(%esp)
37c: e8 12 ff ff ff call 293 <write>
}
381: c9 leave
382: c3 ret
00000383 <printint>:
static void
printint(int fd, int xx, int base, int sgn)
{
383: 55 push %ebp
384: 89 e5 mov %esp,%ebp
386: 56 push %esi
387: 53 push %ebx
388: 83 ec 30 sub $0x30,%esp
static char digits[] = "0123456789ABCDEF";
char buf[16];
int i, neg;
uint x;
neg = 0;
38b: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
if(sgn && xx < 0){
392: 83 7d 14 00 cmpl $0x0,0x14(%ebp)
396: 74 17 je 3af <printint+0x2c>
398: 83 7d 0c 00 cmpl $0x0,0xc(%ebp)
39c: 79 11 jns 3af <printint+0x2c>
neg = 1;
39e: c7 45 f0 01 00 00 00 movl $0x1,-0x10(%ebp)
x = -xx;
3a5: 8b 45 0c mov 0xc(%ebp),%eax
3a8: f7 d8 neg %eax
3aa: 89 45 ec mov %eax,-0x14(%ebp)
3ad: eb 06 jmp 3b5 <printint+0x32>
} else {
x = xx;
3af: 8b 45 0c mov 0xc(%ebp),%eax
3b2: 89 45 ec mov %eax,-0x14(%ebp)
}
i = 0;
3b5: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
do{
buf[i++] = digits[x % base];
3bc: 8b 4d f4 mov -0xc(%ebp),%ecx
3bf: 8d 41 01 lea 0x1(%ecx),%eax
3c2: 89 45 f4 mov %eax,-0xc(%ebp)
3c5: 8b 5d 10 mov 0x10(%ebp),%ebx
3c8: 8b 45 ec mov -0x14(%ebp),%eax
3cb: ba 00 00 00 00 mov $0x0,%edx
3d0: f7 f3 div %ebx
3d2: 89 d0 mov %edx,%eax
3d4: 0f b6 80 54 0a 00 00 movzbl 0xa54(%eax),%eax
3db: 88 44 0d dc mov %al,-0x24(%ebp,%ecx,1)
}while((x /= base) != 0);
3df: 8b 75 10 mov 0x10(%ebp),%esi
3e2: 8b 45 ec mov -0x14(%ebp),%eax
3e5: ba 00 00 00 00 mov $0x0,%edx
3ea: f7 f6 div %esi
3ec: 89 45 ec mov %eax,-0x14(%ebp)
3ef: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
3f3: 75 c7 jne 3bc <printint+0x39>
if(neg)
3f5: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
3f9: 74 10 je 40b <printint+0x88>
buf[i++] = '-';
3fb: 8b 45 f4 mov -0xc(%ebp),%eax
3fe: 8d 50 01 lea 0x1(%eax),%edx
401: 89 55 f4 mov %edx,-0xc(%ebp)
404: c6 44 05 dc 2d movb $0x2d,-0x24(%ebp,%eax,1)
while(--i >= 0)
409: eb 1f jmp 42a <printint+0xa7>
40b: eb 1d jmp 42a <printint+0xa7>
putc(fd, buf[i]);
40d: 8d 55 dc lea -0x24(%ebp),%edx
410: 8b 45 f4 mov -0xc(%ebp),%eax
413: 01 d0 add %edx,%eax
415: 0f b6 00 movzbl (%eax),%eax
418: 0f be c0 movsbl %al,%eax
41b: 89 44 24 04 mov %eax,0x4(%esp)
41f: 8b 45 08 mov 0x8(%ebp),%eax
422: 89 04 24 mov %eax,(%esp)
425: e8 31 ff ff ff call 35b <putc>
buf[i++] = digits[x % base];
}while((x /= base) != 0);
if(neg)
buf[i++] = '-';
while(--i >= 0)
42a: 83 6d f4 01 subl $0x1,-0xc(%ebp)
42e: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
432: 79 d9 jns 40d <printint+0x8a>
putc(fd, buf[i]);
}
434: 83 c4 30 add $0x30,%esp
437: 5b pop %ebx
438: 5e pop %esi
439: 5d pop %ebp
43a: c3 ret
0000043b <printf>:
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, char *fmt, ...)
{
43b: 55 push %ebp
43c: 89 e5 mov %esp,%ebp
43e: 83 ec 38 sub $0x38,%esp
char *s;
int c, i, state;
uint *ap;
state = 0;
441: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp)
ap = (uint*)(void*)&fmt + 1;
448: 8d 45 0c lea 0xc(%ebp),%eax
44b: 83 c0 04 add $0x4,%eax
44e: 89 45 e8 mov %eax,-0x18(%ebp)
for(i = 0; fmt[i]; i++){
451: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
458: e9 7c 01 00 00 jmp 5d9 <printf+0x19e>
c = fmt[i] & 0xff;
45d: 8b 55 0c mov 0xc(%ebp),%edx
460: 8b 45 f0 mov -0x10(%ebp),%eax
463: 01 d0 add %edx,%eax
465: 0f b6 00 movzbl (%eax),%eax
468: 0f be c0 movsbl %al,%eax
46b: 25 ff 00 00 00 and $0xff,%eax
470: 89 45 e4 mov %eax,-0x1c(%ebp)
if(state == 0){
473: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
477: 75 2c jne 4a5 <printf+0x6a>
if(c == '%'){
479: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp)
47d: 75 0c jne 48b <printf+0x50>
state = '%';
47f: c7 45 ec 25 00 00 00 movl $0x25,-0x14(%ebp)
486: e9 4a 01 00 00 jmp 5d5 <printf+0x19a>
} else {
putc(fd, c);
48b: 8b 45 e4 mov -0x1c(%ebp),%eax
48e: 0f be c0 movsbl %al,%eax
491: 89 44 24 04 mov %eax,0x4(%esp)
495: 8b 45 08 mov 0x8(%ebp),%eax
498: 89 04 24 mov %eax,(%esp)
49b: e8 bb fe ff ff call 35b <putc>
4a0: e9 30 01 00 00 jmp 5d5 <printf+0x19a>
}
} else if(state == '%'){
4a5: 83 7d ec 25 cmpl $0x25,-0x14(%ebp)
4a9: 0f 85 26 01 00 00 jne 5d5 <printf+0x19a>
if(c == 'd'){
4af: 83 7d e4 64 cmpl $0x64,-0x1c(%ebp)
4b3: 75 2d jne 4e2 <printf+0xa7>
printint(fd, *ap, 10, 1);
4b5: 8b 45 e8 mov -0x18(%ebp),%eax
4b8: 8b 00 mov (%eax),%eax
4ba: c7 44 24 0c 01 00 00 movl $0x1,0xc(%esp)
4c1: 00
4c2: c7 44 24 08 0a 00 00 movl $0xa,0x8(%esp)
4c9: 00
4ca: 89 44 24 04 mov %eax,0x4(%esp)
4ce: 8b 45 08 mov 0x8(%ebp),%eax
4d1: 89 04 24 mov %eax,(%esp)
4d4: e8 aa fe ff ff call 383 <printint>
ap++;
4d9: 83 45 e8 04 addl $0x4,-0x18(%ebp)
4dd: e9 ec 00 00 00 jmp 5ce <printf+0x193>
} else if(c == 'x' || c == 'p'){
4e2: 83 7d e4 78 cmpl $0x78,-0x1c(%ebp)
4e6: 74 06 je 4ee <printf+0xb3>
4e8: 83 7d e4 70 cmpl $0x70,-0x1c(%ebp)
4ec: 75 2d jne 51b <printf+0xe0>
printint(fd, *ap, 16, 0);
4ee: 8b 45 e8 mov -0x18(%ebp),%eax
4f1: 8b 00 mov (%eax),%eax
4f3: c7 44 24 0c 00 00 00 movl $0x0,0xc(%esp)
4fa: 00
4fb: c7 44 24 08 10 00 00 movl $0x10,0x8(%esp)
502: 00
503: 89 44 24 04 mov %eax,0x4(%esp)
507: 8b 45 08 mov 0x8(%ebp),%eax
50a: 89 04 24 mov %eax,(%esp)
50d: e8 71 fe ff ff call 383 <printint>
ap++;
512: 83 45 e8 04 addl $0x4,-0x18(%ebp)
516: e9 b3 00 00 00 jmp 5ce <printf+0x193>
} else if(c == 's'){
51b: 83 7d e4 73 cmpl $0x73,-0x1c(%ebp)
51f: 75 45 jne 566 <printf+0x12b>
s = (char*)*ap;
521: 8b 45 e8 mov -0x18(%ebp),%eax
524: 8b 00 mov (%eax),%eax
526: 89 45 f4 mov %eax,-0xc(%ebp)
ap++;
529: 83 45 e8 04 addl $0x4,-0x18(%ebp)
if(s == 0)
52d: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
531: 75 09 jne 53c <printf+0x101>
s = "(null)";
533: c7 45 f4 07 08 00 00 movl $0x807,-0xc(%ebp)
while(*s != 0){
53a: eb 1e jmp 55a <printf+0x11f>
53c: eb 1c jmp 55a <printf+0x11f>
putc(fd, *s);
53e: 8b 45 f4 mov -0xc(%ebp),%eax
541: 0f b6 00 movzbl (%eax),%eax
544: 0f be c0 movsbl %al,%eax
547: 89 44 24 04 mov %eax,0x4(%esp)
54b: 8b 45 08 mov 0x8(%ebp),%eax
54e: 89 04 24 mov %eax,(%esp)
551: e8 05 fe ff ff call 35b <putc>
s++;
556: 83 45 f4 01 addl $0x1,-0xc(%ebp)
} else if(c == 's'){
s = (char*)*ap;
ap++;
if(s == 0)
s = "(null)";
while(*s != 0){
55a: 8b 45 f4 mov -0xc(%ebp),%eax
55d: 0f b6 00 movzbl (%eax),%eax
560: 84 c0 test %al,%al
562: 75 da jne 53e <printf+0x103>
564: eb 68 jmp 5ce <printf+0x193>
putc(fd, *s);
s++;
}
} else if(c == 'c'){
566: 83 7d e4 63 cmpl $0x63,-0x1c(%ebp)
56a: 75 1d jne 589 <printf+0x14e>
putc(fd, *ap);
56c: 8b 45 e8 mov -0x18(%ebp),%eax
56f: 8b 00 mov (%eax),%eax
571: 0f be c0 movsbl %al,%eax
574: 89 44 24 04 mov %eax,0x4(%esp)
578: 8b 45 08 mov 0x8(%ebp),%eax
57b: 89 04 24 mov %eax,(%esp)
57e: e8 d8 fd ff ff call 35b <putc>
ap++;
583: 83 45 e8 04 addl $0x4,-0x18(%ebp)
587: eb 45 jmp 5ce <printf+0x193>
} else if(c == '%'){
589: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp)
58d: 75 17 jne 5a6 <printf+0x16b>
putc(fd, c);
58f: 8b 45 e4 mov -0x1c(%ebp),%eax
592: 0f be c0 movsbl %al,%eax
595: 89 44 24 04 mov %eax,0x4(%esp)
599: 8b 45 08 mov 0x8(%ebp),%eax
59c: 89 04 24 mov %eax,(%esp)
59f: e8 b7 fd ff ff call 35b <putc>
5a4: eb 28 jmp 5ce <printf+0x193>
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
5a6: c7 44 24 04 25 00 00 movl $0x25,0x4(%esp)
5ad: 00
5ae: 8b 45 08 mov 0x8(%ebp),%eax
5b1: 89 04 24 mov %eax,(%esp)
5b4: e8 a2 fd ff ff call 35b <putc>
putc(fd, c);
5b9: 8b 45 e4 mov -0x1c(%ebp),%eax
5bc: 0f be c0 movsbl %al,%eax
5bf: 89 44 24 04 mov %eax,0x4(%esp)
5c3: 8b 45 08 mov 0x8(%ebp),%eax
5c6: 89 04 24 mov %eax,(%esp)
5c9: e8 8d fd ff ff call 35b <putc>
}
state = 0;
5ce: 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++){
5d5: 83 45 f0 01 addl $0x1,-0x10(%ebp)
5d9: 8b 55 0c mov 0xc(%ebp),%edx
5dc: 8b 45 f0 mov -0x10(%ebp),%eax
5df: 01 d0 add %edx,%eax
5e1: 0f b6 00 movzbl (%eax),%eax
5e4: 84 c0 test %al,%al
5e6: 0f 85 71 fe ff ff jne 45d <printf+0x22>
putc(fd, c);
}
state = 0;
}
}
}
5ec: c9 leave
5ed: c3 ret
000005ee <free>:
static Header base;
static Header *freep;
void
free(void *ap)
{
5ee: 55 push %ebp
5ef: 89 e5 mov %esp,%ebp
5f1: 83 ec 10 sub $0x10,%esp
Header *bp, *p;
bp = (Header*)ap - 1;
5f4: 8b 45 08 mov 0x8(%ebp),%eax
5f7: 83 e8 08 sub $0x8,%eax
5fa: 89 45 f8 mov %eax,-0x8(%ebp)
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
5fd: a1 70 0a 00 00 mov 0xa70,%eax
602: 89 45 fc mov %eax,-0x4(%ebp)
605: eb 24 jmp 62b <free+0x3d>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
607: 8b 45 fc mov -0x4(%ebp),%eax
60a: 8b 00 mov (%eax),%eax
60c: 3b 45 fc cmp -0x4(%ebp),%eax
60f: 77 12 ja 623 <free+0x35>
611: 8b 45 f8 mov -0x8(%ebp),%eax
614: 3b 45 fc cmp -0x4(%ebp),%eax
617: 77 24 ja 63d <free+0x4f>
619: 8b 45 fc mov -0x4(%ebp),%eax
61c: 8b 00 mov (%eax),%eax
61e: 3b 45 f8 cmp -0x8(%ebp),%eax
621: 77 1a ja 63d <free+0x4f>
free(void *ap)
{
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
623: 8b 45 fc mov -0x4(%ebp),%eax
626: 8b 00 mov (%eax),%eax
628: 89 45 fc mov %eax,-0x4(%ebp)
62b: 8b 45 f8 mov -0x8(%ebp),%eax
62e: 3b 45 fc cmp -0x4(%ebp),%eax
631: 76 d4 jbe 607 <free+0x19>
633: 8b 45 fc mov -0x4(%ebp),%eax
636: 8b 00 mov (%eax),%eax
638: 3b 45 f8 cmp -0x8(%ebp),%eax
63b: 76 ca jbe 607 <free+0x19>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
break;
if(bp + bp->s.size == p->s.ptr){
63d: 8b 45 f8 mov -0x8(%ebp),%eax
640: 8b 40 04 mov 0x4(%eax),%eax
643: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx
64a: 8b 45 f8 mov -0x8(%ebp),%eax
64d: 01 c2 add %eax,%edx
64f: 8b 45 fc mov -0x4(%ebp),%eax
652: 8b 00 mov (%eax),%eax
654: 39 c2 cmp %eax,%edx
656: 75 24 jne 67c <free+0x8e>
bp->s.size += p->s.ptr->s.size;
658: 8b 45 f8 mov -0x8(%ebp),%eax
65b: 8b 50 04 mov 0x4(%eax),%edx
65e: 8b 45 fc mov -0x4(%ebp),%eax
661: 8b 00 mov (%eax),%eax
663: 8b 40 04 mov 0x4(%eax),%eax
666: 01 c2 add %eax,%edx
668: 8b 45 f8 mov -0x8(%ebp),%eax
66b: 89 50 04 mov %edx,0x4(%eax)
bp->s.ptr = p->s.ptr->s.ptr;
66e: 8b 45 fc mov -0x4(%ebp),%eax
671: 8b 00 mov (%eax),%eax
673: 8b 10 mov (%eax),%edx
675: 8b 45 f8 mov -0x8(%ebp),%eax
678: 89 10 mov %edx,(%eax)
67a: eb 0a jmp 686 <free+0x98>
} else
bp->s.ptr = p->s.ptr;
67c: 8b 45 fc mov -0x4(%ebp),%eax
67f: 8b 10 mov (%eax),%edx
681: 8b 45 f8 mov -0x8(%ebp),%eax
684: 89 10 mov %edx,(%eax)
if(p + p->s.size == bp){
686: 8b 45 fc mov -0x4(%ebp),%eax
689: 8b 40 04 mov 0x4(%eax),%eax
68c: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx
693: 8b 45 fc mov -0x4(%ebp),%eax
696: 01 d0 add %edx,%eax
698: 3b 45 f8 cmp -0x8(%ebp),%eax
69b: 75 20 jne 6bd <free+0xcf>
p->s.size += bp->s.size;
69d: 8b 45 fc mov -0x4(%ebp),%eax
6a0: 8b 50 04 mov 0x4(%eax),%edx
6a3: 8b 45 f8 mov -0x8(%ebp),%eax
6a6: 8b 40 04 mov 0x4(%eax),%eax
6a9: 01 c2 add %eax,%edx
6ab: 8b 45 fc mov -0x4(%ebp),%eax
6ae: 89 50 04 mov %edx,0x4(%eax)
p->s.ptr = bp->s.ptr;
6b1: 8b 45 f8 mov -0x8(%ebp),%eax
6b4: 8b 10 mov (%eax),%edx
6b6: 8b 45 fc mov -0x4(%ebp),%eax
6b9: 89 10 mov %edx,(%eax)
6bb: eb 08 jmp 6c5 <free+0xd7>
} else
p->s.ptr = bp;
6bd: 8b 45 fc mov -0x4(%ebp),%eax
6c0: 8b 55 f8 mov -0x8(%ebp),%edx
6c3: 89 10 mov %edx,(%eax)
freep = p;
6c5: 8b 45 fc mov -0x4(%ebp),%eax
6c8: a3 70 0a 00 00 mov %eax,0xa70
}
6cd: c9 leave
6ce: c3 ret
000006cf <morecore>:
static Header*
morecore(uint nu)
{
6cf: 55 push %ebp
6d0: 89 e5 mov %esp,%ebp
6d2: 83 ec 28 sub $0x28,%esp
char *p;
Header *hp;
if(nu < 4096)
6d5: 81 7d 08 ff 0f 00 00 cmpl $0xfff,0x8(%ebp)
6dc: 77 07 ja 6e5 <morecore+0x16>
nu = 4096;
6de: c7 45 08 00 10 00 00 movl $0x1000,0x8(%ebp)
p = sbrk(nu * sizeof(Header));
6e5: 8b 45 08 mov 0x8(%ebp),%eax
6e8: c1 e0 03 shl $0x3,%eax
6eb: 89 04 24 mov %eax,(%esp)
6ee: e8 08 fc ff ff call 2fb <sbrk>
6f3: 89 45 f4 mov %eax,-0xc(%ebp)
if(p == (char*)-1)
6f6: 83 7d f4 ff cmpl $0xffffffff,-0xc(%ebp)
6fa: 75 07 jne 703 <morecore+0x34>
return 0;
6fc: b8 00 00 00 00 mov $0x0,%eax
701: eb 22 jmp 725 <morecore+0x56>
hp = (Header*)p;
703: 8b 45 f4 mov -0xc(%ebp),%eax
706: 89 45 f0 mov %eax,-0x10(%ebp)
hp->s.size = nu;
709: 8b 45 f0 mov -0x10(%ebp),%eax
70c: 8b 55 08 mov 0x8(%ebp),%edx
70f: 89 50 04 mov %edx,0x4(%eax)
free((void*)(hp + 1));
712: 8b 45 f0 mov -0x10(%ebp),%eax
715: 83 c0 08 add $0x8,%eax
718: 89 04 24 mov %eax,(%esp)
71b: e8 ce fe ff ff call 5ee <free>
return freep;
720: a1 70 0a 00 00 mov 0xa70,%eax
}
725: c9 leave
726: c3 ret
00000727 <malloc>:
void*
malloc(uint nbytes)
{
727: 55 push %ebp
728: 89 e5 mov %esp,%ebp
72a: 83 ec 28 sub $0x28,%esp
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
72d: 8b 45 08 mov 0x8(%ebp),%eax
730: 83 c0 07 add $0x7,%eax
733: c1 e8 03 shr $0x3,%eax
736: 83 c0 01 add $0x1,%eax
739: 89 45 ec mov %eax,-0x14(%ebp)
if((prevp = freep) == 0){
73c: a1 70 0a 00 00 mov 0xa70,%eax
741: 89 45 f0 mov %eax,-0x10(%ebp)
744: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
748: 75 23 jne 76d <malloc+0x46>
base.s.ptr = freep = prevp = &base;
74a: c7 45 f0 68 0a 00 00 movl $0xa68,-0x10(%ebp)
751: 8b 45 f0 mov -0x10(%ebp),%eax
754: a3 70 0a 00 00 mov %eax,0xa70
759: a1 70 0a 00 00 mov 0xa70,%eax
75e: a3 68 0a 00 00 mov %eax,0xa68
base.s.size = 0;
763: c7 05 6c 0a 00 00 00 movl $0x0,0xa6c
76a: 00 00 00
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
76d: 8b 45 f0 mov -0x10(%ebp),%eax
770: 8b 00 mov (%eax),%eax
772: 89 45 f4 mov %eax,-0xc(%ebp)
if(p->s.size >= nunits){
775: 8b 45 f4 mov -0xc(%ebp),%eax
778: 8b 40 04 mov 0x4(%eax),%eax
77b: 3b 45 ec cmp -0x14(%ebp),%eax
77e: 72 4d jb 7cd <malloc+0xa6>
if(p->s.size == nunits)
780: 8b 45 f4 mov -0xc(%ebp),%eax
783: 8b 40 04 mov 0x4(%eax),%eax
786: 3b 45 ec cmp -0x14(%ebp),%eax
789: 75 0c jne 797 <malloc+0x70>
prevp->s.ptr = p->s.ptr;
78b: 8b 45 f4 mov -0xc(%ebp),%eax
78e: 8b 10 mov (%eax),%edx
790: 8b 45 f0 mov -0x10(%ebp),%eax
793: 89 10 mov %edx,(%eax)
795: eb 26 jmp 7bd <malloc+0x96>
else {
p->s.size -= nunits;
797: 8b 45 f4 mov -0xc(%ebp),%eax
79a: 8b 40 04 mov 0x4(%eax),%eax
79d: 2b 45 ec sub -0x14(%ebp),%eax
7a0: 89 c2 mov %eax,%edx
7a2: 8b 45 f4 mov -0xc(%ebp),%eax
7a5: 89 50 04 mov %edx,0x4(%eax)
p += p->s.size;
7a8: 8b 45 f4 mov -0xc(%ebp),%eax
7ab: 8b 40 04 mov 0x4(%eax),%eax
7ae: c1 e0 03 shl $0x3,%eax
7b1: 01 45 f4 add %eax,-0xc(%ebp)
p->s.size = nunits;
7b4: 8b 45 f4 mov -0xc(%ebp),%eax
7b7: 8b 55 ec mov -0x14(%ebp),%edx
7ba: 89 50 04 mov %edx,0x4(%eax)
}
freep = prevp;
7bd: 8b 45 f0 mov -0x10(%ebp),%eax
7c0: a3 70 0a 00 00 mov %eax,0xa70
return (void*)(p + 1);
7c5: 8b 45 f4 mov -0xc(%ebp),%eax
7c8: 83 c0 08 add $0x8,%eax
7cb: eb 38 jmp 805 <malloc+0xde>
}
if(p == freep)
7cd: a1 70 0a 00 00 mov 0xa70,%eax
7d2: 39 45 f4 cmp %eax,-0xc(%ebp)
7d5: 75 1b jne 7f2 <malloc+0xcb>
if((p = morecore(nunits)) == 0)
7d7: 8b 45 ec mov -0x14(%ebp),%eax
7da: 89 04 24 mov %eax,(%esp)
7dd: e8 ed fe ff ff call 6cf <morecore>
7e2: 89 45 f4 mov %eax,-0xc(%ebp)
7e5: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
7e9: 75 07 jne 7f2 <malloc+0xcb>
return 0;
7eb: b8 00 00 00 00 mov $0x0,%eax
7f0: eb 13 jmp 805 <malloc+0xde>
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
if((prevp = freep) == 0){
base.s.ptr = freep = prevp = &base;
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
7f2: 8b 45 f4 mov -0xc(%ebp),%eax
7f5: 89 45 f0 mov %eax,-0x10(%ebp)
7f8: 8b 45 f4 mov -0xc(%ebp),%eax
7fb: 8b 00 mov (%eax),%eax
7fd: 89 45 f4 mov %eax,-0xc(%ebp)
return (void*)(p + 1);
}
if(p == freep)
if((p = morecore(nunits)) == 0)
return 0;
}
800: e9 70 ff ff ff jmp 775 <malloc+0x4e>
}
805: c9 leave
806: c3 ret
|
// seed 2
lbi r0, 233 // icount 0
slbi r0, 40 // icount 1
lbi r1, 146 // icount 2
slbi r1, 205 // icount 3
lbi r2, 141 // icount 4
slbi r2, 55 // icount 5
lbi r3, 174 // icount 6
slbi r3, 156 // icount 7
lbi r4, 160 // icount 8
slbi r4, 252 // icount 9
lbi r5, 65 // icount 10
slbi r5, 202 // icount 11
lbi r6, 136 // icount 12
slbi r6, 222 // icount 13
lbi r7, 129 // icount 14
slbi r7, 135 // icount 15
lbi r1, 12 // icount 16
rori r2, r6, 11 // icount 17
j 0 // icount 18
lbi r3, 0 // icount 19
lbi r0, 0 // icount 20
bltz r1, 28 // icount 21
slt r1, r1, r2 // icount 22
andn r4, r1, r1 // icount 23
srl r7, r3, r6 // icount 24
srli r0, r7, 7 // icount 25
sll r2, r4, r7 // icount 26
nop // to align meminst icount 27
andni r5, r5, 1 // icount 28
st r0, r5, 0 // icount 29
seq r1, r1, r3 // icount 30
subi r0, r6, 8 // icount 31
seq r0, r3, r4 // icount 32
ror r0, r0, r5 // icount 33
xor r3, r2, r6 // icount 34
slli r0, r1, 1 // icount 35
sco r7, r0, r0 // icount 36
seq r1, r7, r4 // icount 37
srl r1, r7, r6 // icount 38
sll r7, r4, r0 // icount 39
andni r7, r7, 1 // icount 40
stu r2, r7, 8 // icount 41
srl r7, r5, r4 // icount 42
nop // to align meminst icount 43
andni r7, r7, 1 // icount 44
st r2, r7, 14 // icount 45
sco r2, r5, r2 // icount 46
sle r7, r5, r0 // icount 47
srli r0, r4, 2 // icount 48
slli r1, r2, 2 // icount 49
andni r7, r7, 1 // icount 50
stu r4, r7, 8 // icount 51
andni r5, r5, 1 // icount 52
stu r4, r5, 0 // icount 53
sub r7, r2, r2 // icount 54
xori r6, r2, 10 // icount 55
sco r7, r0, r2 // icount 56
lbi r2, 0 // icount 57
lbi r7, 0 // icount 58
beqz r5, 16 // icount 59
andni r3, r3, 1 // icount 60
ld r4, r3, 0 // icount 61
andni r5, r1, 5 // icount 62
slli r2, r2, 14 // icount 63
subi r2, r2, 5 // icount 64
slt r6, r6, r2 // icount 65
sle r2, r7, r6 // icount 66
sle r3, r5, r0 // icount 67
seq r1, r2, r6 // icount 68
slbi r7, 0 // icount 69
srli r4, r6, 10 // icount 70
lbi r2, 5 // icount 71
ror r1, r5, r4 // icount 72
rori r7, r6, 11 // icount 73
sco r3, r5, r4 // icount 74
seq r3, r2, r6 // icount 75
rol r7, r2, r1 // icount 76
slbi r7, 12 // icount 77
addi r6, r5, 12 // icount 78
lbi r4, 0 // icount 79
lbi r3, 0 // icount 80
bnez r2, 24 // icount 81
srli r3, r7, 1 // icount 82
srli r5, r5, 2 // icount 83
andni r2, r2, 1 // icount 84
stu r2, r2, 6 // icount 85
subi r4, r1, 0 // icount 86
seq r0, r4, r2 // icount 87
andni r0, r3, 9 // icount 88
nop // to align meminst icount 89
andni r4, r4, 1 // icount 90
stu r5, r4, 10 // icount 91
rori r7, r5, 11 // icount 92
sub r2, r6, r3 // icount 93
andni r5, r5, 1 // icount 94
ld r4, r5, 0 // icount 95
subi r5, r2, 11 // icount 96
srli r7, r3, 3 // icount 97
lbi r4, 15 // icount 98
seq r6, r2, r6 // icount 99
rori r7, r3, 9 // icount 100
slli r7, r3, 4 // icount 101
subi r4, r6, 9 // icount 102
sub r1, r4, r3 // icount 103
andni r3, r3, 1 // icount 104
ld r5, r3, 12 // icount 105
andni r6, r1, 15 // icount 106
rol r5, r6, r2 // icount 107
slli r7, r6, 4 // icount 108
andni r2, r3, 4 // icount 109
xor r0, r3, r6 // icount 110
sub r6, r4, r0 // icount 111
slli r5, r2, 3 // icount 112
srl r6, r7, r1 // icount 113
andn r6, r7, r0 // icount 114
j 12 // icount 115
nop // icount 116
nop // icount 117
nop // icount 118
nop // icount 119
nop // icount 120
nop // icount 121
j 16 // icount 122
nop // icount 123
nop // icount 124
nop // icount 125
nop // icount 126
nop // icount 127
nop // icount 128
nop // icount 129
nop // icount 130
sle r4, r3, r7 // icount 131
j 32 // icount 132
nop // icount 133
nop // icount 134
nop // icount 135
nop // icount 136
nop // icount 137
nop // icount 138
nop // icount 139
nop // icount 140
nop // icount 141
nop // icount 142
nop // icount 143
nop // icount 144
nop // icount 145
nop // icount 146
nop // icount 147
nop // icount 148
lbi r3, 0 // icount 149
lbi r3, 0 // icount 150
beqz r0, 24 // icount 151
rol r1, r5, r0 // icount 152
rori r3, r1, 6 // icount 153
subi r2, r7, 4 // icount 154
ror r2, r2, r5 // icount 155
sll r3, r5, r3 // icount 156
seq r6, r4, r0 // icount 157
srli r3, r0, 7 // icount 158
xori r0, r3, 14 // icount 159
roli r4, r1, 10 // icount 160
nop // to align meminst icount 161
andni r3, r3, 1 // icount 162
stu r4, r3, 8 // icount 163
rori r7, r5, 14 // icount 164
nop // to align meminst icount 165
andni r1, r1, 1 // icount 166
stu r4, r1, 12 // icount 167
srl r3, r0, r6 // icount 168
xori r1, r4, 12 // icount 169
sco r0, r7, r6 // icount 170
sub r5, r1, r1 // icount 171
sll r4, r7, r6 // icount 172
rol r6, r0, r4 // icount 173
sll r7, r5, r7 // icount 174
subi r0, r4, 4 // icount 175
andni r3, r3, 1 // icount 176
stu r0, r3, 2 // icount 177
sll r1, r3, r4 // icount 178
rori r3, r3, 8 // icount 179
andni r0, r0, 1 // icount 180
stu r6, r0, 14 // icount 181
slt r3, r1, r6 // icount 182
subi r2, r7, 10 // icount 183
andni r5, r5, 1 // icount 184
ld r0, r5, 12 // icount 185
j 32 // icount 186
nop // icount 187
nop // icount 188
nop // icount 189
nop // icount 190
nop // icount 191
nop // icount 192
nop // icount 193
nop // icount 194
nop // icount 195
nop // icount 196
nop // icount 197
nop // icount 198
nop // icount 199
nop // icount 200
nop // icount 201
nop // icount 202
nop // to align meminst icount 203
andni r6, r6, 1 // icount 204
stu r4, r6, 12 // icount 205
seq r0, r3, r5 // icount 206
lbi r2, 0 // icount 207
lbi r5, 0 // icount 208
bltz r4, 32 // icount 209
sle r2, r4, r5 // icount 210
seq r3, r4, r1 // icount 211
addi r5, r1, 11 // icount 212
ror r1, r6, r1 // icount 213
add r2, r6, r5 // icount 214
subi r2, r6, 6 // icount 215
slbi r4, 15 // icount 216
slli r0, r0, 14 // icount 217
sle r6, r1, r5 // icount 218
sle r4, r3, r4 // icount 219
roli r3, r5, 15 // icount 220
nop // to align meminst icount 221
andni r4, r4, 1 // icount 222
stu r5, r4, 0 // icount 223
rol r3, r2, r3 // icount 224
addi r4, r3, 3 // icount 225
ror r6, r6, r0 // icount 226
sle r4, r1, r6 // icount 227
andni r5, r5, 1 // icount 228
ld r0, r5, 8 // icount 229
andn r6, r3, r4 // icount 230
add r2, r3, r1 // icount 231
andni r7, r7, 1 // icount 232
stu r1, r7, 4 // icount 233
ror r0, r5, r4 // icount 234
rol r3, r1, r3 // icount 235
roli r6, r3, 5 // icount 236
srl r3, r1, r5 // icount 237
sco r6, r7, r3 // icount 238
xor r7, r3, r3 // icount 239
rol r4, r3, r3 // icount 240
xori r0, r4, 8 // icount 241
andni r5, r5, 1 // icount 242
stu r0, r5, 0 // icount 243
andn r6, r7, r1 // icount 244
add r4, r5, r2 // icount 245
sle r7, r7, r0 // icount 246
slt r7, r6, r4 // icount 247
andni r0, r0, 1 // icount 248
j 32 // icount 249
nop // icount 250
nop // icount 251
nop // icount 252
nop // icount 253
nop // icount 254
nop // icount 255
nop // icount 256
nop // icount 257
nop // icount 258
nop // icount 259
nop // icount 260
nop // icount 261
nop // icount 262
nop // icount 263
nop // icount 264
nop // icount 265
lbi r1, 3 // icount 266
nop // to align meminst icount 267
andni r2, r2, 1 // icount 268
ld r7, r2, 10 // icount 269
sco r3, r1, r2 // icount 270
lbi r2, 0 // icount 271
lbi r5, 0 // icount 272
bltz r0, 4 // icount 273
sub r5, r5, r4 // icount 274
xor r1, r6, r6 // icount 275
andni r5, r5, 1 // icount 276
ld r1, r5, 14 // icount 277
sub r0, r2, r1 // icount 278
rori r3, r2, 11 // icount 279
j 26 // icount 280
nop // icount 281
nop // icount 282
nop // icount 283
nop // icount 284
nop // icount 285
nop // icount 286
nop // icount 287
nop // icount 288
nop // icount 289
nop // icount 290
nop // icount 291
nop // icount 292
nop // icount 293
lbi r0, 0 // icount 294
lbi r0, 0 // icount 295
nop // to align branch icount 296
bgez r7, 4 // icount 297
roli r7, r7, 5 // icount 298
sle r7, r5, r6 // icount 299
srli r4, r3, 15 // icount 300
seq r1, r7, r0 // icount 301
andni r6, r6, 1 // icount 302
ld r2, r6, 8 // icount 303
lbi r5, 0 // icount 304
lbi r7, 0 // icount 305
nop // to align branch icount 306
bnez r6, 28 // icount 307
roli r7, r0, 14 // icount 308
subi r0, r4, 6 // icount 309
rori r3, r7, 15 // icount 310
xor r1, r6, r2 // icount 311
slt r0, r0, r4 // icount 312
slbi r6, 8 // icount 313
ror r4, r1, r0 // icount 314
subi r2, r0, 7 // icount 315
andni r4, r4, 1 // icount 316
st r0, r4, 6 // icount 317
andni r5, r7, 3 // icount 318
srl r3, r2, r6 // icount 319
lbi r5, 7 // icount 320
add r4, r6, r1 // icount 321
add r5, r2, r0 // icount 322
slt r2, r1, r2 // icount 323
sco r6, r5, r1 // icount 324
sle r6, r7, r2 // icount 325
roli r4, r6, 0 // icount 326
andn r0, r7, r0 // icount 327
sub r7, r0, r2 // icount 328
rori r0, r6, 10 // icount 329
addi r3, r1, 6 // icount 330
subi r5, r0, 11 // icount 331
andn r6, r5, r7 // icount 332
andn r6, r3, r5 // icount 333
sub r0, r7, r5 // icount 334
andn r6, r0, r1 // icount 335
slt r3, r5, r2 // icount 336
srli r5, r3, 9 // icount 337
j 26 // icount 338
nop // icount 339
nop // icount 340
nop // icount 341
nop // icount 342
nop // icount 343
nop // icount 344
nop // icount 345
nop // icount 346
nop // icount 347
nop // icount 348
nop // icount 349
nop // icount 350
nop // icount 351
rol r2, r0, r1 // icount 352
nop // to align meminst icount 353
andni r0, r0, 1 // icount 354
st r7, r0, 0 // icount 355
lbi r6, 0 // icount 356
lbi r0, 0 // icount 357
nop // to align branch icount 358
beqz r5, 28 // icount 359
add r2, r5, r4 // icount 360
sub r1, r6, r2 // icount 361
rori r1, r3, 12 // icount 362
srli r3, r7, 15 // icount 363
andn r7, r6, r0 // icount 364
andn r3, r5, r1 // icount 365
seq r6, r7, r2 // icount 366
xor r5, r4, r5 // icount 367
sco r1, r2, r1 // icount 368
slbi r0, 9 // icount 369
andni r3, r3, 1 // icount 370
ld r2, r3, 2 // icount 371
sco r7, r6, r3 // icount 372
nop // to align meminst icount 373
andni r3, r3, 1 // icount 374
stu r0, r3, 12 // icount 375
sll r2, r4, r5 // icount 376
ror r4, r2, r0 // icount 377
seq r2, r7, r0 // icount 378
sll r2, r4, r2 // icount 379
ror r7, r3, r0 // icount 380
sub r1, r1, r3 // icount 381
andni r4, r4, 1 // icount 382
st r2, r4, 0 // icount 383
add r3, r2, r3 // icount 384
srli r6, r4, 3 // icount 385
sll r0, r1, r2 // icount 386
slbi r6, 10 // icount 387
subi r5, r6, 11 // icount 388
srl r2, r7, r4 // icount 389
subi r6, r3, 11 // icount 390
xori r7, r1, 2 // icount 391
srl r2, r2, r4 // icount 392
andn r2, r7, r1 // icount 393
lbi r4, 0 // icount 394
lbi r0, 0 // icount 395
nop // to align branch icount 396
bgez r1, 16 // icount 397
ror r0, r0, r0 // icount 398
slt r7, r3, r6 // icount 399
andni r7, r5, 11 // icount 400
ror r2, r0, r1 // icount 401
slli r3, r1, 4 // icount 402
slli r2, r4, 7 // icount 403
subi r0, r1, 6 // icount 404
slli r7, r6, 8 // icount 405
subi r6, r3, 1 // icount 406
srli r5, r2, 12 // icount 407
sll r3, r6, r7 // icount 408
xori r1, r2, 6 // icount 409
rori r3, r3, 14 // icount 410
sll r0, r7, r3 // icount 411
andni r7, r4, 15 // icount 412
roli r1, r0, 2 // icount 413
andni r4, r6, 15 // icount 414
j 8 // icount 415
nop // icount 416
nop // icount 417
nop // icount 418
nop // icount 419
seq r7, r7, r6 // icount 420
andn r1, r6, r1 // icount 421
andni r5, r5, 1 // icount 422
st r0, r5, 14 // icount 423
j 28 // icount 424
nop // icount 425
nop // icount 426
nop // icount 427
nop // icount 428
nop // icount 429
nop // icount 430
nop // icount 431
nop // icount 432
nop // icount 433
nop // icount 434
nop // icount 435
nop // icount 436
nop // icount 437
nop // icount 438
j 32 // icount 439
nop // icount 440
nop // icount 441
nop // icount 442
nop // icount 443
nop // icount 444
nop // icount 445
nop // icount 446
nop // icount 447
nop // icount 448
nop // icount 449
nop // icount 450
nop // icount 451
nop // icount 452
nop // icount 453
nop // icount 454
nop // icount 455
j 14 // icount 456
nop // icount 457
nop // icount 458
nop // icount 459
nop // icount 460
nop // icount 461
nop // icount 462
nop // icount 463
add r5, r3, r4 // icount 464
rori r2, r4, 9 // icount 465
lbi r6, 0 // icount 466
lbi r3, 0 // icount 467
nop // to align branch icount 468
bnez r3, 16 // icount 469
slt r7, r6, r2 // icount 470
sco r1, r7, r3 // icount 471
lbi r1, 10 // icount 472
sub r6, r6, r4 // icount 473
xori r0, r3, 4 // icount 474
srl r0, r5, r4 // icount 475
andn r4, r4, r6 // icount 476
roli r1, r3, 13 // icount 477
andni r5, r7, 13 // icount 478
nop // to align meminst icount 479
andni r7, r7, 1 // icount 480
stu r6, r7, 8 // icount 481
sll r2, r3, r5 // icount 482
slbi r2, 14 // icount 483
xor r6, r4, r4 // icount 484
slt r7, r2, r5 // icount 485
slbi r2, 2 // icount 486
slbi r6, 0 // icount 487
j 26 // icount 488
nop // icount 489
nop // icount 490
nop // icount 491
nop // icount 492
nop // icount 493
nop // icount 494
nop // icount 495
nop // icount 496
nop // icount 497
nop // icount 498
nop // icount 499
nop // icount 500
nop // icount 501
addi r5, r6, 6 // icount 502
j 26 // icount 503
nop // icount 504
nop // icount 505
nop // icount 506
nop // icount 507
nop // icount 508
nop // icount 509
nop // icount 510
nop // icount 511
nop // icount 512
nop // icount 513
nop // icount 514
nop // icount 515
nop // icount 516
addi r2, r6, 7 // icount 517
j 6 // icount 518
nop // icount 519
nop // icount 520
nop // icount 521
slli r2, r1, 11 // icount 522
lbi r4, 0 // icount 523
lbi r7, 0 // icount 524
bnez r2, 8 // icount 525
andni r1, r1, 1 // icount 526
st r7, r1, 10 // icount 527
sub r3, r7, r3 // icount 528
sco r3, r0, r5 // icount 529
ror r5, r6, r3 // icount 530
xori r4, r3, 9 // icount 531
sle r3, r6, r3 // icount 532
srl r3, r3, r6 // icount 533
slbi r7, 14 // icount 534
andni r7, r2, 13 // icount 535
lbi r3, 0 // icount 536
lbi r3, 0 // icount 537
nop // to align branch icount 538
bnez r0, 12 // icount 539
add r4, r6, r6 // icount 540
srli r1, r2, 6 // icount 541
srli r4, r0, 13 // icount 542
andni r1, r5, 5 // icount 543
sub r7, r6, r6 // icount 544
sle r1, r3, r6 // icount 545
ror r1, r2, r0 // icount 546
ror r6, r7, r1 // icount 547
slbi r5, 10 // icount 548
roli r1, r0, 7 // icount 549
srl r1, r7, r4 // icount 550
slli r1, r0, 1 // icount 551
sle r5, r0, r7 // icount 552
lbi r0, 0 // icount 553
lbi r0, 0 // icount 554
bltz r5, 0 // icount 555
roli r5, r4, 15 // icount 556
lbi r5, 0 // icount 557
lbi r6, 0 // icount 558
bgez r1, 16 // icount 559
srli r5, r3, 5 // icount 560
sle r6, r0, r6 // icount 561
sco r1, r6, r0 // icount 562
lbi r3, 12 // icount 563
rol r7, r3, r5 // icount 564
sco r4, r6, r5 // icount 565
slt r2, r2, r4 // icount 566
ror r4, r0, r1 // icount 567
andni r5, r5, 1 // icount 568
ld r1, r5, 14 // icount 569
rol r1, r4, r6 // icount 570
add r6, r3, r1 // icount 571
lbi r6, 3 // icount 572
rol r3, r1, r1 // icount 573
andni r7, r7, 1 // icount 574
ld r2, r7, 2 // icount 575
srl r1, r1, r1 // icount 576
srl r5, r6, r1 // icount 577
slbi r6, 7 // icount 578
nop // to align meminst icount 579
andni r5, r5, 1 // icount 580
stu r1, r5, 8 // icount 581
slli r3, r4, 6 // icount 582
sub r4, r6, r0 // icount 583
andni r6, r6, 1 // icount 584
ld r4, r6, 2 // icount 585
subi r4, r4, 7 // icount 586
sub r7, r5, r2 // icount 587
lbi r6, 0 // icount 588
lbi r1, 0 // icount 589
nop // to align branch icount 590
bgez r2, 4 // icount 591
andni r6, r6, 1 // icount 592
ld r7, r6, 0 // icount 593
subi r2, r1, 13 // icount 594
srl r1, r7, r4 // icount 595
sco r0, r1, r6 // icount 596
lbi r1, 0 // icount 597
lbi r1, 0 // icount 598
bgez r5, 28 // icount 599
sll r5, r7, r5 // icount 600
srli r6, r7, 4 // icount 601
slt r2, r3, r6 // icount 602
nop // to align meminst icount 603
andni r7, r7, 1 // icount 604
stu r0, r7, 4 // icount 605
roli r5, r2, 9 // icount 606
sub r4, r2, r0 // icount 607
andni r2, r2, 1 // icount 608
st r3, r2, 2 // icount 609
sle r5, r4, r6 // icount 610
andni r3, r7, 0 // icount 611
andni r7, r7, 1 // icount 612
ld r4, r7, 4 // icount 613
seq r6, r6, r1 // icount 614
lbi r6, 2 // icount 615
subi r5, r7, 9 // icount 616
ror r7, r2, r5 // icount 617
rol r6, r2, r4 // icount 618
slbi r6, 4 // icount 619
slli r2, r5, 5 // icount 620
xori r1, r5, 12 // icount 621
slli r5, r6, 5 // icount 622
nop // to align meminst icount 623
andni r6, r6, 1 // icount 624
st r7, r6, 10 // icount 625
lbi r6, 6 // icount 626
addi r2, r7, 12 // icount 627
sll r6, r5, r7 // icount 628
ror r6, r3, r6 // icount 629
srl r5, r7, r5 // icount 630
seq r4, r0, r1 // icount 631
xor r2, r2, r1 // icount 632
srl r3, r2, r7 // icount 633
andni r1, r0, 12 // icount 634
j 28 // icount 635
nop // icount 636
nop // icount 637
nop // icount 638
nop // icount 639
nop // icount 640
nop // icount 641
nop // icount 642
nop // icount 643
nop // icount 644
nop // icount 645
nop // icount 646
nop // icount 647
nop // icount 648
nop // icount 649
lbi r0, 0 // icount 650
lbi r7, 0 // icount 651
nop // to align branch icount 652
bltz r2, 28 // icount 653
srli r5, r6, 4 // icount 654
srli r6, r6, 10 // icount 655
xor r3, r1, r3 // icount 656
srl r1, r7, r1 // icount 657
slli r2, r0, 2 // icount 658
sub r7, r3, r6 // icount 659
slt r1, r1, r4 // icount 660
xor r6, r3, r1 // icount 661
lbi r2, 9 // icount 662
addi r4, r1, 4 // icount 663
rol r0, r2, r6 // icount 664
nop // to align meminst icount 665
andni r1, r1, 1 // icount 666
st r3, r1, 14 // icount 667
andni r2, r2, 1 // icount 668
stu r1, r2, 2 // icount 669
seq r7, r0, r5 // icount 670
nop // to align meminst icount 671
andni r1, r1, 1 // icount 672
st r3, r1, 8 // icount 673
add r1, r2, r4 // icount 674
add r5, r0, r6 // icount 675
roli r5, r6, 7 // icount 676
andn r0, r3, r4 // icount 677
andni r0, r0, 1 // icount 678
st r0, r0, 2 // icount 679
slt r3, r6, r2 // icount 680
srli r6, r6, 14 // icount 681
srl r6, r5, r5 // icount 682
roli r3, r5, 0 // icount 683
xori r3, r1, 13 // icount 684
sll r7, r5, r2 // icount 685
sll r1, r2, r3 // icount 686
andn r6, r5, r4 // icount 687
sle r6, r5, r6 // icount 688
lbi r7, 0 // icount 689
lbi r6, 0 // icount 690
beqz r1, 32 // icount 691
xor r5, r7, r3 // icount 692
slbi r2, 15 // icount 693
xor r0, r0, r1 // icount 694
nop // to align meminst icount 695
andni r1, r1, 1 // icount 696
stu r2, r1, 10 // icount 697
slbi r2, 1 // icount 698
xor r4, r6, r1 // icount 699
srl r7, r4, r0 // icount 700
slli r7, r7, 1 // icount 701
andni r4, r4, 1 // icount 702
st r2, r4, 8 // icount 703
seq r7, r2, r1 // icount 704
add r1, r0, r6 // icount 705
roli r1, r5, 13 // icount 706
rol r6, r2, r3 // icount 707
seq r4, r5, r3 // icount 708
srl r3, r6, r3 // icount 709
slbi r3, 12 // icount 710
nop // to align meminst icount 711
andni r0, r0, 1 // icount 712
stu r0, r0, 6 // icount 713
subi r3, r2, 1 // icount 714
sll r2, r7, r0 // icount 715
addi r0, r2, 14 // icount 716
sco r5, r7, r5 // icount 717
lbi r7, 11 // icount 718
sub r4, r2, r2 // icount 719
add r6, r5, r1 // icount 720
andni r3, r2, 14 // icount 721
andni r2, r5, 3 // icount 722
srli r1, r5, 0 // icount 723
add r6, r2, r7 // icount 724
andni r1, r2, 7 // icount 725
andni r1, r0, 14 // icount 726
andn r1, r0, r5 // icount 727
add r5, r6, r1 // icount 728
j 24 // icount 729
nop // icount 730
nop // icount 731
nop // icount 732
nop // icount 733
nop // icount 734
nop // icount 735
nop // icount 736
nop // icount 737
nop // icount 738
nop // icount 739
nop // icount 740
nop // icount 741
sub r3, r4, r6 // icount 742
j 24 // icount 743
nop // icount 744
nop // icount 745
nop // icount 746
nop // icount 747
nop // icount 748
nop // icount 749
nop // icount 750
nop // icount 751
nop // icount 752
nop // icount 753
nop // icount 754
nop // icount 755
addi r1, r4, 10 // icount 756
slt r4, r7, r0 // icount 757
lbi r2, 0 // icount 758
lbi r6, 0 // icount 759
nop // to align branch icount 760
bltz r5, 12 // icount 761
sco r5, r0, r1 // icount 762
seq r6, r6, r2 // icount 763
subi r4, r1, 9 // icount 764
ror r5, r3, r0 // icount 765
andni r4, r4, 1 // icount 766
ld r3, r4, 8 // icount 767
sub r0, r5, r1 // icount 768
slli r3, r7, 3 // icount 769
andn r4, r6, r1 // icount 770
slli r6, r0, 11 // icount 771
lbi r6, 11 // icount 772
rol r2, r1, r7 // icount 773
slli r3, r3, 15 // icount 774
j 16 // icount 775
nop // icount 776
nop // icount 777
nop // icount 778
nop // icount 779
nop // icount 780
nop // icount 781
nop // icount 782
nop // icount 783
lbi r5, 0 // icount 784
lbi r2, 0 // icount 785
nop // to align branch icount 786
bltz r1, 32 // icount 787
andni r0, r2, 3 // icount 788
nop // to align meminst icount 789
andni r4, r4, 1 // icount 790
stu r0, r4, 14 // icount 791
roli r0, r1, 8 // icount 792
slli r7, r6, 15 // icount 793
andni r4, r4, 1 // icount 794
ld r2, r4, 10 // icount 795
andn r2, r6, r5 // icount 796
lbi r3, 4 // icount 797
sco r1, r3, r5 // icount 798
lbi r1, 11 // icount 799
rori r2, r6, 5 // icount 800
srli r4, r0, 1 // icount 801
andni r5, r5, 1 // icount 802
stu r5, r5, 2 // icount 803
srli r1, r0, 4 // icount 804
slli r7, r0, 10 // icount 805
slli r0, r3, 14 // icount 806
andni r5, r3, 2 // icount 807
srli r4, r1, 13 // icount 808
andn r4, r5, r7 // icount 809
seq r4, r2, r7 // icount 810
seq r4, r6, r4 // icount 811
ror r2, r7, r4 // icount 812
slbi r0, 5 // icount 813
andni r1, r1, 1 // icount 814
st r0, r1, 6 // icount 815
sle r3, r5, r2 // icount 816
xor r0, r1, r2 // icount 817
lbi r3, 13 // icount 818
rol r6, r7, r7 // icount 819
srl r2, r5, r4 // icount 820
sub r6, r2, r3 // icount 821
andni r4, r4, 1 // icount 822
ld r4, r4, 6 // icount 823
srl r4, r6, r7 // icount 824
slli r1, r7, 15 // icount 825
sub r2, r7, r5 // icount 826
lbi r6, 0 // icount 827
lbi r4, 0 // icount 828
bgez r0, 12 // icount 829
slbi r6, 7 // icount 830
slbi r4, 1 // icount 831
sco r4, r6, r7 // icount 832
rori r5, r7, 5 // icount 833
slt r2, r6, r6 // icount 834
sub r3, r4, r0 // icount 835
rori r1, r1, 6 // icount 836
add r5, r1, r6 // icount 837
andn r3, r3, r7 // icount 838
srl r5, r0, r6 // icount 839
sco r4, r1, r0 // icount 840
slbi r6, 11 // icount 841
j 30 // icount 842
nop // icount 843
nop // icount 844
nop // icount 845
nop // icount 846
nop // icount 847
nop // icount 848
nop // icount 849
nop // icount 850
nop // icount 851
nop // icount 852
nop // icount 853
nop // icount 854
nop // icount 855
nop // icount 856
nop // icount 857
slt r3, r1, r2 // icount 858
j 10 // icount 859
nop // icount 860
nop // icount 861
nop // icount 862
nop // icount 863
nop // icount 864
lbi r6, 8 // icount 865
j 28 // icount 866
nop // icount 867
nop // icount 868
nop // icount 869
nop // icount 870
nop // icount 871
nop // icount 872
nop // icount 873
nop // icount 874
nop // icount 875
nop // icount 876
nop // icount 877
nop // icount 878
nop // icount 879
nop // icount 880
srli r4, r6, 12 // icount 881
andni r0, r0, 1 // icount 882
st r2, r0, 12 // icount 883
ror r1, r2, r0 // icount 884
halt // icount 885
|
// Copyright 2020 The Defold Foundation
// Licensed under the Defold License version 1.0 (the "License"); you may not use
// this file except in compliance with the License.
//
// You may obtain a copy of the License, together with FAQs at
// https://www.defold.com/license
//
// 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 "crash.h"
#include "crash_private.h"
#include <dlib/log.h>
#include <dmsdk/dlib/json.h>
#include <dlib/math.h>
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <dlfcn.h>
#include <unistd.h>
static bool g_CrashDumpEnabled = true;
static dmCrash::FCallstackExtraInfoCallback g_CrashExtraInfoCallback = 0;
static void* g_CrashExtraInfoCallbackCtx = 0;
void dmCrash::WriteDump()
{
// WriteDump is void for js-web, see JSWriteDump.
}
void dmCrash::SetCrashFilename(const char*)
{
}
void dmCrash::PlatformPurge()
{
}
void dmCrash::InstallHandler()
{
// window.onerror is set in dmloader.js.
}
void dmCrash::EnableHandler(bool enable)
{
g_CrashDumpEnabled = enable;
}
void dmCrash::HandlerSetExtraInfoCallback(dmCrash::FCallstackExtraInfoCallback cbk, void* ctx)
{
g_CrashExtraInfoCallback = cbk;
g_CrashExtraInfoCallbackCtx = ctx;
}
extern "C" void JSWriteDump(char* json_stacktrace) {
if (!g_CrashDumpEnabled)
return;
dmCrash::g_AppState.m_PtrCount = 0;
dmCrash::g_AppState.m_Signum = 0xDEAD;
dmJson::Document doc = { 0 };
if (dmJson::Parse(json_stacktrace, &doc) == dmJson::RESULT_OK)
{
uint32_t len = dmMath::Min((size_t)(dmCrash::AppState::EXTRA_MAX - 1), strlen(json_stacktrace));
strncpy(dmCrash::g_AppState.m_Extra, json_stacktrace, len);
if (g_CrashExtraInfoCallback)
{
int extra_len = strlen(dmCrash::g_AppState.m_Extra);
g_CrashExtraInfoCallback(g_CrashExtraInfoCallbackCtx, dmCrash::g_AppState.m_Extra + extra_len, dmCrash::AppState::EXTRA_MAX - extra_len - 1);
}
dmCrash::WriteCrash(dmCrash::g_FilePath, &dmCrash::g_AppState);
dmJson::Free(&doc);
dmCrash::LogCallstack(dmCrash::g_AppState.m_Extra);
}
}
|
copyright zengfr site:http://github.com/zengfr/romhack
00042A move.l D1, (A0)+
00042C dbra D0, $42a
004D1E move.l D0, (A4)+
004D20 move.l D0, (A4)+
0207FA move.l ($2,A0), ($42,A6) [base+77D]
020800 move.w ($6,A0), ($46,A6) [base+77E, base+780]
0214F0 movea.l ($42,A6), A2
0214F4 move.w D0, D3 [base+77E, base+780]
02241A move.l ($2,A0), ($42,A6) [base+77D]
022420 move.w ($6,A0), ($46,A6) [base+77E, base+780]
0AAACA move.l (A0), D2
0AAACC move.w D0, (A0) [123p+11A, 123p+11C, 123p+11E, 123p+120, 123p+122, 123p+124, 123p+126, 123p+128, 123p+12A, enemy+BC, enemy+C0, enemy+C2, enemy+C4, enemy+CC, enemy+CE, enemy+D0, enemy+D2, enemy+D4, enemy+D6, enemy+D8, enemy+DA, enemy+DE, item+86, item+88, item+8A, item+98, item+9A, item+9C, item+9E, item+A0, item+A2, item+A4, item+A6, scr1]
0AAACE move.w D0, ($2,A0)
0AAAD2 cmp.l (A0), D0
0AAAD4 bne $aaafc
0AAAD8 move.l D2, (A0)+
0AAADA cmpa.l A0, A1 [123p+11A, 123p+11C, 123p+11E, 123p+120, 123p+122, 123p+124, 123p+126, 123p+128, 123p+12A, enemy+BC, enemy+C0, enemy+C2, enemy+C4, enemy+CC, enemy+CE, enemy+D0, enemy+D2, enemy+D4, enemy+D6, enemy+D8, enemy+DA, enemy+DE, item+86, item+88, item+8A, item+98, item+9A, item+9C, item+9E, item+A0, item+A2, item+A4, item+A6, scr1]
0AAAE6 move.l (A0), D2
0AAAE8 move.w D0, (A0) [123p+11A, 123p+11C, 123p+11E, 123p+120, 123p+122, 123p+124, 123p+126, 123p+128, 123p+12A, enemy+BC, enemy+C0, enemy+C2, enemy+C4, enemy+CC, enemy+CE, enemy+D0, enemy+D2, enemy+D4, enemy+D6, enemy+D8, enemy+DA, enemy+DE, item+86, item+88, item+8A, item+98, item+9A, item+9C, item+9E, item+A0, item+A2, item+A4, item+A6, scr1]
0AAAF4 move.l D2, (A0)+
0AAAF6 cmpa.l A0, A1 [123p+11A, 123p+11C, 123p+11E, 123p+120, 123p+122, 123p+124, 123p+126, 123p+128, 123p+12A, enemy+BC, enemy+C0, enemy+C2, enemy+C4, enemy+CC, enemy+CE, enemy+D0, enemy+D2, enemy+D4, enemy+D6, enemy+D8, enemy+DA, enemy+DE, item+86, item+88, item+8A, item+98, item+9A, item+9C, item+9E, item+A0, item+A2, item+A4, item+A6, scr1]
copyright zengfr site:http://github.com/zengfr/romhack
|
; ==========================================
; pmtest5a.asm
; 编译方法:nasm pmtest5a.asm -o pmtest5a.com
; ==========================================
%include "pm.inc" ; 常量, 宏, 以及一些说明
org 0100h
jmp LABEL_BEGIN
[SECTION .gdt]
; GDT
; 段基址, 段界限 , 属性
LABEL_GDT: Descriptor 0, 0, 0 ; 空描述符
LABEL_DESC_NORMAL: Descriptor 0, 0ffffh, DA_DRW ; Normal 描述符
LABEL_DESC_CODE32: Descriptor 0, SegCode32Len-1, DA_C+DA_32; 非一致代码段,32
LABEL_DESC_CODE16: Descriptor 0, 0ffffh, DA_C ; 非一致代码段,16
LABEL_DESC_CODE_DEST: Descriptor 0, SegCodeDestLen-1, DA_C+DA_32; 非一致代码段,32
LABEL_DESC_CODE_RING3: Descriptor 0,SegCodeRing3Len-1, DA_C+DA_32+DA_DPL3
LABEL_DESC_DATA: Descriptor 0, DataLen-1, DA_DRW ; Data
LABEL_DESC_STACK: Descriptor 0, TopOfStack, DA_DRWA+DA_32;Stack, 32 位
LABEL_DESC_STACK3: Descriptor 0, TopOfStack3, DA_DRWA+DA_32+DA_DPL3
LABEL_DESC_LDT: Descriptor 0, LDTLen-1, DA_LDT ; LDT
LABEL_DESC_VIDEO: Descriptor 0B8000h, 0ffffh, DA_DRW+DA_DPL3
; 门 目标选择子,偏移,DCount, 属性
LABEL_CALL_GATE_TEST: Gate SelectorCodeDest, 0, 0, DA_386CGate+DA_DPL3
; GDT 结束
GdtLen equ $ - LABEL_GDT ; GDT长度
GdtPtr dw GdtLen - 1 ; GDT界限
dd 0 ; GDT基地址
; GDT 选择子
SelectorNormal equ LABEL_DESC_NORMAL - LABEL_GDT
SelectorCode32 equ LABEL_DESC_CODE32 - LABEL_GDT
SelectorCode16 equ LABEL_DESC_CODE16 - LABEL_GDT
SelectorCodeDest equ LABEL_DESC_CODE_DEST - LABEL_GDT
SelectorCodeRing3 equ LABEL_DESC_CODE_RING3 - LABEL_GDT + SA_RPL3
SelectorData equ LABEL_DESC_DATA - LABEL_GDT
SelectorStack equ LABEL_DESC_STACK - LABEL_GDT
SelectorStack3 equ LABEL_DESC_STACK3 - LABEL_GDT + SA_RPL3
SelectorLDT equ LABEL_DESC_LDT - LABEL_GDT
SelectorVideo equ LABEL_DESC_VIDEO - LABEL_GDT
SelectorCallGateTest equ LABEL_CALL_GATE_TEST - LABEL_GDT + SA_RPL3
; END of [SECTION .gdt]
[SECTION .data1] ; 数据段
ALIGN 32
[BITS 32]
LABEL_DATA:
SPValueInRealMode dw 0
; 字符串
PMMessage: db "In Protect Mode now. ^-^", 0 ; 进入保护模式后显示此字符串
OffsetPMMessage equ PMMessage - $$
StrTest: db "ABCDEFGHIJKLMNOPQRSTUVWXYZ", 0
OffsetStrTest equ StrTest - $$
DataLen equ $ - LABEL_DATA
; END of [SECTION .data1]
; 全局堆栈段
[SECTION .gs]
ALIGN 32
[BITS 32]
LABEL_STACK:
times 512 db 0
TopOfStack equ $ - LABEL_STACK - 1
; END of [SECTION .gs]
; 堆栈段ring3
[SECTION .s3]
ALIGN 32
[BITS 32]
LABEL_STACK3:
times 512 db 0
TopOfStack3 equ $ - LABEL_STACK3 - 1
; END of [SECTION .s3]
[SECTION .s16]
[BITS 16]
LABEL_BEGIN:
mov ax, cs
mov ds, ax
mov es, ax
mov ss, ax
mov sp, 0100h
mov [LABEL_GO_BACK_TO_REAL+3], ax
mov [SPValueInRealMode], sp
; 初始化 16 位代码段描述符
mov ax, cs
movzx eax, ax
shl eax, 4
add eax, LABEL_SEG_CODE16
mov word [LABEL_DESC_CODE16 + 2], ax
shr eax, 16
mov byte [LABEL_DESC_CODE16 + 4], al
mov byte [LABEL_DESC_CODE16 + 7], ah
; 初始化 32 位代码段描述符
xor eax, eax
mov ax, cs
shl eax, 4
add eax, LABEL_SEG_CODE32
mov word [LABEL_DESC_CODE32 + 2], ax
shr eax, 16
mov byte [LABEL_DESC_CODE32 + 4], al
mov byte [LABEL_DESC_CODE32 + 7], ah
; 初始化测试调用门的代码段描述符
xor eax, eax
mov ax, cs
shl eax, 4
add eax, LABEL_SEG_CODE_DEST
mov word [LABEL_DESC_CODE_DEST + 2], ax
shr eax, 16
mov byte [LABEL_DESC_CODE_DEST + 4], al
mov byte [LABEL_DESC_CODE_DEST + 7], ah
; 初始化数据段描述符
xor eax, eax
mov ax, ds
shl eax, 4
add eax, LABEL_DATA
mov word [LABEL_DESC_DATA + 2], ax
shr eax, 16
mov byte [LABEL_DESC_DATA + 4], al
mov byte [LABEL_DESC_DATA + 7], ah
; 初始化堆栈段描述符
xor eax, eax
mov ax, ds
shl eax, 4
add eax, LABEL_STACK
mov word [LABEL_DESC_STACK + 2], ax
shr eax, 16
mov byte [LABEL_DESC_STACK + 4], al
mov byte [LABEL_DESC_STACK + 7], ah
; 初始化堆栈段描述符(Ring3)
xor eax, eax
mov ax, ds
shl eax, 4
add eax, LABEL_STACK3
mov word [LABEL_DESC_STACK3 + 2], ax
shr eax, 16
mov byte [LABEL_DESC_STACK3 + 4], al
mov byte [LABEL_DESC_STACK3 + 7], ah
; 初始化 LDT 在 GDT 中的描述符
xor eax, eax
mov ax, ds
shl eax, 4
add eax, LABEL_LDT
mov word [LABEL_DESC_LDT + 2], ax
shr eax, 16
mov byte [LABEL_DESC_LDT + 4], al
mov byte [LABEL_DESC_LDT + 7], ah
; 初始化 LDT 中的描述符
xor eax, eax
mov ax, ds
shl eax, 4
add eax, LABEL_CODE_A
mov word [LABEL_LDT_DESC_CODEA + 2], ax
shr eax, 16
mov byte [LABEL_LDT_DESC_CODEA + 4], al
mov byte [LABEL_LDT_DESC_CODEA + 7], ah
; 初始化Ring3描述符
xor eax, eax
mov ax, ds
shl eax, 4
add eax, LABEL_CODE_RING3
mov word [LABEL_DESC_CODE_RING3 + 2], ax
shr eax, 16
mov byte [LABEL_DESC_CODE_RING3 + 4], al
mov byte [LABEL_DESC_CODE_RING3 + 7], ah
; 为加载 GDTR 作准备
xor eax, eax
mov ax, ds
shl eax, 4
add eax, LABEL_GDT ; eax <- gdt 基地址
mov dword [GdtPtr + 2], eax ; [GdtPtr + 2] <- gdt 基地址
; 加载 GDTR
lgdt [GdtPtr]
; 关中断
cli
; 打开地址线A20
in al, 92h
or al, 00000010b
out 92h, al
; 准备切换到保护模式
mov eax, cr0
or eax, 1
mov cr0, eax
; 真正进入保护模式
jmp dword SelectorCode32:0 ; 执行这一句会把 SelectorCode32 装入 cs, 并跳转到 Code32Selector:0 处
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
LABEL_REAL_ENTRY: ; 从保护模式跳回到实模式就到了这里
mov ax, cs
mov ds, ax
mov es, ax
mov ss, ax
mov sp, [SPValueInRealMode]
in al, 92h ; ┓
and al, 11111101b ; ┣ 关闭 A20 地址线
out 92h, al ; ┛
sti ; 开中断
mov ax, 4c00h ; ┓
int 21h ; ┛回到 DOS
; END of [SECTION .s16]
[SECTION .s32]; 32 位代码段. 由实模式跳入.
[BITS 32]
LABEL_SEG_CODE32:
mov ax, SelectorData
mov ds, ax ; 数据段选择子
mov ax, SelectorVideo
mov gs, ax ; 视频段选择子
mov ax, SelectorStack
mov ss, ax ; 堆栈段选择子
mov esp, TopOfStack
; 下面显示一个字符串
mov ah, 0Ch ; 0000: 黑底 1100: 红字
xor esi, esi
xor edi, edi
mov esi, OffsetPMMessage ; 源数据偏移
mov edi, (80 * 10 + 0) * 2 ; 目的数据偏移。屏幕第 10 行, 第 0 列。
cld
.1:
lodsb
test al, al
jz .2
mov [gs:edi], ax
add edi, 2
jmp .1
.2: ; 显示完毕
call DispReturn
push SelectorStack3
push TopOfStack3
push SelectorCodeRing3
push 0
retf
; 测试调用门(无特权级变换),将打印字母 'C'
call SelectorCallGateTest:0
;call SelectorCodeDest:0
; Load LDT
mov ax, SelectorLDT
lldt ax
jmp SelectorLDTCodeA:0 ; 跳入局部任务,将打印字母 'L'。
; ------------------------------------------------------------------------
DispReturn:
push eax
push ebx
mov eax, edi
mov bl, 160
div bl
and eax, 0FFh
inc eax
mov bl, 160
mul bl
mov edi, eax
pop ebx
pop eax
ret
; DispReturn 结束---------------------------------------------------------
SegCode32Len equ $ - LABEL_SEG_CODE32
; END of [SECTION .s32]
[SECTION .sdest]; 调用门目标段
[BITS 32]
LABEL_SEG_CODE_DEST:
mov ax, SelectorVideo
mov gs, ax ; 视频段选择子(目的)
mov edi, (80 * 12 + 0) * 2 ; 屏幕第 12 行, 第 0 列。
mov ah, 0Ch ; 0000: 黑底 1100: 红字
mov al, 'C'
mov [gs:edi], ax
retf
SegCodeDestLen equ $ - LABEL_SEG_CODE_DEST
; END of [SECTION .sdest]
; 16 位代码段. 由 32 位代码段跳入, 跳出后到实模式
[SECTION .s16code]
ALIGN 32
[BITS 16]
LABEL_SEG_CODE16:
; 跳回实模式:
mov ax, SelectorNormal
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
mov ss, ax
mov eax, cr0
and al, 11111110b
mov cr0, eax
LABEL_GO_BACK_TO_REAL:
jmp 0:LABEL_REAL_ENTRY ; 段地址会在程序开始处被设置成正确的值
Code16Len equ $ - LABEL_SEG_CODE16
; END of [SECTION .s16code]
; LDT
[SECTION .ldt]
ALIGN 32
LABEL_LDT:
; 段基址 段界限 , 属性
LABEL_LDT_DESC_CODEA: Descriptor 0, CodeALen - 1, DA_C + DA_32 ; Code, 32 位
LDTLen equ $ - LABEL_LDT
; LDT 选择子
SelectorLDTCodeA equ LABEL_LDT_DESC_CODEA - LABEL_LDT + SA_TIL
; END of [SECTION .ldt]
; CodeA (LDT, 32 位代码段)
[SECTION .la]
ALIGN 32
[BITS 32]
LABEL_CODE_A:
mov ax, SelectorVideo
mov gs, ax ; 视频段选择子(目的)
mov edi, (80 * 13 + 0) * 2 ; 屏幕第 13 行, 第 0 列。
mov ah, 0Ch ; 0000: 黑底 1100: 红字
mov al, 'L'
mov [gs:edi], ax
; 准备经由16位代码段跳回实模式
jmp SelectorCode16:0
CodeALen equ $ - LABEL_CODE_A
; END of [SECTION .la]
; CodeRing3
[SECTION .ring3]
ALIGN 32
[BITS 32]
LABEL_CODE_RING3:
mov ax, SelectorVideo
mov gs, ax
mov edi, (80 * 14 + 0) * 2
mov ah, 0Ch
mov al, '3'
mov [gs:edi], ax
call SelectorCallGateTest:0
jmp $
SegCodeRing3Len equ $ - LABEL_CODE_RING3
; END of [SECTION .ring3]
|
;=============================================================================================================
;
; Pong classic game
;
; Jacinto Mba Cantero <github.com/jacmba>
; 2020
;
;=============================================================================================================
.inesprg 1
.ineschr 1
.inesmir 1
.inesmap 0
.bank 0
.org $8000
;--------------------------------------------------------------------------------------------------------------
; Startup code
;--------------------------------------------------------------------------------------------------------------
Reset:
; Disable IRQs and decimal mode
sei
cld
; Disable API IRQ
ldx #$40
stx $4017
; Setup stack
ldx #$FF
txs
; Disable NMI, rendering and IRQs
inx
stx $2000
stx $2001
stx $4010
bit $2002
jsr WaitVBlank
; Clear memory
ldx #$00
txa
Clearmem:
sta $0000, x
sta $0100, x
sta $0300, x
sta $0400, x
sta $0500, x
sta $0600, x
sta $0700, x
inx
bne Clearmem
ldx #$00
lda #$FF
ClearVmem: ;Cleanup sprite RAM
sta $0200, x
inx
bne ClearVmem
jsr Initialize
jsr WaitVBlank
nop
PPUSetup:
lda #%10010000
sta $2000
lda #%00010000
sta $2001 |
// Test ATARI chipset variations
// Pointer to struct versus MAcro pointer to struct
// Commodore 64 PRG executable file
.file [name="chipset-test.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
.label PIA2 = $d300
.segment Code
main: {
// PIA1.porta = 7
lda #7
sta $d300
// PIA2->PORTA = 7
sta PIA2
// }
rts
}
|
.macosx_version_min 10, 12
.section __TEXT,__text,regular,pure_instructions
_read_markers:
pushl %ebp
movl %esp, %ebp
pushl %ebx
pushl %edi
pushl %esi
subl $604, %esp
call L00000011
L00000011:
popl %eax
movl %eax, -568(%ebp)
movl 8(%ebp), %edx
movl L___stack_chk_guard$non_lazy_ptr-L00000011(%eax), %eax
movl %eax, -588(%ebp)
movl (%eax), %eax
movl %eax, -16(%ebp)
movl 472(%edx), %edi
jmp L0000004E
L00000034:
.align 4, 0x90
L00000040:
movl $0, 472(%esi)
xorl %edi, %edi
movl %esi, %edx
L0000004E:
testl %edi, %edi
jne L00000140
L00000056:
movl 496(%edx), %eax
cmpl $0, 12(%eax)
je L00000082
L00000062:
movl %edx, %ecx
movl %edx, %esi
call _next_marker
L0000006B:
xorl %ebx, %ebx
testl %eax, %eax
je L00000246
L00000075:
movl 472(%esi), %edi
movl %esi, %edx
jmp L00000140
L00000082:
movl 24(%edx), %ecx
movl 4(%ecx), %ebx
testl %ebx, %ebx
jne L000000A7
L0000008C:
movl %edx, (%esp)
movl %edx, %esi
movl %ecx, %edi
call *12(%edi)
L00000096:
xorl %ebx, %ebx
testl %eax, %eax
je L00000246
L000000A0:
movl 4(%edi), %ebx
movl %esi, %edx
movl %edi, %ecx
L000000A7:
movl (%ecx), %esi
decl %ebx
movzbl (%esi), %eax
movl %eax, -572(%ebp)
je L000000B8
L000000B5:
incl %esi
jmp L000000D7
L000000B8:
movl %edx, (%esp)
movl %edx, %esi
movl %ecx, %edi
call *12(%edi)
L000000C2:
xorl %ebx, %ebx
testl %eax, %eax
je L00000246
L000000CC:
movl %esi, %eax
movl (%edi), %esi
movl 4(%edi), %ebx
movl %eax, %edx
movl %edi, %ecx
L000000D7:
decl %ebx
movb (%esi), %al
incl %esi
movzbl %al, %edi
cmpl $255, -572(%ebp)
jne L000000F4
L000000EA:
movzbl %al, %eax
cmpl $216, %eax
je L00000132
L000000F4:
movl (%edx), %eax
movl %eax, -576(%ebp)
movl $53, 20(%eax)
movl -572(%ebp), %eax
movl -576(%ebp), %edx
movl %eax, 24(%edx)
movl -576(%ebp), %eax
movl %edi, 28(%eax)
movl 8(%ebp), %edx
movl %edx, (%esp)
movl %ecx, -572(%ebp)
call *(%eax)
L00000129:
movl -572(%ebp), %ecx
movl 8(%ebp), %edx
L00000132:
movl %edi, 472(%edx)
movl %esi, (%ecx)
movl %ebx, 4(%ecx)
.align 4, 0x90
L00000140:
cmpl $191, %edi
jg L00000150
L00000148:
cmpl $1, %edi
jne L00000190
L0000014D:
jmp L000001B0
L0000014F:
.align 4, 0x90
L00000150:
leal -192(%edi), %eax
cmpl $62, %eax
ja L00000190
L0000015B:
movl -568(%ebp), %ecx
movl L00000258-L00000011(%ecx,%eax,4), %eax
addl %ecx, %eax
jmp *%eax
L0000016C:
movl 496(%edx), %eax
movl %edx, (%esp)
movl %edx, %esi
call *-864(%eax,%edi,4)
L0000017E:
xorl %ebx, %ebx
L00000180:
testl %eax, %eax
jne L00000040
L00000188:
jmp L00000246
L0000018D:
.align 4, 0x90
L00000190:
movl (%edx), %eax
movl $68, 20(%eax)
L00000199:
movl %edi, 24(%eax)
movl %edx, (%esp)
movl %edx, %esi
call *(%eax)
L000001A3:
jmp L00000040
L000001A8:
.align 4, 0x90
L000001B0:
movl (%edx), %eax
movl $92, 20(%eax)
movl %edi, 24(%eax)
movl %edx, (%esp)
movl $1, 4(%esp)
movl %edx, %esi
call *4(%eax)
L000001CC:
jmp L00000040
L000001D1:
movl (%edx), %eax
movl $60, 20(%eax)
jmp L00000199
L000001DC:
movl $0, (%esp)
jmp L0000022D
L000001E5:
movl %edx, (%esp)
movl %edx, %esi
call _skip_variable
L000001EF:
jmp L0000017E
L000001F1:
movl $0, (%esp)
jmp L00000246
L000001FA:
movl 24(%edx), %esi
movl 4(%esi), %ebx
testl %ebx, %ebx
jne L00000215
L00000204:
movl %edx, (%esp)
movl %edx, %edi
call *12(%esi)
L0000020C:
testl %eax, %eax
je L00000246
L00000210:
movl 4(%esi), %ebx
movl %edi, %edx
L00000215:
movl (%esi), %edi
movzbl (%edi), %ecx
decl %ebx
je L00000246
L0000021D:
movl %esi, -572(%ebp)
incl %edi
jmp L00000246
L00000226:
movl $1, (%esp)
L0000022D:
xorl %ebx, %ebx
movl %edx, %esi
xorl %edx, %edx
movl %esi, %ecx
call _get_sof
L0000023A:
jmp L00000180
L0000023F:
movl $1, (%esp)
L00000246:
movl %ebx, %eax
addl $604, %esp
popl %esi
popl %edi
popl %ebx
popl %ebp
ret
L00000253:
call ___stack_chk_fail
.align 2, 0x90
L00000258:
.long L000001DC-L00000011
.long L000001DC-L00000011
.long L000001F1-L00000011
.long L000001D1-L00000011
.long L000001FA-L00000011
.long L000001D1-L00000011
.long L000001D1-L00000011
.long L000001D1-L00000011
.long L000001D1-L00000011
.long L00000226-L00000011
.long L0000023F-L00000011
.long L000001D1-L00000011
.long L000001E5-L00000011
.long L000001D1-L00000011
.long L000001D1-L00000011
.long L000001D1-L00000011
.long L000001B0-L00000011
.long L000001B0-L00000011
.long L000001B0-L00000011
.long L000001B0-L00000011
.long L000001B0-L00000011
.long L000001B0-L00000011
.long L000001B0-L00000011
.long L000001B0-L00000011
.long L00000246-L00000011
.long L00000246-L00000011
.long L00000246-L00000011
.long L00000246-L00000011
.long L000001E5-L00000011
.long L00000246-L00000011
.long L00000190-L00000011
.long L00000190-L00000011
.long L0000016C-L00000011
.long L0000016C-L00000011
.long L0000016C-L00000011
.long L0000016C-L00000011
.long L0000016C-L00000011
.long L0000016C-L00000011
.long L0000016C-L00000011
.long L0000016C-L00000011
.long L0000016C-L00000011
.long L0000016C-L00000011
.long L0000016C-L00000011
.long L0000016C-L00000011
.long L0000016C-L00000011
.long L0000016C-L00000011
.long L0000016C-L00000011
.long L0000016C-L00000011
.long L00000190-L00000011
.long L00000190-L00000011
.long L00000190-L00000011
.long L00000190-L00000011
.long L00000190-L00000011
.long L00000190-L00000011
.long L00000190-L00000011
.long L00000190-L00000011
.long L00000190-L00000011
.long L00000190-L00000011
.long L00000190-L00000011
.long L00000190-L00000011
.long L00000190-L00000011
.long L00000190-L00000011
.long L00000246-L00000011
# ----------------------
.section __IMPORT,__pointers,non_lazy_symbol_pointers
L___stack_chk_guard$non_lazy_ptr:
.indirect_symbol ___stack_chk_guard
.long 0
# ----------------------
L_jpeg_natural_order$non_lazy_ptr:
.indirect_symbol _jpeg_natural_order
.long 0
# ----------------------
.subsections_via_symbols
|
;/*!
; @file
;
; @brief BvsReadCharStr DOS wrapper
;
; (c) osFree Project 2021, <http://www.osFree.org>
; for licence see licence.txt in root directory, or project website
;
; This is Family API implementation for DOS, used with BIND tools
; to link required API
;
; @author Yuri Prokushev (yuri.prokushev@gmail.com)
;
;
;*/
.8086
; Helpers
INCLUDE HELPERS.INC
INCLUDE BIOS.INC
INCLUDE BSEERR.INC
_TEXT SEGMENT BYTE PUBLIC 'CODE' USE16
@BVSPROLOG BVSREADCHARSTR
VIOHANDLE DW ? ;Video handle
COLUMN DW ? ;Starting column
ROW DW ? ;Starting row
SLENGTH DD ?
CHARSTR DD ?
@BVSSTART BVSREADCHARSTR
EXTERN VIOGOTOXYH: PROC
MOV BX,[DS:BP].ARGS.VIOHANDLE ; GET HANDLE
MOV CX,[DS:BP].ARGS.ROW ; GET ROW
MOV DX,[DS:BP].ARGS.COLUMN ; GET COLUMN
CALL VIOGOTOXYH
JNZ EXIT
MOV AX,0B800H ; OFFSET FOR COLOR CARD
MOV SI,DI ; GET THE ADDRESS AS SOURCE INDEX???
MOV DS,AX ; DS:SI IS NOW SET UP
LES DI,[DS:BP].ARGS.SLENGTH ; GET LENGTH POINTER
MOV CX,ES:[DI] ; GET LENGTH
LES DI,[DS:BP].ARGS.CHARSTR ; GET THE POINTER IN ES:DI
F13_100:
MOVSB ; MOVE A BYTE
INC DI ; GET PAST ATTRIBUTE
LOOP F13_100 ; DO THE NEXT ONE
XOR AX,AX ; SUCCESSFUL RETURN
EXIT:
@BVSEPILOG BVSREADCHARSTR
_TEXT ENDS
END
|
#pragma once
#include "renderer/context.hpp"
namespace engine
{
template <typename T>
concept Pass = requires(T t, RenderContext r, ViewportContext v)
{
t.initialize(v);
t.render(v, r);
};
} // namespace engine |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.